/*
 * STAGE33R — design system (v5, "Instrument")
 * ---------------------------------------------------------------------
 * The single design system for every public route. Replaces the
 * --s33v4-* system and the app-shell layer on those routes (both are no
 * longer loaded there). The operations console (admin/*) loads THIS file
 * for its tokens plus assets/css/stage33r-admin.css, which maps the legacy
 * admin variable names and the dashboard's --s33v4-* components onto these
 * values — one palette, one type stack, no second system on any page.
 *
 * Direction: an intelligence instrument, not a card dashboard.
 *   - flat graphite/navy surfaces separated by hairline rules
 *   - indexed mono section headers ("01 — SITUATION")
 *   - condensed Archivo numerals for figures, IBM Plex for text and data
 *   - custom indicators: severity signal bars, EPSS meters, KEV stamps
 *   - colour is reserved for meaning (severity, health, KEV, selection)
 *
 * Contents: 1 tokens · 2 base · 3 typography · 4 layout · 5 primitives
 *           6 indicators · 7 data display · 8 states · 9 forms
 *           10 motion · 11 utilities
 *
 * Accessibility: text/background pairs below meet WCAG 2.2 AA (computed
 * with the sRGB relative-luminance formula; ratios noted beside tokens).
 * CI runs axe-core on every route at 8 widths and fails on any violation.
 */

/* ============================== 1. TOKENS ============================== */
:root {
  /* Surfaces (darkest → lightest) */
  --s-bg: #07090D;          /* page */
  --s-bg-2: #0A0E14;        /* bars */
  --s-panel: #0E131B;       /* instruments */
  --s-panel-2: #131A24;     /* raised rows, inputs */
  --s-panel-3: #1A2330;     /* hover/selected */
  --s-line: #1D2633;        /* hairline */
  --s-line-2: #2B3647;      /* strong rule */
  --s-grid-dot: rgba(148, 163, 184, 0.07);

  /* Ink — on --s-panel: ink 15.6:1, ink-2 8.6:1, ink-3 5.3:1 */
  --s-ink: #E9EDF3;
  --s-ink-2: #AAB4C3;
  --s-ink-3: #8390A2;
  --s-ink-inv: #061016;

  /* Accents — controlled, each with a job */
  --s-cyan: #3FD5F2;        /* primary signal / selection / links   */
  --s-blue: #5B93FF;        /* secondary data series                */
  --s-violet: #A991FF;      /* planned / roadmap / correlation      */
  --s-amber: #F2B33D;       /* KEV, attention, "no signal"          */

  /* Severity (CVSS bands) */
  --s-crit: #FF5A6E;
  --s-high: #FF8D45;
  --s-med: #E8C24E;
  --s-low: #43CFA0;
  --s-none: #7C8899;

  /* Operational health (never vulnerability risk) */
  --s-ok: #43CFA0;
  --s-warn: #F2B33D;
  --s-fail: #FF5A6E;
  --s-idle: #7C8899;

  /* Type */
  --s-f-display: 'Archivo', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --s-f-text: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --s-f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --s-t-11: 0.71875rem; /* 11.5px: smallest metadata size (V5.1 legibility floor) */
  --s-t-12: 0.75rem;
  --s-t-13: 0.8125rem;
  --s-t-14: 0.875rem;
  --s-t-16: 1rem;
  --s-t-18: 1.125rem;
  --s-t-22: 1.375rem;
  --s-t-28: 1.75rem;
  --s-t-36: 2.25rem;
  --s-t-48: 3rem;
  --s-t-64: 4rem;

  /* Space (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;

  /* Layout */
  --s-max: 1480px;
  --s-gutter: clamp(16px, 2.6vw, 40px);
  --s-bar-h: 56px;
  --s-ctx-h: 40px;
  --s-tabbar-h: 64px;
  --s-radius: 3px;
  --s-radius-lg: 6px;

  --s-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --s-focus: 0 0 0 2px var(--s-bg), 0 0 0 4px var(--s-cyan);
}

