/* MarinaFrame desktop UI. Vellum structure (paper, ink, one reserved AI colour, source-label
   patterns and glyphs, short chips) in MarinaChain brand tokens
   (marinachain-website-revamp-2026/docs/HANDOVER-DESIGN.md, docs/design-system.md).
   MarinaChain blue is the primary action, selection and focus. Teal is reserved for
   "the AI acted here". Amber is for review data and warnings only. No orange. */

/* Manrope: one variable file per subset (Google Fonts v23). */
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-Latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-LatinExt.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: "Manrope", -apple-system, "Segoe UI Variable Text", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --font-chip: var(--font-ui);

  /* Type scale 12/13/14/15/17/22 px. Body sizes stay readable; titles stay close to the
     sidebar's 13 px labels (founder, 2026-11-09: "a little smaller to match the sidebar"). */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-2xs: 11px; /* chart ticks and labels only; interface text stays at --fs-xs or above */
  --fs-lg: 15px;
  --fs-xl: 17px;
  --fs-2xl: 22px;

  /* 8 px grid: 4, 8, 12, 16, 24, 32 (2 px only inside small controls). */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  --radius-sm: 4px;
  --radius-md: 8px;     /* inner radii of the product frame */
  --radius-lg: 12px;    /* buttons and cards (brand CTA radius) */
  --radius-chip: 11px;
  --radius-dialog: 12px;

  /* Height of the macOS title bar overlay; the traffic lights sit inside it. */
  --titlebar-h: 44px;
  /* 0: the app uses the standard macOS title bar, so the window buttons sit above the web view. */
  --traffic-light-inset: 0px;
  --statusbar-h: 24px;
  --rail-w: 76px;
  --dur-details: 140ms;
  --inspector-w: clamp(340px, 22vw, 420px); /* wider on large screens: the Thinking text reads better */
  --details-rail-w: 40px; /* the folded details column: one 30 px icon button with a margin */
  --strip-h: 80px;
  --narration-h: 32px;
  --revision-h: 36px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 120ms;
  --dur-med: 220ms;
  --dur-pen: 400ms;  /* pen-stroke draw-in (live lane) */
  --dur-skin: 600ms; /* hull skin growth (live lane) */

  /* ---- Light ---- */
  color-scheme: light;
  --paper: #FBFBF9;        /* app background */
  --surface: #FCFCFD;      /* panels */
  --raised: #FFFFFF;       /* dialogs, inputs, buttons */
  --card: #F2F4F7;         /* cards */
  --sunken: #F2F4F7;       /* wells, segmented controls */
  --rule: #E2E6EC;
  --rule-strong: #C8CFD9;
  --ink: #101D30;
  --ink-2: #3E4B5E;
  --ink-3: #5F6B7E;        /* brand muted #7F899C is 3.5:1 on paper; darkened to 5.3:1 for small text */
  --muted-line: #7F899C;   /* brand muted, for icons and strokes only */
  --brand: #06448E;        /* MarinaChain blue: primary action, selection, focus */
  --brand-hover: #0A57B4;
  --brand-soft: #EFF8FF;   /* accent background */
  --brand-ghost: rgba(6, 68, 142, 0.25);
  --on-brand: #FFFFFF;
  --ai: #07AF87;           /* reserved: the AI acted here */
  --ai-text: #00745A;      /* teal for text on light (4.9:1 on the tint) */
  --ai-soft: #E3F6F0;
  --navy: #004557;
  --warn: #8A6A1E;         /* amber text */
  --warn-soft: #FDF3DC;
  --warn-ink: #F5B14C;     /* amber stroke */
  --pass: #004557;         /* Signed off: product navy */
  --pass-soft: #E3EEF1;
  --fail: #B42318;
  --fail-soft: #FEF0EE;

  /* Section source labels: colour + stroke pattern + glyph (never colour alone). */
  --src-traced: #101D30;
  --src-repaired: #004557;
  --src-interpolated: #3B6499; /* stroke #7AA2D6 is 2.6:1 on paper; darker for chip text */
  --src-ai_inferred: #8A6A1E;
  --src-ai_corrected: #006A52; /* teal #07AF87 for strokes, darker teal for chip text (4.5:1 on the guessed-tile amber) */
  --src-omitted: #5F6B7E;
  --stroke-interpolated: #7AA2D6;
  --stroke-ai_corrected: #07AF87;

  --hover: rgba(16, 29, 48, 0.05);
  --selected: var(--brand-soft);
  --focus: rgba(6, 68, 142, 0.55);
  --shadow-sheet: 0 32px 64px -24px rgba(10, 31, 61, 0.25), 0 0 0 1px rgba(0, 69, 87, 0.12);
  --model-bg: var(--paper);
  --model-hull: #E4E8EE; /* matte "drafting resin"; also the topside paint of the 3D hull */
  /* Hull paint below the topside in the 3D view (js/look3d.js): antifouling under the boot top
     and the boot-top band at the design waterline. Paint colours, so they do not switch. */
  --paint-antifouling: #96402F;
  --paint-boottop: #2A2D33;
  /* Design waterline plane of the 3D view (sea blue, both themes). */
  --model-water: #2F7FC1;
  /* Axis triad of the 3D view: x, y, z (each axis also has its letter). */
  --axis-x: #C2413A;
  --axis-y: #2E8B4E;
  --axis-z: #2F6FC1;
  /* Tank colours by content, as on a capacity plan (docs/TANKS_V1.md section 6). The same
     values colour the GLB materials (vessel_reconstruction.tanks CONTENT_CLASSES); they do not
     switch with the theme, so a tank reads the same in both. */
  --tank-fuel_oil: #B8742A;
  --tank-diesel_oil: #E3C440;
  --tank-lube_oil: #EE8A2C;
  --tank-oily_residue: #6E4B36;
  --tank-water_ballast: #4E9F57;
  --tank-fresh_water: #3E7FD0;
  --tank-feed_water: #93C8EC;
  --tank-sewage: #8C7FAE;
  --tank-cargo: #C9CDD3;
  --tank-void: #EEF0F2;
  --tank-other: #A3A7AD;
  /* Steel structure by member group (vessel_reconstruction.structure.display MEMBER_GROUPS). */
  --steel-shell: #7F96AE;
  --steel-deck: #C9B47E;
  --steel-bulkhead: #A58BB5;
  --steel-primary: #CF8562;
  --steel-stiffener: #4F7A64;

  /* Drawing overlays sit on the paper page image in both themes, so they do not switch. */
  --ink-chosen: #06448E;
  --ink-candidate: #7F899C;
  --ink-region: rgba(62, 75, 94, 0.55);
  --ink-declined: #8A6A1E;
  /* Guesses of a draft: dashed amber (review data). */
  --guess-ink: #E0A43C;
  --guess-text: #8A6A1E;
  --guess-soft: #FDF3DC;
  /* Live marks on the drawing (attention layer). On the paper page in both themes, so fixed:
     teal for what the AI did, amber for refusals and edits not kept. */
  --mark-ai: #07AF87;
  --mark-ai-ink: #00745A;
  --mark-ai-soft: rgba(7, 175, 135, 0.14);
  --mark-warn: #E0A43C;
  --mark-warn-ink: #8A6A1E;
  --mark-warn-soft: #FDF3DC;
  --mark-view: rgba(62, 75, 94, 0.62);
  --mark-on: #FFFFFF;

  /* Older names, kept so every rule reads one set of tokens. */
  --bg: var(--paper);
  --surface-raised: var(--raised);
  --surface-sunken: var(--sunken);
  --line: var(--rule);
  --line-strong: var(--rule-strong);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
  --accent: var(--brand);
  --accent-strong: var(--brand);
  --accent-soft: var(--brand-soft);
  --muted-soft: rgba(16, 29, 48, 0.06);
  /* Pareto chart: dominated candidates are neutral grey, never a tint of the brand blue. */
  --pareto-dominated: #AEB8C6; /* with its #7F899C edge the marker reads at 3:1 or more */
  /* Design drawings (design_graphics.js): hull, water, limits, the parent outline, chart series. */
  --hull-fill: #E4E8EE;
  /* Hull modes (hull_modes.js): outward and inward movement, section fullness. Not blue: blue is for actions. */
  --hull-out: #C2410C;
  --hull-in: #7C3AED;
  --hull-full: #2F6F4E;
  --hull-line: #3E4B5E;
  --water-fill: rgba(47, 127, 193, 0.14);
  --water-line: #2F7FC1;
  --dim-line: #5F6B7E;
  --parent-line: #7F899C;
  --series-1: #06448E;
  --series-2: #2F7FC1;
  --series-3: #8A6A1E;
  --series-4: #7F899C;
  /* Designs as layers in the workspace viewport (design_workspace.js): one colour per candidate. */
  --design-1: #0A57B4;
  --design-2: #0E8F7E;
  --design-3: #A36A12;
  --design-4: #6D3FD8;
  --design-5: #C0306F;
  --design-6: #4D7C0F;
  --pareto-dominated-line: #7F899C;
  --pareto-dominated-text: #5F6B7E; /* 5.3:1 for the small label; the line grey is 3.5:1 */
}

/* ---- Dark (navy). Written twice: system dark and chosen dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0A1F3D;
    --surface: #0E2647;
    --raised: #15335C;
    --card: #102A4D;
    --sunken: #081a33;
    --rule: #1E3B63;
    --rule-strong: #2D4F7E;
    --ink: #E6EDF7;
    --ink-2: #C1CEE0;
    --ink-3: #9AA9BD; /* neutral: blue is for actions; unknown values must not read as links */
    --muted-line: #6F8BB3;
    --brand: #9DBFEA; /* 4.5:1 on its own soft tint over the raised navy */
    --brand-hover: #B8D2F2;
    --brand-soft: rgba(122, 162, 214, 0.16);
    --brand-ghost: rgba(122, 162, 214, 0.35);
    --on-brand: #0A1F3D;
    --ai: #07AF87;
    --ai-text: #3DD6AE;
    --ai-soft: rgba(7, 175, 135, 0.16);
    --warn: #F5B14C;
    --warn-soft: rgba(245, 177, 76, 0.15);
    --warn-ink: #F5B14C;
    --pass: #8CC8D8;
    --pass-soft: rgba(140, 200, 216, 0.14);
    --fail: #F97066;
    --fail-soft: rgba(249, 112, 102, 0.15);
    --src-traced: #E6EDF7;
    --src-repaired: #8CC8D8;
    --src-interpolated: #9BBCE6;
    --src-ai_inferred: #F5B14C;
    --src-ai_corrected: #3DD6AE;
    --src-omitted: #8FB4E8;
    --stroke-interpolated: #7AA2D6;
    --stroke-ai_corrected: #07AF87;
    --hover: rgba(230, 237, 247, 0.07);
    --focus: rgba(122, 162, 214, 0.7);
    --shadow-sheet: 0 32px 64px -24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(230, 237, 247, 0.08);
    --model-hull: #8193AD;
    --guess-text: #F5B14C;
    --guess-soft: rgba(245, 177, 76, 0.15);
    --muted-soft: rgba(230, 237, 247, 0.08);
  --pareto-dominated: #3E4654;
  --hull-fill: #56667E; /* dark theme: light enough that the 3D hull separates from the navy view */
  --hull-out: #F59E4B;
  --hull-in: #B79CFF;
  --hull-full: #6CC59A;
  --hull-line: #B9C3D3;
  --water-fill: rgba(91, 163, 224, 0.18);
  --water-line: #5BA3E0;
  --dim-line: #9AA6B8;
  --parent-line: #9AA6B8;
  --series-1: #5BA3E0;
  --series-2: #9CCBF2;
  --series-3: #F5B14C;
  --series-4: #7F899C;
  --design-1: #5BA3E0;
  --design-2: #2DD4BF;
  --design-3: #F5B14C;
  --design-4: #A78BFA;
  --design-5: #F472B6;
  --design-6: #A3E635;
  --pareto-dominated-line: #8E96A3;
  --pareto-dominated-text: #8E96A3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0A1F3D;
  --surface: #0E2647;
  --raised: #15335C;
  --card: #102A4D;
  --sunken: #081a33;
  --rule: #1E3B63;
  --rule-strong: #2D4F7E;
  --ink: #E6EDF7;
  --ink-2: #C1CEE0;
  --ink-3: #9AA9BD; /* neutral: blue is for actions; unknown values must not read as links */
  --muted-line: #6F8BB3;
  --brand: #9DBFEA; /* 4.5:1 on its own soft tint over the raised navy */
  --brand-hover: #B8D2F2;
  --brand-soft: rgba(122, 162, 214, 0.16);
  --brand-ghost: rgba(122, 162, 214, 0.35);
  --on-brand: #0A1F3D;
  --ai: #07AF87;
  --ai-text: #3DD6AE;
  --ai-soft: rgba(7, 175, 135, 0.16);
  --warn: #F5B14C;
  --warn-soft: rgba(245, 177, 76, 0.15);
  --warn-ink: #F5B14C;
  --pass: #8CC8D8;
  --pass-soft: rgba(140, 200, 216, 0.14);
  --fail: #F97066;
  --fail-soft: rgba(249, 112, 102, 0.15);
  --src-traced: #E6EDF7;
  --src-repaired: #8CC8D8;
  --src-interpolated: #9BBCE6;
  --src-ai_inferred: #F5B14C;
  --src-ai_corrected: #3DD6AE;
  --src-omitted: #8FB4E8;
  --stroke-interpolated: #7AA2D6;
  --stroke-ai_corrected: #07AF87;
  --hover: rgba(230, 237, 247, 0.07);
  --focus: rgba(122, 162, 214, 0.7);
  --shadow-sheet: 0 32px 64px -24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(230, 237, 247, 0.08);
  --model-hull: #8193AD;
  --guess-text: #F5B14C;
  --guess-soft: rgba(245, 177, 76, 0.15);
  --muted-soft: rgba(230, 237, 247, 0.08);
  --pareto-dominated: #3E4654;
  --hull-fill: #56667E; /* dark theme: light enough that the 3D hull separates from the navy view */
  --hull-out: #F59E4B;
  --hull-in: #B79CFF;
  --hull-full: #6CC59A;
  --hull-line: #B9C3D3;
  --water-fill: rgba(91, 163, 224, 0.18);
  --water-line: #5BA3E0;
  --dim-line: #9AA6B8;
  --parent-line: #9AA6B8;
  --series-1: #5BA3E0;
  --series-2: #9CCBF2;
  --series-3: #F5B14C;
  --series-4: #7F899C;
  --design-1: #5BA3E0;
  --design-2: #2DD4BF;
  --design-3: #F5B14C;
  --design-4: #A78BFA;
  --design-5: #F472B6;
  --design-6: #A3E635;
  --pareto-dominated-line: #8E96A3;
  --pareto-dominated-text: #8E96A3;
}

/* ------------------------------------------------------------------ Base */

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-md)/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  /* Desktop app: text is not selectable by default, except where it is content. */
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
code { font-family: var(--font-mono); }
[hidden] { display: none !important; }

.icon-sprite { display: none; }
.marker-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.icon .glyph-fill, .icon use { fill: inherit; }
.glyph-fill { fill: currentColor; stroke: none; }

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

.selectable-text { user-select: text; -webkit-user-select: text; cursor: text; }

/* ------------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 28px;
  padding: 0 var(--space-md);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--raised);
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast);
}
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--raised), var(--ink) 5%); }
.btn:active:not(:disabled) { background: color-mix(in srgb, var(--raised), var(--ink) 10%); }
.btn:disabled { opacity: 0.45; }

/* The one primary action of a view, in MarinaChain blue. */
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); }

.btn-icon { width: 28px; padding: 0; justify-content: center; }
.btn-small { height: 22px; padding: 0 var(--space-sm); font-size: var(--fs-sm); border-radius: var(--radius-md); }
.btn-large { height: 36px; padding: 0 var(--space-lg); font-size: var(--fs-lg); border-radius: var(--radius-lg); }

.btn-danger-quiet { color: var(--fail); }

/* ------------------------------------------------------------------ Chips (badges)
   22 px, 8 px side padding, 11 px Plex Sans Condensed 500, radius 11. One or two words.
   States: outline with a light tint. Source labels: tinted fill with a glyph. */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 var(--space-sm);
  border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
  border-radius: var(--radius-chip);
  background: var(--muted-soft);
  color: var(--ink-2);
  font: 600 var(--fs-xs)/1 var(--font-chip);
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
  flex: none;
}
/* State chips carry no dot, except Running: a pulsing teal dot marks AI activity. */
.badge::before { content: none; }
.badge[data-status="running"]::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s var(--ease-out) infinite;
}

.badge[data-status="running"], .badge[data-tone="ai"] { background: var(--ai-soft); color: var(--ai-text); }
.badge[data-status="running"]::before { background: var(--ai); }
.badge[data-status="draft"], .badge[data-tone="brand"] { background: var(--brand-soft); color: var(--brand); }
.badge[data-status="needs_review"], .badge[data-status="declined"], .badge[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.badge[data-status="signed_off"], .badge[data-tone="pass"] { background: var(--pass-soft); color: var(--pass); }
.badge[data-status="failed"], .badge[data-status="blocked"], .badge[data-tone="fail"] { background: var(--fail-soft); color: var(--fail); }
/* A guessed line of a draft: amber with a dashed outline, like the dashed guess strokes. */
.badge[data-tone="draft"] { background: var(--guess-soft); color: var(--guess-text); border-style: dashed; border-color: var(--guess-ink); }

.badge-plain { background: transparent; border-color: transparent; padding: 0; }
.badge-small { height: 18px; padding: 0 6px; gap: 4px; }
.badge-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.2; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); min-width: 0; }

/* Source-label chip: tinted fill, no outline, glyph first. */
.badge-source { border-color: transparent; }
.badge-glyph { width: 11px; height: 11px; stroke-width: 1.6; }
.badge-source[data-source] { color: var(--src-color); background: color-mix(in srgb, var(--src-color) 13%, transparent); }
[data-source="traced"] { --src-color: var(--src-traced); }
[data-source="repaired"] { --src-color: var(--src-repaired); }
[data-source="interpolated"] { --src-color: var(--src-interpolated); }
[data-source="ai_inferred"] { --src-color: var(--src-ai_inferred); }
[data-source="ai_corrected"] { --src-color: var(--src-ai_corrected); }
[data-source="omitted"] { --src-color: var(--src-omitted); }

/* Source-label strokes for small drawings (tile shapes, hull thumbnails). */
.src-stroke { fill: none; stroke: var(--src-color, var(--ink)); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.src-stroke[data-source="repaired"] { stroke-dasharray: 9 1.5; }               /* solid with small ticks */
.src-stroke[data-source="interpolated"] { stroke: var(--stroke-interpolated); stroke-dasharray: 7 4; stroke-linecap: butt; } /* long dash */
.src-stroke[data-source="ai_inferred"] { stroke-dasharray: 0.1 3.2; stroke-width: 1.8; } /* dotted */
.src-stroke[data-source="ai_corrected"] { stroke: var(--stroke-ai_corrected); stroke-width: 1.8; marker-start: url(#m-diamond); marker-end: url(#m-diamond); } /* solid with diamond nodes */
.src-stroke[data-source="repaired"] { marker-start: url(#m-tick); marker-end: url(#m-tick); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ------------------------------------------------------------------ App shell
   Title bar (breadcrumb) across the top, narrow rail on the left, one view in the main area,
   status bar at the bottom. */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--titlebar-h) minmax(0, 1fr) var(--statusbar-h);
  height: 100vh;
}

.titlebar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  height: var(--titlebar-h);
  padding: 0 var(--space-md) 0 var(--traffic-light-inset);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
/* Brand: logo then name, beside the window buttons. With the sidebar collapsed only the logo
   shows. Clicks pass through so the bar still drags the window. */
/* The brand cell is as wide as the sidebar, so the logo lines up with the sidebar icons:
   centred when collapsed, at the icon column when expanded. */
.brand { display: flex; align-items: center; gap: var(--space-sm); flex: none; pointer-events: none;
         width: var(--rail-w); height: 100%; padding-left: 19px; border-right: 1px solid var(--rule); }
.app[data-rail="collapsed"] .brand { justify-content: center; padding-left: 0; }
.brand-mark { height: 20px; width: auto; flex: none; }
.brand-name { font-weight: 600; font-size: var(--fs-md); color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
/* Collapsed: the name leaves the screen but stays the brand's accessible text. */
.app[data-rail="collapsed"] .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.crumbs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  font-size: var(--fs-md);
  font-weight: 600;
}
/* The place icon in the title bar matches the sidebar icon. */
.crumb-current { display: inline-flex; align-items: center; gap: var(--space-xs); }
.crumb-current .icon { flex: none; width: 18px; height: 18px; color: var(--ink-2); }
.crumb {
  min-width: 0;
  overflow: hidden;
  padding: 2px var(--space-xs);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.crumb-link { flex: 0 1 auto; cursor: pointer; }
/* Only the vessel name shortens; "Run 1" and the revision stay whole. */
.crumbs > .crumb:not(.crumb-link) { flex: none; }
.crumb-link:hover { background: var(--hover); }
.crumb-mono { flex: none; font-family: var(--font-mono); font-weight: 500; color: var(--ink-2); }
.crumb-sep { flex: none; color: var(--ink-3); font-weight: 400; }
.crumb-select {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 18px;
  background: no-repeat right 4px center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 4l3 3 3-3' fill='none' stroke='%237F899C' stroke-width='1.5'/%3E%3C/svg%3E");
  cursor: pointer;
}
.crumb-select:hover { background-color: var(--hover); }
.titlebar > .badge { flex: none; } /* the one-word status stays whole */
.titlebar-actions { display: flex; align-items: center; gap: var(--space-sm); flex: none; margin-left: auto; }

/* Rail: Home, Queue, Settings. Selected: a raised card with a 2 px drafting rule. */
.rail {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xs);
  min-height: 0;
  padding: var(--space-md) var(--space-sm);
  border-right: 1px solid var(--rule);
  background: var(--surface);
}
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: var(--space-sm) 2px 6px;
  border: 0;
  border-radius: var(--radius-lg);
  background: none;
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.rail-item .icon { width: 22px; height: 22px; }
.rail-item span { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rail-item:hover { background: var(--hover); color: var(--ink); }
/* Runs going and sets waiting, on the Queue item (js/app.js renderRailCount). */
.rail-item { position: relative; }
.rail-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font: 600 var(--fs-xs)/20px var(--font-mono); text-align: center; }
.rail-count[hidden] { display: none; }
.app[data-rail="expanded"] .rail-count { margin-left: auto; }
/* Collapsed: a small count at the icon's top-right corner, clear of the icon itself. */
.app[data-rail="collapsed"] .rail-count { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 3px; border: 2px solid var(--surface); border-radius: 9px; font-size: 10px; line-height: 12px; box-sizing: content-box; }
.rail-item[aria-current="page"] {
  background: var(--selected);
  color: var(--brand);
  box-shadow: inset 2px 0 0 var(--brand);
}

/* Expanded sidebar (default): icon and label in one row. Collapsed: icons only. */
.app[data-rail="expanded"] { --rail-w: 184px; }
.app[data-rail="expanded"] .rail-item { flex-direction: row; justify-content: flex-start; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); font-size: var(--fs-sm); }
.app[data-rail="collapsed"] .rail-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.app[data-rail="collapsed"] { --rail-w: 60px; }
.rail-toggle {
  margin-top: auto;
  align-self: flex-start;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink-3);
}
.rail-toggle:hover { background: var(--hover); color: var(--ink); }
.rail-toggle .icon { width: 18px; height: 18px; }

.views { grid-row: 2; grid-column: 2; position: relative; min-width: 0; min-height: 0; }
.view { position: absolute; inset: 0; min-width: 0; min-height: 0; }

/* ------------------------------------------------------------------ Home and Queue */

.home-scroll { height: 100%; overflow-y: auto; padding: var(--space-xl) var(--space-2xl) var(--space-2xl); }
.home-scroll > * { max-width: 1560px; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); min-width: 0; margin-bottom: var(--space-lg); }
.home-head h1 { min-width: 0; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; }
.home-section-title { margin: var(--space-2xl) 0 var(--space-lg); font-size: var(--fs-xl); font-weight: 600; }
.home-empty { color: var(--ink-3); font-size: var(--fs-md); padding: var(--space-sm) 0; }

.needs-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-lg); }
/* A "Needs you" card: the vessel thumbnail, its name, its state, what to do, and Review. */
.needs-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-lg);
  min-width: 0;
  padding: var(--space-lg);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--warn-ink);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.needs-card[data-status="draft"] { border-left-color: var(--brand); }
/* Hover changes three sides only: the left edge keeps its state colour. */
.needs-card:hover { border-top-color: var(--rule-strong); border-right-color: var(--rule-strong); border-bottom-color: var(--rule-strong); transform: translateY(-2px); }
.needs-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
  color: var(--ink-2);
}
.needs-icon .icon { width: 28px; height: 28px; stroke-width: 1.1; }
.needs-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.needs-icon:has(img) { background: #FBFBF9; } /* Drawings retain their paper in both themes. */
.needs-icon:has(.vessel-thumb-model) { background: var(--paper); }
/* The shared loader inserts only decoded images; keep the icon until one is ready. */
.needs-icon:has(img) > .icon,
.needs-icon .vessel-thumb-empty,
.needs-icon .hull-badge { display: none; }
.needs-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* Up to two lines, so a usual vessel name ("DTMB 5415 lines plan") is shown whole. */
.needs-name {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.needs-why { min-height: 1.4em; color: var(--ink-2); font-size: var(--fs-md); }
.needs-go { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.needs-go .icon { width: 14px; height: 14px; }

.vessel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-lg); }
.vessel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
  padding: var(--space-sm) var(--space-sm) var(--space-md);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.vessel-card:hover { border-color: var(--rule-strong); transform: translateY(-2px); }
/* Sheet thumbnail: the scan on paper with crop marks at the corners. */
.vessel-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  margin-bottom: var(--space-xs);
  border-radius: var(--radius-md);
  background: #FBFBF9; /* the paper of the scan, in both themes */
}
.vessel-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* ui-thumb: retain the complete profile and let transparent model PNGs use theme paper. */
.vessel-thumb:has(.vessel-thumb-model) { background: var(--paper); }
.vessel-thumb img.vessel-thumb-model,
.vessel-thumb img.vessel-thumb-drawing { object-fit: contain; }
.vessel-thumb-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #5F6B7E; font-size: var(--fs-sm); }
.crop-marks, .crop-marks::before, .crop-marks::after { position: absolute; pointer-events: none; }
.crop-marks { inset: 6px; z-index: 1; border: 0; }
.crop-marks::before, .crop-marks::after { content: ""; width: 10px; height: 10px; border-color: rgba(16, 29, 48, 0.55); border-style: solid; }
.crop-marks::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.crop-marks::after { right: 0; bottom: 0; border-width: 0 1px 1px 0; }
.hull-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 64px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
}
.hull-thumb { width: 56px; height: 34px; }
.hull-thumb-axis { stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.vessel-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-width: 0; padding: 0 var(--space-xs); }
.vessel-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: var(--fs-lg); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.vessel-row .badge { flex: none; } /* the one-word state stays whole; the name shortens instead */
.vessel-meta { padding: 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A running vessel: a teal hairline that travels (no progress number exists yet). */
.vessel-progress {
  position: relative;
  height: 3px;
  margin: var(--space-xs) var(--space-xs) 0;
  overflow: hidden;
  border-radius: 2px;
  background: var(--sunken);
}
.vessel-progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 2px;
  background: var(--ai);
  animation: travel 1.8s var(--ease-out) infinite;
}
@keyframes travel { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.drop-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-width: 0;
  min-height: 210px;
  padding: var(--space-lg);
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  text-align: center;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.dragging-file .drop-tile { border-color: var(--brand); background: var(--brand-soft); }
.drop-art { width: 120px; height: 64px; margin-bottom: var(--space-sm); fill: none; stroke: var(--rule-strong); stroke-width: 1.2; }
.drop-art .drop-art-wl { stroke-dasharray: 2 3; stroke-width: 0.8; }
.drop-tile strong { font-size: var(--fs-xl); font-weight: 600; }
.drop-hint { color: var(--ink-3); font: var(--fs-sm) var(--font-mono); max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.drop-tile .btn { margin-top: var(--space-sm); }

/* First start (no runs): one large drop target and the four steps ahead. */
.first-steps, .first-sample { display: none; }

/* Loading placeholders (Home while the run list loads). A slow sweep; still under reduced motion. */
.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--sunken) 25%, var(--rule) 50%, var(--sunken) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s linear infinite;
}
@keyframes skeleton-sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skeleton-art { width: 72px; height: 56px; border-radius: var(--radius-md); }
.skeleton-thumb { aspect-ratio: 16 / 10; margin-bottom: var(--space-xs); border-radius: var(--radius-md); }
.skeleton-line { width: 70%; height: 14px; margin: 4px; }
.skeleton-line.short { width: 40%; }
.needs-card.is-loading, .vessel-card.is-loading { border-left-color: var(--rule); cursor: default; pointer-events: none; }
.needs-card.is-loading { grid-template-columns: auto minmax(0, 1fr); }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.view-home[data-empty="true"] .first-sample { display: inline-flex; color: var(--brand); }
.view-home[data-empty="true"] .needs-row,
.view-home[data-empty="true"] .home-section-title { display: none; }
.view-home[data-empty="true"] .vessel-grid { grid-template-columns: minmax(0, 1fr); }
.view-home[data-empty="true"] .drop-tile { min-height: 420px; gap: var(--space-sm); border-width: 2px; }
.view-home[data-empty="true"] .drop-art { width: 200px; height: 106px; }
.view-home[data-empty="true"] .drop-tile strong { font-size: var(--fs-2xl); }
.view-home[data-empty="true"] .drop-tile .btn { height: 36px; padding: 0 var(--space-lg); font-size: var(--fs-lg); }
.view-home[data-empty="true"] .first-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 160px));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  counter-reset: step;
  text-align: left;
}
.first-steps li { display: flex; flex-direction: column; gap: 2px; counter-increment: step; }
.first-steps li::before { content: counter(step); display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: var(--space-xs); border-radius: 50%; background: var(--brand-soft); color: var(--brand); font: 500 var(--fs-sm) var(--font-mono); }
.first-steps strong { font-size: var(--fs-md) !important; font-weight: 600; }
.first-steps span { color: var(--ink-2); font-size: var(--fs-sm); }
@media (max-width: 900px) {
  .view-home[data-empty="true"] .first-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.queue-list { display: flex; flex-direction: column; gap: var(--space-xl); max-width: 1040px; }
.queue-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.queue-group-title { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--fs-lg); font-weight: 600; }
.queue-count { padding: 0 var(--space-sm); border-radius: 999px; background: var(--sunken); color: var(--ink-2); font: 500 var(--fs-sm)/20px var(--font-mono); }
.queue-rows { display: flex; flex-direction: column; gap: var(--space-xs); }
.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 120px 96px 150px 140px;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  min-height: 48px;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--raised);
  color: var(--ink);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.queue-row:hover { border-color: var(--rule-strong); }
