/* SPDX-License-Identifier: Apache-2.0 */
/* Maku's design tokens: Day (:root, the default) and Night (.dark, when theme.ts puts the class
   on <html>; the app-wizard's contract: a media query would ignore the user's explicit choice).
   The values are the Ogenki design system's Day and Night. Where a use has no Ogenki twin
   (--input, --placeholder, the warning family, --accent) or an Ogenki value falls short of its
   pair, a derived token carries it. web/test/contrast.test.ts pins every value and pair below.
   --input is a 3:1 boundary in both schemes (WCAG 1.4.11); --surface-raised is the dock's surface. */
@font-face { font-family: "Space Grotesk"; src: url("assets/fonts/SpaceGrotesk-Variable.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/Inter-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/Inter-Variable-Italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("assets/fonts/JetBrainsMono-Variable.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }
:root {
  --font-display: "Space Grotesk", Arial, sans-serif;
  --font-sans: Inter, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
  /* One type scale (Ogenki's screen scale), each size with its line height: an h1, a section
     title, body text, small text (meta, chips, code), and the eyebrow, a mono uppercase label
     that names a column, a section or a fact. Emphasis is weight or colour, never a new size. */
  --text-display: 32px; --leading-display: 40px;
  --text-heading: 22px; --leading-heading: 30px;
  --text-body: 16px; --leading-body: 26px;
  --text-small: 14px; --leading-small: 20px;
  --text-eyebrow: 13px; --leading-eyebrow: 16px;
  /* The log's measure: every row, and on a wide screen the conversation's column and the composer. */
  --log-w: 72ch;
  /* One radius scale: a control, a row (a call, the table, the composer), a card. */
  --radius-control: 6px; --radius-row: 8px; --radius-card: 12px;
  --radius-sm: 8px; --radius-md: 16px; --radius-pill: 9999px;
  /* The Ogenki 4 px spacing scale. */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  color-scheme: light;

  /* Ogenki raw tokens (Day). */
  --surface-000: #f5f6fc;
  --surface-100: #fdfdff;
  --surface-200: #eceef8;
  --line: #b9bfdc;
  --blue: #1d63b0;
  --violet: #6a4bd8;
  --pink: #c2306f;
  --green: #11795a;
  --amber: #965800;
  --ink-on-accent: #fdfdff;
  /* Day's aurora is derived: Ogenki's (Night's, below) is 2:1 on the Day budget track; Day pink
     to Day violet keeps the hue at 4.09 and 4.47:1. */
  --aurora-bar: linear-gradient(90deg, #c2306f 0%, #6a4bd8 100%);

  --flow-writer: #1d63b0; /* the run rail: a writer's lane */
  --flow-judge: #6a4bd8; /* a judge's lane */
  --flow-plan: #965800; /* a plan step no run has reached */

  --background: #f5f6fc;
  --foreground: #12163a;
  --card: #fdfdff;
  --card-foreground: #12163a;

  --muted: #f5f6fc; /* the page and inset surfaces */
  --muted-foreground: #545b85; /* secondary text */
  --border: #b9bfdc;
  --input: #7a82a8; /* an input's boundary: derived, 3:1 on a card and on the dock */
  --surface-raised: #eceef8; /* the dock; hover and table headers */

  --primary: #1d63b0;
  --primary-foreground: #fdfdff;
  --ring: #1d63b0;
  --link: #1d63b0;

  --accent: #11795a; /* actor green: decorative, use sparingly */
  --accent-foreground: #fdfdff;

  --success: #11795a;
  --success-foreground: #fdfdff;
  --success-text: #11795a;

  --warning: #965800;
  --warning-foreground: #6b3f00; /* warning text on a tint, the page or a card */
  --warning-solid-foreground: #fdfdff; /* the needs-you pill, on solid amber */
  --warning-border: #965800;

  --destructive: #c2306f;
  --destructive-foreground: #fdfdff;
  /* Destructive text: the deny button, the error status, notices, on the card, the page and
     the dock's raised surface. */
  --destructive-text: #c2306f;

  /* The page header: the card's colour in Day. */
  --brand-header: #fdfdff;
  --brand-header-foreground: #12163a;

  --placeholder: #545b85;

  /* Elevation: a layered transparent shadow lifts a card off whatever surface
     ends up underneath; a border colour doesn't. Structural borders stay borders. */
  --shadow-border:
    0 0 0 1px rgb(0 0 0 / 0.06),
    0 1px 2px -1px rgb(0 0 0 / 0.06),
    0 2px 4px 0 rgb(0 0 0 / 0.04);
  --shadow-border-hover:
    0 0 0 1px rgb(0 0 0 / 0.08),
    0 1px 2px -1px rgb(0 0 0 / 0.08),
    0 2px 4px 0 rgb(0 0 0 / 0.06);
  /* The dock floats over the stream it scrolls past. */
  --shadow-dock: 0 -1px 0 rgb(0 0 0 / 0.06), 0 -6px 16px -4px rgb(0 0 0 / 0.10);

  /* The smallest target a control gets: 40 px on a dense desktop, 44 px on a phone (below).
     A control drawn smaller extends to it with a pseudo-element, never over a neighbour's. */
  --hit: 40px;
}

.dark {
  color-scheme: dark;

  /* Ogenki raw tokens (Night). */
  --surface-000: #0d1330;
  --surface-100: #161c42;
  --surface-200: #1f2754;
  --line: #3a4478;
  --blue: #5aa9f0;
  --violet: #a78bfa;
  --pink: #ff6fb5;
  --green: #3ddc97;
  --amber: #ffb547;
  --ink-on-accent: #0d1330;
  --aurora-bar: linear-gradient(90deg, #ff6fb5 0%, #a78bfa 100%);

  --flow-writer: #5aa9f0;
  --flow-judge: #a78bfa;
  --flow-plan: #ffb547;

  --background: #0d1330;
  --foreground: #eef0fa;
  --card: #161c42;
  --card-foreground: #eef0fa;

  --muted: #0d1330; /* the page, so cards and the header lift off it */
  --muted-foreground: #a9b1d6;
  --border: #3a4478;
  --input: #6f79b0; /* an input's boundary: derived, 3:1 on a card and on the dock */
  --surface-raised: #1f2754; /* the dock */

  --primary: #5aa9f0;
  --primary-foreground: #0d1330;
  --ring: #5aa9f0;
  --link: #5aa9f0;

  --accent: #3ddc97;
  --accent-foreground: #0d1330;

  --success: #3ddc97;
  --success-foreground: #0d1330;
  --success-text: #3ddc97;

  --warning: #ffb547;
  /* Light amber: warning text renders on a faint warning tint. */
  --warning-foreground: #ffcf85;
  --warning-solid-foreground: #0d1330;
  --warning-border: #ffb547;

  --destructive: #ff6fb5;
  --destructive-foreground: #0d1330;
  --destructive-text: #ff6fb5;

  /* The page header: the page's colour in Night. */
  --brand-header: #0d1330;
  --brand-header-foreground: #eef0fa;

  --placeholder: #a9b1d6;

  /* Layered depth shadows are invisible against the page: collapse to the ring. */
  --shadow-border: 0 0 0 1px rgb(255 255 255 / 0.08);
  --shadow-border-hover: 0 0 0 1px rgb(255 255 255 / 0.13);
  --shadow-dock: 0 -1px 0 rgb(255 255 255 / 0.10), 0 -6px 16px -4px rgb(0 0 0 / 0.45);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  accent-color: var(--primary); /* the filters' checkboxes and radios take the theme's blue */
}
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

body {
  font: 400 var(--text-body)/var(--leading-body) var(--font-sans);
  margin: 0;
  background: var(--muted);
  color: var(--foreground);
}

h1, h2, h3, h4 { text-wrap: balance; font-family: var(--font-display); font-weight: 700; }
/* Section headings: 16 px bold; metadata labels stay labels, never headings. */
h2, h3, h4 { font-size: var(--text-body); line-height: 1.4; font-weight: 700; }
strong, b { font-weight: 700; }
/* Long prose reads lighter at 400: message bodies, handoff summaries and the notes. Pinned at 400
   so a parent that sets 500 (a name, a chip) never thickens them. */
.bubble .md, .handoff > .md, .notes { font-weight: 400; }
/* Code, commands and tool I/O are monospace at 14 px; IDs, timestamps and counters at 13 px
   with tabular numerals. Prose, bubbles and cards stay in the sans. */
.t-cmd, .t-command, .approval-command, pre, code { font: var(--text-small)/var(--leading-small) var(--font-mono); }
time, .t-time, .step-dur, .replay-progress, .t-prompt {
  font-family: var(--font-mono); font-size: var(--text-small); line-height: var(--leading-small);
  font-variant-numeric: tabular-nums;
}
/* A duration (duration.ts's timeEl) is one word to the reader: "37 d ago" never breaks inside. */
.dur { white-space: nowrap; }
p, li { text-wrap: pretty; }
/* The eyebrow: a label that names a column, a section or a fact, never a sentence or a heading's
   kicker. The rules below keep each one's colour. The settings dt keeps the body's leading, so it
   sits on its value's line. */
.rooms th, .page-header .fact-label, .policy-header dt, .workflow-label, .next-label, .now-lead, .brief-kind, .t-sec,
.controls h2, .controls .group-room > summary, .controls .group-label, .shots-head {
  font: 500 var(--text-eyebrow)/var(--leading-eyebrow) var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
}
.waiting, .closed, .mark-text, .sys, .hint, .approval-meta { text-wrap: pretty; }

a { color: var(--link); }
a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }

/* The page chrome: a brand header, a docked footer. Class-scoped: the chat's
   <header class="msg-head"> and the raw view's <header class="ev-head"> are headers too,
   and the bare selector made each of them a sticky navy bar (review 2026-10-15, U1). */
.page-header, .page-dock { position: sticky; }
.page-dock { padding: 8px 16px; }
/* The unsandboxed banner is pinned with the header (room.ts: --banner-h, and --header-h counts both),
   so the rail's sticky top and height clear everything pinned above it. */
@media (min-width: 641px) {
  .banner-unsandboxed { position: sticky; top: 0; z-index: 2; }
}
.page-header {
  top: var(--banner-h, 0px); z-index: 2;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 16px; align-items: start;
  padding: 16px;
  background: var(--brand-header); color: var(--brand-header-foreground);
}
/* The Maku lockup (brand.ts): the 32 px SVG mark, 16 px clear of the wordmark, and 16 px of
   header padding around it: at least half the mark's width on every side. The two marks are
   both in the DOM; .dark (theme.ts), not the OS media query, picks one, so a manual choice
   and the system choice agree. */
.brand {
  display: flex; align-items: center; gap: 16px; align-self: start;
  color: var(--brand-header-foreground); text-decoration: none;
}
.page-header a.brand { text-decoration: none; }
/* No `display` here: this rule (0,1,1) would beat `.brand-mark-dark { display: none }` (0,1,0)
   and show both marks. Flex items are blockified already. */
.brand img { width: 32px; height: 32px; flex: none; }
.brand-mark-dark { display: none; }
.dark .brand-mark-dark { display: block; }
.dark .brand-mark-light { display: none; }
.brand-wordmark { font: 700 var(--text-heading)/var(--leading-heading) var(--font-display); letter-spacing: -0.03em; }
.brand:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
/* The dock: the composer on the left (the text over its row: deliver to, the notice, send),
   the act notice, the theme button and the connection on the right; one column on a phone. */
/* Sticky, not fixed: it sits in the flow at the page's end, so once scrolled there it
   covers no row. The shadow, not a border, lifts it over the rows it scrolls past. */
.page-dock {
  bottom: 0; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end;
  padding-top: 10px; padding-bottom: 10px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-raised); color: var(--card-foreground);
  box-shadow: var(--shadow-dock);
}
/* The session: Run, Driver, the queue and Room, behind a toggle across the dock (P7).
   Open, it scrolls inside a bound, so the dock never takes the whole screen. */
.page-dock > .session { grid-column: 1 / -1; min-width: 0; }
/* 32 px tall, the top 6 px taken back from the dock's padding; the ::after reaches 40 px,
   half the dock's 8 px gap below, so it never covers the composer. */
.session > summary { cursor: pointer; font-size: var(--text-small); color: var(--muted-foreground); width: fit-content; position: relative; padding-block: 6px; margin-top: -6px; }
.session > summary::after { content: ""; position: absolute; inset: -4px -8px; }
.session[open] > section.controls { max-height: 40vh; overflow: auto; margin-top: 6px; }
.page-dock .controls { padding: 0; background: transparent; }
.page-dock .composer { display: grid; gap: 8px; min-width: 0; }
/* The composer (P4): the text and Send side by side, Send as tall as the field. */
.composer-write { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.composer-write textarea {
  flex: 1 1 auto; min-width: 0; box-sizing: border-box; font: inherit;
  padding: 8px 10px; border-radius: var(--radius-row); resize: vertical;
  /* Grows with the text from two lines to eight where the browser can; rows=2 elsewhere. */
  field-sizing: content; min-height: calc(2lh + 18px); max-height: calc(8lh + 18px);
}
button.send { display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 0 14px 0 16px; font-weight: 700; border-radius: var(--radius-row); min-width: 88px; }
/* The arrow beside a 700 label carries its weight: 2.5, not the set's 1.5. The icon side's
   padding is the text side's less 2 px, so the pair reads centred. */
button.send .icon { stroke-width: 2.5; }
.composer-row, .dock-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-width: 0; }
.composer-row .hint { color: var(--muted-foreground); font-size: var(--text-small); }
.composer-row .keys { margin-left: auto; }
/* Where a message goes (P5): a segmented radio group. The radios stay real inputs, for
   the keyboard and assistive tech; the checked one's label is the raised segment. */
fieldset.delivery { display: inline-flex; gap: 2px; margin: 0; padding: 2px; border: 0; border-radius: 8px; background: var(--muted); min-width: 0; }
fieldset.delivery > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.seg { position: relative; display: flex; }
/* The radio is the target: 6 px taller than its pill on each side (8 px on a phone), inside
   the composer's 8 px gaps; the segments' 2 px gap stays theirs. */
.seg input { position: absolute; inset: -6px 0; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  padding: 4px 12px; border-radius: 6px; font-size: var(--text-small); color: var(--muted-foreground);
  transition-property: background-color, color, box-shadow; transition-duration: 150ms; transition-timing-function: ease-out;
}
.seg input:not(:checked, :disabled):hover + span { color: var(--foreground); }
.seg input:checked + span { background: var(--card); color: var(--foreground); font-weight: 700; box-shadow: var(--shadow-border); }
.seg input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.seg input:disabled + span { opacity: .5; }
.dock-meta { justify-content: flex-end; }
.page-dock .status { color: var(--muted-foreground); font-size: var(--text-small); font-variant-numeric: tabular-nums; }
/* The connection is a dot beside the words: green live, amber reconnecting, grey otherwise. */
.page-dock .status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--placeholder); }
.page-dock[data-status="live"] .status::before { background: var(--success); }
.page-dock[data-status="reconnecting"] .status::before { background: var(--warning); }
.page-dock .notice { color: var(--destructive-text); overflow-wrap: anywhere; }
/* An act notice with nothing to say takes no place: as a third, empty item it pushed the phone's
   theme button off the edge toward the middle of a space-between row. */
