/* 519 Tires console. Phone first (375 px), light and dark, accent #FFC107, Bebas Neue headings.
   Each area keeps its terminal colour as an accent (--sec). No inline styles anywhere: CSP style-src 'self'. */

:root {
  --accent: #FFC107;
  --ink: #15181B;
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel-2: #f9f8f5;
  --line: #e2e0d9;
  --text: #15181B;
  --muted: #555b62;
  --faint: #767c83;
  --good: #1b7f45;
  --warn: #9a5b00;
  --bad: #c0262d;
  --focus: #1659c7;
  --accent-text: #7a5c00;
  --sec: var(--accent-text);
  --sec-bg: var(--accent);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 18px rgba(0, 0, 0, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tap: 44px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012; --panel: #16191c; --panel-2: #1b1f23; --line: #2a2f35; --text: #ecebe6; --muted: #aeb3b9;
    --faint: #8b9097; --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --focus: #7aa7ff; --accent-text: #FFC107;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1012; --panel: #16191c; --panel-2: #1b1f23; --line: #2a2f35; --text: #ecebe6; --muted: #aeb3b9;
  --faint: #8b9097; --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --focus: #7aa7ff; --accent-text: #FFC107;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
}

/* Each area's accent is its terminal colour (tui.py SECTIONS / EXTRAS). */
[data-sec="today"]     { --sec: var(--accent-text); --sec-bg: var(--accent); }
[data-sec="stock"]     { --sec: #00727d; --sec-bg: #00acc1; }
[data-sec="sell"]      { --sec: #b0185a; --sec-bg: #ec4899; }
[data-sec="money"]     { --sec: #a14a00; --sec-bg: #f59e0b; }
[data-sec="mail"]      { --sec: #00727d; --sec-bg: #22d3ee; }
[data-sec="assistant"] { --sec: #9d1aa8; --sec-bg: #d946ef; }
[data-sec="shopfloor"] { --sec: #4d7c0f; --sec-bg: #84cc16; }
[data-sec="settings"]  { --sec: #0f766e; --sec-bg: #14b8a6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-sec="stock"], :root:not([data-theme="light"]) [data-sec="mail"] { --sec: #5ee3f0; }
  :root:not([data-theme="light"]) [data-sec="sell"] { --sec: #f9a8d4; }
  :root:not([data-theme="light"]) [data-sec="money"] { --sec: #fdba74; }
  :root:not([data-theme="light"]) [data-sec="assistant"] { --sec: #f0abfc; }
  :root:not([data-theme="light"]) [data-sec="shopfloor"] { --sec: #bef264; }
  :root:not([data-theme="light"]) [data-sec="settings"] { --sec: #5eead4; }
}
:root[data-theme="dark"] [data-sec="stock"], :root[data-theme="dark"] [data-sec="mail"] { --sec: #5ee3f0; }
:root[data-theme="dark"] [data-sec="sell"] { --sec: #f9a8d4; }
:root[data-theme="dark"] [data-sec="money"] { --sec: #fdba74; }
:root[data-theme="dark"] [data-sec="assistant"] { --sec: #f0abfc; }
:root[data-theme="dark"] [data-sec="shopfloor"] { --sec: #bef264; }
:root[data-theme="dark"] [data-sec="settings"] { --sec: #5eead4; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
a { color: var(--focus); }
a:not(.btn):hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .02em; line-height: 1.05; margin: 0; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--ink); padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.noscript { padding: 2rem; text-align: center; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ── brand ─────────────────────────────────────────────────────────────── */
.brand, .brand-lg { font-family: var(--display); letter-spacing: .03em; color: var(--text); text-decoration: none; }
.brand { font-size: 1.7rem; line-height: 1; white-space: nowrap; }
.brand b, .brand-lg b { color: var(--ink); background: var(--accent); padding: 0 .18em; border-radius: 3px; font-weight: 400; }
.brand-lg { font-size: 3.2rem; }

/* ── sign in ───────────────────────────────────────────────────────────── */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.signin-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-top: 6px solid var(--accent);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); display: grid; gap: .5rem;
}
.signin-card label { font-weight: 600; margin-top: .4rem; }

/* ── shell ─────────────────────────────────────────────────────────────── */
.shell { min-height: 100vh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem;
  padding-top: calc(.5rem + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar { flex-wrap: wrap; }
.search { position: relative; flex: 1 1 100%; min-width: 0; order: 3; }
.topbar .pill { margin-left: auto; }
.search input { width: 100%; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; z-index: 30; padding: .25rem;
}
.search-results h4 { margin: .6rem .5rem .2rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.result {
  display: flex; gap: .6rem; align-items: baseline; width: 100%; text-align: left; padding: .55rem .6rem; border: 0;
  background: none; color: var(--text); font: inherit; border-radius: 8px; cursor: pointer; min-height: var(--tap);
}
.result:hover, .result[aria-selected="true"] { background: var(--panel-2); }
.result .r-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.kbd-hint { display: none; }
.pill {
  font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .55rem;
  white-space: nowrap; background: var(--panel-2);
}
.pill.bad { color: var(--bad); border-color: currentColor; }
.pill.good::before { content: "● "; color: var(--good); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav a, .nav-more-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px;
  color: var(--muted); text-decoration: none; font: 600 .8rem var(--font); background: none; border: 0; cursor: pointer;
}
.nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 3px 0 var(--sec-bg); }
.nav .key { display: none; }
.nav .nav-more { display: none; }
.more-sheet {
  position: fixed; left: .5rem; right: .5rem; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 26;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; padding: .25rem;
}
.more-sheet a { padding: .9rem 1rem; color: var(--text); text-decoration: none; font-weight: 600; border-radius: 8px; }
.more-sheet a:hover { background: var(--panel-2); }

.main { padding: .75rem; max-width: 1280px; margin: 0 auto; outline: none; min-width: 0; width: 100%; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: auto 1fr; padding-bottom: 0; }
  .topbar { grid-column: 1 / -1; }
  .nav {
    position: sticky; top: 61px; align-self: start; grid-template-columns: none; display: flex; flex-direction: column;
    height: calc(100vh - 57px); border-top: 0; border-right: 1px solid var(--line); padding: .75rem .5rem;
  }
  .nav a, .nav .nav-more {
    display: flex; flex-direction: row; justify-content: flex-start; gap: .6rem; min-height: 42px; padding: 0 .75rem;
    font-size: .95rem; border-radius: 8px;
  }
  .nav a:hover { background: var(--panel-2); color: var(--text); }
  .nav a[aria-current="page"] { background: var(--panel-2); box-shadow: inset 4px 0 0 var(--sec-bg); }
  .nav .key {
    display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border: 1px solid var(--line);
    border-radius: 5px; font: .72rem var(--mono); color: var(--faint);
  }
  .nav .key:empty { visibility: hidden; }
  .nav-more-btn, .more-sheet { display: none !important; }
  .btn.kbd-hint { display: inline-flex; }
  .topbar { flex-wrap: nowrap; }
  .search { order: 0; flex: 1 1 auto; }
  .topbar .pill { margin-left: 0; }
  .main { padding: 1.25rem 1.5rem; }
}

/* ── page furniture ────────────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; margin: .25rem 0 .75rem; }
.page-head h1 { color: var(--text); border-bottom: 4px solid var(--sec-bg); padding-bottom: .1rem; }
.page-head .sub { color: var(--muted); flex: 1 1 260px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin: 0 0 .75rem; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a {
  padding: .6rem .8rem; white-space: nowrap; color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; min-height: var(--tap); display: flex; align-items: center;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--sec-bg); }
.tabs a .later { font-weight: 400; font-size: .75rem; color: var(--faint); margin-left: .35rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.toolbar > input, .toolbar > select { width: auto; }
.toolbar .grow { flex: 1 1 220px; min-width: 0; }
.toolbar:empty { display: none; }
.summary { color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.notice {
  border: 1px solid var(--line); border-left: 4px solid var(--warn); background: var(--panel); padding: .6rem .8rem;
  border-radius: 8px; margin: .5rem 0 .75rem;
}
.notice.bad { border-left-color: var(--bad); }
.notice.good { border-left-color: var(--good); }
.empty { color: var(--muted); padding: 1.5rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.loading { color: var(--faint); padding: 1rem; }

/* ── controls ──────────────────────────────────────────────────────────── */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  min-height: var(--tap); padding: .5rem .65rem; width: 100%;
}
textarea { min-height: 5rem; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; min-height: 0; accent-color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--tap);
  padding: .45rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); color: var(--ink); border-color: #e0a800; }
.btn.primary:hover { background: #ffcd38; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { min-height: 34px; padding: .25rem .6rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: .3rem .75rem;
  font: 600 .82rem var(--font); cursor: pointer; min-height: 34px;
}
.chip[aria-pressed="true"] { background: var(--sec-bg); color: var(--ink); border-color: var(--sec-bg); }
.field { display: grid; gap: .25rem; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small { color: var(--muted); }
.field .req { color: var(--bad); }
.grid-form { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-form.two { grid-template-columns: 1fr 1fr; } .grid-form .full { grid-column: 1 / -1; } }
.form-error { color: var(--bad); font-weight: 600; }

/* ── cards and lists ───────────────────────────────────────────────────── */
.cards { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1180px) { .cards.three { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem;
  box-shadow: var(--shadow); min-width: 0;
}
.card > h2, .card > h3 { margin-bottom: .45rem; display: flex; align-items: baseline; gap: .5rem; }
.card > h2 .count, .card > h3 .count { font: 600 .85rem var(--font); color: var(--muted); }
.card.span { grid-column: 1 / -1; }
.card-accent { border-top: 4px solid var(--sec-bg); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: .25rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.big { font: 400 2rem var(--display); letter-spacing: .02em; }

.rows { display: grid; gap: .4rem; }
.row {
  display: grid; gap: .1rem .75rem; grid-template-columns: 1fr auto; align-items: center; padding: .6rem .7rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none;
  min-height: var(--tap);
}
a.row:hover, button.row:hover { border-color: var(--sec-bg); }
button.row { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.row .r-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r-sub { color: var(--muted); font-size: .88rem; grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; }
.row .r-side { text-align: right; white-space: nowrap; }
.row .r-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }

table.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.table th button { all: unset; cursor: pointer; }
.table th button:focus-visible { outline: 3px solid var(--focus); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--panel-2); }
.table td.num, .table th.num { text-align: right; }
.table-wrap { overflow-x: auto; }
.only-wide { display: none; }
@media (min-width: 900px) { .only-wide { display: block; } .only-narrow { display: none; } }

.badge {
  display: inline-block; padding: .05rem .45rem; border-radius: 5px; font: 700 .72rem var(--font); letter-spacing: .04em;
  border: 1px solid currentColor; white-space: nowrap; text-transform: uppercase;
}
.badge.good { color: var(--good); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.badge.dim, .badge.n { color: var(--muted); }
.age { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .3rem; vertical-align: middle; background: var(--age, #888); }
.tone-good { color: var(--good); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.photo { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); display: grid; min-width: 0; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo .none { aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--faint); }
.photo .cap { display: flex; justify-content: space-between; align-items: center; padding: .35rem .5rem; gap: .3rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.section-title { font: 700 .78rem var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1rem 0 .4rem; }

/* the deal letterhead (offers.deal_lines) */
.letter { font-family: var(--mono); font-size: .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.letter .head { font: 400 1.5rem var(--display); letter-spacing: .03em; }
.letter .stock { font: 400 2.2rem var(--display); }
.letter .title { font-weight: 700; }
.letter .hero { font-weight: 700; color: var(--good); }
.letter .warn { color: var(--warn); }
.letter .dim, .letter .notehead { color: var(--muted); }
.letter .note { color: var(--focus); }
.letter .link { color: var(--focus); }

/* the calendar */
.week { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem; min-height: 6rem; }
.day.today { border-color: var(--sec-bg); box-shadow: inset 0 3px 0 var(--sec-bg); }
.day h3 { font-size: 1.1rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .1rem .3rem; }
.day .hours { font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
.appt { border: 1px solid var(--line); border-left: 4px solid var(--sec-bg); border-radius: 7px; padding: .4rem .5rem; margin: .35rem 0; background: var(--panel-2); }
.appt.done { border-left-color: var(--good); opacity: .8; }
.appt.noshow, .appt.cancelled { border-left-color: var(--faint); opacity: .65; }
.appt .t { font-weight: 700; }
.appt ul { margin: .25rem 0 0 1rem; padding: 0; font-size: .85rem; }

/* ── modal (every change previews here) ───────────────────────────────── */
.backdrop { position: fixed; inset: 0; background: rgba(10, 12, 14, .55); z-index: 50; display: grid; place-items: end center; }
@media (min-width: 640px) { .backdrop { place-items: center; } }
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--panel); color: var(--text);
  border-radius: 14px 14px 0 0; box-shadow: var(--shadow); padding: 1.1rem 1.1rem calc(1rem + env(safe-area-inset-bottom));
  border-top: 6px solid var(--accent);
}
@media (min-width: 640px) { .modal { border-radius: 14px; } }
.modal.danger { border-top-color: var(--bad); }
.modal h2 { margin-bottom: .6rem; }
.modal .sentence { font-size: 1.12rem; font-weight: 600; line-height: 1.4; margin: .4rem 0 .8rem; overflow-wrap: anywhere; }
.modal .effects { margin: 0 0 .8rem 1.1rem; padding: 0; color: var(--muted); }
.modal .foot { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.modal .foot .btn { flex: 1 1 140px; }
.modal .result { padding: .6rem .7rem; border-radius: 8px; background: var(--panel-2); margin: .5rem 0; overflow-wrap: anywhere; }
.modal .result.bad { color: var(--bad); }
.modal .result.good { color: var(--good); }
.modal .result.warn { color: var(--warn); }

/* ── money and the back office (phase 3) ─────────────────────────────── */
.kv.fin { grid-template-columns: 1fr max-content; }
.kv.fin dt.sub, .kv.fin dd.sub { color: var(--faint); font-size: .9rem; padding-left: .9rem; }
.kv.fin dd { text-align: right; }
.catbars { display: grid; gap: .5rem; }
.catbar { display: grid; grid-template-columns: 1fr max-content; gap: .15rem .75rem; align-items: baseline; }
.catbar .barline { grid-column: 1 / -1; width: 100%; height: 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { font: 600 11px var(--font); fill: var(--faint); }
.bar.money { fill: var(--sec-bg); }
.bar.out { fill: #ec4899; }
.bar.in { fill: #84cc16; }
.legend { color: var(--muted); font-size: .85rem; margin-bottom: .25rem; }
.legend .key { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -.1rem; }
.legend .key.out { background: #ec4899; }
.legend .key.in { background: #84cc16; }
.stats { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: .5rem 0 .9rem; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius);
  padding: .6rem .75rem; display: grid; gap: .1rem; min-width: 0; box-shadow: var(--shadow);
}
.stat .s-label { font: 700 .72rem var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat .s-value { font: 400 1.9rem/1.05 var(--display); letter-spacing: .02em; overflow-wrap: anywhere; }
.stat .s-note { color: var(--faint); font-size: .82rem; }
.stat.c-gold { border-top-color: #f59e0b; } .stat.c-green { border-top-color: #22c55e; } .stat.c-red { border-top-color: #ef4444; }
.stat.c-pink { border-top-color: #ec4899; } .stat.c-cyan { border-top-color: #06b6d4; } .stat.c-orange { border-top-color: #f97316; }
.stat.c-lime { border-top-color: #84cc16; } .stat.c-faint { border-top-color: var(--line); }
.tone-red { color: var(--bad); } .tone-orange { color: var(--warn); } .tone-green { color: var(--good); } .tone-faint { color: var(--faint); }
.tone-acc { color: var(--sec); }
pre.report {
  font: .82rem/1.45 var(--mono); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem 1rem; overflow-x: auto; white-space: pre; margin-top: .5rem;
}
pre.report.prose { white-space: pre-wrap; font-family: var(--font); font-size: .95rem; }
.pre { white-space: pre-wrap; }
.card.wide { grid-column: 1 / -1; }
.transcript { display: grid; gap: .6rem; margin: .5rem 0 1rem; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; min-width: 0; }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.msg .who { font: 700 .72rem var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: .2rem; }
.msg.you { border-left: 4px solid var(--sec-bg); }
.msg.tool, .msg.decision { background: none; border-style: dashed; color: var(--faint); font-size: .88rem; }
.msg.queued { border-left: 4px solid var(--warn); }
.msg.error { border-left: 4px solid var(--bad); }

.composer { display: grid; gap: .5rem; margin-top: .9rem; }
.composer textarea {
  width: 100%; min-height: 4.5rem; resize: vertical; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem;
}
.composer textarea:disabled { opacity: .6; }

/* the command box */
.palette { max-width: 640px; border-top-color: var(--ink); }
.palette input { font-size: 1.05rem; }
.palette ul { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 55vh; overflow: auto; }
.palette li button {
  width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .7rem; border: 0;
  border-radius: 8px; background: none; color: var(--text); font: inherit; cursor: pointer; min-height: var(--tap);
}
.palette li button[aria-selected="true"], .palette li button:hover { background: var(--panel-2); }
.palette .where { color: var(--faint); font-size: .85rem; white-space: nowrap; }

/* toasts */
.toasts { position: fixed; z-index: 60; left: .75rem; right: .75rem; bottom: calc(72px + env(safe-area-inset-bottom)); display: grid; gap: .4rem; pointer-events: none; }
@media (min-width: 900px) { .toasts { left: auto; right: 1.25rem; bottom: 1.25rem; width: 420px; } }
.toast {
  pointer-events: auto; background: var(--ink); color: #f5f4ef; border-radius: 10px; padding: .7rem .9rem;
  box-shadow: var(--shadow); border-left: 5px solid var(--accent); overflow-wrap: anywhere;
}
.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }
.toast.warn { border-left-color: #fbbf24; }

@media print {
  .topbar, .nav, .toasts, .more-sheet, .btn, .toolbar { display: none !important; }
  .shell { display: block; }
}
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: rise .14s ease-out; }
  @keyframes rise { from { transform: translateY(12px); opacity: .6; } to { transform: none; opacity: 1; } }
}
