/* VelocityBench Dashboard - themed fleet chrome (default: dark) */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050607;
  --bg-elevated: #0a0c10;
  --surface: #0e1218;
  --panel: #12171f;
  --panel-2: #171d27;
  --panel-border: rgba(180, 200, 230, 0.1);
  --panel-border-strong: rgba(200, 220, 255, 0.16);
  --text: #f4f7fb;
  --text-muted: #9aa6b8;
  --text-dim: #667084;
  --accent: #4cc9f0;
  --accent-soft: rgba(76, 201, 240, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.38);
  --red: #ff3355;
  --red-hover: #ff5570;
  --cyan: #2de2e6;
  --warn: #f0b429;
  --good: #46d39a;
  --soft: #7ea6ff;
  --input-bg: rgba(4, 6, 9, 0.88);
  --input-border: rgba(180, 200, 230, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(0, 0, 0, 0.45) inset,
    0 12px 36px rgba(0, 0, 0, 0.45);
  --carbon-fine: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.028) 0 1px,
      transparent 1px 3px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(0, 0, 0, 0.28) 0 1px,
      transparent 1px 3px
    );
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--active-border);
  --trim: rgba(76, 201, 240, 0.35);
  --trim-soft: rgba(76, 201, 240, 0.12);
  --hover-border: var(--hover-border);
  --active-border: rgba(76, 201, 240, 0.65);
  --kpi-sheen: rgba(255, 255, 255, 0.04);
  --brand-mark-mid: #6b778c;
  --brand-mark-edge: rgba(200, 255, 74, 0.55);
  --brand-mark-glow: rgba(200, 255, 74, 0.18);
  --logo-grad-a: #f8fafc;
  --logo-grad-b: #cbd5e1;
  --primary-btn-fg: #0a1008;
  --body-radial-1: rgba(76, 201, 240, 0.08);
  --body-radial-2: rgba(200, 255, 74, 0.04);
  --body-grad-top: #0b0e13;
  --body-grad-bot: #030405;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
  --red: var(--status-red);
  --warn: var(--status-warn);
  --good: var(--status-good);
}

/* Theme: Dark (default) - previous fidelity */
html[data-theme="dark"],
:root {
  color-scheme: dark;
}

/* Theme: Dark + Brass trim (restrained accents only) */
html[data-theme="dark-brass"] {
  color-scheme: dark;
  --bg: #050607;
  --bg-elevated: #0a0c10;
  --surface: #0e1218;
  --panel: #12171f;
  --panel-2: #171d27;
  --panel-border: rgba(201, 162, 99, 0.14);
  --panel-border-strong: rgba(212, 175, 110, 0.28);
  --text: #f4f7fb;
  --text-muted: #9aa6b8;
  --text-dim: #667084;
  --accent: #c9a263;
  --accent-soft: rgba(201, 162, 99, 0.14);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.38);
  --soft: #d2b57c;
  --input-bg: rgba(4, 6, 9, 0.88);
  --input-border: rgba(201, 162, 99, 0.2);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(201, 162, 99, 0.5);
  --trim: rgba(201, 162, 99, 0.4);
  --trim-soft: rgba(201, 162, 99, 0.12);
  --hover-border: rgba(212, 175, 110, 0.5);
  --active-border: rgba(224, 196, 138, 0.7);
  --kpi-sheen: rgba(224, 196, 138, 0.06);
  --brand-mark-mid: #8a7350;
  --brand-mark-edge: rgba(212, 175, 110, 0.65);
  --brand-mark-glow: rgba(201, 162, 99, 0.16);
  --logo-grad-a: #fff4df;
  --logo-grad-b: #c9a263;
  --body-radial-1: rgba(201, 162, 99, 0.05);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #0b0e13;
  --body-grad-bot: #030405;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: Midnight / slate */
