/* Daybook. A logbook for engineering days: paper and graphite, Bahnschrift numerals,
   and one highlighter yellow reserved for what is live: now, running, new. */

:root {
  color-scheme: light;
  --paper: #eceee9;
  --sheet: #fbfbf9;
  --sheet-2: #f3f4f0;
  --ink: #1a1e22;
  --ink-2: #545b62;
  --ink-3: #858b92;
  --rule: #d8dbd4;
  --grid: #e7e9e3;
  --axis: #c6cac3;
  --hover: rgba(26, 30, 34, 0.05);
  --press: rgba(26, 30, 34, 0.09);
  --scrim: rgba(18, 21, 24, 0.32);
  --hl: #f3d34a;
  --hl-ink: #1a1e22;
  --hl-soft: rgba(243, 211, 74, 0.32);
  --focus: #2a78d6;
  --shadow: 0 6px 24px rgba(26, 30, 34, 0.12);
  --shadow-lg: 0 18px 60px rgba(26, 30, 34, 0.22);

  /* Categorical series, validated against --sheet (fixed order, never cycled). */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --other: #a3a8ad;
  /* Sequential blue for heatmaps: near-zero recedes toward the surface. */
  --q1: #cde2fb; --q2: #9ec5f4; --q3: #5598e7; --q4: #256abf; --q5: #104281;
  /* Status: always paired with an icon and a word. */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-text: #006300; --bad-text: #b3261e; --warn-text: #8a5a00;

  --font-display: Bahnschrift, "DIN Alternate", "D-DIN", Barlow, "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;

  --rail: 232px;
  --row: 76px;
  --gap: 12px;
  --r-panel: 10px;
  --r-control: 7px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e1012; --sheet: #16191c; --sheet-2: #1c2024;
    --ink: #eceeea; --ink-2: #b0b5b9; --ink-3: #7d848b;
    --rule: #272b30; --grid: #1f2327; --axis: #383d43;
    --hover: rgba(255, 255, 255, 0.05); --press: rgba(255, 255, 255, 0.09); --scrim: rgba(0, 0, 0, 0.55);
    --hl: #e8c840; --hl-soft: rgba(232, 200, 64, 0.22);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.45); --shadow-lg: 0 22px 70px rgba(0, 0, 0, 0.6);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #62676d;
    --q1: #173d6b; --q2: #1c5cab; --q3: #2a78d6; --q4: #5598e7; --q5: #9ec5f4;
    --good-text: #2fbf2f; --bad-text: #ef7b7b; --warn-text: #f0c060;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e1012; --sheet: #16191c; --sheet-2: #1c2024;
  --ink: #eceeea; --ink-2: #b0b5b9; --ink-3: #7d848b;
  --rule: #272b30; --grid: #1f2327; --axis: #383d43;
  --hover: rgba(255, 255, 255, 0.05); --press: rgba(255, 255, 255, 0.09); --scrim: rgba(0, 0, 0, 0.55);
  --hl: #e8c840; --hl-soft: rgba(232, 200, 64, 0.22);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45); --shadow-lg: 0 22px 70px rgba(0, 0, 0, 0.6);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #62676d;
  --q1: #173d6b; --q2: #1c5cab; --q3: #2a78d6; --q4: #5598e7; --q5: #9ec5f4;
  --good-text: #2fbf2f; --bad-text: #ef7b7b; --warn-text: #f0c060;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--font-body);
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { display: block; flex: none; }

/* ------------------------------------------------------------------ shell */

.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail-collapsed { --rail: 68px; }

.rail {
  position: sticky; top: 0; height: 100vh; z-index: 20;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--rule);
  overflow-y: auto; overflow-x: hidden;
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-height: 36px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font: 600 19px/1 var(--font-display); letter-spacing: 0.01em; }
.brand-date { margin-top: 3px; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }

.rail-tools { display: flex; flex-direction: column; gap: 6px; }
.rail-search {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px;
  border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--sheet);
  color: var(--ink-3); text-align: left; white-space: nowrap; overflow: hidden;
}
.rail-search:hover { color: var(--ink-2); border-color: var(--axis); }
.rail-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.rail-ask {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--r-control); background: var(--ink); color: var(--sheet);
  font-weight: 600; white-space: nowrap; overflow: hidden;
}
.rail-ask:hover { opacity: 0.92; }
.rail-ask span { flex: 1; text-align: left; }
.rail-ask kbd { background: rgba(255, 255, 255, 0.14); border-color: transparent; color: inherit; }
:root[data-theme="dark"] .rail-ask kbd { background: rgba(0, 0, 0, 0.12); }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-gap { height: 1px; background: var(--rule); margin: 8px 8px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  height: 34px; padding: 0 10px; border-radius: var(--r-control);
  color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a .icon { color: var(--ink-3); }
.nav a:hover .icon { color: var(--ink-2); }
.nav a[aria-current="page"] { color: var(--hl-ink); }
.nav a[aria-current="page"] .icon { color: var(--ink); }
.nav a[aria-current="page"] .nav-label {
  background: var(--hl);
  border-radius: 3px 8px 4px 7px / 6px 4px 7px 3px;
  margin: -2px -6px; padding: 2px 6px;
}
.nav-badge { margin-left: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sync-box { padding: 9px 10px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--sheet); }
.sync-line { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.sync-line > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-sub { color: var(--ink-2); font-size: 12px; margin-top: 4px; }
.sync-sub:empty { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--other); }
.dot.ok { background: var(--good); }
.dot.running { background: var(--hl); box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3px var(--hl); }
.dot.error { background: var(--critical); }
.mini-timer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 38px; padding: 0 12px; border-radius: var(--r-control); text-decoration: none;
  background: var(--hl); color: var(--hl-ink); font-weight: 600; white-space: nowrap; overflow: hidden;
}
.mini-timer .time { font: 600 16px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.rail-row { display: flex; gap: 6px; align-items: center; }
.rail-row .seg { flex: 1; }
.rail-row .seg button { flex: 1; display: grid; place-items: center; padding: 0; }

/* Collapsed rail: icons only. */
.rail-collapsed .rail { padding-left: 10px; padding-right: 10px; align-items: stretch; }
.rail-collapsed .brand-text, .rail-collapsed .nav-label, .rail-collapsed .nav-badge,
.rail-collapsed .rail-search span, .rail-collapsed .rail-search kbd, .rail-collapsed .rail-ask span, .rail-collapsed .rail-ask kbd,
.rail-collapsed .sync-line > span:nth-child(2), .rail-collapsed .sync-line .btn, .rail-collapsed .sync-sub,
.rail-collapsed .mini-timer > span:first-child, .rail-collapsed .rail-row .seg { display: none; }
.rail-collapsed .brand { justify-content: center; padding: 0; }
.rail-collapsed .nav a, .rail-collapsed .rail-search, .rail-collapsed .rail-ask { justify-content: center; padding: 0; }
.rail-collapsed .nav a[aria-current="page"] { background: var(--hl); }
.rail-collapsed .sync-box { display: grid; place-items: center; padding: 10px 0; }
.rail-collapsed .mini-timer { padding: 0; justify-content: center; }
.rail-collapsed .mini-timer .time { font-size: 12.5px; }
.rail-collapsed .rail-row { justify-content: center; }

.main { padding: 22px 28px 72px; width: 100%; max-width: 2000px; margin: 0 auto; outline: none; min-width: 0; }
.mobile-bar { display: none; }

/* ------------------------------------------------------------------ page layout */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { margin: 0; font: 600 30px/1.1 var(--font-display); letter-spacing: 0.005em; }
.page-sub { margin: 6px 0 0; color: var(--ink-2); max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section-title { margin: 0; font: 600 16px/1.2 var(--font-display); }
.section-note { color: var(--ink-2); font-size: 13px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.loading { opacity: 0.55; transition: opacity 0.2s; }

.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: 18px 20px; min-width: 0; }
.sheet.flush { padding: 0; overflow: hidden; }
.sheet h3 { margin: 0; font: 600 15px/1.25 var(--font-display); }

/* ------------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: var(--r-control);
  background: var(--sheet); color: var(--ink);
  font-weight: 500; font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--sheet-2); border-color: var(--axis); }
.btn:active { background: var(--press); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.9; background: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad-text); }
.btn.large { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.small { height: 26px; padding: 0 8px; font-size: 12.5px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.small { width: 26px; }
.btn.on { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn.primary.danger-fill { background: var(--critical); border-color: var(--critical); color: #fff; }

kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 5px;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet-2);
  font: 500 11.5px/1 var(--font-body); color: var(--ink-2); white-space: nowrap;
}

/* Wraps rather than running off a narrow screen, where a cut-off option couldn't be tapped. */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--rule); border-radius: var(--r-control); padding: 2px; background: var(--sheet); gap: 2px; }
.seg button {
  border: 0; background: transparent; border-radius: 5px; padding: 4px 10px; height: 26px;
  font-weight: 500; font-size: 13px; color: var(--ink-2); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.input, select.input, textarea.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--r-control);
  background: var(--sheet); color: var(--ink); min-width: 0; width: 100%;
}
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

