/* ═══════════════════════════════════════════════════════
   Alice Pro — Acorn-inspired design system
   ═══════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Layout dimensions ── */
:root {
    --sidebar-w:   260px;
    --topbar-h:    64px;
}

/* ══════════════════════════════════════════════════════
   LIGHT THEME (default)
   ══════════════════════════════════════════════════════ */
:root,
[data-theme="light"] {
    --bg:              #f0f2f5;
    --bg-surface:      #ffffff;
    --bg-hover:        #f8f9fb;
    --bg-input:        #ffffff;

    --sidebar-bg:      #1e2130;
    --sidebar-hover:   #2a2f42;
    --sidebar-active:  #1e3a5f;
    --sidebar-text:    #8b92a9;
    --sidebar-text-active: #60a5fa;
    --sidebar-border:  #252836;
    --sidebar-icon:    #555f7a;
    --sidebar-icon-active: #60a5fa;

    --topbar-bg:       rgba(255,255,255,0.65);
    --topbar-border:   rgba(255,255,255,0.4);

    --border:          #e5e7eb;
    --border-light:    #f3f4f6;

    --text:            #111827;
    --text-muted:      #6b7280;
    --text-light:      #9ca3af;
    --text-inverted:   #ffffff;

    --primary:         #1d4ed8;
    --primary-hover:   #1e40af;
    --primary-light:   #eff6ff;
    --primary-muted:   #93c5fd;

    --success:         #059669;
    --success-light:   #ecfdf5;
    --danger:          #dc2626;
    --danger-light:    #fef2f2;
    --warning:         #d97706;
    --warning-light:   #fffbeb;
    --info:            #0891b2;
    --info-light:      #ecfeff;

    --shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:       0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:       0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl:       0 16px 40px rgba(0,0,0,0.12);

    --radius-sm:       6px;
    --radius:          10px;
    --radius-lg:       14px;
    --radius-xl:       18px;
    --radius-full:     9999px;
}

/* ══════════════════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --bg:              #0f1117;
    --bg-surface:      #1a1d27;
    --bg-hover:        #222535;
    --bg-input:        #1a1d27;

    --sidebar-bg:      #13151f;
    --sidebar-hover:   #1e2130;
    --sidebar-active:  #1e3a5f;
    --sidebar-text:    #8b92a9;
    --sidebar-text-active: #60a5fa;
    --sidebar-border:  #1e2130;
    --sidebar-icon:    #4b5563;
    --sidebar-icon-active: #60a5fa;

    --topbar-bg:       rgba(30,33,48,0.75);
    --topbar-border:   rgba(255,255,255,0.08);

    --border:          #1e2130;
    --border-light:    #252836;

    --text:            #e2e8f0;
    --text-muted:      #8b92a9;
    --text-light:      #4b5563;
    --text-inverted:   #111827;

    --primary:         #3b82f6;
    --primary-hover:   #2563eb;
    --primary-light:   #1e3a5f;
    --primary-muted:   #1e3a5f;

    --success:         #10b981;
    --success-light:   #022c22;
    --danger:          #ef4444;
    --danger-light:    #3b0a0a;
    --warning:         #f59e0b;
    --warning-light:   #3b2000;
    --info:            #06b6d4;
    --info-light:      #0c2a3a;

    --shadow-sm:       0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:       0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:       0 8px 24px rgba(0,0,0,0.5);
    --shadow-xl:       0 16px 40px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════════════════════
   BLUE THEME
   ══════════════════════════════════════════════════════ */