html[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #070a12;
  --bg-elevated: #0b1020;
  --surface: #10182a;
  --panel: #141e32;
  --panel-2: #1a2640;
  --panel-border: rgba(140, 170, 220, 0.12);
  --panel-border-strong: rgba(160, 190, 240, 0.2);
  --text: #eef3ff;
  --text-muted: #9aadc8;
  --text-dim: #6a7d9a;
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.35);
  --soft: #9bb6ff;
  --input-bg: rgba(5, 8, 16, 0.9);
  --input-border: rgba(140, 170, 220, 0.16);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(122, 162, 255, 0.55);
  --trim: rgba(122, 162, 255, 0.4);
  --trim-soft: rgba(122, 162, 255, 0.12);
  --hover-border: rgba(122, 162, 255, 0.5);
  --active-border: rgba(154, 186, 255, 0.7);
  --kpi-sheen: rgba(122, 162, 255, 0.05);
  --brand-mark-mid: #5a6f9a;
  --brand-mark-edge: rgba(122, 162, 255, 0.55);
  --brand-mark-glow: rgba(122, 162, 255, 0.18);
  --logo-grad-a: #eef3ff;
  --logo-grad-b: #7aa2ff;
  --body-radial-1: rgba(122, 162, 255, 0.09);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #0c1220;
  --body-grad-bot: #04060c;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: Graphite */
html[data-theme="graphite"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --surface: #161618;
  --panel: #1b1b1e;
  --panel-2: #222226;
  --panel-border: rgba(220, 220, 230, 0.1);
  --panel-border-strong: rgba(230, 230, 240, 0.18);
  --text: #f2f2f4;
  --text-muted: #a0a0a8;
  --text-dim: #6e6e76;
  --accent: #b0b8c4;
  --accent-soft: rgba(176, 184, 196, 0.14);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.32);
  --soft: #c0c6d0;
  --input-bg: rgba(8, 8, 10, 0.92);
  --input-border: rgba(220, 220, 230, 0.14);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(176, 184, 196, 0.5);
  --trim: rgba(176, 184, 196, 0.35);
  --trim-soft: rgba(176, 184, 196, 0.1);
  --hover-border: rgba(200, 205, 215, 0.4);
  --active-border: rgba(220, 225, 235, 0.55);
  --kpi-sheen: rgba(255, 255, 255, 0.03);
  --brand-mark-mid: #6a6a72;
  --brand-mark-edge: rgba(200, 255, 74, 0.5);
  --brand-mark-glow: rgba(200, 255, 74, 0.14);
  --logo-grad-a: #f2f2f4;
  --logo-grad-b: #a8b0bc;
  --body-radial-1: rgba(180, 180, 190, 0.05);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #121214;
  --body-grad-bot: #050506;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: Forest */
html[data-theme="forest"] {
  color-scheme: dark;
  --bg: #060a07;
  --bg-elevated: #0a120c;
  --surface: #0e1811;
  --panel: #132016;
  --panel-2: #18291c;
  --panel-border: rgba(120, 200, 140, 0.12);
  --panel-border-strong: rgba(140, 220, 160, 0.22);
  --text: #eef8f0;
  --text-muted: #9ab8a2;
  --text-dim: #678074;
  --accent: #5dce8a;
  --accent-soft: rgba(93, 206, 138, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.35);
  --soft: #7ed9a4;
  --input-bg: rgba(4, 10, 6, 0.9);
  --input-border: rgba(120, 200, 140, 0.18);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(93, 206, 138, 0.55);
  --trim: rgba(93, 206, 138, 0.4);
  --trim-soft: rgba(93, 206, 138, 0.12);
  --hover-border: rgba(93, 206, 138, 0.5);
  --active-border: rgba(126, 217, 164, 0.7);
  --kpi-sheen: rgba(93, 206, 138, 0.05);
  --brand-mark-mid: #3d6a4c;
  --brand-mark-edge: rgba(93, 206, 138, 0.55);
  --brand-mark-glow: rgba(93, 206, 138, 0.18);
  --logo-grad-a: #eef8f0;
  --logo-grad-b: #5dce8a;
  --body-radial-1: rgba(93, 206, 138, 0.08);
  --body-radial-2: rgba(200, 255, 74, 0.04);
  --body-grad-top: #0c1610;
  --body-grad-bot: #030504;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #3ee0a0;
}