.queue-row > .badge { justify-self: start; }
.queue-name { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.queue-run, .queue-facts { color: var(--ink-2); white-space: nowrap; }
.queue-time { color: var(--ink-3); font-size: var(--fs-sm); text-align: right; white-space: nowrap; }
.queue-extra { display: inline-flex; min-width: 0; }

/* Batch queue (js/batch.js): the waiting sets, in start order, above the runs. */
.queue-wait-note { margin: 0 0 var(--space-sm); color: var(--ink-2); font-size: var(--fs-sm); }
.queue-wait-note.held { color: var(--warn); font-weight: 600; }
.queue-wait-rows { list-style: none; }
.queue-wait-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 110px minmax(0, 220px) auto;
  align-items: center;
  gap: var(--space-md);
  min-height: 48px;
  padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-lg);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: var(--fs-md);
}
.queue-wait-row[data-state="failed"] { border-color: var(--guess-ink); }
.queue-wait-row > .badge { justify-self: start; }
.queue-wait-order { color: var(--ink-3); font: 600 var(--fs-sm) var(--font-mono); }
.queue-wait-message { display: block; overflow: hidden; color: var(--warn); white-space: nowrap; text-overflow: ellipsis; }
.queue-wait-actions { display: inline-flex; align-items: center; gap: 2px; }
.queue-wait-actions .btn-icon { width: 32px; font-size: var(--fs-md); }
.drop-choices { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: var(--space-sm); }

/* The batch sheet: the drawing sets a drop or a folder gave, each with a check box. */
.batch-sheet {
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  margin: auto;
  padding: var(--space-xl);
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-dialog);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
}
.batch-sheet::backdrop { background: rgba(10, 31, 61, 0.22); }
.batch-sheet h2 { margin-bottom: var(--space-sm); font-size: var(--fs-xl); font-weight: 600; }
.batch-intro { margin-bottom: var(--space-md); color: var(--ink-2); font-size: var(--fs-md); }
.batch-ai-note { display: flex; align-items: flex-start; gap: var(--space-sm); margin-bottom: var(--space-md); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); }
.batch-ai-note[hidden] { display: none; }
.batch-ai-note .icon { flex: none; margin-top: 2px; }
.batch-sets { display: flex; flex-direction: column; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.batch-set { display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.batch-set input { flex: none; width: 16px; height: 16px; margin-top: 3px; accent-color: var(--brand); }
.batch-set-text { display: flex; flex-direction: column; min-width: 0; cursor: pointer; }
.batch-set-name { font-weight: 600; }
.batch-set-files { overflow: hidden; color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; text-overflow: ellipsis; }
.batch-skipped details { margin-top: var(--space-md); color: var(--warn); font-size: var(--fs-sm); }
.batch-skipped summary { display: inline-flex; align-items: center; gap: var(--space-xs); cursor: pointer; }
.batch-skipped ul { margin: var(--space-xs) 0 0 var(--space-lg); color: var(--ink-2); }
.batch-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-xl); }

/* ------------------------------------------------------------------ Run view */

.view-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--inspector-w);
  /* Hide or show the details column: short, and the panes follow the width. */
  transition: grid-template-columns var(--dur-details) ease-out;
}
:root[data-details="closed"] { --inspector-w: var(--details-rail-w); }
:root[data-details="closed"] .inspector { visibility: hidden; border-left-width: 0; overflow: hidden; transition: visibility 0s linear var(--dur-details); }
.inspector { min-width: 0; }
/* The rail and the column share the second grid column; only one shows. */
.view-run > .inspector, .view-run > .details-rail { grid-column: 2; grid-row: 1; }
.view-run:not([data-vtab="run"]) > .details-rail { display: none; }

/* Titlebar toggle and the edge handle that reopens the column. Badge: review items still open. */
.details-toggle { position: relative; }
.details-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--on-brand);
  font: 600 10px/16px var(--font-mono);
  text-align: center;
  box-sizing: border-box;
}
.details-count[hidden] { display: none; }
/* The folded column: a thin rail of icons (show, review with its count, one per tab). */
.details-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: var(--space-sm) 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--bg);
}
.details-rail[hidden] { display: none; }
.details-rail-tabs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--line);
}
.details-rail-item {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-2);
}
.details-rail-item:hover { color: var(--ink); background: var(--hover); }
.details-rail-item[hidden] { display: none; }
#details-review { color: var(--warn); }
.details-rail-item .details-count { top: -3px; right: -3px; }
@media (prefers-reduced-motion: reduce) {
  .view-run, :root[data-details="closed"] .inspector { transition: none; }
}

/* HOOK(M3 live): narration strip under the panes. */
.narration {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: var(--narration-h);
  flex: none;
  min-width: 0;
  padding: 0 var(--space-md);
  border-top: 1px solid var(--rule);
  background: var(--surface);
  font: var(--fs-md) var(--font-mono);
}
.narration-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--rule-strong); }
.narration[data-live="true"] .narration-dot { background: var(--ai); animation: pulse 1.6s var(--ease-out) infinite; }
.narration-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.narration-empty { color: var(--ink-3); }
.narration-time { flex: none; color: var(--ink-3); font-size: var(--fs-xs); }

/* HOOK(M3 live, M7 compare): revision and timeline strip at the bottom of the run view. */
.revision-strip {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  height: var(--revision-h);
  flex: none;
  min-width: 0;
  padding: 0 var(--space-md);
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.revision-ladder { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; overflow: hidden; font-family: var(--font-mono); }
.rev-step { flex: none; padding: 1px var(--space-sm); border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; }
.rev-current { background: var(--brand); color: var(--on-brand); }
.rev-empty { color: var(--ink-3); font-size: var(--fs-sm); font-family: var(--font-ui); white-space: nowrap; }
.revision-facts { display: flex; align-items: center; gap: var(--space-md); min-width: 0; margin-left: auto; overflow: hidden; }
.rev-fact { min-width: 0; overflow: hidden; color: var(--ink-3); font: var(--fs-sm) var(--font-mono); white-space: nowrap; text-overflow: ellipsis; }
.revision-facts .badge { flex: none; }
/* The strip keeps the ladder and the chips whole; the requests, cost and time (also under
   Calls and on Home) leave first when the workspace is narrow. */
.revision-strip { container: revstrip / inline-size; }
@container revstrip (max-width: 960px) {
  .revision-facts .rev-fact { display: none; }
}
/* Narrower still: the AI draft chip goes (the mode is under Calls); Draft only stays. */
@container revstrip (max-width: 640px) {
  .revision-facts .badge + .badge { display: none; }
}

/* HOOK(M3 live): attention layer on the drawing; marks never take clicks. */
.attention-layer { pointer-events: none; }

/* HOOK(M3 live): Thinking tab, a vertical pen rule with one node per step. */
.thinking { position: relative; display: flex; flex-direction: column; gap: var(--space-md); padding-left: 2px; }
.thinking::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 7px; width: 1.5px; background: var(--brand); opacity: 0.5; }
.thought { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--space-md); scroll-snap-align: start; }
/* Scrolling the Thinking list rests on the start of a card, so no card sits half under the tabs. */
#panel-thinking { scroll-snap-type: y proximity; scroll-padding-top: var(--space-md); }
.thought-dot { width: 12px; height: 12px; margin-top: 3px; border: 1.5px solid var(--brand); border-radius: 50%; background: var(--surface); }
.thought-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.thought-tool { font-size: var(--fs-sm); font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.thought-reason { color: var(--ink-2); font-size: var(--fs-md); line-height: 1.45; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Settings view */

.settings-form { display: flex; flex-direction: column; gap: var(--space-lg); max-width: 640px; }
.settings-form h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; }
.settings-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-xs) var(--space-lg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--raised);
}
.settings-group-title { padding: var(--space-sm) 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-sm); font-weight: 600; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  min-height: 48px;
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--rule);
}
.setting-row:first-of-type { border-top: 0; }
.setting-label { display: inline-flex; align-items: center; gap: var(--space-sm); min-width: 0; font-weight: 500; }
/* Key usage (js/usage.js): one card per key slot with three meters. Brand blue fills;
   amber at 90 % or more. Teal is not used: a usage check is not AI activity. */
.usage { display: flex; flex-direction: column; gap: var(--space-sm); padding-bottom: var(--space-md); border-top: 1px solid var(--rule); }
.usage > .usage-head { border-top: 0; }
.usage .field-help { margin: 0; }
.usage-body { display: flex; flex-direction: column; gap: var(--space-sm); }
.usage-warning { display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); }
.usage-warning .icon { flex: none; margin-top: 2px; }
.usage-error { color: var(--warn); font-size: var(--fs-sm); }
.usage-slots { display: flex; flex-direction: column; gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.usage-slot { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.usage-slot.next { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.usage-slot-head { display: flex; align-items: center; gap: var(--space-sm); }
.usage-slot-name { font-weight: 600; }
.usage-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-md); }
.usage-meter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.usage-meter-head { display: flex; justify-content: space-between; gap: var(--space-xs); font-size: var(--fs-sm); }
.usage-window { color: var(--ink-2); }
.usage-percent { font: 500 var(--fs-sm) var(--font-mono); }
.usage-bar { display: block; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.usage-fill { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.usage-meter.near .usage-fill { background: var(--guess-ink); }
.usage-meter.near .usage-percent { color: var(--warn); font-weight: 600; }
.usage-reset.limited { color: var(--warn); font-weight: 600; }
.usage-reset { min-height: 1.2em; color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-advanced { padding-bottom: var(--space-sm); }
.settings-advanced > summary { display: flex; align-items: center; gap: var(--space-xs); width: fit-content; cursor: pointer; list-style: none; }
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-advanced .chevron { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.settings-advanced[open] .chevron { transform: rotate(90deg); }
.settings-advanced[open] > summary { margin-bottom: var(--space-sm); }
.settings-advanced .field + .field { margin-top: var(--space-md); }
.settings-form .sheet-actions { justify-content: flex-end; }

/* On/off switch. A real checkbox underneath, so forms and keyboard work. */
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--rule-strong);
  transition: background var(--dur-fast);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-fast) var(--ease-out);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ Workspace (run view) */

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

/* ---- Run bar (js/run_header.js): one row above the panes. The status sentence with its action
   and Next, the section tiles (compact), Watch again and the fit. The geometry keeps the rest. */
.run-bar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: none;
  min-width: 0;
  /* 36 px: one 28 px control row; at 1280 x 800 the panes then keep 80 % of the window. */
  height: 36px;
  padding: 0 var(--space-sm);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.run-bar[hidden] { display: none; }
.run-status { display: flex; align-items: center; gap: var(--space-xs); flex: 0 1 auto; min-width: 0; }
.run-status:empty { display: none; }
.run-status-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 6px 0 8px;
  border: 0; border-radius: var(--radius-md); background: transparent;
  color: var(--text); font: inherit; font-size: var(--fs-md); cursor: pointer;
}
.run-status-toggle:hover { background: var(--hover); }
.run-status-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.run-status-toggle > .icon { flex: none; width: 15px; height: 15px; }
.run-status-toggle[data-tone="attention"] > .icon:first-child { color: var(--warn); }
.run-status-toggle[data-tone="calm"] > .icon:first-child { color: var(--pass); }
.run-status-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.run-status-chevron { transform: rotate(90deg); color: var(--text-3); transition: transform var(--dur-fast); }
.run-status-toggle[aria-expanded="true"] .run-status-chevron { transform: rotate(-90deg); }
.run-status .btn { flex: none; gap: 6px; }

/* The section tiles in the run bar: one line each (shape, place, state and source glyphs, ink). */
/* The tiles and the sentence shrink together (the sentence ends in "…"); about three tiles show. */
.run-bar .strip-row { flex: 1 1 280px; min-width: 120px; border: 0; background: transparent; }
/* The status sentence already says how many sections need the person. */
.run-bar .strip-head { display: none; }
.run-bar .strip {
  --strip-bar-h: 4px;
  min-height: 0;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-xs);
  border-left: 1px solid var(--line);
}
.run-bar .strip::-webkit-scrollbar { height: var(--strip-bar-h); }
.run-bar .tile {
  display: flex; align-items: center; gap: 6px;
  width: auto; height: 28px; padding: 0 8px 0 4px;
}
.run-bar .tile-shape { grid-row: auto; width: 16px; height: 22px; max-height: none; }
.run-bar .tile-x { font-size: var(--fs-md); }
.run-bar .tile-chips { min-height: 0; }
.run-bar .tile-placeholder { width: 96px; height: 28px; }
.run-bar .strip-empty { padding: 0 var(--space-sm); white-space: nowrap; }
.run-bar-end { display: flex; align-items: center; gap: var(--space-sm); flex: none; }
.run-bar-end:empty { display: none; }
.run-bar .watch-again { height: 28px; padding: 0 8px; font-size: var(--fs-sm); }
/* A narrow bar (details column open in a laptop window): tiles keep place and state only, and
   Watch again keeps its icon (its name stays in aria-label). */
.run-bar { container: runbar / inline-size; }
@container runbar (max-width: 960px) {
  .run-bar .tile-chips { display: none; }
  .run-bar .watch-again > span { display: none; }
}

/* The run drawer: the detail behind the sentence, over the top of the panes. */
.run-drawer {
  position: absolute;
  top: calc(100% + 4px);
  left: var(--space-sm);
  width: min(600px, calc(100% - 2 * var(--space-sm)));
  max-height: min(70vh, 600px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  font-size: var(--fs-md);
}
.run-drawer[hidden] { display: none; }
.drawer-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.drawer-title { margin: 0; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; }
.drawer-line { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-xs) var(--space-sm); margin: 0; }
.drawer-accuracy { align-self: flex-start; cursor: help; }
.drawer-accuracy[data-caution="true"] { color: var(--guess-text); }
.drawer-key { min-width: 44px; color: var(--text-3); }
.run-drawer .sheet-review { padding: 0; border: 0; font-size: var(--fs-sm); }
.drawer-sheets:has(> #sheet-review:empty) { display: none; }
.run-drawer .revision-ladder { flex-wrap: wrap; overflow: visible; }
.run-drawer .revision-facts { flex-wrap: wrap; margin-left: 0; overflow: visible; }
.run-drawer .draft-warnings summary { color: var(--warn); }

/* The narration row shows while the run works or a replay is open; the bottom strip only holds
   the replay transport. A finished run gives both rows to the geometry. */
.workspace:not([data-running="true"]):not(:has(.live-transport:not([hidden]))) > .narration { display: none; }
.revision-strip:not(:has(> .live-transport:not([hidden]))) { display: none; }

/* Costs and timings on the Run tab: shown only with Settings > "Show costs and timings". */
body:not([data-costs="shown"]) :is(.workspace, .inspector) .cost-timing { display: none !important; }

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-md);
  background: var(--sunken);
  gap: 2px;
}
.segmented > button,
.segmented label span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  min-width: 30px;
  padding: 0 var(--space-sm);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
}
.segmented > button:hover { color: var(--ink); }
.segmented > button[aria-checked="true"],
.segmented input:checked + span {
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(10, 31, 61, 0.15), 0 0 0 0.5px rgba(10, 31, 61, 0.1);
}
.segmented-text { align-self: center; }
.segmented-text label { position: relative; }
.segmented-text input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-text input:focus-visible + span { outline: 2px solid var(--focus); }

/* Notices: a slim row each, under the toolbar. */
.notices { display: flex; flex-direction: column; flex: none; }
.notice {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 34px;
  padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-lg);
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--text-2);
  font-size: var(--fs-sm);
  animation: notice-in var(--dur-med) var(--ease-out);
}
.notice[data-tone="warning"] { background: var(--warn-soft); color: var(--text); }
.notice[data-tone="warning"] > .icon { color: var(--warn); }
.notice-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}
.notice.expanded .notice-text { white-space: normal; overflow-wrap: anywhere; }
.notice > .icon, .notice > .btn { flex: none; }
.notice.leaving { opacity: 0; transition: opacity var(--dur-fast); }
@keyframes notice-in { from { opacity: 0; } }

/* Stage: the drawing and the model. */
.stage {
  --split: 0.56;
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--line);
}
.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
.pane-drawing { flex: var(--split) 1 0; }
.pane-model { flex: calc(1 - var(--split)) 1 0; }
.stage[data-view="drawing"] .pane-model,
.stage[data-view="drawing"] .splitter,
.stage[data-view="model"] .pane-drawing,
.stage[data-view="model"] .splitter { display: none; }
/* A pane alone fills the stage. Its split share is a flex-grow below 1, and flex items whose
   grow factors sum below 1 take only that fraction of the free space. */
.stage[data-view="drawing"] .pane-drawing,
.stage[data-view="model"] .pane-model { flex: 1 1 0; }

.stage.stacked { flex-direction: column; }

.splitter {
  flex: none;
  width: 1px;
  position: relative;
  background: var(--line);
  cursor: col-resize;
  z-index: 2;
}
.splitter::after { content: ""; position: absolute; inset: 0 -4px; }
.stage.stacked .splitter { width: auto; height: 1px; cursor: row-resize; }
.stage.stacked .splitter::after { inset: -4px 0; }
.splitter:hover, .splitter.dragging, .splitter:focus-visible { background: var(--accent); outline: none; }

.pane-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: 36px;
  padding: 0 var(--space-sm) 0 var(--space-md);
  flex: none;
  border-bottom: 1px solid var(--line);
}
.pane-title { flex: none; font-size: var(--fs-md); font-weight: 600; white-space: nowrap; }
.pane-meta {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pane-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
.pane-tools .btn-icon { width: 28px; height: 28px; }
.pane-tools .btn-icon .icon { width: 16px; height: 16px; }
/* A narrow pane keeps its tools and drops the size line (it is also in the inspector). */
.pane { container: pane / inline-size; }
@container pane (max-width: 520px) {
  .pane-meta { display: none; }
}
.zoom-readout { min-width: 40px; text-align: center; color: var(--text-3); font-size: var(--fs-xs); }

.drawing-host, .model-host {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.drawing-host { background: var(--surface-sunken); cursor: grab; touch-action: none; }
.drawing-host.panning { cursor: grabbing; }
.drawing-host:focus-visible, .model-host:focus-visible { outline-offset: -2px; border-radius: 0; }
.drawing-host svg { display: block; width: 100%; height: 100%; }
.model-host { background: var(--model-bg); cursor: grab; }
.model-host canvas { display: block; }
/* Whole-vessel tanks: name labels over the 3D view and the legend with its layer switches. */
.model-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.model-label {
  position: absolute; transform: translate(-50%, calc(-100% - 4px));
  display: inline-flex; align-items: center; gap: 5px; max-width: 180px;
  padding: 1px 7px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line);
  color: var(--ink); font-size: 11px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-label.is-strong { border-color: var(--ink); font-weight: 600; }
.model-swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(16, 29, 48, 0.35); }
.model-legend {
  position: absolute; left: 12px; bottom: 12px; max-width: 260px; padding: 5px 6px;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); font-size: 12px; cursor: default;
}
.model-legend-head { display: flex; flex-wrap: wrap; gap: 6px; }
.model-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.model-chip button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 12px; cursor: pointer; }
.model-chip-toggle { padding: 2px 9px; font-weight: 600; }
.model-chip-toggle[aria-pressed="true"] { background: var(--selected); color: var(--ink); }
.model-chip-open { display: inline-flex; align-items: center; padding: 0 6px 0 4px; border-left: 1px solid var(--line) !important; }
.model-chip-open .icon { width: 12px; height: 12px; transform: rotate(90deg); transition: transform 120ms var(--ease-out); }
.model-chip-open[aria-expanded="true"] .icon { transform: rotate(-90deg); }
.model-chip button:hover { background: var(--hover); color: var(--ink); }
.model-chip button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .model-chip-open .icon { transition: none; } }
.model-switch { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; cursor: pointer; }
.model-legend-rows { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.model-legend-rows li { display: flex; align-items: center; gap: 6px; }
.model-legend-count { margin-left: auto; padding-left: 10px; color: var(--text-3); font-family: var(--font-mono); font-size: 11px; }
.model-legend-note { margin: 6px 0 0; color: var(--text-3); font-size: 11px; }

.page-frame { fill: #FBFBF9; stroke: rgba(16, 29, 48, 0.18); }

/* Overlay marks on the drawing. Strokes do not scale with zoom. */
.region {
  fill: transparent;
  stroke: var(--ink-region);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.region:hover { fill: rgba(6, 68, 142, 0.04); }
.region[data-state="declined"] { stroke: var(--ink-declined); stroke-dasharray: none; stroke-width: 1.5; }
.region[data-state="guessed"] { stroke: var(--guess-ink); stroke-dasharray: 7 4; stroke-width: 1.5; fill: none; } /* stations sharing a panel would stack a fill into solid amber */
.region.selected { stroke: var(--ink-chosen); stroke-dasharray: none; stroke-width: 1.5; fill: rgba(6, 68, 142, 0.04); }
.region-label {
  font: 600 13px var(--font-ui);
  fill: #101D30;
  paint-order: stroke;
  stroke: #FBFBF9;
  stroke-width: 4px;
  pointer-events: none;
}

.cand {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  transition: stroke-width var(--dur-fast);
}
.cand-other { stroke: var(--ink-candidate); stroke-width: 1.25; }
.cand-chosen { stroke: var(--ink-chosen); stroke-width: 2.75; }
.cand-overview { stroke: var(--ink-chosen); stroke-width: 1.5; opacity: 0.55; }
/* A guessed line: dashed amber instead of solid blue. */
.cand-guess { stroke: var(--guess-ink); stroke-dasharray: 8 5; stroke-linecap: butt; }
.cand-guess.cand-overview { opacity: 0.85; }
.cand.hot { stroke-width: 3.5; }
.cand-other.hot { stroke: #3E4B5E; }
.cand-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  vector-effect: non-scaling-stroke;
  cursor: help;
}

.tooltip {
  position: absolute;
  z-index: 20;
  max-width: 280px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: rgba(10, 31, 61, 0.96);
  color: #E6EDF7;
  font-size: var(--fs-sm);
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(10, 31, 61, 0.25);
}
.tooltip strong { display: flex; align-items: center; gap: var(--space-sm); font-weight: 600; margin-bottom: 2px; }
.tooltip .tip-tag { color: #F5B14C; font-weight: 600; font-size: var(--fs-xs); }
.tooltip .tip-tag.muted { color: #8FB4E8; }

.pane-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-2);
}
.pane-empty .icon { width: 28px; height: 28px; stroke-width: 1; color: var(--text-3); }
.pane-empty strong { color: var(--text); font-weight: 600; }
.pane-empty p { max-width: 34ch; font-size: var(--fs-sm); color: var(--text-3); }

/* Section strip. */
/* Section strip: the review counter, then the tiles (scrolling sideways). */
.strip-row {
  display: flex;
  flex: none;
  min-width: 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.strip-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  flex: none;
  width: 96px;
  padding: var(--space-sm) var(--space-md);
  border-right: 1px solid var(--line);
}
.strip-head[hidden] { display: none; }
.strip-count { font: var(--fs-sm) var(--font-mono); color: var(--text-3); white-space: nowrap; }
.strip-count strong { font-size: var(--fs-xl); font-weight: 500; color: var(--text); }
.strip-count[data-open="true"] strong { color: var(--warn); }
.strip-count-label { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.strip-head .btn { margin-top: 2px; }
.strip {
  /* Room for the sideways scroll bar under the tiles. The bar is styled, so it has this height
     in every web view; WebKit leaves a plain bar out of the strip's height and then cut the
     tiles and added a vertical scroll bar. */
  --strip-bar-h: 10px;
  display: flex;
  gap: var(--space-sm);
  min-height: calc(var(--strip-h) + var(--strip-bar-h));
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-start;
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  overflow-y: hidden;
}
.strip::-webkit-scrollbar { height: var(--strip-bar-h); }
.strip::-webkit-scrollbar-track { background: transparent; }
.strip::-webkit-scrollbar-thumb { border: 2px solid var(--bg); border-radius: 5px; background: var(--line-strong); }
.strip::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.strip:focus-visible { outline-offset: -2px; border-radius: 0; }
.strip-empty { display: flex; align-items: center; gap: var(--space-sm); flex: none; align-self: center; color: var(--text-3); font-size: var(--fs-sm); padding: 0 var(--space-sm) 0 var(--space-xs); }
.tile-placeholder { height: 62px; border-style: dashed; background: transparent; cursor: default; }
.tile-placeholder:hover { border-color: var(--line); }

/* Evidence card (js/evidence.js): above the hovered tile, the page crop and what it shows. */
.evidence-card {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 272px;
  padding: var(--space-md);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
  pointer-events: none;
}
.evidence-card[hidden] { display: none; }
.evidence-crop { align-self: center; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #F7F5F0; }
.evidence-crop[hidden] { display: none; }
.evidence-text { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.evidence-text strong { color: var(--ink); font-size: var(--fs-md); }
.evidence-ink { font-family: var(--font-mono); color: var(--ink); }

/* A tile: shape | "x m" and the state chip on one line, the source chip below. */
.tile {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: var(--space-xs) var(--space-sm);
  align-items: center;
  width: 216px; /* fits "20.0 m" with "Line chosen", and the "AI corrected" chip */
  flex: none;
  padding: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.tile:hover { border-color: var(--line-strong); }
.tile[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.strip:focus-visible .tile[aria-selected="true"] { box-shadow: 0 0 0 3px var(--focus); }
.tile-shape { grid-row: 1 / span 2; width: 40px; height: 100%; max-height: 44px; }
.tile-shape path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tile-shape .axis { stroke: var(--line-strong); stroke-width: 1; }
.tile[data-state="chosen"] .tile-shape .shape { stroke: var(--accent); }
.tile-shape .shape.src-stroke { stroke: var(--src-color); }
.tile-chips .badge { max-width: 100%; }
.tile[data-state="declined"] .tile-shape .shape { stroke: var(--text-3); stroke-dasharray: 3 3; }
.tile-head { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }
.tile-x { flex: none; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }
.tile-x small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); margin-left: 1px; }
.tile-chips { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; min-height: 20px; }
.tile-ink { margin-left: auto; flex: none; color: var(--text-3); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }
.tile-state, .tile-source {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--muted-soft);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tile[data-state="chosen"] .tile-state { background: var(--accent-soft); color: var(--accent-strong); }
.tile[data-state="declined"] .tile-state { background: var(--warn-soft); color: var(--warn); }
.tile[data-state="guessed"] { border-style: dashed; border-color: var(--guess-ink); background: var(--guess-soft); }
.tile[data-state="guessed"][aria-selected="true"] { border-style: dashed; }
.tile[data-state="guessed"] .tile-shape .shape { stroke: var(--guess-ink); stroke-dasharray: 4 3; }
.tile[data-state="guessed"] .tile-state { background: var(--surface); color: var(--guess-text); box-shadow: inset 0 0 0 1px var(--guess-ink); }

/* ------------------------------------------------------------------ Inspector */

.inspector {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-left: 1px solid var(--line);
}
.inspector-head {
  display: flex;
  flex-wrap: wrap; /* the chips go to a second line before they shorten */
  align-items: center;
  flex: none;
  gap: var(--space-sm);
  min-height: 44px;
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--line);
}
.inspector-head h2 { min-width: 0; overflow: hidden; font-size: var(--fs-md); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }

.selection {
  flex: none;
  max-height: 46%;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--line);
}
.selection-reason { color: var(--text); font-size: var(--fs-md); line-height: 1.5; overflow-wrap: anywhere; }
/* Decide this section: Accept (A), Other line (O), Mark (M). Shown only while it needs a person. */
.decision-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); padding-bottom: var(--space-xs); }
.decision-bar .btn { gap: 6px; padding: 0 10px; }
.decision-hint { color: var(--warn); font-size: var(--fs-sm); }
.key-hint {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  font: 500 11px/1 var(--font-mono);
}
.selection-empty { color: var(--text-3); font-size: var(--fs-sm); }

.cand-list { margin-top: var(--space-md); display: flex; flex-direction: column; gap: 2px; }
.cand-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 2px var(--space-sm);
  align-items: center;
  padding: 6px var(--space-sm);
  margin: 0 calc(-1 * var(--space-sm));
  border-radius: var(--radius-md);
}
.cand-row:hover, .cand-row.hot, .cand-row:focus-within { background: var(--hover); }
.cand-swatch { width: 22px; height: 10px; }
.cand-swatch line { stroke-linecap: round; }
.cand-label { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.cand-why { grid-column: 2 / -1; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.4; overflow-wrap: anywhere; }
.cand-actions { grid-column: 2 / -1; display: flex; gap: var(--space-sm); margin-top: var(--space-xs); }

.tabs {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  white-space: nowrap;
  height: 34px;
  padding: 0 var(--space-sm);
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.tabs button .icon { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.tabs .count { color: var(--text-3); font-weight: 500; }
.tabs .count.bad { color: var(--fail); }

.tab-panels { flex: 1; min-height: 0; display: flex; }
.tab-panel { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-md) var(--space-lg) var(--space-xl); }
.tab-panel:focus-visible { outline-offset: -2px; border-radius: 0; }
/* Content that scrolls past the top or bottom edge fades out over 48 px, so a part-hidden
   card does not look cut. js/app.js sets data-scroll-top / data-scroll-bottom only when there
   is more content that way, so the ends of the list are never faded. */
.tab-panel { padding-top: var(--space-md); --fade-top: 0px; --fade-bottom: 0px; }
.tab-panel[data-scroll-top="true"] { --fade-top: 48px; }
.tab-panel[data-scroll-bottom="true"] { --fade-bottom: 48px; }
.tab-panel[data-scroll-top="true"], .tab-panel[data-scroll-bottom="true"] {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
}
.panel-empty { color: var(--text-3); font-size: var(--fs-sm); padding: var(--space-sm) 0; }

/* Timeline */
.timeline { display: flex; flex-direction: column; }
.event {
  overflow-wrap: anywhere;
  display: grid;
  grid-template-columns: 38px 12px minmax(0, 1fr);
  gap: var(--space-sm);
  padding: 5px 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.event-time { color: var(--text-3); font-size: var(--fs-xs); padding-top: 1px; }
.event-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--line-strong);
  justify-self: center;
}
.event[data-kind="choose"] .event-dot { background: var(--brand); }
.event[data-kind="model"] .event-dot { background: var(--ai); }
.event[data-kind="build"] .event-dot,
.event[data-kind="render"] .event-dot { background: var(--text-2); }
.event[data-kind="check"] .event-dot { background: var(--pass); }
.event[data-kind="finish"] .event-dot { background: var(--text); }
.event.fresh { animation: notice-in 400ms var(--ease-out); }
.timeline-live {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  color: var(--ai-text);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.timeline-live::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 47px;
  border-radius: 50%;
  background: var(--ai);
  animation: pulse 1.6s var(--ease-out) infinite;
}

/* Checks */
.check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--line);
}
.check:last-child { border-bottom: 0; }
.check-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.check-value { grid-column: 1; min-width: 0; color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.check .badge { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.check-summary { margin-bottom: var(--space-xs); }

/* Body-plan calibration item (docs/AUTO_CALIBRATION.md): overlay to confirm once. */
.body-plan-check { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-lg); padding-bottom: var(--space-md); border-bottom: 1px solid var(--line); }
.body-plan-check-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.body-plan-check-image { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.body-plan-check-flag { color: var(--fail, #b42318); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* Section areas (js/areas.js): the sectional-area curve with a dot per built station, coloured
   by its source label; a station far from its neighbours' line is ringed in amber. */
.areas { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); padding-bottom: var(--space-md); border-bottom: 1px solid var(--line); }
.areas-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.areas-head h3 { font-size: var(--fs-md); font-weight: 600; }
.segmented-small > button { height: 24px; padding: 0 var(--space-sm); font-size: var(--fs-xs); }
.areas-chart { width: 100%; height: auto; overflow: visible; }
.areas-axis { stroke: var(--line-strong); stroke-width: 1; }
.areas-tick { fill: var(--text-3); font: 10px var(--font-mono); }
.areas-line { fill: none; stroke: var(--text-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.areas-dot { fill: var(--src-color, var(--ink)); stroke: var(--surface); stroke-width: 1.5; cursor: pointer; }
.areas-dot.flagged { stroke: var(--warn-ink); stroke-width: 3; }
.areas-dot.selected { stroke: var(--brand); stroke-width: 3; }
.areas-flags { display: flex; flex-direction: column; gap: 2px; }
.areas-flag { display: flex; gap: var(--space-sm); width: 100%; padding: var(--space-xs) var(--space-sm); border: 0; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.areas-note { color: var(--text-3); font-size: var(--fs-xs); }
/* Numbers read off the curve: two columns of term over value. */
.areas-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs) var(--space-md); margin: 0; }
.areas-stat { min-width: 0; }
.areas-stat dt { color: var(--text-3); font-size: var(--fs-xs); }
.areas-stat dd { margin: 0; color: var(--text); font: 500 var(--fs-sm) var(--font-mono); overflow-wrap: anywhere; }

/* Model calls */
.call { padding: var(--space-md) 0; border-bottom: 1px solid var(--line); }
.call:first-child { padding-top: var(--space-xs); }
.call:last-child { border-bottom: 0; }
.call-head { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.call-head .meta { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); }
.call-images { display: flex; gap: var(--space-sm); margin-bottom: var(--space-sm); overflow-x: auto; }
.call-images figure { margin: 0; width: 88px; flex: none; }
.call-images img {
  display: block;
  width: 88px;
  height: 116px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.call-images figcaption { margin-top: 3px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.3; }
.call-answer {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font-size: var(--fs-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.call-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
  margin-top: var(--space-sm);
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.call-total { margin-bottom: var(--space-xs); }

/* Evidence */
.evidence summary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  list-style: none;
}
.evidence summary::-webkit-details-marker { display: none; }
.evidence .chevron { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.evidence[open] .chevron { transform: rotate(90deg); }
.evidence pre {
  margin: var(--space-sm) 0 0;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  font: 11px/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ Status bar */

.statusbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 0 var(--space-md);
  border-top: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-3);
  font-size: var(--fs-xs);
  white-space: nowrap;
  overflow: hidden;
}
.statusbar .badge { height: 18px; }
.status-item { display: inline-flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status-progress { min-width: 0; overflow: hidden; }
.status-spacer { flex: 1; }
.status-progress { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.status-ai { display: inline-flex; align-items: center; gap: 6px; flex: none; font-family: var(--font-mono); color: var(--ink-2); }
.status-ai::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-line); }
.status-ai[data-state="on"]::before { background: var(--ai); }
.status-folder { font-family: var(--font-mono); min-width: 0; flex: 0 1 auto; display: block; }
.status-theme { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 18px; padding: 0 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font: var(--fs-xs) var(--font-ui); cursor: pointer; }
.status-theme:hover { background: var(--hover); color: var(--ink); }
.status-theme .icon { width: 13px; height: 13px; }
.status-progress.error { color: var(--fail); }
.spinner {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Sheets */

.sheet {
  width: min(480px, calc(100vw - 48px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-sheet);
}
.sheet[open] { animation: sheet-in var(--dur-med) var(--ease-out); }
.sheet::backdrop { background: rgba(10, 31, 61, 0.22); }
@keyframes sheet-in { from { transform: translateY(-16px); opacity: 0; } }
.sheet-body { display: flex; flex-direction: column; gap: var(--space-lg); padding: var(--space-xl); }
.sheet h2 { font-size: var(--fs-lg); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding: 0; }
.field-help { color: var(--text-3); font-size: var(--fs-sm); }
.field-help.field-warn { color: var(--warn); }
.field-row { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-lg); }
.field input[type="text"] {
  height: 30px;
  padding: 0 var(--space-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: var(--fs-sm) var(--font-mono);
  user-select: text;
  -webkit-user-select: text;
}
.field input[type="text"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--accent); }
.input-with-button { display: flex; gap: var(--space-sm); }
.input-with-button input { flex: 1; min-width: 0; }
.input-with-button .btn { height: 30px; flex: none; }
.field-label-chip { display: inline-flex; align-items: center; gap: var(--space-sm); }

.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }

/* A path: the file name stays whole, the folder shortens with an ellipsis. */
.path-label { display: flex; align-items: baseline; gap: var(--space-sm); min-width: 0; }
.path-name { flex: none; max-width: 100%; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.path-folder {
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  font: var(--fs-xs) var(--font-mono);
  white-space: nowrap;
  text-overflow: ellipsis;
  direction: rtl; /* keep the end of the folder, which tells folders apart */
  text-align: left;
}

/* One-click choices under a settings field. */
.suggestions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.suggestions:empty { display: none; }
.suggestion {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 100%;
  padding: 3px var(--space-sm) 3px 3px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: none;
  font-size: var(--fs-sm);
}
.suggestion:hover { border-style: solid; background: var(--hover); }
.suggestion .path-name { font-weight: 500; }
.dataset-choice { max-width: 100%; }
.dataset-choice .dataset-name { max-width: 24ch; }

/* New run: pick, drop or reuse a spec file. */
.dropzone {
  display: grid;
  min-height: 108px;
  padding: var(--space-md);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.dragging-file .dropzone { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-sm); }
.dropzone-icon { width: 22px; height: 22px; color: var(--text-3); }
.dropzone-hint { color: var(--text-3); font-size: var(--fs-sm); }
.dropzone-chosen { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }
.dropzone-chosen .path-label { flex: 1; flex-direction: column; align-items: stretch; gap: 2px; }
.dropzone-chosen .btn { flex: none; }

.choice-list { display: flex; flex-direction: column; gap: 2px; }
.choice {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  padding: 5px var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  font-size: var(--fs-sm);
  text-align: left;
}
.choice:hover { background: var(--hover); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice > .icon { color: var(--text-3); }
.choice .path-label { flex: 1; }

.typed-path summary {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: fit-content;
  color: var(--text-3);
  font-size: var(--fs-sm);
  cursor: pointer;
  list-style: none;
}
.typed-path summary::-webkit-details-marker { display: none; }
.typed-path .chevron { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.typed-path[open] .chevron { transform: rotate(90deg); }
.typed-path input {
  width: 100%;
  height: 30px;
  margin-top: var(--space-sm);
  padding: 0 var(--space-sm);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font: var(--fs-sm) var(--font-mono);
  user-select: text;
  -webkit-user-select: text;
}
.typed-path input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--accent); }

/* Shown while a file is dragged over the window (no sheet open): the whole window is the
   target, framed by a dashed edge, with one card that says what a drop does. */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: var(--space-lg);
  background: rgba(10, 31, 61, 0.28);
  pointer-events: none;
}
.drop-overlay::before {
  content: "";
  position: absolute;
  inset: var(--space-lg);
  border: 2px dashed var(--brand);
  border-radius: var(--radius-dialog);
  background: color-mix(in srgb, var(--brand-soft) 35%, transparent);
}
.dragging-file .drop-overlay { display: grid; }
.dragging-file:has(dialog[open]) .drop-overlay { display: none; }
.drop-overlay-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  max-width: 420px;
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--ink);
  text-align: center;
  box-shadow: var(--shadow-sheet);
}
.drop-overlay-card .icon { width: 40px; height: 40px; color: var(--brand); stroke-width: 1.4; }
.drop-overlay-card strong { font-size: var(--fs-xl); font-weight: 600; }
.drop-overlay-card span { color: var(--ink-2); font-size: var(--fs-md); line-height: 1.45; }
.form-error { color: var(--fail); font-size: var(--fs-sm); }
.sheet-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); padding-top: var(--space-xs); }
.sheet-actions .btn { height: 28px; min-width: 80px; justify-content: center; }

/* ------------------------------------------------------------------ Toast */

.toast {
  position: fixed;
  right: calc(var(--inspector-w) + var(--space-lg));
  bottom: calc(var(--statusbar-h) + var(--space-lg));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 420px;
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-sheet);
  animation: sheet-in var(--dur-med) var(--ease-out);
}
.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fail);
}

