/* ============================================================
   ETECH SIMOS — Design tokens & base type
   ============================================================ */

/* NOTE: the Google Fonts @import lives in globals.css (must precede all
   other rules per CSS spec; keeping it here gets it dropped by the bundler). */

:root {
  /* ---------- COLORS — base ---------- */
  --ink:            #0C0C0C;        /* near-black for text on light */
  --ink-dark:       #FAFAF7;        /* warm off-white for text on dark */

  --canvas-light:   #FAFAF7;        /* default page bg, light sections */
  --canvas-dark:    #0C0C0C;        /* default page bg, dark sections */

  --surface-light:  oklch(0.96 0 0); /* card fill on light bg */
  --surface-dark:   oklch(0.18 0 0); /* card fill on dark bg */

  --muted-light:    oklch(0.55 0 0); /* secondary text on light */
  --muted-dark:     oklch(0.65 0 0); /* secondary text on dark */

  --line-light:     rgba(12,12,12,0.08); /* hairline divider on light */
  --line-dark:      rgba(250,250,247,0.10); /* hairline divider on dark */

  /* No accent colors. The system is fully monochromatic — contrast comes
     from ink / canvas / surface tones plus typographic weight and scale. */

  /* ---------- Semantic foreground tokens ---------- */
  --fg1: var(--ink);                /* primary text */
  --fg2: var(--muted-light);        /* secondary text */
  --fg-on-dark: var(--ink-dark);
  --fg2-on-dark: var(--muted-dark);

  /* ---------- TYPE ---------- */
  --font-display: 'Geist', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Geist', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* type scale */
  --t-hero:    clamp(48px, 6vw, 72px);   /* h1 - hero (capped at 72px) */
  --t-h1:      clamp(40px, 5vw, 64px);   /* section H2 */
  --t-h2:      clamp(28px, 3vw, 40px);   /* sub-section */
  --t-h3:      24px;
  --t-body-lg: 18px;
  --t-body:    16px;
  --t-small:   14px;
  --t-mono:    13px;                     /* mono pills, code */
  --t-stat:    clamp(48px, 6vw, 80px);   /* big numbers in case studies */

  --weight-display: 800;
  --weight-bold:    700;
  --weight-med:     500;
  --weight-reg:     400;

  --lh-display: 1.05;
  --lh-heading: 1.15;
  --lh-body:    1.5;
  --lh-tight:   1.3;

  --track-display: -0.03em;
  --track-tight:   -0.01em;
  --track-mono:    0.01em;

  /* ---------- SPACING (8pt grid) ---------- */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   24px;
  --space-6:   32px;
  --space-7:   48px;
  --space-8:   64px;
  --space-9:   96px;
  --space-10: 128px;

  /* ---------- RADII ---------- */
  --r-sm:   8px;
  --r-md:   16px;   /* inputs, chat bubbles, images */
  --r-lg:   24px;   /* cards, surfaces */
  --r-pill: 999px;  /* capsules, buttons, pills */

  /* ---------- SHADOWS ---------- */
  --shadow-none: none;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
  --shadow-lift: 0 2px 4px rgba(0,0,0,0.06), 0 16px 40px rgba(0,0,0,0.06);

  /* ---------- MOTION ---------- */
  --ease-out:    cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast:   120ms;
  --dur-base:   180ms;
  --dur-slow:   320ms;

  /* ---------- LAYOUT ---------- */
  --container-max: 1280px;
  --container-pad: 32px;
}

/* ============================================================
   Base reset (light)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--fg1);
  background: var(--canvas-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   Semantic type styles
   ============================================================ */
h1, .h1, .t-hero {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--t-hero);
  line-height: var(--lh-display);
  letter-spacing: var(--track-display);
  text-wrap: balance;
  margin: 0;
}

h2, .h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--t-h1);
  line-height: var(--lh-display);
  letter-spacing: var(--track-display);
  text-wrap: balance;
  margin: 0;
}

h3, .h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--t-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-tight);
  margin: 0;
}

h4, .h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--t-h3);
  line-height: var(--lh-heading);
  margin: 0;
}

p, .p {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--fg1);
  margin: 0;
}

.p-lg { font-size: var(--t-body-lg); }
.p-sm { font-size: var(--t-small); }
.muted { color: var(--fg2); }

code, .mono, kbd, samp {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--track-mono);
}