/* Button journals: one tap per answer. */
.choices { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; }
.choices button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--sheet);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.2; text-align: center;
}
.choices button b { font: 600 18px/1 var(--font-display); color: var(--ink); }
.choices button:hover { background: var(--sheet-2); }
.choices button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.choices button[aria-pressed="true"] b { color: var(--sheet); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  border: 1px solid var(--rule); border-radius: 999px; padding: 4px 11px; background: var(--sheet);
  font-size: 13px; color: var(--ink-2);
}
.chips button:hover { background: var(--sheet-2); }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.tag-add { flex-wrap: nowrap; }
.tag-add .input { width: min(240px, 100%); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill b { color: var(--ink); font-weight: 600; }
.pill.new { background: var(--hl); border-color: var(--hl); color: var(--hl-ink); font-weight: 600; }
.count-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ ledger (stat tiles) */

/* Tiles wrap and the last row stretches, so hairlines never frame an empty cell. */
.ledger {
  display: flex; flex-wrap: wrap;
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: var(--r-panel); overflow: hidden;
}
.tile { flex: 1 1 170px; background: var(--sheet); padding: 13px 16px 11px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-label { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-key { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.tile-value { font: 600 26px/1.1 var(--font-display); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile-value.empty { color: var(--ink-3); font: 400 17px/1.5 var(--font-display); }
.tile-sub { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tile-delta { font-size: 12px; color: var(--ink-3); display: flex; gap: 4px; align-items: center; min-height: 17px; white-space: nowrap; overflow: hidden; }
.tile-delta.up-good, .tile-delta.down-good { color: var(--good-text); }
.tile-delta.up-bad, .tile-delta.down-bad { color: var(--bad-text); }
.tile-spark { height: 26px; margin-top: auto; padding-top: 4px; }
.tile-spark svg { display: block; width: 100%; height: 26px; overflow: visible; }
.tile-action { font-size: 12.5px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; text-align: left; }

/* ------------------------------------------------------------------ tape (24h lanes) */

.tape { padding: 16px 20px 14px; }
.tape-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); row-gap: 6px; align-items: center; }
.tape-grid.fill { height: 100%; min-height: min-content; }
.tape-label { font-size: 12.5px; color: var(--ink-2); padding-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.tape-label .key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tape-label small { color: var(--ink-3); }
.lane { position: relative; height: 20px; }
.lane::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--grid); }
.lane .seg-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; min-width: 2px; }
.lane .seg-bar:hover { filter: brightness(1.08); outline: 2px solid var(--sheet); }
.lane-ticks { height: 26px; }
.lane-ticks::before { top: auto; bottom: 0; border-top-color: var(--axis); }
.tick { position: absolute; bottom: 0; width: 2px; height: 11px; margin-left: -1px; background: var(--ink-2); border-radius: 1px; }
.tick.merge { height: 20px; background: var(--ink); }
.tick.merge::after { content: ""; position: absolute; top: -2px; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.tick-hit { position: absolute; bottom: 0; width: 12px; height: 26px; margin-left: -6px; }
.tape-hours { position: relative; height: 18px; margin-top: 4px; }
.tape-hours span { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tape-gridlines { position: absolute; inset: 0; pointer-events: none; }
.tape-gridlines i { position: absolute; top: -4px; bottom: -4px; border-left: 1px solid var(--grid); }
.now-line { position: absolute; top: -8px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--hl); border-radius: 1px; pointer-events: none; z-index: 2; }
.now-line::before {
  content: "now"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; color: var(--hl-ink); background: var(--hl); padding: 0 4px; border-radius: 3px; line-height: 14px;
}
.tape-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }

/* ------------------------------------------------------------------ charts */

.chart-card { display: flex; flex-direction: column; gap: 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chart-title { margin: 0; font: 600 15px/1.25 var(--font-display); }
.chart-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.chart-body { position: relative; min-height: 40px; }
.chart-body svg { display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.axis-label { font-size: 11.5px; fill: var(--ink-3); font-variant-numeric: tabular-nums; font-family: var(--font-body); }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.hover-band { fill: var(--hover); }
.crosshair { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 120px; color: var(--ink-3); font-size: 13px; text-align: center; padding: 0 20px; }
.heat-cell { shape-rendering: crispEdges; }
.heat-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.heat-scroll svg { display: block; }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.heat-scale i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

.tip {
  position: fixed; z-index: 90; pointer-events: none; min-width: 120px; max-width: 320px;
  background: var(--sheet); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12.5px;
}
.tip-title { color: var(--ink-2); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--ink-2); }
.tip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }

/* ------------------------------------------------------------------ tables, lists, status */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data a { text-decoration: none; }
table.data a:hover { text-decoration: underline; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 70px 12px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 7px 2px; border-bottom: 1px solid var(--grid); }
.log li:last-child { border-bottom: 0; }
.log .when { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.log .mark { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.log .what { min-width: 0; }
.log .what .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.log .what .meta { color: var(--ink-2); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .side { color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.log a { text-decoration: none; }
.log a:hover { text-decoration: underline; }
.log.compact li { grid-template-columns: 52px 10px minmax(0, 1fr) auto; padding: 6px 0; }
.add { color: var(--good-text); }
.del { color: var(--bad-text); }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.status svg { flex: none; }
.status.wrap { white-space: normal; align-items: flex-start; }
.status.wrap svg { margin-top: 3px; }

.empty-state { padding: 28px 24px; text-align: left; }
.empty-state h3 { margin: 0 0 6px; font: 600 17px/1.25 var(--font-display); }
.empty-state p { margin: 0 0 14px; color: var(--ink-2); max-width: 64ch; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); max-width: 70ch; }
.steps li { margin-bottom: 6px; }
.steps code, .code-inline { font-family: var(--font-mono); font-size: 12.5px; background: var(--hover); padding: 1px 5px; border-radius: 4px; color: var(--ink); }

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; }
.meter-top b { font: 600 15px/1.2 var(--font-display); }
.meter-track { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--s1); }
.meter-fill.warn { background: var(--warning); }
.meter-fill.crit { background: var(--critical); }

.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--grid); }
.ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease-out; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring-label b { font: 600 var(--ring-size, 18px)/1 var(--font-display); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ dashboard */

.board-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.board-title { margin: 0; font: 600 26px/1.1 var(--font-display); white-space: nowrap; }
.board-title small { display: block; font: 400 13px/1.3 var(--font-body); color: var(--ink-2); margin-top: 3px; }
.tabs { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--rule); border-radius: 9px; background: var(--sheet-2); overflow-x: auto; max-width: 100%; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--hover); }
.tab[aria-selected="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(0, 0, 0, 0.06); }
.board-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.edit-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px;
  border: 1px dashed var(--axis); border-radius: var(--r-panel); background: var(--sheet); color: var(--ink-2); font-size: 13px;
}
.edit-banner b { color: var(--ink); }
.edit-banner .row { margin-left: auto; }

