/* Searcher 2 — application styles.
 *
 * This is a working tool that analysts sit in front of for hours, so the
 * priorities are legibility at density, a stable layout that does not move
 * under the cursor, and status that reads at a glance. No animation beyond
 * what communicates state.
 *
 * One system font stack, no web fonts: the app runs on a single VPS and a font
 * host is a dependency it does not need.
 */

:root {
  --ink: #16211c;
  --ink-soft: #4a5a53;
  --ink-faint: #7b8a83;
  --ground: #ffffff;
  --surface: #f4f6f5;
  --surface-2: #e9edeb;
  --rule: #d3dad7;
  --accent: #0c4b33;
  --accent-soft: #e6f0ea;
  --ok: #1a7f4b;
  --warn: #8a5a00;
  --warn-soft: #fdf3e0;
  --crit: #a32020;
  --crit-soft: #fbeceb;
  --focus: #0c4b33;

  --step: 0.25rem;
  --radius: 4px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e4eae7;
    --ink-soft: #a9b7b1;
    --ink-faint: #7d8c86;
    --ground: #121714;
    --surface: #1a211d;
    --surface-2: #232b27;
    --rule: #303a35;
    --accent: #63c79e;
    --accent-soft: #1a2b23;
    --ok: #63c79e;
    --warn: #d9a441;
    --warn-soft: #2a2314;
    --crit: #e58b83;
    --crit-soft: #2c1a19;
    --focus: #63c79e;
  }
}

:root[data-theme="dark"] {
  --ink: #e4eae7;
  --ink-soft: #a9b7b1;
  --ink-faint: #7d8c86;
  --ground: #121714;
  --surface: #1a211d;
  --surface-2: #232b27;
  --rule: #303a35;
  --accent: #63c79e;
  --accent-soft: #1a2b23;
  --ok: #63c79e;
  --warn: #d9a441;
  --warn-soft: #2a2314;
  --crit: #e58b83;
  --crit-soft: #2c1a19;
  --focus: #63c79e;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 100;
  background: var(--ground);
  padding: 8px 12px;
  border: 1px solid var(--rule);
}

/* Screen-reader-only text uses `.sr-only`, defined further down with the other
 * utilities and already used across a dozen templates. A second class doing the
 * same thing under a different name was added here and removed: two names for
 * one utility is how a stylesheet ends up with both half-maintained. */

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.crumb-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 32ch;
}
.crumb-client { color: var(--ink-faint); font-size: 0.88rem; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  font-size: 0.9rem;
}
.topbar-link { color: var(--ink-soft); text-decoration: none; }
.topbar-link:hover { color: var(--ink); text-decoration: underline; }

/* Spend: a magnitude, never hidden. Colour carries the band, the number
   carries the fact — colour alone would not survive a greyscale print or a
   colour-blind reader. */
.spend {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--rule);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
}
.spend-amount { font-weight: 700; color: var(--ink); }
.spend-of, .spend-team { color: var(--ink-faint); font-size: 0.82rem; }
.spend-near { border-color: var(--warn); background: var(--warn-soft); }
.spend-near .spend-amount { color: var(--warn); }
.spend-over { border-color: var(--crit); background: var(--crit-soft); }
.spend-over .spend-amount { color: var(--crit); }

/* ── Layout ──────────────────────────────────────────────────────────────── */

