/* cfpool: the public API docs and the admin dashboard. Every text colour
   here is >= 7:1 on the surface it sits on, in both schemes. */
@font-face {
  font-family: "Inter Variable";
  src: url("inter.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("mono.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ───────── design tokens ─────────
   ONE set of custom properties for the shell and every module (MODULES.md,
   "Design system"). Modules read them; they never invent sizes, colours or
   radii of their own. Dark-first; the light theme is its own chosen steps.
   The theme follows the system unless the admin picks one
   (html[data-theme="light"|"dark"]); colour values are plain colours, so
   getComputedStyle(document.documentElement).getPropertyValue('--c1') gives
   a usable colour (QP.color does the same). Every text colour is >= 7:1 on
   the surfaces it sits on. */
:root {
  color-scheme: light;
  /* surfaces: page < card < raised; well = inset inside a card; fill = control */
  --bg: #f4f5f7; --bg-side: #eef0f3; --bar: #f4f5f7;
  --card: #ffffff; --card-2: #ffffff; --well: #f6f7f9;
  --fill: #eceef2; --fill-2: #e1e4ea;
  --hover: rgb(15 23 42 / .045); --press: rgb(15 23 42 / .08);
  --scrim: rgb(15 18 25 / .34);
  /* borders */
  --line: rgb(15 23 42 / .085); --line-2: rgb(15 23 42 / .14); --line-3: rgb(15 23 42 / .24); --hl: rgb(255 255 255 / 0);
  /* elevation: card (resting), raised (buttons, segment thumbs, switch knob), pop (sheets, menus, toasts) */
  --shadow-card: 0 1px 2px rgb(15 23 42 / .04), 0 1px 1px rgb(15 23 42 / .02);
  --shadow-raised: 0 1px 2px rgb(15 23 42 / .08), 0 0 0 1px var(--line-2);
  --shadow-btn: 0 1px 1px rgb(15 23 42 / .04);
  --shadow-primary: inset 0 1px 0 rgb(255 255 255 / .14), 0 1px 2px rgb(0 0 0 / .12);
  --shadow-knob: 0 1px 3px rgb(0 0 0 / .3), 0 0 0 .5px rgb(0 0 0 / .06);
  --shadow-pop: 0 24px 56px -16px rgb(15 23 42 / .22), 0 4px 14px rgb(15 23 42 / .06);
  --shadow-brand: 0 0 0 1px var(--line), 0 2px 6px rgb(29 74 192 / .25);
  /* text (every one >= 7:1 on --card, --card-2, --well and --fill) */
  --fg: #0e1217; --fg-2: #3f4754; --fg-3: #46505d; --on-fill: #ffffff; --knob: #ffffff;
  /* accent (= the info tone) */
  --accent: #1642b5; --accent-fill: #1d4ac0; --accent-hi: #163b9e;
  --accent-soft: #eaf0fd; --accent-ring: rgb(29 74 192 / .32); --accent-dot: #2a78d6;
  --accent-line: rgb(42 120 214 / .32);
  /* status: text, -soft background, -dot mark, -line border. Reserved: always with an icon or a label */
  --ok: #08572f;   --ok-soft: #e8f6ee;   --ok-dot: #16a34a;   --ok-line: rgb(22 163 74 / .3);
  --warn: #734600; --warn-soft: #fdf4e3; --warn-dot: #e09100; --warn-line: rgb(224 145 0 / .35);
  --bad: #96121c;  --bad-soft: #fdecec;  --bad-dot: #e0383e;  --bad-line: rgb(224 56 62 / .3);
  --sim: #5b34b0;  --sim-soft: #f2eefc;  --sim-dot: #6250d6;  --sim-line: rgb(98 80 214 / .3);
  --idle-dot: #a4abb6;
  --danger-fill: #a51c27; --danger-hi: #8c1720;
  /* data: categorical series (validated, adjacent order), kinds, chart chrome */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  /* clearance: magenta, never the orange/red of warnings (operator 2026-11-18: "the clearance color makes me think it is an error"); validated against --c1 for CVD, both modes */
  --k-token: var(--c1); --k-clearance: #d55181;
  --grid: #e6e8ec; --axis: #c4c9d1; --tip: rgb(255 255 255 / .82);
  /* JSON */
  --j-key: #6a3190; --j-str: #0a5c43; --j-num: #7f3b06; --j-lit: #084fa8;

  /* tone aliases (the names the design system speaks: ok · warn · danger · info · neutral) */
  --danger: var(--bad); --danger-soft: var(--bad-soft); --danger-dot: var(--bad-dot); --danger-line: var(--bad-line);
  --info: var(--accent); --info-soft: var(--accent-soft); --info-dot: var(--accent-dot); --info-line: var(--accent-line);
  --neutral: var(--fg-2); --neutral-soft: var(--fill); --neutral-dot: var(--idle-dot); --neutral-line: var(--line-2);

  /* legacy names (kept for modules) */
  --win: var(--bg); --side: var(--bg-side); --sep: var(--line); --sep-2: var(--line-2);
  --ring: 0 0 0 1px var(--line);
  --e1: var(--shadow-card); --e3: 0 0 0 1px var(--line-2), var(--shadow-pop);

  /* focus: one ring everywhere (outline on :focus-visible; the glow on focused fields) */
  --focus-w: 2px; --focus-off: 2px; --focus-glow: 0 0 0 3px var(--accent-ring);

  /* radius: xxs marks/bars · xs code, tags, checkboxes · sm small controls, nav items, icon tiles ·
     md buttons, inputs, segmented · lg wells, notices, inner panels, toasts · card (= xl) cards · sheet · pill */
  --r-xxs: 3px; --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --r-card: 16px; --r-sheet: 20px; --r-pill: 999px;
  /* spacing: the 4 px grid. --sp-0 (2 px) is an optical nudge only, never a gap between things */
  --sp-0: 2px; --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  --font: "Inter Variable", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* type, phone first (size/line; use as font: 600 var(--t-h) var(--font) with its --ls-*).
     The whole page uses tabular figures. Phone floors: body 17, secondary 16. */
  --t-kpi: 36px/40px;   --ls-kpi: -.032em;    /* hero number */
  --t-kpi-s: 28px/32px; --ls-kpi-s: -.026em;  /* tile number */
  --t-xl: 28px/34px;    --ls-xl: -.024em;     /* view title (page header) */
  --t-1:  22px/28px;    --ls-1:  -.019em;     /* sheet title, big headings */
  --t-num: 20px/26px;   --ls-num: -.016em;    /* stat value in a strip or pill */
  --t-2:  19px/25px;    --ls-2:  -.015em;     /* sub-title, a lead line */
  --t-h:  17px/24px;    --ls-h:  -.014em;     /* card / section title */
  --t-b:  17px/24px;    --ls-b:  -.012em;     /* body */
  --t-c:  16px/22px;    --ls-c:  -.01em;      /* secondary (labels, meta) */
  --t-x:  14px/18px;    --ls-x:  -.004em;     /* caption: chips, codes, table headers, units */
  --t-u:  12px/16px;    --ls-u:  .01em;       /* tab labels */
  --t-micro: 12px/16px; --ls-micro: .05em;    /* uppercase micro labels */
  --t-m:  15px/22px;                          /* mono */
  --lh-tight: 1.15; --lh-text: 1.45;          /* multi-line text without a size token (textarea, prose) */

  /* controls: control height (44 on touch), list row, chip, small button, switch */
  --ctl: 44px; --ctl-sm: 44px; --ctl-lg: 48px; --row: 52px; --chip: 28px;
  --sw-w: 51px; --sw-h: 31px;
  /* layout: page gutter, card padding, the gap between cards, table cell padding */
  --gut: 16px; --pad: 16px; --gap: 16px; --cell-x: 12px; --cell-y: 12px;
  --top-h: 56px; --tab-h: 58px; --side-w: 240px;
  /* where a sticky thing in the view sticks, and the view's visible height:
     under the top bar on a scrolling page; the frame (signed in) sets them
     for its own scroller */
  --in-top: calc(var(--top-h) + var(--safe-t)); --port-h: 100dvh;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  /* the end of every page: what the fixed bottom tab bar covers (phone:
     its height and the home-indicator inset; 0 from 768 px) plus air.
     .main, the sticky save bar, docks and toasts all clear it. */
  --bar-b: 0px; --end-air: 48px;

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1); --ease-spring: cubic-bezier(.32, .72, 0, 1);
  --t-fast: .15s; --t-med: .22s; --t-slow: .35s;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
  color-scheme: dark;
  --bg: #0a0c10; --bg-side: #0c0f14; --bar: #0a0c10;
  --card: #12151b; --card-2: #171b22; --well: #0e1116;
  --fill: #1b1f27; --fill-2: #252a34;
  --hover: rgb(255 255 255 / .045); --press: rgb(255 255 255 / .08);
  --scrim: rgb(0 0 0 / .62);
  --line: rgb(255 255 255 / .07); --line-2: rgb(255 255 255 / .11); --line-3: rgb(255 255 255 / .2); --hl: rgb(255 255 255 / .045);
  --shadow-card: 0 1px 0 rgb(0 0 0 / .4);
  --shadow-raised: 0 1px 2px rgb(0 0 0 / .4), 0 0 0 1px var(--line-2);
  --shadow-btn: 0 1px 1px rgb(0 0 0 / .2);
  --shadow-pop: 0 28px 72px -16px rgb(0 0 0 / .75), 0 2px 10px rgb(0 0 0 / .35);
  --fg: #edf0f5; --fg-2: #bcc4d1; --fg-3: #a3abb9; --on-fill: #ffffff;
  --accent: #8cb6ff; --accent-fill: #1d4ac0; --accent-hi: #2556d6;
  --accent-soft: #14213a; --accent-ring: rgb(140 182 255 / .42); --accent-dot: #3987e5; --accent-line: rgb(57 135 229 / .34);
  --ok: #5fd39b;   --ok-soft: #0f2219;   --ok-dot: #34c27a;   --ok-line: rgb(52 194 122 / .3);
  --warn: #f3c164; --warn-soft: #2a2010; --warn-dot: #f0a92e; --warn-line: rgb(240 169 46 / .32);
  --bad: #ff918b;  --bad-soft: #2c1517;  --bad-dot: #f0585a;  --bad-line: rgb(240 88 90 / .32);
  --sim: #c8b6ff;  --sim-soft: #1f1a33;  --sim-dot: #9085e9;  --sim-line: rgb(144 133 233 / .32);
  --idle-dot: #5d6573;
  --danger-fill: #a51c27; --danger-hi: #b8222e;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --grid: #1c2129; --axis: #2a303a; --tip: rgb(23 27 34 / .78);
  --j-key: #d7b1ff; --j-str: #82e3b9; --j-num: #ffb37a; --j-lit: #7cb8ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0c10; --bg-side: #0c0f14; --bar: #0a0c10;
  --card: #12151b; --card-2: #171b22; --well: #0e1116;
  --fill: #1b1f27; --fill-2: #252a34;
  --hover: rgb(255 255 255 / .045); --press: rgb(255 255 255 / .08);
  --scrim: rgb(0 0 0 / .62);
  --line: rgb(255 255 255 / .07); --line-2: rgb(255 255 255 / .11); --line-3: rgb(255 255 255 / .2); --hl: rgb(255 255 255 / .045);
  --shadow-card: 0 1px 0 rgb(0 0 0 / .4);
  --shadow-raised: 0 1px 2px rgb(0 0 0 / .4), 0 0 0 1px var(--line-2);
  --shadow-btn: 0 1px 1px rgb(0 0 0 / .2);
  --shadow-pop: 0 28px 72px -16px rgb(0 0 0 / .75), 0 2px 10px rgb(0 0 0 / .35);
  --fg: #edf0f5; --fg-2: #bcc4d1; --fg-3: #a3abb9; --on-fill: #ffffff;
  --accent: #8cb6ff; --accent-fill: #1d4ac0; --accent-hi: #2556d6;
  --accent-soft: #14213a; --accent-ring: rgb(140 182 255 / .42); --accent-dot: #3987e5; --accent-line: rgb(57 135 229 / .34);
  --ok: #5fd39b;   --ok-soft: #0f2219;   --ok-dot: #34c27a;   --ok-line: rgb(52 194 122 / .3);
  --warn: #f3c164; --warn-soft: #2a2010; --warn-dot: #f0a92e; --warn-line: rgb(240 169 46 / .32);
  --bad: #ff918b;  --bad-soft: #2c1517;  --bad-dot: #f0585a;  --bad-line: rgb(240 88 90 / .32);
  --sim: #c8b6ff;  --sim-soft: #1f1a33;  --sim-dot: #9085e9;  --sim-line: rgb(144 133 233 / .32);
  --idle-dot: #5d6573;
  --danger-fill: #a51c27; --danger-hi: #b8222e;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --grid: #1c2129; --axis: #2a303a; --tip: rgb(23 27 34 / .78);
  --j-key: #d7b1ff; --j-str: #82e3b9; --j-num: #ffb37a; --j-lit: #7cb8ff;
}
/* tablet and desktop: the denser steps (body 15, secondary 14, caption 13) */
@media (min-width: 768px) {
  :root {
    --t-kpi: 40px/44px; --t-kpi-s: 30px/34px;
    --t-xl: 26px/32px; --ls-xl: -.022em;
    --t-1:  20px/26px; --ls-1:  -.017em;
    --t-num: 22px/28px; --ls-num: -.018em;
    --t-2:  18px/24px; --ls-2:  -.014em;
    --t-h:  16px/22px; --ls-h:  -.012em;
    --t-b:  15px/22px; --ls-b:  -.008em;
    --t-c:  14px/20px; --ls-c:  -.005em;
    --t-x:  13px/18px; --ls-x:  0em;
    --t-u:  12px/14px;
    --t-micro: 12px/16px; --ls-micro: .05em;
    --t-m:  14px/20px;
    --ctl: 36px; --ctl-sm: 32px; --ctl-lg: 44px; --row: 48px; --chip: 24px;
    --sw-w: 40px; --sw-h: 24px;
    --gut: 24px; --pad: 20px; --gap: 20px; --cell-x: 12px; --cell-y: 12px;
    --top-h: 56px;
  }
}
@media (min-width: 768px) and (pointer: coarse) {
  :root { --ctl: 44px; --ctl-sm: 40px; --row: 48px; --sw-w: 51px; --sw-h: 31px; }
}

/* ───────── base ───────── */
/* Scroll anchoring off on every element. iPhone Safari (reports from the
   installed app, 2026-11-18) picked a live, moving element as the anchor and
   scrolled the page after it, 78-104 px at a time, with nobody touching it;
   an `overflow-anchor: none` on a box did not cover the rows inside it. The
   page never needs anchoring: live data never changes the layout above the
   reader. */
*, *::before, *::after { box-sizing: border-box; overflow-anchor: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; min-inline-size: 0; }
legend { padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
html.locked { overflow: hidden; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font: var(--t-b) var(--font); letter-spacing: var(--ls-b);
  font-feature-settings: "cv11"; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; margin: 0; }
button:disabled { cursor: default; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font: 650 var(--t-xl) var(--font); letter-spacing: var(--ls-xl); }
h2 { font: 600 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
code, pre, .mono { font-family: var(--mono); font-variant-ligatures: none; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: var(--focus-w) solid var(--accent-ring); outline-offset: var(--focus-off); }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.noscript { padding: var(--sp-6); }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 768px) { svg.i { width: 16px; height: 16px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (max-width: 767.98px), (pointer: coarse) {
  input:not([type="checkbox"], [type="radio"]), select, textarea { font-size: max(16px, 1em) !important; }
}
.micro { font: 600 var(--t-micro) var(--font); letter-spacing: var(--ls-micro); text-transform: uppercase; color: var(--fg-3); }
.kpi { font: 650 var(--t-kpi) var(--font); letter-spacing: var(--ls-kpi); font-variant-numeric: tabular-nums; color: var(--fg); }
.kpi-s { font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); font-variant-numeric: tabular-nums; color: var(--fg); }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.grow { flex: 1; min-width: 0; }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption { font: var(--t-x) var(--font); letter-spacing: var(--ls-x); color: var(--fg-2); }

/* ───────── controls ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--ctl); padding: 0 var(--sp-4); border-radius: var(--r-md);
  background: var(--card-2); color: var(--fg); font-weight: 560; white-space: nowrap;
  border: 1px solid var(--line-2); box-shadow: var(--shadow-btn);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast), transform var(--t-fast) var(--ease);
}
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--fill); } }
.btn:active:not(:disabled) { background: var(--fill-2); transform: scale(.985); }
.btn:disabled { opacity: .45; }
.btn svg.i { color: var(--fg-2); }
.btn.primary { background: var(--accent-fill); color: var(--on-fill); border-color: transparent; box-shadow: var(--shadow-primary); }
.btn.primary svg.i { color: currentColor; }
@media (hover: hover) { .btn.primary:hover:not(:disabled) { background: var(--accent-hi); } }
.btn.primary:active:not(:disabled) { background: var(--accent-hi); }
.btn.danger { background: var(--danger-fill); color: var(--on-fill); border-color: transparent; }
.btn.danger svg.i { color: currentColor; }
@media (hover: hover) { .btn.danger:hover:not(:disabled) { background: var(--danger-hi); } }
.btn.plain { background: transparent; color: var(--accent); padding: 0 var(--sp-3); border-color: transparent; box-shadow: none; }
.btn.plain svg.i { color: currentColor; }
@media (hover: hover) { .btn.plain:hover:not(:disabled) { background: var(--hover); } }
.btn.plain.bad, .btn.bad { color: var(--bad); }
.btn.icon { width: var(--ctl); padding: 0; }
.btn.full { width: 100%; }
.btn.lg { min-height: var(--ctl-lg); padding: 0 var(--sp-5); font: 600 var(--t-b) var(--font); border-radius: var(--r-lg); }
.btn-n { padding: 0 var(--sp-2); min-width: 20px; height: 18px; display: inline-grid; place-items: center; border-radius: var(--r-pill); background: var(--fill); color: var(--fg-2); font: 600 var(--t-u) var(--font); line-height: 1; }
@media (min-width: 768px) and (pointer: fine) {
  .btn.sm { min-height: var(--ctl-sm); padding: 0 var(--sp-3); border-radius: var(--r-sm); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
  .btn.sm.plain { padding: 0 var(--sp-2); }
}

.switch {
  position: relative; flex: none; width: var(--sw-w); height: var(--sw-h); border-radius: var(--r-pill);
  background: var(--fill-2); box-shadow: inset 0 0 0 1px var(--line); transition: background var(--t-med) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: calc(var(--sw-h) - 4px); height: calc(var(--sw-h) - 4px); border-radius: 50%;
  background: var(--knob); box-shadow: var(--shadow-knob);
  transition: transform var(--t-med) var(--ease-spring);
}
.switch[aria-checked="true"] { background: var(--ok-dot); box-shadow: none; }
.switch[aria-checked="true"]::after { transform: translateX(calc(var(--sw-w) - var(--sw-h))); }
.switch:disabled { opacity: .55; }
/* a switch with its word beside it ("On", "Proxy") */
.sw-row { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--fg-2); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.switch.busy::after { opacity: .75; }

.field-in, .select, .search {
  width: 100%; min-height: var(--ctl); padding: 0 12px; border-radius: var(--r-md);
  background: var(--well); border: 1px solid var(--line-2); color: var(--fg);
  outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
@media (hover: hover) { .field-in:hover:not(:focus), .select:hover:not(:focus), .search:hover:not(:focus) { border-color: color-mix(in srgb, var(--fg) 22%, transparent); } }
.field-in:focus, .select:focus, .search:focus { border-color: var(--accent-dot); box-shadow: var(--focus-glow); background: var(--card); }
.field-in[aria-invalid="true"] { border-color: var(--bad-dot); }
.field-in[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad-dot) 30%, transparent); }
.field-in::placeholder, .search::placeholder { color: var(--fg-3); opacity: 1; }
textarea.field-in { padding: var(--sp-3) var(--sp-3); line-height: 1.45; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: none; }
.select-wrap { position: relative; display: block; }
.select-wrap svg.i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--fg-3); }

