/* ===========================================================================
   Turma shared design system  —  single source of truth for tokens + the
   components common to every page (index / sessions / history / login).
   Warm-paper + blue palette (unchanged); Lumen-style discipline & polish:
   self-hosted Space Grotesk + Inter, a 4px scale, glowing "status lights",
   solid primary buttons, and unified focus rings.
   Page-specific layout still lives inline in each HTML file.
   =========================================================================== */

/* ---- Fonts (self-hosted, variable, latin) -------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  /* warm-paper palette (light) */
  --page:        #f9f9f7;
  --surface:     #fcfcfb;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #898781;
  --hairline:    #e1e0d9;
  --border:      rgba(11,11,11,0.10);
  --accent:      #2a78d6;
  --field:       #ffffff;

  /* semantic (shared across both themes — do not redefine in dark) */
  --good:        #0ca30c;
  --warning:     #fab219;
  --critical:    #d03b3b;

  /* status TEXT on a surface (XERK-1571): the semantic colours above are fills
     and dots; as small text on the dark surface three of them drop under 4.5:1,
     so text takes these, which step up in dark only (light = the fill colour).
     Amber is the exception: as text on the light surface it is under 2:1, so
     light steps it DOWN to a dark amber (4.7:1 on the most-tinted org card). */
  --good-text:     var(--good);
  --accent-text:   var(--accent);
  --critical-text: var(--critical);
  --warning-text:  #8a5a00;

  /* validated categorical chart slots — fixed order, never cycled (history) */
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #008300;
  --s5: #4a3aa7; --s6: #e34948; --s7: #e87ba4; --s8: #eb6834;

  /* derived accent washes (auto-adapt: recomputed from --accent per theme) */
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --focus-ring:  color-mix(in srgb, var(--accent) 30%, transparent);

  /* type */
  --font-sans:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, monospace;

  /* spacing (4px base) + radii + elevation */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 40px; --space-8: 48px;
  --radius-sm: 8px; --radius-md: 11px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10);

  /* per-page content width (sessions narrows this; the board widens its own
     column area to --wrap-board — see .wrap.board-page below) */
  --wrap: 1180px;
  --wrap-board: 1640px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:      #0d0d0d;
    --surface:   #1a1a19;
    --ink:       #ffffff;
    --ink-2:     #c3c2b7;
    --muted:     #898781;
    --hairline:  #2c2c2a;
    --border:    rgba(255,255,255,0.10);
    --accent:    #3987e5;
    --field:     #111110;
    /* status text, stepped up to clear 4.5:1 on an org-tinted dark card */
    --good-text:     #4cc94c;
    --accent-text:   #78aef2;
    --critical-text: #f08080;
    --warning-text:  #fab219;
    /* same hues, stepped for the dark surface (validated as a set) */
    --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #008300;
    --s5: #9085e9; --s6: #e66767; --s7: #d55181; --s8: #d95926;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 2px 10px rgba(0,0,0,0.30);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  }
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }

/* No app page scrolls its DOCUMENT: each is one viewport tall (`body.app-shell`,
   or sessions.html's own shell) with the header fixed on top and the content
   scrolling in its own pane below it, so a scrollbar never runs beside the
   header. The header is therefore centred in the full window on every page, and
   the scroll pane reserves its gutter on BOTH edges so its content stays centred
   on that same line whether or not it currently overflows. Once the window is too
   narrow for the centred column plus both gutters (1180 + 2×10), the content
   and header both run edge to edge instead, so the gutter goes on the right only
   and their LEFT edges line up; a left gutter there would indent the content off
   the header's. Between 1180 and 1200 neither choice lines up exactly, so the
   switch sits at the 1190 midpoint, which caps the offset at 5px. Phones overlay
   their scrollbars, so no gutter at all there. nav.js routes scroll keys to the
   pane when nothing is focused, so keyboard scrolling works without a click. */
body.app-shell {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
}
.page-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto; scrollbar-gutter: stable both-edges;
}
@media (max-width: 1190px) { .page-scroll { scrollbar-gutter: stable; } }

/* Every scrollbar in the UI is a thin, theme-coloured thumb on a transparent
   track, rather than the platform's grey default. `scrollbar-color` is inherited,
   so setting it on `html` reaches every scroller; `scrollbar-width` is not, hence
   `*`. Only Firefox gets those standard properties: Chrome 121+ also supports
   them, but once they are set it ignores `::-webkit-scrollbar` and draws its
   own thin bar WITH arrow buttons on Windows/Linux, so Chromium and Safari are
   styled through the `::-webkit-scrollbar` rules instead, which draw no buttons.
   `-moz-appearance` is the Firefox-only feature test that keeps them apart.
   So never set `scrollbar-width`/`scrollbar-color` on an individual scroller:
   in Chromium that alone reverts it to the arrowed platform bar. */
:root {
  --scrollbar:       color-mix(in srgb, var(--ink) 22%, transparent);
  --scrollbar-hover: color-mix(in srgb, var(--ink) 38%, transparent);
}
@supports (-moz-appearance: none) {
  html { scrollbar-color: var(--scrollbar) transparent; }
  * { scrollbar-width: thin; }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar); background-clip: padding-box;
  border: 2px solid transparent; border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-hover); }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); }

/* The page's content column. Its top padding lives on .site-header-in above,
   which sits outside .wrap so the header can be full-bleed. */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px 48px; }

/* The board's Kanban strip is a row of FIXED 300px columns (see .kanban-col),
   so at the shared 1180px --wrap a fourth/fifth column is scrolled off-screen
   long before a wide monitor runs out of room. The board page widens ONLY its
   content column to --wrap-board so those columns can show without scrolling
   (XERK-606). The site header is unaffected — it lives OUTSIDE .wrap and caps
   its own row at --wrap (see .site-header-in), so it stays put at every width.
   The toolbar is re-centred back at the reading width so its buttons still sit
   above the header's right edge; it stays centred in the viewport at --wrap
   exactly as the header does, since the wide .wrap is itself centred. Only
   #board takes the extra width. */
.wrap.board-page { max-width: var(--wrap-board); }
.wrap.board-page > .board-bar { max-width: var(--wrap); margin-inline: auto; width: 100%; }

/* The board page is an .app-shell with no .page-scroll: the page never
   scrolls, the strip takes whatever height the header and toolbar leave, each column
   stretches to it and its card list scrolls inside it (see .kanban-col below).
   That keeps the strip's horizontal scrollbar on screen at the bottom of the
   window — uncapped, a long column made the strip taller than the window and
   parked that scrollbar below the fold. Flex, not a `calc(100dvh - N)` guess, so
   a wrapped toolbar can't push the strip off the bottom. On a window too short
   for the lists' `min-height` floors the strip itself becomes the vertical
   scroller (its `overflow-x: auto` makes it clip both axes) — the content stays
   reachable, through a nested scroll. */
.wrap.board-page {
  flex: 1; min-height: 0; width: 100%; padding-bottom: 16px;
  display: flex; flex-direction: column;
}
.wrap.board-page > * { flex: none; }
.wrap.board-page > #board {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
#board > * { flex: none; }
#board > .kanban-cols { flex: 1; min-height: 0; align-items: stretch; }

