/* ============================================================================
   Ferry console — one stylesheet, no build step, no external assets.

   Aesthetic: an instrument panel that prints like a compliance report.
   Editorial serif for headings, system sans for interface, monospace with
   tabular figures for every number — because in this product the numbers are
   the argument. Hairline rules instead of shadows and cards.

   Colour: chart marks use the validated categorical palette (--series-*) and
   the reserved status palette (--st-*). Chrome uses --accent, a cyan that
   appears in no plot, so interface colour can never impersonate a series.
   ========================================================================== */

/* ---- tokens -------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
                  "URW Palladio L", Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", "DejaVu Sans Mono",
               Menlo, Consolas, monospace;

  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --rail-w: 236px;
  --top-h: 52px;

  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Status palette — fixed, never themed, never reused for a series. Always
     shipped with an icon or a label; hue never carries meaning alone. */
  --st-good: #0ca30c;
  --st-warning: #fab219;
  --st-serious: #ec835a;
  --st-critical: #d03b3b;
}

/* Light is the base declaration; dark is *selected*, not an inverted flip. */
:root {
  --plane: #f4f2ed;
  --surface: #fbfaf7;
  --surface-2: #ffffff;
  --surface-sunk: #efece5;
  --line: rgba(18, 23, 28, .13);
  --line-strong: rgba(18, 23, 28, .26);
  --ink: #12171c;
  --ink-2: #4d565f;
  --ink-3: #79838d;
  --accent: #0b6f7d;
  --accent-ink: #ffffff;
  --accent-wash: rgba(11, 111, 125, .10);
  --focus: #0b6f7d;

  --st-good-text: #0a6b12;
  --st-warning-text: #8a5a00;
  --st-serious-text: #9c4a22;
  --st-critical-text: #a52a2a;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  --grid: rgba(18, 23, 28, .10);
  --axis: rgba(18, 23, 28, .22);
  --hatch: rgba(18, 23, 28, .17);
  --shadow-pop: 0 12px 40px rgba(18, 23, 28, .16), 0 2px 6px rgba(18, 23, 28, .08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --plane: #0b0e12;
    --surface: #12171c;
    --surface-2: #171d24;
    --surface-sunk: #0e1216;
    --line: rgba(238, 242, 246, .11);
    --line-strong: rgba(238, 242, 246, .24);
    --ink: #eef2f6;
    --ink-2: #a8b3bf;
    --ink-3: #7d8894;
    --accent: #4fc7d9;
    --accent-ink: #06232a;
    --accent-wash: rgba(79, 199, 217, .13);
    --focus: #4fc7d9;

    --st-good-text: #5fd35f;
    --st-warning-text: #fab219;
    --st-serious-text: #f0a07d;
    --st-critical-text: #ff8a8a;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;

    --grid: rgba(238, 242, 246, .09);
    --axis: rgba(238, 242, 246, .20);
    --hatch: rgba(238, 242, 246, .20);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, .60), 0 2px 8px rgba(0, 0, 0, .40);
  }
}

/* The viewer's toggle must beat the OS in both directions. */
:root[data-theme="dark"] {
  --plane: #0b0e12;
  --surface: #12171c;
  --surface-2: #171d24;
  --surface-sunk: #0e1216;
  --line: rgba(238, 242, 246, .11);
  --line-strong: rgba(238, 242, 246, .24);
  --ink: #eef2f6;
  --ink-2: #a8b3bf;
  --ink-3: #7d8894;
  --accent: #4fc7d9;
  --accent-ink: #06232a;
  --accent-wash: rgba(79, 199, 217, .13);
  --focus: #4fc7d9;

  --st-good-text: #5fd35f;
  --st-warning-text: #fab219;
  --st-serious-text: #f0a07d;
  --st-critical-text: #ff8a8a;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;

  --grid: rgba(238, 242, 246, .09);
  --axis: rgba(238, 242, 246, .20);
  --hatch: rgba(238, 242, 246, .20);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, .60), 0 2px 8px rgba(0, 0, 0, .40);
}

/* ---- reset --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The shell sets display:grid on #app and #boot, and an author rule beats the
   UA's [hidden] regardless of specificity. Without this the app flashes over
   the boot screen. */
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; }
ul, ol { margin: 0; padding: 0 0 0 1.2em; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

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

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  transform: translateY(-200%);
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: var(--r-md); font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { transform: none; }

/* ---- boot / shell -------------------------------------------------------- */

.boot { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-5); }
.boot-inner { text-align: center; max-width: 46ch; }
.boot-msg { color: var(--ink-2); margin-top: var(--sp-4); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: "top top" "rail main";
  min-height: 100vh;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}

