/* src/client/tokens.css: the shipped design tokens, v2 (CASE-163; CASE-112 to CASE-125 still hold).
   This is the single source of every colour, size, weight, radius and z-index a window uses.
   prototypes/design/tokens.css is an @import of this file (scripts/check-case.mjs fails if it stops
   being one); prototypes/room/lib/tokens.css is a mirror that tests/contrast.test.mjs keeps equal.
   tests/contrast.test.mjs checks every text and non-text pair in BOTH themes, and tests/z-index.test.mjs
   forbids raw z-index literals.

   Colour carries three signals and nothing else:
   - ZONES: neutral foundations; the private facilitator zone is violet-tinted; only the decision
     column carries the option colours.
   - PHASE STATE: one accent per phase on the phase chip's tessera and tint, never a flood and never a
     side or top rail: open = green, locked = amber, reveal = petrol, consequence = coral, paused = slate.
   - CONTROL PRIORITY: one filled primary action per screen (petrol), secondary tinted, quiet neutral,
     tertiary plain text, destructive a coral outline.
   Petrol is never a clinical meaning; clinical meaning is never colour alone (icon + text). */

/* Montserrat (SIL OFL 1.1) and JetBrains Mono (SIL OFL 1.1), self-hosted (NOTICE.md): never loaded from
   a third-party font service, so no participant's address leaves Case. No serif face anywhere (CASE-112). */
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/montserrat-latin.06b16db7a969135d48d38c49183be7fb88d4452e2a3011957c7851941f4e4879.woff2) format('woff2');
  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: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/montserrat-latin-ext.54d9a78b7ff60b689ad9f3017ffac8547b5d871afec733f6c1c3ae36577ee504.woff2) format('woff2');
  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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/assets/jetbrains-mono-latin.83c005d49d8a6a50474c73a5a36ac0468076e9c4a29da7bdb14995d80560a5be.woff2) format('woff2');
  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;
}