.board {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--row); grid-auto-flow: row dense; gap: var(--gap);
}
.widget {
  position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  grid-column: span var(--w, 4); grid-row: span var(--h, 3);
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-panel); overflow: hidden;
}
.w-head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 15px; flex: none; min-width: 0; }
.w-title { margin: 0; font: 600 13.5px/1.2 var(--font-display); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.w-title a { text-decoration: none; }
.w-title a:hover { text-decoration: underline; }
.w-meta { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.w-actions { margin-left: auto; display: flex; gap: 2px; align-items: center; flex: none; opacity: 0; transition: opacity 0.15s; }
.widget:hover .w-actions, .widget:focus-within .w-actions, .w-actions.pinned { opacity: 1; }
.w-actions .btn.icon { width: 28px; height: 28px; color: var(--ink-2); }
.w-body { position: relative; flex: 1; min-height: 0; padding: 0 15px 13px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; container-type: inline-size; }
.w-body.flush { padding: 0; overflow: hidden; }
.w-body.center { display: grid; place-items: center; }
.w-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px 10px 15px; border-top: 1px solid var(--grid); font-size: 12px; color: var(--ink-3); min-width: 0; }
.w-foot .row { margin-left: auto; flex-wrap: nowrap; }
.w-empty { height: 100%; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.w-empty p { margin: 0; max-width: 46ch; }
.w-error { color: var(--bad-text); font-size: 13px; }
.widget.arrived { animation: arrive 1.8s ease-out; }
@keyframes arrive { 0% { box-shadow: 0 0 0 3px var(--hl); } 70% { box-shadow: 0 0 0 3px var(--hl); } 100% { box-shadow: 0 0 0 0 transparent; } }
.widget.skeleton .w-body::after {
  content: ""; position: absolute; inset: 4px 15px 15px; border-radius: 6px;
  background: linear-gradient(90deg, var(--grid) 0%, var(--sheet-2) 50%, var(--grid) 100%); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite; opacity: 0.7;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Edit mode: an overlay with the widget's name, a toolbar and a resize corner. */
.w-edit {
  position: absolute; inset: 0; z-index: 5; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--sheet) 78%, transparent);
  border: 1.5px dashed var(--axis); border-radius: var(--r-panel);
  text-align: center; padding: 10px;
}
.board.editing .w-edit { display: flex; }
.board.editing .widget { overflow: visible; }
.w-edit-label {
  display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 80%;
  padding: 8px 14px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow);
}
.w-edit-name { font: 600 14px/1.2 var(--font-display); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-edit-size { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.w-edit-bar { position: absolute; top: 7px; right: 7px; display: flex; gap: 3px; }
.w-edit-bar .btn { width: 28px; height: 28px; padding: 0; background: var(--sheet); }
.w-grip { position: absolute; top: 7px; left: 7px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--ink-2); cursor: grab; background: var(--sheet); border: 1px solid var(--rule); }
.w-grip:active { cursor: grabbing; }
.w-resize {
  position: absolute; right: 3px; bottom: 3px; width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center; color: var(--ink-2); cursor: nwse-resize; touch-action: none;
}
.w-resize:hover { background: var(--hover); color: var(--ink); }
.widget.dragging { opacity: 0.35; }
.widget.drop-before::before, .widget.drop-after::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--focus); z-index: 6;
}
.widget.drop-before::before { left: -9px; }
.widget.drop-after::before { right: -9px; }
.widget.resizing { box-shadow: 0 0 0 2px var(--focus); z-index: 7; }

.board-empty { grid-column: 1 / -1; grid-row: span 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; border: 1.5px dashed var(--axis); border-radius: var(--r-panel); color: var(--ink-2); padding: 24px; }
.board-empty h3 { margin: 0; font: 600 18px/1.2 var(--font-display); color: var(--ink); }
.board-empty p { margin: 0; max-width: 52ch; }

/* ------------------------------------------------------------------ widgets */

.kpi-strip { display: flex; height: 100%; gap: 1px; background: var(--grid); }
.kpi-strip .tile { flex: 1 1 0; padding: 12px 15px 10px; container-type: inline-size; }
@container (max-width: 175px) { .tile-delta .vs { display: none; } }
.kpi-one { height: 100%; display: flex; flex-direction: column; }
.kpi-one .tile-value { font-size: 32px; }
.kpi-one .tile { padding: 0; flex: 1; }

.goals { display: flex; flex-wrap: wrap; align-content: center; justify-content: space-around; gap: 14px 10px; height: 100%; }
.goal { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 92px; text-align: center; }
.goal-name { font-size: 12.5px; color: var(--ink-2); max-width: 130px; }
.goal-of { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.timer-w { height: 100%; display: flex; align-items: center; gap: 18px; }
.timer-w .ring-label b { font-size: var(--ring-size, 26px); }
.timer-w-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.timer-w-side .seg button { padding: 4px 8px; font-size: 12.5px; }
@container (max-width: 330px) {
  .timer-w { flex-direction: column; justify-content: center; gap: 10px; }
  .timer-w-side { align-items: center; text-align: center; flex: none; }
}
.timer-w-state { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.timer-w-state .live { background: var(--hl); color: var(--hl-ink); font-weight: 600; border-radius: 3px 8px 4px 7px / 6px 4px 7px 3px; padding: 0 7px; }
.timer-w .row { gap: 6px; }

.checkin-w { display: flex; flex-direction: column; gap: 9px; }
.ck-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 8px; }
.ck-row > span { font-size: 12.5px; color: var(--ink-2); }
.ck-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.ck-scale button {
  height: 30px; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet);
  font: 600 14px/1 var(--font-display); color: var(--ink-2);
}
.ck-scale button:hover { background: var(--sheet-2); color: var(--ink); }
.ck-scale button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.ck-tags .chips { gap: 5px; }
.ck-tags .chips button { font-size: 12px; padding: 2px 9px; }