h1 { font-size: 20px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---- Site header: identical on every page, built by nav.js ---------------
   Full-bleed, with its row capped at --wrap and centred, so it lands in the
   same 1180px column as a page's content and reads identically everywhere —
   including sessions.html, whose shell below is full-bleed while its header
   row is not. It carries no page-specific text. It stays put because no page
   scrolls its document — see `.app-shell` in Base. */
.site-header { flex: none; margin-bottom: 20px; }
.site-header-in {
  max-width: var(--wrap); margin: 0 auto; padding: 24px 20px 0;
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
}
.site-header .spacer { flex: 1; }

/* ---- New ticket (#hdrNewTicket, built by newticket.js) -------------------
   The tracker's one write control, in the chrome so a ticket can be created
   from any page (XERK-150) — it moved out of the board toolbar. A filled accent
   pill, so the primary action reads as primary beside the quiet org filter.
   Collapses to nothing until the fleet reports an org to create against, like
   the org slot below. */
.site-header .newticket-slot:empty { display: none; }
.newticket-btn {
  font: inherit; font-size: 12.5px; padding: 5px 12px; cursor: pointer;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; flex: none;
}
.newticket-btn svg { width: 13px; height: 13px; flex: none; }
.newticket-btn:hover { filter: brightness(1.06); }

/* ---- Org filter (#hdrOrg, built by org.js) -------------------------------
   The one org-scoping control, in the chrome because every page obeys it
   (XERK-62) — it replaced the board-only chip strip. Collapses to nothing when
   no host reports a tracker org. */
.site-header .org-slot:empty { display: none; }
.org-filter { position: relative; display: inline-flex; }
.org-btn {
  font: inherit; font-size: 12.5px; padding: 5px 12px; cursor: pointer;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  --org: var(--muted);
}
.org-btn:hover { color: var(--ink); }
.org-btn.scoped { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.org-btn .org-dot { display: none; }
.org-btn.scoped .org-dot { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--org); flex: none; }
/* Multi-select (XERK-222): one dot per selected org — pull the dots after the
   first back so they read as a compact cluster, not a row of gapped beads. */
.org-btn.scoped .org-dot + .org-dot { margin-left: -4px; }
.org-btn .org-chev { color: var(--muted); font-size: 10px; }
/* The menu. Right-aligned under the button (on desktop the button sits at the
   right edge of the header row, so a left-aligned panel would hang off-screen).
   The phone override below flips that — see the media query. */
.org-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  min-width: 220px; max-width: calc(100vw - 24px); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 4px; display: flex; flex-direction: column; gap: 2px;
}
/* One row per org: the scope pick, and the org's auto-start switch (XERK-41) —
   the two segments the board's chips carried, laid out as a list row. A button
   can't nest a button, so the row is a plain container. */
.org-row {
  /* flex-shrink: 0 — `overflow: hidden` zeroes a flex item's min-height, so with
     many orgs the rows squashed to a few px instead of scrolling the menu (XERK-1285). */
  display: flex; align-items: stretch; border-radius: 999px; overflow: hidden; flex-shrink: 0;
  --org: var(--muted);
}
.org-row:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.org-row.active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.org-row-main {
  font: inherit; font-size: 12.5px; padding: 6px 10px; cursor: pointer;
  color: var(--ink-2); background: transparent; border: none; text-align: left;
  display: inline-flex; align-items: center; gap: 7px; flex: 1; min-width: 0;
}
.org-row-main .org-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--org); flex: none; }
.org-row-main .org-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-row-main:hover { color: var(--ink); }
.org-row.active .org-row-main { color: var(--accent); font-weight: 600; }
.org-row-main .chip-n { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.org-row-main .chip-stale { color: var(--warning-text); font-size: 11px; }
/* The color-chip segment (XERK-145): the org's current dot, opening the swatch
   strip below its row. Divided from the pick like the auto segment. */
.org-chip-color {
  font: inherit; padding: 5px 9px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: none; border-left: 1px solid var(--border); border-radius: 0;
  display: inline-flex; align-items: center; flex: none;
}
.org-chip-color .org-color-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--org); flex: none;
  box-shadow: 0 0 0 1px var(--border);
}
.org-chip-color:hover .org-color-dot, .org-chip-color[aria-expanded="true"] .org-color-dot {
  box-shadow: 0 0 0 2px var(--accent);
}
/* The swatch strip an org row expands into: one swatch per palette slot, plus
   the "auto" release back to the hash-assigned color. */
.org-swatch-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 6px;
}
.org-swatch {
  width: 16px; height: 16px; border-radius: 50%; cursor: pointer; padding: 0;
  background: var(--org); border: 1px solid var(--border); flex: none;
}
.org-swatch:hover { box-shadow: 0 0 0 2px var(--accent); }
.org-swatch.picked { box-shadow: 0 0 0 2px var(--accent); }
.org-swatch-auto {
  font: inherit; font-size: 11px; padding: 1px 8px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; flex: none;
}
.org-swatch-auto:hover { color: var(--ink); }
.org-swatch-auto.picked { color: var(--accent); border-color: var(--accent); }
/* The auto-start toggle segment, divided from the pick by an inner border. */
.org-chip-auto {
  font: inherit; font-size: 11px; padding: 5px 10px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: none; border-left: 1px solid var(--border); border-radius: 0;
  display: inline-flex; align-items: center; gap: 5px; flex: none;
}
.org-chip-auto:hover:not(:disabled) { color: var(--ink); }
.org-chip-auto .org-auto-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.org-chip-auto.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.org-chip-auto.on .org-auto-dot { background: var(--accent); box-shadow: 0 0 5px var(--accent); }

/* Global focus: keyboard users get a clear accent ring; mouse clicks don't. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Brand wordmark (icon + "Turma") — reused in every page header ------- */
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  letter-spacing: -0.01em; line-height: 1;
}
.wordmark img { width: 26px; height: 26px; border-radius: 7px; display: block; }
.wordmark:hover { color: var(--ink); }

/* ---- Page nav: pill tabs (wide) + fixed bottom bar (phones) -------------- */
/* Wraps rather than running off the right edge: the header row is already
   flex-wrap, but without min-width:0 + wrap here a narrow window (601–850px)
   pushed Sign out past the viewport, unreachable where body hides overflow. */
.nav-tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.nav-tabs a {
  white-space: nowrap;
  color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 5px 12px; border-radius: 20px; transition: color .12s, background .12s;
}
.nav-tabs a:hover { color: var(--accent); background: var(--accent-soft); }
.nav-tabs a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
/* The active tab is bolder, which made it wider, so the right-aligned row (and
   the org + New-ticket buttons left of it) moved by a pixel or two between
   pages. Each tab stacks an invisible bold copy of its label (nav.js's
   data-label) under the real one, so every tab is always its bold width. */