.dock-meta .act-notice:empty { display: none; }
@media (max-width: 640px) {
  :root { --hit: 44px; }
  /* The header is static here (pinned, it took a third of an 844 px screen); the dock stays sticky and
     the room body and the needs cards reserve its height (--dock-h), so it never covers a decision. */
  .page-header { position: static; padding: 14px; row-gap: 14px; }
  /* Only here: on a wider screen the dock sits after the body at the end of the scroll, and the
     padding would be a blank band; the scroll margins below hold at every width. */
  .room-body { padding-bottom: var(--dock-h, 0px); }
  .brand { gap: 14px; }
  .brand img { width: 28px; height: 28px; }
  .page-header .strip { grid-column: 1 / -1; }
  .page-dock { grid-template-columns: minmax(0, 1fr); }
  .dock-meta { flex-wrap: nowrap; justify-content: space-between; }
  .dock-meta .theme-toggle { flex: none; white-space: nowrap; }
  .page-dock .status { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .composer-row .keys { display: none; }
  .seg input { inset: -8px 0; }
  /* Touch: every form control is a full target, not only the dock's. */
  .controls button, .controls select, .controls input:not([type="checkbox"]), .needs button, .approval-decide input, .fork button, .fork input, .new-room button, .new-room input { min-height: var(--hit); box-sizing: border-box; }
}
/* Not live: under the strip, why and when the page retries. The unsandboxed banner sits above the strip. */
.banner, .banner-unsandboxed { background: color-mix(in srgb, var(--warning) 18%, var(--card)); color: var(--warning-foreground); padding: 6px 16px; }
/* The live demo (web/preview/demo.ts): its banner, room switcher, and the replay bar as the dock's first row. */
.demo-banner { display: flex; flex-direction: column; gap: 6px; }
.demo-banner a { color: inherit; text-decoration: underline; }
.demo-switcher { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-tab { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: var(--text-small); padding: 4px 10px; min-height: 32px; background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-control); }
.demo-tab[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.demo-tab-title { font-weight: 500; }
.demo-tab-meta { font-family: var(--font-mono); font-size: var(--text-small); opacity: 0.85; }
.replay-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: var(--text-small); }
.replay-bar button, .replay-bar select { min-height: 40px; }
.replay-bar select { font: inherit; background: var(--card); color: var(--card-foreground); border: 1px solid var(--input); border-radius: 6px; padding: 0 8px; }
.replay-progress { color: var(--muted-foreground); }
main { padding: 8px 16px 16px; max-width: 100%; }

button {
  font: inherit; cursor: pointer;
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-control); padding: 2px 10px;
  min-height: 28px;
  transition-property: box-shadow, background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
button:hover { box-shadow: var(--shadow-border-hover); }
/* Press feedback: never below .95, which reads as exaggerated, and only where motion is
   welcome. The buttons drawn as a line of text underline instead: a shrinking sentence reads
   as a glitch. */
@media (prefers-reduced-motion: no-preference) {
  button:active:not(:disabled, .now-link, .clip-toggle, .t-more) { scale: .96; }
}
button:disabled { opacity: .55; cursor: not-allowed; }
/* The acts a reader comes to do get a full target: Send, approve, deny. */
.composer button, .needs button { min-height: var(--hit); }
.icon { width: 14px; height: 14px; flex: none; vertical-align: -2px; }
/* The small standalone controls reach --hit through a centred ::after: it only grows, never
   shrinks a control already larger. Each has 8 px or more of inert space around it. */
.theme-toggle, .fork-here, .clip-toggle, .t-more, .cli-setup > summary, .notes details > summary { position: relative; }
.theme-toggle::after, .fork-here::after, .clip-toggle::after, .t-more::after, .cli-setup > summary::after, .notes details > summary::after {
  content: ""; position: absolute; inset: min(0px, (100% - var(--hit)) / 2);
}
/* The muted fold toggles darken on hover: a colour, the cheapest cue for a frequent act. */
.session > summary, .cli-setup > summary, .notes details > summary, .fold > summary, .step-calls > summary, .controls .advanced > summary, .approval-json > summary {
  transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.session > summary:hover, .cli-setup > summary:hover, .notes details > summary:hover, .fold > summary:hover, .step-calls > summary:hover, .controls .advanced > summary:hover, .approval-json > summary:hover { color: var(--foreground); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
.page-header button { background: transparent; color: var(--brand-header-foreground); }

/* The title strip (strip.ts): rows of the header, on the brand header, so every chip and link
   takes the header's text token rather than the card's. */
.strip { display: grid; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
/* The room's h1: display size at the headings' 700, tracked in as display type is. */
.strip-title { font-size: var(--text-display); line-height: var(--leading-display); margin: 0; letter-spacing: -0.02em; }
/* The title links its issue: underlined on hover only, a heading first. */
.page-header .strip-title a { text-decoration: none; }
.page-header .strip-title a:hover, .page-header .strip-title a:focus-visible { text-decoration: underline; }
/* The facts in two tiers (strip.ts): tier 1, what a glance needs (the phase, the run's persona and
   age, Needs you), over tier 2, the rest. Both wrap: nothing in the header scrolls sideways. */
.strip-chips { display: grid; gap: 6px; justify-items: start; font-variant-numeric: tabular-nums; }
.strip-tier1 { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.strip-tier1:empty { display: none; }
.strip-tier2 { display: flex; flex-wrap: wrap; gap: 6px 32px; align-items: center; }
/* Tier 2 folds behind Details on a phone. Above 640 px strip.ts opens it (matchMedia) and the
   toggle goes. */
.strip-details > summary { cursor: pointer; width: fit-content; font-size: var(--text-small); line-height: var(--leading-small); color: color-mix(in srgb, var(--brand-header-foreground) 68%, var(--brand-header)); }
.strip-details > summary:hover { color: var(--brand-header-foreground); }
.strip-details[open] > summary { margin-bottom: 6px; }
@media (min-width: 641px) {
  .strip-details > summary { display: none; }
}
/* Tier 2's facts in four clusters (strip.ts's group): the run, its cost, its links, who and what
   may reach it. Proximity alone groups them, 12 px inside a cluster and 32 px between: a divider
   would lead every wrapped line. */
.fact-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
/* A chip's link and the Needs-you pill grow to their half of the 6 px row gap: a full --hit
   would cover the next row's chips. */
.page-header .chip a { position: relative; }
.page-header .chip a::after { content: ""; position: absolute; inset: -5px -2px; }
/* On a touch screen the link's target reaches 44 px: the row gap grows to 24 px so the taller
   targets of two wrapped rows (19 px link + 2 x 12.5 px) do not overlap. */
@media (pointer: coarse) {
  .strip-tier1, .strip-tier2 { row-gap: 24px; }
  .page-header .chip a::after { inset: calc((100% - 44px) / 2) -4px; }
}
.page-header .needs-pill { position: relative; }
.page-header .needs-pill::after { content: ""; position: absolute; inset: -3px 0; }
/* The facts read as one line of text, not a row of buttons: no outline, a middle dot between
   them; the links among them stay underlined. */
/* Hierarchy by strength: a fact's value at the header's full ink, its name, the run's id, model and
   effort, and the separators at 68%, so the eye lands on the values. The run's role leads at 700. */
.page-header .chip { color: var(--brand-header-foreground); background: transparent; border-color: transparent; padding: 0; font-size: var(--text-small); }
.page-header .fact-label, .page-header .chip-run > :not(.run-role), .page-header .chip-run-detail { color: color-mix(in srgb, var(--brand-header-foreground) 68%, var(--brand-header)); }
.page-header .run-role { font-weight: 700; }
.page-header .run-id { font: var(--text-small)/var(--leading-small) var(--font-mono); }
.page-header .chip[title] { cursor: help; }
/* The budget is quiet until it matters: amber from 80 %, red once spent. */
.page-header .chip-budget[data-level="warn"] { color: var(--warning); font-weight: 700; }
.page-header .chip-budget[data-level="warn"] .meter-bar::after { background: var(--warning); }
.page-header .chip-budget[data-level="over"] { color: var(--destructive-text); font-weight: 700; }
.page-header .chip-budget[data-level="over"] .meter-bar::after { background: var(--destructive); }
.page-header a { color: var(--brand-header-foreground); text-decoration: underline; }
/* The facts' links underline in a quieter line, full ink on hover: four links on one row read as
   links without striping it. */
.page-header .chip a {
  text-decoration-color: color-mix(in srgb, var(--brand-header-foreground) 40%, var(--brand-header)); text-underline-offset: 3px;
  transition-property: text-decoration-color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.page-header .chip a:hover { text-decoration-color: currentColor; }
.meter-bar {
  display: inline-block; width: 64px; height: 6px; border-radius: 3px; vertical-align: middle;
  background: color-mix(in srgb, var(--brand-header-foreground) 12%, transparent); position: relative;
}
.meter-bar::after { content: ""; position: absolute; inset: 0; width: var(--fill, 0%); background: var(--aurora-bar); border-radius: 3px; }
.waiting, .closed { font-size: var(--text-small); color: var(--brand-header-foreground); opacity: .9; }
.strip-head { display: grid; gap: 4px; min-width: 0; }
.strip-tail:empty { display: none; }
/* What comes next: one box under the title, the most actionable lines on the page. */
.strip-next {
  display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px; width: fit-content; max-width: 100%;
  background: color-mix(in srgb, var(--brand-header-foreground) 6%, transparent);
}
.strip-next .waiting { opacity: 1; font-weight: 700; } /* the emphasis is the weight, not a stripe */
.next-label { color: var(--brand-header-foreground); opacity: .7; }
.page-header .waiting code {
  padding: .1em .35em; border-radius: 4px;
  background: color-mix(in srgb, var(--brand-header-foreground) 10%, transparent);
}
.page-header .copy-code { font-size: var(--text-small); padding: 0 6px; margin-left: 4px; border: 1px solid color-mix(in srgb, var(--brand-header-foreground) 30%, transparent); border-radius: 4px; }
/* The Now line: a button that reads as a line of text, so it takes the reader to the row. */
.strip-now { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: var(--text-small); color: var(--brand-header-foreground); font-variant-numeric: tabular-nums; }
.page-header .now-link {
  border: 0; padding: 0; text-align: left; font-size: var(--text-small); overflow-wrap: anywhere;
  color: var(--brand-header-foreground); background: transparent;
}
.page-header .now-link:hover { box-shadow: none; text-decoration: underline; }
/* The Now line leads with a label in the NEXT box's voice; what runs reads first, the status and
   age recede. */
.now-lead { color: color-mix(in srgb, var(--brand-header-foreground) 68%, var(--brand-header)); }
.now-meta { color: color-mix(in srgb, var(--brand-header-foreground) 68%, var(--brand-header)); }
.page-header .now-link { position: relative; }
.page-header .now-link::after { content: ""; position: absolute; inset: min(0px, (100% - var(--hit)) / 2) 0; }
.now-hint { font-style: italic; }
.page-header .needs-pill {
  background: var(--warning); color: var(--warning-solid-foreground);
  border: 0; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: var(--text-small);
}
.theme-toggle { font-size: var(--text-small); }
/* On a phone the strip stays short, so the conversation starts on the first screen: tier 1
   wraps, tier 2 folds behind Details, and the title, the waiting lines and the Now line clamp at
   two lines. The desktop strip is untouched: nothing here applies above 640px. */
@media (max-width: 640px) {
  .page-header .needs-pill::after { inset: -8px 0; }
  .page-header .strip-tier2 { column-gap: 20px; }
  /* The toggle is the target: 20 px of line and 24 px of padding make the 44, the margin taking
     the padding back from the row. */
  .strip-details > summary { padding-block: 12px; margin-block: -12px; }
  .strip-details[open] > summary { margin-bottom: -6px; }
  .strip-title { font-size: var(--text-heading); line-height: var(--leading-heading); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .page-header .waiting { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  /* The clamp's overflow clips an ::after: the button's own box grows instead, the margin
     taking the 24 px back: 20 px of line and 24 px of padding is the 44. The clamp hides lines
     past the second only by clipping at the padding box, so a third line used to show in the
     bottom padding: a mask (it never changes hit-testing, unlike clip-path) paints everything
     but that padding. */
  .page-header .now-link {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-block: 12px; margin-block: -12px;
    -webkit-mask: linear-gradient(#000, #000) top / 100% calc(100% - 12px) no-repeat;
    mask: linear-gradient(#000, #000) top / 100% calc(100% - 12px) no-repeat;
  }
}

/* Chat view */
.msg { margin: 14px 0; max-width: var(--log-w); }
.msg-head { color: var(--muted-foreground); font-size: var(--text-small); display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.msg-head time, .t-time { margin-left: auto; color: var(--placeholder); white-space: nowrap; }
/* --bubble-bg is the bubble's own surface: a long message's fade (below) ends in it. */
.bubble {
  --bubble-bg: var(--card);
  background: var(--bubble-bg); color: var(--card-foreground);
  border-radius: 4px var(--radius-card) var(--radius-card) var(--radius-card); padding: 8px 14px;
  box-shadow: var(--shadow-border);
}
.from-human .bubble { --bubble-bg: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.from-system .bubble { --bubble-bg: var(--muted); }
/* A long message folds (clip.ts): one measured "closed" is clipped at twelve lines, fades
   into its own surface and gets Show more; a short or opened one is never clipped. The 4 px
   padding, taken back by the margin, keeps a focus ring inside the clip box whole. */
.bubble[data-clip="closed"] > .md {
  position: relative; max-height: calc(12 * var(--leading-body)); overflow-y: hidden;
  padding: 4px; margin: -4px;
}
.bubble[data-clip="closed"] > .md::after {
  content: ""; position: absolute; inset: auto 0 0; height: 3em; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bubble-bg));
}
.clip-toggle {
  display: block; margin-top: 4px; padding: 2px 0; border: 0; background: transparent;
  color: var(--link); font-size: var(--text-small); font-weight: 700;
}
.clip-toggle:hover { box-shadow: none; text-decoration: underline; }
.bubble .md > :first-child { margin-top: 0; } .bubble .md > :last-child { margin-bottom: 0; }
/* A brief (chat.ts's briefKind): folded to its kind and first line on the bubble's own surface,
   the full text under it in the DOM, so copy and find-in-page still reach it. */
.brief { border-radius: 4px var(--radius-card) var(--radius-card) var(--radius-card); box-shadow: var(--shadow-border); background: var(--muted); }
.from-agent .brief { background: var(--card); }
.brief-summary {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 14px; cursor: pointer; list-style: none;
  font-size: var(--text-small); color: var(--card-foreground); border-radius: inherit;
}
.brief-summary::-webkit-details-marker { display: none; }
.brief-summary::before { content: "▸"; color: var(--placeholder); }
.brief[open] > .brief-summary::before { content: "▾"; }
.brief-kind { color: var(--muted-foreground); }
.brief-purpose { flex: 1 1 20ch; min-width: 0; font-weight: 400; overflow-wrap: anywhere; }
.brief-toggle { font-size: var(--text-small); font-weight: 700; color: var(--link); white-space: nowrap; }
.brief-summary:hover .brief-toggle { text-decoration: underline; }
.brief > .bubble { box-shadow: none; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-card) var(--radius-card); }
/* A phone sets the first line under its kind, not as a narrow column beside it. */
@media (max-width: 640px) { .brief-purpose { flex-basis: 100%; } }
.bubble p { margin: .45em 0; }

/* A tool row: one line, the detail behind the toggle */
.tool {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md); margin: 6px 0; max-width: var(--log-w);
}
.tool summary { display: flex; gap: 8px; align-items: center; padding: 6px 10px; cursor: pointer; list-style: none; flex-wrap: wrap; border-radius: calc(var(--radius-md) - 1px); }
.tool summary::before { content: "▸"; color: var(--placeholder); }
.tool[open] summary::before { content: "▾"; }
.tool summary::-webkit-details-marker { display: none; }
.tool[open] > summary { border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0; } /* its bottom meets the body's rule */
/* A call that failed or was refused tones its own 1 px border; its t-status word says which. */
.tool.st-error { border-color: var(--destructive); }
.tool.st-rejected { border-color: var(--warning-border); }
.t-name { color: var(--link); font-weight: 700; }
.t-prompt { color: var(--placeholder); }
/* A call's status (P3): ok a muted check, running the link colour, the rest in words. */
.t-status { display: inline-flex; gap: 4px; align-items: center; font-size: var(--text-small); }
.t-status.st-ok { color: var(--placeholder); }
.t-status.st-running { color: var(--link); }
.t-status.st-rejected { color: var(--warning-foreground); }
.t-status.st-error { color: var(--destructive-text); }
@media (prefers-reduced-motion: no-preference) {
  .icon-spinner { animation: spin 1s linear infinite; }
  @keyframes spin { to { rotate: 360deg; } }
}
.t-cmd { min-width: 0; flex: 1 1 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-body { border-top: 1px solid var(--border); padding: 6px 10px; }
.t-sec { color: var(--placeholder); margin: 6px 0 2px; }
.t-meta { color: var(--placeholder); font-size: var(--text-small); margin-top: 6px; overflow-wrap: anywhere; }
.t-body pre, .other pre { background: var(--muted); border-radius: 6px; padding: 6px 8px; }
.t-command { margin: 2px 0 6px; }
.t-out { max-height: none; }
.t-out.capped { max-height: 16em; }
.t-more { font-size: var(--text-small); }
.t-more:hover { text-decoration: underline; }

/* Chips and badges: a tinted pill, the status token for its text. */
.chip, .pol {
  font-size: var(--text-small); line-height: var(--leading-small); padding: 0 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--muted-foreground);
}
.chip-delivery {
  color: var(--warning-foreground);
  background: color-mix(in srgb, var(--warning) 18%, var(--card));
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
}
/* A message for the room prompts no agent: a neutral chip, the others amber (R09). */
.chip-delivery.dl-none { color: var(--muted-foreground); background: none; border-color: var(--border); }
@keyframes pulse { 50% { opacity: .45; } }
.pol-allow, .pol-approved, .verdict-approve {
  color: var(--success-text);
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}
.pol-deny, .pol-denied, .pol-expired {
  color: var(--destructive-text);
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border));
}
.verdict-changes {
  color: var(--warning-foreground);
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
}

/* Timeline markers and system lines */
.handoff > .md { margin: -2px 0 8px 14px; max-width: var(--log-w); }
.mark, .sys { color: var(--muted-foreground); font-size: var(--text-small); margin: 6px 0; display: flex; gap: 8px; align-items: baseline; }
.mark .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--placeholder); align-self: center; flex: none; }
.mark-text { overflow-wrap: anywhere; }
.sys { font-style: italic; }
.sys::before { content: "·"; }
.mk-harness_error .mark-text, .mk-limit .mark-text { color: var(--destructive); }
.mark { max-width: var(--log-w); }
/* U7: a run of plumbing rows reads as one "· N changes" line, open on click. */
.fold { color: var(--muted-foreground); font-size: var(--text-small); margin: 6px 0; max-width: var(--log-w); }
.fold > summary { cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
/* The fold's marker is the step folds' (▸, ▾ open), drawn here, so its line never starts with a stray dot. */
.fold > summary::before { content: "▸"; color: var(--placeholder); margin-right: 6px; }
.fold[open] > summary::before { content: "▾"; }
.fold-body { padding-left: 14px; }
.notes details > summary, .fold > summary, .step-calls > summary, .t-sec { font-variant-numeric: tabular-nums; }
/* A step (P1): an agent's message, then its calls behind one line, on a rail under it. */
.step { margin: 12px 0; max-width: var(--log-w); }
.step > .msg, .step > .row > .msg { margin: 0; }
.step-calls { margin: 6px 0 0 3px; padding-left: 12px; border-left: 2px solid var(--border); }
.step[data-state="failed"] > .step-calls { border-left-color: color-mix(in srgb, var(--destructive) 65%, var(--card)); }
.step-calls > summary {
  display: flex; gap: 8px; align-items: baseline; padding: 4px 0; cursor: pointer; list-style: none;
  font-size: var(--text-small); font-weight: 500; color: var(--muted-foreground);
}
.step-calls > summary::-webkit-details-marker { display: none; }
.step-calls > summary::before { content: "▸"; color: var(--placeholder); }
.step-calls[open] > summary::before { content: "▾"; }
.step-exc { color: var(--warning-foreground); font-weight: 700; }
.step-sep { color: var(--placeholder); }
.step-dur { margin-left: auto; color: var(--placeholder); }
/* Inside a step a call is a line, not a card: the rail groups them. */
.step-body > .tool { background: transparent; border-color: transparent; box-shadow: none; margin: 0; }
.step-body > .tool > summary:hover { background: color-mix(in srgb, var(--card) 70%, transparent); }
.step-body > .tool[open] { background: var(--card); border: 1px solid var(--border); margin: 4px 0; }
.step-body > .fold { margin: 2px 0 2px 10px; }
.step-body .mark { max-width: none; } /* its time aligns with the call lines' */
/* An actor's colour, keyed on its id: decoration beside the name, which carries the meaning. */
.swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: -2px; flex: none; align-self: center; }
.swatch-0 { background: var(--primary); }
.swatch-1 { background: var(--accent); }
.swatch-2 { background: var(--warning); }
.swatch-3 { background: var(--destructive); }
.swatch-4 { background: var(--link); }
.swatch-5 { background: var(--muted-foreground); }
.other { max-width: var(--log-w); color: var(--muted-foreground); }
.other summary { cursor: pointer; }

/* Raw view */
.ev { border-bottom: 1px solid var(--border); padding: 6px 0; }
.ev-head { color: var(--muted-foreground); font-size: var(--text-small); }
pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 24em; overflow: auto; }
.md { overflow-wrap: anywhere; } /* a 64-hex digest has no break point; pre and code keep their own wrapping */
.md a { overflow-wrap: anywhere; }
/* Markdown in a message stays in the conversation's scale: a heading is a bold line, never the
   browser's 2em poster, and inline code reads as code inside the prose. */
.md h1 { font-size: var(--text-heading); line-height: var(--leading-heading); font-weight: 700; margin: .9em 0 .3em; }
.md :is(h2, h3, h4, h5, h6) { font-size: var(--text-body); line-height: 1.4; font-weight: 700; margin: .9em 0 .3em; }
.md :not(pre) > code { font-size: var(--text-small); padding: .1em .35em; border-radius: 4px; background: color-mix(in srgb, var(--foreground) 7%, transparent); }
.md pre { padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--foreground) 5%, transparent); }
.status-error, .status-rejected { color: var(--destructive); }
/* An audit note, not an alarm: the warning foreground reads on both schemes. */
.redacted { color: var(--warning-foreground); font-size: var(--text-small); }

/* Controls (unchanged behaviour, platform palette) */
/* hidden must win over a flex display: the controls toggle it, never re-mount (R10). */
[hidden] { display: none !important; }
.controls { padding: 0 16px 8px; display: grid; background: var(--background); }
.controls .driver, .controls form, .new-room { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.controls input, .new-room input { flex: 1 1 12em; min-width: 0; }
/* Named groups (U8): Run, Driver, the queue, Room behind a toggle. */
.controls .group, .controls .group-queue { border-top: 1px solid var(--border); padding: 8px 0; min-width: 0; }
.controls h2, .controls .group-room > summary, .controls .group-label {
  color: var(--muted-foreground); margin: 0 0 6px;
}
.controls .group-room > summary { cursor: pointer; margin: 0; }
.controls .group-room[open] > summary { margin-bottom: 6px; }
.controls .group-room > * + * { margin-top: 6px; }
.controls label.field { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; flex: 1 1 12em; min-width: 0; }
.controls label.field > span { color: var(--muted-foreground); font-size: var(--text-small); }
.composer-row label.field { display: inline-flex; gap: 6px; align-items: center; min-width: 0; }
.composer-row label.field > span { color: var(--muted-foreground); font-size: var(--text-small); }
.composer-row select { max-width: 100%; }
.controls .advanced { flex: 1 1 100%; }
.controls .advanced > summary { cursor: pointer; color: var(--muted-foreground); font-size: var(--text-small); }
.members { margin: 0; padding-left: 18px; } .members li { overflow-wrap: anywhere; }
.stop { margin: 0; }
.task-cancel .hint { margin: 4px 0 0; color: var(--muted-foreground); font-size: var(--text-small); }
.confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.stop-discard { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-small); color: var(--brand-header-foreground); }
button.destructive { color: var(--destructive-text); border-color: color-mix(in srgb, var(--destructive) 45%, var(--border)); }
input, select, textarea {
  font: inherit;
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--input); border-radius: 6px; padding: 2px 6px;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
.queue { margin: 0; padding-left: 18px; } .queue li span { overflow-wrap: anywhere; margin-right: 6px; }
/* The needs-you panel, under the strip: approval cards lead with their command, the JSON
   behind a toggle; approve is the primary button, deny the destructive outline. */
.needs { padding: 8px 16px; display: grid; gap: 6px; max-width: 100%; }
.needs h2 { margin: 0; font-size: 1em; }
.approvals, .needs-other { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.needs-other li { overflow-wrap: anywhere; }
/* A list that could not be refreshed, and a room whose state could not be read: information under the
   list, not needs themselves, so the pill does not count them. */
.needs-other li.needs-stale, .needs-other li.needs-unread { color: var(--muted-foreground); font-size: var(--text-small); }
.needs-other li.needs-settled { font-size: var(--text-small); }
/* A pending approval: the card shape, its waiting state a 3 px warning bar on its left edge
   (below); the Needs you heading and pill say it in words. */
.approval { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); display: grid; gap: 6px;
  background: var(--card); color: var(--card-foreground); min-width: 0; }
.approval-command { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval-meta { color: var(--muted-foreground); font-size: var(--text-small); overflow-wrap: anywhere; }
.approval-json > summary { cursor: pointer; color: var(--muted-foreground); font-size: var(--text-small); }
.approval-json pre { margin: 4px 0 0; background: var(--muted); padding: 6px; overflow-x: auto; max-height: 16em; border-radius: 6px; }
.approval-decide { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.approval-decide input { flex: 1 1 12em; min-width: 0; }
/* A need decided elsewhere or by another control (needs.ts's needCard): the approval card's surface
   and bar, its heading, its sentence, and one action that is always there. */
.needs-other li.need { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); display: grid; gap: 4px;
  background: var(--card); color: var(--card-foreground); min-width: 0; }
/* The bar is straight: it runs between the 16 px corners rather than bending round them. */
.approval, .needs-other li.need { position: relative; }
.approval::before, .needs-other li.need::before {
  content: ""; position: absolute; left: -1px; top: var(--radius-md); bottom: var(--radius-md); width: 3px;
  border-radius: 0 3px 3px 0; background: var(--warning-border); pointer-events: none; }
.need-title { margin: 0; font-weight: 700; }
.need-what, .need-why { margin: 0; font-size: var(--text-small); }
.need-why { color: var(--muted-foreground); }
/* Next's slash commands, folded when a Needs-you card already offers the acts as buttons. */
.next-commands > summary { cursor: pointer; color: var(--muted-foreground); font-size: var(--text-small); }
.next-commands > p { margin: 4px 0 0; }
/* The proposed plan, folded under a plan-review card: what Approve approves, read in the room. */
.need-plan { font-size: var(--text-small); }
.need-plan > summary { cursor: pointer; color: var(--link); }
.need-plan p { margin: 4px 0 0; }
.need-plan .need-plan-head { color: var(--muted-foreground); }
.need-plan ol, .need-plan ul { margin: 2px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
.need-act { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 4px; }
.need-act button { font-weight: 700; padding: 0 14px; }
.need-act input[type="text"] { flex: 1 1 200px; min-width: 140px; }
/* The link out reads as the card's button: the primary fill, a full target; its arrow says it leaves. */
a.need-go {
  display: inline-flex; align-items: center; min-height: var(--hit); box-sizing: border-box; padding: 0 14px;
  border-radius: var(--radius-control); background: var(--primary); color: var(--primary-foreground); font-weight: 700; text-decoration: none;
  transition-property: box-shadow, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
a.need-go:hover { box-shadow: var(--shadow-border-hover); text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) { a.need-go:active { scale: .96; } }
.need-where { color: var(--muted-foreground); font-size: var(--text-small); }
.need-ack { margin: 4px 0 0; display: grid; gap: 2px; font-weight: 500; }
.need-ack:empty { display: none; }
.need[data-ack="refused"] .need-ack, .need-ack-stalled { color: var(--destructive-text); }
.need-ack:focus { outline: none; }
.stop-ack { font-size: var(--text-small); color: var(--muted-foreground); }
.stop-ack:empty { display: none; }
/* A card is scrolled to (the pill, a hash) clear of the sticky dock, buttons included. */
.approval, .needs-other li.need { scroll-margin-bottom: calc(var(--dock-h, 0px) + 8px); }
.approval-decide { scroll-margin-bottom: calc(var(--dock-h, 0px) + 8px); }
/* Expired: no decision on offer; the word in the warning text colour, the bar quiet. */
.approval[data-state="expired"]::before { background: var(--border); }
.approval[data-state="expired"] .approval-deadline { color: var(--warning-foreground); font-weight: 700; }
button.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
/* Deny is a ghost: the destructive word, no outline; hover tints it. */
button.deny { color: var(--destructive-text); border-color: transparent; background: transparent; }
button.deny:hover { background: color-mix(in srgb, var(--destructive) 10%, transparent); box-shadow: none; }
.manifest pre { background: var(--muted); padding: 8px; border-radius: 6px; }
.new-room { padding: 8px 16px; } .new-room .notice { color: var(--destructive); }
.fork-here { font-size: var(--text-small); padding: 0 6px; }
/* U7: fork here sits in a toolbar beside a message or a handoff, shown on hover and focus. */
.row { position: relative; max-width: var(--log-w); }
.row-tools { position: absolute; right: -4px; top: 0; opacity: 0; visibility: hidden; pointer-events: none; transition-property: opacity, visibility; transition-duration: 150ms; transition-timing-function: ease-out; }
.row:hover .row-tools, .row:focus-within .row-tools { opacity: 1; visibility: visible; pointer-events: auto; }
/* No hover, no reveal: on touch the control stays visible, in the flow under the row where it
   cannot cover the timestamp, and is a full 44 px target. */
@media (hover: none), (pointer: coarse) {
  .row-tools { position: static; opacity: 1; visibility: visible; pointer-events: auto; text-align: right; }
  .row-tools { margin-top: -2px; }
  .row-tools .fork-here { border: 0; background: none; box-shadow: none; color: var(--muted-foreground); font-size: var(--text-small); line-height: var(--leading-small); height: 20px; min-height: 0; padding: 0 8px; }
  .row-tools .fork-here:hover { box-shadow: none; text-decoration: underline; }
  /* 20 px visible + 12 px each way = 44 px, over the row's own inert space. */
  .row-tools .fork-here::after { inset: -12px -8px; }
}
.fork { padding: 8px 16px; border-top: 1px solid var(--border); background: var(--background); }
.fork form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fork input { flex: 1 1 12em; min-width: 0; }
.fork pre { background: var(--muted); padding: 8px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cli-setup { margin-top: 16px; padding: 0 16px 16px; }
.cli-setup > summary { cursor: pointer; font-size: var(--text-small); color: var(--muted-foreground); width: fit-content; }
.cli-setup[open] > summary { margin-bottom: 8px; }
/* The CLI setup card (view.ts cliSetup): numbered steps, each command in an inset block with
   its Copy button. Concentric radii: the card 14 px, a block 10 px, the button 6 px at 4 px
   in. A block wraps its lines (a word breaks only when nothing else fits), so the fold never
   scrolls sideways; the button floats, so the command's later lines run under it. */
.cli-card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); max-width: 80ch; min-width: 0; }
.cli-message { margin: 0; }
.cli-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; counter-reset: cli-step; }
.cli-step { counter-increment: cli-step; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 12px; row-gap: 6px; }
.cli-step > * { grid-column: 2; min-width: 0; }
.cli-step::before {
  content: counter(cli-step); grid-column: 1; grid-row: 1; width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center; font-size: var(--text-small); font-weight: 700; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary);
}
.cli-step-title { margin: 0; line-height: 24px; }
.cli-note { margin: 0; font-size: var(--text-small); color: var(--muted-foreground); }
.cli-note code { color: var(--card-foreground); }
.cli-code { background: var(--muted); border-radius: 10px; padding: 4px; }
.cli-code pre { margin: 0; padding: 8px 8px 8px 10px; white-space: pre-wrap; overflow-wrap: break-word; max-height: none; overflow: visible; color: var(--foreground); }
.cli-copy { float: right; min-height: var(--hit); min-width: 84px; margin: 0 0 4px 8px; padding: 0 12px; font-size: var(--text-small); border-radius: 6px; }
.cli-live, .run-status-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  .cli-card { padding: 12px; }
  .cli-step { grid-template-columns: minmax(0, 1fr); }
  .cli-step::before { display: none; }
  .cli-step-title::before { content: counter(cli-step) ". "; color: var(--primary); }
  .cli-step > * { grid-column: 1; }
  .cli-code { border-radius: 8px; padding: 2px; }
  .cli-copy { margin: 0 0 2px 6px; }
}
.new-room .hint { flex-basis: 100%; color: var(--muted-foreground); font-size: var(--text-small); }
.gone { padding: 16px; }

