/* Otto Draft Viewer. Tokens and measurements follow archive/design/otto-viewer/README.md. */
:root {
  --ink: #17191e;
  --ink-2: #4a515c;
  --ink-3: #6b7280;
  --quiet: #8a909a;
  --quieter: #a0a5ad;
  --line: #e5e7eb;
  --row: #eef0f2;
  --control: #d9dce1;
  --timeline: #e1e4e8;
  --subtle: #fafafb;
  --subtle-2: #f7f8f9;
  --track: #f1f2f4;
  --code-light: #f4f5f7;
  --code-dark: #16181d;
  --code-dark-ink: #d6dae0;
  --accent: oklch(0.48 0.13 255);
  --select: oklch(0.95 0.025 255);
  --select-2: oklch(0.94 0.03 255);
  --good: oklch(0.47 0.12 150);
  --good-bg: oklch(0.95 0.04 150);
  --warn: oklch(0.5 0.12 65);
  --warn-bg: oklch(0.95 0.05 80);
  --bad: oklch(0.5 0.17 25);
  --bad-bg: oklch(0.95 0.035 25);
  --bad-tint: oklch(0.97 0.02 25);
  --neutral: #5f656e;
  --neutral-bg: #eef0f2;
  --pending: oklch(0.48 0.13 255);
  --pending-bg: oklch(0.95 0.03 255);
  --asked: oklch(0.5 0.14 295);
  --asked-bg: oklch(0.95 0.035 295);
  --note-bg: oklch(0.97 0.035 90);
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #eceef1;
  font-family: Geist, system-ui, sans-serif;
  color: var(--ink);
  font-size: 13px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* List cells, steps, and index items are links that look like their surroundings. */
a:where(.c, .step, .ix), a:where(.c, .step, .ix):hover { color: var(--ink); text-decoration: none; }
.mono { font-family: var(--mono); }
.page { padding: 20px 24px 32px; }
.crumb { font-size: 12.5px; margin: 0 2px 10px; }
.card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 99px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  color: var(--c); background: var(--bg);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.pill.big { font-size: 12.5px; padding: 3px 10px 3px 8px; }
.s-good { --c: var(--good); --bg: var(--good-bg); }
.s-warn { --c: var(--warn); --bg: var(--warn-bg); }
.s-bad { --c: var(--bad); --bg: var(--bad-bg); }
.s-neutral { --c: var(--neutral); --bg: var(--neutral-bg); }
.s-asked { --c: var(--asked); --bg: var(--asked-bg); }
.s-active { --c: var(--good); --bg: var(--good-bg); }
.s-pending { --c: var(--pending); --bg: var(--pending-bg); }
.s-closed { --c: var(--neutral); --bg: var(--neutral-bg); }
.s-spam { --c: var(--bad); --bg: var(--bad-tint); }
.pill.s-deleted { --c: #fff; --bg: #16181d; color: #fff; }
.s-later { --c: var(--warn); --bg: var(--warn-bg); }
.via { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; }
.tone-good { color: var(--good); }
.tone-bad { color: var(--bad); font-weight: 600; }
.tone-neutral { color: var(--ink-3); }

/* ---- Session list ---- */
.list-head { padding: 22px 26px 14px; display: flex; flex-direction: column; gap: 14px; }
.title-row { display: flex; align-items: center; gap: 12px; }
.logo { width: 48px; height: 48px; }
.title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.menu { margin-left: auto; position: relative; }
.menu summary {
  list-style: none; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 6px; color: var(--ink-3); cursor: pointer;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--track); color: var(--ink); }
.menu-items {
  position: absolute; right: 0; top: 36px; z-index: 10; min-width: 140px; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}
.menu-items button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 5px;
  background: none; font: 13px Geist, system-ui, sans-serif; color: var(--ink); cursor: pointer;
}
.menu-items button:hover, .menu-items a:hover { background: var(--subtle-2); text-decoration: none; }
.menu-items a { display: block; padding: 7px 10px; border-radius: 5px; color: var(--ink); }
.menu-items form { margin: 0; }

