/* ============================================================
   Beacon WISP Support Portal — main.css
   Brand palette: CoreFiber dark navy + purple/pink/yellow accents
   ============================================================ */

/* === THEME SYSTEM ==========================================
   10 themes × 2 modes = 20 complete palettes.
   data-theme: cf-default (a.k.a. midnight, legacy alias)
             | cyberpunk | ocean | ember | palenight | eclipse
             | tokyo-night | nord | dracula | hacker-red
   data-mode:  dark (default) | light
   ============================================================ */

/* Status colors — universal */
:root { --green: #10B981; --amber: #F59E0B; --red: #EF4444; --teal: #0891B2; }

/* ─── CORE FIBER DEFAULT ─── purple / pink / gold ───
   The original Pathfinder theme.  `data-theme="midnight"` is kept as a
   backward-compat alias so existing localStorage preferences keep working. */
:root, [data-theme="cf-default"], [data-theme="midnight"] {
  --navy:         #0C0C2E; --navy-light: #161650;
  --purple:       #7C3AED; --purple-light: #1A1A3E;
  --bg:           #0E0E28; --card: #12122E;
  --text:         #E5E7EB; --muted: #9CA3AF;
  --border:       #2A2A52;
  --indigo-light: #A5B4FC; --indigo-border: #3730A3;
  --row-hover:    #1A1A3E; --row-expanded: #1E1B4A;
  --graph-bg:     #181838;
  --accent-gradient: linear-gradient(90deg, #7C3AED, #ED3470, #EFCC0E);
  --map-legend-bg: rgba(12,12,46,0.85); --map-legend-text: #E5E7EB;
  --plotly-grid: rgba(255,255,255,0.06); --plotly-tick: #6B7280;
  --plotly-hover-bg: #1A1A3E;
  --scrollbar-thumb: #3A3A6A;
  --shimmer-a: #12122E; --shimmer-b: #2A2A52;
  --graph-line-1: #7C3AED; --graph-fill-1: rgba(124,58,237,0.15);
  --graph-line-2: #F59E0B; --graph-fill-2: rgba(245,158,11,0.10);
  --graph-line-3: #0891B2; --graph-fill-3: rgba(8,145,178,0.10);
  --graph-line-4: #F59E0B; --graph-fill-4: rgba(245,158,11,0.08);
  --graph-line-5: #10B981; --graph-fill-5: rgba(16,185,129,0.15);
  --graph-line-alt: #ED3470;
}
[data-theme="cf-default"][data-mode="light"],
[data-theme="midnight"][data-mode="light"] {
  --navy: #131349; --navy-light: #1E1B5E;
  --bg: #F4F3F9; --card: #FFFFFF; --purple-light: #EDE9F6;
  --text: #1F2937; --muted: #6B7280; --border: #E5E7EB;
  --row-hover: #F3F0FF; --row-expanded: #EDE9F6; --graph-bg: #FAFAFF;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #1F2937;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #9CA3AF;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #D1D5DB; --shimmer-a: #F0F0F5; --shimmer-b: #E0E0E8;
}

/* ─── CYBERPUNK ─── neon green / pink / cyan on black ─── */
[data-theme="cyberpunk"] {
  --navy:         #0A0A0A; --navy-light: #151515;
  --purple:       #00FF41; --purple-light: #0A1A0E;
  --bg:           #080808; --card: #111111;
  --text:         #D4D4D4; --muted: #777777;
  --border:       #222222;
  --indigo-light: #00FF41; --indigo-border: #1A3A1A;
  --row-hover:    #0F1A0F; --row-expanded: #0A200A;
  --graph-bg:     #0D0D0D;
  --accent-gradient: linear-gradient(90deg, #00FF41, #FF00FF, #00FFFF);
  --map-legend-bg: rgba(10,10,10,0.90); --map-legend-text: #D4D4D4;
  --plotly-grid: rgba(0,255,65,0.06); --plotly-tick: #555;
  --plotly-hover-bg: #111111;
  --scrollbar-thumb: #2A2A2A;
  --shimmer-a: #111111; --shimmer-b: #1A1A1A;
  --graph-line-1: #00FF41; --graph-fill-1: rgba(0,255,65,0.12);
  --graph-line-2: #FF00FF; --graph-fill-2: rgba(255,0,255,0.10);
  --graph-line-3: #00FFFF; --graph-fill-3: rgba(0,255,255,0.10);
  --graph-line-4: #FFFF00; --graph-fill-4: rgba(255,255,0,0.08);
  --graph-line-5: #00FF41; --graph-fill-5: rgba(0,255,65,0.12);
  --graph-line-alt: #FF00FF;
}
[data-theme="cyberpunk"][data-mode="light"] {
  --navy: #1A1A1A; --navy-light: #252525;
  --bg: #F0F0F0; --card: #FFFFFF; --purple-light: #E8FFE8;
  --purple: #00AA2A;
  --text: #1A1A1A; --muted: #666; --border: #DDD;
  --row-hover: #E8FFE8; --row-expanded: #D0FFD0; --graph-bg: #F8FFF8;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #1A1A1A;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #999;
  --plotly-hover-bg: #FFF;
  --scrollbar-thumb: #CCC; --shimmer-a: #F0F0F0; --shimmer-b: #E0E0E0;
  --indigo-light: #00AA2A;
}

/* ─── OCEAN ─── deep blues / teals / cyan ─── */
[data-theme="ocean"] {
  --navy:         #091420; --navy-light: #0F1D32;
  --purple:       #0EA5E9; --purple-light: #0C1E30;
  --bg:           #0A1628; --card: #0E1C30;
  --text:         #E0F0FF; --muted: #7BA3C7;
  --border:       #1E3A5F;
  --indigo-light: #7DD3FC; --indigo-border: #0C4A6E;
  --row-hover:    #0F2440; --row-expanded: #132C4A;
  --graph-bg:     #0C1A2E;
  --accent-gradient: linear-gradient(90deg, #0EA5E9, #06B6D4, #10B981);
  --map-legend-bg: rgba(9,20,32,0.88); --map-legend-text: #E0F0FF;
  --plotly-grid: rgba(125,211,252,0.06); --plotly-tick: #5A8AB0;
  --plotly-hover-bg: #0F1D32;
  --scrollbar-thumb: #1E3A5F;
  --shimmer-a: #0E1C30; --shimmer-b: #1E3A5F;
  --graph-line-1: #0EA5E9; --graph-fill-1: rgba(14,165,233,0.15);
  --graph-line-2: #06B6D4; --graph-fill-2: rgba(6,182,212,0.10);
  --graph-line-3: #22D3EE; --graph-fill-3: rgba(34,211,238,0.10);
  --graph-line-4: #38BDF8; --graph-fill-4: rgba(56,189,248,0.08);
  --graph-line-5: #10B981; --graph-fill-5: rgba(16,185,129,0.15);
  --graph-line-alt: #A78BFA;
}
[data-theme="ocean"][data-mode="light"] {
  --navy: #0C4A6E; --navy-light: #075985;
  --bg: #F0F7FF; --card: #FFFFFF; --purple-light: #E0F2FE;
  --text: #0C4A6E; --muted: #6B96B5; --border: #BAE6FD;
  --row-hover: #E0F2FE; --row-expanded: #BAE6FD; --graph-bg: #F5FAFF;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #0C4A6E;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #7BA3C7;
  --plotly-hover-bg: #FFF;
  --scrollbar-thumb: #93C5FD; --shimmer-a: #E0F2FE; --shimmer-b: #BAE6FD;
  --indigo-light: #0EA5E9;
}

/* ─── EMBER ─── charcoal / orange / warm red / amber ─── */
[data-theme="ember"] {
  --navy:         #181210; --navy-light: #221A16;
  --purple:       #EA580C; --purple-light: #2D1A0E;
  --bg:           #141010; --card: #1C1614;
  --text:         #F5E6D8; --muted: #A08B7A;
  --border:       #3D2A20;
  --indigo-light: #FB923C; --indigo-border: #7C2D12;
  --row-hover:    #261A14; --row-expanded: #2E1E16;
  --graph-bg:     #1A1412;
  --accent-gradient: linear-gradient(90deg, #EF4444, #EA580C, #F59E0B);
  --map-legend-bg: rgba(24,18,16,0.88); --map-legend-text: #F5E6D8;
  --plotly-grid: rgba(251,146,60,0.06); --plotly-tick: #806B5A;
  --plotly-hover-bg: #221A16;
  --scrollbar-thumb: #3D2A20;
  --shimmer-a: #1C1614; --shimmer-b: #3D2A20;
  --graph-line-1: #EA580C; --graph-fill-1: rgba(234,88,12,0.15);
  --graph-line-2: #F59E0B; --graph-fill-2: rgba(245,158,11,0.10);
  --graph-line-3: #EF4444; --graph-fill-3: rgba(239,68,68,0.10);
  --graph-line-4: #FB923C; --graph-fill-4: rgba(251,146,60,0.08);
  --graph-line-5: #10B981; --graph-fill-5: rgba(16,185,129,0.15);
  --graph-line-alt: #FBBF24;
}
[data-theme="ember"][data-mode="light"] {
  --navy: #44241A; --navy-light: #5C3420;
  --bg: #FFF8F5; --card: #FFFFFF; --purple-light: #FFF1E6;
  --text: #44241A; --muted: #96705A; --border: #FED7AA;
  --row-hover: #FFF1E6; --row-expanded: #FFEDD5; --graph-bg: #FFFCFA;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #44241A;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #A08B7A;
  --plotly-hover-bg: #FFF;
  --scrollbar-thumb: #FDBA74; --shimmer-a: #FFF1E6; --shimmer-b: #FFEDD5;
  --indigo-light: #EA580C;
}

/* ─── PALENIGHT ─── Termius / Material Palenight ─── deep purple-blue / pastel cyan + mauve ─── */
[data-theme="palenight"] {
  --navy:         #1F2233; --navy-light: #292D3E;
  --purple:       #C792EA; --purple-light: #3A3F58;
  --bg:           #292D3E; --card: #2F344A;
  --text:         #BFC7D5; --muted: #676E95;
  --border:       #3E4254;
  --indigo-light: #89DDFF; --indigo-border: #3E4254;
  --row-hover:    #353A50; --row-expanded: #3E435A;
  --graph-bg:     #252938;
  --accent-gradient: linear-gradient(90deg, #89DDFF, #C792EA, #F78C6C);
  --map-legend-bg: rgba(41,45,62,0.88); --map-legend-text: #BFC7D5;
  --plotly-grid: rgba(199,146,234,0.06); --plotly-tick: #676E95;
  --plotly-hover-bg: #2F344A;
  --scrollbar-thumb: #3E4254;
  --shimmer-a: #2F344A; --shimmer-b: #3E4254;
  --graph-line-1: #89DDFF; --graph-fill-1: rgba(137,221,255,0.15);
  --graph-line-2: #FFCB6B; --graph-fill-2: rgba(255,203,107,0.10);
  --graph-line-3: #C3E88D; --graph-fill-3: rgba(195,232,141,0.12);
  --graph-line-4: #F78C6C; --graph-fill-4: rgba(247,140,108,0.10);
  --graph-line-5: #C792EA; --graph-fill-5: rgba(199,146,234,0.15);
  --graph-line-alt: #F07178;
}
[data-theme="palenight"][data-mode="light"] {
  --navy: #2D2A4E; --navy-light: #3A3760;
  --bg: #FAFAFC; --card: #FFFFFF; --purple-light: #F0EAFB;
  --purple: #6B5DDA;
  --text: #4A4860; --muted: #8796B0; --border: #E1E1E8;
  --row-hover: #F0EAFB; --row-expanded: #E3D9F6; --graph-bg: #FCFCFE;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #4A4860;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #8796B0;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #C5C9D9; --shimmer-a: #F0EAFB; --shimmer-b: #E3D9F6;
  --indigo-light: #6B5DDA;
  --graph-line-1: #1E88E5; --graph-fill-1: rgba(30,136,229,0.12);
  --graph-line-2: #F4A100; --graph-fill-2: rgba(244,161,0,0.10);
  --graph-line-3: #43A047; --graph-fill-3: rgba(67,160,71,0.10);
  --graph-line-4: #E65100; --graph-fill-4: rgba(230,81,0,0.10);
  --graph-line-5: #6B5DDA; --graph-fill-5: rgba(107,93,218,0.12);
  --graph-line-alt: #D81B60;
}

/* ─── ECLIPSE ─── near-black + crimson — preserves night vision,
   low stimulation for long NOC shifts.  Inspired by cockpit / control-
   room red lighting that doesn't constrict your pupils. ─── */
[data-theme="eclipse"] {
  --navy:         #050505; --navy-light: #120505;
  --purple:       #DC2626; --purple-light: #1F0A0A;
  --bg:           #0A0A0A; --card: #141010;
  --text:         #E5E5E5; --muted: #808080;
  --border:       #2A1010;
  --indigo-light: #FCA5A5; --indigo-border: #7F1D1D;
  --row-hover:    #1F0808; --row-expanded: #2A0F0F;
  --graph-bg:     #0F0606;
  --accent-gradient: linear-gradient(90deg, #B91C1C, #DC2626, #F97316);
  --map-legend-bg: rgba(10,10,10,0.90); --map-legend-text: #E5E5E5;
  --plotly-grid: rgba(220,38,38,0.06); --plotly-tick: #808080;
  --plotly-hover-bg: #1A0808;
  --scrollbar-thumb: #2A1010;
  --shimmer-a: #141010; --shimmer-b: #2A1010;
  --graph-line-1: #EF4444; --graph-fill-1: rgba(239,68,68,0.15);
  --graph-line-2: #F97316; --graph-fill-2: rgba(249,115,22,0.10);
  --graph-line-3: #FB923C; --graph-fill-3: rgba(251,146,60,0.10);
  --graph-line-4: #FBBF24; --graph-fill-4: rgba(251,191,36,0.08);
  --graph-line-5: #10B981; --graph-fill-5: rgba(16,185,129,0.15);
  --graph-line-alt: #F472B6;
}
[data-theme="eclipse"][data-mode="light"] {
  --navy: #3D0808; --navy-light: #4A1010;
  --bg: #FAF5F5; --card: #FFFFFF; --purple-light: #FDECEC;
  --purple: #B91C1C;
  --text: #1A0808; --muted: #806060; --border: #E5D5D5;
  --row-hover: #FDECEC; --row-expanded: #FBD5D5; --graph-bg: #FFFAFA;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #1A0808;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #806060;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #FCA5A5; --shimmer-a: #FDECEC; --shimmer-b: #FBD5D5;
  --indigo-light: #B91C1C;
  --graph-line-1: #DC2626; --graph-fill-1: rgba(220,38,38,0.12);
  --graph-line-2: #EA580C; --graph-fill-2: rgba(234,88,12,0.10);
  --graph-line-3: #D97706; --graph-fill-3: rgba(217,119,6,0.10);
  --graph-line-4: #CA8A04; --graph-fill-4: rgba(202,138,4,0.08);
  --graph-line-5: #16A34A; --graph-fill-5: rgba(22,163,74,0.12);
  --graph-line-alt: #DB2777;
}

/* ─── TOKYO NIGHT ─── soft blue-purple with vibrant accents ─── */
[data-theme="tokyo-night"] {
  --navy:         #16161E; --navy-light: #1A1B26;
  --purple:       #BB9AF7; --purple-light: #2E2F44;
  --bg:           #1A1B26; --card: #24283B;
  --text:         #C0CAF5; --muted: #565F89;
  --border:       #292E42;
  --indigo-light: #7AA2F7; --indigo-border: #3D59A1;
  --row-hover:    #2E3149; --row-expanded: #353A52;
  --graph-bg:     #1F2233;
  --accent-gradient: linear-gradient(90deg, #7AA2F7, #BB9AF7, #F7768E);
  --map-legend-bg: rgba(22,22,30,0.90); --map-legend-text: #C0CAF5;
  --plotly-grid: rgba(187,154,247,0.06); --plotly-tick: #565F89;
  --plotly-hover-bg: #24283B;
  --scrollbar-thumb: #3B4261;
  --shimmer-a: #24283B; --shimmer-b: #3B4261;
  --graph-line-1: #7AA2F7; --graph-fill-1: rgba(122,162,247,0.15);
  --graph-line-2: #E0AF68; --graph-fill-2: rgba(224,175,104,0.10);
  --graph-line-3: #9ECE6A; --graph-fill-3: rgba(158,206,106,0.12);
  --graph-line-4: #F7768E; --graph-fill-4: rgba(247,118,142,0.10);
  --graph-line-5: #BB9AF7; --graph-fill-5: rgba(187,154,247,0.15);
  --graph-line-alt: #7DCFFF;
}
[data-theme="tokyo-night"][data-mode="light"] {
  --navy: #2E3149; --navy-light: #3B4261;
  --bg: #E1E2E7; --card: #FFFFFF; --purple-light: #DDD3F3;
  --purple: #5A4A78;
  --text: #343B58; --muted: #6172B0; --border: #C4C8DA;
  --row-hover: #DDD3F3; --row-expanded: #CBC2EA; --graph-bg: #ECECF4;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #343B58;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #6172B0;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #B4B8CE; --shimmer-a: #DDD3F3; --shimmer-b: #CBC2EA;
  --indigo-light: #34548A;
  --graph-line-1: #34548A; --graph-fill-1: rgba(52,84,138,0.12);
  --graph-line-2: #8F5E15; --graph-fill-2: rgba(143,94,21,0.10);
  --graph-line-3: #485E30; --graph-fill-3: rgba(72,94,48,0.10);
  --graph-line-4: #8C4351; --graph-fill-4: rgba(140,67,81,0.10);
  --graph-line-5: #5A4A78; --graph-fill-5: rgba(90,74,120,0.12);
  --graph-line-alt: #166775;
}

/* ─── NORD ─── soft Scandinavian blues / frost on polar night ─── */
[data-theme="nord"] {
  --navy:         #242933; --navy-light: #2E3440;
  --purple:       #88C0D0; --purple-light: #3B4252;
  --bg:           #2E3440; --card: #3B4252;
  --text:         #ECEFF4; --muted: #6E7891;
  --border:       #434C5E;
  --indigo-light: #88C0D0; --indigo-border: #5E81AC;
  --row-hover:    #434C5E; --row-expanded: #4C566A;
  --graph-bg:     #353B49;
  --accent-gradient: linear-gradient(90deg, #5E81AC, #88C0D0, #A3BE8C);
  --map-legend-bg: rgba(46,52,64,0.90); --map-legend-text: #ECEFF4;
  --plotly-grid: rgba(136,192,208,0.06); --plotly-tick: #6E7891;
  --plotly-hover-bg: #3B4252;
  --scrollbar-thumb: #4C566A;
  --shimmer-a: #3B4252; --shimmer-b: #434C5E;
  --graph-line-1: #88C0D0; --graph-fill-1: rgba(136,192,208,0.15);
  --graph-line-2: #EBCB8B; --graph-fill-2: rgba(235,203,139,0.10);
  --graph-line-3: #A3BE8C; --graph-fill-3: rgba(163,190,140,0.12);
  --graph-line-4: #D08770; --graph-fill-4: rgba(208,135,112,0.10);
  --graph-line-5: #B48EAD; --graph-fill-5: rgba(180,142,173,0.15);
  --graph-line-alt: #BF616A;
}
[data-theme="nord"][data-mode="light"] {
  --navy: #2E3440; --navy-light: #3B4252;
  --bg: #ECEFF4; --card: #FFFFFF; --purple-light: #E5E9F0;
  --purple: #5E81AC;
  --text: #2E3440; --muted: #6E7891; --border: #D8DEE9;
  --row-hover: #E5E9F0; --row-expanded: #D8DEE9; --graph-bg: #F8F9FB;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #2E3440;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #6E7891;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #C2C9D6; --shimmer-a: #E5E9F0; --shimmer-b: #D8DEE9;
  --indigo-light: #5E81AC;
}

/* ─── DRACULA ─── purple / cyan / pink — vibrant classic ─── */
[data-theme="dracula"] {
  --navy:         #1E1F29; --navy-light: #282A36;
  --purple:       #BD93F9; --purple-light: #44475A;
  --bg:           #282A36; --card: #343746;
  --text:         #F8F8F2; --muted: #6272A4;
  --border:       #44475A;
  --indigo-light: #8BE9FD; --indigo-border: #6272A4;
  --row-hover:    #3D4154; --row-expanded: #44475A;
  --graph-bg:     #2D2F3D;
  --accent-gradient: linear-gradient(90deg, #FF79C6, #BD93F9, #8BE9FD);
  --map-legend-bg: rgba(40,42,54,0.90); --map-legend-text: #F8F8F2;
  --plotly-grid: rgba(189,147,249,0.06); --plotly-tick: #6272A4;
  --plotly-hover-bg: #343746;
  --scrollbar-thumb: #44475A;
  --shimmer-a: #343746; --shimmer-b: #44475A;
  --graph-line-1: #8BE9FD; --graph-fill-1: rgba(139,233,253,0.15);
  --graph-line-2: #F1FA8C; --graph-fill-2: rgba(241,250,140,0.10);
  --graph-line-3: #50FA7B; --graph-fill-3: rgba(80,250,123,0.12);
  --graph-line-4: #FFB86C; --graph-fill-4: rgba(255,184,108,0.10);
  --graph-line-5: #BD93F9; --graph-fill-5: rgba(189,147,249,0.15);
  --graph-line-alt: #FF79C6;
}
[data-theme="dracula"][data-mode="light"] {
  --navy: #44475A; --navy-light: #6272A4;
  --bg: #F8F8F2; --card: #FFFFFF; --purple-light: #EFE5FC;
  --purple: #7B43D6;
  --text: #282A36; --muted: #6272A4; --border: #D8D8D0;
  --row-hover: #EFE5FC; --row-expanded: #E4D5F9; --graph-bg: #FCFCF7;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #282A36;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #6272A4;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #BDBDB0; --shimmer-a: #EFE5FC; --shimmer-b: #E4D5F9;
  --indigo-light: #7B43D6;
}

/* ─── HACKER RED ─── pure black + vivid red — classic terminal vibe.
   High contrast, single-hue accent.  Distinct from Eclipse which is
   muted/professional crimson; this one leans into the "Matrix in red"
   aesthetic.  Graph data uses warm spread (red → orange → amber → pink)
   plus a green for status so series stay distinguishable. ─── */
[data-theme="hacker-red"] {
  --navy:         #000000; --navy-light: #0A0000;
  --purple:       #FF3030; --purple-light: #1A0000;
  --bg:           #000000; --card: #0A0000;
  --text:         #FF3030; --muted: #802020;
  --border:       #330000;
  --indigo-light: #FF6666; --indigo-border: #660000;
  --row-hover:    #1A0000; --row-expanded: #2A0000;
  --graph-bg:     #050000;
  --accent-gradient: linear-gradient(90deg, #FF0000, #FF3030, #FF8800);
  --map-legend-bg: rgba(0,0,0,0.92); --map-legend-text: #FF3030;
  --plotly-grid: rgba(255,48,48,0.07); --plotly-tick: #802020;
  --plotly-hover-bg: #0A0000;
  --scrollbar-thumb: #330000;
  --shimmer-a: #0A0000; --shimmer-b: #1A0000;
  --graph-line-1: #FF3030; --graph-fill-1: rgba(255,48,48,0.18);
  --graph-line-2: #FF8800; --graph-fill-2: rgba(255,136,0,0.10);
  --graph-line-3: #FFAA00; --graph-fill-3: rgba(255,170,0,0.10);
  --graph-line-4: #FF0066; --graph-fill-4: rgba(255,0,102,0.10);
  --graph-line-5: #00FF66; --graph-fill-5: rgba(0,255,102,0.15);
  --graph-line-alt: #FFCC00;
}
[data-theme="hacker-red"][data-mode="light"] {
  --navy: #800000; --navy-light: #A00000;
  --bg: #FFF5F5; --card: #FFFFFF; --purple-light: #FFE0E0;
  --purple: #CC0000;
  --text: #800000; --muted: #B05050; --border: #FFCCCC;
  --row-hover: #FFE0E0; --row-expanded: #FFCCCC; --graph-bg: #FFFAFA;
  --map-legend-bg: rgba(255,255,255,0.92); --map-legend-text: #800000;
  --plotly-grid: rgba(0,0,0,0.06); --plotly-tick: #B05050;
  --plotly-hover-bg: #FFFFFF;
  --scrollbar-thumb: #FF9090; --shimmer-a: #FFE0E0; --shimmer-b: #FFCCCC;
  --indigo-light: #CC0000;
  --graph-line-1: #CC0000; --graph-fill-1: rgba(204,0,0,0.12);
  --graph-line-2: #D97706; --graph-fill-2: rgba(217,119,6,0.10);
  --graph-line-3: #CA8A04; --graph-fill-3: rgba(202,138,4,0.10);
  --graph-line-4: #BE185D; --graph-fill-4: rgba(190,24,93,0.10);
  --graph-line-5: #15803D; --graph-fill-5: rgba(21,128,61,0.12);
  --graph-line-alt: #B45309;
}

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

body {
  font-family: 'Segoe UI', Calibri, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* === TOP NAV ================================================ */
.topnav {
  background: var(--navy);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
}

/* Gradient accent bar at bottom of nav */
.topnav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

/* --- Logo --------------------------------------------------- */
.logo {
  color: white;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* --- Nav filter dropdowns ----------------------------------- */
.nav-filters {
  display: flex;
  gap: 12px;
  margin-left: 40px;
  align-items: center;
}

.nav-filters label {
  color: #9CA3AF;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-filters select {
  background: var(--navy-light);
  border: 1px solid var(--indigo-border);
  color: white;
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.nav-filters select:focus {
  outline: none;
  border-color: var(--purple);
}

/* --- Return-to-map button (only visible when a site is selected) --- */
.back-to-map-wrap {
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}
.back-to-map-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--indigo-light);
  font: 600 12px/1 inherit;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.back-to-map-btn:hover {
  background: var(--row-hover);
  border-color: var(--purple);
}
/* Hide on full-map view; show as soon as a site is selected.  Uses
   :has() to avoid wiring extra Alpine state — supported in all modern
   browsers (Chrome 105+, Firefox 121+, Safari 15.4+).  If you need to
   support older browsers, remove this rule and the button stays visible
   (clicking on full-map view is a harmless no-op). */
body:not(:has(.main.site-active)) .back-to-map-wrap {
  display: none;
}

/* --- Site search combo -------------------------------------- */
.site-search-wrap {
  position: relative;
}

.site-search-input {
  background: var(--navy-light);
  border: 1px solid var(--indigo-border);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  width: 200px;
}

.site-search-input::placeholder {
  color: #6B7280;
}

.site-search-input:focus {
  outline: none;
  border-color: var(--purple);
}

.site-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--navy);
  border: 1px solid var(--indigo-border);
  border-radius: 0 0 6px 6px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.site-search-item {
  padding: 8px 12px;
  font-size: 13px;
  color: #D1D5DB;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.site-search-item:hover,
.site-search-item.highlighted {
  background: var(--purple);
  color: white;
}

[x-cloak] { display: none !important; }

/* --- Theme selector ----------------------------------------- */
.theme-menu {
  position: relative;
}

.theme-btn {
  background: none;
  border: 1px solid var(--indigo-border);
  color: var(--indigo-light);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
}

.theme-btn:hover {
  border-color: var(--purple);
  color: white;
}

.theme-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--navy);
  border: 1px solid var(--indigo-border);
  border-radius: 8px;
  padding: 10px;
  min-width: 200px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.theme-section {
  margin-bottom: 10px;
}

.theme-section:last-child {
  margin-bottom: 0;
}

.theme-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #D1D5DB;
  transition: background 0.1s;
}

.theme-option:hover {
  background: var(--row-hover);
}

.theme-option.active {
  background: var(--purple);
  color: white;
}

.theme-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.theme-mode-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* --- Nav right-side controls -------------------------------- */
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-badge {
  background: var(--navy-light);
  color: var(--indigo-light);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
}

.weather-toggle {
  background: none;
  border: 1px solid var(--indigo-border);
  color: var(--indigo-light);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.15s;
}

.weather-toggle:hover {
  border-color: var(--purple);
  color: white;
}

.weather-toggle.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}

.weather-toggle svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* === MAIN LAYOUT ============================================ */
/* Default: map fills the page. On site select, panels slide in */
.main {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
}

/* === DEVICE PANEL =========================================== */
/* Hidden by default; slides in when a site is selected         */
.device-panel {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  display: flex;
  flex-direction: column;
  transition: width 0.35s ease, min-width 0.35s ease;
}

/* When a site is active, panel takes ~75% */
.main.site-active .device-panel {
  width: 75%;
  min-width: 400px;
  overflow-y: auto;
}

/* Map fills remaining space */
.main .map-container {
  flex: 1;
  min-width: 0;
  transition: flex 0.35s ease;
}

/* Panel header — dark navy bar */
.panel-header {
  padding: 12px 16px;
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.panel-header .count {
  background: var(--purple);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
}

.panel-empty,
.panel-empty-inline {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.panel-empty-inline {
  padding: 12px 16px;
  font-size: 12px;
}

/* === COLLAPSIBLE INFRASTRUCTURE SECTION ===================== */
.infra-collapse-header {
  padding: 10px 16px;
  background: var(--navy);
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-top: 2px solid var(--border);
  flex-shrink: 0;
}

.infra-collapse-header:hover {
  background: var(--navy-light);
}

.infra-collapse-header .count {
  background: var(--purple);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: auto;
  margin-right: 10px;
}

.infra-collapse-header .collapse-arrow {
  font-size: 12px;
  transition: transform 0.2s;
}

.infra-collapse-header.open .collapse-arrow {
  transform: rotate(90deg);
}

.infra-collapse-body {
  display: none;
}

.infra-collapse-body.open {
  display: block;
}

/* === SECTION HEADERS (inside infrastructure) ================ */
.section-header {
  padding: 8px 16px;
  background: var(--purple-light);
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.section-header .section-count {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}

/* === DEVICE ROWS ============================================ */
.device-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.device-row:hover {
  background: var(--row-hover);
}

.device-row.expanded {
  background: var(--row-expanded);
}

.device-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Status dots -------------------------------------------- */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.status-dot.amber {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.status-dot.red {
  background: var(--red);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
  animation: pulse-red 2s infinite;
}

.status-dot.gray {
  background: #9CA3AF;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 0 12px rgba(239, 68, 68, 0.7); }
}

/* --- Device info -------------------------------------------- */
.device-info {
  flex: 1;
  min-width: 0;
}

.device-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.device-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* --- Capacity badges ---------------------------------------- */
.capacity-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.capacity-badge.open   { background: #D1FAE5; color: #065F46; }
.capacity-badge.limited { background: #FEF3C7; color: #92400E; }
.capacity-badge.full   { background: #FEE2E2; color: #991B1B; }
.capacity-badge.down   { background: #FEE2E2; color: #991B1B; }

/* --- Expand arrow ------------------------------------------- */
.expand-arrow {
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.device-row.expanded .expand-arrow {
  transform: rotate(90deg);
  color: var(--purple);
}

/* === EXPANDED DEVICE AREA (graphs) ========================== */
.device-expanded {
  display: none;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.device-row.expanded + .device-expanded {
  display: block;
}

/* --- Graph time picker --------------------------------------- */
.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--navy);
  border-radius: 6px;
  margin-bottom: 6px;
}

.graph-toolbar .toolbar-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  flex-shrink: 0;
}

.graph-toolbar .time-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.graph-toolbar .time-btn:hover {
  border-color: var(--purple);
  color: var(--text);
}

.graph-toolbar .time-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}

.graph-toolbar .refresh-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--indigo-light);
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.graph-toolbar .refresh-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* --- Graph grid --------------------------------------------- */
.graph-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.graph-placeholder {
  background: var(--graph-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  height: 160px;
  display: flex;
  flex-direction: column;
}

/* Ensure Plotly gets pointer events */
.graph-body,
.graph-body > div {
  pointer-events: auto;
}

/* Style the Plotly modebar for dark mode */
.graph-placeholder .modebar {
  background: transparent !important;
}
.graph-placeholder .modebar-btn path {
  fill: #6B7280 !important;
}
.graph-placeholder .modebar-btn:hover path {
  fill: #A5B4FC !important;
}

.graph-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.graph-expand-btns {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.graph-placeholder:hover .graph-expand-btns {
  opacity: 1;
}
.graph-expand-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 3px;
  line-height: 1;
}
.graph-expand-btn:hover {
  color: var(--text);
}

/* Graph modal overlay */
.graph-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.graph-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90vw;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

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

.graph-modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.graph-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.graph-modal-actions button,
.graph-modal-actions a {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}

.graph-modal-actions button:hover,
.graph-modal-actions a:hover {
  border-color: var(--purple);
  color: var(--text);
}

.graph-modal-close {
  border: none !important;
  font-size: 20px !important;
  padding: 0 6px !important;
  color: var(--muted) !important;
}

.graph-modal-close:hover {
  color: var(--red) !important;
}

.graph-modal-body {
  flex: 1;
  padding: 16px 20px;
  overflow: auto;
}

.graph-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Plotly containers inside graph-body */
.graph-body > div {
  width: 100%;
  height: 100%;
}

/* --- Device actions (below graphs) -------------------------- */
.device-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.explore-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 0;
}

.explore-link:hover {
  color: var(--pink);
}

/* --- Tool buttons ------------------------------------------- */
.tool-buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.tool-btn {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.tool-btn:hover {
  border-color: var(--purple);
  color: var(--indigo-light);
}

.tool-btn.danger {
  color: var(--red);
}

.tool-btn.danger:hover {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* === MAP ==================================================== */
.map-container {
  position: relative;
  border-left: 2px solid var(--border);
  overflow: hidden;
}

/* Leaflet pane z-indices — keep defaults */

#map {
  width: 100%;
  height: 100%;
}

/* Map overlay — top-right corner */
.map-overlay-top {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.map-site-label {
  background: var(--navy);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.map-site-label .map-coords {
  color: var(--yellow);
}

.map-legend {
  background: var(--map-legend-bg);
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-size: 11px;
  color: var(--map-legend-text);
}

.map-legend-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: white;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.map-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* === BOTTOM STATUS BAR ====================================== */
.statusbar {
  height: 28px;
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 11px;
  color: #6B7280;
  gap: 24px;
  flex-shrink: 0;
}

.statusbar .status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.statusbar .status-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.statusbar .status-value {
  color: var(--indigo-light);
}

/* === LOGIN PAGE ============================================= */
.login-page {
  width: 100%;
  height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-brand {
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-logo-icon svg {
  width: 32px;
  height: 32px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.login-btn:hover {
  background: #5904A0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.login-input {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.login-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.login-input::placeholder {
  color: var(--muted);
}

.login-btn-local {
  background: var(--purple);
}

.login-btn-sso {
  background: #2F2F2F;
  color: white;
}

.login-btn-sso:hover {
  background: #404040;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.login-footer {
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-gradient-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

/* === HTMX LOADING INDICATORS ================================ */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: flex;
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  background: rgba(19, 19, 73, 0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 13px;
  align-items: center;
  gap: 10px;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Loading shimmer on device rows during HTMX fetch */
.device-expanded.htmx-request::before {
  content: '';
  display: block;
  height: 80px;
  background: linear-gradient(90deg, var(--shimmer-a) 25%, var(--shimmer-b) 50%, var(--shimmer-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  margin-bottom: 8px;
}

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

/* === SCROLLBAR STYLING ====================================== */
.panel-content::-webkit-scrollbar {
  width: 6px;
}

.panel-content::-webkit-scrollbar-track {
  background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Firefox scrollbar */
.panel-content {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* === RESPONSIVE ============================================= */

/* Tablets: stack vertically */
@media (max-width: 1200px) {
  .main {
    flex-direction: column;
  }
  .main.site-active .device-panel {
    width: 100%;
    min-width: 0;
    max-height: 55vh;
  }
  .map-container {
    border-left: none;
    border-top: 2px solid var(--border);
    min-height: 200px;
  }
}

/* Mobile: single column */
@media (max-width: 768px) {
  .topnav {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .nav-filters {
    margin-left: 0;
    width: 100%;
    order: 3;
  }

  .nav-filters select {
    flex: 1;
  }

  .nav-right {
    margin-left: auto;
  }

  .map-container {
    height: 160px;
  }

  .graph-grid {
    grid-template-columns: 1fr;
  }

  .map-overlay-top {
    top: 8px;
    right: 8px;
  }

  .map-site-label {
    font-size: 12px;
    padding: 6px 12px;
  }

  /* Hide legend on small screens to save space */
  .map-legend {
    display: none;
  }
}

/* === UTILITY ================================================ */

/* Smooth transition for HTMX swaps */
.htmx-settling .device-expanded {
  opacity: 0;
}

.device-expanded {
  transition: opacity 0.2s ease-in;
}

/* Focus-visible for keyboard navigation */
.device-row:focus-visible,
.tool-btn:focus-visible,
.weather-toggle:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* Tower marker on map (used from JS) */
.tower-marker {
  width: 36px;
  height: 36px;
  background: var(--navy);
  border: 3px solid var(--yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.tower-marker svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* Site marker on map (used from JS) */
.site-marker {
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.site-marker.green  { background: var(--green); }
.site-marker.amber  { background: var(--amber); }
.site-marker.red    { background: var(--red); }

/* Permanent site name labels on map */
.leaflet-tooltip.site-label {
  background: var(--map-legend-bg);
  color: var(--map-legend-text);
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Segoe UI', Arial, sans-serif;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.leaflet-tooltip.site-label::before {
  border-top-color: rgba(12, 12, 46, 0.75);
}