:root {
  color-scheme: light;
  /* foundations — neutral */
  --ground: #f3f5f5;
  --surface: #ffffff;
  --sunken: #e8edee;
  --line: #d5dddf;
  --field-line: #6f7f81;      /* control borders: 3:1 non-text  */
  --ink: #16242a;
  --ink-muted: #4a5b62;
  /* orientation band */
  --nav-bg: #ffffff;
  --nav-line: #d5dddf;
  --nav-ink: #16242a;
  --qr-card: #ffffff;
  /* An ECG's card stays light, with dark ink for its text alternative, in every theme (card 59). */
  --figure-card: #ffffff; --figure-ink: #16242a;
  /* control priority */
  --petrol: #0f5566;
  --petrol-deep: #0a4150;
  --on-petrol: #ffffff;
  --petrol-tint: #e1eeef;
  --petrol-ink: #0d4a58;
  --focus: #0f5566;
  --quiet: #eef2f3;
  --quiet-ink: #16242a;
  /* phase state: fill (chip tessera) + tint (chip, soft states) + ink on tint */
  --ph-open: #276b4c;        --ph-open-tint: #ddefe5;        --ph-open-ink: #1a503a;
  --ph-locked: #8a5200;      --ph-locked-tint: #f6e6c8;      --ph-locked-ink: #693e00;
  --ph-reveal: #0f5566;      --ph-reveal-tint: #dcebeb;      --ph-reveal-ink: #0d4a58;
  --ph-consequence: #b5432e; --ph-consequence-tint: #f9e3dc; --ph-consequence-ink: #8c301f;
  --ph-paused: #4b575e;      --ph-paused-tint: #e5e8e8;      --ph-paused-ink: #37424a;
  --on-phase: #ffffff;
  /* status (not phase): destructive, offline, manual room */
  --alert: #a8372a;          --alert-tint: #f8e1da;          --alert-ink: #8c2e1d;
  --manual: #7a4c0a;         --manual-tint: #f4e5c6;         --manual-ink: #623c06;
  --ok: #26603f;             --ok-tint: #dcefe2;             --ok-ink: #17503a;
  --private: #5b4fa3;        --private-tint: #eeecf8;        --private-ink: #3f357d;
  --tile-tint: 12%;
  /* elevation and shape */
  --shadow-1: 0 1px 2px rgba(22, 36, 42, .06);
  --shadow-2: 0 12px 32px rgba(22, 36, 42, .14);
  /* radius — one scale tied to element size (Apple-style): small things are nearly square, large
     surfaces are soft. Nested corners are concentric: inner = outer − padding (never below --radius-xs).
     Capsules are reserved for avatars and switches; nothing else is a pill. */
  --radius-xs: 3px;
  --radius-chip: 6px;
  --radius-sm: 8px;           /* controls: buttons, fields, segmented items, small covers */
  --radius: 12px;             /* cards, option tiles, covers, timeline items */
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;       /* avatars and switches only */
  --tessera: 8px;
  /* spacing: 4 · 8 · 12 · 16 · 24 · 32 · 48 · 64 · 96 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --sp-8: 64px; --sp-9: 96px;
  /* layout */
  --measure: 68ch;            /* prose */
  --form-w: 26rem;            /* join, sign-in, dialogs */
  --page-w: 1200px;           /* library, admin */
  --header-h: 64px;
  /* type: one family, one tight scale (CASE-112) + display steps for arrival and projector */
  --sans: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 24px; --t-code: 32px;
  --t-2xl: 32px; --t-3xl: 44px;
  --w-regular: 400; --w-medium: 500; --w-semibold: 600; --w-bold: 700;
  --lh-tight: 1.2; --lh: 1.5;
  --track-caps: .08em;
  /* projector (CASE-083 body minimum; further steps derived from it) */
  --projector-body: 24px;
  --projector-title: 44px;
  --projector-code: clamp(72px, 5vw, 120px);
  --projector-qr: clamp(180px, 31vh, 340px);  /* lobby QR: about 335 px at 1080p, 223 px at 720p (Julian, 2026-10-07) */
  /* option marks: same names, shapes and positions (CASE-088), hues pulled into the Case palette.
     Each fill keeps 3:1 on every ground, on its own tile, and under its white glyph (yellow keeps its CASE-115
     edge exception). Solved against these v2 grounds; see design-system.html. */
  --mark-red: #d34b36; --mark-blue: #5e74cc; --mark-yellow: #e9a51d; --mark-yellow-edge: #6e5208; --mark-green: #378862;
  --mark-purple: #9c61b5; --mark-teal: #21858c; --mark-orange: #ba611c; --mark-grey: #6b7b82;
  /* Slide palette (CASE-225): every slide fill and text colour comes from these tokens, derived from the marks and the
     theme's ink and surface so light and dark adapt. A presentation theme overrides only these; the design gates test
     each pair (text colours at 7:1 on the slide). */
  --slide-fill-soft: var(--quiet);
  --slide-fill-blue: color-mix(in srgb, var(--mark-blue) 12%, var(--surface));
  --slide-fill-teal: color-mix(in srgb, var(--mark-teal) 12%, var(--surface));
  --slide-fill-green: color-mix(in srgb, var(--mark-green) 12%, var(--surface));
  --slide-fill-purple: color-mix(in srgb, var(--mark-purple) 12%, var(--surface));
  --slide-fill-coral: color-mix(in srgb, var(--mark-red) 12%, var(--surface));
  --slide-fill-orange: color-mix(in srgb, var(--mark-orange) 12%, var(--surface));
  --slide-fill-amber: color-mix(in srgb, var(--mark-yellow) 12%, var(--surface));
  --slide-fill-grey: color-mix(in srgb, var(--mark-grey) 12%, var(--surface));
  --slide-ink-blue: color-mix(in srgb, var(--mark-blue) 50%, var(--ink));
  --slide-ink-teal: color-mix(in srgb, var(--mark-teal) 50%, var(--ink));
  --slide-ink-green: color-mix(in srgb, var(--mark-green) 50%, var(--ink));
  --slide-ink-purple: color-mix(in srgb, var(--mark-purple) 50%, var(--ink));
  --slide-ink-coral: color-mix(in srgb, var(--mark-red) 50%, var(--ink));
  --slide-ink-orange: color-mix(in srgb, var(--mark-orange) 50%, var(--ink));
  --slide-ink-amber: color-mix(in srgb, var(--mark-yellow) 30%, var(--ink));
  --slide-ink-grey: color-mix(in srgb, var(--mark-grey) 50%, var(--ink));
  /* fixed previews of each theme's ground for the Appearance chooser (not themed) */
  --preview-light: #f3f5f5; --preview-dark: #12181b;
  /* z-index bands (a raw number never appears in a window: tests/z-index.test.mjs) */
  --z-raised: 1; --z-sticky: 100; --z-dock: 110; --z-toast: 300; --z-overlay: 400;
  /* motion: one easing, two UI durations and the living-art timings (splash-motion.mjs). All motion is opt-in
     (reduced motion, Motion in Appearance), pauses when hidden and never runs on working surfaces. */
  --ease: cubic-bezier(.2, .7, .2, 1); --dur-1: 120ms; --dur-2: 240ms;
  --art-arrival-tile: 420ms; --art-arrival-span: 1300ms; --art-current: 800ms; --art-lay: 420ms;
  --art-join-hold: 1500ms; --art-join-flight: 600ms; --art-join-queue: 400ms;
}