/* ------------------------------------------------------------------ Narrow windows */

@media (max-width: 1240px) {
  :root { --inspector-w: 312px; }
  .tabs { padding: 0 var(--space-md); }
  .tab-panel, .selection { padding-left: var(--space-md); padding-right: var(--space-md); }
  .inspector-head { padding: 0 var(--space-md); }
  .home-scroll { padding: var(--space-xl); }
}

@media (max-width: 900px) {
  :root { --inspector-w: 264px; --rail-w: 72px; }
  .rail { padding-left: 6px; padding-right: 6px; }
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .crumbs { font-size: var(--fs-md); }
  .home-scroll { padding: var(--space-lg); }
  .home-head h1, .settings-form h1 { font-size: var(--fs-xl); }
  .needs-name { font-size: var(--fs-lg); }
  /* The source chip also shows on the tile and under "Why"; keep the state chip whole. */
  .inspector-head .badge + .badge { display: none; }
  .revision-facts .rev-fact:last-child { display: none; }
}

@media (max-height: 640px) {
  :root { --strip-h: 68px; --narration-h: 28px; --revision-h: 32px; }
  .selection { max-height: 40%; }
  .tile { padding-top: 4px; padding-bottom: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  /* The travelling hairline stands still as a short bar instead of running off. */
  .vessel-progress::after { animation: none; }
  .needs-card:hover, .vessel-card:hover { transform: none; }
}

@media (forced-colors: active) {
  .cand-chosen, .tile[aria-selected="true"] { forced-color-adjust: none; }
}

/* ---- AI draft view: source labels, warnings, model activity ---- */
.draft-summary { display: flex; flex-direction: column; flex: none; }
.draft-summary:empty { display: none; }
.parts-link { align-self: flex-start; gap: var(--space-xs); color: var(--brand); }
.draft-warnings { min-width: 0; }
.draft-warnings[open] { flex-basis: 100%; }
.draft-warnings summary { display: flex; align-items: center; gap: var(--space-xs); cursor: pointer; list-style: none; color: var(--text-3); }
.draft-warnings summary::-webkit-details-marker { display: none; }
.draft-warnings ul {
  max-height: 96px;
  overflow-y: auto;
  margin: var(--space-xs) 0 0;
  padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-xl);
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  list-style: disc;
  overflow-wrap: anywhere;
}
.inspector-head h2 { flex: none; max-width: 60%; }
.inspector-head .badge { flex: 0 1 auto; }
.selection-source { margin: var(--space-xs) 0 0; font-size: var(--fs-sm); color: var(--text-2); }
.selection-source summary { display: flex; align-items: center; gap: var(--space-xs); width: fit-content; cursor: pointer; list-style: none; color: var(--text-3); }
.selection-source summary::-webkit-details-marker { display: none; }
.selection-source p { margin-top: var(--space-xs); overflow-wrap: anywhere; }
.activity { margin-bottom: var(--space-sm); font-size: var(--fs-sm); }
.activity summary { display: flex; align-items: center; gap: var(--space-xs); cursor: pointer; list-style: none; font-weight: 600; }
.activity summary::-webkit-details-marker { display: none; }
.activity .chip-row { margin-top: var(--space-xs); }
.activity-steps { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); overflow-wrap: anywhere; }
.activity .chevron, .draft-warnings .chevron, .selection-source .chevron { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.activity[open] .chevron, .draft-warnings[open] .chevron, .selection-source[open] .chevron { transform: rotate(90deg); }

/* ================================================================== Live run (M3, js/live.js)
   Motion only explains a change: pen draw-in for listed strokes, a ripple for a click, a pin
   that snaps to a claimed line, the fit dial counting. All of it stops under reduced motion. */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Narration: title, then the model's own words in quotes. */
.narration-text { display: flex; align-items: baseline; gap: var(--space-sm); }
.narration-title { flex: none; max-width: 60%; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.narration-quote { min-width: 0; overflow: hidden; color: var(--ink-3); font: italic var(--fs-sm) var(--font-ui); white-space: nowrap; text-overflow: ellipsis; }
.narration[data-category="refused"] .narration-title { color: var(--warn); }
.narration[data-live="true"] .narration-time { color: var(--ai-text); }

/* ---- Attention layer marks. Sizes are screen pixels: --u is page pixels per screen pixel. */
.attention-layer { --u: 1; }
.mk, .mk-band { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mk-screen text { font: 600 11px var(--font-ui); }
.mk-box.tone-view { stroke: var(--mark-view); stroke-width: calc(var(--u) * 1.25px); stroke-dasharray: calc(var(--u) * 7px) calc(var(--u) * 5px); }
.mk-box.tone-panel { stroke: var(--mark-view); stroke-width: calc(var(--u) * 1px); }
.live-now .mk-box.tone-panel { stroke: var(--mark-ai); stroke-width: calc(var(--u) * 1.5px); }
.mk-box.tone-attention { stroke: var(--mark-ai); stroke-width: calc(var(--u) * 2.5px); }
.mk-halo { fill: var(--mark-ai-soft); stroke: var(--mark-ai); stroke-opacity: 0.25; stroke-width: calc(var(--u) * 8px); }
.mk-line { stroke-width: calc(var(--u) * 2.5px); }
.mk-line.tone-stroke { stroke: var(--mark-ai); }
.mk-line.tone-accepted { stroke: var(--mark-ai); stroke-width: calc(var(--u) * 3.5px); }
.mk-line.tone-authored { stroke: var(--mark-ai); stroke-dasharray: calc(var(--u) * 10px) calc(var(--u) * 6px); }
.mk-line.tone-refused { stroke: var(--mark-warn); stroke-dasharray: calc(var(--u) * 10px) calc(var(--u) * 6px); }
.mk-band { stroke: var(--mark-ai); stroke-opacity: 0.24; }
.mk-band.tone-refused { stroke: var(--mark-warn); stroke-opacity: 0.38; }
.mk-click .mk-dot { fill: var(--mark-ai); stroke: var(--mark-on); stroke-width: 1.5; }
.mk-click.tone-refused .mk-dot { fill: var(--mark-warn); }
.mk-ripple { fill: none; stroke: var(--mark-ai); stroke-width: 2; opacity: 0; }
.mk-click.tone-refused .mk-ripple { stroke: var(--mark-warn); }
.mk-tag text { fill: var(--mark-view); }
.live-now .mk-tag text, .mk-tag.tone-attention text { fill: var(--mark-ai-ink); }
.mk-note rect { fill: var(--mark-warn-soft); stroke: var(--mark-warn); stroke-width: 1; }
.mk-note text { fill: var(--mark-warn-ink); }
.mk-stroke-tag circle { fill: var(--mark-ai); stroke: var(--mark-on); stroke-width: 1.5; }
.mk-stroke-tag text { fill: var(--mark-on); text-anchor: middle; }
.mk-pin line { stroke: var(--mark-ai); stroke-width: 1.5; }
.mk-pin circle { fill: var(--mark-ai); stroke: var(--mark-on); stroke-width: 1.5; }
.mk-pin rect { fill: var(--mark-on); stroke: var(--mark-ai); stroke-width: 1; }
.mk-pin text { fill: var(--mark-ai-ink); }
.mk-repeat rect { fill: rgba(16, 29, 48, 0.82); }
.mk-repeat text { fill: var(--mark-on); text-anchor: end; }
/* Earlier steps stay as a faint map of everything the agent looked at. */
.live-past { opacity: 0.42; }

.live-now .mk-ripple { animation: mk-ripple 1100ms var(--ease-out) 1 both; }
.live-now .mk-ripple-2 { animation-delay: 220ms; }
.live-now .mk-halo { animation: pulse 1.6s var(--ease-out) 3; }
.live-enter .mk-line.tone-stroke,
.live-enter .mk-line.tone-accepted {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: mk-draw var(--dur-pen) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.live-enter .mk-stroke-tag { animation: mk-fade 200ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + 200ms); }
.live-enter .mk-box, .live-enter .mk-band, .live-enter .mk-line.tone-authored, .live-enter .mk-line.tone-refused,
.live-enter .mk-note, .live-enter .mk-tag { animation: mk-fade 300ms var(--ease-out) both; }
.live-enter .mk-box.tone-panel { animation-delay: calc(var(--i, 0) * 150ms); }
.live-enter .mk-pin > * { animation: mk-snap 500ms var(--ease-out) both; animation-delay: var(--dur-pen); }
@keyframes mk-draw { to { stroke-dashoffset: 0; } }
@keyframes mk-fade { from { opacity: 0; } }
@keyframes mk-snap { from { opacity: 0; transform: translate(-22px, 22px); } }
@keyframes mk-ripple { from { r: 5px; opacity: 0.9; } to { r: 30px; opacity: 0; } }

.live-follow[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.live-follow .icon { margin-right: 4px; }

/* ---- Fit of the shown revision: a small text chip at the end of the run bar ("fit 0.90"),
   not a dial over the 3D view. The ring stays in the markup for the live lane; it is not drawn. */
.fit-dial {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  white-space: nowrap;
}
.fit-dial[hidden] { display: none; }
.fit-dial svg { display: none; }
.dial-value { font: 500 var(--fs-sm) var(--font-mono); color: var(--ink); }
.dial-label { font-size: var(--fs-xs); color: var(--ink-3); }
.dial-delta { font: var(--fs-xs) var(--font-mono); }
.dial-delta:empty { display: none; }
.dial-delta[data-tone="better"] { color: var(--pass); }
.dial-delta[data-tone="worse"] { color: var(--warn); }
.fit-dial[data-flash="better"] { animation: dial-better 900ms var(--ease-out); }
.fit-dial[data-flash="worse"] { animation: dial-worse 900ms var(--ease-out); }
@keyframes dial-better { 30% { box-shadow: 0 0 0 3px var(--pass-soft); border-color: var(--pass); } }
@keyframes dial-worse { 30% { box-shadow: 0 0 0 3px var(--warn-soft); border-color: var(--warn-ink); } }
.model-caption {
  position: absolute;
  left: var(--space-md);
  bottom: var(--space-sm);
  max-width: calc(100% - 2 * var(--space-md));
  margin: 0;
  padding: 2px var(--space-sm);
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.model-caption[hidden] { display: none; }
/* With no model yet the empty-state text says it; the caption would sit on top of it. */
.pane-model:has(.pane-empty:not([hidden])) .model-caption { display: none; }

/* ---- Revision ladder, sparkline and the replay transport. */
.revision-ladder { flex: 0 1 auto; scrollbar-width: none; overflow-x: auto; }
.revision-ladder::-webkit-scrollbar { display: none; }
.rev-rung {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.rev-rung:hover { background: var(--hover); color: var(--ink); }
.rev-fit { color: var(--ink-3); font-weight: 400; }
.rev-current, .rev-current:hover { background: var(--brand); color: var(--on-brand); }
.rev-current .rev-fit { color: inherit; opacity: 0.85; }
.rev-pinned { outline: 1.5px dashed var(--brand); outline-offset: 1px; }
.rev-sep { flex: none; color: var(--ink-3); }
.rev-rejected { background: var(--warn-soft); color: var(--warn); }
.rev-spark { flex: none; margin-left: var(--space-xs); overflow: visible; }
.rev-spark polyline { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linejoin: round; }
.rev-spark circle { fill: var(--brand); }

.live-transport { display: flex; align-items: center; gap: var(--space-sm); flex: 1 1 180px; min-width: 150px; }
.live-transport[hidden] { display: none; }
.live-play { flex: none; width: 24px; height: 24px; }
.live-play[data-state="paused"] { color: var(--brand); }
.scrub { position: relative; display: flex; align-items: center; flex: 1; min-width: 56px; height: 24px; }
.scrub-input { width: 100%; height: 24px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.scrub-ticks { position: absolute; inset: 0 8px; pointer-events: none; }
.scrub-tick { position: absolute; top: 1px; width: 2px; height: 5px; margin-left: -1px; border-radius: 1px; background: var(--rule-strong); }
.scrub-tick[data-category="ai"] { background: var(--ai); }
.scrub-tick[data-category="refused"] { background: var(--warn-ink); }
.scrub-tick[data-category="build"] { background: var(--ink-3); }
.scrub-tick[data-category="finish"], .scrub-tick[data-category="person"] { background: var(--brand); }
.segmented-speed { flex: none; }
.segmented-speed > button { height: 20px; min-width: 0; padding: 0 6px; font: var(--fs-xs) var(--font-mono); }
.live-edge { cursor: pointer; }
.live-edge[hidden] { display: none; }
.live-edge[aria-pressed="true"] { background: var(--ai-soft); color: var(--ai-text); }
/* With the transport shown, the run facts keep only the mode chip. */
.revision-strip:has(> .live-transport:not([hidden])) .revision-facts .rev-fact { display: none; }

/* ---- Thinking: one card per model step; code steps are one quiet line. */
.thinking-live { gap: var(--space-sm); }
.thinking-live .thought[hidden] { display: none; }
.thought[data-category="ai"] .thought-dot { border-color: var(--ai); }
.thought[data-category="refused"] .thought-dot { border-color: var(--warn-ink); background: var(--warn-soft); }
.thought[data-category="build"] .thought-dot { border-color: var(--ink-3); }
.thought[data-category="quiet"] .thought-dot { width: 8px; height: 8px; margin: 5px 2px 0; border-color: var(--rule-strong); }
.thought[data-category="finish"] .thought-dot, .thought[data-category="person"] .thought-dot { background: var(--brand); }
.thought.is-current .thought-dot { box-shadow: 0 0 0 3px var(--brand-soft); }
.thought-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: var(--space-sm) 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
}
.thought.is-current .thought-card { border-color: var(--brand); box-shadow: inset 2px 0 0 var(--brand); }
.thought-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--space-sm); min-width: 0; }
.thought-title {
  flex: 1 1 9em; /* the time and cost move under a long title in a narrow inspector */
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 var(--fs-md)/1.35 var(--font-ui);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.thought-title:hover { color: var(--brand); }
/* One line per step: chevron, title (cut), time and cost. A press opens the detail below. */
.thought-card:has(.thought-detail[hidden]) { padding-block: 5px; }
.thought-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.thought-row .thought-title { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--fs-sm); }
.thought-row[aria-expanded="true"] .thought-title { white-space: normal; overflow-wrap: anywhere; }
.thought-row:hover .thought-title { color: var(--brand); }
.thought-row .chevron { flex: none; width: 12px; height: 12px; color: var(--ink-3); transition: transform var(--dur-fast); }
.thought-row[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.thought-detail { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.thought-detail[hidden] { display: none; }
.thought-seek {
  display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 0; border: 0; background: none;
  color: var(--ink-3); font-size: var(--fs-xs); cursor: pointer;
}
.thought-seek:hover { color: var(--brand); }
.thought-seek .icon { width: 12px; height: 12px; }
@media (prefers-reduced-motion: reduce) {
  .thought-row .chevron { transition: none; }
}
.thought-who { margin-right: 6px; color: var(--brand); }
.thought-meta { display: inline-flex; gap: 6px; flex: none; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }
.thought-quote { margin: 0; color: var(--ink-2); font-size: var(--fs-md); font-style: italic; line-height: 1.45; overflow-wrap: anywhere; }
.tool-card { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--rule); }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.tool-name { font: 500 var(--fs-sm) var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.target-chip { padding: 0 5px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); color: var(--ink-2); font: var(--fs-xs)/16px var(--font-mono); }
.tool-duration { margin-left: auto; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }
.tool-result { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.tool-card[data-tone="refused"] .tool-result { padding: 3px 6px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.tool-card[data-tone="kept"] .tool-result { color: var(--pass); font-weight: 600; }
.tool-card[data-tone="working"] .tool-result { color: var(--ai-text); }
.thought-more { font-size: var(--fs-sm); }
.thought-more summary { display: flex; align-items: center; gap: var(--space-xs); width: fit-content; color: var(--ink-3); cursor: pointer; list-style: none; }
.thought-more summary::-webkit-details-marker { display: none; }
.thought-more summary .icon { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.thought-more[open] summary .icon { transform: rotate(90deg); }
.thought-notes { margin: var(--space-xs) 0 0; color: var(--ink-2); overflow-wrap: anywhere; }
.thought-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); margin-top: var(--space-xs); }
.thought-images img { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #FBFBF9; }
/* A quiet step: the title (up to two lines) and its time on the first row, the result below.
   Text wraps instead of being cut, so a narrow inspector still reads in full. */
.thought-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: var(--space-sm);
  row-gap: 1px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: var(--fs-sm);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.thought-line:hover, .thought.is-current .thought-line { color: var(--ink); }
.thought-line-title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding-right: 2px; /* room for the slant of italic text */
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.thought-line-result { grid-column: 1; grid-row: 2; min-width: 0; color: var(--ink-3); font-family: var(--font-mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.thought-time { grid-column: 2; grid-row: 1; flex: none; margin-left: auto; font: var(--fs-xs) var(--font-mono); color: var(--ink-3); }
.thought[data-category="quiet"] .thought-line-title { font-style: italic; }
.thinking-jump { position: sticky; bottom: var(--space-sm); display: flex; width: fit-content; margin: var(--space-sm) 0 0 auto; background: var(--ai-soft); color: var(--ai-text); cursor: pointer; box-shadow: 0 2px 8px rgba(10, 31, 61, 0.15); }
.thinking-jump[hidden] { display: none; }

@media (max-width: 1100px) {
  .rev-spark { display: none; }
}
@media (max-width: 900px) {
  .live-follow { width: 24px; padding: 0; justify-content: center; font-size: 0; }
  .live-follow .icon { margin: 0; }
  .narration-quote { display: none; }
  .narration-title { max-width: none; }
  /* Narrow: the transport needs the room; the mode chip is on Home and in Calls. */
  .revision-strip:has(> .live-transport:not([hidden])) .revision-facts { display: none; }
  .live-transport { min-width: 0; gap: var(--space-xs); }
  .segmented-speed > button { padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-enter .mk-line.tone-stroke, .live-enter .mk-line.tone-accepted { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .live-now .mk-ripple { animation: none; }
}


/* Finished run: "Watch again" opens the replay controls (hidden during a live run). */
.watch-again { gap: var(--space-xs); font-size: var(--fs-sm); color: var(--ink-2); }
.watch-again[hidden] { display: none; }

/* ------------------------------------------------------------------ Home: New vessel and the More menu */

.home-head-actions { display: flex; align-items: center; gap: var(--space-sm); flex: none; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--hover); }
.menu-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  min-width: 260px;
  padding: var(--space-xs);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
  box-shadow: var(--shadow-sheet);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 6px var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover { background: var(--hover); }
.menu-item kbd { margin-left: auto; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }

/* ------------------------------------------------------------------ Intake (F4) */

/* View-region colours. They sit on the page image (paper) in both themes, so they are fixed.
   Not teal (AI acted) and not amber (review data): these are code proposals. */
.view-intake {
  --view-body_plan: #06448E;
  --view-half_breadth: #004557;
  --view-profile: #3B6499;
  --view-title_block: #5F6B7E;
  --view-other: #7F899C;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.view-intake[hidden] { display: none; }
[data-label="body_plan"] { --view: var(--view-body_plan); }
[data-label="half_breadth"] { --view: var(--view-half_breadth); }
[data-label="profile"] { --view: var(--view-profile); }
[data-label="title_block"] { --view: var(--view-title_block); }
[data-label="other"] { --view: var(--view-other); }

.intake-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex: none;
  padding: var(--space-lg) var(--space-2xl) var(--space-md);
}
.intake-title { display: flex; align-items: baseline; gap: var(--space-md); min-width: 0; }
.intake-title h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.intake-count { color: var(--ink-3); font-size: var(--fs-md); white-space: nowrap; }
.intake-actions { display: flex; gap: var(--space-sm); flex: none; }

.intake-ai-line,
.intake-set-warnings,
.intake-error,
.intake-blocked { flex: none; margin: 0 var(--space-2xl) var(--space-md); }
.intake-ai-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-md);
}
.intake-ai-line > span { flex: 1 1 auto; min-width: 0; }
.intake-ai-line .btn { flex: none; }
.intake-ai-line > .icon { flex: none; }
.intake-blocked { color: var(--fail); font-size: var(--fs-sm); }
.intake-blocked[hidden] { display: none; }

/* Pages tray | the selected page, large (stage) | vessel form. The stage fills the height. */
.intake-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-xl);
  padding: 0 var(--space-2xl) var(--space-xl);
}
.intake-body.has-tray { grid-template-columns: 184px minmax(0, 1fr) 300px; }
/* Left column: the set summary, then the page tray, which scrolls on its own. */
.intake-tray-wrap { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; min-height: 0; }
.intake-sum { flex: none; padding: var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--raised); }
.intake-sum-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-xs); margin: 0 0 var(--space-xs); font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.intake-sum-skipped { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.intake-sum ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.intake-sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-xs); min-width: 0; font-size: var(--fs-xs); }
.intake-sum-view { flex: none; color: var(--ink-2); }
.intake-sum-pages { min-width: 0; padding: 0 2px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--brand); font: 500 var(--fs-xs) var(--font-mono); text-align: right; overflow-wrap: anywhere; cursor: pointer; }
.intake-sum-pages:hover { text-decoration: underline; }
.intake-sum-row.missing .intake-sum-view,
.intake-sum-row.missing .intake-sum-pages { color: var(--warn); font-weight: 600; cursor: default; }
.intake-position { flex: none; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }
.intake-tray {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 2px; /* room for the focus ring */
}
.intake-tray-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: none;
  width: 100%;
  padding: var(--space-xs);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.intake-tray-item:hover { border-color: var(--rule-strong); }
.intake-tray-item[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.intake-tray-item.skipped .intake-thumb { opacity: 0.45; filter: grayscale(1); }
/* Short thumbnails so a 10-page set shows most pages without scrolling. */
.intake-tray-item .intake-thumb { height: 72px; width: auto; max-width: 100%; align-self: center; }
.intake-tray-line { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; padding: 0 2px; }
.intake-tray-views { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; text-overflow: ellipsis; }
.intake-tray-item.skipped .intake-tray-views { color: var(--ink-3); }
.intake-tray-warn { flex: none; display: inline-flex; color: var(--warn); }
.intake-tray-warn .icon { width: 14px; height: 14px; }
/* Sheet type and scale chips (drawing_set.js). */
.intake-tray-chips { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; padding: 0 2px; }
.scale-chip-text { font: 500 var(--fs-xs) var(--font-mono); }
.intake-sheet-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); padding: var(--space-xs) 0; }
.intake-type-picker { min-width: 0; max-width: 100%; }
.intake-sheet-note { display: inline-flex; align-items: center; gap: var(--space-xs); color: var(--warn); font-size: var(--fs-xs); }
.intake-sheet-note .icon { width: 14px; height: 14px; flex: none; }
/* The drawings checklist (drawing_set.js). */
.intake-checklist { display: grid; gap: var(--space-xs); }
.intake-checklist .intake-sum-title { flex-wrap: wrap; }
.intake-sum-skipped.warn { color: var(--warn); font-weight: 600; }
.check-group-title { margin: var(--space-xs) 0 2px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; }
.check-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: baseline; gap: var(--space-xs); font-size: var(--fs-xs); }
.check-state .icon { width: 12px; height: 12px; align-self: center; }
.check-row.met .check-state { color: var(--brand); }
.check-row.missing.required .check-state,
.check-row.missing.required .check-need,
.check-row.missing.required .intake-sum-pages { color: var(--warn); font-weight: 600; }
.check-row.missing.recommended .check-state,
.check-row.missing.recommended .check-need { color: var(--ink-3); }
.check-need { min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.check-level { display: block; color: var(--ink-3); font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.03em; }
.check-scale { display: flex; align-items: center; gap: var(--space-xs); margin: var(--space-xs) 0 0; font-size: var(--fs-xs); color: var(--ink-2); }
.check-scale.warn { color: var(--warn); font-weight: 600; }
.check-scale .icon { width: 13px; height: 13px; }
.intake-loading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 160px;
  color: var(--ink-2);
  font-size: var(--fs-md);
}

