/* Google Sans Flex (OFL, google/fonts ofl/googlesansflex), pinned to opsz 18 and wght 400-700 and cut to Latin.
   It has no Cyrillic: Russian text falls back to Roboto Flex's Cyrillic, glyph by glyph. */
@font-face {
  font-family: 'Google Sans Flex';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/google-sans-flex-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Roboto Flex';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/roboto-flex-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/roboto-mono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Roboto Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/roboto-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

::selection { background: color-mix(in srgb, var(--primary) 35%, transparent); }

/* Catppuccin Mocha arranged as Material 3 tonal roles: the default; theme.js sets another theme's tokens on <html>. */
:root {
  color-scheme: dark;
  --surface: #1e1e2e;
  --surface-low: #181825;
  --surface-lowest: #11111b;
  --container: #26263a;
  --container-high: #313244;
  --container-highest: #3a3b50;
  --primary: #cba6f7;
  --on-primary: #2d1b47;
  --primary-container: #3d3552;
  --on-primary-container: #ecdcff;
  --tonal: #35384d;
  --on-tonal: #dfe3ff;
  --ok: #a6e3a1;
  --warn: #fab387;
  --error: #f38ba8;
  --text: #cdd6f4;
  --text-2: #bac2de;
  --text-3: #a6adc8;
  --outline: #6c7086;
  --inverse-primary: #7028d9;
  --tint: #2a2633;
  --warn-container: #45393e;
  --on-warn-container: #ffdcc4;
  --on-warn: #3b2313;
  --ok-container: #364142;
  --on-ok-container: #c8f3c3;
  --error-container: #45293a;
  --on-error-container: #ffd0dc;
  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --sans: 'Google Sans Flex', 'Roboto Flex', system-ui, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.05, .7, .1, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; font-optical-sizing: auto; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 14px/20px var(--sans);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
.log, .page, .sheet-body.scroll, .stl, .dscroll, .msg.assistant pre, .msg.assistant .table,
.field textarea, textarea.sfield, .cmd-full, .out, .wcard.approval .body.cmd, .wcard.approval .body.plan, .field .live {
  scrollbar-width: thin;
  scrollbar-color: var(--container-highest) transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Material state layer: one rule for hover and press feedback on anything interactive. */
.sl { position: relative; overflow: hidden; }
.sl::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none;
}
@media (hover: hover) { .sl:hover::after { opacity: .08; } }
.sl:active::after { opacity: .14; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Top app bar */
.bar { display: flex; min-height: 64px; padding: 0 4px; padding-top: env(safe-area-inset-top); }
.bar-inner { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
/* The seiman, in the element's colour. */
.glyph { display: block; flex: none; background: currentColor; -webkit-mask: url(mark.svg) center / contain no-repeat; mask: url(mark.svg) center / contain no-repeat; }
.glyph.g22 { width: 22px; height: 22px; }
.glyph.g40 { width: 40px; height: 40px; }
.glyph.g48 { width: 48px; height: 48px; }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-container); color: var(--on-primary-container);
  display: grid; place-items: center;
}
.bar .titles { flex: 1; min-width: 0; }
.bar h1 { display: inline; margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -.01em; line-height: 28px; }
.bar .harness { margin-left: 8px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.status[data-s="working"] .dot { background: var(--primary); animation: pulse 2s ease-in-out infinite; }
.status[data-s="idle"] .dot { background: var(--ok); }
.status[data-s="away"] .dot, .status[data-s="connecting"] .dot { background: none; box-shadow: inset 0 0 0 1px var(--text-3); }
.status[data-s="starting"] .dot { background: var(--warn); }

/* Rows by role: the Chat | Trajectory tabs only show on the chat tab and leave an empty row elsewhere. */
body > .bar { grid-row: 1; }
.ltabs { grid-row: 2; }
body > main { grid-row: 3; }
body > .bottom { grid-row: 4; }
body:not([data-tab="chat"]) .ltabs { display: none; }

/* Chat | Trajectory: the conversation, and what happened on its own */
.ltabs { display: flex; padding: 0 16px 4px; }
.ltabs-inner { flex: 1; display: flex; gap: 4px; min-width: 0; }
.ltab {
  position: relative; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px;
  border: 0; border-radius: 12px; background: none; color: var(--text-3); font: 500 14px/20px var(--sans);
}
.ltab.on { color: var(--text); }
.ltab.on::before { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); pointer-events: none; }
.fold {
  align-self: center; display: flex; align-items: center; gap: 8px; max-width: 100%; min-height: 32px; padding: 4px 14px;
  border: 0; border-radius: 999px; background: var(--container); color: var(--text-3); font: 500 13px var(--sans);
}
.fold span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold b { flex: none; color: var(--primary); font-weight: 500; }
.trig { display: flex; align-items: center; gap: 8px; margin: 6px 0 -6px; color: var(--text-3); font-size: 12.5px; }
.trig::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 3px; background: var(--primary); }
.reply-btn {
  display: block; margin-top: 8px; min-height: 32px; padding: 0 14px; border: 1px solid var(--outline); border-radius: 16px;
  background: none; color: var(--primary); font: 500 13px var(--sans);
}
.replyable { position: relative; -webkit-touch-callout: none; }
.rbtn {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--outline); border-radius: 16px; background: var(--surface); color: var(--text-2);
  opacity: 0; transition: opacity .12s;
}
.msg.assistant > .rbtn { top: -6px; right: 0; }
.replyable:hover > .rbtn, .rbtn:focus-visible { opacity: 1; }
@media (hover: none) {
  .rbtn { display: none; }
  /* A long press replies: no text selection racing it, so the lift can bring up the keyboard. Code stays copyable. */
  .replyable { -webkit-user-select: none; user-select: none; }
  .replyable pre { -webkit-user-select: text; user-select: text; }
}
.traj-empty { align-self: center; max-width: 34ch; margin: 48px 0; text-align: center; color: var(--text-3); font-size: 14px; }
.re {
  position: relative; display: flex; align-items: center; gap: 6px; width: fit-content; max-width: 100%; margin: 0 0 6px; padding: 4px 10px 4px 8px;
  border: 0; border-radius: 10px; background: var(--container); color: var(--text-3); font: 400 12.5px/1.35 var(--sans); text-align: left;
}
.re.sl { overflow: visible; }
.re::before { content: ""; position: absolute; inset: -12px 0; }
.re svg { flex: none; opacity: .8; }
.re span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.user .re { margin-left: auto; background: color-mix(in srgb, var(--on-primary-container) 12%, transparent); color: var(--on-primary-container); white-space: nowrap; }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 3px transparent; } }
.quote {
  max-width: 720px; margin: 0 auto 8px; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px;
  border-radius: 14px; background: var(--container-high); color: var(--text-2); font-size: 13px;
}
.quote > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--text-3); display: grid; place-items: center; }

/* Conversation sheet */
.log {
  position: relative; overflow-x: clip; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  background: var(--surface-low); border-radius: 28px 28px 0 0; clip-path: inset(0 round 28px 28px 0 0);
  padding: 12px 16px 16px;
}
.thread { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.thread > * { animation: rise .35s var(--ease); }
.older {
  align-self: center; min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--tonal); color: var(--on-tonal); font-size: 13px; font-weight: 500;
}
.note {
  align-self: center; max-width: 90%; text-align: center;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  background: var(--container); border-radius: 999px; padding: 4px 12px;
}
.note[data-n]::after { content: attr(data-n); margin-left: 6px; opacity: .7; font-variant-numeric: tabular-nums; }
.note.warn { color: var(--warn); }
.note.error { color: var(--error); }

