/* The page's look. Plain CSS, no build step (spec/02-ui.md).
   One color per harness part. The theme follows the system unless the toggle pins it:
   every color is a light-dark() pair, so one `color-scheme` value flips them all at once. */

:root {
  /* Base stays "light dark" (follow the system). theme.js pins it via the <meta>. */
  color-scheme: light dark;
  &:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
  &:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }

  --bg: light-dark(#f7f7f5, #040807); /* dark: near-black with a teal cast, like gauravlahoti.dev */
  --surface: light-dark(#ffffff, #0b1312);
  --text: light-dark(#1d1d1b, #e6efed);
  --muted: light-dark(#6b6b66, #8da09c);
  --line: light-dark(#e4e4df, #1b2a28);
  --accent: light-dark(#0b7f70, #19e6c8); /* the site's cyan (D-179); a deep teal on light for contrast */
  --accent-text: light-dark(#ffffff, #00211c);
  --pass: light-dark(#1f7a3d, #5cc983);
  --fail: light-dark(#b42318, #ff8a80);
  --skip: light-dark(#8a6a00, #e0b84a);

  /* One color per harness part (used from S01 on). */
  --part-loop: light-dark(#6b6b66, #a3a39d);
  --part-context: light-dark(#1f5fd6, #7aa7ff);
  --part-actions: light-dark(#1f7a3d, #5cc983);
  --part-guard: light-dark(#b7791f, #e0b84a);
  --part-block: light-dark(#b42318, #ff8a80);
  --part-memory: light-dark(#6d3fc0, #b69cff);
  --part-verify: light-dark(#0b7a75, #4fd1c5); /* Plan & Verify (S11) */
  --part-online: light-dark(#9a3a85, #f08ad6); /* Online Evals (D-148) */
  --claude: light-dark(#b85a33, #e8956a); /* Claude's warm orange: paid */

  /* Agent view surfaces. */
  --bubble: light-dark(#ecebe6, #12201e);
  --dot-bg: light-dark(#ecebe6, #12201e);
  --text-soft: light-dark(#45453f, #c6d4d1);

  /* The theme toggle's own colors. */
  --toggle-track: light-dark(#cfe3ff, #0e2a26);
  --toggle-knob: light-dark(#ffffff, #15403a);
  --toggle-sun: #f2a516;
  --toggle-moon: #e8ecff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  /* The two side lanes: widths the person can drag (kept per browser). */
  --left: 240px;
  --right: 340px;
  display: grid;
  grid-template-columns: var(--left) 1fr;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  /* Pinned to the window: a long thread must not push the footer (and the theme
     toggle) off screen. */
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.org { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.org-logo { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent); }
.org-name { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.agent-box { margin: 0 0 14px -4px; }
.agent-pick { color: var(--text); font-weight: 600; }
.agent-pick::picker(select) { position-area: block-end span-inline-end; transform-origin: top left; min-width: 210px; }
.nav-item {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
.nav-item[aria-current="page"] { background: var(--bg); font-weight: 600; }
.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.version { margin: 0; color: var(--muted); font-size: 12px; }

/* ── Theme toggle ────────────────────────────────────────────────────────────
   A track with a sliding knob; the knob holds a sun that turns into a moon.
   --dark is 0 or 1 and comes only from CSS (the system or the pinned <meta>),
   so the switch stays right even when the system theme changes. */
.theme-toggle {
  --dark: 0;
  position: relative;
  width: 52px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--toggle-track);
  cursor: pointer;
  transition: background-color 0.4s ease;
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle { --dark: 1; }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle { --dark: 1; }

.theme-knob {
  position: absolute;
  inset: 2px auto auto 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--toggle-knob);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  translate: calc(var(--dark) * 24px) 0;
  transition: translate 0.45s cubic-bezier(0.34, 1.4, 0.64, 1), background-color 0.4s ease;
}
.theme-icon {
  position: absolute;
  inset: 3px;
  width: 16px;
  height: 16px;
  transition: opacity 0.35s ease, rotate 0.45s ease, scale 0.45s ease;
}
.theme-icon.sun {
  color: var(--toggle-sun);
  opacity: calc(1 - var(--dark));
  rotate: calc(var(--dark) * 90deg);
  scale: calc(1 - var(--dark) * 0.5);
}
.theme-icon.moon {
  color: var(--toggle-moon);
  opacity: var(--dark);
  rotate: calc((1 - var(--dark)) * -90deg);
  scale: calc(0.5 + var(--dark) * 0.5);
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .theme-knob, .theme-icon { transition: none; }
}

/* The button names the action it will take; only the true one is shown (and read). */
.theme-toggle .to-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle {
    .to-light { display: inline; }
    .to-dark { display: none; }
  }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle {
  .to-light { display: inline; }
  .to-dark { display: none; }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The page-wide switch: theme.js reveals the new theme in a circle from the toggle.
   Turn off the default cross-fade so only that reveal plays. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
main { padding: 28px 32px; max-width: 980px; width: 100%; justify-self: center; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 22px; }
h2 { margin: 0; font-size: 16px; }
.smoke { display: flex; gap: 8px; margin: 0; }
.pill {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
}
.pill.ok { color: var(--pass); }
.pill.skip { color: var(--skip); }
.pill.bad { color: var(--fail); }

.panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.panel-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hint { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

button.primary {
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.55; cursor: progress; }
button.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.summary { margin: 16px 0 6px; font-weight: 600; }
.summary.pass { color: var(--pass); }
.summary.fail { color: var(--fail); }

progress {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
}

/* ── Result rows ─────────────────────────────────────────────────────────── */
.rows { list-style: none; margin: 12px 0 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 22px 92px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 7px 4px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.row .icon { text-align: center; color: var(--muted); }
.row.passed .icon { color: var(--pass); }
.row.failed .icon { color: var(--fail); }
.row.skipped .icon { color: var(--skip); }
.row .check-id {
  font: 12px/1.6 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
}
.row .name { overflow-wrap: anywhere; }
.row .file { display: block; color: var(--muted); font-size: 12px; }
.row .time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.row.waiting .name { color: var(--muted); }

/* New results fade in; people who prefer less motion get them instantly. */
.row.done {
  @media (prefers-reduced-motion: no-preference) {
    animation: arrive 0.25s ease-out;
  }
}
@keyframes arrive {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

@media (max-width: 720px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  main { padding: 20px 16px; }
  .row { grid-template-columns: 22px 1fr auto; }
  .row .check-id { display: none; }
}

/* ── Views ───────────────────────────────────────────────────────────────────
   The sidebar switches between Agent and Checks; the hidden one is not rendered. */
.view[hidden] { display: none; }
.nav-item[aria-current="page"] { background: var(--bg); font-weight: 600; }

/* ── Agent view (S01) ────────────────────────────────────────────────────────
   Calm like a chat on the surface (spec/02-ui.md). Every step the harness takes is
   one quiet line you can open: the X-ray underneath. */
.view-agent {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  max-width: 780px;
  margin: 0 auto;
}
.powered { font-weight: 600; }

.thread { flex: 1; display: flex; flex-direction: column; gap: 34px; padding: 8px 0 28px; }

.empty { margin-top: 14vh; text-align: center; }
.empty-title { margin: 0 0 6px; font-size: 21px; font-weight: 600; }
.empty code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface);
  font: 12px ui-monospace, "SF Mono", Menlo, monospace;
}
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.example {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.example:hover { border-color: var(--accent); }
.example:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* One task and the agent's work on it. */
.turn { display: flex; flex-direction: column; gap: 22px; }
.turn.new {
  @media (prefers-reduced-motion: no-preference) {
    animation: rise 0.35s ease-out;
  }
}
@keyframes rise {
  from { opacity: 0; translate: 0 6px; }
}
.you { display: flex; justify-content: flex-end; }
.bubble {
  max-width: 82%;
  margin: 0;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--bubble);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.agent-name { font-weight: 650; }
.agent-label { color: var(--muted); }
.agent-stats {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.agent-stats.working {
  color: var(--accent);
  @media (prefers-reduced-motion: no-preference) {
    animation: pulse 1.4s ease-in-out infinite;
  }
}
@keyframes pulse {
  50% { opacity: 0.45; }
}

/* The activity list: a dot per step, joined by a thin line. */
.activity { list-style: none; margin: 10px 0 0; padding: 0; }
.act { position: relative; }
.act:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 27px;
  bottom: -3px;
  width: 1px;
  background: var(--line);
}
.act.new {
  @media (prefers-reduced-motion: no-preference) {
    animation: arrive 0.3s ease-out;
  }
}
.act > details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 5px 0;
  list-style: none;
  cursor: pointer;
  border-radius: 6px;
}
.act > details > summary::-webkit-details-marker { display: none; }
.act > details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--dot-bg);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.act.done .dot { color: var(--pass); }
.act.error .dot { color: var(--fail); }
.act.working .dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  @media (prefers-reduced-motion: no-preference) {
    animation: spin 0.8s linear infinite;
  }
}
@keyframes spin {
  to { rotate: 1turn; }
}
.act-text { font-size: 14px; color: var(--text-soft); overflow-wrap: anywhere; }
.part-tool .act-text { color: var(--part-actions); }
.act.error .act-text { color: var(--fail); }
.act-tag {
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
}
.part-tool .act-tag { color: var(--part-actions); border-color: color-mix(in srgb, var(--part-actions) 35%, transparent); }
.chev { flex: none; width: 13px; height: 13px; color: var(--muted); transition: rotate 0.2s ease; }
details[open] > summary .chev { rotate: 180deg; }

/* Opened row: plain facts first, the raw event below. */
.act-body {
  margin: 2px 0 10px 31px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.raw > summary { margin-top: 10px; color: var(--muted); font-size: 12px; cursor: pointer; width: fit-content; }
.raw pre {
  max-height: 280px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg);
  font: 12px/1.45 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The answer, as prose. */
.reply { margin-top: 16px; font-size: 15.5px; line-height: 1.68; overflow-wrap: anywhere; }
.reply:empty { display: none; }
.reply p { margin: 0 0 10px; }
.reply ul, .reply ol { margin: 0 0 10px; padding-left: 22px; }
.reply li { margin: 4px 0; }
/* Answers (D-131): small headings, nested lists indented, sources as quiet badges. */
.reply .prose-h { margin: 14px 0 6px; font-size: 1em; font-weight: 650; }
.reply li > ul, .reply li > ol { margin: 4px 0 2px; padding-left: 18px; color: var(--text-soft); font-size: 0.95em; }
.reply code.cite {
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--part-context) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--part-context) 7%, var(--surface));
  color: var(--part-context);
  font: 600 0.74em/1.6 ui-sans-serif, system-ui, sans-serif;
  white-space: nowrap;
  vertical-align: 1px;
}
.reply code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bubble);
  font: 0.88em ui-monospace, "SF Mono", Menlo, monospace;
}
.run-foot { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.run-foot:empty { display: none; }
/* Calls · tokens · cost · time: quiet, under the final answer. */
.run-meta { margin: 10px 0 0; }
.run-meta:empty { display: none; }
/* ── Run summary under the final answer: one quiet line ─────────────────────── */
/* One horizontal band (your request, 2026-11-12): the numbers · where the tokens went ·
   how full the context was. It stacks only when the column is narrow. */
.run-meta { container-type: inline-size; }
.receipt {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto;
  align-items: center;
  gap: 8px 18px;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 11px;
  color: var(--muted);
}
.receipt-grid { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.receipt-cell { display: inline-flex; align-items: baseline; gap: 4px; }
.receipt-num { color: var(--text); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
/* Where the tokens went, right under the numbers. */
.receipt-bar { display: flex; gap: 2px; width: 100%; height: 5px; }
.seg { min-width: 4px; border-radius: 3px; transform-origin: left; }
.seg-in { background: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.seg-out { background: var(--accent); }
.seg-think { background: linear-gradient(90deg, #b06bff, #ff7ab8); }
.receipt-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.legend-item.lg-in { color: color-mix(in srgb, var(--accent) 55%, var(--muted)); }
.legend-item.lg-out { color: var(--accent); }
.legend-item.lg-think { color: #b06bff; }
@media (prefers-reduced-motion: no-preference) {
  .receipt { animation: receipt-in 0.4s ease-out both; }
  .seg { animation: seg-grow 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) 0.2s both; }
  /* The answer itself settles in, paragraph by paragraph. */
  .reply > * { animation: receipt-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
  .reply > :nth-child(2) { animation-delay: 0.07s; }
  .reply > :nth-child(3) { animation-delay: 0.14s; }
  .reply > :nth-child(n + 4) { animation-delay: 0.21s; }
}
@keyframes receipt-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes seg-grow { from { transform: scaleX(0); opacity: 0; } }

/* Effort menu: three bars that fill with the level (Low · Medium · High). */
.effort-glyph { width: 15px; height: 15px; flex: none; }
.effort-glyph rect { fill: color-mix(in srgb, var(--text) 22%, transparent); }
.effort-glyph[data-level="1"] .b1,
.effort-glyph[data-level="2"] .b1, .effort-glyph[data-level="2"] .b2,
.effort-glyph[data-level="3"] rect { fill: var(--accent); }
.effort-pick selectedcontent { white-space: nowrap; }
.run-foot.stopped { color: var(--skip); }
.run-foot.failed { color: var(--fail); }

/* The input box, docked at the bottom. The dock fades the thread out underneath it,
   so text scrolling past never shows below the box. */
.dock {
  position: sticky;
  bottom: 0;
  padding: 18px 0 22px;
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}
.composer {
  padding: 12px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 6px 28px light-dark(rgb(0 0 0 / 0.06), rgb(0 0 0 / 0.35));
  transition: border-color 0.2s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 26px;
  max-height: 200px;
  field-sizing: content; /* grows with the text where supported; rows=1 elsewhere */
  resize: none;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.composer-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.composer-alert { flex: 1; margin: 0; color: var(--fail); font-size: 12.5px; }

/* Model menu (D-31): the browser's own <select>, styled and animated with
   appearance: base-select. Browsers without it show their normal dropdown. */
.model-pick,
.model-pick::picker(select) {
  appearance: base-select;
}
.model-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.model-pick:hover,
.model-pick:open {
  background: var(--bg);
  border-color: var(--line);
  color: var(--text);
}
.model-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-pick:disabled { opacity: 0.45; cursor: not-allowed; }
.model-pick selectedcontent { display: inline-flex; align-items: center; gap: 7px; }
/* A thin chevron, drawn with two borders, to match the rest of the page. */
.model-pick::picker-icon {
  content: "";
  width: 6px;
  height: 6px;
  margin: 0 3px 3px 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: rotate 0.3s cubic-bezier(0.16, 1, 0.3, 1), translate 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.model-pick:open::picker-icon { rotate: 180deg; translate: 0 3px; }

/* The list rises out of the pill: fade + slide + a touch of scale. It opens upward,
   because the box sits at the bottom of the screen; it flips down if there's no room. */
.model-pick::picker(select) {
  position-area: block-start span-inline-end;
  position-try-fallbacks: flip-block;
  margin-block: 8px;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 14px 40px light-dark(rgb(0 0 0 / 0.14), rgb(0 0 0 / 0.5));
  transform-origin: bottom left;
  opacity: 0;
  translate: 0 6px;
  scale: 0.97;
  transition:
    display 0.24s allow-discrete,
    overlay 0.24s allow-discrete,
    opacity 0.18s ease,
    translate 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    scale 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.model-pick:open::picker(select) {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}
@starting-style {
  .model-pick:open::picker(select) {
    opacity: 0;
    translate: 0 6px;
    scale: 0.97;
  }
}
.model-pick option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.model-pick option:hover,
.model-pick option:focus-visible { background: var(--bg); outline: none; }
/* The current model: bold and a check mark (never colour alone). */
.model-pick option:checked { font-weight: 600; }
.model-pick option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
.model-glyph { width: 15px; height: 15px; flex: none; color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .model-pick,
  .model-pick::picker(select),
  .model-pick::picker-icon,
  .model-pick option {
    transition: none;
  }
}

/* Profile switcher (D-39): cards with a thumb that glides between them. The hidden select
   keeps the value; each card is a real radio, so arrow keys and screen readers just work. */
.profile-box { margin: 4px 0 18px; }
.profile-switch {
  --h: 52px;
  --gap: 6px;
  position: relative;
  display: grid;
  gap: var(--gap);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--text) 3%, var(--surface));
  isolation: isolate;
}
.pf-thumb {
  position: absolute;
  inset: 5px 5px auto 5px;
  height: var(--h);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 8px 24px -10px color-mix(in srgb, var(--accent) 55%, transparent);
  outline: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  transform: translateY(calc(var(--i, 0) * (var(--h) + var(--gap))));
  z-index: -1;
}
.pf-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--h);
  padding: 0 12px 0 9px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
}
.pf-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pf-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.pf-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.pf-text { display: grid; line-height: 1.25; min-width: 0; }
.pf-name { font-weight: 650; font-size: 14px; color: inherit; }
.pf-sub { font-size: 11px; color: var(--muted); opacity: 0; max-height: 0; overflow: hidden; }
.pf-live {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pass);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--pass) 60%, transparent);
  opacity: 0;
  transform: scale(0.4);
}
.pf-card:has(input:checked) { color: var(--text); }
.pf-card:has(input:checked) .pf-avatar {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #9b5cff));
  box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--accent) 70%, transparent);
}
.pf-card:has(input:checked) .pf-sub { opacity: 1; max-height: 16px; }
.pf-card:has(input:checked) .pf-live { opacity: 1; transform: none; }
.pf-card:not(:has(input:checked)):hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }

@media (prefers-reduced-motion: no-preference) {
  .pf-thumb { transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.5, 1); }
  .pf-card, .pf-avatar { transition: color 0.25s, background 0.25s, box-shadow 0.35s; }
  .pf-avatar { transition-property: color, background, box-shadow, transform; }
  .pf-card:has(input:checked) .pf-avatar { animation: pf-pop 0.5s cubic-bezier(0.34, 1.6, 0.5, 1); }
  .pf-sub { transition: opacity 0.25s 0.08s, max-height 0.3s; }
  .pf-live { transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.6, 0.5, 1); }
  .pf-card:has(input:checked) .pf-live { animation: pf-pulse 2.4s ease-out infinite 0.5s; }
  .pf-thumb::after {
    content: "";
    position: absolute;
    inset: -1.5px;
    border-radius: inherit;
    padding: 1.5px;
    background: conic-gradient(from var(--spin, 0deg), transparent 0 60%, color-mix(in srgb, var(--accent) 80%, #fff) 80%, transparent);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: pf-spin 4s linear infinite;
  }
}
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes pf-spin { to { --spin: 360deg; } }
@keyframes pf-pop { 0% { transform: scale(0.7) rotate(-8deg); } 100% { transform: none; } }
@keyframes pf-pulse { 70%, 100% { box-shadow: 0 0 0 7px transparent; } 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pass) 55%, transparent); } }

/* CONTEXT lines: what the agent knows (memory files, skills). Blue, per spec/02-ui.md. */
.part-context .act-text { color: var(--part-context); }
.part-context .act-tag {
  color: var(--part-context);
  border-color: color-mix(in srgb, var(--part-context) 35%, transparent);
}

/* S03: how much power a tool has. Quiet for reading, louder for writing and acting. */
.act-risk {
  --risk: var(--part-loop);
  padding: 0 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--risk) 12%, transparent);
  color: var(--risk);
  font-size: 10px;
  font-weight: 600;
}
.risk-write { --risk: var(--part-guard); }
.risk-action { --risk: var(--part-block); }

/* S03: files a tool saved. A card per file; it opens to the text. */
.files { display: grid; gap: 8px; margin-top: 4px; }
.files:empty { display: none; }
.file-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px;
}
.file-card > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}
.file-card > summary::-webkit-details-marker { display: none; }
.file-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.file-icon { flex: none; width: 17px; height: 17px; color: var(--part-actions); }
.folder-outbox .file-icon { color: var(--part-block); }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-where { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.file-card .chev { margin-left: auto; }
.file-body {
  max-height: 360px;
  overflow: auto;
  padding: 4px 14px 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
}
.file-body p { margin: 10px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .file-card { transition: border-color 0.2s ease; }
  .file-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
}

.send {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  transition: opacity 0.2s ease, scale 0.15s ease;
}
.send svg { width: 18px; height: 18px; }
.send:active { scale: 0.94; }
.send:disabled { opacity: 0.4; cursor: default; }
.send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 720px) {
  .view-agent { min-height: auto; }
  .bubble { max-width: 92%; }
}

/* ── Harness pane (S04): one section per harness part, colour by part ─────── */
body:has(> .harness-pane:not([hidden])) { grid-template-columns: var(--left) 1fr var(--right); }
.harness-pane {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
  font-size: 13.5px;
}
.harness-pane[hidden] { display: none; }
body:has(:is(#view-checks, #view-memory):not([hidden])) :is(.harness-pane, .pane-toggle, .lane-right) { display: none; }
.pane-head {
  position: sticky;
  top: 0;
  z-index: 1;
  /* Title centred; the buttons sit in the right column. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.pane-head h2 { grid-column: 2; margin: 0; font-size: 15px; text-align: center; }
.pane-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 6px; }
.pane-reset {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.pane-close, .pane-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.pane-close svg, .pane-toggle svg { width: 18px; height: 18px; }
.pane-close:hover, .pane-toggle:hover { color: var(--text); border-color: var(--line); }
:is(.pane-close, .pane-toggle, .pane-reset, .off-chip):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pane-toggle {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 5;
  background: var(--surface);
  border-color: var(--line);
}
.pane-toggle[hidden] { display: none; }
.pane-body { padding: 6px 12px 28px; }
.pane-error { color: var(--fail); padding: 0 4px; }

.pane-part { --part: var(--part-loop); border-bottom: 1px solid var(--line); padding: 4px 0 10px; }
.pane-part.part-context { --part: var(--part-context); }
.pane-part.part-tools { --part: var(--part-actions); }
.pane-part.part-memory { --part: var(--part-memory); }
.pane-part.part-guard { --part: var(--part-guard); }
.pane-part.part-verify { --part: var(--part-verify); }
.pane-part > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px 6px;
  cursor: pointer;
  list-style: none;
}
.pane-part > summary::-webkit-details-marker, .pane-item summary::-webkit-details-marker { display: none; }
.part-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--part); flex: none; }
.part-title { font-weight: 650; color: var(--text); }
.part-sum { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
.pane-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 4px 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.sub-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.sub-note { margin-left: auto; color: var(--muted); font-size: 11.5px; text-align: right; }
.pane-file { display: flex; align-items: baseline; gap: 8px; padding: 4px 4px 4px 40px; }
.pane-list { list-style: none; margin: 0; padding: 0; }
.pane-line { padding: 3px 4px; overflow-wrap: anywhere; }
.pane-line.muted, .pane-note { color: var(--muted); }
.pane-note { margin: 4px 4px 0; }
.pane-warn {
  margin: 8px 4px 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--part-block) 10%, transparent);
  color: var(--part-block);
}
.pane-part .facts { margin: 4px 4px 0; font-size: 12.5px; }

.pane-item { display: flex; align-items: flex-start; gap: 8px; padding: 3px 4px; }
.pane-item details { flex: 1; min-width: 0; }
.pane-item summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; cursor: pointer; list-style: none; padding: 2px 0; }
.pane-item .facts { margin: 4px 0 6px; padding: 8px 10px; border-radius: 8px; background: var(--bg); }
.item-name { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.pane-tag { padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; }
.pane-item.is-off .item-name { color: var(--muted); text-decoration: line-through; }
.pane-item.is-off summary :is(.act-risk, .pane-tag) { opacity: 0.5; }

/* A switch: the native `switch` checkbox where supported, the same look everywhere. */
.switch-wrap { display: inline-flex; padding-top: 3px; position: relative; }
/* Locked switches (the tour, a hosted visitor; D-202): say why on hover or keyboard focus. */
:is(.tour-mode, .public-mode:not(.owner-mode)) .switch { cursor: not-allowed; }
:is(.tour-mode, .public-mode:not(.owner-mode)) .switch-wrap:is(:hover, :focus-within)::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 60;
  left: -4px;
  bottom: calc(100% + 10px);
  width: 240px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 500 12.5px/1.45 ui-sans-serif, system-ui, sans-serif;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  pointer-events: none;
}
:is(.tour-mode, .public-mode:not(.owner-mode)) .switch-wrap:is(:hover, :focus-within)::before {
  content: "";
  position: absolute;
  z-index: 61;
  left: 10px;
  bottom: calc(100% + 4px);
  width: 10px;
  height: 10px;
  rotate: 45deg;
  border: solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-width: 0 1px 1px 0;
  background: var(--surface);
}
.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 28px;
  height: 16px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
}
.switch::before {
  content: "";
  position: absolute;
  inset: 2px auto auto 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}
.switch:checked { background: var(--accent); }
.switch:checked::before { translate: 12px 0; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .switch, .switch::before { transition: background-color 0.2s ease, translate 0.2s ease; }
}

/* "2 off" in the input box: shown only when something is switched off (D-71). */
.off-chip {
  padding: 2px 9px;
  border: 1px solid color-mix(in srgb, var(--part-guard) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--part-guard) 10%, transparent);
  color: var(--part-guard);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.off-chip[hidden] { display: none; }

/* A helper's lane: nested under the line that started it, with its own counters. */
.lane {
  margin: 4px 0 8px 31px;
  padding: 6px 0 2px 12px;
  border-left: 2px solid color-mix(in srgb, var(--part-actions) 45%, transparent);
}
.lane-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.lane-name { font-weight: 650; }
.lane-meta { color: var(--muted); }
.lane-stats { margin-left: auto; color: var(--muted); font-size: 12px; }
.lane-stats.working { color: var(--accent); }
.lane.stopped .lane-stats, .lane.failed .lane-stats { color: var(--skip); }
.lane-activity { margin-top: 4px; }
.lane-activity .act-text { font-size: 13px; }

/* Narrow screens: the pane slides over the page instead of taking a column. */
@media (max-width: 1100px) {
  body:has(> .harness-pane:not([hidden])) { grid-template-columns: var(--left) 1fr; }
  .harness-pane {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 10;
    width: min(var(--right), 100vw - 32px);
    box-shadow: -8px 0 24px rgb(0 0 0 / 0.18);
  }
}

/* ── Guardrails on the page (S05) ────────────────────────────────────────── */
.part-guard .act-text { color: var(--part-guard); }
.part-guard .act-tag { color: var(--part-guard); border-color: color-mix(in srgb, var(--part-guard) 40%, transparent); }
.act.error .act-text { color: var(--fail); }

.switch-spacer { flex: none; width: 28px; }
.pane-item.is-locked .item-name { color: var(--muted); }
.pane-item.is-locked summary .act-risk { opacity: 0.5; }
.pane-rule { color: var(--text); }
.pane-rule-row { display: flex; align-items: baseline; gap: 10px; padding: 3px 4px; }
.pane-rule-row .pane-rule { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rule-mark { flex: none; width: 14px; text-align: center; font-size: 12px; font-weight: 700; }
.tone-ok .rule-mark { color: var(--pass); }
.tone-no .rule-mark { color: var(--fail); }
.tone-pause .rule-mark { color: var(--part-guard); }
.pane-group { margin: 8px 4px 2px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.pane-rule-row .sub-note { max-width: 45%; }

/* ⏸ The run waits here for a person. */
.approval-card {
  margin: 4px 0 10px 31px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--part-guard) 45%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--part-guard) 6%, var(--surface));
  font-size: 13.5px;
}
.approval-card.approved { border-color: color-mix(in srgb, var(--pass) 45%, var(--line)); background: var(--surface); }
.approval-card.rejected { border-color: color-mix(in srgb, var(--fail) 45%, var(--line)); background: var(--surface); }
.approval-why { margin: 0 0 8px; color: var(--part-guard); font-weight: 600; }
.approval-card .facts dd { max-height: 220px; overflow: auto; }
.approval-actions { display: flex; gap: 8px; margin-top: 12px; }
.approval-actions button {
  padding: 6px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.approval-actions .approve { border: 0; background: var(--accent); color: var(--accent-text); }
.approval-actions .reject { border: 1px solid var(--line); background: none; color: var(--text); }
.approval-actions button:disabled { opacity: 0.5; cursor: default; }
.approval-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.approval-error { margin: 8px 0 0; color: var(--fail); }
.approval-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.approval-role { font-weight: 700; color: var(--part-guard); }
.approval-step {
  padding: 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--part-guard) 14%, transparent);
  color: var(--part-guard);
  font-size: 11px;
  font-weight: 600;
}
.approval-clock { margin-left: auto; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.approval-question { margin: 0 0 8px; font-size: 14px; }
.approval-field {
  width: 100%;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.approval-field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.approval-demo { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.approval-result { margin: 8px 0 0; color: var(--text-soft); font-size: 13px; }
.approval-nothing { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

/* Scrolling to a line or an approval card must stop above the docked input box,
   or the Approve button sits behind it (found live in S05). */
.act, .approval-card, .run-foot, .file-card { scroll-margin-bottom: 190px; }

/* ── Guardrails cards: green allowed · red not allowed · amber asks you ─────── */
.guard-card {
  --tone: var(--pass);
  margin: 8px 4px 0;
  padding: 8px 10px 9px;
  border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--line));
  border-left: 3px solid var(--tone);
  border-radius: 10px;
  background: color-mix(in srgb, var(--tone) 6%, var(--surface));
}
.guard-card.tone-no { --tone: var(--fail); }
.guard-card.tone-pause { --tone: var(--part-guard); }
.guard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.guard-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tone) 18%, transparent);
  color: var(--tone);
  font-size: 11px;
  font-weight: 800;
  flex: none;
}
.guard-title { font-weight: 650; color: var(--text); }
.guard-note { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.tone-pause .limit-label { font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--part-guard); }
.tone-pause .guard-limits li::before { content: "⏸"; color: var(--part-guard); font-size: 10px; }
.guard-text { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 11.5px/1.6 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--text-soft);
  background: var(--surface);
  overflow-wrap: anywhere;
}
.chip-ok { border-color: color-mix(in srgb, var(--pass) 40%, transparent); color: var(--pass); background: color-mix(in srgb, var(--pass) 10%, transparent); }
.chip-no { border-color: color-mix(in srgb, var(--fail) 40%, transparent); color: var(--fail); background: color-mix(in srgb, var(--fail) 8%, transparent); }
.chip-no::before { content: "✕ "; font-weight: 700; }
.chip-pause { border-color: color-mix(in srgb, var(--part-guard) 45%, transparent); color: var(--part-guard); background: color-mix(in srgb, var(--part-guard) 10%, transparent); }

.guard-limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.guard-limits li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.guard-limits .limit-label { flex: 1; min-width: 0; color: var(--text); }
.tone-no .guard-limits li::before { content: "✕"; color: var(--fail); font-weight: 700; font-size: 11px; }
.limit-badge {
  flex: none;
  padding: 0 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
  font-size: 11px;
  font-weight: 600;
}

/* ── Your work: this profile's conversations, named by topic (S07) ───────────── */
/* Chats keeps its size: its list scrolls on its own (max 32vh), and the sidebar scrolls when
   all the groups are open. Letting it shrink spilled the list over the groups below. */
.work { display: flex; flex-direction: column; flex-shrink: 0; margin: 4px 0 10px; }
.work-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.work-head h2 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
/* Sidebar groups fold: the heading is the button; the body animates its height (0fr ↔ 1fr). */
.side-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 -4px;
  padding: 3px 6px 3px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.side-toggle:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.side-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-chev { width: 12px; height: 12px; transition: transform 0.25s ease; }
.side-toggle[aria-expanded="false"] .side-chev { transform: rotate(-90deg); }
.side-body { display: grid; grid-template-rows: 1fr; min-height: 0; transition: grid-template-rows 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease; }
.side-inner { min-height: 0; overflow: hidden; }
.side-group.collapsed .side-body { grid-template-rows: 0fr; opacity: 0; }
.views { margin: 4px 0 10px; }
.profiles .profile-box { margin: 8px 0 14px; }
.views nav.sections { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .side-body, .side-chev { transition: none; } }
.work-new {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.work-new:hover { border-color: var(--accent); color: var(--accent); }
.work-new:focus-visible, .work-open:focus-visible, .work-delete:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.work-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; max-height: 32vh; overflow-y: auto; }
.work-item { position: relative; display: flex; align-items: center; border-radius: 9px; }
.work-item:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.work-item.active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.work-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.work-open {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
  padding: 7px 10px 7px 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 9px;
}
.work-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-meta { font-size: 11px; color: var(--muted); }
/* A run still going in this chat (D-212): amber while it waits for a person. */
.work-live { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.work-live.waiting { color: var(--part-guard); }
.work-live::before { content: "● "; }
@media (prefers-reduced-motion: no-preference) { .work-live.waiting::before { animation: work-live-pulse 1.6s ease-in-out infinite; } }
@keyframes work-live-pulse { 50% { opacity: 0.35; } }
.work-delete {
  flex: none;
  margin-right: 6px;
  padding: 1px 7px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
}
.work-item:hover .work-delete, .work-delete:focus-visible, .work-delete.sure { opacity: 1; }
.work-delete.sure { background: color-mix(in srgb, var(--fail) 12%, transparent); color: var(--fail); font-size: 11px; font-weight: 600; }
.work-empty { margin: 8px 4px 0; color: var(--muted); font-size: 12px; }
.past-meta { color: var(--muted); font-size: 11.5px; }
@media (prefers-reduced-motion: no-preference) {
  .work-item { transition: background 0.2s; }
  .work-delete { transition: opacity 0.15s; }
  .work-title.retitled { animation: retitle 0.9s ease-out; }
}
@keyframes retitle { from { color: var(--accent); opacity: 0.2; } }

.note-list { margin: 6px 4px 4px; padding: 0 0 0 16px; display: grid; gap: 5px; font-size: 12.5px; color: var(--text-soft); }

/* One line under the agent's name: what it does for people. */
.agent-desc { margin: -8px 4px 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* Context fill: how full the working window was, under the token split. */
.receipt-fill { display: grid; gap: 4px; }
.fill-label { font-size: 10.5px; font-variant-numeric: tabular-nums; }
.fill-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.fill-level { display: block; height: 100%; border-radius: 2px; background: var(--pass); }
.fill-level.warm { background: var(--part-guard); }
.fill-level.hot { background: var(--fail); }
.legend-item.lg-cached { color: var(--pass); }
@media (prefers-reduced-motion: no-preference) {
  .fill-level { transform-origin: left; animation: seg-grow 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) 0.4s both; }
}

/* ── Lane handles: drag the edge of the sidebar or the Harness pane ─────────── */
.lane-handle {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 11;
  width: 9px;
  margin-left: -4px;
  cursor: col-resize;
  touch-action: none;
  background: none;
  border: 0;
  padding: 0;
}
.lane-handle::after {
  content: "";
  position: absolute;
  inset: 0 4px;
  background: transparent;
}
.lane-handle:hover::after,
.lane-handle:focus-visible::after,
body.resizing .lane-handle.active::after { background: var(--accent); }
.lane-handle:focus-visible { outline: none; }
.lane-left { left: var(--left); }
/* right: from the viewport edge, so a page scrollbar doesn't shift it */
.lane-right { right: var(--right); margin: 0 -4px 0 0; }
.lane-handle[hidden] { display: none; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .lane-handle::after { transition: background 0.15s; }
}
/* Below these widths the lanes stack or float, so there is nothing to drag. */
@media (max-width: 720px) { .lane-left { display: none; } }
@media (max-width: 1100px) { .lane-right { display: none; } }

/* ── Memory view: long-term facts per profile (left-lane "Memory") ──────────── */
.memory-intro { max-width: 62ch; margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 22px; }
.memory-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.memory-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.memory-card-head h2 { margin: 0; font-size: 16px; }
.memory-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #9b5cff));
}
.memory-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.memory-empty { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.fact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fact {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.fact:first-child { border-top: 0; }
.fact-date { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.fact-forget {
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.fact-forget:hover { border-color: var(--line); color: var(--text); }
.fact-forget:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fact-forget.sure { background: color-mix(in srgb, var(--fail) 12%, transparent); color: var(--fail); font-weight: 600; }
.pane-link { display: inline-block; margin: 6px 4px 2px; color: var(--accent); font-size: 12.5px; text-decoration: none; }
.pane-link:hover { text-decoration: underline; }
.view-memory .page-header { display: block; }
/* Sections nav: one row per page and a thumb that glides to the current one, like the
   profile switcher above it. Each page keeps its harness colour as a small dot (no icons).
   The current page is chosen in CSS (:has), so no script moves the thumb. */
nav.sections {
  --h: 38px;
  --gap: 2px;
  --i: 0;
  --c: var(--part-context);
  position: relative;
  display: grid;
  gap: var(--gap);
  margin-top: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 3%, var(--surface));
  isolation: isolate;
}
nav.sections:has([data-view="memory"][aria-current]) { --i: 1; --c: var(--part-memory); }
nav.sections:has([data-view="online"][aria-current]) { --i: 0; --c: var(--part-online); }
nav.sections:has([data-view="evals"][aria-current]) { --i: 1; --c: var(--part-guard); }
nav.sections:has([data-view="golden"][aria-current]) { --i: 2; --c: var(--skip); }
nav.sections:not(:has([aria-current])) .nav-thumb { opacity: 0; } /* the open page is in another group */
.nav-thumb {
  position: absolute;
  inset: 4px 4px auto 4px;
  height: var(--h);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 8px 22px -12px color-mix(in srgb, var(--c) 70%, transparent);
  outline: 1.5px solid color-mix(in srgb, var(--c) 45%, var(--line));
  transform: translateY(calc(var(--i) * (var(--h) + var(--gap))));
  z-index: -1;
}
nav.sections .nav-item {
  --dot: var(--part-context);
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--h);
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
}
nav.sections .nav-item[data-view="memory"] { --dot: var(--part-memory); }
nav.sections .nav-item[data-view="evals"] { --dot: var(--part-guard); }
nav.sections .nav-item[data-view="golden"] { --dot: var(--skip); }
nav.sections .nav-item[data-view="checks"] { --dot: var(--pass); }
nav.sections .nav-item::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0.45;
}
nav.sections .nav-item[aria-current="page"] { background: none; color: var(--text); font-weight: 650; }
nav.sections .nav-item[aria-current="page"]::before {
  opacity: 1;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 20%, transparent);
}
nav.sections .nav-item:not([aria-current]):hover { color: var(--text); background: color-mix(in srgb, var(--text) 4%, transparent); }
nav.sections .nav-item:not([aria-current]):hover::before { opacity: 0.8; }
nav.sections .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: no-preference) {
  .nav-thumb { transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.5, 1), outline-color 0.3s, box-shadow 0.3s; }
  nav.sections .nav-item { transition: color 0.25s, background 0.2s; }
  nav.sections .nav-item::before { transition: opacity 0.25s, box-shadow 0.35s; }
  nav.sections .nav-item[aria-current="page"]::before { animation: nav-pop 0.45s cubic-bezier(0.34, 1.6, 0.5, 1); }
}
@keyframes nav-pop {
  from { transform: scale(0.4); }
}
.claude-glyph { color: #c4683f; }
/* A hand-off to a sub-agent: same colour as tools, its own tag. */
.part-sub-agent .act-text { color: var(--part-actions); }
.part-sub-agent .act-tag { color: var(--part-actions); border-color: color-mix(in srgb, var(--part-actions) 35%, transparent); }

/* ── Evals view (S10): summary, metrics, cases, past evals, Run ── */
.evals-head { align-items: center; }
.evals-actions { display: flex; align-items: center; gap: 8px; }
.evals-reset { padding: 7px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.evals-reset:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); }
.evals-reset:disabled { opacity: 0.45; cursor: not-allowed; }
.evals-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:has(> #view-evals:not([hidden])) { max-width: 1120px; }
.evals-sub { margin: 32px 0 10px; font-size: 15px; }
.evals-note { margin: 0; color: var(--muted); font-size: 13px; }
.evals-stopped { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--skip) 12%, transparent); color: var(--skip); font-size: 13.5px; line-height: 1.5; }

/* Hero: a pass-rate ring, one sentence, three numbers. Readable by anyone. */
.evals-summary { margin-top: 14px; }
.evals-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 36px;
  padding: 28px 32px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--pass) 9%, transparent), transparent 55%),
    radial-gradient(100% 120% at 100% 100%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 12px 32px -16px rgb(0 0 0 / 0.18);
}
.hero-ring { width: 148px; height: 148px; transform: rotate(-90deg); }
.hero-ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring-track { stroke: color-mix(in srgb, var(--line) 85%, transparent); stroke-linecap: butt; }
.ring-pass { stroke: var(--pass); animation: ring-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ring-fail { stroke: var(--fail); animation: ring-in 0.9s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ring-progress { stroke: var(--accent); transition: stroke-dasharray 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring-caption {
  transform: rotate(90deg);
  transform-origin: 60px 60px;
  fill: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-anchor: middle;
  dominant-baseline: central;
}
.hero-ring-block { display: grid; justify-items: center; gap: 10px; }
.ring-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.ring-legend li { display: inline-flex; align-items: center; gap: 5px; }
.ring-legend li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ring-legend .pass::before { background: var(--pass); }
.ring-legend .fail::before { background: var(--fail); }
@keyframes ring-in { from { stroke-dasharray: 0 400; } }
.ring-pct {
  transform: rotate(90deg);
  transform-origin: 60px 60px;
  fill: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-anchor: middle;
  dominant-baseline: central;
  font-variant-numeric: tabular-nums;
}
.hero-words { min-width: 0; }
.hero-headline { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
.hero-sub { margin: 6px 0 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.5; text-wrap: pretty; }
.hero-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero-tile {
  display: grid;
  gap: 2px;
  min-width: 130px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}
.hero-tile strong { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hero-tile span { color: var(--muted); font-size: 12px; }
.hero-tile.good strong { color: var(--pass); }
.hero-tile.bad strong { color: var(--fail); }
.hero-kicker { margin: 0 0 6px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
/* Next Run cost panel (D-117): Agent, Judge and You Pay, side by side along the card's
   bottom. Hidden until the card takes it in. Free = green, paid = Claude orange. */
#view-evals > .evals-next { display: none; }
.evals-next { grid-column: 1 / -1; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.next-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.evals-next-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.next-scope { font-size: 13px; font-weight: 600; }
.next-basis { margin-left: auto; padding: 2px 9px; border: 1px dashed var(--line); border-radius: 999px; color: var(--muted); font-size: 11.5px; cursor: help; }
.next-basis:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cost-cards { display: grid; grid-template-columns: 1fr 1fr 1.05fr; gap: 12px; }
.cost-card {
  --tone: var(--pass);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 14px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 45%, var(--surface));
  transition: border-color 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
}
.cost-card.paid { --tone: var(--claude); border-color: color-mix(in srgb, var(--claude) 45%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--claude) 10%, transparent), 0 10px 26px -16px color-mix(in srgb, var(--claude) 70%, transparent); }
.cost-card.over { --tone: var(--skip); }
.cost-card-head { display: flex; justify-content: space-between; align-items: center; }
.cost-card h3 { margin: 0; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.cost-does { margin: 0 0 4px; color: var(--text-soft); font-size: 13px; }
.cost-pill { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; transition: background-color 0.3s ease, color 0.3s ease; }
.cost-pill.free { background: color-mix(in srgb, var(--pass) 14%, transparent); color: var(--pass); }
.cost-pill.paid { background: color-mix(in srgb, var(--claude) 15%, transparent); color: var(--claude); }
.cost-card .model-pick { align-self: flex-start; margin-left: -8px; }
.cost-big { margin: 4px 0 0; line-height: 1; }
.cost-num { font-size: 32px; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--tone); transition: color 0.3s ease; }
.cost-list, .cost-work, .cost-meter-text, .cost-range { margin: 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost-list { color: var(--text-soft); }
.cost-meter { height: 6px; margin-top: 6px; border-radius: 3px; background: color-mix(in srgb, var(--line) 85%, transparent); overflow: hidden; }
.cost-meter[hidden] { display: none; }
.cost-meter-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--tone); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s ease; }
.cost-card.over .cost-meter-text { color: var(--skip); font-weight: 600; }
/* You Pay: the total, the range, and how agent and judge split it. */
.cost-card.total {
  --tone: var(--text);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background:
    radial-gradient(130% 120% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    var(--surface);
}
.cost-card.total .cost-num { font-size: 40px; }
.cost-range { color: var(--text-soft); line-height: 1.45; }
.cost-cap { color: var(--skip); font-weight: 600; }
.cost-time { margin: 0; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cost-note { margin: 0; color: var(--skip); font-size: 12px; font-weight: 600; }
.cost-note:empty, .cost-time:empty { display: none; }
.cost-split { display: flex; height: 10px; margin-top: auto; border-radius: 5px; overflow: hidden; background: color-mix(in srgb, var(--line) 85%, transparent); }
.cost-split span { height: 100%; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.split-agent { background: var(--accent); }
.split-judge { background: var(--part-memory); }
.cost-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.cost-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-agent::before, .legend-judge::before { content: ""; width: 8px; height: 8px; border-radius: 2px; }
.legend-agent::before { background: var(--accent); }
.legend-judge::before { background: var(--part-memory); }
.legend-note { color: var(--muted); }
.synthetic-tag { margin-left: 10px; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--skip) 45%, var(--line)); border-radius: 999px; color: var(--skip); font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em; vertical-align: middle; }
.synthetic-tag[hidden] { display: none; }
/* Stack by the panel's own width: the sidebar and Harness pane make the window a poor guide. */
.evals-next { container-type: inline-size; }
@container (max-width: 640px) { .cost-cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .cost-card, .cost-pill, .cost-num, .cost-meter-fill, .cost-split span { transition: none; } }
@media (max-width: 700px) {
  .evals-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 22px 18px; }
  .hero-tiles { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .ring-pass, .ring-fail { animation: none; } .ring-progress { transition: none; } }

.evals-live[hidden] { display: none; }
.evals-live {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.live-head h2 { margin: 0; font-size: 15px; }
.live-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse { to { box-shadow: 0 0 0 9px transparent; } }
.live-count { font-weight: 650; font-variant-numeric: tabular-nums; }
.live-time { color: var(--text-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.live-head .evals-stop { margin-left: auto; }
.evals-live progress { width: 100%; height: 6px; accent-color: var(--accent); }
.live-now { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.live-ask { margin: 0; font-size: 14.5px; font-weight: 600; }
.live-phases { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: phase; }
.live-phases li {
  counter-increment: phase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}
.live-phases li::before { content: counter(phase); display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in srgb, var(--line) 70%, transparent); font-size: 11px; }
.live-phases li.now { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.live-phases li.now::before { background: var(--accent); color: var(--accent-text); }
.live-phases li.past { color: var(--text-soft); }
.live-phases li.past::before { content: "✓"; background: color-mix(in srgb, var(--pass) 20%, transparent); color: var(--pass); }
.live-detail { margin: 0; color: var(--text-soft); font-size: 13px; }
.live-detail.stalled { color: var(--skip); font-weight: 600; }
.live-feed { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-soft); max-height: 190px; overflow-y: auto; }
.live-feed li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; animation: feed-in 0.3s ease both; }
.live-feed .feed-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.live-feed .pass { color: var(--pass); }
.live-feed .fail { color: var(--fail); }
.live-feed .warn { color: var(--skip); }
@keyframes feed-in { from { opacity: 0; translate: 0 -4px; } }
@media (prefers-reduced-motion: reduce) { .live-pulse, .live-feed li { animation: none; } .live-phases li { transition: none; } }
.evals-stop, .evals-cancel {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.evals-stop:hover { border-color: var(--fail); color: var(--fail); }

/* Metrics: Metric · What it checks · Score, grouped as DeepEval groups them. */
.evals-metrics {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  font-size: 13.5px;
}
.evals-metrics th, .evals-metrics td { padding: 10px 16px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
.evals-metrics thead th { border-top: 0; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-group th { padding-top: 14px; padding-bottom: 6px; background: color-mix(in srgb, var(--line) 35%, transparent); color: var(--text-soft); font-size: 12px; font-weight: 600; }
.metric-name { width: 24%; font-weight: 600; }
.metric-cat { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.metric-does { color: var(--text-soft); line-height: 1.5; }
.metric-score { width: 230px; }
.score-none { color: var(--muted); }
.score-line { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.score-num { font-weight: 700; }
.score-line.pass .score-num { color: var(--pass); }
.score-line.fail .score-num { color: var(--fail); }
.score-bar { position: relative; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--line) 80%, transparent); }
.score-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--pass); transition: width 0.4s ease; }
.score-line.fail .score-fill { background: var(--fail); }
.score-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--text-soft); opacity: 0.55; }
.score-runs { color: var(--muted); font-size: 12px; }

/* Cases: one line each; open one for its runs. */
.evals-cases { display: grid; gap: 6px; }
/* Single Turn / Multi-Turn: each a fold, closed by default, its heading a one-line tally. */
.case-fold { border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--bg) 40%, var(--surface)); }
.case-fold + .case-fold { margin-top: 8px; }
.case-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 14px; list-style: none; cursor: pointer; border-radius: 12px; }
.case-kind::-webkit-details-marker { display: none; }
.case-kind::before { content: "›"; display: inline-block; width: 10px; color: var(--muted); font-size: 16px; transition: rotate 0.2s ease; }
.case-fold[open] > .case-kind::before { rotate: 90deg; }
.case-kind:hover { background: color-mix(in srgb, var(--line) 25%, transparent); }
.case-kind:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-kind-title { color: var(--text-soft); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.case-kind-tally { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.case-kind-tally .pass { color: var(--pass); }
.case-kind-tally .fail { color: var(--fail); }
.case-kind-tally .run { color: var(--accent); }
.case-fold-list { display: grid; gap: 6px; padding: 0 10px 10px; }
@media (prefers-reduced-motion: reduce) { .case-kind::before { transition: none; } }
.case-row { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.case-row > summary { list-style: none; cursor: pointer; border-radius: 12px; }
.case-row > summary::-webkit-details-marker { display: none; }
.case-row > summary:hover { background: color-mix(in srgb, var(--line) 25%, transparent); }
.case-row > summary:focus-visible, .history-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-row[open] > summary { border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.case-line { display: grid; grid-template-columns: 104px 1fr minmax(0, 34%); align-items: center; gap: 14px; padding: 10px 14px; }
.case-status { justify-self: start; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.status-passed { background: color-mix(in srgb, var(--pass) 14%, transparent); color: var(--pass); }
.status-failed { background: color-mix(in srgb, var(--fail) 14%, transparent); color: var(--fail); }
.status-running { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.case-main { min-width: 0; }
.case-ask { margin: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-more { color: var(--muted); font-size: 12px; }
.case-meta { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.case-core { margin-left: 8px; padding: 0 7px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 999px; color: var(--accent); font-size: 11px; }
.case-missed { color: var(--fail); font-size: 12.5px; text-align: right; }
.case-body { padding: 4px 16px 14px; }
.case-expected { margin: 10px 0 0; color: var(--text-soft); font-size: 13px; line-height: 1.5; }
.case-run { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.case-run h4 { margin: 0 0 6px; font-size: 13px; }
.case-turn { display: grid; gap: 4px; margin: 8px 0; }
.turn-ask { justify-self: end; max-width: 80%; margin: 0; padding: 6px 12px; border-radius: 12px; background: var(--bubble); font-size: 13px; }
.turn-tools { margin: 0; padding-left: 18px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.turn-tools .ok { color: var(--part-actions); }
.turn-tools .bad { color: var(--fail); }
.turn-answer { margin: 0; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.run-scores { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.run-scores li { display: grid; grid-template-columns: 16px minmax(150px, max-content) 1fr; gap: 8px; font-size: 12.5px; line-height: 1.5; }
.run-scores .pass .run-score-mark { color: var(--pass); }
.run-scores .fail .run-score-mark, .run-scores .fail .run-score-name { color: var(--fail); }
.run-score-name { font-weight: 600; }
.run-scores .off { color: var(--muted); }
.run-scores .off .run-score-why { color: var(--muted); font-style: italic; }
.run-score-why { color: var(--text-soft); overflow-wrap: anywhere; white-space: pre-line; }

/* Past evals. */
.evals-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history-item {
  display: grid;
  grid-template-columns: 150px 90px 1fr auto;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.history-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.history-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
.history-delete { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 16px; line-height: 1; cursor: pointer; transition: color 0.2s ease, background-color 0.2s ease; }
.history-delete:hover, .history-delete:focus-visible { color: var(--fail); background: color-mix(in srgb, var(--fail) 10%, transparent); outline: none; }
.history-delete.sure { color: var(--fail); background: color-mix(in srgb, var(--fail) 12%, transparent); font-size: 12px; font-weight: 650; }
.history-item[aria-current="true"] { border-color: var(--accent); }
.history-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-score { font-weight: 700; }
.history-meta { color: var(--muted); }
.history-tag { color: var(--skip); font-size: 12px; }

@media (max-width: 760px) {
  .case-line { grid-template-columns: auto 1fr; }
  .case-missed { grid-column: 1 / -1; text-align: left; }
  .metric-score { width: auto; }
  .history-item { grid-template-columns: 1fr auto; }
}
@media (prefers-reduced-motion: reduce) { .score-fill { transition: none; } }

/* The Run dialog: native <dialog> (focus trapped, Esc closes). */
.evals-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.45);
}
.evals-dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.evals-dialog fieldset { margin: 14px 0 0; padding: 0; border: 0; }
.evals-dialog legend { padding: 0; font-weight: 600; font-size: 13.5px; }
.evals-link { margin-left: 8px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 400; cursor: pointer; }
.evals-case-list { max-height: 260px; overflow-y: auto; margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.case-pick-group { margin: 8px 0 2px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.case-pick { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 13px; }
.case-pick-turns { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.evals-dialog-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.evals-runs label { margin-right: 14px; font-size: 13px; }
.evals-models { display: flex; flex-wrap: wrap; gap: 14px; }
.evals-model-pick { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
/* The dialog's menus open downward (the chat's pill opens upward from the bottom). */
.evals-pick::picker(select) { position-area: block-end span-inline-end; transform-origin: top left; }
.evals-estimate-cost { display: block; margin-top: 4px; color: var(--text); font-weight: 600; }
.evals-estimate { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--skip) 10%, transparent); color: var(--text-soft); font-size: 13px; }
.evals-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  .chip-fill { transition: none; }
}

/* ── Golden Dataset (S10): the eval cases as cards, grouped; nothing scored here ── */
main:has(> #view-golden:not([hidden])) { max-width: 1120px; }
.golden-head { align-items: flex-end; flex-wrap: wrap; gap: 14px; }
.golden-sub { margin: 6px 0 0; color: var(--text-soft); font-size: 14px; max-width: 62ch; }
.golden-filter { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.golden-filter button { padding: 6px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease; }
.golden-filter button:hover { color: var(--text); }
.golden-filter button[aria-pressed="true"] { background: color-mix(in srgb, var(--skip) 14%, var(--surface)); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); }
.golden-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.golden-group-title { margin: 28px 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.golden-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.golden-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, translate 0.2s ease;
}
.golden-card:hover { border-color: color-mix(in srgb, var(--skip) 40%, var(--line)); box-shadow: 0 10px 28px -16px rgb(0 0 0 / 0.25); translate: 0 -1px; }
.golden-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.golden-tags { display: flex; gap: 4px; }
.golden-tag { padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: 11px; }
.golden-tag.core { border-color: color-mix(in srgb, var(--skip) 45%, var(--line)); color: var(--skip); }
.golden-chat { display: grid; gap: 6px; }
.golden-ask { justify-self: end; max-width: 92%; margin: 0; padding: 7px 12px; border-radius: 14px 14px 4px 14px; background: var(--bubble); font-size: 13.5px; line-height: 1.45; }
.golden-expected { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--pass) 8%, transparent); }
.golden-expected p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.golden-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.golden-row { display: grid; gap: 4px; }
.golden-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.golden-chip { padding: 2px 8px; border-radius: 7px; background: color-mix(in srgb, var(--line) 55%, transparent); font-size: 12px; }
.golden-chip.tool { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--part-actions); background: color-mix(in srgb, var(--part-actions) 10%, transparent); }
.golden-chip.good { color: var(--pass); background: color-mix(in srgb, var(--pass) 10%, transparent); }
.golden-chip.bad { color: var(--fail); background: color-mix(in srgb, var(--fail) 9%, transparent); }
.golden-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .golden-card, .golden-filter button { transition: none; } }

/* ── Plan & Verify (S11): the To-Do and Checks cards in a run's Activity ── */
.part-plan .act-text, .part-verify .act-text { color: var(--part-verify); }
.todo-row { list-style: none; }
.past-cards { margin: 0 0 8px; padding: 0; }
.todo-card {
  margin: 4px 0 10px 31px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--part-verify) 40%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--part-verify) 5%, var(--surface));
  font-size: 13.5px;
}
.card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card-title { font-weight: 600; color: var(--part-verify); }
.card-count { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.todo-item { display: grid; grid-template-columns: 1.2em 1fr; column-gap: 6px; }
.todo-note { grid-column: 2; color: var(--text-soft); font-size: 12.5px; overflow-wrap: anywhere; }
.todo-box { text-align: center; }
.todo-item.is-done .todo-box { color: var(--pass); }
.todo-item.is-done .todo-text { color: var(--text-soft); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-soft) 50%, transparent); }
.todo-item.is-doing .todo-box, .todo-item.is-doing .todo-text { color: var(--part-verify); font-weight: 600; }
.todo-item.is-skipped .todo-box { color: var(--skip); }
@media (max-width: 600px) { .todo-card { margin-left: 0; } }

/* The run summary's columns: thin dividers between them, a single line each where it fits. */
.receipt-grid { flex-wrap: nowrap; white-space: nowrap; }
.receipt-tokens, .receipt-fill { display: grid; gap: 5px; padding-left: 18px; border-left: 1px solid var(--line); min-width: 0; }
.receipt-legend { gap: 2px 10px; }
.fill-label { white-space: nowrap; }
.receipt-fill { min-width: 130px; }
.receipt-fill { align-content: center; }
@container (max-width: 680px) {
  .receipt { grid-template-columns: 1fr; }
  .receipt-grid { flex-wrap: wrap; }
  .receipt-tokens, .receipt-fill { padding-left: 0; border-left: 0; }
}
.run-foot.unverified { color: var(--fail); } /* the answer failed a check twice (S11) */
.check-names .item-name { font-family: inherit; } /* the pane's check names: names, not code */
/* A check round (S11): a card like the To-Do card. Pending rows pulse; the border says the verdict. */
.todo-item.is-pending .todo-box { color: var(--muted); }
.todo-item.is-passed .todo-box { color: var(--pass); }
.todo-item.is-failed .todo-box, .todo-item.is-failed .todo-text { color: var(--fail); }
.todo-item.is-failed .todo-text { font-weight: 600; }
.todo-item.is-error .todo-box { color: var(--skip); }
.todo-item.is-skipped .todo-text { color: var(--muted); }
.check-card.is-retrying { border-color: color-mix(in srgb, var(--skip) 50%, var(--line)); background: color-mix(in srgb, var(--skip) 6%, var(--surface)); }
.check-card.is-retrying .card-title, .check-card.is-retrying .card-count { color: var(--skip); }
.check-card.is-failed { border-color: color-mix(in srgb, var(--fail) 45%, var(--line)); background: color-mix(in srgb, var(--fail) 5%, var(--surface)); }
.check-card.is-failed .card-title, .check-card.is-failed .card-count { color: var(--fail); }
.check-card.is-passed .card-count { color: var(--pass); }
.check-card.is-skipped { border-color: var(--line); background: var(--surface); }
.check-card.is-skipped .card-title { color: var(--muted); }
.check-fold { margin-top: 8px; font-size: 12.5px; color: var(--text-soft); }
.check-fold summary { cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .check-card.is-checking .card-title::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: vspin 0.8s linear infinite; }
  .todo-item.is-pending .todo-box { animation: vpulse 1s ease-in-out infinite; }
  .todo-item.is-passed .todo-box, .todo-item.is-failed .todo-box { animation: vpop 0.3s ease-out; }
}
@keyframes vspin { to { transform: rotate(360deg); } }
@keyframes vpulse { 50% { opacity: 0.35; } }
@keyframes vpop { from { transform: scale(0.4); } }
/* An outbox file shown as the email that went (your request, 2026-11-12). */
.email-card { overflow: hidden; }
.email-card > summary { border-bottom: 1px solid var(--line); }
.email-badge { flex: none; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--pass) 12%, var(--surface)); color: var(--pass); font-size: 12px; font-weight: 600; }
.email-card .file-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.email-card .file-where { flex: none; }
.email-sheet { padding: 14px 18px 4px; background: var(--surface); }
.email-subject { margin: 0 0 12px; font-size: 17px; font-weight: 650; line-height: 1.35; }
.email-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.email-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); font-weight: 700; }
.email-who { min-width: 0; font-size: 13.5px; line-height: 1.45; }
.email-from, .email-to { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.email-addr { color: var(--muted); font-size: 12.5px; }
.email-key { color: var(--muted); font-size: 12.5px; }
.email-date { align-self: start; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.email-body { padding: 14px 0 6px; font-size: 14.5px; line-height: 1.65; }
.email-body p { margin: 0 0 12px; white-space: pre-line; } /* keep a sign-off on its own lines */
/* A draft isn't sent: an accent badge, not the green "Sent" one (D-164). */
.email-badge.is-draft { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
/* A "> " quote in model text, e.g. a reply it suggests (D-164). */
.prose-quote { margin: 8px 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.prose-quote p { margin: 0 0 4px; }
.email-body ul, .email-body ol { margin: 0 0 12px; padding-left: 22px; }
.email-foot { display: grid; gap: 8px; margin: 4px -18px 0; padding: 12px 18px; border-top: 1px dashed var(--line); background: color-mix(in srgb, var(--text) 3%, var(--surface)); }
.email-record { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: start; }
.email-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.email-chip { padding: 1px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12.5px; }
.email-note { margin: 0; color: var(--muted); font-size: 12px; }
.email-where { margin: 0; padding: 6px 18px 9px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line); }
@media (max-width: 600px) {
  .email-head { grid-template-columns: auto 1fr; }
  .email-date { grid-column: 2; }
  .email-record { grid-template-columns: 1fr; }
}
/* S12: a long-term memory step, and a sent email inside the run's steps. */
.part-memory .act-text { color: var(--part-memory); }
.file-row { list-style: none; margin: 4px 0 10px 31px; }
@media (max-width: 600px) { .file-row { margin-left: 0; } }
/* An approval card (your request, 2026-11-12): who, what this person decides, the chain. */
.approval-v2 { padding: 0; overflow: hidden; border-radius: 14px; background: var(--surface); box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent), 0 8px 24px -16px color-mix(in srgb, var(--part-guard) 45%, transparent); }
.approval-v2 > * { margin-left: 18px; margin-right: 18px; }
.approval-v2 .approval-head { margin: 0; padding: 14px 18px; gap: 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--part-guard) 10%, var(--surface)), var(--surface)); border-bottom: 1px solid color-mix(in srgb, var(--part-guard) 18%, var(--line)); margin-left: 0; margin-right: 0; }
.approval-avatar { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--part-guard); color: var(--surface); font-weight: 700; font-size: 16px; }
.approval-who { display: grid; gap: 1px; min-width: 0; }
.approval-name { font-size: 15px; }
.approval-sub { color: var(--muted); font-size: 12px; }
.approval-v2 .approval-clock { align-self: start; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.approval-focus { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--part-guard); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--part-guard) 6%, var(--surface)); }
.approval-kicker { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.approval-what { margin: 3px 0 0; font-size: 16.5px; font-weight: 650; line-height: 1.35; }
.approval-terms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.approval-term { padding: 3px 11px; border-radius: 999px; background: var(--part-guard); color: var(--surface); font-size: 13px; font-weight: 650; }
.approval-rule { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.approval-chain { display: flex; gap: 0; margin-top: 16px; padding: 0; list-style: none; counter-reset: none; }
.chain-step { position: relative; flex: 1 1 0; display: grid; justify-items: center; gap: 3px; min-width: 0; text-align: center; }
.chain-step + .chain-step::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.chain-step.is-done + .chain-step::before, .chain-step.is-now::before { background: color-mix(in srgb, var(--pass) 55%, var(--line)); }
.chain-node { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.chain-step.is-done .chain-node { border-color: var(--pass); background: var(--pass); color: var(--surface); }
.chain-step.is-now .chain-node { border-color: var(--part-guard); background: var(--part-guard); color: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--part-guard) 22%, transparent); }
.chain-step.is-stopped .chain-node { border-color: var(--fail); background: var(--fail); color: var(--surface); }
.chain-name { font-size: 13px; }
.chain-step.is-next .chain-name { color: var(--muted); font-weight: 600; }
.chain-what { max-width: 100%; padding: 0 4px; color: var(--muted); font-size: 11.5px; line-height: 1.35; overflow-wrap: anywhere; }
.chain-step.is-now .chain-what { color: var(--text-soft); }
.approval-v2 .approval-field { display: block; box-sizing: border-box; width: calc(100% - 36px); margin-top: 12px; }
.approval-v2 .approval-actions { margin-top: 10px; }
.approval-v2 .approval-demo { margin-top: 8px; margin-bottom: 14px; }
.approval-v2 .approval-result, .approval-v2 .approval-nothing { margin-bottom: 14px; }
.approval-v2.approved { box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .chain-step.is-now .chain-node { animation: chain-pulse 1.6s ease-in-out infinite; }
}
@keyframes chain-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--part-guard) 10%, transparent); } }
@media (max-width: 600px) {
  .approval-chain { display: grid; gap: 10px; }
  .chain-step { grid-template-columns: 28px auto; justify-items: start; text-align: left; column-gap: 10px; }
  .chain-step + .chain-step::before { display: none; }
  .chain-what { grid-column: 2; }
}
/* What the approver approves, always open (your request): the message, then its terms. */
.approval-message { margin-top: 16px; }
.approval-section { margin: 14px 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.approval-mail { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.approval-mail-subject { margin: 0; padding: 10px 14px 0; font-size: 15px; font-weight: 650; }
.approval-mail-meta { display: grid; gap: 2px; padding: 4px 14px 10px; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 12.5px; }
/* One grid for every header line, so the values line up ("Payment Days45" ran together). */
.approval-mail-meta { grid-template-columns: max-content 1fr; column-gap: 14px; }
.approval-mail-line { display: contents; }
.approval-mail-key { color: var(--muted); text-transform: capitalize; }
.approval-mail-body { max-height: 320px; overflow: auto; padding: 10px 14px 4px; font-size: 14px; line-height: 1.6; }
.approval-mail-body p { margin: 0 0 10px; white-space: pre-line; }
.approval-mail-body ul, .approval-mail-body ol { margin: 0 0 10px; padding-left: 20px; }
.approval-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.approval-table th { padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: left; }
.approval-table td { padding: 7px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); text-transform: none; }
.approval-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.approval-table tr.is-mine td { background: color-mix(in srgb, var(--part-guard) 9%, var(--surface)); font-weight: 650; }
.approval-table tr.is-mine td:first-child { box-shadow: inset 3px 0 0 var(--part-guard); }
/* Where each term started (D-141): its reference, today's value, the ask, and the move. */
.approval-term-name { display: block; text-transform: capitalize; }
.approval-ref { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.approval-was { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.approval-change { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.approval-change.is-up { background: color-mix(in srgb, var(--part-guard) 18%, var(--surface)); color: var(--part-guard); }
.approval-change.is-down { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent); }
.approval-change.is-same { background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--muted); }
@media (max-width: 600px) { .approval-table { font-size: 12.5px; } .approval-table th, .approval-table td { padding: 6px; } }
/* Acting As (S12 Part B): the person answering approvals. */
.people { margin: 4px 0 14px; }
.people-list { display: grid; gap: 6px; margin-top: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--text) 3%, var(--surface)); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.person:hover { background: color-mix(in srgb, var(--text) 6%, var(--surface)); }
.person.is-me { border-color: color-mix(in srgb, var(--part-guard) 50%, var(--line)); background: color-mix(in srgb, var(--part-guard) 8%, var(--surface)); }
.person-avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: color-mix(in srgb, var(--text) 10%, var(--surface)); font-weight: 700; font-size: 13px; }
.person.is-me .person-avatar { background: var(--part-guard); color: var(--surface); }
.person-text { display: grid; min-width: 0; line-height: 1.25; }
.person-text strong { font-size: 13.5px; }
.person-text span { color: var(--muted); font-size: 11.5px; }
.person:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The hand-off on a card you can't answer: who you are, and who to switch to. */
.approval-handoff { margin-top: 14px; padding: 12px 14px; border: 1px dashed color-mix(in srgb, var(--part-guard) 55%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--part-guard) 5%, var(--surface)); }
.approval-handoff[hidden] { display: none; }
.handoff-text { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; }
.handoff-switch { margin-right: 8px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--part-guard); color: var(--surface); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.handoff-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.approval-actions[hidden], .approval-v2 .approval-field[hidden] { display: none; }
/* A check card while it runs: a small spinner, no names yet (D-147). */
.check-spin { display: none; }
.check-card.is-checking .check-spin { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid color-mix(in srgb, var(--part-verify) 30%, transparent); border-top-color: var(--part-verify); border-radius: 50%; vertical-align: -1px; }
@media (prefers-reduced-motion: no-preference) { .check-card.is-checking .check-spin { animation: check-spin 0.8s linear infinite; } }
@keyframes check-spin { to { transform: rotate(360deg); } }