/* Theme: Ocean */
html[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #050a10;
  --bg-elevated: #081018;
  --surface: #0c1620;
  --panel: #101c28;
  --panel-2: #152636;
  --panel-border: rgba(80, 190, 220, 0.12);
  --panel-border-strong: rgba(90, 210, 240, 0.22);
  --text: #eaf6fb;
  --text-muted: #8eb4c4;
  --text-dim: #5f7f90;
  --accent: #3ec6e8;
  --accent-soft: rgba(62, 198, 232, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.35);
  --soft: #6ed4f0;
  --input-bg: rgba(4, 10, 16, 0.9);
  --input-border: rgba(80, 190, 220, 0.18);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(62, 198, 232, 0.55);
  --trim: rgba(62, 198, 232, 0.4);
  --trim-soft: rgba(62, 198, 232, 0.12);
  --hover-border: rgba(62, 198, 232, 0.5);
  --active-border: rgba(110, 212, 240, 0.7);
  --kpi-sheen: rgba(62, 198, 232, 0.05);
  --brand-mark-mid: #3a6a7e;
  --brand-mark-edge: rgba(62, 198, 232, 0.55);
  --brand-mark-glow: rgba(62, 198, 232, 0.18);
  --logo-grad-a: #eaf6fb;
  --logo-grad-b: #3ec6e8;
  --body-radial-1: rgba(62, 198, 232, 0.09);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #0a141c;
  --body-grad-bot: #03060a;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: Ember (warm, not brass-flooded) */
html[data-theme="ember"] {
  color-scheme: dark;
  --bg: #0a0706;
  --bg-elevated: #120c0a;
  --surface: #18100d;
  --panel: #1e1511;
  --panel-2: #271c16;
  --panel-border: rgba(230, 140, 90, 0.12);
  --panel-border-strong: rgba(240, 150, 100, 0.22);
  --text: #fbf3ec;
  --text-muted: #c0a898;
  --text-dim: #856e60;
  --accent: #e8915a;
  --accent-soft: rgba(232, 145, 90, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.32);
  --soft: #f0a878;
  --input-bg: rgba(10, 6, 4, 0.9);
  --input-border: rgba(230, 140, 90, 0.18);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(232, 145, 90, 0.5);
  --trim: rgba(232, 145, 90, 0.4);
  --trim-soft: rgba(232, 145, 90, 0.12);
  --hover-border: rgba(232, 145, 90, 0.5);
  --active-border: rgba(240, 168, 120, 0.7);
  --kpi-sheen: rgba(232, 145, 90, 0.05);
  --brand-mark-mid: #8a5a40;
  --brand-mark-edge: rgba(232, 145, 90, 0.55);
  --brand-mark-glow: rgba(232, 145, 90, 0.16);
  --logo-grad-a: #fbf3ec;
  --logo-grad-b: #e8915a;
  --body-radial-1: rgba(232, 145, 90, 0.07);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #14100c;
  --body-grad-bot: #060403;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: High contrast */
html[data-theme="high-contrast"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --surface: #0f0f0f;
  --panel: #141414;
  --panel-2: #1e1e1e;
  --panel-border: rgba(255, 255, 255, 0.28);
  --panel-border-strong: rgba(255, 255, 255, 0.45);
  --text: #ffffff;
  --text-muted: #d0d0d0;
  --text-dim: #a0a0a0;
  --accent: #66d9ff;
  --accent-soft: rgba(102, 217, 255, 0.2);
  --lime: #d4ff4a;
  --lime-hover: #e4ff7a;
  --lime-glow: rgba(212, 255, 74, 0.45);
  --soft: #a8d4ff;
  --input-bg: #000000;
  --input-border: rgba(255, 255, 255, 0.35);
  --focus-ring: 0 0 0 2px #000, 0 0 0 4px #66d9ff;
  --trim: rgba(102, 217, 255, 0.6);
  --trim-soft: rgba(102, 217, 255, 0.18);
  --hover-border: #66d9ff;
  --active-border: #ffffff;
  --kpi-sheen: rgba(255, 255, 255, 0.06);
  --brand-mark-mid: #444;
  --brand-mark-edge: #d4ff4a;
  --brand-mark-glow: rgba(212, 255, 74, 0.25);
  --logo-grad-a: #ffffff;
  --logo-grad-b: #66d9ff;
  --body-radial-1: rgba(102, 217, 255, 0.08);
  --body-radial-2: rgba(212, 255, 74, 0.05);
  --body-grad-top: #0a0a0a;
  --body-grad-bot: #000000;
  --status-red: #ff2244;
  --status-warn: #ffcc00;
  --status-good: #22ee88;
  --shadow-card: 0 0 0 1px rgba(255,255,255,0.12), 0 12px 28px rgba(0,0,0,0.7);
}

/* Theme: Soft light */
html[data-theme="soft-light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --panel-border: rgba(40, 60, 90, 0.12);
  --panel-border-strong: rgba(40, 60, 90, 0.2);
  --text: #152033;
  --text-muted: #4a5a72;
  --text-dim: #6e7e96;
  --accent: #1a8fb8;
  --accent-soft: rgba(26, 143, 184, 0.12);
  --lime: #6a9e12;
  --lime-hover: #7db516;
  --lime-glow: rgba(106, 158, 18, 0.28);
  --soft: #3a6ec8;
  --input-bg: #f8fafc;
  --input-border: rgba(40, 60, 90, 0.18);
  --focus-ring: 0 0 0 2px #fff, 0 0 0 4px rgba(26, 143, 184, 0.45);
  --trim: rgba(26, 143, 184, 0.35);
  --trim-soft: rgba(26, 143, 184, 0.1);
  --hover-border: rgba(26, 143, 184, 0.45);
  --active-border: rgba(26, 143, 184, 0.65);
  --kpi-sheen: rgba(26, 143, 184, 0.04);
  --brand-mark-mid: #8a9ab0;
  --brand-mark-edge: rgba(106, 158, 18, 0.65);
  --brand-mark-glow: rgba(106, 158, 18, 0.2);
  --logo-grad-a: #152033;
  --logo-grad-b: #1a8fb8;
  --primary-btn-fg: #ffffff;
  --body-radial-1: rgba(26, 143, 184, 0.08);
  --body-radial-2: rgba(106, 158, 18, 0.05);
  --body-grad-top: #eef2f7;
  --body-grad-bot: #e4e9f0;
  --status-red: #d61f3a;
  --status-warn: #c48900;
  --status-good: #1a9a62;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.8) inset, 0 8px 24px rgba(30, 50, 80, 0.08);
  --carbon-fine: repeating-linear-gradient(45deg, rgba(30,50,80,0.02) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(30,50,80,0.015) 0 1px, transparent 1px 3px);
}

/* Theme: Plum (extra) */
html[data-theme="plum"] {
  color-scheme: dark;
  --bg: #0a0710;
  --bg-elevated: #110c1a;
  --surface: #171022;
  --panel: #1d152a;
  --panel-2: #261c36;
  --panel-border: rgba(190, 140, 230, 0.12);
  --panel-border-strong: rgba(200, 150, 240, 0.22);
  --text: #f6f0fb;
  --text-muted: #b4a0c8;
  --text-dim: #7e6c94;
  --accent: #c084fc;
  --accent-soft: rgba(192, 132, 252, 0.16);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.32);
  --soft: #d4a8ff;
  --input-bg: rgba(8, 5, 14, 0.92);
  --input-border: rgba(190, 140, 230, 0.18);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(192, 132, 252, 0.5);
  --trim: rgba(192, 132, 252, 0.4);
  --trim-soft: rgba(192, 132, 252, 0.12);
  --hover-border: rgba(192, 132, 252, 0.5);
  --active-border: rgba(212, 168, 255, 0.7);
  --kpi-sheen: rgba(192, 132, 252, 0.05);
  --brand-mark-mid: #6a4a8a;
  --brand-mark-edge: rgba(192, 132, 252, 0.55);
  --brand-mark-glow: rgba(192, 132, 252, 0.18);
  --logo-grad-a: #f6f0fb;
  --logo-grad-b: #c084fc;
  --body-radial-1: rgba(192, 132, 252, 0.08);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #120c1a;
  --body-grad-bot: #050308;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}

/* Theme: Copper dusk (extra refined) */
html[data-theme="copper"] {
  color-scheme: dark;
  --bg: #080706;
  --bg-elevated: #100e0c;
  --surface: #161310;
  --panel: #1c1814;
  --panel-2: #25201a;
  --panel-border: rgba(200, 140, 100, 0.12);
  --panel-border-strong: rgba(210, 150, 110, 0.22);
  --text: #f7f1ea;
  --text-muted: #b8a898;
  --text-dim: #7e7164;
  --accent: #d08a5a;
  --accent-soft: rgba(208, 138, 90, 0.14);
  --lime: #c8ff4a;
  --lime-hover: #d9ff78;
  --lime-glow: rgba(200, 255, 74, 0.3);
  --soft: #e0a878;
  --input-bg: rgba(8, 6, 4, 0.9);
  --input-border: rgba(200, 140, 100, 0.18);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px rgba(208, 138, 90, 0.5);
  --trim: rgba(208, 138, 90, 0.38);
  --trim-soft: rgba(208, 138, 90, 0.1);
  --hover-border: rgba(208, 138, 90, 0.48);
  --active-border: rgba(224, 168, 120, 0.65);
  --kpi-sheen: rgba(208, 138, 90, 0.04);
  --brand-mark-mid: #7a5a40;
  --brand-mark-edge: rgba(208, 138, 90, 0.55);
  --brand-mark-glow: rgba(208, 138, 90, 0.14);
  --logo-grad-a: #f7f1ea;
  --logo-grad-b: #d08a5a;
  --body-radial-1: rgba(208, 138, 90, 0.06);
  --body-radial-2: rgba(200, 255, 74, 0.03);
  --body-grad-top: #12100c;
  --body-grad-bot: #050403;
  --status-red: #ff3355;
  --status-warn: #f0b429;
  --status-good: #46d39a;
}


html, body {
  height: 100%;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 50% -8%, var(--body-radial-1), transparent 58%),
    radial-gradient(800px 480px at 92% 88%, var(--body-radial-2), transparent 52%),
    var(--carbon-fine),
    linear-gradient(180deg, var(--body-grad-top) 0%, var(--bg) 42%, var(--body-grad-bot) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 18px 10px;
  gap: 14px;
}

.hidden { display: none !important; }

/* -- Header -- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 55%),
    var(--carbon-fine),
    var(--surface);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, var(--brand-mark-mid), #10151d 68%),
    var(--carbon-fine),
    #0c1016;
  border: 1.5px solid var(--brand-mark-edge);
  box-shadow:
    0 0 0 3px var(--trim-soft),
    0 0 22px var(--brand-mark-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #f8fafc;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-text {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--logo-grad-a) 0%, var(--logo-grad-b) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-btn, .btn {
  border: 1px solid var(--panel-border-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}

.icon-btn:hover, .btn:hover {
  border-color: var(--hover-border);
  background: var(--panel-2);
}

.btn {
  padding: 9px 14px;
}

.btn-primary {
  background: var(--lime);
  color: var(--primary-btn-fg);
  border-color: transparent;
  font-weight: 750;
}

.btn-primary:hover {
  background: var(--lime-hover);
  border-color: transparent;
  color: var(--primary-btn-fg);
}

.btn-ghost {
  background: transparent;
}

.btn-warn {
  background: rgba(240, 180, 41, 0.14);
  border-color: rgba(240, 180, 41, 0.45);
  color: var(--warn);
}

.menu {
  position: absolute;
  right: 28px;
  top: 78px;
  z-index: 40;
  min-width: 210px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.menu button:hover {
  background: var(--panel-2);
}

/* -- Hero drop -- */
.hero-drop {
  margin-top: 6vh;
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--panel-border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 50%),
    var(--carbon-fine),
    var(--panel);
  box-shadow: var(--shadow-card);
}

.hero-drop.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hero-drop h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.hero-drop p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}

