/* ================================================
   Theme System - Light/Dark Mode via CSS Variables
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after {
    font-family: 'Inter', sans-serif !important;
}

/* ---- Light Mode ---- */
:root {
    --bg-body: #e8ecf1;
    --bg-sidebar: linear-gradient(180deg, #0f172a 0%, #1e293b 40%, #164e63 100%);
    --sidebar-border: rgba(255,255,255,0.06);
    --bg-card: #fff;
    --bg-card-hover: #fff;
    --card-border: #e5e7eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-on-card: #1f2937;
    --heading-color: #111827;
    --table-text: #374151;
    --table-header: #6b7280;
    --table-border: #e5e7eb;
    --table-stripe: #f9fafb;
    --bg-main: #f3f4f6;
    --input-bg: #fff;
    --input-border: #d1d5db;
    --input-text: #1f2937;
    --chart-text: #6b7280;
    --chart-grid: #f3f4f6;

    /* KPI cards - light mode: clean white with colored left accent */
    --kpi1-bg: #fff;
    --kpi1-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --kpi1-value: #0f766e;
    --kpi1-label: #6b7280;
    --kpi1-accent: #0d9488;
    --kpi2-bg: #fff;
    --kpi2-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --kpi2-value: #1d4ed8;
    --kpi2-label: #6b7280;
    --kpi2-accent: #2563eb;
    --kpi3-bg: #fff;
    --kpi3-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --kpi3-value: #6d28d9;
    --kpi3-label: #6b7280;
    --kpi3-accent: #7c3aed;
    --kpi4-bg: #fff;
    --kpi4-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --kpi4-value: #c2410c;
    --kpi4-label: #6b7280;
    --kpi4-accent: #ea580c;
    --kpi5-bg: #fff;
    --kpi5-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --kpi5-value: #b91c1c;
    --kpi5-label: #6b7280;
    --kpi5-accent: #dc2626;

    /* Chart headers - light mode: subtle and elegant */
    --chart1-header-bg: #fff;
    --chart1-header-color: #0f766e;
    --chart1-header-border: #e5e7eb;
    --chart2-header-bg: #fff;
    --chart2-header-color: #9d174d;
    --chart2-header-border: #e5e7eb;
    --chart3-header-bg: #fff;
    --chart3-header-color: #1e40af;
    --chart3-header-border: #e5e7eb;
    --chart4-header-bg: #fff;
    --chart4-header-color: #5b21b6;
    --chart4-header-border: #e5e7eb;
    --chart5-header-bg: #fff;
    --chart5-header-color: #065f46;
    --chart5-header-border: #e5e7eb;
    --recent-header-bg: #fff;
    --recent-header-color: #9a3412;
    --recent-header-border: #e5e7eb;

    /* Buttons */
    --btn-primary-bg: #0d9488;
    --btn-primary-hover: #0f766e;
    --btn-success-bg: #059669;
    --btn-success-hover: #047857;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #1e293b;
    --card-border: rgba(255,255,255,0.06);
    --card-shadow: 0 4px 16px rgba(0,0,0,0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-on-card: #e2e8f0;
    --heading-color: #f1f5f9;
    --table-text: #cbd5e1;
    --table-header: #94a3b8;
    --table-border: rgba(255,255,255,0.06);
    --table-stripe: rgba(255,255,255,0.03);
    --bg-main: #131b2a;
    --input-bg: #1e293b;
    --input-border: rgba(255,255,255,0.12);
    --input-text: #e2e8f0;
    --chart-text: #94a3b8;
    --chart-grid: rgba(255,255,255,0.06);

    /* KPI cards - dark mode */
    --kpi1-bg: linear-gradient(135deg, #134e4a, #0f766e);
    --kpi1-shadow: 0 4px 20px rgba(13,148,136,0.3);
    --kpi1-value: #5eead4;
    --kpi1-label: #99f6e4;
    --kpi2-bg: linear-gradient(135deg, #1e3a5f, #1d4ed8);
    --kpi2-shadow: 0 4px 20px rgba(37,99,235,0.3);
    --kpi2-value: #93c5fd;
    --kpi2-label: #bfdbfe;
    --kpi3-bg: linear-gradient(135deg, #4c1d95, #6d28d9);
    --kpi3-shadow: 0 4px 20px rgba(124,58,237,0.3);
    --kpi3-value: #c4b5fd;
    --kpi3-label: #ddd6fe;
    --kpi4-bg: linear-gradient(135deg, #7c2d12, #c2410c);
    --kpi4-shadow: 0 4px 20px rgba(234,88,12,0.3);
    --kpi4-value: #fdba74;
    --kpi4-label: #fed7aa;
    --kpi5-bg: linear-gradient(135deg, #7f1d1d, #b91c1c);
    --kpi5-shadow: 0 4px 20px rgba(220,38,38,0.3);
    --kpi5-value: #fca5a5;
    --kpi5-label: #fecaca;

    /* Chart headers - dark mode */
    --chart1-header-bg: rgba(13,148,136,0.2);
    --chart1-header-color: #5eead4;
    --chart2-header-bg: rgba(236,72,153,0.2);
    --chart2-header-color: #f9a8d4;
    --chart3-header-bg: rgba(59,130,246,0.2);
    --chart3-header-color: #93c5fd;
    --chart4-header-bg: rgba(139,92,246,0.2);
    --chart4-header-color: #c4b5fd;
    --chart5-header-bg: rgba(16,185,129,0.2);
    --chart5-header-color: #6ee7b7;
    --recent-header-bg: rgba(249,115,22,0.2);
    --recent-header-color: #fdba74;
}

/* ================================================
   Color Theme: Aurora Glass
   ================================================ */
[data-color-theme="aurora"] {
    --bg-body: #0a0a1a;
    --bg-main: rgba(0,0,0,0.3);
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-hover: rgba(255,255,255,0.08);
    --card-border: rgba(255,255,255,0.08);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.2);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-on-card: #e2e8f0;
    --heading-color: #f1f5f9;
    --table-text: #e2e8f0;
    --table-header: #c7d2fe;
    --table-border: rgba(255,255,255,0.06);
    --table-stripe: rgba(99,102,241,0.04);
    --input-bg: rgba(255,255,255,0.06);
    --input-border: rgba(255,255,255,0.12);
    --input-text: #e2e8f0;
    --chart-text: #94a3b8;
    --chart-grid: rgba(255,255,255,0.06);
    --bg-sidebar: linear-gradient(180deg, rgba(10,10,26,0.95), rgba(30,20,60,0.9), rgba(15,15,40,0.95));
    --sidebar-border: rgba(99,102,241,0.1);

    --kpi1-bg: rgba(99,102,241,0.15); --kpi1-shadow: 0 4px 20px rgba(99,102,241,0.15); --kpi1-value: #a5b4fc; --kpi1-label: #c7d2fe; --kpi1-accent: #6366f1;
    --kpi2-bg: rgba(236,72,153,0.15); --kpi2-shadow: 0 4px 20px rgba(236,72,153,0.15); --kpi2-value: #f9a8d4; --kpi2-label: #fbcfe8; --kpi2-accent: #ec4899;
    --kpi3-bg: rgba(6,182,212,0.15); --kpi3-shadow: 0 4px 20px rgba(6,182,212,0.15); --kpi3-value: #67e8f9; --kpi3-label: #a5f3fc; --kpi3-accent: #06b6d4;
    --kpi4-bg: rgba(245,158,11,0.15); --kpi4-shadow: 0 4px 20px rgba(245,158,11,0.15); --kpi4-value: #fcd34d; --kpi4-label: #fde68a; --kpi4-accent: #f59e0b;
    --kpi5-bg: rgba(16,185,129,0.15); --kpi5-shadow: 0 4px 20px rgba(16,185,129,0.15); --kpi5-value: #6ee7b7; --kpi5-label: #a7f3d0; --kpi5-accent: #10b981;

    --chart1-header-bg: rgba(99,102,241,0.12); --chart1-header-color: #a5b4fc; --chart1-header-border: rgba(99,102,241,0.15);
    --chart2-header-bg: rgba(236,72,153,0.12); --chart2-header-color: #f9a8d4; --chart2-header-border: rgba(236,72,153,0.15);
    --chart3-header-bg: rgba(6,182,212,0.12); --chart3-header-color: #67e8f9; --chart3-header-border: rgba(6,182,212,0.15);
    --chart4-header-bg: rgba(139,92,246,0.12); --chart4-header-color: #c4b5fd; --chart4-header-border: rgba(139,92,246,0.15);
    --chart5-header-bg: rgba(16,185,129,0.12); --chart5-header-color: #6ee7b7; --chart5-header-border: rgba(16,185,129,0.15);
    --recent-header-bg: rgba(249,115,22,0.12); --recent-header-color: #fdba74; --recent-header-border: rgba(249,115,22,0.15);

    --btn-primary-bg: linear-gradient(135deg, rgba(99,102,241,0.6), rgba(236,72,153,0.5));
    --btn-primary-hover: linear-gradient(135deg, rgba(99,102,241,0.8), rgba(236,72,153,0.7));
    --btn-success-bg: rgba(16,185,129,0.5); --btn-success-hover: rgba(16,185,129,0.7);

    --dropdown-bg: rgba(12,12,28,0.95);
    --dropdown-toggle-bg: rgba(12,12,28,0.85);
    --table-row-bg: rgba(12,12,28,0.95);
    --table-row-alt-bg: rgba(20,18,40,0.95);
    --table-hover-bg: rgba(99,102,241,0.15);
    --table-container-bg: rgba(12,12,28,0.85);
}

/* ================================================
   Color Theme: Smoke & Fire
   ================================================ */
[data-color-theme="smoke-fire"] {
    --bg-body: #0c0a09;
    --bg-main: rgba(0,0,0,0.3);
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.07);
    --card-border: rgba(255,255,255,0.06);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
    --text-primary: #fafaf9;
    --text-secondary: #e7e5e4;
    --text-muted: #a8a29e;
    --text-on-card: #e7e5e4;
    --heading-color: #fafaf9;
    --table-text: #e7e5e4;
    --table-header: #fdba74;
    --table-border: rgba(255,255,255,0.05);
    --table-stripe: rgba(249,115,22,0.04);
    --input-bg: rgba(255,255,255,0.05);
    --input-border: rgba(255,255,255,0.1);
    --input-text: #e7e5e4;
    --chart-text: #a8a29e;
    --chart-grid: rgba(255,255,255,0.05);
    --bg-sidebar: linear-gradient(180deg, rgba(12,10,9,0.95), rgba(28,20,16,0.9), rgba(20,12,8,0.95));
    --sidebar-border: rgba(249,115,22,0.1);

    --kpi1-bg: rgba(249,115,22,0.12); --kpi1-shadow: 0 4px 20px rgba(249,115,22,0.12); --kpi1-value: #fdba74; --kpi1-label: #fed7aa; --kpi1-accent: #f97316;
    --kpi2-bg: rgba(239,68,68,0.12); --kpi2-shadow: 0 4px 20px rgba(239,68,68,0.12); --kpi2-value: #fca5a5; --kpi2-label: #fecaca; --kpi2-accent: #ef4444;
    --kpi3-bg: rgba(245,158,11,0.12); --kpi3-shadow: 0 4px 20px rgba(245,158,11,0.12); --kpi3-value: #fcd34d; --kpi3-label: #fde68a; --kpi3-accent: #f59e0b;
    --kpi4-bg: rgba(34,197,94,0.12); --kpi4-shadow: 0 4px 20px rgba(34,197,94,0.12); --kpi4-value: #86efac; --kpi4-label: #bbf7d0; --kpi4-accent: #22c55e;
    --kpi5-bg: rgba(168,85,247,0.12); --kpi5-shadow: 0 4px 20px rgba(168,85,247,0.12); --kpi5-value: #d8b4fe; --kpi5-label: #e9d5ff; --kpi5-accent: #a855f7;

    --chart1-header-bg: rgba(249,115,22,0.1); --chart1-header-color: #fdba74; --chart1-header-border: rgba(249,115,22,0.12);
    --chart2-header-bg: rgba(239,68,68,0.1); --chart2-header-color: #fca5a5; --chart2-header-border: rgba(239,68,68,0.12);
    --chart3-header-bg: rgba(245,158,11,0.1); --chart3-header-color: #fcd34d; --chart3-header-border: rgba(245,158,11,0.12);
    --chart4-header-bg: rgba(34,197,94,0.1); --chart4-header-color: #86efac; --chart4-header-border: rgba(34,197,94,0.12);
    --chart5-header-bg: rgba(168,85,247,0.1); --chart5-header-color: #d8b4fe; --chart5-header-border: rgba(168,85,247,0.12);
    --recent-header-bg: rgba(251,146,60,0.1); --recent-header-color: #fdba74; --recent-header-border: rgba(251,146,60,0.12);

    --btn-primary-bg: linear-gradient(135deg, rgba(249,115,22,0.7), rgba(239,68,68,0.6));
    --btn-primary-hover: linear-gradient(135deg, rgba(249,115,22,0.9), rgba(239,68,68,0.8));
    --btn-success-bg: rgba(34,197,94,0.5); --btn-success-hover: rgba(34,197,94,0.7);

    --dropdown-bg: rgba(16,12,10,0.95);
    --dropdown-toggle-bg: rgba(16,12,10,0.85);
    --table-row-bg: rgba(16,12,10,0.95);
    --table-row-alt-bg: rgba(28,20,14,0.95);
    --table-hover-bg: rgba(249,115,22,0.15);
    --table-container-bg: rgba(16,12,10,0.85);
}

/* ================================================
   Color Theme: Ocean Depth
   ================================================ */
[data-color-theme="ocean-depth"] {
    --bg-body: #020617;
    --bg-main: rgba(0,0,0,0.3);
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.07);
    --card-border: rgba(255,255,255,0.07);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.25);
    --text-primary: #f0f9ff;
    --text-secondary: #bae6fd;
    --text-muted: #7dd3fc;
    --text-on-card: #e0f2fe;
    --heading-color: #f0f9ff;
    --table-text: #e0f2fe;
    --table-header: #bae6fd;
    --table-border: rgba(255,255,255,0.05);
    --table-stripe: rgba(14,165,233,0.04);
    --input-bg: rgba(255,255,255,0.05);
    --input-border: rgba(255,255,255,0.1);
    --input-text: #e0f2fe;
    --chart-text: #7dd3fc;
    --chart-grid: rgba(255,255,255,0.05);
    --bg-sidebar: linear-gradient(180deg, rgba(2,6,23,0.95), rgba(12,26,46,0.9), rgba(5,15,35,0.95));
    --sidebar-border: rgba(14,165,233,0.1);

    --kpi1-bg: rgba(14,165,233,0.12); --kpi1-shadow: 0 4px 20px rgba(14,165,233,0.12); --kpi1-value: #7dd3fc; --kpi1-label: #bae6fd; --kpi1-accent: #0ea5e9;
    --kpi2-bg: rgba(6,182,212,0.12); --kpi2-shadow: 0 4px 20px rgba(6,182,212,0.12); --kpi2-value: #67e8f9; --kpi2-label: #a5f3fc; --kpi2-accent: #06b6d4;
    --kpi3-bg: rgba(139,92,246,0.12); --kpi3-shadow: 0 4px 20px rgba(139,92,246,0.12); --kpi3-value: #c4b5fd; --kpi3-label: #ddd6fe; --kpi3-accent: #8b5cf6;
    --kpi4-bg: rgba(244,63,94,0.12); --kpi4-shadow: 0 4px 20px rgba(244,63,94,0.12); --kpi4-value: #fda4af; --kpi4-label: #fecdd3; --kpi4-accent: #f43f5e;
    --kpi5-bg: rgba(34,197,94,0.12); --kpi5-shadow: 0 4px 20px rgba(34,197,94,0.12); --kpi5-value: #86efac; --kpi5-label: #bbf7d0; --kpi5-accent: #22c55e;

    --chart1-header-bg: rgba(14,165,233,0.1); --chart1-header-color: #7dd3fc; --chart1-header-border: rgba(14,165,233,0.12);
    --chart2-header-bg: rgba(6,182,212,0.1); --chart2-header-color: #67e8f9; --chart2-header-border: rgba(6,182,212,0.12);
    --chart3-header-bg: rgba(139,92,246,0.1); --chart3-header-color: #c4b5fd; --chart3-header-border: rgba(139,92,246,0.12);
    --chart4-header-bg: rgba(244,63,94,0.1); --chart4-header-color: #fda4af; --chart4-header-border: rgba(244,63,94,0.12);
    --chart5-header-bg: rgba(34,197,94,0.1); --chart5-header-color: #86efac; --chart5-header-border: rgba(34,197,94,0.12);
    --recent-header-bg: rgba(56,189,248,0.1); --recent-header-color: #7dd3fc; --recent-header-border: rgba(56,189,248,0.12);

    --btn-primary-bg: linear-gradient(135deg, rgba(14,165,233,0.7), rgba(6,182,212,0.6));
    --btn-primary-hover: linear-gradient(135deg, rgba(14,165,233,0.9), rgba(6,182,212,0.8));
    --btn-success-bg: rgba(34,197,94,0.5); --btn-success-hover: rgba(34,197,94,0.7);

    --dropdown-bg: rgba(4,10,24,0.95);
    --dropdown-toggle-bg: rgba(4,10,24,0.85);
    --table-row-bg: rgba(4,10,24,0.95);
    --table-row-alt-bg: rgba(10,20,38,0.95);
    --table-hover-bg: rgba(14,165,233,0.15);
    --table-container-bg: rgba(4,10,24,0.85);
}

/* ================================================
   Color Theme: Neon Mint
   ================================================ */
[data-color-theme="neon-mint"] {
    --bg-body: #030712;
    --bg-main: rgba(0,0,0,0.3);
    --bg-card: rgba(16,185,129,0.03);
    --bg-card-hover: rgba(16,185,129,0.06);
    --card-border: rgba(16,185,129,0.08);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.25);
    --text-primary: #f0fdf4;
    --text-secondary: #bbf7d0;
    --text-muted: #86efac;
    --text-on-card: #d1fae5;
    --heading-color: #f0fdf4;
    --table-text: #d1fae5;
    --table-header: #a7f3d0;
    --table-border: rgba(16,185,129,0.06);
    --table-stripe: rgba(16,185,129,0.03);
    --input-bg: rgba(16,185,129,0.04);
    --input-border: rgba(16,185,129,0.12);
    --input-text: #d1fae5;
    --chart-text: #86efac;
    --chart-grid: rgba(16,185,129,0.06);
    --bg-sidebar: linear-gradient(180deg, rgba(3,7,18,0.95), rgba(10,26,18,0.9), rgba(5,15,12,0.95));
    --sidebar-border: rgba(16,185,129,0.1);

    --kpi1-bg: rgba(16,185,129,0.1); --kpi1-shadow: 0 4px 20px rgba(16,185,129,0.1); --kpi1-value: #6ee7b7; --kpi1-label: #a7f3d0; --kpi1-accent: #10b981;
    --kpi2-bg: rgba(6,182,212,0.1); --kpi2-shadow: 0 4px 20px rgba(6,182,212,0.1); --kpi2-value: #67e8f9; --kpi2-label: #a5f3fc; --kpi2-accent: #06b6d4;
    --kpi3-bg: rgba(132,204,22,0.1); --kpi3-shadow: 0 4px 20px rgba(132,204,22,0.1); --kpi3-value: #bef264; --kpi3-label: #d9f99d; --kpi3-accent: #84cc16;
    --kpi4-bg: rgba(249,115,22,0.1); --kpi4-shadow: 0 4px 20px rgba(249,115,22,0.1); --kpi4-value: #fdba74; --kpi4-label: #fed7aa; --kpi4-accent: #f97316;
    --kpi5-bg: rgba(168,85,247,0.1); --kpi5-shadow: 0 4px 20px rgba(168,85,247,0.1); --kpi5-value: #d8b4fe; --kpi5-label: #e9d5ff; --kpi5-accent: #a855f7;

    --chart1-header-bg: rgba(16,185,129,0.08); --chart1-header-color: #6ee7b7; --chart1-header-border: rgba(16,185,129,0.1);
    --chart2-header-bg: rgba(6,182,212,0.08); --chart2-header-color: #67e8f9; --chart2-header-border: rgba(6,182,212,0.1);
    --chart3-header-bg: rgba(132,204,22,0.08); --chart3-header-color: #bef264; --chart3-header-border: rgba(132,204,22,0.1);
    --chart4-header-bg: rgba(249,115,22,0.08); --chart4-header-color: #fdba74; --chart4-header-border: rgba(249,115,22,0.1);
    --chart5-header-bg: rgba(168,85,247,0.08); --chart5-header-color: #d8b4fe; --chart5-header-border: rgba(168,85,247,0.1);
    --recent-header-bg: rgba(52,211,153,0.08); --recent-header-color: #6ee7b7; --recent-header-border: rgba(52,211,153,0.1);

    --btn-primary-bg: linear-gradient(135deg, rgba(16,185,129,0.6), rgba(6,182,212,0.5));
    --btn-primary-hover: linear-gradient(135deg, rgba(16,185,129,0.8), rgba(6,182,212,0.7));
    --btn-success-bg: rgba(16,185,129,0.5); --btn-success-hover: rgba(16,185,129,0.7);

    --dropdown-bg: rgba(5,12,10,0.95);
    --dropdown-toggle-bg: rgba(5,12,10,0.85);
    --table-row-bg: rgba(5,12,10,0.95);
    --table-row-alt-bg: rgba(10,22,18,0.95);
    --table-hover-bg: rgba(16,185,129,0.15);
    --table-container-bg: rgba(5,12,10,0.85);
}

/* ================================================
   Color Theme: Frosted Rose
   ================================================ */
[data-color-theme="frosted-rose"] {
    --bg-body: #0f0a10;
    --bg-main: rgba(0,0,0,0.3);
    --bg-card: rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.07);
    --card-border: rgba(236,72,153,0.08);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.25);
    --text-primary: #fdf2f8;
    --text-secondary: #fbcfe8;
    --text-muted: #f9a8d4;
    --text-on-card: #fce7f3;
    --heading-color: #fdf2f8;
    --table-text: #fce7f3;
    --table-header: #fbcfe8;
    --table-border: rgba(236,72,153,0.06);
    --table-stripe: rgba(236,72,153,0.03);
    --input-bg: rgba(236,72,153,0.04);
    --input-border: rgba(236,72,153,0.12);
    --input-text: #fce7f3;
    --chart-text: #f9a8d4;
    --chart-grid: rgba(236,72,153,0.06);
    --bg-sidebar: linear-gradient(180deg, rgba(15,10,16,0.95), rgba(26,15,24,0.9), rgba(18,10,18,0.95));
    --sidebar-border: rgba(236,72,153,0.1);

    --kpi1-bg: rgba(236,72,153,0.1); --kpi1-shadow: 0 4px 20px rgba(236,72,153,0.1); --kpi1-value: #f9a8d4; --kpi1-label: #fbcfe8; --kpi1-accent: #ec4899;
    --kpi2-bg: rgba(139,92,246,0.1); --kpi2-shadow: 0 4px 20px rgba(139,92,246,0.1); --kpi2-value: #c4b5fd; --kpi2-label: #ddd6fe; --kpi2-accent: #8b5cf6;
    --kpi3-bg: rgba(244,63,94,0.1); --kpi3-shadow: 0 4px 20px rgba(244,63,94,0.1); --kpi3-value: #fda4af; --kpi3-label: #fecdd3; --kpi3-accent: #f43f5e;
    --kpi4-bg: rgba(14,165,233,0.1); --kpi4-shadow: 0 4px 20px rgba(14,165,233,0.1); --kpi4-value: #7dd3fc; --kpi4-label: #bae6fd; --kpi4-accent: #0ea5e9;
    --kpi5-bg: rgba(245,158,11,0.1); --kpi5-shadow: 0 4px 20px rgba(245,158,11,0.1); --kpi5-value: #fcd34d; --kpi5-label: #fde68a; --kpi5-accent: #f59e0b;

    --chart1-header-bg: rgba(236,72,153,0.08); --chart1-header-color: #f9a8d4; --chart1-header-border: rgba(236,72,153,0.1);
    --chart2-header-bg: rgba(139,92,246,0.08); --chart2-header-color: #c4b5fd; --chart2-header-border: rgba(139,92,246,0.1);
    --chart3-header-bg: rgba(244,63,94,0.08); --chart3-header-color: #fda4af; --chart3-header-border: rgba(244,63,94,0.1);
    --chart4-header-bg: rgba(14,165,233,0.08); --chart4-header-color: #7dd3fc; --chart4-header-border: rgba(14,165,233,0.1);
    --chart5-header-bg: rgba(245,158,11,0.08); --chart5-header-color: #fcd34d; --chart5-header-border: rgba(245,158,11,0.1);
    --recent-header-bg: rgba(244,114,182,0.08); --recent-header-color: #f9a8d4; --recent-header-border: rgba(244,114,182,0.1);

    --btn-primary-bg: linear-gradient(135deg, rgba(236,72,153,0.6), rgba(139,92,246,0.5));
    --btn-primary-hover: linear-gradient(135deg, rgba(236,72,153,0.8), rgba(139,92,246,0.7));
    --btn-success-bg: rgba(16,185,129,0.5); --btn-success-hover: rgba(16,185,129,0.7);

    --dropdown-bg: rgba(18,10,18,0.95);
    --dropdown-toggle-bg: rgba(18,10,18,0.85);
    --table-row-bg: rgba(18,10,18,0.95);
    --table-row-alt-bg: rgba(28,16,26,0.95);
    --table-hover-bg: rgba(236,72,153,0.15);
    --table-container-bg: rgba(18,10,18,0.85);
}

