/* Reset (the hosted version gets it from the page skeleton) */
:root { color-scheme: light; box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Layout: one reading column (max 76rem) — loader panel on top, report below in titled sections of cards. */
:root {
  --bg: #f4f5f6; --panel: #fcfcfc; --fg: #121417; --muted: #5d636b; --line: rgba(18,20,23,.11); --grid: #e3e5e8; --axis: #c2c6cc;
  --accent: #ffdc4e; --accent-fg: #1c2429; --accent-soft: #fff4b8; --accent-text: #705600; --pop: #ffffff; --warn-bg: #fff6df; --warn-line: #e8c46a;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --muted-bar: #b9bec5;
  --bad: #d03b3b; --money: #23934a; --money-text: #1b7a3c; --on-money: #ffffff;
  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1012; --panel: #18191c; --fg: #eceef1; --muted: #a2a8b0; --line: rgba(255,255,255,.10); --grid: #2a2c30; --axis: #3b3e44;
  --accent: #ffdc4e; --accent-fg: #1c2429; --accent-soft: #342e16; --accent-text: #ffe581; --pop: #222428; --warn-bg: #2d2615; --warn-line: #8a6d20;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --muted-bar: #4a4e55; --bad: #e66767; --money: #3fbf6a; --money-text: #5fd08a; --on-money: #07150c;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1012; --panel: #18191c; --fg: #eceef1; --muted: #a2a8b0; --line: rgba(255,255,255,.10); --grid: #2a2c30; --axis: #3b3e44;
  --accent: #ffdc4e; --accent-fg: #1c2429; --accent-soft: #342e16; --accent-text: #ffe581; --pop: #222428; --warn-bg: #2d2615; --warn-line: #8a6d20;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --muted-bar: #4a4e55; --bad: #e66767; --money: #3fbf6a; --money-text: #5fd08a; --on-money: #07150c;
  color-scheme: dark; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 76rem; margin-inline: auto; padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 36px; font-variant-numeric: tabular-nums; }
h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 0; text-wrap: balance; }
h3 { font-size: 0.98rem; font-weight: 600; margin: 0; }
p { margin: 0; }
code { font-family: var(--f-mono); font-size: 0.86em; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 0.85rem; }
.head { display: grid; gap: 10px; max-width: 46rem; }
.lead { font-size: 1.02rem; }

