/* Inter (SIL OFL 1.1, see fonts/inter-LICENSE.txt), Latin subset, variable weight. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter.woff2) format("woff2-variations"), url(fonts/inter.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+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Palette and layout follow hermes-webui (MIT, © 2025 Hermes Web UI Contributors): warm light by default, navy + gold in dark. */
:root {
  color-scheme: light;
  --ink: #000000;
  --bg: #fefcf7;
  --sidebar: #faf7f0;
  --raised: #fffdf8;
  --field: #f5f0e5;
  --text: #1a1610;
  --text-2: #5c5344;
  --text-3: #766b58;
  --accent: #b8860b;
  --accent-ink: #ffffff;
  --accent-text: #8b6508;
  --danger: #c62828;
  --warn: #e68a00;
  --add: #3d8b40;
  --shadow:
    0 2px 4px -2px rgb(0 0 0 / 10%),
    0 12px 28px -12px rgb(0 0 0 / 22%);
  --stroke: color-mix(in srgb, var(--ink) 12%, transparent);
  --stroke-soft: color-mix(in srgb, var(--ink) 8%, transparent);
  --hover: color-mix(in srgb, var(--ink) 5%, transparent);
  --active: color-mix(in srgb, var(--accent) 15%, transparent);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --sidebar-w: 300px;
  --code-kw: #8a3fb0;
  --code-str: #2f7a35;
  --code-num: #b4541c;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.6;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ffffff;
  --bg: #0d0d1a;
  --sidebar: #141425;
  --raised: #1a1a2e;
  --field: #16162a;
  --text: #ececf1;
  --text-2: #b8b8c8;
  --text-3: #8c8ca0;
  --accent: #ffd700;
  --accent-ink: #0d0d1a;
  --accent-text: #e8c35a;
  --danger: #ef5350;
  --warn: #ffa726;
  --add: #4caf50;
  --code-kw: #c792ea;
  --code-str: #a5d6a7;
  --code-num: #f7a072;
  --shadow:
    0 2px 4px -2px rgb(0 0 0 / 35%),
    0 12px 28px -12px rgb(0 0 0 / 55%);
  --stroke: color-mix(in srgb, var(--ink) 14%, transparent);
  --stroke-soft: color-mix(in srgb, var(--ink) 7.5%, transparent);
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --active: color-mix(in srgb, var(--accent) 12%, transparent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
@supports (height: 100dvh) {
  html, body, #shell { height: 100dvh; }
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
input, textarea, select { color: var(--text); }
::placeholder { color: var(--text-3); }
::selection { background: color-mix(in srgb, #ffd24a 38%, transparent); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
button { transition: background-color 100ms ease; }
button:hover { transition: none; }

.login { height: 100%; display: grid; place-items: center; align-content: center; gap: 20px; overflow: auto; padding: 24px; }
.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: var(--text-xl); font-weight: 600; }
.login-lead { margin: -4px 0 4px; color: var(--text-2); }
.login-card .error:empty { display: none; }
.login-card .primary { min-height: 44px; }
.bolt { width: 28px; height: 28px; display: block; }
/* The logo blinks now and then: the eye holes in its mask close to a slit and open again, a double blink every other time. */
.droid-eyes { transform-box: fill-box; transform-origin: center; animation: droid-blink 7s ease-in-out infinite; }
@keyframes droid-blink {
  0%, 44%, 48.5%, 93%, 95.5%, 97%, 99.5%, 100% { transform: scaleY(1); }
  46%, 94.2%, 98.2% { transform: scaleY(0.1); }
}
/* While a reply is being written the logo blinks more often. */
.writing .droid-eyes { animation-duration: 2.8s; }
@media (prefers-reduced-motion: reduce) { .droid-eyes { animation: none; } }
input:not([type]), input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], input[type="time"], textarea, select {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
textarea { resize: vertical; }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
}
button.primary:hover { filter: brightness(1.08); }
button.text, button.quiet {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 6px 8px;
}
button.text, button.primary:not(.icon-btn) { display: inline-flex; align-items: center; gap: 6px; }
button.primary:not(.icon-btn) { justify-content: center; }
button.quiet { text-align: left; }
button.text:hover, button.quiet:hover, .icon-btn:hover { background: var(--hover); color: var(--text); }
button.danger { color: var(--danger); }
.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon { width: 16px; height: 16px; flex: none; display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
button.primary.icon-btn { background: var(--accent); color: var(--accent-ink); padding: 0; }
button.primary.icon-btn:hover { background: var(--accent); color: var(--accent-ink); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.note { color: var(--text-3); font-size: var(--text-sm); margin: 0; }
.note.error { color: var(--danger); }
.note.reconnecting { color: var(--warn); }
.mono, code, pre { font-family: var(--mono); }

#shell { height: 100%; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 8px;
  background: var(--sidebar);
  border-right: 1px solid var(--stroke-soft);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 4px 8px 8px; }
.brand-text { flex: 1; min-width: 0; display: grid; justify-items: start; }
.brand strong { font-weight: 600; }
.drawer-close { display: none; }
.rail .search-wrap { margin: 0 8px 6px; padding: 0 10px; background: var(--field); border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); }
.rail .search-wrap:focus-within { border-color: var(--accent); }
.profile-chip { flex: none; font-size: var(--text-sm); }
.profile-chip summary {
  list-style: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
  white-space: nowrap;
}
.profile-chip summary::-webkit-details-marker { display: none; }
.profile-chip summary::after { content: " ⓘ"; }
.profile-chip p {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 12px;
  width: min(24rem, calc(100% - 24px));
  margin: 0;
  padding: 8px 10px;
  background: var(--raised);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  color: var(--text-2);
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: var(--text-xs); color: var(--text-2); border: 1px solid var(--stroke); border-radius: var(--radius-pill); padding: 1px 8px; }
.card { border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); padding: 12px; display: grid; gap: 8px; }
.steps { display: flex; gap: 10px; font-size: var(--text-sm); color: var(--text-3); }
.steps .on { color: var(--text); font-weight: 600; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px;
  color: var(--text-3);
  border-bottom: 1px solid var(--stroke);
}
.search-wrap:focus-within { border-bottom-color: var(--accent); color: var(--text-2); }
input.search {
  width: auto;
  flex: 1;
  min-width: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 2px;
}
input.search:focus { outline: none; }
.session-list { flex: 1; min-height: 0; overflow: auto; }
/* Thin scrollbar that shows only while the list is hovered or focused. Chrome/Firefox use scrollbar-color; Safari the webkit rules. */
.session-list { scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable; }
.session-list:hover, .session-list:focus-within { scrollbar-color: color-mix(in srgb, var(--text-3) 45%, transparent) transparent; }
.session-list::-webkit-scrollbar { width: 8px; }
.session-list::-webkit-scrollbar-track { background: transparent; }
.session-list::-webkit-scrollbar-thumb { background: transparent; border: 2px solid transparent; border-radius: 8px; background-clip: padding-box; }
.session-list:hover::-webkit-scrollbar-thumb, .session-list:focus-within::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--text-3) 45%, transparent); }
.session-list::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
.session-empty { padding: 8px; }
.session-empty-state { display: grid; justify-items: center; gap: 6px; padding: 24px 12px; text-align: center; }
.session-empty-state > .icon { width: 28px; height: 28px; color: var(--text-3); }
.session-empty-state p { margin: 0; font-weight: 600; color: var(--text-2); }
.session-empty-state .text { margin-top: 4px; }
.chats-more { display: flex; align-items: center; gap: 6px; width: 100%; margin: 4px 0 8px; padding: 6px 8px; color: var(--text-2); }
.chats-more .icon { width: 12px; height: 12px; }
.session-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: var(--radius-sm); }
.session-row:hover { background: var(--hover); }
.session-row.active { background: var(--active); }
.session-group { margin: 12px 8px 4px; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); }
.session-section { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 2px; padding: 0 2px 0 4px; min-height: 28px; }
.section-toggle { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2); font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.section-toggle:hover { background: var(--hover); color: var(--text); }
.section-toggle .icon { width: 12px; height: 12px; color: var(--text-3); }
.section-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.session-section .filter-panel { width: 14rem; }
.session-section + .session-group, .chat-filter + #chat-list > .session-group:first-child { margin-top: 4px; }
.session-open, nav button, .list-button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 8px;
}
.session-open { display: grid; gap: 1px; }
.session-title { min-width: 0; font-size: var(--text-md); }
.session-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { color: var(--text-3); font-size: var(--text-xs); }
.session-match { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--text-2); font-size: var(--text-xs); }
.session-title { display: flex; align-items: center; gap: 6px; }
.session-title .icon { flex: none; width: 12px; height: 12px; color: var(--text-3); }
.session.child .session-open { padding-left: 22px; }
.status-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-dot.status-needs_input { background: var(--warn); }
.status-dot.status-error { background: var(--danger); }
.status-dot.status-unread { background: var(--text); }
.session-open.unread .session-title { font-weight: 600; }
/* Running: Twin Orbit on a 4×4, a step under the title line. */
.run-gate { --run-cycle: calc(1500ms / 1.35); flex: none; display: inline-flex; width: 16px; height: 16px; color: var(--accent); }
.run-gate-grid { display: grid; width: 100%; height: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 1px; }
.run-gate i { display: block; width: 100%; height: 100%; border-radius: 50%; background: currentColor; }
.run-gate i.off { visibility: hidden; }
.run-gate i.ring { animation: run-snake var(--run-cycle) linear infinite; animation-delay: calc(var(--ord) * var(--step) * var(--run-cycle) - var(--run-shift, 0ms)); }
@keyframes run-snake {
  0%, 100% { opacity: 0.08; }
  10% { opacity: 1; }
  20% { opacity: 0.61; }
  30% { opacity: 0.392; }
  40% { opacity: 0.14; }
}
@media (prefers-reduced-motion: reduce) {
  .run-gate i.ring { animation: none; }
}
.session-source { flex: none; width: 14px; height: 14px; margin-left: auto; }
nav button.active { background: var(--active); }
nav button:hover, .list-button:hover { background: var(--hover); }
nav button.active:hover { background: var(--active); }
.session-more { color: var(--text-3); }
.session-more:hover { background: transparent; }
/* With a mouse, the hidden button takes no room, so titles use the full width until hover. */
@media (hover: hover) {
  .session-more { display: none; }
  .session-row:hover .session-more, .session-row:focus-within .session-more, .session-row.active .session-more, .session-more[aria-expanded="true"] { display: grid; }
  /* The ⋯ button takes the logo's place on hover. */
  .session-row:hover .session-source, .session-row:focus-within .session-source, .session-row.active .session-source, .session-row:has(.session-more[aria-expanded="true"]) .session-source { display: none; }
}
.session-actions {
  position: fixed;
  z-index: 30;
  display: grid;
  min-width: 160px;
  padding: 4px;
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.session-actions button { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-start; padding: 8px 10px; color: var(--text); }
.session-actions button:hover { background: var(--hover); }
.session-actions button.danger { color: var(--danger); }
nav { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--stroke-soft); }
.rail nav button { min-width: 0; white-space: nowrap; }
nav button, button.quiet { display: flex; align-items: center; gap: 8px; }
nav button { color: var(--text-2); font-size: var(--text-md); }
nav button .icon, button.quiet .icon { color: var(--text-3); }
nav button.active .icon, nav button:hover .icon, button.quiet:hover .icon { color: var(--text); }
#main { min-width: 0; min-height: 0; height: 100%; }
.chat { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.chat-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--stroke-soft);
  position: relative;
}
.chat-crumb { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 35%; color: var(--text-3); }
.crumb-link { min-width: 0; padding: 2px 4px; color: var(--text-3); font-size: var(--text-md); }
.crumb-link .icon { display: none; }
#parent-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title { flex: 0 1 auto; min-width: 0; margin: 0; font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.chat-usage:not([hidden]) + .chat-actions { margin-left: 0; }
.chat-usage { position: relative; flex: none; margin-left: auto; font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chat-usage summary { list-style: none; display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border-radius: var(--radius-pill); cursor: pointer; }
.chat-usage summary::-webkit-details-marker { display: none; }
.chat-usage summary:hover, .chat-usage[open] summary { background: var(--field); color: var(--text-2); }
.context-ring { width: 16px; height: 16px; transform: rotate(-90deg); }
.context-ring circle { fill: none; stroke-width: 4; }
.ring-track { stroke: var(--stroke); }
.ring-fill { stroke: var(--meter, var(--accent)); stroke-dasharray: 0 100; transition: stroke-dasharray .3s; }
.ring-mark { stroke: var(--text); stroke-dasharray: 3 97; }
.chat-usage[data-level="near"] { --meter: var(--warn); }
.chat-usage[data-level="full"] { --meter: var(--danger); }
.context-panel { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; width: min(20rem, calc(100vw - 32px)); display: grid; gap: 10px; padding: 12px; background: var(--raised); border: 1px solid var(--stroke); border-radius: var(--radius-md); box-shadow: var(--shadow); color: var(--text-2); font-size: var(--text-sm); white-space: normal; }
.context-panel .note { margin: 0; font-size: var(--text-xs); }
.context-panel button { justify-self: start; }
.context-head { display: flex; justify-content: space-between; margin: 0; color: var(--text); }
.context-bar { position: relative; display: flex; height: 8px; border-radius: var(--radius-pill); background: var(--field); }
.context-bar span { flex: none; height: 100%; max-width: 100%; min-width: 0; }
.context-bar span:first-child { border-radius: var(--radius-pill) 0 0 var(--radius-pill); }
.context-panel section { display: grid; gap: 8px; }
.context-panel section + section { padding-top: 10px; border-top: 1px solid var(--stroke-soft); }
.context-bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text-3); }
.context-parts { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.context-parts dt { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.context-parts dt b { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--stroke); }
.context-parts dd { margin: 0; text-align: right; color: var(--text); }
.nav-toggle { display: none; }
.transcript { overflow: auto; padding: 12px 0 8px; display: flex; flex-direction: column; gap: 12px; }
/* Without this, every composer resize (each keystroke) re-runs flex shrinking over the whole transcript. */
.transcript > * { flex-shrink: 0; }
.transcript > .msg, .transcript > .note, .transcript > .chat-divider, .transcript > .chat-divider-details {
  width: min(52rem, calc(100% - 48px));
  margin-inline: auto;
}
/* A labelled rule across the transcript: where earlier turns were compressed, or where the user stopped a reply. */
.chat-divider { display: flex; align-items: center; gap: 8px; margin-block: 0; color: var(--text-3); font-size: var(--text-sm); }
.chat-divider::before, .chat-divider::after { content: ""; flex: 1; border-top: 1px solid var(--stroke); }
.chat-divider > span { display: inline-flex; align-items: center; gap: 6px; text-align: center; }
.chat-divider .msg-time { margin-left: 4px; }
.chat-divider.stopped { color: var(--warn); }
.approval-done > span { min-width: 0; }
.approval-done code { display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.chat-divider.stopped::before, .chat-divider.stopped::after { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
summary.chat-divider { list-style: none; cursor: pointer; border-radius: var(--radius-sm); }
summary.chat-divider::-webkit-details-marker { display: none; }
summary.chat-divider:hover { color: var(--text-2); }
summary.chat-divider > span::after { content: "Show summary"; margin-left: 6px; color: var(--accent-text); }
.chat-divider-details[open] summary.chat-divider > span::after { content: "Hide summary"; }
.chat-divider-details > .body { margin-top: 8px; padding: 12px 16px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); font-size: var(--text-md); }
/* minmax(0, 1fr): an unbreakable line (long URL or inline code) must not widen the column past the screen. */
.msg.assistant { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
/* Slash command output: plain text, commands and labels lined up in two columns. */
.notice-card { font-size: var(--text-md); color: var(--text-2); }
.notice-card.error { color: var(--danger); }
.notice-card > .body > :first-child { margin-top: 0; }
.notice-card > .body > :last-child { margin-bottom: 0; }
.notice-rows { display: grid; grid-template-columns: max-content 1fr; gap: 4px 24px; margin: 0; }
.notice-rows dt { color: var(--text); white-space: nowrap; }
.notice-rows dt.mono { font-family: var(--mono); font-size: var(--text-sm); }
.notice-rows dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .notice-rows { grid-template-columns: 1fr; gap: 0; }
  .notice-rows dd { margin-bottom: 6px; }
  .notice-rows dt { white-space: normal; }
}
.empty-chat { flex: 1; display: grid; align-content: center; justify-items: center; gap: 8px; width: min(36rem, calc(100% - 32px)); margin-inline: auto; text-align: center; }
.empty-chat h2 { margin: 0; font-size: var(--text-xl); font-weight: 600; }
.empty-chat p { margin: 0; display: flex; align-items: center; gap: 5px; font-size: var(--text-md); }
.empty-mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.empty-mark .icon { width: 22px; height: 22px; }
.empty-cwd { font-size: var(--text-sm) !important; }
.starters { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 8px; width: 100%; margin-top: 12px; }
.starter { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; text-align: left; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: transparent; color: var(--text-2); font: inherit; font-size: var(--text-md); cursor: pointer; }
.starter:hover { background: var(--hover); color: var(--text); }
.starter .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
@media (max-width: 800px), (pointer: coarse) { .starter { min-height: 44px; } }
.msg.user {
  width: fit-content;
  max-width: min(32rem, calc(100% - 32px));
  margin-right: max(24px, calc((100% - 52rem) / 2));
  margin-left: auto;
  background: color-mix(in srgb, var(--accent) 16%, var(--raised));
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-base);
  line-height: 1.5;
}
.msg-images { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg-images img { display: block; max-width: 100%; max-height: 160px; border-radius: var(--radius-md); }
.body { font-size: var(--text-base); line-height: 1.6; overflow-wrap: break-word; }
.body a { color: var(--accent-text); }
.worked { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; color: var(--text-3); font-size: var(--text-sm); }
.worked .icon { width: 13px; height: 13px; }
/* Source lists: a card per link with the site above the title. */
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; margin: 8px 0; }
.body a.source-card { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 8px 10px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); color: var(--text); text-decoration: none; }
.body a.source-card:hover { border-color: var(--stroke); background: var(--hover); }
.source-host { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--text-xs); }
.source-host .icon { flex: none; width: 12px; height: 12px; }
.source-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--text-sm); font-weight: 500; line-height: 1.35; }
.source-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-3); font-size: var(--text-xs); }
.body blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--stroke); color: var(--text-2); }
.table-wrap { overflow-x: auto; margin: 0 0 10px; }
.body table { border-collapse: collapse; font-size: var(--text-md); }
.body th, .body td { border-bottom: 1px solid var(--stroke-soft); padding: 6px 16px 6px 0; text-align: left; vertical-align: top; }
.body th { border-bottom-color: var(--stroke); font-weight: 600; }
.body code { font-size: 0.92em; background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: var(--radius-sm); padding: 0 3px; }
.body pre, .tool pre, .log {
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.45;
  background: var(--field);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  overflow: auto;
  margin: 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.body p { margin: 0 0 10px; }
.body h3, .body h4, .body h5, .body h6 { margin: 14px 0 6px; line-height: 1.3; font-weight: 600; }
.body h3 { font-size: var(--text-lg); }
.body h4 { font-size: var(--text-base); }
.body h5, .body h6 { font-size: var(--text-md); }
.body ul, .body ol { margin: 0 0 10px; padding-left: 22px; }
.body li + li { margin-top: 4px; }
.body pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
.code-block { position: relative; margin: 8px 0; }
.code-block pre { margin: 0; }
.code-block:has(.code-lang) pre { padding-top: 24px; }
.code-lang { position: absolute; top: 5px; left: 10px; font: var(--text-xs) var(--mono); color: var(--text-3); }
.copy-btn { font-size: var(--text-xs); color: var(--text-3); gap: 4px; padding: 2px 6px; }
.copy-btn .icon { width: 12px; height: 12px; }
.code-block .copy-btn { position: absolute; top: 2px; right: 2px; }
.msg-actions { display: flex; margin-top: -2px; }
/* Phone: the chat actions are icons only, larger and easier to tap; aria-label names each one. */
@media (max-width: 640px) {
  .copy-btn > span { display: none; }
  .copy-btn { justify-content: center; min-width: 36px; min-height: 36px; padding: 0; }
  .copy-btn .icon { width: 16px; height: 16px; }
  .code-block .copy-btn { top: 0; right: 0; }
}
.transcript > .user-actions { justify-content: flex-end; gap: 2px; margin-top: -10px; }
@media (hover: hover) {
  .code-block .copy-btn, .msg-actions { opacity: 0; transition: opacity 0.12s; }
  .code-block:hover .copy-btn, .msg.assistant:hover .msg-actions, .msg.user:hover + .msg-actions, .msg-actions:hover, .copy-btn:focus-visible, .msg-actions:focus-within { opacity: 1; }
}
.msg.steps { display: grid; }
.tool, .step-group { border: 0; background: none; min-width: 0; }
.tool summary, .step-group > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: var(--text-3);
  font-size: var(--text-sm);
  cursor: pointer;
  list-style: none;
  min-width: 0;
}
.tool summary::-webkit-details-marker, .step-group > summary::-webkit-details-marker { display: none; }
.tool summary::before, .step-group > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.tool[open] > summary::before, .step-group[open] > summary::before { transform: rotate(90deg); }
.tool summary:hover, .step-group > summary:hover { color: var(--text-2); }
.tool summary .icon, .step-group > summary .icon { flex: none; width: 13px; height: 13px; }
.tool-name, .step-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-meta { margin-left: auto; flex: none; padding-left: 8px; }
.tool-body { margin: 4px 0 4px 10px; display: grid; gap: 4px; }
.tool pre { margin: 0; max-height: 240px; color: var(--text-2); }
.tool .diff { padding: 4px 0; border-radius: var(--radius-sm); }
.tool-name code { color: var(--text-2); font-size: 0.95em; }
.tool-part { margin: 2px 0 0; font-size: var(--text-xs); color: var(--text-3); }
.tool.failed > summary, .tool.failed .tool-meta, .danger-text { color: var(--danger); }
.tool.failed pre { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.tool.running .tool-meta, .working { color: var(--text-2); }
.step-list { margin: 2px 0 2px 5px; padding-left: 10px; border-left: 1px solid var(--stroke-soft); }
.composer { padding: 0 16px max(16px, env(safe-area-inset-bottom)); }
.composer-inner {
  position: relative;
  width: min(52rem, 100%);
  margin: 0 auto;
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  padding: 8px;
}
.composer-inner:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.composer textarea {
  display: block;
  min-height: 40px;
  max-height: max(160px, 40vh);
  border: 0;
  background: transparent;
  padding: 4px 6px;
  resize: none;
  outline: none;
  overflow: hidden;
}
.previews { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 4px 6px; }
.previews:empty { display: none; }
.editing-bar { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0 4px 6px; font-size: var(--text-sm); color: var(--text-2); }
.editing-bar button { margin-left: auto; }
.preview { position: relative; flex: none; }
.previews img { display: block; height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--stroke-soft); }
.preview-remove {
  position: absolute;
  z-index: 1;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  background: var(--raised);
  color: var(--text-2);
  cursor: pointer;
}
.preview-remove:hover { color: var(--text); }
/* The circle stays small; the tap area around it is 44px. */
.preview-remove::before { content: ""; position: absolute; inset: -12px; }
.preview-remove .icon { width: 12px; height: 12px; }
.composer-inner.dropping { border-color: var(--accent); border-style: dashed; }
.composer-actions { display: flex; align-items: center; gap: 6px; }
/* Mic sits beside Send, the same round size, like the phone chat apps. */
.send-group { flex: none; display: flex; align-items: center; gap: 6px; }
#mic { width: 32px; height: 32px; border-radius: 50%; }
#mic .mic-stop, #mic[aria-pressed="true"] .mic-glyph { display: none; }
#mic[aria-busy="true"]::after { border-color: var(--accent); border-right-color: transparent; }
/* Recording: the mic turns into a filled stop button and a waveform takes over the whole tool row. */
#mic[aria-pressed="true"] { color: var(--accent-ink); background-color: var(--accent); }
#mic[aria-pressed="true"] .mic-stop { display: block; }
#mic, #mic-cancel { transition: background-color 0.2s, color 0.2s; }
/* Recording: cancel, a scrolling waveform and a timer take over the tool row; the stop button ends it and keeps the text. */
.mic-wave { display: none; }
.composer-inner.recording .composer-actions > :not(.send-group):not(.mic-wave),
.composer-inner.recording .send-btn { display: none; }
.composer-inner.recording .composer-actions { flex-wrap: nowrap; }
.composer-inner.recording .mic-wave { display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; margin-right: 8px; animation: mic-in 0.22s ease-out; }
#mic-cancel { width: 32px; height: 32px; flex: none; border-radius: 50%; }
#mic-cancel:hover { color: var(--text); background-color: color-mix(in srgb, var(--text) 8%, transparent); }
.mic-wave canvas { flex: 1; width: 0; min-width: 0; height: 24px; color: var(--text); }
.mic-time { flex: none; min-width: 2.6em; text-align: right; color: var(--text-2); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
@keyframes mic-in { from { opacity: 0; transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .composer-inner.recording .mic-wave { animation: none; } }
.composer-spacer { margin-left: auto; }

/* Pages (Settings, Memory, ...) replace the chat in the main column. */
#main:has(#overlay:not([hidden])) > .chat { display: none; }
.page-view { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--stroke-soft);
}
.overlay-actions { display: flex; align-items: center; gap: 8px; }
/* Save fits the close button's height, so the header doesn't grow when it appears. */
.overlay-actions .primary { padding-block: 4px; }
/* A toast: shows and hides without moving the form under it. */
.overlay-note {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: min(32rem, calc(100vw - 32px));
  margin: 0;
  padding: 8px 14px;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.overlay-note.warn { color: var(--danger); }
/* Saving: label goes invisible (keeps the width), a spinner sits in its place. */
button[aria-busy="true"] { position: relative; color: transparent !important; cursor: progress; }
button[aria-busy="true"] > * { visibility: hidden; }
button[aria-busy="true"]:disabled, #save-settings[aria-busy="true"] { opacity: 1; }
button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button.text[aria-busy="true"]::after, button.quiet[aria-busy="true"]::after { border-color: var(--text-2); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::after { animation-duration: 2s; } }
#overlay-body { flex: 1; overflow: auto; padding: 20px 24px 32px; }
#overlay-body > * { max-width: 820px; margin-inline: auto; }
/* The rail holds a page's nav: the body is one column. */
.settings-shell:not(:has(> [data-rail])), .settings-shell.skills-shell:not(:has(> [data-rail])) { grid-template-columns: minmax(0, 1fr); }
/* Phones keep most page navs on the page (placeRailNav); the drawer then keeps the chats under the profile picker. */
@media (min-width: 801px) { .rail.section-mode .rail-panel > :not(.brand, #rail-section) { display: none; } }
@media (max-width: 800px) { .rail.section-mode:has(#section-nav > *) .rail-panel > :not(.brand, #rail-section) { display: none; } }
.rail-section { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 8px; }
@media (max-width: 800px) { .rail-section:not(:has(#section-nav > *)) { flex: none; padding-bottom: 4px; } }
.section-profile { display: grid; gap: 4px; padding: 0 8px; font-size: var(--text-sm); }
.section-profile select { width: 100%; }
.section-nav .settings-nav { position: static; }
.section-nav .skills-bar { position: static; padding: 0 0 8px; background: none; }
.section-nav .skills-bar .search-wrap { margin: 0; flex-basis: 100%; }
#shell:has(#overlay:not([hidden])) #nav-chat.busy::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.overlay-head h1 { margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; font-size: var(--text-lg); font-weight: 600; }
.page { display: grid; gap: 12px; align-content: start; }
.page.settings { gap: 0; }
.page-head { display: flex; justify-content: flex-end; }
.group { display: grid; gap: 8px; }
.group + .group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--stroke-soft); }
.group h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--text-md); font-weight: 600; }
.group h2 .icon { color: var(--text-2); }
.label-line, .switch-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.advanced summary { width: fit-content; cursor: pointer; color: var(--text-2); font-size: var(--text-md); }
.advanced .setting, .advanced .field { margin-top: 8px; }
/* Settings rows: name and one-line help on the left, a compact control on the right, hairlines between rows. */
.card.rows { gap: 0; padding: 0 14px; }
.card.rows > * + * { border-top: 1px solid var(--stroke-soft); }
.card.rows .setting { grid-template-columns: minmax(0, 1fr) 15rem; gap: 24px; padding: 12px 0; }
.card.rows .setting.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.card.rows .setting.fit { grid-template-columns: minmax(0, 1fr) auto; }
.card.rows .setting.fit > :last-child { justify-self: end; }
.card.rows > :empty { display: none; }
.card.rows .setting textarea { min-height: 4.5em; }
.card.rows .switch-copy { gap: 2px; }
.card.rows .row-name { color: var(--text); font-weight: 500; }
.card.rows .muted { font-size: var(--text-sm); line-height: 1.4; }
.card.rows .muted.warn { color: var(--danger); }
.card.rows input[type="number"] { width: 7rem; justify-self: end; text-align: right; }
.card.rows .advanced { padding: 12px 0; }
.card.rows .advanced summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; width: auto; list-style: none; }
.card.rows .advanced summary::-webkit-details-marker { display: none; }
.card.rows .advanced summary .icon { flex: none; width: 14px; height: 14px; color: var(--text-3); transform: rotate(-90deg); }
.card.rows .advanced[open] summary .icon { transform: none; }
.card.rows .advanced textarea { width: 100%; min-height: 5.5em; margin-top: 10px; font-family: var(--mono); font-size: var(--text-sm); }
.card.rows .advanced .note { margin-top: 6px; }
.group h3 + .card.rows { margin-top: -2px; }
@media (max-width: 800px) {
  .card.rows .setting, .card.rows .setting.wide, .card.rows .setting.fit { grid-template-columns: 1fr; gap: 8px; }
  .card.rows .setting.fit > :last-child { justify-self: start; }
  .card.rows input[type="number"] { justify-self: start; text-align: left; }
}
.group h3 { margin: 10px 0 0; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.shortcuts kbd { display: inline-block; min-width: 22px; margin-left: 4px; padding: 1px 6px; border: 1px solid var(--stroke); border-bottom-width: 2px; border-radius: var(--radius-sm); font: var(--text-xs) var(--mono); text-align: center; color: var(--text-2); }
#telegram-setup, #telegram-webhook-fields { display: grid; gap: 8px; align-content: start; }
.model-list { display: grid; }
.model-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}
.model-row input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); }
.secret-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.secret-line .mono { overflow: hidden; text-overflow: ellipsis; }
.switch-copy { display: grid; min-width: 0; }
.switch-copy .muted { font-size: var(--text-xs); }
.stack { display: grid; gap: 10px; }
.split { display: grid; gap: 12px; }
label.field { display: grid; gap: 6px; color: var(--text-2); font-size: var(--text-sm); }
#profile-edit .setting { padding-block: 2px; }
.setting {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  color: var(--text-2);
  font-size: var(--text-md);
}
.list { display: grid; }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
}

.page textarea { min-height: 140px; }
.list-row:hover { background: var(--hover); }
.list-row strong { font-size: var(--text-md); font-weight: 600; }
.list-row .muted, .muted { color: var(--text-3); font-size: var(--text-sm); }
.list-copy { display: grid; gap: 2px; min-width: 0; overflow-wrap: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
.list-button { display: flex; gap: 10px; align-items: center; }
.list-button .icon { color: var(--text-3); }
.segmented { display: flex; flex-wrap: wrap; gap: 2px; width: fit-content; max-width: 100%; padding: 2px; border-radius: var(--radius-md); background: var(--field); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); border-radius: var(--radius-sm); padding: 4px 10px; }
.segmented .icon { width: 14px; height: 14px; }
.segmented button[aria-checked="true"] { background: var(--active); color: var(--accent-text); }
.toolsets { display: grid; }
button.line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--raised);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 12px;
  font-weight: 600;
}
button.line:hover { border-color: var(--accent); background: var(--active); }
button.line[aria-busy="true"]::after { border-color: var(--text-2); border-right-color: transparent; }
.mcp-lead { max-width: 40rem; color: var(--text-2); }
.mcp-list { display: grid; gap: 10px; }
.mcp-list:empty { display: none; }
.mcp-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px 14px 12px;
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-left: 3px solid var(--stroke);
  border-radius: var(--radius-md);
}
.mcp-card.is-live { border-left-color: var(--add); }
.mcp-card.is-off { border-left-color: var(--stroke-soft); background: transparent; }
.mcp-card.is-off .mcp-mark,
.mcp-card.is-off .mcp-id { opacity: 0.55; }
.mcp-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mcp-id { display: grid; flex: 1; min-width: 0; gap: 1px; }
.mcp-title { font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-host { font-size: var(--text-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-card-head .pill,
.mcp-card-head .switch { flex: none; }
.mcp-card .setting { grid-template-columns: 5.5rem minmax(0, 1fr); padding: 2px 0; }
.mcp-card input,
.mcp-compose input {
  min-width: 0;
  width: 100%;
}
.mcp-card input[type="url"],
.mcp-compose input[type="url"] {
  width: 100%;
  min-width: 0;
  background: var(--field);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.mcp-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.mcp-tools .pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.mcp-status:empty { display: none; }
.mcp-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.mcp-card-foot .mcp-remove { margin-left: auto; }
.mcp-compose {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  background: var(--raised);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.mcp-compose h3 { margin: 0; color: var(--text); font-size: var(--text-md); }
.mcp-catalog { display: grid; gap: 8px; margin-top: 6px; min-width: 0; }
.mcp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; min-width: 0; }
.mcp-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mcp-tile:hover, .mcp-tile:focus-visible { border-color: var(--accent); background: var(--active); }
.mcp-tile .mark { grid-column: 1; }
.mcp-tile-copy { grid-column: 2; display: grid; min-width: 0; }
.mcp-tile-copy strong { font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tile-copy .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); }
.mcp-tile-go {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: 600;
}
.mcp-tile-go .icon { width: 12px; height: 12px; }
.group h2 #mcp-add { margin-left: auto; font-weight: 500; }
.group h2 #mcp-count { margin-left: 0; }
.tool-group { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: var(--text-md); }
.switch { position: relative; width: 32px; height: 18px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; }
.switch span {
  display: block;
  width: 32px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--stroke);
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

@media (min-width: 720px) {
  .split { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .setting, .mcp-card .setting { grid-template-columns: 1fr; gap: 6px; }
  .tool-group { grid-template-columns: 1fr; }
  .mcp-card-head { align-items: flex-start; }
}
@media (max-width: 800px) {
  #shell { grid-template-columns: 1fr; }
  /* Narrow header: the title keeps the room; actions go icon-only, the crumb becomes a back arrow. */
  .context-text, .chat-actions .label, #parent-title, .crumb-sep { display: none; }
  .chat-usage summary { min-width: 44px; min-height: 44px; justify-content: center; }
  .crumb-link .icon { display: block; }
  .chat-actions button, .crumb-link { min-width: 44px; justify-content: center; }
  .nav-toggle, .drawer-close { display: grid; }
  .rail {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(22rem, 92vw);
    transform: translateX(-105%);
    transition: transform 100ms ease;
  }
  .rail.open { transform: none; }
  .backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(0 0 0 / 45%);
  }
  .overlay-head { padding: 8px 12px; }
  #overlay-body { padding: 12px 16px 24px; }
}
@media (max-width: 800px), (pointer: coarse) {
  .chat-bar button, .composer .icon-btn, nav button, .session-open, #new-session, .session-more,
  .segmented button, .switch-row, .page .primary, .list-button, #save-settings, #overlay-close, .advanced summary, .model-row button,
  .mcp-card-foot button, .mcp-tile, .mcp-compose button, .mcp-card summary {
    min-height: 44px;
  }
  #overlay-close { min-width: 44px; }
  .advanced summary { display: flex; align-items: center; }
  .composer .icon-btn, .nav-toggle, .drawer-close, .session-more, .filter-menu summary, .account-menu summary { min-width: 44px; min-height: 44px; }
  /* Keep the 44px tap area but paint a 32px circle, so the filled stop button does not crowd the timer. */
  #mic, #mic-cancel { padding: 6px; background-clip: content-box; }
  .filter-row { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Settings: section nav + one pane at a time */
.settings-shell { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 20px; align-items: start; min-width: 0; }
.settings-nav { position: sticky; top: 0; display: grid; gap: 2px; }
.settings-nav button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text-2); border-radius: var(--radius-sm); padding: 6px 8px; text-align: left; }
.settings-nav button:hover { background: var(--hover); }
.settings-nav button[aria-current="page"] { background: var(--active); color: var(--text); }
.settings-nav button > span:first-of-type { flex: 1; }
.nav-badge { font-size: var(--text-xs); color: var(--text-3); }
.nav-badge.warn { color: var(--danger); font-weight: 600; }
.group h2 .pill, .card h3 .pill { margin-left: auto; }
.card { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); }
.card h3, .group h3 { display: flex; align-items: center; gap: 8px; }
.card h3 { margin: 0; color: var(--text); font-size: var(--text-md); }
.pill { font-size: var(--text-xs); font-weight: 500; color: var(--text-3); border: 1px solid var(--stroke); border-radius: var(--radius-pill); padding: 1px 8px; }
.pill.on { color: var(--add); border-color: color-mix(in srgb, var(--add) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.note.warn { color: var(--danger); }
.help summary { width: fit-content; cursor: pointer; color: var(--text-3); font-size: var(--text-sm); }
.help .note { margin-top: 6px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; text-decoration: underline; }
#save-settings:disabled { opacity: 0.5; cursor: default; }
#settings-dirty { margin-right: 8px; }
@media (max-width: 640px) {
  .settings-shell { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { display: flex; overflow-x: auto; background: var(--raised); z-index: 1; padding-bottom: 6px; }
  .settings-nav button { flex: none; min-height: 44px; }
  .settings-nav button > span:first-of-type { flex: none; }
  /* In the drawer the nav stays a list. */
  .section-nav .settings-nav { display: grid; overflow: visible; background: none; padding-bottom: 0; }
  .section-nav .settings-nav button > span:first-of-type { flex: 1; }
}
.settings .group + .group { margin-top: 0; padding-top: 0; border-top: 0; }

.overview-row { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; align-items: center; }
.overview-row .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 800px), (pointer: coarse) {
  .overview-row { min-height: 44px; }
}
/* Providers (Settings → Models): one card per provider, a dialog to add one. */
.group h2 #provider-add { margin-left: auto; font-weight: 500; }
#provider-list { display: grid; gap: 10px; }
.mark {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius-md);
  font-size: var(--text-md); font-weight: 600; line-height: 1;
  color: hsl(var(--hue) 55% 36%); background: hsl(var(--hue) 70% 50% / 0.14);
}
:root[data-theme="dark"] .mark { color: hsl(var(--hue) 75% 74%); background: hsl(var(--hue) 60% 60% / 0.16); }
/* Real logos sit on a neutral tile; one-colour logos take the text colour so they flip with the theme. */
.mark.logo, :root[data-theme="dark"] .mark.logo { color: var(--text); background: var(--raised); box-shadow: inset 0 0 0 1px var(--stroke-soft); }
.mark.logo svg { width: 58%; height: 58%; }
.mcp-card .mcp-mark.logo svg,
.mcp-tile .mark.logo svg { width: 78%; height: 78%; }
.model-group-head { display: flex; align-items: center; gap: 6px; }
.model-group-head .mark { width: 16px; height: 16px; border-radius: var(--radius-sm); font-size: 9px; }
.model-group-head .mark.logo { box-shadow: none; background: transparent; }
.model-group-head .mark.logo svg { width: 100%; height: 100%; }
.provider-card { padding: 0; background: var(--raised); transition: border-color 0.15s, box-shadow 0.15s; }
.provider-card[open] { border-color: var(--stroke); box-shadow: var(--shadow); }
.provider-card > summary { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; cursor: pointer; list-style: none; border-radius: var(--radius-md); }
.provider-card > summary:hover { background: var(--hover); }
.provider-card > summary::-webkit-details-marker { display: none; }
.provider-card > summary::after {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 3px 4px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: rotate(45deg); transition: transform 0.15s;
}
.provider-card[open] > summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.provider-title { display: grid; flex: 1; min-width: 0; }
.provider-title .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.provider-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-body { display: grid; padding: 0 14px 6px; border-top: 1px solid var(--stroke-soft); }
.provider-section { display: grid; gap: 6px; padding: 12px 0; }
.provider-section + .provider-section { border-top: 1px solid var(--stroke-soft); }
/* Settings → Channels: provider-style cards that hold each app's setup steps. */
.channel-list { display: grid; gap: 10px; }
.channel-card { gap: 0; }
.channel-card .mark.logo svg { width: 72%; height: 72%; }
.channel-body { gap: 8px; padding: 12px 14px 14px; }
.provider-section > h3 { margin: 0; color: var(--text); font-size: var(--text-md); }
.provider-section > h3 button { margin-left: auto; font-weight: 400; font-size: var(--text-sm); }
.provider-foot { display: flex; justify-content: flex-end; padding: 6px 0; border-top: 1px solid var(--stroke-soft); }
.provider-foot button { font-size: var(--text-sm); }
.key-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.key-field input { flex: 1; min-width: 0; }
.provider-card .model-list { gap: 2px; }
.provider-card .model-row { padding: 4px 8px; border-radius: var(--radius-sm); }
.provider-card .model-row:hover { background: var(--hover); }
.provider-card .model-row:has(input:checked) { background: var(--active); }
.model-row .model-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: var(--text-sm); }
.model-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 10rem; overflow: auto; padding: 2px 0; }
.model-chips button {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 10px 3px 7px;
  border: 1px dashed var(--stroke); border-radius: var(--radius-pill); background: transparent;
  color: var(--text-2); font-family: var(--mono); font-size: var(--text-sm); cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.model-chips button:hover, .model-chips button:focus-visible { border-style: solid; border-color: var(--accent); background: var(--active); color: var(--text); }
.model-chips .icon { flex: none; width: 12px; height: 12px; }
.model-chips .more { font-family: var(--sans); border-style: solid; padding-left: 10px; }
.model-add-row { display: flex; gap: 6px; align-items: center; }
.model-add-row input { flex: 1; min-width: 0; }
[data-note]:empty { display: none; }
.providers-empty {
  display: grid; justify-items: center; gap: 10px; padding: 32px 16px; text-align: center;
  border: 1px dashed var(--stroke); border-radius: var(--radius-lg);
}
.providers-empty strong { font-size: var(--text-lg); font-weight: 600; }
.providers-empty .note { margin: 0; max-width: 26rem; }
.quick-presets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 4px 0; }
.preset-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border: 1px solid var(--stroke);
  border-radius: var(--radius-pill); background: var(--raised); color: var(--text); font: inherit; font-size: var(--text-md); cursor: pointer;
}
.preset-chip:hover, .preset-chip:focus-visible { border-color: var(--accent); background: var(--active); }
.preset-chip .mark { width: 26px; height: 26px; border-radius: 50%; font-size: var(--text-sm); }
.picker {
  width: min(32rem, calc(100vw - 32px)); max-height: min(38rem, calc(100dvh - 64px)); padding: 0;
  border: 1px solid var(--stroke); border-radius: var(--radius-lg); background: var(--raised); color: var(--text); box-shadow: var(--shadow);
}
.picker[open] { display: flex; flex-direction: column; }
.picker::backdrop { background: rgb(0 0 0 / 0.4); backdrop-filter: blur(2px); }
.picker-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--stroke-soft); color: var(--text-3); }
.picker-head input.search { font-size: var(--text-lg); padding: 8px 2px; color: var(--text); }
.picker-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 8px 8px; }
.picker-group { display: grid; }
.picker-group-head {
  position: sticky; top: -4px; z-index: 1; padding: 10px 8px 4px; background: var(--raised);
  font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em;
}
.picker-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.picker-row:hover, .picker-row:focus-visible { background: var(--hover); outline: none; }
.picker-row:focus-visible { box-shadow: inset 0 0 0 1.5px var(--accent); }
.picker-row .pick-copy > span:first-child { font-weight: 500; }
#chat-search .pick-copy { display: grid; gap: 2px; min-width: 0; }
#chat-search .pick-copy > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-none { padding: 24px 8px; text-align: center; }
.reauth-form { display: grid; gap: 10px; padding: 16px; }
.reauth-form .note { margin: 0; }
.reauth-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* In-app confirm and prompt, in place of the browser's own boxes. */
.ask { width: min(440px, calc(100vw - 32px)); }
.ask-form { display: grid; gap: 12px; padding: 20px; }
.ask-title { margin: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.ask-body { margin: 0; max-height: 40vh; overflow: auto; color: var(--text-2); font-size: var(--text-md); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ask-body[hidden], .ask-form input[hidden] { display: none; }
.ask-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ask-actions button { white-space: nowrap; }
.ask-actions #ask-alt { margin-right: auto; }
button.primary.danger { background: var(--danger); color: #fff; }
.ask[open] { animation: ask-in 140ms ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .ask[open] { animation: none; } }
@media (max-width: 640px) {
  .ask-form { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .ask-actions button { min-height: 44px; }
}
.picker-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--stroke-soft); font-size: var(--text-sm); }
@media (max-width: 800px), (pointer: coarse) {
  .picker-row, .model-chips button { min-height: 44px; }
}
@media (max-width: 640px) {
  .picker { width: 100vw; max-width: none; max-height: 85dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* Composer model picker: grouped by provider, opens above the composer. */
.model-menu-wrap { position: relative; display: inline-flex; min-width: 0; }
.model-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 6; width: min(24rem, calc(100vw - 32px)); display: grid; gap: 6px; padding: 8px;
  background: var(--raised); border: 1px solid var(--stroke); border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.model-menu[hidden] { display: none; }
#model-groups { max-height: min(50vh, 22rem); overflow: auto; display: grid; gap: 6px; align-content: start; }
.model-group { display: grid; }
.model-group-head { padding: 4px 8px; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.model-option { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: var(--text-md); text-align: left; cursor: pointer; }
.model-option:hover:not(:disabled), .model-option:focus-visible { background: var(--hover); }
.model-option.selected { background: var(--active); }
.model-option:disabled { color: var(--text-3); cursor: not-allowed; }
.model-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-option .pill { font-size: var(--text-xs); }
.model-more { justify-self: start; font-size: var(--text-sm); }
/* Effort: label left, a pill track of options right; min-width 0 so it never widens the menu. */
.model-effort { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 0 0 8px; border-top: 1px solid var(--stroke-soft); }
.model-effort[hidden] { display: none; }
/* The select holds the value for code; its hidden flag means "model has no effort", so it is never drawn. */
.model-effort > select { display: none; }
.model-effort-label { flex: none; font-size: var(--text-sm); color: var(--text-2); }
.effort-seg { flex: 1; min-width: 0; display: flex; gap: 2px; padding: 2px; border-radius: var(--radius-pill); background: var(--field); }
.effort-seg button { flex: 1 1 auto; min-width: 0; height: 26px; padding: 0 8px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-2); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.effort-seg button:hover { color: var(--text); }
.effort-seg button[aria-checked="true"] { background: var(--active); color: var(--accent-text); font-weight: 600; }
.effort-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.model-foot { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
.model-foot .note { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--text-xs); }
.model-foot button { flex: none; font-size: var(--text-sm); }
@media (max-width: 800px), (pointer: coarse) {
  .model-option { min-height: 44px; }
  .effort-seg button { height: 40px; }
  .model-foot button { min-height: 44px; }
}
/* On a phone the menu spans the composer, like the workspace picker. */
@media (max-width: 640px) {
  .model-menu-wrap { position: static; }
  .model-menu { left: 0; right: 0; width: auto; }
}

#tools-all { margin-left: auto; font-weight: 400; }
.step { border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); }
.step > summary, .step.locked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.step > summary { cursor: pointer; list-style: none; }
.step > summary::-webkit-details-marker { display: none; }
.step > summary .muted, .step.locked .muted { margin-left: auto; }
.step-num { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid var(--stroke); font-size: var(--text-sm); color: var(--text-2); }
.step.done .step-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step.done .step-num .icon { width: 12px; height: 12px; }
.step-title { font-size: var(--text-md); font-weight: 600; }
.step.locked { opacity: 0.55; }
.step-body { display: grid; gap: 8px; padding: 0 12px 12px; }
.pair-code { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pair-code input { flex: 1; min-width: 8rem; font-size: var(--text-xl); letter-spacing: 0.12em; text-align: center; }
@media (max-width: 800px), (pointer: coarse) {
  .step > summary { min-height: 44px; }
}
.secret-line { justify-content: flex-start; gap: 2px; } .secret-line .mono { margin-right: auto; }

/* Profiles: list + detail */
.profile-nav button { align-items: flex-start; }
.profile-nav button .icon { margin-top: 2px; }
/* One-line rows (New schedule, New profile) center in the 44px touch height. */
.profile-nav button:not(:has(.pick-copy)) { align-items: center; }
.profile-nav button:not(:has(.pick-copy)) .icon { margin-top: 0; }
.pick-copy { display: grid; min-width: 0; flex: 1; }
.pick-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-copy .muted { font-size: var(--text-xs); }
.profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-title { font-size: var(--text-lg); }
.profile-pills { display: flex; gap: 6px; flex: none; }
.profile-actions { justify-content: flex-start; }
#profile-edit { display: grid; }
#profile-edit textarea, .danger-zone input { width: 100%; }
.danger-zone { margin-top: 14px; padding: 12px; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: var(--radius-md); }
.danger-zone h2 .icon { color: var(--danger); }
#profile-form { margin-top: 4px; }
@media (max-width: 640px) {
  .profile-nav .pick-copy .muted { display: none; }
  .section-nav .profile-nav .pick-copy .muted { display: block; }
  .profile-head { flex-direction: column; }
}
#profile-edit textarea { min-height: 0; }

/* Skills: search + list + reader */
.skills-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 0 10px; background: var(--raised); }
.skills-bar .search-wrap { flex: 1; min-width: 10rem; }
.settings-shell.skills-shell { grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); }
.skill-list { display: grid; gap: 2px; align-content: start; }
.skill-row { display: flex; align-items: center; gap: 8px; padding-right: 4px; border-radius: var(--radius-sm); }
.skill-row:hover { background: var(--hover); }
.skill-open { flex: 1; min-width: 0; display: flex; border: 0; background: transparent; color: var(--text-2); text-align: left; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.skill-open[aria-current] { background: var(--active); color: var(--text); }
#skill-detail { min-width: 0; }
.skill-body { padding-top: 8px; border-top: 1px solid var(--stroke-soft); }
#skill-detail .skill-back { display: none; justify-self: start; }
@media (max-width: 640px) {
  .settings-shell.skills-shell { grid-template-columns: 1fr; }
  .skills-shell.showing-detail .skill-side, .skills-shell:not(.showing-detail) #skill-detail { display: none; }
  #skill-detail .skill-back { display: inline-flex; }
  .skill-open { min-height: 44px; }
}

/* Memory: entry lists + size meter */
.entry-list { display: grid; border-top: 1px solid var(--stroke-soft); }
.entry-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--stroke-soft); }
/* Plain text until you click into it; then it looks like a field. */
.page .entry-row textarea.entry { flex: 1; min-height: 0; resize: none; field-sizing: content; padding: 6px 8px; background: transparent; border-color: transparent; }
.page .entry-row textarea.entry:hover { background: var(--hover); }
.page .entry-row textarea.entry:focus { background: var(--field); border-color: var(--stroke-soft); }
.entry-remove { flex: none; color: var(--text-3); }
@media (hover: hover) {
  .entry-remove { opacity: 0; }
  .entry-row:hover .entry-remove, .entry-row:focus-within .entry-remove { opacity: 1; }
}
.entry-remove:hover { color: var(--danger); }
.entry-add { display: flex; gap: 6px; }
.entry-add input { flex: 1; }
.page textarea.memory-text { min-height: 320px; font-family: var(--mono); font-size: var(--text-sm); }
.meter { height: 4px; border-radius: var(--radius-pill); background: var(--field); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--accent); }
.meter-wrap { display: grid; gap: 4px; }
.meter-wrap.warn .meter-fill { background: var(--danger); }
.meter-wrap.warn .note { color: var(--danger); }
.profile-title:has(.icon) { display: flex; align-items: center; gap: 6px; }
.profile-title .icon { color: var(--text-2); }
@media (max-width: 800px), (pointer: coarse) {
  .entry-remove { min-width: 44px; min-height: 44px; }
}

/* Schedule: job facts + results */
.facts { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: var(--text-md); }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.facts time { text-decoration: underline dotted var(--text-3); cursor: help; }
.job-output { max-height: 320px; overflow: auto; padding: 10px 12px; border-radius: var(--radius-md); background: var(--field); }
.job-runs { display: grid; gap: 6px; }
.job-run summary { cursor: pointer; font-size: var(--text-sm); }
.job-run .job-output { margin: 6px 0; }
.job-run .delivery-failed { color: var(--danger); }
#job-n { width: 5rem; flex: none; }
.segmented button:disabled { opacity: 0.4; cursor: not-allowed; }
.segmented button[aria-pressed="true"] { background: var(--active); color: var(--accent-text); }
.day-picks button { min-width: 3rem; justify-content: center; }
.time-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.time-row input[type="time"] { width: 8rem; margin-right: 4px; }
.time-row .chip { border-color: var(--stroke-soft); font-variant-numeric: tabular-nums; }
#job-form textarea { min-height: 0; }

button.primary.send-btn { width: 32px; height: 32px; flex: none; border-radius: 50%; }
.send-btn svg { width: 16px; height: 16px; }
.send-btn .stop-glyph, .send-btn.stopping .send-glyph { display: none; }
.send-btn.stopping .stop-glyph { display: block; }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
@media (prefers-reduced-motion: reduce) { .send-btn:active { transform: none; } }

/* Files: right-side panel */
.files-panel { min-height: 0; height: 100%; width: 340px; display: flex; flex-direction: column; background: var(--sidebar); border-left: 1px solid var(--stroke-soft); }
.files-panel.wide { width: min(680px, 48vw); }
.files-head { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--stroke-soft); }
.files-head #files-back { margin-left: -8px; }
.files-name { flex: 1; min-width: 0; display: grid; }
.files-name strong, .files-name small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-name strong { font-size: var(--text-md); }
.files-name small { font-size: var(--text-xs); }
.files-head-actions { display: flex; gap: 2px; }
.files-note { padding: 0 14px 6px; }
.files-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 12px; }
.files-changed { display: grid; gap: 1px; padding: 0 0 8px; border-bottom: 1px solid var(--stroke-soft); }
.files-changed h3 { margin: 0 0 4px; padding: 0 6px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); display: flex; gap: 6px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 0 2px; font-size: var(--text-sm); color: var(--text-3); }
.crumb { border: 0; background: transparent; color: var(--text-2); padding: 2px 4px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; }
.crumb:last-of-type { color: var(--text); font-weight: 600; }
.crumb:hover { background: var(--hover); }
.files-panel .files-filter { margin: 0 2px; padding: 0 10px; background: var(--field); border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); }
.files-panel .files-filter:focus-within { border-color: var(--accent); }
.file-row .file-size { flex: none; font-variant-numeric: tabular-nums; }
.file-list { display: grid; gap: 1px; }
.file-row { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text-2); font-size: var(--text-md); text-align: left; padding: 5px 6px; border-radius: var(--radius-sm); cursor: pointer; }
.file-row:hover { background: var(--hover); color: var(--text); }
.file-row .icon { color: var(--text-3); }
.file-row > span:not(.dot):not(.muted) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .muted { font-size: var(--text-xs); }
.dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--accent); }
.file-actions { justify-content: flex-start; }
#nav-files.active { background: var(--active); color: var(--text); }
@media (min-width: 1101px) {
  #shell.files-open { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto; }
}
@media (max-width: 1100px) {
  .files-panel { position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); box-shadow: var(--shadow); }
  .files-panel.wide { width: min(900px, 100vw); }
}
@media (max-width: 800px) {
  .files-panel, .files-panel.wide { width: 100vw; border-left: 0; }
  #file-wide { display: none; }
  .file-row, .crumb { min-height: 44px; }
}