/* Online Evals (D-148): the card under an answer, the pane part, the page. */
.pane-part.part-online { --part: var(--part-online); }
.quality-card { margin: 14px 0 6px; border-color: color-mix(in srgb, var(--part-online) 40%, var(--line)); background: color-mix(in srgb, var(--part-online) 4%, var(--surface)); }
.quality-card .card-title { color: var(--part-online); }
.quality-card > summary { cursor: pointer; list-style: none; align-items: center; margin-bottom: 0; }
.quality-card > summary::-webkit-details-marker { display: none; }
.quality-card > summary .card-count { margin-left: auto; }
.quality-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.quality-card[open] > summary { margin-bottom: 6px; }
.quality-card.is-passed .card-count { color: var(--pass); }
.quality-card.is-mixed .card-count { color: var(--skip); }
.quality-card.is-checking .check-spin { border-color: color-mix(in srgb, var(--part-online) 30%, transparent); border-top-color: var(--part-online); }
.quality-item { grid-template-columns: 1.2em 1fr 3em 7.6em; column-gap: 8px; align-items: baseline; }
.quality-item .q-score { text-align: right; }
.quality-item .grade-chip { justify-self: start; }
.quality-item .todo-note { grid-column: 2 / -1; }
.quality-item.is-failed .todo-box, .quality-item.is-failed .todo-text { color: var(--skip); }
.quality-item.is-not_scored .todo-box, .quality-item.is-not_scored .todo-text { color: var(--muted); }
.quality-foot .todo-note { grid-column: 2; font-size: 11.5px; }
.q-score { font-variant-numeric: tabular-nums; color: var(--text-soft); }
.grade-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); color: var(--text-soft); }
.grade-chip.grade-judge { border-color: color-mix(in srgb, var(--part-online) 45%, var(--line)); color: var(--part-online); background: color-mix(in srgb, var(--part-online) 7%, var(--surface)); }
.grade-chip.grade-code { border-color: color-mix(in srgb, var(--part-verify) 45%, var(--line)); color: var(--part-verify); background: color-mix(in srgb, var(--part-verify) 7%, var(--surface)); }
.metric-by { white-space: nowrap; }
.view-online .page-header { display: block; }
.online-summary { margin-bottom: 8px; }
/* The judge's switch (D-167): a clear yes before any paid call. */
.judge-switch { margin: 14px 0 4px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-width: 62ch; }
.judge-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.judge-state { margin-left: auto; color: var(--muted); font-size: 13px; }
.judge-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.q-rate.pass { color: var(--pass); }
.q-rate.fail { color: var(--skip); }
.online-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.online-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.online-table th, .online-table td { padding: 9px 12px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
.online-table thead th { border-top: 0; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.online-ask { max-width: 320px; }
.online-open { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-align: left; cursor: pointer; }
.online-open:hover { text-decoration: underline; }
.online-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.online-when { color: var(--muted); }
.q-pill { display: inline-block; min-width: 38px; padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; font-size: 12px; text-align: center; background: color-mix(in srgb, var(--text) 6%, var(--surface)); color: var(--muted); }
.q-pill.is-passed { background: color-mix(in srgb, var(--pass) 14%, var(--surface)); color: var(--pass); }
.q-pill.is-failed { background: color-mix(in srgb, var(--skip) 16%, var(--surface)); color: var(--skip); }

/* Each metric's threshold, in the metrics tables. */
.metric-at { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.metric-on { width: 1%; }
.metric-reported { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
/* Online Evals: use the width, and show every metric without a sideways scroll. */
main:has(> #view-online:not([hidden])) { max-width: 1400px; }
.online-scroll { overflow-x: visible; }
.online-table { table-layout: fixed; }
.online-table th, .online-table td { white-space: normal; vertical-align: middle; }
.online-table thead th { line-height: 1.3; }
.online-table thead th:first-child { width: 34%; }
.online-table thead th:last-child { width: 12%; }
.online-ask, .online-open { max-width: none; }
.online-open { overflow: visible; text-overflow: clip; white-space: normal; line-height: 1.35; }
@media (max-width: 900px) { .online-scroll { overflow-x: auto; } .online-table { table-layout: auto; min-width: 760px; } }
.ref-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); }
.ref-chip.ref-based { color: var(--part-guard); border-color: color-mix(in srgb, var(--part-guard) 45%, var(--line)); background: color-mix(in srgb, var(--part-guard) 8%, var(--surface)); }
.ref-chip.ref-free { color: var(--muted); }
.case-score { font-variant-numeric: tabular-nums; color: var(--text-soft); font-size: 12.5px; white-space: nowrap; }

/* Next Run cards, compact (your request): same content, less height. */
.evals-next { margin-top: 12px; padding-top: 12px; }
.cost-cards { gap: 10px; }
.cost-card { gap: 2px; padding: 10px 14px; border-radius: 13px; }
.cost-card .model-pick { margin-block: -2px; }
.cost-does { margin: 0; font-size: 12.5px; }
.cost-big { margin: 2px 0 0; }
.cost-num { font-size: 24px; }
.cost-card.total .cost-num { font-size: 28px; }
.cost-list, .cost-work, .cost-meter-text, .cost-range { font-size: 12px; line-height: 1.35; }
.cost-meter { height: 4px; margin-top: 4px; }
.cost-split { height: 7px; margin-top: 6px; }

/* The eval's model pickers read as controls (your note): a bordered button, not plain text. */
.cost-card .model-pick.evals-pick { margin: 2px 0 0; padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 9px; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); cursor: pointer; }
.cost-card .model-pick.evals-pick:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.cost-card .model-pick.evals-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Guided Tour (S13, D-168–D-178) ──────────────────────────────────────────
   /?tour: the chat replays a recorded run and a guide presents it, in the composer's place.
   Nothing here can send: no composer, no new chat, no deletes. Every pane and the
   Observability views stay; the tour just doesn't cover them (your call). */
.tour-mode #composer,
.tour-mode .examples,
.tour-mode #new-task,
.tour-mode .work-delete { display: none; }
.tour-mode .work-open { pointer-events: none; }
/* The guide is taller than the composer: keep the newest line above it when it scrolls in. */
html:has(body.tour-mode) { scroll-padding-bottom: 200px; }

/* The way in: a glowing invitation in the sidebar, a pointer tapping at it. */
.tour-invite {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 4px 0 18px;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 65%, transparent);
  border-radius: 14px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface) 70%);
  color: var(--text);
  font: 600 13.5px ui-sans-serif, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.tour-invite[hidden], .tour-mode .tour-invite { display: none; }