.check { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--ctl); cursor: pointer; }
.check input, .scope-opt input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; width: 22px; height: 22px; border-radius: var(--r-xs);
  border: 1.5px solid var(--line-2); background: var(--well); display: grid; place-content: center; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.check input:checked, .scope-opt input:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
.check input:checked::after, .scope-opt input:checked::after { content: ""; width: 11px; height: 6px; border: 2px solid var(--on-fill); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check input:focus-visible, .scope-opt input:focus-visible { outline: var(--focus-w) solid var(--accent-ring); outline-offset: var(--focus-off); }
@media (min-width: 768px) {
  .check input, .scope-opt input { width: 18px; height: 18px; border-radius: var(--r-xs); }
  .check input:checked::after, .scope-opt input:checked::after { width: 9px; height: 5px; }
}

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--chip); padding: 0 var(--sp-2); border-radius: var(--r-pill);
  font: 560 var(--t-x) var(--font); letter-spacing: var(--ls-x); white-space: nowrap;
  background: var(--fill); color: var(--fg-2); border: 1px solid var(--line);
}
.chip svg.i { width: 14px; height: 14px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent-dot) 30%, transparent); }
.chip.sim { background: var(--sim-soft); color: var(--sim); border-color: color-mix(in srgb, var(--sim-dot) 30%, transparent); }
.chip.mono { font-family: var(--mono); font-weight: 500; }

/* badge: a status with its icon (status colours never stand alone) */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 28px; padding: 0 var(--sp-3) 0 var(--sp-2); border-radius: var(--r-pill);
  font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); white-space: nowrap; border: 1px solid;
}
.badge svg.i { width: 16px; height: 16px; stroke-width: 2; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.badge.idle { background: var(--fill); color: var(--fg-2); border-color: var(--line-2); }
@media (min-width: 768px) { .badge { min-height: 24px; padding: 0 var(--sp-2) 0 var(--sp-2); gap: var(--sp-1); } .badge svg.i { width: 14px; height: 14px; } }

.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle-dot); }
.dot.ok { background: var(--ok-dot); }
.dot.warn { background: var(--warn-dot); }
.dot.bad { background: var(--bad-dot); }
.dot.accent { background: var(--accent-dot); }
.dot.idle { background: var(--idle-dot); }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
/* the beat is a ring on its own layer (transform + opacity): it never repaints the bar it sits in */
.dot.beat { position: relative; }
.dot.beat::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: color-mix(in srgb, var(--ok-dot) 55%, transparent); animation: beat 2.4s ease-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes beat { 0% { transform: scale(1); opacity: 1; } 70%, 100% { transform: scale(2.5); opacity: 0; } }
.kdot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: var(--r-xxs); background: var(--idle-dot); }
.kdot.k-token { background: var(--k-token); }
.kdot.k-clearance { background: var(--k-clearance); }

.meter { position: relative; height: 8px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); min-width: 0; border-radius: var(--r-pill); background: var(--idle-dot); transition: width var(--t-slow) var(--ease); }
.meter.ok > span { background: var(--ok-dot); }
.meter.accent > span { background: var(--accent-dot); }
.meter.warn > span { background: var(--warn-dot); }
.meter.bad > span { background: var(--bad-dot); }
.meter.k-token > span { background: var(--k-token); }
.meter.k-clearance > span { background: var(--k-clearance); }
.meter.thin { height: 6px; }

/* priority: five steps, the level filled */
.prio { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; font-weight: 560; }
.prio-bars { display: inline-flex; align-items: flex-end; gap: var(--sp-0); height: 14px; }
.prio-bars i { display: block; width: 4px; border-radius: var(--r-xxs); background: var(--fill-2); }
.prio-bars i:nth-child(1) { height: 6px; } .prio-bars i:nth-child(2) { height: 8px; } .prio-bars i:nth-child(3) { height: 10px; }
.prio-bars i:nth-child(4) { height: 12px; } .prio-bars i:nth-child(5) { height: 14px; }
.prio-bars i.on { background: var(--accent-dot); }

.code { font: 500 var(--t-x) var(--mono); color: var(--fg-2); white-space: nowrap; }
.copyable { cursor: copy; border-radius: var(--r-xs); padding: var(--sp-0) var(--sp-1); margin: calc(-1 * var(--sp-0)) calc(-1 * var(--sp-1)); }
@media (hover: hover) { .copyable:hover { background: var(--hover); color: var(--fg); } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-0); padding: var(--sp-1); border-radius: var(--r-md); background: var(--fill); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: calc(var(--ctl) - 8px); padding: 0 var(--sp-3); border-radius: calc(var(--r-md) - 3px); font-weight: 560; color: var(--fg-2); transition: background var(--t-fast), color var(--t-fast); }
@media (hover: hover) { .seg button:not([aria-pressed="true"]):hover { color: var(--fg); } }
.seg button[aria-pressed="true"] { background: var(--card-2); color: var(--fg); box-shadow: var(--shadow-raised); }
.seg-n { margin-left: var(--sp-0); color: var(--fg-3); font-weight: 500; }
@media (pointer: coarse) { .seg button { min-height: 40px; } }

/* ───────── components (MODULES.md "Design system") ─────────
   Button kinds: .btn (secondary) · .primary · .ghost (= .plain) · .danger;
   a ghost in the danger tone: .ghost.bad. Sizes: .sm · (default) · .lg;
   every size is 44 px on touch. */
.btn.ghost { background: transparent; color: var(--accent); padding: 0 var(--sp-3); border-color: transparent; box-shadow: none; }
.btn.ghost svg.i { color: currentColor; }
@media (hover: hover) { .btn.ghost:hover:not(:disabled) { background: var(--hover); } }
.btn.ghost.bad { color: var(--bad); }
@media (hover: hover) { .btn.ghost.bad:hover:not(:disabled), .btn.plain.bad:hover:not(:disabled) { background: var(--bad-soft); } }
@media (min-width: 768px) and (pointer: fine) { .btn.sm.ghost { padding: 0 var(--sp-2); } }

/* tone aliases on chips and badges: info = accent, danger = bad, neutral = the default */
.chip.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.chip.danger, .badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge.neutral { background: var(--fill); color: var(--fg-2); border-color: var(--line-2); }
.chip.sm { min-height: var(--chip); padding: 0 var(--sp-2); gap: var(--sp-1); }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); min-width: 0; }

/* page header: QP.head(title, ...actions) → .view-head > h1 + .view-acts */
.view-head .view-sub { flex-basis: 100%; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }

/* toolbar / filter bar: one row of controls above a list; a search grows, the rest keep their size */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.toolbar > .search-wrap { flex: 1 1 240px; min-width: 0; }
.toolbar > .tb-end { margin-left: auto; }

/* stat strip: a card of 2–4 facts side by side, hairlines between (phone: the first spans the row) */
.card.strip { padding: 0; }
.strip { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); padding: 0; overflow: clip; }
.strip-i { display: grid; grid-template-rows: 1fr auto; gap: var(--sp-1); padding: var(--sp-4) var(--pad); min-width: 0; }
.strip-i + .strip-i { border-left: 1px solid var(--line); }
.strip-i dt { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; overflow-wrap: anywhere; color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.strip-i dd { min-width: 0; font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599.98px) {
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-i:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .strip-i:nth-child(2) { border-left: 0; }
  .strip-i dd { font: 650 var(--t-num) var(--font); letter-spacing: var(--ls-num); }
  .strip-i:first-child dd { font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); }
}

/* key–value rows: a label on the left, its value on the right (QP.facts draws the well version) */
.kv { display: grid; min-width: 0; }
.kv-r { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); min-height: 40px; padding: var(--sp-2) 0; min-width: 0; }
.kv-r + .kv-r { border-top: 1px solid var(--line); }
.kv-r > dt, .kv-r > .kv-l { flex: none; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.kv-r > dd, .kv-r > .kv-v { min-width: 0; text-align: right; font-weight: 560; overflow-wrap: anywhere; }

/* skeleton: a block standing in for content that is loading */
.skel { display: block; min-height: 1em; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--fill) 0%, var(--fill-2) 50%, var(--fill) 100%) 0 0 / 200% 100%; animation: skel 1.4s linear infinite; }
.skel.line { height: 12px; min-height: 0; border-radius: var(--r-xxs); }
@keyframes skel { to { background-position: -200% 0; } }

/* ── data table ──
   .dt-wrap (the container; .dt-wide for wide tables) > .dt-box (the card)
   > .dt-scroll (scrolls sideways when the table cannot fit; the header does
   not stick) or .dt-fits (the table promises to fit: its --dt-min is at most
   the card-list threshold; the header sticks under the top bar) > table.dt.
   Fixed layout: each th sets its column's width with --w (padding included);
   the one column without --w takes the room left; --dt-min on the table is
   the narrowest it gets. th > span: the header text, two lines at most, then
   an ellipsis (give the th a title). td.num: right-aligned tabular numbers.
   Text that may not fit: .ell (+ a title).
   Below 820 px of room (.dt-wide: 1120 px) each row becomes a card in an
   auto-fill grid: td.dt-title the card's title, td.dt-aside its top right (a
   switch, a badge), td.dt-sub a full-width line under the title (chips),
   every td[data-label] a label–value row (.dt-block: the value on its own
   line), td.dt-acts the card's actions, full width. tr.dt-full spans every
   column / card (a fold, an empty row). tr.dt-dim dims a row's facts. */