/* =============================== 2. BASE =============================== */
html { background: var(--s-bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body.s-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(var(--s-grid-dot) 1px, transparent 1.2px) 0 0 / 24px 24px,
    var(--s-bg);
  color: var(--s-ink);
  font-family: var(--s-f-text);
  font-size: var(--s-t-14);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.s-body *, .s-body *::before, .s-body *::after { box-sizing: border-box; }
.s-body img, .s-body svg { max-width: 100%; }
:where(.s-body) a { color: var(--s-cyan); text-decoration: none; }
:where(.s-body a:hover) { text-decoration: underline; text-underline-offset: 3px; }
/* Links inside running text are underlined so they are not distinguished by colour alone (WCAG 1.4.1). */
:where(.s-body) :is(p, .s-small, .s-prose, li > span, dd) > a:not(.s-btn):not(.s-mono) { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
:where(.s-body) :focus-visible { outline: none; box-shadow: var(--s-focus); border-radius: var(--s-radius); }
:where(.s-body) button { font: inherit; color: inherit; }
::selection { background: rgba(63, 213, 242, 0.28); }

/* ============================ 3. TYPOGRAPHY ============================ */
.s-display {
  font-family: var(--s-f-display);
  font-stretch: 112%;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.02;
  text-wrap: balance;
  margin: 0;
}
.s-h1 { font-family: var(--s-f-display); font-stretch: 108%; font-weight: 600; font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.125rem); letter-spacing: -0.02em; line-height: 1.1; margin: 0; text-wrap: balance; }
.s-h2 { font-family: var(--s-f-display); font-stretch: 104%; font-weight: 600; font-size: var(--s-t-18); letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
.s-h3 { font-family: var(--s-f-text); font-weight: 600; font-size: var(--s-t-14); line-height: 1.35; margin: 0; }
.s-lede { color: var(--s-ink-2); font-size: var(--s-t-16); line-height: 1.6; max-width: 62ch; margin: 0; }
.s-small { font-size: var(--s-t-12); color: var(--s-ink-3); }
.s-mono { font-family: var(--s-f-mono); font-feature-settings: 'zero' 1; }

/* Index label — the system's signature section marker */
.s-index {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--s-f-mono);
  font-size: var(--s-t-11);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--s-ink-3);
}
.s-index b { color: var(--s-cyan); font-weight: 500; }
.s-index::after { content: ''; flex: 1; height: 1px; background: var(--s-line); }
.s-index--bare::after { display: none; }

/* Big figure numerals */
.s-num {
  font-family: var(--s-f-display);
  font-stretch: 78%;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* ============================== 4. LAYOUT ============================== */
.s-wrap { width: 100%; max-width: var(--s-max); margin: 0 auto; padding-inline: var(--s-gutter); }
.s-section { margin-block: var(--s-10); }
.s-section:first-child { margin-top: var(--s-6); }
.s-section > .s-index { margin-bottom: var(--s-4); }
.s-stack { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }
.s-row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; min-width: 0; }
.s-grid { display: grid; gap: var(--s-4); min-width: 0; }
.s-grid > * { min-width: 0; }
.s-grid--12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s-span-12 { grid-column: span 12; } .s-span-8 { grid-column: span 8; } .s-span-7 { grid-column: span 7; }
.s-span-6 { grid-column: span 6; } .s-span-5 { grid-column: span 5; } .s-span-4 { grid-column: span 4; }
.s-span-3 { grid-column: span 3; }

/* Page header */
.s-pagehead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--s-4) var(--s-8);
  padding: var(--s-8) 0 var(--s-6);
  border-bottom: 1px solid var(--s-line);
}
.s-pagehead .s-index { margin-bottom: var(--s-3); }
.s-pagehead .s-index::after { display: none; }
.s-pagehead p { margin: var(--s-2) 0 0; color: var(--s-ink-2); max-width: 70ch; }
.s-pagehead__aside { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }

/* =========================== 5. PRIMITIVES ============================ */