.hero-drop .cta {
  margin-top: 18px;
}

.privacy-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
}

/* -- Live bar / banners -- */
.live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.live-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.live-meta .file-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-meta .file-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.live-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
}

.toggle input {
  accent-color: var(--lime);
}

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 51, 85, 0.4);
  background: rgba(255, 51, 85, 0.1);
  color: var(--text);
}

.banner.warn {
  border-color: rgba(240, 180, 41, 0.45);
  background: rgba(240, 180, 41, 0.1);
}

.banner .banner-text {
  flex: 1;
  min-width: 200px;
  line-height: 1.45;
  font-size: 13px;
}

.banner .banner-text strong {
  color: var(--warn);
}

.banner.lock .banner-text strong {
  color: var(--red);
}

.banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--hover-border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 80;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -- Setup / mapper -- */
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--carbon-fine),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.map-grid label {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-grid select,
#sheetSelect,
.toolbar input,
.toolbar select {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-family: var(--sans);
  font-size: 13px;
}

.map-grid select:focus,
#sheetSelect:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--active-border);
}

.setup-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* -- KPIs -- */
.kpis {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Match .kpis row gap: space between live-bar and Units cards */
#boardFleet > .live-bar + .kpis {
  margin-top: 12px;
}

.kpi-divider {
  height: 1px;
  margin: 2px 0 4px;
  border: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--trim) 18%,
    var(--panel-border-strong) 50%,
    var(--trim) 82%,
    transparent 100%
  );
  opacity: 0.9;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

