/* "Cab and strips" (DESIGN.md). Every colour is a token declared here: light in :root, dark in the two dark blocks
   below (the viewer's choice, or the system's when they chose System). Rules use var(--…) only. The product design
   system replaces these values once it is exported to design/. */
:root {
  color-scheme: light;
  --band: #4A6B00;
  --band-raised: #3D5900;
  --band-line: #6A8A2E;
  --band-text: #F3F7EA;
  --band-muted: #E1EACF;
  --band-link: #E3F3B5;
  --band-strong: #FFFFFF;
  --ground: #ECEEE7;
  --surface: #FFFFFF;
  --subtle: #F5F6F1;
  --line: #DADED2;
  --line-strong: #C6CBBC;
  --ink: #1B2016;
  --muted: #596150;
  --accent: #557A00;
  --accent-hover: #405C00;
  --accent-tint: #EEF4DF;
  --on-accent: #FFFFFF;
  --link: #4E7000;
  --info: #0B5FAA;
  --info-tint: #E8F1FB;
  --scrim: #1B2016E6;
  --on-scrim: #FFFFFF;
  --pass: #1E7B4F;
  --pass-tint: #E6F4EC;
  --exception: #9A5200;
  --exception-tint: #FDF1E2;
  --blocked: #B3261E;
  --blocked-tint: #FCEBEA;
  --neutral: #596150;
  --neutral-tint: #EEF0E8;
  --person-edge: #E8CFA8;
  --selection: #DCEAB8;
  --shadow-pop: rgba(26, 34, 19, 0.12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --target: 44px;

  --font-display: "Barlow Semi Condensed", "IBM Plex Sans", sans-serif;
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --band: #253309;
    --band-raised: #1C2807;
    --band-line: #3E5218;
    --ground: #121510;
    --surface: #1A1E16;
    --subtle: #21261C;
    --line: #2E3427;
    --line-strong: #3E4635;
    --ink: #E8ECE2;
    --muted: #A4AC98;
    --accent: #A6CE52;
    --accent-hover: #C0E07E;
    --accent-tint: #273219;
    --on-accent: #121A05;
    --link: #A6CE52;
    --info: #6AAEF2;
    --info-tint: #16304C;
    --scrim: #000000E6;
    --pass: #5CC98F;
    --pass-tint: #15301F;
    --exception: #F0B35A;
    --exception-tint: #35270F;
    --blocked: #FF8A80;
    --blocked-tint: #3A1A19;
    --neutral: #A8B09C;
    --neutral-tint: #282E21;
    --person-edge: #5A4420;
    --selection: #3A4A20;
    --shadow-pop: rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --band: #253309;
  --band-raised: #1C2807;
  --band-line: #3E5218;
  --ground: #121510;
  --surface: #1A1E16;
  --subtle: #21261C;
  --line: #2E3427;
  --line-strong: #3E4635;
  --ink: #E8ECE2;
  --muted: #A4AC98;
  --accent: #A6CE52;
  --accent-hover: #C0E07E;
  --accent-tint: #273219;
  --on-accent: #121A05;
  --link: #A6CE52;
  --info: #6AAEF2;
  --info-tint: #16304C;
  --scrim: #000000E6;
  --pass: #5CC98F;
  --pass-tint: #15301F;
  --exception: #F0B35A;
  --exception-tint: #35270F;
  --blocked: #FF8A80;
  --blocked-tint: #3A1A19;
  --neutral: #A8B09C;
  --neutral-tint: #282E21;
  --person-edge: #5A4420;
  --selection: #3A4A20;
  --shadow-pop: rgba(0, 0, 0, 0.45);
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("fonts/barlow-semi-condensed-600-latin.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

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

html { background: var(--ground); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { margin: 0; font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; }
h2 { margin: 0 0 var(--space-2); font-size: 15px; font-weight: 600; }
h3 { margin: var(--space-4) 0 var(--space-2); font-size: 14px; font-weight: 600; }
p { margin: 0 0 var(--space-3); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--selection); }
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: background-color 0.12s ease-out, color 0.12s ease-out, border-color 0.12s ease-out; }
}

.mono { font-family: var(--font-mono); font-size: 13px; }
.id { font-size: 20px; font-weight: 500; }
h1 .id { margin-right: var(--space-2); }
.meta { font-size: 13px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.label { font-size: 13px; color: var(--muted); }
.sr { position: absolute; left: -9999px; }

/* Status is always a word, never colour alone (decision 9). */
.status-pass { color: var(--pass); font-weight: 600; }
.status-exception { color: var(--exception); font-weight: 600; }
.status-blocked { color: var(--blocked); font-weight: 600; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--space-2); top: var(--space-2); background: var(--surface); color: var(--ink); padding: var(--space-2); z-index: 10; }

/* The band: wordmark, the five places as folder tabs and the View as role switch, search, viewer, theme. The current tab joins the page
   header. Controls on the band take a focus ring in band-link, which shows on the band in both themes (accent does not); the role pop-up,
   on surface, keeps accent. A viewer that wraps to a second row stays at the right. */
.top {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 var(--space-5);
  min-height: 52px; padding: 0 var(--space-6); background: var(--band); color: var(--band-text);
}
.brand { align-self: center; padding-right: var(--space-2); font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: 0.01em; }
.brand a, .brand a:hover { display: inline-flex; align-items: center; gap: 8px; color: var(--band-strong); text-decoration: none; }
.tower { flex: none; stroke: currentColor; }
.tower .lamp { fill: var(--band-link); fill-opacity: 0.55; }
.tower .beam { stroke: var(--band-link); }
.top :focus-visible { outline-color: var(--band-link); }
.nav a:focus-visible { outline-offset: -3px; } /* inside the tab: .nav scrolls, so a ring outside it is clipped */
.nav a[aria-current="page"]:focus-visible { outline-color: var(--accent); } /* the current tab is surface, like the pop-up */
.places { display: flex; align-items: flex-end; gap: 0 var(--space-2); min-width: 0; }
.nav { display: flex; gap: 2px; overflow-x: auto; }
.nav a {
  display: flex; align-items: center; height: 42px; padding: 0 18px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  color: var(--band-text); font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--band-raised); color: var(--band-text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; }
.nav .count { margin-left: 7px; padding: 0 7px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; line-height: 18px; }
.top-spacer { flex: 1 1 0; }
.jump {
  align-self: center; display: flex; align-items: center; gap: var(--space-2); flex: 1 1 160px; min-width: 0; max-width: 240px; height: 34px;
  padding: 0 10px; border: 1px solid var(--band-line); border-radius: var(--r-md); background: var(--band-raised);
}
.jump:focus-within { border-color: var(--band-link); }
.jump svg { flex: none; stroke: var(--band-muted); }
.jump input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--band-text); font: 13px var(--font-sans); outline: none; }
.jump input::placeholder { color: var(--band-muted); }
.viewer { align-self: center; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; padding: 6px 0; font-size: 12px; line-height: 1.35; color: var(--band-muted); }
.viewer .mono { font-family: var(--font-mono); font-size: 13px; color: var(--band-text); }
.viewer a, .viewer button.link { color: var(--band-link); }
.viewer .links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0 var(--space-2); }
.viewer .links a, .viewer button.link, .theme button { display: inline-flex; align-items: center; min-height: 24px; }
.theme { display: inline-flex; gap: 2px; margin: 0; }
.theme button {
  border: 0; padding: 0 4px; background: none; color: var(--band-muted); font: 12px var(--font-sans); cursor: pointer;
}
.theme button:hover { color: var(--band-text); }
.theme button[aria-pressed="true"] { color: var(--band-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Page header (white band under the current tab) and body */
.page-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 18px var(--space-8) 0; }
.page-head.plain { padding-bottom: var(--space-4); }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-3) var(--space-6); }
.page-head .meta { margin: 2px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.views { display: flex; gap: var(--space-6); margin-top: var(--space-3); overflow-x: auto; }
.views a {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 0 10px; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.views a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--line-strong); }
.views a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.pill { padding: 0 6px; border-radius: 9px; background: var(--neutral-tint); color: var(--muted); font-size: 12px; font-weight: 500; }
.page-body { display: flex; flex-direction: column; gap: var(--space-4); max-width: 1440px; padding: var(--space-5) var(--space-8) 48px; }

.split { display: flex; flex-wrap: wrap; align-items: stretch; }

/* Panels */
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-2); padding: 14px var(--space-4) 10px; }
.panel-head h2 { margin: 0; }
.panel-body { padding: 0 var(--space-4) var(--space-4); }
.panel > p, .panel > .table-scroll + p, .panel > ul.budgets { margin-left: var(--space-4); margin-right: var(--space-4); }
.row2 { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
.row2 > .wide-col { flex: 999 1 640px; min-width: 0; }
.row2 > .side-col { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }

/* Departure board */
.departures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.departures a { display: block; padding: 14px var(--space-5) var(--space-4); border-left: 1px solid var(--line); color: var(--ink); }
.departures a:first-child { border-left: 0; }
.departures a:hover { background: var(--subtle); text-decoration: none; color: var(--ink); }
.departures .big { font-family: var(--font-display); font-size: 40px; line-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
.departures .what { display: flex; align-items: center; height: 21px; font-weight: 500; }
.departures .why { font-size: 13px; color: var(--muted); }
/* The Settings page's three groups (docs/designs/settings-groups.md): three segments, and the group chip, outlined because a
   group is not a status (DESIGN.md: status hues only on status); Critical in bold. Waiting uses .flag.warn, the person tone. */
.departures.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.prio { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.prio.critical { border-color: var(--ink); font-weight: 700; }
.prio.other { border-color: var(--line); color: var(--muted); }
#group-other summary { cursor: pointer; list-style-position: inside; }
#group-other summary h2 { display: inline; }

/* Badges, flags, holder tabs */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 0 7px; border-radius: var(--r-sm);
  background: var(--neutral-tint); color: var(--neutral); font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Work in progress is blue, never the brand olive, so green never reads as done. */
.badge.active { background: var(--info-tint); color: var(--info); }
.badge.warn { background: var(--exception-tint); color: var(--exception); }
.badge.err { background: var(--blocked-tint); color: var(--blocked); }
.badge.ok { background: var(--pass-tint); color: var(--pass); }
.flag {
  display: inline-block; margin: 0 var(--space-1) var(--space-1) 0; padding: 0 6px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); color: var(--ink); font-size: 12px; line-height: 20px; white-space: normal;
}
.holder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 58px; height: 32px;
  border-radius: var(--r-sm); background: var(--neutral-tint); color: var(--neutral); font-size: 12px; line-height: 14px; font-weight: 500;
}
.holder.person { background: var(--exception-tint); color: var(--exception); }
.holder b { font-weight: 700; color: var(--ink); }
.legend { display: inline-block; width: 10px; height: 10px; border: 1px solid var(--person-edge); border-radius: 2px; background: var(--exception-tint); vertical-align: -1px; }

/* A flag action: a next step beside a flag, flag-sized so a row stays one line, but never under 24px (44px on phones). */
button.flag-action { min-height: 24px; background: var(--surface); font: 500 12px var(--font-sans); cursor: pointer; }
button.flag-action:hover { background: var(--subtle); border-color: var(--muted); }
@media (max-width: 767px) { button.flag-action { min-height: 44px; padding: 0 12px; } }

/* Buttons */
.button {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 500 14px var(--font-sans); text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--subtle); border-color: var(--muted); color: var(--ink); text-decoration: none; }
.button.primary, .button.primary:visited { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button.danger { color: var(--blocked); }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }
/* A clicked button while its request is on its way (forms.js; portal-speed.md, 3.4): it keeps its colour and reads "Saving…"; the form's
   other buttons look disabled. aria-disabled, not disabled, so the clicked button's value is still sent. Nothing spins. */
