/* css/tokens.css */
/*
 * Sentinel design tokens — "Quiet control room".
 * Single source of truth for colour, type, space, radius, layout and motion.
 * Dark is the default theme; light applies via prefers-color-scheme or
 * <html data-theme="light">. See docs/DESIGN.md §11.
 */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* ---- Surface ---- */
  --bg: #0a0a0b;
  --surface-1: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #232327;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.14);
  --overlay: rgba(5, 5, 6, 0.72);
  --glass: rgba(20, 20, 22, 0.62);

  /* ---- Text (contrast vs --bg) ---- */
  --text: #f2f2f0;      /* ~17:1 */
  --text-2: #a9a9ad;    /* ~8.4:1 */
  --text-3: #85858c;    /* ~5.3:1, AA small text */
  --text-inverse: #0a0a0b;

  /* ---- Accent: intent only (focus, primary action, live) ---- */
  --accent: #c6ff3d;
  --accent-ink: #0a0a0b;
  --accent-glow: rgba(198, 255, 61, 0.18);
  --focus-ring: var(--accent);

  /* ---- Status: muted until it matters; critical is the only saturated hue ---- */
  --ok: #7fb89a;
  --ok-bg: rgba(127, 184, 154, 0.08);
  --ok-line: rgba(127, 184, 154, 0.24);
  --warn: #e3ac55;
  --warn-bg: rgba(227, 172, 85, 0.08);
  --warn-line: rgba(227, 172, 85, 0.32);
  --warn-glow: rgba(227, 172, 85, 0.14);
  --crit: #ff3b30;
  --crit-bg: rgba(255, 59, 48, 0.1);
  --crit-line: rgba(255, 59, 48, 0.45);
  --crit-glow: rgba(255, 59, 48, 0.28);
  --info: #9aa7b8;
  --muted: #5d5d63;

  /* ---- Chart ---- */
  --chart-line: #e6e6e3;
  --chart-fill: rgba(230, 230, 227, 0.06);
  --chart-grid: rgba(255, 255, 255, 0.05);
  --chart-axis: var(--text-3);

  /* ---- Hero glow (tinted by fleet state via [data-fleet]) ---- */
  --hero-glow: rgba(255, 255, 255, 0.045);

  /* ---- Type ---- */
  --font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4.5rem);
  --fs-display: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem);
  --fs-h1: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --fs-h2: 1.25rem;
  --fs-h3: 1.0625rem;
  --fs-body: 0.9375rem;  /* 15px */
  --fs-sm: 0.8125rem;    /* 13px */
  --fs-xs: 0.75rem;      /* 12px */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --lh-tight: 1.08;
  --lh-snug: 1.3;
  --lh-body: 1.55;
  --tracking-tight: -0.03em;
  --tracking-label: 0.06em;

  /* ---- Space: 8px grid (s-1 is the half step) ---- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* ---- Radius ---- */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* ---- Layout ---- */
  --content-max: 1320px;
  --gutter: clamp(16px, 4vw, 48px);
  --grid-cols: 12;
  --grid-gap: var(--s-4);
  --nav-h: 52px;

  /* ---- Elevation: borders over shadows; shadow only for floating layers ---- */
  --shadow-float: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px -12px rgba(0, 0, 0, 0.6);

  /* ---- Motion ---- */
  --dur-micro: 120ms;
  --dur-ui: 220ms;
  --dur-page: 400ms;
  --dur-hold: 1200ms;
  --stagger: 35ms;
  --breathe: 2.5s;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* Gentle spring (slight overshoot) approximated with linear(); falls back to ease-out. */
  --ease-spring: var(--ease-out);
  --press-scale: 0.97;
  --lift: -2px;

  /* ---- Z layers ---- */
  --z-grain: 1;
  --z-nav: 50;
  --z-toast: 80;
  --z-palette: 90;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --ease-spring: linear(
      0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%,
      1.067, 1.099 24.3%, 1.108 26%, 1.1 28%, 1.067 31.4%, 1.008 39%,
      0.988 42.8%, 0.982 46.6%, 0.987 52.5%, 1.001 69.6%, 1
    );
  }
}

/* ---- Light theme ---- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fafaf9;
    --surface-1: #ffffff;
    --surface-2: #f4f4f2;
    --surface-3: #ececea;
    --line: rgba(10, 10, 11, 0.08);
    --line-strong: rgba(10, 10, 11, 0.18);
    --overlay: rgba(250, 250, 249, 0.72);
    --glass: rgba(255, 255, 255, 0.7);
    --text: #0d0d0e;
    --text-2: #4a4a4f;
    --text-3: #6a6a70;
    --text-inverse: #fafaf9;
    --accent: #4d7c0f;
    --accent-ink: #ffffff;
    --accent-glow: rgba(77, 124, 15, 0.16);
    --ok: #2f7a55;
    --ok-bg: rgba(47, 122, 85, 0.07);
    --ok-line: rgba(47, 122, 85, 0.24);
    --warn: #9a6200;
    --warn-bg: rgba(154, 98, 0, 0.07);
    --warn-line: rgba(154, 98, 0, 0.3);
    --warn-glow: rgba(154, 98, 0, 0.12);
    --crit: #d70015;
    --crit-bg: rgba(215, 0, 21, 0.07);
    --crit-line: rgba(215, 0, 21, 0.4);
    --crit-glow: rgba(215, 0, 21, 0.2);
    --info: #56657a;
    --muted: #a3a3a8;
    --chart-line: #1a1a1c;
    --chart-fill: rgba(26, 26, 28, 0.05);
    --chart-grid: rgba(10, 10, 11, 0.06);
    --hero-glow: rgba(10, 10, 11, 0.035);
    --shadow-float: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 12px 40px -16px rgba(10, 10, 11, 0.22);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafaf9;
  --surface-1: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #ececea;
  --line: rgba(10, 10, 11, 0.08);
  --line-strong: rgba(10, 10, 11, 0.18);
  --overlay: rgba(250, 250, 249, 0.72);
  --glass: rgba(255, 255, 255, 0.7);
  --text: #0d0d0e;
  --text-2: #4a4a4f;
  --text-3: #6a6a70;
  --text-inverse: #fafaf9;
  --accent: #4d7c0f;
  --accent-ink: #ffffff;
  --accent-glow: rgba(77, 124, 15, 0.16);
  --ok: #2f7a55;
  --ok-bg: rgba(47, 122, 85, 0.07);
  --ok-line: rgba(47, 122, 85, 0.24);
  --warn: #9a6200;
  --warn-bg: rgba(154, 98, 0, 0.07);
  --warn-line: rgba(154, 98, 0, 0.3);
  --warn-glow: rgba(154, 98, 0, 0.12);
  --crit: #d70015;
  --crit-bg: rgba(215, 0, 21, 0.07);
  --crit-line: rgba(215, 0, 21, 0.4);
  --crit-glow: rgba(215, 0, 21, 0.2);
  --info: #56657a;
  --muted: #a3a3a8;
  --chart-line: #1a1a1c;
  --chart-fill: rgba(26, 26, 28, 0.05);
  --chart-grid: rgba(10, 10, 11, 0.06);
  --hero-glow: rgba(10, 10, 11, 0.035);
  --shadow-float: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 12px 40px -16px rgba(10, 10, 11, 0.22);
}

/* Fleet-state tint for the hero glow. */
[data-fleet="warn"] { --hero-glow: var(--warn-glow); }
[data-fleet="crit"] { --hero-glow: var(--crit-glow); }