.loader { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: grid; gap: 16px; }
.drop { border: 1.5px dashed var(--axis); border-radius: var(--r); padding: 22px; display: grid; gap: 14px; justify-items: start; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { font: inherit; font-weight: 500; font-size: 0.93rem; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.paths { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 0.85rem; color: var(--muted); }
@media (max-width: 34rem) { .paths { grid-template-columns: 1fr; } }
.progress { display: grid; gap: 6px; }
.bar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.status { font-size: 0.88rem; }
.status.err { color: var(--bad); }
.banner { border-radius: var(--r); padding: 12px 16px; font-size: 0.9rem; background: var(--warn-bg); border: 1px solid var(--warn-line); }
.banner.real { background: var(--accent-soft); border-color: transparent; }

.report { display: grid; gap: 40px; }
.take { font-size: 1.05rem; max-width: 52rem; line-height: 1.55; }
.take b { font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.kpi .l { color: var(--muted); font-size: 0.8rem; }
.kpi .v { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
.kpi .n { color: var(--muted); font-size: 0.78rem; }
.sec { display: grid; gap: 14px; }
.sec > header { display: grid; gap: 4px; max-width: 52rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: 14px; } /* two columns at most: cards come in pairs */
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.card > header { display: grid; gap: 3px; }
.wide { grid-column: 1 / -1; }
.chart { min-width: 0; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: var(--f-body); }
.chart .gridl line { stroke: var(--grid); }
.chart .gridl path, .chart .ax path { display: none; }
.chart .ax line { stroke: var(--axis); }
.rows { display: grid; gap: 5px; }
.row { display: grid; grid-template-columns: minmax(7rem, 16rem) 1fr auto; gap: 10px; align-items: center; font-size: 0.82rem; padding: 2px 4px; border-radius: 5px; }
.row:hover { background: var(--grid); }
.row .lab { overflow-wrap: anywhere; line-height: 1.3; }
.track { height: 13px; position: relative; }
.fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.row .val { text-align: right; white-space: nowrap; }
.row .x { color: var(--muted); margin-left: 6px; display: inline-block; min-width: 3.3em; }
@media (max-width: 34rem) { .row { grid-template-columns: minmax(6rem, 9rem) 1fr auto; } }
.stack { display: flex; gap: 2px; height: 28px; border-radius: 5px; overflow: hidden; }
.stack > div { min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { font-weight: 600; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--pop); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 7px 10px; font-size: 0.8rem; max-width: 21rem; display: grid; gap: 2px; }
.tip > div { display: flex; align-items: center; gap: 6px; }
.tip .h { color: var(--muted); }
.tablebox { max-height: 34rem; overflow: auto; border-top: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 600; padding: 0; border-bottom: 1px solid var(--line); z-index: 1; }
th button { all: unset; cursor: pointer; display: block; padding: 7px 9px; white-space: nowrap; }
th button:focus-visible { outline: 2px solid var(--accent-text); }
th[aria-sort="descending"] button::after { content: " ↓"; color: var(--muted); }
th[aria-sort="ascending"] button::after { content: " ↑"; color: var(--muted); }
th.num, td.num { text-align: right; }
td { padding: 7px 9px; border-bottom: 1px solid var(--grid); vertical-align: top; }
td.title { min-width: 14rem; max-width: 28rem; line-height: 1.35; }
td.nowrap { white-space: nowrap; }
.cellbar { display: grid; grid-template-columns: 4.3rem 1fr; gap: 6px; align-items: center; min-width: 9rem; }
.cellbar i { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--muted-bar); min-width: 1px; }
.chip { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.search { font: inherit; font-size: 0.85rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: min(100%, 22rem); }
.notes { display: grid; gap: 8px; max-width: 52rem; font-size: 0.85rem; color: var(--muted); }
.notes ul { margin: 0; padding-left: 1.2em; display: grid; gap: 5px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* clickable rows, filters, tool detail */
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--grid); }
tr.click:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
tr.sel td { background: var(--accent-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 3px 3px 11px; border-radius: 999px; background: var(--accent-soft); font-size: 0.82rem; }
.fchip button { all: unset; cursor: pointer; padding: 1px 8px; border-radius: 999px; font-size: 1rem; line-height: 1.2; }
.fchip button:hover { background: var(--panel); }
.fchip button:focus-visible, .xbtn:focus-visible, .lgbtn:focus-visible, .linkbtn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.cmd { font-family: var(--f-mono); font-size: 0.78rem; overflow-wrap: anywhere; }
.dhead { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.xbtn { all: unset; cursor: pointer; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 2px 8px; border-radius: 6px; }
.xbtn:hover { background: var(--grid); color: var(--fg); }
.tdesc { max-width: 52rem; font-size: 0.9rem; line-height: 1.5; }
.mini { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.mini > div { display: grid; gap: 1px; }
.mini span { color: var(--muted); font-size: 0.76rem; }
.mini b { font-size: 1.08rem; font-weight: 600; }
h4 { font-size: 0.9rem; font-weight: 600; margin: 0; }
.dsub { display: grid; gap: 6px; }
.lgbtn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border-radius: 5px; padding: 1px 4px; }
.lgbtn:hover { background: var(--grid); }
.linkbtn { all: unset; cursor: pointer; color: var(--accent-text); font-size: 0.85rem; font-weight: 500; }
.linkbtn:hover { text-decoration: underline; }

/* conversation viewer */
body:has(dialog[open]) { overflow: hidden; }
.viewer { padding: 0; border: 1px solid var(--line); border-radius: var(--r); width: calc(100vw - 24px); max-width: 100rem; height: calc(100dvh - 24px); max-height: none; background: var(--bg); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }

.vgrid { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.vhead { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.vtitle { display: grid; gap: 2px; min-width: 0; flex: 1 1 22rem; }
.vtitle h2 { font-size: 1.02rem; overflow-wrap: anywhere; }
.vctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vctl select { width: auto; max-width: 17rem; }
.vbody { display: grid; grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem); min-height: 0; }
/* block flow in chunks, not one grid: a grid relays out every row of a long conversation on any change */
.vtr { overflow: auto; padding: 16px 18px 48px; position: relative; display: block; }
.vtr > * + *, .vchunk > * + * { margin-top: 6px; }
.vchunk { content-visibility: auto; contain-intrinsic-size: auto 4000px; }
.vpanel { overflow: auto; border-left: 1px solid var(--line); padding: 16px 18px 24px; position: relative; display: grid; gap: 18px; align-content: start; background: var(--panel); }
.vpanel section { display: grid; gap: 8px; }
.vslider { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.vslider input { width: 100%; accent-color: var(--accent); }
.vjump { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
.vpanel .mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.vpanel .mini b { overflow-wrap: anywhere; }
.btn.sm { padding: 5px 10px; font-size: 0.82rem; }
.vnote { font-size: 0.8rem; padding: 6px 10px; border-radius: 6px; background: var(--warn-bg); border: 1px solid var(--warn-line); }
#v-strip { width: 100%; height: 38px; display: block; cursor: pointer; border-radius: 4px; }
.vmsg { font-size: 0.85rem; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; max-height: 9rem; overflow: auto; }
@media (max-width: 60rem) {
  .viewer { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .vhead { padding-top: max(12px, env(safe-area-inset-top, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .vbody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .vpanel { order: -1; border-left: 0; border-bottom: 1px solid var(--line); max-height: 42dvh; gap: 14px; }
  .vhead { padding-block: 10px; gap: 8px; }
  .vctl { width: 100%; flex-wrap: nowrap; }
  .vctl label { display: none; }
  .vctl select { flex: 1 1 auto; max-width: none; min-width: 0; }
  .vpanel .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vtr, .vpanel { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}
.it { --g: var(--muted-bar); border-left: 3px solid var(--g); padding: 6px 10px 8px 12px; border-radius: 0 7px 7px 0; display: grid; gap: 4px; background: var(--panel); transition: opacity .12s, background-color .12s; min-width: 0; }
/* chat: your messages on the right, the model's text green, commands pink, their results blue and indented under them */
.it.u { width: fit-content; max-width: min(46rem, 88%); margin-left: auto; border-left: 0; border-radius: 12px 12px 4px 12px; padding: 8px 12px 10px;
  background: color-mix(in srgb, var(--s4) 16%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--s4) 45%, transparent); }
.it.u.replay { margin-left: auto; }
.it.m { background: color-mix(in srgb, var(--s3) 11%, var(--panel)); }
.it.r { background: transparent; border-left-style: dashed; padding-block: 3px; }
.it.r .who { font-weight: 500; color: var(--muted); }
.it.call { background: var(--panel); }
.it.res { margin-left: 18px; background: color-mix(in srgb, var(--s1) 8%, var(--panel)); }
.it.svc { background: transparent; }
.ih .bad { font-size: 0.72rem; font-weight: 600; color: #fff; background: var(--bad); border-radius: 999px; padding: 0 7px; }
.ih .turn { font-size: 0.74rem; color: var(--money-text); font-weight: 600; }
.step { display: grid; gap: 6px; padding: 6px 8px 8px; border-radius: 10px; border: 1px solid transparent; }
.step.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.gbody { display: grid; gap: 6px; min-width: 0; }
.svcg { display: grid; gap: 4px; padding: 4px 8px 6px; border-radius: 10px; border: 1px dashed var(--line); }
.svcg > .gh { font-size: 0.72rem; color: var(--muted); }
.svcg .it { padding-block: 3px; }
.vlegend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 0.74rem; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.vlegend span { display: inline-flex; align-items: center; gap: 5px; }
.it[data-st="fut"], .it[data-st="gone"] { opacity: .45; }
.it[data-st="gone"] .who { text-decoration: line-through; }
.it.flash { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.it.comp { border-left-style: dashed; }
.ih { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 0.78rem; }
.ih .who { font-weight: 600; }
.ih .st { font-size: 0.7rem; color: var(--fg); border-radius: 999px; padding: 0 6px; border: 1px solid var(--accent); }
.ih .st:empty { display: none; }
.ih .meta { margin-left: auto; color: var(--muted); white-space: nowrap; }
.ib { font-size: 0.87rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.ib.mono, pre.out { font-family: var(--f-mono); font-size: 0.76rem; line-height: 1.45; }
pre.out { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow: auto; background: var(--bg); border-radius: 6px; padding: 8px 10px; margin: 6px 0 0; }
.it details > summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.it details > summary:focus-visible { outline: 2px solid var(--accent-text); }
.more { all: unset; cursor: pointer; color: var(--accent-text); font-size: 0.8rem; }
.rq { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 0.74rem; color: var(--muted); padding: 2px; cursor: pointer; }
.rq b { color: var(--fg); }
.rq:hover { color: var(--fg); }
.rq.cur, .rq.cur b { color: var(--accent-text); }
.rq.cur { font-weight: 600; }
.vempty { color: var(--muted); padding: 24px 0; }

/* unit switch and prices */
.unitsbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 4; background: var(--bg); padding-block: 8px; margin-block: -8px; display: grid; gap: 6px; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.units { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); justify-self: start; max-width: 100%; }
.units > span { padding: 0 8px 0 6px; }
.units button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 7px; font-size: 0.86rem; font-weight: 500; }
.units button:hover { background: var(--grid); }
.units button[aria-checked="true"] { background: var(--accent); color: var(--accent-fg); }
.units button:disabled { cursor: not-allowed; opacity: .45; background: none; }
.units button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
#units-note { max-width: 60rem; }
input.price { font: inherit; font-size: 0.82rem; width: 5.2rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }
input.price:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.notes a, .filters a { color: var(--accent-text); }
#c-prices td.cmd { white-space: nowrap; }
@media (max-width: 40rem) { .unitsbar { position: static; margin-block: 0; padding-block: 0; } }

/* money: running totals, table column */
td.money { color: var(--money-text); font-weight: 500; }
.cum { display: grid; gap: 10px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--money) 9%, var(--panel)); border: 1px solid var(--line); }
.cumrow { display: grid; gap: 4px; }
.cumtop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 0.8rem; }
.cumtop b { font-size: 1.15rem; font-weight: 600; }
.cumbar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.cumbar i { display: block; height: 100%; }

/* calendar */
.cal { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.calm { display: grid; gap: 6px; align-content: start; }
.calm h4 { font-size: 0.85rem; }
.calg { display: grid; grid-template-columns: repeat(7, 2.4rem); gap: 3px; }
.calg .wd { font-size: 0.68rem; color: var(--muted); text-align: center; }
.cd { box-sizing: border-box; height: 2.4rem; border-radius: 6px; position: relative; display: grid; place-items: center; font: inherit; color: var(--fg); border: 0; padding: 0; margin: 0;
  background: color-mix(in srgb, var(--money) var(--heat, 0%), var(--panel)); box-shadow: inset 0 0 0 1px var(--line); }
button.cd { cursor: pointer; }
button.cd:hover { filter: brightness(1.08); }
.cd.l3, .cd.l4 { color: var(--on-money); }
.cd.off { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--grid); }
.cd.pad { visibility: hidden; }
.cd .dn { position: absolute; top: 2px; left: 4px; font-size: 0.6rem; opacity: 0.75; line-height: 1; }
.cd.off .dn { position: static; font-size: 0.7rem; }
.cd .cn { font-weight: 600; font-size: 0.9rem; padding-top: 6px; }
.cd.sel, .cd:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.calleg > span:first-child { display: inline-flex; align-items: center; gap: 3px; }
.cdsw { width: 12px; height: 12px; background: color-mix(in srgb, var(--money) var(--heat), var(--panel)); box-shadow: inset 0 0 0 1px var(--line); }
.cdsw.off { background: transparent; }

/* help */
.howto { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; }
.howto summary, .vhelp summary { cursor: pointer; font-weight: 600; }
.howto summary:focus-visible, .vhelp summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.howto ol, .vhelp ul { margin: 10px 0 4px; padding-left: 1.3em; display: grid; gap: 6px; font-size: 0.9rem; line-height: 1.5; }
.vhelp { font-size: 0.85rem; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.vhelp ul { font-size: 0.82rem; }
.pill { font-size: 0.72rem; border-radius: 999px; padding: 0 6px; border: 1px solid var(--line); white-space: nowrap; }
.pill.new { border-color: var(--s2); } .pill.ans { border-color: var(--s3); }
.vslider { position: sticky; top: -16px; z-index: 3; background: var(--panel); padding-block: 6px; }
.rq .rqusd { color: var(--money-text); font-weight: 600; }

/* long conversations: blocks off screen are not laid out or painted until scrolled to */
.vchunk > * { content-visibility: auto; contain-intrinsic-size: auto 64px; }
/* filters, period summary, compaction groups */
.fsel { width: auto; max-width: 15rem; }
@media (max-width: 34rem) { .fsel { max-width: 100%; flex: 1 1 10rem; } }
.chart .selband { fill: var(--accent-soft); }
.chart .comphit { stroke: transparent; stroke-width: 10; cursor: pointer; }
.it.replay { margin-left: 14px; }
.cgroup { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.notes li.warnli { color: var(--fg); }
/* calendar: selected days */
.cd.inr { box-shadow: inset 0 0 0 2px var(--accent); }
button.cd[data-day] { touch-action: pan-y; user-select: none; }
/* aura */
.aura-card { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px 24px; align-items: center; }
.aura-all { grid-column: 1 / -1; }
@media (max-width: 44rem) { .aura-card { grid-template-columns: minmax(0, 1fr); } .aura-art { max-width: 280px; justify-self: center; width: 100%; } }
.aura-svg { width: 100%; height: auto; display: block; overflow: visible; }
.aura-txt { display: grid; gap: 8px; align-content: start; }
.aura-txt p { margin: 0; }
.aura-name { font-family: var(--f-display); font-weight: 500; font-size: clamp(1.3rem, 2.6vw, 1.75rem); margin: 0; }
.aura-map { margin: 4px 0 0; padding-left: 1.1em; display: grid; gap: 3px; color: var(--muted); font-size: 0.84rem; }
.aura-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.aura-gal figure { margin: 0; display: grid; gap: 2px; justify-items: center; font-size: 0.78rem; color: var(--muted); }
.aura-svg * { transform-box: view-box; }
.a-halo, .a-ring, .a-collapse, .a-beast, .a-shield { transform-origin: 120px 120px; }
.a-beast { animation: a-breath var(--period) ease-in-out infinite; }
.a-halo { animation: a-breath var(--period) ease-in-out infinite; }
.a-halo.ragged { animation: a-ragged var(--period) linear infinite; }
.a-ring { animation: a-ring calc(var(--period) * 1.6) ease-out infinite; opacity: 0; }
.a-collapse { animation: a-collapse calc(var(--period) * 2.5) ease-in-out infinite; }
.a-shield { animation: a-spin calc(var(--period) * 8) linear infinite; }
.a-star { animation: a-twinkle 3.2s ease-in-out infinite; }
.a-eye { animation: a-eye calc(var(--period) * 0.8) ease-in-out infinite; }
.a-flap { transform-box: fill-box; transform-origin: 15% 100%; animation: a-flap .18s ease-in-out infinite; }
.a-rise { transform-box: fill-box; transform-origin: 50% 100%; animation: a-rise calc(var(--period) * 0.9) ease-out infinite; }
@keyframes a-breath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes a-ragged { 0%, 100% { transform: scale(1); } 11% { transform: scale(1.07); } 19% { transform: scale(.96); } 43% { transform: scale(1.05); } 52% { transform: scale(.99); } 77% { transform: scale(1.03); } }
@keyframes a-ring { 0% { transform: scale(.82); opacity: 0; } 25% { opacity: .65; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes a-collapse { 0%, 60%, 100% { transform: scale(1); opacity: .7; } 75% { transform: scale(.5); opacity: .15; } }
@keyframes a-spin { to { transform: rotate(360deg); } }
@keyframes a-twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .95; } }
@keyframes a-eye { 0%, 100% { filter: brightness(.8); } 50% { filter: brightness(1.4); } }
@keyframes a-flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.35); } }
@keyframes a-rise { 0% { transform: translateY(8px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .aura-svg * { animation: none !important; } .a-ring { opacity: .4; } }
.aura-gal .aura-svg * { animation: none !important; }
.aura-gal .a-ring { opacity: .35; }
.aura-gal figure.cur figcaption { color: var(--fg); font-weight: 600; }
.aura-gal figure.cur .aura-svg { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 50%; }
.aura-sw { display: inline-block; width: .9em; height: .9em; border-radius: 3px; vertical-align: -0.1em; margin-right: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.secnav { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 0.82rem; }
.secnav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.secnav a:hover { color: var(--accent-text); text-decoration: underline; }
.sec, #method { scroll-margin-top: 110px; }
@media (max-width: 40rem) { .secnav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .sec, #method { scroll-margin-top: 8px; } }
.warnbox { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-line); font-size: 0.85rem; }
.cd .cn.long { font-size: 0.62rem; letter-spacing: -0.02em; }

/* period picker in «Беседы»: button with a calendar popover */
.pwrap { display: inline-flex; }
.filters.fpop { position: relative; }
.pbtn { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 0.85rem; }
.pbtn.on { background: var(--accent-soft); border-color: transparent; }
.pbtn > button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.pbtn > button i { font-style: normal; color: var(--muted); font-size: 0.75em; }
.pbtn > .px { padding: 4px 9px; margin-left: -6px; font-size: 1rem; line-height: 1; }
.pbtn > button:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.pbtn > button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
/* anchored to the filters row (full card width): no measuring; as wide as its months, at most 4 in a row */
.calpop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 4; display: grid; gap: 12px; width: fit-content; max-width: 100%; box-sizing: border-box;
  max-height: min(calc(100vh - 24px), 52rem); overflow: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 40px rgba(0,0,0,.18); padding: 14px; }
.calbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.calhint { font-size: 0.76rem; }
.calpop .cal { gap: 18px 24px; max-width: calc(4 * 16rem + 3 * 24px); }
.calpop .calm { flex: 1 0 min(14rem, 100%); max-width: 16rem; }
.btn:disabled { opacity: 0.4; cursor: default; filter: none; }
.calpop .calg { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calpop .cd { height: auto; aspect-ratio: 1; }
.calpop .wd { aspect-ratio: auto; }
.psum { display: grid; gap: 8px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--money) 7%, var(--panel)); border: 1px solid var(--line); }
.pmore > summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; width: max-content; }
.pmore > summary:focus-visible { outline: 2px solid var(--accent-text); }
.pmore[open] { display: grid; gap: 8px; }
.calpop > .calbar { position: sticky; top: -14px; z-index: 1; margin: -14px -14px 0; padding: 14px 14px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.vtr .it { cursor: pointer; }
.vtr .it:hover { filter: brightness(0.98); }
@media (prefers-color-scheme: dark) { .vtr .it:hover { filter: brightness(1.12); } }
/* a block's size is a button: a click explains it; dotted underline like a term with a footnote */
.ih .sz { all: unset; margin-left: auto; white-space: nowrap; color: var(--muted); cursor: pointer; border-bottom: 1px dotted currentColor; line-height: 1.2; }
.ih .sz:hover { color: var(--fg); }
.ih .sz[aria-expanded="true"] { color: var(--accent-text); }
.ih .sz:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.qinfo { display: grid; gap: 3px; font-size: 0.8rem; line-height: 1.45; background: var(--bg); border-radius: 6px; padding: 6px 9px; cursor: auto; }
.it.nw { box-shadow: inset -3px 0 0 var(--accent); }
.it.u.nw { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--s4) 45%, transparent), inset -3px 0 0 var(--accent); }
.newline { font-size: 0.76rem; color: var(--accent-text); padding: 2px 8px; }
.ih .when { font-size: 0.74rem; color: var(--muted); }
.ih .turn.none { color: var(--muted); }
.rq .miss { font-size: 0.72rem; font-weight: 600; color: var(--fg); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 999px; padding: 0 7px; }
.aura-how > summary, .aura-all > summary { cursor: pointer; }
/* the totem lifts a little under the mouse; the whole picture moves, its own animations stay as they are */
@media (hover: hover) and (pointer: fine) {
  .aura-card > .aura-art { transition: transform .25s ease; }
  .aura-card > .aura-art:hover { transform: translateY(-3px) rotate(2deg) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) { .aura-card > .aura-art, .aura-card > .aura-art:hover { transition: none; transform: none; } }
/* each animal's own motion: the whole figure, pivot at its feet; amplitude --ma, duration --mv */
.a-body { transform-box: fill-box; transform-origin: 50% 90%; animation: var(--mv) ease-in-out infinite; }
.mv-hover { animation-name: mv-hover; } .mv-buzz { animation-name: mv-buzz; animation-timing-function: linear; } .mv-peck { animation-name: mv-peck; }
.mv-waddle { animation-name: mv-waddle; } .mv-swim { animation-name: mv-swim; } .mv-pulse { animation-name: mv-pulse; transform-origin: 50% 30%; }
.mv-slither { animation-name: mv-slither; } .mv-hop { animation-name: mv-hop; } .mv-scuttle { animation-name: mv-scuttle; animation-timing-function: steps(2, jump-none); }
.mv-plod { animation-name: mv-plod; } .mv-prowl { animation-name: mv-prowl; } .mv-nod { animation-name: mv-nod; }
@keyframes mv-hover { 0%, 100% { transform: translateY(0) rotate(calc(-2deg * var(--ma))); } 50% { transform: translateY(calc(-5px * var(--ma))) rotate(calc(2deg * var(--ma))); } }
@keyframes mv-buzz { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1px, -1.5px); } 50% { transform: translate(-1px, 0.5px); } 75% { transform: translate(0.5px, 1px); } }
@keyframes mv-peck { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(calc(-9deg * var(--ma))); } 80% { transform: rotate(0); } 88% { transform: rotate(calc(-7deg * var(--ma))); } }
@keyframes mv-waddle { 0%, 100% { transform: rotate(calc(-5deg * var(--ma))); } 50% { transform: rotate(calc(5deg * var(--ma))); } }
@keyframes mv-swim { 0%, 100% { transform: translateX(calc(-4px * var(--ma))) rotate(calc(-3deg * var(--ma))); } 50% { transform: translateX(calc(4px * var(--ma))) rotate(calc(3deg * var(--ma))); } }
@keyframes mv-pulse { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(calc(1 + 0.05 * var(--ma)), calc(1 - 0.08 * var(--ma))); } 70% { transform: scale(calc(1 - 0.02 * var(--ma)), calc(1 + 0.04 * var(--ma))) translateY(-3px); } }
@keyframes mv-slither { 0%, 100% { transform: skewX(calc(-5deg * var(--ma))); } 50% { transform: skewX(calc(5deg * var(--ma))); } }
@keyframes mv-hop { 0%, 55%, 100% { transform: translateY(0) scale(1, 1); } 62% { transform: translateY(0) scale(1.04, 0.94); } 75% { transform: translateY(calc(-10px * var(--ma))) scale(0.98, 1.03); } 88% { transform: translateY(0) scale(1.03, 0.96); } }
@keyframes mv-scuttle { 0%, 100% { transform: translateX(calc(-2px * var(--ma))); } 50% { transform: translateX(calc(2px * var(--ma))); } }
@keyframes mv-plod { 0%, 100% { transform: rotate(calc(-1.5deg * var(--ma))); } 50% { transform: rotate(calc(1.5deg * var(--ma))) translateY(-1px); } }
@keyframes mv-prowl { 0%, 100% { transform: translateX(calc(-3px * var(--ma))); } 25% { transform: translateX(0) translateY(-1px); } 50% { transform: translateX(calc(3px * var(--ma))); } 75% { transform: translateX(0) translateY(-1px); } }
@keyframes mv-nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(calc(-3deg * var(--ma))); } }

/* Read the conversation first; open the execution trail when investigating. */
.chat-turn { display: grid; gap: 12px; padding: 8px 0 24px; border-bottom: 1px solid var(--line); }
.chat-turn + .chat-turn { margin-top: 18px; }
.chat-answer { padding: 14px 16px; border-radius: 10px; }
.chat-answer[data-st="fut"], .chat-answer[data-st="gone"] { opacity: .45; background: var(--panel); }
.chat-answer[data-st="gone"] .who { text-decoration: none; }
.chat-answer[data-st="gone"] .who::after { display: none; }
.turn-steps { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.turn-summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.turn-summary > span + span { margin-left: 12px; font-size: .74rem; }
.turn-step-list { display: grid; gap: 8px; padding-top: 12px; }
.turn-steps:not([open]) > .turn-step-list, .step:not([open]) > .gbody, .svcg:not([open]) > .gbody { display: none; }
.step { display: block; border-color: var(--line); padding: 9px 11px; }
.step > .gbody { padding-top: 12px; }
.rq { display: list-item; font-weight: 400 !important; }
.step-top { display: inline-flex; gap: 10px; align-items: baseline; width: calc(100% - 20px); }
.step-top .rqusd { margin-left: auto; }
.token-bar { display: flex; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 8px 0 6px; }
.token-bar i { display: block; height: 100%; }
.token-bar .cached { background: var(--s3); }
.token-bar .uncached { background: var(--s4); }
.token-bar .generated { background: var(--s5); }
.token-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .72rem; color: var(--muted); }
.token-legend > span::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-right: 4px; }
.token-legend .cached::before { background: var(--s3); }
.token-legend .uncached::before { background: var(--s4); }
.token-legend .generated::before { background: var(--s5); }
.step-input { display: grid; gap: 6px; font-size: .74rem; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.svcg { display: block; }
.svcg > summary { cursor: pointer; }
.svcg[open] > .gbody { margin-top: 8px; }
.answer-missing { font-size: .82rem; color: var(--muted); margin: 0; }
.turn-steps summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.step-purpose { display: block; margin-top: 4px; font-size: .76rem; color: var(--fg); font-weight: 400; }

/* A step is one model request; selecting it does not expand its contents. */
.step-select { all: unset; display: inline-block; width: calc(100% - 22px); vertical-align: top; cursor: pointer; border-radius: 5px; }
.step-select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
.step-top { display: flex; flex-wrap: wrap; width: 100%; gap: 5px 10px; }
.step-state { color: var(--accent-text); font-size: .68rem; }
.step-state:empty, .fresh-badge:empty, .turn-fresh:empty { display: none; }
.step[data-timing="future"] > summary { opacity: .45; }
.step-phase { display: grid; gap: 8px; min-width: 0; border-left: 2px solid var(--line); padding: 4px 0 8px 12px; }
.step-phase[hidden] { display: none; }
.phase-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-size: .77rem; }
.phase-value { color: var(--muted); font-size: .72rem; }
.phase-note, .fresh-description, .flow-note { margin: 0; font-size: .73rem; line-height: 1.5; color: var(--muted); }
.phase-input { border-left-color: var(--s2); }
.phase-generated { border-left-color: var(--s5); }
.phase-results { border-left-color: var(--s1); }
.fresh-description { color: var(--accent-text); }
.phase-results > .it.res { margin-left: 0; }
.snapshot-note { margin: 0; padding: 9px 11px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); font-size: .76rem; line-height: 1.5; }
.step-help { display: grid; gap: 10px; margin-top: 12px; }
.fresh-badge, .turn-fresh { display: block; margin-top: 7px; color: var(--accent-text); font-size: .72rem; font-weight: 500; }
.has-fresh { box-shadow: inset -3px 0 0 var(--accent); }
.turn-total { margin-top: 6px; font-size: .72rem; color: var(--muted); line-height: 1.5; }
.it[data-st="fut"] .st, .it[data-st="gone"] .st { border-color: var(--line); color: var(--muted); }
.it[data-st="new"] .st { color: var(--accent-text); }
.token-bar .cached, .token-legend .cached::before { background: var(--s1); }
.token-bar .uncached, .token-legend .uncached::before { background: var(--s2); }
@media (max-width: 600px) {
  .step { padding: 8px; }
  .step-phase { padding-left: 8px; }
  .token-legend { gap: 4px 10px; }
  .chat-answer { padding: 10px; }
}
.missb { font-size: .7rem; font-weight: 600; color: var(--fg); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 999px; padding: 0 7px; }
/* the selected question and the model's answer to it: outlined together, never faded */
.it.turn-cur { outline: 2px solid color-mix(in srgb, var(--accent-text) 65%, transparent); outline-offset: 2px; opacity: 1 !important; }
/* the answer to the selected question keeps its normal green look, even if it is written on a later step */
.chat-answer.turn-cur[data-st] { background: color-mix(in srgb, var(--s3) 11%, var(--panel)); }
.it.turn-cur[data-st="fut"] .st { border-color: var(--accent); color: var(--fg); }

/* Compact execution tree inside expanded steps. */
.trace-node { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.trace-node[hidden], .trace-branch[hidden], .trace-thinking[hidden] { display: none; }
.trace-head { cursor: pointer; padding: 9px 10px; font-size: .78rem; overflow-wrap: anywhere; }
.trace-head::marker { color: var(--muted); }
.trace-icon { color: var(--s5); margin-right: 6px; }
.trace-title { font-weight: 600; }
.trace-preview { color: var(--muted); font-family: var(--f-mono); font-size: .72rem; margin-left: 10px; overflow-wrap: anywhere; }
.trace-status { display: inline-block; font-size: .68rem; color: var(--muted); background: var(--bg); padding: 2px 6px; border-radius: 5px; margin-left: 8px; }
.trace-status.failed { color: var(--bad); }
.trace-children { display: grid; gap: 8px; margin: 0 10px 10px 22px; padding-left: 14px; border-left: 1px solid var(--line); min-width: 0; }
.trace-branch { min-width: 0; position: relative; }
.trace-branch::before { content: ''; position: absolute; left: -15px; top: 12px; width: 11px; height: 9px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0 0 0 7px; }
.trace-branch-head { cursor: pointer; padding: 5px 0; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.trace-size { margin-left: 10px; white-space: nowrap; font-size: .7rem; }
.trace-branch > .it.res { margin-left: 0; }
.trace-branch > .it { margin-top: 4px; }
.trace-thinking { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.trace-thinking::before { display: none; }
.trace-fresh { display: inline-block; color: var(--accent-text); font-size: .68rem; margin-left: 8px; }
.trace-fresh:empty { display: none; }
.trace-new { box-shadow: inset -3px 0 var(--accent); }
.trace-future > summary { opacity: .45; }
.trace-node summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
@media (max-width: 600px) { .trace-preview { display: block; margin: 4px 0 0 17px; } .trace-children { margin-left: 12px; padding-left: 10px; } .trace-branch::before { left: -11px; width: 7px; } }

.trace-section-title { font-size: .78rem; }

/* Conversation navigation: tree → chat → Timeline. */
.vbody { position: relative; grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr) minmax(20rem, 24rem); }
.vbody.nav-hidden { grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem); }
.vbody.nav-hidden .vnav { display: none; }
.vnav { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }
.vnav-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 14px 9px; }
.vnav-head h3 { font-size: .88rem; }
.vnav-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 12px; border-bottom: 1px solid var(--line); font-size: .68rem; color: var(--muted); }
.vnav-toolbar .more { font-size: .7rem; }
.vnav-tree { overflow: auto; min-height: 0; padding: 10px 7px 28px; position: relative; }
.nav-tree, .nav-children { list-style: none; margin: 0; padding: 0; }
.nav-children { margin-left: 14px; padding-left: 7px; border-left: 1px solid var(--line); }
.nav-entry { min-width: 0; }
.nav-entry > .nav-row { position: relative; }
.nav-children > .nav-entry > .nav-row::before { content: ''; position: absolute; left: -8px; top: 3px; width: 7px; height: 14px; border-bottom: 1px solid var(--line); border-radius: 0 0 0 5px; pointer-events: none; }
.nav-row { display: flex; align-items: center; border-radius: 6px; padding: 1px 0; margin: 2px 0; min-width: 0; }
.nav-row:hover { background: var(--bg); }
.nav-select, .nav-toggle { all: unset; cursor: pointer; box-sizing: border-box; }
.nav-toggle { color: var(--muted); flex: 0 0 16px; width: 16px; text-align: center; font-size: 18px; height: 28px; line-height: 28px; }
.nav-open > .nav-row > .nav-toggle { transform: rotate(90deg); }
.nav-leaf { padding-left: 16px; }
.nav-select { display: flex; align-items: center; min-width: 0; gap: 6px; padding: 7px 5px 7px 1px; width: 100%; font-size: .74rem; line-height: 1.3; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.nav-meta { font-size: .63rem; color: var(--muted); white-space: nowrap; margin-left: 2px; flex-shrink: 0; }
.nav-selected > .nav-row { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.nav-selected > .nav-row > .nav-select { color: var(--accent-text); }
.nav-active-step > .nav-row .nav-label { font-weight: 650; }
.nav-failed > .nav-row .work-icon, .nav-failed > .nav-row .nav-label { color: var(--bad); }
.nav-row button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -1px; border-radius: 4px; }
.work-icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -3px; margin-right: 4px; color: var(--muted); }
.work-icon[data-kind="user"], .work-icon[data-kind="pasted"] { color: var(--s4); }
.work-icon[data-kind="reasoning"], .work-icon[data-kind="assistant"] { color: var(--s3); }
.work-icon[data-kind="read"], .work-icon[data-kind="search"], .work-icon[data-kind="result"] { color: var(--s1); }
.work-icon[data-kind="patch"], .work-icon[data-kind="git"] { color: var(--s5); }
.work-icon[data-kind="run"], .work-icon[data-kind="docker"], .work-icon[data-kind="net"], .work-icon[data-kind="web"] { color: var(--s2); }
.work-icon[data-kind="step"] { color: var(--accent-text); }
.work-icon[data-kind="guardian"], .work-icon[data-kind="dev"] { color: var(--money-text); }
.trace-head > .work-icon { margin-left: 3px; }
.trace-branch-head > .work-icon { width: 14px; height: 14px; }
.nav-select .work-icon { margin-right: 0; width: 15px; height: 15px; flex-basis: 15px; }
.it.nav-target { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.step.nav-target { border-color: var(--accent); }
#v-nav-close, #v-nav-shade { display: none; }
@media (max-width: 85rem) and (min-width: 70.001rem) {
  .vbody { grid-template-columns: 15.5rem minmax(0, 1fr) 20rem; }
  .vpanel { padding-inline: 12px; }
  .vtr { padding-inline: 12px; }
}
@media (max-width: 70rem) {
  .vbody, .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); }
  .vnav { position: absolute; inset: 0 auto 0 0; width: min(90vw, 22rem); z-index: 12; box-shadow: 10px 0 32px rgba(0,0,0,.2); }
  #v-nav-close { display: inline-block; }
  .vbody:not(.nav-hidden) #v-nav-shade { all: unset; display: block; position: absolute; inset: 0; background: rgba(0,0,0,.4); z-index: 11; cursor: pointer; }
}
@media (max-width: 60rem) {
  .vbody, .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr); }
  #v-nav-toggle { flex-shrink: 0; }
}
.vgrid { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.vhead, .vbody, .vctl { min-width: 0; }
@media (max-width: 60rem) { .vctl select { width: 0; } }

/* The home page starts with conversations; analytics is progressively disclosed. */
.analytics { display: grid; gap: 10px; margin-top: 8px; }
.analytics > h2 { margin-bottom: 0; }.analytics > p { margin-bottom: 6px; }
.report-block { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 0; }
.report-block > summary { cursor: pointer; padding: 16px 18px; font-size: .9rem; }
.report-block > summary::marker { color: var(--muted); }
.report-block-label { display: inline-grid; vertical-align: middle; gap: 5px; }
.report-block-label b { font-size: .91rem; font-weight: 600; }.report-block-label small { font-size: .77rem; color: var(--muted); }
.report-block-body { padding: 4px 18px 20px; display: grid; gap: 24px; min-width: 0; }
.report-block-body .sec { scroll-margin-top: 24px; }
.report-block > summary:focus-visible, .session-help > summary:focus-visible { outline: 2px solid var(--accent-text); border-radius: 8px; }
.session-help { font-size: .78rem; color: var(--muted); }.session-help > summary { cursor: pointer; }.session-help[open] { display: grid; gap: 8px; }

/* Wide conversation workspace with one bottom Timeline. */
.workbench .vbody, .workbench .vbody.nav-hidden { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 234px; }
.workbench .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }.workbench .vbody.nav-hidden .workbench-main { grid-column: 1; }
.workbench .vnav { grid-column: 1; grid-row: 1; }
.workbench-main { grid-column: 2; grid-row: 1; min-height: 0; min-width: 0; display: grid; grid-template-rows: auto 38px minmax(0, 1fr); }
.step-summary { display: flex; align-items: center; gap: 24px; min-width: 0; padding: 12px 18px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--panel); }
.step-summary-title, .step-metric { display: grid; gap: 4px; flex-shrink: 0; }
.step-summary-title { min-width: 136px; }.step-summary-title small { font-size: .61rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }.step-summary-title b { font-size: .9rem; }
.step-metric { min-width: 80px; }.step-metric span { color: var(--muted); font-size: .65rem; }.step-metric b { font-size: .95rem; font-weight: 600; }
.workbench-tabs { display: flex; align-items: stretch; gap: 20px; padding: 0 18px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.workbench-tabs > button:not(.context-toggle) { all: unset; box-sizing: border-box; cursor: pointer; font-size: .76rem; color: var(--muted); border-bottom: 2px solid transparent; }
.workbench-tabs > button.active:not(.context-toggle) { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.workbench-tabs > .context-toggle { margin: 5px 0 5px auto; font-size: .7rem; }.context-toggle.active { color: var(--accent-text); }
.workbench-view { overflow: auto; min-width: 0; min-height: 0; padding: 20px 24px; }
.workbench-view[hidden], .workbench .vtr[hidden], .workbench .timeline-panel[hidden] { display: none; }
.context-view { display: grid; gap: 20px; align-content: start; background: var(--panel); }
.context-view section { display: grid; gap: 8px; }.context-view .mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workbench-tabs button:focus-visible, .timeline-controls button:focus-visible, .chart-chip:focus-visible, .segmented button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; border-radius: 4px; }
.timeline-panel { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-rows: 48px 30px 116px minmax(0, 1fr); gap: 1px; padding: 8px 18px 10px; min-width: 0; min-height: 0; border-top: 1px solid var(--line); background: var(--panel); }
.timeline-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; min-width: 0; }
.timeline-total { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px; padding: 6px 10px; border-radius: 6px; background: var(--bg); min-width: 0; }
.total-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .63rem; color: var(--muted); }.total-value { white-space: nowrap; font-size: .87rem; font-weight: 600; line-height: 1.4; }.total-of { color: var(--muted); font-size: .6rem; white-space: nowrap; }
.total-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }.total-bar i { display: block; height: 100%; }
.timeline-controls { display: flex; align-items: center; gap: 16px; min-width: 0; }.timeline-title { font-size: .8rem; }
.timeline-modes, .segmented { display: flex; align-items: stretch; padding: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; flex-shrink: 0; }
.timeline-modes button, .segmented button { all: unset; cursor: pointer; color: var(--muted); font-size: .67rem; padding: 4px 9px; border-radius: 4px; white-space: nowrap; }.timeline-modes button[aria-pressed=true], .segmented button[aria-pressed=true] { color: var(--fg); background: var(--panel); box-shadow: 0 1px 3px #0001; font-weight: 600; }
.timeline-controls .vslider { display: grid; grid-template-columns: auto minmax(70px, 160px) auto auto; align-items: center; margin: 0 auto; gap: 8px; }
.timeline-counter { font-size: .68rem; min-width: 90px; text-align: center; }.timeline-controls .btn { padding: 1px 9px; }.timeline-controls > .more { margin-left: auto; font-size: .68rem; white-space: nowrap; }
.timeline-panel .chart, .timeline-panel .chart svg { height: 116px; min-height: 0; }
.timeline-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 18px; min-width: 0; }
.chart-chip { all: unset; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: .64rem; }.chart-chip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }.chart-chip[aria-pressed=false] { opacity: .4; text-decoration: line-through; }.chart-chip:disabled { cursor: default; opacity: .45; text-decoration: none; }.chart-note { color: var(--muted); font-size: .6rem; }
.workbench .vbody.timeline-collapsed { grid-template-rows: minmax(0, 1fr) 98px; }.timeline-collapsed .timeline-panel { grid-template-rows: 48px 30px; }.timeline-collapsed #v-chart, .timeline-collapsed #v-chart-legend { display: none; }

