/* Anton web. Dark-first operating surface: near-black planes, hairline borders,
   compact Inter, one indigo accent. Laid out like an IDE: explorer on the left,
   chat in the middle with a terminal under it, an inspector on the right and a
   status bar along the bottom. Light theme via [data-theme="light"] or the
   system preference. */
:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #08090a;
  --sidebar: #0b0c0d;
  --panel: #0f1011;
  --raised: #16171a;
  --hover: rgba(255, 255, 255, 0.045);
  --active: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #f2f3f5;
  --text-2: #b4bac4;
  --text-3: #8a8f98;
  --text-4: #62666d;

  --accent: #5e6ad2;
  --accent-hover: #6e7ade;
  --accent-soft: rgba(94, 106, 210, 0.16);
  --on-accent: #ffffff;

  --green: #4cb782;
  --yellow: #f2c94c;
  --orange: #e5884d;
  --red: #eb5757;
  --blue: #4ea7fc;
  --purple: #b392f0;
  /* Message content: inline code, code blocks, quotes. */
  --code-fg: #b9bffc;
  --code-bg: rgba(94, 106, 210, 0.15);
  --pre-bg: #0c0d0f;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 48px -8px rgba(0, 0, 0, 0.6), 0 4px 12px -2px rgba(0, 0, 0, 0.4);
  /* Motion: strong ease-out for things arriving, a drawer curve for panels,
     short durations; exits are faster than entrances. */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 160ms;
  --dur-enter: 220ms;
  --dur-exit: 140ms;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f7f7f8;
  --panel: #ffffff;
  --raised: #f4f4f5;
  --hover: rgba(0, 0, 0, 0.04);
  --active: rgba(0, 0, 0, 0.065);
  --line: #ebebed;
  --line-strong: #dedee1;
  --text: #17181b;
  --text-2: #3c3f46;
  --text-3: #6b6f76;
  --text-4: #8f939a;
  --accent: #5e6ad2;
  --accent-hover: #5260c9;
  --accent-soft: rgba(94, 106, 210, 0.1);
  --green: #2e9d67;
  --yellow: #b88a00;
  --orange: #d26b26;
  --red: #d64545;
  --blue: #2d7fd8;
  --purple: #7c4dcc;
  --code-fg: #4650b8;
  --code-bg: rgba(94, 106, 210, 0.09);
  --pre-bg: #f7f7f9;
  --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 40px -10px rgba(20, 20, 40, 0.18), 0 4px 10px -2px rgba(20, 20, 40, 0.08);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff; --sidebar: #f7f7f8; --panel: #ffffff; --raised: #f4f4f5;
    --hover: rgba(0, 0, 0, 0.04); --active: rgba(0, 0, 0, 0.065);
    --line: #ebebed; --line-strong: #dedee1;
    --text: #17181b; --text-2: #3c3f46; --text-3: #6b6f76; --text-4: #8f939a;
    --accent-hover: #5260c9; --accent-soft: rgba(94, 106, 210, 0.1);
    --green: #2e9d67; --yellow: #b88a00; --orange: #d26b26; --red: #d64545; --blue: #2d7fd8;
    --purple: #7c4dcc; --code-fg: #4650b8; --code-bg: rgba(94, 106, 210, 0.09); --pre-bg: #f7f7f9;
    --shadow-pop: 0 0 0 1px var(--line-strong), 0 16px 40px -10px rgba(20, 20, 40, 0.18), 0 4px 10px -2px rgba(20, 20, 40, 0.08);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* An app shell, not a document: the page itself never scrolls or rubber-bands;
   only the panes inside it scroll, and they stop at their edges. */