.dt-wrap { container: dt / inline-size; min-width: 0; }
.dt-wrap.dt-wide { container-name: dtw; }
.dt-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); overflow: clip; min-width: 0; }
.dt-scroll { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.dt { width: 100%; min-width: var(--dt-min, 0px); table-layout: fixed; border-collapse: separate; border-spacing: 0; font: var(--t-b) var(--font); letter-spacing: var(--ls-b); }
.dt th { width: var(--w, auto); }
.dt.dense { --cell-x: var(--sp-2); }
.dt-scroll .dt th { position: static; }
.dt th {
  position: sticky; top: var(--in-top); z-index: 2;
  padding: var(--sp-3) var(--cell-x); text-align: left; vertical-align: bottom; white-space: normal;
  background: var(--well); border-bottom: 1px solid var(--line-2);
  color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x);
}
.dt th > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: normal; word-break: normal; }
.dt thead tr:first-child th:first-child { border-top-left-radius: calc(var(--r-card) - 1px); }
.dt thead tr:first-child th:last-child { border-top-right-radius: calc(var(--r-card) - 1px); }
.dt td { padding: var(--cell-y) var(--cell-x); vertical-align: middle; border-bottom: 1px solid var(--line); min-width: 0; }
.dt th:first-child, .dt td:first-child { padding-left: var(--pad); }
.dt th:last-child, .dt td:last-child { padding-right: var(--pad); }
.dt tbody tr:last-child > td { border-bottom: 0; }
.dt tbody + tbody > tr:first-child > td { border-top: 1px solid var(--line); }
.dt .num { text-align: right; font-variant-numeric: tabular-nums; }
.dt td.num { white-space: nowrap; }
.dt th.num > span { margin-left: auto; text-align: right; }
.dt td { overflow-wrap: anywhere; }
.dt .nowrap { white-space: nowrap; }
.dt td.dt-acts { text-align: right; }
.dt-acts-in { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--sp-1); }
@media (hover: hover) { .dt tbody tr.dt-row:hover > td { background: var(--hover); } }
.dt tr.dt-full > td { padding: 0; }
.dt tr.dt-dim > td:not(.dt-acts):not(.dt-aside) { opacity: .72; }
/* the card list */
@container dt (max-width: 819.98px) {
  .dt-scroll { overflow: visible; }
  .dt-box { background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .dt, .dt tbody { display: grid; gap: var(--sp-3); min-width: 0; }
  .dt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dt tbody { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
  .dt tbody + tbody > tr:first-child > td { border-top: 0; }
  .dt tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); overflow: clip; }
  .dt tr.dt-full { grid-column: 1 / -1; display: block; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .dt tr.dt-full > td { display: block; padding: 0; border: 0; }
  .dt td.dt-acts .btn.ghost { background: var(--card-2); border-color: var(--line-2); box-shadow: var(--shadow-btn); }
  .dt td, .dt td:first-child, .dt td:last-child { grid-column: 1 / -1; padding: var(--sp-3) var(--pad); border: 0; text-align: left; white-space: normal; }
  .dt td.dt-title { grid-column: 1; grid-row: 1; padding: var(--sp-4) var(--sp-2) var(--sp-2) var(--pad); }
  .dt td.dt-aside { grid-column: 2; grid-row: 1; align-self: stretch; padding: var(--sp-4) var(--pad) 0 var(--sp-2); }
  .dt td.dt-sub { padding: 0 var(--pad) var(--sp-4); }
  .dt td[data-label] { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); min-height: 44px; padding-top: var(--sp-2); padding-bottom: var(--sp-2); border-top: 1px solid var(--line); text-align: right; }
  .dt td[data-label]::before { content: attr(data-label); flex: none; max-width: 55%; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); text-align: left; }
  .dt td.dt-block { flex-wrap: wrap; }
  .dt td.dt-block > * { flex: 1 1 100%; }
  .dt td.dt-block::before { flex: 1 1 auto; }
  .dt td.dt-acts { display: flex; gap: var(--sp-2); padding-top: var(--sp-3); padding-bottom: var(--sp-3); border-top: 1px solid var(--line); }
  .dt-acts-in { display: flex; flex: 1; gap: var(--sp-2); }
  .dt-acts-in > .btn { flex: 1 1 0; min-height: var(--ctl); }
  .dt tr.dt-dim > td:not(.dt-acts):not(.dt-aside) { opacity: .72; }
}
@container dtw (max-width: 1119.98px) {
  .dt-box { background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .dt-scroll { overflow: visible; }
  .dt, .dt tbody { display: grid; gap: var(--sp-3); min-width: 0; }
  .dt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dt tbody { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); align-items: start; }
  .dt tbody + tbody > tr:first-child > td { border-top: 0; }
  .dt tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); overflow: clip; }
  .dt tr.dt-full { grid-column: 1 / -1; display: block; background: none; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .dt tr.dt-full > td { display: block; padding: 0; border: 0; }
  .dt td.dt-acts .btn.ghost { background: var(--card-2); border-color: var(--line-2); box-shadow: var(--shadow-btn); }
  .dt td, .dt td:first-child, .dt td:last-child { grid-column: 1 / -1; padding: var(--sp-3) var(--pad); border: 0; text-align: left; white-space: normal; }
  .dt td.dt-title { grid-column: 1; grid-row: 1; padding: var(--sp-4) var(--sp-2) var(--sp-2) var(--pad); }
  .dt td.dt-aside { grid-column: 2; grid-row: 1; align-self: stretch; padding: var(--sp-4) var(--pad) 0 var(--sp-2); }
  .dt td.dt-sub { padding: 0 var(--pad) var(--sp-4); }
  .dt td[data-label] { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); min-height: 44px; padding-top: var(--sp-2); padding-bottom: var(--sp-2); border-top: 1px solid var(--line); text-align: right; }
  .dt td[data-label]::before { content: attr(data-label); flex: none; max-width: 55%; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); text-align: left; }
  .dt td.dt-block { flex-wrap: wrap; }
  .dt td.dt-block > * { flex: 1 1 100%; }
  .dt td.dt-block::before { flex: 1 1 auto; }
  .dt td.dt-acts { display: flex; gap: var(--sp-2); padding-top: var(--sp-3); padding-bottom: var(--sp-3); border-top: 1px solid var(--line); }
  .dt-acts-in { display: flex; flex: 1; gap: var(--sp-2); }
  .dt-acts-in > .btn { flex: 1 1 0; min-height: var(--ctl); }
  .dt tr.dt-dim > td:not(.dt-acts):not(.dt-aside) { opacity: .72; }
}

/* ───────── sign in ───────── */
.signin .signin-head { display: grid; justify-items: center; gap: var(--sp-4); padding: var(--sp-10) var(--sp-6) var(--sp-2); text-align: center; position: relative; }
.signin .signin-head .brand-mark { width: 56px; height: 56px; border-radius: var(--r-lg); }
.signin .signin-head h2 { font: 650 var(--t-1) var(--font); letter-spacing: var(--ls-1); }
.signin .signin-x { position: absolute; top: var(--sp-3); right: var(--sp-3); color: var(--fg-2); }
.signin .sheet-body { padding: var(--sp-5) var(--sp-6) var(--sp-8); }
.signin .form { gap: var(--sp-4); }
.key-row { position: relative; }
.key-row .field-in { padding-right: 52px; font-family: var(--mono); min-height: 48px; }
.key-row .btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--fg-2); background: transparent; border-color: transparent; box-shadow: none; }
.signin-err { display: flex; align-items: center; gap: var(--sp-2); color: var(--bad); font-weight: 560; }
.signin-err:empty { display: none; }
.signin-err.note { color: var(--fg-2); font-weight: 500; }
.fl-label > label { font-weight: 560; }

/* ───────── shell ─────────
   Phone: top bar, the view, a bottom tab bar (BAR views + More).
   768 px and up: a full-height sidebar (brand, every view, theme, admin)
   and the top bar over the view. The sidebar's brand row is the top bar's
   height, so their hairlines run as one line. */
.shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "top" "main"; }
.top {
  grid-area: top; position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) max(var(--gut), var(--safe-r)) 0 max(var(--gut), var(--safe-l));
  background: var(--bar); border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .top, .tabbar { background: color-mix(in srgb, var(--bar) 86%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); }
}
/* touch screens (the installed iPhone app): solid bars, no live blur of the
   page scrolling under them (iOS redraws a backdrop blur every scrolled frame) */
@media (pointer: coarse) { .top, .tabbar { background: var(--bar); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.brand { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; font: 650 var(--t-h) var(--font); letter-spacing: var(--ls-h); color: var(--fg); min-width: 0; }
.brand-mark { flex: none; display: block; width: 28px; height: 28px; border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-brand); }
.brand-mark img { display: block; width: 100%; height: 100%; }
/* Live: the event stream's state (a dot and its word; phone: the dot) */
.live { flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 28px; padding: 0 var(--sp-3) 0 10px; border-radius: var(--r-pill); background: var(--fill); color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); white-space: nowrap; border: 1px solid var(--line); }
.live.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.live.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.live.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.live .dot { width: 8px; height: 8px; }
.top .spacer { flex: 1; min-width: 0; }
.avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-dot), var(--c7)); color: var(--on-fill); font: 650 var(--t-x) var(--font); line-height: 1; }

/* Top-bar switches: Filling and Proxy. The whole pill is the switch (a
   button, role=switch); the track inside only shows it. One line: the icon
   tile, the word, its state (Proxy: and the host, where there is room) and
   the track; the tile and the track sit concentric in the pill.
   Phone: the tile, the word and On/Off ("Filling On", "Proxy Off"), no track. */
.top-sw { flex: none; display: flex; align-items: center; gap: var(--sp-2); }
.tsw {
  --fi: 26px;
  flex: none; display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--ctl);
  padding: 0 calc((var(--ctl) - 2px - var(--sw-h)) / 2) 0 calc((var(--ctl) - 2px - var(--fi)) / 2);
  border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-btn);
  white-space: nowrap; text-align: left;
  transition: background var(--t-med), border-color var(--t-med), opacity var(--t-med), transform var(--t-fast) var(--ease); -webkit-tap-highlight-color: transparent;
}
.tsw:active { transform: scale(.97); }
@media (hover: hover) { .tsw:hover { border-color: var(--line-3); } }
.tsw-i { flex: none; display: grid; place-items: center; width: var(--fi); height: var(--fi); border-radius: 50%; background: var(--ok-soft); color: var(--ok); transition: background var(--t-med), color var(--t-med); }
.tsw-i svg.i { width: 15px; height: 15px; stroke-width: 2.1; }
.tsw-t { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.tsw-l { font: 600 var(--t-c) var(--font); letter-spacing: var(--ls-c); color: var(--fg); }
.tsw-r { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.tsw-s { font: 600 var(--t-c) var(--font); letter-spacing: var(--ls-c); color: var(--ok); }
.tsw-s.short { display: none; }
.tsw-c { font: 500 var(--t-x) var(--mono); color: var(--fg-2); }
.tsw .switch { margin-left: var(--sp-1); }
.tsw[aria-checked="true"] .switch { background: var(--ok-dot); box-shadow: none; }
.tsw[aria-checked="true"] .switch::after { transform: translateX(calc(var(--sw-w) - var(--sw-h))); }
.tsw.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.tsw.warn .tsw-i { background: color-mix(in srgb, var(--warn-dot) 24%, transparent); color: var(--warn); }
.tsw.warn .tsw-s { color: var(--warn); }
/* Proxy off (proxyless) is a normal state: neutral, not a warning */
.tsw.idle .tsw-i { background: var(--fill); color: var(--fg-2); }
.tsw.idle .tsw-s { color: var(--fg-2); }
/* no proxy saved: dimmed; a tap opens Settings → Task proxy */
.tsw[aria-disabled="true"] { opacity: .55; box-shadow: none; }
.tsw[aria-disabled="true"]:active { transform: none; }
@media (min-width: 768px) and (pointer: coarse) { .tsw { --fi: 30px; } .tsw-i svg.i { width: 16px; height: 16px; } }
/* the proxy host: tablets from 900 px, desktops from 1280 px (pool chips
   take the room below that); never beside a long Filling state */
@media (max-width: 899.98px), (min-width: 1280px) and (max-width: 1365.98px) { .tsw-c { display: none; } }
@media (max-width: 1099.98px), (min-width: 1280px) and (max-width: 1439.98px) { .top-sw:has(.fill-sw .tsw-s.long) .tsw-c { display: none; } }
/* tablets below 900 px: a long Filling state ("Backing off") takes Live's word */
@media (min-width: 768px) and (max-width: 899.98px) {
  .top:has(.fill-sw .tsw-s.long) .live { padding: 0; width: 28px; justify-content: center; }
  .top:has(.fill-sw .tsw-s.long) .live-txt { display: none; }
}
@media (max-width: 767.98px) {
  .top { gap: var(--sp-2); }
  .top-brand > span:not(.brand-mark) { display: none; }
  .tsw { --fi: 28px; gap: var(--sp-2); padding-right: var(--sp-3); }
  .tsw-t { gap: var(--sp-1); }
  /* tuned to fit both pills beside the brand and Live from 360 px */
  .tsw-l, .tsw-s { font-size: 15px; line-height: 20px; letter-spacing: -.01em; }
  .tsw .switch, .tsw-s.long { display: none; }
  .tsw-s.short { display: inline; }
}
@media (max-width: 389.98px) { .tsw-l, .tsw-s { font-size: 14px; } }
@media (max-width: 374.98px) {
  .top, .top-sw { gap: var(--sp-1); }
  .tsw { gap: var(--sp-1); padding-right: var(--sp-2); }
}
@media (max-width: 359.98px) { .top-brand { display: none; } }

/* pool chips (desktop from 1280 px): each pool's ready / minimum, a link to
   Pools; a hairline sets them apart from the switches */
.top-pools { display: none; }
@media (min-width: 1280px) {
  .top-pools { flex: none; display: flex; gap: var(--sp-2); }
  .top-pools + .top-sw { padding-left: var(--sp-3); border-left: 1px solid var(--line); }
  .tp { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--ctl); padding: 0 var(--sp-3); border-radius: var(--r-pill); color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); white-space: nowrap; border: 1px solid transparent; transition: border-color var(--t-fast), background var(--t-fast); }
  @media (hover: hover) { .tp:hover { border-color: var(--line); background: var(--hover); } }
  .tp-n { color: var(--fg); font-weight: 650; }
  .tp-of { color: var(--fg-3); font-weight: 500; }
}

/* phone: bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tab-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: var(--bar); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); min-width: 0;
  color: var(--fg-3); font: 600 var(--t-u) var(--font); letter-spacing: var(--ls-u); -webkit-user-select: none; user-select: none;
}
.tab-i { position: relative; display: grid; place-items: center; width: 56px; height: 32px; border-radius: var(--r-pill); transition: background var(--t-med) var(--ease), color var(--t-med); }
.tab-i .dot { position: absolute; top: var(--sp-1); right: var(--sp-3); width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--bar); }
.tab svg.i { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--fg); }
.tab[aria-current="page"] .tab-i { background: var(--accent-soft); color: var(--accent); }
.tab:active .tab-i { background: var(--press); }
.tab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar { display: none; }
@media (max-width: 767.98px) {
  :root { --bar-b: calc(var(--tab-h) + var(--safe-b)); --end-air: 32px; }
  .top .live-txt { display: none; }
  .top .live { padding: 0; width: 28px; justify-content: center; }
}
/* tablet and desktop: the sidebar. The brand row is the top bar's height
   (hairline under both); the views; then theme and the admin at the foot. */
