/* ==========================================================================
   Adler — theme.css
   Dark Victorian: obsidian / velvet / gold / mist.
   Self-contained. No webfonts, no CDN, no network. Renders from disk.

   Contract: this file is the single source of truth for colour, type,
   rhythm and component shape across index.html, waitlist.html, admin.html.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   Brand hexes in the AP-§ tokens group are LOCKED (CONTEXT.md, PLAN.md).
   Everything else is a derived working value; contrast notes are measured
   ratios against --obsidian-0 unless stated.
   -------------------------------------------------------------------------- */
:root {
  /* --- AP-§ locked brand tokens --- */
  --obsidian: #0a0a0c;   /* page background */
  --velvet:   #8b1528;   /* accent, danger, the Irene motif */
  --gold:     #d4af37;   /* primary action, illumination (9.9:1) */
  --mist:     #2a2b36;   /* card borders, subtle surfaces */

  /* --- derived surfaces (all near-black; never a grey slab) --- */
  --obsidian-0: var(--obsidian);
  --obsidian-1: #0e0e11;   /* rail / raised row */
  --obsidian-2: #121216;   /* card */
  --obsidian-3: #17171d;   /* input well, hovered card */
  --obsidian-4: #1d1d24;   /* pressed / code block */

  /* --- derived ink --- */
  --parchment: #eee9dd;    /* 15.4:1 primary text  */
  --ink-2:     #c6c0b2;    /* 10.3:1 body locks    */
  --ink-3:     #9a958a;    /*  6.6:1 secondary, captions, labels */
  --ink-4:     #6f6a61;    /*  3.6:1 placeholder / disabled only — never body copy */
  --ink-cap:   #8f8a80;    /*  5.76:1 on --obsidian-0, 5.44:1 on --obsidian-2.
                              Small-caps metadata: the one ink that may carry TEXT
                              under 4.5:1-review. Derived from --ink-4 but lightened
                              deliberately — body-adjacent copy, not placeholder. */

  /* --- derived lines --- */
  --line:      var(--mist);        /* 1px card + rail border */
  --line-soft: #1c1c23;            /* internal rules */
  --gold-line: rgba(212, 175, 55, 0.34);
  --gold-dim:  #b8942f;            /*  6.9:1 — gold text that must be smaller text */
  --gold-wash: rgba(212, 175, 55, 0.07);
  --velvet-text:  #e0919b;         /*  8.4:1 — velvet that must be legitimately readable */
  --velvet-deep:  #6d0f1e;
  --velvet-wash:  rgba(139, 21, 40, 0.12);

  --danger: #e0919b;
  --ok:     #7fbf8f;
  --ok-dim: #4f8a5f;

  /* --- type ---
     No network fetch is permitted, so the display face is a locally-present
     Didone/transitional serif rather than a downloaded Cinzel. Bodoni MT is a
     true high-contrast Victorian display face and is present on this machine;
     Georgia is the universal fallback. Body copy is a serif (readable long-form),
     UI labels are the sans stack, code is monospace. */
  --font-display: "Bodoni MT", "Bodoni 72", "Didot", "Playfair Display", "Georgia", "Times New Roman", serif;
  --font-serif:   "Georgia", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --font-sans:    "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "Cascadia Mono", "Cascadia Code", "JetBrains Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;

  /* --- rhythm --- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* --- measure: 68ch at 17px ≈ 640px. Long-form never runs wider. --- */
  --measure: 42rem;
  --rail-w: 216px;
  --radius: 3px;
  --radius-lg: 5px;

  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.6), 0 18px 40px -28px rgba(0, 0, 0, 0.9);
  --shadow-pop:  0 2px 0 rgba(0, 0, 0, 0.7), 0 32px 64px -28px rgba(0, 0, 0, 0.95);

  --ring: 0 0 0 2px var(--obsidian), 0 0 0 4px var(--gold);
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--obsidian);
  color: var(--ink-2);
  font: 16px/1.65 var(--font-serif);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Lamplight + tooth. Two very low-opacity layers: a warm pool behind the
   working column and a faint vertical-rule weave. No image files, no blur
   filters, no animation — costs nothing per frame. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 620px at 18% -8%, rgba(212, 175, 55, 0.055), transparent 62%),
    radial-gradient(900px 700px at 96% 108%, rgba(139, 21, 40, 0.085), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.0125) 0 1px, transparent 1px 88px);
}

img, svg { max-width: 100%; }
svg { display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--parchment);
  letter-spacing: 0.005em;
  line-height: 1.18;
  margin: 0 0 var(--s3);
  text-wrap: balance;
}
h1 { font-size: clamp(1.85rem, 1.2rem + 2.2vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 1.05rem + 1.1vw, 1.95rem); }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.04rem; }

p { margin: 0 0 var(--s4); }
p:last-child { margin-bottom: 0; }

a { color: var(--gold); text-decoration-color: var(--gold-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.875em; }
kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  background: var(--obsidian-3);
  color: var(--ink-2);
  padding: 1px 5px;
  font-size: 0.78em;
}

hr {
  border: 0;
  height: 1px;
  margin: var(--s6) 0;
  background: linear-gradient(90deg, transparent, var(--gold-line) 18%, var(--gold-line) 82%, transparent);
}

::selection { background: rgba(212, 175, 55, 0.28); color: #fff; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

.skip-link {
  position: absolute;
  left: var(--s3);
  top: -100px;
  z-index: 200;
  background: var(--gold);
  color: var(--obsidian);
  font: 600 0.86rem/1 var(--font-sans);
  padding: 12px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: var(--s3); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   3. LAYOUT
   -------------------------------------------------------------------------- */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100dvh;
}
.shell--solo { grid-template-columns: minmax(0, 1fr); }

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: var(--s5) var(--s4);
  background: linear-gradient(180deg, var(--obsidian-1), var(--obsidian-0));
  border-right: 1px solid var(--line);
}

.main { min-width: 0; display: flex; flex-direction: column; }

.column {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--s5);
}
.column--wide { max-width: 62rem; }

/* --------------------------------------------------------------------------
   4. BRAND: mark, cameo, ornaments
   -------------------------------------------------------------------------- */
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; }
.brand__mark { width: 42px; height: 42px; flex: none; color: var(--gold); }
.brand__word {
  font-family: var(--font-display);
  font-size: 1.42rem;
  line-height: 1;
  color: var(--parchment);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand__sub {
  display: block;
  font: 500 0.6rem/1 var(--font-sans);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-cap);
  margin-top: 7px;
}

.eyebrow {
  font: 600 0.68rem/1 var(--font-sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.eyebrow::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}

/* Skeleton-key rule — the section divider motif. */
.keyrule {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s6) 0;
  color: var(--gold-dim);
}
.keyrule::before, .keyrule::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line) 40%, var(--line));
}
.keyrule::after { background: linear-gradient(90deg, var(--line), var(--line) 60%, transparent); }
.keyrule svg { width: 26px; height: 26px; flex: none; opacity: 0.85; }

.cameo {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
}
.cameo::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.13), transparent 68%);
  pointer-events: none;
}
.cameo--lg { width: 176px; height: 176px; }

/* --------------------------------------------------------------------------
   5. CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 40px;
  padding: 9px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--obsidian-2);
  color: var(--parchment);
  font: 600 0.87rem/1.2 var(--font-sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--obsidian-3); border-color: #383947; }
.btn:active { background: var(--obsidian-4); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; }

.btn--gold {
  background: var(--gold);
  border-color: #e6c65a;
  color: #1a1403;
}
.btn--gold:hover { background: #e0bd48; border-color: #f0d478; }
.btn--gold:active { background: #c5a22f; }

.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn--quiet:hover { background: var(--obsidian-3); color: var(--parchment); border-color: transparent; }

.btn--danger { border-color: rgba(139, 21, 40, 0.6); color: var(--velvet-text); }
.btn--danger:hover { background: var(--velvet-wash); border-color: var(--velvet); }

.btn--block { width: 100%; }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 0.79rem; }

/* Icon-only: still a 40×40 target. */
.btn--icon { min-height: 40px; width: 40px; padding: 0; }
.btn--icon svg { width: 19px; height: 19px; }

.field { margin-bottom: var(--s5); }
.field > label, .label {
  display: block;
  font: 600 0.71rem/1 var(--font-sans);
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s2);
}
.hint {
  font: 400 0.79rem/1.5 var(--font-sans);
  color: var(--ink-cap);
  margin: var(--s2) 0 0;
}

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--obsidian-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--parchment);
  font: 400 0.95rem/1.5 var(--font-sans);
  transition: border-color 120ms ease, background-color 120ms ease;
}
textarea { resize: vertical; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:hover, select:hover, textarea:hover { border-color: #363745; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold-dim);
  background: var(--obsidian-2);
}
input[aria-invalid="true"] { border-color: var(--velvet); }

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Toggle switch — real checkbox, keyboard operable. */
.switch { display: flex; align-items: flex-start; gap: var(--s3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  flex: none;
  width: 42px;
  height: 24px;
  margin-top: 2px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--obsidian-3);
  position: relative;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform 140ms ease, background-color 140ms ease;
}
.switch input:checked + .switch__track { background: rgba(212, 175, 55, 0.2); border-color: var(--gold-dim); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--gold); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch__text { font: 400 0.88rem/1.5 var(--font-sans); color: var(--ink-2); }
.switch__text b { display: block; color: var(--parchment); font-weight: 600; font-size: 0.87rem; letter-spacing: 0.02em; }

/* Checkbox chip group (tools allowlist). */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--obsidian-2);
  font: 600 0.82rem/1 var(--font-sans);
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ink-4);
  flex: none;
}
.chip:hover { border-color: #3a3b4a; color: var(--parchment); }
.chip:has(input:checked) { border-color: var(--gold-dim); color: var(--parchment); background: var(--gold-wash); }
.chip:has(input:checked) .chip__dot { background: var(--gold); border-color: var(--gold); }
.chip:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   6. SURFACES
   -------------------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--obsidian-2), var(--obsidian-1));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--s5);
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
}
.card__head h2, .card__head h3 { margin: 0; font-size: 1.05rem; letter-spacing: 0.03em; }
/* Groups the head's own controls so `justify-content: space-between` has two sides to work
   with rather than spreading three children apart. */