.intake-stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-width: 0;
  min-height: 0;
  align-self: start;
  max-height: 100%;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--raised);
}
.intake-card-head { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; flex: none; }
.intake-page-id { flex: none; font: 500 var(--fs-sm) var(--font-mono); color: var(--ink-2); }
.intake-file { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: var(--fs-md); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.intake-where { flex: none; color: var(--ink-3); font-size: var(--fs-sm); }
.intake-skip { flex: none; margin-left: auto; }
.intake-skip[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); }

/* The page keeps its aspect ratio and is as large as the stage width and the window height
   allow; the card then ends under the page, with no empty band. */
.intake-stage-frame {
  display: grid;
  place-items: start center;
  container-type: inline-size;
}
.intake-page {
  /* The other parts of the screen above and below the page are about 300 px tall. */
  width: min(100cqw, (100vh - 300px) * var(--page-ratio));
  min-width: min(100cqw, 320px);
  aspect-ratio: var(--page-ratio);
}
.intake-stage-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg); flex: none; }
.intake-stage.skipped .intake-page { opacity: 0.45; filter: grayscale(1); }
.intake-stage.skipped .intake-region-chip { display: none; }

.intake-thumb {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: #F7F5F0; /* paper behind the page image, in both themes */
}
.intake-thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; user-select: none; -webkit-user-drag: none; }
.intake-thumb-missing { display: grid; place-items: center; height: 100%; color: #5F6B7E; font-size: var(--fs-sm); }
.intake-regions { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.intake-region { fill: color-mix(in srgb, var(--view) 8%, transparent); stroke: var(--view); stroke-width: 2; }
.intake-region.unsure { stroke-dasharray: 6 4; }
/* Placed in pixels by placeChips() in js/intake.js, so chips never cover each other. */
.intake-region-chip {
  position: absolute;
  max-width: 60%;
  padding: 2px 8px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--view);
  color: #FFFFFF;
  font: 600 var(--fs-sm)/18px var(--font-ui);
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 29, 48, 0.25);
}
.intake-skipped-note { color: var(--ink-3); font-size: var(--fs-sm); }

.intake-region-list { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: var(--space-sm) var(--space-lg); }
.intake-region-row { display: flex; align-items: center; gap: var(--space-sm); flex: 0 1 220px; min-width: 180px; }
.intake-swatch { flex: none; width: 12px; height: 12px; border-radius: 3px; background: var(--view); }
.intake-label-picker {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 22px 0 var(--space-sm);
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--surface) no-repeat right 6px center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 4l3 3 3-3' fill='none' stroke='%237F899C' stroke-width='1.5'/%3E%3C/svg%3E");
  color: var(--ink);
  font-size: var(--fs-md);
  cursor: pointer;
}
.intake-confidence { flex: none; min-width: 3.2em; text-align: right; font: var(--fs-sm) var(--font-mono); color: var(--ink-3); }
.intake-confidence.unsure { color: var(--warn); }
.intake-card-foot .badge .icon,
.intake-set-warnings .badge .icon { width: 11px; height: 11px; }
.intake-dpi { color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }

.intake-side { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; min-height: 0; overflow-y: auto; padding: 2px; }
.intake-side input[type="text"] {
  height: 30px;
  width: 100%;
  min-width: 0;
  padding: 0 var(--space-sm);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: var(--fs-md) var(--font-ui);
  user-select: text;
  -webkit-user-select: text;
}
.intake-side input[type="text"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--brand); }
.intake-side input[aria-invalid="true"] { border-color: var(--fail); }
.intake-optional { color: var(--ink-3); font-weight: 400; }
.intake-number-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.intake-number { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.intake-number-label { color: var(--ink-3); font-size: var(--fs-xs); }
.intake-number-input { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; }
.intake-number-input input[type="text"] { flex: 1 1 auto; font-family: var(--font-mono); font-size: var(--fs-sm); text-align: right; }
.intake-unit { flex: none; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }
.intake-mode { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }

@media (max-width: 1240px) {
  .intake-head { padding-left: var(--space-xl); padding-right: var(--space-xl); }
  .intake-body { padding-left: var(--space-xl); padding-right: var(--space-xl); }
  .intake-ai-line, .intake-set-warnings, .intake-error, .intake-blocked { margin-left: var(--space-xl); margin-right: var(--space-xl); }
}
@media (max-width: 1000px) {
  /* The form goes above the pages: the name is the first thing to check. */
  .intake-body, .intake-body.has-tray { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; overflow-y: auto; }
  /* One column: each block keeps its full height; min-height: 0 would let the grid squeeze one under the next. */
  .intake-body > * { min-height: auto; }
  .intake-side { order: -1; overflow: visible; }
  /* A scroll box counts min-height: auto as 0, so the stage shows its full height and the page scrolls instead. */
  .intake-stage { overflow: visible; max-height: none; }
  .intake-tray { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .intake-sum ul { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--space-lg); }
  .intake-tray-item { width: 168px; }
  .intake-stage-frame { container-type: inline-size; }
  .intake-page { width: 100%; }
  .intake-number-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .intake-head { padding: var(--space-md) var(--space-lg); }
  .intake-title h1 { font-size: var(--fs-xl); }
  .intake-body { padding: 0 var(--space-lg) var(--space-lg); gap: var(--space-lg); }
  .intake-ai-line, .intake-set-warnings, .intake-error, .intake-blocked { margin-left: var(--space-lg); margin-right: var(--space-lg); }
  .intake-number-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intake-count { display: none; }
}

/* ------------------------------------------------------------------ Keyboard shortcuts (?, js/shortcuts.js) */

.shortcuts {
  width: min(720px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  margin: auto;
  padding: var(--space-xl);
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-dialog);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
}
.shortcuts::backdrop { background: rgba(10, 31, 61, 0.22); }
.shortcuts h2 { margin-bottom: var(--space-lg); font-size: var(--fs-xl); font-weight: 600; }
.shortcut-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-lg) var(--space-xl); }
.shortcut-group h3 { margin-bottom: var(--space-sm); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.shortcut-group dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-sm) var(--space-md); align-items: center; }
.shortcut-group dt { display: flex; gap: 4px; }
.shortcut-group dt .key-hint { min-width: 24px; height: 22px; font-size: var(--fs-xs); opacity: 1; color: var(--ink-2); }
.shortcut-group dd { color: var(--ink-2); font-size: var(--fs-md); }
.shortcuts-actions { display: flex; justify-content: flex-end; margin-top: var(--space-xl); }
/* ------------------------------------------------------------------ Command palette (⌘K, js/palette.js) */

.palette-open { margin-left: auto; gap: var(--space-sm); color: var(--ink-2); }
.palette-open ~ .titlebar-actions { margin-left: 0; }
.palette {
  width: min(600px, calc(100vw - 48px));
  max-height: min(560px, calc(100vh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-dialog);
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sheet);
}
.palette[open] { display: flex; flex-direction: column; }
.palette::backdrop { background: rgba(10, 31, 61, 0.22); }
.palette-input {
  flex: none;
  height: 52px;
  padding: 0 var(--space-lg);
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font: var(--fs-lg) var(--font-ui);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.palette-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--space-xs) var(--space-sm) var(--space-sm); }
.palette-group { padding: var(--space-sm) var(--space-sm) 2px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.palette-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 36px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
  cursor: pointer;
}
.palette-row[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }
.palette-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.palette-hint { flex: none; color: var(--ink-3); font-size: var(--fs-sm); }
.palette-empty { padding: var(--space-lg); color: var(--ink-3); font-size: var(--fs-md); }
.palette-foot { flex: none; padding: var(--space-sm) var(--space-lg); border-top: 1px solid var(--rule); color: var(--ink-3); font-size: var(--fs-xs); }
/* ------------------------------------------------------------------ Welcome and setup check (F1-F2) */

.view-welcome { overflow-y: auto; }
.view-welcome[hidden] { display: none; }
.welcome { display: grid; place-items: center; min-height: 100%; padding: var(--space-2xl) var(--space-xl); }
.welcome-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: min(680px, 100%);
  padding: var(--space-2xl);
  border: 1px solid var(--rule);
  border-radius: var(--radius-dialog);
  background: var(--surface);
}
.welcome-mark { width: 48px; height: auto; }
.welcome-card h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; }
.welcome-lead { color: var(--ink-2); font-size: var(--fs-lg); line-height: 1.5; }
.welcome-checking { display: flex; align-items: center; gap: var(--space-sm); color: var(--ink-2); font-size: var(--fs-md); }
.setup-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.setup-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--raised);
}
.setup-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--pass-soft); color: var(--pass); }
.setup-row[data-ok="false"] .setup-mark { background: var(--warn-soft); color: var(--warn); }
.setup-mark .icon { width: 18px; height: 18px; stroke-width: 2; }
.setup-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setup-title { display: flex; align-items: center; gap: var(--space-sm); font-size: var(--fs-lg); font-weight: 600; }
.setup-message { color: var(--ink-2); font-size: var(--fs-md); }
.setup-path { min-width: 0; overflow: hidden; color: var(--ink-3); font: var(--fs-sm) var(--font-mono); white-space: nowrap; text-overflow: ellipsis; }
.welcome-actions { display: flex; align-items: center; gap: var(--space-sm); padding-top: var(--space-sm); }
.welcome-spacer { flex: 1; }
.welcome-note { color: var(--ink-3); font-size: var(--fs-sm); }
/* ------------------------------------------------------------------ Vessel tabs and pages
   Run | Export | History in the title bar (design plan section 3). Export and History are
   full-width pages over the run workspace; the Run tab is the workspace itself. */

.vessel-tabs { display: flex; align-items: stretch; gap: var(--space-2xs); flex: none; height: 100%; margin-left: var(--space-lg); }
.vessel-tabs[hidden] { display: none; }
.vessel-tabs > button {
  position: relative;
  padding: 0 var(--space-md);
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 600 var(--fs-md) var(--font-ui);
  cursor: pointer;
}
.vessel-tabs > button:hover { color: var(--ink); }
.vessel-tabs > button[aria-selected="true"] { color: var(--brand); }
.vessel-tabs > button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--space-sm);
  right: var(--space-sm);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.vessel-tabs > button:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; border-radius: var(--radius-sm); }

.view-run:not([data-vtab="run"]) > .workspace,
.view-run:not([data-vtab="run"]) > .inspector,
.view-run[data-vtab="run"] > .vessel-page { display: none; }
.vessel-page { grid-column: 1 / -1; min-height: 0; overflow-y: auto; }
.vessel-page[hidden] { display: none; }
.page-body { display: flex; flex-direction: column; gap: var(--space-lg); max-width: 880px; padding: var(--space-xl) var(--space-2xl) var(--space-2xl); }
.page-head { display: flex; align-items: center; gap: var(--space-md); min-width: 0; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.page-head-meta { min-width: 0; overflow: hidden; color: var(--ink-3); font-size: var(--fs-md); white-space: nowrap; text-overflow: ellipsis; }
.page-empty { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-xl); border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg); color: var(--ink-2); font-size: var(--fs-md); }
.page-empty .icon { flex: none; width: 24px; height: 24px; color: var(--ink-3); }

/* Export: one row per output: a toggle (check, icon, name and what it is), the size after
   export and "Show in Finder". The draft stamp is neutral ink, not amber: it is not review data. */
.export-stamp {
  padding: var(--space-md) var(--space-lg);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: var(--fs-md);
  line-height: 1.45;
}
.export-stamp strong { color: var(--text); font-weight: 600; }
.export-signoff { padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--pass); border-radius: var(--radius-sm); background: var(--pass-soft); color: var(--ink); font-size: var(--fs-md); }
.export-issues {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-md);
}
.export-issues .icon { flex: none; }
.export-list { display: flex; flex-direction: column; gap: var(--space-xs); }
/* The row is the card: the toggle fills it, the size and Show in Finder sit inside on the right. */
.export-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  padding-right: var(--space-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.export-row:hover { border-color: var(--line-strong); }
.export-row:has(> .export-toggle[aria-pressed="true"]) {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}
.export-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
  min-height: 56px;
  padding: var(--space-sm) var(--space-md);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.export-toggle:hover:not(:disabled), .export-toggle[aria-pressed="true"] { color: var(--text); }
.export-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.export-toggle:disabled { opacity: 0.6; }
.export-toggle .icon { flex: none; width: 20px; height: 20px; color: var(--text-3); }
.export-toggle[aria-pressed="true"] .icon { color: var(--accent); }
.export-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.export-name { font-weight: 600; font-size: var(--fs-lg); color: var(--text); }
.export-hint { color: var(--text-3); font-size: var(--fs-sm); line-height: 1.35; }
.export-check {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--raised);
}
.export-toggle[aria-pressed="true"] .export-check {
  border-color: var(--accent);
  background: var(--accent) no-repeat center / 11px 11px;
  /* A white check mark; data URLs are allowed by the page's img-src policy. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5.2l2 2 4-4.4' fill='none' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E");
}
.export-size { min-width: 72px; color: var(--text-2); font: var(--fs-md) var(--font-mono); text-align: right; white-space: nowrap; }
.export-size-none { color: var(--text-3); }
/* No file yet: keep the column, hide the Finder button (it has nothing to show). */
.export-finder-none { visibility: hidden; }
.export-actions { display: flex; align-items: center; gap: var(--space-sm); padding-top: var(--space-sm); }
.export-actions-spacer { flex: 1; }

/* Sources: the files the run was given (js/sources.js). The list of files on the left, the
   chosen page large on the right (the drawing viewer of the Run tab); stacked when narrow. */
.vessel-page-sources { overflow: hidden; }
.sources-page {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.sources-page[data-state="message"] { grid-template-columns: minmax(0, 880px); }
.sources-page[data-state="message"] .sources-side { border-right: 0; }
.sources-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-lg) var(--space-xl) var(--space-xl);
  border-right: 1px solid var(--line);
}
.sources-intro, .sources-panel-intro { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.sources-panel-intro { margin-bottom: var(--space-sm); }
.sources-list { display: flex; flex-direction: column; gap: var(--space-md); }
.source-group { display: flex; flex-direction: column; gap: var(--space-2xs); }
.source-group + .source-group { margin-top: var(--space-sm); }
.source-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-xs);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.source-group-title .icon { width: 14px; height: 14px; }
.source-group-count { color: var(--text-3); font-weight: 500; }
.source-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.source-row:hover { background: var(--hover); }
.source-row[aria-selected="true"] { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.source-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* An earlier version reads as history: the same row, quieter. */
.source-row[data-status="replaced"] .source-thumb { opacity: 0.6; }
.source-row[data-status="replaced"] .source-name { color: var(--text-2); }
.source-thumb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-3);
}
.source-thumb img { width: 100%; height: 100%; object-fit: contain; background: #FBFBF9; }
.source-thumb .icon { width: 20px; height: 20px; }
.source-text-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.source-name { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.source-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); color: var(--text-2); font-size: var(--fs-sm); }
.source-facts { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.4; overflow-wrap: anywhere; }
.source-row-compact { grid-template-columns: 48px minmax(0, 1fr); gap: var(--space-sm); padding: 6px; }
.source-row-compact .source-thumb { width: 48px; height: 34px; }

.source-view { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.source-view[hidden] { display: none; }
.source-view-title { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: var(--fs-md); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.source-pager { display: inline-flex; gap: 2px; margin-right: var(--space-xs); }
.source-zoom { display: inline-flex; align-items: center; gap: 2px; }
.source-pager[hidden], .source-zoom[hidden] { display: none; }
.source-page-back .icon { transform: rotate(180deg); }
.source-stage { position: relative; display: flex; flex: 1; min-height: 0; }
.source-host[hidden], .source-text[hidden], .source-message[hidden] { display: none; }
.source-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-xl);
  color: var(--text-2);
  font-size: var(--fs-md);
  text-align: center;
  pointer-events: none;
}
.source-message strong { color: var(--text); }
.source-text {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow: auto;
  padding: var(--space-lg);
  background: var(--surface-sunken);
  color: var(--text);
  font: var(--fs-sm) / 1.5 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.source-text:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.source-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-xs) var(--space-lg);
  max-height: 30%;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.source-details dt { color: var(--text-3); }
.source-details dd { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.source-details dd.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.source-error .btn { margin-left: auto; }

@media (max-width: 1000px) {
  /* One column: the list above, the page below at a usable height; the page scrolls. */
  .vessel-page-sources { overflow-y: auto; }
  .sources-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(460px, 1fr); height: auto; min-height: 100%; }
  .sources-side { max-height: 42vh; padding: var(--space-lg); border-right: 0; border-bottom: 1px solid var(--line); }
  .source-view { min-height: 460px; }
  .source-details { max-height: none; }
}