/* eyebrow pill (the signature element) */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--track-mono);
  padding: 6px 14px;
  background: var(--surface-light);
  color: var(--fg1);
  border-radius: var(--r-pill);
}
.eyebrow.on-dark { background: var(--surface-dark); color: var(--fg-on-dark); }

/* stat number */
.stat {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: var(--t-stat);
  line-height: 1;
  letter-spacing: var(--track-display);
}

/* dark-mode helper class (wrap any section to flip) */
.dark {
  background: var(--canvas-dark);
  color: var(--fg-on-dark);
}
.dark .muted, .dark .p.muted { color: var(--fg2-on-dark); }
.dark .eyebrow { background: var(--surface-dark); color: var(--fg-on-dark); }

/* container */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

/* hatch background (apply to any light section) */
.hatch-bg {
  background-color: var(--canvas-light);
  background-image: url('./hatch.svg');
  background-repeat: repeat;
  background-size: 320px 320px;
}


/* ============================================================
   SimOS — Operator app shell (monochrome, light + dark)
   Built on top of ETECH SimOS tokens (tokens.css).

   Components reference ONLY the semantic tokens below (--bg, --fg,
   --surface*, --line*, the promoted chrome tokens, etc.) — never raw
   color literals. Theme is a single attribute on <html>: the :root
   defaults are LIGHT; [data-theme="dark"] flips them. So one attribute
   repaints the whole operator UI with no per-component overrides.
   ============================================================ */

:root {
  /* ---- surfaces & text (LIGHT — default) ----
     Light elevation reads as white cards over a warm off-white page, with
     progressively grayer secondary/hover/input surfaces (the inverse lightness
     direction of dark mode, where elevation gets brighter). */
  --bg:         var(--canvas-light);   /* warm off-white page (~0.975) */
  --fg:         var(--ink);
  --fg-mute:    var(--muted-light);
  --surface:    oklch(1 0 0);      /* white card, lifted above the page */
  --surface-2:  oklch(0.955 0 0);  /* secondary surface (gauges, secondary btn) */
  --surface-3:  oklch(0.91 0 0);   /* input / active / hover-deep */
  --line:       var(--line-light);
  --line-2:     rgba(12,12,12,0.16);

  /* ---- chrome tokens (promoted from former inline oklch literals) ---- */
  --topbar-bg:   oklch(0.985 0 0);
  --sidebar-bg:  oklch(0.965 0 0);
  --row-hover:   oklch(0.95 0 0);
  --btn-hover:   oklch(0.30 0 0);          /* .btn is fg-on-bg inverted; hover lifts the near-black */
  --spark-area:  oklch(0.20 0 0 / 0.06);
  --handle-ring: oklch(0.20 0 0 / 0.12);
  --hatch-invert: 0;                       /* hatch SVG is dark-on-transparent; no invert on light */
  --logo-invert:  1;                       /* ETECH wordmark asset is white; invert it to dark on light chrome */

  /* heatmap density scale: low (pale) → high (ink) */
  --heat-0: oklch(0.96 0 0);
  --heat-1: oklch(0.90 0 0);
  --heat-2: oklch(0.78 0 0);
  --heat-3: oklch(0.58 0 0);
  --heat-4: oklch(0.38 0 0);
  --heat-5: oklch(0.20 0 0);

  /* Severity scale — used ONLY for system semantic states (alerts,
     telemetry thresholds, hardware health). Brand chrome stays monochrome.
     Tuned to read on either canvas, so it is theme-independent. */
  --sev-info:     oklch(0.74 0.07 230);   /* cool blue-gray */
  --sev-success:  oklch(0.78 0.12 150);   /* muted green */
  --sev-warn:     oklch(0.82 0.14 80);    /* warm amber */
  --sev-critical: oklch(0.68 0.20 25);    /* restrained red */

  --sev-info-bg:     oklch(0.74 0.07 230 / 0.14);
  --sev-success-bg:  oklch(0.78 0.12 150 / 0.14);
  --sev-warn-bg:     oklch(0.82 0.14 80  / 0.14);
  --sev-critical-bg: oklch(0.68 0.20 25  / 0.16);

  /* Pin-role scale — used ONLY in the hardware wiring feature (board diagram,
     pin plan, pin-out test). Same muted-oklch family as the sev scale; the
     brand chrome stays monochrome. */
  --role-di:  oklch(0.56 0.09 220); --role-di-bg:  oklch(0.56 0.09 220 / 0.13);
  --role-ai:  oklch(0.58 0.11 300); --role-ai-bg:  oklch(0.58 0.11 300 / 0.13);
  --role-do:  oklch(0.60 0.11 75);  --role-do-bg:  oklch(0.60 0.11 75 / 0.15);
  --role-pwm: oklch(0.58 0.12 345); --role-pwm-bg: oklch(0.58 0.12 345 / 0.12);
  --role-free: oklch(0.55 0 0);     --role-free-bg: oklch(0.55 0 0 / 0.05);

  /* Tighter densities (operator UI) — theme-independent */
  --row-h: 44px;
  --topbar-h: 56px;
  --sidebar-w: 240px;
}