/* Room page lead: the notes. Wraps at phone width, never scrolls sideways. */
.summary { padding: 8px 16px; display: grid; gap: 8px; max-width: 100%; overflow-wrap: anywhere; }
.summary-error { color: var(--destructive); margin: 0; }
.summary .hint { color: var(--muted-foreground); font-size: var(--text-small); }
.notes { overflow-wrap: anywhere; }
.notes .note-latest { margin: 0; }
.notes .note-latest .hint { margin-left: 8px; }
.notes details > summary { cursor: pointer; color: var(--muted-foreground); font-size: var(--text-small); }
.notes ul { margin: 4px 0 0; padding-left: 18px; }
.policy { overflow-wrap: anywhere; font-size: var(--text-small); }
.policy > summary { cursor: pointer; color: var(--muted-foreground); }
.policy p { margin: 4px 0 0; }
.policy ul { margin: 2px 0 0; padding-left: 18px; }
.raw-events { margin-top: 8px; }
.raw-events > summary { cursor: pointer; padding: 4px 0; }
/* Until the first frame (P9): three message shapes, pulsing where motion is welcome. */
.skeleton { padding: 8px 16px; display: grid; gap: 12px; max-width: var(--log-w); }
.sk-msg { height: 56px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); }
.sk-msg:nth-child(2) { width: 70%; }
.sk-msg:nth-child(3) { width: 85%; }
@media (prefers-reduced-motion: no-preference) {
  .sk-msg { animation: pulse 1.6s ease-in-out infinite; }
}

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