.limit-rows { display: flex; flex-direction: column; gap: 7px; }
.limit-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(64px, 96px) minmax(64px, 96px); gap: 12px; align-items: center; min-height: 22px; }
.limit-name { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.limit-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.limit-bar { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.limit-bar b { color: var(--ink); font-weight: 600; font-size: 12.5px; text-align: right; order: 2; }
.limit-bar .meter-track { height: 6px; order: 1; }
.limit-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(64px, 96px) minmax(64px, 96px); gap: 12px; font-size: 11.5px; color: var(--ink-3); }

.agent-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; }
.agent-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agent-cell .tile-label { font-size: 12.5px; }
.agent-cell .tile-value { font-size: 22px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--grid); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow a { text-decoration: none; }
.list .grow a:hover { text-decoration: underline; }
.list .sub { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .side { color: var(--ink-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.bigline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bigline b { font: 600 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.bigline span { color: var(--ink-2); font-size: 13px; }

.cat-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--grid); margin: 4px 0 10px; }
.cat-bar i { display: block; height: 100%; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-stat span { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat b { font: 600 20px/1.15 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-stat small { font-size: 11.5px; color: var(--ink-3); }

.test-rows { display: flex; flex-direction: column; }
.test-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.test-row:last-child { border-bottom: 0; }
.test-row b { font: 600 18px/1 var(--font-display); font-variant-numeric: tabular-nums; }

.actions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.actions-grid .btn { justify-content: flex-start; }

.note-area {
  width: 100%; height: 100%; resize: none; border: 0; outline: none; background: transparent;
  font: 14px/1.6 var(--font-body); color: var(--ink); padding: 0;
  background-image: linear-gradient(transparent calc(1.6em - 1px), var(--grid) calc(1.6em - 1px));
  background-size: 100% 1.6em; background-attachment: local;
}
.note-area::placeholder { color: var(--ink-3); }

/* Delivery board: widgets and the Delivery page */
.ib-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.warn-text { color: var(--warn-text); }
.dlv-subhead { margin: 0 0 6px; font: 600 13px/1.2 var(--font-display); color: var(--ink-2); }
.dlv-clear { padding: 2px 0; }
.dlv-waiting { display: flex; flex-direction: column; gap: 12px; }

.ship-list { list-style: none; margin: 0; padding: 0; }
.ship-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.ship-row:first-child { padding-top: 2px; }
.ship-row:last-child { border-bottom: 0; }
.ship-text { min-width: 0; }
.ship-name {
  display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink);
  font: 600 14px/1.3 var(--font-display); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ship-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.ship-row.is-new .ship-name { background: var(--hl-soft); box-shadow: 0 0 0 3px var(--hl-soft); border-radius: 3px; }
.ship-sub { margin-top: 1px; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ship-summary { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; }

.dlv-counts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 10px; }
.dlv-counts div { display: flex; align-items: baseline; gap: 5px; }
.dlv-counts b { font: 600 22px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.dlv-counts span { font-size: 12.5px; color: var(--ink-2); }
.dlv-group { border-top: 1px solid var(--grid); }
.dlv-group summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 7px 0; cursor: pointer; font-size: 13px; }
.dlv-group summary::-webkit-details-marker { display: none; }
.dlv-group summary .chev { color: var(--ink-3); transition: transform 0.15s; }
.dlv-group[open] summary .chev { transform: rotate(90deg); }
.dlv-group summary .name { font-weight: 600; }
.dlv-group summary .n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dlv-group .dlv-rows { padding: 0 0 8px 20px; }
.dlv-rows { list-style: none; margin: 0; padding: 0; }
.dlv-rows li { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--grid); min-width: 0; font-size: 13px; }
.dlv-rows li:last-child { border-bottom: 0; }
.dlv-rows li.is-new .dlv-name { background: var(--hl-soft); box-shadow: 0 0 0 3px var(--hl-soft); border-radius: 3px; }
.dlv-name { display: inline-block; max-width: 100%; vertical-align: bottom; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlv-rows .grow { min-width: 0; }
.dlv-sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlv-sub code, .dlv-note-body code, .ship-summary code { font-size: 11.5px; }
.dlv-pr { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; text-decoration: none; }
a.dlv-pr:hover { text-decoration: underline; text-underline-offset: 2px; }
.dlv-time { min-width: 60px; text-align: right; font-size: 12px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

.dlv-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.dlv-notes li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.4; }
.dlv-notes li .bullet { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); margin: 7px 0 0 4px; }
.dlv-notes li.is-new .dlv-lead-name { background: var(--hl-soft); box-shadow: 0 0 0 3px var(--hl-soft); border-radius: 3px; }
.dlv-lead .faint { margin-left: 6px; }
.dlv-lead { font-weight: 600; overflow-wrap: anywhere; }
.dlv-note-body { color: var(--ink-2); overflow-wrap: anywhere; cursor: pointer; }

.dlv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 1px; margin-bottom: 12px; background: var(--grid); border: 1px solid var(--grid); border-radius: 8px; overflow: hidden; }
.dlv-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 8px 10px; background: var(--sheet); text-decoration: none; }
.dlv-tile:hover { background: var(--sheet-2); }
.dlv-tile b { font: 600 22px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }

.dlv-columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.dlv-rest { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; }
.dlv-card .section-head { margin-bottom: 8px; }
.dlv-card > .btn { margin-top: 8px; }
.dlv-folded { max-height: 330px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.ledger a.tile { color: inherit; text-decoration: none; }
.ledger a.tile:hover { background: var(--sheet-2); }
@media (max-width: 1100px) { .dlv-columns { grid-template-columns: minmax(0, 1fr); } }

/* Questions waiting on you: who asks and for how long, the question, and its options. */
.dlv-qs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dlv-q { display: flex; flex-direction: column; gap: 5px; padding: 10px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.dlv-q:first-child { padding-top: 2px; }
.dlv-q:last-child { border-bottom: 0; }
.dlv-q-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.dlv-q-id { font-variant-numeric: tabular-nums; }
.dlv-q.is-new .dlv-q-id { background: var(--hl-soft); box-shadow: 0 0 0 3px var(--hl-soft); border-radius: 3px; }
.dlv-q-who { min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.dlv-q-wait { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dlv-q-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--ink-3); }
.dlv-q-meta code { font-size: 11.5px; }
.dlv-q-text { line-height: 1.45; overflow-wrap: anywhere; cursor: pointer; }
.dlv-q-text p { margin: 0 0 4px; }
.dlv-q-text p:last-child { margin-bottom: 0; }
.dlv-q-text.clamp { -webkit-line-clamp: 3; }
.dlv-options { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; color: var(--ink-2); line-height: 1.4; overflow-wrap: anywhere; }
.dlv-options li::marker { color: var(--ink-3); }
.dlv-options li.ticked { color: var(--ink); font-weight: 600; }
.dlv-q-note, .dlv-tg { margin: 0; }
/* A lane's priority in the PREP queue, P0 or P1; outlined when it was given to an earlier head. */
.dlv-lane-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.dlv-lane-line .dlv-name { min-width: 0; }
.dlv-prio { flex: none; padding: 1px 5px; border-radius: 4px; background: var(--hl-soft); color: var(--ink); font: 600 10.5px/1.4 var(--font-body); }
.dlv-prio.earlier { background: none; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-3); }

.ai-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 8px 0; }
.ai-empty h4 { margin: 4px 0 0; font: 600 15px/1.2 var(--font-display); }
.ai-empty p { margin: 0 0 4px; max-width: 42ch; color: var(--ink-2); font-size: 13px; }
.ai-mark { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--hl-soft); color: var(--ink); }

/* Claude answers (and any Markdown) */
.prose { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 9px; }
.prose ul, .prose ol { margin: 0 0 9px; padding-left: 20px; }
.prose li { margin: 2px 0; }
.prose h2, .prose h3, .prose h4 { font: 600 14.5px/1.3 var(--font-display); margin: 14px 0 5px; }
.prose code { font-family: var(--font-mono); font-size: 12.5px; background: var(--hover); padding: 1px 4px; border-radius: 4px; }
.prose strong { font-weight: 650; }
.prose a { color: var(--focus); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 12px 0; }
.caret::after {
  content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px;
  background: var(--ink); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.thinking { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--hl); animation: pulse 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------------------------ overlays */

.layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.layer > * { pointer-events: auto; }
.scrim { position: fixed; inset: 0; background: var(--scrim); animation: fade-in 0.15s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

.dialog {
  position: fixed; left: 50%; top: 9vh; transform: translateX(-50%);
  width: min(var(--dialog-w, 560px), calc(100vw - 32px)); max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: rise-in 0.16s ease-out;
}
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.dialog-head h2 { margin: 0; font: 600 18px/1.2 var(--font-display); flex: 1; }
.dialog-body { padding: 4px 18px 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--grid); }
.dialog-foot .row { margin-left: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w, 460px), 100vw);
  display: flex; flex-direction: column;
  background: var(--sheet); border-left: 1px solid var(--rule); box-shadow: var(--shadow-lg);
  animation: slide-in 0.18s ease-out;
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--grid); }
.drawer-head h2 { margin: 0; font: 600 17px/1.2 var(--font-display); }
.drawer-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.drawer-body { flex: 1; overflow: auto; padding: 14px 18px; }

.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: 300px; padding: 4px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 9px; box-shadow: var(--shadow);
  animation: fade-in 0.1s ease-out;
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; text-align: left; text-decoration: none; font-size: 13.5px; color: var(--ink);
}
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu .danger { color: var(--bad-text); }
.menu hr { border: 0; border-top: 1px solid var(--grid); margin: 4px 2px; }
.menu .icon { color: var(--ink-3); flex: none; }
.menu button:disabled { opacity: 0.5; }
.menu button.two-line { height: auto; min-height: 44px; padding: 6px 10px; align-items: center; }
.menu-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.menu-text small { font-size: 12px; color: var(--ink-3); line-height: 1.35; white-space: normal; }
.menu-check { width: 15px; flex: none; margin-left: auto; color: var(--ink); display: inline-flex; }
.menu-check .icon { color: var(--ink); }
.menu-head { padding: 6px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.menu:has(.two-line) { max-width: 360px; }

/* Command palette */
.palette {
  position: fixed; left: 50%; top: 13vh; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px)); max-height: 66vh; display: flex; flex-direction: column;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: rise-in 0.14s ease-out;
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--grid); color: var(--ink-3); }
.palette-input input { flex: 1; height: 54px; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.palette-list { overflow: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 12px; color: var(--ink-3); }
.palette-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; color: var(--ink); font-size: 14px;
}
.palette-item .icon { color: var(--ink-3); }
.palette-item .hint { margin-left: auto; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.palette-item[aria-selected="true"] { background: var(--sheet-2); box-shadow: inset 0 0 0 1px var(--rule); }
.palette-item[aria-selected="true"] .icon { color: var(--ink); }
.palette-empty { padding: 18px; color: var(--ink-3); font-size: 13px; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--grid); font-size: 12px; color: var(--ink-3); }
.palette-foot span { display: inline-flex; gap: 5px; align-items: center; }

/* Ask Claude panel */
.ask { --drawer-w: 480px; }
/* Pills that open a menu: who answers (in the header) and what it reads (under the box) */
.who, .reads {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 8px 0 9px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
}
.who span, .reads span { overflow: hidden; text-overflow: ellipsis; }
.who:hover, .reads:hover { background: var(--sheet-2); color: var(--ink); }
.who .icon:first-child, .reads .icon:first-child { color: var(--accent-ink, var(--ink)); }
.ask .drawer-head .sub { margin-top: 6px; }
.chat { flex: 1; overflow: auto; padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 22px; }
.chat-intro { color: var(--ink-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 10px; margin: auto 0; }
.chat-intro h3 { margin: 0; font: 600 18px/1.25 var(--font-display); color: var(--ink); }
.turn { display: flex; flex-direction: column; gap: 8px; }
.turn-q { align-self: flex-end; max-width: 88%; background: var(--sheet-2); border: 1px solid var(--rule); border-radius: 12px 12px 4px 12px; padding: 8px 12px; font-size: 13.5px; }
.turn-q .scope { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.turn-meta .by { display: inline-flex; align-items: center; gap: 5px; }
.chat-intro .ai-mark { margin-bottom: 2px; }
.chat-intro p { margin: 0; }
.turn-meta { display: flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 12px; flex-wrap: wrap; }
.turn-meta .grow { min-width: 60px; }
.turn-error { color: var(--bad-text); font-size: 13px; }
.composer { border-top: 1px solid var(--grid); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--rule); border-radius: 12px; padding: 6px 6px 6px 12px; background: var(--sheet); }
.composer-box:focus-within { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.composer textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; min-height: 24px; max-height: 160px; padding: 5px 0; line-height: 1.45; }
.composer-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
/* Settings: one card per assistant */
.ai-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.ai-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); }
.ai-card.next { border-color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--ink-3); }
.ai-card-head { display: flex; align-items: center; gap: 8px; }
.ai-card-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--sheet-2); color: var(--ink-2); flex: none; }
.tag { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--sheet); font-size: 11.5px; font-weight: 600; white-space: nowrap; }