/* Instrument panel: flat, ruled, square */
.s-panel {
  position: relative;
  background: var(--s-panel);
  border: 1px solid var(--s-line);
  border-radius: var(--s-radius);
  min-width: 0;
}
.s-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  flex-wrap: wrap;
  min-height: 44px;
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--s-line);
}
.s-panel__label {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0;
  font-family: var(--s-f-mono);
  font-size: var(--s-t-11);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--s-ink-2);
}
.s-panel__label b { color: var(--s-cyan); font-weight: 500; }
.s-panel__meta { font-family: var(--s-f-mono); font-size: var(--s-t-11); color: var(--s-ink-3); letter-spacing: 0.02em; }
.s-panel__body { padding: var(--s-4); min-width: 0; }
.s-panel__body--flush { padding: 0; }
.s-panel__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); flex-wrap: wrap;
  padding: var(--s-2) var(--s-4);
  border-top: 1px solid var(--s-line);
  font-size: var(--s-t-12);
  color: var(--s-ink-3);
}

/* Registration marks — reserved for the primary instrument on a page */
.s-marked::before, .s-marked::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border-color: var(--s-cyan);
  border-style: solid;
  pointer-events: none;
}
.s-marked::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.s-marked::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* Buttons */
.s-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--s-radius);
  border: 1px solid transparent;
  font-family: var(--s-f-text);
  font-size: var(--s-t-14);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.s-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
:where(.s-body) a.s-btn:hover { text-decoration: none; }
.s-btn--primary { background: var(--s-cyan); color: var(--s-ink-inv); }
.s-btn--primary:hover { background: #7BE3F7; color: var(--s-ink-inv); }
.s-btn--line { background: transparent; color: var(--s-ink); border-color: var(--s-line-2); }
.s-btn--line:hover { border-color: var(--s-cyan); color: var(--s-ink); }
.s-btn--quiet { background: transparent; color: var(--s-ink-2); padding-inline: var(--s-2); }
.s-btn--quiet:hover { color: var(--s-ink); background: var(--s-panel-2); }
.s-btn--sm { min-height: 32px; padding-inline: var(--s-3); font-size: var(--s-t-13); }
.s-btn[disabled], .s-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Tags / chips */
.s-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 7px;
  border-radius: 2px;
  border: 1px solid var(--s-line-2);
  font-family: var(--s-f-mono);
  font-size: var(--s-t-11);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--s-ink-2);
  white-space: nowrap;
}
.s-tag--planned { color: var(--s-violet); border-color: rgba(169, 145, 255, 0.45); border-style: dashed; }
.s-tag--live { color: var(--s-cyan); border-color: rgba(63, 213, 242, 0.45); }
.s-tag--live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--s-ok); }

/* ============================ 6. INDICATORS =========================== */