/* Room list */
/* The page title beside the brand: a 1px divider, then the title lighter and smaller than the
   wordmark, so the header reads "maku | Rooms", never "maku Rooms". The grid's 16px gap and the
   16px padding put the divider midway; 24px of line height makes it 24px tall. */
.page-header .page-title {
  margin: 0; align-self: center;
  font: 700 var(--text-heading)/var(--leading-heading) var(--font-display);
  color: var(--muted-foreground);
  border-left: 1px solid var(--border); padding-left: 16px;
}
/* On a phone the title steps down as the room's does: a heading beside the brand wrapped a
   repository's name over three lines at 390 px. After the rule above, which it overrides. */
@media (max-width: 640px) { .page-header .page-title { font-size: var(--text-body); line-height: var(--leading-body); } }
.page-header .theme-toggle { align-self: center; }
.list-tools { display: flex; gap: 8px 12px; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.list-tools label { display: inline-flex; gap: 6px; align-items: center; }
.list-tools .notice { color: var(--destructive-text); }
.list-tools .notice:empty { display: none; }
/* The closed hint (view.ts): the rooms that ended are on the closed view, one click away. */
.closed-hint { margin: 0; padding: 0 16px 8px; color: var(--muted-foreground); font-size: var(--text-small); }
.closed-hint button { min-height: 0; padding: 0; border: 0; background: transparent; color: var(--link); font: inherit; font-weight: 700; }
.closed-hint button:hover { box-shadow: none; text-decoration: underline; }
.list-tools label, .list-tools select, .list-tools button { min-height: var(--hit); }
/* More holds the secondary acts (Investigate with an agent) beside New task, the one primary. */
.list-tools .more-menu { position: relative; margin-left: auto; }
.list-tools [data-act="more"] { padding: 0 14px; font-weight: 400; }
.more-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 2; min-width: 16em; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 4px 16px color-mix(in srgb, var(--foreground) 12%, transparent); }
.more-items[hidden] { display: none; }
.more-items [role="menuitem"] { display: block; width: 100%; text-align: left; border: 0; background: transparent; font-weight: 400; padding: 0 10px; }
.more-items [role="menuitem"]:hover, .more-items [role="menuitem"]:focus-visible { background: color-mix(in srgb, var(--primary) 8%, var(--card)); }
/* The search box filters the loaded rows; it gives way on a phone. */
.list-tools .room-search { min-height: var(--hit); box-sizing: border-box; flex: 0 1 18em; min-width: 8em; }
/* The auto-refresh: when it last read the list, the interval and the pause, before More. */
.list-tools .refresh { display: inline-flex; gap: 8px; align-items: center; margin-left: auto; }
.list-tools .refresh + .more-menu { margin-left: 0; }
.new-room .new-room-lead { flex-basis: 100%; margin: 0; }
/* A sortable column's header is a button that reads as the header: the arrow marks the order. */
.rooms th .sort { min-height: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: baseline; }
.rooms th .sort:hover { box-shadow: none; color: var(--foreground); }
.rooms th .sort:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
.rooms th[aria-sort] .sort { color: var(--foreground); }
.rooms th .sort-arrow { display: inline-block; min-width: 1ch; }
.refresh-status { color: var(--muted-foreground); font-size: var(--text-small); font-variant-numeric: tabular-nums; }
.refresh-status[data-failed] { color: var(--destructive-text); }
.refresh-pause { padding: 0 10px; }
table.rooms { width: calc(100% - 32px); margin: 0 16px; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.rooms th, .rooms td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: baseline; font-variant-numeric: tabular-nums; }
.rooms tbody tr:last-child td { border-bottom: 0; }
.rooms th { color: var(--muted-foreground); white-space: nowrap; }
.rooms th:first-child, .rooms .room-row td:first-child { width: 1%; white-space: nowrap; }
.rooms .needs-pill { background: var(--warning); color: var(--warning-solid-foreground); border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: var(--text-small); }
/* A row opens its room: the task link's ::after covers the row (the stretched-link pattern),
   so there is one link per row and no click handler; any other link or button sits above it. */