.nav-tabs a[data-label] { display: inline-grid; }
.nav-tabs a[data-label]::after {
  content: attr(data-label); font-weight: 600;
  height: 0; overflow: hidden; visibility: hidden; pointer-events: none; user-select: none;
}
.nav-tabs a.help, .nav-tabs a.signout { color: var(--muted); background: none; }
.nav-tabs a.help { margin-left: 6px; }
.nav-tabs a.help:hover { color: var(--accent); background: var(--accent-soft); }
.nav-tabs a.signout:hover { color: var(--critical); background: none; }
.bottom-nav { display: none; }
/* An admin-only account's explanation (XERK-2553, nav.js adminOnlyNoteHtml), and
   an admin's reset of this account's password (XERK-2630, passwordResetNoteHtml),
   and the billing state (XERK-3151, billingNoteHtml). */
.admin-only-note, .password-reset-note, .link-signin-note, .billing-note {
  width: calc(100% - 40px); max-width: calc(var(--wrap) - 40px); margin: 12px auto 10px;
  padding: 10px 14px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--ink-2); font-size: 13px; line-height: 1.45;
}
.billing-note { border-color: var(--warning); color: var(--warning-text); }
.billing-note.critical { border-color: var(--critical); color: var(--critical-text); }
.link-signin-note a { color: var(--accent-text); }

/* ---- Buttons ------------------------------------------------------------- */
button {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  transition: background .12s, border-color .12s, color .12s, filter .12s;
}
button:hover:not(:disabled) { border-color: var(--ink-2); }
/* solid primary — the one clear "go" action per surface */
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
button.primary:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.07); }
/* destructive: outline until armed, then fills */
button.confirm, button.kill-btn { border-color: var(--critical); color: var(--critical); font-weight: 600; background: transparent; }
button.confirm:hover:not(:disabled), button.kill-btn:hover:not(:disabled) { border-color: var(--critical); filter: brightness(1.03); }
button.kill-btn.armed { background: var(--critical); color: #fff; border-color: var(--critical); }
button.btn-sm { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: default; }

/* ---- Form controls ------------------------------------------------------- */
input, textarea, select { font: inherit; color: var(--ink); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---- Badges (pill) ------------------------------------------------------- */
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap;
}
.badge.running { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge.stopped { color: var(--muted); }
.badge.error { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 10%, transparent); }
/* Optimistic "being taken down" badge — shown the instant a kill is confirmed,
   before the agent has acted. Its inline spinner spins in the critical hue. */
.badge.stopping { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 10%, transparent); display: inline-flex; align-items: center; gap: 5px; }
.badge.stopping .spin { width: 9px; height: 9px; border-width: 2px; border-top-color: var(--critical); }

/* ---- PR status pill — GitHub-style state + CI-check rollup ---------------
   Rendered on the dashboard/session cards and (compact) in the chat footer.
   `prBadgeHtml()` in the page scripts builds the markup; colours track the PR
   state, the trailing ✓/✗/● reflects the CI-check rollup. */
.pr-badge {
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
  font-size: 11px; padding: 2px 8px; border-radius: 20px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--ink-2);
}
.pr-badge:hover { filter: brightness(1.08); }
.pr-badge .pr-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.pr-badge.pr-open   { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.pr-badge.pr-open   .pr-dot { background: var(--good); }
.pr-badge.pr-merged { color: var(--s5); border-color: color-mix(in srgb, var(--s5) 45%, transparent); background: color-mix(in srgb, var(--s5) 12%, transparent); }
.pr-badge.pr-merged .pr-dot { background: var(--s5); }
.pr-badge.pr-closed { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: color-mix(in srgb, var(--critical) 10%, transparent); }
.pr-badge.pr-closed .pr-dot { background: var(--critical); }
.pr-badge.pr-draft  { color: var(--muted); }
/* The merge-readiness mark: CI *and* mergeability, not CI alone (see
   _merge_ready in hub-agent.py) — hence "ready/blocked", not "passing/failing". */
.pr-badge .pr-ready { font-weight: 700; font-size: 11px; }
.pr-badge .pr-ready.ready { color: var(--good); }
.pr-badge .pr-ready.blocked { color: var(--critical); }
.pr-badge .pr-ready.pending { color: var(--warning-text); }
.pr-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Status "lights" — glowing dots (the Lumen points-of-light motif) ---- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.online,  .dot.working { background: var(--good);     box-shadow: 0 0 8px color-mix(in srgb, var(--good) 75%, transparent); }
.dot.waiting,
.dot.updating              { background: var(--warning);  box-shadow: 0 0 8px color-mix(in srgb, var(--warning) 75%, transparent); }
.dot.offline               { background: var(--critical);  box-shadow: 0 0 7px color-mix(in srgb, var(--critical) 55%, transparent); }
/* A stalled background wait (XERK-1571): the danger colour it has on every surface. */
.dot.stalled               { background: var(--critical);  box-shadow: 0 0 7px color-mix(in srgb, var(--critical) 55%, transparent); }
.dot.idle                  { background: var(--muted); }
/* Ready for review (XERK-224): work that has stopped and is waiting on YOU.
   Accent rather than the muted idle it is lifted out of — the section is a
   call to action, and the dot has to read that way beside a quiet card. */
.dot.review                { background: var(--accent);   box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 65%, transparent); }
/* Holding (XERK-1570): alive but waiting out a background shell — the working
   colour as a hollow ring, so it reads "not done" without reading "busy". */
.dot.holding               { background: none; border: 1.5px solid var(--good); box-sizing: border-box; }

/* ---- Spinner ------------------------------------------------------------- */
.spin {
  width: 11px; height: 11px; flex: none; display: inline-block;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; vertical-align: -1px; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled .spin { border-top-color: var(--ink-2); }

/* ---- Failure toast (nav.js TurmaNav.toast, every page) -------------------- */
/* A transient bottom-centre notice, raised only when the hub REFUSED something
   (XERK-264) — nothing announces success through it, so one on screen always
   means a command did not run. Lives here, not in a page, because every page
   fires commands. */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 50; max-width: min(92vw, 480px);
  background: var(--critical); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ---- Elevated surfaces (page-specific layout stays inline; look here) ----- */
.tile, .host-card, .scard, .stopped-row, .host-block, .chart-card, .kanban-card {
  box-shadow: var(--shadow-sm);
}

/* ---- Jira board (/board) -------------------------------------------------- */
/* Board toolbar: just the refresh button now, pinned right — the org chips it
   used to run alongside became the header's org filter (XERK-62), and the New
   ticket button moved into the header too (XERK-150). */
.board-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 14px; position: relative; }
.board-actions { display: flex; gap: 10px; flex: none; }

/* Search / filter / sort toolbar — the left half of the board bar. One row at
   every width: on a phone the labels fold to icons, the active-filter chips
   give way to the badge, and the page actions fold behind ⋯. */