.tools-view { background: var(--panel); }.tools-view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.tools-view-head h3 { font-size: 1.05rem; }.tools-view-head p { font-size: .75rem; margin-top: 6px; }
.tools-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }.tools-kpis > div { display: grid; gap: 6px; }.tools-kpis span { color: var(--muted); font-size: .67rem; }.tools-kpis b { font-size: 1.15rem; }
.tools-metric { margin: 12px 0 16px; }.tools-metric label { display: flex; align-items: center; gap: 8px; font-size: .73rem; }.tools-metric .search { padding: 5px 8px; min-width: 0; width: auto; font-size: .74rem; }
.viewer-tools-table { max-height: none; }.viewer-tools-table table { min-width: 650px; }.viewer-tools-table th { white-space: normal; }.viewer-tools-table td { padding-block: 13px; }.tool-name { all: unset; display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: .79rem; }.tool-name:hover { color: var(--accent-text); }.tool-name:focus-visible { outline: 2px solid var(--accent-text); }.tool-error { color: var(--bad); font-weight: 600; }
.tool-share { display: flex; align-items: center; height: 6px; background: var(--line); border-radius: 4px; min-width: 130px; position: relative; margin-right: 48px; }.tool-share i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }.tool-share span { position: absolute; left: calc(100% + 8px); color: var(--muted); font-size: .65rem; white-space: nowrap; }
.tools-explainer { margin-top: 18px; padding: 12px 16px; border-radius: 8px; background: var(--accent-soft); font-size: .73rem; line-height: 1.6; color: var(--muted); }.tool-entries { background: var(--bg); }.tool-entry { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 7px 0; }.tool-entry code { white-space: pre-wrap; overflow-wrap: anywhere; flex: 1 1 300px; font-size: .72rem; }.tool-entry .muted { font-size: .7rem; }
@media (max-width: 70rem) {
  .workbench .vbody, .workbench .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .workbench-main { grid-column: 1; }.workbench .vnav { grid-column: auto; grid-row: auto; }
  .timeline-totals { gap: 12px; }.timeline-controls { gap: 10px; }
}
@media (max-width: 60rem) {
  .workbench .vbody, .workbench .vbody.nav-hidden { grid-template-rows: minmax(0, 1fr) 286px; }
  .timeline-panel { padding: 8px 12px; grid-template-rows: 58px 54px 116px minmax(0, 1fr); }
  .timeline-totals { gap: 6px; }.timeline-total { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 5px 7px; }.total-label { font-size: .56rem; }.total-value { font-size: .8rem; }.total-of { display: none; }
  .timeline-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }.timeline-title { display: none; }.timeline-modes { justify-self: start; }.timeline-modes button { font-size: .59rem; padding: 3px 7px; }.timeline-controls .vslider { grid-row: 2; grid-column: 1 / -1; grid-template-columns: auto minmax(0, 1fr) auto auto; width: 100%; }.timeline-controls > .more { font-size: .59rem; grid-row: 1; grid-column: 2; }
  .timeline-legend { gap: 3px 10px; }.chart-chip { font-size: .59rem; }.chart-note { font-size: .53rem; }
  .workbench .vbody.timeline-collapsed { grid-template-rows: minmax(0, 1fr) 130px; }.timeline-collapsed .timeline-panel { grid-template-rows: 58px 54px; }
  .step-summary { padding: 9px 12px; gap: 18px; }.step-summary-title { min-width: 100px; }.step-summary-title small { font-size: .53rem; }.step-summary-title b { font-size: .76rem; }.step-metric { min-width: 72px; }.step-metric b { font-size: .84rem; }
  .workbench-tabs { padding-inline: 12px; gap: 15px; }.workbench-tabs > button:not(.context-toggle) { font-size: .72rem; }.workbench-tabs > .context-toggle { font-size: .62rem; }
  .workbench-view { padding: 16px 12px; }.tools-view-head { flex-wrap: wrap; }.tools-kpis { gap: 10px; padding: 10px; }.tools-kpis b { font-size: .88rem; }.tools-kpis span { font-size: .57rem; }
  .report-block-label small { font-size: .7rem; }.report-block > summary { padding: 14px 12px; }.report-block-body { padding-inline: 12px; }
}