[data-theme="blue"] {
    --bg:              #f0f4ff;
    --bg-surface:      #ffffff;
    --bg-hover:        #e8eeff;
    --bg-input:        #ffffff;
    --sidebar-bg:      #1e40af;
    --sidebar-hover:   #1d3a9e;
    --sidebar-active:  #1e3a8a;
    --sidebar-text:    #bfdbfe;
    --sidebar-text-active: #ffffff;
    --sidebar-border:  #1d3a9e;
    --sidebar-icon:    #93c5fd;
    --sidebar-icon-active: #ffffff;
    --topbar-bg:       #ffffff;
    --topbar-border:   #dbeafe;
    --border:          #dbeafe;
    --border-light:    #eff6ff;
    --text:            #1e3a8a;
    --text-muted:      #3b82f6;
    --text-light:      #93c5fd;
    --text-inverted:   #ffffff;
    --primary:         #1d4ed8;
    --primary-hover:   #1e40af;
    --primary-light:   #dbeafe;
    --shadow-sm:       0 1px 3px rgba(30,64,175,0.08);
    --shadow-md:       0 4px 12px rgba(30,64,175,0.12);
    --shadow-lg:       0 8px 24px rgba(30,64,175,0.16);
    --shadow-xl:       0 16px 40px rgba(30,64,175,0.20);
    --success:  #059669; --success-light: #ecfdf5;
    --danger:   #dc2626; --danger-light:  #fef2f2;
    --warning:  #d97706; --warning-light: #fffbeb;
    --info:     #0891b2; --info-light:    #ecfeff;
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
    --radius-xl: 18px; --radius-full: 9999px;
}

/* ══════════════════════════════════════════════════════
   GREEN THEME
   ══════════════════════════════════════════════════════ */
[data-theme="green"] {
    --bg:              #f0fdf4;
    --bg-surface:      #ffffff;
    --bg-hover:        #dcfce7;
    --bg-input:        #ffffff;
    --sidebar-bg:      #14532d;
    --sidebar-hover:   #166534;
    --sidebar-active:  #15803d;
    --sidebar-text:    #86efac;
    --sidebar-text-active: #ffffff;
    --sidebar-border:  #166534;
    --sidebar-icon:    #4ade80;
    --sidebar-icon-active: #ffffff;
    --topbar-bg:       #ffffff;
    --topbar-border:   #dcfce7;
    --border:          #bbf7d0;
    --border-light:    #dcfce7;
    --text:            #14532d;
    --text-muted:      #16a34a;
    --text-light:      #86efac;
    --text-inverted:   #ffffff;
    --primary:         #16a34a;
    --primary-hover:   #15803d;
    --primary-light:   #dcfce7;
    --shadow-sm:       0 1px 3px rgba(20,83,45,0.08);
    --shadow-md:       0 4px 12px rgba(20,83,45,0.12);
    --shadow-lg:       0 8px 24px rgba(20,83,45,0.16);
    --shadow-xl:       0 16px 40px rgba(20,83,45,0.20);
    --success:  #059669; --success-light: #ecfdf5;
    --danger:   #dc2626; --danger-light:  #fef2f2;
    --warning:  #d97706; --warning-light: #fffbeb;
    --info:     #0891b2; --info-light:    #ecfeff;
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
    --radius-xl: 18px; --radius-full: 9999px;
}

/* ══════════════════════════════════════════════════════
   PURPLE THEME
   ══════════════════════════════════════════════════════ */
[data-theme="purple"] {
    --bg:              #faf5ff;
    --bg-surface:      #ffffff;
    --bg-hover:        #f3e8ff;
    --bg-input:        #ffffff;
    --sidebar-bg:      #4c1d95;
    --sidebar-hover:   #5b21b6;
    --sidebar-active:  #6d28d9;
    --sidebar-text:    #c4b5fd;
    --sidebar-text-active: #ffffff;
    --sidebar-border:  #5b21b6;
    --sidebar-icon:    #a78bfa;
    --sidebar-icon-active: #ffffff;
    --topbar-bg:       #ffffff;
    --topbar-border:   #ede9fe;
    --border:          #ddd6fe;
    --border-light:    #ede9fe;
    --text:            #4c1d95;
    --text-muted:      #7c3aed;
    --text-light:      #c4b5fd;
    --text-inverted:   #ffffff;
    --primary:         #7c3aed;
    --primary-hover:   #6d28d9;
    --primary-light:   #ede9fe;
    --shadow-sm:       0 1px 3px rgba(76,29,149,0.08);
    --shadow-md:       0 4px 12px rgba(76,29,149,0.12);
    --shadow-lg:       0 8px 24px rgba(76,29,149,0.16);
    --shadow-xl:       0 16px 40px rgba(76,29,149,0.20);
    --success:  #059669; --success-light: #ecfdf5;
    --danger:   #dc2626; --danger-light:  #fef2f2;
    --warning:  #d97706; --warning-light: #fffbeb;
    --info:     #0891b2; --info-light:    #ecfeff;
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
    --radius-xl: 18px; --radius-full: 9999px;
}