/* ---- Sign in ---- */
.login {
  max-width: 380px; margin: 12vh auto 0; padding: 26px;
  display: flex; flex-direction: column; gap: 14px;
}
.login label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; color: var(--ink-3); }
.login .search { flex: none; width: 100%; }
.login .btn.primary { height: 34px; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 13px; }
.login-error { margin: 0; color: var(--bad); }
.count { font-size: 13px; color: var(--ink-3); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  flex: 1 1 320px; min-width: 0; height: 34px; padding: 0 12px;
  border: 1px solid var(--control); border-radius: 7px;
  font: 13px Geist, system-ui, sans-serif; color: var(--ink);
}
.search::placeholder { color: var(--quiet); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; flex-basis: 100%; min-width: 0; }
.chip-row { display: flex; gap: 4px; padding: 3px; background: var(--track); border-radius: 8px; align-items: center; overflow-x: auto; max-width: 100%; }
.chips { column-gap: 24px; }
.chip-group { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.chip-row { min-width: 0; }
.chip span { white-space: nowrap; }
@media (max-width: 600px) { .chips-label { display: none; } }
.chips-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 6px; font-size: 12.5px; font-weight: 500; color: #4a515c; cursor: pointer;
}
.chip input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-weight: 400; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.select {
  height: 34px; padding: 0 10px; border: 1px solid var(--control); border-radius: 7px;
  font: 13px Geist, system-ui, sans-serif; color: var(--ink-2); background: #fff;
}
.scroll-x { overflow-x: auto; }
.grid {
  display: grid;
  grid-template-columns: 96px 92px 108px 70px 150px minmax(240px, 1fr) 150px 66px 120px 90px;
  font-size: 13px;
  min-width: 1182px;
}
.grid > .r, .rows-body, .rows-body > .r { display: contents; }
.grid .c { padding: 11px 10px; border-bottom: 1px solid var(--row); min-width: 0; }
.grid .c:first-child { padding-left: 26px; }
.grid .c:last-child { padding-right: 26px; }
.grid .h .c { padding-top: 8px; padding-bottom: 8px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); border-bottom-color: var(--line); }
.grid .num { text-align: right; font-family: var(--mono); font-size: 12px; }
.grid .h .num { font-family: inherit; font-size: 11.5px; }
.grid .row .c { cursor: pointer; }
.grid .row:hover .c { background: var(--subtle); }
.grid .day {
  grid-column: 1 / -1; padding: 14px 26px 6px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em;
  background: var(--subtle); border-bottom: 1px solid var(--row);
}
.grid .day-label { grid-column: 1 / span 8; display: flex; gap: 10px; align-items: baseline; }
.grid .day-n { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.grid .day-num {
  grid-column: auto; padding: 14px 10px 6px; text-align: right; font-family: var(--mono);
  font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; white-space: nowrap;
}
.grid .day-tokens { text-align: left; }
.grid .day-cost { padding-right: 26px; }
.grid .day-cost .l2 { color: var(--ink-3); font-weight: 400; }
.customer { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.status-cell { padding-top: 9px !important; }
.ticket { font-family: var(--mono); font-size: 12px; }
.subject { padding-top: 10px !important; display: flex; flex-direction: column; gap: 3px; }
.subject .s1 { color: inherit; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.nosubj { color: var(--quiet); font-weight: 400; }
.subject .s2 { display: flex; gap: 8px; align-items: baseline; font-size: 12px; min-width: 0; }
.topic { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); flex: none; }
.reason { color: var(--c); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox, .model { color: var(--ink-2); }
.model { font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: 3px; }
.grid .row .stack { padding-top: 10px; }
.grid .row .stack .l2 { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.grid .h .stack { gap: 2px; }
.mode { font-size: 12px; font-weight: 500; color: var(--neutral); }
.mode.live { color: var(--accent); }
.slash { color: var(--quieter); }
.list-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 26px; font-size: 12px; color: var(--ink-3);
}
.pager { display: flex; gap: 6px; }
.btn {
  border: 1px solid var(--control); border-radius: 6px; background: #fff;
  padding: 4px 10px; font: 500 12px Geist, system-ui, sans-serif; color: var(--accent); cursor: pointer;
}
.btn[disabled] { color: var(--quieter); cursor: default; }
.empty { grid-column: 1 / -1; padding: 24px 26px; color: var(--ink-3); }

/* ---- Session view ---- */
.session {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  position: relative; overflow: visible;
}
.thread { padding: 26px 32px; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); min-width: 0; }
.shead { display: flex; flex-direction: column; gap: 6px; }
.shead .top { display: flex; gap: 10px; align-items: baseline; }
.shead .subj { font-size: 22px; font-weight: 600; }
.shead .hs { font-family: var(--mono); font-size: 13px; }
.shead .pills { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.shead .via { margin-top: 0; }
.meta { font-size: 12.5px; color: var(--ink-2); }
.item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600;
  background: #e3e6ea; color: var(--ink-2);
}
.avatar.otto { overflow: hidden; }
.avatar.otto img { width: 100%; height: 100%; object-fit: cover; }
.byline { font-size: 13px; }
.byline b { font-weight: 600; }
.byline span { color: var(--ink-3); }
.msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.body { font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.body p { margin: 0 0 .7em; }
.note { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--note-bg); border-radius: 8px; min-width: 0; }
.note .byline span { color: #6b5d3a; }
.note .body { font-size: 13.5px; line-height: 1.5; }
.draft { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1.5px dashed #c4c8ce; border-radius: 8px; min-width: 0; }
.runsep { font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; padding-top: 4px; }
.rail { background: var(--subtle); padding: 22px 16px 26px; display: flex; flex-direction: column; min-width: 0; border-radius: 0 8px 8px 0; }
.run-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 12px; }
.run-head + .run-head, .step + .run-head { padding-top: 14px; }
.run-head b { font-size: 13px; font-weight: 600; }
.run-head a { font-size: 12px; }
.run-head .figures { font-size: 12px; color: var(--ink-3); }
.step {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding: 0 8px;
  border-radius: 8px; cursor: pointer;
}
.step:hover { box-shadow: inset 0 0 0 1px #dfe2e6; }
.step.sel { background: var(--select); }
.tl { display: flex; flex-direction: column; align-items: center; }
.tl .dot { width: 9px; height: 9px; margin-top: 12px; border-radius: 50%; background: #b8bdc5; box-shadow: 0 0 0 3px var(--subtle); }
.step.sel .tl .dot { box-shadow: 0 0 0 3px var(--select); }
.tl .dot.good { background: var(--good); }
.tl .dot.bad { background: var(--bad); }
.tl .line { flex: 1; width: 1.5px; background: var(--timeline); }
.step .txt { padding: 7px 0 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step .fnl { font-family: var(--mono); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnl .fn { font-weight: 500; }
.fnl .args { color: var(--ink-3); }
.step .res { font-size: 12px; }
.say {
  margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--ink);
  padding: 7px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Step popover */
.pop {
  position: absolute; right: 414px; width: 560px; z-index: 5; background: #fff;
  border: 1px solid var(--control); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(15, 20, 30, .18), 0 2px 6px rgba(15, 20, 30, .08);
  padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px;
  max-height: 80vh; overflow: auto;
}
.pop[hidden] { display: none; }
.pop .arrow {
  position: absolute; right: -7px; width: 12px; height: 12px; background: #fff;
  border-top: 1px solid var(--control); border-right: 1px solid var(--control); transform: rotate(45deg);
}
#pop-body { display: flex; flex-direction: column; gap: 12px; }
.pop-bar { display: flex; align-items: center; gap: 10px; }
.pop-bar .where { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.pop-bar .btns { margin-left: auto; display: flex; gap: 4px; }
.pop-bar button {
  cursor: pointer; width: 28px; height: 28px; border: 1px solid var(--control); border-radius: 6px;
  background: #fff; color: var(--ink-2); font: 500 13px Geist, system-ui, sans-serif;
}
.pop-bar button[disabled] { color: var(--quieter); cursor: default; }
.pop .call { font-family: var(--mono); font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.call .paren { color: var(--quiet); font-weight: 400; }
.call .args { color: var(--ink-2); font-weight: 400; }
.sect { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.label.tone-bad { color: var(--bad); }
.label.tone-good { color: var(--good); }
pre.code {
  margin: 0; padding: 10px 12px; border-radius: 7px; font: 12px/1.6 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}
.dark pre.code { background: var(--code-dark); color: var(--code-dark-ink); }
.light pre.code { background: var(--code-light); color: var(--ink); border-radius: 6px; }
.light pre.code.err { background: var(--bad-tint); }
.after { font-size: 13.5px; line-height: 1.5; padding: 10px 14px; background: var(--subtle-2); border-radius: 7px; white-space: pre-wrap; }
.block .more { margin-top: 6px; }
.block .full { display: none; }
.block.open .full { display: block; }
.block.open .short { display: none; }
.result-img { max-width: 100%; border-radius: 6px; border: 1px solid var(--line); }

/* ---- Raw view ---- */
.raw-top { display: flex; align-items: baseline; gap: 10px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.raw-top b { font-size: 15px; font-weight: 600; }
.raw-top .id { font-family: var(--mono); font-size: 12.5px; }
.raw-top a:last-child { margin-left: auto; font-size: 12.5px; }
.raw { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 110px); }
.index { background: var(--subtle); border-right: 1px solid var(--line); padding: 10px 0; overflow-y: auto; border-radius: 0 0 0 8px; }
.ix {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 8px; gap: 6px; align-items: center;
  padding: 6px 16px; font-size: 12px; cursor: pointer;
}
.ix:hover { background: #f1f2f4; }
.ix.sel { background: var(--select-2); }
.ix .no { font-family: var(--mono); font-size: 11px; color: var(--quieter); }
.ix .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.ix .what.tool { font-family: var(--mono); font-size: 11.5px; color: var(--ink); }
.ix .what.tool.bad { color: var(--bad); }
.ix .role { font-weight: 600; }
.ix .role.otto { color: oklch(0.45 0.13 255); }
.ix .flag { width: 7px; height: 7px; border-radius: 50%; }
.ix .flag.bad { background: var(--bad); }
.stream { overflow-y: auto; position: relative; }
.entry { padding: 18px 28px 20px; border-bottom: 1px solid var(--row); display: flex; flex-direction: column; gap: 10px; }
.entry-head { display: flex; align-items: baseline; gap: 10px; }
.chipno {
  font: 500 11px var(--mono); padding: 2px 7px; border-radius: 5px;
  background: var(--row); color: var(--ink-2);
}
.entry.cur .chipno { background: var(--ink); color: #fff; }
.entry-head .t { font-family: var(--mono); font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.entry-head .t.role { font-family: inherit; font-size: 14px; font-weight: 600; }
.entry-head .m { margin-left: auto; font-size: 11.5px; color: var(--quiet); white-space: nowrap; }
.entry .text { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; max-width: 700px; overflow-wrap: anywhere; }
.end { height: 640px; padding: 18px 28px; color: var(--quiet); font-size: 12px; }

@media (max-width: 900px) {
  .page { padding: 12px 16px 24px; }
  .session { grid-template-columns: minmax(0, 1fr); }
  .thread { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 16px; }
  .rail { border-radius: 0 0 8px 8px; }
  .pop { position: fixed; left: 16px; right: 16px; width: auto; top: 16px !important; bottom: auto !important; }
  .pop .arrow { display: none; }
  .raw { grid-template-columns: minmax(0, 1fr); height: auto; }
  .index { display: none; }
  .stream { overflow: visible; }
}

.delete-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 12px; border: 1px solid #e8b4b4; border-radius: 8px; background: #fdf3f3; }
.delete-bar form { margin: 0; }
.btn.danger { color: #a12a2a; border-color: #e0a3a3; }
.body blockquote { margin: 4px 0 4px 2px; padding: 2px 0 2px 12px; border-left: 3px solid var(--line); color: var(--ink-2); font-style: italic; white-space: pre-wrap; }

/* ---- Metrics ---- */
.metrics { padding: 0 26px 26px; display: flex; flex-direction: column; gap: 26px; }
.m-section { min-width: 0; }
.m-scroll { overflow-x: auto; }
.m-section h2 {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-2); margin: 0 0 10px;
}
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.m-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 12px; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.m-card.wide { grid-column: 1 / -1; }
.m-title { font-weight: 600; font-size: 13px; }
.m-value { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.m-caption { color: var(--ink-3); font-size: 12px; line-height: 1.45; }
.m-empty { color: var(--quiet); font-size: 12px; padding: 18px 0; }
.chart { width: 100%; height: auto; margin-top: 6px; overflow: visible; }
.chart text { font: 10.5px var(--mono); fill: var(--quiet); }
.chart .grid { stroke: var(--row); stroke-width: 1; }
.chart polyline { stroke-width: 1.8; stroke-linejoin: round; }
.m-card.wide .chart { max-height: 220px; }
.only-narrow { display: none; }
.chart polygon { stroke: none; }
.chart .guide { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; padding: 6px 9px; border-radius: 6px;
  background: var(--code-dark); color: var(--code-dark-ink); font-size: 11.5px; line-height: 1.5;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18); max-height: calc(100vh - 8px); overflow: hidden;
}
.chart-tip-head { font-weight: 600; margin-bottom: 2px; }
.chart-tip div:not(.chart-tip-head) { display: flex; align-items: center; gap: 6px; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip b { margin-left: auto; padding-left: 14px; font-weight: 500; font-family: var(--mono); }
.chart text.right { text-anchor: start; }
.m-ranges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.m-ranges input { position: absolute; opacity: 0; pointer-events: none; }
.m-ranges label {
  font: 11.5px var(--mono); color: var(--ink-3); padding: 2px 8px; border: 1px solid var(--line);
  border-radius: 5px; cursor: pointer;
}
.m-ranges input:checked + label { background: var(--subtle-2); color: var(--ink); border-color: var(--ink-3); }
.m-ranges input:focus-visible + label { outline: 2px solid var(--accent); }
.m-panes { flex-basis: 100%; }
.m-pane { display: none; }
.m-ranges input:nth-of-type(1):checked ~ .m-panes .m-pane:nth-child(1) { display: block; }
.m-ranges input:nth-of-type(2):checked ~ .m-panes .m-pane:nth-child(2) { display: block; }
.m-ranges input:nth-of-type(3):checked ~ .m-panes .m-pane:nth-child(3) { display: block; }
.m-ranges input:nth-of-type(4):checked ~ .m-panes .m-pane:nth-child(4) { display: block; }
.m-ranges input:nth-of-type(5):checked ~ .m-panes .m-pane:nth-child(5) { display: block; }
.m-ranges input:nth-of-type(6):checked ~ .m-panes .m-pane:nth-child(6) { display: block; }
.m-ranges input:nth-of-type(7):checked ~ .m-panes .m-pane:nth-child(7) { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-3); }
.legend span, .pie li { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .pie li i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.pie { display: flex; align-items: center; gap: 18px; margin-top: 6px; }
.pie svg { width: 120px; height: 120px; flex: none; }
.pie path, .pie circle { stroke-width: 16; }
.pie ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 12px; }
.pie li span { color: var(--ink-2); }
.pie li b { font: 500 11.5px var(--mono); }
.pie li em { font: 11.5px var(--mono); color: var(--quiet); font-style: normal; }
.barlist { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.bl-row { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 10px; align-items: center; font-size: 12px; }
.bl-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.bl-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bl-track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bl-value { font: 11.5px var(--mono); color: var(--ink-3); white-space: nowrap; }
.m-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.m-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 11.5px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.m-table td { padding: 4px 6px; border-bottom: 1px solid var(--row); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.m-table th:not(:first-child), .m-table td:not(:first-child) { text-align: right; white-space: nowrap; word-break: normal; }
.m-quiet { color: var(--ink-3); }
.m-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 3px; color: var(--ink-2); }
.m-when { font: 11.5px var(--mono); color: var(--quiet); }
.m-groups { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.m-groups summary { cursor: pointer; font-size: 12px; color: var(--ink-2); padding: 2px 0; }
.m-groups ul { margin-bottom: 8px; }
@media (max-width: 600px) {
  .metrics { padding: 0 14px 18px; }
  .m-grid { grid-template-columns: minmax(0, 1fr); }
  .pie { flex-direction: column; align-items: flex-start; }
  .only-wide { display: none; }
  .only-narrow { display: block; }
}

/* Metrics page: shown until the stats arrive */
.m-loading { display: flex; align-items: center; gap: 10px; padding: 48px 0; justify-content: center; color: var(--quiet); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--quiet); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Ask Otto ---- */
.ask { padding: 22px 26px 26px; display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.ask-q { white-space: pre-wrap; }
.ask-form { display: flex; flex-direction: column; gap: 10px; }
.ask-form textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--control);
  border-radius: 7px; font: 14px/1.5 Geist, system-ui, sans-serif; color: var(--ink); resize: vertical;
}
.ask-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.ask-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ask .btn.primary { height: 34px; padding: 0 14px; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 13px; }
.ask .btn.primary[disabled] { opacity: .45; cursor: default; }
.ask .m-loading { padding: 0 0 0 46px; justify-content: flex-start; }
.ask-error { margin: 0; color: var(--bad); font-size: 13px; }
.ask-steps { margin: -10px 0 0; padding-left: 64px; font: 12px var(--mono); color: var(--ink-3); }
@media (max-width: 640px) { .ask { padding: 16px; } }