.card__head-actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.card__body { padding: var(--s5); }

.panel {
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold-line);
  border-radius: var(--radius);
  background: var(--obsidian-1);
  padding: var(--s4) var(--s5);
}

.notice { border-radius: var(--radius); padding: var(--s3) var(--s4); font: 400 0.88rem/1.55 var(--font-sans); }
.notice--info { background: var(--gold-wash); border: 1px solid var(--gold-line); color: var(--ink-2); }
.notice--bad  { background: var(--velvet-wash); border: 1px solid rgba(139, 21, 40, 0.55); color: var(--velvet-text); }
.notice--good { background: rgba(127, 191, 143, 0.08); border: 1px solid rgba(127, 191, 143, 0.3); color: #b6dcc1; }
.notice:empty { display: none; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font: 600 0.68rem/1.5 var(--font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.tag--gold { border-color: var(--gold-line); color: var(--gold-dim); background: var(--gold-wash); }
.tag--velvet { border-color: rgba(139, 21, 40, 0.55); color: var(--velvet-text); background: var(--velvet-wash); }
.tag--ok { border-color: rgba(127, 191, 143, 0.32); color: #9ccbaa; }

.meter {
  height: 5px;
  border-radius: 3px;
  background: var(--obsidian-4);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.meter__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 300ms ease;
}
.meter--hot .meter__fill { background: linear-gradient(90deg, var(--velvet), var(--velvet-text)); }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat__v {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--parchment);
  font-variant-numeric: tabular-nums;
}
.stat__k {
  font: 600 0.66rem/1.4 var(--font-sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-cap);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: var(--s4) var(--s5);
}

/* Data table: real <table>, horizontally scrollable on narrow screens. */
.tablewrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font: 400 0.88rem/1.5 var(--font-sans); }
table.data th {
  text-align: left;
  font: 600 0.66rem/1 var(--font-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-cap);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, 0.017); }
table.data .num { font-family: var(--font-mono); font-size: 0.82rem; color: var(--parchment); font-variant-numeric: tabular-nums; }
table.data .muted { color: var(--ink-cap); }
.empty {
  padding: var(--s6) var(--s4);
  text-align: center;
  color: var(--ink-cap);
  font: italic 400 0.92rem/1.6 var(--font-serif);
}

/* --------------------------------------------------------------------------
   7. TRANSCRIPT + COMPOSER  (index.html)
   Markup contract, mirrored in index.html and NOTES.md:
     <ol id="transcript" role="log" aria-live="polite" aria-relevant="additions text"
         aria-label="Conversation transcript">
       <li class="turn turn--user"  data-role="user">
         <p class="turn__who">…</p><div class="turn__body">…</div>
       </li>
     </ol>
   The log has ONE live region; streaming text is written into the single
   in-flight turn's .turn__body, never into newly appended nodes, so a screen
   reader announces deltas instead of re-reading the transcript.
   -------------------------------------------------------------------------- */
.transcript {
  list-style: none;
  margin: 0;
  padding: var(--s6) 0 var(--s3);
  display: flex;
  flex-direction: column;
}

.turn { position: relative; padding-left: 30px; margin-bottom: var(--s6); }
.turn:last-child { margin-bottom: var(--s3); }
.turn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--obsidian-3);
}
.turn--user::before { border-color: var(--gold-line); background: var(--gold); }
.turn--assistant::before { border-color: var(--velvet); background: var(--velvet-deep); }

.turn__who {
  font: 600 0.68rem/1 var(--font-sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-cap);
  margin: 0 0 var(--s2);
}
.turn--assistant .turn__who { color: var(--gold-dim); }
.turn__body { color: var(--ink-2); max-width: 100%; }
.turn--user .turn__body { color: var(--parchment); }
.turn__body > *:first-child { margin-top: 0; }
.turn__body > *:last-child { margin-bottom: 0; }

/* Long-form inside a turn */
.turn__body p { margin: 0 0 var(--s3); }
.turn__body ul, .turn__body ol { margin: 0 0 var(--s3); padding-left: 1.35em; }
.turn__body li { margin-bottom: var(--s1); }
.turn__body h3, .turn__body h4 { margin: var(--s4) 0 var(--s2); }
.turn__body strong { color: var(--parchment); font-weight: 700; }
.turn__body em { color: var(--ink-2); }
.turn__body blockquote {
  margin: var(--s3) 0;
  padding-left: var(--s4);
  border-left: 2px solid var(--gold-line);
  color: var(--ink-3);
  font-style: italic;
}
.turn__body code {
  background: var(--obsidian-4);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 1px 5px;
  color: #e7d79a;
  font-size: 0.84em;
}
.turn__body pre {
  margin: var(--s3) 0;
  padding: var(--s4);
  background: var(--obsidian-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
  color: #ddd7c8;
  tab-size: 2;
}
.turn__body pre code { background: none; border: 0; padding: 0; color: inherit; font-size: 0.8rem; }
.turn__body table { border-collapse: collapse; margin: var(--s3) 0; font: 400 0.85rem/1.5 var(--font-sans); width: 100%; }
.turn__body th, .turn__body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.turn__body th { background: var(--obsidian-3); color: var(--parchment); font-weight: 600; }

/* Streaming caret — decorative only, hidden from assistive tech. */
.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  vertical-align: -0.16em;
  margin-left: 2px;
  background: var(--gold);
  opacity: 0.85;
  animation: pulse 1.1s steps(1, end) infinite;
}
@keyframes pulse { 0%, 55% { opacity: 0.85; } 56%, 100% { opacity: 0.12; } }

.turn__pending {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font: 400 0.85rem/1 var(--font-sans);
  color: var(--ink-cap);
}
.turn__pending i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold-dim);
  animation: bounce 1.05s ease-in-out infinite;
}
.turn__pending i:nth-child(2) { animation-delay: 0.14s; }
.turn__pending i:nth-child(3) { animation-delay: 0.28s; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(10, 10, 12, 0.72), var(--obsidian) 42%);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
}
.composer__inner { padding: var(--s4) 0 var(--s5); }
.composer__box {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  padding: var(--s3);
  background: var(--obsidian-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.composer__box:focus-within { border-color: var(--gold-dim); box-shadow: var(--ring); }
.composer__box textarea {
  border: 0;
  background: transparent;
  min-height: 44px;
  max-height: 168px;
  padding: 10px 4px;
  resize: none;
  font-family: var(--font-serif);
  font-size: 1rem;
}
.composer__box textarea:focus-visible { outline: none; }
.composer__actions { display: flex; align-items: center; gap: var(--s2); flex: none; }
.composer__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-top: var(--s3);
  font: 400 0.75rem/1.4 var(--font-sans);
  color: var(--ink-cap);
}
.composer__meta kbd { font-size: 0.72em; }

/* --------------------------------------------------------------------------
   8. AGENT DRAWER + NAV
   -------------------------------------------------------------------------- */
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: none;
  color: var(--ink-3);
  font: 600 0.85rem/1.3 var(--font-sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.nav a:hover, .nav button:hover { color: var(--parchment); background: var(--obsidian-2); }
.nav a[aria-current="page"], .nav button[aria-current="true"] {
  color: var(--parchment);
  border-left-color: var(--gold);
  background: var(--gold-wash);
}
.nav svg { width: 16px; height: 16px; flex: none; }
.nav__group { margin-bottom: var(--s3); }
.nav__label {
  font: 600 0.62rem/1 var(--font-sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-cap);
  padding: 0 10px;
  margin-bottom: var(--s2);
}

/* A field group needs the same runway below it that a single .field has, or whatever follows
   sits flush against the group. Measured 2026-11-16: the bot form's Name/Model row ran straight
   into "What it should do" with a 0px gap while every other transition in the form was 24px.
   The inner fields carry an inline margin:0, so the group has to supply the spacing itself. */
.drawer { display: grid; gap: var(--s4); margin-bottom: var(--s5); }
.drawer__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); }

.usage { display: grid; gap: var(--s2); }
.usage__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.usage__n { font-family: var(--font-mono); font-size: 0.85rem; color: var(--parchment); font-variant-numeric: tabular-nums; }
.usage__n span { color: var(--ink-cap); }

.invite {
  border: 1px dashed rgba(212, 175, 55, 0.34);
  border-radius: var(--radius);
  background: var(--gold-wash);
  padding: var(--s4);
}
.invite code {
  display: block;
  font-size: 0.82rem;
  color: var(--parchment);
  background: var(--obsidian-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s3);
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   9. PAGE-LEVEL COMPOSITIONS
   -------------------------------------------------------------------------- */
.hero { padding: clamp(48px, 9vh, 104px) 0 var(--s7); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s7); align-items: center; }
.hero h1 { margin-bottom: var(--s4); }
.hero h1 .lit { color: var(--gold); }
.lead { font-size: 1.09rem; line-height: 1.66; color: var(--ink-2); max-width: 34rem; }

.pagefoot {
  border-top: 1px solid var(--line);
  margin-top: var(--s8);
  padding: var(--s5) 0 var(--s7);
  font: 400 0.79rem/1.6 var(--font-sans);
  color: var(--ink-cap);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  align-items: center;
}
.pagefoot a { color: var(--ink-3); }
.pagefoot a:hover { color: var(--gold); }

.formrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: start; }