.msg { overflow-wrap: anywhere; }
.msg.user {
  align-self: flex-end; max-width: 80%; white-space: pre-wrap;
  background: var(--primary-container); color: var(--on-primary-container);
  border-radius: 20px 20px 4px 20px; padding: 11px 16px; line-height: 1.45;
}
.msg .time { display: block; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.msg.user.pending { opacity: .6; }
.msg.user.failed { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--error); }
.msg.user .retry { display: block; margin: 6px 0 -2px auto; padding: 4px 0; border: 0; background: none; color: var(--error); font: 500 14px/20px var(--sans); }
.msg.user .time { color: var(--on-primary-container); opacity: .7; text-align: right; }

/* Markdown inside replies */
.msg.assistant > :first-child { margin-top: 0; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant p { margin: 0 0 .7em; }
/* # ## ### render as h3 h4 h5: a clear step between levels. */
.msg.assistant h3, .msg.assistant h4, .msg.assistant h5, .msg.assistant h6 { margin: 1.2em 0 .4em; font-weight: 600; }
.msg.assistant h3 { font-size: 22px; line-height: 28px; letter-spacing: -.01em; }
.msg.assistant h4 { font-size: 18px; line-height: 24px; }
.msg.assistant h5, .msg.assistant h6 { font-size: 16px; line-height: 22px; }
.msg.assistant ul, .msg.assistant ol { margin: 0 0 .7em; padding-left: 1.4em; }
.msg.assistant li { margin: .15em 0; }
.msg.assistant li > ul, .msg.assistant li > ol { margin: .15em 0 0; }
.msg.assistant a { color: var(--primary); text-underline-offset: 2px; }
.msg.assistant code { font: .9em var(--mono); background: var(--container-high); border-radius: 6px; padding: .1em .35em; }
.msg.assistant pre {
  margin: 0 0 .7em; padding: 12px 14px; overflow-x: auto;
  background: var(--surface-lowest); border-radius: 16px;
  font: 13px/1.6 var(--mono); color: var(--text-2);
}
.msg.assistant pre code { background: none; padding: 0; font: inherit; }
.msg.assistant blockquote { margin: 0 0 .7em; padding: 2px 0 2px 14px; color: var(--text-2); box-shadow: inset 2px 0 var(--outline); }
.msg.assistant hr { border: 0; height: 1px; background: var(--container-high); margin: 1em 0; }
/* Wide tables scroll; a shade at the edge shows there is more (the covers scroll with the content, the shades don't). */
.msg.assistant .table {
  overflow-x: auto; margin: 0 0 .7em; border-radius: 16px;
  background:
    linear-gradient(90deg, var(--container) 30%, transparent) 0 0 / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--container) 30%, transparent) 100% 0 / 40px 100% no-repeat local,
    linear-gradient(90deg, rgb(0 0 0 / .45), transparent) 0 0 / 14px 100% no-repeat scroll,
    linear-gradient(270deg, rgb(0 0 0 / .45), transparent) 100% 0 / 14px 100% no-repeat scroll,
    var(--container);
}
.msg.assistant table { border-collapse: collapse; font-size: 14px; line-height: 20px; min-width: 100%; }
.msg.assistant .table th, .msg.assistant .table td { padding: 8px 12px; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; }
.msg.assistant th { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.msg.assistant td { min-width: 7ch; }
.msg.assistant .table td code { white-space: nowrap; }
.msg.assistant tr + tr td, .msg.assistant tbody tr:first-child td { box-shadow: inset 0 1px var(--container-highest); }

/* Charts in replies (chart.js). --chart-bg is what the chart sits on: the ring around a dot takes its color. */
.chart { position: relative; display: grid; gap: 8px; max-width: 560px; margin: 0 0 .7em; --chart-bg: var(--surface); }
.report .rbody .chart { --chart-bg: var(--container); }
.chart.pending { height: 180px; border-radius: 16px; background: var(--container); }
.chart-title { font-size: 14px; font-weight: 600; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart i.key { width: 12px; height: 2px; border-radius: 1px; }
.chart i.swatch { width: 8px; height: 8px; border-radius: 2px; }
.chart i.point { width: 8px; height: 8px; border-radius: 50%; }
.chart i.s1 { background: var(--chart-1); }
.chart i.s2 { background: var(--chart-2); }
.chart i.s3 { background: var(--chart-3); }
.chart-plot { position: relative; min-width: 0; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }
.chart text { font: 11.5px var(--sans); font-variant-numeric: tabular-nums; fill: var(--text-3); }
.chart .tick.y { text-anchor: end; dominant-baseline: middle; }
.chart .tick.row, .chart .tick.name, .chart .end { fill: var(--text-2); dominant-baseline: middle; }
.chart .grid { stroke: var(--container-high); }
.chart .baseline, .chart .crosshair { stroke: var(--outline); }
.chart line.ref { stroke: var(--text-3); stroke-dasharray: 4 3; }
.chart text.ref { fill: var(--text-2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--chart-1); }
.chart .line.s2 { stroke: var(--chart-2); }
.chart .line.s3 { stroke: var(--chart-3); }
.chart .s1:is(.bar, .dot, .fill) { fill: var(--chart-1); }
.chart .s2:is(.bar, .dot, .fill) { fill: var(--chart-2); }
.chart .s3:is(.bar, .dot, .fill) { fill: var(--chart-3); }
.chart .dot { stroke: var(--chart-bg); stroke-width: 2; }
.chart-tip {
  position: absolute; top: 0; z-index: 1; pointer-events: none; display: grid; gap: 2px; padding: 8px 12px;
  border-radius: 12px; background: var(--container-highest); color: var(--text); font-size: 12px; white-space: nowrap;
}
.chart-tip-x { color: var(--text-3); }
.chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip-row span { color: var(--text-3); }
.chart-tip-row.total { padding-left: 18px; }
.chart .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chart-meters { display: grid; gap: 12px; }
.chart-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.meter-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-value { color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--container-high); overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.meter-track i.over { background: var(--error); }
.chart-bad { margin: -.3em 0 .7em; font-size: 13px; color: var(--text-3); }
.chart i.ink, .chart .dot.ink { background: var(--text); fill: var(--text); }
.chart .tick.lane { fill: var(--text-2); font-weight: 600; dominant-baseline: middle; }
/* A rect takes its size from CSS too, so the page's own .bar and .tile would resize one: chart rects are .fill, .day and .part. */
.chart .day, .chart .part { fill: var(--chart-1); }
.chart .day.none { fill: var(--container-high); }
.chart .day.on, .chart .part.on { stroke: var(--text); stroke-width: 1.5; }
.chart text.part-label { fill: var(--text); font-weight: 600; }
.chart text.part-value { fill: var(--text-2); }
/* Matrix and compare: the reply's table, with each column's best marked. */
.chart .table { margin: 0; }
.chart th .unit { font-weight: 400; color: var(--text-3); }
.chart td { font-variant-numeric: tabular-nums; }
.chart td.none, .chart tr.same :is(th, td) { color: var(--text-3); }
.chart td.best { font-weight: 600; background: color-mix(in srgb, var(--chart-1) 22%, transparent); }
.chart-note { font-size: 12px; color: var(--text-3); }

/* Maths (tex.js): its source until KaTeX has drawn it, or when KaTeX can't read it. */
/* A formula paints only inside its own box, which reaches a little past its text: none can draw over the page around it. */
.tex:not(.drawn) { font: .9em var(--mono); color: var(--text-2); }
div.tex { margin: 0 0 .7em; overflow-x: auto; overflow-y: hidden; contain: paint; }
span.tex.drawn { display: inline-block; max-width: 100%; padding: .2em .1em; margin: -.2em -.1em; contain: paint; }
div.tex:not(.drawn) { white-space: pre-wrap; }
div.tex .katex-display { margin: 0; }

/* Collapsed tool activity: one assist chip per run of tool calls */
.activity { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 10px;
  border: 0; border-radius: 10px; background: var(--container); color: var(--text-2); font-size: 13px; text-align: left;
}
.chip svg { flex: none; }
/* 48 px touch targets without changing the look. */
.chip { position: relative; }
.chip::before { content: ""; position: absolute; inset: -6px 0; }
.chip .spin { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s ease-in-out infinite; }
.chip .chev { transition: transform .2s var(--ease); }
.chip.err { background: color-mix(in srgb, var(--error) 14%, var(--container)); color: var(--error); }
.activity.open .chev { transform: rotate(180deg); }
.calls { align-self: stretch; background: var(--surface-lowest); border-radius: 16px; padding: 6px; display: flex; flex-direction: column; }
.thought-row {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: none; text-align: left; width: 100%;
  font: 13px/1.5 var(--sans); color: var(--text-3);
}
.thought-row svg { flex: none; margin-top: 2px; opacity: .8; }
.thought-row span {
  min-width: 0; flex: 1; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thought-row.open span, .activity.thought-only .thought-row span {
  display: block; -webkit-line-clamp: unset; overflow: visible; color: var(--text-2);
}
.call {
  display: flex; align-items: baseline; gap: 10px; min-height: 36px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: none; text-align: left; font: 12.5px/1.5 var(--mono); color: var(--text-2);
}
.call b { font-weight: 500; color: var(--text-3); flex: none; }
.call span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call.err b { color: var(--error); }
.call.run b { animation: pulse 1.6s ease-in-out infinite; }
.call-detail { display: flex; flex-direction: column; gap: 4px; margin: 0 4px 6px; }
.cmd-full {
  margin: 0; padding: 10px 12px; max-height: 320px; overflow: auto;
  background: var(--container); border-radius: 10px; box-shadow: inset 3px 0 0 var(--primary);
  font: 12px/1.6 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere;
}
.out {
  margin: 0; padding: 10px 12px; max-height: 320px; overflow: auto;
  background: var(--surface-low); border-radius: 10px;
  font: 12px/1.6 var(--mono); color: var(--text-3); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Working indicator and the away card */
.working { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 14px; max-width: 720px; margin: 14px auto 0; }
.working::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s ease-in-out infinite; }
.away {
  max-width: 340px; margin: 40px auto 0; padding: 0 12px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  animation: rise .45s var(--ease);
}
.away .badge { width: 96px; height: 96px; border-radius: 32px; background: var(--container); color: var(--outline); display: grid; place-items: center; }
.away h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.away p { margin: 0; color: var(--text-2); }
.away button {
  min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--tonal); color: var(--on-tonal); font-size: 14px; font-weight: 500;
}
body.offline .thread { opacity: .45; transition: opacity .4s; }

/* Composer */
.composer { padding: 10px 12px 2px; }
.composer-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
/* min-width 0: at large text the textarea's own width would push Send and Stop off the screen. */
.field { flex: 1; min-width: 0; display: flex; background: var(--container-high); border-radius: 28px; min-height: 52px; }
.field textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; color: var(--text);
  font: 16px/24px var(--sans); padding: 14px 20px; min-height: 52px; max-height: 168px;
}
.field textarea::placeholder { color: var(--text-3); }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.fab {
  flex: none; width: 52px; height: 52px; border: 0; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
}
.fab.tonal { background: var(--primary-container); color: var(--on-primary-container); }
/* M3 disabled: 12% on-surface container, 38% content. */
.fab:disabled { background: color-mix(in srgb, var(--text) 12%, transparent); color: color-mix(in srgb, var(--text) 38%, transparent); cursor: default; }
.fab .square { width: 14px; height: 14px; border-radius: 4px; background: currentColor; }
.fab.stopping .square { animation: pulse 1s ease-in-out infinite; }
body.offline .composer { opacity: .5; pointer-events: none; }

@media (min-width: 900px) {
  .bar, .ltabs, .log, .page, .bottom { margin-left: 24px; margin-right: 24px; }
}

/* Buttons shared by login and menus */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 24px; font-size: 14px; line-height: 20px; font-weight: 500;
}
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--tonal); color: var(--on-tonal); }
.btn.text { background: none; color: var(--primary); padding: 0 14px; min-height: 48px; }
.btn.text.danger { color: var(--error); }
.btn:disabled { opacity: .5; pointer-events: none; }
/* An answer on its way: the loading indicator over the hidden label, so the button keeps its size. */
.btn.busy { position: relative; color: transparent; }
.btn.busy:disabled { opacity: 1; }
.btn.busy .loader { position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; }
.btn.busy .loader > i { width: 20px; height: 20px; --loader-bg: var(--on-primary); --loader-img: var(--loader-on-primary); }
.btn.tonal.busy .loader > i { --loader-bg: var(--on-tonal); --loader-img: var(--loader-on-tonal); }
.btn.text.busy .loader > i { --loader-bg: var(--primary); --loader-img: var(--loader-primary); }