/* Files: code view + editor */
.code-frame { flex: 1; min-height: 240px; display: flex; overflow: hidden; background: var(--field); border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); }
.code-frame.editing:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.code-view, .code-text, .code-gutter { margin: 0; font-family: var(--mono); font-size: var(--text-sm); line-height: 18px; tab-size: 4; }
.code-view { flex: 1; overflow: auto; padding: 10px 12px 10px 0; white-space: pre; color: var(--text); counter-reset: line; }
.code-line { display: inline; }
.code-line::before { counter-increment: line; content: counter(line); display: inline-block; width: 3.2em; margin-right: 12px; padding-right: 8px; text-align: right; color: var(--text-3); border-right: 1px solid var(--stroke-soft); user-select: none; }
.code-gutter { flex: none; min-width: 3.2em; padding: 10px 8px; overflow: hidden; white-space: pre; text-align: right; color: var(--text-3); border-right: 1px solid var(--stroke-soft); user-select: none; }
.page textarea.code-text, .code-text { flex: 1; min-height: 0; padding: 10px 12px; border: 0; border-radius: 0; background: transparent; color: var(--text); resize: none; white-space: pre; overflow: auto; outline: none; }
.file-status { margin: 0; font-size: var(--text-xs); min-height: 1.4em; }
.file-blocked { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px dashed var(--stroke); border-radius: var(--radius-md); }
.file-blocked p { margin: 0; font-size: var(--text-md); }
.file-blocked .icon { width: 20px; height: 20px; color: var(--text-3); }
.file-conflict { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.file-conflict p { margin: 0; font-size: var(--text-md); }
.file-conflict .actions { justify-content: flex-start; }

/* Composer autocomplete */
.suggest {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 5;
  max-height: 260px; overflow: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--raised); border: 1px solid var(--stroke); border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.suggest li { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: var(--text-md); cursor: pointer; min-width: 0; }
.suggest li .icon { flex: none; align-self: center; width: 14px; height: 14px; color: var(--text-3); }
.suggest li[aria-selected="true"] { background: var(--active); }
.suggest-label { flex: none; font-family: var(--mono); font-size: var(--text-sm); }
.suggest-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: var(--text-sm); }