@media (min-width: 768px) {
  .tabbar { display: none; }
  .top-brand { display: none; }
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "side top" "side main"; }
  .top { padding-left: max(var(--gut), var(--safe-l)); }
  .sidebar {
    grid-area: side; position: sticky; top: 0; align-self: start;
    height: 100dvh; display: flex; flex-direction: column;
    padding: 0 0 calc(var(--sp-3) + var(--safe-b)) var(--safe-l);
    background: var(--bg-side); border-right: 1px solid var(--line);
  }
  .side-brand { flex: none; min-height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--sp-4) 0 var(--sp-5); border-bottom: 1px solid var(--line); }
  .brand-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-list { display: grid; gap: var(--sp-1); align-content: start; overflow: auto; flex: 1; min-height: 0; padding: var(--sp-4) var(--sp-3); }
  .side-a {
    position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 36px; padding: 0 var(--sp-3); border-radius: var(--r-sm);
    color: var(--fg-2); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); -webkit-user-select: none; user-select: none;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .side-a svg.i { width: 18px; height: 18px; color: var(--fg-3); transition: color var(--t-fast); }
  .side-a .n-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-a .n-badge { margin-left: auto; min-width: 24px; padding: 0 var(--sp-2); border-radius: var(--r-pill); color: var(--fg-2); font: 600 var(--t-x) var(--font); text-align: center; background: var(--fill); }
  .side-a .n-dot { display: inline-flex; justify-content: center; min-width: 0; padding: 0; background: none; }
  .side-a[aria-current="page"] { background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 var(--hl), var(--shadow-card); }
  .side-a[aria-current="page"] svg.i { color: var(--accent); }
  .side-a[aria-current="page"] .n-badge:not(.n-dot) { background: var(--accent-soft); color: var(--accent); }
  @media (hover: hover) { .side-a:not([aria-current="page"]):hover { background: var(--hover); color: var(--fg); } .side-a:not([aria-current="page"]):hover svg.i { color: var(--fg-2); } }
  .side-a:active:not([aria-current="page"]) { background: var(--press); }
  .side-foot { flex: none; display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-3) 0; border-top: 1px solid var(--line); min-width: 0; }
  .side-theme button { min-height: 28px; padding: 0; }
  .side-theme .seg-l { display: none; }
  .side-acct { display: flex; align-items: center; gap: var(--sp-3); padding-left: var(--sp-1); min-width: 0; }
  .side-acct .btn { flex: none; color: var(--fg-2); }
  .side-who { display: grid; flex: 1; min-width: 0; }
  .side-name { font: 600 var(--t-c) var(--font); letter-spacing: var(--ls-c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-who > span { font: 500 var(--t-x) var(--font); color: var(--fg-3); }
}
@media (min-width: 768px) and (pointer: coarse) { .side-a { min-height: 44px; } .side-theme button { min-height: 40px; } }
@media (min-width: 768px) and (max-width: 1099.98px) { :root { --side-w: 212px; } .side-acct { gap: var(--sp-2); } }

/* More (phone): the views not in the tab bar, the theme, the admin */
.more .sheet-body { padding: var(--sp-4) var(--pad) var(--sp-6); display: grid; gap: var(--sp-6); }
.more-list { display: grid; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); overflow: hidden; }
.more-list .prow { min-height: 56px; padding-left: var(--sp-3); }
.more-list .prow:last-child { border-bottom: 0; }
.more-a { color: var(--fg); }
.more-a .more-i { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }
.more-a .more-i svg.i { width: 18px; height: 18px; }
.more-a[aria-current="page"] .names { color: var(--accent); }
.more-a .side { min-width: 28px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--fill); text-align: center; font-weight: 600; }
.more-theme { display: grid; gap: var(--sp-2); }
.more-theme .micro { padding-left: var(--sp-1); }
.more-theme .seg button { min-height: 44px; }
.more-acct { display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); min-width: 0; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); }
.more-acct .avatar { width: 40px; height: 40px; font: 650 var(--t-c) var(--font); }
.more-acct .side-who { display: grid; flex: 1; min-width: 0; }
.more-acct .side-who b { font-weight: 600; overflow-wrap: anywhere; }
.more-acct .side-who span { color: var(--fg-2); font: 500 var(--t-c) var(--font); }

.main { grid-area: main; min-width: 0; padding: var(--sp-6) max(var(--gut), var(--safe-r)) calc(var(--bar-b) + var(--end-air)) max(var(--gut), var(--safe-l)); }
@media (min-width: 1100px) { .main { padding-top: var(--sp-8); } }
/* one column that never grows past the screen: a row's long unbreakable
   text (a key name, a route) ellipsizes instead of widening the page */
/* The frame (signed in): the window itself never scrolls. The bars hold
   still by construction and the view scrolls inside .main, moved only by
   the reader: no page-level bounce, scroll anchoring or inset quirk of an
   installed iPhone app can move the page. */
html.frame, html.frame body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.frame .shell {
  position: fixed; inset: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr);
  --in-top: 0px; --port-h: calc(100dvh - var(--top-h) - var(--safe-t));
}
html.frame .main { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 768px) { html.frame .sidebar { position: relative; top: auto; height: auto; align-self: stretch; min-height: 0; } }
.view { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-4); animation: viewin var(--t-med) var(--ease); }
@keyframes viewin { from { opacity: 0; transform: translateY(4px); } }
@media (min-width: 768px) { .view { gap: var(--sp-5); } }
/* the offline notice and "Update available" float under the top bar, over
   the view: coming and going, they never move the page */
.floats { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); top: calc(var(--top-h) + var(--safe-t) + var(--sp-2));
  width: min(440px, calc(100% - 2 * var(--gut))); display: grid; gap: var(--sp-2); pointer-events: none; }
.floats:empty { display: none; }
.floats > * { pointer-events: auto; box-shadow: var(--shadow-pop); }
@media (min-width: 768px) { .floats { left: calc(50% + var(--side-w) / 2); width: min(440px, calc(100% - var(--side-w) - 2 * var(--gut))); } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-height: 44px; }
.view-head h1 { margin-right: auto; }
.view-acts { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.view-meta { color: var(--fg-2); font: var(--t-c) var(--font); }
.acts { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); padding: var(--pad); min-width: 0;
}
.card-head { display: flex; align-items: center; gap: var(--sp-3); min-height: 32px; min-width: 0; }
.card-head h2 { margin-right: auto; min-width: 0; }
.card-i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--fill); color: var(--fg-2); flex: none; }
.empty { display: grid; justify-items: center; gap: var(--sp-3); text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--fg-2); }
.empty b { color: var(--fg); font: 600 var(--t-h) var(--font); }
.big-empty { padding: var(--sp-12) var(--sp-6); }
.empty-i { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-xl); background: var(--accent-soft); color: var(--accent); margin-bottom: var(--sp-1); }
.empty-i svg.i { width: 26px; height: 26px; }
.notice { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: var(--r-lg); font-weight: 560; background: var(--fill); color: var(--fg); border: 1px solid var(--line); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.notice .btn { margin-left: auto; }
.notice .grow + .btn { margin-left: 0; }

/* ───────── pools ─────────
   == Pools == Two pool cards (the gauge against the minimum, the pool's
   settings, six facts, the queue by priority P1 … P5, the ready items) side
   by side from 1180 px, then the Upstream tasks card (four facts, the
   in-flight list). Labels are sentence case over their values. */
.grid2 { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1180px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pool { display: grid; gap: var(--sp-5); align-content: start; overflow: clip; }
.pool::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--kc), transparent 70%); opacity: .8; }
.pool.k-token { --kc: var(--k-token); }
.pool.k-clearance { --kc: var(--k-clearance); }
.pool-head { min-height: var(--ctl); }
.pool-head .kdot { width: 10px; height: 10px; }
.pool-head h2 { font: 650 var(--t-h) var(--font); letter-spacing: var(--ls-h); overflow-wrap: anywhere; }
.pool .card-head .btn { margin-left: var(--sp-1); }
/* the gauge and the pool's settings beside it */
.pool-top { display: flex; align-items: center; gap: var(--sp-6); min-width: 0; }
.gauge { position: relative; flex: none; width: 148px; height: 148px; }
.gauge svg { width: 100%; height: 100%; overflow: visible; }
.g-track, .g-fill { fill: none; stroke-width: 10; stroke-linecap: round; }
.g-track { stroke: var(--fill-2); }
.g-fill { stroke: var(--idle-dot); stroke-dashoffset: var(--off); transition: stroke-dashoffset var(--t-slow) var(--ease), stroke var(--t-med); }
.g-fill.k-token { stroke: var(--k-token); }
.g-fill.k-clearance { stroke: var(--k-clearance); }
.g-fill.warn { stroke: var(--warn-dot); }
.g-fill.bad { stroke: var(--bad-dot); }
.g-min { stroke: var(--fg); stroke-width: 2.5; stroke-linecap: round; opacity: .8; }
.g-mid { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 0; padding-top: var(--sp-1); }
.g-mid .kpi { font: 650 var(--t-kpi) var(--font); letter-spacing: var(--ls-kpi); }
.g-mid .micro { color: var(--fg-2); }
.pool-set { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: var(--sp-4) var(--sp-8); align-content: center; }
.ps { display: grid; gap: var(--sp-0); min-width: 0; }
.ps:last-child { grid-column: 1 / -1; }
.ps dt { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.ps dd { min-width: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.ps dd b { color: var(--fg); font: 650 var(--t-num) var(--font); letter-spacing: var(--ls-num); }
.ps dd b.bad-t { color: var(--bad); }
.ps .ps-sub { font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
/* six facts (four on the tasks card): a well grid with hairlines */
.pool-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: clip; }
.pf { display: grid; gap: var(--sp-1); align-content: start; min-width: 0; padding: var(--sp-3) var(--sp-4); background: var(--well); }
.pf dt { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf dd { min-width: 0; font: 650 var(--t-num) var(--font); letter-spacing: var(--ls-num); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf dd small { margin-left: var(--sp-0); color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.pf .soon, .pf.bad dd { color: var(--bad); }
.pf.warn dd { color: var(--warn); }
.wk-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* the queue: P1 (served first) … P5, a lane each with its count and a bar */
.pool-q { display: grid; gap: var(--sp-3); }
.pool-qh { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); }
.pool-qt { font: 600 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.pool-qs { color: var(--fg-2); font: var(--t-x) var(--font); letter-spacing: var(--ls-x); }
.lvls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
.lvl { position: relative; display: grid; gap: var(--sp-0); min-width: 0; padding: var(--sp-2) var(--sp-3) var(--sp-3); border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line); overflow: clip; }
.lvl-l { color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
.lvl-n { color: var(--fg-3); font: 650 var(--t-num) var(--font); letter-spacing: var(--ls-num); }
.lvl.on { background: var(--accent-soft); border-color: var(--accent-line); }
.lvl.on .lvl-n { color: var(--fg); }
.lvl.on .lvl-l { color: var(--accent); }
.lvl-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }
.lvl-bar > span { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--v, 0) * 100%); background: var(--accent-dot); transition: width var(--t-slow) var(--ease); }
/* ready items: the fold, then the list (bleeds to the card's edges) */
.pool-items { display: grid; min-width: 0; margin: calc(-1 * var(--sp-2)) 0 0; }
.pool-items.open { gap: var(--sp-2); }
.pool-disc .count { font-variant-numeric: tabular-nums; }
@media (max-width: 599.98px) {
  .pool-top { gap: var(--sp-4); }
  .gauge { width: 128px; height: 128px; }
  .g-mid .kpi { font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); }
  .pool-set { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
  .ps dd b { font: 650 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
  .pool-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lvls { gap: var(--sp-1); }
  .lvl { padding: var(--sp-2) var(--sp-2) var(--sp-3); }
}
.disclose {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--ctl); margin: 0 calc(-1 * var(--sp-2)); width: calc(100% + 16px);
  padding: 0 var(--sp-2); border-radius: var(--r-sm); font-weight: 600; color: var(--fg); text-align: left;
}
@media (hover: hover) { .disclose:hover:not(:disabled) { background: var(--hover); } }
.disclose:disabled { color: var(--fg-2); }
.disclose .count { color: var(--fg-3); font-weight: 500; }
.disclose svg.i { margin-left: auto; color: var(--fg-3); transition: transform var(--t-fast); }
.disclose[aria-expanded="true"] svg.i { transform: rotate(180deg); }
/* rows: a list of tappable lines that open details */
.rows { display: grid; margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--pad)); border-top: 1px solid var(--line); }
.rows > li + li { border-top: 1px solid var(--line); }
.card > .rows:first-child { margin-top: calc(-1 * var(--pad)); border-top: 0; }
.card > .rows:first-child > li:first-child .row { border-radius: var(--r-card) var(--r-card) 0 0; }
.card > .rows:first-child > li:only-child .row { border-radius: var(--r-card); }
.row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--row); padding: var(--sp-3) var(--pad); text-align: left; color: var(--fg); transition: background var(--t-fast); }
.rows > li:last-child .row { border-radius: 0 0 var(--r-card) var(--r-card); }
@media (hover: hover) { .row:hover { background: var(--hover); } }
.row:active { background: var(--press); }
.row-main { display: grid; gap: var(--sp-1); flex: 1; min-width: 0; }
.row > svg.i { color: var(--fg-3); }
/* long lists (in-flight tasks, ready items): filter box, "Showing 100 of 1,000 · Load more" */
.list-search { margin: var(--sp-1) 0; }
.list-search .search { width: 100%; }
.rows.has-foot { margin-bottom: 0; }
.rows.has-foot > li:last-child .row { border-radius: 0; }
.list-foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3);
  margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--pad)); padding: var(--sp-3) var(--pad); border-top: 1px solid var(--line);
  background: var(--well); border-radius: 0 0 var(--r-card) var(--r-card);
}
.list-n { color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); font-variant-numeric: tabular-nums; min-width: 0; }
.list-acts { display: flex; gap: var(--sp-2); margin-left: auto; }
/* a ready item: number · id and browser, then age · time left and the life bar */
.row.pr { align-items: center; gap: var(--sp-3); padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.pr-n { flex: none; align-self: start; display: grid; place-items: center; min-width: max(28px, calc(var(--nd, 1) * 1ch + 2 * var(--sp-1) + 2px)); height: 28px; padding: 0 var(--sp-1); border-radius: var(--r-sm); background: var(--fill); color: var(--fg-2); font: 600 var(--t-x) var(--font); font-variant-numeric: tabular-nums; }
.pr-main { display: grid; gap: var(--sp-1); flex: 1; min-width: 0; }
.pr-top { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.pr-id { flex: none; font: 560 var(--t-m) var(--mono); color: var(--fg); }
.pr-ua { flex: 0 1 auto; min-width: 0; margin-left: auto; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-meta { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); font-variant-numeric: tabular-nums; min-width: 0; }
.pr-meta b { color: var(--fg); font-weight: 560; }
.pr-meta .soon { color: var(--bad); }
.life { display: block; height: 4px; margin-top: var(--sp-1); border-radius: var(--r-pill); background: var(--fill-2); overflow: hidden; }
.life > span { display: block; height: 100%; width: calc(var(--v, 0) * 100%); background: var(--kc, var(--accent-dot)); border-radius: var(--r-pill); transition: width 1s linear; }
.life.k-token { --kc: var(--k-token); }
.life.k-clearance { --kc: var(--k-clearance); }
.life.soon > span { background: var(--bad-dot); }
.route { display: flex; align-items: baseline; gap: var(--sp-1) var(--sp-2); flex-wrap: wrap; min-width: 0; }
.route .names { font-weight: 560; overflow-wrap: anywhere; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-0) var(--sp-4); color: var(--fg-2); font: var(--t-c) var(--font); min-width: 0; }
.meta b { color: var(--fg); font-weight: 560; }
.meta .soon { color: var(--bad); }
.meta > * { min-width: 0; overflow-wrap: anywhere; }

/* stat tiles (QP modules: .stats > .stat) */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--well); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); min-width: 0; display: grid; gap: var(--sp-1); }
.stat dt { color: var(--fg-3); }
.stat dd { font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); }
.stat dd small { font: 500 var(--t-c) var(--font); color: var(--fg-3); letter-spacing: 0; }
.stat.bad dd { color: var(--bad); }

/* the Upstream tasks card. In-flight rows, narrow: the route and the task id,
   then the status · polls · running time; from 640 px of room one line in
   columns under their heads (.fr-head). */