/* Units row also has .kpi-strip (drag chrome). Override 5-col so only 4 equal slots. */
.kpi-row-units,
.kpi-strip.kpi-row-units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  align-items: stretch;
}

.kpi-row-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.section-divider {
  margin: 10px 0 6px;
}

.kpi-slot {
  min-width: 0;
  min-height: 96px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
  display: flex;
  flex-direction: column;
}

.kpi-slot > .kpi {
  flex: 1;
  height: 100%;
}

.kpi-slot-vacant {
  border: 1px dashed var(--panel-border-strong);
  background: rgba(0, 0, 0, 0.18);
}

.kpi-strip.is-dragging .kpi-slot {
  border-color: var(--panel-border);
  background: rgba(0, 0, 0, 0.12);
}

.kpi-strip.is-dragging .kpi-slot-vacant {
  border-style: dashed;
  border-color: var(--trim);
}

.kpi-slot.drag-over {
  border: 1px solid var(--active-border) !important;
  box-shadow: 0 0 0 2px var(--trim-soft), var(--shadow-card);
  background: var(--accent-soft);
}

.kpi-slot-empty {
  flex: 1;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  pointer-events: none;
}

.kpi-slot-empty .lbl {
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}

.kpi-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-group-label {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 2px;
}

.kpi-group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  background:
    linear-gradient(180deg, var(--kpi-sheen), transparent 50%),
    var(--carbon-fine),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  min-width: 0;
  position: relative;
  user-select: none;
}