/* Card list used by admin referrals + waitlist queue */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s3) var(--s4);
  align-items: center;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
}
.rows li:last-child { border-bottom: 0; }
.rows .rows__main { min-width: 0; }
.rows .rows__name { color: var(--parchment); font-weight: 600; font: 600 0.92rem/1.4 var(--font-sans); }
.rows .rows__meta { font: 400 0.78rem/1.5 var(--font-sans); color: var(--ink-cap); overflow-wrap: anywhere; }
.rows .rows__acts { display: flex; gap: var(--s2); flex-wrap: wrap; }
.rows__kind {
  font: 600 0.62rem/1 var(--font-sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 5px;
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE — 360px must be genuinely usable, not merely non-broken
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail__scroll { display: flex; align-items: center; gap: var(--s2); overflow-x: auto; }
  .rail .nav { flex-direction: row; }
  .rail .nav__group { margin: 0; }
  .rail .nav__label { display: none; }
  .rail .nav a, .rail .nav button { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--radius); }
  .rail .nav a[aria-current="page"], .rail .nav button[aria-current="true"] { border-left-color: transparent; border-bottom-color: var(--gold); }
  .brand__sub { display: none; }
  .hero__grid { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .cameo--lg { width: 120px; height: 120px; }
}

@media (max-width: 560px) {
  :root { --rail-w: 0px; }
  body { font-size: 15.5px; }
  .column { padding-inline: var(--s4); }
  .card { padding: var(--s4); }
  .card__body, .card__head { padding: var(--s4); }
  .rows li { grid-template-columns: minmax(0, 1fr); padding: var(--s4); }
  .rows .rows__acts { justify-content: flex-start; }
  .formrow { grid-template-columns: minmax(0, 1fr); }
  .turn { padding-left: 22px; }
  .turn::before { width: 10px; height: 10px; top: 8px; }
  .composer__inner { padding: var(--s3) 0 var(--s4); }
  .composer__box { padding: 10px; gap: var(--s2); }
  .composer__meta { flex-direction: column; align-items: flex-start; gap: var(--s2); }
  .keyrule { margin: var(--s5) 0; }
  table.data th, table.data td { padding: 10px var(--s3); }
}

/* Form controls must never fall under 16px on touch, or iOS zooms the page. */
@media (max-width: 560px) {
  input[type="text"], input[type="email"], input[type="password"], select, textarea { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .caret { animation: none; opacity: 0.85; }
}

/* --------------------------------------------------------------------------
   §14  prefers-contrast: more  (Kitsune house rule 8)

   The sheet handled prefers-reduced-motion but had no contrast preference block,
   so a reader who asked their OS for more contrast got the same dark-on-dark
   surfaces. This raises the two things that actually lose information at low
   vision: text ink, and the 1px borders that separate surfaces.

   Measured against --obsidian-0 (#0a0a0c):
     --ink-3  6.63:1 -> --parchment 15.4:1
     --ink-4  3.68:1 -> --ink-2    10.3:1   (3.68:1 fails even the 4.5:1 floor)
     --ink-cap 5.76:1 -> --ink-2   10.3:1
   Borders go from rgba/grey hairlines to the solid --mist / gold tokens, and the
   gold text token steps up from --gold-dim (6.9:1) to --gold (9.9:1).
   -------------------------------------------------------------------------- */
@media (prefers-contrast: more) {
  :root {
    --ink-2: var(--parchment);
    --ink-3: var(--parchment);
    --ink-cap: var(--parchment);
    --ink-4: var(--ink-2);
    --gold-dim: var(--gold);
    --gold-line: var(--gold);
    --line: var(--parchment);
    --line-soft: var(--ink-3);
  }

  /* Swap the hairline greys for solid, unambiguous edges. */
  .rail, .card, .btn, .chip, .kbd, kbd, .notice, .turn, .invite,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], select, textarea,
  table.data th, table.data td, .turn__body th, .turn__body td,
  .pagefoot, .composer__inner, .rows li {
    border-color: var(--parchment);
  }

  /* Keep a focus ring visible against the brighter borders. */
  a:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible,
  textarea:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
  }

  a { text-decoration-color: currentColor; text-decoration-thickness: 2px; }

  .chip__dot { border-color: var(--parchment); }
  .turn--user::before, .turn--assistant::before { border-color: var(--parchment); }
  .card, .turn { background: var(--obsidian-1); }
  input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], select, textarea {
    background: #000;
  }
}

@media print {
  body::before, .rail, .composer, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .turn__body, .card { color: #000; border-color: #999; background: #fff; }
}

/* --------------------------------------------------------------------------
   §12  Sign-in gate
   Revealed only when /api/me answers 401. Deliberately built from the existing
   .brand / .card / .field / .btn pieces so it inherits the system instead of
   restating it, and so it cannot drift away from the app's look.
   -------------------------------------------------------------------------- */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--s5) var(--s4);
}
.gate__panel { width: 100%; max-width: 26rem; }

/* --------------------------------------------------------------------------
   §12c Gate landmark (WCAG 1.3.1 / 2.4.1)

   `#gate` is a sibling of `.shell`, and while the app is signed out app.js hides
   `.shell` entirely — so the seven nodes in the gate column (brand, h1, lead,
   both sign-in fields, the alt links) sat outside every landmark. The gate is
   the <main> content in that state, so it is marked as a main landmark *only
   while it is displayed*; when a signed-in session shows the shell, the shell's
   own <main> is the one landmark and this one is hidden.
   -------------------------------------------------------------------------- */
.gate:not([hidden]) {
  display: grid;
}
.gate__brand { margin-bottom: var(--s4); }
.gate__alt { margin: var(--s3) 0 0; color: var(--ink-2); }
.gate__alt a { color: inherit; }

/* --------------------------------------------------------------------------
   §13  Touch targets (WCAG 2.5.8 — 24x24 minimum)

   These are links inside running prose, so they cannot be given a different
   display or they break the sentence. They also measured 19-20.2px tall because
   an inline link's hit height is just its line box. Inline-block + vertical
   padding reaches 24px; the negative margin cancels the extra padding so the
   paragraph's own leading and the page rhythm are unchanged.
   -------------------------------------------------------------------------- */
.gate__alt a,
.pagefoot a,
#footTop {
  display: inline-block;
  min-height: 24px;
  padding-block: 3px;
  margin-block: -3px;
}
.gate .card { margin-top: 0; }

/* --------------------------------------------------------------------------
   §12b  Contrast repairs (WCAG 1.4.3 / Kitsune house rule)

   `--ink-4` is 3.68:1 on --obsidian-0 — short of the 4.5:1 floor for small text,
   and its own token comment says placeholder/disabled only. The three selectors
   below were nonetheless using it for real copy, so they move to --ink-cap.

   #modelLine and #agentLine previously took their colour from an inline style on
   their parent <p>. That inline declaration is gone (it became .metalines, which
   carries layout only), so these are plain selectors again — no !important.
   -------------------------------------------------------------------------- */
.brand__sub,
.pagefoot {
  color: var(--ink-cap);
}
#modelLine,
#agentLine {
  color: var(--ink-cap);
}

@media (max-width: 560px) {
  .gate { padding: var(--s4) var(--s3); place-items: start center; }
}
/* ---------------------------------------------------------------------------
   Honour the `hidden` attribute.

   The gate reveals itself by setting `.shell.hidden = true` (app.js), but this
   sheet sets `.shell { display: grid }`, and a class selector outranks the UA
   sheet's [hidden] rule. The result was that the signed-out page still laid out
   and exposed the whole authenticated app: #tabChat, #tabAgent, #tabInvite,
   #navAdmin and #btnLogout stayed keyboard-reachable and present in the
   accessibility tree behind the sign-in card.

   `!important` is deliberate: this must beat component `display` declarations
   wherever `hidden` is used, not just on `.shell`. It is the standard
   normalisation and it is what makes the attribute mean what it says.
   --------------------------------------------------------------------------- */
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   §12c  .metalines

   index.html used an inline style on this paragraph for four things: margin 0,
   a .8rem sans face, right alignment, and color:var(--ink-4). It was replaced
   with a class so this sheet is the single source of truth for colour - the
   inline declaration was outranking §12b and forced an !important there.

   The layout properties are reproduced exactly; the colour comes from §12b,
   which now has no competing inline declaration to fight.
   -------------------------------------------------------------------------- */
.metalines {
  margin: 0;
  font: 400 .8rem/1.5 var(--font-sans);
  text-align: right;
}

/* ==========================================================================
   WARM LAYER (2026-11-14)
   Warm cream canvas, serif headlines, clean sans body, one clay accent,
   light by default with a matching dark mode. Everything above still works;
   this block only re-points the tokens and fixes the few hard-coded colours.
   Roll back by deleting from this banner to the end of the file.
   ========================================================================== */