.board-tools { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; position: relative; }
.bt-search {
  display: flex; align-items: center; gap: 7px; flex: 1 1 300px; max-width: 360px; min-width: 120px;
  height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--field); color: var(--muted); font-size: 12.5px; cursor: text;
}
.bt-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.bt-search svg { width: 13px; height: 13px; flex: none; }
.bt-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0;
  color: var(--ink); font: inherit; font-size: 12.5px;
}
.bt-search input::-webkit-search-cancel-button { display: none; }
.bt-search input::placeholder { color: var(--muted); }
.bt-kbd { font: 11px var(--font-mono); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; color: var(--muted); }
.bt-search:focus-within .bt-kbd, .bt-search:has(.bt-clear:not([hidden])) .bt-kbd { display: none; }
.bt-clear { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; line-height: 1; }
.bt-clear:hover { color: var(--ink); }
.bt-btn {
  font: inherit; font-size: 12.5px; height: 30px; padding: 0 12px; cursor: pointer;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; position: relative;
}
.bt-btn:hover { color: var(--ink); }
.bt-btn svg { width: 13px; height: 13px; flex: none; }
.bt-btn.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.bt-caret { font-size: 10px; opacity: 0.7; }
.bt-badge {
  min-width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 600; display: inline-grid; place-items: center; padding: 0 4px;
}
.bt-badge[hidden] { display: none; }
.bt-chips { display: flex; gap: 6px; min-width: 0; overflow: hidden; }
.bf-chip {
  font-size: 12px; height: 24px; padding: 0 2px 0 10px; border-radius: 999px; white-space: nowrap; flex: none;
  background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; gap: 5px;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}
.bf-chip b { font-weight: 500; color: var(--ink-2); }
.bf-chip button { border: 0; background: none; color: inherit; cursor: pointer; opacity: 0.75; font-size: 12px; padding: 0 6px; height: 100%; }
.bf-chip button:hover { opacity: 1; }
.bt-more { display: none; width: 30px; padding: 0; justify-content: center; font-size: 15px; }
.bt-pop, .bt-menu {
  position: absolute; top: calc(100% + 6px); z-index: 50; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.bt-pop[hidden], .bt-menu[hidden] { display: none; }
.bt-pop { left: 0; width: min(680px, calc(100vw - 32px)); padding: 16px 18px 12px; font-size: 12.5px; max-height: 70vh; overflow-y: auto; }
.bt-menu { width: 210px; padding: 6px; font-size: 12.5px; border-radius: var(--radius-md); }
.bf-grid { display: grid; grid-template-columns: 110px 1fr; row-gap: 11px; column-gap: 14px; align-items: start; }
.bf-l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 5px; }
.bf-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.bf-o {
  font: inherit; font-size: 12.5px; height: 25px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 5px;
  color: var(--ink-2); background: var(--field); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bf-o:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.bf-o.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.bf-o small { color: var(--muted); font-size: 11px; }
.bf-o.sel small { color: rgba(255,255,255,0.75); }
.bf-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--hairline); color: var(--muted);
}
.bf-tog { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); cursor: pointer; }
.bf-tog input { accent-color: var(--accent); margin: 0; }
.bf-link { font: inherit; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; }
.bs-mh { padding: 6px 10px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.bs-mi {
  font: inherit; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 7px 10px; border-radius: 7px; color: var(--ink-2); display: flex; justify-content: space-between;
}
.bs-mi:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.bs-mi.sel { background: var(--accent-soft); color: var(--accent); }
.bs-hr { height: 1px; background: var(--hairline); margin: 5px 4px; }
.bf-chip[hidden] { display: none; }
.bf-more { font: inherit; font-size: 12px; border: 0; cursor: pointer; padding: 0 10px; }
/* Below this the toolbar and the page actions can't share a row, so the
   chips give way to the badge and the actions fold behind ⋯. */
@media (max-width: 760px) {
  .bt-chips { display: none; }
  .bt-search { max-width: none; }
  .bt-more { display: inline-flex; }
  .board-actions { display: none; }
  .board-actions.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 6px; position: absolute; right: 0;
    top: calc(100% + 6px); z-index: 50; padding: 8px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  }
}
@media (max-width: 560px) {
  .board-tools .bt-label, .board-tools .bt-kbd { display: none; }
  .board-tools .bt-btn { width: 30px; padding: 0; justify-content: center; }
  .board-tools .bt-badge { position: absolute; top: -5px; right: -5px; }
  .bf-grid { grid-template-columns: 1fr; row-gap: 6px; }
  .bf-l { padding-top: 6px; }
}
.board-refresh {
  font: inherit; font-size: 12.5px; padding: 5px 12px; cursor: pointer;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; flex: none;
}
.board-refresh svg { width: 13px; height: 13px; flex: none; }
.board-refresh:hover:not(:disabled) { color: var(--ink); }
.board-refresh:disabled { cursor: default; color: var(--muted); }
.board-refresh.busy svg { animation: board-spin 0.9s linear infinite; }
@keyframes board-spin { to { transform: rotate(360deg); } }
/* Respect a reduced-motion preference: the label still says "Refreshing…". */
@media (prefers-reduced-motion: reduce) {
  .board-refresh.busy svg { animation: none; }
}

/* The status columns are ALWAYS one horizontal row (XERK-253) — they never wrap
   underneath each other at any width. Once four readable columns no longer fit,
   the row scrolls sideways instead of restacking, so a column sits in the same
   place on a desktop, a tablet and a phone, and the board keeps reading as a
   Kanban rather than as four stacked lists.
   The padding is room for the drop-target column's offset outline (XERK-141),
   which the scroll container would otherwise clip; the negative margin gives it
   back so the strip still lines up with the rest of the page's content. The
   matching `scroll-padding` keeps that room ON SCREEN — without it a snap (or a
   keyboard scrollIntoView) parks the first column flush against the scrollport
   and the padding is simply scrolled out of sight, insetting the phone strip by
   half what it used to be. */
.kanban-cols {
  display: flex; gap: 12px; align-items: start;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 6px; margin: -6px -6px 0; scroll-padding: 6px;
}
/* A column is a FIXED 300px at every viewport — it does not grow into a wide
   board and does not shrink as the window narrows, so a card is the same size in
   the hand as on the desk and the board never re-flows under you. 300 is
   Android's `.width(300.dp)`, which makes the two surfaces the same layout and
   not merely the same shape. Four of them exceed the 1180px content column, so
   the desktop board scrolls a little even at full width: that is the intended
   trade, not a fallback. `min-width: 0` replaces a flex item's automatic
   min-content minimum, which would otherwise let one long card widen a column
   past 300 and undo the whole point. */
.kanban-col { flex: 0 0 300px; min-width: 0; }
.kanban-col .kc-head {
  font-weight: 600; font-size: 13px; color: var(--ink-2);
  padding: 2px 4px 8px; display: flex; align-items: center; gap: 8px;
}
.kanban-col .kc-count {
  color: var(--muted); font-weight: 400; font-size: 11.5px;
  font-variant-numeric: tabular-nums; background: var(--page);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 1px 7px;
}
.kanban-col .kc-list { display: flex; flex-direction: column; gap: 8px; }
.kanban-col .kc-none { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0; border: 1px dashed var(--hairline); border-radius: var(--radius-md); }
.kanban-done .kanban-card { opacity: 0.72; }
/* The Triage lane (XERK-486 [F]) is a view, not a tracker column: a dashed
   top rule keeps it visually apart from the real status columns beside it. */