/* History: every run of the vessel. */
.history-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.history-row {
  display: grid;
  grid-template-columns: 72px auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  min-height: 48px;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.history-row:hover { border-color: var(--rule-strong); }
.history-row[aria-current="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.history-run { font-weight: 600; white-space: nowrap; }
.history-facts { min-width: 0; overflow: hidden; color: var(--ink-3); white-space: nowrap; text-overflow: ellipsis; }
.history-time { color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; }
.history-chips { display: inline-flex; gap: var(--space-xs); justify-self: end; }

/* Parts (js/parts.js): tree | sketches and the selected part. */
.parts-page { max-width: 1240px; }
.parts-head { flex-wrap: wrap; }
.parts-progress { display: flex; align-items: center; gap: var(--space-sm); margin-left: auto; }
.parts-progress-text { color: var(--ink-2); font-size: var(--fs-md); white-space: nowrap; }
.parts-progress-text strong { color: var(--ink); font: 500 var(--fs-lg) var(--font-mono); }
.parts-progress-bar { position: relative; width: 120px; height: 6px; overflow: hidden; border-radius: 3px; background: var(--rule); }
.parts-progress-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--brand); }
.parts-layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.parts-tree { display: flex; flex-direction: column; gap: var(--space-md); }
.parts-group h2 { margin-bottom: var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.parts-group ul { display: flex; flex-direction: column; gap: 2px; }
.parts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 100%;
  min-height: 36px;
  padding: 0 var(--space-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.parts-row:hover { background: var(--hover); }
.parts-row[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.parts-name { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; } /* long labels wrap to two lines */
.parts-row .badge { flex: none; }
.parts-main { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }
.parts-sketches { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-md); align-items: start; }
.parts-sketch { margin: 0; padding: var(--space-sm) var(--space-md) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.parts-sketch figcaption { margin-bottom: var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.parts-sketch svg { display: block; width: 100%; height: auto; overflow: visible; } /* the focus ring may pass the edge */
.parts-box { fill: color-mix(in srgb, var(--ink-3) 10%, transparent); stroke: color-mix(in srgb, var(--ink-3) 65%, var(--surface)); /* muted: in dark, ink-3 is close to the brand blue of the selected part */ stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; }
.parts-box[data-status="draft_guess"] { stroke: var(--guess-ink); stroke-dasharray: 5 3; fill: color-mix(in srgb, var(--guess-ink) 10%, transparent); }
/* A tank's real outline: filled with its capacity-plan colour; a guessed value keeps the dashed amber edge. */
.parts-outline polygon { fill: color-mix(in srgb, var(--tank-fill) 78%, transparent); stroke: color-mix(in srgb, var(--tank-fill) 55%, var(--ink)); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; }
.parts-outline[data-status="draft_guess"] polygon { stroke: var(--guess-ink); stroke-dasharray: 5 3; }
.parts-outline.selected polygon { stroke: var(--brand); stroke-width: 3; stroke-dasharray: none; }
.parts-focus { fill: none; stroke: var(--brand); stroke-width: 2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.parts-box.selected { stroke: var(--brand); stroke-width: 3.2; stroke-dasharray: none; fill: color-mix(in srgb, var(--brand) 16%, transparent); }
.parts-detail { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.parts-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.parts-detail-head h2 { font-size: var(--fs-xl); font-weight: 600; }
.parts-reason { color: var(--ink-2); font-size: var(--fs-md); }
.parts-box-line { color: var(--ink-2); font: var(--fs-sm) var(--font-mono); }
.parts-args { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.parts-args th, .parts-args td { padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.parts-args thead th { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.parts-args tbody th { font-weight: 600; white-space: nowrap; }
.parts-value { font-family: var(--font-mono); font-size: var(--fs-sm); white-space: nowrap; }
.parts-basis { color: var(--ink-2); font-size: var(--fs-sm); }
.parts-args tr[data-source="guessed"] { background: var(--guess-soft); }
.parts-note { display: flex; align-items: center; gap: var(--space-sm); color: var(--warn); font-size: var(--fs-sm); }
/* Mark a part: the person's words are brand blue (a person's mark), not amber (review data). */
.parts-mark { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md); border: 1px solid var(--brand); border-radius: var(--radius-md); background: var(--brand-soft); }
.parts-mark textarea { width: 100%; min-height: 72px; padding: var(--space-sm); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--raised); color: var(--ink); font: var(--fs-md)/1.45 var(--font-ui); resize: vertical; user-select: text; -webkit-user-select: text; }
.parts-mark-actions { display: flex; align-items: center; gap: var(--space-sm); }
.parts-mark-count { color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }
.parts-marked { padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--ink); font-size: var(--fs-md); }
/* Re-run a part from its mark: the AI acted here, so the new revision is teal. */
.parts-rerun-offer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-md); }
.parts-rerun { display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--raised); color: var(--ink); font-size: var(--fs-md); }
.parts-rerun .spinner { flex: none; margin-top: 5px; }
.parts-rerun-time { font-family: var(--font-mono); color: var(--ink-2); }
.parts-revision { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-md); border: 1px solid var(--ai); border-radius: var(--radius-md); background: var(--ai-soft); }
.parts-revision h3 { font-size: var(--fs-lg); font-weight: 600; }
.parts-revision-note { color: var(--ink); font-size: var(--fs-md); }
.parts-revision-hint { color: var(--ink-2); font-size: var(--fs-sm); }
.parts-changes .parts-value { white-space: normal; }
/* Sign-off: product navy ("pass"), never green and never the word approved. */
.parts-signoff { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-md); padding: var(--space-md) var(--space-lg); border: 1px dashed var(--rule-strong); border-radius: var(--radius-md); color: var(--ink-2); font-size: var(--fs-md); }
.parts-signoff p { flex: 1 1 320px; min-width: 0; }
.parts-signoff input { flex: 0 1 220px; height: 32px; padding: 0 var(--space-sm); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--raised); color: var(--ink); font: var(--fs-md) var(--font-ui); user-select: text; -webkit-user-select: text; }
.parts-signoff.is-signed { border-style: solid; border-color: var(--pass); background: var(--pass-soft); color: var(--ink); }
.parts-signoff.is-signed > .icon { flex: none; width: 20px; height: 20px; color: var(--pass); stroke-width: 2; }
.parts-signoff-note { color: var(--ink-3); }
/* Tank tables (js/tanks.js): capacity plan, group totals, sounding table. Drafts with source labels. */
.tank-detail h3, .tank-sounding h3 { font-size: var(--fs-lg); font-weight: 600; }
.tank-detail { display: flex; flex-direction: column; gap: var(--space-xs); }
.tank-plan { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-xl); padding: var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.tank-plan h2 { font-size: var(--fs-xl); font-weight: 600; }
.tank-groups { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); color: var(--ink-2); font: var(--fs-sm) var(--font-mono); }
.tank-table-scroll { max-height: 420px; overflow: auto; }
.tank-table thead th { position: sticky; top: 0; background: var(--surface); }
.tank-table tr[data-source="guessed"] { background: var(--guess-soft); }
.tank-table tr.is-selected { box-shadow: inset 3px 0 0 var(--brand); background: var(--brand-soft); }
.tank-pick { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.tank-pick:hover { text-decoration: underline; }
.tank-sounding { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-md); }
/* Dense table (js/data_table.js): long engineering lists. Compact, thin row lines, no zebra. */
.table-wrap { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.table-bar { display: flex; align-items: center; gap: var(--space-sm); }
.table-search { flex: 1 1 auto; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-sm); }
.table-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.table-count { flex: none; color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.table-scroll { max-height: 480px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.data-table th, .data-table td { padding: 2px var(--space-sm); border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table thead th { position: sticky; top: 0; z-index: 1; padding: 0; background: var(--surface); border-bottom: 1px solid var(--rule-strong); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.table-sort { display: flex; align-items: center; gap: var(--space-2xs); width: 100%; height: 26px; padding: 0 var(--space-sm); border: 0; background: none; color: inherit; font: inherit; white-space: nowrap; cursor: pointer; }
.table-sort .icon { width: 12px; height: 12px; color: var(--ink-3); transform: rotate(90deg); transition: transform var(--dur-fast); visibility: hidden; }
.table-sort[data-active="true"] .icon { visibility: visible; }
.data-table th[aria-sort="descending"] .table-sort .icon { transform: rotate(-90deg); }
.table-sort[data-active="true"] { color: var(--ink); }
.data-table th[aria-sort] .table-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--hover); }
.table-body:focus-visible, .data-table tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.data-table tbody tr.is-selected, .data-table tbody tr.is-selected:hover { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.data-table td.table-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-empty { padding: var(--space-md) var(--space-sm); color: var(--ink-3); font-size: var(--fs-sm); }
@media (max-width: 900px) {
  .parts-layout { grid-template-columns: minmax(0, 1fr); }
  .parts-sketches { grid-template-columns: minmax(0, 1fr); }
}
/* Changes in a run (js/changes.js): one card per scored revision, oldest first. */
.page-subtitle { margin-top: var(--space-lg); font-size: var(--fs-xl); font-weight: 600; }
.changes { display: flex; flex-direction: column; gap: var(--space-md); }
.change-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.change { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.change-not-kept { border-style: dashed; border-color: var(--warn-ink); background: var(--warn-soft); }
.change-head { display: flex; align-items: center; gap: var(--space-md); min-width: 0; font-size: var(--fs-md); }
.change-rev { flex: none; padding: 1px var(--space-sm); border-radius: var(--radius-sm); background: var(--brand); color: var(--on-brand); font: 500 var(--fs-sm) var(--font-mono); }
.change-rev-x { display: inline-grid; place-items: center; background: var(--warn-ink); color: #FFFFFF; }
.change-rev-x .icon { width: 12px; height: 12px; stroke-width: 2; }
.change-fit { font: var(--fs-md) var(--font-mono); color: var(--ink-2); }
.change-delta[data-trend="up"] { color: var(--pass); font-weight: 500; }
.change-delta[data-trend="down"] { color: var(--warn); font-weight: 500; }
.change-cause { color: var(--ink-2); font-size: var(--fs-md); overflow-wrap: anywhere; }
.change-sections { display: flex; flex-direction: column; gap: 2px; margin-top: var(--space-xs); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.change-section { display: flex; gap: var(--space-md); color: var(--ink-2); font-size: var(--fs-sm); }
.change-x { flex: none; min-width: 56px; font: 500 var(--fs-sm) var(--font-mono); color: var(--ink); }
/* A Mark and revise pass: thumbnail of the marked area | what was asked, done and kept. */
.change-mark { flex-direction: row; align-items: flex-start; gap: var(--space-md); border-left: 3px solid var(--brand); }
.change-mark[data-outcome="not_kept"], .change-mark[data-outcome="stopped"] { border-left-color: var(--warn-ink); }
.change-thumb { flex: none; width: 168px; height: 120px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #F7F5F0; }
.change-mark-body { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.change-who { color: var(--brand); font-weight: 600; }
.change-instruction { margin: 0; color: var(--ink); font-size: var(--fs-md); font-style: italic; overflow-wrap: anywhere; }
.change-why { color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Mark and revise (js/mark.js)
   The person's mark is brand blue. Teal stays for AI activity, amber for review. */

.mark-toggle[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.mark-overlay { position: absolute; inset: 0; z-index: 3; cursor: crosshair; touch-action: none; }
.mark-overlay[hidden] { display: none; }
.mark-preview { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mark-shape { fill: var(--brand-ghost); fill-opacity: 0.35; stroke: var(--brand); stroke-width: 2; stroke-dasharray: 6 4; }
.mark-hint {
  position: absolute; top: var(--space-sm); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  border-radius: var(--radius-lg); background: var(--raised); box-shadow: var(--shadow-sheet);
  font-size: var(--fs-sm); color: var(--ink-2); cursor: default; white-space: nowrap; max-width: calc(100% - 16px);
}
.mark-hint span { overflow: hidden; text-overflow: ellipsis; }
.mark-hint .btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.mark-popover {
  position: absolute; width: 320px; max-width: calc(100% - 16px);
  display: flex; flex-direction: column; gap: var(--space-sm);
  padding: var(--space-md); border-radius: var(--radius-dialog);
  background: var(--raised); box-shadow: var(--shadow-sheet); cursor: default;
}
.mark-popover-docked { left: 50%; bottom: var(--space-lg); transform: translateX(-50%); }
.mark-place { margin: 0; font-size: var(--fs-sm); color: var(--ink-3); }
.mark-chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.mark-chip { cursor: pointer; }
.mark-chip:hover { background: var(--brand-soft); color: var(--brand); }
.mark-text {
  width: 100%; resize: vertical; min-height: 64px; padding: var(--space-sm);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-md);
}
.mark-error { margin: 0; font-size: var(--fs-sm); color: var(--fail); }
.mark-actions { display: flex; align-items: center; gap: var(--space-xs); }
.mark-count { margin-right: auto; font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.strip.mark-picking .tile, #strip.mark-picking .tile { cursor: crosshair; outline: 1px dashed var(--brand-ghost); outline-offset: -3px; }
.mark-result-actions { display: flex; justify-content: flex-end; margin-top: var(--space-xs); }
.mark-keep { border-color: var(--warn-ink); color: var(--warn); }
.mark-forced { margin: var(--space-xs) 0 0; font-size: var(--fs-sm); color: var(--warn); }
.mk-box.tone-person, .mk-line.tone-person { stroke: var(--brand); stroke-width: calc(var(--u) * 2px); stroke-dasharray: calc(var(--u) * 8px) calc(var(--u) * 5px); }

/* ================================================================== Icon chips and tooltips
   (js/glyphs.js, js/tooltip.js). An icon (and a count) stands for a word; the word is the
   accessible name and the tooltip title, the explanation is the tooltip detail. */

.badge-glyphchip { gap: 3px; padding: 0 5px; }
.badge-glyphchip.badge-small { padding: 0 4px; }
.badge-glyphchip .badge-glyph { width: 12px; height: 12px; }
.badge-glyphchip:not(.badge-small) .badge-glyph { width: 14px; height: 14px; }
.badge-count { font: 600 var(--fs-xs)/1 var(--font-mono); }
.badge-glyphchip[tabindex] { cursor: help; }
.badge-glyphchip[data-tone="draft"] .badge-glyph { stroke-width: 1.7; }

/* Shared tooltip: title first, a ring fills, then the detail. Fixed, so no pane clips it. */
.tip {
  --tip-ring-ms: 1000ms; /* tooltip.js RING_MS */
  position: fixed;
  z-index: 60;
  max-width: 260px;
  pointer-events: auto;
  cursor: default;
}
.tip-head { display: flex; align-items: center; gap: var(--space-sm); font-weight: 600; }
.tip-ring { flex: none; width: 12px; height: 12px; transform: rotate(-90deg); }
.tip-ring circle { fill: none; stroke-width: 1.6; }
.tip-ring-track { stroke: rgba(230, 237, 247, 0.25); }
.tip-ring-fill { stroke: #8FB4E8; stroke-dasharray: 1; stroke-dashoffset: 1; }
.tip-ring-run .tip-ring-fill { animation: tip-ring var(--tip-ring-ms) linear forwards; }
.tip[data-state="detail"] .tip-ring { display: none; }
.tip-detail { margin: 4px 0 0; color: #C9D5E6; font-weight: 400; white-space: pre-line; }
.tip-detail:empty { display: none; }
@keyframes tip-ring { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .tip-ring-run .tip-ring-fill { animation: none; }
}

/* Icon legend: one popover with every glyph, its word and what it means. */
.legend-pop { position: relative; }
.legend-pop summary { list-style: none; cursor: pointer; }
.legend-pop summary::-webkit-details-marker { display: none; }
.legend-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px var(--space-md);
  width: max-content;
  max-width: 340px;
  margin: 0;
  padding: var(--space-md);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--raised);
  box-shadow: 0 6px 20px rgba(10, 31, 61, 0.18);
  font-size: var(--fs-sm);
}
.legend-list dt { display: flex; align-items: center; gap: var(--space-sm); font-weight: 600; color: var(--ink); white-space: nowrap; }
.legend-list dd { margin: 0; color: var(--ink-2); }

.parts-link .icon { width: 14px; height: 14px; }

/* Strip head: flag, open count, total. */
.strip-head .strip-count { display: inline-flex; align-items: center; gap: 4px; cursor: help; }
.strip-count[data-open="true"] .icon { color: var(--warn); }

/* Tiles: state and source as icons beside the place. */
.tile-head .badge-glyphchip { flex: none; }

/* Section explanations on demand. */
.selection-source summary .icon:not(.chevron) { width: 14px; height: 14px; color: var(--ink-3); }
.selection-fact { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); font-family: var(--font-mono); font-size: var(--fs-xs); }
.selection-why-word { margin-left: var(--space-xs); color: var(--ink-3); }
.selection-source summary { max-width: 100%; }
.selection-why { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-xs); }
.selection-why p { margin: 0; }
.why-lines { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--space-sm); margin: 0; }
.why-lines dt { font-weight: 600; color: var(--ink); }
.why-lines dd { margin: 0; }
.cand-key { cursor: help; color: var(--ink-3); }
.cand-label[data-tip-detail] { cursor: help; text-decoration: underline dotted var(--rule-strong); text-underline-offset: 3px; }

/* Thinking cards: long quotes and results show one (or two) lines until clicked open. */
.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.clamped[data-lines="2"] { -webkit-line-clamp: 2; }
.clamped[aria-expanded="true"] { display: block; -webkit-line-clamp: unset; cursor: text; user-select: text; -webkit-user-select: text; }
.thought-sub { color: var(--ink-2); font-size: var(--fs-sm); }
.narration > .icon { color: var(--brand); width: 12px; height: 12px; }
.strip-head { width: auto; }

/* ---- 3D view tools (js/controls3d.js): the tool bar at the top left and the section cut panel. */
.model-controls {
  position: absolute; top: var(--space-sm); left: var(--space-sm); max-width: calc(100% - 2 * var(--space-sm));
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  pointer-events: none;
}
/* One row: groups that do not fit go into the More menu (createToolbar().fit in controls3d.js). */
.model-tools { display: flex; flex-wrap: nowrap; gap: 6px; }
.model-tools-more { position: relative; }
.model-tools-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.model-tools-menu[hidden] { display: none; }
.model-tools-group {
  display: inline-flex; gap: 1px; padding: 2px;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  pointer-events: auto;
}
.model-tool {
  display: inline-flex; align-items: center; gap: 5px; min-height: 28px; min-width: 28px;
  padding: 0 7px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.model-tool:hover { background: var(--hover); color: var(--ink); }
.model-tool[aria-pressed="true"] { background: var(--selected); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.model-tool:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-tool .icon { width: 15px; height: 15px; }
.model-cut {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 100%; padding: 3px 4px 3px 6px;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--ink); font-size: 12px;
  cursor: default; pointer-events: auto;
}
.model-cut[hidden] { display: none; }
.model-cut-axes { display: inline-flex; padding: 1px; border-radius: var(--radius-sm); background: var(--hover); }
.model-cut-choice { padding: 2px 7px; border-radius: var(--radius-sm); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.model-cut-choice:has(input:checked) { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line-strong); }
.model-cut-choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-cut-slider { flex: 1 1 110px; min-width: 90px; accent-color: var(--accent); }
.model-cut-readout { min-width: 9.5ch; font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }

/* ---- Part list of the 3D view (js/parts_panel3d.js): search, Show all, one row per part. */
.model-tools-group[hidden] { display: none; }
/* The part list and the fact card share one column at the right of the 3D view. */
.model-side {
  position: absolute; top: 48px; right: var(--space-sm); bottom: 44px; z-index: 2;
  width: min(256px, calc(100% - 2 * var(--space-sm))); display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.model-side > * { pointer-events: auto; }
.model-panel {
  flex: 1 1 110px; min-height: 72px; display: flex; flex-direction: column; padding: 6px;
  border-radius: var(--radius-md); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--ink); font-size: 12px;
  cursor: default;
}
.model-panel[hidden], .model-panel-body[hidden] { display: none; }
.model-panel-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.model-space-glyph { flex: none; display: inline-flex; color: var(--ink-2); }
.model-space-glyph .icon { width: 14px; height: 14px; }
.model-space-builder { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.model-space-builder[hidden] { display: none; }
.model-space-label { color: var(--text-3); font-size: 11px; }
.model-space-select {
  flex: 1 1 70px; min-width: 0; height: 26px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 11px;
}
.model-space-select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-space-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 2px 2px 8px; border-radius: var(--radius-md);
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--surface) 95%, transparent); color: var(--ink); font-size: 12px; pointer-events: auto;
}
.model-space-chip[hidden] { display: none; }
.model-space-chip .icon { width: 14px; height: 14px; flex: none; }
.model-space-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.model-panel-head { display: flex; align-items: center; gap: 4px; }
.model-part-search {
  flex: 1 1 auto; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12px;
}
.model-part-search:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-part-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; align-content: start; }
.model-part { display: flex; align-items: center; gap: 1px; border-radius: var(--radius-sm); }
.model-part[hidden] { display: none; }
.model-part:hover, .model-part.is-picked { background: var(--hover); }
.model-part.is-picked { box-shadow: inset 0 0 0 1px var(--accent); }
.model-part-main {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; background: transparent;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.model-part-main:focus-visible, .model-part-tool:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.model-part-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-part-detail { flex: none; color: var(--text-3); font-size: 11px; }
.model-part-tool {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer;
}
.model-part-tool:hover { background: var(--hover); color: var(--ink); }
.model-part-tool[aria-pressed="true"] { background: var(--selected); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.model-part-tool .icon { width: 15px; height: 15px; }
.model-part[data-state="hidden"] .model-part-main { color: var(--text-3); text-decoration: line-through; }
.model-part[data-state="hidden"] .model-swatch, .model-part[data-state="ghost"] .model-swatch { opacity: 0.35; }
.model-part[data-state="ghost"] .model-part-main { color: var(--ink-2); font-style: italic; }
.model-part-none { margin: 4px 6px; color: var(--text-3); }
.model-part-none[hidden] { display: none; }
.model-space-none { display: flex; flex-direction: column; gap: 2px; }
.model-space-none strong { color: var(--ink); font-weight: 600; }
.model-part-summary { margin: 0 2px; min-height: 0; color: var(--text-3); font-size: 11px; }
.model-part-summary:empty { display: none; }
/* The card grows to its content inside the side column; it scrolls only when the pane is too short. */
.model-card {
  flex: 0 1 auto; min-height: 0; margin-top: auto; overflow-y: auto; padding: 6px 8px 8px; border-radius: var(--radius-md); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--ink); font-size: 12px; cursor: default;
}
.model-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.model-card.is-collapsed .model-card-head { margin-bottom: 0; }
.model-card-toggle { border: 0; background: transparent; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; align-items: stretch; }
.model-card-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.model-card-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.model-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-card-title span { color: var(--text-3); font-size: 11px; }
.model-card-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; }
.model-card-facts dt { color: var(--ink-2); }
.model-card-facts dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: 11px; display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.model-card-note { margin: 6px 0 0; color: var(--text-3); font-size: 11px; }
.model-card-link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 3px 7px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; text-align: left;
}
.model-card-link:hover { background: var(--hover); }
.model-card-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-card-link .icon { width: 14px; height: 14px; flex: none; }
/* Docked in a free corner of the 3D pane while the details column is folded (js/model3d.js places it). */
.model-card.is-docked {
  position: absolute; z-index: 2; width: min(240px, calc(100% - 2 * var(--space-sm)));
  max-height: calc(100% - 140px); margin: 0;
}
.model-card.is-docked .model-card-toggle:hover strong { text-decoration: underline; }
/* In the details column: the picked part above the section review. */
.inspector-part { flex: none; max-height: 40%; overflow-y: auto; padding: var(--space-sm) var(--space-lg); border-bottom: 1px solid var(--line); }
.inspector-part[hidden] { display: none; }
.model-card.is-column { padding: 0; border: 0; background: transparent; font-size: var(--fs-sm); }
.model-card.is-column .model-card-facts dd { font-size: var(--fs-xs); }
/* Hover in 3D: the part's name and source chip only, beside the part (js/model3d.js places it). */
.model-hover-tag {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
  padding: 2px 4px 2px 7px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); font-size: 12px; line-height: 18px;
  white-space: nowrap; pointer-events: none;
}
.model-hover-tag[hidden] { display: none; }
.model-hover-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* ---- 3D overlays (js/overlay3d.js): frame numbers, pointer readout, scale, axes and stamp. */
.model-frame-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.model-frame-label {
  position: absolute; transform: translate(-50%, 2px);
  color: var(--ink-2); font-family: var(--font-mono); font-size: 10px; line-height: 12px;
  text-shadow: 0 0 2px var(--model-bg), 0 0 2px var(--model-bg);
  white-space: nowrap;
}
.model-readout {
  position: absolute; top: 48px; right: var(--space-sm); max-width: calc(100% - 2 * var(--space-sm));
  padding: 2px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
  font-family: var(--font-mono); font-size: 11px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.model-readout[hidden], .model-corner[hidden] { display: none; }
.model-corner {
  position: absolute; right: var(--space-sm); bottom: var(--space-sm);
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  padding: 4px 6px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--model-bg) 82%, transparent);
  color: var(--ink-2); font-size: 11px; pointer-events: none; text-align: right;
}
/* With no model the empty-state text is alone: no tools, overlays or stamp. */
.pane-model:has(.pane-empty:not([hidden])) :is(.model-controls, .model-corner, .model-readout, .model-frame-labels) { display: none; }
.model-corner-row { display: flex; align-items: flex-end; gap: 10px; }
.model-scale { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-family: var(--font-mono); }
.model-scale-bar { display: block; height: 6px; border: 1.5px solid var(--ink-2); border-top: 0; }
.model-triad { overflow: visible; }
.model-triad line { stroke-width: 2; stroke-linecap: round; }
.model-triad text { font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.model-triad .model-triad-x { stroke: var(--axis-x); fill: var(--axis-x); }
.model-triad .model-triad-y { stroke: var(--axis-y); fill: var(--axis-y); }
.model-triad .model-triad-z { stroke: var(--axis-z); fill: var(--axis-z); }
.model-triad text { stroke: none; }
.model-reference { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; }
.model-badge {
  display: inline-block; padding: 0 5px; border-radius: 999px; border: 1px solid currentColor;
  font-family: var(--font-ui); font-size: 10px; font-weight: 600; line-height: 15px; pointer-events: auto;
}
.model-badge[hidden] { display: none; }
.model-badge[data-tone="guess"] { color: var(--guess-text); border-style: dashed; }
.model-badge[data-tone="draft"] { color: var(--guess-text); }
@container pane (max-width: 560px) {
  /* A narrow pane keeps the scale, axes and stamp; the reference line is in the readout title. */
  .model-reference-text { display: none; }
  .model-tool { padding: 0 5px; }
  /* Parts and Spaces show their icons only, so See-through, Parts and Spaces stay on one row. */
  .model-tool[data-short] .model-tool-text { display: none; }
}

/* History and export: icon facts in a line of text. */
.change-what { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.change-ink { font-family: var(--font-mono); font-size: var(--fs-xs); }
.export-issues .badge-glyphchip { margin-left: 2px; }
.needs-why.chip-row { min-height: 18px; }
.intake-optional { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Accuracy summary (accuracy.js): a chip per output on the run page, a block on the Export page. */
.accuracy-chips { display: inline-flex; align-items: center; gap: var(--space-xs); }
.export-accuracy { display: flex; flex-direction: column; gap: var(--space-xs); font-size: var(--fs-md); }
.export-accuracy-title { display: flex; align-items: center; gap: var(--space-xs); margin: 0; font-size: var(--fs-md); }
.export-accuracy-note { margin: 0; color: var(--text-3); }
.export-accuracy-line { display: flex; align-items: flex-start; gap: var(--space-sm); margin: 0; }
.export-accuracy-line .badge { flex: none; }

/* A partial run keeps its work area; sheet recovery is a compact row above it. */
.sheet-review { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.sheet-strip { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.sheet-item { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sheet-name { font-weight: 600; }
.sheet-reason { max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-draft-note { margin: 6px 0 0; color: var(--ink-3); font-size: 11px; }
.sheet-requests { margin-top: 6px; }
.sheet-requests summary { cursor: pointer; }
.sheet-requests ul, .sheet-history ul { list-style: none; padding: 0; margin: 8px 0; }
.sheet-requests li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.sheet-requests small, .sheet-history small { color: var(--ink-3); }
.sheet-history { margin: 20px 0; }
.sheet-history li { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* A narrow 3D pane (an 800 px window): a slimmer part list so the section cut strip stays reachable. */
@container pane (max-width: 520px) {
  .model-side { width: min(206px, calc(100% - 2 * var(--space-sm))); }
  .model-part-detail { display: none; }
}

/* Source view (js/provenance.js, docs/SOURCE_RECORD.md): the sheet a part came from covers the
   drawing, zoomed to its region, with a line from the part in 3D. Read: blue, solid. Guess:
   amber, dashed, "best guess". Unknown or no record: a note, no line. */
.stage { position: relative; }
.source-peek {
  position: absolute; inset: 36px 0 0 0; z-index: 4;
  display: flex; flex-direction: column; gap: var(--space-sm);
  padding: var(--space-md); background: var(--surface-sunken);
  border-top: 2px solid var(--brand);
}
.source-peek[data-tone="guess"] { border-top: 2px dashed var(--guess-ink); }
.source-peek[data-tone="unknown"], .source-peek[data-tone="none"] { border-top-color: var(--rule-strong); }
.source-peek[hidden] { display: none; }
/* Nothing to show (unknown or no record): a short note over the top of the drawing. */
.source-peek[data-sheets="0"] { bottom: auto; box-shadow: var(--shadow-sheet); }
.source-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-xs) var(--space-sm); }
.source-label { font-size: var(--fs-md); font-weight: 600; }
.source-chip {
  font-size: var(--fs-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--radius-chip);
  border: 1px solid transparent;
}
.source-chip.read { background: var(--brand-soft); color: var(--brand); }
.source-chip.guess { background: var(--guess-soft); color: var(--guess-text); border: 1px dashed var(--guess-ink); }
.source-chip.unknown, .source-chip.none { background: var(--sunken); color: var(--ink-3); border-color: var(--rule); }
.source-detail { flex-basis: 100%; margin: 0; font-size: var(--fs-sm); color: var(--ink-2); }
.source-body { position: relative; flex: 1; min-height: 0; display: grid; gap: var(--space-sm); grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr)); }
.source-body[data-count="2"] { --rows: 2; }
.source-body[data-count="3"] { --rows: 3; }
.source-tile {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--raised); border: 1px solid var(--rule); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sheet); overflow: hidden;
}
.source-tile-head { display: flex; gap: var(--space-sm); align-items: baseline; padding: var(--space-xs) var(--space-sm); border-bottom: 1px solid var(--rule); font-size: var(--fs-xs); }
.source-tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-tile-meta { color: var(--ink-3); white-space: nowrap; }
.source-tile-body { position: relative; flex: 1; min-height: 0; }
.source-sheet { display: block; width: 100%; height: 100%; }
.source-sheet-paper { fill: #fff; }
.source-tile-note { padding: var(--space-md); font-size: var(--fs-sm); color: var(--ink-3); }
.source-tile-note.floating { position: absolute; left: var(--space-sm); bottom: var(--space-sm); padding: 2px 8px; background: var(--raised); border-radius: var(--radius-sm); }
.source-region { fill: var(--brand-ghost); fill-opacity: 0.35; stroke: var(--brand); stroke-width: 2.5; }
.source-region.guess { fill: var(--guess-soft); fill-opacity: 0.5; stroke: var(--guess-ink); stroke-dasharray: 6 4; }
/* The stacked sheets that fan away before the source settles (not with reduced motion). */
.source-stack { position: absolute; inset: 8% 10%; pointer-events: none; }
.source-paper {
  position: absolute; inset: 0; background: var(--raised); border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sheet);
  background-image: repeating-linear-gradient(0deg, transparent 0 22px, var(--rule) 22px 23px);
}
.source-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: visible; }
.source-link { fill: none; stroke-width: 2; stroke-linecap: round; }
.source-link.read { stroke: var(--brand); }
.source-link.guess { stroke: var(--guess-ink); stroke-dasharray: 7 5; }
.source-dot.read { fill: var(--brand); }
.source-dot.guess { fill: var(--guess-ink); }
.source-part-ring { fill: none; stroke: var(--guess-ink); stroke-width: 2; stroke-dasharray: 3 3; }
.source-guess-label rect { fill: var(--guess-soft); stroke: var(--guess-ink); stroke-dasharray: 3 2; }
.source-guess-label text { font: 600 var(--fs-xs) var(--font-ui); fill: var(--guess-text); }
@media (prefers-reduced-motion: reduce) {
  .source-stack { display: none; }
}
/* The one note of the light guess form (js/guess3d.js): most of the hull is guessed. */
.model-guess-note {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: var(--radius-md);
  border: 1px dashed var(--guess-ink); background: var(--guess-soft); color: var(--guess-text); font-size: 12px;
}
.model-guess-note[hidden] { display: none; }
.model-guess-note .icon { width: 14px; height: 14px; flex: none; }

/* ---------------------------------------------------------------- GA reading (ga_panel.js) */
/* A GA run has no 3D model: the panel fills the 3D pane. Each row shows its source on hover. */
.ga-panel {
  position: absolute; inset: 36px 0 0 0; overflow-y: auto; padding: var(--space-md) var(--space-lg) var(--space-xl);
  background: var(--surface); color: var(--ink); font-size: var(--fs-sm);
}
.ga-panel[hidden] { display: none; }
.ga-head { margin-bottom: var(--space-md); }
.ga-title { margin: 0; font-size: var(--fs-xl); }
.ga-meta { margin: 2px 0 0; color: var(--text-2); }
.ga-section { margin-top: var(--space-lg); }
.ga-section-title { margin: 0 0 var(--space-xs); font-size: var(--fs-md); }
.ga-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.ga-row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: var(--space-sm); align-items: baseline;
  padding: 5px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit;
  text-align: left; cursor: pointer;
}
.ga-row:hover, .ga-row:focus-visible, .ga-row[aria-pressed="true"] { background: var(--hover); }
.ga-row[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.ga-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ui-p0-value: one quantity layout, using the shared theme and badge tokens. */
.vd {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-xs);
  font-variant-numeric: tabular-nums;
}
.vd-value, .vd-unit { font-family: var(--font-mono); }
.vd-unc { color: var(--text-2); }
.vd-unit:empty, .vd-unc:empty { display: none; }
.vd .badge { font-size: var(--fs-xs); }
.vd:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }
.ga-row > .vd { justify-content: flex-end; }
.ga-row .vd-status { min-width: 6.5em; justify-content: center; }
.ga-unknown .vd-value { color: var(--text-2); }
/* ui-p0-value: allow quantity status chips to wrap in dense parts and export rows. */
.parts-value .vd { white-space: normal; }
.export-accuracy-values { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

/* ============================================================ Public web demo (docs/WEB_DEMO.md)
   js/app.js sets [data-demo="read-only"] on <html> with the static backend. The demo shows
   finished runs: every control that starts or changes a run is left out, and the backend
   refuses those commands with "Demo: read-only" anyway. */
.demo-only { display: none; }
[data-demo="read-only"] .demo-only { display: revert; }
[data-demo="read-only"] :is(#new-vessel, #home-more, #drop-tile, #needs-row, #home-queue-link, #try-sample) { display: none; }
/* Desktop items that mean nothing to a visitor: the vessel list (replaced by the entry cards),
   the AI and runs-folder status and the Queue. The "Demo: read-only" chip stays. */
[data-demo="read-only"] :is(#home-vessels-title, #vessel-grid, #status-ai, #status-folder, #status-mode, .rail-item[data-route="queue"], .rail-item[data-route="home"]) { display: none; }

/* The language switch of the web demo, in the title bar of every page (js/settings_view.js). */
[data-demo="read-only"] .lang-switch { display: inline-flex; }
.lang-switch { flex: none; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-md); }
.lang-switch button { padding: 3px 10px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.lang-switch button + button { border-left: 1px solid var(--rule); }
.lang-switch button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand, #fff); font-weight: 600; }
.lang-switch button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* The web demo's design workspace: no construction or use chips; the record's warnings as one
   quiet line with a count (js/designs.js demoNotes). */
[data-demo="read-only"] .badge-fact:is([data-scope="construction"], [data-scope="uses"], [data-scope="data"]) { display: none; }
.design-notes { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-sm); min-width: 0; }
.design-notes .design-warning-full { width: 100%; padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.design-notes .design-warning-full h3 { margin: 0 0 var(--space-2xs); font-size: var(--fs-sm); }
.design-notes .design-warning-full ul { margin: 0 0 var(--space-sm); padding-left: 1.2em; font-size: var(--fs-sm); }

/* The web demo's Home (docs/design/2026-11-18-showcase-home.md): the sentence as the title at
   reading size, four entry cards, the pilot, more examples. Each card is one link target. */
[data-demo="read-only"] #home-needs-title { max-width: 62ch; font-size: var(--fs-2xl); font-weight: 500; line-height: 1.4; }
[data-demo="read-only"] .demo-home { display: flex; flex-direction: column; gap: var(--space-lg); max-width: 1240px; }
.entry-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.entry-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--card);
  transition: border-color var(--dur-fast);
}
.entry-card:hover, .entry-card:focus-within { border-color: var(--rule-strong); }
.entry-card.is-large { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); }
.entry-picture { display: block; aspect-ratio: 2 / 1; overflow: hidden; border-bottom: 1px solid var(--rule); background: var(--paper); }
.entry-card.is-large .entry-picture { aspect-ratio: 16 / 9; border-bottom: 0; border-right: 1px solid var(--rule); }
.entry-picture img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.entry-body { display: flex; flex: 1; flex-direction: column; gap: var(--space-xs); padding: var(--space-md) var(--space-lg) 0; }
.entry-card.is-large .entry-body { justify-content: center; padding: var(--space-xl); }
.entry-title { margin: 0; color: var(--ink); font-size: var(--fs-lg); font-weight: 600; }
.entry-card.is-large .entry-title { font-size: var(--fs-xl); }
.entry-text { margin: 0; color: var(--ink-2); font-size: var(--fs-md); line-height: 1.5; }
.entry-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-md); margin: auto 0 0; padding: var(--space-md) 0 var(--space-lg); }
.entry-card.is-large .entry-links { margin: 0; padding: var(--space-md) 0 0; }
.entry-link, .entry-extra {
  padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-md); font-weight: 600; text-decoration: none; cursor: pointer;
}
.entry-link { color: var(--brand); }
/* The main link covers the whole card; the second link sits above it. */
.entry-link::after { content: ""; position: absolute; inset: 0; }
.entry-link:focus-visible { outline: none; }
.entry-card:has(.entry-link:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.entry-extra { position: relative; z-index: 1; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.entry-extra:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }
.entry-pilot { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-lg); }
.entry-pilot .entry-body { flex: 1 1 auto; padding: var(--space-lg); }
.entry-pilot .entry-links { margin: 0; flex: none; padding: 0 var(--space-lg); }
.entry-mark { align-self: flex-start; padding: 1px 8px; border: 1px solid var(--rule-strong); border-radius: 999px; color: var(--ink-2); font-size: var(--fs-xs, 11px); font-weight: 600; }
/* Korean breaks between words, not inside them. */
:lang(ko) :is(#home-needs-title, .entry-card, .loop-page) { word-break: keep-all; overflow-wrap: break-word; }
.more-examples > summary { width: fit-content; padding: var(--space-xs) 0; color: var(--ink); font-size: var(--fs-md); font-weight: 600; cursor: pointer; }
.more-examples > .vessel-grid { margin-top: var(--space-md); }
@media (max-width: 900px) {
  .entry-row, .entry-card.is-large { grid-template-columns: minmax(0, 1fr); }
  [data-demo="read-only"] #home-needs-title { font-size: var(--fs-xl); }
  .entry-card.is-large .entry-picture { border-right: 0; border-bottom: 1px solid var(--rule); }
  .entry-card.is-large .entry-body { padding: var(--space-md) var(--space-lg) 0; }
  .entry-card.is-large .entry-links { padding: var(--space-md) 0 var(--space-lg); }
  .entry-pilot { flex-direction: column; align-items: stretch; }
  .entry-pilot .entry-links { padding: 0 var(--space-lg) var(--space-lg); }
}
.vessel-source { padding: 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs, 11px); line-height: 1.35; }
.export-downloads { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.export-readonly { margin-top: var(--space-lg); color: var(--ink-2); }
/* The demo writes no files: the outputs are a list, not choices. */
[data-demo="read-only"] .export-toggle { pointer-events: none; }
[data-demo="read-only"] .export-check { visibility: hidden; }
.demo-run-note { display: none; }
[data-demo-note] body[data-route="run"] .demo-run-note {
  display: flex; align-items: center; position: absolute; inset: 0 0 auto 0; height: var(--demo-note-h); z-index: 5;
  margin: 0; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: var(--fs-sm); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
[data-demo-note] body[data-route="run"] .demo-run-note[data-kind="concept"] {
  border-bottom: 1px dashed var(--guess-ink); background: var(--guess-soft); color: var(--guess-text); font-weight: 600;
}
:root { --demo-note-h: 34px; }
[data-demo-note] body[data-route="run"] #view-run { top: var(--demo-note-h); }
.vessel-tagline { padding: 0 var(--space-xs); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
/* Controls that change a run carry .write-action (js/parts.js and the run views); the demo has none. */
[data-demo="read-only"] .write-action { display: none !important; }
[data-demo-note] body[data-route="run"] .demo-run-note[data-kind="note"] { border-left: 3px solid var(--guess-ink); color: var(--ink); }
/* A run note and its credit take up to two lines. */
:root[data-demo-note="note"] { --demo-note-h: 48px; }
[data-demo-note] body[data-route="run"] .demo-run-note[data-kind="note"] { white-space: normal; line-height: 1.35; }
/* The web demo while a run's whole-vessel model loads (js/workspace.js prepareDemoView). */
.pane-model.is-demo-loading .model-host { visibility: hidden; }
.demo-model-loading { position: absolute; inset: 50% 0 auto 0; margin: 0; text-align: center; color: var(--ink-3); font-size: var(--fs-md); }
.pane-model.is-demo-loading :is(.model-controls, .model-corner, .model-readout, .model-frame-labels, .model-caption) { visibility: hidden; }

/* Designs (js/designs.js): a designer's workbench. Main particulars as cards, warnings in one
   compact amber block (in Lite and Advanced), labelled sections in the tabs, evidence on demand. */
.design-page { overflow: auto; color: var(--ink); }
.design-body { max-width: 1240px; }
.design-body h2 { display: flex; align-items: center; gap: var(--space-sm); margin: 0 0 var(--space-sm); color: var(--ink); font-size: var(--fs-lg); font-weight: 600; }
.design-head { display: flex; flex-direction: column; gap: var(--space-xs); }
.design-head .page-head { flex-wrap: wrap; row-gap: var(--space-sm); }
.design-head h1 { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.design-head .segmented { margin-left: auto; flex: none; }
.design-parent { color: var(--ink-3); font-size: var(--fs-sm); }
a.design-parent { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a.design-parent:hover { color: var(--brand); text-decoration-color: currentColor; }
.design-facts { color: var(--ink-3); font-size: var(--fs-sm); }
.design-count { min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--sunken); color: var(--ink-2); font: 600 var(--fs-xs)/18px var(--font-mono); text-align: center; }

/* Underlined tabs, as the vessel tabs in the title bar. */
/* Page navigation of a design (docs/design/2026-11-14-page-map.md): underlined top items, as the
   vessel tabs, then a second row of pill links for a top item with more than one page. */
.design-navs { display: flex; flex-direction: column; gap: var(--space-sm); }
.design-nav { display: flex; gap: var(--space-2xs); height: 40px; margin-left: calc(-1 * var(--space-md)); overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--rule); }
.design-nav > a { position: relative; display: inline-flex; flex: none; align-items: center; gap: var(--space-xs); padding: 0 var(--space-md); color: var(--ink-2); font: 600 var(--fs-md) var(--font-ui); text-decoration: none; }
.design-nav > a:hover { color: var(--ink); }
.design-nav > a[aria-current="page"] { color: var(--brand); }
.design-nav > a[aria-current="page"]::after { content: ""; position: absolute; left: var(--space-sm); right: var(--space-sm); bottom: 0; height: 2px; border-radius: 2px; background: var(--brand); }
.design-nav > a:focus-visible, .design-subnav > a:focus-visible { outline: 2px solid var(--focus); outline-offset: -4px; border-radius: var(--radius-sm); }
.design-subnav { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.design-subnav[hidden] { display: none; }
.design-subnav > a { display: inline-flex; align-items: center; height: 28px; padding: 0 var(--space-md); border-radius: 14px; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.design-subnav > a:hover { background: var(--hover); color: var(--ink); }
.design-subnav > a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.design-tab-body { display: flex; flex-direction: column; gap: var(--space-xl); min-width: 0; }

/* A quantity: number and unit in mono, then the band or a quiet "no band" mark. */
.dv { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--space-xs); font-variant-numeric: tabular-nums; }
.dv-num, .dv-unit { font-family: var(--font-mono); }
.dv-unit { color: var(--ink-2); }
.dv-band { color: var(--ink-2); font: var(--fs-xs) var(--font-mono); }
.dv-noband { position: relative; color: var(--ink-3); font-size: var(--fs-xs); cursor: help; }
.dv-noband:hover { text-decoration: underline dotted; text-underline-offset: 2px; }
.dv-noband:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.dv-noband:focus-visible::after {
  content: attr(data-reason); position: absolute; left: 0; top: calc(100% + 6px); z-index: 5; width: max-content; max-width: 260px;
  padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-md); background: var(--ink); color: var(--paper, var(--surface));
  font-size: var(--fs-xs); line-height: 1.35; white-space: normal; text-decoration: none;
}
.design-missing { color: var(--ink-3); font-style: italic; }

/* Main particulars. */
.design-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 188px), 1fr)); gap: var(--space-sm); }
.design-card { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; padding: var(--space-md) var(--space-md) var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.design-card-grid-lite { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.design-card[data-state="missing"] { border-style: dashed; background: transparent; }
.design-card dt { color: var(--ink-3); font-size: var(--fs-sm); }
.design-card dd { min-width: 0; margin: 0; }
.design-card .dv-num { color: var(--ink); font-size: var(--fs-2xl); font-weight: 500; letter-spacing: -0.02em; }
.design-card .dv-unit { font-size: var(--fs-md); }
.design-card .dv-none { display: block; color: var(--ink-3); font-size: var(--fs-2xl); line-height: 1.2; }
.design-card .design-missing { font-size: var(--fs-sm); }
.design-card-method { overflow: hidden; color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; text-overflow: ellipsis; }

/* Checks and warnings: amber, a few lines, then all of them grouped by topic. */
.design-overview-lower { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: var(--space-xl); align-items: start; }
.design-overview-lower > :only-child { grid-column: 1 / -1; }
.design-warnings { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; padding: var(--space-md) var(--space-lg); border-left: 3px solid var(--warn-ink); border-radius: var(--radius-md); background: var(--warn-soft); }
.design-warnings h2 { margin: 0; font-size: var(--fs-md); }
.design-warnings h2 .icon { width: 16px; height: 16px; color: var(--warn); }
.design-warnings .design-count { background: color-mix(in srgb, var(--warn-ink) 30%, transparent); color: var(--ink); }
.design-warnings-none { border-left-color: var(--rule-strong); background: var(--sunken); }
.design-warnings-none p { color: var(--ink-2); font-size: var(--fs-sm); }
.design-warning-preview { display: flex; flex-direction: column; gap: var(--space-xs); }
.design-warning-preview li { display: flex; gap: var(--space-sm); min-width: 0; font-size: var(--fs-sm); line-height: 1.45; }
.design-warning-preview[hidden], .design-warning-full[hidden] { display: none; }
.design-warning-topic { flex: none; min-width: 6.5em; color: var(--warn); font-weight: 600; }
.design-warning-text { min-width: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.design-warning-full { display: flex; flex-direction: column; gap: var(--space-md); }
.design-warning-full h3 { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-xs); color: var(--warn); font-size: var(--fs-sm); font-weight: 600; }
.design-warning-full ul { display: flex; flex-direction: column; gap: var(--space-xs); padding-left: var(--space-lg); list-style: disc; color: var(--ink); font-size: var(--fs-sm); line-height: 1.45; }
.design-warning-full li { overflow-wrap: anywhere; }
.design-warning-toggle { align-self: flex-start; margin-left: calc(-1 * var(--space-sm)); color: var(--ink); font-weight: 600; }

/* What changed from the parent. */
.design-changes ul { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.design-changes li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-xs) var(--space-sm); padding: var(--space-sm) var(--space-md); font-size: var(--fs-sm); }
.design-changes li + li { border-top: 1px solid var(--rule); }
.design-change-label { flex: 1 1 100%; color: var(--ink-2); }
.design-delta { padding: 0 6px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); font: 600 var(--fs-md) var(--font-mono); }
.design-changes .design-missing { flex: 1 1 100%; order: 2; font-size: var(--fs-xs); }