.brand { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.brand-mark { color: var(--accent); align-self: center; display: flex; }
.brand-name {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  letter-spacing: .01em;
}
.brand-sub {
  font-size: 11px; color: var(--ink-3); font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: .08em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: var(--sp-2); }

.session-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; color: var(--ink-2);
  padding-left: var(--sp-3); border-left: 1px solid var(--line);
}

/* left rail */
.rail {
  grid-area: rail;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: var(--sp-4) var(--sp-2) var(--sp-6);
  overflow-y: auto;
  position: sticky; top: var(--top-h); align-self: start;
  max-height: calc(100vh - var(--top-h));
}
.rail-group + .rail-group { margin-top: var(--sp-5); }
.rail-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-3); font-weight: 700;
  padding: 0 var(--sp-3) var(--sp-2);
}
.rail a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 7px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--ink-2); text-decoration: none;
  font-size: 13.5px;
  border-left: 2px solid transparent;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.rail a:hover { background: var(--surface-sunk); color: var(--ink); }
.rail a[aria-current="page"] {
  background: var(--accent-wash); color: var(--ink); font-weight: 600;
  border-left-color: var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.rail a .ic { color: var(--ink-3); flex: none; }
.rail a[aria-current="page"] .ic { color: var(--accent); }

.main { grid-area: main; min-width: 0; padding: var(--sp-5) var(--sp-5) var(--sp-7); }
.view { max-width: 1180px; }

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--top-h) auto minmax(0, 1fr);
    grid-template-areas: "top" "rail" "main";
  }
  .rail {
    position: static; max-height: none;
    display: flex; gap: var(--sp-1); overflow-x: auto; padding: var(--sp-2);
    border-right: 0; border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
  }
  .rail-group { display: flex; gap: var(--sp-1); }
  .rail-group + .rail-group { margin-top: 0; margin-left: var(--sp-2); padding-left: var(--sp-2); border-left: 1px solid var(--line); }
  .rail-title { display: none; }
  .rail a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--r-md); }
  .rail a[aria-current="page"] { border-radius: var(--r-md); border-left: 0; }
  .main { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
  .brand-sub { display: none; }
}