.workers { display: grid; gap: var(--sp-4); container: wk / inline-size; }
.workers .none { padding: var(--sp-1) 0; color: var(--fg-2); }
.scaler { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-lg); background: var(--accent-soft); color: var(--fg); border: 1px solid var(--accent-line); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.scaler svg.i { color: var(--accent); margin-top: var(--sp-0); }
.fr-wrap { display: grid; gap: var(--sp-2); min-width: 0; }
.fr-head { display: none; }
.row.fr {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; grid-template-areas: "route id chev" "meta meta chev";
  align-items: center; gap: var(--sp-1) var(--sp-3);
}
.fr .fr-route { grid-area: route; min-width: 0; font-weight: 560; }
.fr .fr-route .rfit { max-width: 100%; }
.fr .fr-id { grid-area: id; color: var(--fg-2); font: 500 var(--t-x) var(--mono); white-space: nowrap; }
.fr-meta { grid-area: meta; display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--sp-4); min-width: 0; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); white-space: nowrap; }
.fr-meta b { color: var(--fg); font-weight: 560; }
.fr .fr-run { color: var(--fg); font-weight: 560; }
.fr-st { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.fr > svg.i { grid-area: chev; }
@container wk (min-width: 640px) {
  .fr-head, .row.fr {
    display: grid; grid-template-columns: minmax(0, 1fr) 112px 128px 72px 112px 20px; grid-template-areas: "route id st polls run chev";
    align-items: center; column-gap: var(--sp-4);
  }
  .fr-head { margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--sp-2)); padding: var(--sp-2) var(--pad); color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
  .fr-head::after { content: ""; grid-area: chev; }
  .row.fr { min-height: var(--row); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
  .fr-meta { display: contents; }
  .fr-route { grid-area: route; min-width: 0; }
  .fr-id { grid-area: id; }
  .fr-st { grid-area: st; }
  .fr-polls { grid-area: polls; justify-self: end; }
  .fr-run { grid-area: run; justify-self: end; font-variant-numeric: tabular-nums; }
  .fr .fr-u { display: none; }
  .fr .fr-st, .fr .fr-polls { color: var(--fg-2); }
}
/* a sheet's lead (an item, a task): two or three big values, a bar under them */
.sh-hero { display: grid; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); min-width: 0; }
.sh-stats { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-8); min-width: 0; }
.sh-stat { display: grid; gap: var(--sp-0); min-width: 0; }
.sh-stat dt { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.sh-stat dd { font: 650 var(--t-num) var(--font); letter-spacing: var(--ls-num); white-space: nowrap; }
.sh-stat dd .soon { color: var(--bad); }
.sh-stat dd .fr-st { font: 560 var(--t-b) var(--font); letter-spacing: var(--ls-b); }
.sh-hero .life { height: 6px; margin: 0; }
.sh-route { padding: var(--sp-1) 0 0; font: 600 var(--t-2) var(--font); letter-spacing: var(--ls-2); }
.sh-route .route { gap: var(--sp-1) var(--sp-3); }
.sh-route .route .code { font-weight: 500; }

/* ───────── settings ─────────
   == Settings ==
   Desktop (≥ 1100): the section nav on the left (sticky), the cards on the
   right. Phone and tablet: a row of section chips under the title. A
   setting is a .frow: label (+ the changed dot) and a short hint on the
   left, the control on the right, flush with the card's edge (.wide: the
   control on its own line under them; .wide-ph: the same on a phone only;
   .nh: no hint). A number's read-back ("3 min") sits left of its field
   (phone: under it). */
.set-wrap { display: grid; gap: var(--sp-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
.set-nav { display: none; }
/* phone and tablet: the chips wrap inside the gutters (SET_JUMPS: short words), so every one shows */
.set-jumps { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
@media (max-width: 767.98px) {
  /* rows fill the width: seven chips make two full rows at 360–430 px */
  .set-jumps .set-j { flex: 1 1 auto; padding: 0 var(--sp-3); }
}
.set-j {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--ctl); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-btn);
  color: var(--fg); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}
.set-j svg.i { color: var(--fg-2); }
@media (hover: hover) { .set-j:hover { background: var(--fill); } }
.set-j:active { background: var(--fill-2); }
.set-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dot); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (min-width: 1100px) {
  .set-jumps { display: none; }
  .set-wrap { grid-template-columns: 224px minmax(0, 1fr); gap: var(--sp-8); }
  .set-nav { display: grid; gap: var(--sp-0); position: sticky; top: calc(var(--in-top) + var(--sp-6)); }
  .set-a { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--ctl); padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--fg-2); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); text-align: left; transition: background var(--t-fast), color var(--t-fast); }
  .set-a svg.i { color: var(--fg-3); }
  .set-a-l { flex: 1; min-width: 0; }
  @media (hover: hover) { .set-a:not([aria-current]):hover { background: var(--hover); color: var(--fg); } }
  .set-a[aria-current] { background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 var(--hl), var(--shadow-card); }
  .set-a[aria-current] svg.i { color: var(--accent); }
}
.set-main { display: grid; gap: var(--gap); min-width: 0; max-width: 880px; }

/* cards */
.set-card { padding: 0; overflow: clip; scroll-margin-top: calc(var(--in-top) + var(--sp-4)); }
.set-card.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent-ring), inset 0 1px 0 var(--hl); } 100% { box-shadow: 0 0 0 0 transparent, inset 0 1px 0 var(--hl), var(--shadow-card); } }
.set-h { display: flex; align-items: center; gap: var(--sp-3); min-height: calc(var(--ctl) + 2 * var(--sp-3)); padding: var(--sp-3) var(--pad); border-bottom: 1px solid var(--line); }
.set-h h2 { margin-right: auto; min-width: 0; }
.set-i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--fill); color: var(--fg-2); flex: none; }
.set-i.k-token { background: color-mix(in srgb, var(--k-token) 16%, transparent); color: var(--k-token); }
.set-i.k-clearance { background: color-mix(in srgb, var(--k-clearance) 16%, transparent); color: var(--k-clearance); }
@media (min-width: 768px) { .set-i { width: 28px; height: 28px; } }

/* one setting */
.frow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l c" "h c";
  align-items: center; column-gap: var(--sp-4); row-gap: var(--sp-1);
  padding: var(--sp-4) var(--pad); border-top: 1px solid var(--line); min-width: 0;
}
.frow.nh { grid-template-areas: "l c"; }
.set-h + .frow, .set-sub + .frow, .px-none + .frow { border-top: 0; }
.fr-l { grid-area: l; align-self: end; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; color: var(--fg); font: 560 var(--t-b) var(--font); letter-spacing: var(--ls-b); }
.fr-l > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.frow.nh .fr-l { align-self: center; }
.fr-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dot); box-shadow: 0 0 0 3px var(--accent-soft); }
.fr-h { grid-area: h; align-self: start; min-width: 0; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.fr-ctl { grid-area: c; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); min-width: 0; }
.fr-aside { grid-area: a; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); min-width: 0; }
.frow > .fr-sub, .frow > .fr-err { grid-column: 1 / -1; }
.fr-human { order: -1; color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); white-space: nowrap; }
.fr-human:empty { display: none; }
.fr-err { display: flex; align-items: center; gap: var(--sp-2); justify-self: end; margin-top: var(--sp-1); color: var(--bad); font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.fr-err svg.i { width: 16px; height: 16px; }
.fr-sub { display: flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; }
.frow.changed { background: linear-gradient(90deg, color-mix(in srgb, var(--accent-dot) 8%, transparent), transparent 70%); }
/* the control on its own line */
.frow.wide { grid-template-areas: "l a" "h h" "c c"; }
.frow.wide.nh { grid-template-areas: "l a" "c c"; }
.frow.wide > .fr-ctl { margin-top: var(--sp-2); justify-content: stretch; }
.frow.wide > .fr-err, .frow.wide > .fr-sub { justify-self: start; justify-content: flex-start; }
.frow.wide .field-in { width: 100%; }
/* number fields (.num-in is the design system's) */
.num-in { position: relative; display: inline-flex; align-items: center; }
.num-in .field-in { width: 132px; padding-right: 52px; text-align: right; font-weight: 600; }
.num-in .unit { position: absolute; right: 12px; color: var(--fg-3); font: 500 var(--t-x) var(--font); pointer-events: none; }
.range { display: flex; align-items: center; gap: var(--sp-2); }
.range-to { color: var(--fg-2); }
.range .num-in .field-in { width: 120px; }
.range .fr-human { margin-right: var(--sp-1); }
.frow .select-wrap { width: 260px; max-width: 100%; }
@media (max-width: 599.98px) {
  .fr-ctl { flex-direction: column; align-items: flex-end; gap: var(--sp-1); }
  .fr-human { order: 0; font: 500 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
  .frow .num-in .field-in { width: 124px; }
  .frow.wide-ph { grid-template-columns: minmax(0, 1fr); grid-template-areas: "l" "h" "c"; }
  .frow.wide-ph.nh { grid-template-areas: "l" "c"; }
  .frow.wide-ph > .fr-ctl { margin-top: var(--sp-2); align-items: stretch; }
  .frow.wide-ph > .fr-err { justify-self: start; }
  .frow .select-wrap { width: 100%; }
  .range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: var(--sp-2); row-gap: var(--sp-1); }
  .range .num-in, .range .num-in .field-in { width: 100%; }
  .range .fr-human { grid-column: 1 / -1; justify-self: end; margin: 0; }
}

/* Filling: applies at once */
.fill-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--pad); }
.fill-t { display: grid; gap: var(--sp-1); min-width: 0; }
.fill-t h2 { font: 650 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
.fill-s { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); min-width: 0; }
.fill-h { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.set-fill .fill-ico { width: 40px; height: 40px; border-radius: var(--r-md); }
.set-fill.on .fill-ico { background: var(--ok-soft); color: var(--ok); }
.set-fill:not(.on) .fill-ico { background: var(--warn-soft); color: var(--warn); }

/* Task proxy (DECISIONS QP23): the URL with its password masked and a parsed read-back; Proxy on/off is the header's switch (the same as the top bar's). */
.px-set-sw { flex: none; }
.px-set-sw .sw-txt { color: var(--fg); font-weight: 600; }
.px-none { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) var(--pad) 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.px-none svg.i { flex: none; color: var(--fg-3); }
.px-in { position: relative; display: block; width: 100%; min-width: 0; }
.px-in .field-in { width: 100%; text-overflow: ellipsis; }
.px-in.pw .field-in { padding-right: calc(var(--ctl) + 4px); }
.px-in .btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: calc(var(--ctl) - 4px); min-height: calc(var(--ctl) - 4px); color: var(--fg-2); background: transparent; border-color: transparent; box-shadow: none; }
.px-in .btn:active:not(:disabled) { transform: translateY(-50%) scale(.96); }
@media (pointer: coarse) { .px-in .field-in { min-height: var(--ctl-lg); } .px-in .btn { width: var(--ctl); min-height: var(--ctl); } }
.px-prev { flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); min-width: 0; }
.px-f { display: inline-flex; align-items: baseline; gap: var(--sp-2); max-width: 100%; min-width: 0; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-pill); background: var(--fill); border: 1px solid var(--line); font: var(--t-x) var(--font); letter-spacing: var(--ls-x); }
.px-k { flex: none; color: var(--fg-2); }
.px-f b { min-width: 0; overflow-wrap: anywhere; font-weight: 600; color: var(--fg); }
.px-f.none b { color: var(--fg-2); font-weight: 500; }

/* Alerts (DECISIONS QP24): the bot's state under its label, Send test on the right */
.tg-st { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 560; overflow-wrap: anywhere; }
.tg-st.warn { color: var(--warn); }
.tg-row .btn { flex: none; white-space: nowrap; }
.frow .sw-row .sw-txt { min-width: 3ch; text-align: right; }
@media (max-width: 599.98px) { .frow.tg-row { grid-template-areas: "l c" "h h"; } .tg-row > .fr-l { align-self: center; } }

/* Task routes: the selected pairs, grouped by source */
.set-sub { padding: var(--sp-5) var(--pad) 0; border-top: 1px solid var(--line); }
.rt-row .fr-ctl { flex-direction: row; align-items: center; gap: var(--sp-3); }
.rt-n { display: inline-flex; align-items: baseline; gap: var(--sp-1); white-space: nowrap; }
.rt-n b { font: 650 var(--t-kpi-s) var(--font); letter-spacing: var(--ls-kpi-s); color: var(--fg); }
.rt-of { color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.rt-diff { display: inline-flex; gap: var(--sp-1); }
.rt-tools { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: 0 var(--pad) var(--sp-4); }
.rt-search { flex: 1 1 240px; min-width: 0; }
@media (max-width: 599.98px) {
  .rt-tools .btn { padding: 0 var(--sp-3); }
  .rt-tools .btn.primary { flex: 1 1 100%; }
  .rt-tools .btn:not(.primary) { flex: 1 1 auto; }
  .rt-search { flex-basis: 100%; }
}
.rt-list { container: rt / inline-size; margin: 0 var(--pad) var(--sp-4); border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); overflow: clip; }
.rgroups { padding: 0 var(--sp-3); }
.rg { display: grid; gap: var(--sp-2); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); min-width: 0; }
.rg:last-child { border-bottom: 0; }
.rg-src { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.rg-src b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-meta { display: inline-flex; align-items: baseline; gap: var(--sp-2); white-space: nowrap; flex: 1; }
.rg-n { display: inline-grid; place-items: center; min-width: var(--chip); margin-left: auto; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--fill); color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
/* a narrow list: the source over its chips; from 640 px of room: side by side */
@container rt (min-width: 640px) {
  .rgroups { padding: 0 var(--sp-4); }
  .rg { grid-template-columns: 200px minmax(0, 1fr); align-items: start; gap: var(--sp-4); }
  .rg-src { min-height: var(--ctl-sm); align-items: center; }
  .rg-meta { flex: none; }
  .rg-n { margin-left: 0; }
}
/* a pair: the destination code and its ×, a tight wrap of small chips */
.rchips { display: flex; flex-wrap: wrap; gap: var(--sp-2); min-width: 0; }
.rmore { display: flex; }
.rchip, .rchip-more {
  display: inline-flex; align-items: center; min-height: var(--ctl-sm); border-radius: var(--r-sm);
  background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow-btn);
}
.rchip { padding-left: var(--sp-2); }
.rchip .code { color: var(--fg); font-weight: 560; }
.rchip .x { flex: none; align-self: stretch; width: var(--sp-8); border-radius: var(--r-sm); display: grid; place-items: center; color: var(--fg-2); }
.rchip .x svg.i { width: 14px; height: 14px; }
.rchip-more { padding: 0 var(--sp-3); color: var(--accent); background: var(--fill); border-color: transparent; box-shadow: none; font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
@media (hover: hover) {
  .rchip .x:hover { background: var(--bad-soft); color: var(--bad); }
  .rchip-more:hover { background: var(--fill-2); }
}
.rchip-more:active { background: var(--fill-2); }
.rt-foot { margin: 0; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }
.rt-empty { display: grid; justify-items: center; gap: var(--sp-2); margin: 0 var(--pad) var(--sp-4); padding: var(--sp-6); border-radius: var(--r-lg); background: var(--well); border: 1px dashed var(--line-2); color: var(--fg-2); text-align: center; }
.rt-empty svg.i { width: 24px; height: 24px; color: var(--fg-3); }
.rt-empty b { color: var(--fg); }
.rt-none { padding: var(--sp-4); color: var(--fg-2); }

/* Requests (read-only) */
.ro-kv { padding: 0 var(--pad); }
.ro-kv .kv-r { align-items: center; padding: var(--sp-3) 0; min-height: var(--row); }
.ro-kv .kv-r > dt { flex: 1 1 auto; display: grid; min-width: 0; color: var(--fg); font: inherit; }
.ro-kv .kv-r > dd { flex: none; display: inline-flex; align-items: center; font-weight: 600; white-space: nowrap; }
.ro-l { font: 560 var(--t-b) var(--font); letter-spacing: var(--ls-b); }
.ro-s { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); overflow-wrap: anywhere; }
.ro-s.code { font: 500 var(--t-x) var(--mono); white-space: normal; }
.ro-ep { white-space: nowrap; }
.ro-q { display: inline-flex; align-items: baseline; gap: var(--sp-1); font-variant-numeric: tabular-nums; }
.ro-to { color: var(--fg-2); font-weight: 500; }

/* User agents (read-only): each browser's version, its source as a small
   chip beside the label (under it on a phone), then when it was fetched
   and the next refresh */
.ua-kv .ua-r > dt { gap: var(--sp-1); }
.ua-srcs { display: flex; flex-wrap: wrap; gap: var(--sp-1); min-width: 0; }
@media (min-width: 600px) { .ua-kv .ua-r > dt { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); } }
.ua-kv .ua-r > dd { font-variant-numeric: tabular-nums; }
.ua-foot { padding: var(--sp-3) var(--pad) var(--sp-4); border-top: 1px solid var(--line); color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); font-variant-numeric: tabular-nums; }