.rooms tr.room-row { position: relative; }
.rooms tr.room-row:hover, .rooms tr.room-row:focus-within { background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.rooms .task-link { text-decoration: none; }
.rooms .task-link::after { content: ""; position: absolute; inset: 0; }
.rooms .task-link:hover, .rooms .task-link:focus-visible { text-decoration: underline; }
.rooms .task-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 2px; }
.rooms .room-row a:not(.task-link), .rooms .room-row button { position: relative; z-index: 1; }
/* The room id is copied into maku: above the link too, so it selects and a click stays put. */
.rooms td.room-id { position: relative; z-index: 1; cursor: text; }
/* The strip's phase chip (.page-header .chip), on the card's tokens; 50%, so its border holds 3:1 on a card
   and on a hovered row. */
.rooms .chip-phase {
  color: var(--card-foreground); background: transparent;
  border-color: color-mix(in srgb, var(--card-foreground) 50%, var(--card));
}
/* The room page's status line (strip.ts's .run-status), compact: the icon is the colour cue,
   never the only one, on tokens that hold 3:1 on a card and on a hovered row in both themes. */
.rooms .row-status { display: inline-flex; gap: 6px; align-items: baseline; color: var(--card-foreground); font-weight: 500; line-height: 1.35; }
.rooms .row-status-icon { flex: none; color: var(--muted-foreground); }
.rooms .row-status[data-kind="running"] .row-status-icon { color: var(--primary); }
.rooms .row-status[data-kind="waiting-you"] .row-status-icon, .rooms .row-status[data-kind="waiting-other"] .row-status-icon, .rooms .row-status[data-kind="waiting-pr"] .row-status-icon, .rooms .row-status[data-kind="waiting"] .row-status-icon { color: var(--warning-border); }
.rooms .row-status[data-kind="finished"] .row-status-icon, .rooms .row-status[data-kind="done"] .row-status-icon { color: var(--success); }
.rooms .row-status[data-kind="failed"] .row-status-icon { color: var(--destructive); }
.rooms .repo, .rooms .room-id { color: var(--muted-foreground); }
.rooms td.repo { white-space: nowrap; } /* an owner/name reads whole; the task and the status wrap */
@media (max-width: 600px) {
  /* A phone keeps what needs you, the task and its status; the repository and the rest go. */
  .rooms th:nth-child(3), .rooms td:nth-child(3), .rooms th:nth-child(n+5), .rooms td:nth-child(n+5) { display: none; }
  .rooms .row-status { font-size: var(--text-small); }
  .rooms th:first-child { white-space: normal; } /* "Needs / you" on two lines, not a wide column */
  .rooms th, .rooms td { padding: 8px 10px; }
}

/* Approval card: the plain-words block leads, the raw command folds under details. */
.approval-intent { margin: 0; font-weight: 500; }
.approval-why, .approval-deadline, .approval-status { margin: 0; font-size: var(--text-small); overflow-wrap: anywhere; }
.approval-outcomes { display: grid; gap: 2px; font-size: var(--text-small); }
.approval-outcomes p { margin: 0; }
.approval-status[data-can="true"] { color: var(--foreground); font-weight: 500; }
.approval-status[data-can="false"] { color: var(--muted-foreground); }
.approval-details > summary { cursor: pointer; color: var(--muted-foreground); font-size: var(--text-small); }
.approval-details > :not(summary) { margin-top: 6px; }

/* The run status (strip.ts): the first line of the strip. Icon and words say it; the accent bar
   is the colour cue, never the only one. Maku weights: 700 for the bold line. */
/* A pill tinted in the state's tone (--tone), the icon in the tone itself; the words carry it at
   full ink, so the tint is never the only cue. */
.run-status {
  --tone: var(--muted-foreground);
  display: flex; gap: 8px; align-items: baseline; justify-self: start; max-width: 100%; box-sizing: border-box;
  font-size: var(--text-body); line-height: 1.4; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 3px 14px 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 14%, var(--brand-header));
}
.run-status[hidden] { display: none; }
.run-status[data-kind="running"] { --tone: var(--primary); }
.run-status[data-kind="waiting-you"], .run-status[data-kind="waiting-other"], .run-status[data-kind="waiting-pr"], .run-status[data-kind="waiting"] { --tone: var(--warning-border); }
.run-status[data-kind="finished"], .run-status[data-kind="done"] { --tone: var(--success); }
.run-status[data-kind="failed"] { --tone: var(--destructive); }
.run-status-icon { flex: none; align-self: center; display: inline-flex; color: var(--tone); }
.run-status-icon .icon, .row-status-icon .icon { display: block; }
.icon-dot { fill: currentColor; }

/* The run rail (rail.ts): a node's lane colour comes from data-tone, a plan step's from
   data-state=ghost; role text never reaches a class. No node fades: a finished one's lane mutes
   (its tone at 70% over the card, 3:1) and a ghost's is dashed, so its text keeps full contrast. */
.rail { font-size: var(--text-small); min-width: 0; overflow-wrap: anywhere; }
.rail[hidden] { display: none; }
.rail-path, .rail-milestones { list-style: none; margin: 0; padding: 0; }
.rail-node { position: relative; --lane: var(--flow-writer); }
.rail-node[data-tone="judge"] { --lane: var(--flow-judge); }
.rail-node[data-state="ghost"] { --lane: var(--flow-plan); }
.rail-node[data-state="done"] > .rail-button { border-left-color: color-mix(in srgb, var(--lane) 70%, var(--card)); }
.rail-button {
  display: grid; gap: 2px; width: 100%; min-height: var(--hit); padding: 6px 8px; text-align: left;
  font: inherit; color: var(--foreground); background: var(--card); cursor: pointer;
  border: 1px solid var(--border); border-left: 3px solid var(--lane); border-radius: 6px;
}
.rail-button:hover { box-shadow: var(--shadow-border-hover); }
.rail-button:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.rail-button[aria-current="true"] { border-color: var(--lane); }
.rail-button[aria-pressed="true"] { background: var(--accent); color: var(--accent-foreground); }
/* A ghost's button is disabled: it opts out of button:disabled's fade, as every node does. */
.rail-node[data-state="ghost"] .rail-button { background: transparent; border-style: dashed; cursor: default; opacity: 1; }
.rail-node[data-state="ghost"] .rail-persona { color: var(--muted-foreground); }
.rail-line { display: flex; gap: 8px; align-items: center; min-width: 0; }
.rail-line .glyph { flex: none; width: 22px; height: 22px; color: var(--lane); }
.rail-persona { font-size: var(--text-body); font-weight: 500; min-width: 0; }
.rail-chip { margin-left: auto; white-space: nowrap; color: var(--muted-foreground); }
.rail-chip[data-kind="ok"] { color: var(--success-text); }
.rail-chip[data-kind="changes"], .rail-chip[data-kind="fail"] { color: var(--destructive-text); }
.rail-chip[data-kind="live"] { color: var(--lane); }
.rail-judge { color: var(--flow-judge); white-space: nowrap; }
.rail-detail { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
/* The room's activity on a node: who steered it (the card lists them), and its chat as a count. */
.rail-activity { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: center; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.rail-steered { color: var(--foreground); white-space: nowrap; }
.rail-chat { display: inline-flex; gap: 4px; align-items: center; }
.rail-chat .glyph { width: 16px; height: 16px; }
.rail-chat .glyph path { vector-effect: non-scaling-stroke; }
/* The notes waiting for the next run: on the next ghost, or in the gap after the live node. */
.rail-queued {
  display: block; width: fit-content; margin: 4px 0 0 12px; padding: 0 8px; border: 1px dashed var(--border); border-radius: 999px;
  color: var(--muted-foreground); font-variant-numeric: tabular-nums;
}
/* Every served model, then the alias asked for, dimmer, when no served model is it. */
.rail-models { display: flex; flex-wrap: wrap; gap: 0 4px; color: var(--muted-foreground); }
.rail-models > :not(:first-child)::before { content: "·\00a0"; }
.rail-model { color: var(--foreground); }
.rail-asked { opacity: 0.8; }
.rail-asked::after { content: " (asked)"; }
/* A picked node's lines take its foreground: muted text on the accent was unreadable (v0.40.0). */
.rail-button[aria-pressed="true"] :is(.rail-detail, .rail-models, .rail-model, .rail-chip, .rail-judge, .rail-activity, .rail-steered) { color: inherit; }
.rail-edge { display: flex; align-items: center; gap: 6px; padding-left: 4px; }
.rail-edge svg { flex: none; }
.rail-stroke { fill: none; stroke: var(--border); stroke-width: 2; }
.rail-edge[data-state="ghost"] .rail-stroke { stroke: var(--flow-plan); stroke-dasharray: 3 3; }
.rail-edge-label { color: var(--muted-foreground); }
.rail-round > button {
  width: 100%; min-height: var(--hit); padding: 6px 8px; text-align: left; font: inherit;
  color: var(--muted-foreground); background: transparent; border: 1px dashed var(--border); border-radius: 6px; cursor: pointer;
}
.rail-parts { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; display: grid; gap: 6px; font-size: var(--text-small); }
.rail-part, .rail-parent { color: var(--muted-foreground); }
.rail-part a, .rail-parent a { color: var(--muted-foreground); }
.rail-part-lane { border-left: 2px solid var(--border); padding: 4px 0 4px 8px; display: grid; gap: 4px; }
.rail-part-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.rail-part-cost, .rail-part-run-cost { color: var(--muted-foreground); font-variant-numeric: tabular-nums; margin-left: auto; }
.rail-part-runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.rail-part-run {
  --lane: var(--flow-writer); display: flex; gap: 6px; align-items: center;
  padding: 2px 6px; border: 1px solid var(--border); border-left: 3px solid var(--lane); border-radius: 4px; background: var(--card); color: var(--foreground);
}
.rail-part-run[data-tone="judge"] { --lane: var(--flow-judge); }
.rail-part-run .glyph { flex: none; width: 16px; height: 16px; color: var(--lane); }
.rail-part-strip { margin: 0; color: var(--muted-foreground); }
.rail-part[data-state="running"] { color: var(--foreground); border-left-color: var(--flow-writer); }
.rail-part[data-state="done"] { border-left-color: var(--success); }
.rail-part[data-state="waiting"], .rail-part[data-state="escalated"] { border-left-color: var(--warning-border); }
.rail-part[data-state="dropped"], .rail-part[data-state="reverted"] { border-left-color: var(--destructive); }
.rail-part[data-state="queued"] { opacity: 0.6; }
.rail-parent { padding: 0 0 6px 4px; font-size: var(--text-small); }
.rail-milestones { display: grid; gap: 4px; margin-top: 8px; }
.rail-milestone { display: flex; gap: 6px; align-items: center; color: var(--muted-foreground); }
.rail-milestone::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-foreground); }
.rail-milestone[data-state="ghost"] { color: var(--flow-plan); }
.rail-milestone[data-state="ghost"]::before { background: transparent; border: 1px dashed var(--flow-plan); }
/* Fixed, placed by rail.ts beside its node: inside the rail's scroll box it was clipped (v0.40.0).
   Its height is capped to the room the window has; a longer card scrolls on its own. */
.rail-card {
  position: fixed; z-index: 5; box-sizing: border-box; padding: 8px; display: grid; gap: 2px; align-content: start;
  overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere;
  background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-border), var(--shadow-dock); border-radius: 6px;
}
.rail-card[hidden] { display: none; }
.rail-card p { margin: 0; }
.rail-card .hint { margin-left: 8px; color: var(--muted-foreground); }
.rail-card .rail-card-head { margin-top: 6px; color: var(--muted-foreground); }
.rail-steers { list-style: none; margin: 0; padding: 0; }
.rail-earlier { color: var(--muted-foreground); }
@media (prefers-reduced-motion: no-preference) {
  .rail-node.enter { animation: rail-enter 150ms ease-out; }
  .rail-stroke.draw { stroke-dasharray: var(--len); animation: rail-draw 400ms ease-out; }
  .rail-judge.tick { display: inline-block; animation: rail-tick 200ms ease-out; }
  .rail-milestone.fill::before { animation: rail-fill 300ms ease-out; }
  .rail .arrive { animation: rail-arrive 180ms ease-out; }
  .rail-node[data-state="live"] > .rail-button { animation: rail-breathe 2.4s ease-in-out infinite; }
  @keyframes rail-enter { from { opacity: 0; transform: scale(0.96); } }
  @keyframes rail-arrive { from { opacity: 0; transform: translateY(2px); } }
  @keyframes rail-draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
  @keyframes rail-tick { 50% { transform: scale(1.4); } }
  @keyframes rail-fill { from { transform: scale(0); } }
  @keyframes rail-breathe { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--lane) 35%, transparent); } }
}
.rail-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }

/* The room body: the conversation, and the rail beside it from 1100 px up. Below that the rail is
   a drawer a row of dots opens. --header-h and --dock-h come from room.ts (CSSOM). */