/* ---- Reduced motion: instant or opacity-only ---- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-micro: 0ms;
    --dur-ui: 120ms;   /* opacity-only transitions still read as a state change */
    --dur-page: 0ms;
    --stagger: 0ms;
    --press-scale: 1;
    --lift: 0px;
    --ease-spring: linear;
  }
}

/* css/base.css */
/* Base: reset, typography, layout primitives. Tokens live in tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, dl, dd, ol, ul, pre { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:where(a) { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 100%;
  line-height: var(--lh-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scrollbar-color: var(--surface-3) transparent;
}

body {
  overflow-x: clip;   /* decorative glows may bleed past the viewport; never scroll sideways */
  min-height: 100dvh;
  background: var(--bg);
  font-size: var(--fs-body);
  padding-bottom: var(--s-8);
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* Focus: a visible accent ring everywhere, never removed without replacement. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.skip-link {
  position: fixed; left: var(--s-4); top: var(--s-3); z-index: 100;
  padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-weight: var(--fw-medium);
  transform: translateY(-200%);
  transition: transform var(--dur-ui) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Texture: faint grain over everything, never interactive ---- */
.grain {
  position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none;
  background-image: url("/static/img/grain.svg");
  background-size: 240px 240px;
  opacity: 0.035;
  mix-blend-mode: overlay;
}
:root[data-theme="light"] .grain { opacity: 0.05; mix-blend-mode: multiply; }

/* ---- Typography ---- */
.statement {
  font-size: var(--fs-hero);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
.display {
  font-size: var(--fs-display);
  font-weight: var(--fw-medium);
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}
.h1 { font-size: var(--fs-h1); font-weight: var(--fw-medium); letter-spacing: -0.02em; line-height: 1.2; }
.h2 { font-size: var(--fs-h2); font-weight: var(--fw-medium); letter-spacing: -0.015em; line-height: 1.3; }
.h3 { font-size: var(--fs-h3); font-weight: var(--fw-medium); letter-spacing: -0.01em; line-height: 1.35; }
.h4 { font-size: var(--fs-body); font-weight: var(--fw-medium); line-height: 1.35; }
.lead { font-size: 1.0625rem; color: var(--text-2); max-width: 64ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: var(--tracking-label);
  color: var(--text-3);
}
.label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--text-3); }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.mono, code, kbd, pre, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "zero", "tnum";
}
.mono { letter-spacing: -0.01em; }
.num { letter-spacing: -0.02em; }
.num.big { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); font-weight: var(--fw-medium); }
code { font-size: 0.92em; }
kbd {
  display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 0.4em;
  font-size: 0.72rem; line-height: 1; color: var(--text-2);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2);
}
a:where(:not(.btn):not(.card-link)):hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.small a, a.small { color: var(--text-2); }

pre.code, textarea.code {
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4); overflow: auto; white-space: pre; tab-size: 2; color: var(--text);
}

/* ---- Layout ---- */
.page {
  width: min(100% - 2 * var(--gutter), var(--content-max));
  margin-inline: auto;
  padding-top: calc(var(--nav-h) + var(--s-8));
  position: relative; z-index: 2;
}
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-5);
  margin-bottom: var(--s-6);
}
.page-head > div { display: grid; gap: var(--s-2); max-width: 72ch; }

.detail-grid, .chart-grid, .bento {
  display: grid; grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr)); gap: var(--grid-gap);
}
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
@media (max-width: 1080px) {
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 6; }
}
@media (max-width: 760px) {
  .detail-grid > *, .chart-grid > * { grid-column: 1 / -1; }
}

.stack { display: grid; gap: var(--s-4); }
.row-end { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--s-2); }
.row-center { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--s-3); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.crumbs { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--s-4); }
.crumbs a { color: var(--text-2); }

/* ---- Tables ---- */
.table { font-size: var(--fs-sm); }
.table th {
  text-align: left; font-weight: var(--fw-medium); color: var(--text-3);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-label);
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line);
}
.table td { padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color var(--dur-micro) var(--ease-out); }
.table tbody tr:hover { background: color-mix(in oklab, var(--surface-2) 60%, transparent); }
.table .r { text-align: right; }
.table td.r { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.card > .table { margin: calc(-1 * var(--s-2)) calc(-1 * var(--s-3)); width: calc(100% + 2 * var(--s-3)); }
@media (max-width: 760px) {
  .card:has(> .table) { overflow-x: auto; }
}

/* ---- Key/value ---- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); }
.kv dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv.wide { grid-template-columns: minmax(10ch, max-content) 1fr; }
.kv-inline { display: flex; flex-wrap: wrap; gap: var(--s-5); font-size: var(--fs-sm); }
.kv-inline div { display: grid; gap: 2px; }
.kv-inline dt { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.kv-inline dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.loadmore { display: flex; justify-content: center; padding-top: var(--s-5); }

/* css/components.css */
/* Components. Only transform/opacity animate (plus SVG stroke offsets). */

/* ---- Card ---- */
.card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--dur-ui) var(--ease-out), transform var(--dur-ui) var(--ease-out);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head .h3 { margin: 0; }