.workbench .vbody.timeline-empty { grid-template-rows: minmax(0, 1fr); }

/* Failed commands and wider conversation navigation. */
@media (min-width: 70.01rem) { .workbench .vbody { grid-template-columns: 260px minmax(0, 1fr); } }
.trace-node.trace-failed { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); border-left: 3px solid var(--bad); }
.trace-failed > .trace-head { background: color-mix(in srgb, var(--bad) 6%, var(--panel)); }
.trace-failed > .trace-head .trace-title, .trace-failed > .trace-head .trace-preview, .trace-failed > .trace-head .work-icon { color: var(--bad); }
.command-failed pre, .command-failed .who { color: var(--bad); }
.tool-entry.failed { padding: 10px 12px; margin: 3px -12px; border-left: 3px solid var(--bad); border-radius: 4px; background: color-mix(in srgb, var(--bad) 6%, var(--bg)); }
.tool-entry.failed code { color: var(--bad); }
.command-error-badge { font-size: .68rem; font-weight: 600; color: var(--bad); white-space: nowrap; }

.tool-entry code { background: transparent; padding: 0; }
.command-failed .ib { color: var(--bad); }

/* Experiment 38: report navigation and a separate conversation screen. */
.wrap { max-width: 112rem; }
.wrap > .head { max-width: 76rem; }
.wrap[hidden], .home-panel[hidden], .viewer[hidden] { display: none; }
.home-panel { display: grid; gap: 36px; min-width: 0; scroll-margin-top: 118px; }
.home-panel > .sec { scroll-margin-top: 118px; }
.home-panel > .take { max-width: 76rem; }
.secnav { display: flex; flex-wrap: nowrap; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0; }
.secnav a { padding: 13px 18px 11px; border-bottom: 3px solid transparent; text-decoration: none; font-size: .86rem; }
.secnav a:first-child { padding-left: 0; padding-right: 22px; }
.secnav a[aria-current=page] { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }
.secnav a:hover { text-decoration: none; color: var(--accent-text); }
.secnav a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; border-radius: 4px; }
.viewer.workbench { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0; overflow: hidden; background: var(--bg); color: var(--fg); }
body.conversation-open { overflow: hidden; }
.viewer-back { flex: 0 0 auto; }
@media (max-width: 60rem) {
  .viewer-back { order: -1; }
  .vtitle { flex-basis: calc(100% - 180px); }
  .vctl select { max-width: none; min-width: 0; }
  .home-panel { gap: 24px; scroll-margin-top: 12px; }
  .secnav a { padding: 12px 14px 10px; font-size: .78rem; }
}