:root {
  --obsidian:   #faf9f5;
  --obsidian-1: #f4f2ec;
  --obsidian-2: #ffffff;
  --obsidian-3: #f5f3ee;
  --obsidian-4: #efece5;

  --parchment: #1f1e1b;
  --ink-2:     #3d3c38;
  --ink-3:     #5e5c56;
  --ink-4:     #8e8b82;
  --ink-cap:   #67655f;

  --mist:        #e6e1d8;
  --line:        #e6e1d8;
  --line-soft:   #eeeae3;
  --line-strong: #d3cdc1;

  --gold:      #b05530;
  --gold-dim:  #9a4826;
  --gold-line: rgba(176, 85, 48, 0.28);
  --gold-wash: rgba(176, 85, 48, 0.07);

  --velvet:       #a8323a;
  --velvet-text:  #a8323a;
  --velvet-deep:  #7d2128;
  --velvet-wash:  rgba(168, 50, 58, 0.07);
  --danger:  #a8323a;
  --ok:      #2f7a47;
  --ok-dim:  #4f8a5f;
  --ok-text: #2a6a3e;

  --accent-btn:        #b05530;
  --accent-btn-hover:  #9a4826;
  --accent-btn-active: #853d20;

  --font-display: "Iowan Old Style", "Charter", "Source Serif 4", "Source Serif Pro", "Georgia", "Cambria", "Times New Roman", serif;
  --font-serif:   "Iowan Old Style", "Charter", "Source Serif 4", "Georgia", "Cambria", serif;
  --font-sans:    ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(20, 20, 19, 0.04), 0 10px 30px -18px rgba(20, 20, 19, 0.18);
  --shadow-pop:  0 4px 14px rgba(20, 20, 19, 0.07), 0 28px 56px -22px rgba(20, 20, 19, 0.22);
  --ring: 0 0 0 2px var(--obsidian), 0 0 0 4px var(--gold);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --obsidian:   #1f1e1c;
    --obsidian-1: #252422;
    --obsidian-2: #2a2926;
    --obsidian-3: #31302c;
    --obsidian-4: #373531;

    --parchment: #f2f0ea;
    --ink-2:     #d8d5cd;
    --ink-3:     #b3b0a7;
    --ink-4:     #87847c;
    --ink-cap:   #a5a299;

    --mist:        #3a3834;
    --line:        #3a3834;
    --line-soft:   #302e2b;
    --line-strong: #4b4944;

    --gold:      #e3906f;
    --gold-dim:  #e8987a;
    --gold-line: rgba(227, 144, 111, 0.32);
    --gold-wash: rgba(227, 144, 111, 0.08);

    --velvet:      #e0757b;
    --velvet-text: #ef9ea3;
    --velvet-wash: rgba(224, 117, 123, 0.1);
    --danger:  #ef9ea3;
    --ok:      #7fbf8f;
    --ok-text: #a6d6b3;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.6);
    --shadow-pop:  0 4px 14px rgba(0, 0, 0, 0.35), 0 28px 56px -22px rgba(0, 0, 0, 0.7);

    color-scheme: dark;
  }
}

/* Flat canvas: no lamplight pools, no weave. */
body::before { display: none; }
body { font: 16px/1.6 var(--font-sans); color: var(--ink-2); }

h1, h2, h3, h4 { font-weight: 400; letter-spacing: -0.012em; line-height: 1.14; }
h1 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem); }
.card__head h2, .card__head h3 { letter-spacing: 0; font-family: var(--font-sans); font-weight: 600; font-size: 1rem; }

::selection { background: rgba(176, 85, 48, 0.2); color: inherit; }
:focus-visible { border-radius: 6px; }

/* Wordmark: quiet serif, no small caps shouting. */
.brand__mark { width: 34px; height: 34px; }
.brand__word { font-size: 1.45rem; letter-spacing: -0.01em; text-transform: none; font-weight: 500; }
.brand__sub  { font-size: 0.66rem; letter-spacing: 0.12em; margin-top: 5px; }

.eyebrow { letter-spacing: 0.12em; font-size: 0.72rem; }
.eyebrow::after { display: none; }

/* Dividers become a plain hairline. */
.keyrule { gap: 0; margin: var(--s5) 0; }
.keyrule svg { display: none; }
.keyrule::before, .keyrule::after { background: var(--line); }

.cameo::after { background: radial-gradient(circle, var(--gold-wash), transparent 68%); }

/* Buttons: pill-ish, solid clay primary with white text. */
.btn { border-radius: 10px; letter-spacing: 0; font-weight: 550; min-height: 42px; padding: 10px 18px; }
.btn:hover { border-color: var(--line-strong); }
.btn--gold { background: var(--accent-btn); border-color: var(--accent-btn); color: #fff; }
.btn--gold:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); }
.btn--gold:active { background: var(--accent-btn-active); }
.btn--quiet:hover { border-color: transparent; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], select, textarea { border-radius: 10px; background: var(--obsidian-2); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
.chip:hover { border-color: var(--line-strong); }

.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-card); background: var(--obsidian-2); }
.notice--bad  { border-color: color-mix(in srgb, var(--velvet) 40%, transparent); }
.notice--good { background: color-mix(in srgb, var(--ok) 9%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok-text); }
.tag--ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok-text); }
table.data tbody tr:hover td { background: rgba(127, 120, 105, 0.06); }

/* App shell */
.rail { background: var(--obsidian-1); }
.turn--assistant .turn__body { font-family: var(--font-serif); font-size: 1.04rem; }
.turn__body code { color: var(--parchment); border-radius: 5px; }
.turn__body pre { color: var(--parchment); border-radius: 12px; }
.composer {
  background: linear-gradient(180deg, color-mix(in srgb, var(--obsidian) 70%, transparent), var(--obsidian) 42%);
  border-top-color: transparent;
}
.composer__box { border-radius: 20px; padding: var(--s3) var(--s3) var(--s3) var(--s4); }
.invite { border-color: var(--gold-line); border-radius: 12px; }

/* Public pages: slim sticky top bar. */
.wl-top, .cli-top, .acc-top {
  position: sticky; top: 0; z-index: 20;
  padding: var(--s3) 0;
  background: color-mix(in srgb, var(--obsidian) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

/* The CLI banner stays a dark terminal in both modes, so pin its colours. */
html .term { background: #1b1a18; border-color: #1b1a18; border-radius: 14px; }
html .term pre { color: #d8d5cd; }
html .term .g  { color: #e3906f; }
html .term .gp { color: #f2f0ea; }
html .term .gd { color: #d8805e; }
html .term .m  { color: #a5a299; }
html .term .r  { color: #ef9ea3; }

/* --------------------------------------------------------------------------
   Sign-in front page: top bar, hero, sign-in card, small footer.
   -------------------------------------------------------------------------- */
.gate { display: block; padding: 0; place-items: initial; }
.gate:not([hidden]) { display: flex; flex-direction: column; min-height: 100dvh; }
.gate__top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--obsidian) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.gate__top .brand__sub { display: none; }
.gate__nav { display: flex; align-items: center; gap: var(--s5); font: 500 0.92rem/1 var(--font-sans); }
.gate__nav a:not(.btn) { color: var(--ink-3); text-decoration: none; min-height: 24px; display: inline-flex; align-items: center; }
.gate__nav a:not(.btn):hover { color: var(--parchment); }
.gate__nav .btn { min-height: 38px; padding: 8px 16px; }

.gate__wrap {
  flex: 1;
  width: 100%; max-width: 72rem; margin-inline: auto;
  padding: clamp(40px, 9vh, 112px) clamp(16px, 4vw, 40px) var(--s8);
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 25rem);
  gap: clamp(32px, 6vw, 96px); align-items: start;
}
.gate__kicker {
  display: inline-flex; align-items: center; gap: var(--s2);
  font: 500 0.8rem/1 var(--font-sans); color: var(--ink-3);
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--obsidian-2); margin: 0 0 var(--s5);
}
.gate__kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.gate__title { font-size: clamp(2.5rem, 1.4rem + 4.2vw, 4.4rem); line-height: 1.04; letter-spacing: -0.025em; margin: 0 0 var(--s5); max-width: 13ch; }
.gate__lead { font-size: 1.14rem; line-height: 1.6; color: var(--ink-3); max-width: 34rem; margin: 0 0 var(--s6); }
.gate__ctas { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s8); }
.gate__points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.gate__points li {
  padding: var(--s4) var(--s5); border: 1px solid var(--line); border-radius: 14px; background: var(--obsidian-2);
  font-size: 0.93rem; color: var(--ink-3); line-height: 1.5;
}
.gate__points b { display: block; color: var(--parchment); font-weight: 600; margin-bottom: 4px; font-size: 0.98rem; }

.gate__card { position: sticky; top: 96px; margin: 0; box-shadow: var(--shadow-pop); }
.gate__card h2 { font-size: 1.7rem; margin: 0 0 var(--s2); }
.gate__card .lead { font-size: 0.96rem; color: var(--ink-3); margin: 0 0 var(--s5); }
.gate__alt { font-size: 0.92rem; color: var(--ink-3); }
.gate__alt a { color: var(--gold); }

.gate__foot {
  width: 100%; max-width: 72rem; margin-inline: auto;
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); justify-content: space-between;
  padding: var(--s5) clamp(16px, 4vw, 40px) var(--s6);
  border-top: 1px solid var(--line-soft);
  font: 400 0.84rem/1.5 var(--font-sans); color: var(--ink-cap);
}
.gate__foot nav { display: flex; flex-wrap: wrap; gap: var(--s4); }
.gate__foot a { color: var(--ink-cap); text-decoration: none; min-height: 24px; display: inline-flex; align-items: center; }
.gate__foot a:hover { color: var(--parchment); }

@media (max-width: 900px) {
  .gate__wrap { grid-template-columns: minmax(0, 1fr); padding-top: var(--s7); }
  .gate__card { position: static; }
  .gate__ctas { margin-bottom: var(--s6); }
}
@media (max-width: 560px) {
  /* Sign in survives the smallest screens: a returning member should never have
     to scroll the whole page to find the way back in. */
  .gate__nav a:not(.btn):not([href="#signin"]) { display: none; }
  .gate__points { grid-template-columns: minmax(0, 1fr); }
  .gate__title { max-width: none; }
}

/* Form labels and tags in sentence case, not engraved small caps. */
.field > label, .label { text-transform: none; letter-spacing: 0; font-size: 0.9rem; font-weight: 550; color: var(--parchment); }
.tag { text-transform: none; letter-spacing: 0.01em; }
.composer__box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-line); }


/* --------------------------------------------------------------------------
   LANDING v2 (2026-11-14): hero prompt box, demo session, numbered steps,
   surfaces, membership cards, sign-in, FAQ, closing band.
   -------------------------------------------------------------------------- */
.lp-hero, .lp-sec, .lp-cta { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.lp-hero { text-align: center; padding-top: clamp(56px, 12vh, 136px); padding-bottom: var(--s8); display: flex; flex-direction: column; align-items: center; }
.lp-hero__title { font-size: clamp(2.6rem, 1.3rem + 5vw, 5rem); line-height: 1.02; letter-spacing: -0.03em; margin: 0 0 var(--s5); }
.lp-hero__lead { font-size: 1.16rem; line-height: 1.6; color: var(--ink-3); max-width: 38rem; margin: 0 0 var(--s7); }
.lp-ask {
  width: 100%; max-width: 46rem; text-align: left;
  background: var(--obsidian-2); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-pop); padding: var(--s4) var(--s4) var(--s3) var(--s5);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.lp-ask:focus-within { border-color: var(--gold); box-shadow: var(--shadow-pop), 0 0 0 3px var(--gold-line); }
.lp-ask textarea { width: 100%; border: 0; background: transparent; resize: none; font: 400 1.1rem/1.5 var(--font-sans); color: var(--parchment); padding: 4px 0; min-height: 3.2em; box-shadow: none; }
.lp-ask textarea:focus-visible { outline: none; box-shadow: none; }
.lp-ask__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.lp-ask__hint { font: 400 0.82rem/1.4 var(--font-sans); color: var(--ink-cap); }
.lp-ask__go { border-radius: 999px; min-height: 40px; }
.lp-chips { list-style: none; margin: var(--s5) 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); max-width: 46rem; }
.lp-chips a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--obsidian-2); color: var(--ink-2); text-decoration: none;
  font: 500 0.88rem/1.2 var(--font-sans);
}
.lp-chips a:hover { border-color: var(--line-strong); color: var(--parchment); }