.room-body { min-width: 0; }
.rail-dots, .rail-close { display: none; }
/* The page fills the window: the dock stays at the bottom when the room is short. */
/* overflow-x clip: a line no rule wraps is cut here, never the whole page scrolled sideways
   (v0.40.0). clip, not hidden: hidden is a scroll box, which ends the header's and dock's stickiness. */
#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; overflow-x: clip; }
#app > .room-body { flex: 1 0 auto; }
#app > .page-dock { margin-top: auto; }
.room-body:not(.has-rail) > .rail { display: none; }
/* The narrow strip: "scoper ✓ · tester ✓ · implementer ● · reviewer ○". Inline text, so a long path
   wraps at the separators (or anywhere) instead of scrolling; the glyph beside each word carries the
   state, the lane colour only tints it. */
.rail-dots {
  box-sizing: border-box; max-width: calc(100% - 32px); margin: 8px 16px 0; padding: 6px 8px; min-height: var(--hit);
  text-align: left; font: inherit; font-size: var(--text-small); line-height: var(--leading-small); overflow-wrap: anywhere;
  color: var(--foreground); background: var(--card); border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.rail-dot-glyph { color: var(--flow-writer); }
.rail-dot[data-tone="judge"] .rail-dot-glyph { color: var(--flow-judge); }
.rail-dot[data-state="ghost"] .rail-dot-glyph { color: var(--flow-plan); }
@media (max-width: 1099.98px) {
  .room-body.has-rail > .rail-dots:not([hidden]) { display: block; }
  .room-body.has-rail > .rail.open {
    display: block; position: fixed; z-index: 3; top: 0; right: 0; bottom: 0; width: min(320px, 100vw);
    overflow-y: auto; padding: 16px; box-sizing: border-box; background: var(--surface-raised); box-shadow: var(--shadow-dock);
  }
  .rail.open > .rail-close { display: block; margin-left: auto; margin-bottom: 8px; min-height: var(--hit); }
  .room-body.has-rail > .rail:not(.open) { display: none; }
}
@media (min-width: 1100px) {
  /* The column takes the window's width and the rail sits at its right edge; the composer shares
     the grid (the rail's 360 px, the same 32 px gap). Cards grow with the column (no --log-w
     cap here), prose inside them keeps a readable measure. */
  .room-body { --log-w: none; }
  .page-dock { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 32px; }
  .room-body.has-rail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; column-gap: 16px; align-items: start; padding-right: 16px; }
  .bubble .md, .handoff > .md, .notes { max-width: 100ch; }
  .room-body.has-rail > :not(.rail) { grid-column: 1; }
  .room-body.has-rail > .rail {
    grid-column: 2; grid-row: 1 / span 6; position: sticky; top: var(--header-h, 0px);
    /* border-box: the 8 px of padding is inside the height, or the rail's last 8 px sit under the dock. */
    box-sizing: border-box; padding: 8px 0;
    max-height: calc(100vh - var(--header-h, 0px) - var(--dock-h, 0px));
    max-height: calc(100dvh - var(--header-h, 0px) - var(--dock-h, 0px));
    overflow-y: auto; overscroll-behavior: contain; align-self: start;
  }
}

/* A run's own view (runview.ts), in place of the room's conversation. */
.run-view-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.run-view-title { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.run-view-note { margin: 0 0 8px; color: var(--muted-foreground); }

/* A run's screenshots (shots.ts): the chat card, the run's gallery above its events, and the
   viewer. Flat like a card: a hairline and the surface, no shadow beyond a button's hover ring. */
.shot-card { display: grid; gap: 4px; justify-items: start; max-width: var(--log-w); margin: 8px 0; }
.shot-thumb {
  display: block; padding: 0; overflow: hidden; line-height: 0; cursor: zoom-in;
  border: 1px solid var(--border); border-radius: var(--radius-row); background: var(--card);
}
.shot-thumb img { display: block; width: 240px; max-width: 100%; height: auto; }
.shot-caption { margin: 0; color: var(--muted-foreground); font-size: var(--text-small); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.shot-blind { margin: 0; color: var(--foreground); font-size: var(--text-small); font-weight: 700; }
.shots { margin: 0 0 12px; }
.shots-head { margin: 0 0 8px; color: var(--muted-foreground); }
.shots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.shots-item { display: grid; gap: 4px; align-content: start; }
.shots-grid .shot-thumb, .shots-grid .shot-thumb img { width: 100%; }
.shot-viewer {
  box-sizing: border-box; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); color: var(--card-foreground);
}
.shot-viewer::backdrop { background: color-mix(in srgb, var(--background) 85%, transparent); }
.shot-viewer-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.shot-viewer-bar button { min-height: var(--hit); }
.shot-viewer-count { margin-right: auto; font-family: var(--font-mono); font-size: var(--text-small); font-variant-numeric: tabular-nums; }
.shot-viewer-figure { display: grid; gap: 4px; margin: 0; }
.shot-viewer-figure img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 180px); object-fit: contain; }
@media (prefers-reduced-motion: no-preference) {
  .shot-viewer[open] { animation: settle-in 180ms ease-out; }
}
.rail-shots { white-space: nowrap; }

/* The coordination panel: a parent's family, apart from the run rail and its split parts. */
.rail-coordination { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.rail-coordination-title { margin: 0; font-size: var(--text-body); }
.rail-coordination-nodes, .rail-coordination-edges { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rail-coordination-node { --lane: var(--flow-writer); border-left: 3px solid var(--lane); padding-left: 8px; }
.rail-coordination-node[data-tone="judge"] { --lane: var(--flow-judge); }
.rail-coordination-head { display: flex; gap: 6px; align-items: center; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.rail-coordination-head:disabled { color: var(--muted-foreground); opacity: 0.7; }
.rail-coordination-meta, .rail-coordination-links { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted-foreground); font-size: var(--text-small); }
.rail-coordination-edge { color: var(--muted-foreground); font-size: var(--text-small); }
.rail-coordination-edge[data-state="pending"] { opacity: 0.7; }
.rail-coordination-restricted { margin: 0; color: var(--muted-foreground); font-style: italic; }
.rail-coordination-act { justify-self: start; }
.rail-coordination-status:empty { display: none; }

/* The settings pages (merge policy stage 6). */
/* The sections as tabs, on the header's own surface so they read as its lower edge; the hairline
   under them ends the chrome. The current one (aria-current) takes the full ink and a primary bar,
   never a bolder weight, which would shift its neighbours. The 4 px inset puts the first label under
   the brand mark. A phone scrolls the row sideways rather than wrap it. */
.settings-nav {
  display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 0 16px; padding: 0 4px;
  background: var(--brand-header); box-shadow: inset 0 -1px 0 var(--border);
}
.settings-nav a {
  position: relative; display: inline-flex; align-items: center; flex: none; min-height: var(--hit); padding: 0 12px;
  font-size: var(--text-small); font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--muted-foreground);
  transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.settings-nav a:hover { color: var(--brand-header-foreground); }
.settings-nav a[aria-current="page"] { color: var(--brand-header-foreground); }
.settings-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary);
}
.settings-nav a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-control); }
/* Approval memory inside the settings chrome: the header's title is its h1, and it aligns with the other pages. */
@media (max-width: 640px) {
  /* One row that scrolls sideways; its right edge fades, saying the tabs go on. */
  .settings-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav a:focus-visible { outline-offset: -2px; } /* the scrolling row clips an outset ring */
  .settings-nav { -webkit-mask: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
}
main.settings.approval-memory { margin: 0 16px; padding: 0; max-width: none; }
main.settings.approval-memory > h1:first-child { display: none; }
.settings { margin: 0 16px; }
.settings .settings-table { width: 100%; margin: 0; }
/* A policy's repositories: the name stays on one line, and the other columns take the rest. */
.settings .consumers td:first-child, .settings .impact td:first-child { white-space: nowrap; }

/* Settings home: one card per section, the whole card the link. */
.settings-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 8px 0 24px; }
.settings-card { display: block; border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card);
  color: var(--card-foreground); text-decoration: none; position: relative; isolation: isolate; transition: transform 150ms ease-out; }
/* The hover raise is a layer faded in behind the text, so only opacity and transform animate. */
.settings-card::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--surface-raised); opacity: 0; transition: opacity 150ms ease-out; }
.settings-card:hover { transform: translateY(-1px); }
.settings-card:hover::after { opacity: 1; }
.settings-card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.settings .settings-card h2 { margin: 0 0 4px; font-size: var(--text-heading); line-height: var(--leading-heading); }
.settings-card p { margin: 0 0 8px; color: var(--muted-foreground); max-width: 60ch; }
.settings-card .settings-card-counts { margin: 0; color: var(--card-foreground); font-variant-numeric: tabular-nums; }

/* Settings environment summary: mirrors .policy-header's key-value rhythm below the section cards. */
.settings-env { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); margin: 0 0 24px; }
.settings-env-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.settings .settings-env-head h2 { margin: 0; font-size: var(--text-heading); line-height: var(--leading-heading); }
.settings-env-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.settings-env-list dt { color: var(--muted-foreground); line-height: var(--leading-body); }
.settings-env-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (min-width: 721px) {
  .settings-env-list { grid-template-columns: max-content minmax(0, 20em) max-content minmax(0, 1fr); column-gap: 16px; }
}
.settings-env-mono { font-family: var(--font-mono); }
.settings-env-muted { color: var(--muted-foreground); }
.settings-env-warn { color: var(--warning-foreground); }

/* Prose on settings pages stays readable: no line past 72 characters. */
.settings > p, .settings .guardrails, .settings .class-card p { max-width: 64ch; }
.settings h2 { font-size: var(--text-heading); line-height: var(--leading-heading); margin: 28px 0 8px; }
.settings h3 { font-size: var(--text-body); margin: 0; }

/* The repository's MergePolicy, said once above its classes: facts as a list of pairs, then each
   condition as a word on its tone. Tones pair a colour with the word, never the colour alone. */
.policy-header { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); }
/* The Workflow card (room header and New task form): each fact a label column and a value column,
   so "Outcome" never runs into "a plan to approve" (gcp-0, 2026-11-25). */
.workflow-head { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; align-items: baseline; }
.workflow-row { display: contents; }
.workflow-label { color: var(--muted-foreground); line-height: var(--leading-body); }
.workflow-value { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workflow-head > :not(.workflow-row) { grid-column: 1 / -1; margin: 0; }
.policy-header dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.policy-header dt { color: var(--muted-foreground); line-height: var(--leading-body); }
.policy-header dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (min-width: 721px) {
  .policy-header dl { grid-template-columns: max-content minmax(0, 24em) max-content minmax(0, 1fr); column-gap: 16px; }
}
.policy-header .policy-conditions { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 12px 0 0; padding: 0; }
.policy-condition { padding: 2px 10px; border-radius: 999px; font-size: var(--text-small); border: 1px solid var(--border); color: var(--muted-foreground); }
.policy-condition[title] { cursor: help; }
.policy-condition[data-tone="ok"] { border-color: var(--success); color: var(--success-text); }
.policy-condition[data-tone="warn"] { border-color: var(--warning-border); color: var(--warning-foreground); background: color-mix(in srgb, var(--warning) 12%, var(--card)); }
.policy-condition[data-tone="bad"] { border-color: var(--destructive); color: var(--destructive-text); }
.policy-differences { margin: 8px 0 0; font-size: var(--text-small); }
.policy-differences > summary { width: fit-content; cursor: pointer; color: var(--muted-foreground); }
.policy-differences > summary:hover, .policy-differences[open] > summary { color: var(--foreground); }
.policy-differences ul { margin: 4px 0 0; padding-left: 20px; }
.policy-condition-message { margin: 8px 0 0; font-size: var(--text-small); color: var(--muted-foreground); overflow-wrap: anywhere; }
.policy-authority, .policy-read { margin: 8px 0 0; font-size: var(--text-small); color: var(--muted-foreground); }
.policy-read { font-variant-numeric: tabular-nums; }
.not-migrated { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); }
/* The three modes, once: a card's badge is the word only. */
.mode-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0 0 8px; padding: 0; font-size: var(--text-small); color: var(--muted-foreground); }
.mode-legend li { display: flex; gap: 6px; align-items: baseline; }
.mode-legend .mode-badge { flex: none; }
.file-line { margin: 4px 0 0; font-size: var(--text-small); color: var(--muted-foreground); }
.file-line[data-prominent="true"] { padding: 8px 12px; border: 1px solid var(--warning-border); border-radius: var(--radius-row);
  background: color-mix(in srgb, var(--warning) 12%, var(--card)); color: var(--warning-foreground); font-weight: 500; }