/* Login */
body.login { display: grid; place-items: center; grid-template-rows: 1fr; padding: 24px 16px; }
body.login > main { grid-row: 1; }
.signin { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: center; animation: rise .45s var(--ease); }
.signin .mark {
  align-self: center; width: 88px; height: 88px; border-radius: 30px; margin-bottom: 6px;
  background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center;
}
.signin h1 { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -.02em; }
.signin .sub { margin: -6px 0 14px; color: var(--text-3); }
.signin .btn { min-height: 56px; border-radius: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--container-high); }
.pwform { display: flex; flex-direction: column; gap: 10px; }
.pwform .field { border-radius: 18px; min-height: 56px; }
.pwform input {
  flex: 1; border: 0; outline: none; background: none; color: var(--text);
  font: 16px var(--sans); padding: 0 20px; min-height: 56px;
}
.pwform input::placeholder { color: var(--text-3); }
.err { margin: 0; min-height: 1.5em; color: var(--error); font-size: 14px; }

/* Top bar icons: the drawer's menu icon leads, the new side thread trails */
.bar { position: relative; }
.icon-btn {
  margin-left: auto; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: none; color: var(--text-2); display: grid; place-items: center;
}
.bar .icon-btn { color: var(--text); }
.bar .icon-btn.lead { margin-left: 0; position: relative; overflow: visible; }
.bar .icon-btn.lead .nbadge { left: 26px; top: 6px; }
.bar .titles { padding-left: 4px; }
body:not([data-tab="chat"]):not([data-tab="threads"]) #new-thread { display: none; }