/* Detail tabs: sections of label | value rows, like a data sheet. */
/* Columns, not a grid: a long section and several short ones sit side by side without a gap. */
.design-sections { columns: 2 400px; column-gap: var(--space-lg); }
.design-sections > .design-section { break-inside: avoid; margin-bottom: var(--space-lg); }
.design-inputs > summary { width: fit-content; margin-bottom: var(--space-md); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.design-inputs > summary:hover { color: var(--ink); }
.design-section { min-width: 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.design-section h2 { margin-bottom: var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.design-section-method { margin-bottom: var(--space-sm); color: var(--ink-2); font: var(--fs-xs)/1.4 var(--font-mono); overflow-wrap: anywhere; }
.design-section-method > span { color: var(--ink-3); font-family: var(--font-ui); font-weight: 600; }
.design-props > div { display: grid; grid-template-columns: minmax(min-content, 1fr) minmax(0, auto); gap: var(--space-md); align-items: baseline; padding: 5px 0; border-top: 1px solid var(--rule); font-size: var(--fs-sm); }
.design-props > div:first-child { border-top: 0; }
.design-props dt { min-width: 0; color: var(--ink-2); }
.design-props dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.design-props .dv { justify-content: flex-end; }
.design-section-empty { display: flex; flex-direction: column; gap: var(--space-xs); }
.design-section-empty h2 { margin: 0; }
.design-arrow { color: var(--ink-3); }
.design-section-note { margin-top: var(--space-sm); color: var(--ink-3); font-size: var(--fs-xs); }

/* Provenance tables. */
.design-path { display: block; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); overflow-wrap: anywhere; }
.design-page td { max-width: 42rem; white-space: normal; overflow-wrap: anywhere; }

/* Lite: what is still unknown, as quiet chips. */
.design-unknowns { display: flex; flex-direction: column; gap: var(--space-md); }
.design-missing-group h3, .design-missing-group > summary { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.design-missing-chip { padding: 2px var(--space-sm); border: 1px dashed var(--rule-strong); border-radius: var(--radius-chip); color: var(--ink-2); font-size: var(--fs-xs); }

/* Designs list. */
.design-list-name { color: var(--ink); font-weight: 600; }

/* Design project (js/design_project.js): Candidates, Compare, Decisions and the Lite cards. */
.table-unknown { color: var(--ink-3); font-style: italic; }
.data-table thead th > .table-head { display: block; padding: 0 var(--space-sm); line-height: 26px; }
.compare-table thead th, .decision-grid thead th { padding: var(--space-xs) var(--space-sm); }
.compare-table tbody tr, .decision-grid tbody tr { cursor: default; }
.compare-table tbody tr:hover, .decision-grid tbody tr:hover { background: none; }
.design-cand-name { display: inline-block; min-width: 9rem; overflow-wrap: normal; }
/* A decision chip keeps its whole text; several chips stack in the cell. */
.design-decision-chips .badge { flex: none; max-width: 100%; height: auto; min-height: 18px; padding-block: 1px; }
.design-decision-chips .badge-text { white-space: normal; overflow: visible; }
.data-table .design-decision-chips { flex-direction: column; align-items: flex-start; }
fieldset[data-invalid="true"] .decision-action span { border-color: var(--fail); }
.design-project-section { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.design-section-head { display: flex; align-items: baseline; gap: var(--space-sm); flex-wrap: wrap; }
.design-section-head h2 { margin: 0; }
.design-near { color: var(--ink-2); font-size: var(--fs-xs); }
.design-notice { padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink-2); font-size: var(--fs-sm); }
.design-page .data-table .chip-row { flex-wrap: wrap; }

/* Pareto chart: tokens only, so light and dark both read. */
.pareto { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; margin: 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.pareto figcaption h2 { margin: 0; }
.pareto figcaption p { color: var(--ink-2); font-size: var(--fs-sm); }
.pareto-plot { min-width: 0; overflow-x: auto; }
.pareto-svg { display: block; overflow: visible; font-family: var(--font-ui); }
.pareto-frame { fill: none; stroke: var(--rule-strong); }
.pareto-grid { stroke: var(--rule); stroke-width: 1; }
.pareto-tick { fill: var(--ink-3); font: var(--fs-2xs) var(--font-mono); }
.pareto-axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.pareto-bar line { stroke: var(--ink-3); stroke-width: 1.25; }
.pareto-front { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 6 4; opacity: 0.7; }
.pareto-pair { fill: none; stroke: var(--ink-2); stroke-width: 1.25; stroke-dasharray: 4 3; }
.pareto-fail-tag { fill: var(--fail); font-weight: 600; }
/* The legend sits right of the plot on a wide window and wraps below it on a narrow one. */
.pareto-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-md) var(--space-lg); }
.pareto-body .pareto-plot { flex: 1 1 480px; }
.pareto-body .pareto-legend { flex: 0 1 auto; flex-direction: column; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); }
@media (max-width: 900px) { .pareto-body .pareto-legend { flex-direction: row; border: 0; padding: 0; } }
.pareto-marker { fill: var(--brand); stroke: var(--surface); stroke-width: 1.5; }
.pareto-point[data-state="dominated"] .pareto-marker, .pareto-point[data-state="fails"] .pareto-marker { fill: var(--pareto-dominated); stroke: var(--pareto-dominated-line); }
.pareto-point[data-state="dominated"] .pareto-bar line { stroke: var(--pareto-dominated-line); stroke-width: 1; }
.pareto-point[data-state="dominated"] .pareto-label { fill: var(--pareto-dominated-text); font-weight: 600; }
.pareto-point[data-fails="true"] .pareto-marker { stroke: var(--fail); stroke-width: 2; }
.pareto-point[data-state="reference"] .pareto-marker { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.pareto-hatch-bg.pareto-hatch-front { fill: var(--brand-soft); }
.pareto-hatch-bg.pareto-hatch-dominated { fill: var(--sunken); }
.pareto-hatch-line { stroke: var(--fail); stroke-width: 1.6; }
.pareto-label { fill: var(--ink); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.pareto-point:not([data-state="reference"]) { cursor: pointer; }
.pareto-point:focus { outline: none; }
.pareto-focus { fill: none; stroke: transparent; stroke-width: 2; }
.pareto-point:hover .pareto-focus { stroke: var(--rule-strong); }
.pareto-point:focus-visible .pareto-focus { stroke: var(--focus); stroke-width: 3; }
.pareto-legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); color: var(--ink-2); font-size: var(--fs-xs); }
.pareto-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pareto-swatch { flex: none; overflow: visible; }
.pareto-notes { display: flex; flex-direction: column; gap: var(--space-xs); color: var(--ink-2); font-size: var(--fs-sm); }
.pareto-unknown { color: var(--warn); font-weight: 600; }

/* Compare. */
.compare-chooser { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); min-width: 0; }
.compare-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); }
.compare-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 2px 0 var(--space-md); border: 1px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); font-size: var(--fs-sm); }
.compare-chip .compare-letter { min-width: 0; margin: 0; color: inherit; }
.compare-remove { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 2px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; }
.compare-remove:hover:not(:disabled) { background: var(--hover); }
.compare-remove:disabled { opacity: 0.45; cursor: not-allowed; }
.compare-remove:focus-visible, .compare-add:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.compare-add { height: 28px; padding: 0 var(--space-sm); border: 1px dashed var(--rule-strong); border-radius: 14px; background: var(--raised); color: var(--ink-2); font-size: var(--fs-sm); cursor: pointer; }
.compare-add:disabled { opacity: 0.6; cursor: not-allowed; }
.compare-letter { display: inline-block; min-width: 1.4em; margin-right: 4px; color: var(--ink); font-weight: 700; }
.compare-table thead th { vertical-align: bottom; text-align: left; }
.compare-value .dv { justify-content: flex-end; }
.compare-add { max-width: 14rem; }
.compare-table .compare-design-head .compare-name { display: block; max-width: 14rem; overflow: hidden; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.compare-table th[scope="row"] { color: var(--ink-2); font-weight: 600; text-align: left; white-space: normal; min-width: 9rem; }
.compare-table td { vertical-align: top; }
.compare-table td.compare-delta { padding-left: 0; color: var(--ink-2); font: var(--fs-xs)/1.9 var(--font-mono); border-right: 1px solid var(--rule); }
.compare-delta [data-tone="better"] { color: var(--pass); font-weight: 600; }
.compare-delta [data-tone="worse"] { color: var(--fail); font-weight: 600; }
.compare-table tr.compare-axis > * { background: color-mix(in srgb, var(--brand-soft) 70%, transparent); }
.compare-table tr.compare-axis th[scope="row"] { color: var(--ink); }
.compare-design-head[data-fails="true"] { background: var(--warn-soft) !important; }
.compare-fails { display: block; color: var(--warn); font-size: var(--fs-xs); font-weight: 600; }
.compare-check { display: inline-flex; align-items: center; gap: var(--space-sm); }
.compare-check-value { color: var(--ink-2); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }
.compare-checks th[scope="colgroup"] { padding-top: var(--space-md); color: var(--ink); font-weight: 600; text-align: left; }

/* Decisions. */
.decision-grid td, .decision-grid th[scope="row"] { vertical-align: top; }
.decision-grid { table-layout: fixed; min-width: 760px; }
.decision-grid thead th:first-child { width: 30%; }
.decision-grid th[scope="row"] { text-align: left; font-weight: 600; white-space: normal; min-width: 10rem; }
.decision-grid th[scope="row"] a { color: var(--ink); }
/* Decision chips: Accepted outlined, Deferred amber, Rejected grey and struck through, Not decided dashed. */
.decision-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--space-sm); border: 1px solid; border-radius: var(--radius-sm); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.decision-chip[data-action="accepted"] { border-color: var(--brand); background: var(--raised); color: var(--brand); }
.decision-chip[data-action="deferred"] { border-color: var(--warn-ink); background: var(--warn-soft); color: var(--warn); }
.decision-chip[data-action="rejected"] { border-color: var(--rule-strong); background: var(--sunken); color: var(--ink-2); text-decoration: line-through; }
.decision-chip[data-action="none"] { border-style: dashed; border-color: var(--rule-strong); color: var(--ink-3); font-weight: 400; }
.decision-chip[tabindex] { cursor: help; }
.decision-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.design-decision-chips .decision-chip { height: auto; min-height: 20px; white-space: normal; }
.decision-candidate { display: flex; align-items: flex-start; gap: var(--space-sm); }
.decision-letter { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--raised); color: var(--ink); font-weight: 700; }
.decision-candidate a { color: var(--ink); font-weight: 600; }
.decision-candidate small { display: block; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 400; font-variant-numeric: tabular-nums; }
.decision-candidate small.decision-fails { color: var(--fail); font-family: var(--font-ui); font-weight: 600; }
.decision-candidate small.decision-unknown { color: var(--warn); font-family: var(--font-ui); font-weight: 600; }
.decision-grid td { vertical-align: middle; }
.decision-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
@media (min-width: 1280px) { .decision-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 330px); } }
.decision-layout .decision-form { max-width: none; }
.decision-main { display: flex; flex-direction: column; gap: var(--space-xl); min-width: 0; }
/* The log keeps readable columns on a narrow window; its box scrolls instead. */
.decision-log .data-table { min-width: 720px; }
.decision-form { display: flex; flex-direction: column; gap: var(--space-md); max-width: 640px; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.decision-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--space-md); }
.decision-form select, .decision-form input[type="text"], .decision-form textarea {
  min-width: 0; width: 100%; padding: 0 var(--space-sm); border: 1px solid var(--rule-strong); border-radius: var(--radius-md);
  background: var(--raised); color: var(--ink); font: var(--fs-sm) var(--font-ui); user-select: text; -webkit-user-select: text;
}
.decision-form select, .decision-form input[type="text"] { height: 32px; }
.decision-form textarea { min-height: 72px; padding: var(--space-sm); line-height: 1.45; resize: vertical; }
.decision-form :is(select, input, textarea):focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--brand); }
.decision-form :is(input, textarea, select)[aria-invalid="true"] { border-color: var(--fail); }
.decision-actions { display: flex; padding: 2px; border-radius: var(--radius-md); background: var(--sunken); gap: 2px; }
.decision-action { position: relative; display: flex; flex: 1 1 0; }
.decision-action input { position: absolute; opacity: 0; pointer-events: none; }
.decision-action span { display: flex; flex: 1; align-items: center; justify-content: center; height: 28px; padding: 0 var(--space-md); border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--fs-sm); cursor: pointer; }
.decision-action input:checked + span { border-color: currentColor; font-weight: 600; }
.decision-action[data-action="accepted"] input:checked + span { background: var(--raised); color: var(--brand); }
.decision-action[data-action="deferred"] input:checked + span { background: var(--warn-soft); color: var(--warn); }
.decision-action[data-action="rejected"] input:checked + span { background: var(--raised); color: var(--ink); }
.decision-action input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.decision-submit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); }
.decision-message { font-size: var(--fs-sm); }
.decision-message[data-tone="fail"] { color: var(--fail); font-weight: 600; }
.decision-message[data-tone="pass"] { color: var(--ink-2); }


@media (max-width: 900px) {
  .design-overview-lower { grid-template-columns: minmax(0, 1fr); }
}
/* "no band" once per row in Compare, in the label column, when no value in the row has a band. */
.compare-table th[scope="row"] .compare-noband { display: block; font-weight: 400; }
/* The compare table is short; do not hide its Checks rows behind the shared table height limit. */
.compare-scroll { max-height: none; }
/* Narrow widths: the labels stay in view while the candidate columns scroll sideways. */
.compare-scroll-hint { display: none; margin: 0 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); }
@media (max-width: 720px) {
  .compare-scroll-hint { display: block; }
  .compare-table th[scope="row"] { position: sticky; left: 0; z-index: 1; min-width: 7.5rem; background: var(--surface); }
}

/* ---- Lite brief (design_brief.js) ---- */
.brief-form { display: flex; flex-direction: column; gap: var(--space-md); padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
/* Brief by direct manipulation: requirements on the parent hull, the aim on the front. */
.brief-board { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-lg); align-items: start; }
@media (max-width: 900px) { .brief-board { grid-template-columns: minmax(0, 1fr); } }
.brief-board h3 { margin: 0 0 var(--space-xs); font-size: var(--fs-md); }
.brief-help { margin: 0 0 var(--space-sm); color: var(--ink-2); font-size: var(--fs-sm); }
.brief-canvas { display: flex; flex-direction: column; gap: var(--space-lg); }
.brief-figure-section { width: min(100%, 400px); align-self: center; }
.brief-canvas-message { grid-column: 1 / -1; margin: 0; color: var(--fail); font-size: var(--fs-sm); }
.brief-canvas-message:empty { display: none; }
.brief-figure { margin: 0; }
.brief-figure figcaption { margin-top: var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); }
.brief-profile, .brief-section { position: relative; }
.brief-svg { display: block; width: 100%; height: auto; overflow: visible; }
.brief-centre { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 6 3 1 3; }
.brief-limit-line { stroke: var(--fail); stroke-width: 1.5; stroke-dasharray: 8 5; pointer-events: none; }
.brief-limit-hit { stroke: transparent; stroke-width: 16; }
.brief-limit { cursor: ns-resize; outline: none; }
.brief-limit[data-key="max_beam_m"] { cursor: ew-resize; }
.brief-limit:hover .brief-limit-line, .brief-limit.is-dragging .brief-limit-line { stroke-width: 3; }
.brief-limit:focus-visible .brief-limit-hit { stroke: var(--focus); stroke-width: 6; }
.brief-speed-arrow line { stroke: var(--brand); stroke-width: 2; }
.brief-speed-arrow polygon { fill: var(--brand); }
/* A value label sits on its line; a click turns it into a field. */
.brief-value { position: absolute; transform: translate(-100%, -50%); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: var(--fs-xs); }
.brief-value[data-key="max_beam_m"] { transform: translate(-50%, -100%); }
.brief-value[data-key="dwt_t"] { transform: translate(-50%, -50%); }
.brief-value[data-key="service_speed_kn"] { transform: translate(-100%, -100%); }
.brief-value[data-placed="false"] { display: none; }
.brief-value-button { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 6px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; cursor: text; }
.brief-value-button:hover { border-color: var(--brand); }
.brief-value[data-key^="max_"] .brief-value-button { border-color: var(--fail); }
.brief-value-label { color: var(--ink-2); }
.brief-value-text { font-family: var(--font-mono); font-weight: 600; }
.brief-value-parent { color: var(--ink-3); }
.brief-value-input { width: 7em; padding: 2px 4px; font-family: var(--font-mono); font-size: var(--fs-sm); }
.brief-value-input[aria-invalid="true"] { border-color: var(--fail); }
.brief-value-unit { color: var(--ink-2); }
.brief-canvas-plain .brief-value { position: static; transform: none; }
/* On a narrow window the drawings are too small to carry labels: the labels follow each drawing. */
@media (max-width: 600px) {
  .brief-profile, .brief-section { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xs); }
  .brief-profile .brief-value, .brief-section .brief-value { position: static; transform: none; }
}
.brief-value-list { display: flex; flex-direction: column; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.brief-aim-note { color: var(--warn); }
.brief-submit { margin: var(--space-md) 0; }
.brief-message:empty { display: none; }
.brief-message[role="alert"], .brief-error { color: var(--fail); }
.brief-run:empty { display: none; }
.brief-run { margin-top: var(--space-md); }
.brief-progress { display: flex; flex-direction: column; gap: var(--space-xs); max-width: 520px; }
.brief-progress progress { width: 100%; height: 8px; accent-color: var(--brand); }
.brief-result { display: flex; flex-direction: column; gap: var(--space-sm); }
.brief-options { display: flex; flex-direction: column; gap: var(--space-sm); margin: 0; padding-left: 1.5em; list-style: decimal; }
.brief-options li { display: list-item; }
.brief-options li { padding-left: var(--space-xs); }
.brief-options a { font-weight: 600; }
.brief-option-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); margin-bottom: var(--space-xs); }
.brief-front { color: var(--ink-3); font-size: var(--fs-xs); }
.brief-front[data-front="true"] { color: var(--brand); font-weight: 600; }
.brief-options .delta-bars { max-width: 460px; }
.brief-rejected summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); }
.brief-rejected ul { margin: var(--space-xs) 0 0 1.25em; color: var(--ink-2); font-size: var(--fs-sm); }

/* ---- Design graphics (design_graphics.js; docs/design/2026-11-15-design-visuals.md) ---- */
.hull-drawing { display: flex; flex-direction: column; gap: var(--space-sm); margin: 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.hull-views { display: grid; grid-template-columns: minmax(0, 3fr) minmax(180px, 1fr); gap: var(--space-lg); align-items: center; }
.hull-svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-ui); }
.hull-svg text { fill: var(--ink-2); }
.hull-svg .hull-view-label { fill: var(--ink-3); font-weight: 600; }
.hull-water { fill: var(--water-fill); }
.hull-body { fill: var(--hull-fill); }
.hull-line { fill: none; stroke: var(--hull-line); stroke-width: 1.5; stroke-linejoin: round; }
.hull-body.hull-line { fill: var(--hull-fill); }
.hull-assumed { stroke-dasharray: 6 5; }
.hull-waterline { stroke: var(--water-line); stroke-width: 1.5; }
.hull-centreline { stroke: var(--dim-line); stroke-width: 1; stroke-dasharray: 14 4 2 4; }
.hull-parent { fill: none; stroke: var(--parent-line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.hull-dim line { stroke: var(--dim-line); stroke-width: 1; }
.hull-dim text { fill: var(--ink); font-weight: 600; }
.hull-limit line { stroke: var(--fail); stroke-width: 1.5; stroke-dasharray: 8 5; }
.hull-svg .hull-limit text { fill: var(--fail); font-weight: 600; }
.hull-station line { stroke: var(--dim-line); }
.hull-svg .hull-station text { fill: var(--ink-3); }
.hull-marker polygon, .hull-point circle { fill: var(--brand); }
.hull-svg .hull-point text { fill: var(--ink); font-weight: 600; }
.hull-drawing figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); color: var(--ink-3); font-size: var(--fs-xs); }
.hull-assumed-note { color: var(--warn); }
.hull-legend { display: inline-flex; flex-wrap: wrap; gap: var(--space-md); margin-left: auto; }
.hull-key { display: inline-flex; align-items: center; gap: var(--space-xs); }
.hull-key::before { content: ""; width: 18px; height: 0; border-top: 2px solid; }
.hull-key-water::before { height: 8px; border: 0; border-top: 2px solid var(--water-line); background: var(--water-fill); }
.hull-key-parent::before { border-top: 2px dashed var(--parent-line); }
.hull-key-limit::before { border-top: 2px dashed var(--fail); }
.hull-none { padding: var(--space-md); border: 1px dashed var(--rule-strong); border-radius: var(--radius-md); }
.hull-side { min-width: 0; }
.hull-side:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
@media (max-width: 900px) {
  .hull-views { grid-template-columns: minmax(0, 1fr); }
  .hull-side { overflow-x: auto; }
  .hull-side .hull-svg { min-width: 640px; }
  .hull-section-svg { max-width: 300px; }
}