/* ---- page furniture ------------------------------------------------------ */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.page-title {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 600; letter-spacing: -.005em;
}
.page-sub { color: var(--ink-2); font-size: 13.5px; max-width: 78ch; margin-top: var(--sp-1); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.section { margin-top: var(--sp-6); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.section-title {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
}
.section-note { color: var(--ink-3); font-size: 12.5px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.panel + .panel { margin-top: var(--sp-3); }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 14px; font-weight: 650; }
.panel-body { padding: var(--sp-4); }

.grid { display: grid; gap: var(--sp-3); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---- type helpers -------------------------------------------------------- */

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 700;
}
.prose { max-width: 74ch; color: var(--ink-2); font-size: 13.5px; }
.prose strong { color: var(--ink); font-weight: 650; }
.lede { font-size: 15px; color: var(--ink-2); max-width: 74ch; }
.ref { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }

/* Absence is a value. It is never rendered as zero. */
.absent {
  color: var(--ink-3);
  font-style: italic;
  border-bottom: 1px dotted var(--line-strong);
  cursor: help;
  font-family: var(--font-ui);
}

/* ---- stat tiles ---------------------------------------------------------- */

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 700; }
.tile-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15;
}
.tile-value.sm { font-size: 19px; }
.tile-unit { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 3px; }
.tile-note { font-size: 12px; color: var(--ink-3); margin-top: var(--sp-1); }
.tile-hero {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.tile-hero .tile-value { font-size: 40px; }

/* ---- badges & status ----------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; line-height: 1.5;
  border: 1px solid var(--line-strong); color: var(--ink-2);
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.good { color: var(--st-good-text); border-color: color-mix(in srgb, var(--st-good) 45%, transparent); }
.badge.warning { color: var(--st-warning-text); border-color: color-mix(in srgb, var(--st-warning) 55%, transparent); }
.badge.serious { color: var(--st-serious-text); border-color: color-mix(in srgb, var(--st-serious) 55%, transparent); }
.badge.critical { color: var(--st-critical-text); border-color: color-mix(in srgb, var(--st-critical) 55%, transparent); }
.badge.neutral { color: var(--ink-3); }
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.callout {
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  font-size: 13px; color: var(--ink-2);
  display: flex; gap: var(--sp-3); align-items: flex-start;
}
.callout .ic { flex: none; margin-top: 2px; }
.callout h4 { font-size: 13px; color: var(--ink); margin-bottom: 3px; }
.callout.info { border-left-color: var(--accent); }
.callout.info .ic { color: var(--accent); }
.callout.warning { border-left-color: var(--st-warning); }
.callout.warning .ic { color: var(--st-warning-text); }
.callout.critical { border-left-color: var(--st-critical); }
.callout.critical .ic { color: var(--st-critical-text); }
.callout.good { border-left-color: var(--st-good); }
.callout.good .ic { color: var(--st-good-text); }

/* ---- buttons & controls -------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink); font-size: 13px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background .12s var(--ease), border-color .12s var(--ease), transform .06s var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { background: var(--st-critical); border-color: var(--st-critical); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); border-color: transparent; }
.btn-icon { padding: 6px; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--st-critical-text); font-weight: 600; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"],
input[type="search"], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 6px 9px;
  min-width: 0; width: 100%;
  transition: border-color .12s var(--ease);
}
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--ink-3); }
input:disabled, select:disabled { opacity: .55; }
input.num, textarea.mono { font-family: var(--font-mono); }
textarea { resize: vertical; min-height: 68px; }

.check { display: flex; gap: var(--sp-2); align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; flex: none; accent-color: var(--accent); }
.check-body { min-width: 0; }
.check-title { font-size: 13px; font-weight: 600; }
.check-hint { font-size: 12px; color: var(--ink-3); }

.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; }
.segmented button {
  border: 0; background: transparent; padding: 5px 11px; font-size: 12.5px; cursor: pointer;
  color: var(--ink-2); border-right: 1px solid var(--line);
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent-wash); color: var(--ink); font-weight: 650; }

/* Outcome cards — the plan form picks outcomes, never backends (§5.2). */
.outcome {
  display: block; position: relative;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: var(--sp-3); cursor: pointer; background: var(--surface-2);
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.outcome:hover { border-color: var(--ink-3); }
.outcome:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.outcome:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.outcome input { position: absolute; opacity: 0; pointer-events: none; }
.outcome-title { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.outcome-desc { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---- tables -------------------------------------------------------------- */

/* A table is its own surface. Wide tables scroll inside this box; the page
   body never scrolls horizontally. */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel .table-wrap { background: transparent; border: 0; border-radius: 0; }

table.data { width: 100%; font-size: 13px; }
/* Captions read as footnotes here — they qualify the numbers above them. */
table.data caption {
  caption-side: bottom;
  text-align: left;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 12px;
}
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 700; padding: 8px var(--sp-3);
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
table.data td { padding: 9px var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-sunk); }
table.data th.r, table.data td.r { text-align: right; }
table.data td.num, table.data th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data tr.selected td { background: var(--accent-wash); }
table.data td .sub { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }

.rowlink { color: inherit; text-decoration: none; font-weight: 600; }
.rowlink:hover { color: var(--accent); text-decoration: underline; }

.empty {
  padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}
.empty h4 { color: var(--ink-2); font-size: 14px; margin-bottom: 4px; }

/* ---- protection timeline: "backed up" vs "immutably backed up" ------------
   Two different claims (§10.7). The difference is carried by fill *and*
   texture *and* a lock glyph — never by colour alone.                       */

.prot-track {
  position: relative; height: 22px; border-radius: var(--r-sm);
  background: var(--surface-sunk); border: 1px solid var(--line);
  overflow: hidden;
}
.prot-seg { position: absolute; top: 0; bottom: 0; }
.prot-seg.backed {
  background-image: repeating-linear-gradient(135deg,
    var(--hatch) 0 2px, transparent 2px 6px);
  border-right: 1px solid var(--line-strong);
}
.prot-seg.immutable {
  background: color-mix(in srgb, var(--series-1) 62%, transparent);
  border-left: 2px solid var(--series-1);
}
.prot-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); }
.prot-key { display: inline-flex; align-items: center; gap: 6px; }
.prot-key i {
  width: 14px; height: 12px; border-radius: 2px; display: inline-block; flex: none;
  border: 1px solid var(--line-strong);
}
.prot-key.backed i { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 6px); }
.prot-key.immutable i { background: color-mix(in srgb, var(--series-1) 62%, transparent); border-color: var(--series-1); }