/* Fingerprint setup card */
.card {
  max-width: 720px; margin: 14px auto 0; padding: 16px; border-radius: 20px;
  background: var(--container); display: flex; gap: 14px; align-items: flex-start; animation: rise .35s var(--ease);
}
.card .badge { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.card p { margin: 0; color: var(--text-2); font-size: 14px; }
.card .actions { display: flex; gap: 4px; margin: 8px 0 0 -14px; }

/* Shikigami cards in the conversation */
.wcard { background: var(--container); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.wcard .head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wcard .title { display: flex; flex-direction: column; min-width: 0; }
.wcard .title b { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.wcard .meta { font: 12px/1.4 var(--mono); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard .badge { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-container); color: var(--on-primary-container); }
.wcard.done .badge { background: var(--container-high); color: var(--text-3); }
.wcard.failed .badge { background: var(--error-container); color: var(--error); }
.wcard.asking { box-shadow: inset 0 0 0 1.5px var(--primary); }
.wcard .settle { margin: -8px -8px -8px auto; flex: none; background: none; color: var(--text-3); width: 48px; height: 48px; padding: 0; border-radius: 24px; display: grid; place-items: center; }
@media (hover: hover) { .wcard .settle:hover { color: var(--primary); } }
/* An answered question folds to a few quiet lines. */
.wcard.asked .badge { background: var(--container-high); color: var(--text-3); }
.wcard.asked .body { max-height: 4.4em; color: var(--text-3); -webkit-mask-image: linear-gradient(#000 50%, transparent); mask-image: linear-gradient(#000 50%, transparent); }
.wcard.asked.open .body { max-height: none; -webkit-mask-image: none; mask-image: none; }
.wcard .body { font-size: 14px; color: var(--text-2); max-height: 9.5em; overflow: hidden; overflow-wrap: anywhere; }
.wcard .body.task { white-space: pre-wrap; max-height: 4.4em; }
.wcard.clipped:not(.open) .body { -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.wcard.open .body { max-height: none; }
.wcard .body > :first-child { margin-top: 0; }
.wcard .body > :last-child { margin-bottom: 0; }
.wcard .body p, .wcard .body ul, .wcard .body ol, .wcard .body pre { margin: 0 0 .6em; }
.wcard .body ul, .wcard .body ol { padding-left: 1.3em; }
.wcard .body code { font: .9em var(--mono); background: var(--container-high); border-radius: 6px; padding: .1em .35em; }
.wcard .body pre { padding: 10px 12px; overflow-x: auto; background: var(--surface-lowest); border-radius: 12px; font: 12.5px/1.55 var(--mono); }
.wcard .body pre code { background: none; padding: 0; }
.wcard .body a { color: var(--primary); }
.wcard .more { align-self: flex-start; border: 0; background: none; color: var(--primary); font-size: 13px; font-weight: 500; padding: 15px 8px; margin: -15px -8px; border-radius: 8px; }

.run { --t-bg: var(--primary-container); --t-fg: var(--on-primary-container); --t-dot: var(--primary); }
.ok { --t-bg: var(--ok-container); --t-fg: var(--on-ok-container); --t-dot: var(--ok); }
.bad { --t-bg: var(--error-container); --t-fg: var(--on-error-container); --t-dot: var(--error); }
.idle { --t-bg: var(--container-high); --t-fg: var(--text); --t-dot: var(--text-3); }

/* Bottom sheet */
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.sheet-wrap { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.scrim { position: absolute; inset: 0; border: 0; background: rgb(0 0 0 / .5); animation: fadeIn .3s; }
.sheet {
  position: relative; width: 100%; max-width: 720px; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--container); border-radius: 28px 28px 0 0; padding: 0 0 env(safe-area-inset-bottom);
  animation: sheetUp .45s var(--ease);
}
.sheet-wrap.closing { pointer-events: none; }
.sheet-wrap.closing .scrim { animation: fadeOut var(--effects-fast-ms, 160ms) var(--effects-fast, ease-out) forwards; }
.sheet-wrap.closing .sheet { animation: sheetDown var(--effects-fast-ms, 160ms) var(--effects-fast, ease-out) forwards; }
.handle { flex: none; align-self: center; width: 32px; height: 4px; border-radius: 2px; background: var(--outline); margin: 16px 0 8px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; padding: 6px 20px 16px; }
.sheet .question { background: var(--warn-container); color: var(--on-warn-container); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet h2.list { margin: 0; font-size: 22px; font-weight: 500; }

/* Images */
.field .attach {
  flex: none; align-self: flex-end; width: 44px; height: 44px; margin: 4px 0 4px 6px; border: 0; border-radius: 50%;
  background: none; color: var(--text-3); display: grid; place-items: center;
}
.field .attach + textarea { padding-left: 8px; }
/* Dictation (docs/asr.md): the trailing mic; recording swaps the field for the level, the time and the stop square */
.field .mic {
  flex: none; align-self: flex-end; width: 44px; height: 44px; margin: 4px 4px 4px 0; border: 0; border-radius: 50%;
  background: none; color: var(--text-3); display: grid; place-items: center;
}
.field textarea:has(~ .mic:not([hidden])) { padding-right: 4px; }
.field .mic .square, .field .mic .spin, .field .mic.on svg, .field .mic.busy svg { display: none; }
.field .mic.on { background: var(--primary); color: var(--on-primary); border-radius: 16px; }
.field .mic.on .square { display: block; width: 14px; height: 14px; border-radius: 4px; background: currentColor; }
.field .mic.busy .spin {
  display: block; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--container-highest);
  border-top-color: var(--primary); animation: spin 0.9s linear infinite;
}
.field.rec { box-shadow: inset 0 0 0 2px var(--primary); flex-wrap: wrap; }
/* The draft stays in view while recording: phrases land in it, the newest tinted, dots while one is on its way */
.field .live {
  order: -1; flex: 1 0 100%; position: relative; max-height: 168px; overflow-y: auto; padding: 14px 20px 0;
  font: 15px/1.4 var(--sans); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere;
}
.field .live .new { background: color-mix(in srgb, var(--primary) 22%, transparent); border-radius: 4px; box-decoration-break: clone; }
.field .live .wait { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.field .live .wait i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: pulse 1.2s infinite; }
.field .live .wait i:nth-child(2) { animation-delay: .2s; }
.field .live .wait i:nth-child(3) { animation-delay: .4s; }
.field .level { flex: 1; display: flex; align-items: center; gap: 3px; padding: 0 6px; min-height: 52px; }
.field .level i { width: 3px; height: 4px; border-radius: 2px; background: var(--primary); }
.field .time { align-self: center; color: var(--text-2); font: 500 13px var(--sans); font-variant-numeric: tabular-nums; padding: 0 8px 0 2px; }
.field.fresh { box-shadow: inset 0 0 0 2px var(--primary), 0 0 0 4px var(--primary-container); transition: box-shadow .3s; }
/* Voice calls (docs/voice.md): the call bar in place of the composer, and the call's turns in the chat */
.callbar { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px; }
.callbar { flex-wrap: wrap; }
/* The debug panel: a tap on the pill opens it above the controls; it stays, with its beeps, between calls. */
.calldebug { max-width: 696px; margin: 10px 12px 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 16px; background: var(--container-high); }
@media (min-width: 720px) { .calldebug { margin: 10px auto 0; } }
.calldebug pre { margin: 0; font: 12px/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; }
.calldebug .beeps { display: flex; flex-wrap: wrap; gap: 6px; }
.calldebug button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--tonal); color: var(--on-tonal); font: 500 13px var(--sans); }
/* The call goes on on the other pages: the bar keeps its own sheet there. */
body:not([data-tab="chat"]) .callbar { background: var(--container); border-radius: 24px 24px 0 0; }
.callbar .pill { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border-radius: 28px; background: var(--container-high); transition: box-shadow .15s; }
.callbar .pill.me { box-shadow: inset 0 0 0 2px var(--primary); }
.callbar .who { font: 500 14px var(--sans); white-space: nowrap; }
.callbar .lvl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; height: 30px; overflow: hidden; }
.callbar .lvl i { flex: none; width: 3px; height: 4px; border-radius: 2px; background: var(--primary); }
.callbar .pill.them .lvl i { background: var(--on-primary-container); opacity: .75; }
.callbar .t { color: var(--text-2); font: 500 13px var(--sans); font-variant-numeric: tabular-nums; }
.callbar .mute { background: var(--tonal); color: var(--on-tonal); }
.callbar .mute .off, .callbar .mute.on svg:not(.off) { display: none; }
.callbar .mute.on { background: var(--on-tonal); color: var(--tonal); }
.callbar .mute.on .off { display: block; }
.callbar .end { background: var(--error); color: var(--surface); }
.callbar .speed { background: var(--tonal); color: var(--on-tonal); font: 500 14px var(--sans); font-variant-numeric: tabular-nums; }
.msg.voiced::before {
  content: ""; float: left; width: 14px; height: 14px; margin: 3px 8px 0 -4px; background: currentColor; opacity: .6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 10v4M8 6v12M12 9v6M16 4v16M20 10v4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 10v4M8 6v12M12 9v6M16 4v16M20 10v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.attachments { max-width: 720px; margin: 0 auto 8px; display: flex; gap: 8px; overflow-x: auto; }
.att { position: relative; flex: none; width: 72px; height: 72px; border-radius: 14px; overflow: hidden; background: var(--container-high); }
.att img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A 44 px button in the corner; the visible 24 px circle is its background. */
.att .remove {
  position: absolute; top: 0; right: 0; width: 44px; height: 44px; border: 0; padding: 4px 4px 16px 16px;
  background: radial-gradient(circle at calc(100% - 16px) 16px, color-mix(in srgb, var(--surface-lowest) 75%, transparent) 12px, transparent 12.5px);
  color: var(--text); display: grid; place-items: center;
}
.msg .pics { display: grid; gap: 4px; margin: -6px -11px 8px; }
.msg .pics.only { margin-bottom: -6px; }
.msg .pics.n2 { grid-template-columns: 1fr 1fr; }
.msg .pics.n3 { grid-template-columns: 1fr 1fr 1fr; }
.msg .pics img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 16px; display: block; cursor: zoom-in; }
.msg .pics.n2 img, .msg .pics.n3 img { aspect-ratio: 1; }
.shown { margin: 0; align-self: flex-start; max-width: 100%; display: flex; flex-direction: column; gap: 6px; }
.shown img { max-width: 100%; max-height: 60vh; border-radius: 16px; display: block; cursor: zoom-in; background: var(--container); }
.shown figcaption, .shown .from { font-size: 13px; color: var(--text-3); }
.fchip { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 340px; padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--container-high); color: var(--text); text-decoration: none; }
.fchip .ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tonal); color: var(--on-tonal); }
.fchip .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fchip b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip small { font-size: 12px; color: var(--text-3); }
.fchip > svg { flex: none; color: var(--text-3); }
.fchip.expired { opacity: .6; }
.msg.user .files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.msg.user .fchip { background: color-mix(in srgb, var(--on-primary-container) 10%, transparent); color: var(--on-primary-container); }
.msg.user .fchip small, .msg.user .fchip > svg { color: inherit; opacity: .75; }
.att.file { width: auto; max-width: 180px; display: flex; align-items: center; gap: 8px; padding: 0 30px 0 12px; color: var(--text-2); }
.att.file .fname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att.busy { opacity: .55; }
.viewer { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, var(--surface-lowest) 94%, transparent); display: grid; place-items: center; padding: 12px; animation: fadeIn .2s; cursor: zoom-out; overflow: hidden; touch-action: none; }
.viewer img { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); object-fit: contain; border-radius: 8px; transform-origin: center; cursor: zoom-in; user-select: none; }
.viewer.zoomed img { cursor: grab; border-radius: 0; }
.viewer-bar { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; z-index: 1; display: flex; gap: 4px; }
.viewer-bar .icon-btn { margin: 0; color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); }
@media (hover: hover) { .viewer-bar .icon-btn:hover { background: color-mix(in srgb, var(--container-high) 90%, transparent); } }