.lp-sec { padding-top: var(--s8); padding-bottom: var(--s8); }
.lp-h2 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); letter-spacing: -0.02em; margin: 0 0 var(--s7); max-width: 22ch; }

.lp-demo { max-width: 56rem; margin-inline: auto; border-radius: 20px; border: 1px solid var(--line); background: var(--obsidian-2); box-shadow: var(--shadow-pop); overflow: hidden; }
.lp-demo__bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); background: var(--obsidian-1); font: 500 0.8rem/1 var(--font-sans); color: var(--ink-cap); }
.lp-demo__bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.lp-demo__bar span { margin-left: 8px; }
.lp-demo__body { padding: clamp(20px, 4vw, 40px); display: grid; gap: var(--s4); }
.lp-demo__body b { display: block; font: 600 0.8rem/1.4 var(--font-sans); color: var(--ink-cap); margin-bottom: 4px; }
.lp-demo__you { margin: 0 0 0 auto; max-width: 30rem; background: var(--obsidian-3); border-radius: 16px; padding: 12px 16px; color: var(--parchment); }
.lp-demo__steps { margin: 0; font: 500 0.84rem/1.4 var(--font-mono); color: var(--ink-3); padding-left: 12px; border-left: 2px solid var(--gold-line); }
.lp-demo__adler { font-family: var(--font-serif); font-size: 1.08rem; color: var(--ink-2); max-width: 44rem; }
.lp-demo__adler b { color: var(--gold-dim); }
.lp-demo__note { margin: 0; font: 400 0.8rem/1.4 var(--font-sans); color: var(--ink-cap); }

.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s6); }
.lp-steps li { border-top: 1px solid var(--line); padding-top: var(--s4); color: var(--ink-3); font-size: 0.96rem; line-height: 1.55; }
.lp-steps span { display: block; font: 500 0.82rem/1 var(--font-mono); color: var(--gold-dim); margin-bottom: var(--s4); }
.lp-steps b { display: block; font: 400 1.35rem/1.2 var(--font-display); color: var(--parchment); margin-bottom: var(--s2); }

.lp-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.lp-modes article, .lp-plan { border: 1px solid var(--line); border-radius: 18px; background: var(--obsidian-2); padding: var(--s6) var(--s5); }
.lp-modes h3, .lp-plan h3 { font-size: 1.5rem; margin: 0 0 var(--s3); }
.lp-modes p, .lp-plan p { color: var(--ink-3); font-size: 0.96rem; }
.lp-modes ul, .lp-plan ul { margin: var(--s4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.lp-modes li, .lp-plan li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 0.93rem; }
.lp-modes li::before, .lp-plan li::before { content: ""; position: absolute; left: 2px; top: 0.45em; width: 10px; height: 6px; border-left: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(-45deg); }
.lp-cmd { margin: var(--s4) 0; padding: 12px 14px; border-radius: 10px; background: #1b1a18; color: #f2f0ea; font: 0.86rem/1.4 var(--font-mono); overflow-x: auto; }
.lp-cmd code { background: none; border: 0; padding: 0; color: inherit; }
.lp-modes a { font: 500 0.92rem/1 var(--font-sans); display: inline-flex; min-height: 24px; align-items: center; }

.lp-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); max-width: 52rem; }
.lp-plan { display: flex; flex-direction: column; }
.lp-plan .btn { margin-top: auto; }
.lp-plan ul { margin-bottom: var(--s6); }
.lp-plan > p:not(.lp-plan__price) { margin-bottom: var(--s6); }
.lp-plan .lp-plan__price { font: 400 2rem/1.1 var(--font-display); color: var(--parchment); margin: 0 0 var(--s4); }
.lp-plan--main { border-color: var(--gold-line); box-shadow: var(--shadow-card); }

.lp-signin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); gap: clamp(32px, 6vw, 96px); align-items: center; scroll-margin-top: 80px; }
.lp-signin .lp-h2 { margin-bottom: var(--s4); }
.lp-signin .gate__card { position: static; }
.gate__lead { font-size: 1.08rem; color: var(--ink-3); max-width: 30rem; }

.lp-faq { max-width: 48rem; border-top: 1px solid var(--line); }
.lp-faq details { border-bottom: 1px solid var(--line); }
.lp-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s5) 0; font: 500 1.06rem/1.4 var(--font-sans); color: var(--parchment); }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: "+"; font: 300 1.4rem/1 var(--font-sans); color: var(--ink-3); transition: transform 160ms ease; }
.lp-faq details[open] summary::after { transform: rotate(45deg); }
.lp-faq details p { margin: 0 0 var(--s5); color: var(--ink-3); max-width: 40rem; }

.lp-cta { text-align: center; padding-top: var(--s9); padding-bottom: var(--s9); display: flex; flex-direction: column; align-items: center; }
.lp-cta h2 { font-size: clamp(2rem, 1.2rem + 3vw, 3.4rem); letter-spacing: -0.025em; margin: 0 0 var(--s6); }
.lp-cta .gate__ctas { justify-content: center; margin: 0; }
#how, #faq { scroll-margin-top: 80px; }

