@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* ╔══════════════════════════════════════════════════════════════╗
   ║  JAZ TRUST SYSTEM — Premium Design System v3.0              ║
   ║  A unique, non-generic accounting UI with layered surfaces  ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ===== DESIGN TOKENS ===== */
:root {
    /* Brand Identity - Unique teal/cyan palette */
    --brand-50: #ecfeff;
    --brand-100: #cffafe;
    --brand-200: #a5f3fc;
    --brand-300: #67e8f9;
    --brand-400: #22d3ee;
    --brand-500: #06b6d4;
    --brand-600: #0891b2;
    --brand-700: #0e7490;
    --brand-800: #155e75;
    --brand-900: #164e63;

    /* Accent - Warm amber for contrast */
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;

    /* Semantic Colors */
    --success: #34d399;
    --success-muted: rgba(52, 211, 153, 0.15);
    --danger: #f87171;
    --danger-muted: rgba(248, 113, 113, 0.15);
    --warning: #fbbf24;
    --warning-muted: rgba(251, 191, 36, 0.15);
    --info: #60a5fa;
    --info-muted: rgba(96, 165, 250, 0.15);

    /* ===== DARK THEME (Default) ===== */
    --bg-root: #0a0e1a;
    --bg-canvas: #0f1420;
    --bg-surface-1: rgba(17, 24, 39, 0.85);
    --bg-surface-2: rgba(22, 30, 48, 0.75);
    --bg-surface-3: rgba(30, 41, 59, 0.6);
    --bg-elevated: rgba(30, 41, 59, 0.95);
    --bg-overlay: rgba(0, 0, 0, 0.65);

    /* Text Hierarchy */
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;
    --text-brand: var(--brand-400);

    /* Borders & Dividers */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --border-brand: rgba(6, 182, 212, 0.3);

    /* Glassmorphism */
    --glass-blur: 20px;
    --glass-saturate: 1.8;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 30px rgba(6, 182, 212, 0.15);
    --shadow-glow-brand: 0 0 40px rgba(6, 182, 212, 0.25);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 0px;

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 50;
    --z-sticky: 60;
    --z-sidebar: 70;
    --z-modal: 100;
    --z-toast: 200;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Cairo', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-root);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated mesh gradient background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(6, 182, 212, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse 60% 80% at 85% 75%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ===== LAYOUT SYSTEM ===== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface-1);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-base), width var(--transition-base);
    overflow: hidden;
}

/* Subtle gradient accent line at the top of sidebar */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-400), var(--brand-600), var(--accent-500));
    z-index: 1;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.sidebar-logo {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--brand-300) 0%, var(--brand-500) 50%, var(--accent-400) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 6s ease infinite;
    margin-bottom: var(--space-1);
}

@keyframes gradientText {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.sidebar-subtitle {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
    gap: var(--space-3);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--brand-300);
    background: rgba(6, 182, 212, 0.08);
    font-weight: 600;
}

/* Active indicator bar */
.nav-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.nav-icon {
    font-size: 1.15rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
    transition: transform var(--transition-smooth);
}

.nav-item:hover .nav-icon {
    transform: scale(1.15);
}

.nav-item.active .nav-icon {
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: var(--space-8) var(--space-10);
    width: calc(100% - var(--sidebar-width));
    transition: all var(--transition-base);
    min-height: 100vh;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: var(--space-8);
    animation: fadeSlideUp 0.5s ease-out;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.page-subtitle {
    color: var(--text-tertiary);
    font-size: 0.92rem;
    font-weight: 400;
}

/* ===== STATISTICS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--bg-surface-2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 60%, rgba(6, 182, 212, 0.03));
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all var(--transition-smooth);
}

.stat-icon.primary {
    background: rgba(6, 182, 212, 0.12);
    color: var(--brand-400);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
}

.stat-icon.secondary {
    background: var(--success-muted);
    color: var(--success);
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.1);
}

.stat-icon.accent {
    background: var(--warning-muted);
    color: var(--warning);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
}

.stat-icon.danger {
    background: var(--danger-muted);
    color: var(--danger);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.1);
}

.stat-card:hover .stat-icon {
    transform: scale(1.08) rotate(3deg);
}

/* Subtle animated bottom border on hover */
.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--brand-400), var(--accent-400));
    transition: width 0.5s ease;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stat-card:hover::after {
    width: 100%;
}

.stat-info h3 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-info p {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--space-1);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-surface-2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: var(--space-3) var(--space-4);
    vertical-align: middle;
    text-align: right;
}

th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-default);
}

td {
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: background var(--transition-fast);
}