/* ---- Buttons ---- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-line: var(--line-strong);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-pill); border: 1px solid var(--btn-line);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); letter-spacing: -0.005em; white-space: nowrap;
  transition: transform var(--dur-micro) var(--ease-out), border-color var(--dur-ui) var(--ease-out), opacity var(--dur-ui);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: color-mix(in oklab, var(--text) 30%, transparent); }
.btn:active { transform: scale(var(--press-scale)); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { --btn-bg: transparent; --btn-line: transparent; color: var(--text-2); }
.btn.ghost:hover { --btn-line: var(--line-strong); color: var(--text); }
.btn.danger { --btn-bg: transparent; --btn-line: var(--crit-line); --btn-fg: var(--crit); }

/* Primary CTA: accent, arrow nudge, press, shine sweep. One per view. */
.btn.primary {
  --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-line: transparent;
  box-shadow: 0 0 0 0 var(--accent-glow);
  transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}
.btn.primary:hover { box-shadow: 0 0 0 6px var(--accent-glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: -20% auto -20% -60%; width: 40%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(0) skewX(-18deg); opacity: 0;
}
.btn.primary:hover::after { animation: shine 900ms var(--ease-out) 1; }
.btn .arrow { display: inline-block; transition: transform var(--dur-ui) var(--ease-spring); }
.btn:hover .arrow { transform: translateX(3px); }

.iconbtn {
  display: inline-grid; grid-auto-flow: column; align-items: center; gap: 6px;
  height: 32px; min-width: 32px; padding: 0 8px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: color var(--dur-micro), border-color var(--dur-micro), transform var(--dur-micro) var(--ease-out);
}
.iconbtn:hover { color: var(--text); border-color: var(--line-strong); }
.iconbtn:active { transform: scale(var(--press-scale)); }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }

/* Copy-to-clipboard: the icon morphs into a check. */
.copy svg { grid-area: 1 / 1; transition: transform var(--dur-ui) var(--ease-spring), opacity var(--dur-micro); }
.copy .i-check { opacity: 0; transform: scale(0.4) rotate(-20deg); color: var(--ok); }
.copy.copied .i-copy { opacity: 0; transform: scale(0.4) rotate(20deg); }
.copy.copied .i-check { opacity: 1; transform: none; }
.copyrow { display: flex; align-items: center; gap: var(--s-2); }
.copyrow > pre, .copyrow > code { flex: 1; min-width: 0; }
.secret { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-sm); word-break: break-all; }

/* Hold-to-confirm: a ring fills while pressed; release early cancels. */
.btn.hold { padding-left: var(--s-3); }
.hold-ring { width: 18px; height: 18px; transform: rotate(-90deg); flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--crit-line); }
.hold-ring circle { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; }
.btn.hold::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--crit-bg); transform-origin: left; transform: scaleX(var(--hold, 0));
}
.btn.hold.done { --btn-bg: var(--crit); --btn-fg: #fff; }

/* ---- Fields ---- */
.field { display: grid; gap: 6px; font-size: var(--fs-sm); }
.field > span:first-child { color: var(--text-2); }
.input {
  width: 100%; min-height: 42px; padding: 0 var(--s-3);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: var(--fs-body); color: var(--text);
  transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-ui) var(--ease-out);
}
textarea.input { padding: var(--s-3); min-height: auto; resize: vertical; line-height: 1.55; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: var(--s-6); }
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--line-strong); }
.input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.input.otp { font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; padding-left: 0.4em; }
.search .input { min-height: 36px; border-radius: var(--r-pill); padding-inline: var(--s-4); width: min(320px, 70vw); }
.form-error { color: var(--crit); font-size: var(--fs-sm); display: flex; gap: var(--s-2); align-items: baseline; }
.meter { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--strength, 0)); transition: transform var(--dur-ui) var(--ease-out), background-color var(--dur-ui); }
.meter span[data-level="weak"] { background: var(--crit); }
.meter span[data-level="fair"] { background: var(--warn); }

/* Checkbox: the box morphs into a filled tick. */
.check { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; font-size: var(--fs-sm); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  position: relative; width: 18px; height: 18px; flex: none; border-radius: 5px;
  border: 1.5px solid var(--line-strong); background: var(--surface-2);
  transition: border-radius var(--dur-ui) var(--ease-spring), background-color var(--dur-ui), border-color var(--dur-ui);
}
.check-box::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform var(--dur-ui) var(--ease-spring);
}
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); border-radius: 9px; }
.check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Toggle: spring thumb. */
.toggle { cursor: pointer; font-size: var(--fs-sm); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 38px; height: 22px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); position: relative; flex: none; transition: background-color var(--dur-ui) var(--ease-out); }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur-ui) var(--ease-spring), background-color var(--dur-ui), width var(--dur-micro); }
.toggle input:checked ~ .toggle-track { background: var(--accent); border-color: transparent; }
.toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(16px); background: var(--accent-ink); }
.toggle:active .toggle-thumb { transform: scaleX(1.25); }
.toggle input:checked ~ .toggle-track:active .toggle-thumb, .toggle:active input:checked ~ .toggle-track .toggle-thumb { transform: translateX(14px) scaleX(1.25); }
.toggle input:focus-visible ~ .toggle-track { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- Segmented control & tabs ---- */
.segmented {
  justify-self: start; width: fit-content;
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
}
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  height: 30px; padding: 0 var(--s-3); border-radius: var(--r-pill); font-size: var(--fs-sm);
  transition: color var(--dur-micro), background-color var(--dur-ui) var(--ease-out);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-1); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong); }
.segmented.small button { height: 26px; font-size: var(--fs-xs); padding: 0 var(--s-2); }

