/* Baton - one stylesheet. Colours are tokens; the accent comes from brand.json at start. */
:root {
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d9f0ec;
  --accent-text: #0b5f58;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --surface-3: #e7e6df;
  --border: #e0ded6;
  --border-strong: #c9c6bb;
  --text: #1b1a17;
  --text-2: #57554d;
  --text-3: #6d6a61;
  --amber: #a15c07;
  --amber-soft: #fcf1d8;
  --amber-line: #f0d59a;
  --red: #b42318;
  --red-soft: #fdeceb;
  --red-line: #f3c2be;
  --green: #17803d;
  --green-soft: #e3f4e8;
  --blue: #1d5fbf;
  --code-bg: #f3f2ee;
  --shadow: 0 1px 2px rgba(20, 20, 15, .06), 0 8px 24px rgba(20, 20, 15, .08);
  --shadow-lg: 0 4px 12px rgba(20, 20, 15, .10), 0 24px 64px rgba(20, 20, 15, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
  --side: 292px;
  --col: 820px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --accent: #2dd4bf;
  --accent-ink: #042f2a;
  --accent-soft: #123530;
  --accent-text: #5eead4;
  --bg: #121311;
  --surface: #1a1b19;
  --surface-2: #222320;
  --surface-3: #2b2c28;
  --border: #30312d;
  --border-strong: #45463f;
  --text: #ecebe5;
  --text-2: #adaba1;
  --text-3: #949288;
  --amber: #f5b942;
  --amber-soft: #33270c;
  --amber-line: #5c4712;
  --red: #f97066;
  --red-soft: #351512;
  --red-line: #6a2620;
  --green: #4ade80;
  --green-soft: #12301c;
  --blue: #7fb2ff;
  --code-bg: #20211e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .5), 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; text-size-adjust: 100%; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------------------------------------------------------------- shell */
#app { height: 100dvh; display: flex; overflow: hidden; }
.side {
  width: var(--side); flex: none; display: flex; flex-direction: column; background: var(--surface-2);
  border-right: 1px solid var(--border); min-height: 0; transition: margin-left .18s ease;
}
.side.closed { margin-left: calc(-1 * var(--side)); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; }
.scrim { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand b { font-size: 16px; letter-spacing: -.01em; }
.brand .grow { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: var(--accent-text); background: var(--accent-soft); }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.s { width: 15px; height: 15px; }

.side .new { margin: 2px 12px 10px; }
.search { margin: 0 12px 8px; position: relative; }
.search input {
  width: 100%; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  padding: 0 10px 0 30px; font-size: 13.5px;
}
.search .ico { position: absolute; left: 9px; top: 8px; color: var(--text-3); }
.filter { display: flex; gap: 4px; margin: 0 12px 6px; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--text-2); height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550;
}
.chip.on { background: var(--surface); color: var(--text); border-color: var(--border-strong); }

.list { flex: 1; overflow-y: auto; padding: 2px 8px 10px; min-height: 0; }
.group { font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 12px 8px 4px; }
.row {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text); position: relative; border: 0; background: none; width: 100%; text-align: left;
}
.row:hover { background: var(--surface-3); }
.row.on { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 550; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t small { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; }
.row .dot.running { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.row .dot.needs { background: var(--amber); }
.row .dot.waiting { background: var(--amber); animation: pulse 2s ease-in-out infinite; }
.row .dot.unread { background: var(--blue); }
.row .src { font-size: 10.5px; color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; flex: none; }
.row .more { opacity: 0; }
.row:hover .more, .row.on .more, .row .more:focus-visible { opacity: 1; }
@media (hover: none) { .row .more { opacity: 1; } }
@keyframes pulse { 50% { opacity: .35; } }

.side-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.acct-mini { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12.5px; border: 0; background: none; width: 100%; text-align: left; }
.acct-mini:hover { background: var(--surface-3); }
.acct-mini .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.acct-mini .w { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.led { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.led.ready { background: var(--green); }
.led.limited, .led.busy { background: var(--amber); }
.led.signin_failed, .led.no_credit { background: var(--red); }
.led.disabled, .led.untested { background: var(--border-strong); }
.led.answering { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.nav { display: flex; gap: 2px; padding-top: 4px; }
.nav .btn { flex: 1; font-size: 12.5px; height: 30px; padding: 0 6px; }
.nav .btn.on { background: var(--surface); border-color: var(--border); }

/* --------------------------------------------------------------- header */
.head {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); min-height: 50px; flex: none; z-index: 5;
}
.head h1 { font-size: 15px; font-weight: 620; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 40px; letter-spacing: -.005em; }
.head .title-input { font-size: 15px; font-weight: 620; border: 1px solid var(--accent); border-radius: 6px; padding: 2px 6px; background: var(--surface); min-width: 0; flex: 1; }
.head .grow { flex: 1; min-width: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 550; white-space: nowrap; max-width: 240px;
}
button.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill span { overflow: hidden; text-overflow: ellipsis; }
.pill.warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.meter { width: 46px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.hot i { background: var(--amber); }
.meter.full i { background: var(--red); }

/* ----------------------------------------------------------- transcript */
.scroll { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: auto; overflow-anchor: none; }
.col { max-width: var(--col); margin: 0 auto; padding: 22px 20px 12px; }
.item { margin: 0 0 14px; content-visibility: auto; contain-intrinsic-size: auto 60px; }

.user { display: flex; flex-direction: column; align-items: flex-end; margin: 22px 0 16px; }
.user .bubble {
  max-width: min(86%, 640px); background: var(--surface-3); border-radius: 16px 16px 4px 16px; padding: 9px 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.user .bubble.queued { opacity: .65; border: 1px dashed var(--border-strong); background: transparent; }
.user .bubble.command { font-family: var(--mono); font-size: 13.5px; }
.user .meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.user .meta button { border: 0; background: none; color: var(--text-3); padding: 0; font-size: 11.5px; text-decoration: underline; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.thumbs img { max-width: 220px; max-height: 180px; border-radius: 10px; border: 1px solid var(--border); display: block; cursor: zoom-in; background: var(--surface-2); }
.filechip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; font-size: 12.5px; background: var(--surface); color: var(--text-2); }

.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 .8em; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; margin: 1.3em 0 .5em; letter-spacing: -.01em; }
.prose h1 { font-size: 1.35em; } .prose h2 { font-size: 1.2em; } .prose h3 { font-size: 1.07em; } .prose h4 { font-size: 1em; }
.prose ul, .prose ol { margin: 0 0 .8em; padding-left: 1.5em; }
.prose li { margin: .15em 0; }
.prose li > p { margin: 0 0 .3em; }
.prose blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .12em .38em; border-radius: 5px; }
.prose pre { margin: 0 0 .9em; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: relative; }
.prose pre code { display: block; padding: 12px 14px; overflow-x: auto; background: none; font-size: 13px; line-height: 1.5; border-radius: 0; }
.prose pre .codebar { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.prose pre .codebar button { border: 0; background: none; color: var(--text-3); font-size: 11.5px; padding: 3px 8px; border-radius: 5px; font-family: var(--sans); }
.prose pre .codebar button:hover { background: var(--surface-3); color: var(--text); }
.prose table { border-collapse: collapse; margin: 0 0 .9em; display: block; overflow-x: auto; max-width: 100%; font-size: .95em; }
.prose th, .prose td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 620; }
.prose img { max-width: 100%; border-radius: 8px; }
.caret::after { content: ""; display: inline-block; width: 7px; height: 1.05em; vertical-align: -0.18em; margin-left: 2px; background: var(--accent); border-radius: 1px; animation: pulse 1s steps(2) infinite; }

.think { color: var(--text-3); font-size: 13px; margin: 0 0 8px; }
.think summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
.think summary::-webkit-details-marker { display: none; }
.think summary:hover { color: var(--text-2); }
.think .body { white-space: pre-wrap; border-left: 2px solid var(--border); padding: 4px 0 4px 12px; margin: 6px 0 4px 6px; color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }

/* tool cards */
.tool { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 8px; overflow: hidden; }
.tool > summary, .tool > .line {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; list-style: none; font-size: 13.5px; min-width: 0; user-select: none;
}
.tool > summary::-webkit-details-marker { display: none; }
.tool > summary:hover { background: var(--surface-2); }
.tool .verb { font-weight: 600; flex: none; }
.tool .arg { color: var(--text-2); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool .arg.plain { font-family: var(--sans); font-size: 13.5px; }
.tool .badge { font-size: 11px; font-weight: 600; border-radius: 5px; padding: 1px 6px; flex: none; background: var(--surface-3); color: var(--text-2); }
.tool .badge.add { background: var(--green-soft); color: var(--green); }
.tool .badge.del { background: var(--red-soft); color: var(--red); }
.tool .badge.err { background: var(--red-soft); color: var(--red); }
.tool .badge.warn { background: var(--amber-soft); color: var(--amber); }
.tool .st { flex: none; color: var(--text-3); display: inline-grid; place-items: center; width: 18px; }
.tool .st.ok { color: var(--green); }
.tool .st.err { color: var(--red); }
.tool .chev { flex: none; color: var(--text-3); transition: transform .12s; }
.tool[open] > summary .chev { transform: rotate(90deg); }
.tool .body { border-top: 1px solid var(--border); padding: 10px 12px; font-size: 13px; max-height: 460px; overflow: auto; background: var(--surface); }
.tool .body pre { margin: 0; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.tool .body .lbl { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin: 10px 0 4px; }
.tool .body .lbl:first-child { margin-top: 0; }
.tool .body .lbl.path { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 500; font-size: 12px; overflow-wrap: anywhere; }
.tool .body .errtxt { color: var(--red); }
.tool .body img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 6px; cursor: zoom-in; }
.tool.err { border-color: var(--red-line); }
.spin { width: 13px; height: 13px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.fold { border: 1px dashed var(--border-strong); border-radius: var(--radius); margin: 0 0 8px; }
.fold > summary { padding: 6px 10px; font-size: 13px; color: var(--text-2); cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] { border-style: solid; padding-bottom: 2px; }
.fold[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.fold > .tool { margin: 0 8px 6px; }
.nest { margin: 8px 0 0 8px; padding-left: 10px; border-left: 2px solid var(--border); }

.diff { font: 12.5px/1.5 var(--mono); border: 1px solid var(--border); border-radius: 8px; overflow: auto; }
.diff .hunk { color: var(--text-3); background: var(--surface-2); padding: 1px 10px; }
.diff .ln { display: block; padding: 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff .ln.add { background: var(--green-soft); }
.diff .ln.del { background: var(--red-soft); }
.diff .ln::before { content: attr(data-s); display: inline-block; width: 1.2em; color: var(--text-3); user-select: none; }

/* notices */
.note { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); margin: 10px 0; padding: 7px 12px; border-radius: var(--radius); background: var(--surface-2); }
.note .ico { margin-top: 2px; }
.note.center { justify-content: center; background: none; color: var(--text-3); font-size: 12.5px; padding: 2px; }
.note.warn { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.note.err { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); }
.note .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.note pre { margin: 4px 0 0; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; color: var(--text-2); }
.note .btn { margin-left: 6px; }

.pass { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--text-2); font-size: 12.5px; }
.pass::before, .pass::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }
.pass .card { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; flex-wrap: wrap; justify-content: center; max-width: 86%; }
.pass b { color: var(--text); font-weight: 620; }
.pass .why { color: var(--text-3); }
.pass.wait .card { border-color: var(--amber-line); background: var(--amber-soft); color: var(--amber); border-radius: var(--radius); padding: 8px 14px; }
.pass.wait b { color: var(--amber); }

/* permission cards */
.ask { border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); padding: 14px 16px; margin: 0 0 12px; }
.ask h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 620; display: flex; gap: 8px; align-items: center; }
.ask p { margin: 0 0 8px; color: var(--text-2); font-size: 13.5px; }
.ask pre { margin: 0 0 10px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; }
.ask .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ask .acts .grow { flex: 1; }
.ask input[type=text], .ask textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; background: var(--bg); margin: 0 0 8px; }
.ask .q { margin: 0 0 14px; }
.ask .q .hd { display: inline-block; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-text); background: var(--accent-soft); padding: 1px 7px; border-radius: 5px; margin-bottom: 5px; }
.ask .q b { display: block; margin-bottom: 7px; font-weight: 600; }
.ask .opt { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 8px 12px; margin: 0 0 6px; }
.ask .opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ask .opt.on { border-color: var(--accent); background: var(--accent-soft); }
.ask .opt small { display: block; color: var(--text-2); }
.ask .opt .mark { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; margin-top: 3px; }
.ask .opt.multi .mark { border-radius: 4px; }
.ask .opt.on .mark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2.5px var(--surface); }
.ask .plan { border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; margin: 0 0 10px; max-height: 50vh; overflow: auto; background: var(--bg); }

/* tasks strip */
.tasks { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 8px; font-size: 13px; }
.tasks summary { padding: 6px 12px; cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.tasks summary::-webkit-details-marker { display: none; }
.tasks ul { list-style: none; margin: 0; padding: 0 12px 8px; max-height: 180px; overflow: auto; }
.tasks li { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; }
.tasks li.completed { color: var(--text-3); text-decoration: line-through; }
.tasks li.in_progress { font-weight: 600; }
.tasks .box { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--border-strong); margin-top: 4px; flex: none; display: grid; place-items: center; }
.tasks li.completed .box { background: var(--accent); border-color: var(--accent); }
.tasks li.in_progress .box { border-color: var(--accent); }

/* -------------------------------------------------------------- composer */
.dock { flex: none; padding: 0 20px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.dock .inner { max-width: var(--col); margin: 0 auto; position: relative; }
.statusline { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); padding: 0 4px 6px; min-height: 22px; }
.statusline .grow { flex: 1; }
.suggest { border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest:hover { background: var(--surface-2); color: var(--text); }
.composer {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 8px 8px 6px 14px; transition: border-color .12s, box-shadow .12s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow); }
.composer.drop { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent; max-height: 38vh; min-height: 26px; padding: 4px 0;
  line-height: 1.5; display: block; font-size: 15px;
}
.composer .tools { display: flex; align-items: center; gap: 2px; margin-top: 2px; min-width: 0; }
.composer .tools > * { flex-shrink: 0; }
.composer .tools > select { flex-shrink: 1; min-width: 60px; }
.composer .tools .grow { flex: 1; }
.composer .tools .route { font-size: 12px; color: var(--text-3); white-space: nowrap; padding: 0 6px 0 2px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.composer select, .mini-select {
  border: 0; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 550; height: 28px; border-radius: 7px; padding: 0 4px;
  max-width: 150px; cursor: pointer;
}
.composer select:hover { background: var(--surface-3); color: var(--text); }
.composer select option { background: var(--surface); color: var(--text); }
.send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; margin-left: 4px; }
.send:disabled { background: var(--surface-3); color: var(--text-3); cursor: default; }
.send.stop { background: var(--text); color: var(--bg); }
.attach { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 6px; }
.attach .a { position: relative; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; gap: 6px; font-size: 12.5px; max-width: 200px; }
.attach .a img { width: 52px; height: 52px; object-fit: cover; display: block; }
.attach .a span { padding: 0 26px 0 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 30px; }
.attach .a button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; padding: 0; font-size: 13px; line-height: 1; }
.pop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 300px; overflow: auto; padding: 5px; z-index: 20;
}
.pop .o { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; border: 0; background: none; width: 100%; text-align: left; }
.pop .o.on, .pop .o:hover { background: var(--surface-3); }
.pop .o b { font-family: var(--mono); font-size: 13px; font-weight: 600; flex: none; }
.pop .o small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .empty { padding: 10px; color: var(--text-3); font-size: 13px; }
.queued-bar { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 4px 6px; }
.jump { position: absolute; right: 24px; bottom: 150px; z-index: 6; box-shadow: var(--shadow); border-radius: 999px; }