/* KEV stamp — amber, square, always labelled */
.s-kev {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--s-amber);
  border-radius: 2px;
  font-family: var(--s-f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--s-amber);
  background: rgba(242, 179, 61, 0.08);
  white-space: nowrap;
}
.s-kev--ransom { color: #FFD08A; border-color: #FFD08A; }

/* Severity signal: five ascending bars + label. Bars filled to band. */
.s-sev { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-family: var(--s-f-mono); font-size: var(--s-t-12); font-weight: 600; }
.s-sev__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.s-sev__bars i { display: block; width: 3px; border-radius: 1px; background: var(--s-line-2); }
.s-sev__bars i:nth-child(1) { height: 4px; } .s-sev__bars i:nth-child(2) { height: 6.5px; }
.s-sev__bars i:nth-child(3) { height: 9px; } .s-sev__bars i:nth-child(4) { height: 11.5px; } .s-sev__bars i:nth-child(5) { height: 14px; }
.s-sev--critical { color: var(--s-crit); } .s-sev--critical i { background: var(--s-crit); }
.s-sev--high { color: var(--s-high); } .s-sev--high i:nth-child(-n+4) { background: var(--s-high); }
.s-sev--medium { color: var(--s-med); } .s-sev--medium i:nth-child(-n+3) { background: var(--s-med); }
.s-sev--low { color: var(--s-low); } .s-sev--low i:nth-child(-n+2) { background: var(--s-low); }
.s-sev--unknown { color: var(--s-ink-3); }
.s-sev__score { color: var(--s-ink-2); font-weight: 500; }

/* EPSS meter: probability bar 0–100%, percentile tick when known */
.s-epss { display: inline-flex; align-items: center; gap: 8px; min-width: 96px; white-space: nowrap; }
.s-epss__track { position: relative; flex: 1; min-width: 44px; height: 4px; background: var(--s-line-2); border-radius: 2px; overflow: hidden; }
.s-epss__fill { position: absolute; inset: 0 auto 0 0; background: var(--s-blue); border-radius: 2px; }
.s-epss--hot .s-epss__fill { background: var(--s-crit); }
.s-epss--warm .s-epss__fill { background: var(--s-high); }
.s-epss__val { font-family: var(--s-f-mono); font-size: var(--s-t-12); color: var(--s-ink-2); min-width: 44px; text-align: right; }
.s-epss--none .s-epss__track { background: repeating-linear-gradient(90deg, var(--s-line-2) 0 3px, transparent 3px 6px); }

/* Health light */
.s-health { display: inline-flex; align-items: center; gap: 7px; font-family: var(--s-f-mono); font-size: var(--s-t-11); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.s-health::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.s-health--operational { color: var(--s-ok); } .s-health--operational::before { background: var(--s-ok); box-shadow: 0 0 0 3px rgba(67, 207, 160, 0.15); }
.s-health--degraded { color: var(--s-warn); } .s-health--degraded::before { background: var(--s-warn); }
.s-health--failed { color: var(--s-fail); } .s-health--failed::before { background: var(--s-fail); }
.s-health--unknown { color: var(--s-ink-3); } .s-health--unknown::before { border: 1.5px solid var(--s-ink-3); }
.s-health--not-configured { color: var(--s-ink-3); } .s-health--not-configured::before { border: 1.5px dashed var(--s-ink-3); }

/* Stacked distribution bar (severity / EPSS bands) */
.s-dist { display: flex; width: 100%; height: 10px; gap: 2px; }
.s-dist > span { display: block; min-width: 3px; height: 100%; border-radius: 1px; }
.s-dist--empty { background: repeating-linear-gradient(90deg, var(--s-line-2) 0 4px, transparent 4px 8px); border-radius: 1px; }
.s-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin: var(--s-3) 0 0; padding: 0; list-style: none; font-size: var(--s-t-12); color: var(--s-ink-2); }
.s-legend li { display: inline-flex; align-items: center; gap: 6px; }
.s-legend i { width: 8px; height: 8px; border-radius: 1px; display: inline-block; }
.s-legend b { font-family: var(--s-f-mono); color: var(--s-ink); font-weight: 500; }

/* Run strip: one cell per day, coloured by worst run status */
.s-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(6px, 1fr); gap: 2px; height: 14px; }
.s-strip i { display: block; border-radius: 1px; background: var(--s-panel-3); }
.s-strip i[data-s="success"] { background: var(--s-ok); }
.s-strip i[data-s="partial"] { background: var(--s-warn); }
.s-strip i[data-s="failed"] { background: var(--s-fail); }

/* ============================ 7. DATA DISPLAY ========================= */

/* Figure: label + numeral + caption; separates "0" from "no signal" */
.s-figure { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.s-figure__label { font-family: var(--s-f-mono); font-size: var(--s-t-11); letter-spacing: 0.1em; text-transform: uppercase; color: var(--s-ink-3); }
.s-figure__value { font-size: clamp(2rem, 1.5rem + 1.3vw, 2.75rem); color: var(--s-ink); }
.s-figure__value--crit { color: var(--s-crit); }
.s-figure__value--amber { color: var(--s-amber); }
.s-figure__value--violet { color: var(--s-violet); }
.s-figure__value--cyan { color: var(--s-cyan); }
.s-figure__value[data-state="unavailable"] { color: var(--s-ink-3); }
.s-figure__cap { font-size: var(--s-t-12); color: var(--s-ink-2); }
.s-figure__cap--nosignal { font-family: var(--s-f-mono); font-size: var(--s-t-11); letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-amber); }