.tabs { display: flex; gap: var(--s-1); flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: var(--s-5); }
.tabs > a, .tabs > button {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2);
  background: none; border: 0; padding: var(--s-3) var(--s-3); color: var(--text-2); font-size: var(--fs-sm);
}
.tabs > a:hover, .tabs > button:hover { color: var(--text); text-decoration: none; }
.tabs > [aria-selected="true"], .tabs > [aria-current="page"] { color: var(--text); }
.tabs > [aria-selected="true"]::after, .tabs > [aria-current="page"]::after {
  content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 2px; border-radius: 2px; background: var(--text);
}
.count { font-size: var(--fs-xs); color: var(--text-3); padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin-block: var(--s-6) var(--s-4); }
.toolbar.sticky {
  position: sticky; top: calc(var(--nav-h) + var(--s-5) + 4px); z-index: 5; width: fit-content;
  padding: 4px var(--s-3) 4px 4px; margin-inline: -4px; border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
@media (max-width: 860px) { .toolbar.sticky { top: var(--s-3); } }

/* ---- Badges, severity, status ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.badge.accent { background: var(--accent-glow); color: var(--text); border-color: transparent; }
.sev-tag {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  border-radius: var(--r-pill); font-size: 0.6875rem; font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono);
}
.sev-tag::before { font-size: 0.8em; }
.sev-critical { color: var(--crit); background: var(--crit-bg); }
.sev-critical::before { content: "▲"; }
.sev-warning { color: var(--warn); background: var(--warn-bg); }
.sev-warning::before { content: "◆"; }
.sev-info { color: var(--info); background: var(--surface-2); }
.sev-info::before { content: "●"; }
.sev-resolved { color: var(--ok); background: var(--ok-bg); }
.sev-resolved::before { content: "✓"; }

/* Status: dot + icon-free text label, never colour alone. */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--text-2); }
.status-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-ok .status-dot { background: var(--ok); }
.status-ok { color: var(--ok); }
.status-warning .status-dot { background: var(--warn); }
.status-warning { color: var(--warn); }
.status-critical .status-dot, .status-down .status-dot { background: var(--crit); }
.status-critical, .status-down { color: var(--crit); }
.status-critical .status-dot::after, .status-down .status-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--crit);
  animation: dot-pulse var(--breathe) var(--ease-in-out) infinite;
}
.status-elevated { color: var(--warn); }
.status-elevated .status-dot { background: transparent; border: 1.5px solid var(--warn); }
.status-pending .status-dot { background: transparent; border: 1.5px dashed var(--text-3); }
.status-revoked .status-dot { background: transparent; border: 1.5px solid var(--text-3); }

.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: breathe var(--breathe) var(--ease-in-out) infinite; }

/* ---- Gauges: thin radial arcs ---- */
.gauge { position: relative; display: grid; justify-items: center; gap: 4px; }
.gauge svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 2.5; }
.gauge-track { stroke: var(--surface-3); }
.gauge-arc {
  stroke: var(--text-2); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset var(--dur-page) var(--ease-out), stroke var(--dur-ui);
}
.gauge[data-level="warn"] .gauge-arc { stroke: var(--warn); }
.gauge[data-level="crit"] .gauge-arc { stroke: var(--crit); }
.gauge-val { position: absolute; top: 0; height: 54px; display: grid; place-items: center; font-size: 0.8125rem; font-weight: var(--fw-medium); }
.gauge-label { font-size: 0.6875rem; color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-label); }