/* ---------------------------------------------------------------- empty */
.empty { height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.empty .box { max-width: 520px; }
.empty img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 14px; }
.empty h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.empty p { margin: 0 0 18px; color: var(--text-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; text-align: left; }
.cards button { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; text-align: left; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; min-width: 0; }
.cards button:hover { border-color: var(--border-strong); }
.cards b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.cards small { color: var(--text-2); }

/* ---------------------------------------------------------------- pages */
.page { flex: 1; overflow-y: auto; min-height: 0; }
.page .wrap { max-width: 920px; margin: 0 auto; padding: 26px 22px 60px; }
.page h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.page .lead { color: var(--text-2); margin: 0 0 22px; }
.page h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 30px 0 10px; font-weight: 650; }
.panel { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 16px 18px; margin: 0 0 12px; }
.panel.flat { padding: 0; overflow: hidden; }
.acct { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; }
.acct .ord { display: flex; flex-direction: column; gap: 0; color: var(--text-3); }
.acct .ord button { border: 0; background: none; color: var(--text-3); padding: 0; height: 16px; width: 24px; display: grid; place-items: center; border-radius: 4px; }
.acct .ord button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.acct .ord button:disabled { opacity: .3; cursor: default; }
.acct .ord span { font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.acct .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.acct .nm b { font-size: 15px; }
.acct .sub { color: var(--text-2); font-size: 13px; grid-column: 2; overflow-wrap: anywhere; }
.acct .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acct .bars { grid-column: 2 / 4; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 18px; margin-top: 8px; }
.bar-row { font-size: 12.5px; color: var(--text-2); }
.bar-row .top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.bar-row .top b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s; }
.bar.hot i { background: var(--amber); }
.bar.full i { background: var(--red); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 8px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.ready { background: var(--green-soft); color: var(--green); }
.tag.limited, .tag.busy { background: var(--amber-soft); color: var(--amber); }
.tag.signin_failed, .tag.no_credit { background: var(--red-soft); color: var(--red); }
.tag.answering { background: var(--accent-soft); color: var(--accent-text); }
.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select, .field textarea {
  width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 0 10px;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.field .inline { display: flex; gap: 8px; }
.field .inline input { flex: 1; min-width: 0; }
.rowset { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.rowset:last-child { border-bottom: 0; }
.rowset .t { flex: 1; min-width: 0; }
.rowset .t b { display: block; font-weight: 600; font-size: 14px; }
.rowset .t small { color: var(--text-2); font-size: 13px; display: block; }
.rowset select, .rowset input[type=text], .rowset input[type=number] { height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 0 8px; max-width: 260px; min-width: 0; }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 16px; }
.stat small { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat span { color: var(--text-2); font-size: 12.5px; }
.days { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding: 14px 18px 8px; }
.days .d { flex: 1; min-width: 3px; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; overflow: hidden; background: var(--surface-2); height: 100%; position: relative; }
.days .d i { display: block; width: 100%; }
.days-axis { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11.5px; padding: 0 18px 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0 18px 14px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.callout { border: 1px solid var(--amber-line); background: var(--amber-soft); color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin: 0 0 14px; }
.callout b { color: var(--amber); }
.callout.info { border-color: var(--border); background: var(--surface-2); }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.steps code, .page code { font-family: var(--mono); font-size: .9em; background: var(--code-bg); padding: .1em .4em; border-radius: 5px; }

/* --------------------------------------------------------------- modals */
.veil { position: fixed; inset: 0; background: rgba(15, 15, 12, .5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: min(86dvh, 760px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal.wide { width: min(720px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal header h2 { margin: 0; font-size: 16px; flex: 1; }
.modal .content { padding: 16px 18px; overflow-y: auto; min-height: 0; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); align-items: center; }
.modal footer .grow { flex: 1; color: var(--text-3); font-size: 12.5px; min-width: 0; }
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.types button { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
.types button:hover { border-color: var(--accent); }
.types b { display: block; font-size: 13.5px; }
.types small { color: var(--text-2); font-size: 12.5px; }
.folders { border: 1px solid var(--border); border-radius: 9px; max-height: 320px; overflow: auto; }
.folders button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 6px 12px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.folders button:last-child { border-bottom: 0; }
.folders button:hover { background: var(--surface-2); }
.folders .dim { color: var(--text-3); }
.crumbs { font: 12.5px var(--mono); color: var(--text-2); margin: 0 0 8px; overflow-wrap: anywhere; }
.menu { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 190px; }
.menu button { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; }
.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .hd { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 2px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.menu .sub { color: var(--text-3); font-size: 12px; margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.toasts { position: fixed; right: 16px; top: 62px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: rise .18s; pointer-events: auto; overflow-wrap: anywhere; }
.toast.err { background: var(--red); color: #fff; }
@keyframes rise { from { transform: translateY(-8px); opacity: 0; } }
.zoom { position: fixed; inset: 0; background: rgba(0, 0, 0, .86); z-index: 90; display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; width: 100%; }
.login form { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 26px; box-shadow: var(--shadow); text-align: center; }
.login img { width: 52px; height: 52px; border-radius: 13px; }
.login h1 { font-size: 20px; margin: 12px 0 2px; letter-spacing: -.02em; }
.login p { color: var(--text-2); margin: 0 0 18px; font-size: 13.5px; }
.login input { width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 12px; background: var(--bg); margin-bottom: 10px; text-align: center; }
.login .msg { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login .btn { height: 40px; }

/* --------------------------------------------------------------- phones */
@media (max-width: 820px) {
  :root { --side: min(86vw, 320px); }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 40; box-shadow: var(--shadow-lg); padding-top: env(safe-area-inset-top); }
  .side.closed { margin-left: 0; transform: translateX(-105%); box-shadow: none; }
  .side { transition: transform .2s ease; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 15, 12, .45); z-index: 39; }
  .head { padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top)); gap: 4px; }
  .hide-s { display: none !important; }
  .col { padding: 14px 12px 8px; }
  .dock { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 16px; } /* iOS zooms into smaller text fields */
  .composer select { max-width: 104px; min-width: 0; flex-shrink: 1; }
  .composer .tools { overflow: hidden; }
  .composer { padding-left: 12px; }
  .user .bubble { max-width: 92%; }
  .page .wrap { padding: 18px 12px 60px; }
  .acct { grid-template-columns: auto 1fr; }
  .acct .acts { grid-column: 1 / 3; justify-content: flex-start; }
  .acct .bars { grid-column: 1 / 3; }
  .rowset { flex-wrap: wrap; padding: 12px 14px; }
  .jump { right: 12px; bottom: 140px; }
  .pill { max-width: 150px; }
  .toasts { left: 12px; right: 12px; top: calc(58px + env(safe-area-inset-top)); max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
@media print {
  .side, .dock, .head, .jump { display: none !important; }
  #app, .scroll { height: auto; overflow: visible; display: block; }
}

/* ------------------------------------------------- who answered, how hard */
.meta.answered { flex-wrap: wrap; row-gap: 2px; }
.meta.answered .by { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.meta.answered .by .ico.s { width: 12px; height: 12px; }

/* ------------------------------------------------------------------- talk */
.talk { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin: 0 0 8px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.talk .orb { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); cursor: pointer; }
.talk .orb .ico { width: 26px; height: 26px; }
.talk .orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; }
.talk.listening .orb { background: var(--accent); color: var(--accent-ink); }
.talk.listening .orb .ring { border-color: var(--accent); animation: talk-pulse 1.6s ease-out infinite; }
.talk.speaking .orb { background: var(--accent-soft); color: var(--accent-text); }
.talk.speaking .orb .ico { animation: talk-wave 1s ease-in-out infinite; }
.talk.thinking .orb, .talk.sending .orb { color: var(--text-3); }
.talk.thinking .orb .ring { border-color: var(--border-strong); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.talk.paused .orb { background: var(--amber-soft); color: var(--amber); }
.talk .words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.talk .words b { font-size: 13px; }
.talk .words .heard { font-size: 15px; line-height: 1.4; max-height: 4.2em; overflow: hidden; color: var(--text); overflow-wrap: anywhere; }
.talk .words small { color: var(--text-3); font-size: 11.5px; }
.talk .words .err { color: var(--amber); font-size: 12.5px; }
.talk .acts { display: flex; align-items: center; gap: 4px; flex: none; }
.talk .acts select { border: 0; background: transparent; color: var(--text-3); font-size: 12px; max-width: 110px; height: 28px; border-radius: 7px; }
.talk .acts select:hover { background: var(--surface-3); color: var(--text); }
@keyframes talk-pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes talk-wave { 0%, 100% { transform: scaleY(.7); } 50% { transform: scaleY(1.15); } }

/* ------------------------------------------------------------- spare time */
.row .src.spare { border: 0; padding: 0; display: inline-flex; color: var(--text-3); }
.panel.job { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.panel.job .jobhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel.job .jobhead input { flex: 1; min-width: 140px; height: 32px; border: 1px solid var(--border); border-radius: 7px; padding: 0 8px; background: var(--surface); font-weight: 600; }
.panel.job .jobhead select { height: 30px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text-2); font-size: 12.5px; padding: 0 6px; }
.panel.job label { display: flex; flex-direction: column; gap: 4px; }
.panel.job label small { color: var(--text-3); font-size: 11.5px; }
.panel.job label input, .panel.job label textarea { border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; background: var(--surface); font: 13px/1.5 var(--sans); width: 100%; }
.panel.job label textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.panel.job .acts { display: flex; justify-content: flex-end; }
@media (max-width: 820px) {
  .talk { gap: 10px; padding: 10px; }
  .talk .acts select { display: none; }
}