/* Experiment 39: explicit report buttons and a shorter conversation header. */
.report-menu { padding: 12px; display: grid; gap: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.report-menu-label { font-size: .73rem; color: var(--muted); font-weight: 500; }
.report-menu .secnav { flex-wrap: wrap; gap: 7px; overflow: visible; border: 0; padding: 0; }
.report-menu .secnav a, .report-menu .secnav a:first-child { display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid var(--axis); border-radius: 7px; background: var(--bg); color: var(--fg); font-size: .83rem; font-weight: 500; line-height: 1.3; }
.report-menu .secnav a:hover { border-color: var(--accent); background: var(--accent-soft); }
.report-menu .secnav a[aria-current=page] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.home-panel, .home-panel > .sec { scroll-margin-top: 156px; }
.workbench .vhead { flex-wrap: nowrap; gap: 12px; padding: 6px 14px; min-height: 42px; }
.workbench .vtitle { flex: 1 1 auto; overflow: hidden; gap: 2px; }
.workbench .vtitle h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .94rem; line-height: 1.35; }
.workbench #v-meta { font-size: .73rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4; }
.workbench .vctl { flex: 0 1 auto; flex-wrap: nowrap; }
.workbench .vctl .muted { font-size: .73rem; }
.workbench .vctl select { font-size: .76rem; padding: 6px 8px; max-width: 15rem; }
.workbench .workbench-main { grid-template-rows: auto minmax(0, 1fr); }
.workbench-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 16px; padding: 0 14px; min-width: 0; min-height: 48px; border-bottom: 1px solid var(--line); background: var(--panel); }
.workbench-toolbar .step-summary { padding: 6px 0; gap: 20px; border: 0; min-width: 0; }
.workbench-toolbar .step-summary-title { min-width: 112px; gap: 2px; }
.workbench-toolbar .step-summary-title small { font-size: .59rem; }
.workbench-toolbar .step-summary-title b { font-size: .82rem; }
.workbench-toolbar .step-metric { min-width: 64px; gap: 2px; }
.workbench-toolbar .step-metric span { font-size: .62rem; }
.workbench-toolbar .step-metric b { font-size: .88rem; }
.workbench-toolbar .workbench-tabs { padding: 0; border: 0; gap: 16px; }
.workbench-toolbar .workbench-tabs > button:not(.context-toggle) { font-size: .74rem; }
.workbench-toolbar .workbench-tabs > .context-toggle { margin: 9px 0 9px 8px; }
@media (max-width: 60rem) {
  .report-menu { padding: 10px; }
  .report-menu .secnav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .report-menu .secnav a, .report-menu .secnav a:first-child { padding: 9px 5px; white-space: normal; font-size: .73rem; text-align: center; }
  .home-panel, .home-panel > .sec { scroll-margin-top: 14px; }
  .workbench .vhead { flex-wrap: wrap; gap: 6px 10px; padding: 6px 10px; }
  .workbench .vtitle { flex: 1 1 calc(100% - 150px); }
  .workbench .vtitle h2 { font-size: .8rem; }
  .workbench .vctl { flex: 1 1 100%; }
  .workbench .vctl select { max-width: none; }
  .workbench-toolbar { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 12px; }
  .workbench-toolbar .step-summary { gap: 16px; }
  .workbench-toolbar .step-summary-title { min-width: 90px; }
  .workbench-toolbar .workbench-tabs { min-height: 34px; }
  .workbench-toolbar .workbench-tabs > .context-toggle { margin: 4px 0 4px auto; }
}