.kanban-col.kanban-triage > .kc-head {
  border-bottom: 1px dashed var(--hairline); padding-bottom: 6px;
}

.kanban-card {
  /* Subtle, opaque org tint (XERK-142): --org (var(--sN), set inline per card)
     mixed a little way into --surface, so the card's org reads at a glance without
     the colour overwhelming it. Falls back to plain surface when no org is set. */
  background: color-mix(in srgb, var(--org, var(--surface)) 12%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 9px 11px 10px;
}
.kanban-card .kc-top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.kanban-card .kc-key { font-family: var(--font-mono); font-weight: 600; color: var(--accent); text-decoration: none; }
.kanban-card .kc-key:hover { text-decoration: underline; }
.kanban-card .kc-type { color: var(--muted); }
.kanban-card .kc-age { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.kanban-card .kc-summary { font-size: 13px; color: var(--ink); margin: 4px 0 7px; line-height: 1.35; overflow-wrap: anywhere; }
.kanban-card .kc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; font-size: 11px; }
.jira-status {
  display: inline-flex; align-items: center; padding: 1.5px 8px;
  border-radius: 999px; font-weight: 600; font-size: 11px; color: var(--ink-2);
  border: 1px solid var(--border); background: var(--page);
}
/* Shared with the ticket detail panel, which reuses the card's pills. */
.kc-prio { color: var(--muted); }
.kc-prio.prio-high { color: var(--critical); font-weight: 600; }
.kc-prio.prio-low { color: var(--muted); }
.kc-due { color: var(--muted); }
.kc-due.overdue { color: var(--critical); font-weight: 600; }
/* The agent's triaged repo for a ticket. Cloned repos read as solid/actionable;
   an uncloned one is dashed (it's a real answer, but you'd clone it first); "no
   repo" recedes to muted — it's the absence of a suggestion, not a suggestion. */
/* inline-block, NOT inline-flex: as a flex item of .kc-meta this blockifies, and
   text-overflow can only ellipsise a block's text — inside a flex container the
   name is anonymous flex content and gets hard-cut mid-letter instead. */
.kc-repo {
  display: inline-block; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  color: var(--ink-2); font-family: var(--font-mono); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Only the card is tight enough to need a TIGHT cap; the detail panel has more
   room — but not unlimited. Uncapped, an ordinary long repo directory name
   overflowed the detail panel's field column and painted on top of the AGENT
   column beside it (XERK-235). 100% keeps it inside whatever column it is in. */
.kanban-card .kc-repo { max-width: 15ch; }
.td-field .kc-repo, .td-fields .kc-repo { max-width: 100%; }
.kc-repo.kc-repo-uncloned { border-style: dashed; color: var(--muted); }
.kc-repo.kc-repo-none {
  border: 0; background: none; padding: 0; color: var(--muted);
  font-style: italic; font-family: var(--font-sans);
}
/* Likely-duplicate chip (XERK-484). Same chip metrics as .kc-repo; the warning
   tint marks a ticket the classifier considers a duplicate, and the link target
   is the twin ticket it duplicates. */
.kc-dup {
  display: inline-block; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  color: var(--warning-text); font-family: var(--font-mono); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 15ch;
}
.kc-dup a { color: inherit; text-decoration: none; }
/* The operator's triage verdict (XERK-486 [F]): same chip metrics as .kc-dup;
   the verdict outranks the model's triage, so it gets its own tint — green for
   an explicit approve, amber for hold (the card parks in the Triage lane), red
   for reject. */
.kc-triage {
  display: inline-block; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  font-family: var(--font-mono); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 15ch;
}
.kc-triage-approve { color: var(--good); border-color: var(--good); }
.kc-triage-hold { color: var(--warning-text); border-color: var(--warning); }
.kc-triage-reject { color: var(--critical); border-color: var(--critical); }
/* Epic auto-orchestration (XERK-638). An epic is an organizer, not a work
   ticket: a solid accent "EPIC" badge distinguishes it, and a work ticket that
   belongs to one carries a dim monospace ⧉<epicKey> chip. Same chip metrics as
   .kc-dup so the meta row reads as one family. */
.kc-epic-badge {
  display: inline-block; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--accent-soft);
  color: var(--accent); font-family: var(--font-mono); font-size: 10px;
  font-weight: 700; letter-spacing: .06em; white-space: nowrap;
}
.kc-epic-child {
  display: inline-block; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border); background: var(--page);
  color: var(--muted); font-family: var(--font-mono); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 15ch;
}
/* The epic's Start-run button, in place of the per-ticket Start it never has.
   Reuses .kc-start metrics via its own class so it can accent-tint. */
.kc-epic-start {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); background: var(--page);
  color: var(--accent); font: inherit; font-size: 10.5px; line-height: 1.5;
  cursor: pointer; white-space: nowrap; font-weight: 600;
}
.kc-epic-start:hover:not(:disabled) { background: var(--accent-soft); }
.kc-epic-start:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
/* The armed-run progress chip: state-tinted, opens the detail panel on card
   click for the full wave breakdown. */
.kc-epic-run {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.5;
  white-space: nowrap;
}
.kc-epic-run.kc-epic-running { color: var(--accent); border-color: var(--accent); }
.kc-epic-run.kc-epic-blocked { color: var(--warning-text); border-color: var(--warning); }
.kc-epic-run.kc-epic-done { color: var(--good); border-color: var(--good); }
.kc-epic-run.kc-epic-paused { color: var(--muted); border-color: var(--muted); }
/* Start-a-session-on-this-ticket, and the sessions it started. Both sit in
   .kc-meta between the repo chip and the org, i.e. before the margin-left:auto
   that pins .kc-org right. */
.kc-start {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  color: var(--ink-2); font: inherit; font-size: 10.5px; line-height: 1.5;
  cursor: pointer; white-space: nowrap;
}
.kc-start:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.kc-start:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
/* Not cloned / no online host: the ticket has a repo, so the button stays put
   and says why rather than vanishing. */
.kc-start:disabled { opacity: .5; cursor: not-allowed; }
/* Once the ticket has a session, starting ANOTHER is the rare case — shrink it
   to a "+" so it stops competing with the session chips for the card's width. */
.kc-start.kc-start-more { padding: 1px 6px; font-weight: 600; color: var(--muted); }
.kc-start.kc-start-busy { color: var(--muted); border-style: dashed; cursor: default; }
/* A ticket waiting in the hub's queue for a free session slot (XERK-296). Same
   chip metrics as the start button it replaces, dashed like the other "not a
   thing yet" states; the ✕ beside it takes the ticket back out of the line. */
.kc-queued {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border); background: var(--page);
  color: var(--muted); font-size: 10.5px; line-height: 1.5; white-space: nowrap;
}
.kc-queued.kc-queued-blocked { color: var(--warning-text); border-color: var(--warning); }
.kc-unqueue {
  padding: 1px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  color: var(--muted); font: inherit; font-size: 10.5px; line-height: 1.5;
  cursor: pointer;
}
.kc-unqueue:hover { border-color: var(--critical); color: var(--critical); }
.kc-unqueue:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.kc-start-err {
  color: var(--critical); font-size: 10.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch;
}
/* A session working this ticket. Same chip metrics as .kc-repo so a card's meta
   row reads as one family; the dot carries the run state. */
