:root {
    /* Brand */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-900: #1e3a8a;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 64px;
    --header-height: 64px;
    --card-radius: 12px;
    --btn-radius: 8px;
    --input-radius: 8px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    z-index: 1040;
    transition: width .2s ease;
    display: flex;
    flex-direction: column;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar .brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-weight: 700;
    font-size: 18px;
    color: var(--brand-700);
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .brand span { display: none; }
.sidebar .nav-section {
    padding: 16px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .nav-section { text-align: center; padding: 16px 0 4px; }
.sidebar .nav-item {
    margin: 2px 8px;
}
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--btn-radius);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s ease;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar .nav-link:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}
.sidebar .nav-link.active {
    background: var(--brand-50);
    color: var(--brand-700);
}
.sidebar .nav-link .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar .nav-link .nav-icon svg { width: 18px; height: 18px; }
.sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 10px; }
.sidebar .sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--gray-100);
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left .2s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* Top header */
.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.top-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
}
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb .current { color: var(--gray-900); font-weight: 600; }

/* Cards */
.card {
    border: 1px solid var(--gray-200);
    border-radius: var(--card-radius);
    box-shadow: 0 1px 2px rgba(0,0,0,.02);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    padding: 16px 20px;
}

/* KPI Cards */
.kpi-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--card-radius);
    background: #fff;
    padding: 20px;
    transition: all .15s ease;
    position: relative;
}
.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
    transform: translateY(-1px);
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-icon svg { width: 20px; height: 20px; }

/* Tables */
.table {
    margin-bottom: 0;
}
.table thead th {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 16px;
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
}

/* Buttons */
.btn {
    border-radius: var(--btn-radius);
    font-weight: 500;
    padding: 8px 16px;
    font-size: 14px;
    transition: all .15s ease;
}
.btn-primary {
    background: var(--brand-600);
    border-color: var(--brand-600);
}
.btn-primary:hover {
    background: var(--brand-700);
    border-color: var(--brand-700);
}

/* Forms */
.form-control, .form-select {
    border-radius: var(--input-radius);
    border: 1px solid var(--gray-300);
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
}

/* Utilities */
.text-brand { color: var(--brand-600) !important; }
.bg-brand { background: var(--brand-600) !important; }
.bg-brand-50 { background: var(--brand-50) !important; }
.bg-brand-100 { background: var(--brand-100) !important; }

/* Page header */
.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.page-header p {
    color: var(--gray-500);
    font-size: 14px;
    margin: 4px 0 0;
}

/* Quick actions */
.quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--btn-radius);
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .15s ease;
}
.quick-action:hover {
    border-color: var(--brand-300);
    background: var(--brand-50);
    color: var(--brand-700);
    transform: translateY(-1px);
}

/* Alerts */
.alert {
    border-radius: var(--btn-radius);
    border: none;
    padding: 12px 16px;
    font-size: 14px;
}

/* Auth */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
}
.auth-card {
    width: 100%;
    max-width: 420px;
}

/* Print */
@media print {
    .sidebar, .top-header, .no-print, .btn, form, .quick-action, .page-header, .kpi-card { display: none !important; }
    body { background: #fff !important; color: #000 !important; font-size: 11px; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .container-fluid { padding: 0 !important; max-width: 100% !important; }
    .card { border: none !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; border-radius: 0 !important; }
    .card-body { padding: 0 !important; }
    .card-header { display: none !important; }
    .table { font-size: 11px; }
    .table thead th { background: #fff !important; border-bottom: 1px solid #000 !important; color: #000 !important; }
    .table tbody td { border-bottom: 1px solid #ccc !important; padding: 4px 8px !important; }
    h1, h2, h3, h4, h5, h6 { color: #000 !important; margin: 0 !important; padding: 0 !important; }
    p { margin: 0 !important; padding: 0 !important; }
    .badge { border: 1px solid #000 !important; color: #000 !important; background: none !important; }
    a { text-decoration: none !important; color: #000 !important; }
    .text-muted { color: #333 !important; }
    .text-danger, .text-success, .text-warning, .text-info, .text-brand { color: #000 !important; }
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
}