@media (max-width: 1000px) {
  .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-modes { grid-template-columns: minmax(0, 1fr); }
  .gate__nav a[href="#how"], .gate__nav a[href="#faq"] { display: none; }
}
@media (max-width: 760px) {
  .lp-signin, .lp-plans { grid-template-columns: minmax(0, 1fr); }
  .lp-steps { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .lp-ask__hint { display: none; }
  .lp-ask__bar { justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .lp-faq summary::after { transition: none; } }


/* LANDING v3 (2026-11-14): real screenshot, proof list, first-run welcome. */
.lp-shot { max-width: 64rem; margin: 0 auto; border-radius: 20px; border: 1px solid var(--line); background: var(--obsidian-2); box-shadow: var(--shadow-pop); overflow: hidden; }
.lp-shot img { display: block; width: 100%; height: auto; }
.lp-shot figcaption { padding: 12px 18px; border-top: 1px solid var(--line-soft); font: 400 0.84rem/1.4 var(--font-sans); color: var(--ink-cap); }

.lp-proof { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.lp-proof li { padding: var(--s5); border-radius: 16px; background: var(--obsidian-1); border: 1px solid var(--line-soft); color: var(--ink-3); font-size: 0.95rem; line-height: 1.55; }
.lp-proof b { display: block; color: var(--parchment); font: 600 1.02rem/1.35 var(--font-sans); margin-bottom: 6px; }
.lp-proof a { display: inline-flex; min-height: 24px; align-items: center; }
.lp-plan__note { margin: calc(var(--s3) * -1) 0 var(--s4) !important; font-size: 0.88rem !important; }

.welcome { display: none; padding: var(--s7) 0 var(--s6); text-align: center; }
.transcript:empty + .welcome { display: block; }
.welcome__title { font: 400 clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem)/1.15 var(--font-display); color: var(--parchment); letter-spacing: -0.015em; margin: 0 0 var(--s3); }
.welcome__lead { color: var(--ink-3); max-width: 30rem; margin: 0 auto var(--s5); }
.welcome__chips { margin: 0 auto; }

@media (max-width: 760px) { .lp-proof { grid-template-columns: minmax(0, 1fr); } }

.lp-proof a { color: var(--gold-dim); }

/* Invitations: once the code cannot be shown again, drop the empty box and copy buttons. */
#inviteHeld.is-spent .invite { background: var(--obsidian-1); border-style: solid; }
#inviteHeld.is-spent .label, #inviteHeld.is-spent code, #inviteHeld.is-spent .btn { display: none; }
#inviteHeld.is-spent #inviteMeta { margin-top: 0 !important; color: var(--ink-2); font-size: 0.95rem; }
.chip[hidden] { display: none; }

/* Self-hosted type (SIL OFL 1.1): Source Serif 4, Inter, JetBrains Mono. */
@font-face { font-family: "Source Serif 4"; src: url("/brand/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/brand/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/brand/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/brand/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }
:root {
  --font-display: "Source Serif 4", "Iowan Old Style", "Charter", "Georgia", serif;
  --font-serif:   "Source Serif 4", "Iowan Old Style", "Charter", "Georgia", serif;
  --font-sans:    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "JetBrains Mono", "Cascadia Mono", "Consolas", ui-monospace, monospace;
}
body { font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, .lp-hero__title, .lp-h2, .gate__title, .welcome__title { font-optical-sizing: auto; font-weight: 420; }
.lp-hero__title { font-weight: 400; letter-spacing: -0.035em; }

/* Demo recording caption + pause control, and the retry button inside an error notice. */
.lp-shot figcaption { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.lp-demo__toggle {
  flex: none; min-height: 32px; padding: 4px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--obsidian-2); color: var(--parchment);
  font: 500 0.82rem/1 var(--font-sans);
}
.lp-demo__toggle:hover { border-color: var(--line-strong); }
.notice__action { margin-left: var(--s2); min-height: 32px; padding: 4px 12px; vertical-align: middle; }

/* Rail: New chat + Recent conversations. */
.newchat { justify-content: flex-start; gap: var(--s2); margin-bottom: var(--s3); background: var(--obsidian-2); }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.recent__item {
  width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 7px 10px; border-radius: 8px; min-height: 32px;
  font: 400 0.86rem/1.35 var(--font-sans); color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent__item:hover { background: var(--obsidian-3); color: var(--parchment); }
.recent__item[aria-current="true"] { background: var(--obsidian-3); color: var(--parchment); font-weight: 500; }
.rail__scroll { overflow-y: auto; min-height: 0; }

/* Recent list never scrolls sideways. */
.rail__scroll { overflow-x: hidden; }
.recent { grid-template-columns: minmax(0, 1fr); }
.recent li { min-width: 0; }

/* Phone and small tablet: the rail becomes a two-row app header
   (brand, New chat, Sign out / then the three tabs full width). */
@media (max-width: 900px) {
  .rail {
    display: grid; position: sticky; top: 0; z-index: 30;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "brand new out" "tabs tabs tabs" "usage usage usage";
    gap: var(--s2) var(--s2); padding: var(--s3) var(--s4) var(--s2);
    background: color-mix(in srgb, var(--obsidian-1) 92%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .rail > .brand { grid-area: brand; min-width: 0; }
  .rail .brand__mark { width: 30px; height: 30px; }
  .rail__scroll { display: contents; }
  .newchat { grid-area: new; width: auto; margin: 0; min-height: 40px; padding: 8px 14px; }
  .rail .nav { grid-area: tabs; display: flex; flex-direction: row; gap: 4px; margin: 0; }
  .rail .nav > button, .rail .nav > a:not([hidden]) { flex: 1; justify-content: center; min-height: 40px; font-size: 0.9rem; }
  /* The allowance stays on the phone header: a member on a phone must still see
     what is left today. Only the recent-conversation list is dropped. */
  .rail .nav__group:not(.nav):not(#recentGroup) { display: block; grid-area: usage; grid-column: 1 / -1; margin: 0; }
  .rail .nav__group:not(.nav):not(#recentGroup) .nav__label { display: none; }
  #recentGroup { display: none; }
  .rail__foot { grid-area: out; margin: 0 !important; display: flex !important; }
  .rail__foot #railWaitlist { display: none; }
  .rail__foot .btn { width: auto; min-height: 40px; white-space: nowrap; padding: 8px 10px; }
  .metalines { text-align: left; }
}
@media (max-width: 420px) {
  .rail .nav svg { display: none; }
  .newchat { padding: 8px 10px; }
  /* WCAG 1.4.10 reflow, measured 2026-11-16: at a 320px viewport the header measured 305px
     of client width and the tab row reached x=332, so the page scrolled sideways - the same
     failure you get at 400% zoom on a 1280px screen. Cause: the tabs are `flex: 1` with the
     default `min-width: auto`, so "Invitations" could not shrink below its 94px min-content
     width and four tabs did not fit in 273px. Wrapping keeps every label intact; shrinking and
     truncating would hide text, which is the thing 1.4.10 exists to prevent. */
  .rail .nav { flex-wrap: wrap; }
  .rail .nav > button, .rail .nav > a:not([hidden]) { flex: 1 1 auto; min-width: 0; }
}

/* Reply actions: quiet until you need them. */
.turn__actions { display: flex; gap: 4px; margin-top: var(--s2); margin-left: -10px; }
.turn__act {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  min-height: 30px; padding: 4px 10px; border-radius: 8px;
  font: 500 0.8rem/1 var(--font-sans); color: var(--ink-3);
}
.turn__act:hover { background: var(--obsidian-3); color: var(--parchment); }

/* Reply stats (tokens per second, first token, tokens, estimated cost). */
.turn__actions { align-items: center; flex-wrap: wrap; }
.rstats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.rstat {
  display: inline-flex; flex-direction: row; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border-radius: 999px; border: 1px solid var(--line-soft); background: var(--obsidian-1);
  font: 500 0.76rem/1 var(--font-mono); color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.rstat svg { width: 13px; height: 13px; flex: none; color: var(--gold-dim); }
.stats__more { position: relative; }
.stats__more summary {
  list-style: none; cursor: pointer; height: 26px; padding: 0 10px; display: inline-flex; align-items: center;
  border-radius: 999px; font: 500 0.76rem/1 var(--font-sans); color: var(--ink-3);
}
.stats__more summary::-webkit-details-marker { display: none; }
.stats__more summary:hover, .stats__more[open] summary { background: var(--obsidian-3); color: var(--parchment); }
.stats__pop {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 10; width: min(330px, 84vw);
  padding: var(--s4); background: var(--obsidian-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-pop);
}
.stats__pop dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font: 400 0.82rem/1.4 var(--font-sans); }
.stats__pop dt { color: var(--ink-cap); }
.stats__pop dd { margin: 0; color: var(--parchment); text-align: right; font-variant-numeric: tabular-nums; }
.stats__note { margin: var(--s3) 0 0; padding-top: var(--s3); border-top: 1px solid var(--line-soft); font: 400 0.76rem/1.45 var(--font-sans); color: var(--ink-3); }
.session-cost { margin-top: var(--s2) !important; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .rstats { margin-left: 0; width: 100%; }
  .stats__pop { right: auto; left: 0; }
}

/* Monocle mode picker in the message box. */
.composer__actions { display: flex; align-items: flex-end; gap: var(--s2); }
.modepick { position: relative; }
.modepick summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--obsidian-1); font: 500 0.84rem/1 var(--font-sans); color: var(--ink-2); white-space: nowrap;
}
.modepick summary::-webkit-details-marker { display: none; }
.modepick summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 2px; opacity: .7; }
.modepick summary:hover, .modepick[open] summary { border-color: var(--line-strong); color: var(--parchment); }
.modepick__model { font-weight: 650; color: var(--parchment); }
.modepick__mode { color: var(--gold-dim); }
.modepick__menu {
  position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 40; width: min(330px, 86vw);
  padding: var(--s3); background: var(--obsidian-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop);
}
.modepick__head { margin: 4px 8px var(--s2); font: 650 0.9rem/1.2 var(--font-sans); color: var(--parchment); display: flex; justify-content: space-between; }
.modepick__head span { font-weight: 400; color: var(--ink-cap); font-size: 0.8rem; }
.modepick__opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; cursor: pointer; }
.modepick__opt:hover { background: var(--obsidian-3); }
.modepick__opt input { margin-top: 3px; accent-color: var(--accent-btn); width: 16px; height: 16px; }
.modepick__opt span { font: 400 0.84rem/1.4 var(--font-sans); color: var(--ink-3); }
.modepick__opt b { display: block; font-weight: 600; color: var(--parchment); font-size: 0.9rem; }
.modepick__opt:has(input:checked) { background: var(--obsidian-3); }
.modepick__price { margin: var(--s2) 8px 4px; padding-top: var(--s2); border-top: 1px solid var(--line-soft); font: 400 0.76rem/1.45 var(--font-sans); color: var(--ink-cap); }

/* Live trace: thinking and tool steps above a reply. */
.trace { display: grid; gap: 6px; margin: 2px 0 var(--s3); }
.trace__think summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font: 500 0.84rem/1.3 var(--font-sans); color: var(--ink-3); min-height: 28px;
}
.trace__think summary::-webkit-details-marker { display: none; }
.trace__think summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 140ms ease; }
.trace__think[open] summary::before { transform: rotate(45deg); }
.trace__think summary.is-live { color: var(--gold-dim); }
.trace__think summary.is-live::after { content: ""; width: 34px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.trace__thinktext { margin: 6px 0 4px; padding-left: 12px; border-left: 2px solid var(--line); white-space: pre-wrap; font: 400 0.84rem/1.55 var(--font-sans); color: var(--ink-3); max-height: 260px; overflow: auto; }
.trace__step { display: flex; align-items: center; gap: 8px; min-height: 26px; font: 400 0.84rem/1.3 var(--font-sans); color: var(--ink-3); }
.trace__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.trace__step.is-running .trace__dot { background: var(--gold); animation: pulse 1.1s steps(1, end) infinite; }
.trace__step.is-ok .trace__dot { background: var(--ok); }
.trace__step.is-bad .trace__dot { background: var(--velvet); }
.trace__name { font-weight: 600; color: var(--ink-2); }
.trace__args { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 44ch; }
.trace__ms { margin-left: auto; font: 500 0.74rem/1 var(--font-mono); color: var(--ink-cap); }
.trace__note { font: 400 0.82rem/1.4 var(--font-sans); color: var(--ink-3); }
.turn__pending.is-quiet { display: none; }

/* Fulcrum: next best steps under the newest reply. */
.nextsteps { margin-top: var(--s4); padding: var(--s3); border: 1px solid var(--line-soft); border-radius: 16px; background: var(--obsidian-1); }
.nextsteps__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin: 2px 6px var(--s2); font: 600 0.82rem/1.2 var(--font-sans); color: var(--parchment); }
.nextsteps__by { font-weight: 500; color: var(--ink-cap); font-size: 0.76rem; display: inline-flex; align-items: center; gap: 6px; }
.nextsteps__by.is-fulcrum { color: var(--gold-dim); }
.nextsteps__by.is-fulcrum::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.nextsteps__list { display: grid; gap: 4px; }
.nextsteps__item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  min-height: 40px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent;
  font: 400 0.9rem/1.35 var(--font-sans); color: var(--ink-2);
}
.nextsteps__item:hover { background: var(--obsidian-2); border-color: var(--line); color: var(--parchment); }
.nextsteps__n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--obsidian-3); font: 600 0.74rem/1 var(--font-mono); color: var(--gold-dim); }
.nextsteps__t { flex: 1; min-width: 0; }
.nextsteps__conf { flex: none; width: 42px; height: 4px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; }
.nextsteps__conf::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--conf, 0%); background: var(--gold); border-radius: 4px; }
.nextsteps__skel { height: 40px; border-radius: 10px; background: linear-gradient(90deg, var(--obsidian-2), var(--obsidian-3), var(--obsidian-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .trace__think summary.is-live::after, .nextsteps__skel, .trace__step.is-running .trace__dot { animation: none; }
}
@media (max-width: 760px) {
  .modepick__model { display: none; }
  .modepick__menu { right: -60px; }
}

/* Trace rows never push the page wider than the screen. */
.trace, .trace__step { min-width: 0; max-width: 100%; }
.trace__args { flex: 1 1 auto; max-width: none; }
.trace__thinktext { overflow-wrap: anywhere; }
.turn__body, .turn { min-width: 0; overflow-wrap: anywhere; }

.turn__body .tablewrap { overflow-x: auto; margin: var(--s3) 0; border: 1px solid var(--line); border-radius: 12px; }
.turn__body .tablewrap table { margin: 0; border: 0; }
.turn__body .tablewrap th, .turn__body .tablewrap td { border: 0; border-bottom: 1px solid var(--line-soft); }
.turn__body .tablewrap tr:last-child td { border-bottom: 0; }
.turn__body a { color: var(--gold-dim); text-underline-offset: 2px; }

/* ==========================================================================
   POLISH LAYER (2026-11-16)
   Surgical overrides on top of the warm layer for Claude-level fit & finish.
   Uses only existing tokens — no new hexes, no new HTML.
   Roll back by deleting from this banner to the end of the file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   P1. MOTION FOUNDATIONS
   One duration and one curve for the whole app. 150 ms reads as snappy;
   200 ms keeps flourishes from reading as lag.
   -------------------------------------------------------------------------- */
:root {
  --ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast:  130ms;
  --t-base:  170ms;
}
button, .btn, a, summary { transition-duration: var(--t-fast); }
button:hover, .btn:hover, a:hover { transition-duration: var(--t-fast); }

/* --------------------------------------------------------------------------
   P2. TRANSCRIPT — turn rhythm, bubbles, prose, code blocks
   -------------------------------------------------------------------------- */

/* --- breathing room between turns --- */
.transcript { padding: var(--s6) 0 var(--s7); gap: 0; }

/* --- Assistant turns: no box; just a dot + label + prose on a page --- */
.turn--assistant { margin-bottom: var(--s7); padding-left: 28px; }
.turn--assistant::before {
  width: 8px; height: 8px; top: 2px; left: 4px;
  border-color: var(--velvet); background: var(--velvet);
  opacity: .76; border-width: 1.5px;
}
.turn--assistant .turn__who {
  letter-spacing: 0.14em; font-size: 0.64rem; font-weight: 650;
  color: var(--gold-dim); margin-bottom: var(--s2);
}

/* --- User turns: raised bubble, right-aligned, sans face --- */
.turn--user {
  display: flex; flex-direction: column; align-items: flex-end;
  padding-left: 0; margin-bottom: var(--s5); margin-top: var(--s1);
}
.turn--user::before { display: none; }
.turn--user .turn__who {
  order: -1; margin: 0 var(--s1) 4px 0;
  font-size: 0.62rem; letter-spacing: 0.18em; font-weight: 600;
  color: var(--ink-cap);
}
.turn--user .turn__body {
  max-width: min(38rem, 88%);
  padding: var(--s3) var(--s4);
  background: var(--obsidian-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.06);
  color: var(--parchment);
  font: 400 0.98rem/1.58 var(--font-sans);
}
.turn--user .turn__body p { margin: 0; }
.turn--user .turn__body > *:last-child { margin-bottom: 0; }

/* --- Assistant prose: serif, generous line, colour from ink-2 --- */
.turn--assistant .turn__body {
  font: 400 1.06rem/1.72 var(--font-serif);
  color: var(--ink-2); letter-spacing: 0.001em;
}
.turn__body p { margin: 0 0 0.95em; }
.turn__body > p:last-child { margin-bottom: 0; }
.turn__body ul, .turn__body ol { margin: 0 0 0.95em; padding-left: 1.35em; }
.turn__body li { margin-bottom: 0.38em; }
.turn__body li::marker { color: var(--gold-dim); }

.turn__body h3, .turn__body h4 {
  margin: 1.15em 0 0.35em; font-family: var(--font-display);
  font-weight: 480; line-height: 1.22; letter-spacing: -0.01em;
}
.turn__body h3 { font-size: 1.18rem; }
.turn__body h4 { font-size: 1.02rem; color: var(--ink-2); }

.turn__body blockquote {
  margin: var(--s3) 0; padding-left: var(--s4);
  border-left: 3px solid var(--gold-line);
  color: var(--ink-3); font-style: italic; line-height: 1.65;
}
.turn__body strong { color: var(--parchment); font-weight: 700; }

/* --- Inline code: quiet token surface — warm-wash in both modes --- */
.turn__body code {
  background: color-mix(in srgb, var(--obsidian-3) 90%, var(--gold) 2%);
  border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 1px 5px;
  color: var(--gold-dim); font-size: 0.84em;
}

/* --- Code blocks: inset well, clay left accent, crisp mono --- */
.turn__body pre {
  margin: var(--s4) 0; padding: var(--s4) var(--s5);
  background: var(--obsidian-3);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-line);
  border-radius: 12px;
  overflow-x: auto; max-width: 100%;
  font-family: var(--font-mono); font-size: 0.83rem;
  line-height: 1.6; tab-size: 2;
  color: var(--parchment);
}
.turn__body pre code {
  background: none; border: 0; padding: 0;
  color: inherit; font-size: inherit; line-height: inherit;
}

/* --- Tables: refined header, softer lines --- */
.turn__body .tablewrap { margin: var(--s4) 0; border-radius: 12px; }
.turn__body th {
  background: var(--obsidian-2); border-color: var(--line-soft);
  font-weight: 650; font-size: 0.82rem; letter-spacing: 0.01em;
  padding: 8px 12px;
}
.turn__body td { padding: 7px 12px; border-color: var(--line-soft); }
.turn__body tr:first-child th:first-child { border-radius: 11px 0 0 0; }
.turn__body tr:first-child th:last-child  { border-radius: 0 11px 0 0; }

/* --- Column measure: the chat panel only gets a taller page, so prose
       keeps a comfortable 68–72 character line without touching the
       landing and admin columns, which are tuned separately. --- */
#panelChat .column { max-width: 44rem; }
#panelChat .column { padding-inline: clamp(20px, 4vw, 32px); }

/* --------------------------------------------------------------------------
   P3. STREAMING STATES
   -------------------------------------------------------------------------- */

/* Waiting dots: one hair shorter, clay-coloured, smooth bounce. */
.turn__pending { gap: 5px; font: 400 0.84rem/1.2 var(--font-sans); color: var(--ink-cap); }
.turn__pending i { width: 5px; height: 5px; background: var(--gold-dim); opacity: .55; }

/* Blinking caret: narrower, rounded, soft gold. */
.caret { width: 2px; border-radius: 1px; margin-left: 2px; background: var(--gold-dim); }

/* --------------------------------------------------------------------------
   P4. REPLY ACTIONS + STATS
   -------------------------------------------------------------------------- */

/* Copy / Regenerate: quiet until the turn gets hover or focus. */
.turn__act {
  color: var(--ink-cap); font-size: 0.78rem; min-height: 30px;
  padding: 4px 11px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease);
}
.turn:hover .turn__act,
.turn:focus-within .turn__act { color: var(--ink-3); }
.turn__act:hover { color: var(--parchment); background: var(--obsidian-2); border-color: var(--line); }