/* Dark: same roles. Charcoal foundations. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #12181b; --surface: #1a2226; --sunken: #0d1214; --line: #2a353a; --field-line: #7f9599;
    --ink: #e7edef; --ink-muted: #a9b7bc;
    --nav-bg: #161d20; --nav-line: #2a353a; --nav-ink: #e7edef; --qr-card: #ffffff;
    --petrol: #6cc2cf; --petrol-deep: #8fd3dd; --on-petrol: #062228; --petrol-tint: #193a41; --petrol-ink: #a9e0e8; --focus: #8fd3dd;
    --quiet: #222c30; --quiet-ink: #e7edef;
    --ph-open: #57c08c; --ph-open-tint: #143a28; --ph-open-ink: #a5e6c4;
    --ph-locked: #e3a74c; --ph-locked-tint: #3d2c10; --ph-locked-ink: #f3cf96;
    --ph-reveal: #6cc2cf; --ph-reveal-tint: #173d46; --ph-reveal-ink: #a9e0e8;
    --ph-consequence: #f08b72; --ph-consequence-tint: #432019; --ph-consequence-ink: #f8bcab;
    --ph-paused: #9eabb1; --ph-paused-tint: #252f34; --ph-paused-ink: #cfd8dc;
    --on-phase: #0a1a1f;
    --alert: #f08b72; --alert-tint: #432019; --alert-ink: #f8bcab;
    --manual: #e3a74c; --manual-tint: #3d2c10; --manual-ink: #f3cf96;
    --ok: #57c08c; --ok-tint: #143a28; --ok-ink: #a5e6c4;
    --private: #a99cf0; --private-tint: #272340; --private-ink: #d2caff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #12181b; --surface: #1a2226; --sunken: #0d1214; --line: #2a353a; --field-line: #7f9599;
  --ink: #e7edef; --ink-muted: #a9b7bc;
  --nav-bg: #161d20; --nav-line: #2a353a; --nav-ink: #e7edef; --qr-card: #ffffff;
  --petrol: #6cc2cf; --petrol-deep: #8fd3dd; --on-petrol: #062228; --petrol-tint: #193a41; --petrol-ink: #a9e0e8; --focus: #8fd3dd;
  --quiet: #222c30; --quiet-ink: #e7edef;
  --ph-open: #57c08c; --ph-open-tint: #143a28; --ph-open-ink: #a5e6c4;
  --ph-locked: #e3a74c; --ph-locked-tint: #3d2c10; --ph-locked-ink: #f3cf96;
  --ph-reveal: #6cc2cf; --ph-reveal-tint: #173d46; --ph-reveal-ink: #a9e0e8;
  --ph-consequence: #f08b72; --ph-consequence-tint: #432019; --ph-consequence-ink: #f8bcab;
  --ph-paused: #9eabb1; --ph-paused-tint: #252f34; --ph-paused-ink: #cfd8dc;
  --on-phase: #0a1a1f;
  --alert: #f08b72; --alert-tint: #432019; --alert-ink: #f8bcab;
  --manual: #e3a74c; --manual-tint: #3d2c10; --manual-ink: #f3cf96;
  --ok: #57c08c; --ok-tint: #143a28; --ok-ink: #a5e6c4;
  --private: #a99cf0; --private-tint: #272340; --private-ink: #d2caff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 12px 32px rgba(0, 0, 0, .5);
}

/* ── Presentation themes (CASE-227) ──
   A case may choose one; the slide renderer adds slide-theme-<name> to the slide root. A theme sets the slide's own
   ground, ink and lines; its fills and text colours derive from the shared marks, so they are declared again inside
   the theme (a token derived at :root would keep the room's values). Option marks never change: they mean the same on
   every phone. The Builder's editing chrome on a slide uses the theme's own accent, so selection stays visible.
   Every pair is checked at 7:1 by the design gates (tests/design-gates.test.mjs, slide themes). */