/* the save bar */
.savebar, .dock {
  position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-3); border-radius: var(--r-lg); background: var(--card-2);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
}
.savebar { animation: rise var(--t-med) var(--ease-spring); padding-left: var(--sp-4); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .savebar { background: color-mix(in srgb, var(--card-2) 86%, transparent); -webkit-backdrop-filter: saturate(1.5) blur(18px); backdrop-filter: saturate(1.5) blur(18px); }
}
.sb-state { display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 0; }
.sb-n { flex: none; display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--accent-fill); color: var(--on-fill); font: 700 var(--t-c) var(--font); }
.sb-t { display: grid; min-width: 0; }
.sb-t b { font-weight: 650; }
.sb-list { color: var(--fg-2); font: var(--t-x) var(--font); letter-spacing: var(--ls-x); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-acts { display: flex; gap: var(--sp-2); }
.savebar .formerr { flex-basis: 100%; display: flex; align-items: center; gap: var(--sp-2); color: var(--bad); font-weight: 560; padding: var(--sp-0) var(--sp-1); }
@media (max-width: 767.98px) { .savebar, .dock { bottom: calc(var(--bar-b) + 10px); } }
@media (max-width: 599.98px) {
  .savebar { padding: var(--sp-3); }
  .sb-state { flex-basis: 100%; }
  .sb-acts { flex: 1; }
  .sb-acts .btn { flex: 1; }
}

/* the add-pairs picker (sheet) */
.picker .seg button { white-space: nowrap; padding: 0 var(--sp-2); }
.picker .sheet-foot .grow { min-width: 0; }
.picker .pick-src b { margin-right: 0; }
.picker .pick-src .btn { margin-left: auto; }
@media (max-width: 599.98px) { .picker .pk-cap { display: none; } }

/* ───────── keys ─────────
   The data table (.dt-wrap.dt-wide) with one row per key; a card per key
   below 1120 px of room. */
.k-name { display: grid; gap: var(--sp-0); min-width: 0; }
.k-n { font-weight: 600; color: var(--fg); }
.k-pre { color: var(--fg-2); font: 500 var(--t-x) var(--mono); white-space: nowrap; }
/* scope chips: compact and stacked in the table, side by side in a card */
.k-scope { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 0 var(--sp-2) 0 var(--sp-2); border-radius: var(--r-pill); background: var(--fill); white-space: nowrap; color: var(--fg); font: 560 var(--t-x) var(--font); letter-spacing: var(--ls-x); }
.k-scope .kdot { width: 7px; height: 7px; }
.k-scopes { display: grid; gap: var(--sp-1); justify-items: start; }
.k-prio { white-space: nowrap; }
.k-used { display: grid; gap: var(--sp-1); min-width: 0; }
.k-used-t { white-space: nowrap; }
.k-used-t b { font-weight: 600; }
.k-used-m { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.k-used-m .meter { flex: 1; min-width: 0; }
.k-used-p { flex: none; min-width: 3.2em; text-align: right; color: var(--fg-2); font: 500 var(--t-x) var(--font); font-variant-numeric: tabular-nums; }
.k-off { color: var(--fg-3); }
/* a revoked key: the status icon in Enabled (the whole badge in a card), "Revoked <ago>" and who in Actions */
.k-rv { display: grid; gap: var(--sp-0); justify-items: end; min-width: 0; color: var(--fg-2); font: var(--t-x) var(--font); letter-spacing: var(--ls-x); white-space: nowrap; text-align: right; }
.k-rv .ell { max-width: 100%; }
.k-rvw { color: var(--bad); font-weight: 600; }
.k-tbl td:has(> .k-rv) { text-align: right; }
.k-tbl .k-rvb { width: 24px; min-height: 24px; padding: 0; justify-content: center; }
.k-tbl .k-rvb svg.i { width: 14px; height: 14px; }
.k-tbl .k-rvl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.k-fold { width: 100%; margin: 0; min-height: 52px; padding: 0 var(--pad); border-radius: 0; }
.k-none { padding: var(--sp-4) var(--pad); color: var(--fg-2); }
.k-tbl .switch { vertical-align: middle; }
/* table mode: the name and prefix ellipsize (title = the whole name); counts, levels and times stay on one line */
/* the name wraps to two lines, then an ellipsis */
.k-tbl .k-n { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.k-tbl .k-pre { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-tbl td.num, .k-tbl .k-prio, .k-tbl .k-used-t { white-space: nowrap; }
/* a time or a "used / limit" after a right-aligned count: a wider gap */
.k-tbl th.k-lastc, .k-tbl td.k-lastc, .k-tbl th.k-usedc, .k-tbl td.k-usedc { padding-left: var(--sp-5); }
/* Threads: "3 / 10"; "/ no limit" goes under the count when the column is too narrow */
.k-tbl td.k-thrc { white-space: normal; }
.k-thr b, .k-thr .muted { white-space: nowrap; }
.k-thr b { font-weight: 600; }
.k-thr.idle b { font-weight: 400; color: var(--fg-2); }
.k-thr.full b { color: var(--warn); }
/* By kind: a dot and a count per line (the kind's name read out only) */
.k-kinds { display: grid; gap: var(--sp-1); justify-items: end; }
.k-kind { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.k-kl { display: inline-flex; align-items: center; }
.k-kind .kdot { width: 7px; height: 7px; }
.k-tbl .k-kw { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@container dtw (max-width: 1119.98px) {
  .k-tbl .k-pre { white-space: normal; overflow-wrap: anywhere; }
  .k-tbl th.k-lastc, .k-tbl td.k-lastc, .k-tbl th.k-usedc, .k-tbl td.k-usedc { padding-left: var(--pad); }
  /* a card: one label–value row per kind, like the td[data-label] rows */
  .k-tbl td.k-kindc { padding: 0; }
  .k-tbl .k-kinds { gap: 0; justify-items: stretch; }
  .k-tbl .k-kind { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-4); min-height: 44px; padding: var(--sp-2) var(--pad); border-top: 1px solid var(--line); text-align: right; }
  .k-tbl .k-kind .kdot { display: none; }
  .k-tbl .k-kw { position: static; width: auto; height: auto; overflow: visible; clip-path: none; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); text-align: left; }
  .k-tbl .k-n { display: block; -webkit-line-clamp: none; line-clamp: none; overflow: visible; font: 650 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
  .k-tbl .k-scopes { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .k-tbl .k-scope { min-height: var(--chip); padding: 0 var(--sp-3) 0 var(--sp-2); }
  .k-tbl td.k-usedc { flex-wrap: wrap; row-gap: var(--sp-2); }
  .k-tbl .k-used { display: contents; }
  .k-tbl .k-used-t { margin-left: auto; }
  .k-tbl .k-used-m { flex: 1 1 100%; }
  .k-tbl .k-rv { font: var(--t-c) var(--font); letter-spacing: var(--ls-c); color: var(--fg); }
  .k-tbl .k-rvw { display: none; }
  .k-tbl .k-rvb { width: auto; min-height: var(--chip); padding: 0 var(--sp-3) 0 var(--sp-2); }
  .k-tbl .k-rvl { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .k-fold { border-radius: var(--r-card); background: var(--card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); }
  .k-none { border-radius: var(--r-card); background: var(--card); border: 1px solid var(--line); }
}
/* key form */
/* Threads: the label and hint left, the field right (a Settings row); "No limit" or the error under it */
.k-thr-f { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l c" "h c" "v v"; column-gap: var(--sp-3); row-gap: var(--sp-1); align-items: center; }
.k-thr-l { grid-area: l; align-self: end; font-weight: 600; }
.k-thr-h { grid-area: h; align-self: start; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.k-thr-f > .num-in { grid-area: c; }
.k-thr-f .num-in .field-in { width: 136px; padding-right: 72px; }
.k-thr-f > .fl-val, .k-thr-f > .fl-err { grid-area: v; justify-self: end; text-align: right; }
.k-thr-f > .fl-val:empty { display: none; }
.scope-opts { display: grid; gap: var(--sp-2); }
.scope-opt { display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md); background: var(--well); border: 1px solid var(--line-2); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.scope-opt:has(input:checked) { border-color: color-mix(in srgb, var(--accent-dot) 50%, transparent); background: var(--accent-soft); }
.scope-t { display: grid; min-width: 0; }
.scope-t b { font-weight: 600; }
.scope-t .mono { color: var(--fg-2); font: 500 var(--t-x) var(--mono); }
/* Best level: 1 (highest, = any level) … 5 (lowest); the range it allows on the right */
.prio-set { display: grid; gap: var(--sp-2); }
.prio-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.prio-head > span:first-child { font-weight: 600; }
.prio-head .fl-val { color: var(--fg); font-weight: 560; }
.prio-seg button { font: 650 var(--t-b) var(--font); font-variant-numeric: tabular-nums; }
.prio-ends { display: flex; justify-content: space-between; gap: var(--sp-3); color: var(--fg-2); font: var(--t-x) var(--font); letter-spacing: var(--ls-x); padding: 0 var(--sp-1); }
@media (pointer: coarse) { .prio-seg button { min-height: 40px; } }

/* ───────── events ─────────
   == Events == The filter chips (one scrolling row on a phone), then the
   log in one card. A row, narrow: a tone icon, the title and the time, then
   what it names · its outcome; from 760 px of room one line in columns
   (time, icon, title, names, outcome). Open problems (alerts) carry a
   coloured edge. */
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
@media (max-width: 767.98px) {
  .filters {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * max(var(--gut), var(--safe-l))); padding: var(--sp-0) max(var(--gut), var(--safe-r)) var(--sp-0) max(var(--gut), var(--safe-l));
    scroll-padding-inline: var(--gut);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }
}
.fchip { min-height: 34px; padding: 0 var(--sp-4); border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line-2); color: var(--fg-2); font: 560 var(--t-c) var(--font); white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.fchip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (hover: hover) { .fchip:not([aria-pressed="true"]):hover { color: var(--fg); border-color: color-mix(in srgb, var(--fg) 25%, transparent); } }
@media (pointer: coarse) { .fchip { min-height: 44px; padding: 0 var(--sp-4); } }
.evs-wrap { container: evl / inline-size; min-width: 0; }
.evs { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card); overflow: clip; }
.ev + .ev { border-top: 1px solid var(--line); }
.ev-line {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "ic t time" "ic sub sub";
  align-items: center; gap: var(--sp-1) var(--sp-3); width: 100%; min-height: var(--row);
  padding: var(--sp-3) var(--pad); text-align: left; color: var(--fg); transition: background var(--t-fast);
}
@media (hover: hover) { .ev-line:hover { background: var(--hover); } }
.ev-line:active { background: var(--press); }
.ev-ic { grid-area: ic; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--fill); color: var(--fg-2); }
.ev-ic svg.i { width: 18px; height: 18px; }
.ev-ic.ok { background: var(--ok-soft); color: var(--ok); }
.ev-ic.warn { background: var(--warn-soft); color: var(--warn); }
.ev-ic.bad { background: var(--bad-soft); color: var(--bad); }
.ev-ic.accent { background: var(--accent-soft); color: var(--accent); }
.ev-ic.sim { background: var(--sim-soft); color: var(--sim); }
.ev-t { grid-area: t; min-width: 0; font: 600 var(--t-b) var(--font); letter-spacing: var(--ls-b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time { grid-area: time; align-self: baseline; color: var(--fg-2); font: 500 var(--t-x) var(--font); letter-spacing: var(--ls-x); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-sub { grid-area: sub; display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.ev-sub:empty { display: none; }
.ev-side { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-side .rfit { vertical-align: baseline; }
.ev-key { display: inline-flex; max-width: 100%; min-width: 0; vertical-align: bottom; }
.ev-kn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-kp { flex: none; white-space: pre; }
.ev-txt { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sub.both .ev-txt { flex: none; max-width: 60%; }
/* a short lead (Alert, Reminder, who) keeps its room; the text after it ellipsizes */
.ev-sub.both.lead .ev-side { flex: none; max-width: 45%; }
.ev-sub.both.lead .ev-txt { flex: 0 1 auto; max-width: none; }
.ev-sub.both .ev-txt::before { content: "·"; margin-right: var(--sp-2); color: var(--fg-3); }
.ev-txt.sum { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.ev-sub.both .ev-txt.sum { white-space: nowrap; display: block; }
/* the chevron: in the one-line layout only (a phone row is short of room for its title) */
.ev-line > svg.i { display: none; grid-area: chev; color: var(--fg-3); width: 16px; height: 16px; }
.ev.ev-al.bad .ev-line { box-shadow: inset 3px 0 0 var(--bad-dot); }
.ev.ev-al.warn .ev-line { box-shadow: inset 3px 0 0 var(--warn-dot); }
@container evl (min-width: 760px) {
  .ev-line {
    grid-template-columns: 96px 28px minmax(0, 264px) minmax(0, 1fr) minmax(0, 1.25fr) 16px; grid-template-areas: "time ic t side txt chev";
    gap: 0 var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--pad);
  }
  .ev-line > svg.i { display: block; }
  .ev-time { align-self: center; font-family: var(--mono); }
  .ev-ic { width: 28px; height: 28px; }
  .ev-ic svg.i { width: 16px; height: 16px; }
  .ev-sub { display: contents; }
  .ev-side { grid-area: side; }
  .ev-txt, .ev-sub.both .ev-txt { grid-area: txt; max-width: none; }
  .ev-sub.both .ev-txt::before { content: none; }
  .ev-txt.sum, .ev-sub.both .ev-txt.sum { display: block; white-space: nowrap; }
  .ev-sub:not(.both) > .ev-txt, .ev-sub:not(.both) > .ev-side { grid-column: side / txt; }
}
.ev-empty { min-height: 160px; align-content: center; }
.ev-foot { display: flex; justify-content: center; padding: var(--sp-1) 0 var(--sp-2); }
.ev-end { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
/* the event sheet: its type as a code chip; the upstream reply loading (GET /api/events/{seq}) */
.ev-code { font: 500 var(--t-x) var(--mono); }
/* a route in a row (routeFit): short of room the space is shared out
   evenly (grid: each name up to its full width), so a short name stays
   whole and the long one ellipsizes; neither drops below 1.6em */
.rfit { display: inline-grid; grid-template-columns: minmax(1.6em, max-content) auto minmax(1.6em, max-content); align-items: baseline; column-gap: .3em; max-width: 100%; min-width: 0; vertical-align: bottom; white-space: nowrap; }
.rfit-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rfit-to { color: var(--fg-3); }
.rep-wait .codebox-bar > .rep-l { display: inline-flex; align-items: center; gap: var(--sp-2); margin-right: var(--sp-3); color: var(--fg-2); font-weight: 500; }
.rep-sk { display: grid; gap: var(--sp-3); padding: var(--sp-4); }
.rep-sk .skel { width: var(--w, 60%); }
.json {
  margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--well); color: var(--fg);
  font: var(--t-m) var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  max-height: 60vh; overflow: auto; -webkit-user-select: text; user-select: text; tab-size: 2;
}
.json .k { color: var(--j-key); } .json .s { color: var(--j-str); } .json .n { color: var(--j-num); } .json .l { color: var(--j-lit); }

/* ───────── details: facts, sections, code boxes, the clearance wire, cookies ───────── */
.dbody { display: grid; gap: var(--sp-5); min-width: 0; }
.ev-summary { font-weight: 560; overflow-wrap: anywhere; }
.facts-list { display: grid; min-width: 0; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); padding: var(--sp-0) 0; }
.fact {
  display: grid; grid-template-columns: minmax(84px, 32%) minmax(0, 1fr) auto; align-items: center; gap: var(--sp-0) var(--sp-3);
  min-height: 44px; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); min-width: 0;
}
.fact + .fact { border-top: 1px solid var(--line); }
.fact dt { color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.fact dd { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.fact dd.mono { font: 500 var(--t-m) var(--mono); }
.fact.block { grid-template-columns: minmax(0, 1fr) auto; }
.fact.block dt { grid-column: 1; }
.fact.block dd { grid-column: 1; grid-row: 2; }
.fact.block .cp { grid-column: 2; grid-row: 1 / span 2; }
.fact:not(.block):not(:has(.cp)) { padding-right: var(--sp-4); }
.cp { width: 44px; min-height: 44px; margin: calc(-1 * var(--sp-1)) 0; }
.cp svg.i { color: var(--fg-3); }
@media (min-width: 768px) and (pointer: fine) { .cp { width: 32px; min-height: 32px; margin: 0; } }
.dsec { display: grid; gap: var(--sp-3); min-width: 0; }
.dsec-h { font: 600 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
.keylab { display: inline-flex; align-items: baseline; gap: var(--sp-1) var(--sp-2); flex-wrap: wrap; min-width: 0; }
.disc { border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); min-width: 0; }
.disc > summary {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--row); padding: 0 var(--sp-3) 0 var(--sp-4); list-style: none; cursor: pointer;
  font-weight: 560; -webkit-user-select: none; user-select: none; border-radius: var(--r-lg);
}
.disc > summary::-webkit-details-marker { display: none; }
.disc > summary .muted { font-weight: 400; }
.disc > summary > svg.i { margin-left: auto; color: var(--fg-3); transition: transform var(--t-fast); }
.disc[open] > summary > svg.i { transform: rotate(180deg); }
@media (hover: hover) { .disc > summary:hover { background: var(--hover); } }
.disc-t { min-width: 0; overflow-wrap: anywhere; }
.disc-b { display: grid; gap: var(--sp-3); padding: 0 var(--sp-3) var(--sp-3); min-width: 0; }
.codebox { display: grid; min-width: 0; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.dbody > .codebox, .dsec > .codebox { background: var(--well); }
.codebox-bar { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-0) 0 var(--sp-3); border-bottom: 1px solid var(--line); color: var(--fg-2); font: 560 var(--t-c) var(--font); }
.codebox-bar > span { margin-right: auto; }
.codebox .json { border-radius: 0; background: transparent; max-height: 420px; }
.codebox-none { padding: var(--sp-3) var(--sp-3); color: var(--fg-2); font: var(--t-c) var(--font); }
.hdrs { display: grid; padding: var(--sp-1) 0; font: var(--t-m) var(--mono); max-height: 420px; overflow: auto; }
.hdrs li { display: block; padding: var(--sp-1) var(--sp-3); overflow-wrap: anywhere; word-break: break-word; }
.hdrs li b { font-weight: 600; color: var(--j-key); }
.hdrs li b::after { content: ": "; color: var(--fg-2); font-weight: 400; }
.wire { display: grid; gap: var(--sp-3); min-width: 0; }
.wire-line { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-2) var(--sp-1) var(--sp-2) var(--sp-3); border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); min-width: 0; }
.wire-line .method { margin-top: 1px; }
.wire-url { flex: 1; min-width: 0; font: 500 var(--t-m) var(--mono); overflow-wrap: anywhere; word-break: break-all; }
.cookies { display: grid; gap: var(--sp-3); min-width: 0; }
.cookie-list { display: grid; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); }
.cookie { display: grid; gap: var(--sp-0); padding: var(--sp-2) var(--sp-2) var(--sp-3) var(--sp-4); min-width: 0; }
.cookie + .cookie { border-top: 1px solid var(--line); }
.cookie-top { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.cookie-top b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cookie-v { font: var(--t-m) var(--mono); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: var(--sp-2); }
.cookie-f { color: var(--fg-2); font: var(--t-c) var(--font); overflow-wrap: anywhere; padding-right: var(--sp-2); }

/* ───────── modal ───────── */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade var(--t-med) var(--ease); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) { .scrim { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); } }
.sheet {
  position: relative; display: flex; flex-direction: column; width: 100%; max-height: calc(100dvh - var(--safe-t) - 24px);
  background: var(--card-2); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: 0 0 0 1px var(--line-2), var(--shadow-pop);
  padding-bottom: var(--safe-b); animation: rise var(--t-slow) var(--ease-spring);
}
.sheet::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: var(--r-pill); background: var(--line-3); }
.sheet.tall { height: calc(100dvh - var(--safe-t) - 24px); }
@media (min-width: 768px) {
  .modal { align-items: center; padding: var(--sp-6); }
  .sheet { width: min(560px, 100%); max-height: min(780px, calc(100dvh - 48px)); border-radius: var(--r-sheet); padding-bottom: 0; animation-name: pop; }
  .sheet::before { display: none; }
  .sheet.tall { height: min(780px, calc(100dvh - 48px)); }
  .sheet.small { width: min(460px, 100%); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: 0; } }
/* sheet chrome (shell): the title (and its sub line) on the left, Done /
   Cancel on the right, centred on the title's first line */
.sheet-head { --sh-lh: 28px; flex: none; display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-6) var(--sp-3) var(--sp-4) var(--pad); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin-right: auto; font: 650 var(--t-1) var(--font); letter-spacing: var(--ls-1); overflow-wrap: anywhere; min-width: 0; }
@media (min-width: 768px) { .sheet-head { --sh-lh: 26px; padding: var(--sp-5) var(--sp-4) var(--sp-4) var(--pad); } }
.sheet-title { display: grid; gap: var(--sp-2); margin-right: auto; min-width: 0; }
.sheet-sub { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--fg-2); font: var(--t-c) var(--font); letter-spacing: var(--ls-c); min-width: 0; }
.sheet-head > .btn { flex: none; align-self: flex-start; margin-block: calc((var(--sh-lh) - var(--ctl)) / 2); }
.sheet-head > .btn.plain { font-weight: 600; }
/* a confirm: no rules between title, text and buttons */
.sheet[role="alertdialog"] .sheet-head { border-bottom: 0; padding-bottom: 0; }
.sheet[role="alertdialog"] .sheet-body { padding-top: var(--sp-3); }
.sheet[role="alertdialog"] .sheet-foot { border-top: 0; padding-top: var(--sp-2); padding-bottom: var(--sp-4); }
@media (max-width: 767.98px) {
  .sheet.small .sheet-foot { flex-wrap: nowrap; }
  .sheet.small .sheet-foot > .btn { flex: 1 1 0; min-width: 0; }
}
/* details: a bottom sheet on a phone, a panel on the right from 768 px */
.sheet.details { height: auto; }
@media (min-width: 768px) {
  .modal.panel { grid-template-rows: minmax(0, 1fr); align-items: stretch; justify-items: end; padding: var(--sp-3); padding-top: max(12px, var(--safe-t)); }
  .modal.panel .sheet.details { width: min(560px, 100%); max-height: none; height: 100%; animation-name: slide; }
}
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
.sheet-tools { display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--pad); border-bottom: 1px solid var(--line); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: var(--sp-4) var(--pad); }
.sheet-body.list { padding: 0; }
.sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--pad); border-top: 1px solid var(--line); }
.sheet-foot .grow { margin-right: auto; color: var(--fg-2); font: var(--t-c) var(--font); }
.sheet-foot .grow b { color: var(--fg); font-weight: 650; }
.search-wrap { position: relative; }
.search-wrap svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search { padding-left: 40px; }
@media (min-width: 768px) { .search { padding-left: 34px; } }

.prow { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--row); padding: var(--sp-2) var(--pad); text-align: left; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
@media (hover: hover) { .prow:hover { background: var(--hover); } }
.prow .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: background var(--t-fast), border-color var(--t-fast); }
.prow[aria-pressed="true"] .tick { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-fill); }
.prow .tick svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
.prow .main-col { display: grid; gap: var(--sp-0); min-width: 0; flex: 1; }
.prow .names { font-weight: 560; overflow-wrap: anywhere; }
.prow .side { flex: none; color: var(--fg-2); font: var(--t-c) var(--font); text-align: right; white-space: nowrap; }
.prow > svg.i { color: var(--fg-3); }
.pick-src { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--pad); background: var(--well); border-bottom: 1px solid var(--line); }
.pick-src b { margin-right: auto; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.list-note { padding: var(--sp-5) var(--pad); color: var(--fg-2); text-align: center; }

.form { display: grid; gap: var(--sp-5); }
.fl-label { display: grid; gap: var(--sp-2); }
.fl-label > span:first-child, .scope-set legend, .prio-set legend { font-weight: 600; }
.fl-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.fl-err { color: var(--bad); font: 560 var(--t-c) var(--font); }
.fl-val { color: var(--fg-2); font: var(--t-c) var(--font); }
.scope-set { display: grid; gap: var(--sp-2); border: 0; padding: 0; margin: 0; }
.scope-set legend { padding: 0; margin-bottom: var(--sp-2); }
.sw-line { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--ctl); font-weight: 600; }
.raw-key {
  display: block; padding: var(--sp-4); border-radius: var(--r-md); background: var(--well); font: 500 var(--t-m) var(--mono);
  overflow-wrap: anywhere; word-break: break-all; -webkit-user-select: all; user-select: all; border: 1px dashed var(--line-2);
}
.once { display: flex; align-items: center; gap: var(--sp-2); }
.confirm-body { display: grid; gap: var(--sp-3); }