/* Public tour mode (S14, D-189): nothing here can run, record or change, so it isn't offered. */
.public-mode:not(.owner-mode) .views.side-group, .public-mode #tour-rec-box { display: none; }
/* A hosted copy starts marked (D-202): the chat screen stays hidden until the page knows
   whether it's the tour or the owner's session, so it never flashes before the tour. */
.hosted-boot:not(.tour-mode):not(.owner-mode) :is(#empty-state, #composer, #tour-invite, #thread) {
  visibility: hidden;
  /* A safety net with no script at all: if the page never learns its mode, show it anyway. */
  animation: hosted-reveal 0s linear 4s forwards;
}
@keyframes hosted-reveal { to { visibility: visible; } }
/* Owner on a hosted copy: Memory and Observability (D-196), forgetting a fact (D-211), and
   running offline evals on Claude (D-213) are all the owner's. */
/* The hosted welcome after Exit (D-206): a question, one line, and a clear way in. */
.empty.welcome :is(#empty-hint) { max-width: 60ch; margin-inline: auto; }
.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: 700 16px ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.welcome-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 45%, transparent); }
.welcome-cta:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 4px; }
.welcome-play { font-size: 13px; }
.welcome-aside { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .welcome-cta { transition: none; } }
/* A visitor outside the tour (after Exit, D-204): no composer or examples, just the way back in. */
.public-mode:not(.owner-mode) :is(#composer, #examples) { display: none; }
/* The words of the subtitle light up as the voice says them (D-204). */
.guide-caption .word { color: color-mix(in srgb, var(--text) 45%, transparent); transition: color 0.18s ease; }
.guide-caption .word.said { color: var(--text); }
.guide-caption .word.now { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .guide-caption .word { transition: none; } }
/* The hosted copy's note: quiet, one line of context and a way to the code (your review). */
.public-note {
  margin: 2px 0 16px;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 12px/1.55 ui-sans-serif, system-ui, sans-serif;
}
.public-text { display: block; }
.public-note a.public-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.public-note a.public-code:hover { border-color: var(--accent); color: var(--accent); }
.public-note a.public-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.github-mark { width: 14px; height: 14px; flex: none; }
/* A tour, or a visitor to the hosted copy, sees each switch as it is but can't change it. */
:is(.tour-mode, .public-mode:not(.owner-mode)) .switch-wrap,
:is(.tour-mode, .public-mode:not(.owner-mode)) .switch { cursor: default; }
.public-note[hidden] { display: none; }
/* The tour picks the profile, person and chat: shown, greyed out, not clickable (inert in app.js). */
/* A tour visitor doesn't need profiles, people or chats at all (your review, D-204). */
.public-mode:not(.owner-mode) :is(#profiles, #people, #work) { display: none; }
.owner-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.owner-form input { flex: 1 1 140px; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.owner-form button, .owner-lock { padding: 7px 12px; border: 1px solid var(--accent); border-radius: 10px; background: transparent; color: var(--accent); font: 600 13px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.owner-error { flex-basis: 100%; margin: 0; color: var(--fail); }
.public-note a:not(.public-code) { color: var(--accent); font-weight: 600; }
.tour-invite:hover { border-color: var(--accent); transform: translateY(-1px); }
.tour-invite:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tour-invite-pointer { flex: none; width: 22px; height: 22px; color: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
@media (prefers-reduced-motion: no-preference) {
  .tour-invite { animation: invite-glow 2.6s ease-out infinite; }
  .tour-invite-pointer { animation: invite-tap 1.3s ease-in-out infinite; }
  @keyframes invite-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent, 0 0 22px color-mix(in srgb, var(--accent) 22%, transparent); } }
  @keyframes invite-tap { 0%, 100% { transform: translate(0, 0) rotate(-12deg); } 45% { transform: translate(3px, -3px) rotate(-12deg) scale(0.92); } }
}

/* ── The guide (D-178, D-179): a voice orb and film-style subtitles, no box ─────────── */
.tour-guide { position: relative; z-index: 60; display: flex; align-items: center; gap: 24px; padding: 0 4px; }
/* The guide sits in a translucent cyan capsule (your review, D-206): a soft glass panel that
   folds into a small orb capsule and opens back out, animated. */
.tour-mode .tour-guide {
  max-width: 100%;
  padding: 12px 22px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 28px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 6%, transparent) inset, 0 10px 34px color-mix(in srgb, var(--accent) 12%, transparent);
  transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1), padding 0.45s ease, border-radius 0.45s ease, gap 0.45s ease;
}
.tour-mode .guide-talk {
  max-width: 2000px;
  max-height: 320px;
  overflow: hidden;
  transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1), max-height 0.45s ease, opacity 0.3s ease 0.12s, translate 0.45s ease;
}
.tour-mode .tour-show { white-space: nowrap; }
.tour-mode .guide-orb { transition: width 0.45s ease, height 0.45s ease, margin 0.45s ease; }
.tour-guide[hidden] { display: none; }
/* The orb's glow fills its box, so the gap above is real breathing room, not overlap. */
.guide-orb { flex: none; width: 72px; height: 72px; margin: -6px 0 -6px -8px; color: var(--accent); }
.guide-talk { flex: 1; min-width: 0; }
.guide-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 3px;
  font: 500 10.5px/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.guide-sep { opacity: 0.4; }