/* ---- Floating pill navbar ---- */
.navwrap {
  position: fixed; top: var(--s-4); left: 0; right: 0; z-index: var(--z-nav);
  display: flex; justify-content: center; padding-inline: var(--s-4); pointer-events: none;
}
.pillnav {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s-2);
  height: var(--nav-h); padding: 0 6px 0 var(--s-3);
  border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-float);
  transform-origin: top center;
  transition: transform var(--dur-page) var(--ease-out);
  max-width: 100%;
}
.navwrap.scrolled .pillnav { transform: scale(0.94) translateY(-6px); }
.brand { display: grid; place-items: center; width: 32px; height: 32px; color: var(--text); border-radius: 50%; }
.brand-mark circle { fill: var(--accent); }
.pillnav-items { position: relative; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.pillnav-items::-webkit-scrollbar { display: none; }
.pillnav-items a {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap;
  transition: color var(--dur-ui) var(--ease-out);
}
.pillnav-items a:hover { color: var(--text); text-decoration: none; }
.pillnav-items a[aria-current="page"] { color: var(--text); }
.pill-indicator {
  position: absolute; z-index: 0; left: 0; top: 50%; height: 36px; width: 80px; margin-top: -18px;
  border-radius: var(--r-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong);
  transform: translateX(var(--pill-x, 0)) scaleX(var(--pill-sx, 1)); transform-origin: left;
  opacity: 0; transition: transform var(--dur-page) var(--ease-out), opacity var(--dur-ui);
}
.pill-indicator.ready { opacity: 1; }
.pillnav-items .badge { height: 18px; padding: 0 6px; background: var(--crit); color: #fff; border: 0; font-family: var(--font-mono); }
.pillnav-items .badge[data-level="warn"] { background: var(--warn); color: var(--text-inverse); }
.pillnav-tools { display: flex; align-items: center; gap: 2px; padding-left: var(--s-2); border-left: 1px solid var(--line); margin-left: var(--s-1); }
.kbd-hint { height: 20px; font-size: 0.65rem; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.avatar:hover { text-decoration: none; border-color: var(--text-3); }
@media (max-width: 860px) {
  .navwrap { top: auto; bottom: max(var(--s-3), env(safe-area-inset-bottom)); }
  .pillnav { padding-left: var(--s-2); }
  .brand, .kbd-hint { display: none; }
  .pillnav-items a { padding: 0 10px; }
  .page { padding-top: var(--s-7); }
  body { padding-bottom: calc(var(--nav-h) + var(--s-8)); }
  .toasts { bottom: calc(var(--nav-h) + var(--s-6)); }
}

/* ---- Command palette ---- */
.palette, .sudo { position: fixed; inset: 0; z-index: var(--z-palette); display: grid; justify-items: center; align-items: start; padding: 12vh var(--s-4) var(--s-4); }
.palette-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.palette-panel {
  position: relative; width: min(640px, 100%); max-height: 70vh; display: grid; grid-template-rows: auto 1fr auto;
  border-radius: var(--r-lg); border: 1px solid var(--line-strong); background: var(--surface-1); box-shadow: var(--shadow-float); overflow: hidden;
}
.palette-input { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-4); border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-input input { flex: 1; height: 56px; background: transparent; border: 0; outline: 0; font-size: 1.0625rem; color: var(--text); }
.palette-list { overflow-y: auto; padding: var(--s-2); scroll-padding: var(--s-2); }
.palette-group { padding: var(--s-3) var(--s-3) var(--s-1); font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.palette-item {
  display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-sm);
  cursor: pointer; font-size: var(--fs-sm); color: var(--text-2);
}
.palette-item .pi-kind { width: 18px; text-align: center; color: var(--text-3); font-family: var(--font-mono); }
.palette-item .pi-label { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-label mark { background: none; color: var(--accent); }
:root[data-theme="light"] .palette-item .pi-label mark { text-decoration: underline; color: inherit; }
.palette-item .pi-hint { color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-xs); }
.palette-item[aria-selected="true"] { background: var(--surface-3); }
.palette-item[aria-selected="true"] .pi-kind { color: var(--accent); }
.palette-empty { padding: var(--s-6); text-align: center; color: var(--text-3); }
.palette-foot { display: flex; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-3); }
.palette-foot span { display: inline-flex; gap: 4px; align-items: center; }
.sudo-panel { position: relative; width: min(420px, 100%); display: grid; gap: var(--s-4); box-shadow: var(--shadow-float); }

/* Shortcut hints revealed by holding ⌘/Ctrl. */
.kbd-overlay { position: fixed; inset: 0; z-index: calc(var(--z-palette) - 1); pointer-events: none; }
.kbd-chip {
  position: fixed; left: 0; top: 0; padding: 2px 6px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font: var(--fw-semibold) 0.6875rem/1.4 var(--font-mono);
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translate(var(--x), var(--y)) scale(0.8);
  transition: opacity var(--dur-micro) var(--ease-out), transform var(--dur-ui) var(--ease-spring);
}
.kbd-overlay.show .kbd-chip { opacity: 1; transform: translate(var(--x), var(--y)) scale(1); }

/* ---- Dialog sheet ---- */
dialog.sheet {
  width: min(560px, calc(100% - 2 * var(--s-4))); max-height: 86vh; overflow: auto;
  color: var(--text); padding: var(--s-6); border-radius: var(--r-lg);
}
dialog.sheet.wide { width: min(820px, calc(100% - 2 * var(--s-4))); }
dialog.sheet::backdrop { background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---- Toasts: stack and spring ---- */
.toasts { position: fixed; right: var(--s-5); bottom: var(--s-5); z-index: var(--z-toast); display: grid; gap: var(--s-2); width: min(380px, calc(100vw - 2 * var(--s-4))); }
.toast {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3); align-items: start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--surface-1); box-shadow: var(--shadow-float); font-size: var(--fs-sm);
}
.toast .t-icon { font-family: var(--font-mono); line-height: 1.5; }
.toast.crit { border-color: var(--crit-line); }
.toast.crit .t-icon { color: var(--crit); }
.toast.warn .t-icon { color: var(--warn); }
.toast.ok .t-icon { color: var(--ok); }
.toast .t-title { font-weight: var(--fw-medium); }
.toast .t-body { color: var(--text-2); }
.toast button { background: none; border: 0; color: var(--text-3); padding: 0 2px; }

/* ---- Skeleton shimmer (no spinners anywhere) ---- */
.skeleton { pointer-events: none; }
.sk { position: relative; overflow: hidden; border-radius: var(--r-xs); background: var(--surface-2); }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--text) 6%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.6s var(--ease-in-out) infinite;
}
.sk-line { height: 12px; margin-bottom: var(--s-3); }
.sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; }
.sk-row { display: flex; gap: var(--s-4); margin-block: var(--s-4); }
.sk-circle { width: 54px; height: 54px; border-radius: 50%; }
.sk-block { height: 40px; }

/* ---- Empty state ---- */
.empty { padding: var(--s-8) var(--s-5); text-align: center; display: grid; gap: var(--s-2); }
.empty-title { font-size: var(--fs-h2); font-weight: var(--fw-medium); letter-spacing: -0.015em; }
.empty-sub { color: var(--text-2); }

/* css/motion.css */
/* Motion system. Calm by default; reserved for meaning during incidents.
   Only transform and opacity animate. Every animation has a reduced-motion
   counterpart at the bottom of this file. */