/* ══════════════════════════════════════════════════════
   ORANGE THEME
   ══════════════════════════════════════════════════════ */
[data-theme="orange"] {
    --bg:              #fff7ed;
    --bg-surface:      #ffffff;
    --bg-hover:        #ffedd5;
    --bg-input:        #ffffff;
    --sidebar-bg:      #7c2d12;
    --sidebar-hover:   #9a3412;
    --sidebar-active:  #c2410c;
    --sidebar-text:    #fdba74;
    --sidebar-text-active: #ffffff;
    --sidebar-border:  #9a3412;
    --sidebar-icon:    #fb923c;
    --sidebar-icon-active: #ffffff;
    --topbar-bg:       #ffffff;
    --topbar-border:   #fed7aa;
    --border:          #fed7aa;
    --border-light:    #ffedd5;
    --text:            #7c2d12;
    --text-muted:      #ea580c;
    --text-light:      #fdba74;
    --text-inverted:   #ffffff;
    --primary:         #ea580c;
    --primary-hover:   #c2410c;
    --primary-light:   #ffedd5;
    --shadow-sm:       0 1px 3px rgba(124,45,18,0.08);
    --shadow-md:       0 4px 12px rgba(124,45,18,0.12);
    --shadow-lg:       0 8px 24px rgba(124,45,18,0.16);
    --shadow-xl:       0 16px 40px rgba(124,45,18,0.20);
    --success:  #059669; --success-light: #ecfdf5;
    --danger:   #dc2626; --danger-light:  #fef2f2;
    --warning:  #d97706; --warning-light: #fffbeb;
    --info:     #0891b2; --info-light:    #ecfeff;
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
    --radius-xl: 18px; --radius-full: 9999px;
}

/* ══════════════════════════════════════════════════════
   BASE STYLES
   ══════════════════════════════════════════════════════ */
html { font-size: 14px; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ══════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════ */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: var(--topbar-h);
}

.sidebar-logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--sidebar-text-active);
    letter-spacing: -0.3px;
}

.sidebar-logo-sub {
    font-size: 10px;
    color: var(--sidebar-text);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    padding: 12px 12px;
    flex: 1;
}

.nav-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sidebar-text);
    padding: 16px 8px 6px;
    opacity: 0.7;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    cursor: pointer;
    position: relative;
}

.nav-item i {
    font-size: 17px;
    color: var(--sidebar-icon);
    flex-shrink: 0;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.nav-item:hover i { color: var(--sidebar-icon-active); }

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

.nav-item.active i { color: var(--sidebar-icon-active); }

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--sidebar-text-active);
    border-radius: 0 3px 3px 0;
}

/* ── Main content ── */
.layout {
    display: flex;
    width: 100%;
}
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,0.3), 0 4px 16px rgba(0,0,0,0.06);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ── Content area ── */
.content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-h));
}