[data-theme="dark"] {
  /* ---- surfaces & text (DARK) ---- */
  --bg:         var(--canvas-dark);
  --fg:         var(--ink-dark);
  --fg-mute:    var(--muted-dark);
  --surface:    var(--surface-dark);
  --surface-2:  oklch(0.22 0 0);   /* slightly lifted */
  --surface-3:  oklch(0.26 0 0);   /* hover, input */
  --line:       var(--line-dark);
  --line-2:     rgba(250,250,247,0.16);

  /* ---- chrome tokens ---- */
  --topbar-bg:   oklch(0.13 0 0);
  --sidebar-bg:  oklch(0.11 0 0);
  --row-hover:   oklch(0.20 0 0);
  --btn-hover:   oklch(0.92 0 0);
  --spark-area:  oklch(0.95 0 0 / 0.06);
  --handle-ring: oklch(0.95 0 0 / 0.16);
  --hatch-invert: 1;               /* invert the dark hatch to show on dark canvas */
  --logo-invert:  0;               /* white wordmark shows as-is on dark chrome */

  /* heatmap density scale: low (deep) → high (bright) */
  --heat-0: oklch(0.16 0 0);
  --heat-1: oklch(0.22 0 0);
  --heat-2: oklch(0.32 0 0);
  --heat-3: oklch(0.45 0 0);
  --heat-4: oklch(0.65 0 0);
  --heat-5: oklch(0.85 0 0);

  /* Pin-role scale (dark) — brighter to read on the dark canvas. */
  --role-di:  oklch(0.74 0.09 220); --role-di-bg:  oklch(0.74 0.09 220 / 0.13);
  --role-ai:  oklch(0.75 0.12 300); --role-ai-bg:  oklch(0.75 0.12 300 / 0.13);
  --role-do:  oklch(0.80 0.11 75);  --role-do-bg:  oklch(0.80 0.11 75 / 0.14);
  --role-pwm: oklch(0.75 0.13 345); --role-pwm-bg: oklch(0.75 0.13 345 / 0.13);
  --role-free: oklch(0.55 0 0);     --role-free-bg: oklch(0.70 0 0 / 0.06);
}

html, body { height: 100%; }
.simos-body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
#root { height: 100vh; display: flex; flex-direction: column; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}
.topbar { grid-column: 1 / 3; }
.sidebar { grid-column: 1; grid-row: 2; }
.content { grid-column: 2; grid-row: 2; overflow: auto; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px 0 18px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  user-select: none;
  -webkit-app-region: drag; /* electron-like feel */
}
.topbar > * { -webkit-app-region: no-drag; }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand .mark { width: 22px; height: 22px; color: var(--fg); }
.topbar .brand .name { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 15px; }
.topbar .brand .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.topbar .facility {
  display: flex; flex-direction: column; line-height: 1.1;
}
.topbar .facility .label { font-family: var(--font-mono); font-size: 10px; color: var(--fg-mute); letter-spacing: 0.05em; text-transform: uppercase; }
.topbar .facility .name { font-weight: 600; font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar .conn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: 0.02em;
}
.topbar .conn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sev-success); }
.topbar .conn.warn .dot { background: var(--sev-warn); }
.topbar .conn.err .dot { background: var(--sev-critical); }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 14px 10px 16px;
}
.sidebar .nav-group { margin-top: 14px; }
.sidebar .nav-group .label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em;
  color: var(--fg-mute);
  text-transform: uppercase;
  padding: 0 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--fg);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-out);
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--surface-2); }
.nav-item.active .icon { color: var(--fg); }
.nav-item .icon { color: var(--fg-mute); width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface-3); color: var(--fg);
  padding: 2px 7px; border-radius: var(--r-pill);
}
.nav-item.disabled { opacity: 0.4; cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; }

