/* vibe web. One persistent top bar; a chat list that is the page on a
   phone and a sidebar on a desk; one column of conversation. */

:root {
  --bg: #f6f6f8; --surface: #ffffff; --surface-2: #eef0f4; --surface-3: #e4e7ee;
  --fg: #15171d; --fg-2: #3b4050; --muted: #6f7688; --line: rgba(20, 24, 40, .09); --line-2: rgba(20, 24, 40, .16);
  --accent: #4f5fe6; --accent-2: #3d4ccf; --on-accent: #fff; --accent-soft: rgba(79, 95, 230, .10);
  --ok: #1fa971; --warn: #d9911c; --bad: #d7453d; --busy: #4f5fe6;
  --claude: #d97757; --codex: #19a37b; --hermes: #8b5cf6; --fake: #7a8194;
  --user-bg: #e9ecfb; --user-fg: #1a1d3a;
  /* Machine colours: hostClass in hosts.go hashes a machine's name to one. */
  --hc-0: #d8453a; --hc-1: #d97a1a; --hc-2: #a88700; --hc-3: #1f9d5a; --hc-4: #128a8a; --hc-5: #2f6fe4; --hc-6: #7c4ddb; --hc-7: #d0389a;
  --shadow: 0 1px 2px rgba(15, 18, 30, .06), 0 8px 24px rgba(15, 18, 30, .08);
  --r: 14px; --r-s: 9px;
  --top: 54px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12; --surface: #12151c; --surface-2: #191d26; --surface-3: #222732;
    --fg: #e9ebf1; --fg-2: #c3c8d4; --muted: #8b93a5; --line: rgba(255, 255, 255, .075); --line-2: rgba(255, 255, 255, .14);
    --accent: #7c8cff; --accent-2: #93a0ff; --on-accent: #0b0d12; --accent-soft: rgba(124, 140, 255, .14);
    --ok: #34c58a; --warn: #e2a33a; --bad: #ef5a52; --busy: #7c8cff;
    --user-bg: #1d2240; --user-fg: #e9ebf1;
    --hc-0: #ff6b5f; --hc-1: #f5a04a; --hc-2: #e6c04a; --hc-3: #4ad48f; --hc-4: #3ecfcf; --hc-5: #6ea2ff; --hc-6: #b08cff; --hc-7: #ff7ad0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; min-width: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; margin: 0; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; }
svg { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 13px; }
.inline { display: inline; }

/* Controls */
button, .btn {
  font: inherit; font-weight: 550; color: var(--fg); background: var(--surface-2); border: 1px solid transparent;
  border-radius: 10px; padding: 9px 14px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, transform .06s, box-shadow .12s;
}
button:hover, .btn:hover { background: var(--surface-3); }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-2); }
button.danger { color: var(--bad); background: transparent; border-color: var(--line-2); }
button.danger:hover { background: rgba(215, 69, 61, .1); }
button.small, .btn.small { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
button.big { min-height: 46px; padding: 11px 20px; font-size: 16px; }
button.wide { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=search], input[type=password], select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 12px; width: 100%; min-height: 40px; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
label { display: block; font-size: 13px; font-weight: 550; color: var(--fg-2); }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; font-size: 15px; }
label small { display: block; margin-top: 4px; font-weight: 400; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 12px 10px; margin: 0; }
legend { color: var(--fg); font-weight: 550; padding: 0 6px; font-size: 14px; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.btnrow.end { justify-content: flex-end; }
.inline-form { display: flex; gap: 8px; align-items: center; flex: 1 1 260px; max-width: 360px; }
.inline-form input { flex: 1; }
.hint { color: var(--muted); font-size: 13.5px; margin: 8px 0; }
.hint.pad { padding: 0 16px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: rgba(215, 69, 61, .12); color: var(--bad); border-radius: 6px; padding: 2px 7px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty p { margin: 0 0 12px; }

/* Status dots */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.idle { background: var(--ok); }
.dot.busy { background: var(--busy); animation: pulse 1.1s ease-in-out infinite; }
.dot.waiting { background: var(--warn); animation: pulse .7s ease-in-out infinite; }
.dot.off { background: var(--bad); }
.dot.stored, .dot.closed { background: var(--line-2); }
@keyframes pulse { 50% { opacity: .3; } }

/* Kind marks: a lettered square per harness kind. */
.mark { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 700; font-size: 14px; color: #fff; flex: none; background: var(--fake); }
.mark .dot { position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border: 2px solid var(--surface); }
.k-claude { --k: var(--claude); } .k-codex { --k: var(--codex); } .k-hermes { --k: var(--hermes); } .k-fake { --k: var(--fake); }
.mark.k-claude, .mark.k-codex, .mark.k-hermes, .mark.k-fake { background: var(--k); }

/* Machines: a colour per host, a badge wherever a chat or agent is named. */
.hc-0 { --h: var(--hc-0); } .hc-1 { --h: var(--hc-1); } .hc-2 { --h: var(--hc-2); } .hc-3 { --h: var(--hc-3); }
.hc-4 { --h: var(--hc-4); } .hc-5 { --h: var(--hc-5); } .hc-6 { --h: var(--hc-6); } .hc-7 { --h: var(--hc-7); }
.host { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--h, var(--muted)) 14%, transparent); color: var(--h, var(--muted)); font-weight: 650; font-size: 11.5px; line-height: 1.5; letter-spacing: .01em; white-space: nowrap; vertical-align: 1px; font-style: normal; }
.rmeta .host, .sub .host, .item-meta .host { margin-right: 6px; }
.host::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--h, var(--muted)); flex: none; }
.host.big { font-size: 14px; padding: 2px 11px 2px 8px; }
.host.big::before { width: 8px; height: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--top) + var(--sat)); padding: var(--sat) 12px 0;
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 700; font-size: 17px; letter-spacing: -.02em; padding: 6px 4px; }
.logo { width: 22px; height: 22px; color: var(--accent); }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; margin-left: 6px; }
.tab { color: var(--muted); font-weight: 550; font-size: 14px; padding: 5px 12px; border-radius: 8px; transition: background .12s, color .12s; }
.tab.active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.tab:hover { color: var(--fg); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--fg); background: var(--surface-2); font-size: 20px; }
.iconbtn:hover { background: var(--surface-3); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #b06cff); color: #fff; font-weight: 700; font-size: 14px; }
.avatar.big { width: 44px; height: 44px; font-size: 18px; }
@media (max-width: 480px) { .brand span { display: none; } .tabs { margin-left: 0; } }

/* Shell */
.shell { display: flex; height: calc(100dvh - var(--top) - var(--sat)); }
.sidebar { width: 100%; display: flex; flex-direction: column; background: var(--surface); }
.main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.main.placeholder { display: none; }
.page-chat .sidebar { display: none; }
@media (min-width: 900px) {
  .sidebar { width: 336px; flex: none; border-right: 1px solid var(--line); }
  .main.placeholder { display: flex; align-items: center; justify-content: center; }
  .page-chat .sidebar { display: flex; }
}
.welcome { text-align: center; color: var(--muted); max-width: 320px; }
.welcome .logo { width: 44px; height: 44px; opacity: .5; margin-bottom: 10px; }
.welcome h1 { color: var(--fg); font-size: 22px; margin-bottom: 6px; }

/* Chat list */
.chatlist { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.filters { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; background: var(--surface-2); border-color: transparent; border-radius: 11px; }
.search input:focus { background: var(--surface); }
.chipgroups { display: flex; flex-direction: column; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.chips.sub { margin-left: 6px; padding-left: 8px; border-left: 2px solid var(--h, var(--line-2)); }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); font-size: 13px; font-weight: 550; white-space: nowrap; flex: none; border: 1px solid transparent; transition: background .12s; }
.chip .dot { background: var(--k, var(--muted)); }
.chip.off .dot { background: var(--bad); }
.chip.off { color: var(--muted); }
.chip.on { background: var(--fg); color: var(--bg); }
.chip.on .dot { background: var(--bg); opacity: .7; }
.chip:hover:not(.on) { background: var(--surface-3); }
.chip.machine { color: var(--h); background: color-mix(in srgb, var(--h) 10%, var(--surface-2)); }
.chip.machine .dot { background: var(--h); }
.chip.machine.off { color: var(--muted); }
.chip.machine.off .dot { background: var(--bad); }
.chip.machine.on { background: var(--h); color: #fff; }
.chip.machine.on .dot { background: #fff; opacity: .85; }
.chip.machine:hover:not(.on) { background: color-mix(in srgb, var(--h) 20%, var(--surface-2)); }
.chip .n { font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, transparent); line-height: 16px; }
.chips.sub .chip.on { background: var(--fg); color: var(--bg); }
.toggles { display: flex; gap: 6px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line-2); cursor: pointer; user-select: none; }
.toggle input { appearance: none; -webkit-appearance: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin: 0; }
.toggle.on { color: var(--fg); border-style: solid; }
.toggle.on input { background: var(--accent); }
.rows { overflow-y: auto; flex: 1; padding: 6px 8px 12px; }
.row { display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "mark title time" "mark meta meta"; column-gap: 10px; align-items: center; padding: 9px 10px 9px 12px; border-radius: 12px; color: var(--fg); transition: background .1s; box-shadow: inset 3px 0 0 var(--h, transparent); }
.row:hover { background: var(--surface-2); }
.row.current { background: var(--accent-soft); }
.row.archived { opacity: .55; }
.row .mark { grid-area: mark; }
.row.busy .mark .dot { background: var(--busy); animation: pulse 1.1s ease-in-out infinite; }
.row.waiting .mark .dot { background: var(--warn); animation: pulse .7s ease-in-out infinite; }
.row.idle .mark .dot { background: var(--ok); }
.row.stored .mark .dot { display: none; }
.rtitle { grid-area: title; font-weight: 550; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin { color: var(--warn); margin-right: 4px; font-size: 12px; }
.rtime { grid-area: time; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rmeta { grid-area: meta; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ragent { color: var(--fg-2); }
.rmeta em { font-style: normal; color: var(--fg-2); }
.row.waiting .rmeta em { color: var(--warn); }
.row.busy .rmeta em { color: var(--busy); }

/* Chat */
.chatbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; box-shadow: inset 0 -2px 0 var(--h, transparent); }
.back { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: var(--fg); font-size: 22px; margin-left: -6px; }
.back:hover { background: var(--surface-2); }
@media (min-width: 900px) { .back { display: none; } }
.ttl { flex: 1; min-width: 120px; }
.ttl h1 { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.sub .host { margin-right: 2px; }
.head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.head .status { color: var(--fg-2); font-weight: 550; text-transform: capitalize; }
.head .hm { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.herr { color: var(--bad); }
@media (max-width: 899px) { .head { flex-basis: 100%; order: 10; } .head .hm { display: none; } .head .hm:first-of-type { display: inline; } }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: var(--fg); font-size: 20px; }
.menu > summary svg { fill: currentColor; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary, .menu > summary:hover { background: var(--surface-2); }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); z-index: 30; max-height: 75vh; overflow: auto; }
.menu-body > * + * { margin-top: 14px; }
.menu-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.settings { border-top: 1px solid var(--line); padding-top: 14px; }
.state summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.state pre { max-height: 240px; overflow: auto; font-size: 11.5px; background: var(--surface-2); padding: 10px; border-radius: var(--r-s); margin-top: 8px; }
.banner { padding: 10px 16px; background: var(--surface-2); color: var(--muted); font-size: 13.5px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.banner.error { color: var(--bad); }

.transcript { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; scroll-behavior: smooth; }
.blk { width: 100%; max-width: 820px; align-self: center; }
.blk-user { display: flex; justify-content: flex-end; }
.blk-user.local .bubble { opacity: 0.6; }
.bubble { background: var(--user-bg); color: var(--user-fg); border-radius: 18px 18px 6px 18px; padding: 10px 14px; max-width: 86%; white-space: pre-wrap; word-break: break-word; }
.md { line-height: 1.6; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .55em 0; }
.md h1, .md h2, .md h3 { margin: 1em 0 .4em; font-size: 1.05em; }
.md ul, .md ol { padding-left: 1.4em; }
.md pre { background: var(--surface-2); padding: 12px; border-radius: var(--r-s); overflow-x: auto; white-space: pre; border: 1px solid var(--line); }
.md pre code { background: none; padding: 0; font-size: 12.5px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line-2); padding: 5px 9px; }
.md img { max-width: 100%; border-radius: var(--r-s); }
.md blockquote { border-left: 3px solid var(--line-2); margin: .6em 0; padding-left: 12px; color: var(--muted); }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.streaming .md::after { content: ""; display: inline-block; width: 8px; height: 15px; margin-left: 3px; vertical-align: -2px; background: var(--accent); border-radius: 2px; animation: pulse .9s infinite; }

details.thinking, details.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); font-size: 13.5px; }
details.thinking > summary, details.tool > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; padding: 8px 12px; color: var(--fg-2); }
details.thinking > summary::-webkit-details-marker, details.tool > summary::-webkit-details-marker { display: none; }
details.thinking > summary { color: var(--muted); font-style: italic; }
details.thinking .pre { white-space: pre-wrap; color: var(--muted); padding: 0 12px 12px; font-size: 13px; }
.ticon { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); flex: none; }
.tname { font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.tdetail { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tstatus { font-size: 11px; font-weight: 600; color: var(--muted); padding: 1px 7px; border-radius: 999px; background: var(--surface-2); text-transform: lowercase; flex: none; }
.tstatus.running { color: var(--busy); }
.tstatus.running::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--busy); margin-right: 5px; animation: pulse .9s infinite; }
.tstatus.error, .tstatus.failed, .tstatus[class*="exit"] { color: var(--bad); background: rgba(215, 69, 61, .12); }
.blk.err details.tool { border-color: rgba(215, 69, 61, .4); }
.tbody { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.tin, .tout { max-height: 340px; overflow: auto; background: var(--surface-2); padding: 10px; border-radius: 7px; font-size: 12px; }
.tin { color: var(--muted); }
.ellipsis::after { content: "…"; animation: pulse 1s infinite; }
.note { color: var(--muted); font-size: 12px; text-align: center; padding: 2px 0; }
.note.error { color: var(--bad); }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 14px; font-size: 14px; }
.plan ul { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 10px; padding: 4px 0; align-items: flex-start; }
.check { width: 16px; height: 16px; border: 2px solid var(--line-2); border-radius: 5px; margin-top: 3px; flex: none; position: relative; }
.step.completed .check, .step.done .check { background: var(--ok); border-color: var(--ok); }
.step.completed .check::after, .step.done .check::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.inprogress .check, .step.in_progress .check { border-color: var(--busy); animation: pulse 1s infinite; }
.step.completed span:last-child, .step.done span:last-child { color: var(--muted); }