/* Figure band: figures separated by vertical rules */
.s-band {
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  border-top: 1px solid var(--s-line-2);
  border-bottom: 1px solid var(--s-line);
}
.s-band > .s-figure { padding: var(--s-5) var(--s-5) var(--s-5) 0; }
.s-band > .s-figure + .s-figure { padding-left: var(--s-5); border-left: 1px solid var(--s-line); }

/* Tables */
.s-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
.s-table { width: 100%; border-collapse: collapse; font-size: var(--s-t-13); }
.s-table th {
  position: sticky; top: 0;
  text-align: left;
  padding: 9px var(--s-4);
  background: var(--s-bg-2);
  border-bottom: 1px solid var(--s-line-2);
  font-family: var(--s-f-mono);
  font-size: var(--s-t-11);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--s-ink-3);
  white-space: nowrap;
}
.s-table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.s-table th a:hover { color: var(--s-ink); text-decoration: none; }
.s-table th[aria-sort] a { color: var(--s-cyan); }
.s-table td { padding: 10px var(--s-4); border-bottom: 1px solid var(--s-line); vertical-align: middle; color: var(--s-ink); }
.s-table tbody tr:hover > td { background: rgba(63, 213, 242, 0.03); }
.s-table tbody tr:last-child > td { border-bottom: none; }
.s-table .s-id { font-family: var(--s-f-mono); font-size: var(--s-t-13); font-weight: 500; white-space: nowrap; }
.s-table .s-dim { color: var(--s-ink-2); }
.s-table .s-nowrap { white-space: nowrap; }
.s-table .s-right { text-align: right; }

/* List rows (compact feeds) */
.s-list { list-style: none; margin: 0; padding: 0; }
.s-list > li { display: grid; gap: 2px var(--s-3); padding: 10px var(--s-4); border-bottom: 1px solid var(--s-line); min-width: 0; }
.s-list > li:last-child { border-bottom: none; }

/* Timeline */
.s-tl { list-style: none; margin: 0; padding: 0; }
.s-tl > li { position: relative; display: grid; grid-template-columns: 62px 14px minmax(0, 1fr); gap: 0 var(--s-2); padding: 0 0 var(--s-3); }
.s-tl > li::before { content: ''; position: absolute; left: calc(62px + 8px + 6px); top: 14px; bottom: 0; width: 1px; background: var(--s-line); }
.s-tl > li:last-child::before { display: none; }
.s-tl__time { font-family: var(--s-f-mono); font-size: var(--s-t-11); color: var(--s-ink-3); padding-top: 2px; text-align: right; white-space: nowrap; }
.s-tl__dot { width: 9px; height: 9px; margin: 5px 0 0 2px; border-radius: 50%; border: 2px solid var(--s-ink-3); background: var(--s-bg); position: relative; z-index: 1; }
.s-tl__dot[data-s="success"] { border-color: var(--s-ok); }
.s-tl__dot[data-s="failed"] { border-color: var(--s-fail); background: var(--s-fail); }
.s-tl__dot[data-s="partial"] { border-color: var(--s-warn); }
.s-tl__dot[data-s="change"] { border-color: var(--s-violet); }
.s-tl__body { min-width: 0; font-size: var(--s-t-13); }
.s-tl__body small { display: block; color: var(--s-ink-3); font-size: var(--s-t-12); }

/* Definition list (detail views) */
.s-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s-5); margin: 0; font-size: var(--s-t-13); }
.s-dl dt { font-family: var(--s-f-mono); font-size: var(--s-t-11); letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-ink-3); padding-top: 2px; }
.s-dl dd { margin: 0; color: var(--s-ink); overflow-wrap: anywhere; }