.sidebar .footer {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: 0.02em;
}
.sidebar .footer .v { color: var(--fg); }

/* ---------- Content area ---------- */
.content { padding: 0; }
.page {
  padding: 28px 32px 64px;
  max-width: 1600px;
  margin: 0 auto;
}
.page.wide { max-width: none; }
.page-h {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.page-h .title { display: flex; flex-direction: column; gap: 10px; }
.page-h h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-h .crumbs {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-mute); letter-spacing: 0.04em;
}
.page-h .crumbs .sep { margin: 0 6px; opacity: 0.5; }
.page-h .actions { display: flex; gap: 8px; }

/* ---------- Eyebrow (overrides for dark) ---------- */
.eyebrow {
  background: var(--surface) !important;
  color: var(--fg) !important;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
  width: fit-content;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
}
.card.flat { background: transparent; border: 1px solid var(--line); }
.card.tight { padding: 14px 16px; }
.card.section { padding: 24px; }
.card .card-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card .card-h h3 {
  font-family: var(--font-display);
  font-weight: 700; font-size: 14px;
  letter-spacing: 0;
}
.card .card-h .right { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-family: var(--font-body); font-weight: 500; font-size: 13px;
  background: var(--fg); color: var(--bg);
  border: none; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.98); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.lg { padding: 12px 22px; font-size: 14px; }
.btn.ghost {
  background: transparent; color: var(--fg);
}
.btn.ghost:hover { background: var(--surface); }
.btn.secondary {
  background: var(--surface-2); color: var(--fg);
}
.btn.secondary:hover { background: var(--surface-3); }
.btn.danger {
  background: var(--sev-critical); color: var(--fg);
}
.btn.danger:hover { background: oklch(0.62 0.20 25); }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-bare {
  background: none; border: none; color: var(--fg-mute); cursor: pointer;
  padding: 6px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-bare:hover { background: var(--surface); color: var(--fg); }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface);
  color: var(--fg);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-mute); }
.pill.info { background: var(--sev-info-bg); color: var(--sev-info); }
.pill.info .dot { background: var(--sev-info); }
.pill.success { background: var(--sev-success-bg); color: var(--sev-success); }
.pill.success .dot { background: var(--sev-success); }
.pill.warn { background: var(--sev-warn-bg); color: var(--sev-warn); }
.pill.warn .dot { background: var(--sev-warn); }
.pill.critical { background: var(--sev-critical-bg); color: var(--sev-critical); }
.pill.critical .dot { background: var(--sev-critical); }
.pill.outline { background: transparent; border: 1px solid var(--line-2); color: var(--fg-mute); }

/* status pill with running dot (pulse) */
.pill.live .dot {
  background: var(--sev-success);
  box-shadow: 0 0 0 0 var(--sev-success);
  animation: pulse 1.6s var(--ease-out) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.78 0.12 150 / 0.6); }
  70%  { box-shadow: 0 0 0 8px oklch(0.78 0.12 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.12 150 / 0); }
}

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 14px;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--fg);
  background: var(--surface-2);
}
.input::placeholder { color: var(--fg-mute); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.04em; color: var(--fg-mute);
  text-transform: uppercase;
}
.field .hint { font-size: 12px; color: var(--fg-mute); }

/* range slider */
input[type="range"].slider {
  -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--surface-2);
  border-radius: var(--r-pill); outline: none; width: 100%;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
  transition: transform var(--dur-fast);
}
input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"].slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg); border: none; cursor: pointer;
}

/* checkbox / toggle */
.toggle {
  width: 32px; height: 18px; border-radius: 999px;
  background: var(--surface-3); position: relative; cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast);
}
.toggle::after {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--fg);
  transition: left var(--dur-fast) var(--ease-out);
}
.toggle.on { background: var(--fg); }
.toggle.on::after { left: 16px; background: var(--bg); }

/* ---------- Tables ---------- */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-mute); font-weight: 500;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  background: transparent;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-action { color: var(--fg-mute); }
.table .nowrap { white-space: nowrap; }
.table.compact td, .table.compact th { padding: 8px 12px; }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.muted-fg { color: var(--fg-mute); }
.mono { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; }
.t-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.t-stat { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.03em; }
.t-stat-lg { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -0.03em; }