/* ══════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════ */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* ══════════════════════════════════════════════════════
   STATS CARDS
   ══════════════════════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-icon.pink   { background: #fce7f3; color: #db2777; }

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.stat-change {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.stat-change.up   { color: #16a34a; }
.stat-change.down { color: #dc2626; }

/* ══════════════════════════════════════════════════════
   FEATURE GRID (settings cards)
   ══════════════════════════════════════════════════════ */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-muted);
    color: var(--text);
}

.feature-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.feature-card-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.feature-card-icon.green  { background: #dcfce7; color: #16a34a; }
.feature-card-icon.purple { background: #ede9fe; color: #7c3aed; }
.feature-card-icon.orange { background: #ffedd5; color: #ea580c; }
.feature-card-icon.red    { background: #fee2e2; color: #dc2626; }
.feature-card-icon.teal   { background: #ccfbf1; color: #0d9488; }

.feature-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.feature-card-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
    transition: background 0.1s;
}

tbody tr:hover { background: var(--bg-hover); }

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(29,78,216,0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover {
    opacity: 0.9;
    color: #fff;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover {
    opacity: 0.9;
    color: #fff;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    gap: 4px;
}

.btn-lg {
    padding: 11px 24px;
    font-size: 14px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-gray    { background: var(--bg-hover);      color: var(--text-muted); }

/* ══════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-color: #a7f3d0;
}
.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border-color: #fca5a5;
}
.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border-color: #fcd34d;
}
.alert-info {
    background: var(--info-light);
    color: var(--info);
    border-color: #a5f3fc;
}

/* ══════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.page-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* ══════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ══════════════════════════════════════════════════════
   LANGUAGE & USER MENU DROPDOWNS
   ══════════════════════════════════════════════════════ */
.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
    transition: background 0.1s;
    cursor: pointer;
}

.lang-option:hover  { background: var(--bg-hover); color: var(--text); }
.lang-option.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.1s;
    cursor: pointer;
}

.user-menu-item:hover { background: var(--bg-hover); color: var(--text); }
.user-menu-item i { font-size: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   HAMBURGER & MOBILE
   ══════════════════════════════════════════════════════ */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
    font-size: 22px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.hamburger:hover { background: var(--bg-hover); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* ══════════════════════════════════════════════════════
   THEME SWITCHER
   ══════════════════════════════════════════════════════ */
.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    font-family: inherit;
}
.theme-option:hover  { background: var(--bg-hover); }
.theme-option.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.theme-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ══════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 101;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }

    .main { margin-left: 0; }

    .topbar { padding: 0 12px; gap: 8px; }

    .content { padding: 12px; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .feature-grid { grid-template-columns: 1fr; }

    .modal { padding: 20px; border-radius: var(--radius-lg); }

    .btn { font-size: 12px; padding: 7px 12px; }
    .btn-sm { padding: 4px 8px; font-size: 11px; }

    .hide-mobile { display: none !important; }

    thead th, tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 17px; }
}

/* ── Topbar actions (right side) ── */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Topbar actions (right side) ── */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Extra icon colors ── */
.stat-icon.indigo,
.feature-card-icon.indigo { background: #e0e7ff; color: #4338ca; }
.stat-icon.amber,
.feature-card-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.cyan,
.feature-card-icon.cyan   { background: #cffafe; color: #0891b2; }
.stat-icon.rose,
.feature-card-icon.rose   { background: #ffe4e6; color: #e11d48; }

/* ── Sidebar submenu animation ── */

    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
}

/* ── Sidebar submenus ── */
.submenu-items {
    margin-bottom: 4px;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 34px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    color: var(--sidebar-text);
    transition: color 0.15s;
}

.nav-sub-item i {
    font-size: 14px;
    color: var(--sidebar-icon);
    transition: color 0.15s;
}

.nav-sub-item:hover {
    color: var(--sidebar-text-active);
}

.nav-sub-item:hover i {
    color: var(--sidebar-icon-active);
}

.nav-sub-item.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-sub-item.active i {
    color: var(--primary);
}






/* ── View Transitions ── */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 0.15s ease both fade-out;
}

::view-transition-new(root) {
    animation: 0.2s ease both fade-in;
}

@keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Slide Toggle (replaces checkboxes) ── */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-wrap input[type="checkbox"] {
    display: none;
}

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-wrap input:checked + .toggle {
    background: var(--primary);
}

.toggle-wrap input:checked + .toggle::after {
    transform: translateX(18px);
}

.toggle-wrap input:disabled + .toggle {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label {
    font-size: 13px;
    color: var(--text);
}

.toggle-sm .toggle {
    width: 32px;
    height: 18px;
    border-radius: 9px;
}

.toggle-sm .toggle::after {
    width: 12px;
    height: 12px;
    top: 3px;
    left: 3px;
}

.toggle-sm input:checked + .toggle::after {
    transform: translateX(14px);
}

/* ── Toast Notifications ── */
#toast-container {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
    min-width: 280px;
    max-width: 400px;
    pointer-events: all;
    animation: toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="dark"] .toast {
    background: rgba(30,33,48,0.75);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

.toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.toast-success .toast-icon { background: var(--success-light); color: var(--success); }
.toast-danger  .toast-icon { background: var(--danger-light);  color: var(--danger);  }
.toast-warning .toast-icon { background: var(--warning-light); color: var(--warning); }
.toast-info    .toast-icon { background: #eff6ff;              color: var(--primary); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text); }
.toast-msg   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    flex-shrink: 0;
    font-size: 14px;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}