/* ============================== 8. STATES ============================= */
/* One component, seven situations. Compact, specific, actionable.      */
.s-state {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 2px var(--s-3);
  align-items: start;
  padding: var(--s-4);
  border-left: 2px solid var(--s-idle);
  background: linear-gradient(90deg, rgba(124, 136, 153, 0.07), transparent 60%);
  min-width: 0;
}
.s-state > :not(.s-state__icon) { grid-column: 2; }
.s-state__icon { grid-column: 1; grid-row: 1 / span 4; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--s-line-2); border-radius: var(--s-radius); color: var(--s-ink-2); }
.s-state__icon svg { width: 16px; height: 16px; }
.s-state__kicker { font-family: var(--s-f-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--s-ink-3); }
.s-state__title { font-weight: 600; font-size: var(--s-t-14); color: var(--s-ink); }
.s-state__text { font-size: var(--s-t-13); color: var(--s-ink-2); max-width: 70ch; }
.s-state__action { margin-top: var(--s-2); display: flex; gap: var(--s-2); flex-wrap: wrap; }
.s-state--unavailable { border-left-color: var(--s-amber); background: linear-gradient(90deg, rgba(242, 179, 61, 0.07), transparent 60%); }
.s-state--unavailable .s-state__icon, .s-state--unavailable .s-state__kicker { color: var(--s-amber); }
.s-state--failed { border-left-color: var(--s-fail); background: linear-gradient(90deg, rgba(255, 90, 110, 0.07), transparent 60%); }
.s-state--failed .s-state__icon, .s-state--failed .s-state__kicker { color: var(--s-fail); }
.s-state--planned { border-left-color: var(--s-violet); background: linear-gradient(90deg, rgba(169, 145, 255, 0.07), transparent 60%); }
.s-state--planned .s-state__icon, .s-state--planned .s-state__kicker { color: var(--s-violet); }
.s-state--denied { border-left-color: var(--s-violet); }
.s-state--denied .s-state__icon, .s-state--denied .s-state__kicker { color: var(--s-violet); }
.s-state--empty .s-state__kicker { color: var(--s-ink-3); }
.s-state--compact { padding: var(--s-3); grid-template-columns: 24px minmax(0, 1fr); }
.s-state--compact .s-state__icon { width: 24px; height: 24px; }
.s-state--compact .s-state__icon svg { width: 13px; height: 13px; }

/* Page-level availability banner */
.s-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px solid rgba(242, 179, 61, 0.4);
  border-radius: var(--s-radius);
  background: rgba(242, 179, 61, 0.06);
  font-size: var(--s-t-13);
}
.s-banner__code { font-family: var(--s-f-mono); font-size: var(--s-t-11); letter-spacing: 0.1em; color: var(--s-amber); white-space: nowrap; }
.s-banner p { margin: 0; color: var(--s-ink-2); }
.s-banner p b { color: var(--s-ink); font-weight: 600; }
@media (max-width: 860px) { .s-banner { grid-template-columns: minmax(0, 1fr); align-items: start; } .s-banner > * { justify-self: start; } }

/* Loading skeleton */
.s-skel { display: block; height: 12px; border-radius: 2px; background: linear-gradient(90deg, var(--s-panel-2) 20%, var(--s-panel-3) 50%, var(--s-panel-2) 80%) 0 0 / 300% 100%; animation: s-shimmer 1.4s linear infinite; }
.s-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--s-line-2); border-top-color: var(--s-cyan); animation: s-spin 0.7s linear infinite; display: inline-block; }

/* =============================== 9. FORMS ============================= */
.s-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.s-label { font-family: var(--s-f-mono); font-size: var(--s-t-11); letter-spacing: 0.08em; text-transform: uppercase; color: var(--s-ink-3); }
.s-input, .s-select, .s-textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--s-3);
  border: 1px solid var(--s-line-2);
  border-radius: var(--s-radius);
  background: var(--s-bg-2);
  color: var(--s-ink);
  font: 400 var(--s-t-14) var(--s-f-text);
  color-scheme: dark;
  transition: border-color 120ms ease;
}
.s-textarea { padding: var(--s-3); min-height: 132px; resize: vertical; line-height: 1.5; }
.s-input::placeholder, .s-textarea::placeholder { color: var(--s-ink-3); opacity: 1; }
.s-input:focus, .s-select:focus, .s-textarea:focus { outline: none; border-color: var(--s-cyan); box-shadow: 0 0 0 3px rgba(63, 213, 242, 0.14); }