/* ---------- Banners ---------- */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 13px;
}
.banner.warn { background: var(--sev-warn-bg); color: var(--sev-warn); }
.banner.warn .accent { color: var(--sev-warn); }
.banner.critical { background: var(--sev-critical-bg); color: var(--sev-critical); }
.banner.info { background: var(--sev-info-bg); color: var(--sev-info); }
.banner .icon { flex-shrink: 0; margin-top: 1px; }
.banner .body { flex: 1; }
.banner .title { font-weight: 600; }
.banner .dismiss { color: inherit; opacity: 0.6; }

/* ---------- Telemetry gauges ---------- */
.gauge {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 12px 14px;
  position: relative;
}
.gauge .label {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute);
  letter-spacing: 0.04em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.gauge .value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; letter-spacing: -0.02em;
  line-height: 1.05;
}
.gauge .value .unit {
  font-size: 12px; font-weight: 500; color: var(--fg-mute);
  margin-left: 4px;
  font-family: var(--font-mono);
}
.gauge .range {
  font-family: var(--font-mono); font-size: 10px; color: var(--fg-mute);
}
.gauge.warn .value { color: var(--sev-warn); }
.gauge.critical .value { color: var(--sev-critical); }
.gauge .bar {
  height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden;
}
.gauge .bar > i {
  display: block; height: 100%; background: var(--fg); border-radius: 4px;
}
.gauge.warn .bar > i { background: var(--sev-warn); }
.gauge.critical .bar > i { background: var(--sev-critical); }
.gauge .spark { height: 30px; width: 100%; }

/* ---------- Event feed ---------- */
.events { display: flex; flex-direction: column; gap: 4px; }
.event {
  display: grid;
  grid-template-columns: 56px 18px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  cursor: default;
}
.event:hover { background: var(--surface-2); }
.event .ts { font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute); }
.event .ic { color: var(--fg-mute); display: inline-flex; }
.event .body .code { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); letter-spacing: 0.02em; }
.event .body .detail { color: var(--fg); margin-top: 2px; }
.event .sev {
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--fg-mute);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.event.warn .sev { background: var(--sev-warn-bg); color: var(--sev-warn); }
.event.warn .ic { color: var(--sev-warn); }
.event.medium .sev { background: var(--sev-warn-bg); color: var(--sev-warn); }
.event.medium .ic { color: var(--sev-warn); }
.event.critical .sev { background: var(--sev-critical-bg); color: var(--sev-critical); }
.event.critical .ic { color: var(--sev-critical); }
.event.info .ic { color: var(--sev-info); }

/* ---------- Coaching cues ---------- */
.cue {
  display: flex; gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border-left: 3px solid var(--fg-mute);
}
.cue.loop-1 { border-left-color: var(--sev-info); }
.cue.loop-2 { border-left-color: var(--sev-warn); }
.cue.loop-3 { border-left-color: var(--fg); }
.cue .loop-tag { font-family: var(--font-mono); font-size: 10px; color: var(--fg-mute); letter-spacing: 0.05em; text-transform: uppercase; }
.cue .msg { font-size: 13px; color: var(--fg); margin-top: 2px; }
.cue .meta { display: flex; gap: 8px; margin-top: 6px; font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); }
.cue .ic { flex-shrink: 0; opacity: 0.7; }

/* ---------- Sparkline (svg) ---------- */
.spark path { stroke: var(--fg); stroke-width: 1.5; fill: none; }
.spark .area { fill: var(--spark-area); stroke: none; }
.gauge.warn .spark path { stroke: var(--sev-warn); }
.gauge.critical .spark path { stroke: var(--sev-critical); }