.slide-theme-clinic, .slide-theme-night, .slide-theme-print {
  --slide-fill-soft: var(--quiet);
  --slide-fill-blue: color-mix(in srgb, var(--mark-blue) var(--slide-fill-mix), var(--surface));
  --slide-fill-teal: color-mix(in srgb, var(--mark-teal) var(--slide-fill-mix), var(--surface));
  --slide-fill-green: color-mix(in srgb, var(--mark-green) var(--slide-fill-mix), var(--surface));
  --slide-fill-purple: color-mix(in srgb, var(--mark-purple) var(--slide-fill-mix), var(--surface));
  --slide-fill-coral: color-mix(in srgb, var(--mark-red) var(--slide-fill-mix), var(--surface));
  --slide-fill-orange: color-mix(in srgb, var(--mark-orange) var(--slide-fill-mix), var(--surface));
  --slide-fill-amber: color-mix(in srgb, var(--mark-yellow) var(--slide-fill-mix), var(--surface));
  --slide-fill-grey: color-mix(in srgb, var(--mark-grey) var(--slide-fill-mix), var(--surface));
  --slide-ink-blue: color-mix(in srgb, var(--mark-blue) var(--slide-ink-mix), var(--ink));
  --slide-ink-teal: color-mix(in srgb, var(--mark-teal) var(--slide-ink-mix), var(--ink));
  --slide-ink-green: color-mix(in srgb, var(--mark-green) var(--slide-ink-mix), var(--ink));
  --slide-ink-purple: color-mix(in srgb, var(--mark-purple) var(--slide-ink-mix), var(--ink));
  --slide-ink-coral: color-mix(in srgb, var(--mark-red) var(--slide-ink-mix), var(--ink));
  --slide-ink-orange: color-mix(in srgb, var(--mark-orange) var(--slide-ink-mix), var(--ink));
  --slide-ink-amber: color-mix(in srgb, var(--mark-yellow) var(--slide-ink-amber-mix), var(--ink));
  --slide-ink-grey: color-mix(in srgb, var(--mark-grey) var(--slide-ink-mix), var(--ink));
}
/* Clinic: cool and clear, for bright teaching rooms. */
.slide-theme-clinic { --surface: #f5f9fc; --ink: #0d2132; --ink-muted: #36495a; --line: #c2d2de; --quiet: #e3edf5;
  --slide-fill-mix: 14%; --slide-ink-mix: 50%; --slide-ink-amber-mix: 30%;
  --petrol: #0f5566; --petrol-deep: #0a4150; --on-petrol: #ffffff; --petrol-tint: #e1eeef; --petrol-ink: #0d4a58; --focus: #0f5566; }
/* Night: a dark slide for dim rooms and bright projectors. */
.slide-theme-night { --surface: #121820; --ink: #eef3f7; --ink-muted: #b8c4cf; --line: #33404c; --quiet: #1e2731;
  --slide-fill-mix: 24%; --slide-ink-mix: 42%; --slide-ink-amber-mix: 55%;
  --petrol: #6cc2cf; --petrol-deep: #8fd3dd; --on-petrol: #062228; --petrol-tint: #193a41; --petrol-ink: #a9e0e8; --focus: #8fd3dd; }
/* Print: black on white, like a handout. */
.slide-theme-print { --surface: #ffffff; --ink: #111111; --ink-muted: #404040; --line: #bdbdbd; --quiet: #f0f0f0;
  --slide-fill-mix: 10%; --slide-ink-mix: 55%; --slide-ink-amber-mix: 32%;
  --petrol: #0f5566; --petrol-deep: #0a4150; --on-petrol: #ffffff; --petrol-tint: #e1eeef; --petrol-ink: #0d4a58; --focus: #0f5566; }

/* ── base ── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: var(--w-regular) var(--t-md)/var(--lh) var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-weight: var(--w-semibold); line-height: var(--lh-tight); letter-spacing: -.01em; }
b, strong { font-weight: var(--w-semibold); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, button[aria-disabled="true"] { cursor: not-allowed; opacity: 1; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--petrol-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* Whole-slide fills (CASE-312): a slide's ground from the block palette, the same light/dark/theme --slide-fill-* tokens,
   so ink keeps 7:1 on every fill (design gates). Each surface paints its slide with var(--slide-ground, var(--surface)). */
.slide-fill-soft { --slide-ground: var(--slide-fill-soft); }
.slide-fill-blue { --slide-ground: var(--slide-fill-blue); }
.slide-fill-teal { --slide-ground: var(--slide-fill-teal); }
.slide-fill-green { --slide-ground: var(--slide-fill-green); }
.slide-fill-purple { --slide-ground: var(--slide-fill-purple); }
.slide-fill-coral { --slide-ground: var(--slide-fill-coral); }
.slide-fill-orange { --slide-ground: var(--slide-fill-orange); }
.slide-fill-amber { --slide-ground: var(--slide-fill-amber); }
.slide-fill-grey { --slide-ground: var(--slide-fill-grey); }
/* Blood gas reports (CASE-311): one block, groups as small tables that flow into two columns on a wide slide. */
.slide-gas-title { margin: 0; font-weight: var(--w-semibold); }
.slide-gas-groups { columns: 2; column-gap: 1.6em; }
.slide-reflow .slide-gas-groups { columns: 1; }
.slide-gas-table { break-inside: avoid; width: 100%; margin: 0 0 .5em; border-collapse: collapse; color: inherit; font: inherit; line-height: 1.25; font-variant-numeric: tabular-nums; table-layout: auto; }
.slide-gas-table caption { text-align: start; font-weight: var(--w-semibold); color: var(--ink-muted); font-size: .9em; padding: .1em 0; }
.slide-gas-table :is(th, td) { padding: .08em .35em; border-bottom: 1px solid var(--line); text-align: start; font-weight: var(--w-regular); white-space: nowrap; }
.slide-gas-table th { font-weight: var(--w-semibold); }
.slide-gas-table .slide-gas-flag { width: 1em; padding-inline: 0; text-align: center; }
.slide-gas-table :is(.slide-gas-value, .slide-gas-range) { text-align: end; }
.slide-gas-table .slide-unit { margin: 0; color: var(--ink-muted); }
.slide-gas-table .slide-gas-range { color: var(--ink-muted); }
.slide-gas-table :is(.slide-gas-high, .slide-gas-low) :is(th, .slide-gas-value, .slide-gas-flag) { font-weight: var(--w-bold); }
/* Compare mode (CASE-317): one table, so every sample's column lines up down the printout; the newest column is tinted. A
   phone scrolls the table sideways inside its card; the projector's fit pass shrinks it into its placement instead. */
.slide-gas-compare table { width: 100%; max-inline-size: 36em; border-collapse: collapse; color: inherit; font: inherit; line-height: 1.15; font-variant-numeric: tabular-nums; }
.slide-reflow .slide-gas-compare { overflow-x: auto; }
.slide-gas-compare :is(th, td) { padding: .03em .45em; border-bottom: 1px solid var(--line); text-align: start; font-weight: var(--w-regular); white-space: nowrap; }
.slide-gas-compare tbody th { font-weight: var(--w-semibold); }
.slide-gas-compare :is(thead th, .slide-gas-group th) { color: var(--ink-muted); font-size: .9em; font-weight: var(--w-semibold); }
.slide-gas-compare .slide-gas-group th { padding-top: .2em; font-size: .8em; }
.slide-gas-compare .slide-gas-cell { text-align: end; }
.slide-gas-compare :is(td, th).slide-gas-now { background: var(--petrol-tint); color: var(--ink); }
.slide-gas-compare :is(.slide-gas-high, .slide-gas-low) { font-weight: var(--w-bold); }
.slide-gas-compare .slide-gas-cell > [aria-hidden] { margin-inline-end: .15em; }
.slide-gas-compare :is(.slide-unit, .slide-gas-range) { margin: 0; color: var(--ink-muted); }
/* Trend charts (card 59 M1, CASE-263): one drawing for projector, phone, Builder and fit frames. Lengths are SVG user
   units, so labels scale with the chart. Series differ by marker shape as well as colour. */
.slide-canvas.slide-grid > .slide-block.slide-trend { display: flex; flex-direction: column; }
.slide-grid .slide-trend-chart { flex: 1 1 0; width: 100%; height: 100%; min-height: 0; }
.slide-reflow .slide-trend-chart { width: 100%; height: auto; aspect-ratio: 2; }
.slide-trend-chart text { font-size: 20px; fill: var(--ink-muted); }
.slide-trend-chart .slide-trend-value { font-size: 22px; fill: var(--ink); font-weight: var(--w-semibold); }
.slide-trend-axis { stroke: var(--ink-muted); stroke-width: 1.5; }
.slide-trend-grid { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 7; }
.slide-trend-line { fill: none; stroke-width: 3; stroke-linejoin: round; }
.slide-trend-s1 { stroke: var(--slide-ink-blue); fill: var(--slide-ink-blue); }
.slide-trend-s2 { stroke: var(--slide-ink-coral); fill: var(--slide-ink-coral); }
.slide-trend-s3 { stroke: var(--slide-ink-green); fill: var(--slide-ink-green); }
.slide-trend-s4 { stroke: var(--slide-ink-purple); fill: var(--slide-ink-purple); }
.slide-trend-line.slide-trend-s1, .slide-trend-line.slide-trend-s2, .slide-trend-line.slide-trend-s3, .slide-trend-line.slide-trend-s4 { fill: none; }
.slide-trend-legend { display: flex; flex-wrap: wrap; gap: .2em 1em; margin: 0; padding: 0; list-style: none; font-size: .8em; }
.slide-trend-key::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .35em; background: var(--slide-ink-blue); border-radius: 50%; }
.slide-trend-k2::before { background: var(--slide-ink-coral); border-radius: 0; }
.slide-trend-k3::before { background: var(--slide-ink-green); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.slide-trend-k4::before { background: var(--slide-ink-purple); border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.slide-trend-caption { margin: 0; font-size: .85em; color: var(--ink-muted); }
.slide-reflow .slide-trend-data { border-collapse: collapse; font-size: .85em; font-variant-numeric: tabular-nums; }
.slide-reflow .slide-trend-data :is(th, td) { padding: .15em .6em .15em 0; text-align: start; }
.slide-reflow .slide-trend-data caption { text-align: start; color: var(--ink-muted); }
/* Images and ECGs (card 59, CASE-268): the picture takes the block's room; text stays text. An ECG sits on a light card
   in every theme and is never inverted or cropped by the slide. */
.slide-canvas.slide-grid > .slide-block.slide-image { display: flex; flex-direction: column; }
.slide-figure { display: flex; flex: 1 1 auto; flex-direction: column; gap: .3em; min-height: 0; margin: 0; }
.slide-picture { display: block; max-width: 100%; height: auto; }
.slide-grid .slide-picture { flex: 1 1 0; width: 100%; height: 100%; min-height: 0; }
.slide-fit-contain { object-fit: contain; }
.slide-fit-cover { object-fit: cover; }
.slide-figure-ecg .slide-picture { background: var(--figure-card); color: var(--figure-ink); }
/* Card 59 M3: a video sits on the figure card until its first frame decodes. */
.slide-video { background: var(--figure-card); color: var(--figure-ink); }
.slide-image-missing { display: grid; flex: 1 1 auto; place-items: center; min-height: 3em; padding: .5em; border: 1px dashed var(--ink-muted); color: var(--ink-muted); text-align: center; }
.slide-figure figcaption { display: flex; flex-direction: column; gap: .1em; font-size: .8em; color: var(--ink-muted); }
.slide-figure .slide-figure-caption { color: var(--ink); }
.slide-figure-calibration { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* D23 hero slides (CASE-264): a slide's only block, in every row under its title, drawn the same in the projector, the
   Builder canvas, thumbnails and the fit frames. Centred across the slide, at the top by default or centred in the space;
   the box hugs its text (the fit pass then sets a centred column span), kept inside the area. A question, table or chart
   keeps the full width; a chart fills the height.
   A hero question's phase line keeps body size (--hero-scale is set by the fit pass). */
.slide-canvas.slide-grid > .slide-block.slide-hero { justify-self: center; align-self: start; max-width: 100%; max-height: 100%; }
.slide-canvas.slide-grid > .slide-block.slide-hero-centred { align-self: center; }
.slide-canvas.slide-grid > .slide-block.slide-hero-full { justify-self: stretch; }
.slide-canvas.slide-grid > .slide-block.slide-hero-full.slide-trend { align-self: stretch; }
.slide-hero.slide-question :is(.eyebrow, .decision .call) { font-size: calc(1em / var(--hero-scale, 1)); }
/* Selected in the Builder, a hero keeps its box and place (steady editing, CASE-249): these outrank the selected-block
   rules in builder-slides.css and builder-shell.css, which stretch a block over its area. */
.builder-studio .builder-slide .slide-grid > .slide-block.slide-hero[data-selected] { align-self: start; min-height: 0; }
.builder-studio .builder-slide .slide-grid > .slide-block.slide-hero-centred[data-selected] { align-self: center; }
.builder-studio .builder-slide .slide-grid > .slide-block.slide-hero-full.slide-trend[data-selected] { align-self: stretch; }
.builder-slide .slide-canvas > .slide-hero[data-blank] { justify-self: stretch; }
svg.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── controls: one primary, secondary tinted, tertiary text, destructive coral outline ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: var(--sp-2) var(--sp-4); border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--petrol-tint); color: var(--petrol-ink); font-size: var(--t-sm); font-weight: var(--w-semibold); line-height: 1.2; text-align: center; text-decoration: none; }
.btn.primary { background: var(--petrol); color: var(--on-petrol); }
.btn.primary:hover:not(:disabled) { background: var(--petrol-deep); }
.btn.quiet { background: var(--quiet); color: var(--quiet-ink); }
.btn.quiet:hover:not(:disabled) { background: var(--sunken); }
.btn.tertiary { background: transparent; color: var(--petrol-ink); padding-inline: var(--sp-2); }
.btn.tertiary:hover:not(:disabled) { background: var(--petrol-tint); }
.btn.danger { background: transparent; border-color: var(--alert); color: var(--alert-ink); }
.btn.icon { padding: 0; width: 44px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; padding: var(--sp-3) var(--sp-5); font-size: var(--t-md); }
.record-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); width: 100%; min-height: 44px; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.record-row:hover { background: var(--petrol-tint); color: var(--petrol-ink); }
.record-title { font-weight: var(--w-semibold); overflow-wrap: anywhere; }
.record-meta { font-size: var(--t-sm); color: var(--ink-muted); overflow-wrap: anywhere; }
.record-row:hover .record-meta { color: var(--petrol-ink); }

/* Disabled controls use explicit colours, not group opacity (CASE-125: at least 4.5:1). */
.btn:disabled, .btn[aria-disabled="true"] { color: var(--ink-muted); background: var(--sunken); border-color: var(--field-line); }

/* ── phase chip: tinted, with a leading tessera in the phase colour. No capsule, no card rail (CASE-163). ── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px; border-radius: var(--radius-chip); background: var(--ph-tint, var(--ph-reveal-tint)); color: var(--ph-ink, var(--ph-reveal-ink)); font-size: var(--t-xs); font-weight: var(--w-semibold); letter-spacing: .02em; white-space: nowrap; }
.pill::before { content: ""; flex: none; width: var(--tessera); height: var(--tessera); border-radius: 2px; background: var(--ph, var(--ph-reveal)); }
[data-phase="open"] { --ph: var(--ph-open); --ph-tint: var(--ph-open-tint); --ph-ink: var(--ph-open-ink); }
[data-phase="locked"] { --ph: var(--ph-locked); --ph-tint: var(--ph-locked-tint); --ph-ink: var(--ph-locked-ink); }
[data-phase="reveal"] { --ph: var(--ph-reveal); --ph-tint: var(--ph-reveal-tint); --ph-ink: var(--ph-reveal-ink); }
[data-phase="consequence"] { --ph: var(--ph-consequence); --ph-tint: var(--ph-consequence-tint); --ph-ink: var(--ph-consequence-ink); }
[data-phase="paused"] { --ph: var(--ph-paused); --ph-tint: var(--ph-paused-tint); --ph-ink: var(--ph-paused-ink); }

/* ── neutral chips and tags (status, never phase) ── */
.tag { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px var(--sp-2); border-radius: var(--radius-chip); background: var(--sunken); color: var(--ink); font-size: var(--t-xs); font-weight: var(--w-medium); white-space: nowrap; }
.tag.ok { background: var(--ok-tint); color: var(--ok-ink); }
.tag.warn { background: var(--manual-tint); color: var(--manual-ink); }
.tag.bad { background: var(--alert-tint); color: var(--alert-ink); }
.tag.sel { background: var(--petrol-tint); color: var(--petrol-ink); }
.tag.priv { background: var(--private-tint); color: var(--private-ink); }

/* ── banners (layers and connection), icon + text ── */
.banner { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); font-weight: var(--w-medium); font-size: var(--t-sm); }
.banner.manual { background: var(--manual-tint); color: var(--manual-ink); }
.banner.pause { background: var(--ph-paused-tint); color: var(--ph-paused-ink); }
.banner.alert { background: var(--alert-tint); color: var(--alert-ink); }
.banner.info { background: var(--petrol-tint); color: var(--petrol-ink); }
.banner.ok { background: var(--ok-tint); color: var(--ok-ink); }

/* ── tesserae: the universal marker. Four tiles with grout, coloured by --tc, grout by --tg. Replaces dots, rails and accent bars. ── */
.tesserae, .tessera-label::before { content: ""; display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 2px; background-image: linear-gradient(var(--tg, var(--surface)) 0 0), linear-gradient(var(--tg, var(--surface)) 0 0), linear-gradient(var(--tc, var(--ink-muted)) 0 0); background-position: center; background-size: 12px 2px, 2px 12px, 12px 12px; background-repeat: no-repeat; }
.tessera-label { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ── cards and tiles (bento) ── */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.eyebrow { margin: 0; color: var(--ink-muted); font-size: var(--t-xs); font-weight: var(--w-semibold); letter-spacing: .08em; text-transform: uppercase; }

/* Option tile (CASE-088/089): the decision column carries the option colours. --mk is the mark fill. */
.opt-tile { --mk: var(--ink-muted); background: color-mix(in srgb, var(--mk) var(--tile-tint), var(--surface)); border: 1px solid color-mix(in srgb, var(--mk) 35%, var(--line)); border-radius: var(--radius); }

/* ── segmented control and tabs: concentric radii (outer 10 − padding 3 = inner 7) ── */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--quiet); }
.segmented button { min-width: 44px; min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); font-size: var(--t-sm); font-weight: var(--w-semibold); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); }
.tabs button { position: relative; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink-muted); font-weight: var(--w-semibold); font-size: var(--t-sm); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--petrol); }