/* Stats chip row: tighter spacing, hairline border, tabular goodness. */
.rstats { gap: 5px; }

/* Fulcrum: next best steps — refined with a light clay wash edge. */
.nextsteps { background: var(--obsidian-1); border-radius: 14px; padding: var(--s4); }
.nextsteps__item:hover { background: var(--obsidian-2); border-color: var(--line-soft); }
.nextsteps__item:active { background: var(--obsidian-3); }
.nextsteps__n { background: var(--gold-wash); width: 24px; height: 24px; font-weight: 700; }

/* --------------------------------------------------------------------------
   P5. COMPOSER
   -------------------------------------------------------------------------- */

/* Fade: taller gradient, stronger blur, no top border (blur is the cut). */
.composer {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--obsidian) 0%, transparent) 0%,
    color-mix(in srgb, var(--obsidian) 90%, transparent) 28%,
    var(--obsidian) 64%
  );
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
  backdrop-filter: blur(10px) saturate(1.25);
  border-top-color: transparent;
  padding-top: var(--s4);
}

/* Inner: less vertical padding so the box sits tighter. */
.composer__inner { padding: var(--s2) 0 var(--s5); }

/* Box: slightly larger radius, subtle inset shadow on focus. */
.composer__box {
  border-radius: 18px; padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--obsidian-2); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.03);
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.composer__box:focus-within {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
  box-shadow: 0 0 0 3px var(--gold-wash), 0 10px 28px -20px rgba(20, 20, 19, 0.35);
}