/* A policy: its plain sentence, mode, evidence, and the raw expression only on demand. */
.policy-classes { display: grid; gap: 12px; }
.class-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); }
.class-card:target { border-color: var(--primary); }
.class-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.mode-badge { padding: 2px 10px; border-radius: 999px; font-size: var(--text-small); border: 1px solid var(--border); }
/* A bound class's pill links to its row in the Bindings editor: it reads as the pill, underlined on hover. */
a.mode-badge { text-decoration: none; color: inherit; }
a.mode-badge:hover { text-decoration: underline; }
.binding-form:target { outline: 2px solid var(--ring); outline-offset: 4px; border-radius: 4px; }
.mode-badge[data-mode="live"], .mode-badge[data-mode="pr"] { border-color: var(--success); color: var(--success-text); }
.mode-badge[data-mode="shadow"], .mode-badge[data-mode="draft"] { border-color: var(--primary); color: var(--link); }
.mode-badge[data-mode="propose"] { border-color: var(--warning-border); color: var(--warning-foreground); background: color-mix(in srgb, var(--warning) 12%, var(--card)); }
.mode-badge[data-mode="off"], .mode-badge[data-mode="disabled"] { color: var(--muted-foreground); }
.class-source, .evidence-detail, .class-empty { color: var(--muted-foreground); font-size: var(--text-small); }
.settings .class-card .policy-sentence, .settings > .policy-sentence { max-width: 64ch; margin: 6px 0; }
.raw-patterns { margin: 4px 0 8px; font-size: var(--text-small); }
.raw-pattern { font-family: var(--font-mono); overflow-wrap: anywhere; }
.repository-health, .backtest-warning { color: var(--warning-foreground); overflow-wrap: anywhere; }
.class-card .class-last { margin: 4px 0; font-size: var(--text-small); color: var(--muted-foreground); }
.class-card .binding-policy, .class-card .evidence-generations, .class-card .promote-where { margin: 4px 0; font-size: var(--text-small); color: var(--muted-foreground); }
.binding-editor .binding-form { min-width: 0; margin: 0 0 12px; }
.binding-editor .binding-meaning, .policy-definition { font-size: var(--text-small); overflow-wrap: anywhere; }
.mode-ladder, .editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.mode-choice { display: inline-flex; align-items: center; gap: 4px; min-height: var(--hit); padding: 0 8px; border: 1px solid var(--input); border-radius: var(--radius-control); }
.mode-choice:has(input:checked) { border-color: var(--primary); color: var(--link); }
.editor-actions .backtest-repository { display: inline-flex; align-items: center; gap: 8px; }
.editor-actions select, .editor-field input, .editor-field textarea, .editor-field select { min-width: 0; max-width: 100%; box-sizing: border-box; }
/* A time inside a settings sentence reads as part of it, not as the log's mono timestamp. */
.settings p time { font: inherit; font-variant-numeric: tabular-nums; }
.class-profiles { margin-top: 8px; }
.class-profiles > h4 { margin: 0 0 4px; font-size: var(--text-small); font-weight: 500; color: var(--muted-foreground); }
.class-profile-list { margin: 0 0 4px; padding-left: 20px; }
.class-escalation { margin: 0; font-size: var(--text-small); color: var(--muted-foreground); }
.evidence-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 4px; }
.evidence-track { flex: 1 1 8em; min-width: 8em; max-width: 320px; height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
/* Solid, not the aurora: the repository page draws one bar per class, and a screen gets one gradient. */
.evidence-fill { display: block; height: 100%; background: var(--primary); }
/* A blocked class is not about to promote: its fill is muted, never the accent of progress. */
.evidence-bar[data-blocked="true"] .evidence-fill { background: var(--muted-foreground); }
.evidence-count { font-size: var(--text-small); font-variant-numeric: tabular-nums; }
.evidence-ladder { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; padding: 0; margin: 0 0 4px; font-size: var(--text-small); color: var(--muted-foreground); }
.evidence-ladder li[data-reached="true"] { color: var(--success-text); }
.class-actions, .class-promotions, .class-exceptions { margin-top: 8px; }
.class-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* A bindings editor field: its label, then its control. */
.settings .editor-field { display: grid; grid-template-columns: minmax(12em, 18em) minmax(0, 1fr); gap: 4px 16px; align-items: start; margin: 8px 0; }

/* The differences fold settles in when opened; nothing moves under reduced motion. */
.policy-differences[open] > ul { animation: settle-in 180ms ease-out; }
@keyframes settle-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .policy-differences[open] > ul { animation: none; }
  .settings-card, .settings-card::after { transition: none; }
  .settings-card:hover { transform: none; }
}

@media (max-width: 720px) {
  .settings .editor-field { grid-template-columns: minmax(0, 1fr); }
  .settings .settings-table { display: block; overflow-x: auto; }
  .settings .repo-table, .settings .decisions-table, .settings .backtest-table, .settings .evidence-table { overflow-x: visible; }
  .settings .repo-table thead, .settings .decisions-table thead, .settings .backtest-table thead, .settings .evidence-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .settings .repo-table tbody, .settings .repo-table tr, .settings .decisions-table tbody, .settings .decisions-table tr,
  .settings .backtest-table tbody, .settings .backtest-table tr, .settings .evidence-table tbody, .settings .evidence-table tr { display: block; }
  .settings .repo-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 12px; padding: 10px 12px; }
  .settings .decisions-table tr, .settings .backtest-table tr, .settings .evidence-table tr { padding: 10px 12px; }
  .settings .repo-table tr + tr, .settings .decisions-table tr + tr, .settings .backtest-table tr + tr, .settings .evidence-table tr + tr { border-top: 1px solid var(--border); }
  .settings .repo-table td, .settings .decisions-table td, .settings .backtest-table td, .settings .evidence-table td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .settings .repo-table td { display: block; }
  .settings .repo-table td:first-child { grid-column: 1 / -1; }
  .settings .repo-table td:nth-child(n + 2) { font-size: var(--text-small); color: var(--muted-foreground); }
  .settings .repo-table td:nth-child(n + 2)[data-label]::before { content: attr(data-label) ": "; }
  .settings .decisions-table td, .settings .backtest-table td, .settings .evidence-table td { display: grid; grid-template-columns: minmax(7em, auto) minmax(0, 1fr); gap: 8px; font-size: var(--text-small); }
  .settings .decisions-table td[data-label]::before, .settings .backtest-table td[data-label]::before, .settings .evidence-table td[data-label]::before { content: attr(data-label); color: var(--muted-foreground); }
  .settings .decisions-table td:first-child, .settings .backtest-table td:first-child, .settings .evidence-table td:first-child { font-size: var(--text-body); }
}
.settings .proposal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); margin-bottom: 16px; }
.settings .proposal-file { overflow-x: auto; max-height: 24em; font-size: var(--text-small); }
.settings textarea { display: block; width: 100%; min-height: 4em; margin: 4px 0; }

/* Approval memory (/settings/approval-memory): one card per saved grant, its predicate as code. */
.grants-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.grants { list-style: none; padding: 0; display: grid; gap: 8px; }
.grant { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); background: var(--card); }
.grant-predicate { font-family: var(--font-mono); font-size: var(--text-small); overflow-wrap: anywhere; margin: 6px 0; }
.grant-facts, .grants-note { color: var(--muted-foreground); font-size: var(--text-small); }
.grant-actions { display: flex; gap: 6px; margin-top: 6px; }
.grant-history h3, .rule-preview h3 { font-size: var(--text-small); margin: 8px 0 4px; }
.rule-preview h4 { font-size: var(--text-small); margin: 8px 0 2px; }
.grant-history ul, .rule-preview ul { margin: 0; padding-left: 18px; font-size: var(--text-small); }
.rule-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.rule-field { display: grid; gap: 2px; font-size: var(--text-small); }
.rule-preview { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px; margin-top: 10px; background: var(--surface-raised); }
.approval-memory { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* The Settings & Routines entry points in the page header: quiet until hovered, pushed to the header's end. */
.page-header .routines-link, .page-header .settings-link { margin-left: auto; align-self: center; display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--hit); box-sizing: border-box;
  padding: 6px 10px; border-radius: 8px; color: var(--brand-header-foreground); text-decoration: none; font-size: var(--text-small); font-weight: 500; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--brand-header-foreground) 22%, transparent);
  transition: background-color 120ms ease, color 120ms ease; }
.page-header .header-actions .routines-link, .page-header .header-actions .settings-link { margin-left: 0; }
.page-header .routines-link:hover, .page-header .settings-link:hover { background: color-mix(in srgb, var(--brand-header-foreground) 10%, transparent); }
.page-header .routines-link:focus-visible, .page-header .settings-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.page-header .settings-link + .theme-toggle { margin-left: 8px; }
.page-header .header-actions .settings-link + .theme-toggle { margin-left: 0; }

/* The filter over a list: label, field, count; hidden items leave the layout. */
.settings [hidden] { display: none !important; }
.filter { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0; }
.filter:empty { display: none; }
.filter input { min-width: 0; flex: 1 1 220px; max-width: 360px; padding: 6px 10px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--background); color: var(--foreground); }
.filter-count { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.filter-empty { flex-basis: 100%; margin: 0; }
@media (max-width: 720px) {
  .filter label { flex-basis: 100%; }
  .filter input { flex-basis: 100%; max-width: none; }
}

/* New task form (Task G4): beside New room above the room list. */
.list-tools [data-act="new-task"] { padding: 0 14px; font-weight: 700; }
.new-task { margin: 0 16px 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); display: grid; gap: 12px; }
.new-task-form { display: grid; gap: 10px; }
.new-task-text { display: grid; gap: 4px; }
.new-task-text textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--background); color: var(--foreground); resize: vertical; }
.new-task-row, .new-task-options, .new-task-actions, .new-task-q-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.new-task .notice { margin: 0; color: var(--destructive-text); }
.new-task .notice:empty { display: none; }
.new-task-preview { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.new-task-title { margin: 0; font-size: var(--text-body); font-weight: 700; }
.new-task-body { margin: 4px 0 0; padding: 10px 12px; background: var(--muted); border-radius: var(--radius-control); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-small); }
.new-task-check { display: inline-flex; gap: 6px; align-items: center; }
.new-task-question { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--background); }
.new-task-q-text { margin: 0; font-weight: 500; }
.new-task-q-actions input { flex: 1 1 16em; min-width: 0; }
.new-task-link-notice, .new-task-filed { margin: 0; }

/* Correctness signals, guidance surfaces: the factory's sentence, the help line under each field,
   the fields the form does not edit, a blocked promotion's lines, the explainer and the guided flow. */
