/* PoolGod Design System v2 — Cue Telemetry Studio
   Cohesive broadcast-grade Obsidian Dark (default) + Studio Ivory Light.
   Space Grotesk display, Inter UI, JetBrains Mono tabular numerics.

   Fonts are loaded by each page via <link> (non-render-blocking). */

:root {
  /* Surfaces — Studio Ivory Light */
  --bg:           #f4f6f9;
  --bg-card:      #ffffff;
  --bg-elevated:  #ffffff;
  --bg-sunken:    #ebeff5;
  --bg-rail:      #f0f3f7;
  --bg-glass:     rgba(255, 255, 255, 0.82);

  /* Borders / hairlines */
  --border:       #e1e6ee;
  --border-hi:    #cbd3e0;
  --border-soft:  #eaeef4;
  --border-glow:  rgba(16, 185, 129, 0.25);

  /* Text */
  --fg:           #18202c;
  --fg-strong:    #090d14;
  --fg-muted:     #546072;
  --fg-dim:       #7c8899;
  --fg-faint:     #a8b2c0;

  /* Accent — Precision Telemetry Cyan-Blue & Emerald */
  --accent:       #0284c7;
  --accent-hover: #0369a1;
  --accent-soft:  rgba(2, 132, 199, 0.10);
  --accent-line:  rgba(2, 132, 199, 0.30);
  --accent-ink:   #0369a1;
  --accent-glow:  rgba(2, 132, 199, 0.22);

  /* Semantic */
  --good:         #059669;
  --good-soft:    rgba(5, 150, 105, 0.12);
  --good-line:    rgba(5, 150, 105, 0.30);
  --warn:         #d97706;
  --warn-soft:    rgba(217, 119, 6, 0.12);
  --warn-line:    rgba(217, 119, 6, 0.30);
  --bad:          #dc2626;
  --bad-soft:     rgba(220, 38, 38, 0.12);
  --bad-line:     rgba(220, 38, 38, 0.30);

  /* Grade colour ramp */
  --grade-a:      #059669;
  --grade-b:      #0284c7;
  --grade-c:      #d97706;
  --grade-d:      #ea580c;
  --grade-f:      #dc2626;

  /* Grade badge surfaces (theme-aware) */
  --grade-a-bg:   rgba(5, 150, 105, 0.12);
  --grade-b-bg:   rgba(2, 132, 199, 0.12);
  --grade-c-bg:   rgba(217, 119, 6, 0.12);
  --grade-d-bg:   rgba(234, 88, 12, 0.12);
  --grade-f-bg:   rgba(220, 38, 38, 0.12);

  /* Type */
  --font-display: 'Space Grotesk', 'Inter', -apple-system, system-ui, sans-serif;
  --font-sans:    'Inter', -apple-system, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Radius */
  --r-xs: 5px;
  --r-sm: 8px;
  --r:    12px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  --sh-2: 0 2px 6px rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.05);
  --sh-3: 0 4px 10px rgba(15, 23, 42, 0.08), 0 16px 36px rgba(15, 23, 42, 0.08);
  --sh-4: 0 8px 16px rgba(15, 23, 42, 0.10), 0 24px 54px rgba(15, 23, 42, 0.12);
  --sh-focus: 0 0 0 3px rgba(2, 132, 199, 0.25);

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

  --header-h: 60px;
}

[data-theme="dark"] {
  /* Surfaces — Obsidian Broadcast Studio */
  --bg:           #080b10;
  --bg-card:      #0f141e;
  --bg-elevated:  #151c2a;
  --bg-sunken:    #070a0f;
  --bg-rail:      #0c1018;
  --bg-glass:     rgba(15, 20, 30, 0.80);

  /* Crisp translucent architectural borders */
  --border:       rgba(148, 163, 184, 0.11);
  --border-hi:    rgba(148, 163, 184, 0.22);
  --border-soft:  rgba(148, 163, 184, 0.065);
  --border-glow:  rgba(56, 189, 248, 0.28);

  /* Text */
  --fg:           #e2e8f0;
  --fg-strong:    #f8fafc;
  --fg-muted:     #94a3b8;
  --fg-dim:       #64748b;
  --fg-faint:     #475569;

  /* Accent — Precision Telemetry Cyan */
  --accent:       #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft:  rgba(56, 189, 248, 0.12);
  --accent-line:  rgba(56, 189, 248, 0.34);
  --accent-ink:   #7dd3fc;
  --accent-glow:  rgba(56, 189, 248, 0.22);

  /* Semantic */
  --good:         #10b981;
  --good-soft:    rgba(16, 185, 129, 0.14);
  --good-line:    rgba(16, 185, 129, 0.35);
  --warn:         #f59e0b;
  --warn-soft:    rgba(245, 158, 11, 0.14);
  --warn-line:    rgba(245, 158, 11, 0.35);
  --bad:          #f43f5e;
  --bad-soft:     rgba(244, 63, 94, 0.14);
  --bad-line:     rgba(244, 63, 94, 0.35);

  /* Grade colour ramp — vibrant broadcast-calibrated */
  --grade-a:      #10b981;
  --grade-b:      #38bdf8;
  --grade-c:      #f59e0b;
  --grade-d:      #fb923c;
  --grade-f:      #f43f5e;

  /* Grade badge surfaces (dark-calibrated, never blinding white) */
  --grade-a-bg:   rgba(16, 185, 129, 0.14);
  --grade-b-bg:   rgba(56, 189, 248, 0.14);
  --grade-c-bg:   rgba(245, 158, 11, 0.14);
  --grade-d-bg:   rgba(251, 146, 60, 0.14);
  --grade-f-bg:   rgba(244, 63, 94, 0.14);

  /* Layered studio elevation */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --sh-2: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --sh-3: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --sh-4: 0 18px 56px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --sh-focus: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

/* Base reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(56, 189, 248, 0.07), transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(16, 185, 129, 0.045), transparent 60%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); background-clip: content-box; }