/* Limit gauges: a bullet bar from zero, the limit as a tick. */
.design-gauges ul { display: flex; flex-direction: column; gap: var(--space-sm); }
.gauge { display: grid; grid-template-columns: 9rem minmax(80px, 1fr) 13rem; gap: var(--space-md); align-items: center; font-size: var(--fs-sm); }
.gauge-label { color: var(--ink-2); }
.gauge-track { position: relative; height: 10px; border-radius: var(--radius-sm); background: var(--sunken); }
.gauge-value { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--pass); }
.gauge[data-state="fail"] .gauge-value { background: var(--fail); }
.gauge-limit { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.gauge[data-state="unknown"] .gauge-track { background: repeating-linear-gradient(135deg, var(--sunken) 0 6px, var(--muted-soft) 6px 12px); }
.gauge-words { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gauge[data-state="fail"] .gauge-words { color: var(--fail); font-weight: 600; }
.gauge[data-state="unknown"] .gauge-words { color: var(--warn); }
@media (max-width: 720px) { .gauge { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); } }

/* Resistance parts and the power chain. */
.design-graphics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--space-lg); align-items: start; }
.design-graphic { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.design-graphic h2 { justify-content: space-between; font-size: var(--fs-md); }
.design-graphic-total { color: var(--ink); font: 600 var(--fs-md) var(--font-mono); }
.stack-bar { display: flex; gap: 2px; height: 22px; overflow: hidden; border-radius: var(--radius-sm); }
.stack-part, .stack-swatch { background: var(--series-4); }
[data-part="viscous"] .stack-swatch, .stack-part[data-part="viscous"] { background: var(--series-1); }
[data-part="wave"] .stack-swatch, .stack-part[data-part="wave"] { background: var(--series-2); }
[data-part="correlation"] .stack-swatch, .stack-part[data-part="correlation"] { background: var(--series-3); }
.stack-part { min-width: 3px; }
.stack-legend { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.stack-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: var(--space-sm); align-items: center; }
.stack-swatch { width: 12px; height: 12px; border-radius: 3px; }
.stack-value { color: var(--ink-2); font: var(--fs-sm) var(--font-mono); }
.power-chain { display: flex; flex-direction: column; gap: var(--space-sm); }
.power-chain li { display: grid; grid-template-columns: 11rem minmax(80px, 1fr) 8.5rem; gap: var(--space-md); align-items: center; font-size: var(--fs-sm); }
.power-label { color: var(--ink-2); }
.power-track { display: flex; height: 18px; }
.power-bar { height: 100%; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--series-1); }
.power-chain li[data-stage="brake"] .power-bar { border-radius: var(--radius-sm); }
.power-loss { height: 100%; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: repeating-linear-gradient(135deg, var(--series-4) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px var(--series-4); }
.power-value { display: flex; flex-direction: column; font: var(--fs-sm) var(--font-mono); color: var(--ink); }
.power-value small { color: var(--ink-3); font: var(--fs-xs) var(--font-ui); }
@media (max-width: 720px) { .power-chain li { grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); } }

/* Change from the parent: diverging bars around zero. */
.delta-bars { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.delta-bars li { display: grid; grid-template-columns: 6rem minmax(48px, 1fr) 4.5rem; gap: var(--space-sm); align-items: center; }
.delta-label { color: var(--ink-2); }
.delta-track { position: relative; height: 10px; background: linear-gradient(var(--rule-strong), var(--rule-strong)) center / 1px 100% no-repeat; }
.delta-bar { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; background: var(--parent-line); }
.delta-bar[data-side="right"] { left: 50%; }
.delta-bar[data-side="left"] { right: 50%; }
.delta-bars [data-tone="better"] .delta-bar { background: var(--pass); }
.delta-bars [data-tone="worse"] .delta-bar { background: var(--fail); }
.delta-value { font: 600 var(--fs-sm) var(--font-mono); text-align: right; }
.delta-bars [data-tone="better"] .delta-value { color: var(--pass); }
.delta-bars [data-tone="worse"] .delta-value { color: var(--fail); }
.delta-bars [data-tone="neutral"] .delta-value { color: var(--ink-3); font-weight: 400; }

/* Overview under the drawing: limits and values on the left, warnings and changes on the right. */
.design-overview-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--space-xl); align-items: start; }
.design-overview-column { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }
.design-value-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); column-gap: var(--space-lg); }
.design-value-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-sm); padding: 4px 0; border-top: 1px solid var(--rule); font-size: var(--fs-sm); }
.design-value-list dt { color: var(--ink-2); }
.design-value-list dd { margin: 0; text-align: right; }
.design-value-list .dv { justify-content: flex-end; }
.design-value-list [data-state="missing"] dd { color: var(--ink-3); font-style: italic; }
.design-missing-group > summary { cursor: pointer; }
.design-missing-group > summary::-webkit-details-marker { display: none; }
.design-missing-group > summary::before { content: "▸"; color: var(--ink-3); }
.design-missing-group[open] > summary::before { content: "▾"; }

/* ---- Design viewport (design_viewport.js) and shared value lists ---- */
html[data-demo="read-only"] .design-body:is([data-page="run"], [data-page="agent"], [data-page="structure"]) { padding-bottom: var(--space-sm); }
.design-body[data-page="model"] { max-width: none; height: 100%; box-sizing: border-box; padding-bottom: var(--space-md); }
.design-body[data-page="model"] .design-page-content { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.ws-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--swatch); }
.ws-letter { flex: none; font-weight: 700; }
.ws-values { grid-template-columns: minmax(0, 1fr); }

/* Panes: Lines plan puts the profile above the plan in the wide column. */
.dv-root { position: absolute; inset: 0; display: grid; grid-template-columns: 3fr 2fr; grid-template-rows: 1fr 1fr; grid-template-areas: "p0 p2" "p1 p3"; }
.dv-root[data-layout="quad"] { grid-template-columns: 1fr 1fr; grid-template-areas: "p0 p1" "p2 p3"; }
.dv-root[data-layout="pair"] { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr; grid-template-areas: "p0 p1"; }
.dv-root[data-layout="sheet"] { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "p0 p2" "p1 p2"; }
.dv-root[data-maximised]:not([data-maximised=""]) { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: none; }
.dv-root[data-maximised]:not([data-maximised=""]) .dv-pane { grid-area: auto; }
.dv-pane[data-pane="p0"] { grid-area: p0; }
.dv-pane[data-pane="p1"] { grid-area: p1; }
.dv-pane[data-pane="p2"] { grid-area: p2; }
.dv-pane[data-pane="p3"] { grid-area: p3; }
.dv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dv-pane { position: relative; min-width: 0; min-height: 0; box-shadow: inset 0 0 0 0.5px var(--rule-strong); }
.dv-pane[hidden] { display: none; }
.dv-pane:focus-within { box-shadow: inset 0 0 0 2px var(--brand); }
.dv-surface { position: absolute; inset: 0; cursor: default; touch-action: none; }
.dv-surface[hidden], .dv-graph[hidden] { display: none; }
.dv-pane[data-content="perspective"] .dv-surface { cursor: grab; }
.dv-surface:focus-visible { outline: none; }
.dv-graph { position: absolute; inset: 34px 0 0; overflow: auto; padding: 0 var(--space-sm) var(--space-sm); background: var(--surface); }
.dv-title { position: absolute; top: 6px; left: 6px; z-index: 1; display: flex; align-items: center; gap: 2px; max-width: calc(100% - 12px); padding: 1px 2px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: 0 0 0 1px var(--rule); color: var(--ink); font-size: var(--fs-xs); user-select: none; }
.dv-content, .dv-mode { height: 22px; min-width: 0; padding: 0 2px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.dv-content { font-weight: 600; }
.dv-mode { color: var(--ink-2); }
.dv-content[hidden], .dv-mode[hidden], .dv-badge[hidden] { display: none; }
.dv-badge { padding: 0 6px; border: 1px dashed var(--warn-ink); border-radius: 9px; color: var(--warn); font-size: var(--fs-xs); line-height: 16px; white-space: nowrap; }
/* Real offsets are not a warning; a scaled or schematic hull is. */
.dv-badge[data-basis="offsets"] { border-style: solid; border-color: var(--line); color: var(--ink-2); }
.dv-badge:empty { display: none; }
.dv-content:hover, .dv-mode:hover, .dv-max:hover { background: var(--hover); }
.dv-max { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.dv-max[aria-pressed="true"] { color: var(--brand); }
.dv-content:focus-visible, .dv-mode:focus-visible, .dv-max:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }

/* Graph panes. */
.dv-graph .pareto { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.dv-graph .pareto figcaption p, .dv-graph .pareto-notes { display: none; }
.dv-graph .pareto figcaption h2 { font-size: var(--fs-sm); }
.graph { display: flex; flex-direction: column; gap: var(--space-xs); margin: 0; }
.graph figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); }
.graph-title { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.graph-note { color: var(--ink-3); font-size: var(--fs-xs); }
.graph-empty { padding: var(--space-md); color: var(--ink-3); font-size: var(--fs-sm); }
.graph-frame { position: relative; border-radius: var(--radius-sm); }
.graph-frame:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.graph-svg { display: block; overflow: visible; cursor: crosshair; font-family: var(--font-ui); }
.graph-grid line { stroke: var(--rule); }
.graph-grid text, .graph-tick { fill: var(--ink-3); font: var(--fs-2xs) var(--font-mono); }
.graph-axis { fill: var(--ink-3); font-size: var(--fs-2xs); }
.graph-series polyline { fill: none; stroke: var(--series); stroke-width: 1.5; }
.graph-series[data-active="true"] polyline { stroke: var(--ink); stroke-width: 2.5; }
.graph-lcb line { stroke: var(--series); stroke-width: 2; }
.graph-series[data-active="true"] .graph-lcb line { stroke: var(--ink); }
.graph-lcb text { fill: var(--ink-2); font-size: var(--fs-2xs); }
.graph-station { stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 4 3; }
.graph-pill { position: absolute; top: 4px; right: 4px; padding: 2px 8px; border-radius: 10px; background: var(--ink); color: var(--paper); font: var(--fs-xs) var(--font-mono); pointer-events: none; }
.graph-pill[hidden] { display: none; }
.graph-legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); font-size: var(--fs-xs); }
.graph-legend li { display: inline-flex; align-items: center; gap: var(--space-xs); font-weight: 600; }
.graph-swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--series); }
.graph-value { color: var(--ink-3); font-family: var(--font-mono); font-weight: 400; }

/* Layout buttons in the status bar. */
.ws-hint { color: var(--ink-3); font-size: var(--fs-xs); }

@media (max-width: 900px) {
  .design-body[data-page="model"] { height: auto; }
}

/* The workspace needs the height: a tighter design header on that page only. */
/* One compact header on every page of a design, so the tabs do not move between pages. */
.design-body[data-page] { gap: var(--space-sm); padding-top: var(--space-md); }
.design-body[data-page] .design-head h1 { font-size: var(--fs-xl); }
.pareto-grid, .graph-grid { pointer-events: none; }

/* ---- Design model hub, class prefix dm- (design_model.js, design_strip.js; docs/design/2026-11-15-screen-map.md) ---- */
.dm { display: grid; flex: 1 1 auto; grid-template-columns: minmax(0, 1fr) 280px; min-height: 460px; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.dm-main { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; }
.dm-view-button { height: 28px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font: var(--fs-sm) var(--font-ui); cursor: pointer; }
.dm-view-button:hover:not(:disabled) { border-color: var(--brand); color: var(--ink); }
.dm-view-button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dm-view-button:disabled { opacity: 0.5; cursor: not-allowed; }
.dm-view-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-show { position: relative; }
.dm-show-menu fieldset { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; border: 0; }
.dm-show-menu legend { margin-bottom: 2px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
.dm-show-menu label { display: flex; align-items: center; gap: var(--space-xs); }
.dm-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.dm-view[data-split="false"] .dv-title { display: none; }
.dm-station { position: absolute; top: var(--space-sm); right: var(--space-sm); z-index: 4; width: 230px; padding: var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sheet); font-size: var(--fs-sm); }
.dm-station[hidden] { display: none; }
.dm-station-head { display: flex; align-items: center; gap: var(--space-xs); margin-bottom: var(--space-xs); }
.dm-station-head label { flex: none; color: var(--ink-2); font-size: var(--fs-xs); }
.dm-station-head input { width: 0; flex: 1 1 auto; height: 28px; }
.dm-station .design-value-list { grid-template-columns: minmax(0, 1fr); }
.dm-panel { display: flex; flex-direction: column; gap: var(--space-md); overflow: auto; padding: var(--space-md); border-left: 1px solid var(--rule); }
.dm-panel h2 { display: flex; align-items: center; gap: var(--space-xs); margin: 0; font-size: var(--fs-md); }
.dm-panel .design-value-list { grid-template-columns: minmax(0, 1fr); }
.dm-panel .design-gauges h2 { font-size: var(--fs-sm); }
.dm-panel .gauge { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.dm-basis { margin: var(--space-xs) 0 0; color: var(--warn); font-size: var(--fs-xs); }
.dm-basis[data-basis="offsets"] { color: var(--ink-3); }
.dm-links { margin: 0; font-size: var(--fs-sm); }
.dm-decision { display: flex; flex-direction: column; gap: var(--space-xs); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.dm-decision h3 { margin: 0; font-size: var(--fs-sm); }
.decision-form-compact { gap: var(--space-sm); }
.decision-form-compact .decision-form-row { grid-template-columns: minmax(0, 1fr); }
.decision-form-compact textarea { min-height: 0; }
/* The options strip */
.ostrip { display: flex; gap: var(--space-xs); overflow-x: auto; padding: var(--space-xs) var(--space-sm); border-top: 1px solid var(--rule); background: var(--surface); }
.ostrip-card { flex: 0 0 150px; width: 150px; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: var(--space-xs) var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: var(--fs-xs) var(--font-ui); text-align: left; cursor: pointer; }
.ostrip-card:hover { border-color: var(--brand); }
.ostrip-card[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.ostrip-card[data-compare="true"] { border-style: dashed; border-color: var(--swatch); box-shadow: inset 0 0 0 1px var(--swatch); }
.ostrip-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.ostrip-outline { width: 100%; height: 30px; }
.ostrip-parent { fill: none; stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 2; }
.ostrip-hull { fill: color-mix(in srgb, var(--swatch) 18%, transparent); stroke: var(--swatch); stroke-width: 1.4; }
.ostrip-head { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.ostrip-letter { font-weight: 700; }
.ostrip-name { overflow: hidden; color: var(--ink-2); white-space: nowrap; text-overflow: ellipsis; }
.ostrip-mark { margin-left: auto; font-weight: 700; }
.ostrip-mark + .ostrip-mark { margin-left: 2px; }
.ostrip-fail { color: var(--fail); }
.ostrip-decision[data-action="accepted"] { color: var(--pass); }
.ostrip-decision[data-action="rejected"] { color: var(--fail); }
.ostrip-changes { display: flex; flex-direction: column; gap: 1px; }
.ostrip-change { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px; color: var(--ink-2); }
.ostrip-change-text { font-family: var(--font-mono); white-space: nowrap; }
.ostrip-change-bar { height: 4px; width: var(--share); border-radius: 2px; background: var(--ink-3); }
.ostrip-change[data-tone="better"] .ostrip-change-bar { background: var(--pass); }
.ostrip-change[data-tone="worse"] .ostrip-change-bar { background: var(--fail); }
/* Options, Decide, Brief steps, Sources */
.design-section-head .view-switch { margin-left: var(--space-md); }
.options-actions { display: flex; align-items: center; gap: var(--space-sm); margin-left: auto; }
.brief-steps { display: flex; gap: 4px; margin-bottom: var(--space-sm); }
.brief-board { grid-template-columns: minmax(0, 1fr); }
.brief-requirements[hidden], .brief-aim[hidden] { display: none; }
.brief-next { display: flex; justify-content: flex-end; margin-top: var(--space-sm); }
.brief-run-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); margin: var(--space-sm) 0; }
.brief-summary { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.brief-figure-section { width: min(100%, 360px); }
@media (max-width: 900px) {
  .dm { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
  .dm-main { grid-template-rows: clamp(240px, 45vh, 420px) auto; }
  .dm-panel { border-left: 0; border-top: 1px solid var(--rule); }
}

/* The brief's aim on the trade-off chart: a line of equal score. */
.pareto-aim line { stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 2 4; }
.pareto-aim text { fill: var(--brand); font-size: var(--fs-2xs); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }

.brief-aim-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); margin: 0 0 var(--space-xs); font-size: var(--fs-sm); }
.brief-aim-line label { font-weight: 600; }
.brief-aim-menu { height: 28px; }
.brief-aim-weights { font-family: var(--font-mono); color: var(--ink-2); }
.brief-aim-best { color: var(--ink); }
.brief-step { display: inline-flex; align-items: baseline; gap: var(--space-xs); height: 28px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font: var(--fs-sm) var(--font-ui); cursor: pointer; }
.brief-step-name { font-weight: 600; }
.brief-step-state { color: var(--ink-3); font-size: var(--fs-xs); }
.brief-step:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* The view's own controls, in its top-left corner (design_model.js). */
.view-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dm-overlay { position: absolute; top: var(--space-sm); left: var(--space-sm); z-index: 4; display: flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.dm-view-picker { position: relative; }
.dm-view-label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: 600 var(--fs-sm) var(--font-ui); cursor: pointer; }
.dm-view-label:hover, .dm-icon:hover:not(:disabled), .dm-show > summary:hover { background: var(--hover); }
.dm-view-menu { position: absolute; top: 32px; left: 0; display: flex; flex-direction: column; min-width: 200px; padding: 4px; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sheet); }
.dm-view-menu[hidden] { display: none; }
.dm-view-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm); height: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font: var(--fs-sm) var(--font-ui); text-align: left; cursor: pointer; }
.dm-view-item:hover, .dm-view-item:focus-visible { background: var(--hover); color: var(--ink); outline: none; }
.dm-view-item[aria-checked="true"] { color: var(--brand); font-weight: 600; }
.dm-view-item kbd { color: var(--ink-3); font: var(--fs-xs) var(--font-mono); }
.dm-icon, .dm-show > summary { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); cursor: pointer; list-style: none; }
.dm-icon[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.dm-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.dm-view-label:focus-visible, .dm-icon:focus-visible, .dm-show > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-show > summary::-webkit-details-marker { display: none; }
.dm-show-menu { position: absolute; left: 0; top: 34px; z-index: 5; display: flex; flex-direction: column; gap: var(--space-sm); min-width: 220px; padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sheet); font-size: var(--fs-sm); }
.dm-glyph { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
/* In Split the second view keeps its pane title; the first is named by the corner label. */
.dm-view[data-split="true"] .dv-pane[data-pane="p0"] .dv-title { display: none; }

/* A cue at an end of the options strip when more cards are out of view. */
.ostrip[data-more-right="true"] { mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.ostrip[data-more-left="true"] { mask-image: linear-gradient(to right, transparent, #000 48px); }
.ostrip[data-more-left="true"][data-more-right="true"] { mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.ostrip-card { transition: border-color 120ms ease-out, box-shadow 120ms ease-out; }

/* Side panel header: the name on one line, the hull source under it. */
.dm-panel-head h2 { min-width: 0; }
.dm-panel-head .dm-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dm-basis { margin-top: 2px; }
/* Short functional motion; none when the system asks for reduced motion. */
@keyframes dm-fade-in { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes dm-pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.dm-view.is-changing .dv-canvas, .dm-view.is-changing .dv-graph { animation: dm-fade-in 180ms cubic-bezier(0.2, 0, 0, 1); }
.dm-station:not([hidden]), .dm-view-menu:not([hidden]), .dm-show[open] > .dm-show-menu { transform-origin: top left; animation: dm-pop-in 140ms cubic-bezier(0.2, 0, 0, 1); }
@media (prefers-reduced-motion: reduce) {
  .dm-view.is-changing .dv-canvas, .dm-view.is-changing .dv-graph, .dm-station, .dm-view-menu, .dm-show-menu, .ostrip-card { animation: none !important; transition: none !important; }
}

/* Decide: quiet empty cells, a count per discipline, an outline per option. */
.decision-none { color: var(--ink-3); }
.decision-count { display: block; color: var(--ink-3); font-weight: 400; font-size: var(--fs-xs); }
.decision-candidate .outline-glyph { flex: none; width: 96px; height: 24px; }
.decision-more[hidden] { display: none; }
.decision-more { display: flex; flex-direction: column; gap: var(--space-sm); }

/* Brief: a value that is not set is a gap to fill, not a label. */
.brief-value-button[data-unset="true"] { border-style: dashed; border-color: var(--warn); }
.brief-value-button[data-unset="true"] .brief-value-text { color: var(--warn); }
.brief-step[aria-current="step"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.brief-requirements h3:focus, .brief-aim h3:focus { outline: none; }
.brief-reason { margin: 2px 0 0; color: var(--ink-2); font-size: var(--fs-sm); }

.ostrip-letter { flex: none; white-space: nowrap; }
.ostrip-head { overflow: hidden; }

/* No cards inside cards (.impeccable.md): the chart in the brief form and the chart legend have no frame of their own. */
.brief-form .pareto { padding: 0; border: 0; background: none; }
.pareto-body .pareto-legend { padding: 0; border: 0; background: none; }
/* The parent card wraps its two-part caption; the parent overlaid in the view is a dotted, not dashed, frame. */
.ostrip-card[data-role="parent"] .ostrip-name { white-space: normal; }
.ostrip-card[data-overlaid="true"] { border-style: dotted; border-color: var(--rule-strong); box-shadow: none; }
/* The key of the designs in the view, when more than one is shown. */
.dm-key { position: absolute; left: var(--space-sm); bottom: var(--space-sm); z-index: 3; display: flex; flex-wrap: wrap; gap: var(--space-sm); margin: 0; padding: var(--space-xs) var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--fs-xs); list-style: none; }
.dm-key[hidden] { display: none; }
.dm-key li { display: inline-flex; align-items: center; gap: 4px; }
.dm-key-line { display: inline-block; width: 16px; border-top: 2px solid var(--swatch); }
.dm-key-line[data-role="parent"] { border-top-style: dashed; }

/* Breakdown card (breakdown_card.js): why a panel value is what it is. It sits beside the side
   panel, level with the value that opened it, over the view. A value that opens it has a dotted
   underline, as a term with a definition has. */
.dm { position: relative; }
.dm-value { display: inline-flex; align-items: baseline; max-width: 100%; margin: -2px -4px; padding: 2px 4px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; text-decoration: underline dotted var(--ink-3); text-underline-offset: 4px; cursor: help; }
.dm-value:hover, .dm-value[aria-expanded="true"] { background: var(--hover); }
.dm-value:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-why { position: absolute; top: var(--why-top, 8px); right: calc(280px + 8px); z-index: 6; display: flex; flex-direction: column; gap: var(--space-sm); width: 360px; max-height: calc(100% - 16px); overflow: auto; padding: var(--space-sm) var(--space-md) var(--space-md); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sheet); font-size: var(--fs-sm); }
.dm-why[hidden] { display: none; }
.dm-why:focus { outline: none; }
.dm-why[data-pinned="true"] { border-color: var(--brand); }
.dm-why-head { display: flex; align-items: center; gap: 2px; }
.dm-why-head h3 { display: flex; flex: 1 1 auto; align-items: baseline; gap: var(--space-xs); min-width: 0; margin: 0; font-size: var(--fs-md); }
.dm-why-head h3:focus { outline: none; }
.dm-why-letter { color: var(--ink-3); font-weight: 400; font-size: var(--fs-sm); }
.dm-why-trail ol { display: flex; flex-wrap: wrap; gap: 2px var(--space-xs); margin: 0; padding: 0; color: var(--ink-3); font-size: var(--fs-xs); list-style: none; }
.dm-why-trail li + li::before { content: '›'; margin-right: var(--space-xs); }
.dm-why-trail button { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; }
.dm-why-trail button:hover { text-decoration: underline; }
.dm-why-trail button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-why-trail [aria-current] { color: var(--ink-2); }
.dm-why-total { margin: 0; font: 600 var(--fs-lg) var(--font-mono); }
.dm-why-parent, .dm-why-set, .dm-why-none { margin: 0; color: var(--ink-2); }
.dm-why-section { display: flex; flex-direction: column; gap: var(--space-2xs); padding-top: var(--space-sm); border-top: 1px solid var(--rule); }
.dm-why-section h4 { margin: 0; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
.dm-why-formula { margin: 0; font: var(--fs-xs) var(--font-mono); overflow-wrap: anywhere; }
.dm-why-list { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; column-gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.dm-why-list li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; min-height: 24px; }
.dm-why-extra { justify-self: end; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }
.dm-why-name { overflow: hidden; color: var(--ink-2); white-space: nowrap; text-overflow: ellipsis; }
.dm-why-value { justify-self: end; white-space: nowrap; }
.dm-why-link { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; color: var(--brand); font: inherit; text-align: left; cursor: pointer; }
.dm-why-link .dm-why-name { color: inherit; }
.dm-why-link:hover .dm-why-name { text-decoration: underline; }
.dm-why-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-why-notes { margin: 0; padding-left: 1.1em; color: var(--ink-2); }
.dm-why-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--space-sm); margin: 0; }
.dm-why-facts dt { color: var(--ink-3); }
.dm-why-facts dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.dm-why-sources { margin: 0; padding: 0; list-style: none; font: var(--fs-xs) var(--font-mono); }
.dm-why-related summary { color: var(--ink-2); cursor: pointer; }
.dm-why-related summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dm-why-related[open] summary { margin-bottom: var(--space-2xs); }
.dm-why:not([hidden]) { transform-origin: top right; animation: dm-pop-in 140ms cubic-bezier(0.2, 0, 0, 1); }
@media (prefers-reduced-motion: reduce) { .dm-why { animation: none !important; } }
@media (max-width: 900px) { .dm-why { right: var(--space-sm); width: min(360px, calc(100% - 16px)); } }

/* Hull colour legend (design_model.js, hull_modes.js): the scale and what it means, bottom right of the view. */
.dm-legend { position: absolute; right: var(--space-sm); bottom: var(--space-sm); z-index: 3; display: flex; flex-direction: column; gap: var(--space-2xs); width: 260px; padding: var(--space-xs) var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--fs-xs); }
.dm-legend[hidden] { display: none; }
.dm-legend p { margin: 0; color: var(--ink-2); }
.dm-legend .dm-legend-title { display: flex; align-items: baseline; gap: var(--space-xs); color: var(--ink); font-weight: 600; }
.dm-legend-letter { color: var(--ink-3); font-weight: 400; }
.dm-legend-bar { display: block; height: 8px; border: 1px solid var(--rule); border-radius: 2px; }
.dm-legend-bar[data-mode="change"] { background: linear-gradient(to right, var(--hull-in), var(--hull-fill) 50%, var(--hull-out)); }
.dm-legend-bar[data-mode="fullness"] { background: linear-gradient(to right, var(--hull-fill), var(--hull-full)); }
.dm-legend-ticks { display: flex; justify-content: space-between; margin-top: 2px; color: var(--ink-2); font-family: var(--font-mono); }
/* --warn is the amber for text; --warn-ink is for strokes. The bar gives a second cue. */
.dm-legend .dm-legend-warn { padding-left: var(--space-xs); border-left: 2px solid var(--warn-ink); color: var(--warn); }
.dm-show-menu kbd { color: var(--ink-3); font: var(--fs-xs) var(--font-mono); text-transform: none; }

/* Facts about a design's data as chips in the header; each explains itself in the tooltip. */
.design-chips { display: inline-flex; flex-wrap: wrap; gap: var(--space-xs); }
.badge-fact { background: var(--sunken); color: var(--ink-2); cursor: help; }
.badge-fact:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
/* A term that explains itself in the tooltip, as a term with a definition: a dotted underline. */
.tip-term { text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; cursor: help; }
.tip-term:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: 2px; }
/* A view tool with a word: it names itself and its state ("Section 50 % L"). */
.dm-tool { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font: var(--fs-sm) var(--font-ui); cursor: pointer; }
.dm-tool:hover { background: var(--hover); color: var(--ink); }
.dm-tool[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dm-tool:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* "New design" dialog (new_design.js): the sheet of the New run dialog, with requirement rows. */
.nd-action { display: inline-flex; align-items: center; gap: var(--space-sm); margin-left: auto; }
.nd .field input[type="text"] { font-family: var(--font-ui); }
.nd-templates, .nd-requirements { gap: var(--space-sm); }
.nd-template { display: flex; align-items: flex-start; gap: var(--space-sm); padding: var(--space-sm); border: 1px solid var(--line); border-radius: var(--radius-md); cursor: pointer; }
.nd-template:has(input:checked) { border-color: var(--accent); background: var(--brand-soft); }
.nd-template input { margin-top: 3px; }
.nd-template-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nd-template-name { font-weight: 600; }
.nd-requirement { display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: center; column-gap: var(--space-md); row-gap: 2px; }
.nd-requirement label { color: var(--text-2); font-size: var(--fs-sm); }
.nd-requirement .field-help { grid-column: 1 / -1; margin: 0; }
.nd-input-unit { display: flex; align-items: center; gap: var(--space-xs); }
.nd-input-unit input { width: 0; flex: 1 1 auto; text-align: right; font-family: var(--font-mono) !important; }
.nd-unit { flex: none; width: 24px; color: var(--text-3); font: var(--fs-sm) var(--font-mono); }
.nd .field-error { color: var(--fail); }
.nd input[aria-invalid="true"] { border-color: var(--fail); }
.nd-progress { display: flex; flex-direction: column; gap: var(--space-xs); }
.nd-progress p { margin: 0; }
.nd-clock { font-family: var(--font-mono); }
/* Indeterminate: a band that moves; the loop reports no share done. Static under reduced motion. */
.nd-bar { position: relative; display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--sunken); }
.nd-bar > span { position: absolute; top: 0; bottom: 0; left: 0; width: 30%; border-radius: 2px; background: var(--brand); animation: nd-bar 1.4s ease-in-out infinite; }
@keyframes nd-bar { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .nd-bar > span { width: 100%; opacity: 0.35; animation: none; } }
.nd-result { display: flex; flex-direction: column; gap: var(--space-sm); }
.nd-result p { margin: 0; }
.nd-limit { padding: var(--space-sm); border-left: 2px solid var(--warn-ink); background: var(--warn-soft); color: var(--text); }
/* The record's hull notes under the hull's source line in the Model panel. */
.dm-hull-notes { display: flex; flex-direction: column; gap: 2px; margin: var(--space-xs) 0 0; padding-left: 1em; color: var(--ink-2); font-size: var(--fs-xs); }
/* The description sits on the selected template's tint: the second text colour keeps 4.5:1 in dark. */
.nd-template .field-help { color: var(--text-2); }

/* The method error line (design_brief_model.js, methodErrorLine): a quiet note where options are compared. */
.brief-error-note { margin: 0; padding-left: var(--space-sm); border-left: 2px solid var(--rule-strong); color: var(--ink-2); font-size: var(--fs-sm); }
.dm-error-note { margin: 0; padding: var(--space-2xs) var(--space-sm); border-top: 1px solid var(--rule); color: var(--ink-2); font-size: var(--fs-xs); }
/* An input outside a method's range, beside the values in the Model panel. */
.dm-range-warnings { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: var(--space-xs) var(--space-sm); border-left: 2px solid var(--warn-ink); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-xs); list-style: none; }

/* Economic brief (economic_brief.js): the assumptions, the result and the interval chart. */
.econ-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: var(--space-md); }
.econ-table[hidden] { display: none; }
.econ-group { display: flex; flex-direction: column; gap: var(--space-xs); margin: 0; padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.econ-group legend { padding: 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
.econ-row { display: grid; grid-template-columns: minmax(0, 1fr) 168px 104px; align-items: center; column-gap: var(--space-sm); row-gap: 2px; font-size: var(--fs-sm); }
.econ-row label { color: var(--ink-2); }
.econ-row input { width: 0; flex: 1 1 auto; height: 28px; padding: 0 var(--space-xs); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); text-align: right; font: var(--fs-sm) var(--font-mono); }
.econ-row input[aria-invalid="true"] { border-color: var(--fail); }
.econ-unit { width: 60px; }
.econ-origin { display: inline-flex; align-items: center; gap: var(--space-xs); justify-self: start; }
.econ-example { background: var(--sunken); color: var(--ink-2); }
.econ-reset { padding: 0; border: 0; background: none; color: var(--brand); font: var(--fs-xs) var(--font-ui); cursor: pointer; text-decoration: underline; }
.econ-row .econ-error, .econ-row .econ-help { grid-column: 1 / -1; margin: 0; }
.econ-row .econ-error { color: var(--fail); }
.econ-lite { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.econ-summary { margin: 0; color: var(--ink-2); }
.econ-result { display: flex; flex-direction: column; gap: var(--space-sm); }
.econ-used-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-sm); }
.econ-used summary { color: var(--brand); cursor: pointer; }
.econ-used-list { display: flex; flex-direction: column; gap: 2px; margin: var(--space-xs) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.econ-used-value { font-family: var(--font-mono); }
.econ-reference { margin: 0; font-weight: 600; }
.econ-result-line { margin: 0; padding: var(--space-sm) var(--space-md); border-left: 3px solid var(--brand); background: var(--sunken); color: var(--ink); }
.econ-basis { margin: 0; }
.econ-option-rate { margin: 2px 0 0; font-weight: 600; }
.econ-margin { margin: 2px 0 0; color: var(--ink-2); font-size: var(--fs-sm); }
.econ-details summary { color: var(--brand); cursor: pointer; font-size: var(--fs-sm); }
.econ-breakdown { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-xs); }
.econ-breakdown-table { width: auto !important; min-width: 520px; max-width: 760px; font-size: var(--fs-sm); }
.econ-breakdown-table td, .econ-breakdown-table th { padding: 3px var(--space-md) 3px 0; }
.econ-breakdown-table th[scope="row"] { text-align: left; color: var(--ink-2); font-weight: 400; }
.econ-split-bar { display: flex; height: 8px; max-width: 360px; overflow: hidden; border-radius: 2px; }
.econ-split-bar [data-part="capital"] { background: var(--series-1); }
.econ-split-bar [data-part="fuel"] { background: var(--series-2); }
.econ-split-bar [data-part="fixed"] { background: var(--series-3); }
.rate-chart { margin: 0; padding: var(--space-sm) 0; }
.rate-chart-title { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.rate-rows { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-sm); }
.rate-row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(160px, 1fr) minmax(200px, auto); align-items: center; column-gap: var(--space-md); font-size: var(--fs-sm); }
.rate-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rate-row[data-reference="true"] .rate-name { font-weight: 600; }
.rate-track { position: relative; height: 18px; }
.rate-band { position: absolute; top: -4px; bottom: -4px; background: var(--brand-soft); }
.rate-bar { position: absolute; top: 8px; height: 2px; background: var(--ink-2); }
.rate-bar::before, .rate-bar::after { content: ''; position: absolute; top: -4px; width: 1px; height: 10px; background: var(--ink-2); }
.rate-bar::before { left: 0; }
.rate-bar::after { right: 0; }
.rate-dot { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--ink); }
.rate-row[data-reference="true"] .rate-dot { border-radius: 0; transform: rotate(45deg); background: var(--brand); }
.rate-value { color: var(--ink-2); font-family: var(--font-mono); font-size: var(--fs-xs); white-space: nowrap; }
.rate-axis .rate-track { height: 14px; border-top: 1px solid var(--rule); }
.rate-tick { position: absolute; top: 2px; transform: translateX(-50%); color: var(--ink-3); font: var(--fs-2xs) var(--font-mono); }
/* The required freight rate on an option card, and the brief rows in Compare. */
.ostrip-rfr { color: var(--ink); font: 600 var(--fs-xs) var(--font-mono); }
.ostrip-rfr[data-overlap="true"] { color: var(--ink-3); font-weight: 400; }
.compare-brief th[scope="colgroup"] { color: var(--ink-2); font-weight: 400; font-size: var(--fs-xs); text-align: left; }
.compare-brief-mark { padding: 0 4px; border: 1px solid var(--rule-strong); border-radius: var(--radius-chip); color: var(--ink-2); font-size: var(--fs-2xs); }
.compare-brief-state { color: var(--ink-3); font-size: var(--fs-xs); }