/* Segmented control (radio group styled as buttons) */
.s-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--s-line-2); border-radius: var(--s-radius); overflow: hidden; }
.s-seg label { position: relative; }
.s-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.s-seg span { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 var(--s-3); font-size: var(--s-t-13); color: var(--s-ink-2); border-right: 1px solid var(--s-line); cursor: pointer; }
.s-seg label:last-child span { border-right: none; }
.s-seg input:checked + span { background: var(--s-panel-3); color: var(--s-ink); box-shadow: inset 0 -2px 0 var(--s-cyan); }
.s-seg input:focus-visible + span { box-shadow: var(--s-focus); }

.s-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: var(--s-t-13); color: var(--s-ink-2); }
.s-switch input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 10px; background: var(--s-line-2); position: relative; cursor: pointer; transition: background 120ms ease; flex-shrink: 0; }
.s-switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--s-ink-2); transition: transform 140ms var(--s-ease); }
.s-switch input:checked { background: var(--s-amber); }
.s-switch input:checked::after { transform: translateX(14px); background: var(--s-ink-inv); }

/* ============================== 10. MOTION ============================ */
@keyframes s-shimmer { to { background-position: -300% 0; } }
@keyframes s-spin { to { transform: rotate(360deg); } }
@keyframes s-pulse { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes s-sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .s-body *, .s-body *::before, .s-body *::after { animation: none !important; transition: none !important; }
}

/* ============================= 11. UTILITIES ========================== */
.s-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.s-muted { color: var(--s-ink-3); }
.s-ink2 { color: var(--s-ink-2); }
.s-crit { color: var(--s-crit); }
.s-amber { color: var(--s-amber); }
.s-hide-sm { }
@media (max-width: 860px) { .s-hide-sm { display: none !important; } }
@media (min-width: 861px) { .s-show-sm { display: none !important; } }

/* ============================ 12. RESPONSIVE ========================== */
@media (max-width: 1100px) {
  .s-span-3, .s-span-4 { grid-column: span 6; }
  .s-span-5, .s-span-7, .s-span-8 { grid-column: span 12; }
  .s-band { --cols: 3 !important; }
  .s-band > .s-figure:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
  .s-band > .s-figure:nth-child(n + 4) { border-top: 1px solid var(--s-line); }
}
@media (max-width: 860px) {
  .s-grid--12 > [class*="s-span-"] { grid-column: span 12; }
  .s-pagehead { grid-template-columns: minmax(0, 1fr); padding: var(--s-6) 0 var(--s-5); }
  .s-pagehead__aside { justify-content: flex-start; }
  .s-section { margin-block: var(--s-8); }
  .s-panel__head, .s-panel__body, .s-panel__foot { padding-inline: var(--s-3); }
  .s-band { --cols: 2 !important; }
  .s-band > .s-figure { padding: var(--s-4) var(--s-3) var(--s-4) 0; }
  .s-band > .s-figure:nth-child(n) { padding-left: var(--s-3); border-left: 1px solid var(--s-line); border-top: 0; }
  .s-band > .s-figure:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
  .s-band > .s-figure:nth-child(n + 3) { border-top: 1px solid var(--s-line); }
  .s-figure__value { font-size: 2rem; }
  .s-table th, .s-table td { padding-inline: var(--s-3); }
  .s-tl > li { grid-template-columns: 52px 14px minmax(0, 1fr); }
  .s-tl > li::before { left: calc(52px + 8px + 6px); }
  .s-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .s-dl dd { margin-bottom: var(--s-2); }
}

/* ---- V5.1 target sizes (WCAG 2.2 SC 2.5.8, 24 x 24 CSS px minimum) ---- */
:where(.s-body) :is(.s-crumbs, .s-foot nav, .s-table th, .s-list, .s-panel__head, .s-panel__foot, .h-road, .z-refs, .m-others) a:not(.s-btn) {
  display: inline-flex; align-items: center; min-height: 24px;
}
:where(.s-body) .s-foot nav a { min-height: 32px; }
.s-switch input { width: 40px; height: 24px; border-radius: 12px; }
.s-switch input::after { top: 3px; left: 3px; width: 18px; height: 18px; }
.s-switch input:checked::after { transform: translateX(16px); }