/* Workspace picker: type a path or walk folders, above the composer like the suggestions. */
.cwd-picker {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 6; display: grid; gap: 6px; padding: 8px;
  background: var(--raised); border: 1px solid var(--stroke); border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.cwd-picker[hidden] { display: none; }
#cwd-input { font-family: var(--mono); font-size: var(--text-sm); }
#cwd-list { max-height: 240px; overflow: auto; margin: 0; padding: 0; list-style: none; }
#cwd-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: var(--text-md); cursor: pointer; min-width: 0; }
#cwd-list li .icon { flex: none; width: 14px; height: 14px; color: var(--text-3); }
#cwd-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cwd-list li[aria-selected="true"] { background: var(--active); }
#cwd-list li.empty { cursor: default; color: var(--text-3); }
.cwd-actions { display: flex; align-items: center; gap: 6px; }
.cwd-actions .muted { flex: 1; min-width: 0; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Subagent link and per-turn changes */
.step-link { flex: none; font-size: var(--text-xs); padding: 0 6px; gap: 4px; color: var(--accent-text); }
.step-link .icon { width: 12px; height: 12px; }
.turn-changes { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--text-3); font-size: var(--text-sm); }
.turn-changes > .icon { width: 13px; height: 13px; }
.file-chip { font: var(--text-sm) var(--mono); padding: 1px 6px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); color: var(--text-2); }
.approval { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--warn) 6%, transparent); }
.approval p { margin: 0; }
.approval-head { display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: var(--text-sm); font-weight: 600; }
.approval-what { font-weight: 600; }
.approval-args { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: var(--text-md); }
.approval-args dt { color: var(--text-3); }
.approval-args dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval-raw summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-3); }
.approval-raw pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-sm); }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.approval-actions button { font-size: var(--text-md); padding: 5px 12px; }
.approval-what code { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .approval-args { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .approval-args dd + dt { margin-top: 6px; }
  .approval-actions button { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 800px), (pointer: coarse) { .approval-actions button { min-height: 44px; } }
.file-chip.on { border-color: var(--stroke); background: var(--hover); color: var(--text); }
.diff-block { border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); overflow: hidden; }
.diff-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; font-size: var(--text-sm); border-bottom: 1px solid var(--stroke-soft); }
.diff-path { font-family: var(--mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.diff-add { color: var(--add); font-family: var(--mono); }
.diff-del { color: var(--danger); font-family: var(--mono); }
.diff-head button { margin-left: auto; font-size: var(--text-sm); }
.diff-note { margin: 0; padding: 8px 10px; font-size: var(--text-sm); color: var(--text-3); }
.diff { margin: 0; padding: 4px 0; max-height: 26rem; overflow: auto; font: var(--text-sm)/1.5 var(--mono); }
.diff span { display: block; padding: 0 10px; white-space: pre; min-width: fit-content; }
.diff .add { background: color-mix(in srgb, var(--add) 14%, transparent); }
.diff .del { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.diff .skip { color: var(--text-3); background: var(--hover); }
@media (pointer: coarse) { .preview-remove { width: 28px; height: 28px; top: -10px; right: -10px; } .preview-remove::before { inset: -8px; } }

/* Hermes layout: icon rail + sessions panel, gold user bubbles, role header, roomier composer. */
.rail { display: flex; flex-direction: row; gap: 0; padding: 0; }
.rail-panel { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.rail > nav {
  flex: none;
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
  border-top: 0;
  border-right: 1px solid var(--stroke-soft);
}
/* Icon-only: the text stays as the accessible name, the title attribute is the tooltip. */
.rail nav button { position: relative; width: 40px; height: 40px; justify-content: center; gap: 0; padding: 0; border-radius: var(--radius-md); font-size: 0; }
.rail nav button .icon { width: 20px; height: 20px; color: var(--text-2); }
#shell:has(#overlay[hidden]) #nav-chat::before, .rail nav button.active::before { content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); }
.rail nav button.active .icon, #shell:has(#overlay[hidden]) #nav-chat .icon { color: var(--accent-text); }
#shell:has(#overlay[hidden]) #nav-chat { background: var(--active); }
.rail nav #inbox-open { margin-top: auto; }
/* Account menu: an icon like the rail's buttons; its panel opens to the right, bottom-aligned, over the sessions panel. */
.account-menu { position: relative; }
.account-menu summary { list-style: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary .icon { width: 20px; height: 20px; color: var(--text-2); }
.account-menu summary:hover, .account-menu[open] summary { background: var(--hover); }
.account-menu .filter-panel { top: auto; right: auto; bottom: 0; left: calc(100% + 8px); width: 12rem; }
/* Undo the rail's icon-only button look for the menu's row. */
.account-menu .filter-row { width: 100%; height: auto; justify-content: flex-start; gap: 10px; padding: 6px 8px; font-size: var(--text-sm); color: var(--text); }
.account-menu .filter-row .icon { width: 14px; height: 14px; color: var(--text-3); }
.brand { box-sizing: border-box; height: 56px; padding: 0 14px 0 16px; gap: 12px; border-bottom: 1px solid var(--stroke-soft); }
.brand .bolt { width: 28px; height: 28px; }
.brand strong { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.rail .search-wrap { margin: 0 12px 8px; padding: 2px 12px; border-radius: var(--radius-md); }
.session-list { padding: 0 8px; }
/* The scrollbar gutter (~8px) already pads the right edge where scrollbars take space. shortcut: macOS overlay scrollbars take none, so the list sits 8px right there; measure offsetWidth - clientWidth in JS if that shows. */
@media (pointer: fine) { .session-list { padding-right: 0; } }
.session-group { margin: 16px 8px 4px; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.session-row { border-radius: var(--radius-md); }
.session-open { padding: 8px 10px; }
.session-title { font-size: var(--text-base); }
.session-row.active { background: var(--active); }

.chat-bar { min-height: 56px; padding: 8px 20px; background: var(--bg); }
.chat-title { font-size: var(--text-lg); }
.transcript { padding: 24px 0 12px; gap: 20px; }
.transcript > .user-actions { margin-top: -16px; }
.msg.user {
  max-width: min(36rem, calc(100% - 48px));
  background: color-mix(in srgb, var(--accent) 10%, var(--raised));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  line-height: 1.6;
}
.role-head { display: flex; align-items: center; gap: 8px; margin-bottom: -10px; color: var(--text-2); font-size: var(--text-md); font-weight: 500; }
.role-icon { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--stroke); border-radius: 50%; background: var(--field); }
.role-icon svg { width: 12px; height: 12px; fill: var(--accent); }
.body { line-height: 1.65; }
.msg.steps > details > summary { padding: 6px 10px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.msg.steps > details[open] > summary { margin-bottom: 6px; }

.composer { padding: 0 20px max(20px, env(safe-area-inset-bottom)); }
.composer-inner { border: 1px solid var(--stroke); border-radius: var(--radius-lg); padding: 10px 12px 8px; box-shadow: 0 1px 3px rgb(0 0 0 / 6%); }
.composer textarea { font-size: var(--text-lg); min-height: 44px; }
button.primary.send-btn { width: 36px; height: 36px; }

.login-card { border-radius: var(--radius-lg); }
button.primary { border-radius: var(--radius-md); }
.files-head { min-height: 56px; padding-left: 16px; }
@media (max-width: 800px) {
  .chat-bar { padding: 6px 12px; }
  .composer { padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
  /* The drawer's X tops the icon column, level with the 56px header, so the header keeps room for the name. */
  .rail > nav { padding-top: 6px; }
  .rail nav .drawer-close { margin-bottom: 8px; }
  .brand { gap: 4px; padding-right: 8px; }
  .brand .bolt { margin-right: 8px; }
  /* viewport-fit=cover lets the page run under Android's navigation bar; keep the last rows above it. */
  .rail > nav, .rail .session-list, .files-panel .files-body { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #overlay-body { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* Hermes extras: header subtitle, composer chips, source tabs, bulk step toggles. */
.chat-heading { flex: 0 1 auto; min-width: 0; display: grid; }
.chat-sub { color: var(--text-3); font-size: var(--text-sm); line-height: 1.3; }
.composer-actions { gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 11rem;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-2);
  font-size: var(--text-md);
}
.chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }
/* In the composer the chips sit beside the attach and mic buttons: same 16px icons. */
.composer .chip .icon { width: 16px; height: 16px; }
button.chip:hover { background: var(--hover); color: var(--text); }
button.chip { cursor: pointer; }
/* Profile and Effort: the select holds the value and stays out of sight; the chip and menu are drawn from it. */
.pick > select { display: none; }
.pick:has(> select[hidden]) { display: none; }
.pick-menu { left: 0; right: auto; width: max-content; min-width: 11rem; max-width: calc(100vw - 32px); max-height: min(50vh, 22rem); overflow: auto; gap: 0; padding: 4px; }
.pick-menu .icon { width: 14px; height: 14px; color: var(--text-2); }
#composer-model { max-width: 16rem; }
/* Source filter as chips in one scrolling row, so more integrations still fit. */
@media (max-width: 640px) {
  /* Icons only so every control fits one line; the tooltip and the open menu show the current value. */
  .composer .chip span { display: none; }
  .composer .chip { justify-content: center; padding: 0; min-width: 44px; min-height: 44px; }
  .composer-actions { gap: 0; }
  /* The chips take a second line instead of pushing Send off the screen. */
  .composer-actions { flex-wrap: wrap; }
  /* The spacer can end up on the line above, so Mic and Send push themselves right. */
  .send-group { margin-left: auto; }
}

/* Syntax colours for fenced code; comments reuse the muted text colour. */
.tok-c { color: var(--text-3); font-style: italic; }
.tok-k { color: var(--code-kw); }
.tok-s { color: var(--code-str); }
.tok-n { color: var(--code-num); }

@media (min-width: 801px) {
  .overlay-head { min-height: 56px; }
  .skills-bar { background: var(--bg); }
}

/* Message times and queued messages */
.msg-time { color: var(--text-3); font-size: var(--text-xs); font-weight: 400; font-variant-numeric: tabular-nums; }
.role-head .msg-time { margin-left: 2px; }
.user-actions .msg-time { align-self: center; margin-right: 6px; }
.msg.user.queued { opacity: 0.6; border-style: dashed; }
.transcript > .queued-actions { opacity: 1; align-items: center; gap: 8px; font-size: var(--text-sm); }

/* Mermaid diagrams */
.mermaid-block { margin: 12px 0; padding: 12px; overflow-x: auto; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); text-align: center; }
.mermaid-block svg { max-width: 100%; height: auto; }
.mermaid-error { margin: -4px 0 8px; padding: 8px 10px; overflow-x: auto; border-radius: var(--radius-md); background: var(--raised); color: var(--danger); font-size: 12px; white-space: pre-wrap; }

/* Accent skins (values from hermes-webui). Dark keeps its dark --accent-ink, which reads on every bright accent. */
:root[data-skin="ares"] { --accent: #c0392b; --accent-text: #922b21; }
:root[data-skin="poseidon"] { --accent: #0369a1; --accent-text: #025080; }
:root[data-skin="sisyphus"] { --accent: #7c3aed; --accent-text: #6d28d9; }
:root[data-skin="charizard"] { --accent: #ea580c; --accent-text: #c2410c; }
:root[data-skin="slate"] { --accent: #475569; --accent-text: #334155; }
:root[data-skin="mono"] { --accent: #666666; --accent-text: #555555; }
:root[data-theme="dark"][data-skin="ares"] { --accent: #ff4444; --accent-text: #ff6b6b; }
:root[data-theme="dark"][data-skin="poseidon"] { --accent: #0ea5e9; --accent-text: #38bdf8; }
:root[data-theme="dark"][data-skin="sisyphus"] { --accent: #a78bfa; --accent-text: #a78bfa; }
:root[data-theme="dark"][data-skin="charizard"] { --accent: #fb923c; --accent-text: #fb923c; }
:root[data-theme="dark"][data-skin="slate"] { --accent: #94a3b8; --accent-text: #94a3b8; }
:root[data-theme="dark"][data-skin="mono"] { --accent: #cccccc; --accent-text: #cccccc; }
.skins { flex-wrap: wrap; }
.skins .swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; }

/* Todo strip: fixed rows so a hidden strip leaves the transcript in the stretching row. */
.chat > .transcript { grid-row: 3; }
.chat > .composer { grid-row: 4; }
.todo-strip { width: min(52rem, calc(100% - 48px)); margin: 8px auto 0; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); font-size: var(--text-md); }
.todo-strip summary { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.todo-strip ul { list-style: none; margin: 0; padding: 0 10px 8px; display: grid; gap: 4px; max-height: 30vh; overflow: auto; }
.todo-strip li { display: flex; align-items: flex-start; gap: 8px; }
.todo-strip li .icon { flex: none; margin-top: 3px; color: var(--text-3); }
.todo-strip li.todo-done { color: var(--text-3); text-decoration: line-through; }
.todo-strip li.todo-done .icon { color: var(--add); }

/* Reasoning cards */
.msg.thinking details { border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); padding-left: 10px; }
.msg.thinking summary { display: flex; align-items: center; gap: 6px; width: fit-content; color: var(--text-3); font-size: var(--text-sm); cursor: pointer; }
.msg.thinking summary .icon { color: var(--accent); }
.msg.thinking .body { margin-top: 6px; color: var(--text-2); font-size: var(--text-md); }

/* Projects and tags */
/* Chat filter: one row. Active filters are chips that shrink to fit; the rest lives in the menu. */
.chat-filter { display: flex; align-items: center; gap: 6px; margin: 2px 4px 6px; min-height: 28px; }
.filter-active { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; }
.filter-label { padding-left: 4px; color: var(--text-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; height: 24px; padding: 0 6px 0 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); font: inherit; font-size: var(--text-sm); cursor: pointer;
}
.filter-chip > span:not(.project-dot) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip .icon { flex: none; width: 12px; height: 12px; }
.filter-chip > .icon:last-child { color: var(--text-3); }
.filter-chip:hover > .icon:last-child { color: var(--text); }
.filter-menu { position: relative; flex: none; }
.filter-menu summary { list-style: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--text-3); cursor: pointer; }
.filter-menu summary::-webkit-details-marker { display: none; }
.filter-menu summary:hover, .filter-menu[open] summary { background: var(--hover); color: var(--text); }
.filter-menu.on summary { color: var(--accent-text); }
.filter-panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; width: 15rem; max-height: min(26rem, 70dvh); overflow: auto;
  padding: 4px; background: var(--raised); border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); box-shadow: var(--shadow);
}
.filter-head { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 8px 4px; color: var(--text-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.filter-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer;
}
.filter-row:hover, .filter-row:focus-visible { background: var(--hover); outline: none; }
.filter-row .icon { flex: none; width: 14px; height: 14px; color: var(--text-3); }
.filter-row .project-dot { margin: 0 3px; }
.filter-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { color: var(--text-3); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.filter-row > .icon:last-child { visibility: hidden; color: var(--accent-text); }
.filter-row[aria-checked="true"] > .icon:last-child { visibility: visible; }
.filter-row[aria-checked="true"] .filter-name { font-weight: 500; }
.filter-act { color: var(--text-2); }
.filter-foot { display: flex; align-items: center; gap: 2px; margin-top: 4px; padding: 4px 0 0; border-top: 1px solid var(--stroke-soft); }
.filter-foot .filter-head { flex: 1; min-width: 0; padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-2); }
.filter-foot .icon-btn { width: 28px; height: 28px; }
.filter-foot .danger { color: var(--danger); }
.project-none { border: 1.5px solid var(--text-3); background: transparent; box-sizing: border-box; }
.source-logo { color: initial; }
.project-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.project-name { display: inline-flex; align-items: center; gap: 4px; }
.tag-chip { display: inline-flex; align-items: center; gap: 2px; padding: 0 6px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); font-size: var(--text-xs); cursor: pointer; }
.tag-chip:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
button.tag-chip { border: 0; padding: 3px 8px; font-size: var(--text-sm); }
.session-actions button[aria-current="true"] { background: var(--active); }
.filter-list-acts { display: block; }
.filter-panel > div:empty + .filter-foot { margin-top: 0; padding-top: 0; border-top: 0; }
.session-list { padding-bottom: 12px; }

/* Insights */
.insights { display: grid; gap: 16px; }
.insights .segmented { width: fit-content; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); }
.stat .muted { font-size: var(--text-sm); }
.stat strong { font-size: var(--text-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart { margin: 0; padding: 12px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); background: var(--raised); }
.chart figcaption { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: var(--text-md); }
.chart svg { display: block; width: 100%; height: 160px; }
.chart .bar { fill: var(--accent); }
.chart .hit:hover .bar { fill: var(--accent-text); }
.chart .axis { stroke: var(--stroke); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-x { display: flex; justify-content: space-between; margin-top: 4px; font-size: var(--text-xs); }
.data-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 4px 8px; border-bottom: 1px solid var(--stroke-soft); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.rank h3 { margin: 0 0 6px; font-size: var(--text-md); }
/* Rows share one set of columns, so bars and values line up whatever the value's length. */
.rank ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) 60px auto; gap: 6px 8px; }
.rank li { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; font-size: var(--text-sm); }
.rank:first-child { grid-column: 1 / -1; } /* Models: its values are long, so it gets the full row */
.rank:first-child ol { grid-template-columns: minmax(0, max-content) minmax(60px, 1fr) auto; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.rank-value { color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Files panel tools */
.files-tools { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 4px; }
.files-tools button { font-size: var(--text-sm); }
.branch-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--field); color: var(--text-2); font-size: var(--text-xs); }
.branch-badge .icon { width: 12px; height: 12px; }

/* File attachments */
.file-preview { display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); background: var(--raised); font-size: var(--text-sm); max-width: 220px; }
.file-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview small { flex: none; }
.msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg-files:first-child { margin-top: 0; }
.msg.user .file-chip { display: inline-flex; align-items: center; gap: 4px; }
.facts .delivery-failed { color: var(--danger); }
/* Background chats: what finished, failed or asks, with a way there. */
.toasts {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  width: min(22rem, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  color: var(--text);
  font-size: var(--text-sm);
  background: var(--raised);
  border: 1px solid var(--stroke-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.toast.error { border-left-color: var(--danger); }
.toast.ask { border-left-color: var(--warn); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .icon-btn { flex: none; }
@media (max-width: 640px) { .toasts { right: 16px; left: 16px; width: auto; bottom: 88px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* First run: a short checklist above the starters. */
.setup-card { width: 100%; margin-bottom: 16px; padding: 14px 16px; text-align: left; background: var(--raised); border: 1px solid var(--stroke-soft); border-radius: var(--radius-md); }
.setup-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.setup-card h3 { margin: 0; font-size: var(--text-md); font-weight: 600; }
.setup-card ol { display: grid; gap: 12px; margin: 12px 0 0; padding: 0; list-style: none; }
.setup-step { display: flex; align-items: flex-start; gap: 10px; }
.setup-mark { flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--stroke); border-radius: 50%; }
.setup-step.done .setup-mark { color: var(--add); border-color: var(--add); }
.setup-mark .icon { width: 12px; height: 12px; }
.setup-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.setup-copy .muted { font-size: var(--text-sm); }
.setup-copy code { overflow-wrap: anywhere; }
.setup-step.done strong { color: var(--text-2); }
.setup-step > button { flex: none; }

/* Kanban board: quiet columns, status shown by one small mark, the picked card in a side panel. */
#overlay-body > .board-page { max-width: 1600px; }
.board-page { display: grid; gap: 14px; align-content: start; }
.kb-mark { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.kb-mark[data-status="ready"] { color: var(--text-2); }
.kb-mark[data-status="running"] { color: var(--warn); }
.kb-mark[data-status="blocked"] { color: var(--danger); }
.kb-mark[data-status="done"] { color: var(--add); }
.kb-toolbar { display: flex; gap: 12px; align-items: center; }
.kb-filter select { width: auto; min-width: 9rem; padding-block: 4px; font-size: var(--text-md); }
.kb-total { font-size: var(--text-sm); color: var(--text-3); }
.kb-empty-note { margin: 0; }
.kb-shell { display: grid; gap: 20px; align-items: start; }
.kb-shell.open { grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); }
.kanban-board { display: grid; grid-template-columns: repeat(5, minmax(14rem, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.kb-col { display: flex; flex-direction: column; min-width: 0; border-radius: var(--radius-md); background: var(--sidebar); }
.kb-col-head { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px 8px; font-size: var(--text-md); font-weight: 600; color: var(--text); }
.kb-n { font-weight: 400; color: var(--text-3); }
.kb-col-body { display: grid; gap: 6px; align-content: start; padding: 0 6px 6px; min-height: min(55vh, 30rem); }
.kb-card { display: grid; gap: 6px; text-align: left; width: 100%; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--stroke); background: var(--raised); color: var(--text); cursor: pointer; overflow-wrap: anywhere; font: inherit; transition: border-color 0.12s; }
.kb-card:hover { border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.kb-card[aria-current] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kb-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kb-card-title { font-size: var(--text-md); font-weight: 500; line-height: 1.45; }
.kb-card-need { font-size: var(--text-sm); color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-card-dep { font-size: var(--text-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-card-meta { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--text-3); min-width: 0; }
.kb-card-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-count { display: inline-flex; gap: 3px; align-items: center; }
.kb-count .icon { width: 12px; height: 12px; }
.kb-time { margin-left: auto; white-space: nowrap; }
.kb-card-meta time, .kb-props time { text-decoration: none; }
.kb-detail { position: sticky; top: 0; display: grid; gap: 20px; align-content: start; max-height: calc(100vh - 130px); overflow-y: auto; padding: 4px 4px 16px 20px; border-left: 1px solid var(--stroke-soft); }
.kb-detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; }
.kb-detail-sub { font-size: var(--text-sm); color: var(--text-3); }
.kb-detail-title { grid-column: 1 / -1; margin: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.kb-props { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: var(--text-md); align-items: center; }
.kb-props dt { color: var(--text-3); }
.kb-props dd { margin: 0; display: flex; gap: 6px; align-items: center; min-width: 0; }
.kb-props select { width: 100%; }
.kb-link { display: inline-flex; gap: 6px; align-items: center; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.kb-link:hover { text-decoration: underline; }
.kb-section { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--stroke-soft); }
.kb-section h3 { margin: 0; font-size: var(--text-md); font-weight: 600; }
.kb-section .body { font-size: var(--text-md); }
.kb-section .body > :first-child { margin-top: 0; }
.kb-section .body > :last-child { margin-bottom: 0; }
.kb-needs h3 { color: var(--danger); }
.kb-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.kb-comments li { display: grid; gap: 2px; }
.kb-comment-head { display: flex; gap: 8px; align-items: baseline; font-size: var(--text-md); }
.kb-comment-head time { color: var(--text-3); font-size: var(--text-sm); }
.kb-comment-body { font-size: var(--text-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.kb-compose, .kb-form { display: grid; gap: 10px; }
.kb-detail textarea { min-height: 0; font-size: var(--text-md); }
.kb-title-input { font-size: var(--text-base); font-weight: 500; }
.kb-detail .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
#board-refresh, #card-new { white-space: nowrap; }
#card-delete { margin-right: auto; }
@media (max-width: 1100px) {
  .kb-shell.open { grid-template-columns: minmax(0, 1fr); }
  .kb-detail { position: static; max-height: none; order: -1; padding: 0 0 20px; border-left: 0; border-bottom: 1px solid var(--stroke-soft); }
}
@media (max-width: 640px) {
  #board-refresh .board-label { display: none; }
  .kanban-board { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .kb-col-body { min-height: 2.5rem; }
}

/* Onboarding and two-step sign-in. A config ledger, not a card deck: rows and rules, real values in mono. */
.onboard { position: fixed; inset: 0; z-index: 50; overflow: auto; background: var(--bg); }
.ob-shell {
  width: min(920px, 100%); margin: 0 auto; padding: clamp(32px, 8vh, 88px) 32px 48px;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 64px;
}
.ob-aside { align-self: start; display: grid; gap: 28px; padding: 0; border: 0; }
.ob-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--text-base); }
.ob-brand .bolt { width: 22px; height: 22px; }
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ob-steps li { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: var(--text-md); color: var(--text-3); }
.ob-mark { flex: none; width: 16px; display: grid; place-items: center; font-family: var(--mono); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.ob-mark .icon { width: 14px; height: 14px; }
.ob-steps li.done { color: var(--text-2); }
.ob-steps li.done .ob-mark { color: var(--add); }
.ob-steps li.now { color: var(--text); font-weight: 600; }
.ob-steps li.now .ob-mark { color: var(--accent-text); }
.ob-aside-note { margin: 0; font-size: var(--text-sm); line-height: 1.5; color: var(--text-3); }
.ob-mobile-progress { display: none; }
/* Maker credit: quiet, text-only, on the screens before the app (setup, sign-in, onboarding). */
.made-by { margin: 0; font-size: var(--text-sm); color: var(--text-3); text-align: center; }
.made-by a { color: var(--text-2); font-weight: 500; text-decoration: none; }
.made-by a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.ob-shell { grid-template-rows: auto 1fr; }
.ob-main { grid-column: 2; grid-row: 1 / span 2; }
.ob-credit { grid-column: 1; grid-row: 2; align-self: end; text-align: left; }

.ob-main { min-width: 0; max-width: 600px; }
.ob-enter { animation: ob-fade 160ms cubic-bezier(.2, .7, .2, 1); }
@keyframes ob-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ob-enter { animation: none; } }
.ob-main h2 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; outline: none; }
.ob-lead { margin: 8px 0 32px; max-width: 60ch; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.ob-loading { padding: 24px 0; }
.ob-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--stroke-soft); }
.ob-foot:not(:has(button)) { display: none; }
.ob-ledger + .ob-foot { margin-top: 32px; padding-top: 0; border-top: 0; }
.onboard button.primary { min-height: 40px; padding: 8px 20px; border-radius: var(--radius-md); }
.onboard button.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.onboard button.primary:active:not(:disabled) { filter: brightness(.95); }
.onboard button.text { min-height: 40px; padding: 8px 10px; }
.ob-foot > button.text:first-child { margin-left: -10px; }
.ob-foot > button.text:last-child { margin-right: -10px; }
button.icon-only { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--text-3); }
button.icon-only:hover { background: var(--hover); color: var(--text); }

/* The ledger: label column, value column, hairline rules between rows. */
.ob-ledger { margin: 0; border-top: 1px solid var(--stroke); }
.ob-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--stroke-soft); }
.ob-row dt { font-size: var(--text-md); font-weight: 600; padding-top: 6px; }
.ob-row dd { margin: 0; min-width: 0; display: grid; gap: 6px; }
.ob-row dd strong { font-size: var(--text-base); font-weight: 600; padding-top: 4px; }
.ob-row dd p { margin: 0; color: var(--text-2); font-size: var(--text-md); line-height: 1.55; }
.ob-value { display: flex; align-items: flex-start; gap: 4px; min-width: 0; padding: 4px 4px 4px 10px; background: var(--field); border-radius: var(--radius-sm); }
.ob-value code { flex: 1; min-width: 0; padding: 5px 0; font-family: var(--mono); font-size: var(--text-md); line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.ob-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ob-state .icon { width: 14px; height: 14px; }
.ob-row.ok dt { color: var(--add); }
.ob-row.todo dt { color: var(--text-3); }
.ob-row.bad dt { color: var(--danger); }
.ob-row.ok dd p { color: var(--text-3); }

/* Two-step sign-in (onboarding and Settings). */
.totp { container-type: inline-size; display: grid; gap: 20px; }
.totp-loading { padding: 24px 0; }
.totp-grid { display: grid; gap: 20px; align-items: start; }
@container (min-width: 480px) { .totp-grid { grid-template-columns: 176px 1fr; gap: 28px; } }
.totp-qr { margin: 0; width: 176px; padding: 4px; line-height: 0; background: #fff; border: 1px solid var(--stroke); border-radius: var(--radius-md); }
.totp-qr svg { width: 100%; height: auto; }
.totp-how { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; color: var(--text-2); font-size: var(--text-base); line-height: 1.55; }
.totp-how li::marker { color: var(--text-3); font-variant-numeric: tabular-nums; }
.totp-open { display: none; }
@media (pointer: coarse) {
  .totp-open { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--stroke); border-radius: var(--radius-md); color: var(--text); text-decoration: none; font-weight: 500; }
}
.totp-manual summary { width: fit-content; cursor: pointer; color: var(--text-2); font-size: var(--text-md); }
.totp-manual summary:hover { color: var(--text); }
.totp-manual .ob-value { margin-top: 10px; }
.totp-key { letter-spacing: 0.06em; }
.totp-confirm { display: grid; gap: 6px; max-width: 360px; }
.totp-confirm input { height: 40px; }
.totp-confirm label + .totp-code-row, .totp-confirm label { margin: 0; }
.totp-confirm input + label { margin-top: 10px; }
.totp-confirm label { font-size: var(--text-md); font-weight: 600; }
.totp-code-row { display: flex; flex-wrap: wrap; gap: 10px; }
input.otp-input {
  width: 11ch; flex: 1; min-width: 11ch; height: 40px; padding: 0 12px;
  font-family: var(--mono); font-size: 18px; letter-spacing: 0.2em; font-variant-numeric: tabular-nums;
  border-radius: var(--radius-md); border: 1px solid var(--stroke);
}
input.otp-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.totp-confirm .error:empty { display: none; }
.totp-status { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--add); }
.recovery { display: grid; gap: 8px; }
.recovery h3 { margin: 8px 0 0; font-size: var(--text-base); font-weight: 600; }
.recovery-codes {
  margin: 4px 0 0; padding: 14px 16px 14px 2.6em; display: grid; grid-template-columns: repeat(auto-fill, minmax(17ch, 1fr)); gap: 6px 24px;
  font-family: var(--mono); font-size: var(--text-md); background: var(--field); border-radius: var(--radius-md);
}
.recovery-codes li { white-space: nowrap; }
.recovery-codes li::marker { color: var(--text-3); }
.recovery-actions { display: flex; gap: 4px; margin-left: -8px; }
.recovery-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--stroke-soft); }
.check-line { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: var(--text-base); cursor: pointer; min-height: 32px; }
.check-line input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
#login-code { font-family: var(--mono); letter-spacing: 0.15em; }
#totp-setup:not(:empty) { max-width: 600px; margin: 8px 0 16px; }

@media (max-width: 760px) {
  .ob-shell { grid-template-columns: 1fr; grid-template-rows: none; padding: 0 16px 32px; }
  .ob-main, .ob-credit { grid-column: 1; grid-row: auto; }
  .ob-credit { margin-top: 24px; text-align: center; }
  .ob-aside { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -16px 24px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--stroke-soft); }
  .ob-steps, .ob-aside-note { display: none; }
  .ob-mobile-progress { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
  .ob-bar { width: 72px; height: 4px; border-radius: 4px; background: var(--stroke); overflow: hidden; }
  .ob-bar span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--ob-progress, 0)); background: var(--accent); transition: transform 200ms cubic-bezier(.2, .7, .2, 1); }
  .ob-main h2 { font-size: 21px; }
  .ob-lead { margin-bottom: 24px; font-size: var(--text-base); }
  .ob-row { grid-template-columns: 1fr; row-gap: 8px; padding: 16px 0; }
  .ob-row dt { padding-top: 0; }
  .ob-row:is(.ok, .todo, .bad) { grid-template-columns: 56px minmax(0, 1fr); column-gap: 12px; }
  .ob-row:is(.ok, .todo, .bad) dt { padding-top: 5px; font-size: var(--text-sm); }
  .ob-foot, .ob-ledger + .ob-foot { position: sticky; bottom: 0; margin: 32px -16px 0; border-top: 1px solid var(--stroke-soft); padding: 12px 16px max(12px, env(safe-area-inset-bottom)); background: var(--bg); }
  .ob-foot .primary { flex: 1; }
  .onboard button.primary { min-height: 44px; }
}

/* Security → Recent activity */
.audit-day { margin: 10px 4px 2px; color: var(--text-3); font-size: var(--text-sm); font-weight: 600; }
.audit-day:first-child { margin-top: 0; }
.audit-row .list-copy > .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-row.alarm strong { color: var(--warn); }
.audit-more { justify-self: start; margin-top: 6px; }

/* Notification center */
.inbox-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
}
.nav-toggle.has-unread { position: relative; }
.nav-toggle.has-unread::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.inbox-title { flex: 1; color: var(--text); }
#inbox .pick-copy { display: grid; gap: 2px; min-width: 0; }
#inbox .pick-copy > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
#inbox .inbox-row.unread .pick-copy > span:first-child { font-weight: 600; }
.inbox-kind { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.inbox-kind.kind-reply { background: var(--accent); }
.inbox-kind.kind-ask { background: var(--warn); }
.inbox-kind.kind-error { background: var(--danger); }
.card.rows .setting .alert-controls { display: flex; align-items: center; gap: 12px; }
.card.rows .setting .alert-controls select { width: 8rem; }
.alert-controls .check-line { font-size: var(--text-sm); }
#alert-volume { width: min(12rem, 100%); accent-color: var(--accent); }

/* Password sign-in off: a passkey confirms guarded changes, so the inline password fields go. */
.no-password #shell label:has(> .confirm-password),
.no-password #shell :is(label[for="totp-password"], #totp-password, label[for="totp-off-password"], #totp-off-password, label[for="hook-password"], #hook-password) { display: none; }
.reauth-actions #reauth-passkey { margin-right: auto; }
#passkey-list:empty, #passkey-error:empty { display: none; }
.setup-folders summary { font-size: var(--text-sm); list-style: none; }
.setup-folders summary::-webkit-details-marker { display: none; }
.setup-folders summary::before { content: "\25B8"; margin-right: 6px; }
.setup-folders[open] summary::before { content: "\25BE"; }
.setup-folders .field + .field { margin-top: 12px; }