/* "The design loop" page (loop_playback.js): a recorded run, played back. Three kinds of step:
   runs today (solid), in development (outline), planned (dashed). The kind is also in words. */
.loop-view { overflow-y: auto; }
.loop-page { display: flex; flex-direction: column; gap: var(--space-md); max-width: 1180px; }
.loop-head h1 { margin: 0; font-size: var(--fs-2xl); }
.loop-lead { margin: var(--space-xs) 0 0; color: var(--ink-2); }
.loop-fixture { margin: 0; padding: var(--space-xs) var(--space-sm); border-left: 3px solid var(--warn-ink); background: var(--warn-soft); color: var(--ink); }
.loop-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-md); }
.loop-card { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 4px var(--space-sm); padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.loop-card > h2 { margin: 0; }
.loop-card > .loop-facts { grid-column: 1 / -1; }
.loop-card h2, .loop-diagram h2, .loop-compare h2, .loop-options h2, .loop-list h2 { margin: 0 0 var(--space-xs); color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
.loop-order-label { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.loop-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 0; font-size: var(--fs-sm); }
.loop-facts dt { color: var(--ink-3); }
.loop-facts dd { margin: 0 var(--space-sm) 0 0; font-family: var(--font-mono); }
.loop-controls { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-xs) var(--space-md); }
.loop-controls > .loop-loading { grid-column: 1 / -1; margin: 0; }
.loop-buttons { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.loop-recorded { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.loop-progress { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.loop-progress-bar { display: block; height: 100%; width: 0; background: var(--brand); }
.loop-clock { grid-row: 1; grid-column: 3; color: var(--ink-3); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }
.loop-legend { display: flex; flex-wrap: wrap; gap: var(--space-md); margin: 0 0 var(--space-sm); padding: 0; list-style: none; font-size: var(--fs-sm); }
.loop-legend li { display: inline-flex; align-items: center; gap: var(--space-xs); }
.loop-swatch { width: 18px; height: 12px; border-radius: 3px; }
.loop-swatch[data-kind="today"] { border: 1px solid var(--brand); background: var(--brand-soft); }
.loop-swatch[data-kind="development"] { border: 1px solid var(--ink-2); }
.loop-swatch[data-kind="planned"] { border: 1px dashed var(--ink-3); }
.loop-steps { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--space-sm); margin: 0; padding: 0; list-style: none; counter-reset: none; }
.loop-step { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.loop-node { display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); font-size: var(--fs-sm); transition: border-color 150ms ease-out, background-color 150ms ease-out; }
.loop-node[data-kind="today"] { border: 1px solid var(--rule-strong); background: var(--surface); }
.loop-node[data-kind="today"][data-state="running"] { border-color: var(--brand); background: var(--brand-soft); }
.loop-node[data-kind="today"][data-state="done"] { border-color: var(--brand); }
.loop-node-name { font-weight: 600; }
.loop-state { color: var(--brand); font-size: var(--fs-xs); }
.loop-result { color: var(--ink-2); font: var(--fs-xs) var(--font-mono); overflow-wrap: anywhere; }
.loop-asides { display: flex; flex-direction: column; gap: var(--space-xs); margin: 0; padding: 0; list-style: none; }
.loop-aside { min-height: 0; background: transparent; color: var(--ink-2); }
.loop-aside[data-kind="development"] { border: 1px solid var(--ink-3); }
.loop-aside[data-kind="planned"] { border: 1px dashed var(--ink-3); }
.loop-aside .loop-node-name { font-weight: 400; }
.loop-kind { color: var(--ink-3); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.02em; }
.loop-view-button { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--brand); font: var(--fs-xs) var(--font-ui); text-decoration: underline; cursor: pointer; }
.loop-options { margin-top: var(--space-md); }
.loop-options[hidden] { display: none; }
.loop-count { color: var(--ink-2); font-weight: 400; text-transform: none; }
.loop-lanes { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.loop-lane { display: grid; grid-template-columns: minmax(120px, 180px) minmax(140px, 1fr) minmax(100px, 160px) minmax(90px, auto); align-items: center; gap: var(--space-sm); font-size: var(--fs-sm); }
.loop-cells { display: flex; gap: 3px; }
.loop-cell { flex: 1; height: 10px; border: 1px solid var(--rule-strong); border-radius: 2px; transition: background-color 150ms ease-out; }
.loop-cell[data-state="running"] { border-color: var(--brand); background: var(--brand-soft); }
.loop-cell[data-state="done"] { border-color: var(--brand); background: var(--brand); }
.loop-current { color: var(--ink-3); font-size: var(--fs-xs); }
.loop-lane-result { font: var(--fs-sm) var(--font-mono); text-align: right; }
.loop-lane-result[data-rejected="true"] { color: var(--ink-2); font-family: var(--font-ui); }
.loop-panel-host:empty { display: none; }
.loop-panel { margin-top: var(--space-md); padding: var(--space-md); border: 1px solid var(--ink-3); border-radius: var(--radius-md); }
.loop-panel h3 { display: flex; align-items: baseline; gap: var(--space-sm); margin: 0 0 var(--space-sm); font-size: var(--fs-md); }
/* One column: a long side view at the full panel width, a squarer picture at up to 60 %. */
.loop-pictures { display: flex; flex-direction: column; gap: var(--space-md); }
.loop-pictures figure { margin: 0; min-width: 0; }
.loop-pictures figure[data-shape="tile"] { max-width: 60%; }
.loop-pictures img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.loop-panel-note { margin: var(--space-sm) 0 0; color: var(--ink); font-size: var(--fs-sm); }
@media (max-width: 900px) {
  .loop-pictures figure[data-shape="tile"] { max-width: none; }
  /* A long side view keeps a readable size and scrolls sideways in its own box. */
  .loop-pictures figure[data-shape="long"] { overflow-x: auto; }
  .loop-pictures figure[data-shape="long"] img { min-width: 720px; }
}
.loop-pictures figure[data-shape="long"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.loop-pictures figcaption { color: var(--ink-2); font-size: var(--fs-xs); }
.loop-panel-table { width: auto !important; margin-top: var(--space-sm); font-size: var(--fs-sm); }
.loop-panel-table thead th { padding: 4px var(--space-sm); }
.loop-table { width: 100%; font-size: var(--fs-sm); }
.loop-table tr[data-kind="reference"] th { font-weight: 600; }
.loop-end { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.loop-end[hidden] { display: none; }
.loop-list ol { margin: 0; padding-left: 1.4em; font-size: var(--fs-sm); }
/* The deadweight the run reached, under the order (order.reached). */
.loop-facts dd.loop-reached { color: var(--ink); font-weight: 600; }
/* The ship stage (js/loop_ship.js): hull, then compartments, then the options' hulls. */
.loop-ship { display: flex; flex-direction: column; gap: var(--space-sm); margin: 0; padding: var(--space-md) var(--space-lg); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--card); }
.loop-ship h2 { margin: 0; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; }
.ship-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: var(--space-lg); align-items: start; }
.ship-frame { position: relative; min-height: 120px; }
.ship-svg { display: block; width: 100%; height: auto; transition: opacity 150ms ease; }
.ship-frame[data-hull="false"] .ship-svg { opacity: 0; }
.ship-frame[data-rooms="false"] .ship-rooms { display: none; }
.ship-waiting { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; border: 1px dashed var(--rule-strong); border-radius: var(--radius-md); color: var(--ink-3); font-size: var(--fs-sm); text-align: center; }
.ship-frame[data-hull="true"] .ship-waiting { display: none; }
.ship-water { fill: var(--water-fill); }
.ship-hull { fill: var(--hull-fill); }
.ship-line { fill: none; stroke: var(--hull-line); stroke-width: 1.6; stroke-linejoin: round; }
.ship-waterline { stroke: var(--brand); stroke-width: 1.2; }
.ship-centreline { stroke: var(--hull-line); stroke-width: 0.8; stroke-dasharray: 8 5; }
.ship-view-label { fill: var(--ink-2); font-size: 15px; }
.ship-room, .ship-swatch { --room: var(--tank-void); }
.ship-room { fill: color-mix(in srgb, var(--room) 70%, transparent); stroke: var(--hull-line); stroke-width: 0.8; }
:is(.ship-room, .ship-swatch)[data-kind="cargo"] { --room: var(--tank-cargo); }
:is(.ship-room, .ship-swatch)[data-kind="slop"] { --room: var(--tank-oily_residue); }
:is(.ship-room, .ship-swatch)[data-kind="ballast"] { --room: var(--tank-water_ballast); }
:is(.ship-room, .ship-swatch)[data-kind="fuel"] { --room: var(--tank-fuel_oil); }
:is(.ship-room, .ship-swatch)[data-kind="machinery"] { --room: var(--tank-other); }
.ship-legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); margin: var(--space-sm) 0 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--fs-sm); }
.ship-legend[hidden] { display: none; }
.ship-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ship-swatch { width: 14px; height: 10px; border: 1px solid var(--hull-line); border-radius: 2px; background: var(--room); }
.ship-values { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.ship-values li { padding-bottom: 6px; border-bottom: 1px solid var(--rule); color: var(--ink); }
.ship-options[hidden] { display: none; }
.ship-options-title { margin: 0 0 var(--space-sm); color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.ship-scale { color: var(--ink-3); font-weight: 400; }
.ship-option-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-sm); }
.ship-option { margin: 0; padding: var(--space-sm); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.ship-option-art { aspect-ratio: 4 / 1; }
.ship-option-art svg { display: block; width: 100%; height: 100%; transition: opacity 150ms ease; }
.ship-option[data-shown="false"] .ship-option-art { border: 1px dashed var(--rule); border-radius: var(--radius-sm); }
.ship-option[data-shown="false"] .ship-option-art svg { opacity: 0; }
.ship-option[data-rejected="true"] { border-style: dashed; color: var(--ink-2); }
.ship-option figcaption { margin-top: 4px; font-size: var(--fs-xs); }
@media (max-width: 900px) {
  .ship-main { grid-template-columns: minmax(0, 1fr); }
  .ship-option-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loop-ship { padding: var(--space-md); }
}
@media (prefers-reduced-motion: reduce) { .loop-node, .loop-cell, .ship-svg, .ship-option-art svg { transition: none; } }
@media (max-width: 900px) {
  .loop-steps { grid-template-columns: minmax(0, 1fr); }
  .loop-step { display: grid; grid-template-columns: minmax(0, 1fr); }
  .loop-lane { grid-template-columns: minmax(0, 1fr) auto; }
  .loop-lane .loop-cells { grid-column: 1 / -1; grid-row: 2; }
  .loop-lane .loop-current { display: none; }
  .loop-controls { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- The project's Run view (js/run_view.js): a run monitor that fills the window ---------- */
.design-body:is([data-page="run"], [data-page="agent"], [data-page="stability"], [data-page="structure"], [data-page="cfd"], [data-page="seakeeping"]) { max-width: none; }
.design-view-host { gap: 0; }
.run-view { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.run-empty { padding: var(--space-xl) 0; color: var(--ink-3); }
.run-bar { display: flex; align-items: center; gap: var(--space-md); padding: 6px var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.run-title { display: flex; align-items: baseline; gap: var(--space-sm); min-width: 0; white-space: nowrap; }
.run-id { font-family: var(--font-mono); font-size: var(--fs-sm); }
.run-name { overflow: hidden; color: var(--ink-2); font-size: var(--fs-sm); text-overflow: ellipsis; }
.run-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.run-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.run-status[data-state="running"]::before { animation: pulse 1.2s ease-in-out infinite; }
.run-status[data-state="done"] { background: var(--pass-soft); color: var(--pass); }
.run-progress { flex: 1 1 auto; height: 4px; min-width: 80px; overflow: hidden; border-radius: 2px; background: var(--rule); }
.run-progress-fill { height: 100%; background: var(--brand); }
.run-clock { color: var(--ink-2); font: var(--fs-xs) var(--font-mono); white-space: nowrap; }

.run-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 310px; gap: var(--space-sm); align-items: stretch; }
.run-panel { display: flex; flex-direction: column; min-width: 0; padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
.design-body .run-panel h2, .design-body .run-view .loop-ship h2 { margin: 0 0 6px; color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
:lang(ko) .design-body .run-panel h2 { letter-spacing: 0; }

.run-steps { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.run-step { position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; column-gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--rule); font-size: var(--fs-sm); }
.run-step:last-child { border-bottom: 0; }
.run-step-icon { display: grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--rule-strong); border-radius: 50%; color: var(--on-brand); font-size: 9px; line-height: 1; }
.run-step-name { color: var(--ink-3); }
.run-step-time { color: var(--ink-3); font: var(--fs-xs) var(--font-mono); text-align: right; }
.run-step-meter { position: absolute; right: 0; bottom: -1px; left: 24px; height: 2px; }
.run-step-meter > span { display: block; width: 0; height: 100%; background: var(--brand); }
.run-step:not([data-state="running"]) .run-step-meter { display: none; }
.run-step[data-state="running"] .run-step-icon { border-color: var(--brand); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.run-step[data-state="running"] .run-step-name, .run-step[data-state="done"] .run-step-name { color: var(--ink); }
.run-step[data-state="running"] .run-step-name { font-weight: 600; }
.run-step[data-state="done"] .run-step-icon { border-color: var(--pass); background: var(--pass); }
.run-step[data-kind="feedback"] { padding-left: 14px; }
.run-step[data-kind="feedback"] .run-step-name::before { content: "↺ "; color: var(--brand); }
.run-step[data-kind="feedback"] .run-step-meter { left: 38px; }

.run-centre { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.run-view .loop-ship { margin: 0; padding: var(--space-sm) var(--space-md); border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); gap: 4px; }
.run-view .ship-main { display: block; }
.run-view .ship-values, .run-view .ship-options { display: none; }
.run-view .ship-svg { max-height: 300px; }
.run-view .ship-legend { margin-top: 4px; font-size: var(--fs-xs); }

.run-matrix { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.run-matrix th, .run-matrix td { padding: 5px 4px; border-bottom: 1px solid var(--rule); text-align: left; }
.run-matrix thead th { color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; line-height: 1.2; vertical-align: bottom; }
.run-matrix .run-col, .run-matrix .run-cell { text-align: right; }
.run-matrix .run-col { overflow-wrap: normal; }
.run-matrix .run-unit { display: block; margin-top: 3px; color: var(--ink-3); font-weight: 400; white-space: nowrap; }
.run-matrix .run-cell { font-family: var(--font-mono); font-size: var(--fs-xs); white-space: nowrap; }
.run-matrix tr { cursor: pointer; }
.run-matrix thead tr { cursor: default; }
.run-matrix tbody tr:hover { background: var(--surface-2); }
.run-matrix tbody th { padding: 0; }
.run-design { display: flex; align-items: baseline; gap: 5px; width: 100%; padding: 5px 6px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.run-design .ws-swatch { align-self: center; width: 8px; height: 8px; }
.run-design:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.run-matrix tr[data-selected="true"] .run-design { box-shadow: inset 2px 0 var(--brand); background: var(--brand-soft); }
.run-cell[data-state="running"]::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: pulse 1s ease-in-out infinite; }
.run-matrix tr[data-rejected="true"] { color: var(--ink-3); }
.run-matrix .run-cell[data-state="rejected"] { color: var(--fail); font-family: var(--font-ui); font-weight: 600; }
.run-cell[data-best="true"] { background: var(--brand-soft); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .run-cell[data-state="running"]::after { animation: none; } }
.run-parent-row th { color: var(--ink-2); }

.run-side { display: flex; flex-direction: column; gap: var(--space-sm); min-height: 0; }
.run-results { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px var(--space-sm); margin: 0; font-size: var(--fs-sm); }
.run-results dt { min-width: 0; color: var(--ink-2); overflow-wrap: break-word; }
.run-results dd { margin: 0; color: var(--ink); font-family: var(--font-mono); font-size: var(--fs-xs); text-align: right; white-space: nowrap; }
.run-log-panel { flex: 1 1 0; min-height: 160px; }
.run-log { flex: 1 1 0; min-height: 0; max-height: 300px; margin: 0; padding: 0; overflow-y: auto; list-style: none; font: 11px/1.5 var(--font-mono); }
.run-log li { display: grid; grid-template-columns: 52px 18px minmax(0, 1fr); gap: 4px; color: var(--ink-2); }
.run-log-time { color: var(--ink-3); }
.run-log-scope { color: var(--brand); font-weight: 600; }
.run-log li[data-kind="end"], .run-log li[data-kind="option-end"] { color: var(--ink); }
.run-log li[data-kind="rejected"] { color: var(--fail); }
.pv-empty { padding: var(--space-xl) 0; color: var(--ink-3); }
.run-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--space-sm); margin: auto 0 0; padding-top: var(--space-sm); border-top: 1px solid var(--rule-strong); font-size: var(--fs-sm); }
.run-summary dt { color: var(--ink-3); }
.run-summary dd { margin: 0; font-family: var(--font-mono); font-size: var(--fs-xs); text-align: right; }
.run-grid { min-height: calc(100vh - 230px); }

/* ---------- Line charts (js/line_chart.js) ---------- */
.line-chart { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.lc-grid line { stroke: var(--rule); stroke-width: 1; }
.lc-axis line { stroke: var(--rule-strong); }
.lc-axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font-mono); }
.lc-axis .lc-label { fill: var(--ink-2); font-family: var(--font-ui); font-size: 11px; }
.lc-reference line { stroke: var(--ink-3); stroke-dasharray: 5 4; }
.lc-reference text { fill: var(--ink-3); font-size: 11px; }
.lc-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.lc-line[data-style="dashed"] { stroke-dasharray: 6 4; }
.lc-line[data-series="best"] { stroke: var(--pass); }
.lc-line[data-series="empirical"] { stroke: var(--ink-3); }
.lc-line[data-series="h1"] { stroke: var(--design-1); }
.lc-line[data-series="h2"] { stroke: var(--design-2); }
.lc-line[data-series="h3"] { stroke: var(--design-3); }
.lc-line[data-series="h4"] { stroke: var(--design-4); }
.lc-points circle { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.lc-points circle[data-state="rejected"] { fill: var(--fail); stroke: var(--fail); }
.lc-points circle[data-state="best"] { fill: var(--pass); stroke: var(--pass); }

/* ---------- Project views (js/project_views.js) ---------- */
.pv { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.pv-panel { gap: 6px; }
.pv-two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--space-sm); align-items: start; }
.pv-stability > .pv-two { align-items: stretch; }
.pv-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.pv-column { display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; }
.pv-spacer { flex: 1 1 auto; }
.pv-chart { min-width: 0; }
.pv-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.pv-table th, .pv-table td { padding: 4px 6px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.pv-table thead th { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.pv-table .pv-num { font-family: var(--font-mono); font-size: var(--fs-xs); text-align: right; white-space: nowrap; }
.pv-compact td { padding: 2px 6px; font-size: var(--fs-xs); }
.pv-mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.pv-check { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.pv-check[data-passes="true"] { background: var(--pass-soft); color: var(--pass); }
.pv-check[data-passes="false"] { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); }
.pv-select { cursor: pointer; }
.pv-select:hover { background: var(--hover); }
.pv-select[data-selected="true"] { background: var(--brand-soft); }
.pv-select:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pv-condition { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pv-subtitle { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.pv-facts { grid-template-columns: minmax(0, 1fr) auto; }
.pv-key { display: flex; flex-wrap: wrap; gap: var(--space-md); margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--fs-xs); }
.pv-key li::before { content: ""; display: inline-block; width: 16px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--brand); }
.pv-key li[data-series="empirical"]::before { background: repeating-linear-gradient(90deg, var(--ink-3) 0 6px, transparent 6px 10px); }
.pv-key li[data-series="h1"]::before { background: var(--design-1); }
.pv-key li[data-series="h2"]::before { background: var(--design-2); }
.pv-key li[data-series="h3"]::before { background: var(--design-3); }
.pv-figure { margin: 0; min-width: 0; }
.pv-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--sunken); }
.pv-figure figcaption { margin-top: 4px; color: var(--ink-2); font-size: var(--fs-xs); }
.pv-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.pv-scale { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-2); font: var(--fs-xs) var(--font-mono); }
.pv-scale-bar { flex: 1 1 auto; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #00007f, #0000ff, #007fff, #00ffff, #7fff7f, #ffff00, #ff7f00, #ff0000, #7f0000); }
.pv-use { position: relative; display: inline-block; width: 90px; height: 14px; border-radius: 2px; background: var(--sunken); vertical-align: middle; }
.pv-use-bar { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: color-mix(in srgb, var(--brand) 45%, transparent); }
.pv-use-text { position: relative; padding-left: 4px; font: 10px/14px var(--font-mono); }
.pv-midship { display: block; width: 100%; height: auto; max-height: 300px; }
.pv-ms-shell { fill: none; stroke: var(--ink); stroke-width: 2.4; }
.pv-ms-inner { fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.pv-ms-cargo { fill: var(--brand-soft); }
.pv-ms-stiff { stroke: var(--ink-3); stroke-width: 1; }
.pv-ms-centre { stroke: var(--ink-3); stroke-dasharray: 8 3 2 3; }
.pv-ms-dim { fill: var(--ink-2); font: 11px var(--font-mono); }
.pv-agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--space-sm); min-height: calc(100vh - 230px); }
.pv-agent-grid > .pv-panel { min-height: 0; }
.pv-log-box { flex: 1 1 0; min-height: 0; max-height: calc(100vh - 290px); overflow-y: auto; }
.pv-agent-log td { font-size: var(--fs-xs); }
.pv-agent-log tr[data-latest="true"] { background: var(--brand-soft); animation: dm-pop-in 240ms var(--ease-out); }
.pv-agent-log tr[data-outcome="rejected"] td { color: var(--ink-3); }
.pv-reason { color: var(--ink-2); }
.pv-limit { color: var(--fail); }
.pv-outcome { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.pv-outcome[data-outcome="best"] { background: var(--pass-soft); color: var(--pass); }
.pv-outcome[data-outcome="rejected"] { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); }
.pv-best { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.pv-current { display: flex; flex-direction: column; gap: 4px; }
.pv-current p { margin: 0; }
.pv-current-change { font-size: var(--fs-lg); font-weight: 600; }
.pv-current-reason { color: var(--ink-2); }
.pv-log-box thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.pv-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; }
.pv-gallery .pv-figure img { height: 230px; object-fit: contain; background: var(--surface); }
.pv-structure > .pv-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: stretch; }
.pv-structure .pv-midship { max-height: 230px; margin: auto 0; }
.pv-structure .pv-figure img { max-height: 160px; object-fit: contain; }
.pv-ms-ballast { fill: color-mix(in srgb, var(--pass) 18%, transparent); }
.pv-trying { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; margin-bottom: 4px !important; border-bottom: 1px solid var(--rule); color: var(--brand); font-size: var(--fs-sm); font-weight: 600; }
.pv-spinner { width: 12px; height: 12px; border: 2px solid var(--brand); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.pv-agent-log tr[data-outcome="rejected"] .pv-outcome { background: color-mix(in srgb, var(--fail) 14%, transparent); }
.project-table, .library-table { margin-top: var(--space-sm); }
.project-table td, .library-table td { padding-top: 7px; padding-bottom: 7px; }
.library { gap: var(--space-sm); max-width: none; }
[data-demo="read-only"] .rail-item.demo-only { display: flex; }
.library-table, .project-table { width: 100%; }
.run-results-panel dt { display: flex; align-items: flex-start; gap: 7px; }
.result-icon { flex: none; width: 22px; height: 16.5px; fill: none; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.result-icon .ri-base { stroke: var(--ink-3); }
.result-icon .ri-guide { stroke: var(--brand); stroke-dasharray: 1.6 1.2; opacity: 0.7; }
.result-icon .ri-mark { stroke: var(--brand); stroke-width: 1.3; }
.result-icon .ri-thick { stroke-width: 2.2; }
.result-icon .ri-dashed { stroke-dasharray: 1.6 1.2; }
.result-icon .ri-fill { fill: color-mix(in srgb, var(--brand) 35%, transparent); stroke: var(--brand); stroke-width: 0.9; }
.lib-sub { display: block; margin-top: 2px; color: var(--ink-3); font-size: var(--fs-xs); }
.lib-none { color: var(--ink-3); }
.library-table td { vertical-align: middle; }
.library-table td a { margin-right: var(--space-sm); }
.lib-action { text-align: right; white-space: nowrap; }
.library-table .lib-vessel { width: 38%; }
.library-table .lib-date { white-space: nowrap; overflow-wrap: normal; }
.run-design { white-space: nowrap; }
.run-matrix thead th { vertical-align: bottom; white-space: nowrap; }