.lock-state { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; font-size: 12.5px; }
.lock-state.on { color: var(--ink); }
.lock-state.off { color: var(--st-warning-text); }

/* ---- meters (RPO vs target) ---------------------------------------------- */

.meter { position: relative; height: 8px; border-radius: 999px; background: var(--surface-sunk); overflow: visible; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--st-good); }
.meter-fill.warning { background: var(--st-warning); }
.meter-fill.critical { background: var(--st-critical); }
.meter-target {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--ink); border-radius: 1px;
}
.meter-target::after {
  content: ""; position: absolute; top: -4px; left: -2px;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
  border-top: 4px solid var(--ink);
}

/* ---- charts (inline SVG) ------------------------------------------------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 10px; font-family: var(--font-mono); }
.chart .lbl { fill: var(--ink-2); font-size: 11px; }
.chart .val { fill: var(--ink); font-size: 11px; font-family: var(--font-mono); font-weight: 600; }
.chart .target-line { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-figure { margin: 0; }
.chart-figure figcaption { font-size: 12px; color: var(--ink-3); margin-top: var(--sp-2); }
.chart-title { font-size: 13px; font-weight: 650; margin-bottom: 2px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: 11.5px; color: var(--ink-2); margin-top: var(--sp-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key i { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* Stacked phase bar — 2px surface gap between segments per the mark spec. */
.phasebar { display: flex; width: 100%; height: 26px; gap: 2px; }
.phaseseg { border-radius: 2px; min-width: 2px; position: relative; }
.phaseseg:first-child { border-radius: 3px 2px 2px 3px; }
.phaseseg:last-child { border-radius: 2px 3px 3px 2px; }

/* ---- definition list ----------------------------------------------------- */

dl.defs { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 7px var(--sp-4); margin: 0; font-size: 13px; }
dl.defs dt { color: var(--ink-3); }
dl.defs dd { margin: 0; }
dl.defs.wide { grid-template-columns: minmax(190px, auto) 1fr; }

/* ---- overlay: modal & command menu --------------------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--plane) 72%, transparent);
  backdrop-filter: blur(3px);
  display: grid; place-items: start center;
  padding: clamp(var(--sp-4), 8vh, 92px) var(--sp-4) var(--sp-4);
  overflow-y: auto;
  animation: fade .12s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  width: min(640px, 100%);
  animation: rise .16s var(--ease);
}
.modal.wide { width: min(880px, 100%); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4); border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-family: var(--font-display); font-size: 19px; }
.modal-body { padding: var(--sp-4); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line);
  background: var(--surface-sunk); border-radius: 0 0 var(--r-lg) var(--r-lg);
  flex-wrap: wrap;
}

.cmdk { width: min(560px, 100%); }
.cmdk input { border: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 13px var(--sp-4); font-size: 15px; background: transparent; }
.cmdk input:focus { outline: none; }
.cmdk ul { list-style: none; padding: var(--sp-1); margin: 0; max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--line); }
.cmdk li { padding: 7px var(--sp-3); border-radius: var(--r-md); cursor: pointer; display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 13px; }
.cmdk li[aria-selected="true"] { background: var(--accent-wash); }
.cmdk li .where { color: var(--ink-3); font-size: 11.5px; }

/* ---- toasts -------------------------------------------------------------- */

.toast-root {
  position: fixed; bottom: var(--sp-4); right: var(--sp-4); z-index: 80;
  display: flex; flex-direction: column; gap: var(--sp-2); max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md); padding: var(--sp-3);
  box-shadow: var(--shadow-pop); font-size: 13px;
  animation: rise .16s var(--ease);
}
.toast.error { border-left-color: var(--st-critical); }
.toast.success { border-left-color: var(--st-good); }
.toast h4 { font-size: 13px; margin-bottom: 2px; }

/* ---- misc ---------------------------------------------------------------- */

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.reveal > * { animation: reveal .28s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

.noscript { padding: var(--sp-5); max-width: 60ch; margin: 10vh auto; color: var(--ink-2); }

.kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: var(--r-sm); color: var(--ink-2); background: var(--surface-2);
}

.hairline { border-top: 1px solid var(--line); margin: var(--sp-4) 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (forced-colors: active) {
  .prot-seg.immutable, .meter-fill, .phaseseg { forced-color-adjust: none; }
  .badge, .panel, .tile { border: 1px solid CanvasText; }
}