.settings .policy-meaning, .settings .evidence-progress { max-width: 64ch; margin: 4px 0 8px; }
.settings .editor-field .field-help { grid-column: 2; color: var(--muted-foreground); font-size: var(--text-small); overflow-wrap: anywhere; }
.policy-readonly { list-style: none; padding: 0; margin: 8px 0; max-width: 64ch; }
.policy-readonly li { margin: 6px 0; }
.policy-readonly .field-help { display: block; color: var(--muted-foreground); font-size: var(--text-small); }
.promote-blockers { margin: 4px 0 8px; padding-left: 1.2em; font-size: var(--text-small); max-width: 64ch; }
.promote-blockers .blocker-next { color: var(--muted-foreground); }
.policy-explainer { margin: 8px 0 12px; max-width: 72ch; }
.policy-explainer .md { overflow-x: auto; }
.policy-guide { margin: 8px 0 12px; }
.policy-guide .guide-kinds { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.policy-guide .guide-says, .policy-guide .guide-signal { max-width: 64ch; }
@media (max-width: 600px) { .settings .editor-field .field-help { grid-column: 1; } }

/* Shared Copy / Download manifest action row (policy-editor.ts fileActions). */
.file-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.file-actions button, .file-actions a.download {
  display: inline-flex; align-items: center; min-height: var(--hit); box-sizing: border-box;
  padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--card); color: var(--link); font-size: var(--text-small); font-weight: 500; text-decoration: none;
  transition-property: box-shadow, background-color, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.file-actions a.download:hover { box-shadow: var(--shadow-border-hover); text-decoration: underline; }
.file-actions a.download:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .file-actions a.download:active { scale: .96; }
}
/* Upkeep routines (/routines and /routines/<owner>/<name>/<routine>). */
.routines-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0; }
.routines-filters input[type="search"] {
  min-height: var(--hit); min-width: 0; flex: 1 1 200px; max-width: 320px; box-sizing: border-box;
  padding: 6px 10px; font: inherit; font-size: var(--text-small);
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--card); color: var(--foreground);
}
.routines-filters select {
  min-height: var(--hit); padding: 6px 10px; font: inherit; font-size: var(--text-small);
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--card); color: var(--foreground);
}
.routines-filter-count { font-size: var(--text-small); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.routines-filters select:focus-visible, .routines-filters input:focus-visible, .routine-actions select:focus-visible, .routine-back:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
.routine-breadcrumb {
  display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-bottom: 8px;
  font-size: var(--text-small); color: var(--muted-foreground);
}
.routine-breadcrumb a { display: inline-flex; align-items: center; min-height: var(--hit); color: var(--link); text-decoration: none; }
.routine-breadcrumb a:hover { text-decoration: underline; }
.routine-breadcrumb-sep { color: var(--muted-foreground); }
.routines-empty-card {
  display: grid; gap: 8px; max-width: 64ch; padding: var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card);
}
.routines-empty-card p { margin: 0; color: var(--muted-foreground); }
.routines-list { display: grid; gap: 12px; margin-bottom: 24px; }
.routines-empty { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--muted-foreground); margin: 8px 0; }
.routines-empty button { min-height: var(--hit); }
.routine-card {
  position: relative; display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); background: var(--card); color: var(--card-foreground);
}
.routine-card[data-attention="paused"]::before, .routine-card[data-attention="breaker"]::before {
  content: ""; position: absolute; left: -1px; top: var(--radius-md); bottom: var(--radius-md); width: 3px;
  border-radius: 0 3px 3px 0; pointer-events: none;
}
.routine-card[data-attention="paused"]::before { background: var(--warning-border); }
.routine-card[data-attention="breaker"]::before { background: var(--destructive); }
.routine-card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.routine-title-wrap { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; min-width: 0; }
.settings .routine-title-heading { margin: 0; font-size: var(--text-heading); line-height: var(--leading-heading); }
.routine-title {
  font-family: var(--font-display); font-size: var(--text-heading); line-height: var(--leading-heading);
  font-weight: 700; color: var(--link); text-decoration: none;
}
.routine-title:hover { text-decoration: underline; }
.routine-title:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-control); }
.routine-repo { color: var(--muted-foreground); font-size: var(--text-small); }
.routine-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.routine-state, .routine-breaker, .routine-outcome, .prompt-changed-note {
  padding: 2px 10px; border-radius: var(--radius-pill); font-size: var(--text-small); border: 1px solid var(--border); color: var(--muted-foreground);
}
.routine-state[data-state="active"], .routine-outcome[data-outcome="accepted"], .routine-outcome[data-outcome="merged_human"] {
  border-color: var(--success); color: var(--success-text);
}
.routine-breaker[data-breaker="ok"] {
  border-color: var(--border); color: var(--muted-foreground);
}
.routine-state[data-state="paused"], .routine-state[data-state="half_open"], .routine-breaker[data-breaker="half_open"], .routine-outcome[data-outcome="closed"] {
  border-color: var(--warning-border); color: var(--warning-foreground); background: color-mix(in srgb, var(--warning) 12%, var(--card));
}
.routine-breaker[data-breaker="paused"], .routine-breaker[data-breaker="tripped"], .routine-outcome[data-outcome="failed"], .routine-outcome[data-outcome="stopped"], .routine-outcome[data-outcome="rejected"], .routine-outcome[data-outcome="reverted"], .routine-outcome[data-outcome="Escalated"], .routine-outcome[data-outcome="escalated"] {
  border-color: var(--destructive); color: var(--destructive-text);
}
.routine-paused-reason { font-size: var(--text-small); color: var(--warning-foreground); }
.routine-desc { margin: 0; color: var(--card-foreground); max-width: 72ch; }
.routine-spark-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; list-style: none;
  margin: 0 0 10px; padding: 0; font-size: var(--text-small); color: var(--muted-foreground);
}
.routine-spark-legend li { display: inline-flex; gap: 6px; align-items: center; }
.routine-spark-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.routine-spark-label {
  font-family: var(--font-mono); font-size: var(--text-eyebrow); line-height: var(--leading-eyebrow);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground);
}
.routine-sparkline { display: inline-flex; gap: 4px; list-style: none; margin: 0; padding: 0; align-items: center; }
.routine-spark-summary { font-size: var(--text-small); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.spark-day {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--input); background: var(--muted);
}
.spark-day[data-outcome="merged"] { background: var(--success); border-color: var(--success); }
.spark-day[data-outcome="closed"] { background: var(--warning); border-color: var(--warning-border); }
.spark-day[data-outcome="escalated"] { background: var(--destructive); border-color: var(--destructive); }
.spark-day[data-outcome="no-op"] { background: var(--surface-raised); border-color: var(--input); }
.routine-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px;
  margin: 0; padding: 8px 12px; border-radius: var(--radius-control); background: var(--surface-raised);
}
.routine-metric { display: grid; gap: 2px; }
.routine-metric dt {
  font-family: var(--font-mono); font-size: var(--text-eyebrow); line-height: var(--leading-eyebrow);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground);
}
.routine-metric dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }
.routine-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.routine-actions select, .routine-actions button { min-height: var(--hit); }
.routine-actions select {
  padding: 6px 10px; font: inherit; font-size: var(--text-small);
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--card); color: var(--foreground);
}
.routine-inline-confirm {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-raised);
  font-size: var(--text-small);
}
.routine-inline-confirm input {
  flex: 1 1 14em; min-width: 0; min-height: var(--hit); padding: 6px 10px;
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--card); color: var(--foreground);
}
.routine-inline-confirm button { min-height: var(--hit); }
.routine-declarative-note { font-size: var(--text-small); color: var(--muted-foreground); }
.routine-edit-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: var(--hit);
  margin-left: auto; font-size: var(--text-small); color: var(--link);
}
.routine-notice { margin: 8px 0 12px; font-size: var(--text-small); }
.routine-notice:empty { display: none; }
.routine-notice[data-tone="bad"] { color: var(--destructive-text); }
.routine-notice[data-tone="ok"] { color: var(--success-text); }
.routine-fetch-error { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.routine-fetch-error .notice { margin: 0; }
.routine-fetch-error button { min-height: var(--hit); }
.routine-back { display: inline-flex; align-items: center; min-height: var(--hit); margin-bottom: 8px; color: var(--link); text-decoration: none; }
.routine-back:hover { text-decoration: underline; }
.settings .routine-detail-title { margin: 0; font-size: var(--text-heading); line-height: var(--leading-heading); }
.routine-detail-facts {
  display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--text-small);
  color: var(--muted-foreground); font-variant-numeric: tabular-nums;
}
.routine-prompt > summary, .routine-consumers > summary, .routine-breaker-details > summary,
.routine-spec-details > summary, .routine-advanced-details > summary {
  position: relative; width: fit-content; padding-block: 4px; cursor: pointer;
  color: var(--muted-foreground); font-size: var(--text-small);
  transition-property: color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.routine-prompt > summary::after, .routine-consumers > summary::after, .routine-breaker-details > summary::after,
.routine-spec-details > summary::after, .routine-advanced-details > summary::after {
  content: ""; position: absolute; inset: min(0px, (100% - var(--hit)) / 2) -6px;
}
.routine-prompt > summary:hover, .routine-consumers > summary:hover, .routine-breaker-details > summary:hover,
.routine-spec-details > summary:hover, .routine-advanced-details > summary:hover {
  color: var(--foreground);
}
.routine-prompt-text { margin: 8px 0 0; padding: 10px 12px; background: var(--muted); border-radius: var(--radius-control); white-space: pre-wrap; overflow-wrap: anywhere; }
.routine-runs-list, .routine-skips-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; }
.routine-run-row, .routine-skip-row {
  display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-row); background: var(--card);
}
.routine-run-head, .routine-skip-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.routine-run-name { font-family: var(--font-mono); font-size: var(--text-small); font-weight: 500; }
.routine-run-reason, .routine-skip-slot, .routine-skip-desc { font-size: var(--text-small); color: var(--muted-foreground); margin: 0; }
.routine-run-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 12px; margin: 0;
}
.routine-run-meta-item { display: grid; gap: 2px; }
.routine-run-meta-item dt {
  font-family: var(--font-mono); font-size: var(--text-eyebrow); line-height: var(--leading-eyebrow);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground);
}
.routine-run-meta-item dd { margin: 0; font-size: var(--text-small); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.routine-prompt-cell { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prompt-sha-badge { font-family: var(--font-mono); font-size: var(--text-small); padding: 1px 6px; border-radius: var(--radius-control); background: var(--surface-raised); }
.prompt-sha-badge[data-prompt-changed="true"] { border: 1px solid var(--warning-border); color: var(--warning-foreground); }
.prompt-changed-note { border-color: var(--warning-border); color: var(--warning-foreground); background: color-mix(in srgb, var(--warning) 12%, var(--card)); }

/* Routine catalog (/routines/catalog). */
.routines-toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0; }
.routine-catalog-cta, .routine-catalog-enable {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); box-sizing: border-box; padding: 6px 14px;
  border-radius: var(--radius-control); border: 1px solid var(--primary); background: var(--primary);
  color: var(--primary-foreground); font-size: var(--text-small); font-weight: 700; text-decoration: none;
  transition-property: box-shadow, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.routine-catalog-cta:hover, .routine-catalog-enable:hover { box-shadow: var(--shadow-border-hover); text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) {
  .routine-catalog-cta:active, .routine-catalog-enable:active { scale: .96; }
}
.routine-catalog-enable[data-readonly="true"] {
  background: var(--card); color: var(--link); border-color: var(--border); font-weight: 500;
}
.routine-catalog-cta:focus-visible, .routine-catalog-enable:focus-visible, .routine-catalog-picker select:focus-visible, .routine-catalog-search:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
.routine-catalog-controls {
  display: grid; gap: 10px; margin: 12px 0 16px; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card);
}
.routine-catalog-picker { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.routine-catalog-picker select, .routine-catalog-search {
  min-height: var(--hit); padding: 6px 10px; font: inherit; font-size: var(--text-small);
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--background); color: var(--foreground);
}
.routine-catalog-search { min-width: 0; flex: 1 1 200px; max-width: 320px; box-sizing: border-box; }
.routine-catalog-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.routine-catalog-repo-status { margin: 0; font-size: var(--text-small); color: var(--muted-foreground); }
.routine-catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; margin-bottom: 24px; }
.settings .routine-catalog-title { margin: 0; font-size: var(--text-heading); line-height: var(--leading-heading); }
.routine-catalog-badge, .routine-fact-badge, .routine-bound-badge {
  padding: 2px 10px; border-radius: var(--radius-pill); font-size: var(--text-small);
  border: 1px solid var(--border); color: var(--muted-foreground);
}
.routine-catalog-badge[data-catalog="true"] { border-color: var(--primary); color: var(--link); }
.routine-bound-badge { border-color: var(--success); color: var(--success-text); }
.routine-catalog-specs { display: grid; gap: 4px; font-size: var(--text-small); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.routine-catalog-spec-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.routine-spec-label { font-weight: 500; color: var(--card-foreground); }
.routine-requires-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.routine-req-chip {
  font-family: var(--font-mono); font-size: var(--text-small); padding: 1px 6px;
  border-radius: var(--radius-control); background: var(--surface-raised); color: var(--card-foreground);
}
.routine-consumers-list { margin: 6px 0 0; padding-left: 18px; font-size: var(--text-small); }

/* Guided routine configurator (/routines/<owner>/<name>/<routine>/edit). */
.routine-configure-link {
  display: inline-flex; align-items: center; min-height: var(--hit); box-sizing: border-box; padding: 6px 12px;
  border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--card);
  color: var(--link); font-size: var(--text-small); font-weight: 500; text-decoration: none;
  transition-property: box-shadow, scale; transition-duration: 150ms; transition-timing-function: ease-out;
}
.routine-configure-link:hover { box-shadow: var(--shadow-border-hover); text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) {
  .routine-configure-link:active { scale: .96; }
}
.routine-configure-link:focus-visible, .routine-github-prompt-link:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}
.routine-editor { display: grid; gap: 16px; margin-bottom: 24px; }
.routine-editor-section {
  display: grid; gap: 10px; margin: 0; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card);
}
.routine-editor-section legend { font-weight: 700; padding: 0 6px; }
.routine-editor .editor-field :is(input, select) {
  min-height: var(--hit); padding: 6px 10px; background: var(--background); color: var(--foreground);
}
.routine-editor .editor-field input[aria-invalid="true"], .routine-prompt-pane textarea[aria-invalid="true"] {
  border-color: var(--destructive);
}
.routine-mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; }
.routine-mode-card {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; min-height: var(--hit);
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--background); cursor: pointer;
  transition-property: border-color, background-color; transition-duration: 150ms; transition-timing-function: ease-out;
}
.routine-mode-card:hover { border-color: var(--primary); }
.routine-mode-card:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.routine-mode-card:has(input:checked) { border-color: var(--primary); background: var(--surface-raised); }
.routine-mode-card-text { display: grid; gap: 2px; font-size: var(--text-small); }
.routine-mode-card-desc { color: var(--muted-foreground); }
.routine-editor-check { display: inline-flex; gap: 8px; align-items: center; min-height: var(--hit); font-size: var(--text-small); cursor: pointer; }
.routine-editor-grid { display: grid; gap: 8px; }
.routine-editor-hint { margin: 0; font-size: var(--text-small); color: var(--muted-foreground); }
.cron-preview-box { padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-raised); display: grid; gap: 6px; }
.cron-preview-box p { margin: 0; }
.cron-preview-error { color: var(--destructive-text); font-size: var(--text-small); }
.cron-next-runs { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--text-small); font-variant-numeric: tabular-nums; }
.cron-next-runs li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.cron-run-utc { font-family: var(--font-mono); color: var(--muted-foreground); }
.routine-egress-group { display: grid; gap: 6px; }
.routine-egress-options { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.routine-spec-list { margin: 6px 0 0; padding-left: 18px; font-size: var(--text-small); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.routine-prompt-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.routine-prompt-pane { display: grid; gap: 6px; align-content: start; min-width: 0; }
.routine-prompt-pane-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.routine-prompt-pane-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.routine-prompt-pane-actions button { min-height: var(--hit); font-size: var(--text-small); }
.routine-github-prompt-link { display: inline-flex; align-items: center; gap: 4px; min-height: var(--hit); font-size: var(--text-small); color: var(--link); }
.routine-prompt-pane textarea {
  box-sizing: border-box; font-family: var(--font-mono); font-size: var(--text-small); padding: 8px 10px;
  border: 1px solid var(--input); border-radius: var(--radius-control); background: var(--background); color: var(--foreground);
}
.routine-prompt-status { margin: 0; font-size: var(--text-small); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.routine-prompt-status[data-valid="true"] { color: var(--success-text); }
.routine-prompt-status[data-valid="false"] { color: var(--destructive-text); }
.routine-editor-actions button { min-height: var(--hit); }
.routine-preview-output { display: grid; gap: 10px; }
.preview-prompt-error { margin: 0; font-size: var(--text-small); color: var(--destructive-text); }
.preview-prompt-ok { margin: 0; font-size: var(--text-small); color: var(--success-text); }
.routine-yaml-preview {
  margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface-raised); font-size: var(--text-small); overflow-x: auto;
}