/* ---------- Login ---------- */
.login {
  height: 100vh; display: grid; place-items: center;
  background: var(--bg);
  position: relative; overflow: hidden;
}
.login .card-w {
  width: 380px; padding: 36px 32px;
  background: var(--surface);
  border-radius: var(--r-lg);
  position: relative; z-index: 2;
}
.login .brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 32px;
}
.login .brand .mark { width: 32px; height: 32px; }
.login .brand .name { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.login h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: 28px; line-height: 1.1; letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login .sub { color: var(--fg-mute); margin-bottom: 28px; font-size: 13px; }
.login .footer { text-align: center; color: var(--fg-mute); font-family: var(--font-mono); font-size: 11px; margin-top: 24px; }
.login .bg-hatch {
  position: absolute; inset: 0; opacity: 0.12;
  background: url('./hatch.svg'); background-size: 320px 320px;
  filter: invert(var(--hatch-invert));
}

/* ---------- Wizard ---------- */
.wizard-steps {
  display: flex; gap: 0; align-items: center; flex-wrap: wrap;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 12px; color: var(--fg-mute);
}
.wizard-step .n {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); display: inline-grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
}
.wizard-step.active { background: var(--surface); color: var(--fg); }
.wizard-step.active .n { background: var(--fg); color: var(--bg); }
.wizard-step.done .n { background: var(--surface-3); color: var(--fg); }
.wizard-arrow { color: var(--fg-mute); margin: 0 4px; }

/* ---------- Live session layout ---------- */
.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
  height: 100%;
}
.live-grid .lov-wrap { grid-column: 1; grid-row: 1; }
.live-grid .telemetry { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.live-grid .bottom { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }

/* ---------- Heatmap ---------- */
.heat {
  border-radius: var(--r-md); overflow: hidden;
}
.heat td {
  padding: 0; height: 40px; width: 60px;
  text-align: center; font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line);
  color: var(--fg-mute);
}
.heat td.h-0 { background: var(--heat-0); }
.heat td.h-1 { background: var(--heat-1); color: var(--fg); }
.heat td.h-2 { background: var(--heat-2); color: var(--fg); }
.heat td.h-3 { background: var(--heat-3); color: var(--bg); font-weight: 600; }
.heat td.h-4 { background: var(--heat-4); color: var(--bg); font-weight: 600; }
.heat td.h-5 { background: var(--heat-5); color: var(--bg); font-weight: 700; }
.heat th { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-mute); padding: 6px 8px; text-align: left; font-weight: 500; }
.heat td.lbl { width: auto; text-align: left; padding: 0 12px; color: var(--fg); font-family: var(--font-body); font-size: 13px; background: var(--surface); }

/* ---------- Scrubber / timeline ---------- */
.scrubber {
  position: relative;
  height: 56px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 8px 12px;
}
.scrubber .track {
  position: relative;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  margin-top: 22px;
}
.scrubber .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--fg); border-radius: var(--r-pill);
}
.scrubber .handle {
  position: absolute; top: -5px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--fg); transform: translateX(-50%);
  box-shadow: 0 0 0 4px var(--handle-ring);
}
.scrubber .marker {
  position: absolute; top: -16px; width: 2px; height: 10px;
  background: var(--fg-mute);
}
.scrubber .marker.warn { background: var(--sev-warn); }
.scrubber .marker.crit { background: var(--sev-critical); }
.scrubber .time {
  position: absolute; top: 6px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-mute);
}

/* ---------- Capability chip ---------- */
.capchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface); color: var(--fg);
  letter-spacing: 0.02em;
}
.capchip.off { color: var(--fg-mute); opacity: 0.5; text-decoration: line-through; }
.capchip .ic { width: 12px; height: 12px; opacity: 0.7; }

/* ---------- Misc utility ---------- */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 22px; padding: 0 6px; height: 22px;
  background: var(--surface-2); border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg);
  border: 1px solid var(--line-2);
}
.sep-line { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Avatar ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  color: var(--fg);
  flex-shrink: 0;
}
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* ---------- Severity dot ---------- */
.sev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sev-dot.info { background: var(--sev-info); }
.sev-dot.warn { background: var(--sev-warn); }
.sev-dot.critical { background: var(--sev-critical); }
.sev-dot.success { background: var(--sev-success); }
.sev-dot.mute { background: var(--fg-mute); }

/* ---------- Modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 1000;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 28px;
  min-width: 420px; max-width: 560px;
}
.modal h3 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.modal .body { color: var(--fg-mute); margin-bottom: 20px; font-size: 13.5px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Scroll ---------- */
.content::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.content::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb {
  background: var(--surface-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box;
}
.content::-webkit-scrollbar-thumb:hover { background: var(--surface-3); background-clip: padding-box; }

/* ---------- Animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fade-up 200ms var(--ease-out); }

/* small skeleton */
.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 6px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