/* ───────── toasts ───────── */
/* (shell) raised material at the bottom centre of the view (above the tab
   bar on a phone); under the top bar while the Settings save bar holds the
   bottom (Playground lifts them over its dock itself; over an open sheet
   on a phone: a pill at the top, below). Success: a check in the ok tone;
   a failure: the danger tone. */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sp-6) + var(--safe-b)); z-index: 80; display: grid; gap: var(--sp-2); width: min(440px, calc(100% - 2 * var(--gut))); pointer-events: none; }
@media (min-width: 768px) { .shell ~ .toasts { left: calc(50% + var(--side-w) / 2); width: min(440px, calc(100% - var(--side-w) - 2 * var(--gut))); } }
@media (max-width: 767.98px) { .toasts { bottom: calc(var(--bar-b) + var(--sp-3)); } }
#app:has(.savebar) .toasts { top: calc(var(--top-h) + var(--safe-t) + var(--sp-3)); bottom: auto; }
.toast {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3);
  border-radius: var(--r-lg); background: var(--card-2); color: var(--fg); border: 1px solid var(--line-2);
  font: 560 var(--t-c) var(--font); letter-spacing: var(--ls-c); box-shadow: var(--shadow-pop);
  animation: rise var(--t-med) var(--ease-spring); pointer-events: auto;
}
/* dark: one step lighter than the cards, so it reads as raised */
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .toast:not(.bad) { background: var(--fill-2); border-color: var(--line-3); } }
:root[data-theme="dark"] .toast:not(.bad) { background: var(--fill-2); border-color: var(--line-3); }
.toast-i { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.toast-i svg.i { width: 16px; height: 16px; stroke-width: 2.2; }
.toast-t { min-width: 0; overflow-wrap: anywhere; }
.toast.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.toast.bad .toast-i { background: color-mix(in srgb, var(--bad-dot) 18%, transparent); color: var(--bad); }

/* == shell: the Settings save bar ==
   (after the Settings section on purpose: these win.) A floating, opaque
   bar: the count, "Unsaved changes" and what changed, Discard and Save. It
   sticks above the page end, the tab bar and the home indicator (--bar-b). */
.savebar { gap: var(--sp-3) var(--sp-4); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); border-radius: var(--r-card); background: var(--card-2); border-color: var(--line-3); -webkit-backdrop-filter: none; backdrop-filter: none; }
.savebar .sb-n { font: 650 var(--t-c) var(--font); }
.savebar .sb-t b { font: 600 var(--t-b) var(--font); letter-spacing: var(--ls-b); }
.savebar .sb-acts { flex: none; }
.savebar .sb-acts .btn { min-width: 96px; }
.savebar .formerr { min-height: 32px; padding: var(--sp-2) var(--sp-1) 0; border-top: 1px solid var(--line); }
@media (max-width: 767.98px) { .savebar { bottom: calc(var(--bar-b) + var(--sp-3)); } }
@media (max-width: 599.98px) {
  .savebar { padding: var(--sp-3); }
  .savebar .sb-state { padding: 0 var(--sp-1); }
  .savebar .sb-acts { flex: 1; }
  .savebar .sb-acts .btn { flex: 1; min-width: 0; }
}

/* ───────── keys: created ───────── */
.made-name { display: flex; align-items: center; gap: var(--sp-2) var(--sp-2); flex-wrap: wrap; }
.made-name b { font-weight: 650; margin-right: var(--sp-1); overflow-wrap: anywhere; }
.once { flex-wrap: wrap; }

/* ───────── public page ───────── */
.pub { min-height: 100dvh; }
.pub-top { position: sticky; }
.top-tag { color: var(--fg-2); font: 600 var(--t-x) var(--font); padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--card); }
.pub-main { padding: 0 max(var(--gut), var(--safe-r)) calc(56px + var(--safe-b)) max(var(--gut), var(--safe-l)); }
@media (min-width: 1100px) { .pub-main { padding-top: var(--sp-8); } }

/* ───────── API docs ───────── */
.docs { --stick: calc(var(--in-top) + 61px); display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1180px; margin: 0 auto; min-width: 0; }
@media (min-width: 1100px) {
  .docs, .shell .docs { --stick: var(--in-top); grid-template-columns: 232px minmax(0, 1fr); gap: var(--sp-10); }
}
.docs [data-toc], .docs .doc-hero { scroll-margin-top: calc(var(--stick) + 12px); }
.docs-view { max-width: none; }
.shell .main:has(> .docs-view) { padding-top: 0; }
@media (min-width: 1100px) { .shell .main:has(> .docs-view) { padding-top: var(--sp-6); } }
.docs-state { max-width: 720px; margin: var(--sp-6) auto; width: 100%; }

.toc { display: none; }
@media (min-width: 1100px) {
  .toc {
    display: block; position: sticky; top: calc(var(--stick) + 16px); align-self: start;
    max-height: calc(var(--port-h) - var(--stick) - 32px); overflow: auto; padding: 0 var(--sp-1) var(--sp-4) 0; margin-left: calc(-1 * var(--sp-3));
  }
  .toc ul { display: grid; gap: 1px; }
  .toc > ul > li + li { margin-top: var(--sp-0); }
  .toc a {
    display: flex; align-items: center; gap: var(--sp-2); min-height: 32px; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-sm);
    color: var(--fg-2); font: 500 var(--t-c) var(--font); letter-spacing: var(--ls-c);
  }
  .toc a.toc-group { color: var(--fg); font-weight: 600; margin-top: var(--sp-3); }
  .toc ul ul a { padding-left: var(--sp-3); }
  @media (hover: hover) { .toc a:hover { background: var(--hover); color: var(--fg); } }
  .toc a[aria-current] { background: var(--fill); color: var(--fg); }
  .toc .toc-op { min-width: 0; overflow-wrap: anywhere; }
  .toc .toc-op.mono { font: 500 var(--t-x) var(--mono); }
}
.m { flex: none; display: inline-grid; place-items: center; min-width: 44px; height: 20px; padding: 0 var(--sp-1); border-radius: var(--r-xs); font: 650 var(--t-u) var(--mono); line-height: 1; letter-spacing: .02em; }
.jump {
  position: sticky; top: var(--in-top); z-index: 20;
  margin: 0 calc(-1 * max(var(--gut), var(--safe-l))) var(--sp-2); padding: var(--sp-2) max(var(--gut), var(--safe-r)) var(--sp-2) max(var(--gut), var(--safe-l));
  background: var(--bg); border-bottom: 1px solid var(--line-2);
}
.pub .jump { top: calc(var(--top-h) + var(--safe-t)); }
.jump .select { background: var(--card); font-weight: 560; }
@media (min-width: 1100px) { .jump { display: none; } }