.shell { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.shell-with-rail {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
:root { --rail-w: 232px; }
:root.rail-collapsed { --rail-w: 52px; }

/* Below 880px the grid becomes one column and the rail sits above the content
   rather than beside it; the rules for the rail there follow the rail's own. */
@media (max-width: 880px) {
  .shell-with-rail { grid-template-columns: 1fr; gap: 0; }
}

/* ── The rail ────────────────────────────────────────────────────────────── */

.rail { position: sticky; top: 16px; padding-top: 20px; min-width: 0; }
.rail-group { margin-bottom: 22px; }
.rail-heading {
  margin: 0 0 6px 10px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.rail-project-name {
  margin: 0 0 6px 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.rail-list { list-style: none; margin: 0; padding: 0; }

.rail-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 6px 10px;
  text-decoration: none;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.rail-item:hover { color: var(--ink); background: var(--surface); }
.rail-item-current,
.rail-item[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
  border-left-color: var(--accent);
  font-weight: 600;
}
.rail-mark {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-faint);
}
.rail-item:hover .rail-mark,
.rail-item-current .rail-mark { color: var(--accent); }
.rail-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rail-label { font-size: 0.86rem; line-height: 1.4; }

.rail-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 14px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink-faint);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}
.rail-toggle:hover { color: var(--ink); background: var(--surface); }
.rail-toggle-mark { width: 18px; text-align: center; font-family: var(--mono); }

/* Collapsed: the marks stay, the words go to the accessibility tree only. Not
   `display:none` — a rail whose labels are unreachable to a screen reader is a
   rail with no navigation in it, and `title` on each link keeps the pointer
   answer too. */
:root.rail-collapsed .rail-text,
:root.rail-collapsed .rail-heading,
:root.rail-collapsed .rail-project-name,
:root.rail-collapsed .rail-toggle-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:root.rail-collapsed .rail-group { margin-bottom: 14px; }
:root.rail-collapsed .rail-item { padding: 7px 0; justify-content: center; border-left-width: 0; }
:root.rail-collapsed .rail-item-current,
:root.rail-collapsed .rail-item[aria-current="page"] { border-radius: var(--radius); }

/* The rail at 880px and narrower, after the rules it overrides. Collapsing is
   meaningless in one column — there is no width to reclaim — so the toggle is
   a menu button, closed until pressed (the script in base.html), and a stored
   "collapsed" is ignored. Not sticky: stuck to the top of a one-column page it
   was drawn over the content, and a tap meant for a button below it opened a
   stage instead. */
@media (max-width: 880px) {
  .rail { position: static; padding-top: 12px; }
  :root.rail-menu:not(.rail-menu-open) .rail-body { display: none; }
  .rail-toggle { width: auto; margin-bottom: 8px; border: 1px solid var(--rule); }
  :root.rail-collapsed .rail-text,
  :root.rail-collapsed .rail-heading,
  :root.rail-collapsed .rail-project-name,
  :root.rail-collapsed .rail-toggle-text {
    position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal;
  }
  :root.rail-collapsed .rail-item { padding: 6px 10px; justify-content: flex-start; border-left-width: 2px; }
}

.main { padding: 24px 0 64px; min-width: 0; }

/* ── Stage stepper ───────────────────────────────────────────────────────── */

.steps { position: sticky; top: 16px; padding-top: 24px; }
.steps ol { list-style: none; margin: 0; padding: 0; }
.step a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  text-decoration: none;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.step a:hover { background: var(--surface); color: var(--ink); }
.step-current a {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}
.step-n {
  font-size: 0.78rem;
  color: var(--ink-faint);
  min-width: 1.2em;
}
.step-current .step-n { color: var(--accent); }
/* Takes the slack so the state mark sits at the end of the row. `.step a` is a
 * single flex line with no room for a second, so the mark goes beside the label
 * rather than under it. */
.step-label { flex: 1 1 auto; min-width: 0; }

/* State is the mark, and the mark carries a word for a screen reader. The left
 * border stays the "you are here" channel alone — sharing it would make a
 * current step that also needs attention pick one of the two to show. */
.step-mark {
  font-size: 0.8rem;
  line-height: 1;
  color: var(--ink-faint);
}
.step-done .step-mark { color: var(--ok); }
.step-running .step-mark { color: var(--accent); }
.step-attention .step-mark { color: var(--crit); font-weight: 700; }

@media (max-width: 880px) {
  .steps { position: static; padding-top: 12px; overflow-x: auto; }
  .steps ol { display: flex; gap: 4px; }
  .step a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .step-current a { border-left: 0; border-bottom-color: var(--accent); }
  /* The rail is a horizontal scroller here, so the label must not stretch. */
  .step-label { flex: 0 0 auto; }
}

/* ── Workbench ───────────────────────────────────────────────────────────── */

/* `.spacenav` — the workbench's own strip of section links — was removed with
 * the markup that used it. The rail carries those sections now, and rendering
 * both put two `aria-current="page"` marks on one page. */

/* ── Typography ──────────────────────────────────────────────────────────── */

h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 32px 0 10px; }
h3 { font-size: 0.98rem; font-weight: 700; margin: 22px 0 8px; }
.lede { color: var(--ink-soft); margin: 0 0 20px; max-width: 68ch; }
.hint { color: var(--ink-faint); font-size: 0.86rem; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }

/* ── Pills and badges ────────────────────────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink-soft);
  white-space: nowrap;
}
.pill-muted { color: var(--ink-faint); }
.pill-ok { border-color: var(--ok); color: var(--ok); background: var(--accent-soft); }
.pill-warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.pill-crit { border-color: var(--crit); color: var(--crit); background: var(--crit-soft); }

/* ── Tables ──────────────────────────────────────────────────────────────── */