.kpi:hover {
  border-color: var(--hover-border);
}

.kpi.active {
  border-color: var(--active-border);
  box-shadow: 0 0 0 1px var(--trim-soft), var(--shadow-card);
}

.kpi.kpi-draggable {
  cursor: grab;
  -webkit-user-drag: element;
}

.kpi.kpi-draggable:active {
  cursor: grabbing;
}

.kpi.kpi-draggable * {
  -webkit-user-drag: none;
}

.kpi.kpi-fixed {
  cursor: pointer;
}

.kpi.dragging,
.kpi.drag-ghost {
  opacity: 0.35;
  /* Never pointer-events:none on the source: Chromium cancels DnD if applied
     in dragstart, and a setTimeout race past dragend leaves cards dead. */
}

.kpi.drag-over {
  border-color: var(--active-border);
}

.kpi-placeholder {
  border: 1px dashed var(--trim);
  background: var(--trim-soft);
  box-shadow: none;
  cursor: default;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-placeholder .lbl {
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}

.kpi .lbl {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.kpi .lbl-cat {
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi .lbl-horizon {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: none;
}

.kpi .num {
  font-size: 32px;
  font-weight: 750;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.kpi .hint {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.3;
}

/* -- Queue -- */
.queue {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--carbon-fine),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px 16px 8px;
  box-shadow: var(--shadow-card);
}

.queue h3 {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.q-item {
  display: grid;
  grid-template-columns: 72px 1fr 150px 110px;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-top: 1px solid var(--panel-border);
  cursor: pointer;
  border-radius: 8px;
}

.q-item:hover {
  background: var(--accent-soft);
}

.q-item b {
  font-size: 14px;
}

.meta {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.days {
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.days.bad { color: var(--red); }
.days.warn { color: var(--warn); }
.days.good { color: var(--good); }
.days.muted { color: var(--text-muted); }

/* -- Table -- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  flex: 1;
  min-width: 160px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 560px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

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

th, td {
  text-align: left;
  padding: 11px 10px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
  z-index: 1;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(76, 201, 240, 0.05);
}

tbody tr.active {
  background: rgba(76, 201, 240, 0.1);
}

tbody td {
  border-top: 1px solid var(--panel-border);
  vertical-align: top;
}

td.wrap {
  min-width: 220px;
  max-width: 320px;
}

td.notes {
  color: var(--text-muted);
  max-width: 220px;
}

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.chip.bad {
  background: rgba(255, 51, 85, 0.16);
  color: var(--red);
}

.chip.warn {
  background: rgba(240, 180, 41, 0.16);
  color: var(--warn);
}

.chip.good {
  background: rgba(70, 211, 154, 0.14);
  color: var(--good);
}

.chip.muted {
  background: rgba(102, 112, 132, 0.25);
  color: var(--text-muted);
}

/* -- Drawer -- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 8, 0.72);
  backdrop-filter: blur(3px);
  z-index: 50;
}

.drawer {
  position: fixed;
  right: 16px;
  top: 16px;
  bottom: 16px;
  width: min(360px, 92vw);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    var(--surface);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  padding: 20px;
  z-index: 60;
  transform: translateX(110%);
  transition: transform 0.25s ease;
  overflow: auto;
  box-shadow: var(--shadow-card);
}

.drawer.open {
  transform: translateX(0);
}

.drawer h2 {
  margin: 8px 0 4px;
  font-size: 20px;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 10px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.kv b {
  color: var(--text);
  font-weight: 600;
}

/* -- Footer -- */
.app-footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 14px 18px;
  border-top: 1px solid var(--panel-border);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: auto;
}

.footer-credit {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.footer-credit span {
  color: var(--lime);
}

.footer-disclaimer {
  max-width: 720px;
  color: var(--text-dim);
  font-size: 11px;
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

.footer-links a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .kpi-group-grid { grid-template-columns: 1fr 1fr; }
  .kpi-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .q-item { grid-template-columns: 1fr 1fr; }
  .kpi-row-units,
  .kpi-strip.kpi-row-units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .kpi-group-grid { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row-units,
  .kpi-strip.kpi-row-units { grid-template-columns: 1fr; }
  .app { padding: 10px 12px; }
  .live-bar .mode-pill {
    flex: 1 1 100%;
    order: 3;
    justify-content: flex-start;
  }
}

/* -- Phase 2: layout extras -- */
.banner.info {
  border-color: var(--hover-border);
  background: rgba(76, 201, 240, 0.1);
}

.banner.info .banner-text strong {
  color: var(--accent);
}

.sheet-label,
.sheet-inline {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.sheet-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.sheet-inline select,
#sheetSelectFleet {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 12px;
  max-width: 200px;
}

.mode-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.live-meta {
  flex: 0 1 auto;
}

.live-controls {
  flex: 0 1 auto;
  margin-left: auto;
}

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(126, 166, 255, 0.16);
  color: var(--soft);
  border: 1px solid rgba(126, 166, 255, 0.35);
}

.pill.accent {
  background: rgba(200, 255, 74, 0.12);
  color: var(--lime);
  border-color: rgba(200, 255, 74, 0.4);
}

.pill-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11px;
}

.cat-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cat-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.cat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}

.cat-chip {
  cursor: pointer;
}

.cat-chip:hover {
  border: 1px solid var(--hover-border);
}

.type-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(102, 112, 132, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--accent);
}

th.sortable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  color: var(--accent);
}

th.sortable.sorted {
  color: var(--soft);
}

th.sortable .sort-ind {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0;
}

.num-cell {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 12px;
}

.table-foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.col-panel {
  position: absolute;
  right: 18px;
  z-index: 30;
  min-width: 240px;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.toolbar {
  position: relative;
}

.col-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.col-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.col-check input {
  accent-color: var(--lime);
}

/* Customize layout panel */
.layout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.layout-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  width: min(440px, calc(100vw - 24px));
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%),
    var(--carbon-fine),
    var(--panel);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: var(--text);
}

.layout-panel.hidden,
.layout-backdrop.hidden {
  display: none !important;
}

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

.layout-panel-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.layout-panel-body {
  padding: 12px 16px 16px;
  overflow: auto;
  flex: 1 1 auto;
}

.layout-section {
  margin-bottom: 16px;
}

.layout-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.layout-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin: 0 0 8px;
  line-height: 1.4;
}