/* Textarea: sans face (clearer for typing), rounded inner edge. */
.composer__box textarea {
  font: 400 1rem/1.55 var(--font-sans);
  min-height: 40px; max-height: 180px; padding: 8px 4px;
  color: var(--parchment);
}
.composer__box textarea::placeholder { color: var(--ink-4); }

/* Send button: warmer clay, tighter pill, distinct disabled state. */
#btnSend { border-radius: 12px; min-height: 38px; padding: 0 14px; gap: 6px; font-size: 0.85rem; }
#btnSend[disabled], #btnSend[aria-disabled="true"] {
  background: var(--obsidian-3); border-color: var(--line);
  color: var(--ink-cap); cursor: not-allowed; opacity: 1;
}

/* Monocle pill: smoother open/close, more breathing room. */
.modepick summary {
  min-height: 38px; padding: 6px 13px; border-radius: 14px;
  font-size: 0.84rem;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.modepick__menu {
  border-radius: 16px; padding: var(--s4);
  box-shadow: var(--shadow-pop);
  min-width: 260px;
}
.modepick__opt:has(input:checked) {
  background: var(--gold-wash);
}
.modepick__opt input { accent-color: var(--gold); }

/* Meta line: tighter, kbd stays a key. */
.composer__meta { margin-top: var(--s2); font-size: 0.73rem; gap: var(--s3); }
.composer__meta kbd {
  font-size: 0.72rem; padding: 1px 5px; border-radius: 4px;
  background: var(--obsidian-3); border: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   P6. RAIL
   -------------------------------------------------------------------------- */

/* New chat: a real secondary-action button — light lift on hover. */
.newchat {
  justify-content: flex-start; gap: var(--s2);
  min-height: 42px; font-weight: 650; font-size: 0.88rem;
  background: var(--obsidian-2); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: var(--s4);
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.newchat:hover { background: var(--obsidian-3); border-color: var(--line-strong); }
.newchat:active { transform: translateY(1px); }
.newchat svg { color: var(--gold-dim); width: 16px; height: 16px; }

/* Nav: slightly taller, fully rounded, inset clay bar on active. */
.nav a, .nav button {
  min-height: 40px; padding: 8px 11px; border-left: 0;
  border-radius: 10px; font-weight: 500; font-size: 0.87rem;
  letter-spacing: 0.005em;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.nav a:hover, .nav button:hover { background: var(--obsidian-2); color: var(--parchment); }
.nav a[aria-current="page"],
.nav button[aria-current="true"] {
  background: var(--obsidian-2); color: var(--parchment); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav svg { width: 17px; height: 17px; opacity: .88; flex: none; }
.nav [aria-current] svg { opacity: 1; color: var(--gold-dim); }

/* Section label: a whisper, not a shout. */
.nav__label { font-size: 0.64rem; letter-spacing: 0.18em; margin-bottom: 7px; color: var(--ink-cap); font-weight: 600; }

/* Recent: relaxed rows, head-mark on active, empty-state hint. */
.recent { gap: 1px; }
.recent__item {
  min-height: 32px; padding: 8px 11px; border-radius: 9px;
  font-size: 0.86rem; color: var(--ink-3);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.recent__item:hover { background: var(--obsidian-2); color: var(--parchment); }
.recent__item[aria-current="true"] {
  background: var(--obsidian-2); color: var(--parchment); font-weight: 500;
  box-shadow: inset 2px 0 0 var(--gold);
}
.recent:empty::after {
  content: "Your past conversations land here.";
  display: block; padding: 6px 11px;
  font: 400 0.82rem/1.4 var(--font-sans); color: var(--ink-cap);
}

/* Scroll: allow air at the bottom of the rail list. */
.rail__scroll { padding-bottom: var(--s3); }

/* Usage block: tighter, mono, progress bar. */
.usage { gap: 6px; }
.usage__n { font-size: 0.92rem; letter-spacing: -0.005em; }
.meter { height: 6px; border-radius: 999px; border: 0; background: color-mix(in srgb, var(--ink-4) 22%, transparent); }
.meter__fill { border-radius: 999px; transition: width 240ms var(--ease); }

/* --------------------------------------------------------------------------
   P7. WELCOME + EMPTY STATE
   -------------------------------------------------------------------------- */
.welcome { padding: var(--s8) 0 var(--s7); }
.welcome__title {
  font-size: clamp(1.8rem, 1.3rem + 1.5vw, 2.2rem);
  letter-spacing: -0.02em; margin: 0 0 var(--s3);
}
.welcome__lead {
  font-size: 0.98rem; line-height: 1.62;
  color: var(--ink-3); max-width: 32rem; margin: 0 auto var(--s6);
}
.welcome__chips { justify-content: center; gap: var(--s2); }
.welcome__chips a {
  font-size: 0.83rem; font-weight: 500;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.welcome__chips a:hover { transform: translateY(-1px); }

/* --- Pamphlet tiles — landing v2/v3 shares these. --- */
.lp-chips a {
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.lp-chips a:hover { transform: translateY(-1px); border-color: var(--line-strong); }

/* --- Agent drawer empty fill --- */
.empty {
  font: 400 0.95rem/1.6 var(--font-serif);
  padding: var(--s7) var(--s4);
  color: var(--ink-cap);
}

/* --------------------------------------------------------------------------
   P8. NOTICES + ERRORS
   -------------------------------------------------------------------------- */
.notice {
  border-radius: 10px; padding: var(--s3) var(--s4);
  border-left-width: 3px; border-left-style: solid;
}
.notice--bad {
  border-color: color-mix(in srgb, var(--velvet) 40%, transparent);
  border-left-color: var(--velvet);
  background: var(--velvet-wash); color: var(--velvet-text);
}
.notice--good {
  background: color-mix(in srgb, var(--ok) 9%, transparent);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  border-left-color: var(--ok);
  color: var(--ok-text);
}
.notice--info { border-left-color: var(--gold); }
.notice__action { min-height: 32px; padding: 4px 13px; border-radius: 8px; font-size: 0.82rem; }

/* --------------------------------------------------------------------------
   P9. TRANSCRIPT + RAIL SCROLLBARS
   -------------------------------------------------------------------------- */
.rail__scroll,
.turn__body pre,
.turn__body .tablewrap {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink-4) 38%, transparent) transparent;
}
.rail__scroll::-webkit-scrollbar,
.turn__body pre::-webkit-scrollbar,
.turn__body .tablewrap::-webkit-scrollbar {
  width: 6px; height: 6px;
}
.rail__scroll::-webkit-scrollbar-thumb,
.turn__body pre::-webkit-scrollbar-thumb,
.turn__body .tablewrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink-4) 38%, transparent);
  border-radius: 999px; border: 1.5px solid transparent;
  background-clip: padding-box;
}
.rail__scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------------------
   P10. REDUCED MOTION + RESPONSIVE
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
  .turn__pending i { animation: none; opacity: .45; }
  .newchat:active, .welcome__chips a:hover, .lp-chips a:hover { transform: none; }
}

@media (max-width: 900px) {
  .turn--user .turn__body { max-width: min(36rem, 94%); }
}

@media (max-width: 560px) {
  .turn--assistant { padding-left: 26px; }
  .turn--assistant::before { left: 2px; width: 7px; height: 7px; }
  .turn--user .turn__body { max-width: 100%; border-radius: 12px 12px 3px 12px; padding: var(--s2) var(--s3); }
  #panelChat .column { padding-inline: var(--s4); }
  .composer { padding-top: var(--s2); }
  .composer__inner { padding: var(--s2) 0 var(--s4); }
  .welcome { padding: var(--s6) 0 var(--s5); }
}

/* ==========================================================================
   §8  Bots — the scheduled-work panel.
   Same obsidian surfaces and gold action as the rest of the app. The list is a
   stack of rows rather than a table, so it survives a narrow rail and a screen
   reader, and each row keeps its own actions reachable by keyboard.
   ========================================================================== */

.botlist, .runs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }

.bot {
  background: var(--obsidian-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s4);
  /* A grid item defaults to min-width:auto, so the track sizes to the widest UNBREAKABLE thing
     inside it. Measured 2026-11-16: a 4000-character instruction written as one word made this
     row 16145px wide and pushed the whole page sideways (scrollWidth 16545 against a 1425px
     viewport). min-width:0 lets the track shrink to its container; the overflow-wrap below
     gives the text somewhere to break. */
  min-width: 0;
}

.bot__head { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }

.bot__name {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--parchment);
  min-width: 0;
  overflow-wrap: anywhere;
}

.bot__meta { margin: var(--s2) 0 0; }

/* Instructions can be long; three lines is enough to recognise the bot. */
.bot__say {
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: 0.9375rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* overflow:hidden clips the box, but without a break opportunity the line itself never
     wraps, so a single long token is what stretches the row. `.run__error` below already had
     this; the bot instruction line was missing it. */
  overflow-wrap: anywhere;
}

.bot__actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

/* The measured cost estimate under the schedule fields. Added in round 11 as a bare .hint, which
   carries `margin: var(--s2) 0 0` - no bottom margin - so it sat flush on the Time zone label
   (0px, against a 24px rhythm everywhere else in the form). It now takes the form's rhythm on
   both sides. */
.bot__cost {
  margin: 0 0 var(--s5);
  max-width: 62ch;
}

/* --- run history --------------------------------------------------------- */

.run { border-left: 2px solid var(--line); padding-left: var(--s3); }

.run__head { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }

.run__error {
  margin: var(--s2) 0 0;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  word-break: break-word;
}

.run__out { margin-top: var(--s2); color: var(--ink-2); font-size: 0.9375rem; }
.run__out p { margin: 0 0 var(--s2); }
.run__out p:last-child { margin-bottom: 0; }
.run__out code { font-family: var(--font-mono); font-size: 0.875em; }

@media (max-width: 560px) {
  .bot { padding: var(--s3); }
  .bot__actions .btn { flex: 1 1 auto; }
}