/* Approval cards */
.status[data-s="waiting"] .dot { background: var(--primary); }
.status[data-s="waiting"] { color: var(--primary); }
.wcard.approval:not(.settled) { box-shadow: inset 0 0 0 1.5px var(--primary); }
.wcard.approval .body { color: var(--text); }
.wcard.approval .body.cmd { font: 13px/1.5 var(--mono); white-space: pre-wrap; max-height: 7.5em; overflow: auto; background: var(--surface); border-radius: 10px; padding: 8px 10px; }
.wcard.approval .body.task { max-height: 9em; overflow: auto; }
.wcard.approval .foot { display: flex; align-items: center; gap: 4px; margin: 2px -6px -4px 0; min-height: 40px; }
.wcard.approval .foot .left { flex: 1; font-size: 13px; color: var(--text-3); }
.wcard.approval .body .path { color: var(--text-3); }
.wcard.approval .body .del { color: var(--error); }
.wcard.approval .body .add { color: var(--ok); }
.wcard.approval .body.plan { background: var(--surface); border-radius: 10px; padding: 8px 12px; max-height: 16em; overflow: auto; color: var(--text); }
.wcard.approval .choices { display: flex; flex-direction: column; gap: 6px; }
.wcard.approval .choice { text-align: left; border: 1px solid var(--container-highest, #45475a); background: none; color: var(--text); border-radius: 14px; padding: 8px 12px; font: inherit; font-size: 13.5px; line-height: 1.4; cursor: pointer; }
.wcard.approval .choice code { font: 12.5px var(--mono); background: var(--container-high); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.wcard.approval .choice small { color: var(--text-3); font-size: 12.5px; }
.wcard.approval .choice small.warn { color: var(--warn, #fab387); }
.wcard.approval textarea.note { font: inherit; font-size: 14px; color: var(--text); background: none; border: 1.5px solid var(--primary); border-radius: 12px; padding: 8px 10px; resize: vertical; }
.wcard.approval .btn.icon { background: none; color: var(--text-2); width: 40px; height: 40px; padding: 0; border-radius: 20px; display: grid; place-items: center; }
.wcard.approval.settled .body { max-height: 4.4em; overflow: hidden; color: var(--text-2); -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.wcard.approval.approved .foot .left { color: var(--ok); }
.wcard.approval.denied .foot .left, .wcard.approval.expired .foot .left { color: var(--error); }
.wcard.approval.approved .badge { background: var(--ok-container); color: var(--ok); }
.wcard.approval.denied .badge, .wcard.approval.expired .badge { background: var(--error-container); color: var(--error); }
.wcard.approval.cancelled .foot .left, .wcard.approval.restart .foot .left { color: var(--text-3); }
.wcard.approval .sub { font-size: 12px; color: var(--text-3); }
.wcard.approval.secret .body p { margin: 4px 0 0; color: var(--text-2); }
.wcard.approval .secret-box p.warn { margin: 0 0 4px; font-size: 14px; color: var(--warn); }
.wcard.approval .secret-box { display: flex; flex-direction: column; gap: 4px; }
.wcard.approval .secret-value { font: 14px var(--mono); color: var(--text); background: var(--surface); border: 1.5px solid var(--container-highest); border-radius: 12px; padding: 10px 12px; outline: none; resize: vertical; }
.wcard.approval .secret-value:focus { border-color: var(--primary); }
.wcard.approval .secret-box .err { min-height: 0; font-size: 13px; }
.wcard.approval .secret-box small { font-size: 12.5px; color: var(--text-3); padding: 0 4px; }

/* Usage */
.meter { display: flex; flex-direction: column; gap: 8px; background: var(--surface-low); border-radius: 20px; padding: 14px 16px; --tone: var(--ok); }
.meter.warn { --tone: var(--warn); }
.meter.bad { --tone: var(--error); }
.meter .top { display: flex; align-items: baseline; justify-content: space-between; }
.meter b { font-weight: 500; font-size: 15px; }
.meter .pct { font-size: 28px; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--tone); }
.meter .bar-track { height: 8px; border-radius: 4px; background: var(--container-high); overflow: hidden; }
.meter .bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--tone); transition: width .6s var(--ease); }
.meter .sub { font-size: 13px; color: var(--text-3); }
.usage-note { margin: 0; font-size: 13px; color: var(--text-3); }
.usage-h { margin: 6px 0 0; font-size: 14px; font-weight: 500; color: var(--text-2); }
.ulist { display: flex; flex-direction: column; overflow-y: auto; }
.urow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--container-high); }
.urow:first-child { border-top: 0; }
.urow b { font-weight: 500; font-size: 14px; }
.urow time { font-size: 12px; color: var(--text-3); text-align: right; }
.urow span { grid-column: 1 / 3; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.urow .tags { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: 1px; }
.tag { font: 500 11px/16px var(--sans); font-style: normal; padding: 0 6px; border-radius: 6px; background: var(--container-high); color: var(--text-2); }
.tag.yours { background: var(--tonal); color: var(--on-tonal); }
.quota { display: flex; flex-direction: column; gap: 14px; }
/* The harness picker: an M3 Expressive connected button group; the picked one turns fully round. */
.hsel { display: flex; gap: 2px; }
.hsel button {
  flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--container-high); color: var(--text);
  font: 500 14px/20px var(--sans); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-radius .2s var(--ease), background-color .2s var(--ease);
}
.hsel button:first-child { border-radius: 20px 8px 8px 20px; }
.hsel button:last-child { border-radius: 8px 20px 20px 8px; }
.hsel button.on { border-radius: 20px; background: var(--primary); color: var(--on-primary); }
.cost, .metrics { display: flex; flex-direction: column; gap: 8px; }
.crow { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 2px 8px; padding: 10px 0; border: 0; border-top: 1px solid var(--container-high); background: none; text-align: left; }
.crow:first-child { border-top: 0; }
.crow b { font-weight: 500; font-size: 15px; }
.crow .amt { font-size: 20px; font-variant-numeric: tabular-nums; }
.crow small { grid-column: 1 / 3; font-size: 12px; color: var(--text-3); }
.crow .chev { color: var(--text-3); transition: transform .2s var(--ease); }
.crow.open .chev { transform: rotate(90deg); }
.mfacts { padding: 2px 0 12px; font-size: 13px; gap: 4px 14px; }
.mfacts dd { font-variant-numeric: tabular-nums; }
.metrics .btn.text { align-self: flex-start; margin-top: 4px; }
.cmodels { display: flex; flex-direction: column; gap: 6px; padding: 0 0 10px; }
.cmodel { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; background: var(--surface-low); border-radius: 14px; padding: 8px 12px; font-size: 14px; }
.cmodel .amt { font-variant-numeric: tabular-nums; }
.cmodel small { grid-column: 1 / 3; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.sheet-body.scroll { overflow-y: auto; overscroll-behavior: contain; }

/* Activity log */
/* Phone app sheet */
.pblock { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 0 4px; }
.pcode { display: flex; flex-direction: column; gap: 6px; }
.paddr { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 14px; border-radius: 12px; background: var(--container-high); }
.paddr code { flex: 1; min-width: 0; font: 15px/1.4 var(--mono); overflow-wrap: anywhere; }
.pcode b { font: 500 34px/1.2 var(--mono); letter-spacing: .08em; color: var(--primary); user-select: all; }
.psec { margin: 20px 0 4px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--container-high); }
.prow:first-child { border-top: 0; }
.ptext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ptext b { font-weight: 500; }
.ptext span { font-size: 13px; color: var(--text-3); }

.alist { display: flex; flex-direction: column; }
.aday { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 12px 0 4px; }
.arow { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; border-top: 1px solid var(--container-high); }
.aday + .arow { border-top: 0; }
.atop { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.atop time { color: var(--text-3); font-variant-numeric: tabular-nums; }
.atop b { font-weight: 500; }
.atop .tool { color: var(--text-2); }
.atop .tag { font-size: 12px; padding: 0 8px; border-radius: 6px; background: var(--container-high); color: var(--text-2); }
.arow.bad .tag { background: var(--error-container); color: var(--error); }
.arow.ok .tag { background: var(--ok-container); color: var(--ok); }
.arow code { font: 12px/1.45 var(--mono); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tasks: the lane's box; its rows are in m3x.css */
.tasks { max-width: 720px; margin: 0 auto; padding: 16px 4px 24px; }
body[data-lane="t"] #fp-card, body[data-lane="k"] .composer, body[data-lane="k"] #working, body[data-lane="k"] #hello, body[data-lane="k"] #fp-card { display: none; }
.tasks-empty { margin: 48px 32px; text-align: center; font-size: 14px; color: var(--text-3); }

/* Pages: the drawer's destinations; the chat's composer is the only bottom block */
.log { padding-bottom: 40px; }
.page {
  overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; background: var(--surface-low);
  border-radius: 28px 28px 0 0; clip-path: inset(0 round 28px 28px 0 0);
  padding: 4px 16px 40px; display: flex; flex-direction: column;
}
.page > * { flex: none; width: 100%; max-width: 720px; margin-left: auto; margin-right: auto; }
.page > .older { width: auto; margin-top: 14px; }
#usage { padding-top: 12px; gap: 14px; }
body > main.page { grid-row: 3 / 5; }
.bottom { position: relative; z-index: 1; margin-top: -24px; background: var(--container); border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
body:not([data-tab="chat"]) .bottom:not(:has(#callbar:not([hidden]))),
body[data-lane="k"] .bottom:not(:has(#callbar:not([hidden]))) { display: none; }
body:not([data-tab="chat"]) .bottom { margin-top: 0; background: none; padding: 0; }
body:not([data-tab="chat"]) .composer { display: none; }
.composer { padding-bottom: 12px; }
.nbadge {
  position: absolute; left: 34px; top: -1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--primary); color: var(--on-primary); font: 600 11px/18px var(--sans); font-style: normal; text-align: center; font-variant-numeric: tabular-nums;
}
.nbadge.attn { background: var(--warn); color: var(--on-warn); }
.ring-ico { transform: rotate(-90deg); }
.ring-ico circle { fill: none; stroke-width: 2.4; }
.ring-ico .t { stroke: currentColor; opacity: .3; }
.ring-ico .f { stroke: var(--ok); stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ditem[data-tone="bad"] .ring-ico .f { stroke: var(--error); }
.ditem[data-tone=""] .ring-ico .f { stroke: none; }

/* Agents: M3 lists; running work shows a progress indicator, not a colored chip */
.sec { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 4px 8px; font-size: 14px; font-weight: 500; color: var(--primary); }
.sec small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.group { display: flex; flex-direction: column; gap: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { flex: none; width: 24px; height: 24px; animation: spin 1.4s linear infinite; }
.spinner circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.spinner .t { stroke: var(--container-highest); }
.spinner .f { stroke: var(--primary); }
.empty { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 64px 24px; color: var(--text-3); font-size: 14px; }
.empty b { color: var(--text); font-size: 16px; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }
/* Meter cards sit one step below their page, as in the app. */
.page .meter { background: var(--surface-lowest); }

/* Details sheet: facts as a key/value list, actions as full-width tonal buttons */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 14px; line-height: 20px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv dd.mono { font: 12px/20px var(--mono); }
.dactions { display: flex; flex-direction: column; gap: 8px; }
.dwait { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 20px;
  background: var(--warn-container); color: var(--on-warn-container); }
.change-h { font-size: 22px; line-height: 28px; font-weight: 500; margin: 0 0 4px; }
#sheet-body .lab { margin: 14px 0 8px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-2); }
#sheet-body .hint { margin: 8px 0 0; font-size: 12px; line-height: 16px; color: var(--text-3); }
.seg { display: flex; gap: 2px; }
.seg button {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 10px; border: 0; border-radius: 8px;
  background: var(--container-high); color: var(--text-2); font: 500 14px/20px var(--sans); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-radius .37s var(--ease), background-color .22s var(--ease), color .22s var(--ease);
}
.seg button:first-child { border-radius: 24px 8px 8px 24px; }
.seg button:last-child { border-radius: 8px 24px 24px 8px; }
.seg button.on { background: var(--primary); color: var(--on-primary); border-radius: 24px; font-weight: 600; }
.radios { display: flex; flex-direction: column; }
.radio { display: flex; gap: 16px; align-items: flex-start; border: 0; background: none; color: var(--text); text-align: left; font: inherit; padding: 10px 4px; border-radius: 12px; cursor: pointer; }
.radio .rdot { flex: none; width: 20px; height: 20px; border-radius: 10px; border: 2px solid var(--text-3); margin-top: 1px; }
.radio.on .rdot { border-color: var(--primary); box-shadow: inset 0 0 0 3px var(--container), inset 0 0 0 10px var(--primary); }
.radio b { display: block; font-weight: 400; font-size: 15.5px; }
.radio small { display: block; color: var(--text-3); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.dbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 20px; border: 0;
  border-radius: 99px; background: var(--primary-container); color: var(--on-primary-container); font: 500 14px var(--sans);
}
.dbtn span { display: inline; }
.dbtn.stop { background: color-mix(in srgb, var(--error) 16%, var(--container)); color: var(--error); }
.dbtn .square { width: 12px; height: 12px; border-radius: 3px; background: currentColor; }
.dbtn:disabled { opacity: .5; }
.qopt .sent { margin-left: auto; font-size: 12px; color: var(--primary); }
.taskd { flex: none; border-radius: 16px; background: var(--container-high); overflow: hidden; }
.taskd-head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 14px 8px 10px; border: 0; background: none; text-align: left; }
.taskd .ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--tonal); color: var(--on-tonal); }
.taskd .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.taskd b { font-size: 12px; font-weight: 500; color: var(--text-3); }
.taskd .preview { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.taskd .chev { flex: none; color: var(--text-3); transition: transform .2s var(--ease); }
.taskd.open .chev { transform: rotate(180deg); }
.taskd.open .preview { visibility: hidden; height: 0; }
.taskd .full { padding: 0 16px 14px 54px; font-size: 14px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; }

/* Agents list: grouped by what needs the user; a tile tinted by project */
.agroup { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.agroup h2 { margin: 0; padding: 0 8px 6px; font-size: 13px; font-weight: 500; letter-spacing: .02em; color: var(--text-3); }
.agroup.ask h2 { color: var(--warn); }
.agroup.work h2 { color: var(--primary); }
.agent {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px; border: 0; border-radius: 18px;
  background: none; color: var(--text); text-align: left;
}
.agent.ask { background: var(--tint); }
.agroup.done .agent .top b { color: var(--text-2); }
.tile {
  flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent);
}
.tile.ask { color: var(--warn); background: color-mix(in srgb, var(--warn) 18%, transparent); }
.tile.work svg { animation: spin 1.4s linear infinite; }
.tile.done { color: var(--text-3); background: var(--container-high); }
.tile.bad { color: var(--error); }
.agent .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agent .top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent .top b { font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .tag { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--container-high); color: var(--text-2); }
.agent time { margin-left: auto; flex: none; font-size: 12px; line-height: 16px; color: var(--text-3); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.agent time.fresh::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.agent .sub { font-size: 13.5px; line-height: 18px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .proj { font-weight: 500; }
.agent.ask .line { color: var(--warn); }
.agent.work .line { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .tile.work svg { animation-duration: 4s; } }

/* The page of one agent: full screen above the tabs; app bar, timeline that sticks to the bottom, composer */
.spage {
  position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; background: var(--surface);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); animation: fadeIn .2s;
}
body.spage-open { overflow: hidden; }
.sbar { flex: none; display: flex; align-items: center; gap: 4px; min-height: 64px; padding: 8px 8px 8px 4px; max-width: 760px; width: 100%; margin: 0 auto; }
.sbar .handoff { flex: none; height: 32px; padding: 0 12px; margin-right: 4px; border: 0; border-radius: 16px; background: var(--tonal); color: var(--on-tonal); font: 500 13px var(--sans); white-space: nowrap; cursor: pointer; }
.sbar .handoff:disabled { opacity: .5; }
.sbar .back, .sbar .ring { flex: none; width: 48px; height: 48px; border-radius: 24px; border: 0; background: none; display: grid; place-items: center; color: var(--text); }
.sbar .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sbar h1 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbar .sub { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.sbar .sub i { flex: none; width: 7px; height: 7px; border-radius: 4px; background: var(--outline); }
.sbar .sub i.work { background: var(--primary); }
.sbar .sub i.ask { background: var(--warn); }
.sbar .sub b { font-weight: 500; }
.sbar .sub span.ask { color: var(--warn); }
.ring { position: relative; color: var(--text-2) !important; }
.ring svg circle { fill: none; stroke-width: 3; }
.ring .t { stroke: var(--container-highest); }
.ring .f { stroke: var(--text-3); stroke-linecap: round; }
.ring.hot .f { stroke: var(--warn); }
.ring.info { color: var(--text-2); }
.ring span { position: absolute; font: 600 10.5px var(--sans); font-variant-numeric: tabular-nums; }
.stl { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; padding: 8px 16px 12px; }
.stl > * { width: 100%; max-width: 720px; margin-left: auto; margin-right: auto; }
.sthread { margin-top: auto; display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; }
.sthread .msg.user { max-width: 88%; }
.qcard { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 24px; background: var(--tint); box-shadow: inset 0 0 0 1.5px var(--warn); }
.qhead { display: flex; align-items: center; gap: 10px; }
.qic { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--warn); background: color-mix(in srgb, var(--warn) 18%, transparent); }
.qt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qt b { font-size: 15.5px; font-weight: 500; overflow-wrap: anywhere; }
.qt small { font-size: 12.5px; color: var(--text-3); }
.qopt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; min-height: 44px; padding: 12px 14px;
  border: 0; border-radius: 16px; background: var(--container-high); color: var(--text); text-align: left;
}
.qopt b { font-size: 14.5px; font-weight: 500; }
.qopt small { font-size: 12.5px; line-height: 17px; color: var(--text-3); }
.qopt:disabled { cursor: default; opacity: .7; }
.qopt.picked { box-shadow: inset 0 0 0 2px var(--primary); opacity: 1; }
.qnote { margin: 0; padding: 0 4px; font-size: 12.5px; color: var(--text-3); }
.sfoot { flex: none; width: 100%; max-width: 744px; margin: 0 auto; padding: 0 12px 12px; }
.snote { margin: 0 4px 8px; font-size: 13px; color: var(--text-3); }
.snote.error { color: var(--error); }
.scomposer { display: flex; align-items: flex-end; gap: 8px; }
.scomposer .field textarea { min-height: 52px; padding: 15px 18px 15px 8px; }
.scomposer textarea:disabled { opacity: .6; }
.sfoot .attachments { margin: 0 0 8px; }

/* A tool call still running: the pill shows how long, the command, and its last output lines */
.activity.running { align-self: stretch; background: var(--container); border-radius: 20px; padding: 0 0 8px; gap: 0; }
.activity.running .chip { align-self: stretch; background: none; color: var(--text); }
.chip .clock { margin-left: auto; padding-left: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.activity.running .chip .chev { margin-left: 6px; }
.livebox { align-self: stretch; display: flex; flex-direction: column; gap: 6px; padding: 0 12px; }
.livebox .cmd { font: 11.5px/16px var(--mono); color: var(--text); overflow-wrap: anywhere; padding: 0 2px; }
.livebox .tail { margin: 0; font: 11px/16px var(--mono); color: var(--text-3); background: var(--surface); border-radius: 12px; padding: 7px 10px; white-space: pre; overflow: hidden; }
.activity.running .calls { margin: 8px 8px 0; align-self: stretch; }
.dhead h2 { margin: 0; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.dhead .sub { font-size: 13px; color: var(--text-3); }

/* Empty chat and the snackbar */
.hello { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; color: var(--text-2); font-size: 17px; }
.hello b { font-weight: 500; }
.hello img { opacity: .9; }
.hello[hidden] { display: none; }
.snack {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  max-width: min(560px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 8px;
  background: var(--text); color: var(--surface); font-size: 14px; box-shadow: 0 4px 16px rgb(0 0 0 / .35);
}
.snack[hidden] { display: none; }
.snack:has(button) { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; min-width: min(344px, calc(100vw - 32px)); }
.snack:has(button)[hidden] { display: none; }
.snack span { flex: 1; }
.snack button { flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: none; color: var(--inverse-primary); font: 600 14px var(--sans); }

/* Agents archive: one row at the end of the list, a searchable page, a banner on an archived agent */
.archrow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; margin-top: 10px; padding: 10px; border: 0; border-radius: 18px; background: none; color: var(--text); text-align: left; }
.archrow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.archrow .txt b { font-size: 15.5px; font-weight: 500; }
.archrow .txt span { font-size: 13.5px; color: var(--text-3); }
.archrow > svg { flex: none; color: var(--text-3); }
.agent.arch .tile { opacity: .7; }
.ahead { display: flex; align-items: center; gap: 4px; margin: 0 0 4px -8px; }
.ahead .back { flex: none; width: 48px; height: 48px; border: 0; border-radius: 24px; background: none; display: grid; place-items: center; color: var(--text); }
.ahead h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 500; }
.ahead .count { color: var(--text-3); font-size: 12px; line-height: 16px; padding-right: 8px; font-variant-numeric: tabular-nums; }
.asearch { display: flex; align-items: center; gap: 10px; height: 48px; margin: 4px 0 8px; padding: 0 16px; border-radius: 24px; background: var(--container-high); color: var(--text-3); }
.asearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 15px var(--sans); }
.asearch input::-webkit-search-cancel-button { filter: invert(.7); }
.asearch:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
mark { background: color-mix(in srgb, var(--primary) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
/* Search: a hit shows up to three lines of what was said around its matches */
.agent.shit { align-items: flex-start; }
.agent.shit .sub { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow-wrap: anywhere; }
.agent.shit .who { color: var(--text-2); font-weight: 500; }
.archbar { flex: none; display: flex; align-items: center; gap: 12px; width: calc(100% - 32px); max-width: 720px; margin: 0 auto 4px; padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--container); color: var(--text-2); font-size: 14px; line-height: 1.4; }
.archbar[hidden] { display: none; }
.archbar svg { flex: none; color: var(--text-3); }
.archbar span { flex: 1; }
.archbar button { flex: none; min-height: 40px; padding: 0 12px; border: 0; border-radius: 20px; background: none; color: var(--primary); font: 500 14px var(--sans); white-space: nowrap; }
.dbtn.tonal { background: var(--container-high); color: var(--text); }
.mwho { padding: 0 8px 10px; color: var(--text-3); font-size: 14px; }
.mopt { display: flex; gap: 16px; align-items: flex-start; width: 100%; padding: 12px 8px; border: 0; border-radius: 14px; background: none; color: var(--text); text-align: left; font-size: 16px; }
.mopt small { display: block; color: var(--text-3); font-size: 13.5px; margin-top: 2px; line-height: 1.4; }
.mopt svg { flex: none; margin-top: 1px; color: var(--text-2); }

/* Wide: the header and the tabs line up with the 720 px content column inside full-bleed bars. */
@media (min-width: 840px) {
  .bar-inner, .ltabs-inner { width: 100%; max-width: 752px; margin: 0 auto; box-sizing: border-box; }
}
/* Short landscape: a compact one-line header, gone while typing so the chat keeps its space. */
@media (orientation: landscape) and (max-height: 520px) {
  .bar { min-height: 48px; height: 48px; }
  .bar .titles { display: flex; align-items: baseline; gap: 12px; }
  .bar h1 { font-size: 18px; }
  .ltab { height: 34px; }
  body.typing .bar, body.typing .ltabs { display: none; }
}

/* ---------- theme picker: each tile is drawn in its own theme's tokens ---------- */
.trow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.trl { font-size: 14px; color: var(--text-2); }
.tseg { display: flex; border: 1px solid var(--outline); border-radius: 999px; overflow: hidden; }
.tseg button { border: 0; background: none; color: var(--text-2); font: 500 13px var(--sans); padding: 8px 14px; cursor: pointer; }
.tseg button + button { border-left: 1px solid var(--outline); }
.tseg button.on { background: var(--tonal); color: var(--on-tonal); font-weight: 600; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ttile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 6px; border: 0; border-radius: 20px; text-align: left;
  background: var(--container-high); color: var(--text); font: inherit; cursor: pointer; outline: 2px solid transparent; outline-offset: 0; }
.ttile.sel { outline-color: var(--primary); }
.ttile.sel::before { content: '✓'; position: absolute; top: 12px; left: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 700; z-index: 1; }
.tprev { background: var(--surface); border-radius: 22px; padding: 12px 10px 10px; display: flex; flex-direction: column; gap: 7px; font-size: 11px; line-height: 16px; min-height: 150px; }
.tub { align-self: flex-end; background: var(--primary-container); color: var(--on-primary-container); padding: 5px 10px; border-radius: 12px 12px 3px 12px; }
.tsay { color: var(--text); line-height: 1.35; }
.tsay b { font-family: var(--mono); font-weight: 500; color: var(--primary); }
.tcard { margin-top: auto; background: var(--container-high); border-radius: 11px; padding: 8px 9px; display: flex; flex-direction: column; gap: 7px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--outline) 35%, transparent); }
.tct { color: var(--text); }
.tct code { font: 10.5px var(--mono); background: var(--container-highest); color: var(--text-2); padding: 0 4px; border-radius: 4px; }
.tbt { display: flex; gap: 6px; }
.tbt span { padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 11px; }
.tallow { background: var(--primary); color: var(--on-primary); }
.tdeny { background: var(--tonal); color: var(--on-tonal); }
.tlbl { display: flex; flex-direction: column; padding: 0 6px 4px; font-size: 14px; }
.tlbl span { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.tseed { width: 28px; height: 22px; padding: 0; border: 1px solid var(--outline); border-radius: 6px; background: none; cursor: pointer; }
.tdots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tdot { width: 24px; height: 24px; border: 0; border-radius: 50%; padding: 0; cursor: pointer; }
.tdot.on { box-shadow: 0 0 0 2px var(--container), 0 0 0 4px var(--text); }
/* The lane being left, sliding out over the log while the new one slides in (chat.js slideOut) */
.lane-ghost { position: absolute; left: 0; right: 0; overflow: hidden; pointer-events: none; }
.lane-ghost > * { position: absolute; left: 16px; right: 16px; }
.lane-ghost * { animation: none !important; }