/* Timeline lives below the navigation tree; the conversation uses the full height. */
.workbench .vbody, .workbench .vbody.timeline-collapsed, .workbench .vbody.timeline-empty { grid-template-columns: 360px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.workbench .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.workbench .vnav { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.vnav .timeline-panel { grid-column: auto; grid-row: auto; display: flex; flex-direction: column; gap: 9px; padding: 10px 12px 12px; border-right: 0; }
.vnav .timeline-totals { grid-template-columns: minmax(0, 1fr); gap: 5px; }
.vnav .timeline-total { grid-template-columns: minmax(0, 1fr) auto auto; gap: 3px 6px; padding: 5px 8px; }
.vnav .total-label { font-size: .63rem; }.vnav .total-value { font-size: .78rem; }.vnav .total-of { display: block; font-size: .6rem; }.vnav .total-bar { height: 3px; }
.vnav .timeline-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.vnav .timeline-title { display: block; font-size: .77rem; }
.vnav .timeline-controls > .more { grid-row: 1; grid-column: 2; margin: 0; font-size: .64rem; }
.vnav .timeline-controls .vslider { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; width: 100%; margin: 0; }
.vnav .timeline-controls .vslider input { width: 100%; min-width: 0; }
.vnav .timeline-counter { font-size: .65rem; min-width: 88px; }
.vnav .timeline-panel .chart, .vnav .timeline-panel .chart svg { height: 160px; min-height: 160px; }
.vnav .timeline-legend { gap: 5px 12px; }
.vnav .chart-note { flex: 1 1 100%; text-align: center; font-size: .59rem; }
@media (min-width: 70.001rem) and (max-width: 85rem) {
  .workbench .vbody { grid-template-columns: 330px minmax(0, 1fr); }
}
@media (max-width: 70rem) {
  .workbench .vbody, .workbench .vbody.nav-hidden { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .workbench .vnav { width: min(94vw, 360px); }
}

/* Controls keep their width; the title yields space before they overflow. */
@media (min-width: 60.001rem) { .workbench .vctl { flex: 0 0 auto; } }
.workbench .vctl select { min-width: 0; }
.home-panel, .home-panel > .sec { scroll-margin-top: calc(var(--report-nav-height, 148px) + 16px); }
@media (max-width: 40rem) { .home-panel, .home-panel > .sec { scroll-margin-top: 14px; } }

/* Experiment 40: upload first, then a stable application shell. */
body { overflow: hidden; }
.app-shell.wrap { max-width: none; width: 100%; height: 100dvh; padding: 0; margin: 0; display: grid; grid-template-rows: 60px minmax(0, 1fr); gap: 0; overflow: hidden; }
.app-header { display: flex; align-items: center; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.app-brand { display: flex; align-items: center; gap: 10px; min-width: 168px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-fg); }.brand-mark svg { width: 22px; height: 22px; }
.app-brand > div { display: grid; gap: 1px; }.app-brand b { font-size: .91rem; font-weight: 650; }.app-brand > div > span { font-size: .66rem; color: var(--muted); }
.dataset-info { flex: 1 1 auto; min-width: 0; }.dataset-info p { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-local { margin-left: auto; color: var(--muted); font-size: .74rem; white-space: nowrap; }
#home-menu-toggle { display: none; }
.start-screen { min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 36px 24px 50px; }
.start-intro { display: grid; gap: 14px; text-align: center; max-width: 620px; }.start-intro h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.35; }.start-intro p { max-width: 480px; margin-inline: auto; color: var(--muted); font-size: .95rem; line-height: 1.6; }
.start-eyebrow { font-size: .64rem; letter-spacing: .11em; font-weight: 500; color: var(--accent-text); }
.start-screen .loader { width: min(100%, 620px); padding: 12px; gap: 14px; box-shadow: 0 6px 28px #00000004; flex-shrink: 0; }
.start-screen .drop, .import-dialog .drop { width: 100%; justify-items: center; text-align: center; gap: 12px; padding: 28px 20px; }
.upload-icon { width: 48px; height: 48px; color: var(--accent-text); margin: 0 0 6px; }
.drop h2 { font-size: 1.05rem; font-family: var(--f-body); }.drop > p { color: var(--muted); font-size: .82rem; }.drop .btns { margin-top: 7px; justify-content: center; }.drop .btn { font-size: .86rem; }
.start-privacy { font-size: .75rem; color: var(--muted); text-align: center; }
.log-help { padding: 0 10px 5px; font-size: .79rem; color: var(--muted); }.log-help > summary { cursor: pointer; width: fit-content; }.log-help[open] { display: grid; gap: 14px; }.log-help .paths { margin-top: 12px; font-size: .76rem; gap: 8px 12px; }.log-help p { font-size: .74rem; line-height: 1.6; }
.app-shell .report { display: grid; grid-template-columns: 192px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; min-width: 0; min-height: 0; height: 100%; position: relative; overflow: hidden; }
.home-sidebar { padding: 18px 10px 14px; background: var(--panel); border-right: 1px solid var(--line); min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.sidebar-caption, .nav-group-label { font-size: .62rem; letter-spacing: .09em; color: var(--muted); padding: 0 12px; }.sidebar-caption { margin-bottom: 12px; }.nav-group-label { margin-top: 18px; margin-bottom: 6px; }
.home-sidebar .secnav { display: flex; flex-direction: column; flex-wrap: nowrap; overflow: visible; border: 0; gap: 4px; }
.home-sidebar .secnav button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 9px 11px; border-radius: 7px; font-size: .79rem; color: var(--muted); line-height: 1.3; }
.home-sidebar .secnav button .work-icon { color: inherit; margin: 0; width: 16px; height: 16px; flex-basis: 16px; }
.home-sidebar .secnav button:hover { background: var(--bg); color: var(--fg); }.home-sidebar .secnav button[aria-current=page] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 2px 0 var(--accent); }
.home-sidebar .secnav button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
.nav-group-divider { display: block; border-top: 1px solid var(--line); margin: 14px 10px 8px; }
.sidebar-local { margin-top: auto; padding: 30px 12px 0; font-size: .67rem; color: var(--muted); line-height: 1.6; max-width: 150px; }
.home-main { display: grid; grid-template-rows: 76px minmax(0, 1fr); min-width: 0; min-height: 0; }
.home-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.home-toolbar h1 { font-family: var(--f-body); font-size: 1.22rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-wrap: nowrap; }
.home-toolbar .units { flex-shrink: 0; padding: 2px; border-radius: 8px; }.home-toolbar .units > span { font-size: .72rem; }.home-toolbar .units button { font-size: .76rem; padding: 5px 9px; border-radius: 6px; }
.home-scroll { min-width: 0; min-height: 0; overflow: auto; scrollbar-gutter: stable; overflow-anchor: none; padding: 22px 24px 36px; }
.home-scroll > #units-note:not([hidden]) { max-width: 76rem; padding: 10px 12px; margin-bottom: 20px; border-radius: 8px; background: var(--accent-soft); font-size: .78rem; line-height: 1.6; }
.home-scroll .home-panel { display: grid; gap: 28px; min-width: 0; scroll-margin-top: 0; }
.home-scroll .sec, .home-scroll .home-panel > .sec { scroll-margin-top: 0; }
.home-panel > header > h2, .home-panel > .sec:first-child > header > h2 { display: none; }
.home-panel > header .muted { max-width: 76rem; }.home-panel > .take { max-width: 70rem; }
#sessions .tablebox { max-height: none; }
#sessions > .card { padding: 16px; }
.home-menu-shade { display: none; }
.import-dialog { padding: 22px; width: min(660px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--fg); overflow: auto; box-shadow: 0 16px 60px #0003; }
.import-dialog::backdrop { background: #10182066; }.import-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }.import-dialog header h2 { font-size: 1.12rem; margin-bottom: 7px; }.import-dialog header p { font-size: .77rem; line-height: 1.5; }.import-dialog header button { flex-shrink: 0; }
.import-dialog .loader { border: 0; padding: 18px 0 0; background: transparent; gap: 14px; }.import-dialog .drop { background: var(--bg); }
@media (max-width: 60rem) {
  .app-header { padding-inline: 14px; gap: 10px; }.app-brand { min-width: 145px; }.dataset-info { display: none; }
  .app-shell.has-data #home-menu-toggle { display: inline-block; margin-left: auto; }
  .app-header .btn { font-size: .73rem; padding: 6px 10px; }
  .app-shell .report { grid-template-columns: minmax(0, 1fr); }
  .home-sidebar { position: absolute; inset: 0 auto 0 0; width: 225px; z-index: 12; visibility: hidden; transform: translateX(-100%); pointer-events: none; box-shadow: 10px 0 32px #0002; }
  .menu-open .home-sidebar { visibility: visible; transform: none; pointer-events: auto; }
  .menu-open .home-menu-shade { display: block; position: absolute; inset: 0; z-index: 11; border: 0; background: #10182066; cursor: pointer; }
  .home-scroll { padding: 18px 16px 28px; }.home-toolbar { padding-inline: 16px; }
}
@media (max-width: 40rem) {
  .app-header { padding-inline: 10px; gap: 8px; }.app-brand { min-width: 135px; gap: 8px; }.app-brand b { font-size: .82rem; }.app-brand > div > span { font-size: .61rem; }.brand-mark { width: 30px; height: 30px; }.header-local { font-size: .66rem; }
  .app-header .btn { padding: 6px 8px; font-size: .7rem; }
  .start-screen { justify-content: flex-start; padding: 38px 16px 28px; gap: 22px; }.start-intro h1 { font-size: 1.6rem; }.start-intro p { font-size: .86rem; }.start-screen .loader { padding: 9px; }.start-screen .drop, .import-dialog .drop { padding: 24px 12px; }.drop h2 { font-size: .95rem; }.drop .btn { padding: 9px 12px; font-size: .8rem; }
  .start-privacy { max-width: 300px; font-size: .7rem; }
  .home-main { grid-template-rows: 90px minmax(0, 1fr); }.home-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 16px; }.home-toolbar h1 { font-size: 1.05rem; }.home-toolbar .units { justify-self: start; }.home-toolbar .units > span { font-size: .69rem; }.home-toolbar .units button { font-size: .71rem; }
  .home-scroll { padding-inline: 12px; }.home-scroll .home-panel { gap: 22px; }#sessions > .card { padding: 12px; }
  .import-dialog { padding: 16px; }.import-dialog .log-help { padding-inline: 2px; }
}

#v-chart .cost-axis text { fill: var(--money); }
#v-chart .cost-axis line, #v-chart .cost-axis path { stroke: var(--money); }

.app-shell, .app-header, .home-main, .home-toolbar, .home-scroll, .home-sidebar, .start-screen .loader, .start-screen .drop, .import-dialog, .import-dialog .loader, .import-dialog .drop { box-sizing: border-box; }

/* Release 41: local chart units, brand actions and full-height conversation. */
:root { --action: var(--accent); --action-fg: var(--accent-fg); --action-soft: var(--accent-soft); --action-text: var(--accent-text); }
#open-import { background: var(--action); color: var(--action-fg); border-color: var(--action); font-weight: 600; }
#open-import:hover { filter: brightness(.94); }
.workbench-toolbar .workbench-tabs > #v-tab-tools { align-self: center; min-height: 30px; padding: 5px 12px; margin: 4px 0; border: 1px solid var(--action); border-radius: 6px; background: var(--action-soft); color: var(--action-text); }
.workbench-toolbar .workbench-tabs > #v-tab-tools.active { background: var(--action); color: var(--action-fg); border-color: var(--action); }
#open-import:focus-visible, #v-tab-tools:focus-visible { outline: 2px solid var(--action); outline-offset: 3px; }
.workbench .vbody.nav-hidden, .workbench .vbody.nav-hidden.timeline-collapsed, .workbench .vbody.nav-hidden.timeline-empty { grid-template-rows: minmax(0, 1fr); }
#v-chart svg text { font-size: 11px; }
.activity-units { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--muted); font-size: .75rem; }
.activity-units select { color: var(--fg); background: var(--panel); border: 1px solid var(--axis); border-radius: 6px; padding: 6px 8px; font: inherit; }
.activity-units select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.activity-note { min-height: 3.2em; margin-top: 12px; font-size: .72rem; line-height: 1.6; }
.unknown-point { fill: var(--muted); }
@media (max-width: 40rem) { .home-main { grid-template-rows: 64px minmax(0, 1fr); } }