.doc-main { min-width: 0; max-width: 860px; display: grid; gap: 0; align-content: start; }
.doc-hero { display: grid; gap: var(--sp-3); padding: var(--sp-4) 0 var(--sp-5); }
@media (min-width: 1100px) { .doc-hero { padding-top: 0; } }
.doc-hero h1 { font: 700 var(--t-xl) var(--font); letter-spacing: var(--ls-xl); overflow-wrap: anywhere; }
.doc-chips, .doc-dl { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.doc-lede { font: var(--t-b) var(--font); color: var(--fg-2); }
.doc-dl .btn { font-family: var(--mono); font-weight: 500; }

/* markdown */
.md { display: grid; gap: var(--sp-3); min-width: 0; overflow-wrap: break-word; }
.md > * { min-width: 0; }
.md h2 { font: 650 var(--t-1) var(--font); letter-spacing: var(--ls-1); margin-top: var(--sp-5); padding-top: var(--sp-6); border-top: 1px solid var(--line-2); }
.md h3 { font: 600 var(--t-h) var(--font); letter-spacing: var(--ls-h); margin-top: var(--sp-2); }
.md h4, .md h5, .md h6 { font: 600 var(--t-b) var(--font); margin-top: var(--sp-1); }
.md ul, .md ol { padding-left: var(--sp-6); display: grid; gap: var(--sp-2); }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li::marker { color: var(--fg-2); }
.md li > ul, .md li > ol, .md li > p { margin-top: var(--sp-2); }
.md strong { font-weight: 650; }
.md a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.md code, .f-meta code, .r-desc code {
  font: 500 .88em/1.4 var(--mono); padding: 1px var(--sp-1); border-radius: var(--r-xs); background: var(--fill); color: var(--fg);
  overflow-wrap: anywhere; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: var(--sp-2) 0; }
.md blockquote { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--accent-soft); color: var(--fg); display: grid; gap: var(--sp-2); }
.md blockquote::before { content: none; }
.tbl { container: tbl / inline-size; overflow-x: auto; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); -webkit-overflow-scrolling: touch; }
.tbl:focus-visible { outline-offset: 0; }
.tbl table { border-collapse: collapse; width: 100%; font: var(--t-c) var(--font); letter-spacing: var(--ls-c); }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--well); font-weight: 600; white-space: nowrap; }
.tbl td:first-child { white-space: nowrap; }
.tbl code { overflow-wrap: normal; }
.tbl .a-r { text-align: right; } .tbl .a-c { text-align: center; }
/* Under 600 px of room (phones, tablets): each row stacks, its first cell
   as the title and the rest labelled. */
@container tbl (max-width: 599.98px) {
  .tbl table, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl tr { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td, .tbl td:first-child { padding: 0; border: 0; white-space: normal; text-align: left; }
  .tbl td:first-child { font-weight: 650; }
  .tbl td + td { margin-top: var(--sp-2); }
  .tbl td[data-label]::before { content: attr(data-label); display: block; color: var(--fg-2); font: 560 var(--t-x) var(--font); }
}

/* code blocks */
.cb { min-width: 0; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); overflow: hidden; }
.cb-bar { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: var(--sp-0) var(--sp-1) var(--sp-0) var(--sp-4); border-bottom: 1px solid var(--line); }
.cb-lang { color: var(--fg-2); font: 560 var(--t-c) var(--font); }
.cb-copy { margin-left: auto; min-height: 36px; }
.cb-pre {
  margin: 0; padding: var(--sp-3) var(--sp-4); overflow: auto; max-height: 560px; font: var(--t-m) var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
  color: var(--fg); -webkit-user-select: text; user-select: text;
}
.cb-pre:focus-visible { outline-offset: -2px; }
.cb .ph { color: var(--warn); background: var(--warn-soft); border-radius: var(--r-xxs); padding: 0 var(--sp-0); }
.cb .k { color: var(--j-key); } .cb .s { color: var(--j-str); } .cb .n { color: var(--j-num); } .cb .l { color: var(--j-lit); }

/* sections */
.doc-intro { padding-bottom: var(--sp-2); }
.doc-sec { display: grid; gap: var(--sp-4); padding-top: var(--sp-8); margin-top: var(--sp-5); border-top: 1px solid var(--line-2); min-width: 0; }
.doc-sec > h2 { font: 650 var(--t-1) var(--font); letter-spacing: var(--ls-1); }
.servers { display: grid; gap: var(--sp-2); }
.server { display: flex; align-items: center; gap: var(--sp-1) var(--sp-3); flex-wrap: wrap; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); min-width: 0; }
.server-url { font: 600 var(--t-b) var(--mono); overflow-wrap: anywhere; min-width: 0; }
.server-desc { color: var(--fg-2); }
.server .btn { margin-left: auto; }
.scheme { display: grid; gap: var(--sp-3); }
.scheme + .scheme { margin-top: var(--sp-2); }
.scheme-head { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.scheme-head h3 { font: 600 var(--t-h) var(--font); letter-spacing: var(--ls-h); }

/* == Docs: endpoint and schema cards ==
   One card per operation (and per schema): title, method + path, key, the
   description, then its parts (example request, parameters, body,
   responses) split by hairlines. Blocks inside a card sit on the well. */
.op {
  display: grid; gap: var(--sp-4); min-width: 0; padding: var(--sp-5) var(--pad) var(--pad);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: inset 0 1px 0 var(--hl), var(--shadow-card);
}
.tag > .op + .op, .tag > .md + .op { margin-top: var(--sp-2); }
@media (min-width: 768px) { .op { padding: var(--sp-6); gap: var(--sp-5); } }
/* phone: the cards run edge to edge, so code and field lists keep the room */
@media (max-width: 599.98px) { .op { margin-left: calc(-1 * var(--gut)); margin-right: calc(-1 * var(--gut)); border-radius: 0; border-left: 0; border-right: 0; } }
.op-top { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.op-title { font: 650 var(--t-1) var(--font); letter-spacing: var(--ls-1); overflow-wrap: anywhere; }
.schema .op-title { font: 650 var(--t-2) var(--mono); letter-spacing: 0; }
.op-line { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; min-height: var(--ctl-lg); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2); border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); }
.method { flex: none; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-xs); font: 700 var(--t-x) var(--mono); letter-spacing: .03em; }
.m-get { background: var(--ok-soft); color: var(--ok); }
.m-post { background: var(--accent-soft); color: var(--accent); }
.m-put, .m-patch { background: var(--warn-soft); color: var(--warn); }
.m-delete { background: var(--bad-soft); color: var(--bad); }
.m-head, .m-options, .m-trace { background: var(--sim-soft); color: var(--sim); }
.op-path { font: 600 var(--t-b) var(--mono); overflow-wrap: anywhere; min-width: 0; }
.op-path .pp { color: var(--accent); }
.op-auth { display: flex; align-items: center; gap: var(--sp-2); color: var(--fg-2); font: var(--t-c) var(--font); }
.op-auth b { color: var(--fg); font-weight: 560; }
.op-auth svg.i { color: var(--fg-2); }
.op-part { display: grid; gap: var(--sp-3); min-width: 0; padding-top: var(--sp-4); border-top: 1px solid var(--line); }
@media (min-width: 768px) { .op-part { padding-top: var(--sp-5); } }
.op-part > h4 { font: 600 var(--t-h) var(--font); letter-spacing: var(--ls-h); }
.op-part > h4 .muted { font-weight: 400; }
.op-part > h4 .f-req { font-size: var(--t-c); }
.op-sub { display: grid; gap: var(--sp-2); min-width: 0; }
.op-sub > h5 { font: 600 var(--t-c) var(--font); }
.op-sub > h5 .muted { font-weight: 400; overflow-wrap: anywhere; }

/* == Docs: parameters and fields ==
   A list per schema or parameter set. Phone: each row stacks (name, type,
   tags; then the description). From 520 px of room it reads as a table:
   name, type and tags on the left, the description on the right, the column
   titles (.f-th) on top; nested fields span both columns, indented. */
.fields { display: grid; min-width: 0; border-radius: var(--r-lg); background: var(--well); border: 1px solid var(--line); container: fl / inline-size; }
.field { display: grid; gap: var(--sp-1); min-width: 0; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.f-body { display: grid; gap: var(--sp-1); min-width: 0; }
.f-th { display: none; }
.f-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); min-width: 0; }
.f-ref { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
@container fl (min-width: 520px) {
  .field, .f-th { grid-template-columns: 210px minmax(0, 1fr); column-gap: var(--sp-5); align-items: start; }
  /* nested rows keep the description column in line with their parent's */
  .fields.nested > .field { grid-template-columns: calc(210px - var(--sp-3) - 2px) minmax(0, 1fr); }
  .fields.nested .fields.nested > .field { grid-template-columns: calc(210px - 2 * (var(--sp-3) + 2px)) minmax(0, 1fr); }
  .field > .f-head { grid-column: 1; row-gap: var(--sp-0); }
  .field > .f-head > .f-name { flex-basis: 100%; }
  .field > .f-body { grid-column: 2; }
  .field > .fields, .field > .alts { grid-column: 1 / -1; }
  .f-th {
    display: grid; padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line-2); border-radius: calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0 0;
    background: var(--fill); color: var(--fg-2); font: 600 var(--t-x) var(--font); letter-spacing: var(--ls-x);
  }
}
.f-name { font: 600 var(--t-c) var(--mono); color: var(--fg); overflow-wrap: anywhere; }
.f-type { font: var(--t-c) var(--mono); color: var(--fg-2); overflow-wrap: anywhere; min-width: 0; }
.f-in, .f-tag { font: 560 var(--t-x) var(--font); color: var(--fg-2); }
.f-in { padding: 1px var(--sp-2); border-radius: var(--r-xs); background: var(--fill); color: var(--fg); }
.f-req { font: 600 var(--t-x) var(--font); color: var(--warn); }
.f-desc { font: var(--t-c) var(--font); letter-spacing: var(--ls-c); gap: var(--sp-2); }
.f-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-4); color: var(--fg-2); font: var(--t-c) var(--font); min-width: 0; }
.f-meta > span { min-width: 0; overflow-wrap: anywhere; }
.f-enum code { margin-right: var(--sp-1); }
.fields.nested, .alts.nested { margin: var(--sp-2) 0 0; padding-left: var(--sp-3); border: 0; border-left: 2px solid var(--line-2); border-radius: 0; background: transparent; box-shadow: none; }
.fields.nested .field { padding: var(--sp-2) 0; }
.alts { display: grid; gap: var(--sp-2); min-width: 0; }
.alt-label { color: var(--fg-2); font: 560 var(--t-c) var(--font); }
.alt { display: grid; gap: var(--sp-2); }
.alt-name { font: 600 var(--t-c) var(--mono); }

/* responses */
.resps { display: grid; gap: var(--sp-2); min-width: 0; }
.resp { border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line-2); min-width: 0; }
.resp-sum { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--row); padding: var(--sp-2) var(--sp-4); list-style: none; border-radius: var(--r-lg); }
summary.resp-sum { cursor: pointer; -webkit-user-select: none; user-select: none; }
summary.resp-sum::-webkit-details-marker { display: none; }
@media (hover: hover) { summary.resp-sum:hover { background: var(--hover); } }
.resp-sum > svg.i { margin-left: auto; color: var(--fg-2); transition: transform var(--t-fast); }
.resp[open] > .resp-sum > svg.i { transform: rotate(180deg); }
.resp[open] > .resp-sum { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.chip.status { flex: none; font-family: var(--mono); font-weight: 600; min-width: 48px; justify-content: center; }
.r-desc { min-width: 0; overflow-wrap: anywhere; }
.resp-body { display: grid; gap: var(--sp-3); padding: var(--sp-1) var(--sp-4) var(--sp-4); min-width: 0; }
.resp .fields { background: var(--well); }
.resp .fields.nested { background: transparent; }
.f-enumd { display: grid; gap: var(--sp-2); margin-top: var(--sp-0); font: var(--t-c) var(--font); }
.f-enumd li { display: grid; justify-items: start; gap: 2px; min-width: 0; }
@media (min-width: 600px) {
  .f-enumd { grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: var(--sp-1) var(--sp-3); }
  .f-enumd li { display: contents; }
  .f-enumd li > code { grid-column: 1; justify-self: start; }
  .f-enumd li > .md { grid-column: 2; }
}
.f-enumd code { font: 600 .88em/1.4 var(--mono); padding: 1px var(--sp-1); border-radius: var(--r-xs); background: var(--fill); }
.f-enumd .md { display: inline; color: var(--fg-2); }
.cb-pre .ln { display: block; padding-left: calc((var(--i, 0) + 2) * 1ch); text-indent: calc((var(--i, 0) + 2) * -1ch); }
.cb-pre .ln:empty::before { content: " "; }
.pub ~ .toasts { bottom: calc(24px + var(--safe-b)); }
@media (max-width: 767.98px) {
  /* over an open sheet: a small pill above the sheet's head, never on Done */
  html.locked .toasts { top: calc(var(--safe-t) + 3px); bottom: auto; left: 0; right: 0; margin-inline: auto; transform: none; width: fit-content; max-width: calc(100% - 32px); }
  html.locked .toast { gap: var(--sp-2); min-height: 40px; padding: var(--sp-1) var(--sp-4) var(--sp-1) var(--sp-1); border-radius: var(--r-pill); font: 560 var(--t-c) var(--font); pointer-events: none; }
  html.locked .toast-i { width: 28px; height: 28px; }
  html.locked .toast .i { width: 16px; height: 16px; }
}
.cb-pre > code { display: block; padding: 0; margin: 0; border-radius: 0; background: none; font: inherit; color: inherit; }
.bad-t { color: var(--bad); }
@media (max-width: 599.98px) { .pool .card-head .edit-l { display: none; } .pool .card-head .btn.icon-sm { width: 44px; padding: 0; } }
/* public docs hero */
.pub .doc-hero { position: relative; padding-top: var(--sp-8); padding-bottom: var(--sp-8); }
.pub .doc-hero::before {
  content: ""; position: absolute; z-index: -1; top: -40px; left: -30vw; right: -10vw; height: 360px; pointer-events: none;
  background: radial-gradient(45% 100% at 50% 0%, color-mix(in srgb, var(--accent-dot) 14%, transparent), transparent);
}
.pub .doc-hero h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.1; letter-spacing: -.03em; }
.pub-main { position: relative; z-index: 0; overflow-x: clip; }
/* tablets (touch, whatever pointer the browser reports): fingers need 40–44 px */
@media (min-width: 768px) and (max-width: 1099.98px) {
  .side-theme button { min-height: 40px; }
  .side-acct .btn.icon { width: 44px; min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .seg button { min-height: 40px; }
  .rchip { min-height: 40px; }
  .rchip .x { width: 36px; height: 36px; }
  .fchip { min-height: 40px; }
  .cp { width: 44px; min-height: 44px; margin: calc(-1 * var(--sp-1)) 0; }
}
@media (max-width: 767.98px) { .fchip { min-height: 44px; padding: 0 var(--sp-4); } }
@media (min-width: 768px) and (max-width: 1099.98px) {
  .rchip { min-height: 44px; }
  .rchip .x { width: 40px; height: 40px; }
  .btn.icon { width: 44px; min-height: 44px; }
}