/* ── option marks: recoloured from the --mark-* tokens (CSS beats the presentation attribute); shapes, names and order untouched ── */
svg.mark { display: block; flex: none; }
svg.mark.mark-red > rect { fill: var(--mark-red); } svg.mark.mark-blue > rect { fill: var(--mark-blue); }
svg.mark.mark-yellow > rect { fill: var(--mark-yellow); stroke: var(--mark-yellow-edge); } svg.mark.mark-green > rect { fill: var(--mark-green); }
svg.mark.mark-purple > rect { fill: var(--mark-purple); } svg.mark.mark-teal > rect { fill: var(--mark-teal); }
svg.mark.mark-orange > rect { fill: var(--mark-orange); } svg.mark.mark-grey > rect { fill: var(--mark-grey); }

/* ── notice and private zone: tinted surfaces, never a stripe (CASE-163) ── */
.notice { padding: var(--sp-5); border-radius: var(--radius-lg); background: var(--notice-bg, var(--quiet)); --tg: var(--notice-bg, var(--quiet)); }
.notice.locked { --notice-bg: var(--ph-locked-tint); --tc: var(--ph-locked); }
.notice.ok { --notice-bg: var(--ok-tint); --tc: var(--ok); }
.notice.bad { --notice-bg: var(--alert-tint); --tc: var(--alert); }
.private { padding: var(--sp-4); border-radius: var(--radius); background: var(--private-tint); color: var(--ink); --tg: var(--private-tint); --tc: var(--private); }
.private .zone-label { color: var(--private-ink); }