td.number {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

th.number {
    text-align: right;
}

tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

tr:hover td {
    background: rgba(6, 182, 212, 0.04);
}

/* ===== BADGES ===== */
.badge {
    padding: 0.3em 0.75em;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.badge-primary {
    background: rgba(6, 182, 212, 0.15);
    color: var(--brand-300);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-success {
    background: var(--success-muted);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-warning {
    background: var(--warning-muted);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-danger {
    background: var(--danger-muted);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ===== BUTTONS ===== */
.btn {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
    border-color: var(--border-default);
}

/* ===== FORMS & INPUTS ===== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
    background: rgba(0, 0, 0, 0.3);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

select.form-control option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    z-index: var(--z-modal);
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.96);
    transition: all var(--transition-spring);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    background: rgba(0, 0, 0, 0.1);
}

/* ===== MOBILE TOGGLE ===== */
.menu-toggle {
    display: none;
    background: var(--bg-surface-1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-default);
    width: 44px;
    height: 44px;
    position: relative;
    z-index: calc(var(--z-sidebar) + 10);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.menu-toggle:hover {
    border-color: var(--brand-500);
}

.hamburger {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: all var(--transition-base);
    border-radius: 2px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    position: absolute;
    left: 0;
    transition: all var(--transition-base);
    border-radius: 2px;
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.menu-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* ===== FILTER SECTION ===== */
.filter-section {
    background: rgba(6, 182, 212, 0.04);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border-subtle);
}

/* ===== FILE UPLOAD ===== */
.file-upload {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-10) var(--space-6);
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    transition: all var(--transition-base);
    cursor: pointer;
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--brand-500);
    background: rgba(6, 182, 212, 0.04);
}

.file-upload-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    opacity: 0.7;
}

.upload-area {
    width: 100%;
}

/* ===== MULTI-SELECT ===== */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-display {
    padding: var(--space-3) var(--space-4);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    min-height: 44px;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    transition: border-color var(--transition-fast);
}

.multi-select-display:hover {
    border-color: var(--border-strong);
}

.multi-select-tag {
    background: rgba(6, 182, 212, 0.15);
    color: var(--brand-300);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(6, 182, 212, 0.2);
    font-weight: 500;
}

.multi-select-tag button {
    background: transparent;
    border: none;
    color: var(--brand-300);
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 2px;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
    box-shadow: var(--shadow-lg);
}

.multi-select-dropdown.show {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1px;
    padding: var(--space-2);
}

.multi-select-option {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: background var(--transition-fast);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.multi-select-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.multi-select-option.selected {
    background: rgba(6, 182, 212, 0.08);
    color: var(--brand-300);
}

.placeholder {
    color: var(--text-tertiary);
}

/* ===== TEXT UTILITIES ===== */
.text-center {
    text-align: center !important;
}

.text-muted {
    color: var(--text-tertiary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

/* ===== ALERTS ===== */
.alert {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-muted);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-muted);
    border-color: rgba(248, 113, 113, 0.25);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-muted);
    border-color: rgba(251, 191, 36, 0.25);
    color: var(--warning);
}

/* ===== EMPTY STATES ===== */
.empty-state {
    padding: var(--space-12) var(--space-6) !important;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    color: var(--text-tertiary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(6, 182, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Staggered card entrance */
.stat-card {
    animation: fadeSlideUp 0.4s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 80ms; }
.stat-card:nth-child(3) { animation-delay: 160ms; }
.stat-card:nth-child(4) { animation-delay: 240ms; }
.stat-card:nth-child(5) { animation-delay: 320ms; }
.stat-card:nth-child(6) { animation-delay: 400ms; }

.card {
    animation: fadeSlideUp 0.5s ease-out both;
    animation-delay: 200ms;
}

/* ===== HEADER TOOLBAR (in sidebar footer) ===== */
.header-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-right: 0;
        width: 100%;
        padding: var(--space-5);
        padding-top: calc(var(--space-5) + 60px);
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: var(--space-4);
        top: var(--space-4);
    }

    .page-title {
        font-size: 1.35rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .stat-info p {
        font-size: 0.72rem;
    }

    th,
    td {
        padding: var(--space-2);
        font-size: 0.8rem;
    }

    .modal {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 85vh;
    }

    .card-header {
        flex-direction: column;
        gap: var(--space-3);
        align-items: flex-start;
    }

    .btn-sm {
        padding: var(--space-2) var(--space-3);
        font-size: 0.78rem;
    }

    .header-toolbar {
        position: static !important;
        margin-top: var(--space-2);
        justify-content: flex-start;
    }

    .filter-section {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .main-content {
        padding: var(--space-4);
        padding-top: calc(var(--space-4) + 60px);
    }

    .page-header {
        margin-bottom: var(--space-5);
    }

    .stat-info h3 {
        font-size: 1.15rem;
    }
}

/* ===================================================
   LIGHT THEME
   =================================================== */
[data-theme="light"] {
    --bg-root: #f8fafc;
    --bg-canvas: #f1f5f9;
    --bg-surface-1: rgba(255, 255, 255, 0.92);
    --bg-surface-2: rgba(255, 255, 255, 0.88);
    --bg-surface-3: rgba(255, 255, 255, 0.75);
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(15, 23, 42, 0.45);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-inverse: #f8fafc;
    --text-brand: var(--brand-600);

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.18);
    --border-brand: rgba(6, 182, 212, 0.25);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(6, 182, 212, 0.08);
    --shadow-glow-brand: 0 0 40px rgba(6, 182, 212, 0.12);
}

[data-theme="light"] body {
    background-color: var(--bg-root);
    color: var(--text-primary);
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(6, 182, 212, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 60% 80% at 85% 75%, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
}

/* Light theme — Sidebar */
[data-theme="light"] .sidebar {
    background: var(--bg-surface-1);
    border-left-color: var(--border-default);
}

[data-theme="light"] .sidebar-logo {
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 50%, var(--accent-600) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .nav-item {
    color: var(--text-secondary);
}

[data-theme="light"] .nav-item:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .nav-item.active {
    color: var(--brand-700);
    background: rgba(6, 182, 212, 0.06);
}

/* Light theme — Cards */
[data-theme="light"] .card {
    background: var(--bg-surface-2);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .card:hover {
    box-shadow: var(--shadow-md);
}

[data-theme="light"] .card-header {
    background: rgba(0, 0, 0, 0.01);
    border-bottom-color: var(--border-subtle);
}

/* Light theme — Stat cards */
[data-theme="light"] .stat-card {
    background: var(--bg-surface-2);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

[data-theme="light"] .stat-info h3 {
    color: var(--text-primary);
}

[data-theme="light"] .stat-icon {
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Light theme — Tables */
[data-theme="light"] th {
    background: rgba(241, 245, 249, 0.98);
    color: var(--text-tertiary);
}

[data-theme="light"] td {
    border-bottom-color: var(--border-subtle);
    color: var(--text-secondary);
}

[data-theme="light"] tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="light"] tr:hover td {
    background: rgba(6, 182, 212, 0.04);
}

/* Light theme — Forms */
[data-theme="light"] .form-control {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-primary);
    border-color: var(--border-default);
}

[data-theme="light"] .form-control:focus {
    background: #fff;
    border-color: var(--brand-500);
}

/* Light theme — Modals */
[data-theme="light"] .modal {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

[data-theme="light"] .modal-footer {
    background: rgba(241, 245, 249, 0.6);
}

/* Light theme — Buttons */
[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

[data-theme="light"] .btn-icon {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

[data-theme="light"] .btn-icon:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

/* Light theme — Badges */
[data-theme="light"] .badge-primary {
    background: rgba(6, 182, 212, 0.1);
    color: var(--brand-700);
    border-color: rgba(6, 182, 212, 0.18);
}

[data-theme="light"] .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.18);
}

[data-theme="light"] .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.18);
}

[data-theme="light"] .badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.18);
}

[data-theme="light"] .badge-secondary {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.2);
}

/* Light theme — Alerts */
[data-theme="light"] .alert-success {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}

[data-theme="light"] .alert-danger {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

[data-theme="light"] .alert-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #b45309;
}

/* Light theme — Text */
[data-theme="light"] .text-success {
    color: #059669;
}

[data-theme="light"] .text-muted {
    color: var(--text-tertiary);
}

/* Light theme — MultiSelect */
[data-theme="light"] .multi-select-display {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--border-default);
}

[data-theme="light"] .multi-select-dropdown {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-default);
}

[data-theme="light"] .multi-select-option {
    color: var(--text-secondary);
}

[data-theme="light"] .multi-select-option:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .multi-select-option.selected {
    background: rgba(6, 182, 212, 0.06);
    color: var(--brand-700);
}

[data-theme="light"] .multi-select-tag {
    background: rgba(6, 182, 212, 0.1);
    color: var(--brand-700);
    border-color: rgba(6, 182, 212, 0.18);
}

/* Light theme — Filter section */
[data-theme="light"] .filter-section {
    background: rgba(6, 182, 212, 0.03);
    border-color: var(--border-subtle);
}

/* Light theme — File upload */
[data-theme="light"] .file-upload {
    border-color: var(--border-default);
    background: rgba(0, 0, 0, 0.01);
}

/* Light theme — Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Light theme — Hamburger */
[data-theme="light"] .menu-toggle {
    background: var(--bg-surface-1);
    border-color: var(--border-default);
}

[data-theme="light"] .hamburger,
[data-theme="light"] .hamburger::before,
[data-theme="light"] .hamburger::after {
    background: var(--text-primary);
}

/* Light theme — Sidebar footer */
[data-theme="light"] .sidebar-footer {
    background: rgba(0, 0, 0, 0.02);
}

/* Light theme — Empty state */
[data-theme="light"] .empty-state-title {
    color: var(--text-tertiary);
}

/* Light theme — Placeholder */
[data-theme="light"] .placeholder {
    color: var(--text-tertiary);
}

/* Light theme — Select options */
[data-theme="light"] select.form-control option {
    background: #fff;
    color: var(--text-primary);
}