@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.55; } 50% { transform: scale(2.4); opacity: 0; } }
@keyframes dot-pulse { 0% { transform: scale(0.6); opacity: 0.9; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes shine { 0% { opacity: 0; transform: translateX(0) skewX(-18deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateX(380%) skewX(-18deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-top { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes ripple { from { opacity: 0.5; transform: scale(0.96); } to { opacity: 0; transform: scale(1.18); } }
@keyframes glitch-a { 0%, 100% { transform: none; opacity: 0; } 10% { transform: translate(-3px, 1px); opacity: 0.8; } 20% { transform: translate(2px, -1px); } 30% { transform: none; opacity: 0; } }
@keyframes glitch-b { 0%, 100% { transform: none; opacity: 0; } 12% { transform: translate(3px, -1px); opacity: 0.8; } 24% { transform: translate(-2px, 1px); } 32% { transform: none; opacity: 0; } }

/* First-load stagger (JS sets --i and adds .enter only on first visit). */
.enter > * { animation: rise var(--dur-page) var(--ease-out) both; animation-delay: calc(var(--i, 0) * var(--stagger)); }

/* Critical: one ripple from the card when the incident fires. */
.ripple-once::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--crit); animation: ripple 1100ms var(--ease-out) 1 forwards;
}

/* New timeline items slide in from the top. */
.slide-in { animation: slide-in-top var(--dur-page) var(--ease-out) both; }

/* ---- Cross-document view transitions ---- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur-page); animation-timing-function: var(--ease-out); }
::view-transition-group(host-title) { animation-duration: var(--dur-page); animation-timing-function: var(--ease-out); }
.host .host-hero h1 { view-transition-name: host-title; }
.pillnav { view-transition-name: pillnav; }

/* ---- Reduced motion: instant, or opacity-only ---- */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
:root.reduce-motion { --dur-micro: 0ms; --dur-ui: 120ms; --dur-page: 0ms; --stagger: 0ms; --press-scale: 1; --lift: 0px; --ease-spring: linear; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .live-dot::after, .status-critical .status-dot::after, .status-down .status-dot::after, .sk::after { animation: none; }
  .enter > *, .slide-in { animation: fade 120ms linear both; animation-delay: 0ms; }
  .ripple-once::before { animation: none; }
  .btn.primary:hover::after { animation: none; }
  .btn:hover .arrow { transform: none; }
}
:root.reduce-motion .live-dot::after, :root.reduce-motion .status-dot::after, :root.reduce-motion .sk::after,
:root.reduce-motion .ripple-once::before, :root.reduce-motion .btn.primary:hover::after { animation: none; }
:root.reduce-motion .enter > *, :root.reduce-motion .slide-in { animation: fade 120ms linear both; animation-delay: 0ms; }
:root.reduce-motion .btn:hover .arrow { transform: none; }

/* css/pages.css */
/* ---- Auth (login, 2FA, setup) ---- */
.auth {
  min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: var(--s-5);
  padding: var(--s-7) var(--s-4); position: relative; z-index: 2;
}
.auth-glow, .hero-glow {
  position: absolute; pointer-events: none; z-index: -1;
  inset: -30% -20% auto; height: 80vh;
  background: radial-gradient(50% 50% at 50% 40%, var(--hero-glow), transparent 70%);
  transition: opacity var(--dur-page);
}
.auth-brand { display: flex; align-items: center; gap: var(--s-2); font-weight: var(--fw-medium); letter-spacing: -0.01em; }
.auth-card { width: min(400px, calc(100vw - 2 * var(--s-4))); display: grid; gap: var(--s-4); padding: var(--s-6); box-shadow: var(--shadow-float); }
.auth-card.wide { width: min(620px, calc(100vw - 2 * var(--s-4))); }
.auth-foot { font-size: var(--fs-sm); text-align: center; }
.totp-setup { display: grid; grid-template-columns: auto 1fr; gap: var(--s-5); align-items: start; }
.qr { padding: 10px; border-radius: var(--r-md); background: #fff; }
.qr img { width: 180px; height: 180px; image-rendering: pixelated; }
@media (max-width: 560px) { .totp-setup { grid-template-columns: 1fr; justify-items: center; } }

/* ---- Overview hero ---- */
.hero { position: relative; padding: var(--s-6) 0 var(--s-5); display: grid; gap: var(--s-5); }
.hero .eyebrow.live { color: var(--text-2); }
.hero .sep { color: var(--text-3); }
.statement { max-width: 18ch; transition: color var(--dur-page) var(--ease-out); }
[data-fleet="warn"] .statement { color: var(--warn); }
[data-fleet="crit"] .statement { color: var(--crit); }
.statement .soft { color: var(--text-3); }
.hero-stats { display: flex; flex-wrap: wrap; gap: var(--s-7); }
.hero-stats div { display: grid; gap: var(--s-1); }
.hero-stats dt { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.hero-stats dd { display: flex; align-items: baseline; gap: 2px; }
.hero-stats .unit { color: var(--text-3); font-family: var(--font-mono); }

/* ---- Odometer ---- */
.odo { display: inline-flex; align-items: flex-start; overflow: hidden; height: 1.15em; line-height: 1.15em; vertical-align: bottom; }
.odo-col { display: inline-flex; flex: none; flex-direction: column; transition: transform var(--dur-page) var(--ease-out); }
.odo-col span { display: block; height: 1.15em; }
.odo-static { display: inline-block; }

/* ---- Bento of server cards ---- */
.bento > .host-card { grid-column: span 3; }
@media (max-width: 1280px) { .bento > .host-card { grid-column: span 4; } }
@media (max-width: 920px) { .bento > .host-card { grid-column: span 6; } }
@media (max-width: 600px) { .bento > .host-card { grid-column: 1 / -1; } }
.bento > .host-card.feature { grid-column: span 6; }
@media (max-width: 920px) { .bento > .host-card.feature { grid-column: span 6; } }
@media (max-width: 600px) { .bento > .host-card.feature { grid-column: 1 / -1; } }

.host-card { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3); content-visibility: auto; contain-intrinsic-size: auto 250px; }
.host-card:not(.skeleton):hover { transform: translateY(var(--lift)); border-color: var(--line-strong); }
.host-card .card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.host-card .card-link:focus-visible { outline-offset: 3px; border-radius: var(--r-lg); }
.host-head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.host-head .host-alerts { order: 1; }
.host-head .host-name { order: 2; }
.host-name { flex-basis: 100%; font-size: 1.0625rem; font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-alerts { margin-left: auto; display: inline-flex; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.host-alerts .crit { color: var(--crit); }
.host-alerts .warn { color: var(--warn); }
.host-meta { font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.2em; }
.gauges { display: flex; justify-content: space-between; padding-block: var(--s-1); }
.spark-wrap { position: relative; }
.spark { width: 100%; height: 40px; }
.spark-label { position: absolute; right: 0; top: -2px; font-size: 0.6875rem; opacity: 0; transition: opacity var(--dur-ui); }
.host-card:hover .spark-label { opacity: 1; }
.host-foot { display: flex; justify-content: space-between; font-size: var(--fs-xs); padding-top: var(--s-2); border-top: 1px solid var(--line); }

/* Severity treatments: warning glows softly, critical gets a strong border
   (the ripple and dot pulse are added in motion.css); down is dimmed. */
.host-card.is-warning { border-color: var(--warn-line); box-shadow: 0 0 0 1px var(--warn-line), 0 0 28px -8px var(--warn-glow); }
.host-card.is-critical { border-color: var(--crit-line); background: linear-gradient(180deg, var(--crit-bg), transparent 60%), var(--surface-1); }
.host-card.is-down { border-color: var(--crit-line); }
.host-card.is-down .gauges, .host-card.is-down .spark-wrap { opacity: 0.35; filter: grayscale(1); }
.host-card.is-pending { border-style: dashed; }
.host-card.is-elevated { border-color: var(--warn-line); }
.fleet tbody tr[data-status="elevated"] .sticky-col { box-shadow: inset 2px 0 0 var(--warn-line); }

/* ---- Host detail ---- */
.host-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-2); }
.host-hero > div { display: grid; gap: var(--s-2); }
.chart-card { display: grid; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3); }
.chart-card header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.chart { position: relative; height: 180px; }
.chart canvas { width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.legend i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: currentColor; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.chart-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; min-width: 140px;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface-1); box-shadow: var(--shadow-float); font-size: var(--fs-xs);
  opacity: 0; transition: opacity var(--dur-micro);
}
.chart-tip.show { opacity: 1; }
.chart-tip .tt-time { color: var(--text-3); margin-bottom: 4px; font-family: var(--font-mono); }
.chart-tip .tt-row { display: flex; justify-content: space-between; gap: var(--s-3); font-family: var(--font-mono); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: var(--fs-sm); }
.chart-grid { margin-bottom: var(--grid-gap); }
.incidents-strip { display: grid; gap: var(--s-2); margin-bottom: var(--grid-gap); }
.list-plain { display: grid; gap: var(--s-2); font-size: var(--fs-sm); }
.list-plain li { display: flex; justify-content: space-between; gap: var(--s-3); align-items: center; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar span { display: block; height: 100%; background: var(--text-2); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform var(--dur-page) var(--ease-out); }
.bar[data-level="warn"] span { background: var(--warn); }
.bar[data-level="crit"] span { background: var(--crit); }
.quiet { color: var(--text-3); font-size: var(--fs-sm); padding: var(--s-3) 0; }

/* ---- Alerts timeline ---- */
.timeline { position: relative; display: grid; gap: var(--s-2); }
.timeline:not(.compact)::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.incident {
  position: relative; display: grid; grid-template-columns: 24px 1fr auto; gap: var(--s-3); align-items: start;
  padding: var(--s-3) var(--s-4) var(--s-3) 0; border-radius: var(--r-md);
}
.incident:hover { background: color-mix(in oklab, var(--surface-1) 70%, transparent); }
.sev-marker { position: relative; z-index: 1; justify-self: center; margin-top: 6px; width: 11px; height: 11px; background: var(--bg); border: 2px solid var(--text-3); border-radius: 50%; }
.incident[data-sev="critical"] .sev-marker { border-color: var(--crit); background: var(--crit); border-radius: 2px; transform: rotate(45deg); }
.incident[data-sev="warning"] .sev-marker { border-color: var(--warn); border-radius: 2px; transform: rotate(45deg); }
.incident[data-state="resolved"] .sev-marker { border-color: var(--ok); background: var(--bg); border-radius: 50%; transform: none; }
.incident-body { display: grid; gap: 4px; min-width: 0; }
.incident-body header { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.incident-title { font-weight: var(--fw-medium); }
.incident-summary { color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.incident-meta { display: flex; gap: var(--s-3); }
.incident-actions { display: flex; gap: var(--s-1); flex-wrap: wrap; justify-content: flex-end; }
.incident-actions .btn { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-xs); }
.timeline.compact { gap: 0; }
.timeline.compact li { display: grid; grid-template-columns: 96px 1fr; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.timeline.compact li:last-child { border-bottom: 0; }
.timeline.compact li.quiet { display: block; border: 0; }
.timeline.compact time { color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-xs); padding-top: 2px; }
@media (max-width: 640px) { .incident { grid-template-columns: 24px 1fr; } .incident-actions { grid-column: 2; justify-content: flex-start; } }

/* ---- Checks ---- */
.check-list { display: grid; gap: var(--s-2); }
.check-row {
  display: grid; grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 2fr) 200px; gap: var(--s-4); align-items: center;
  padding: var(--s-3) var(--s-4);
}
.check-row .check-error { grid-column: 2 / -1; color: var(--crit); }
.check-row .check-host { grid-column: 2 / -1; margin-top: calc(-1 * var(--s-3)); }
.check-id h2 { display: flex; gap: var(--s-2); align-items: center; }
.type-tag { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 6px; }
.check-stats { display: flex; gap: var(--s-5); }
.check-stats div { display: grid; }
.check-stats dt { font-size: 0.6875rem; color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.check-row .spark { height: 36px; }
@media (max-width: 960px) { .check-row { grid-template-columns: 1fr; } .check-row .check-error, .check-row .check-host { grid-column: auto; margin: 0; } }

/* ---- Security ---- */
.sec-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--grid-gap); margin-bottom: var(--grid-gap); }
@media (max-width: 860px) { .sec-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: grid; gap: var(--s-2); padding: var(--s-4); }
.stat dt { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.stat dd { font-family: var(--font-mono); font-size: clamp(1.4rem, 1rem + 1.4vw, 2rem); font-weight: var(--fw-medium); letter-spacing: -0.03em; }
.stat.is-warning dd { color: var(--warn); }
.stat.is-critical dd { color: var(--crit); }
.stat p { font-size: var(--fs-xs); color: var(--text-3); }

/* ---- Rules ---- */
.rule-groups { display: grid; gap: var(--s-6); }
.rule-group h2 { margin-bottom: var(--s-3); }
.rule-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s-3); }
.rule-card { display: grid; gap: var(--s-2); padding: var(--s-4); text-align: left; cursor: pointer; width: 100%; color: inherit; font: inherit; }
.rule-card:hover { border-color: var(--line-strong); transform: translateY(var(--lift)); }
.rule-card header { display: flex; align-items: center; gap: var(--s-2); }
.rule-card .rule-name { font-family: var(--font-mono); font-weight: var(--fw-medium); }
.rule-card p { color: var(--text-2); font-size: var(--fs-sm); }
.rule-card footer { display: flex; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.rule-card.disabled { opacity: 0.55; }
.rule-card .firing { color: var(--crit); font-family: var(--font-mono); }

/* ---- Error pages: a metric that flatlines ---- */
.errorpage {
  min-height: 100dvh; display: grid; place-content: center; justify-items: center; text-align: center;
  gap: var(--s-4); padding: var(--s-8) var(--gutter); position: relative; z-index: 2;
}
.err-figure { position: relative; width: min(640px, 92vw); display: grid; justify-items: center; }
.err-code {
  position: relative; font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.06em;
  font-size: clamp(6rem, 3rem + 14vw, 12rem); line-height: 0.9; color: var(--text);
}
.err-code::before, .err-code::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; }
.err-code::before { color: var(--crit); animation: glitch-a 2.8s steps(1) 600ms 2 both; clip-path: inset(10% 0 55% 0); }
.err-code::after { color: var(--accent); animation: glitch-b 2.8s steps(1) 700ms 2 both; clip-path: inset(60% 0 8% 0); }
.err-monitor { position: relative; width: 100%; height: 96px; margin-top: var(--s-4); }
.err-bars { position: absolute; inset: 0 0 16px; display: flex; align-items: flex-end; gap: 3px; }
.err-bars span { flex: 1; height: 100%; border-radius: 2px 2px 0 0; background: var(--text-3); transform-origin: bottom; transform: scaleY(var(--h, 0.02)); transition: transform 700ms var(--ease-out), background-color var(--dur-page); transition-delay: calc(var(--i, 0) * 12ms); }
.errorpage.flat .err-bars span { transform: scaleY(0.02); background: var(--crit); }
.err-ecg { position: absolute; inset: auto 0 0; width: 100%; height: 80px; overflow: visible; }
.err-ecg path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ecg-flat { stroke: var(--crit); opacity: 0; transition: opacity var(--dur-page); }
.errorpage.flat .ecg-flat { opacity: 1; }
.ecg-beat { stroke: var(--ok); stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; }
.errorpage.beating .ecg-beat { opacity: 1; }
.errorpage.beating .ecg-flat { opacity: 0; }
.errorpage .statement { max-width: 20ch; }
.errorpage[data-code="403"] .err-bars span { background: var(--warn); }

/* ---- Styleguide ---- */
.sg-section { display: grid; gap: var(--s-4); padding-block: var(--s-6); border-top: 1px solid var(--line); }
.sg-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.swatch { display: grid; gap: var(--s-2); }
.swatch-chip { height: 64px; border-radius: var(--r-md); border: 1px solid var(--line-strong); }
.swatch figcaption { display: grid; font-size: var(--fs-xs); }
.sg-space { display: inline-block; height: 16px; background: var(--accent); border-radius: 2px; }
.sg-radius { display: inline-block; width: 56px; height: 56px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.sg-bento { margin-block: var(--s-3); }

/* ---- Misc pages ---- */
.onetime { display: grid; gap: var(--s-2); margin-top: var(--s-4); padding: var(--s-3); border-radius: var(--r-sm); border: 1px dashed var(--accent); }

/* ---- Fleet table: every server on one screen ---- */
.toolbar-end { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.segmented[data-view] button { display: inline-grid; place-items: center; width: 34px; padding: 0; }
.fleet-wrap { padding: 0; overflow: auto; max-height: calc(100dvh - var(--nav-h) - var(--s-8)); }
.fleet { font-size: var(--fs-sm); width: 100%; }
/* Table mode uses the full screen width so every column fits without scrolling. */
.page.overview[data-view="table"] { width: min(100% - 2 * var(--gutter), 1840px); }
.fleet th, .fleet td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; vertical-align: middle; }
.fleet th.r, .fleet td.r { text-align: right; }
.fleet thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-1);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-3);
  text-transform: uppercase; letter-spacing: var(--tracking-label);
  user-select: none;
}
.fleet th[data-sort] { cursor: pointer; transition: color var(--dur-micro); }
.fleet th[data-sort]:hover, .fleet th[aria-sort="ascending"], .fleet th[aria-sort="descending"] { color: var(--text); }
.fleet th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent); }
.fleet th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent); }
.fleet .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface-1); min-width: 200px; }
.fleet thead .sticky-col { z-index: 3; }
.fleet tbody tr { cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.fleet tbody tr:hover td, .fleet tbody tr:focus-visible td { background: var(--surface-2); }
.fleet tbody tr:focus-visible { outline: none; }
.fleet tbody tr:focus-visible .sticky-col { box-shadow: inset 2px 0 0 var(--accent); }
.fleet tbody tr:last-child td { border-bottom: 0; }
.fleet tbody tr[data-status="critical"] .sticky-col, .fleet tbody tr[data-status="down"] .sticky-col { box-shadow: inset 2px 0 0 var(--crit); }
.fleet tbody tr[data-status="warning"] .sticky-col { box-shadow: inset 2px 0 0 var(--warn); }
.fleet tbody tr[data-status="down"] td:not(.sticky-col) { opacity: 0.45; }
.fname { display: flex; align-items: center; gap: var(--s-2); }
.fname a { font-weight: var(--fw-medium); color: var(--text); }
.fmeta { display: block; font-size: var(--fs-xs); margin-top: 2px; padding-left: 15px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.envtag { font-family: var(--font-mono); font-size: 0.6875rem; padding: 0 6px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); color: var(--text-2); }
.envtag[data-env="prod"], .envtag[data-env="production"] { border-color: var(--accent-glow); color: var(--text); background: var(--accent-glow); }
.fcell { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.fval { font-family: var(--font-mono); font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.fbar { width: 40px; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.fbar span { display: block; height: 100%; background: var(--text-3); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform var(--dur-page) var(--ease-out); }
.fbar[data-level="warn"] span { background: var(--warn); }
.fbar[data-level="crit"] span { background: var(--crit); }
.fleet td[data-level="warn"] .fval, .lv-warn { color: var(--warn); }
.fleet td[data-level="crit"] .fval, .lv-crit { color: var(--crit); }
.f2 { display: inline-grid; justify-items: end; line-height: 1.35; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.f2 > span:first-child { font-size: var(--fs-sm); }
.fleet td { font-variant-numeric: tabular-nums; }
.fspark { width: 80px; height: 22px; display: block; }