#tour-title { color: var(--muted); }
.guide-caption {
  margin: 0;
  min-height: 1.5em;
  /* Always two lines tall, so the guide capsule never resizes (D-208); captionCards() keeps
     every card within two lines at the current width. */
  height: 3em;
  overflow: hidden;
  font-size: 14px; /* your review: 15 → 13 → 14 (D-204, D-206) */
  font-weight: 450;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text);
  text-wrap: pretty; /* fill the line: the width beside the orb is there to be used (your review) */
  text-shadow: 0 2px 18px light-dark(rgb(255 255 255 / 0.9), rgb(0 0 0 / 0.9));
}
.tour-recording .guide-caption { height: auto; font-size: 18px; line-height: 1.6; max-height: 14em; overflow-y: auto; text-wrap: pretty; } /* your script: read it out */
.guide-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.tour-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.tour-icon svg { width: 13px; height: 13px; }
.tour-icon:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.tour-icon[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
/* Mute shows its state: a speaker with waves, or crossed out in red with no glow (your review). */
#tour-mute .sound-off { display: none; }
#tour-mute[aria-pressed="true"] { border-color: color-mix(in srgb, var(--fail) 55%, var(--line)); color: var(--fail); box-shadow: none; }
#tour-mute[aria-pressed="true"] .sound-on { display: none; }
#tour-mute[aria-pressed="true"] .sound-off { display: inline; }
.tour-icon:disabled { opacity: 0.35; cursor: default; }
.tour-main, .tour-pill {
  padding: 4px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font: 600 12px ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tour-main { min-width: 96px; background: var(--accent); color: var(--accent-text); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent); }
.tour-pill { background: transparent; color: var(--text); }
.tour-icon:focus-visible, .tour-main:focus-visible, .tour-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Only the chapter title shows; "04 of 10" read as vague (your review, D-206). The timeline
   on the right still shows where the tour is. */
#tour-count, .guide-step .guide-sep { display: none; }
.tour-countdown { min-width: 72px; font: 11px ui-monospace, "SF Mono", Menlo, monospace; color: var(--accent); font-variant-numeric: tabular-nums; }
.tour-timeline { display: flex; flex: 1; min-width: 120px; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tour-tick { flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: background 0.4s ease, box-shadow 0.4s ease; }
.tour-tick.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tour-tick.now { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.tour-exit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
  padding: 5px 12px 5px 10px;
  /* Clearly visible on the dark strip, like the round controls beside it (your review). */
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  font: 500 12px ui-monospace, "SF Mono", Menlo, monospace;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tour-exit svg { width: 12px; height: 12px; }
.tour-exit:hover { color: var(--accent); border-color: var(--accent); }
.tour-exit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tour-rec { display: inline-flex; align-items: center; gap: 8px; }
.tour-rec[hidden], .tour-card[hidden] { display: none; } /* display above would beat hidden */
.tour-record.is-on { border-color: var(--fail); background: var(--fail); color: var(--surface); }
.tour-rec-note { color: var(--muted); font-size: 12.5px; }
@media (prefers-reduced-motion: no-preference) {
  .guide-caption.enter { animation: caption-in 0.45s ease-out; }
  @keyframes caption-in { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }
}
@media (max-width: 600px) {
  .tour-guide { gap: 16px; }
  .guide-orb { width: 56px; height: 56px; }
  .guide-caption { font-size: 14px; }
}

/* The spotlight: everything dims except the line being explained (and the Harness pane). */
.tour-spot {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: 0 0 0 200vmax light-dark(rgb(245 247 246 / 0.72), rgb(1 4 4 / 0.62)), 0 0 0 1.5px var(--accent), 0 0 32px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1), top 0.5s cubic-bezier(0.22, 1, 0.36, 1), width 0.5s ease, height 0.5s ease;
}
.tour-spot.is-empty { box-shadow: 0 0 0 200vmax light-dark(rgb(245 247 246 / 0.82), rgb(1 4 4 / 0.86)); }
.tour-spot[hidden] { display: none; }
/* The guide's floor: the colour of the dimmed page, fading in at the top, so content scrolls
   behind the subtitles and never through them (your review). */
.tour-mode .dock {
  z-index: 55;
  padding-top: 34px;
  background: linear-gradient(to bottom, transparent, light-dark(#f5f7f6, #020505) 30px);
}
/* The guide tucked away (D-186): only the orb and Show Guide; the page gets the room back. */
.tour-guide.is-tucked { gap: 10px; }
.tour-guide.is-tucked .guide-talk { display: none; }
.tour-guide.is-tucked .guide-orb { width: 40px; height: 40px; margin: 0; }
/* In the tour the fold animates (D-206): the text fades and slides out while the capsule
   narrows to an orb pill; Show Guide plays it back. */
.tour-mode .tour-guide.is-tucked { max-width: 220px; padding: 6px 10px 6px 6px; border-radius: 999px; }
.tour-mode .tour-guide.is-tucked .guide-talk { display: block; max-width: 0; max-height: 0; opacity: 0; translate: -12px 0; transition: max-width 0.5s cubic-bezier(0.22, 1, 0.36, 1), max-height 0.35s ease, opacity 0.18s ease, translate 0.3s ease; }
@media (prefers-reduced-motion: reduce) {
  .tour-mode :is(.tour-guide, .guide-talk, .guide-orb) { transition: none; }
}
.tour-mode .dock:has(.tour-guide.is-tucked) { padding-top: 10px; }
.tour-show[hidden] { display: none; }
/* Every approval card fits on screen in the tour (your review): the email's subject stays;
   its body and header lines were shown in full one step before (the draft), the terms table
   carries what matters, and nobody types a note into a replay. */
.tour-mode :is(.approval-mail-body, .approval-mail-meta, .approval-field) { display: none; }
/* Room below the newest line, so the tour can scroll it up to the middle of the screen. */
.tour-mode .thread { padding-bottom: 50vh; }
/* Both side panels stay bright (your review): the spotlight dims the chat column only. */
.tour-mode #harness-pane, .tour-mode #sidebar { z-index: 50; }
/* With the pane hidden, its show button must stay above the dim too, or it can't be found. */
.tour-mode .pane-toggle { z-index: 50; }
/* Before the tour's run starts, the Harness pane and its toggle stay out of sight (D-206). */
.tour-prerun :is(.pane-toggle, .lane-right) { display: none; }
.harness-pane:not([hidden]) { animation: pane-in 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pane-in { from { opacity: 0; translate: 24px 0; } }
@media (prefers-reduced-motion: reduce) { .harness-pane:not([hidden]) { animation: none; } }
.tour-mode .lane-handle { z-index: 50; }

/* A new step: its name flashes in the label line, never over the content (your review). */
@media (prefers-reduced-motion: no-preference) {
  .guide-step.flash #tour-title { animation: step-flash 2.2s ease-out; }
  @keyframes step-flash {
    0% { color: var(--accent); text-shadow: 0 0 14px var(--accent); letter-spacing: 0.3em; }
    60% { color: var(--accent); text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent); letter-spacing: 0.14em; }
  }
}

/* The living diagram (D-179): the model alone in a jar, then the harness around it. Exists
   only in tour mode (SVG ignores the hidden attribute). */
.tour-stage { display: none; }
.tour-mode .tour-stage {
  display: block;
  position: fixed;
  z-index: 45;
  height: auto;
  overflow: visible;
  pointer-events: none;
  transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1), top 0.9s cubic-bezier(0.22, 1, 0.36, 1), width 0.9s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.tour-mode .tour-stage.is-away { opacity: 0; }
.tour-stage text { font: 600 15px ui-sans-serif, system-ui, sans-serif; fill: var(--text); text-anchor: middle; }
.stage-core path { fill: none; stroke: #00211c; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.stage-core text { font: 600 13px ui-monospace, "SF Mono", Menlo, monospace; fill: var(--accent); letter-spacing: 0.12em; }
.stage-core { transform-origin: 200px 200px; animation: core-breathe 3.2s ease-in-out infinite; }
@keyframes core-breathe { 50% { transform: scale(1.05); } }
.stage-jar rect, .stage-jar path { fill: color-mix(in srgb, var(--accent) 6%, transparent); stroke: color-mix(in srgb, var(--accent) 55%, var(--muted)); stroke-width: 2; }
.stage-jar { transition: opacity 0.8s ease, transform 1s cubic-bezier(0.22, 1, 0.36, 1); transform-origin: 200px 200px; }
.stage-orbit { fill: none; stroke: color-mix(in srgb, var(--accent) 40%, transparent); stroke-width: 1.5; stroke-dasharray: 4 7; transform-origin: 200px 200px; animation: orbit 40s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.stage-spoke { stroke: color-mix(in srgb, var(--accent) 35%, transparent); stroke-width: 1.5; }
.stage-node circle { fill: var(--surface); stroke: var(--node); stroke-width: 2; transition: fill 0.3s ease; }
.stage-node path { fill: none; stroke: var(--node); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stage-node text { font-size: 14px; }
.node-loop { --node: var(--part-loop); }
.node-context { --node: var(--part-context); }
.node-tools { --node: var(--part-actions); }
.node-guard { --node: var(--part-guard); }
.stage-node { transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); transform-box: fill-box; transform-origin: center; }
.stage-node.fire circle { animation: node-fire 0.9s ease-out; }
@keyframes node-fire { 0% { fill: var(--node); filter: drop-shadow(0 0 14px var(--node)); } 100% { fill: var(--surface); } }
/* Named by the voice: the part swells and settles (D-184). */
.stage-node.pop { animation: node-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes node-pop { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .stage-node.pop, .tour-stage[data-scene="build"] .stage-node.pop { animation: none; } }
.stage-pulse { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
.pulse-loop { fill: var(--part-loop); }
.pulse-context { fill: var(--part-context); }
.pulse-tools { fill: var(--part-actions); }
.pulse-guard { fill: var(--part-guard); }
.stage-harness .stage-orbit, .stage-harness .stage-spoke { transition: opacity 0.8s ease; }
.stage-equation { font: 700 20px ui-sans-serif, system-ui, sans-serif !important; fill: var(--accent) !important; letter-spacing: -0.01em; transition: opacity 0.8s ease 0.6s; }

/* Scenes. The jar: the model alone. */
.tour-stage[data-scene="jar"] .stage-node,
.tour-stage[data-scene="jar"] .stage-orbit,
.tour-stage[data-scene="jar"] .stage-spoke,
.tour-stage[data-scene="jar"] .stage-equation { opacity: 0; }
.tour-stage[data-scene="jar"] .stage-node { transform: scale(0.3); }
/* The harness and the finale: the jar lifts away, the four parts snap in, one by one. */
.tour-stage:not([data-scene="jar"]) .stage-jar { opacity: 0; transform: translateY(-60px) scale(1.15); }
.tour-stage:not([data-scene="jar"]) .node-loop { transition-delay: 0.2s; }
.tour-stage:not([data-scene="jar"]) .node-tools { transition-delay: 0.45s; }
.tour-stage:not([data-scene="jar"]) .node-guard { transition-delay: 0.7s; }
.tour-stage:not([data-scene="jar"]) .node-context { transition-delay: 0.95s; }
/* The build: the model alone; each part (and its spoke) springs in as the voice names it (D-185). */
/* ── The model alone, in beats (D-191): think → reach → seal → tell → bounce ─────────────── */
.stage-story > *, .stage-chips { opacity: 0; transition: opacity 0.6s ease, transform 0.6s ease; }
.stage-story > .story-burst { transition: none; }
.tour-stage:not([data-scene="jar"]) :is(.stage-story, .stage-chips) { opacity: 0; visibility: hidden; }
/* A step with a story starts with the model alone: the jar waits above until "seal". */
.tour-stage.has-story[data-scene="jar"]:not(.beat-seal) .stage-jar { opacity: 0; transform: translateY(-150px) scale(0.96); }
.tour-stage.has-story.beat-seal .stage-jar { transition: opacity 0.35s ease, transform 0.9s cubic-bezier(0.34, 1.45, 0.64, 1); }
.tour-stage.has-story.beat-seal .stage-jar path { animation: glass-flash 1.1s ease-out 0.55s; }
@keyframes glass-flash { 30% { stroke: var(--accent); stroke-width: 4; filter: drop-shadow(0 0 10px var(--accent)); } }

/* The agenda (D-191): a roadmap that owns the stage; the model only arrives at "think". */
.tour-stage.has-story[data-scene="jar"]:not(.beat-think) .stage-chips { opacity: 1; }
.tour-stage.has-story[data-scene="jar"]:not(.beat-think) .stage-core { opacity: 0; }
.tour-stage.has-story .stage-core { transition: opacity 0.7s ease 0.15s; }
.stage-chip .chip-rail { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 4px var(--accent)); }
.stage-chip.on .chip-rail { animation: rail-draw 0.7s ease-out forwards; }
@keyframes rail-draw { to { stroke-dashoffset: 0; } }
.stage-chip .chip-node { fill: var(--surface); stroke: color-mix(in srgb, var(--accent) 30%, var(--line)); stroke-width: 2; transition: fill 0.5s ease, stroke 0.5s ease; }
.stage-chip.on .chip-node { fill: url(#stage-core); stroke: var(--accent); filter: drop-shadow(0 0 12px var(--accent)); }
.stage-chip .chip-ripple { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.stage-chip.now .chip-ripple { animation: chip-ripple 1.4s ease-out 0.5s; }
@keyframes chip-ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.6); } }
.tour-stage .stage-chip .chip-num { font: 700 17px ui-monospace, "SF Mono", Menlo, monospace; fill: color-mix(in srgb, var(--accent) 45%, var(--muted)); text-anchor: middle; }
.tour-stage .stage-chip.on .chip-num { fill: #00211c; }
.tour-stage .stage-chip .chip-text { font: 700 17px ui-sans-serif, system-ui, sans-serif; text-anchor: start; fill: var(--muted); opacity: 0.18; transform: translateX(-10px); transition: opacity 0.6s ease 0.35s, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.35s, fill 0.4s ease; }
.tour-stage .stage-chip.on .chip-text { opacity: 0.7; transform: none; fill: var(--text); }
.tour-stage .stage-chip.now .chip-text { opacity: 1; fill: var(--accent); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }

/* The model arrives: a burst ring as the roadmap gives way. */
.story-burst { fill: none; stroke: var(--accent); stroke-width: 3; transform-box: fill-box; transform-origin: center; opacity: 0; }
.beat-think .story-burst { animation: model-burst 1.2s ease-out 0.15s; }
@keyframes model-burst { 0% { opacity: 1; transform: scale(0.5); } 100% { opacity: 0; transform: scale(2.4); } }

/* think: the model arrives with its two powers, feeding it. */
/* What it's good at: three skills light up in turn and feed the model. */
.story-skill rect { fill: color-mix(in srgb, var(--accent) 14%, var(--surface)); stroke: var(--accent); stroke-width: 1.4; }
.story-skill .skill-icon { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tour-stage .story-skill text { font: 700 12px ui-sans-serif, system-ui, sans-serif; text-anchor: start; fill: var(--text); }
.tour-stage .story-heading { font: 700 9px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.18em; fill: var(--accent); opacity: 0; }
.beat-think .story-heading { animation: skill-in 0.6s ease-out forwards; }
.story-skill rect { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.skill-link { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 2 5; }
.story-skill, .skill-link { opacity: 0; transform: translateX(-8px); }
.beat-think .story-skills { opacity: 1; }
.beat-think :is(.story-skill, .skill-link) { animation: skill-in 0.6s ease-out forwards; }
.beat-think :is(.story-skill, .skill-link):nth-of-type(2) { animation-delay: 0.6s; }
.beat-think .skill-link { animation-name: skill-in, link-flow; animation-duration: 0.6s, 1.2s; animation-timing-function: ease-out, linear; animation-iteration-count: 1, infinite; }
@keyframes skill-in { to { opacity: 1; transform: none; } }
@keyframes link-flow { to { stroke-dashoffset: -14; } }

/* reach: the world it would act on appears, greyed; its reach stops short. */
.story-action circle { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.tour-stage .story-action text { font: 600 10.5px ui-sans-serif, system-ui, sans-serif; fill: var(--muted); }
.story-action path { fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.story-reach { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 5; stroke-dashoffset: 60; }
.beat-reach .story-actions { opacity: 0.85; }
.beat-reach .story-reach { animation: reach-out 1.1s ease-out forwards; }
@keyframes reach-out { from { stroke-dashoffset: 60; opacity: 0; } to { stroke-dashoffset: 0; opacity: 1; } }
/* Each reach breaks: a red ✗ on every line, one after the other. */
.tour-stage .story-miss { fill: var(--fail); font: 700 18px ui-sans-serif, system-ui, sans-serif; opacity: 0; }
.beat-reach .story-miss { animation: miss-in 0.35s ease-out 1.1s forwards; }
.beat-reach .story-miss:nth-of-type(2) { animation-delay: 1.4s; }
.beat-reach .story-miss:nth-of-type(3) { animation-delay: 1.7s; }
.beat-reach .story-reach { stroke: color-mix(in srgb, var(--fail) 55%, var(--muted)); }
/* Sealed: the glass is the boundary now. Nothing crosses it; the targets wait outside. */
.beat-seal :is(.story-reach, .story-miss, .skill-link) { visibility: hidden; }

/* tell: it can say how, from inside the jar. */
.story-bubble :is(rect, path) { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke: var(--accent); stroke-width: 1.4; stroke-linejoin: round; }
.story-bubble rect { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)); }
.tour-stage .story-bubble text { font: 600 12px ui-sans-serif, system-ui, sans-serif; fill: var(--text); }
.story-bubble { transform: translateY(10px); }
.beat-tell .story-bubble { opacity: 1; transform: none; }

/* bounce: it tries to send; the glass stops it. */
.story-bounce .bounce-dot { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }
.story-bounce .bounce-ripple { fill: none; stroke: var(--fail); stroke-width: 2; transform-box: fill-box; transform-origin: center; opacity: 0; }
.beat-bounce .story-bounce { opacity: 1; }
.beat-bounce .bounce-dot { animation: send-bounce 1.6s cubic-bezier(0.5, 0, 0.3, 1) forwards; }
.beat-bounce .bounce-ripple { animation: glass-ripple 0.9s ease-out 0.55s forwards; }
.beat-bounce .act-mail circle { animation: mail-shake 0.5s ease-in-out 0.7s; }
@keyframes send-bounce {
  0% { transform: translate(200px, 200px); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translate(258px, 171px); }
  60% { transform: translate(236px, 182px); }
  100% { transform: translate(214px, 194px); opacity: 0; }
}
@keyframes glass-ripple { 0% { opacity: 1; transform: scale(0.4); } 100% { opacity: 0; transform: scale(2.2); } }
@keyframes miss-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mail-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
  .stage-chip.on .chip-rail, .stage-chip.now .chip-ripple, .beat-think .story-burst,
  .beat-think :is(.story-skill, .skill-link, .story-heading), .beat-reach .story-reach, .beat-reach .story-miss,
  .beat-bounce .bounce-dot, .beat-bounce .bounce-ripple, .beat-bounce .act-mail circle,
  .tour-stage.has-story.beat-seal .stage-jar path { animation: none; }
  .beat-think :is(.story-skill, .skill-link, .story-heading) { opacity: 1; transform: none; }
  .beat-reach .story-reach { stroke-dashoffset: 0; }
  .beat-reach .story-miss { opacity: 1; }
  .stage-chip.on .chip-rail { stroke-dashoffset: 0; }
}

.tour-stage[data-scene="build"] :is(.stage-node, .stage-spoke):not(.on),
.tour-stage[data-scene="build"] .stage-equation { opacity: 0; }
.tour-stage[data-scene="build"] .stage-node { transition-delay: 0s; }
.tour-stage[data-scene="build"] .stage-node:not(.on) { transform: scale(0.3); }
.tour-stage[data-scene="build"] .stage-node.pop { animation: node-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes node-in { 0% { transform: scale(0.3); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
/* The live diagram: small, no equation, no labels to read. */
.tour-stage[data-scene="hud"] .stage-equation, .tour-stage[data-scene="hud"] .stage-node text, .tour-stage[data-scene="hud"] .stage-core text { opacity: 0; }
.tour-stage[data-scene="hud"] .stage-node, .tour-stage[data-scene="hud"] .stage-node text { transition-delay: 0s; }
/* The finale: every part lit. */
.tour-stage[data-scene="finale"] .stage-node circle { fill: color-mix(in srgb, var(--node) 22%, var(--surface)); filter: drop-shadow(0 0 10px var(--node)); }
@media (prefers-reduced-motion: reduce) {
  .stage-core, .stage-orbit { animation: none; }
  .tour-stage, .stage-node, .stage-jar { transition: none; }
}

/* A step's card over the empty chat: the use case, seen while you hear it. */
.tour-card {
  margin-top: 6vh;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 6px 28px light-dark(rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.3));
}
.tour-card h3 { margin: 0 0 10px; font-size: 16px; }
.tour-card-text p { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.tour-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tour-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
.tour-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tour-table tr:last-child td { border-bottom: 0; }
@media (max-width: 600px) {
  .tour-card { padding: 14px 12px; overflow-x: auto; }
  .tour-table { font-size: 12.5px; }
}

/* The whole harness (steps 2 and 10): the pane as it always looks, with one cyan edge. */

/* ── Phones (D-214) ──────────────────────────────────────────────────────────
   Your review: "mobile users are our primary audience". A visitor on a phone gets a slim
   top bar instead of the stacked sidebar, a compact guide, the story graphic in the room
   between the two (tour.js phoneStage), and nothing wider than the screen. */
@media (max-width: 720px) {
  html, body { overflow-x: clip; }
  /* The page's column never grows past the screen for a wide line (an outbox path, an
     approval row): it shrinks, and long words wrap. */
  main { min-width: 0; }
  .thread { min-width: 0; overflow-wrap: anywhere; }
  /* The Harness pane needs a wide screen; on a phone its button only covers the top bar. */
  .public-mode:not(.owner-mode) .pane-toggle { display: none; }
  .welcome-aside { display: none; } /* "the Harness pane on the right": not on a phone */
  .public-mode:not(.owner-mode) .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    overflow: visible;
    border-bottom: 1px solid var(--line);
  }
  .public-mode:not(.owner-mode) .sidebar > :not(.org, .public-note, .sidebar-foot) { display: none; }
  .public-mode:not(.owner-mode) .org { flex: 1; min-width: 0; gap: 10px; margin: 0; }
  .public-mode:not(.owner-mode) .org-logo { width: 30px; height: 30px; border-radius: 8px; }
  .public-mode:not(.owner-mode) .org-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .public-mode:not(.owner-mode) .public-note { margin: 0; padding: 0; border: 0; }
  .public-mode:not(.owner-mode) .public-text { display: none; }
  .public-mode:not(.owner-mode) .public-note a.public-code { margin: 0; min-height: 32px; padding: 4px 12px 4px 10px; font-size: 13px; }
  .public-mode:not(.owner-mode) .sidebar-foot { margin: 0; }
  .public-mode:not(.owner-mode) .sidebar-foot .version { display: none; }
  .tour-mode main { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  /* The guide: the orb moves into the title line, so the subtitles get the full width;
     the timeline runs above one row of 36 px controls, and Exit is an icon. */
  .tour-mode .tour-guide { padding: 10px 12px 12px; border-radius: 22px; }
  .tour-mode .tour-guide:not(.is-tucked) .guide-orb { position: absolute; top: 4px; left: 6px; width: 32px; height: 32px; margin: 0; }
  .tour-mode .tour-guide:not(.is-tucked) .guide-step { min-height: 22px; align-items: center; padding-left: 34px; }
  .guide-controls { gap: 6px; margin-top: 10px; }
  .tour-timeline { order: -1; flex: 0 0 100%; min-width: 0; margin-bottom: 4px; }
  .tour-icon { width: 36px; height: 36px; }
  .tour-icon svg { width: 15px; height: 15px; }
  .tour-main { flex: 1; min-width: 0; height: 36px; font-size: 13px; }
  .tour-exit { width: 36px; height: 36px; justify-content: center; gap: 0; margin-left: 0; padding: 0; font-size: 0; }
  .tour-exit svg { width: 14px; height: 14px; }
  .tour-countdown:empty { display: none; }
}