.kc-sess {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  padding: 1px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--page);
  color: var(--ink-2); font-family: var(--font-mono); font-size: 10.5px;
  text-decoration: none; max-width: 22ch;
}
/* The name ellipsises on its own element, not on .kc-sess: text-overflow can
   only clip a BLOCK's text, and inside the flex chip a bare label would be
   anonymous flex content and get hard-cut mid-letter. Same trap as .kc-repo. */
.kc-sess .kc-sess-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-sess:hover { border-color: var(--accent); color: var(--accent); }
.kc-sess-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); flex: none; }
.kc-sess.kc-sess-off { color: var(--muted); }
.kc-sess.kc-sess-off .kc-sess-dot { background: var(--muted); }
.kc-sess.kc-sess-err { color: var(--critical); border-color: var(--critical); }
.kc-sess.kc-sess-err .kc-sess-dot { background: var(--critical); }
/* A session that closed its own ticket (XERK-1569): the chip's label becomes
   its reason ("not reproducible", "already fixed", or "closed") in the chip's
   normal ink, with a neutral dot — never the green running one, even while the
   session is still up. It stays inside the 22ch name cap on one line, so the
   card's org tag never wraps onto a row of its own. */
.kc-sess.kc-sess-closed .kc-sess-dot { background: var(--muted); }
/* On that card the closing session's chip, the start control and the org tag
   wrap as one unit (board.js cardHtml), filling the rest of their row so the
   org tag still sits flush right — and never alone on a row of its own. */
.kanban-card .kc-tail {
  display: inline-flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center;
  gap: 5px 7px; min-width: 0;
}
.kc-org {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-family: var(--font-mono); font-size: 10.5px;
  --org: var(--muted);
}
.kanban-card .kc-org { margin-left: auto; }
.kc-org::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--org); flex: none; }
.kc-note { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.kc-note.kc-err { color: var(--warning-text); }

/* The whole card opens the detail panel (the kc-key link still goes to Jira). */
.kanban-card[role="button"] { cursor: pointer; }
.kanban-card[role="button"]:hover { border-color: var(--accent); }
.kanban-card[role="button"]:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Drag-and-drop status change (XERK-141). Tap-and-hold a card, drag it onto
   another status column, and it moves there. A floating ghost follows the
   pointer, the source card dims, and the drop-target column lights up. */
.kc-moving { color: var(--muted); font-size: 10.5px; font-style: italic; }
.kc-move-err { color: var(--critical); font-size: 10.5px; }
.kanban-card.kc-moving-card { opacity: .6; }
.kanban-card.kc-drag-src { opacity: .3; }
.kanban-col.kc-drop-into {
  outline: 2px dashed var(--accent); outline-offset: 4px;
  border-radius: var(--radius-md); background: var(--focus-ring);
}
.kc-ghost {
  position: fixed; left: 0; top: 0; z-index: 60; margin: 0; pointer-events: none;
  opacity: .96; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); transition: none;
}
/* While a drag is active kill text selection, and let the captured card own the
   gesture (touch-action:none) rather than scrolling the column strip under it. */
body.kc-drag-on { user-select: none; -webkit-user-select: none; }
body.kc-drag-on .kanban-card { touch-action: none; }

/* Each column fills the strip's height (it is stretched by .board-page's flex
   layout above) and its card list scrolls inside it, so a long column never
   makes the page scroll. The `min-height` floor keeps a list usable on a very
   short window, at the cost of the page scrolling there. The list's `flex` is
   set on the bare `.kc-list`, never through `.kanban-col`, so the one rule that
   sizes a column stays the only one that can (board.test.js pins that). */
.kanban-col { display: flex; flex-direction: column; min-height: 0; }
.kc-list { flex: 1; min-height: 96px; }
.kanban-col .kc-list { overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }

/* On phones the strip also gets swipe manners (XERK-24). The column keeps its
   fixed 300px here too — on a typical phone that still leaves a peek of the next
   one, which is what signals the row swipes — and the row scroll-snaps to it. */
@media (max-width: 560px) {
  .kanban-cols { gap: 10px; scroll-snap-type: x proximity; }
  .kanban-col { scroll-snap-align: start; }
  .kanban-col .kc-head { padding: 2px 2px 6px; }
}