[aria-disabled="true"]:is(button, input[type="submit"]):not([data-busy-clicked]) { opacity: 0.5; cursor: not-allowed; }
[aria-disabled="true"][data-busy-clicked] { cursor: progress; }
.button[aria-disabled="true"]:hover { background: var(--surface); border-color: var(--line-strong); }
.button.primary[aria-disabled="true"]:hover { background: var(--accent); border-color: var(--accent); }
button.link { padding: 0; border: 0; background: none; color: var(--link); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; }

/* Tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
caption { padding: 0 var(--space-4) var(--space-2); text-align: left; }
th {
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); color: var(--muted);
  font-size: 12px; font-weight: 500; text-align: left; white-space: nowrap;
}
td { padding: 9px var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { padding-left: var(--space-4); }
th:last-child, td:last-child { padding-right: var(--space-4); }
tbody tr:hover td { background: var(--subtle); }
table.board td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
table.board td.holder-cell { width: 1%; padding-right: 0; }
.board .band th { padding: 6px var(--space-4); background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; }
table.compact { min-width: 0; }
/* A code-like value in a cell (an image digest, a path, a setting's name) wraps anywhere, so one long unbroken value never sets its
   column's width and pushes the columns after it out of view. A cell that must stay on one line says nowrap. */
td .mono, td.mono { overflow-wrap: anywhere; }
/* A work order's ID linked in a cell ("WO-IN-12-F Storage charges") stays whole: IDs never wrap (DESIGN.md, Mono). */
td a > .mono { white-space: nowrap; }
/* Settings: the name and value get room of their own, so neither is squeezed to a sliver once code wraps; what it does takes the rest. */
@media (min-width: 768px) {
  table.settings th.setting { width: 24%; }
  table.settings th.value { width: 20%; }
  table.settings th.who { width: 14%; }
}
.right { text-align: right; }