/* Positioned, so a table's screen-reader-only labels (absolutely placed) are
   laid out inside the scroller: otherwise they sit at the table's full width
   and the whole page scrolls sideways on a narrow screen (Model routing did,
   at 810px, on a 390px phone). */
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); position: relative; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  white-space: nowrap;
}
td { padding: 10px 12px; border-top: 1px solid var(--rule); vertical-align: top; }

/* Run again, in the Runs list's Outcome cell (workbench/_run_again.html). The
   outcome and the control share the cell so a row stays six columns wide; the
   cell is given a floor and the panel a ceiling, so a confirmation sentence
   wraps inside the cell rather than stretching the table past a 1366px screen. */
td.outcome { min-width: 13rem; }
.rerun { margin-top: 6px; max-width: 26rem; }
.rerun p { margin: 4px 0 0; }
.rerun-confirm { padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.rerun-confirm .row { margin-top: 6px; }
.rerun-says { font-size: 0.86rem; }
.btn-compact { padding: 3px 10px; font-size: 0.84rem; }
/* A row's own header cell, for a row named by long text (a patent with the
   reason it cannot be searched, a case name). It stays a `th` for screen
   readers but reads like the row's other cells: the column headers' small
   grey capitals on one line made the litigation table 1,600px wide, pushed
   its Title column off-screen and turned case names into the faintest text
   on the page. */
th.rowhead {
  font-size: inherit;
  text-transform: none;
  letter-spacing: normal;
  color: inherit;
  background: none;
  white-space: normal;
  padding: 10px 12px;
  border-bottom: 0;
  border-top: 1px solid var(--rule);
  vertical-align: top;
}
th.rowhead .hint { font-weight: 400; }
tbody tr:hover { background: var(--surface); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* The assignee cleanup (deliverables/_assignee_workspace.html). A group's
   Decide panel is the row below it, across the table, shown while the
   group's Decide is open: inside the last cell it ran past the card and
   squeezed "Shown as" and the notes to a word a line. The merge bar stays in
   view while the table scrolls, and the row a decision scrolls to stops
   below it. The workspace replaces itself on every decision, so the scroll is
   not re-anchored on what follows it. */
#assignee-workspace { overflow-anchor: none; }
/* Positioned, so the table's screen-reader-only labels (absolutely placed)
   scroll inside it: they widened a phone's page to the table's width. */
#assignee-workspace .tablewrap { position: relative; }
.assignee-table .decide-row { display: none; }
.assignee-table tr:has(details.decide[open]) + .decide-row { display: table-row; }
.assignee-table .decide-row > td { border-top: 0; background: var(--surface); }
.assignee-table .decide-row input[type="text"] { width: auto; max-width: 100%; }
.assignee-table .decision-cell { min-width: 7.5rem; }
/* A long spelling wraps rather than pushing Decide past the card's edge. */
.assignee-table td > .nowrap > code { white-space: normal; overflow-wrap: anywhere; }
#assignee-focus { scroll-margin-top: 9rem; }
.merge-bar { position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 6px rgb(0 0 0 / 0.06); }
.tick-kept { display: inline; font-weight: 400; margin: 0; }
.team-block { margin-top: 8px; }
.team-block > summary { cursor: pointer; color: var(--ink-soft); font-size: 0.9rem; }
.team-block .choice { margin: 4px 0; }
/* A checkbox and what it does, on one line (deliverables/studio.html). As a
   wrapping row the long text dropped below the box, all of it in a label's
   bold. */
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.choice > input { margin-top: 3px; flex: 0 0 auto; }
.choice > span { flex: 1; min-width: 0; }

/* ── Forms and controls ──────────────────────────────────────────────────── */

input[type="text"], input[type="email"], input[type="search"],
input[type="number"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 7px 10px;
  width: 100%;
  max-width: 100%;
}
textarea { min-height: 8rem; resize: vertical; }
label { display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--crit); }
/* A category card holding a field a refused save named. */
.card.card-error { border-color: var(--crit); }
.error-text { color: var(--crit); font-size: 0.84rem; margin-top: 4px; }
/* Something the analyst has to know that did not fail: a run that finished and
   is narrower than it looks, which reads wrong in the colour of an error. */
.warn-text { color: var(--warn); font-size: 0.84rem; margin-top: 4px; }

/* The Studio's two panels (deliverables/_sections.html, _insights_workspace.html)
   answer every change by replacing themselves. Without `overflow-anchor: none`
   Chrome re-anchors the scroll on the content below the replaced panel and the
   page jumps to its foot, away from the button just pressed. */
#sections-panel, #insights-workspace { overflow-anchor: none; }
/* A box changed and not saved says so; the page script sets `data-dirty`. */
.unsaved-note { display: none; }
form:has([data-dirty="true"]) .unsaved-note { display: inline; color: var(--warn); font-weight: 600; }
input[data-dirty="true"], textarea[data-dirty="true"] { border-color: var(--warn); }
.just-added { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The insight editor: the text at the weight and size it has on the report,
   and the reference titles in the tick list not in a label's bold. */
.insight-text { font-size: 1rem; font-weight: 400; }
.cite-choice { font-weight: 400; }
/* "Add a question" puts each field inside its caption's label; what is typed
   and chosen reads at the body's weight and size, as the question rows above
   do, not in the caption's small bold. */
#add-question label > input[type], #add-question label > select { font-size: 15px; font-weight: 400; }
dl.facts { margin: 6px 0 0; font-size: .84rem; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
dl.facts dt { color: var(--ink-soft); }
dl.facts dd { margin: 0; }
dl.facts ul { margin: 0; padding-left: 1.1em; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--ground);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn-danger { color: var(--crit); border-color: var(--crit); background: var(--ground); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.linkish {
  font: inherit; background: none; border: 0; padding: 0;
  color: var(--ink-soft); cursor: pointer; text-decoration: underline;
}
.linkish:hover { color: var(--ink); }
.inline { display: inline; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 180px; }

/* Inputs default to width:100% so they fill a form field. Inside a flex row
   that reads as a 100% flex-basis and every control wraps onto its own line,
   so here the row does the sizing instead. */
.toolbar input, .toolbar select, .row > input, .row > select { width: auto; }
.toolbar form.row { flex: 1; min-width: 320px; flex-wrap: nowrap; }
.toolbar form.row input[type="search"] { flex: 1; min-width: 140px; }
.toolbar form.row select { flex: 0 0 auto; max-width: 15rem; }

@media (max-width: 700px) {
  .toolbar form.row { flex-wrap: wrap; }
}

/* ── Cards and panels ────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ground);
  padding: 18px 20px;
}
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
/* A panel that carries a problem rather than an explanation. The border and
   ground shift; the words still have to say what is wrong on their own, since
   colour is not read by everyone. */
.panel-crit { border-color: var(--crit); background: var(--crit-soft); }
/* A panel that says something is not done yet: nothing is wrong, but what the
   analyst expects to work does not work until they act. */
.panel-warn { border-color: var(--warn); background: var(--warn-soft); }

.empty {
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
/* An empty state under a section heading uses h3, so the page's heading order
   still reads top to bottom; both sit flush with the top of the box. */
.empty h2, .empty h3 { margin-top: 0; }

/* ── Messages ────────────────────────────────────────────────────────────── */

.messages { list-style: none; margin: 0; padding: 10px 20px; }
.message {
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
  margin-bottom: 6px;
  max-width: 1400px;
}
.message-success { border-color: var(--ok); background: var(--accent-soft); }
.message-error { border-color: var(--crit); background: var(--crit-soft); }
.message-warning { border-color: var(--warn); background: var(--warn-soft); }

.error-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--crit-soft);
  border: 1px solid var(--crit);
  color: var(--crit);
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 50;
  max-width: 90vw;
}

/* ── Progress ────────────────────────────────────────────────────────────── */

.bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}
@media (prefers-reduced-motion: reduce) {
  .bar > span { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* ── htmx feedback ───────────────────────────────────────────────────────── */

/* Only shown while a request is genuinely in flight; htmx adds the class. */
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: 0.55; }

/* ── Login ───────────────────────────────────────────────────────────────── */

.auth {
  max-width: 380px;
  margin: 10vh auto;
  padding: 0 20px;
}
.auth h1 { margin-bottom: 6px; }
.auth .card { margin-top: 22px; }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* A checkbox or radio with its text: the box beside the words, which wrap on
   their own, in body weight. As a wrapping row in a label's bold the box sat
   alone on a line above the whole text, hint included. */
label.row { flex-wrap: nowrap; align-items: flex-start; font-weight: 400; }
label.row > input[type="checkbox"], label.row > input[type="radio"] { flex: 0 0 auto; margin-top: 3px; }
label.row > span { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.muted { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Start an analysis ───────────────────────────────────────────────────── */

/* auto-fit rather than a fixed count: seven cards do not divide evenly into
   any column count, and a widow on its own row reads as a mistake. */
.analysis-grid {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.analysis-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--ground);
}
.analysis-card h2 { margin: 0; font-size: 0.98rem; }
/* The question is the reason this page exists, so it carries the emphasis the
   name would normally take. */
.analysis-question { margin: 0; color: var(--ink); font-size: 0.9rem; }
.analysis-card .btn { margin-top: auto; align-self: flex-start; }

/* Switching analysis after arriving with one chosen: available, not in the way.
   Closed by default because the common case is that the rail got it right. */
.switcher { margin-top: 28px; }
.switcher summary { cursor: pointer; color: var(--ink-soft); font-size: 0.88rem; }
.analysis-switch { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.analysis-switch li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }

/* Claim text on the Review stage. Long, pre-formatted, and the one thing on
   that screen an analyst reads rather than scans — so it gets a readable
   measure and its own scroll rather than stretching the detail pane. */
.doctext {
  max-height: 22rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: .6rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: .85rem;
  line-height: 1.5;
}

/* The console section strip (control/_nav.html). Horizontal, wraps on narrow
   screens, current section marked by weight and rule rather than colour alone
   so it survives a monochrome print and does not rely on hue to carry state. */
.console-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 0 0 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: .9rem;
}
.console-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.console-nav a:hover { color: var(--ink); text-decoration: underline; }
.console-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* The Help hub's three reference cards. A grid rather than a list because they
   are peers — an analyst comes here knowing which of the three they want. */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.cardlink {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--rule);
  transition: border-color .12s ease;
}
.cardlink:hover, .cardlink:focus-visible { border-color: var(--accent); }
.cardlink h3 { margin: 0 0 6px; color: var(--accent); }
.cardlink p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* A category node's fields, collapsed by default (analysis/_categories_node.html).
   The summary is a quiet control: the node's own header row above it is what an
   analyst reads when scanning the taxonomy's shape. */
.node-fields > summary { cursor: pointer; padding: 4px 0; }
.node-fields[open] > summary { margin-bottom: 8px; }

/* Status filters on the job queue (control/_jobs_recent.html). Same shape as
   the console section strip: current marked by weight and rule, not hue. */
.filters { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .9rem; }
.filters a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.filters a:hover { color: var(--ink); text-decoration: underline; }
.filters a[aria-current="page"] {
  color: var(--ink); font-weight: 600; border-bottom-color: var(--accent);
}

/* The overview's summary tiles (projects/dashboard.html). A count and the thing
   it counts, so the number is what the eye lands on and the label is what makes
   it mean something. `tabular-nums` because these sit in a row and digits of
   different widths make a tidy row look accidental. */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-n {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--ink-soft); font-size: .92rem; }

/* ── Courses (courses/index.html, courses/lesson.html) ────────────────────── */

/* The video and its chapters side by side, the transcript under both. The
   chapters are the video's table of contents, so they stay next to it on a
   wide screen and fall under it on a narrow one. */
.course {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 24px;
  margin: 16px 0 28px;
  align-items: start;
}
.course-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); }
.course-chapters h2, .course-transcript h2 { font-size: 1.05rem; margin: 0 0 8px; }
.chapter-list, .transcript-list { list-style: none; margin: 0; padding: 0; }
.chapter-list { border: 1px solid var(--rule); border-radius: var(--radius); }
.transcript-list {
  position: relative;       /* the box the script scrolls: its lines' offsetTop is measured from it */
  max-height: 24rem;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
/* A chapter and a line are both "go to this moment" buttons that read as rows.
   The current one is marked by a bar and a tint, not by hue alone. */
.chapter, .line {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
li:last-child > .chapter, li:last-child > .line { border-bottom: 0; }
.chapter:hover:not(:disabled), .line:hover:not(:disabled) { background: var(--surface); }
.chapter:disabled, .line:disabled { cursor: default; }
.chapter .mono, .line .mono { flex: none; min-width: 3em; color: var(--ink-faint); }
.chapter-current, .line-current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.course-transcript { margin-bottom: 24px; }
.course-transcript .field { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.course-transcript input[type="search"] { max-width: 24rem; }
/* A pill's own display beats the browser's rule for [hidden], so the empty
   progress badge on a lesson not yet started would show as a bare pill. */
.pill[hidden] { display: none; }
.course-nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin: 24px 0; }
@media (max-width: 880px) {
  .course { grid-template-columns: 1fr; }
}