/* ---- Expanded ticket detail (board) ------------------------------------- */
.td-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.td-backdrop[hidden] { display: none; }
body.td-open { overflow: hidden; }
.td-panel {
  width: 100%; max-width: 760px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 18px 20px 20px;
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.td-head { display: flex; align-items: center; gap: 10px; }
.td-crumbs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.td-crumbs .kc-key { font-family: var(--font-mono); font-weight: 600; color: var(--accent); text-decoration: none; }
.td-crumbs .kc-key:hover { text-decoration: underline; }
.td-crumbs .kc-type { color: var(--muted); }
.td-close {
  margin-left: auto; flex: none; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 6px 9px;
}
.td-close:hover { color: var(--ink); border-color: var(--accent); }
.td-summary {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  line-height: 1.3; margin: 10px 0 14px; overflow-wrap: anywhere;
}
.td-fields {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px 16px; margin: 0 0 16px; padding: 12px 0;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}
.td-field { min-width: 0; font-size: 12px; }
.td-field dt { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.td-field dd { margin: 2px 0 0; color: var(--ink); overflow-wrap: anywhere; }
/* A cell that spans the whole grid row: the "Closed by" row (XERK-1569) is the
   one tall cell, and as an ordinary cell it stretched its row of three. */
.td-field.td-field-wide { grid-column: 1 / -1; }
/* The "Closed by" row's evidence note (XERK-1569): the session's own words,
   clamped to three lines until a tap or click opens the <details>, which shows
   all of it (a phone has no hover for the tooltip). */
.td-outcome-note { margin-top: 3px; color: var(--ink-2); }
.td-outcome-note > summary { display: block; list-style: none; cursor: pointer; }
.td-outcome-note > summary::-webkit-details-marker { display: none; }
.td-outcome-note-text { white-space: pre-line; }
.td-outcome-note:not([open]) .td-outcome-note-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3;
  overflow: hidden;
}
.td-dim { color: var(--muted); }
/* The Repo row's manual override (see repoFieldHtml/repoPickerHtml in board.js).
   "Change" is a quiet text button, not a filled one: the row's job is to report
   the triaged repo, and the edit affordance sits beside that value rather than
   competing with it. */
.td-edit {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer; font-size: 10.5px; line-height: 1;
  padding: 2px 6px; font-family: inherit;
}
.td-edit:hover { color: var(--ink); border-color: var(--accent); }
/* The picker replaces the row in place, so it wraps within the same grid cell
   rather than widening it — .td-fields is auto-fill and a rigid child would
   reflow every other field. */
.td-repo-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; }
.td-repo-select {
  flex: 1 1 100%; min-width: 0; max-width: 100%;
  background: var(--page); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px;
  padding: 3px 4px;
}
.td-err-inline { color: var(--warning-text); font-size: 10.5px; }
.td-label {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
  color: var(--ink-2); background: var(--page); border: 1px solid var(--border);
}
.td-section { margin-bottom: 18px; }
.td-section h3 {
  font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 8px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.td-section p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.td-section a { color: var(--accent); }
.td-none { color: var(--muted); font-size: 13px; font-style: italic; }
.td-note { color: var(--muted); font-size: 12px; margin: 6px 0; }
.td-note.td-err { color: var(--warning-text); }
.td-comment { border-top: 1px solid var(--hairline); padding: 10px 0 2px; }
.td-comment:first-of-type { border-top: 0; padding-top: 0; }
.td-chead { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.td-cauthor { font-weight: 600; color: var(--ink-2); }
.td-cwhen { color: var(--muted); font-size: 11px; margin-left: auto; }
.td-cbody p { font-size: 13px; }
.td-foot { border-top: 1px solid var(--hairline); padding-top: 12px; font-size: 13px; }
.td-foot a { color: var(--accent); text-decoration: none; }
.td-foot a:hover { text-decoration: underline; }
/* Epic-run panel (XERK-638): Start/Re-arm/Cancel + wave-by-wave child progress,
   in the ticket detail view of an epic. */
.epic-run { border-top: 1px solid var(--hairline); padding-top: 14px; }
.epic-run h3 { display: flex; align-items: center; gap: 8px; }
.epic-desc { color: var(--ink-2); }
.epic-state {
  padding: 1px 8px; border-radius: 999px; font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600; border: 1px solid var(--border);
}
.epic-state.epic-running { color: var(--accent); border-color: var(--accent); }
.epic-state.epic-blocked { color: var(--warning-text); border-color: var(--warning); }
.epic-state.epic-done { color: var(--good); border-color: var(--good); }
.epic-state.epic-paused { color: var(--muted); border-color: var(--muted); }
.epic-state.epic-idle { color: var(--muted); border-color: var(--muted); }
.epic-paused-note { color: var(--ink-2); }
.epic-prog { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.epic-prog-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.epic-bar {
  display: flex; flex: 1; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--page); border: 1px solid var(--border);
}
.epic-seg { display: block; height: 100%; }
.epic-seg.epic-done { background: var(--good); }
.epic-seg.epic-running { background: var(--accent); }
.epic-seg.epic-ready { background: color-mix(in srgb, var(--accent) 40%, var(--page)); }
.epic-seg.epic-blocked { background: color-mix(in srgb, var(--warning) 55%, var(--page)); }
.epic-seg.epic-empty { background: var(--page); }
/* The wave list: each wave a group, each child a status-tinted row. */
.epic-children { list-style: none; margin: 0 0 12px; padding: 0; }
.epic-wave { margin-bottom: 8px; }
.epic-wave-h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.epic-wave-cycle .epic-wave-h { color: var(--critical); }
.epic-wave-list { list-style: none; margin: 0; padding: 0; }
.epic-child {
  display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px;
}
/* The key + summary open that sub-ticket's panel (XERK-2674). */
.epic-child-open {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.epic-child-open:hover .epic-child-sum, .epic-child-open:focus-visible .epic-child-sum { text-decoration: underline; }
.td-epic {
  background: none; border: 0; padding: 0; font: inherit; font-family: var(--font-mono);
  font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.td-epic:hover, .td-epic:focus-visible { color: var(--accent); text-decoration: underline; }
.epic-child-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.epic-child-key { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); flex: none; }
.epic-child-sum { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.epic-child-st { font-size: 11px; color: var(--muted); flex: none; }
.epic-child.epic-done .epic-child-dot { background: var(--good); }
.epic-child.epic-done .epic-child-st { color: var(--good); }
.epic-child.epic-running .epic-child-dot { background: var(--accent); }
.epic-child.epic-running .epic-child-st { color: var(--accent); }
.epic-child.epic-ready .epic-child-dot { background: color-mix(in srgb, var(--accent) 45%, var(--page)); }
.epic-child.epic-blocked .epic-child-dot { background: color-mix(in srgb, var(--warning) 60%, var(--page)); }
.epic-child.epic-none { color: var(--muted); font-style: italic; }
/* A board child listed by column (epicChildrenOf), not by run status. */
.epic-child.epic-cat-inprogress .epic-child-dot,
.epic-child.epic-cat-review .epic-child-dot { background: var(--accent); }
.epic-child.epic-cat-done .epic-child-dot { background: var(--good); }
.epic-child.epic-cat-done .epic-child-st { color: var(--good); }
.epic-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* The run's "max running at once" cap (XERK-1860), above its actions. */
.epic-limit { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.epic-limit select { font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 6px; }
.epic-btn {
  padding: 5px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
.epic-btn:hover { filter: brightness(1.05); }
.epic-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.epic-btn.epic-btn-ghost { background: var(--page); color: var(--accent); }
.epic-btn.epic-btn-pause { background: var(--page); color: var(--warning-text); border-color: var(--warning); }
.epic-btn.epic-btn-cancel { background: var(--page); color: var(--critical); border-color: var(--critical); }
.epic-btn.epic-btn-busy { background: var(--page); color: var(--muted); border-color: var(--border); border-style: dashed; cursor: default; }
/* New-ticket form (XERK-137). Reuses the detail panel's backdrop/panel chrome;
   these style the form's own rows, inputs and actions. */
.cf-panel { max-width: 560px; }
.cf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cf-head h2 {
  font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0;
}
.cf-head .td-close { margin-left: auto; }
.cf-body { display: flex; flex-direction: column; gap: 12px; padding: 12px 0; }
.cf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cf-field > span {
  color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em;
}
.cf-static { font-size: 13px; color: var(--ink); }
.cf-field select, .cf-field input, .cf-field textarea {
  width: 100%; box-sizing: border-box; background: var(--page); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; padding: 7px 8px;
}
.cf-field textarea { resize: vertical; min-height: 90px; line-height: 1.4; }
.cf-field select:focus, .cf-field input:focus, .cf-field textarea:focus {
  outline: none; border-color: var(--accent);
}
.cf-note { color: var(--muted); font-size: 12px; }
.cf-note.cf-err { color: var(--warning-text); }
.cf-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--hairline); padding-top: 14px; margin-top: 4px;
}
.cf-btn {
  font: inherit; font-size: 12.5px; padding: 6px 14px; cursor: pointer;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
}
.cf-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--accent); }
.cf-btn.cf-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.cf-btn.cf-primary:hover:not(:disabled) { filter: brightness(1.06); color: #fff; }
.cf-btn:disabled { cursor: default; opacity: 0.5; }
/* The dirty-close confirmation row (XERK-218): the question fills the space the
   right-aligned buttons leave. */
.cf-discard-q { margin-right: auto; align-self: center; }
.cf-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cf-file {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 4px 2px 8px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--ink);
}
.cf-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cf-file.cf-file-err { border-color: var(--warning); color: var(--warning-text); }
.cf-file-x {
  border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px 4px;
}
.cf-file-x:hover { color: var(--ink); }
.cf-btn.cf-danger { color: #fff; background: var(--critical); border-color: var(--critical); }
.cf-btn.cf-danger:hover:not(:disabled) { filter: brightness(1.06); color: #fff; }
.cf-done { font-size: 14px; color: var(--ink); padding: 14px 0; line-height: 1.5; }
.cf-done a { color: var(--accent); }
/* A ticket created but not assigned: still a success, so it sits in the same
   confirmation line rather than the error slot — just marked. */
.cf-warn { color: var(--warning-text); }
/* Per-org triage policy panel (XERK-486): narrow modal reusing the detail
   panel's backdrop/padding plus the form-field and action-button styles above. */
.td-panel.td-narrow { max-width: 520px; }
.tp-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.tp-field { display: block; margin: 0 0 12px; }
.tp-field > span {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.tp-field input[type="text"], .tp-field input[type="number"], .tp-field select,
.tp-field textarea {
  font: inherit; font-size: 12.5px; width: 100%; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); box-sizing: border-box;
}
.tp-field textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.tp-field input:focus, .tp-field select:focus, .tp-field textarea:focus {
  outline: none; border-color: var(--accent);
}

/* Epic-builder progress strip (XERK-726): one row per builder run above the
   board, driven by the hub's `epicBuilders` map. Collapses to nothing when
   there are no runs (the container is emptied). */
.eb-progress {
  border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  background: var(--surface); padding: 10px 12px; margin: 0 0 14px;
}
.eb-progress-h {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.eb-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 6px 0; border-top: 1px solid var(--hairline); font-size: 12.5px;
}
.eb-row:first-of-type { border-top: 0; }
.eb-state {
  flex: 0 0 auto; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.eb-state-researching, .eb-state-creating, .eb-state-queued {
  color: var(--accent); border-color: var(--accent);
}
.eb-state-done { color: var(--good); border-color: var(--good); }
.eb-state-failed { color: var(--critical); border-color: var(--critical); }
.eb-title { flex: 1 1 180px; min-width: 0; color: var(--ink); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eb-org { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.eb-host { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.eb-err { flex: 1 1 100%; color: var(--critical); font-size: 12px; }
.eb-epic {
  flex: 0 0 auto; color: var(--accent); text-decoration: none;
  font-family: var(--font-mono); font-weight: 600;
}
.eb-epic:hover { text-decoration: underline; }
.eb-arm {
  flex: 0 0 auto; font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
}
.eb-arm:hover { filter: brightness(1.06); }
.eb-arm:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.eb-dismiss {
  flex: 0 0 auto; margin-left: auto; font: inherit; font-size: 13px; line-height: 1;
  padding: 3px 7px; cursor: pointer; color: var(--muted);
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.eb-dismiss:hover { color: var(--ink); border-color: var(--accent); }
.eb-spin {
  flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: eb-spin 0.8s linear infinite;
}
@keyframes eb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .eb-spin { animation: none; } }
.tp-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tp-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.tp-check input { accent-color: var(--accent); }
.tp-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.tp-note.tp-note-tight { margin-bottom: 4px; }
.tp-err { font-size: 12.5px; color: var(--critical); margin: 0 0 12px; }

@media (max-width: 600px) {
  .td-backdrop { padding: 0; }
  .td-panel { max-width: none; min-height: 100vh; max-height: none; border: 0; border-radius: 0; }
}

/* ---- Shared bits --------------------------------------------------------- */
.empty { color: var(--muted); text-align: center; padding: 64px 0; border: 1px dashed var(--hairline); border-radius: var(--radius-lg); }
.footer { color: var(--muted); font-size: 12px; margin-top: 28px; }

/* ---- Live-terminal overlay (index + sessions) ---------------------------- */
.term-overlay {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.62); flex-direction: column; padding: 20px;
}
.term-box {
  flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1400px;
  margin: 0 auto; background: #000; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md);
}
.term-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--hairline);
}
/* The stage bar's title block stacks the name over the identity/meta line
   (XERK-735): inside a session the meta sits on its OWN line below the title
   rather than wrapping off the end of the first. min-width:0 lets it shrink and
   ellipsis inside the flex row instead of shoving the toolbar buttons off. */
.term-bar .t-title { display: flex; flex-direction: column; min-width: 0;
  font-weight: 600; font-size: 14px; line-height: 1.3; }
.term-bar .t-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .t-title .path { font-family: var(--font-mono); color: var(--muted);
  font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-bar .spacer { flex: 1; }
.term-bar a { color: var(--accent); text-decoration: none; font-size: 13px; }
.term-bar a:hover { text-decoration: underline; }
.term-overlay iframe { flex: 1; border: 0; width: 100%; background: #000; }
/* Local compose bar under the live terminal — see index.html for why. */
.term-compose {
  display: flex; align-items: flex-end; gap: 10px; padding: 8px 12px;
  background: var(--surface); border-top: 1px solid var(--hairline);
}
.term-compose textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 160px; overflow-y: auto;
  padding: 8px 10px; font-family: var(--font-mono); font-size: 13px; line-height: 1.4;
  color: var(--ink); background: var(--field); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-sizing: border-box;
}
.term-compose textarea:focus { outline: none; border-color: var(--accent); }
.term-compose button { align-self: stretch; white-space: nowrap; }

/* ---- Responsive: phone bottom nav + roomier touch targets ---------------- */
@media (max-width: 600px) {
  .wrap { padding: 0 12px 40px; }
  .site-header { margin-bottom: 16px; }
  .site-header-in { padding: 16px 12px 0; gap: 8px 12px; }
  .nav-tabs { display: none; }
  /* The header's flex spacer keeps the org button at the right edge of its row,
     but it wraps to the LEFT of a new row when the header content is wide — so
     anchoring the popover to either edge of the button risks it hanging off
     screen (a right-growing panel off a right-edge button forces a sideways
     scroll to reach the auto toggles). Drop it below the whole header instead,
     spanning the viewport, so it's always fully in view wherever the button sat. */
  .org-filter { position: static; }
  .site-header-in { position: relative; }
  .org-menu { left: 12px; right: 12px; top: calc(100% + 4px); max-width: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--hairline);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  /* Seven tabs (XERK-2510): min-width 0 lets a long label share the row evenly. */
  .bottom-nav a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 10.5px; padding: 6px 0 4px;
  }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a { overflow: hidden; white-space: nowrap; }
  @media (max-width: 380px) { .bottom-nav a { font-size: 9.5px; letter-spacing: -0.2px; } }
  @media (max-width: 340px) { .bottom-nav a { font-size: 8.5px; letter-spacing: -0.3px; } }
  .bottom-nav a.active { color: var(--accent); }
  body { padding-bottom: 68px; }
  /* Clear the bottom nav: the toast is now on every page (XERK-264), and at its
     desktop offset it lands on top of the tab bar on a phone. */
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) {
  button { padding: 9px 15px; }
  button.btn-sm { padding: 8px 12px; font-size: 12.5px; }
}