/* The snapshot viewer */
.ctx-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.ctx-summary b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ctx-list { display: flex; flex-direction: column; gap: 8px; }
.ctx-sec { border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); }
.ctx-sec summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.ctx-sec summary::-webkit-details-marker { display: none; }
.ctx-sec summary::before { content: ''; width: 7px; height: 7px; border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(-45deg); transition: transform 0.15s; flex: none; }
.ctx-sec[open] summary::before { transform: rotate(45deg); }
.ctx-title { font-weight: 600; font-size: 13.5px; flex: 1; }
.ctx-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ctx-body { margin: 0; padding: 10px 12px 12px; border-top: 1px solid var(--grid); font: 12px/1.55 var(--font-mono); white-space: pre-wrap; word-break: break-word; color: var(--ink-2); max-height: 340px; overflow: auto; }
.plan-line { display: flex; gap: 10px; flex-wrap: wrap; }

/* Widget gallery */
.gallery-search { margin-bottom: 12px; }
.gallery-group { margin-bottom: 16px; }
.gallery-group h3 { margin: 0 0 8px; font: 600 13px/1.2 var(--font-display); color: var(--ink-2); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.gallery button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 11px 12px; min-height: 92px;
  border: 1px solid var(--rule); border-radius: 9px; background: var(--sheet); text-align: left;
}
.gallery button:hover { border-color: var(--axis); background: var(--sheet-2); }
.gallery button b { display: flex; align-items: center; gap: 8px; font: 600 13.5px/1.2 var(--font-display); }
.gallery button span { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.gallery button .added { color: var(--good-text); font-size: 12px; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.template-grid button { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 9px; background: var(--sheet); text-align: left; min-height: 84px; }
.template-grid button b { font: 600 14px/1.2 var(--font-display); }
.template-grid button span { font-size: 12px; color: var(--ink-2); }
.template-grid button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.metric-pick { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow: auto; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-control); }
.metric-pick h4 { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.metric-pick .chips button { font-size: 12.5px; padding: 3px 10px; }
.goal-rows { display: flex; flex-direction: column; gap: 6px; }
.goal-rows .row { flex-wrap: nowrap; }

/* ------------------------------------------------------------------ views: everything, focus, full screen */

/* Focus keeps only the activity, next to the sidebar; Full screen hides the sidebar too. */
.page.stage-on > :not(.stage-view) { display: none !important; }
.stage-view { position: relative; min-height: calc(100vh - 94px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px 0; }
.stage-exit { position: fixed; top: 14px; right: 18px; z-index: 30; display: flex; gap: 8px; transition: opacity 0.4s; }
.stage-switch button { display: inline-flex; align-items: center; gap: 6px; }
.stage-fade { transition: opacity 0.4s; }
body.stage-idle { cursor: none; }
body.stage-idle .stage-exit, body.stage-idle .stage-fade { opacity: 0; pointer-events: none; }
body.stage-full .rail, body.stage-full .mobile-bar { display: none; }
body.stage-full .app { grid-template-columns: minmax(0, 1fr); }
body.stage-full .main { max-width: none; padding: 0 32px; }
body.stage-full .stage-view { min-height: 100vh; }

/* ------------------------------------------------------------------ timer page */

.timer-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 16px; align-items: stretch; }
.timer-card { display: grid; place-items: center; min-height: 440px; padding: 36px 24px; }
.timer-face { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 640px; text-align: center; }
.timer-label {
  width: 100%; max-width: 520px; padding: 4px 6px 6px;
  border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: none;
  font: 500 20px/1.3 var(--font-body); color: var(--ink); text-align: center;
}
.timer-label::placeholder { color: var(--ink-3); }
.timer-label:hover { border-bottom-color: var(--rule); }
.timer-label:focus { outline: none; border-bottom-color: var(--ink-2); }
.timer-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.timer-state .live { background: var(--hl); color: var(--hl-ink); font-weight: 600; border-radius: 3px 8px 4px 7px / 6px 4px 7px 3px; padding: 1px 8px; }
.timer-state .paused { font-weight: 600; }
.timer-time { font: 300 clamp(84px, 8.5vw, 132px)/0.95 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.timer-time.running { font-weight: 400; }
.progress { width: 100%; max-width: 420px; height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ink); border-radius: 3px; transition: width 1s linear; }
.timer-setup, .timer-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.timer-today { display: none; font-size: 13px; color: var(--ink-2); }
.timer-log .section-head { align-items: center; }
.timer-total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.timer-total b { font: 600 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.timer-total span { font-size: 13px; color: var(--ink-2); }
.timer-log .side { display: inline-flex; align-items: center; gap: 4px; }
.timer-log .side .btn.icon { width: 26px; height: 26px; }

.stage-view .timer-face { max-width: 960px; gap: 22px; }
.stage-view .timer-label { max-width: 760px; font-size: 26px; }
.stage-view .timer-time { font-size: clamp(112px, 15vw, 240px); }
.stage-view .progress { max-width: 560px; height: 5px; }
.stage-view .timer-today { display: block; }
body.stage-full .stage-view .timer-label { font-size: clamp(24px, 2.4vw, 40px); }
body.stage-full .stage-view .timer-time { font-size: clamp(140px, 22vw, 400px); }
body.stage-full .stage-view .progress { max-width: 40vw; }

/* ------------------------------------------------------------------ tests */

.test-stage {
  position: relative; border: 1px solid var(--rule); border-radius: var(--r-panel); background: var(--sheet);
  padding: 26px 28px; min-height: 220px;
}
.typing-text { font: 22px/1.75 var(--font-body); color: var(--ink-3); user-select: none; word-break: break-word; max-height: calc(22px * 1.75 * 3); overflow: hidden; }
.typing-text.code { font-family: var(--font-mono); font-size: 19px; }
.typing-text .w { display: inline; }
.typing-text .c-ok { color: var(--ink); }
.typing-text .c-bad { color: var(--bad-text); text-decoration: underline; text-decoration-thickness: 2px; }
.typing-text .c-extra { color: var(--bad-text); opacity: 0.7; }
.typing-text .caret { box-shadow: inset 2px 0 0 var(--ink); animation: blink-caret 1s steps(1) infinite; }
.typing-text .caret-end { box-shadow: inset -2px 0 0 var(--ink); animation: blink-caret 1s steps(1) infinite; }
.typing-text .caret::after, .typing-text .caret-end::after { content: none; }
@keyframes blink-caret { 50% { box-shadow: none; } }
.typing-input { position: absolute; opacity: 0; pointer-events: none; height: 1px; width: 1px; }
.typing-meta { display: flex; gap: 22px; align-items: baseline; margin-bottom: 14px; }
.typing-meta .big { font: 600 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.typing-cover { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center; gap: 10px; padding: 0 24px; text-align: center; background: color-mix(in srgb, var(--sheet) 70%, transparent); border-radius: var(--r-panel); color: var(--ink-2); font-weight: 500; cursor: text; }

.reaction-pad {
  width: 100%; min-height: 280px; border: 0; border-radius: var(--r-panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font: 600 30px/1.2 var(--font-display); color: var(--ink); background: var(--grid);
  user-select: none; touch-action: manipulation;
}
.reaction-pad small { font: 400 14px/1.4 var(--font-body); color: var(--ink-2); }
.reaction-pad.wait { background: #3b3f45; color: #f1f2ee; }
.reaction-pad.wait small { color: #c9ccc6; }
.reaction-pad.go { background: #0f8f3a; color: #ffffff; }
.reaction-pad.go small { color: #e6f5ea; }
.reaction-pad.early { background: var(--critical); color: #ffffff; }
.reaction-pad.early small { color: #fbe9e9; }
.trials { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.trials span { border: 1px solid var(--rule); border-radius: 6px; padding: 3px 9px; font-variant-numeric: tabular-nums; font-size: 13px; background: var(--sheet); }

.math-q { font: 500 58px/1.1 var(--font-display); font-variant-numeric: tabular-nums; margin: 6px 0 18px; }
/* Before the first key press: holds the question's height, with a quieter prompt in it */
.math-ready { display: flex; align-items: center; min-height: 1.1em; }
.math-ready span { font-size: max(20px, 0.26em); color: var(--ink-2); }
.stage-view .math-ready { justify-content: center; }
.math-input { font: 500 32px/1 var(--font-display); height: 58px; width: 220px; text-align: left; padding: 0 14px; }
.math-progress { display: flex; gap: 4px; margin-bottom: 16px; }
.math-progress i { width: 26px; height: 6px; border-radius: 3px; background: var(--grid); }
.math-progress i.ok { background: var(--good); }
.math-progress i.bad { background: var(--critical); }
.math-progress i.cur { background: var(--ink); }
.result-line { display: flex; gap: 28px; flex-wrap: wrap; margin: 6px 0 16px; }
.result-line div { display: flex; flex-direction: column; }
.result-line b { font: 600 32px/1.1 var(--font-display); }
.result-line span { color: var(--ink-2); font-size: 13px; }
.test-kpis { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 8px; }
.test-kpis div { display: flex; align-items: baseline; gap: 6px; }
.test-kpis b { font: 600 22px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.test-kpis span { font-size: 13px; color: var(--ink-2); }

/* Tests in Focus and Full screen: the test alone, centered and larger, with its live numbers */
.stage-view .test-main { width: min(1100px, 100%); }
.stage-view .test-stage { border: 0; background: none; padding: 0; }
.stage-view .typing-meta { justify-content: center; gap: 44px; margin-bottom: 28px; }
.stage-view .typing-meta .big { font-size: 44px; }
.stage-view .typing-text { font-size: 30px; max-height: calc(30px * 1.75 * 3); }
.stage-view .typing-text.code { font-size: 26px; }
.stage-view .typing-cover { background: color-mix(in srgb, var(--paper) 78%, transparent); }
.stage-view .math-stage { display: flex; flex-direction: column; align-items: center; text-align: center; }
.stage-view .math-progress { justify-content: center; margin-bottom: 26px; }
.stage-view .test-kpis { justify-content: center; gap: 12px 48px; margin-bottom: 30px; }
.stage-view .test-kpis b { font-size: 30px; }
.stage-view .math-q { font-size: clamp(72px, 9vw, 140px); margin: 8px 0 34px; }
.stage-view .math-answer { justify-content: center; }
.stage-view .math-input { width: 300px; height: 76px; font-size: 44px; text-align: center; }
.stage-view .math-answer .btn { height: 76px; padding: 0 28px; font-size: 18px; }
.stage-view .math-stage .table-wrap { width: min(720px, 100%); text-align: left; }
.stage-view .result-line, .stage-view .trials { justify-content: center; }
.stage-view .reaction-pad { min-height: min(62vh, 560px); font-size: 44px; }

/* ------------------------------------------------------------------ chess puzzles */

/* A paper and graphite board; the last move wears the highlighter, since it is what's new. */
:root { --cb-light: #e6e8df; --cb-dark: #a0a899; --pc-w: #fbfbf9; --pc-b: #2b3036; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cb-light: #c3c8bc; --cb-dark: #78816f; } }
:root[data-theme="dark"] { --cb-light: #c3c8bc; --cb-dark: #78816f; }
/* The other boards, the same in light and dark: a green like chess.com's, a brown like Lichess's. */
[data-board="green"] { --cb-light: #ebecd0; --cb-dark: #779556; }
[data-board="brown"] { --cb-light: #f0d9b5; --cb-dark: #b58863; }

.cb {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  background: repeating-conic-gradient(var(--cb-dark) 0 25%, var(--cb-light) 0 50%) 0 0 / 25% 25%;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.cb.your-move { cursor: pointer; }
.cb-marks, .cb-pieces, .cb-coords { position: absolute; inset: 0; pointer-events: none; }
.cb-mark, .cb-pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; }
.cb-mark.last { background: color-mix(in srgb, var(--hl) 48%, transparent); }
.cb-mark.sel { background: color-mix(in srgb, var(--hl) 78%, transparent); }
.cb-mark.dest { background: radial-gradient(circle, rgba(26, 30, 34, 0.3) 16%, transparent 18%); }
.cb-mark.take { background: radial-gradient(circle, transparent 64%, rgba(26, 30, 34, 0.3) 66%); }
.cb-mark.check { background: radial-gradient(circle, rgba(208, 59, 59, 0.95), rgba(208, 59, 59, 0.45) 42%, transparent 72%); }
.cb-mark.flash { animation: cb-flash 0.9s ease-out forwards; }
.cb-mark.flash.bad { background: color-mix(in srgb, var(--critical) 62%, transparent); }
.cb-mark.flash.good { background: color-mix(in srgb, var(--good) 48%, transparent); }
@keyframes cb-flash { 0%, 35% { opacity: 1; } 100% { opacity: 0; } }
.cb-pc { transition: transform 0.18s ease; }
.cb-pc svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 0.6px rgba(0, 0, 0, 0.28)); }
.cb-pc.dragging { transition: none; z-index: 3; }
.cb-pc.dragging svg { transform: scale(1.12); }
.cb-pc.gone { opacity: 0; transition: transform 0.18s ease, opacity 0.15s ease; }
.pc-body { stroke-width: 1.5; stroke-linejoin: round; }
.pc-line { fill: none; stroke-width: 1.5; stroke-linecap: round; }
.cb-pc.w .pc-body { fill: var(--pc-w); stroke: #1a1e22; }
.cb-pc.w .pc-line { stroke: #1a1e22; }
.cb-pc.w .pc-dot { fill: #1a1e22; }
.cb-pc.b .pc-body { fill: var(--pc-b); stroke: #0c0e10; }
.cb-pc.b .pc-line { stroke: #e3e6de; }
.cb-pc.b .pc-dot { fill: #e3e6de; }
.cb-coords span { position: absolute; font: 700 10.5px/1 var(--font-body); }
.cb-file { bottom: 3px; width: 12.5%; padding-right: 4px; text-align: right; }
.cb-rank { left: 4px; padding-top: 4px; }
.cb-coords .on-dark { color: var(--cb-light); }
.cb-coords .on-light { color: var(--cb-dark); }
.cb-promo { position: absolute; top: 0; z-index: 4; display: flex; flex-direction: column; width: 12.5%; height: 50%; background: var(--sheet); border-radius: 4px; box-shadow: var(--shadow-lg); }
.cb-promo.up { top: auto; bottom: 0; flex-direction: column-reverse; }
.cb-promo .cb-pc { position: relative; flex: 1; width: 100%; height: auto; padding: 4%; border: 0; border-radius: 4px; background: none; cursor: pointer; transition: none; }
.cb-promo .cb-pc:hover, .cb-promo .cb-pc:focus-visible { background: var(--hl-soft); }

.chess-stage { display: grid; grid-template-columns: minmax(0, 560px) minmax(240px, 1fr); gap: 28px; align-items: start; }
.chess-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.chess-board { position: relative; }
.chess-look { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
/* Short of room, the label goes above its buttons rather than the buttons wrapping. */
.chess-look > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--ink-2); }
.chess-look .seg button { padding: 3px 9px 3px 5px; }
.pc-icon.cb-pc { position: relative; flex: none; width: 20px; height: 20px; transition: none; }
.cb-swatch { flex: none; width: 14px; height: 14px; margin: 0 2px; border-radius: 3px; background: repeating-conic-gradient(var(--cb-dark) 0 25%, var(--cb-light) 0 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); }
.chess-cover {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px 12%; text-align: center; border-radius: 6px; background: color-mix(in srgb, var(--sheet) 86%, transparent); color: var(--ink-2);
}
.chess-cover p { margin: 0; max-width: 44ch; }
.chess-cover .result-line { justify-content: center; color: var(--ink); }
.chess-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.chess-turn { display: flex; align-items: center; gap: 9px; font: 600 20px/1.2 var(--font-display); }
.chess-turn i { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.chess-turn i.w { background: var(--pc-w); }
.chess-turn i.b { background: var(--pc-b); }
.chess-status { margin: 0; min-height: 2.9em; color: var(--ink-2); }
.chess-status.good { color: var(--good-text); }
.chess-status.bad { color: var(--bad-text); }
.chess-moves { display: flex; flex-wrap: wrap; gap: 3px 12px; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.chess-moves li { white-space: nowrap; }
.chess-moves .n { color: var(--ink-3); margin-right: 3px; }
.chess-moves .setup { color: var(--ink-2); }
.chess-info { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.chess-info b { color: var(--ink); font-weight: 600; }
.chess-typed { width: 100%; max-width: 260px; }
.chess-delta { margin-left: 6px; font-size: 14px; font-weight: 600; }
.chess-delta.up { color: var(--good-text); }
.chess-delta.down { color: var(--bad-text); }
/* On one column the look goes last, so the status stays next to the board. */
@media (max-width: 900px) {
  .chess-stage { grid-template-columns: minmax(0, 1fr); }
  .chess-main { display: contents; }
  .chess-look { order: 1; }
}

.stage-view .chess-look { display: none; }
.stage-view .chess-stage { grid-template-columns: minmax(0, min(74vh, 720px)) minmax(240px, 300px); justify-content: center; }
body.stage-full .stage-view .chess-stage { grid-template-columns: minmax(0, min(82vh, 960px)) minmax(240px, 320px); }
@media (max-width: 900px) { .stage-view .chess-stage, body.stage-full .stage-view .chess-stage { grid-template-columns: minmax(0, 1fr); } }
body.stage-full .stage-view .typing-text { font-size: 36px; max-height: calc(36px * 1.75 * 3); }
body.stage-full .stage-view .math-q { font-size: clamp(96px, 12vw, 200px); }

/* Phones: the exit buttons sit under the top bar instead of over it, and the live numbers line up as columns */
@media (max-width: 860px) {
  .stage-view { min-height: calc(100dvh - 140px); padding-top: 56px; }
  .stage-exit { position: absolute; top: 0; right: 0; }
  body.stage-full .stage-exit { top: 12px; }
  .stage-view .test-kpis { gap: 10px 28px; }
  .stage-view .test-kpis div { flex-direction: column; align-items: center; gap: 2px; }
  .stage-view .test-kpis div span { order: 1; }
  .stage-view .test-kpis b { font-size: 24px; }
  .stage-view .math-q, body.stage-full .stage-view .math-q { font-size: clamp(40px, 15vw, 72px); margin: 4px 0 24px; }
  .stage-view .math-answer { width: 100%; flex-wrap: nowrap; }
  .stage-view .math-input { flex: 1; width: auto; min-width: 0; height: 64px; font-size: 36px; }
  .stage-view .math-answer .btn { height: 64px; }
  .stage-view .typing-text, body.stage-full .stage-view .typing-text { font-size: 22px; max-height: calc(22px * 1.75 * 3); }
  .stage-view .typing-meta { gap: 24px; }
  .stage-view .typing-meta .big { font-size: 30px; }
}


/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; left: calc(var(--rail) + 20px); bottom: 20px; z-index: 95; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.toast {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 460px; overflow: hidden;
  padding: 10px 8px 12px 12px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.4;
  animation: toast-in 0.18s ease-out;
}
.toast-icon { display: grid; place-items: center; flex: none; color: var(--ink-3); }
.toast.good .toast-icon { color: var(--good-text); }
.toast.bad { border-color: color-mix(in srgb, var(--critical) 45%, var(--rule)); }
.toast.bad .toast-icon { color: var(--bad-text); }
.toast.warn .toast-icon { color: var(--warn-text); }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-action { flex: none; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--sheet-2); color: var(--ink); font-weight: 600; font-size: 12.5px; }
.toast-action:hover { background: var(--grid); }
.toast-close { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; color: var(--ink-3); }
.toast-close:hover { background: var(--sheet-2); color: var(--ink); }
/* The time left, as a line that shortens; pointing at the toast or tabbing into it holds it. */
.toast-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink-3); opacity: 0.5; transform-origin: left; animation: toast-time linear forwards; }
.toast.good .toast-timer { background: var(--good); }
.toast.bad .toast-timer { background: var(--critical); }
.toast.warn .toast-timer { background: var(--warning); }
.toast:hover .toast-timer, .toast:focus-within .toast-timer { animation-play-state: paused; }
.toast.leaving { animation: toast-out 0.16s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes toast-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-timer { opacity: 0; }
}

/* ------------------------------------------------------------------ responsive */

/* Medium screens: quarter and third widths become halves, the rest full width. */
@media (max-width: 1360px) {
  .widget { grid-column: span var(--wm, 6); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { display: none; }
  .rail.open {
    display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100vh; z-index: 70;
    box-shadow: var(--shadow-lg); animation: none;
  }
  .rail-collapsed .rail.open .nav-label, .rail-collapsed .rail.open .brand-text { display: revert; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30;
    padding: 10px 12px; background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .mobile-bar .brand { margin-right: auto; }
  .main { padding: 16px 16px 64px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 26px; }
  .board-title { font-size: 22px; }
  .board { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .widget { grid-column: 1 / -1; grid-row: auto; min-height: calc(var(--h, 3) * 64px); max-height: 640px; }
  .widget[data-type="kpis"] { min-height: 0; }
  .kpi-strip { flex-wrap: wrap; }
  .kpi-strip .tile { flex: 1 1 140px; }
  .tape-grid { grid-template-columns: 92px minmax(0, 1fr); }
  .tape-hours .minor { display: none; }
  .timer-time { font-size: 72px; }
  .timer-layout { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 16px; right: 16px; }
  .log li { grid-template-columns: 58px 12px minmax(0, 1fr); }
  .log .side { grid-column: 3; text-align: left; }
  .board-actions { margin-left: 0; }
  .palette { top: 8vh; }
}
@media (hover: none) {
  .w-actions { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .seg-bar, .meter-fill, .tick, .ring-fill, .cat-bar i { forced-color-adjust: none; }
}

/* Code page: the year heatmap keeps its natural width, with the year in numbers beside it */
.heat-row { display: grid; grid-template-columns: minmax(0, 940px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.year-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 20px; }
.year-stats .stat-label { font-size: 12.5px; color: var(--ink-2); }
.year-stats .stat-value { margin-top: 2px; font: 600 24px/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.year-stats .stat-sub { font-size: 12px; color: var(--ink-3); }
@media (max-width: 1400px) { .heat-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .year-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------------------------ journal and entry panels */

.journal-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.supp-grid { display: grid; grid-template-columns: minmax(84px, 150px) repeat(var(--days), minmax(0, 1fr)); gap: 4px; align-items: center; margin-top: 16px; }
.supp-day { font-size: 11px; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.supp-day.today { color: var(--ink); font-weight: 600; }
.supp-name { padding-right: 8px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supp-cell { height: 20px; border-radius: 4px; background: var(--grid); display: grid; place-items: center; font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.supp-cell.on { background: var(--s7); color: #fff; }
.supp-cell.today { box-shadow: inset 0 0 0 2px var(--hl); }
.or-rule { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; }
.or-rule::before, .or-rule::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.entry-drawer { width: min(460px, 100vw); }
@media (max-width: 1100px) { .journal-top { grid-template-columns: minmax(0, 1fr); } }

/* Supplements: saved ones as chips, with the actions above them */
.supp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.supp-chips button { display: inline-flex; align-items: center; gap: 6px; }
.supp-chips button .icon { color: var(--s7); }
.supp-chips button.done { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); background: color-mix(in srgb, var(--good) 9%, var(--sheet)); }
.supp-chips button.done .icon { color: var(--good); }
.supp-chips button:disabled { opacity: 0.75; cursor: default; }
.supp-w .supp-grid { margin-top: 12px; }
.link-button { align-self: flex-start; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.preset-rows { display: flex; flex-direction: column; gap: 8px; }
.preset-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 96px 104px 32px; gap: 8px; align-items: center; }
.preset-icon { color: var(--s7); display: inline-flex; }

/* The quick journal: one question at a time */
.qj { --dialog-w: 640px; }
.qj .dialog-body { gap: 20px; min-height: 360px; }
.qj-progress { display: flex; gap: 5px; }
.qj-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--grid); transition: background 0.2s; }
.qj-progress i.done { background: color-mix(in srgb, var(--ink) 45%, var(--grid)); }
.qj-progress i.cur { background: var(--ink); }
.qj-stage { display: flex; flex-direction: column; gap: 18px; animation: fade-in 0.15s ease-out; }
.qj-q { display: flex; align-items: center; gap: 12px; }
.qj-q h3 { margin: 0; font: 600 22px/1.25 var(--font-display); }
.qj-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--hl-soft); color: var(--ink); flex: none; }
.qj-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.qj-scale button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px 12px;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); color: var(--ink-2); font-size: 13px;
}
.qj-scale button b { font: 600 24px/1 var(--font-display); color: var(--ink); }
.qj-scale button:hover { background: var(--sheet-2); }
.qj-scale button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.qj-scale button[aria-checked="true"] b { color: var(--sheet); }
.qj-phone { display: grid; grid-template-columns: repeat(2, minmax(0, 140px)); gap: 10px; }
.qj-review { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.qj-review li { display: grid; grid-template-columns: 20px 70px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.qj-review li .icon { color: var(--ink-3); margin-top: 2px; }
.qj-review .label { color: var(--ink-3); font-size: 13px; }
@media (max-width: 560px) {
  .qj-scale { grid-template-columns: minmax(0, 1fr); }
  .qj-scale button { flex-direction: row; justify-content: flex-start; padding: 12px 14px; }
}

/* The quick journal widget */
.jw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.jw-item { display: flex; align-items: center; gap: 9px; }
.jw-item .icon { color: var(--ink-3); flex: none; }
.jw-item div { display: flex; flex-direction: column; }
.jw-item b { font-size: 14px; }
.jw-took { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; }
.jw-took .icon { color: var(--s7); flex: none; }

/* ------------------------------------------------------------------ pins and widget twins */

/* "Add to a dashboard" in the corner of a card without a heading (rows of tiles, the day tape). */
.pin-corner { position: absolute; top: 6px; right: 6px; z-index: 2; background: var(--sheet); opacity: 0; transition: opacity 0.15s; }
:is(.ledger, .sheet):has(> .pin-corner) { position: relative; }
:is(.ledger, .sheet):hover > .pin-corner, .pin-corner:focus-visible { opacity: 1; }
@media (hover: none) { .pin-corner { opacity: 0.8; } }
@media (prefers-reduced-motion: reduce) { .pin-corner { transition: none; } }

/* Repos widget: your commits against agents'. */
.repo-bar { display: flex; gap: 2px; height: 4px; margin-top: 5px; }
.repo-bar i { border-radius: 2px; min-width: 2px; }

/* Workout cards (Health page and the Workouts widget). */
:root { --zone0: color-mix(in srgb, var(--ink-3) 45%, transparent); }
.wo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wo-grid.compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.wo-card { display: flex; flex-direction: column; gap: 9px; min-width: 0; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-panel); background: var(--sheet); }
.wo-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wo-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--sheet-2); color: var(--ink); }
.wo-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.wo-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-strain { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.wo-strain b { font: 600 22px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.wo-strain-bar { height: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.wo-strain-bar i { display: block; height: 100%; border-radius: 2px; background: var(--ink); }
.wo-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); }
.wo-stat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wo-stat .icon { color: var(--ink-3); flex: none; }
.wo-zone-bar { display: flex; gap: 2px; height: 8px; }
.wo-zone-bar i { min-width: 2px; border-radius: 2px; }
.wo-zone-key { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
.wo-zone-key span { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.wo-zone-key i { width: 8px; height: 8px; border-radius: 2px; }
.wo-grid.compact .wo-card { padding: 10px 12px; gap: 7px; }
/* The year in numbers in a widget: smaller numbers, more to a row. */
.widget .year-stats { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px 16px; }
.widget .year-stats .stat-value { font-size: 19px; }

/* Delivery: lanes open to show who built them and who approved them. */
.dlv-open { display: inline-block; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.dlv-open:hover { text-decoration: underline; text-underline-offset: 2px; }
.dlv-open[aria-expanded="true"] { color: var(--ink); }
.dlv-owner { color: var(--ink-2); font-weight: 500; }
.dlv-rows li:has(> .dlv-lane-slot) { flex-wrap: wrap; }
.dlv-lane-slot { flex-basis: 100%; margin: 0 0 4px; }
.dlv-lane { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--sheet-2); font-size: 12.5px; white-space: normal; }
.dlv-lane-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.dlv-lane-row .k { color: var(--ink-3); }
.dlv-lane-row code { font-size: 11.5px; }
.dlv-lane-row a { margin-left: 10px; color: var(--ink-2); }
.dlv-lane-row:last-child { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.dlv-lane-row:last-child .k { width: 84px; }
.dlv-quote { margin: 0 0 0 92px; padding: 2px 0 2px 10px; border-left: 2px solid var(--rule); color: var(--ink-2); overflow-wrap: anywhere; }
.dlv-contribs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.dlv-contribs li { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.dlv-contribs b { font-weight: 600; }
.dlv-prov .dlv-group summary .tiny { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .dlv-lane-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dlv-quote { margin-left: 0; }
}
.tile-label .icon { color: var(--ink-3); flex: none; }

/* ------------------------------------------------------------------ scrollbars */

/* Thin, rounded scrollbars in the app's greys instead of the browser's. Chrome and Edge draw
   them from ::-webkit-scrollbar; Firefox, which has no such selector, gets the standard
   properties. Setting scrollbar-width or scrollbar-color in Chrome would switch these off. */
:root {
  --scroll-thumb: color-mix(in srgb, var(--ink-3) 38%, transparent);
  --scroll-thumb-hover: color-mix(in srgb, var(--ink-3) 70%, transparent);
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { min-height: 36px; min-width: 36px; border: 3px solid transparent; border-radius: 8px; background: var(--scroll-thumb) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
::-webkit-scrollbar-thumb:active { background-color: var(--ink-3); }
::-webkit-scrollbar-button { display: none; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

/* ------------------------------------------------------------------ agenda and calendars */

.ag { display: flex; flex-direction: column; gap: 14px; }
.ag-head { margin: 0 0 6px; font: 600 13px/1.2 var(--font-display); color: var(--ink-2); }
.ag-allday { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ag-chip { max-width: 100%; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--s4) 18%, var(--sheet)); color: var(--ink); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-list { list-style: none; margin: 0; padding: 0; }
.ag-list li { display: grid; grid-template-columns: 62px 6px minmax(0, 1fr); gap: 10px; align-items: stretch; padding: 7px 0; border-bottom: 1px solid var(--grid); }
.ag-list li:last-child { border-bottom: 0; }
.ag-time { display: flex; flex-direction: column; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.25; }
.ag-time small { color: var(--ink-3); font-size: 11.5px; }
.ag-key { border-radius: 2px; background: var(--key); border: 1.5px solid var(--key); }
.ag-key.free { background: transparent; border-width: 2px; }
.ag-what { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ag-title { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-meta { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-list li.past { opacity: 0.55; }
.ag-list li.live { background: var(--hl-soft); box-shadow: -8px 0 0 var(--hl-soft), 8px 0 0 var(--hl-soft); border-radius: 4px; }
.ag-list li.live .ag-meta { color: var(--ink-2); }
.ag-none { margin: 0; font-size: 13px; color: var(--ink-3); }

.cal-list { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.cal-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.cal-list li:last-child { border-bottom: 0; }
.cal-key { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 8px; background: color-mix(in srgb, var(--s4) 18%, var(--sheet)); color: var(--ink); }
.cal-name { font-weight: 600; }
.cal-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.cal-help summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
.cal-help ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); max-width: 76ch; }
@media (max-width: 560px) { .cal-form { grid-template-columns: minmax(0, 1fr); } }
/* Narrow tiles let their note wrap instead of cutting it off. */
@media (max-width: 560px) { .tile-delta { white-space: normal; } }

/* Daybook inside Telegram: the sign-in screen, its steps in Settings, and room for Telegram's own controls. */
.tg-gate { min-height: 100dvh; max-width: 420px; margin: 0 auto; padding: 24px 24px 15vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px; }
.tg-gate h1 { margin: 0; font-size: 24px; color: var(--ink); }
.tg-gate p { margin: 0 0 8px; color: var(--ink-2); line-height: 1.5; }
.tg-gate-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--sheet); border: 1px solid var(--rule); color: var(--ink); }
.tg-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 16px; max-width: 76ch; color: var(--ink-2); }
.tg-steps li > b { color: var(--ink); }
.tg-steps li > .row, .tg-steps li > form, .tg-steps li > .stack, .tg-steps li > .hint, .tg-steps li > .status { margin-top: 8px; }
.tg-steps li > .hint { display: block; }
.in-telegram kbd { display: none; }
.in-telegram .rail.open { height: var(--tg-viewport-stable-height, 100dvh); }
.in-telegram body.stage-full .stage-view { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 12px); }