/* Requests */
.req { border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.req.resolved { border-color: var(--line); background: var(--surface); box-shadow: none; opacity: .85; }
.req-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.req-icon { width: 22px; height: 22px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.resolved .req-icon { background: var(--ok); }
.req-body { background: var(--surface-2); padding: 10px; border-radius: var(--r-s); max-height: 320px; overflow: auto; font-size: 13px; margin-bottom: 10px; }
.req-plan { max-height: 50vh; overflow: auto; margin-bottom: 10px; }
.req-res { color: var(--muted); font-size: 13px; }
.req .opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.req .q + .q { margin-top: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; color: var(--fg); font-size: 15px; font-weight: 400; cursor: pointer; }
.opt input { margin: 4px 0 0; accent-color: var(--accent); }
.opt small { display: block; color: var(--muted); font-size: 13px; }

/* Composer */
.composer { padding: 8px 12px calc(10px + var(--sab)); background: var(--surface); border-top: 1px solid var(--line); }
.composer-box { display: flex; gap: 6px; align-items: flex-end; max-width: 820px; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 8px; transition: border-color .12s, box-shadow .12s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.composer textarea { flex: 1; background: transparent; border: 0; box-shadow: none; padding: 9px 10px; min-height: 36px; max-height: 40vh; font-size: 15.5px; }
.composer textarea:focus { box-shadow: none; }
.composer button { width: 36px; height: 36px; min-height: 36px; border-radius: 50%; padding: 0; font-size: 18px; flex: none; }
.composer .send { background: var(--accent); color: var(--on-accent); }
.composer .send:hover { background: var(--accent-2); }
.composer .stop { display: none; background: var(--bad); color: #fff; }
.main:has(.head[data-status="busy"]) .stop, .main:has(.head[data-status="waiting"]) .stop { display: inline-flex; }

/* Plain pages */
.page { max-width: 820px; margin: 0 auto; padding: 8px 16px 48px; }
.page-head { padding: 20px 4px 12px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.subnav { display: flex; gap: 4px; margin: 0 0 12px; overflow-x: auto; }
.subnav a { padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 550; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.subnav a:hover { color: var(--fg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 14px; scroll-margin-top: calc(var(--top) + 12px); }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card h3 { font-size: 15px; margin: 22px 0 10px; }
.card > .hint:first-of-type { margin-top: 0; }
.keycard { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.keybox { background: var(--surface-2); padding: 12px; border-radius: var(--r-s); user-select: all; font-size: 13px; }
.item { border-top: 1px solid var(--line); padding: 14px 0; }
.item:first-of-type { border-top: 0; }
.item-head { display: flex; align-items: flex-start; gap: 12px; }
.item-head > .dot { margin-top: 8px; }
.item-head b { font-size: 15px; }
.item-head code { margin-left: 4px; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-word; }
details.sub { margin-top: 10px; }
details.sub > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
details.sub textarea { margin-top: 8px; }

.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: min(400px, 100%); padding: 26px; }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.login-brand .logo { width: 26px; height: 26px; }
.login h1 { font-size: 22px; margin-bottom: 16px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--sab)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow); animation: rise .18s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