/* ── avatars ── */
img.avatar { display: block; flex: none; border-radius: 50%; background: var(--sunken); }

/* Disclosures use action text; native collapse triangles are suppressed app-wide. */
summary { list-style: none; }
summary::marker { content: ""; }
summary::-webkit-details-marker { display: none; }
.disclosure-action { flex: none; color: var(--petrol-ink); font-size: var(--t-sm); font-weight: var(--w-semibold); }

/* ── info disclosure: explanations live behind it, never inline paragraphs (CASE-118) ── */
details.info { display: inline-block; vertical-align: middle; }
details.info > summary { list-style: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--petrol-ink); cursor: pointer; }
details.info > summary::-webkit-details-marker { display: none; }
details.info > summary:hover, details.info[open] > summary { background: var(--petrol-tint); }
details.info .info-body { margin: var(--sp-2) 0 0; padding: var(--sp-3); max-width: 52ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-size: var(--t-sm); font-weight: var(--w-regular); color: var(--ink); }

@media (forced-colors: active) {
  .btn, .tag, .pill, .card, .opt-tile, .banner, .notice, .private { border: 1px solid CanvasText; }
  .pill::before { background: CanvasText; }
  .btn.primary, .pill { forced-color-adjust: auto; background: ButtonFace; color: ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.nomodule { margin: var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 2px solid var(--alert); border-radius: var(--radius-sm); background: var(--alert-tint); color: var(--alert-ink); font-weight: var(--w-semibold); }
.avatar-none { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--sunken); color: var(--ink-muted); font-weight: var(--w-semibold); }

/* Continuous (squircle) corners where the browser supports them; the same radii otherwise (progressive enhancement). */
@supports (corner-shape: squircle) {
  .btn, .card, .panel, .opt-tile, .banner, .pill, .tag, .notice, .private, .segmented, .segmented button { corner-shape: squircle; }
}
/* Motion only when the person allows it, by the OS and by Motion in Appearance (never an !important override). */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="false"]) .btn { transition: background var(--dur-1) var(--ease); }
}

/* CASE-385: group colour belongs to the named chip; artwork owns its separate appearance. */
.case-group-chip{--group-hue:200;background:color-mix(in srgb,hsl(var(--group-hue) 55% 45%) 14%,var(--surface));color:var(--ink);padding:4px 10px;border-radius:4px;white-space:normal;overflow-wrap:anywhere}
.case-group-chip[data-tint=petrol]{--group-hue:186}.case-group-chip[data-tint=sage]{--group-hue:150}.case-group-chip[data-tint=olive]{--group-hue:72}.case-group-chip[data-tint=ochre]{--group-hue:40}.case-group-chip[data-tint=coral]{--group-hue:12}.case-group-chip[data-tint=rose]{--group-hue:345}.case-group-chip[data-tint=plum]{--group-hue:290}.case-group-chip[data-tint=periwinkle]{--group-hue:232}.case-group-chip[data-tint=sky]{--group-hue:205}.case-group-chip[data-tint=neutral]{background:var(--quiet)}