/* ================================================
   Glassmorphism Shared Styles (any non-ocean-slate)
   ================================================ */
#theme-blobs {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

#theme-blobs .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .kpi-card,
[data-color-theme]:not([data-color-theme="ocean-slate"]) .chart-card,
[data-color-theme]:not([data-color-theme="ocean-slate"]) .recent-uploads-section {
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator {
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    background-color: var(--table-container-bg) !important;
    border-color: var(--card-border) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-header {
    background-color: rgba(255,255,255,0.08) !important;
    border-bottom: 1px solid var(--card-border) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-header .tabulator-col {
    border-color: var(--card-border) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    background-color: var(--table-row-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--table-border) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
    background-color: var(--table-row-alt-bg) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-color: var(--table-border) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-footer {
    background-color: var(--table-container-bg) !important;
    border-color: var(--card-border) !important;
    color: var(--text-muted) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-footer .tabulator-page-size {
    background-color: rgba(255,255,255,0.06) !important;
    border-color: var(--card-border) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-footer .tabulator-page {
    color: var(--text-muted) !important;
    border-color: var(--card-border) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-footer .tabulator-page:hover {
    background: rgba(255,255,255,0.1) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"])[data-theme="dark"] .tabulator .tabulator-footer .tabulator-page.active {
    background: rgba(255,255,255,0.15) !important;
    color: var(--text-primary) !important;
    border-color: rgba(255,255,255,0.2) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-toggle {
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    background: var(--dropdown-toggle-bg) !important;
    border-color: var(--card-border) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-menu {
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    background: var(--dropdown-bg) !important;
    border-color: var(--card-border) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-search input {
    background: rgba(255,255,255,0.08) !important;
    border-color: var(--card-border) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-action-btn {
    background: rgba(255,255,255,0.06) !important;
    border-color: var(--card-border) !important;
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-checkbox-item label {
    color: var(--text-primary) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-checkbox-item:hover {
    background: var(--table-hover-bg) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-list {
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-actions {
    border-color: var(--card-border) !important;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .company-dropdown-search {
    border-color: var(--card-border) !important;
}

/* Glass theme KPI cards: use semi-transparent accent borders */
[data-color-theme]:not([data-color-theme="ocean-slate"]) .kpi-card {
    border: 1px solid var(--card-border) !important;
    border-left: none;
    text-align: center;
}

[data-color-theme]:not([data-color-theme="ocean-slate"]) .kpi-card::before {
    display: block;
    height: 3px;
}

/* ================================================
   Color Theme Picker (Sidebar)
   ================================================ */
.sidebar-color-theme {
    padding: 10px 20px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-color-theme > span {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.color-theme-picker {
    position: relative;
    flex: 1;
    min-width: 0;
}

.color-theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.color-theme-toggle:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}

.color-theme-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.color-theme-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.color-theme-arrow {
    font-size: 9px;
    opacity: 0.5;
    flex-shrink: 0;
}

.color-theme-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 200;
    border-radius: 12px;
    background: #1e293b;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.color-theme-menu.open {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.theme-option:hover {
    background: rgba(255,255,255,0.06);
}

.theme-option.active {
    background: rgba(255,255,255,0.08);
}

.theme-option-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.theme-option-name {
    flex: 1;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
}

.theme-option-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: #94a3b8;
}

.theme-option-check {
    color: #5eead4;
    font-size: 14px;
    font-weight: 700;
}

/* Collapsed sidebar: hide theme picker text, show only dot */
.sidebar-collapsed .sidebar-color-theme > span,
.sidebar-collapsed .color-theme-name,
.sidebar-collapsed .color-theme-arrow {
    display: none;
}

.sidebar-collapsed .sidebar-color-theme {
    justify-content: center;
    padding: 8px;
}

.sidebar-collapsed .color-theme-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
}

.sidebar-collapsed .color-theme-menu {
    left: auto;
    right: auto;
    left: calc(100% + 8px);
    bottom: auto;
    top: 0;
    width: 200px;
}

/* ================================================
   Base Layout
   ================================================ */
body {
    margin: 0;
    padding: 0;
    background: var(--bg-body) !important;
    background-image: none !important;
    overflow-x: hidden;
    color: var(--text-primary);
}


/* Page exit overlay (created by navbar.js on navigation) */
#page-exit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
#page-exit-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* SPA content fade-in animation */
@keyframes spaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#spa-content main.spa-fade-in {
    animation: spaFadeIn 0.25s ease forwards;
}

/* Hide original navbar - sidebar replaces it */
header nav {
    display: none !important;
}

/* Content area shift for sidebar (only when sidebar exists) */
body.has-sidebar main.container {
    margin-left: 250px !important;
    max-width: calc(100% - 250px - 48px) !important;
    padding: 32px 24px !important;
    background: transparent !important;
}

body.has-sidebar footer.container {
    display: none !important;
}

/* ================================================
   Sidebar
   ================================================ */
#app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    border-right: 1px solid var(--sidebar-border);
}

/* Brand */
#app-sidebar .sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 14px;
}

#app-sidebar .sidebar-brand img {
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 2px 8px rgba(220,38,38,0.3));
}

#app-sidebar .sidebar-brand span {
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

/* Theme toggle */
#app-sidebar .sidebar-theme-toggle {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#app-sidebar .sidebar-theme-toggle span {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle switch */
.theme-switch {
    position: relative;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch .slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #334155;
    border-radius: 14px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.theme-switch .slider .icon-sun,
.theme-switch .slider .icon-moon {
    font-size: 14px;
    line-height: 1;
}

.theme-switch .slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.theme-switch input:checked + .slider {
    background: #0d9488;
}

.theme-switch input:checked + .slider::after {
    transform: translateX(24px);
}

/* Section label */
#app-sidebar .sidebar-section {
    padding: 16px 20px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #0d9488;
}

/* Nav links */
#app-sidebar .sidebar-nav {
    flex: 1;
    padding: 8px 14px;
    overflow-y: auto;
}

#app-sidebar .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#app-sidebar .sidebar-nav a:hover {
    transform: translateX(3px);
}

#app-sidebar .sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Colored nav items (nth-child offsets by 1 because .sidebar-section div is first child) */
#app-sidebar .sidebar-nav a:nth-child(2) { color: #5eead4; }
#app-sidebar .sidebar-nav a:nth-child(2):hover { background: rgba(94,234,212,0.1); }
#app-sidebar .sidebar-nav a:nth-child(2).active { background: linear-gradient(135deg, #0d9488, #14b8a6); color: #fff; box-shadow: 0 4px 15px rgba(13,148,136,0.4); }

#app-sidebar .sidebar-nav a:nth-child(3) { color: #93c5fd; }
#app-sidebar .sidebar-nav a:nth-child(3):hover { background: rgba(147,197,253,0.1); }
#app-sidebar .sidebar-nav a:nth-child(3).active { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 4px 15px rgba(37,99,235,0.4); }

#app-sidebar .sidebar-nav a:nth-child(4) { color: #fcd34d; }
#app-sidebar .sidebar-nav a:nth-child(4):hover { background: rgba(252,211,77,0.1); }
#app-sidebar .sidebar-nav a:nth-child(4).active { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; box-shadow: 0 4px 15px rgba(217,119,6,0.4); }

#app-sidebar .sidebar-nav a:nth-child(5) { color: #c4b5fd; }
#app-sidebar .sidebar-nav a:nth-child(5):hover { background: rgba(196,181,253,0.1); }
#app-sidebar .sidebar-nav a:nth-child(5).active { background: linear-gradient(135deg, #7c3aed, #8b5cf6); color: #fff; box-shadow: 0 4px 15px rgba(124,58,237,0.4); }

#app-sidebar .sidebar-nav a:nth-child(6) { color: #fdba74; }
#app-sidebar .sidebar-nav a:nth-child(6):hover { background: rgba(253,186,116,0.1); }
#app-sidebar .sidebar-nav a:nth-child(6).active { background: linear-gradient(135deg, #ea580c, #f97316); color: #fff; box-shadow: 0 4px 15px rgba(234,88,12,0.4); }

#app-sidebar .sidebar-nav a:nth-child(7) { color: #f9a8d4; }
#app-sidebar .sidebar-nav a:nth-child(7):hover { background: rgba(249,168,212,0.1); }
#app-sidebar .sidebar-nav a:nth-child(7).active { background: linear-gradient(135deg, #db2777, #ec4899); color: #fff; box-shadow: 0 4px 15px rgba(219,39,119,0.4); }

#app-sidebar .sidebar-nav a.active svg { color: #fff !important; }

/* User section */
#app-sidebar .sidebar-user {
    padding: 18px 16px 22px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

#app-sidebar .sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(13,148,136,0.4);
}

#app-sidebar .sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

#app-sidebar .sidebar-user .user-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#app-sidebar .sidebar-user .user-name {
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
}

#app-sidebar .sidebar-user .user-role {
    color: #5eead4;
    font-size: 11px;
    font-weight: 500;
}

#app-sidebar .sidebar-user .btn-logout {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

#app-sidebar .sidebar-user .btn-logout:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

/* Change Password Button (inline next to username) */
#app-sidebar .sidebar-user .btn-change-pwd {
    background: none;
    border: none;
    color: #64748b;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

#app-sidebar .sidebar-user .btn-change-pwd svg {
    width: 14px;
    height: 14px;
}

#app-sidebar .sidebar-user .btn-change-pwd:hover {
    color: #5eead4;
}

/* Change Password Modal */
.pwd-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.pwd-modal-backdrop.open {
    display: flex;
}

.pwd-modal {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: pwdModalIn 0.2s ease;
}

@keyframes pwdModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.pwd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.pwd-modal-header h3 {
    margin: 0;
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
}

.pwd-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pwd-modal-close:hover {
    color: #f1f5f9;
}

.pwd-modal-body {
    padding: 20px 24px;
}

.pwd-field {
    margin-bottom: 16px;
}

.pwd-field label {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.pwd-field input {
    width: 100%;
    padding: 10px 14px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #f1f5f9;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.pwd-field input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.2);
}

.pwd-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.pwd-btn-cancel {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pwd-btn-cancel:hover {
    background: rgba(255,255,255,0.1);
    color: #f1f5f9;
}

.pwd-btn-save {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.pwd-btn-save:hover {
    box-shadow: 0 4px 14px rgba(13,148,136,0.4);
    transform: translateY(-1px);
}

.pwd-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pwd-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.pwd-alert-error {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}

.pwd-alert-success {
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    color: #6ee7b7;
}

/* Light mode overrides for password modal */
:root .pwd-modal {
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

:root .pwd-modal-header h3 { color: #111827; }
:root .pwd-modal-header { border-bottom-color: #e5e7eb; }
:root .pwd-modal-close { color: #6b7280; }
:root .pwd-modal-close:hover { color: #111827; }
:root .pwd-field label { color: #374151; }
:root .pwd-field input {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}
:root .pwd-field input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
    background: #fff;
}
:root .pwd-modal-footer { border-top-color: #e5e7eb; }
:root .pwd-btn-cancel {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
}
:root .pwd-btn-cancel:hover { background: #e5e7eb; color: #374151; }
:root .pwd-alert-error {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.2);
    color: #dc2626;
}
:root .pwd-alert-success {
    background: rgba(16,185,129,0.08);
    border-color: rgba(16,185,129,0.2);
    color: #059669;
}

/* Dark mode re-applies dark styles */
[data-theme="dark"] .pwd-modal {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
[data-theme="dark"] .pwd-modal-header h3 { color: #f1f5f9; }
[data-theme="dark"] .pwd-modal-header { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .pwd-modal-close { color: #94a3b8; }
[data-theme="dark"] .pwd-modal-close:hover { color: #f1f5f9; }
[data-theme="dark"] .pwd-field label { color: #94a3b8; }
[data-theme="dark"] .pwd-field input {
    background: #0f172a;
    border-color: rgba(255,255,255,0.12);
    color: #f1f5f9;
}
[data-theme="dark"] .pwd-field input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.2);
}
[data-theme="dark"] .pwd-modal-footer { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .pwd-btn-cancel {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: #94a3b8;
}
[data-theme="dark"] .pwd-btn-cancel:hover { background: rgba(255,255,255,0.1); color: #f1f5f9; }
[data-theme="dark"] .pwd-alert-error {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
    color: #fca5a5;
}
[data-theme="dark"] .pwd-alert-success {
    background: rgba(16,185,129,0.15);
    border-color: rgba(16,185,129,0.3);
    color: #6ee7b7;
}

/* ================================================
   Sidebar Toggle Button
   ================================================ */
.sidebar-toggle-btn {
    position: absolute;
    top: 32px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e293b;
    border: 2px solid rgba(255,255,255,0.12);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    padding: 0;
}

.sidebar-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: #0d9488;
    color: #fff;
    border-color: #0d9488;
    box-shadow: 0 2px 8px rgba(13,148,136,0.4);
}

/* Collapsed state: rotate arrow to point right */
.sidebar-collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

/* Sidebar collapsed state */
.sidebar-collapsed #app-sidebar {
    width: 68px;
}

.sidebar-collapsed #app-sidebar .sidebar-brand span,
.sidebar-collapsed #app-sidebar .sidebar-nav a span,
.sidebar-collapsed #app-sidebar .sidebar-section,
.sidebar-collapsed #app-sidebar .sidebar-theme-toggle span,
.sidebar-collapsed #app-sidebar .sidebar-user .user-info,
.sidebar-collapsed #app-sidebar .sidebar-user .btn-logout {
    display: none;
}

.sidebar-collapsed #app-sidebar .sidebar-brand {
    justify-content: center;
    padding: 20px 8px;
}

.sidebar-collapsed #app-sidebar .sidebar-brand img {
    width: 36px;
    height: 36px;
}

.sidebar-collapsed #app-sidebar .sidebar-nav a {
    justify-content: center;
    padding: 12px;
}

.sidebar-collapsed #app-sidebar .sidebar-theme-toggle {
    justify-content: center;
    padding: 10px 8px;
}

.sidebar-collapsed #app-sidebar .sidebar-user {
    justify-content: center;
    padding: 14px 8px;
}

body.sidebar-collapsed.has-sidebar main.container {
    margin-left: 68px !important;
    max-width: calc(100% - 68px - 48px) !important;
}

/* Smooth transitions for sidebar collapse */
#app-sidebar {
    transition: width 0.3s ease;
}

#app-sidebar .sidebar-brand,
#app-sidebar .sidebar-brand span,
#app-sidebar .sidebar-nav a,
#app-sidebar .sidebar-nav a span,
#app-sidebar .sidebar-section,
#app-sidebar .sidebar-theme-toggle,
#app-sidebar .sidebar-theme-toggle span,
#app-sidebar .sidebar-user,
#app-sidebar .sidebar-user .user-info,
#app-sidebar .sidebar-user .btn-logout {
    transition: all 0.3s ease;
}

body.has-sidebar main.container {
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

/* ================================================
   Content Styles (theme-aware)
   ================================================ */

/* Page titles */
main h1 {
    font-size: 26px !important;
    font-weight: 800 !important;
    color: var(--heading-color) !important;
    margin-bottom: 24px !important;
}

/* General cards and containers */
main.container.bg-light {
    background: transparent !important;
}

/* Form controls */
.form-control,
.form-select {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--input-text) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d9488 !important;
    box-shadow: 0 0 0 0.2rem rgba(13,148,136,0.25) !important;
}

.form-label {
    color: var(--text-secondary) !important;
}

/* Buttons */
.btn-primary {
    background: var(--btn-primary-bg) !important;
    border-color: var(--btn-primary-bg) !important;
}

.btn-primary:hover {
    background: var(--btn-primary-hover) !important;
    border-color: var(--btn-primary-hover) !important;
}

.btn-success {
    background: var(--btn-success-bg) !important;
    border-color: var(--btn-success-bg) !important;
}

.btn-success:hover {
    background: var(--btn-success-hover) !important;
    border-color: var(--btn-success-hover) !important;
}

/* Tables (Bootstrap) */
.table {
    color: var(--table-text) !important;
}

.table th {
    color: var(--table-header) !important;
    border-color: var(--table-border) !important;
}

.table td {
    border-color: var(--table-border) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--table-stripe) !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-striped-color: var(--table-text) !important;
    color: var(--table-text) !important;
}
.table-striped > tbody > tr:nth-of-type(even) {
    color: var(--table-text) !important;
}

/* Accordion (guard list page) */
.accordion-item {
    background-color: var(--bg-card) !important;
    border-color: var(--card-border) !important;
}

.accordion-button {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.accordion-button:not(.collapsed) {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.accordion-body {
    background-color: var(--bg-card) !important;
    color: var(--text-secondary) !important;
}

/* Fieldsets (detail pages) */
fieldset {
    border-color: var(--card-border) !important;
}

legend {
    color: var(--text-primary) !important;
}

/* Alerts */
.alert {
    border-radius: 12px !important;
}

/* Links */
a {
    color: #0d9488;
}

a:hover {
    color: #0f766e;
}

/* ApexCharts theme-aware */
.apexcharts-text,
.apexcharts-text tspan {
    fill: var(--chart-text) !important;
}

.apexcharts-legend-text {
    color: var(--chart-text) !important;
}

.apexcharts-gridline {
    stroke: var(--chart-grid) !important;
}

.apexcharts-xaxis line,
.apexcharts-yaxis line {
    stroke: var(--chart-grid) !important;
}

/* Tabulator theme-aware */
.tabulator {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--table-border) !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: var(--card-shadow) !important;
    font-size: 14px !important;
}

.tabulator .tabulator-header {
    background-color: var(--bg-main) !important;
    border-bottom: 2px solid var(--table-border) !important;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: transparent !important;
    border-color: var(--table-border) !important;
    padding: 10px 12px !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    color: var(--table-header) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: var(--table-header) !important;
}

.tabulator .tabulator-tableholder {
    overflow-x: auto !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--table-border) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
    background-color: var(--table-stripe) !important;
}

.tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-color: var(--table-border) !important;
    padding: 10px 12px !important;
    color: var(--text-primary) !important;
}

.tabulator .tabulator-footer {
    background-color: var(--bg-main) !important;
    border-top: 1px solid var(--table-border) !important;
    color: var(--text-muted) !important;
    padding: 8px 12px !important;
}

.tabulator .tabulator-footer .tabulator-page-size {
    background-color: var(--bg-card) !important;
    border-color: var(--table-border) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
}

.tabulator .tabulator-footer .tabulator-page {
    color: var(--text-muted) !important;
    border: 1px solid var(--table-border) !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    margin: 0 2px !important;
    transition: all 0.15s ease;
}

.tabulator .tabulator-footer .tabulator-page:hover {
    background: rgba(13, 148, 136, 0.1) !important;
    border-color: #0d9488 !important;
    color: #0d9488 !important;
}

.tabulator .tabulator-footer .tabulator-page.active {
    background: #0d9488 !important;
    color: #fff !important;
    border-color: #0d9488 !important;
}

.tabulator .tabulator-footer .tabulator-pages {
    margin: 0 8px !important;
}

/* Tabulator — Dark mode (ocean-slate specific with teal header) */
[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator,
[data-theme="dark"]:not([data-color-theme]) .tabulator {
    background-color: #172033 !important;
    border-color: rgba(255,255,255,0.10) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-header,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-header {
    background-color: #0d9488 !important;
    border-bottom: none !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-header .tabulator-col,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-header .tabulator-col {
    border-color: rgba(255,255,255,0.15) !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    color: #fff !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-header .tabulator-col .tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: #fff !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
    background-color: #172033 !important;
    color: #f1f5f9 !important;
    border-color: rgba(255,255,255,0.06) !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even),
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-tableholder .tabulator-table .tabulator-row:nth-child(even) {
    background-color: #1e2d42 !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
    border-color: rgba(255,255,255,0.06) !important;
    color: #f1f5f9 !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-footer,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-footer {
    background-color: #131b2a !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
    color: #94a3b8 !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-footer .tabulator-page-size,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-footer .tabulator-page-size {
    background-color: #172033 !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: #cbd5e1 !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-footer .tabulator-page,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-footer .tabulator-page {
    color: #94a3b8 !important;
    border-color: rgba(255,255,255,0.08) !important;
}

[data-color-theme="ocean-slate"][data-theme="dark"] .tabulator .tabulator-footer .tabulator-page:hover,
[data-theme="dark"]:not([data-color-theme]) .tabulator .tabulator-footer .tabulator-page:hover {
    background: rgba(13,148,136,0.2) !important;
    border-color: #0d9488 !important;
    color: #5eead4 !important;
}

/* ================================================
   Login Page
   ================================================ */
body.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #164e63 100%) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.login-page main.container {
    max-width: 440px !important;
    margin: 0 auto !important;
    background: #fff !important;
    border-radius: 20px !important;
    padding: 40px 36px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.login-page .login-logo {
    text-align: center;
    margin-bottom: 24px;
}

body.login-page .login-logo img {
    max-height: 60px;
    object-fit: contain;
}

body.login-page h1 {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    text-align: center;
    margin-bottom: 4px !important;
}

body.login-page p {
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

body.login-page .form-label {
    color: #374151 !important;
    font-weight: 600;
    font-size: 13px;
}

body.login-page .form-control {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.login-page .form-control:focus {
    border-color: #0d9488 !important;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15) !important;
    background: #fff !important;
}

body.login-page .btn-primary {
    width: 100%;
    padding: 11px !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    background: linear-gradient(135deg, #0d9488, #0f766e) !important;
    border: none !important;
    transition: transform 0.15s, box-shadow 0.15s;
}

body.login-page .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4) !important;
}

body.login-page footer {
    display: none !important;
}

body.login-page .text-muted {
    font-size: 12px !important;
    text-align: center;
}

body.login-page .text-muted a {
    color: #0d9488;
    font-weight: 600;
}

body.login-page .invalid-feedback {
    text-align: center;
    font-size: 13px;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 768px) {
    #app-sidebar {
        width: 60px;
    }
    #app-sidebar .sidebar-brand span,
    #app-sidebar .sidebar-nav a span,
    #app-sidebar .sidebar-section,
    #app-sidebar .sidebar-theme-toggle span,
    #app-sidebar .sidebar-user .user-info,
    #app-sidebar .sidebar-user .btn-change-pwd,
    #app-sidebar .sidebar-user .btn-logout {
        display: none;
    }
    #app-sidebar .sidebar-brand {
        justify-content: center;
        padding: 16px 8px;
    }
    #app-sidebar .sidebar-brand img {
        width: 36px;
        height: 36px;
    }
    #app-sidebar .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }
    #app-sidebar .sidebar-theme-toggle {
        justify-content: center;
        padding: 8px;
    }
    #app-sidebar .sidebar-user {
        justify-content: center;
    }
    body.has-sidebar main.container {
        margin-left: 60px !important;
        max-width: calc(100% - 60px - 24px) !important;
    }
    .sidebar-toggle-btn {
        display: none;
    }
}