html, body { overflow: hidden; overscroll-behavior: none; }
.messages, .activity, .threads, .cmd-list, details.raw pre { overscroll-behavior: contain; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
kbd {
  font: 500 11px/1 var(--font);
  color: var(--text-3);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px 4px;
  min-width: 18px;
  text-align: center;
  display: inline-block;
}
.ic { width: 16px; height: 16px; flex: none; color: inherit; }
.muted { color: var(--text-3); }
.tiny { font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  font-weight: 500;
}
.btn:hover { background: var(--active); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-wide { width: 100%; height: 36px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn, .icon-btn, .send, .sb-new, .sb-search, .nav-item, .thread, .starter, .cmd-item {
  transition-property: background-color, color, border-color, transform, opacity, box-shadow;
  transition-duration: 120ms, 120ms, 120ms, var(--dur-press), 120ms, 120ms;
  transition-timing-function: var(--ease);
}
.btn:active, .icon-btn:active, .send:active:not(:disabled), .sb-new:active, .sb-search:active { transform: scale(0.97); }
.nav-item:active, .thread:active, .starter:active { transform: scale(0.985); }
@media (hover: none) {
  .btn:hover, .icon-btn:hover, .nav-item:hover, .thread:hover, .starter:hover, .row:hover { background: transparent; }
}
.icon-btn {
  width: 28px; height: 28px; display: inline-grid; place-items: center; flex: none;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-3);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.mark {
  width: 20px; height: 20px; border-radius: 5px; background: var(--accent); color: #fff;
  display: inline-grid; place-items: center; font-weight: 600; font-size: 12px; flex: none;
}
.mark-lg { width: 44px; height: 44px; border-radius: 11px; font-size: 22px; }
.avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 600; color: #fff; background: #8b5cf6;
}
.avatar.deborah { background: #e5884d; }
.avatar.john { background: #3b82f6; }
.avatar.anton { background: var(--accent); border-radius: 5px; }

/* Sign in */
.signin { height: 100%; overflow-y: auto; overscroll-behavior: none; display: grid; place-items: center; padding: 24px 16px; }
.signin-box { width: min(340px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.signin-box h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 16px 0 2px; }
.signin-box p { color: var(--text-3); margin: 0 0 18px; }
.signin-error { color: var(--red); min-height: 1.5em; margin: 10px 0 0 !important; }

/* Shell */
.app {
  display: grid; grid-template-columns: 256px minmax(0, 1fr) 324px; grid-template-rows: minmax(0, 1fr) 24px;
  height: 100vh; height: 100dvh;
}
.app.no-inspector { grid-template-columns: 256px minmax(0, 1fr); }
.app.no-inspector .inspector { display: none; }
.app > .sidebar { grid-column: 1; grid-row: 1; }
.app > .main { grid-column: 2; grid-row: 1; }
.app > .inspector { grid-column: 3; grid-row: 1; }
.app > .statusbar { grid-column: 1 / -1; grid-row: 2; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; padding: 10px 8px 8px; gap: 2px;
}
.sb-head { padding: 2px 6px 8px; }
.workspace { display: flex; align-items: center; gap: 8px; min-width: 0; }
.workspace-name { font-weight: 600; font-size: 13px; }
.presence { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.presence.on .presence-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(76, 183, 130, 0.15); }
.presence.off .presence-dot { background: var(--red); }

.sb-actions { display: flex; gap: 4px; padding: 0 0 8px; }
.sb-new, .sb-search {
  height: 30px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; padding: 0 8px;
}
.sb-new { flex: 1; min-width: 0; }
.sb-new span { flex: 1; text-align: left; font-weight: 500; }
.sb-new:hover, .sb-search:hover { background: var(--hover); color: var(--text); }
.sb-search { padding: 0 6px; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; padding-bottom: 10px; }
.nav-item, .thread {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2); text-align: left;
}
.nav-item:hover, .thread:hover { background: var(--hover); color: var(--text); }
.nav-item.active, .thread.active { background: var(--active); color: var(--text); }
.nav-item .ic { color: var(--text-3); }
.nav-item.active .ic { color: var(--text); }
.nav-count { margin-left: auto; font-size: 11px; color: var(--accent-hover); font-weight: 600; }

.sb-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sb-section-title { font-size: 11.5px; font-weight: 500; color: var(--text-4); padding: 4px 8px 4px; }
.threads { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; min-height: 0; padding-bottom: 6px; }
.thread { min-width: 0; }
.thread .t-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .t-time { color: var(--text-4); font-size: 11.5px; flex: none; }
.threads-empty { color: var(--text-4); padding: 4px 8px; font-size: 12.5px; }

.sb-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 6px 0; margin-top: 4px; }
.me-name { flex: 1; color: var(--text-2); font-weight: 500; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.topbar {
  height: 44px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line); min-width: 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-weight: 500; }
.crumb-sep { width: 12px; height: 12px; color: var(--text-4); }
.crumb-leaf { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.only-mobile { display: none; }
.scrim { display: none; }

.view { flex: 1; min-height: 0; }

/* Chat */
.chat { display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 24px 24px 12px; }
.thread-log { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg { display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 12px; }
.msg.enter { animation: msg-in var(--dur-enter) var(--ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
.msg-body .stream-in { animation: text-in 180ms var(--ease) both; }
@keyframes text-in { from { opacity: 0.35; } }
.msg-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg-name { font-weight: 600; color: var(--text); }
.msg-time { color: var(--text-4); font-size: 12px; }
.msg-tag { color: var(--text-3); font-size: 11.5px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; }
.msg-tag.model { color: var(--accent-hover); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
/* Both sides of the conversation read in the main text colour. */
.msg-body { grid-column: 2; color: var(--text); font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; margin-top: 2px; }
.msg-body > :first-child { margin-top: 0; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body p { margin: 0 0 10px; }
.msg-body h1, .msg-body h2, .msg-body h3, .msg-body h4, .msg-body h5, .msg-body h6 { color: var(--text); font-weight: 600; line-height: 1.35; margin: 18px 0 8px; }
.msg-body h1 { font-size: 18px; letter-spacing: -0.01em; }
.msg-body h2 { font-size: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.msg-body h3 { font-size: 14.5px; }
.msg-body h4, .msg-body h5, .msg-body h6 { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.msg-body strong { color: var(--text); font-weight: 600; }
.msg-body em { color: var(--text-2); }
.msg-body del { color: var(--text-4); }
.msg-body a { color: var(--accent-hover); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.msg-body a:hover { text-decoration-color: currentColor; }
.msg-body ul, .msg-body ol { margin: 4px 0 10px; padding-left: 22px; }
.msg-body li { margin: 3px 0; }
.msg-body li > ul, .msg-body li > ol { margin: 2px 0; }
.msg-body ul > li::marker { color: var(--accent); }
.msg-body ol > li::marker { color: var(--text-3); font-variant-numeric: tabular-nums; }
.msg-body li:has(> input[type="checkbox"]) { list-style: none; margin-left: -20px; }
.msg-body input[type="checkbox"] { accent-color: var(--accent); margin: 0 6px 0 0; vertical-align: -1px; }
.msg-body blockquote {
  margin: 8px 0 12px; padding: 4px 0 4px 12px; border-left: 2px solid var(--accent);
  color: var(--text-2); background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-radius: 0 4px 4px 0;
}
.msg-body blockquote p { margin: 4px 0; }
.msg-body hr { border: 0; border-top: 1px solid var(--line-strong); margin: 16px 0; }
.msg-body code { font: 12px var(--mono); background: var(--code-bg); border-radius: 4px; padding: 1.5px 5px; color: var(--code-fg); }
/* Code blocks: a slim header line for the language and the copy button, then the code. */
.msg-body pre {
  position: relative; margin: 8px 0 12px; background: var(--pre-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 14px 12px; overflow-x: auto; overscroll-behavior-x: contain; line-height: 1.55;
}
.msg-body pre::after { content: ""; position: absolute; left: 0; right: 0; top: 26px; border-top: 1px solid var(--line); }
.msg-body pre[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 7px; left: 14px; font: 10.5px var(--mono); color: var(--text-4); text-transform: lowercase;
}
.msg-body pre code { background: none; padding: 0; color: var(--text-2); font-size: 12px; }
.msg-body pre .copy {
  position: absolute; top: 3px; right: 4px; height: 20px; padding: 0 7px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text-3); font-size: 11px; cursor: pointer; opacity: 0; transition: opacity 120ms var(--ease), color 120ms var(--ease), background-color 120ms var(--ease);
}
.msg-body pre .copy:hover { background: var(--hover); }
.msg-body pre:hover .copy, .msg-body pre .copy:focus-visible { opacity: 1; }
@media (hover: none) { .msg-body pre .copy { opacity: 1; } }
.msg-body pre .copy:hover { color: var(--text); }
.table-wrap { margin: 8px 0 12px; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: var(--radius); }
/* Tables keep their natural width (scrolling sideways inside .table-wrap when wide)
   instead of squeezing headers into broken words; long cells still wrap. */
.msg-body table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12.5px; }
.msg-body td { max-width: 340px; }
.msg-body th { white-space: nowrap; text-align: left; font-weight: 600; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--raised); }
.msg-body th[align="right"] { text-align: right; }
.msg-body th[align="center"] { text-align: center; }
.msg-body th, .msg-body td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.msg-body tr:last-child td { border-bottom: 0; }
.msg-body tbody tr:hover td { background: var(--hover); }
.msg-body td code { white-space: nowrap; }
/* Code highlighting (highlight.js classes), from the page's own palette. */
.hljs-comment, .hljs-quote { color: var(--text-4); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-section { color: var(--purple); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-template-tag { color: var(--green); }
.hljs-number, .hljs-built_in, .hljs-type, .hljs-symbol, .hljs-bullet { color: var(--orange); }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title, .hljs-name { color: var(--blue); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property, .hljs-selector-class, .hljs-selector-id { color: var(--yellow); }
.hljs-meta, .hljs-params { color: var(--text-3); }
.hljs-deletion { color: var(--red); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }
.msg-error { color: var(--red); margin-top: 6px; font-size: 12.5px; }
.typing { color: var(--text-3); display: inline-flex; gap: 6px; align-items: center; }
.typing::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: breathe 1.4s var(--ease-in-out) infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }

.empty { max-width: 560px; margin: 10vh auto 0; padding: 0 8px; }
.empty h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 14px 0 6px; }
.empty p { color: var(--text-3); margin: 0 0 18px; }
.starters { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.starter {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-top: 1px solid var(--line);
  background: transparent; padding: 10px 12px; color: var(--text-2);
}
.starter:first-child { border-top: 0; }
.starter:hover { background: var(--hover); color: var(--text); }
.starter .ic { color: var(--text-4); }
.starter span { flex: 1; }

.composer-wrap { padding: 8px 24px 20px; }
.composer {
  max-width: 760px; margin: 0 auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--raised); transition: border-color 160ms var(--ease), box-shadow 200ms var(--ease);
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-strong)); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea {
  display: block; width: 100%; resize: none; border: 0; background: transparent; color: var(--text);
  padding: 12px 14px 4px; min-height: 44px; max-height: 240px; font-size: 13.5px; line-height: 1.55; outline: none;
}
.composer textarea::placeholder { color: var(--text-4); }
.composer-bar { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px 7px; }
.hint { flex: 1; color: var(--text-4); font-size: 12px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
/* Model and thinking pickers: a native <select> (keyboard and phone friendly) laid
   invisibly over a Linear-style pill. */
.pick {
  position: relative; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; border-radius: var(--radius);
  color: var(--text-3); font-size: 12px; white-space: nowrap; flex: none; cursor: pointer;
  transition: color 120ms var(--ease), background-color 120ms var(--ease), transform var(--dur-press) var(--ease);
}
.pick:hover, .pick:focus-within { color: var(--text); background: var(--hover); }
.pick:active { transform: scale(0.97); }
.pick .ic { width: 13px; height: 13px; flex: none; }
.pick .pick-chev { width: 10px; height: 10px; transform: rotate(90deg); opacity: 0.7; }
.pick select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.pick:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.send {
  width: 28px; height: 28px; border-radius: var(--radius); border: 0; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
}
.send:hover { background: var(--accent-hover); }
.send:disabled { opacity: 0.4; cursor: default; }
.send.idle { opacity: 0.35; transform: scale(0.92); }
.mic { position: relative; }
.mic.recording { color: var(--red); background: rgba(235, 87, 87, 0.12); }
.mic.recording::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(235, 87, 87, 0.45);
  animation: ring 1.6s var(--ease) infinite;
}
@keyframes ring { to { box-shadow: 0 0 0 8px rgba(235, 87, 87, 0); } }
.mic.busy { opacity: 0.5; }

/* Activity: grouped list rows */
.activity { overflow-y: auto; }
.activity-body { padding: 0 0 40px; }
.group { border-bottom: 1px solid var(--line); }
.group-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 24px; background: var(--raised); border-bottom: 1px solid var(--line); font-weight: 500;
}
.group-head .count { color: var(--text-4); font-weight: 400; }
.group-note { margin-left: auto; color: var(--text-4); font-size: 12px; font-weight: 400; }
.row {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 40px; padding: 6px 24px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.row-title { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-sub { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 12.5px; }
.row-meta { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--text-2); font-size: 11.5px; font-weight: 500;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.urgent { color: var(--red); } .chip.high { color: var(--orange); } .chip.normal { color: var(--text-3); } .chip.low { color: var(--text-4); }
.group-empty { padding: 12px 24px 14px; color: var(--text-4); }
.group-error { padding: 12px 24px 14px; color: var(--red); }

/* Status icons (drawn) */
.st { width: 14px; height: 14px; }
.st-backlog { color: var(--text-4); }
.st-todo { color: var(--text-3); }
.st-running { color: var(--yellow); }
.st-review { color: var(--green); }
.st-done { color: var(--accent); }
.st-blocked, .st-failed { color: var(--red); }
.st-scheduled { color: var(--blue); }

.props { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 0; padding: 4px 0; }
.props dt { color: var(--text-3); padding: 7px 24px; }
.props dd { margin: 0; padding: 7px 24px 7px 0; color: var(--text); overflow-wrap: anywhere; }
details.raw { padding: 4px 24px 16px; }
details.raw summary { color: var(--text-3); cursor: pointer; width: fit-content; }
details.raw summary:hover { color: var(--text); }
details.raw pre { font: 11.5px/1.5 var(--mono); color: var(--text-2); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; overflow: auto; max-height: 320px; }

/* Command menu */
.cmd { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px; background: rgba(0, 0, 0, 0.35); }
.cmd.animate { animation: fade var(--dur-enter) var(--ease) both; }
.cmd.animate .cmd-panel { animation: pop var(--dur-enter) var(--ease) both; }
.cmd.leaving { animation: fade-out var(--dur-exit) var(--ease) both; }
.cmd.leaving .cmd-panel { animation: pop-out var(--dur-exit) var(--ease) both; }
:root[data-theme="light"] .cmd { background: rgba(20, 20, 40, 0.12); }
.cmd-panel {
  width: min(620px, 100%); background: var(--raised); border-radius: 12px; box-shadow: var(--shadow-pop);
  overflow: hidden; transform-origin: 50% 0;
}
.cmd-input-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.cmd-input-row input { flex: 1; border: 0; outline: none; background: transparent; height: 52px; font-size: 15px; color: var(--text); }
.cmd-input-row input::placeholder { color: var(--text-4); }
.cmd-list { max-height: min(360px, 50vh); overflow-y: auto; padding: 6px; }
.cmd-group { color: var(--text-4); font-size: 11.5px; font-weight: 500; padding: 8px 10px 4px; }
.cmd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-2); text-align: left;
}
.cmd-item[aria-selected="true"] { background: var(--active); color: var(--text); }
.cmd-item .ic { color: var(--text-3); }
.cmd-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-empty { padding: 18px 10px; color: var(--text-4); }
.cmd-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--text-4); font-size: 12px; }
.cmd-foot kbd { margin-right: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
@keyframes sink { to { opacity: 0; transform: translateY(4px) scale(0.98); } }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  background: var(--raised); color: var(--text); box-shadow: var(--shadow-pop); border-radius: 8px; padding: 8px 14px;
  animation: rise var(--dur-enter) var(--ease) both;
}
.toast.leaving { animation: sink var(--dur-exit) var(--ease) both; }

/* Activity: rows settle in once, on first load only */
.activity-body.first .group { animation: msg-in var(--dur-enter) var(--ease) both; }
.activity-body.first .group:nth-child(2) { animation-delay: 30ms; }
.activity-body.first .group:nth-child(3) { animation-delay: 60ms; }
.activity-body.first .group:nth-child(4) { animation-delay: 90ms; }
.activity-body.first .group:nth-child(n+5) { animation-delay: 120ms; }
.row.fresh { animation: row-in 600ms var(--ease) both; }
@keyframes row-in { from { background: var(--accent-soft); } }

/* Theme switch crossfade (View Transitions where supported) */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 200ms; animation-timing-function: var(--ease); }

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30;
    transform: translateX(-102%); transition: transform 300ms var(--ease-drawer); box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); animation: fade 240ms var(--ease) both; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 0 8px; }
  .messages { padding: 18px 14px 8px; }
  .composer-wrap { padding: 6px 10px 12px; }
  .hint { visibility: hidden; }
  .composer-wrap { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .group-head, .row, .group-empty, .group-error { padding-left: 14px; padding-right: 14px; }
  .row { grid-template-columns: 16px minmax(0, 1fr); }
  .row-meta { grid-column: 2; }
  .row-main { flex-direction: column; gap: 0; }
  .props { grid-template-columns: 110px minmax(0, 1fr); }
  .props dt { padding-left: 14px; }
  .props dd { padding-right: 14px; }
  .cmd { padding-top: 8vh; }
}
/* Anton's work: thinking and tool steps above an answer. Collapses with a grid-row
   transition so the height animates without measuring. */
.trace { grid-column: 2; margin: 2px 0 6px; min-width: 0; }
.trace.tr-enter { animation: text-in 180ms var(--ease) both; }
.trace-head {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; max-width: 100%; padding: 0 8px 0 4px; margin-left: -4px;
  border: 0; border-radius: 5px; background: none; color: var(--text-3); font: inherit; font-size: 12.5px; cursor: pointer;
  transition: color 120ms var(--ease), background-color 120ms var(--ease), transform var(--dur-press) var(--ease);
}
.trace-head:hover { color: var(--text-2); background: var(--hover); }
.trace-head:active { transform: scale(0.97); }
.trace-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace.live .trace-label { color: var(--text-2); }
.trace-time { color: var(--text-4); font-variant-numeric: tabular-nums; }
.trace-chev { width: 12px; height: 12px; flex: none; transition: transform 200ms var(--ease); }
.trace.open .trace-chev { transform: rotate(90deg); }
.trace-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 240ms var(--ease-drawer); }
.trace.open .trace-body { grid-template-rows: 1fr; }
.trace-inner { overflow: hidden; min-height: 0; }
.trace-list {
  list-style: none; margin: 4px 0 2px 5px; padding: 2px 0 2px 13px; border-left: 1px solid var(--line-strong);
  display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity 160ms var(--ease);
}
.trace.open .trace-list { opacity: 1; }
.tr.tr-enter { animation: tr-in 200ms var(--ease) both; }
@keyframes tr-in { from { opacity: 0; transform: translateY(3px); } }
.tr-think { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; padding: 3px 0; }
.tr-icon .ic { width: 14px; height: 14px; color: var(--text-4); margin-top: 2px; }
.tr-text { color: var(--text-3); font-size: 12.5px; line-height: 1.55; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.tr-text p { margin: 0 0 6px; }
.tr-text p:last-child { margin: 0; }
.tr-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 26px; padding: 2px 6px; margin-left: -6px;
  border: 0; border-radius: 5px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.tr-row:hover:not(:disabled) { background: var(--hover); }
.tr-row:disabled { cursor: default; color: var(--text-2); }
.tr-row .st { flex: none; }
.tr-step[data-status="running"] .st-running { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tr-step[data-status="done"] .st-done { color: var(--text-4); }
.tr-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-dur { color: var(--text-4); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tr-chev { width: 11px; height: 11px; color: var(--text-4); flex: none; transition: transform 200ms var(--ease); }
.tr-step.open .tr-chev { transform: rotate(90deg); }
.tr-step.nested { margin-left: 22px; }
.tr-detail { display: none; padding: 2px 0 6px 22px; }
.tr-step.open .tr-detail { display: grid; gap: 4px; animation: tr-in 160ms var(--ease) both; }
.tr-detail pre {
  margin: 0; max-height: 200px; overflow: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 11.5px/1.5 var(--mono); color: var(--text-2); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px;
}
.tr-detail .tr-in { color: var(--text); }
.tr-detail .tr-out { color: var(--text-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .btn:active, .icon-btn:active, .send:active, .sb-new:active, .sb-search:active, .nav-item:active, .thread:active, .starter:active, .trace-head:active { transform: none; }
}


/* Explorer: collapsible lists of chats, ideas, tickets and sessions. */
.sb-explorer { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.sb-group > summary { list-style: none; display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; border-radius: var(--radius); }
.sb-group > summary::-webkit-details-marker { display: none; }
.sb-group > summary:hover { color: var(--text-2); }
.sb-chev { width: 11px; height: 11px; transition: transform 160ms var(--ease); }
.sb-group[open] > summary .sb-chev { transform: rotate(90deg); }
.sb-count { margin-left: auto; color: var(--text-4); font-weight: 400; font-variant-numeric: tabular-nums; }
.sb-group .threads { overflow: visible; }
.sb-list { display: flex; flex-direction: column; gap: 1px; }
.sb-row {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 26px; padding: 2px 8px;
  border-radius: var(--radius); color: var(--text-2); font-size: 12.5px;
}
.sb-row:hover { background: var(--hover); color: var(--text); }
.sb-row .st { width: 12px; height: 12px; }
.sb-row-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-row-meta { color: var(--text-4); font-size: 11px; font-family: var(--mono); white-space: nowrap; }
a.sb-row { text-decoration: none; }
.sb-empty { color: var(--text-4); padding: 2px 8px 4px 23px; font-size: 12px; }

/* Run toggle in the top bar. */
.run-toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 13px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background-color 120ms var(--ease), transform var(--dur-press) var(--ease);
}
.run-toggle:hover { background: var(--hover); color: var(--text); }
.run-toggle:active { transform: scale(0.97); }
.run-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.run-toggle.running .run-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(76, 183, 130, 0.15); animation: pulse 2.4s var(--ease) infinite; }
.run-toggle.paused .run-dot { background: var(--yellow); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(76, 183, 130, 0.05); } }

/* Terminal under the chat: the event log, HPI job output, slot status. */
.terminal {
  flex: none; height: var(--term-h, 220px); display: flex; flex-direction: column; min-height: 0;
  border-top: 1px solid var(--line); background: var(--pre-bg);
}
.main.term-hidden .terminal { display: none; }
.term-tabs { display: flex; align-items: center; gap: 2px; height: 30px; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.term-tab, .insp-tab {
  height: 22px; padding: 0 9px; border: 0; border-radius: 4px; background: transparent; color: var(--text-3);
  font: inherit; font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; cursor: pointer;
}
.term-tab:hover, .insp-tab:hover { color: var(--text); background: var(--hover); }
.term-tab.active, .insp-tab.active { color: var(--text); background: var(--active); }
.term-note { margin-left: auto; color: var(--text-4); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-body {
  flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 6px 12px 10px;
  font: 12px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.term-line { display: grid; grid-template-columns: 98px 84px minmax(0, 1fr); gap: 10px; }
.term-line .t-at { color: var(--text-4); font-variant-numeric: tabular-nums; }
.term-line .t-src { color: var(--blue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-line.k-control .t-src, .term-line.k-control .t-text { color: var(--yellow); }
.term-line.k-finding .t-src { color: var(--green); }
.term-line.k-error .t-text { color: var(--red); }
.term-line.fresh { animation: text-in 300ms var(--ease) both; }
.term-block { margin: 0 0 10px; }
.term-block-head { color: var(--text); }
.term-block-head .st { vertical-align: -2px; margin-right: 6px; }
.term-dim { color: var(--text-4); }

/* Inspector: control (objectives, constraints) and HPI. */
.inspector { background: var(--sidebar); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.insp-tabs { display: flex; gap: 2px; height: 44px; align-items: center; padding: 0 10px; border-bottom: 1px solid var(--line); flex: none; }
.insp-close { margin-left: auto; }
.insp-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 16px; }
.insp-section { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.insp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 12.5px; }
.insp-actions { display: flex; justify-content: flex-end; }
.insp-actions .btn { height: 28px; }
.inspector textarea, .inspector input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--text);
  font: inherit; font-size: 12.5px; padding: 6px 8px; resize: vertical;
}
.inspector textarea { line-height: 1.5; }
.inspector input:focus, .inspector textarea:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line-strong)); box-shadow: 0 0 0 3px var(--accent-soft); }
.inspector label { display: flex; flex-direction: column; gap: 4px; color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.field-pair { display: flex; align-items: center; gap: 6px; color: var(--text-4); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day {
  height: 24px; min-width: 34px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--text-3); font: inherit; font-size: 11.5px; cursor: pointer;
}
.day[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong)); color: var(--text); }
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 6px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--active); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.over > span { background: var(--orange); }
.jobs { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.jobs td, .jobs th { overflow: hidden; text-overflow: ellipsis; }
.jobs th { text-align: left; color: var(--text-4); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.jobs td { padding: 5px 6px; border-bottom: 1px solid var(--line); color: var(--text-2); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.jobs td.name { font-family: var(--font); color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.state-R, .state-RUNNING { color: var(--green); } .state-PD, .state-PENDING { color: var(--yellow); } .state-F, .state-FAILED, .state-CANCELLED, .state-TIMEOUT { color: var(--red); }
.notice { margin: 12px 14px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--panel); color: var(--text-2); font-size: 12.5px; }
.notice.warn { border-color: color-mix(in srgb, var(--yellow) 45%, var(--line-strong)); }

/* Status bar along the bottom. */
.statusbar {
  display: flex; align-items: center; gap: 0; height: 24px; padding: 0 6px; border-top: 1px solid var(--line);
  background: var(--sidebar); color: var(--text-3); font-size: 11.5px; overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.statusbar::-webkit-scrollbar { display: none; }
.sb-item { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 100%; }
.sb-item + .sb-item { border-left: 1px solid var(--line); }
.sb-item.sb-right { margin-left: auto; }
.sb-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); }
.sb-item.ok .dot { background: var(--green); } .sb-item.warn .dot { background: var(--yellow); } .sb-item.bad .dot { background: var(--red); }

@media (max-width: 1180px) {
  .app { grid-template-columns: 236px minmax(0, 1fr) 292px; }
  .app.no-inspector { grid-template-columns: 236px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app, .app.no-inspector { grid-template-columns: minmax(0, 1fr); }
  .app > .main { grid-column: 1; }
  .inspector {
    position: fixed; inset: 0 0 24px auto; width: min(340px, 90vw); z-index: 30; box-shadow: var(--shadow-pop);
    transform: translateX(102%); transition: transform 300ms var(--ease-drawer);
  }
  .app:not(.no-inspector) .inspector.open { transform: none; }
  .app.no-inspector .inspector { display: flex; }
  .terminal { --term-h: 170px; }
  .term-line { grid-template-columns: 92px minmax(0, 1fr); }
  .term-line .t-src { display: none; }
}

/* iPhone Safari zooms into any text field under 16px when it is focused; on touch
   screens the fields are 16px (last in this file so it wins over the composer's own size), so tapping the message box no longer zooms the page. */
@media (hover: none) and (pointer: coarse), (max-width: 820px) {
  input, textarea, select, .composer textarea, .cmd-input-row input { font-size: 16px; }
}