/* Factory (docs/designs/factory-dashboards.md, D1-D15) */
.factory-head { display: flex; flex-wrap: wrap; align-items: baseline; align-content: center; gap: 0 var(--space-1); min-height: 28px; } /* one height on every Factory view, links or none, so the tabs never move */
.factory-head a, .presets summary { display: inline-flex; align-items: center; min-height: 28px; }
.presets summary { color: var(--link); cursor: pointer; }
.presets[open] { flex-basis: 100%; }
.preset-lists { display: flex; flex-wrap: wrap; gap: 0 var(--space-6); padding: var(--space-2) 0; }
.preset-lists ul { margin: 0; padding: 0; list-style: none; }
.past { margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--r-md); background: var(--exception-tint); color: var(--ink); font-weight: 400; }
.past p:first-child { font-weight: 600; }
.past p:last-child { margin-bottom: 0; }
.after-merge { margin: 0; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.factory h3 { margin: var(--space-4) var(--space-4) var(--space-2); }
.held-for > span { display: block; }
.held { white-space: nowrap; }
/* Time on people (amber, as the person tab) against time on machines, under Held for; the words are its title. */
.hold-split { position: relative; width: 64px; height: 4px; margin: 5px 0 0 auto; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.hold-split > span { display: block; height: 100%; background: var(--exception); }
/* Desktop board: fixed columns so the work order takes the free width and titles stay on one line where they can. */
@media (min-width: 768px) {
  table.board { table-layout: fixed; }
  .board .c-holder { width: 74px; }
  .board .c-state { width: 136px; }
  .board .c-by { width: 15%; }
  .board .c-for { width: 108px; }
  .board .c-flag { width: 18%; }
  /* One line per row: a long title or holder ends in an ellipsis, the whole of it in the cell's title. */
  .board td.line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* Lists of work orders: 30 to a page, rows a little tighter than other tables. */
table.list td { padding-top: 6px; padding-bottom: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin: 0; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.pager .links { display: flex; gap: var(--space-4); }
.sessions { margin: 0 var(--space-4) var(--space-3); padding: 0; list-style: none; }
.sessions li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px 0; border-top: 1px solid var(--line); }
.sessions li:first-child { border-top: 0; padding-top: 0; }
.sessions .what { min-width: 0; }
.budgets { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.budgets li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.budgets li:first-child { border-top: 0; padding-top: 0; }
.bar { position: relative; display: block; height: 6px; margin-top: 6px; background: var(--neutral-tint); border-radius: 3px; }
.bar-fill { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.bar.warn .bar-fill { background: var(--exception); }
.bar::before, .bar::after { content: ""; position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.bar::before { left: 50%; }
.bar::after { left: 80%; }

/* Factory line: the stages a change moves through, each a column of strips (DESIGN.md) */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stage { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; padding: var(--space-3); border-left: 1px solid var(--line); }
.stage:first-child { border-left: 0; }
.stage h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 var(--space-1); font-size: 13px; font-weight: 600; }
.stage-count { font-family: var(--font-display); font-size: 24px; line-height: 1; }
.strips { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.strip { display: flex; gap: 10px; padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); }
a.strip:hover { border-color: var(--line-strong); background: var(--subtle); color: var(--ink); text-decoration: none; }
.strip .holder { flex: none; }
.stage .empty { margin: 0; padding: var(--space-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--muted); font-size: 13px; }
/* The request line (docs/designs/factory-line.md): one strip per request in its phase's column. A request strip is the
   ordinary strip laid out as a column; the track is one 4px segment per step, done in muted, the current one blue for a
   machine or the holder tab's amber for a person, later ones in line. The words carry it all; the track is aria-hidden. */
.phase h2 { margin-bottom: 0; }
.phase .stages-of { margin: 0 0 var(--space-1); color: var(--muted); font-size: 12px; line-height: 1.35; }
.strip.request { flex-direction: column; gap: 4px; line-height: 1.3; }
.request-top { display: flex; align-items: center; gap: var(--space-2); }
.request-top .holder { flex: none; }
.request-id { display: flex; flex-direction: column; min-width: 0; }
.request-id .mono { font-weight: 500; color: var(--ink); }
.request-id .meta { text-wrap: pretty; } /* "path set at GT · step 2" never leaves the number alone on a line */
.request-title { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.request-step { font-size: 13px; }
.request-step b { font-weight: 600; }
.request-state { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 13px; color: var(--muted); }
.request-state .who { font-family: var(--font-mono); font-size: 12px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip.request .flag { align-self: flex-start; margin: 0; }
.track { display: flex; gap: 2px; height: 4px; margin-top: 2px; }
.track i { flex: 1; border-radius: 1px; background: var(--line); }
.track i.d { background: var(--muted); }
.track i.n { background: var(--info); }
.track i.p { background: var(--exception); }
.finished { margin: 0; }
.finished .sep { color: var(--line-strong); }
.other td .mono { white-space: nowrap; }
@media (max-width: 1279px) {
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage:nth-child(4) { border-left: 0; }
  .stage:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 767px) {
  .stages { grid-template-columns: minmax(0, 1fr); }
  .stage { border-left: 0; }
  .stage + .stage { border-top: 1px solid var(--line); }
}

/* Inbox: the queue and the selected decision, as two panels */
h1, h2, .page-title { text-wrap: balance; }
.page-title { margin: 0; font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; }
.narrow-panel { max-width: 760px; }
.empty-state h1 { font-family: var(--font-sans); font-size: 18px; line-height: 26px; margin-bottom: var(--space-2); }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); max-width: 1440px; padding: var(--space-5) var(--space-8) 48px; }
.inbox { flex: 1 1 300px; max-width: 340px; min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.inbox-head { padding: 14px var(--space-4) 10px; border-bottom: 1px solid var(--line); }
.inbox-head h2 { margin: 0; }
.rows { margin: 0; padding: 0; list-style: none; }
.rows li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; flex-direction: column; gap: 2px; min-height: var(--target); padding: var(--space-3) var(--space-4); color: var(--ink); text-decoration: none; }
.row-link:hover { background: var(--subtle); color: var(--ink); text-decoration: none; }
.row-link.selected { background: var(--accent-tint); }
.row-kind { align-self: flex-start; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 12px; font-weight: 600; line-height: 20px; }
/* Decided by you, still open (docs/designs/roster-and-close.md, section 3): below the open list, muted text, never opacity. */
.rows-group { margin: 0; padding: var(--space-3) var(--space-4) 6px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.rows.decided .row-title { color: var(--muted); }
.row-link .mine { color: var(--ink); }
.rows.decided .row-link .mine { color: var(--muted); }
.row-title { line-height: 1.35; }
.detail { flex: 999 1 560px; min-width: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.detail > * { margin-left: var(--space-5); margin-right: var(--space-5); }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2) 32px; margin: 0; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.detail-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.detail-head h1 { font-size: 24px; line-height: 30px; }
.due { color: var(--ink); font-weight: 600; }
.block { margin: 0; padding: 14px var(--space-5); border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block-note { padding-top: var(--space-3); color: var(--exception); font-weight: 500; }
.block-note.ok { color: var(--pass); } /* your own approval: the approved green (docs/designs/card-audit-fixes.md, S10); a send-back or a real notice stays amber */
.label { font-size: 13px; color: var(--muted); }
h2.label { font-weight: 600; }

/* A record card (gate card, work order, submission): one panel of hairline sections. The gate card pins its decision. */
.card > section, .card > p, .card > dl { margin: 0; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); }
/* The G2 and G3 cards hold their sections in one form (AnalystBody.razor): the same rhythm. */
.card > form > section, .card > form > details.context, .card > .card-record > section, .card > .card-record > details.context { margin: 0; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); }
.card > :first-child { border-top: 0; }
/* A finished card's recorded answer (FinishedCard.razor): a person's words, so a long path or link wraps instead of widening the card. */
.recorded-line { overflow-wrap: anywhere; }
.card ul { margin: 0; padding-left: var(--space-5); }
.card details { margin-top: var(--space-2); }
.card summary { cursor: pointer; padding: var(--space-1) 0; }
.gate .card .decision {
  position: sticky; bottom: 0; z-index: 1; background: var(--subtle); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.gate .card .decision:not(:has(form)) { position: static; }
.gate .card .decision:has(.send-back-fold[open]) { position: static; } /* G7's fold (S6): the reason and the tag are taller than the band should be */
.card .decision label { display: block; font-size: 13px; font-weight: 600; }
.card .decision textarea { min-height: 0; height: 64px; resize: vertical; }
.card .decision-bar .button { min-height: 38px; }
pre.patch span { display: block; padding: 0 var(--space-3); white-space: pre; }
pre.patch .add { background: var(--pass-tint); }
pre.patch .del { background: var(--blocked-tint); }
pre.patch .hunk { color: var(--muted); }
pre.patch.wrap span { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.patch span:empty::before { content: " "; } /* a blank line of code keeps its height */

/* Work orders */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-4) var(--space-6); margin: 0; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
section { padding-top: var(--space-4); }
.panel, .panel section { padding-top: 0; }

/* Notices: tinted box, the word first; never a coloured edge */
.notice { padding: 10px var(--space-3); border-radius: var(--r-md); background: var(--subtle); border: 1px solid var(--line); }
/* Notice tones (DESIGN.md): the status word first, bold. */
.notice.run { background: var(--info-tint); border-color: transparent; }
/* Working: the waiting page while a preview starts, opens or stops. It turns only when motion is welcome; otherwise it is a still ring. */
.working { display: inline-block; width: 12px; height: 12px; margin-right: var(--space-2); vertical-align: -1px; border: 2px solid var(--info); border-right-color: transparent; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .working { animation: working 1s linear infinite; }
}
@media (forced-colors: active) { .working { border-right-color: Canvas; } }
@keyframes working { to { transform: rotate(360deg); } }
.notice.ok { background: var(--pass-tint); border-color: transparent; }
.notice.warn { background: var(--exception-tint); border-color: transparent; }
.notice.err { background: var(--blocked-tint); border-color: transparent; }
pre.patch { overflow: auto; max-height: 40rem; margin: var(--space-2) 0 0; padding: var(--space-2) 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--subtle); font: 12.5px/1.65 var(--font-mono); white-space: normal; }
.decision textarea { display: block; width: 100%; max-width: 48rem; margin: var(--space-1) 0 var(--space-2); padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.decision-bar { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.phone-only { display: none; }

/* Filters (DESIGN.md, Filters): one row above a list, wrapping on narrow screens; GET forms, so a filtered list is a link. */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.filters input.filter-text, .filters input[type="date"], .filters select {
  min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 14px var(--font-sans);
}
.filters input.filter-text { flex: 1 1 14rem; min-width: 0; max-width: 24rem; }
.filters .filter-date { font-size: 14px; color: var(--muted); }
.filters .filter-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.filters .filter-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.filters .filter-summary { margin-left: auto; }
.line-filter { margin-bottom: var(--space-4); }
/* Inside a padded panel body the bar needs no padding of its own. */
.panel-body > .filters { margin-bottom: var(--space-2); padding: 0 0 var(--space-3); }
.line-filter .filters { border-bottom: 0; }

/* Intake: submitter text is shown as written, line breaks kept, never as markup. */
.untrusted { white-space: pre-wrap; overflow-wrap: anywhere; }
.intake label { display: block; margin-top: var(--space-3); font-weight: 600; font-size: 13px; }
.intake input:not([type]), .intake input[type="text"], .intake input[type="date"], .intake select, .intake textarea {
  display: block; width: 100%; max-width: 48rem; min-height: 36px; margin: var(--space-1) 0 var(--space-2); padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit;
}
.intake fieldset { margin: var(--space-4) 0; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--r-md); }

/* Attachments (DESIGN.md, Attachments, Origin chip, Choice chips; docs/designs/gates-attachments.md). A still sits in a
   strip under the field it shows; the tray under it takes a plain file choice, so it works without script. */
.intake fieldset.plain { margin: var(--space-3) 0 0; padding: 0; border: 0; }
.intake fieldset.plain > legend { font-weight: 600; font-size: 13px; }
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); max-width: 48rem; margin: var(--space-1) 0 var(--space-2); }
.intake label.kind { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); font-weight: 400; cursor: pointer; }
.kind input { margin: 3px 0 0; accent-color: var(--accent); }
.kind b { display: block; font-size: 14px; }
.kind span span { font-size: 12px; color: var(--muted); }
.kind:has(:checked) { border-color: var(--accent); background: var(--accent-tint); }
/* Settings edit: suggestions stack one per row, each with its reason and its impact on their own lines. */
.kinds.stack { grid-template-columns: 1fr; }
.kinds.stack .kind span span { display: block; margin-top: 2px; }
/* The kind's own parts only, chosen in CSS (no script); a browser without :has shows them all. */
.intake-form:has(#kind-problem:checked) .for-other, .intake-form:has(#kind-problem:checked) .for-change,
.intake-form:has(#kind-change:checked) .for-problem, .intake-form:has(#kind-idea:checked) .for-problem,
.intake-form:has(#kind-idea:checked) .for-change { display: none; }
.show-us { margin: var(--space-4) 0; padding: var(--space-4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.show-us h2 { margin-bottom: 2px; }
.pair-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.pair-cols > div { min-width: 0; }
/* The intake as reported on the G3, G4 and G7 cards (gate-cards.md, PR2): Actual and Expected side by side from 768px. */
.reported-pair { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.reported-pair > div { min-width: 0; }
.card .ev-strip { padding-left: 0; }
@media (min-width: 768px) {
  .reported-pair { grid-template-columns: 1fr 1fr; }
}
.tray-note { margin: var(--space-3) 0 0; font-size: 12px; color: var(--exception); }
.ev-strip { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-1) 0 var(--space-2); padding: 0; list-style: none; }
.ev { width: 152px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; font-size: 12px; line-height: 1.35; }
.ev .thumb { position: relative; display: flex; align-items: center; justify-content: center; height: 96px; background: var(--subtle); border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; }
.ev .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ev .cap { display: flex; flex-direction: column; gap: 3px; padding: 6px 8px 8px; }
.ev .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 12px; }
.ev .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ev .row button.link { font-size: 12px; min-height: 24px; display: inline-flex; align-items: center; }
.ev.big { width: 220px; }
.ev.big .thumb { height: 140px; }
.ev.refused .cap { background: var(--blocked-tint); color: var(--blocked); }
.ev.refused .thumb { color: var(--blocked); font-weight: 600; }
.ev.removed { border-style: dashed; background: var(--subtle); color: var(--muted); }
.ev.removed .thumb { background: transparent; border-bottom-style: dashed; }
.ev.processing .thumb { color: var(--info); font-weight: 500; }
.tray { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-2); padding: var(--space-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--muted); font-size: 13px; }
.intake .tray label.tray-label, .gate-attachments .tray label.tray-label { flex: 1 0 100%; margin: 0; color: var(--ink); }
.tray input[type="file"] { max-width: 100%; font: inherit; font-size: 13px; }
.tray .hint { flex: 1 1 220px; }
.tray .button { min-height: 30px; font-size: 13px; }
.tray.over { border-color: var(--accent); background: var(--accent-tint); }
/* A clip's length on its thumbnail (DESIGN.md: a `scrim` label); mono, never wraps. */
.dur { position: absolute; right: 4px; bottom: 4px; padding: 0 4px; border-radius: var(--r-sm); background: var(--scrim); color: var(--on-scrim); font-family: var(--font-mono); font-size: 11px; line-height: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Files going up in parts (script only): name, a blue bar, Cancel; a failure keeps its reason on screen. */
ul.uploads { flex: 1 0 100%; display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
ul.uploads li { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; }
ul.uploads .name { flex: 0 1 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-mono); color: var(--ink); }
ul.uploads progress { flex: 1 1 auto; height: 6px; accent-color: var(--info); }
ul.uploads li.refused { color: var(--blocked); }
/* The tick on a gate file its adder can change (mt-stills.md): C20's words, the head in mono, wrapping under the chip. */
.ev .tick { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12px; line-height: 1.35; color: var(--ink); cursor: pointer; }
.ev .tick input { flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.ev .tick .mono { font-size: 12px; }
/* The tray and strip sit inside the MT card's grey Issue block, whose own label and input rules must not reach them. */
.mt-card .issue .gate-attachments label.tray-label { display: block; font-size: 13px; font-weight: 400; }
.mt-card .issue .gate-attachments .tick { display: flex; font-size: 12px; font-weight: 400; }
.mt-card .issue .gate-attachments input { display: inline-block; width: auto; max-width: 100%; margin: 0; padding: 0; border: 0; background: none; }
.mt-card .issue .gate-attachments .tick input { margin: 1px 0 0; }
.mt-card .issue .gate-attachments { margin-top: var(--space-3); }
/* Said wherever stills and clips are added or shown: what agents read. */
.agents-line { margin: var(--space-2) 0; }
/* The clip page: the native player, then the stills it was cut into as checkboxes. */
.clip-page video.player { display: block; width: 100%; max-width: 860px; max-height: 70vh; border-radius: var(--r-md); }
.clip-page form.moment p { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-2) 0; }
ul.stills { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); padding: 0; list-style: none; }
ul.stills li { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
ul.stills li:has(:checked) { border-color: var(--accent); background: var(--accent-tint); }
ul.stills label { display: block; margin: 0; cursor: pointer; }
ul.stills img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--subtle); }
ul.stills .t { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
ul.stills .t input { margin: 0; accent-color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
/* Origin chips (E11): one rule per origin in Factory.Contracts.AttachmentOrigins; Customer and Unchecked are amber. */
.origin { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; color: var(--ink); }
.origin.customer, .origin.unchecked { border-color: transparent; background: var(--exception-tint); color: var(--exception); }
.origin.preview, .origin.old-aims, .origin.design { background: transparent; }
/* The GT card's answers: one fieldset per file, its choices as bordered radio chips. */
fieldset.disp { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3) var(--space-4); align-items: start; margin: 0; padding: var(--space-3) 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
fieldset.disp > legend { float: left; width: 100%; grid-column: 1 / -1; padding: 0; font-weight: 600; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.intake label.choice, .choice { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; margin: 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: 13px; font-weight: 400; cursor: pointer; }
.choice input { margin: 0; accent-color: var(--accent); }
.choice:has(:checked) { border-color: var(--accent); background: var(--accent-tint); font-weight: 600; }
.choice.del:has(:checked) { border-color: var(--blocked); background: var(--blocked-tint); color: var(--blocked); }
.counter { font-weight: 600; color: var(--muted); }
/* Settings batch (docs/designs/settings-groups.md, Batch; DESIGN.md, Settings batch): wider than the intake form so a row is two columns on a
   laptop (what it is, then the choice), grouped under Critical and Important headings, with the send bar kept in view at the bottom. */
.intake.batch-page .form-panel.batch { max-width: 1200px; }
.batch-rows { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.batch-group h3 { margin: var(--space-4) 0 var(--space-1); font-size: 15px; }
.batch-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-1) var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.batch-row p { margin: 0 0 4px; }
.batch-what .name { font-weight: 600; }
.batch-choose .choices { margin-top: 0; }
.intake .choices input.batch-value { display: inline-block; width: 14rem; min-height: 30px; margin: 0; padding: 3px 8px; }
.batch-suggestions { margin: 6px 0 0; }
.batch-own { margin-top: var(--space-1); }
.batch-own summary { cursor: pointer; font-size: 13px; }
.intake input.batch-reason { margin: var(--space-1) 0 0; }
.batch-problem { margin: 6px 0 0; color: var(--blocked); font-weight: 600; font-size: 13px; }
.batch-send { position: sticky; bottom: 0; z-index: 1; align-items: center; margin-top: var(--space-3); padding: var(--space-2) 0; background: var(--surface); border-top: 1px solid var(--line); }
.notice > p { margin: 0; }
@media (max-width: 999px) { .batch-row { grid-template-columns: 1fr; } }
td.pick { width: 1%; }
.pick-box { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; cursor: pointer; }
.pick-box input { margin: 0; accent-color: var(--accent); }
.pick-bar { margin: var(--space-2) var(--space-4) var(--space-3); }
.unanswered { color: var(--exception); }
/* The G4 card (docs/designs/gate-cards.md): each test a fieldset with its scenario, its choice and its code, folded. */
.lens { display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; line-height: 22px; white-space: nowrap; }
.scen { margin: 0; padding: 0; list-style: none; }
.card .scen { padding-left: 0; }
.card .gwt-lines { margin: 6px 0 0; padding: 0; list-style: none; }
.gwt-lines li { display: grid; grid-template-columns: 44px 1fr; gap: 0 8px; padding: 1px 0; }
.gwt-lines b { padding-top: 1px; color: var(--muted); font-size: 13px; font-weight: 600; }
.scen .issue { margin-top: var(--space-2); }
.scen fieldset:not(:has(input[value="not_right"]:checked)) .issue { display: none; }
.scen .issue label { display: block; font-size: 13px; font-weight: 600; }
.scen .issue textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.same { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.scen summary .mono, .card summary .mono { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 899px) {
  .pair-cols { grid-template-columns: 1fr; }
}

/* The G2 and G3 cards (docs/designs/analyst-g2-g3.md): the plan's parts, the questions with their choices, the rules. */

/* The item block (docs/designs/gate-cards-readable.md, section 5; DESIGN.md "Item block"): each plan part, question, concern,
   rule and scenario on G2, G3, G4 and MT is one block: a subtle strip with its label (and its choices where they sit there),
   then its body at the strip's inset. No border, shadow or coloured edge; 16px between blocks. A legend is floated so it
   lays out as the strip, the fieldset still named by it. */
:is(.plan-sec, .rule, .gap, .scen > li, .scenarios > li) + :is(.plan-sec, .rule, .gap, .scen > li, .scenarios > li) { margin-top: var(--space-4); }
/* A group's heading sits close to its first block, so it reads as that group's, not as a gap between groups. */
.group-h + .gap { margin-top: var(--space-2); }
:is(.plan-sec, .rule, div.gap, .scen > li, .scenarios > li) > fieldset { min-width: 0; margin: 0; padding: 0 var(--space-3); border: 0; }
:is(.plan-sec, .rule) > fieldset > .top-line,
:is(div.gap, .scen > li, .scenarios > li) > fieldset > legend {
  box-sizing: border-box; min-height: 36px; margin: 0 calc(-1 * var(--space-3)) var(--space-2); padding: 6px var(--space-3);
  border-radius: var(--r-md) var(--r-md) 0 0; background: var(--subtle); color: var(--ink); font-size: 13px; font-weight: 600;
}
/* A G2 part's and a G3 rule's strip holds its choices on the right; a legend strip (a question, a scenario) holds only its label. */
:is(.plan-sec, .rule) > fieldset > .top-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); }
:is(div.gap, .scen > li, .scenarios > li) > fieldset > legend { display: block; float: left; width: calc(100% + 2 * var(--space-3)); }
:is(div.gap, .scen > li, .scenarios > li) > fieldset > legend + * { clear: both; }
.item-label { font-size: 13px; font-weight: 600; }

.item-label .meta, legend .meta { margin-left: 2px; color: var(--muted); font-weight: 400; }
:is(.plan-sec, .rule) > fieldset > .top-line .choices { margin-top: 0; }
details.gap.answered > summary { padding: 6px var(--space-3); border-radius: var(--r-md); background: var(--subtle); }
details.gap.answered[open] > summary { border-radius: var(--r-md) var(--r-md) 0 0; }
details.gap.answered > fieldset { padding: var(--space-2) var(--space-3) 0; }
details.gap.answered > fieldset > legend { padding: 0; font-size: 13px; font-weight: 600; }
.inout { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-4); margin-top:6px; }
.inout h3 { margin:0 0 4px; font-size:13px; color:var(--muted); font-weight:600; }
.inout ul, .plain { margin:0; padding-left:18px; font-size:14px; }
.inout li, .plain li { margin:2px 0; }
.kv { display:grid; grid-template-columns:120px 1fr; gap:4px var(--space-3); margin-top:6px; font-size:14px; }
.kv b { font-weight:600; }
.tier-chip { display:inline-block; min-width:28px; padding:0 6px; border:1px solid var(--line-strong); border-radius:var(--r-sm); font:600 13px/20px var(--font-mono); text-align:center; }
.seams { margin:6px 0 0; padding:0; list-style:none; font-size:14px; }
.seams li { display:grid; grid-template-columns:minmax(0, 400px) 1fr; gap:2px var(--space-3); padding:4px 0; border-top:1px solid var(--line); }
.seams li:first-child { border-top:0; }
.seams .mono { overflow-wrap:break-word; word-break:normal; font-size:13px; }
.demo-line { margin:6px 0 0; padding:8px var(--space-3); border-radius:var(--r-md); background:var(--info-tint); font-size:13px; }
.demo-line b { color:var(--info); }
/* Why a G2 or G3 card is back after a revision (AnalystReturnSection): one notice above the card's sections. */
.return-notice { margin:6px 0 0; }
.return-notice > p + p { margin-top:4px; }
.card > .return-notice { margin:0; padding:var(--space-4) var(--space-5); border-radius:0; }
.group-h { margin:var(--space-4) 0 2px; font-size:13px; font-weight:600; color:var(--muted); text-transform:none; }
.gap fieldset { margin:0; padding:0; border:0; min-width:0; }
.gap .q { margin:4px 0 0; font-size:14px; }
.opts { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.opts .choice { align-items:flex-start; min-height:0; padding:7px 10px; line-height:1.4; }
.opts .choice input { margin-top:3px; }
.gap .why { display:none; }
.gap:has(.other:checked) .why, .gap .why.open { display:block; }
/* A challenge concern's dismissal (G2): one click on a preset reason; the reason box only for Another reason. */
.gap .presets { display:none; margin:8px 0 0; padding:0; border:0; min-width:0; flex-direction:column; gap:6px; }
.gap .presets legend { padding:0; margin-bottom:6px; font-size:13px; font-weight:600; }
.gap .presets .choice { align-items:flex-start; min-height:0; padding:7px 10px; line-height:1.4; }
.gap .presets .choice input { margin-top:3px; }
.gap:has(.other:checked) .presets { display:flex; }
.gap.concern:has(.other:checked) .why { display:none; }
.gap.concern:has(.other:checked):has(.own:checked) .why { display:block; }
/* Send carries an optional note (the send-back's "Note:"), in the same box under its own label. */
.gap.concern:has(.send:checked) .why { display:block; }
.gap.concern .why .for-send, .gap.concern:has(.send:checked) .why .for-dismiss { display:none; }
.gap.concern:has(.send:checked) .why .for-send { display:inline; }
/* The questions card's I can't answer this (plan-stage.md) takes an optional "who can?" in the same box, under its own label. */
.gap:has(.cant:checked) .why { display:block; }
.gap .why .for-cant, .gap:has(.cant:checked) .why .for-other { display:none; }
.gap:has(.cant:checked) .why .for-cant { display:inline; }
/* A browser without :has shows the reasons and the box outright, so a concern can still be dismissed or sent with a note. */
@supports not selector(:has(*)) {
  .gap .presets { display:flex; }
  .gap .why { display:block; }
  .gap.concern .why .for-send { display:inline; }
  .gap.concern .why .for-send::before { content:" / "; }
  .gap .why .for-cant { display:inline; }
  .gap .why .for-cant::before { content:" / "; }
}
/* Who the questions card still waits on: a plain line under its count. */
.waiting-on { margin: var(--space-1) 0 var(--space-3); font-size: 14px; }
@media (max-width: 767px) { .gap .presets .choice { min-height:44px; } }
.answered summary { font-size:14px; }
.answered .ans { color:var(--ink); font-weight:600; }
.context .rule { padding:10px 0; border-top:1px solid var(--line); }
.context h3 + .rule { border-top:0; }
/* The rules folded in for context are rows, not item blocks: no block gap between them. */
.context .rule + .rule { margin-top: 0; }
.rule .ears { margin:2px 0 0; font-size:15px; line-height:1.45; }
.rule .src { margin:4px 0 0; font-size:12px; color:var(--muted); }
.rule .waits { display:inline-block; margin-left:6px; padding:0 6px; border-radius:var(--r-sm); background:var(--exception-tint); color:var(--exception); font-size:12px; font-weight:500; line-height:18px; }
.rule .why { display:none; }
.rule:has(.mark:checked) .why { display:block; }
.cov { margin:6px 0 0; padding:0; list-style:none; font-size:13px; }
.cov li { display:grid; grid-template-columns:1fr auto; gap:var(--space-3); padding:5px 0; border-top:1px solid var(--line); }
.cov li:first-child { border-top:0; }
.cov .x { color:var(--muted); }
.gate h2 a, .why-off a { white-space:nowrap; }
.next-line { margin:6px 0 0; font-size:13px; color:var(--muted); }
@media (max-width: 767px) { .inout, .kv, .seams li { grid-template-columns:1fr; } .opts .choice { min-height:44px; } }
.plan-sec .issue, .gap .issue, .rule .issue { margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--subtle); }
.plan-sec .issue label, .gap .issue label, .rule .issue label { display: block; font-size: 13px; font-weight: 600; }
.plan-sec .issue textarea, .gap .issue textarea, .rule .issue textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.plan-sec:not(:has(.mark:checked)) .issue { display: none; }
.scenarios { margin: 0; padding: 0; list-style: none; }
.scenarios fieldset:not(:has(input[value="issue"]:checked)) .issue { display: none; }
.mt-card h2 .meta { margin-left: 6px; font-weight: 400; }
.mt-card .issue, .scenarios .issue { margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--subtle); }
.mt-card .issue label, .scenarios .issue label { display: block; font-size: 13px; font-weight: 600; }
.mt-card .issue textarea, .mt-card .issue input, .scenarios .issue textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
/* The MT card's groups inside an issue (what kind of issue, what happened) and the explored note (docs/designs/mt-scenario-data.md, PR 1). */
.scenarios .issue fieldset.sub { margin: var(--space-2) 0 0; padding: 0; border: 0; border-radius: 0; }
.scenarios .issue fieldset.sub legend { padding: 0; font-size: 13px; font-weight: 600; }
.scenarios .issue fieldset.sub .meta { margin: 4px 0 0; }
.mt-card .issue label.in-words { margin-top: 6px; font-weight: 400; }
.mt-card .issue fieldset.sub + label { margin-top: var(--space-2); }
.mt-card .issue fieldset.sub .choice { display: inline-flex; font-weight: 400; }
.mt-card .issue fieldset.sub .choice:has(:checked) { font-weight: 600; }
.mt-card .issue fieldset.sub .choice input { display: inline-block; width: auto; max-width: none; margin: 0; padding: 0; border: 0; background: none; }
.mt-card .explored { margin-top: var(--space-3); }
/* A scenario's world on the G4 and MT cards (docs/designs/mt-scenario-data.md, 3.6): a hairline, no box; the rows as compact tables. */
.scenario-data { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.scenario-data .data-head { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.scenario-data .gwt { margin: 0 0 var(--space-2); }
.scenario-data .not-shown { margin: 0 0 var(--space-2); }
.scenario-rows .table-scroll { margin-top: var(--space-2); }
.scenario-rows caption { padding: 0 0 4px; font-size: 13px; }
.scenario-rows th:first-child, .scenario-rows td:first-child { padding-left: 0; }
.scenario-rows td.cell { font-size: 13px; max-width: 40ch; overflow-wrap: anywhere; }
.scenario-rows td.muted { color: var(--muted); }
.scenario-rows tr.rows-gap td { color: var(--muted); font-size: 12px; background: var(--subtle); }
.scenario-rows > .meta { margin: var(--space-2) 0 0; }
.scenario-data .open-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0 0 4px; }
.scenario-data .open-row .same { margin: 0; }
.scenario-data > .notice { margin: var(--space-2) 0; }
.mt-card .explored label { display: block; font-size: 13px; font-weight: 600; }
.mt-card .explored textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.mt-card .explored .meta { margin: 4px 0 0; }
.rule .ears { overflow-wrap: anywhere; }
.readiness { margin: 0 0 4px; font-size: 14px; }
/* The labels inside G2's Readiness and work, like Scope's In and Out, so its two lists never read as one. */
.plan-sec .sub-h { margin: var(--space-3) 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.plan-sec .top-line + .sub-h { margin-top: 0; }
/* Formatted text (docs/designs/gate-cards-readable.md, section 1): agent and submitter Markdown as ordinary elements, never above h3. */
.formatted { max-width: 72ch; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.card .formatted > * { margin: 0; }
.card .formatted > * + * { margin-top: var(--space-2); }
.card .formatted h3 { margin-top: var(--space-3); font-size: 14px; font-weight: 600; color: var(--ink); }
.card .formatted h4 { margin-top: var(--space-3); font-size: 13px; font-weight: 600; color: var(--muted); }
.card .formatted > :first-child { margin-top: 0; }
.card .formatted ul, .card .formatted ol { padding-left: var(--space-5); }
.formatted li + li { margin-top: 2px; }
.formatted code, .plain code, .inout code { padding: 0 3px; border-radius: var(--r-sm); background: var(--subtle); font-size: 13px; overflow-wrap: anywhere; }
.formatted .url { color: var(--muted); font-size: 12px; }
.formatted pre.patch { padding: var(--space-2) var(--space-3); white-space: pre; }
.why-off { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.badge.fict { background: var(--exception-tint); color: var(--exception); }

/* Narrower screens */
@media (max-width: 1023px) {
  .departures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .departures a:nth-child(3) { border-left: 0; }
  .departures a:nth-child(n+3) { border-top: 1px solid var(--line); }
  .departures.three a:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  .kinds, fieldset.disp { grid-template-columns: 1fr; }
  .ev, .ev.big { width: calc(50% - 4px); }
  .choice, .intake label.choice, .ev .row button.link, ul.stills .t { min-height: 44px; }
  ul.stills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { padding: 0 var(--space-3); }
  .top { column-gap: var(--space-3); }
  .brand { flex: 1 1 auto; font-size: 18px; }
  .brand a { gap: 6px; }
  .tower { width: 20px; height: 20px; }
  .top-spacer { display: none; }
  /* The band on a phone: wordmark and viewer share the first row, then search, then the tabs. The theme choice stays
     on System there, which follows the phone. */
  .viewer { order: 2; max-width: 44%; padding: 4px 0; }
  .viewer .who { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .wide, .top .theme { display: none; }
  .jump { order: 3; flex-basis: 100%; max-width: none; margin: var(--space-1) 0; }
  /* The places last, so the current tab still joins the page header; a chosen role's pill sits above the tabs. */
  .places { order: 4; width: 100%; flex-wrap: wrap; }
  .nav { order: 2; width: 100%; }
  .nav a { height: var(--target); padding: 0 14px; }
  .page-head { padding: var(--space-4) var(--space-4) 0; }
  .page-head.plain { padding-bottom: 14px; }
  .page-body { padding: var(--space-4) var(--space-4) 40px; }
  .departures a { padding: var(--space-3) 14px; }
  .button { min-height: var(--target); }
  table { min-width: 0; }
  th, td { padding-left: 6px; padding-right: 6px; }
  th:first-child, td:first-child { padding-left: var(--space-3); }
  th:last-child, td:last-child { padding-right: var(--space-3); }
  .optional, .held-for > .hold-split { display: none; }
  .split { padding: var(--space-4) var(--space-4) 40px; }
  .phone-only { display: block; }
  .desktop-only { display: none; }
  .gate .card .decision:has(.desktop-only) { position: static; }
  .inbox { max-width: none; flex-basis: 100%; }
  .detail { flex-basis: 100%; }
}

/* A panel holding a page's flowing content: forms, lists and tables. */
.form-panel, .panel-note { padding-top: var(--space-4); }
.form-panel > .table-scroll, .form-panel > .rows { margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4)); }
.form-panel > .rows { border-bottom: 0; }
.intake .form-panel { max-width: 860px; }
.panel.panel-body > p, .panel.panel-body > ul.budgets { margin-left: 0; margin-right: 0; }
.crumb { margin: 0 0 var(--space-1); font-size: 13px; }
.card .facts { padding: 14px var(--space-5); border-bottom: 0; }
.card .decision { background: var(--subtle); }
.card > section > .table-scroll { margin: 0 calc(-1 * var(--space-5)); }
.card > section > .table-scroll th:first-child, .card > section > .table-scroll td:first-child { padding-left: var(--space-5); }
.card > section > .table-scroll th:last-child, .card > section > .table-scroll td:last-child { padding-right: var(--space-5); }
/* The work order page: its state badge with any flag beside it (Trial), kept together at the right. */
.head-row > h1 + .head-badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: 8px; }
.head-badges .flag { margin: 0; }
/* A required field's marker, after its label text. */
.required { margin-left: var(--space-1); font-weight: 400; font-size: 12px; color: var(--muted); }

/* Findings (docs/designs/lessons-loop.md): a finding is a short entry in a list, its tag a badge, its actions small inline forms. Tokens only. */
.finding-list { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.finding { padding: 10px 0; border-top: 1px solid var(--line); }
.finding:first-child { border-top: 0; padding-top: 0; }
.finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); }
.finding-line { margin: var(--space-1) 0; }
/* Lessons fixes (docs/designs/lessons-loop.md, "On the cards and pages"): a row's links and facts, a person's own words, the tag asked in a
   gate action (a nested fieldset of choice chips, its legend read as a field label), and the Learnings area picker. No new tokens. */
.finding-links { margin: var(--space-1) 0; font-size: 13px; }
.finding-words { max-width: 72ch; margin: var(--space-1) 0; font-size: 14px; }
fieldset.finding-tag { min-width: 0; margin: var(--space-3) 0; padding: 0; border: 0; }
fieldset.finding-tag > legend { padding: 0; font-weight: 600; font-size: 13px; color: var(--ink); }
fieldset.finding-tag > legend .meta { font-weight: 400; margin-left: var(--space-2); }
fieldset.finding-tag .choice { display: inline-flex; font-weight: 400; } /* the card's own answer chips: a card's label rule would make them blocks */
fieldset.finding-tag label[for] { display: block; margin: var(--space-2) 0 var(--space-1); font-size: 13px; font-weight: 600; }
fieldset.finding-tag .finding-tag-why { margin: var(--space-1) 0 0; font-size: 12px; }
/* One tag layout on every card (docs/designs/card-audit-fixes.md, S6): a row of choices, each with its meaning under its name. */
fieldset.finding-tag .choices { gap: var(--space-2); }
fieldset.finding-tag .choice { align-items: flex-start; }
fieldset.finding-tag .choice > input { margin-top: 3px; }
fieldset.finding-tag .choice > span { display: flex; flex-direction: column; max-width: 18rem; }
fieldset.finding-tag .choice small { font-size: 12px; font-weight: 400; color: var(--muted); }
/* Approve stands alone: the reason and the tag show once an answer is a send-back, and where the server drew the block open (a saved send-back
   answer, a refused post). :not(:has()) so a browser without :has shows them, as before. The ancestor is .card: the answers sit in the item panes,
   the block in the decision section. Each selector is an answer input a card renders for a send-back. */
.card:not(:has(input.mark:checked, input.send:checked, input[value="not_right"]:checked, input[value="issue"]:checked,
               input[value="test"]:checked, input[value="build"]:checked)) .on-send-back:not(.open) { display: none; }
/* G7 has buttons, not answers: its send-back fields sit in a fold the Approve button stands outside of. */
.send-back-fold > summary { min-height: 24px; box-sizing: border-box; padding: var(--space-1) 0; color: var(--ink); font-weight: 600; cursor: pointer; }
fieldset.finding-tag[aria-invalid="true"]:not(.refused-area) .choices { outline: 1px solid var(--blocked); outline-offset: 4px; border-radius: var(--r-md); }
fieldset.finding-tag.refused-area select { border-color: var(--blocked); outline: 1px solid var(--blocked); }
.finding-area-pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); }
.finding p.meta { margin: 0; }
.finding-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.finding-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.finding-form select { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 14px var(--font-sans); }
.findings .panel-body { padding-top: var(--space-2); }
.finding-group { margin-bottom: var(--space-3); }
.finding-notice { margin: 0 0 var(--space-3); }
.broke-here { margin-top: var(--space-4); }

/* Findings forms: 44px touch targets below 768px (DESIGN.md, Density). */
@media (max-width: 767px) {
  .finding-form select, .finding-form button, .finding-form .btn, .finding-actions button { min-height: 44px; }
}

/* Close this work order (DESIGN.md): a disclosure at the bottom of the timeline, not a panel. The successor field and each
   choice's consequence show only under their choice, with no script. */
.close-section { margin-top: var(--space-4); border-top: 1px solid var(--line); padding-top: var(--space-3); }
.close-section summary h2 { display: inline; font-size: inherit; }
.close-section .notice { margin: var(--space-2) 0; }
/* Stalled intakes (migration 0037): on the inbox and on the intake page. */
.stalls { margin: var(--space-2) 0; }
.stalls h2.label { margin: 0 0 var(--space-1); color: var(--ink); font-weight: 600; }
.stalls ul.plain li + li { margin-top: var(--space-1); }
.close-form fieldset { border: 0; padding: 0; margin: 0 0 var(--space-2); }
.close-form legend { font-weight: 600; }
.close-form label[for] { display: block; margin-top: var(--space-2); font-weight: 600; }
.close-form input[type="text"], .close-form textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.close-form input[type="text"] { max-width: 20rem; }
.close-form .if-replace, .close-form .if-end { display: none; }
.close-form:has(#close-replace:checked) .if-replace, .close-form:has(#close-end:checked) .if-end { display: block; }
.close-form .error-summary ul { margin: 4px 0 0; padding-left: 1.2em; }
.close-form .choice { min-height: 24px; }
@media (max-width: 767px) { .close-form .choice, .close-form .button { min-height: 44px; } }
.close-form .decision-bar { align-items: center; }

/* The stop card (DESIGN.md, Answer needed card; docs/designs/stop-answer-card.md): the factory's own sentence in body ink, the agent's account
   below it in a subtle box of at most 72 characters a line, then one box for the answer. No new tokens. */
.stop-why, .stop-fact { max-width: 72ch; margin: var(--space-2) 0 0; }
.stop-sub { margin: var(--space-3) 0 var(--space-1); font-size: 13px; font-weight: 600; }
.stop-account { max-width: 72ch; margin: var(--space-1) 0 var(--space-3); padding: 10px var(--space-3); background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r-md); }
.stop-account code { overflow-wrap: anywhere; }
.card .decision textarea.stop-box { height: auto; min-height: 9rem; }
.stop-form .error-summary { margin: var(--space-2) 0; }
.stop-form .error-summary ul { margin: 4px 0 0; padding-left: 1.2em; }
/* Only the bar is pinned on this card, not the whole section: its Close follows, so the section is no bottom corner of the card either. */
.gate .card.stop-card > .decision { position: static; border-radius: 0; }
.gate .card.stop-card > .decision:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.stop-form .decision-bar { position: sticky; bottom: 0; z-index: 1; align-items: center; margin-top: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); background: var(--subtle); }
.stop-outcome > p + p { margin-top: var(--space-1); }

/* Tunnel down, and sessions that never started (docs/designs/tunnel-hold.md): full-width notices under the page head, above the
   Inbox's queue and its empty h1, and the Factory page's one line. The command is one selectable line. */
.page-notice { max-width: 960px; margin: 0; }
.page-notice h2.label { margin: 0 0 var(--space-1); color: var(--ink); font-weight: 600; }
.notice.page-notice > p + p { margin-top: 6px; }
/* The live Inbox's notice (live-inbox.md): Dismiss at the end of the line, 24px tall at least. */
#live-inbox-new .dismiss { min-height: 24px; margin-left: var(--space-2); vertical-align: baseline; }
/* The skip link's target, and where focus goes after Dismiss: a container, so no ring of its own. */
#content:focus { outline: none; }
.page-notices { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5) var(--space-8) 0; }
.page-notices + .split { padding-top: var(--space-4); }
.command { display: block; width: max-content; max-width: 100%; margin: var(--space-1) 0; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-family: var(--font-mono); font-size: 13px; user-select: all; overflow-wrap: anywhere; }
/* Start it again (the work order page): a section under the facts, like Close a hairline above and never a panel. */
.restart-section { margin-top: var(--space-4); border-top: 1px solid var(--line); padding-top: var(--space-3); }
.restart-section .notice { margin: var(--space-2) 0; }
/* Its paragraphs carry numbers and setting names: at most 72 characters a line, as Why it failed's cause; a notice keeps the full width. */
.restart-section > p:not(.notice) { max-width: 72ch; }
.restart-form label[for] { display: block; margin-top: var(--space-2); font-weight: 600; }
.restart-form textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.restart-form .error-summary ul { margin: 4px 0 0; padding-left: 1.2em; }
.restart-form .decision-bar { align-items: center; margin-top: var(--space-2); }
@media (max-width: 767px) { .page-notices { padding: var(--space-4) var(--space-4) 0; } .restart-form .button { min-height: 44px; } }

/* People (/settings/people): a login GitHub does not know is flagged in the warning tone; the top notice lists every problem. */
.flag.warn { border-color: transparent; background: var(--exception-tint); color: var(--exception); }
.notice ul.plain { margin: 0; }

/* Learnings (Factory): the failed attempts queue and the Checker mark form (docs/designs/lessons-loop.md, "Checker findings"). */
/* The queue's filter: the Filters row, stacked inside the 320px queue. */
.inbox.attempts .filters input.filter-text, .inbox.attempts .filters select { flex: 1 1 100%; max-width: none; }
/* What failed, on the queue row's tab: a plain bordered tab (not tinted: it says what failed, not who holds it). */
.row-link .row-top { display: flex; align-items: center; gap: var(--space-2); }
/* A marked block stays in the list, its title muted like a decided card's. */
.rows li.decided .row-title { color: var(--muted); }
.failed-tab { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
/* The Checker's findings: the problem first, the file in mono under it. */
.checker-findings { margin: 0; padding: 0; list-style: none; }
.checker-findings li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 2px var(--space-3); padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.checker-findings li:first-child { border-top: 0; }
.checker-findings .flag { justify-self: start; }
.checker-findings .problem { margin: 0; }
.checker-findings .file { grid-column: 2; font-family: var(--font-mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.said { margin: 0 0 var(--space-3); }
/* The finding tabs (docs/designs/learnings-decide.md, section 5): two short lines a row, each cut with an ellipsis (the whole line in its title);
   the filters in two lines inside the list, the search with its button, then Area and Source side by side. */
.page-body.learnings-head { padding-bottom: var(--space-4); }
.learnings-head .views.sub-views { margin-bottom: 0; position: relative; } /* the pills' hidden words stay inside the scrolling row */
#finding-heading, .hidden-failing, .scenario p.mono, .finding-files ul.mono, .reference b.mono { overflow-wrap: anywhere; } /* code-like values wrap anywhere */
.finding-choose label.field { display: block; margin: var(--space-3) 0 var(--space-1); font-size: 13px; font-weight: 600; }
.finding-choose select { min-height: 34px; min-width: 200px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 14px var(--font-sans); }
.finding-choose .decision-bar { margin-top: var(--space-3); }
@media (max-width: 767px) { .finding-choose select { min-height: 44px; } }
.learnings-head .finding-notice { margin-top: var(--space-3); }
.finding-row { padding: var(--space-2) var(--space-3); }
.finding-row .r1, .finding-row .r2 { display: flex; gap: var(--space-2); align-items: baseline; min-width: 0; }
.finding-row .r1-text, .finding-row .r2-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finding-row.selected .r1 { font-weight: 600; }
.finding-row .age, .finding-row .r2-flag { flex: none; }
.finding-row .r2-flag { max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finding-row .flag { margin: 0; line-height: 18px; }
.flag.suggested { border-style: dashed; color: var(--muted); }
.inbox.findings-list .filters input.filter-text { flex: 1 1 calc(100% - 96px); }
.inbox.findings-list .filters select { flex: 1 1 calc(50% - var(--space-2)); min-width: 0; }
.findings-list .pager { padding: var(--space-2) var(--space-3); }
/* The pane: the decision, the words (Policy's amendment keeps its lines), each named item as a block, and the folds. */
.finding-reason { margin-top: 2px; }
.finding-decide { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.finding-decide .decision-bar { margin: 0; }
.finding-decide details > form { margin-top: var(--space-2); }
.finding-decide summary, .finding-files summary { padding: var(--space-1) 0; cursor: pointer; } /* nothing clickable under 24px */
.finding-decide fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.finding-decide legend { padding: 0; font-weight: 600; font-size: 13px; }
.finding-decide label.field { display: block; margin: var(--space-2) 0 var(--space-1); }
.amendment { max-width: 72ch; margin: 0 0 var(--space-3); }
.reference, .scenario { margin: var(--space-3) 0 0; }
.reference, .scenario:not(.pane-item) { max-width: 72ch; } /* not a card's pane (pane-item scenario): its previous and next links stay at the pane's right edge */
.reference p, .scenario p { margin: 0; }
.hidden-failing { margin: 0 0 var(--space-2); padding-left: 1.2em; }
.finding-files ul { margin: var(--space-1) 0 0; padding-left: 1.2em; }
/* Checks on this attempt: the G5/G6 checklist rows. */
ul.checks { margin: 0; padding: 0; list-style: none; }
ul.checks li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 2px var(--space-3); padding: 6px 0; border-top: 1px solid var(--line); align-items: baseline; }
ul.checks li:first-child { border-top: 0; }
ul.checks .badge { justify-self: start; }
/* inspect's gate tags on G7 (gate-cards.md, PR3b): a badge only on the tags outside the Checker's diff, so a row flows
   (badge, pattern, file) rather than taking the checks list's badge column. */
ul.gate-tags { margin: 0; padding: 0; list-style: none; }
ul.gate-tags li { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
ul.gate-tags li:first-child { border-top: 0; }
ul.gate-tags .mono { overflow-wrap: anywhere; }
/* G5 and G6 on the work order page (docs/designs/gate-cards.md, "Group 1"; DESIGN.md, Automated gates): sections above the
   timeline, each check a row of badge, bold name and sentence; a refusal's problems or a failure's reason sit under it. */
.gate-section { margin-bottom: var(--space-4); }
.gate-section .notice { margin: var(--space-2) 0; }
.gate-section ul.checks > li { padding: var(--space-2) 0; }
/* A refusal's problems sit under their row as plain lines, not as rows of the check list (ul.checks li is a grid row). */
.gate-section ul.checks .gate-problems li { display: list-item; padding: 0; border-top: 0; }
.gate-section ul.checks .gate-problems, .gate-section ul.checks .gate-reason { grid-column: 2; margin: var(--space-1) 0; }
.gate-section .gate-problems, .gate-section .gate-reason, .gate-section .gate-history { font-size: 13px; color: var(--muted); }
.gate-section .gate-history, .gate-section > .gate-reason { margin-top: var(--space-3); }
.gate-section .mono { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .gate-section ul.checks li { display: block; }
  .gate-section ul.checks .badge { margin-right: var(--space-2); }
}
/* Why it failed on the work order page (docs/designs/diagnose-and-proof-runs.md, D2): a section of the card between its facts and the
   timeline. The cause is one paragraph of at most 72 characters a line; Next step, Kind and Evidence are label-over-value rows (the .kv
   grid, stacked below 768px); "No diagnosis" is a dashed note, not an Error notice, since nothing in the Portal failed. */
.why-section .notice { margin: var(--space-2) 0; }
.why-section .mono { overflow-wrap: anywhere; }
.why-cause { max-width: 72ch; margin: var(--space-3) 0; font-size: 15px; }
.why-none { margin: var(--space-2) 0; padding: 10px var(--space-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); color: var(--muted); }
.why-rows { margin: 0; }
.why-rows dt { padding-top: 2px; color: var(--muted); font-size: 13px; }
.why-rows dd { margin: 0; min-width: 0; }
.why-rows dd > p { margin: 0 0 var(--space-1); }
ul.why-evidence { margin: 0; padding-left: var(--space-5); }
ul.why-evidence li { margin: 0 0 var(--space-1); overflow-wrap: anywhere; }
@media (max-width: 767px) { .why-rows dd { margin-bottom: var(--space-2); } }

/* The mark form: choice rows stacked one per row with their consequence (the Settings form's rule). */
.mark-form fieldset { margin: 0 0 var(--space-4); padding: 0; border: 0; }
.mark-form legend { padding: 0; font-weight: 600; }
.mark-form .help { margin: 2px 0 6px; font-size: 13px; color: var(--muted); }
.choice-rows { display: flex; flex-direction: column; gap: 6px; }
.choice-rows .choice { align-items: flex-start; padding: 8px 10px; }
.choice-rows .choice input { margin-top: 3px; }
.choice-rows .choice span { display: flex; flex-direction: column; }
.choice-rows .choice small { font-size: 13px; font-weight: 400; color: var(--muted); }
.mark-form label.field { display: block; margin: 0 0 4px; font-weight: 600; }
.mark-form select, .mark-form input[type=text], fieldset.finding-tag select, .finding-area-pick select { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 14px var(--font-sans); }
.mark-form input[type=text] { width: 100%; max-width: 560px; }
.inbox-aside-line { margin: 0; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 767px) { .choice, .mark-form select, .mark-form input[type=text], fieldset.finding-tag select, .finding-area-pick select { min-height: 44px; } }

/* Designs view (docs/designs/gd-design-gate.md): its lists are rows split by hairlines, no bullets; a route entry is a plain fieldset. */
.design-screens, .design-history, .refused-files { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.design-screens > li, .design-history > li, .refused-files > li { padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.design-screens > li:first-child, .design-history > li:first-child, .refused-files > li:first-child { border-top: 0; }
.design-route { margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--line); border-radius: var(--r-md); }
.design-frames { margin: var(--space-2) 0 0; max-width: 640px; }
.design-frames figure { margin: 0; }
.design-frames img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.views.sub-views { margin-top: 0; margin-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.token-changes { margin: 0 0 var(--space-3); padding-left: var(--space-4); }

/* Empty states in a split (design review 2026-11-18): a page-body with nothing in it adds no gap above the split, an empty
   queue's note is padded like the queue's head, and a lone note in the detail pane gets the pane's vertical room; a
   panel under the split sits one gap below it, as panels in a page-body do. */
.page-body:not(:has(*)) { display: none; }
.inbox .panel-note { margin: 0; padding: var(--space-4); }
.detail > p.meta:only-child { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.split:has(+ .page-body) { padding-bottom: 0; }
.split + .page-body { padding-top: var(--space-4); }

/* Answered rows on a finished card (FinishedCard): the GD card that drew the rest of these is React's since R4 (docs/designs/react-migration/R4.md). */
.diffs { margin: 0 0 var(--space-3); padding: 0; list-style: none; }
.diffs > li { padding: 10px 0; border-top: 1px solid var(--line); }
.diffs > li:first-child { border-top: 0; }
.diffs.recorded .plain { margin-top: 4px; }

/* The request flow (docs/designs/request-flow.md): role lanes as columns, steps as rows, the current row on an accent-tint band.
   Solid hairline rails; a dashed box always means "not reached". No coloured edge, no shadow, no new tokens. */
.flow-panel .notice { margin: 0; }
.flow-panel .flow-note { margin: var(--space-2) 0 0; }
.flow { position: relative; margin-top: var(--space-3); --gut: 84px; overflow-x: auto; }
.flow-grid { display: grid; grid-template-columns: var(--gut) repeat(var(--lanes), minmax(120px, 1fr)); column-gap: var(--space-2); }
.flow .rails { position: absolute; inset: 0; pointer-events: none; }
.flow .rails span { border-left: 1px solid var(--line); }
.flow .rails span:first-child { border-left: 0; }
.flow .lanes { padding: 0 0 var(--space-2); border-bottom: 1px solid var(--line); }
.flow .lanes span { font-size: 12px; font-weight: 600; color: var(--muted); padding-left: var(--space-1); }
.flow ol { margin: 0; padding: 0; list-style: none; position: relative; }
.flow li { align-items: start; padding: 6px 0; border-radius: var(--r-md); }
.flow li.now { background: var(--accent-tint); }
.flow .gut { display: flex; flex-direction: column; padding: 4px 0 0 var(--space-2); font-size: 12px; color: var(--muted); line-height: 1.35; }
.flow .gut .n { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.flow li.now .gut .when { color: var(--ink); font-weight: 600; }
.flow .box { min-width: 0; padding: 6px var(--space-2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); line-height: 1.35; }
.flow .box .h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.flow .box .h b, .flow .box .h a { font-weight: 600; line-height: 24px; }
.flow .box a { display: inline-block; min-height: 24px; line-height: 24px; }
/* A box with a page: its name's link stretches over the whole box (one link, one tab stop); the box takes the hover and the focus ring (inside
   it: .flow scrolls, so a ring outside the last lane is clipped). A second link in it (Extra) and a line with a tooltip sit above the stretch. */
.flow .box.linked { position: relative; }
.flow .box.linked .box-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.flow .box.linked:hover { background: var(--subtle); }
.flow .box.linked:has(.box-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.flow .box.linked .box-link:focus-visible { outline: none; }
.flow .box.linked .l a, .flow .box.linked .l[title] { position: relative; z-index: 1; }
@supports not selector(:has(*)) { .flow .box.linked .box-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } }
.flow .box .l { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.flow .box .l.login { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow .box .id { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.flow .box .tag { padding: 0 5px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12px; line-height: 16px; color: var(--muted); }
.flow .box.now { border-color: var(--line-strong); }
.flow .box.done { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.flow .box.done .l { margin: 0; }
.flow .box.todo { border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--muted); }
.flow .box.todo .h b { font-weight: 500; }
.flow .box.slim { padding: 2px var(--space-2); }
.flow .box.slim .h .l { margin: 0; }
/* No phone layout (phone never a target): below 768px only the Now and next notice. */
@media (max-width: 767px) { .flow, .flow-panel .flow-note { display: none; } }

/* Spend (docs/designs/portal-navigation.md, section 4): panels and tables only; the bars are the Overview's budget bars, without the 50/80 marks
   outside Workspaces. Every bar is aria-hidden: its amount is the text beside it. */
.spend { display: grid; gap: var(--space-4); align-content: start; }
.spend-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.spend-pair table { min-width: 0; }
.spend .budgets { padding: var(--space-3) 0 0; }
.spend .budgets li { display: grid; gap: 4px; }
.spend-bar { width: 40%; }
.spend-bar .bar { margin-top: 0; }
.spend-bar .bar::before, .spend-bar .bar::after { display: none; }
.days td, .days th { padding-top: 6px; padding-bottom: 6px; }
.limits { list-style: none; margin: 0; padding: var(--space-3) var(--space-4); display: grid; gap: 8px; font-size: 13px; }
/* A row's own heading reads as its text, not as a column heading. */
.spend tbody th[scope="row"] { color: var(--ink); font-size: inherit; font-weight: 400; white-space: normal; }
.spend tbody tr:hover th { background: var(--subtle); }
.spend tbody .other-row th, .other-row td { color: var(--muted); font-weight: 400; }
.other-row summary { cursor: pointer; }
.other-list { margin: 6px 0 0; padding-left: var(--space-4); display: grid; gap: 2px; font-size: 13px; color: var(--ink); }
.total-row th, .total-row td { border-top: 1px solid var(--line-strong); }
@media (max-width: 999px) { .spend-pair { grid-template-columns: 1fr; } }

/* The Requests list: each row's step now, in the request flow's own words. */
.row-step { font-size: 13px; color: var(--muted); }
.row-step .badge { margin-right: 4px; }

/* View as role (docs/designs/view-as-role.md; DESIGN.md, View as role): a disclosure in the band after the places, opening the one pop-up
   the design allows. "All my roles" reads plain in the band's colours; a chosen role is a lit pill (band-link behind band, the same in both
   themes), which is how every page says which role it shows. It sits in .places beside the tabs, set off by a rule. Below 768px only a
   chosen role shows, as a row above the tabs, with 44px targets. */
.lens-switch { position: relative; align-self: center; display: inline-flex; padding-left: var(--space-3); border-left: 1px solid var(--band-line); }
.lens-switch > summary { display: inline-flex; align-items: center; min-height: 30px; padding: 0 6px; border-radius: var(--r-md);
  font-size: 13px; white-space: nowrap; cursor: pointer; list-style: none; }
.lens-switch > summary::-webkit-details-marker { display: none; }
.lens-switch > summary:hover, .lens-switch[open] > summary { background: var(--band-raised); }
.lens-switch .lens-now { display: inline-flex; align-items: center; color: var(--band-text); font-weight: 500; }
.lens-switch .lens-now::after { content: "▾"; margin-left: 5px; font-size: 10px; }
.lens-switch.on .lens-now { padding: 0 8px; border-radius: var(--r-sm); background: var(--band-link); color: var(--band); font-weight: 600; line-height: 22px; }
.lens-menu { position: absolute; left: var(--space-3); top: calc(100% + 4px); z-index: 20; display: flex; flex-direction: column; min-width: 200px; margin: 0; padding: 4px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 6px 18px var(--shadow-pop); }
.lens-group { display: flex; flex-direction: column; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.lens-menu button { display: flex; align-items: center; min-height: 40px; width: 100%; padding: 0 var(--space-3); border: 0; background: none; color: var(--ink);
  font: 14px var(--font-sans); text-align: left; cursor: pointer; }
.lens-menu button:hover { background: var(--subtle); }
.lens-menu :focus-visible { outline-color: var(--accent); outline-offset: -2px; }
.lens-menu button[aria-pressed="true"] { font-weight: 600; }
.lens-menu .now { margin-left: 0.3em; font-weight: 400; color: var(--muted); }
.lens-hidden { margin: var(--space-3) 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 767px) {
  .top .lens-switch { order: 1; padding-left: 0; border-left: 0; }
  .top .lens-switch:not(.on) { display: none; }
  .lens-switch > summary, .lens-menu button { min-height: var(--target); }
  .lens-switch > summary:focus-visible { outline-offset: -2px; } /* the row has no margin: keep the ring off the search and the tabs */
  .lens-menu { left: 0; }
}
.why-off + .decision-bar { margin-top: var(--space-2); }
/* The Test or build card (docs/designs/hidden-test-dispute.md, "Page design"): one block per failing test, the stop card's parts and G4's issue box;
   each box shows only under its own answer, and without :has both show, each saying which answer it is for. */
.tob-card .tob-test + .tob-test { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.tob-card fieldset { margin: 0; padding: 0; border: 0; }
.tob-card legend { padding: 0; font-size: 15px; font-weight: 600; }
.tob-card .choices { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.tob-card .tob-open { margin: var(--space-2) 0 0; }
.tob-card details { margin-top: var(--space-2); }
.tob-card .issue { margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--subtle); }
.tob-card .issue label { display: block; font-size: 13px; font-weight: 600; }
.tob-card .issue textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.tob-card .no-has { display: none; }
.tob-card fieldset:not(:has(input[value="test"]:checked)) .issue.for-test,
.tob-card fieldset:not(:has(input[value="build"]:checked)) .issue.for-build { display: none; }
@supports not selector(:has(*)) {
  .tob-card .no-has { display: inline; font-weight: 400; }
}
/* A test fix on the G4 card: its notice, the person's words, then each changed method and helper, open, before the tests to lock. */
.tob-fix { margin: var(--space-4) 0 var(--space-6); }
.tob-fix .strip { margin-top: var(--space-4); }
.tob-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.tob-card .decision .error-summary { margin: var(--space-2) 0 var(--space-3); }

/* Folds on gate cards (docs/designs/gate-cards-layout.md, "Two shapes"; DESIGN.md, Folds on gate cards). A section fold's summary is its
   h2, inline, then what it holds in muted text; an item fold's summary is the item block's strip, with the browser's own triangle. */
.card > details.fold-section, .card > form > details.fold-section, .card > .card-record > details.fold-section { margin: 0; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); }
.card details.fold-section { margin-top: 0; }
.fold-section > summary { padding: 0; }
.fold-section > summary h2 { display: inline; margin: 0; }
.fold-section > summary .hold { font-size: 13px; color: var(--muted); font-weight: 400; }
.fold-section[open] > summary { margin-bottom: var(--space-3); }
.card details.item { margin: 0; }
:is(details.item, li:has(> details.item)) + :is(details.item, li:has(> details.item)) { margin-top: var(--space-2); }
details.item[open] { margin-bottom: var(--space-4); }
details.item > summary { min-height: 32px; box-sizing: border-box; padding: 6px var(--space-3); border-radius: var(--r-md); background: var(--subtle); color: var(--ink); font-size: 13px; font-weight: 600; line-height: 20px; }
details.item[open] > summary { border-radius: var(--r-md) var(--r-md) 0 0; }
details.item > summary .note { color: var(--muted); font-weight: 400; }
details.item > summary .ans { color: var(--ink); font-weight: 600; }
details.item > summary .unanswered { font-weight: 600; }
details.item > .item-body { padding: var(--space-2) var(--space-3) 0; }
.unsaved { display: none; color: var(--exception); font-weight: 400; }
details.item:has(input[type=radio]:checked:not([data-saved])) .unsaved { display: inline; }

/* The item list and pane (docs/designs/gate-cards-layout.md, "C in detail"; DESIGN.md, Item list and pane): the Inbox's shape inside a card.
   One-line rows with a mark by shape, the id, the label cut with an ellipsis and the answer in words; the chosen item alone beside it. */
.card-items { border-top: 1px solid var(--line); }
.card > .card-items:first-child { border-top: 0; }
.card-items .muted { color: var(--muted); }
.ci-tally { margin: 0; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.ci-split { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.ci-side { min-width: 0; border-right: 1px solid var(--line); }
.ci-list { position: sticky; top: var(--space-4); max-height: calc(100vh - 2 * var(--space-4)); overflow-y: auto; padding: var(--space-1) 0 var(--space-3); }
.ci-group { margin: var(--space-3) var(--space-4) 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ci-group .counter { font-weight: 400; }
.ci-list ol { margin: 0; padding: 0; list-style: none; }
.ci-row { display: flex; align-items: baseline; gap: var(--space-2); min-height: 30px; box-sizing: border-box; padding: 5px var(--space-4); color: var(--ink); font-size: 13px; line-height: 20px; text-decoration: none; }
.ci-row:hover { background: var(--subtle); color: var(--ink); text-decoration: none; }
.ci-row:focus-visible { outline-offset: -2px; }
.ci-row.selected { background: var(--accent-tint); }
.ci-row.selected .ci-label { font-weight: 600; }
.ci-mark { flex: none; width: 8px; height: 8px; box-sizing: border-box; border-radius: 50%; transform: translateY(-1px); }
.ci-mark.done { background: var(--muted); }
.ci-mark.open { border: 1.5px solid var(--line-strong); }
.ci-mark.half { border: 1.5px solid var(--exception); background: linear-gradient(90deg, var(--exception) 50%, transparent 50%); }
.ci-code { flex: none; font-size: 12px; }
.ci-label { flex: 1 1 auto; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
.ci-change { flex: none; color: var(--muted); font-size: 12px; }
.ci-ans { flex: none; white-space: nowrap; }
.ci-ans.assumed, .pane-ans .assumed { color: var(--muted); } /* an answer sent unless changed (P-1): muted, its open ring says nobody looked */
.ci-unsaved { flex: none; font-size: 12px; }
.ci-note { flex: 0 8 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; border-radius: 9px; background: var(--neutral-tint); color: var(--muted); font-size: 12px; font-weight: 500; line-height: 18px; }
.ci-panes { min-width: 0; padding: var(--space-4) var(--space-5) var(--space-5); }
.pane-item { display: none; scroll-margin-top: var(--space-4); }
.card-items:not(.js) .ci-panes:not(:has(> .pane-item:target)) > .pane-item.chosen,
.card-items:not(.js) .ci-panes > .pane-item:target,
.card-items.js .ci-panes > .pane-item.on,
.card-items[data-read-all] .ci-panes > .pane-item { display: block; }
.card-items[data-read-all] .ci-panes > .pane-item + .pane-item { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.pane-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.pane-h { flex: 1 1 16rem; margin: 0; color: var(--ink); font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
.pane-h:focus:not(:focus-visible) { outline: none; }
.pane-ans { font-weight: 400; }
.pane-top .choices { margin-top: 0; }
.pn { display: flex; gap: var(--space-4); font-size: 13px; white-space: nowrap; }
/* The cards' own rules about an item's body, for its pane. */
.pane-item.test .issue { margin-top: var(--space-2); }
.pane-item.test:not(:has(input[value="not_right"]:checked)) .issue { display: none; }
.pane-item.test .issue label { display: block; font-size: 13px; font-weight: 600; }
.pane-item.test .issue textarea { display: block; width: 100%; max-width: 48rem; margin: 4px 0 0; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: inherit; }
.pane-item.scenario:not(:has(input[value="issue"]:checked)) .issue { display: none; }
.pane-item.scenario .issue fieldset.sub { margin: var(--space-2) 0 0; padding: 0; border: 0; border-radius: 0; }
.pane-item.scenario .issue fieldset.sub legend { padding: 0; font-size: 13px; font-weight: 600; }
.pane-item.scenario .issue fieldset.sub .meta { margin: 4px 0 0; }
@media (forced-colors: active) {
  .ci-mark.done { background: CanvasText; }
  .ci-mark.half { background: linear-gradient(90deg, CanvasText 50%, transparent 50%); border-color: CanvasText; }
  .ci-row.selected { outline: 2px solid Highlight; outline-offset: -2px; }
}
@supports not selector(:has(*)) {
  .card-items:not(.js) .ci-panes > .pane-item { display: block; }
}
/* Below 1000px the list sits above the pane, as the Inbox's queue does. */
@media (max-width: 999px) {
  .ci-split { grid-template-columns: minmax(0, 1fr); }
  .ci-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .ci-list { position: static; max-height: 50vh; }
}
/* A list inside a card section (MT's Scenarios) runs the card's full width, as G4's does. */
.card section > .card-items { margin: var(--space-3) calc(-1 * var(--space-5)) 0; }
.ci-actions { float: right; margin-left: var(--space-3); }
.ci-tally .ci-action.button { min-height: 28px; padding: 0 10px; font-size: 13px; }
.decision-bar .unsaved-count { align-self: center; font-size: 13px; }
/* A fold inside a section (G7's gate tags): the h3 inline in its summary. */
.fold-sub > summary h3 { display: inline; margin: 0; }

/* GT, GD and Test or build folds (docs/designs/gate-cards-layout.md): the item fold's strip replaces each block's legend and divider. */
details.item > .item-body > fieldset.disp { padding-top: 0; border-top: 0; }
.tob-card .tob-tests > details.item + details.item { margin-top: var(--space-2); }
.tob-card details.item > summary .mono { font-weight: 400; }
.list-head { margin: 0 0 var(--space-2); }
/* card audit, group C: the stop reason's code, text after its sentence in muted mono brackets so a person can copy it (AN-2); a test's two choices
   stacked, each with its consequence under it (HT-1); the finished hands-on test's recorded part: each issue's Steps, What they expected and What happened (MT-1). */
.stop-code { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tob-card .choices.tob-options { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: var(--space-3); }
.tob-card .tob-option p { margin: var(--space-1) 0 0; }
.found-fields { margin: var(--space-2) 0 0; }
.found-fields dt { margin: var(--space-2) 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.found-fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* card audit, D2: the request flow's badges wrap and "Show the steps" folds the diagram after the form (GT-2, GT-6) */
.flow .box .badge { white-space: normal; line-height: 16px; padding: 2px 7px; max-width: 100%; }
.flow-steps > summary { min-height: 24px; box-sizing: border-box; padding: var(--space-1) 0; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.flow-steps[open] > summary { margin-bottom: var(--space-2); }
@media (max-width: 767px) { .flow-steps-panel { display: none; } }

/* card audit, B: the live gate cards (G4's unsaved send-back line, G7's checks line and fold buttons) */
.unsaved-send-back { display: none; }
.card:has(input.mark:checked:not([data-saved]), input.send:checked:not([data-saved]), input[value="not_right"]:checked:not([data-saved])) .unsaved-send-back { display: inline; }
.checker-line { margin: 0 0 var(--space-2); }
.checker-line .badge { margin-right: var(--space-1); }
.send-back-actions { align-items: flex-start; }
.send-back-actions > div { display: flex; flex-direction: column; gap: var(--space-1); max-width: 22rem; }
.send-back-actions > div > .meta { margin: 0; font-size: 12px; }
#g7-approve > .meta { margin: var(--space-1) 0 0; font-size: 12px; }

/* card audit, review fixes: a long answer word wraps the row under the label instead of squeezing the label to nothing (the answer word itself never shrinks or wraps) */
.ci-row { flex-wrap: wrap; }
.ci-label { flex: 1 1 6rem; }