.layout-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.layout-check input {
  accent-color: var(--lime);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.layout-check input:disabled {
  opacity: 0.45;
}

.layout-master {
  font-weight: 650;
  color: var(--text);
}

.layout-group {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

.layout-sub {
  margin-left: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 8px;
}

.layout-col-list {
  max-height: 180px;
  overflow: auto;
  padding: 4px 6px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

.layout-panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border);
}

.live-controls #customizeBtn {
  white-space: nowrap;
}

@media (max-width: 520px) {
  .layout-sub {
    grid-template-columns: 1fr;
  }
  .layout-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 88vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

@media (max-width: 900px) {

/* -- Phase 3: header actions (no hamburger) -- */
.header {
  flex-wrap: wrap;
  align-items: flex-start;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.header-actions .btn {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 12px;
}

.header-actions .btn.active {
  border-color: var(--active-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Date horizon filters (any date column) */
.date-horizons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.horizon-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.horizon-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horizon-chip {
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.horizon-chip:hover {
  border-color: var(--hover-border);
}

.horizon-chip.active {
  border-color: var(--active-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.cat-chip.active {
  border: 1px solid var(--active-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.kpi[role="button"],
.kpi.clickable {
  cursor: pointer;
}

.kpi.active {
  border-color: var(--active-border);
  box-shadow: 0 0 0 1px rgba(76, 201, 240, 0.25);
}

.filter-clear-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions {
    justify-content: flex-start;
    width: 100%;
  }
}

/* Theme picker */
.theme-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.theme-inline select,
.theme-select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 12px;
  max-width: 180px;
}

.theme-inline select:focus,
.theme-select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--hover-border);
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

html[data-theme="soft-light"] .theme-option {
  background: rgba(30, 50, 80, 0.04);
}

.theme-option:hover {
  border-color: var(--hover-border);
}

.theme-option.active {
  border-color: var(--active-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-option input {
  accent-color: var(--lime);
}

.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--swatch-a, #333) 50%, var(--swatch-b, #888) 50%);
}


html[data-theme="soft-light"] .backdrop {
  background: rgba(20, 30, 45, 0.45);
}
html[data-theme="soft-light"] .layout-backdrop {
  background: rgba(20, 30, 45, 0.35);
}
html[data-theme="soft-light"] .logo-mark {
  color: #152033;
  background:
    radial-gradient(circle at 30% 26%, var(--brand-mark-mid), #d8dee8 68%),
    var(--carbon-fine),
    #eef2f7;
}
