:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f1ee;
  --surface-3: #e9e8e4;
  --border: #e2e0da;
  --border-strong: #cfccc4;
  --text: #1f1e1c;
  --text-2: #55524c;
  --text-3: #8a867e;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --good: #157f52;
  --good-soft: #e3f4ec;
  --bad: #c0392b;
  --bad-soft: #fbeae7;
  --warn: #a86a12;
  --s1: #1f6feb; --s2: #e07b39; --s3: #2f9e6f; --s4: #8b5cf6;
  --s5: #d94f70; --s6: #0d9aa8; --s7: #9a7b26; --s8: #6b7280;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151a;
    --surface: #1e1d23;
    --surface-2: #26252c;
    --surface-3: #2f2e36;
    --border: #33323a;
    --border-strong: #454350;
    --text: #ecebe8;
    --text-2: #b3b0aa;
    --text-3: #807d78;
    --accent: #6ea8fe;
    --accent-soft: #1c2b45;
    --good: #4ade80;
    --good-soft: #16301f;
    --bad: #f87171;
    --bad-soft: #3a1e1e;
    --warn: #fbbf24;
    --s1: #6ea8fe; --s2: #f0a868; --s3: #5fd6a0; --s4: #b39bf5;
    --s5: #f2839c; --s6: #4fc7d4; --s7: #d4b45c; --s8: #9ca3af;
  }
}

* { box-sizing: border-box; }

/* Author display rules below would otherwise beat the UA hidden rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.error { color: var(--bad); font-size: .88rem; }

/* ───────────────────────────── overlays ───────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--bg);
  padding: 24px; overflow: auto;
}
.card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  display: flex; flex-direction: column; gap: 6px;
}
.card.narrow { width: min(380px, 100%); }
.card h1 { margin: 0 0 4px; font-size: 1.4rem; letter-spacing: -.01em; }
.card > p.muted { margin: 0 0 18px; }
.card label { font-weight: 600; font-size: .85rem; margin-top: 14px; }
.card input, .card textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  resize: vertical;
}
.card input:focus, .card textarea:focus { border-color: var(--accent); }
.hint { margin: 6px 0 0; font-size: .8rem; color: var(--text-3); line-height: 1.5; }
.advanced { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.advanced summary { cursor: pointer; font-size: .85rem; color: var(--text-2); }
.primary {
  margin-top: 22px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  padding: 11px 16px; font-weight: 600;
}
.primary:disabled { opacity: .55; cursor: progress; }
.progress { list-style: none; margin: 14px 0 0; padding: 0; font-size: .82rem; color: var(--text-2); }
.progress li { padding: 2px 0; }
.progress li::before { content: "› "; color: var(--text-3); }

/* ───────────────────────────── layout ───────────────────────────── */
#app { display: grid; grid-template-columns: 280px 1fr; height: 100%; }

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  min-height: 0; padding: 16px 12px;
}
.brand { display: flex; gap: 10px; align-items: flex-start; padding: 4px 8px 16px; }
.brand strong { display: block; font-size: .92rem; }
.brand small { display: block; color: var(--text-3); font-size: .74rem; line-height: 1.4; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-top: 6px; flex: none; }
.dot.stale { background: var(--warn); }

.new-chat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; text-align: left;
  color: var(--text); font-size: .88rem; font-weight: 500;
}
.new-chat:hover { background: var(--surface-3); }

/* Both lists compete for the same column. Without a floor the conversation
   list collapses to nothing on a short screen once an account has many assets. */
.conversations {
  margin-top: 14px; overflow-y: auto; overflow-x: hidden;
  flex: 1 1 auto; min-height: 84px;
}
.conversations button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-2);
  padding: 7px 10px; border-radius: 7px; font-size: .84rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conversations button:hover { background: var(--surface-2); color: var(--text); }
.conv-row {
  display: flex; align-items: center; border-radius: 7px;
}
.conv-row:hover { background: var(--surface-2); }
.conv-row.active { background: var(--accent-soft); }
.conv-row.active > button:first-child { color: var(--text); }
.conv-row > button:first-child { flex: 1 1 auto; min-width: 0; width: auto; }
/* Specificity matters here: the generic `.conversations button` rule is (0,1,1)
   and sets width:100%. A bare `.conv-del` (0,1,0) loses to it, leaving the
   delete button the full width of the row and the title crushed to one letter. */
.conv-row > .conv-del {
  flex: 0 0 auto; width: auto; display: block; opacity: 0;
  padding: 6px 9px; font-size: .72rem; line-height: 1;
  background: none; border: none; color: var(--text-3); border-radius: 6px;
}
.conv-row:hover > .conv-del, .conv-row > .conv-del:focus-visible { opacity: 1; }
.conv-row > .conv-del:hover { color: var(--bad); background: var(--bad-soft); }

.context-note {
  max-width: 820px; margin: 0 auto 20px; padding: 10px 14px;
  border: 1px dashed var(--border-strong); border-radius: 9px;
  font-size: .8rem; color: var(--text-3);
}

.account-panel {
  border-top: 1px solid var(--border); padding: 12px 8px 4px; font-size: .78rem;
  flex: 0 1 auto; max-height: 42%; overflow-y: auto; overflow-x: hidden;
}
.account-panel .row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; color: var(--text-2); }
.account-panel .row span:last-child { color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel h4 { margin: 8px 0 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.pill { font-size: .68rem; padding: 1px 6px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.ghost {
  background: none; border: none; color: var(--text-2);
  text-align: left; padding: 5px 8px; border-radius: 6px; font-size: .8rem;
}
.ghost:hover { background: var(--surface-2); color: var(--text); }
.sidebar-footer small { padding: 4px 8px; font-size: .7rem; }

/* ───────────────────────────── chat ───────────────────────────── */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread { flex: 1; overflow-y: auto; padding: 32px 24px 12px; scroll-behavior: smooth; }
.thread > * { max-width: 820px; margin-inline: auto; }

.welcome { padding-top: 8vh; }
.welcome h1 { font-size: 1.9rem; letter-spacing: -.02em; margin: 0 0 6px; }
.welcome > p { margin: 0 0 26px; }
.suggestions { display: grid; gap: 8px; }
.suggestions button {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; color: var(--text); font-size: .9rem;
}
.suggestions button:hover { border-color: var(--accent); background: var(--accent-soft); }

.msg { margin-bottom: 26px; }
.msg.user .bubble {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; font-weight: 500;
}
.msg.assistant .bubble { padding: 2px 0; }

/* ─────────────────────── rendered markdown ─────────────────────── */
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  letter-spacing: -.01em; line-height: 1.3; margin: 24px 0 8px;
}
.prose h1, .prose h2 { font-size: 1.22rem; }
.prose h3 { font-size: 1.04rem; }
.prose h4, .prose h5, .prose h6 {
  font-size: .76rem; color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; margin-top: 22px;
}
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose strong { font-weight: 650; }
.prose a { color: var(--accent); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.prose blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border-strong); color: var(--text-2);
}
.prose code { font-family: var(--mono); font-size: .87em; background: var(--surface-2); padding: .12em .35em; border-radius: 4px; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }

/* ─────────────────────────── KPI row ─────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 4px 0 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 15px;
}
.kpi .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.kpi .value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta {
  font-size: .78rem; font-weight: 600;
  display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap;
}
.kpi .delta small { flex-basis: 100%; }   /* a long comparison label gets its own line */
.kpi .delta.good { color: var(--good); }
.kpi .delta.bad { color: var(--bad); }
.kpi .delta.neutral { color: var(--text-3); }
.kpi .delta small { font-weight: 400; color: var(--text-3); }
.kpi .hint { margin: 5px 0 0; font-size: .72rem; color: var(--text-3); }

/* ─────────────────────────── charts ─────────────────────────── */
.viz {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px 12px; margin: 4px 0 20px;
}
.viz-head { margin-bottom: 10px; }
.viz-title { font-weight: 600; font-size: .95rem; }
.viz-sub { font-size: .78rem; color: var(--text-3); }
.viz-note { font-size: .76rem; color: var(--text-3); margin: 8px 0 0; }
.viz-scroll { overflow-x: auto; }
.viz-scroll:has(> svg[width]:not([width="100%"])) { display: flex; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 2px 0 8px; font-size: .76rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
svg .grid { stroke: var(--border); stroke-width: 1; }
svg .axis { stroke: var(--border-strong); stroke-width: 1; }
svg .tick { fill: var(--text-3); font-size: 10px; font-family: var(--sans); }
svg .axis-label { fill: var(--text-3); font-size: 10px; }
svg .pt { transition: r .1s; }
.tooltip {
  position: fixed; pointer-events: none; z-index: 60;
  background: var(--text); color: var(--bg);
  padding: 6px 9px; border-radius: 6px; font-size: .76rem;
  white-space: pre; opacity: 0; transition: opacity .1s;
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────── tables ─────────────────────────── */
.viz table, .prose table { border-collapse: collapse; width: 100%; font-size: .84rem; }
.viz th, .prose th {
  text-align: left; font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
  border-bottom: 1px solid var(--border-strong); padding: 7px 10px; white-space: nowrap;
}
.viz td, .prose td { padding: 7px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.viz tr:last-child td, .prose tr:last-child td { border-bottom: none; }
.viz td.r, .viz th.r, .prose td.r, .prose th.r { text-align: right; }
.prose table { margin: 4px 0 20px; }

/* ─────────────────────────── composer ─────────────────────────── */
.composer {
  max-width: 820px; width: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; gap: 8px; align-items: flex-end;
}
.composer textarea {
  flex: 1; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 12px 14px; resize: none; outline: none;
  max-height: 220px; line-height: 1.5;
}
.composer textarea:focus { border-color: var(--accent); }
.send, .stop {
  width: 40px; height: 40px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none;
}
.send:disabled { opacity: .4; cursor: default; }
.stop { background: var(--surface-3); color: var(--text); }
.composer-hint {
  max-width: 820px; margin: 6px auto 14px; padding: 0 24px;
  font-size: .72rem; color: var(--text-3); text-align: center; width: 100%;
}

@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .thread { padding: 20px 14px 8px; }
  .composer, .composer-hint { padding: 0 14px; }
}

/* ───────────────────── setup / settings panels ───────────────────── */
.card.wide { width: min(680px, 100%); position: relative; }
.card .close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-3); font-size: 1rem; padding: 4px 8px;
  border-radius: 6px;
}
.card .close:hover { background: var(--surface-2); color: var(--text); }
.section-heading {
  margin: 26px 0 10px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3); font-weight: 600;
}

.panel { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.panel.connected { border-color: var(--border-strong); }
.panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; cursor: pointer; background: var(--surface-2);
}
.panel > header:hover { background: var(--surface-3); }
.panel > header strong { display: block; font-size: .9rem; }
.panel > header small { display: block; color: var(--text-3); font-size: .76rem; margin-top: 2px; }
.panel-body { padding: 4px 15px 16px; display: none; }
.panel.open .panel-body, #anthropic-panel .panel-body { display: block; }
.panel-body label { display: block; font-weight: 600; font-size: .8rem; margin-top: 12px; }
.panel-body input { margin-top: 4px; }
.panel-body .where { margin-top: 12px; font-style: italic; }
.panel-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.primary.small, .ghost.small {
  margin-top: 0; padding: 7px 13px; font-size: .82rem; border-radius: 7px;
}
.ghost.small { border: 1px solid var(--border); }

.unavailable {
  margin-top: 6px; padding: 12px 14px; border-radius: 9px;
  background: var(--surface-2); font-size: .78rem; color: var(--text-3); line-height: 1.5;
}
.unavailable p { margin: 0 0 6px; }
.unavailable p:last-child { margin-bottom: 0; }
.unavailable strong { color: var(--text-2); }

.bad-text { color: var(--bad); }

/* ───────────────────── answer actions ───────────────────── */
.msg-actions {
  display: flex; gap: 6px; margin-top: 10px;
  opacity: 0; transition: opacity .12s;
}
.msg.assistant:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg-actions button {
  background: none; border: 1px solid var(--border); color: var(--text-3);
  border-radius: 6px; padding: 3px 9px; font-size: .74rem;
}
.msg-actions button:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.msg-actions .done { color: var(--good); border-color: var(--good); }

.usage {
  font-size: .7rem; color: var(--text-3); margin-top: 8px;
  font-variant-numeric: tabular-nums;
}


/* ───────────────────── print / save as PDF ───────────────────── */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #f4f4f2;
    --border: #d8d6d0; --border-strong: #b8b5ae;
    --text: #111; --text-2: #444; --text-3: #666;
  }
  html, body { height: auto; background: #fff; }
  .sidebar, .composer, .composer-hint, .steps, .inspector, .msg-actions, .overlay, .usage { display: none !important; }
  #app { display: block !important; }
  .chat, .thread { display: block; overflow: visible; height: auto; padding: 0; }
  .thread > * { max-width: none; }
  .msg { break-inside: avoid; margin-bottom: 18px; }
  .msg.user .bubble { background: #f4f4f2; border-color: #ddd; }
  .viz, .kpi { break-inside: avoid; border-color: #ddd; box-shadow: none; }
  .kpi-row { break-inside: avoid; }
  a { color: inherit; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .7em; color: #666; }
}


/* ─────────────────── work-trace badges (under each answer) ─────────────────── */
.steps {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin: 0 0 14px;
}
.step-summary {
  background: none; border: none; padding: 3px 2px 3px 0;
  color: var(--text-3); font-size: .76rem; font-weight: 500;
}
.step-summary:hover { color: var(--text); text-decoration: underline; }
.step-summary.busy::after {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 7px;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px;
}

/* The model's live reasoning: two-line peek, click to expand, fades when done. */
.thought {
  flex: 1 0 100%; order: 99; min-width: 0;
  margin-top: 4px; padding: 6px 10px 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  font-size: .78rem; line-height: 1.45; color: var(--text-2);
  transition: opacity .3s ease, transform .3s ease;
}
.thought[hidden] { display: none; }
.thought.leaving { opacity: 0; transform: translateY(-3px); }
.thought-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; padding: 0 0 2px; cursor: pointer;
  color: var(--text-3); font-size: .7rem; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase;
}
.thought-toggle::after {
  content: ""; width: 5px; height: 5px; margin-top: -2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease;
}
.thought.open .thought-toggle::after { transform: rotate(-135deg); margin-top: 3px; }
.thought-toggle:hover { color: var(--text); }
.thought-peek {
  /* Bottom-aligned inside a two-line window: the newest words stay visible. */
  display: flex; flex-direction: column; justify-content: flex-end;
  max-height: calc(1.45em * 2); overflow: hidden; cursor: pointer;
  overflow-wrap: anywhere;
}
.thought-peek:hover { color: var(--text); }
.thought-full {
  max-height: 40vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  padding-right: 4px; color: var(--text-2);
}
@media (prefers-reduced-motion: reduce) {
  .thought, .thought-toggle::after { transition: none; }
}

.step-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px 3px 7px;
  color: var(--text-2); font-size: .73rem; line-height: 1.5;
  max-width: 230px; white-space: nowrap;
}
.step-chip > span { overflow: hidden; text-overflow: ellipsis; }
.step-chip:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.step-chip svg { flex: none; opacity: .75; }
.step-chip em {
  font-style: normal; font-variant-numeric: tabular-nums;
  color: var(--text-3); font-size: .68rem;
  background: var(--surface-2); border-radius: 999px; padding: 0 5px;
}
.step-chip.running { opacity: .6; }
.step-chip.running svg { animation: spin 1.1s linear infinite; }
.step-chip.failed { border-color: var(--bad); color: var(--bad); }
.step-chip.failed em { color: var(--bad); background: var(--bad-soft); }
.step-chip.p-meta svg { color: var(--s1); }
.step-chip.p-google svg { color: var(--s3); }
.step-chip.p-tiktok svg { color: var(--s5); }
.step-chip.p-demo svg { color: var(--s7); }

/* ─────────────────────────── inspector drawer ─────────────────────────── */
#app.inspecting { grid-template-columns: 280px minmax(0, 1fr) 400px; }
.inspector {
  border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
}
.inspector > header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
}
.inspector > header strong { display: block; font-size: .9rem; }
.inspector > header small { display: block; color: var(--text-3); font-size: .74rem; margin-top: 2px; }
.inspector > header button {
  background: none; border: none; color: var(--text-3);
  padding: 2px 7px; border-radius: 6px; font-size: .85rem;
}
.inspector > header button:hover { background: var(--surface-2); color: var(--text); }
#inspector-body { overflow-y: auto; padding: 10px 12px 24px; flex: 1; min-height: 0; }

.insp-step { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 7px; overflow: hidden; }
.insp-step.open { border-color: var(--border-strong); }
.insp-step.failed { border-color: var(--bad); }
.insp-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; padding: 9px 11px; text-align: left;
  color: var(--text-2); font-size: .8rem;
}
.insp-head:hover { background: var(--surface-2); }
.insp-step.open .insp-head { background: var(--surface-2); color: var(--text); }
.insp-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-meta { flex: none; color: var(--text-3); font-size: .72rem; font-variant-numeric: tabular-nums; }
.insp-step.failed .insp-meta { color: var(--bad); }
.insp-detail { padding: 4px 11px 12px; border-top: 1px solid var(--border); }
.insp-row { margin-top: 9px; }
.insp-label {
  display: block; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3); margin-bottom: 3px;
}
.insp-value { font-size: .78rem; }
.insp-pre {
  margin: 0; font-family: var(--mono); font-size: .7rem; line-height: 1.5;
  color: var(--text-2); background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 9px; max-height: 260px;
  overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.insp-thinking { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.insp-thinking summary { cursor: pointer; font-size: .76rem; color: var(--text-3); }
.insp-thinking pre {
  margin: 8px 0 0; font-size: .72rem; color: var(--text-3);
  white-space: pre-wrap; line-height: 1.5;
}

@media (max-width: 1200px) {
  #app.inspecting { grid-template-columns: 280px minmax(0, 1fr); }
  #app.inspecting .inspector {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
    z-index: 40; box-shadow: -12px 0 32px rgba(0,0,0,.16);
  }
}

/* placeholder lines while the answer is still being worked out */
.skeleton { display: flex; flex-direction: column; gap: 9px; padding: 4px 0 2px; }
.skeleton span {
  height: 11px; border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 220% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton span { animation: none; }
  .step-summary.busy::after { animation: none; }
}

/* ─────────────────── accounts dropdown (sidebar) ─────────────────── */
.accounts { margin-top: 12px; border: 1px solid var(--border); border-radius: 9px; }
.accounts > summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 11px; cursor: pointer; font-size: .82rem; color: var(--text-2);
  list-style: none;
}
.accounts > summary::-webkit-details-marker { display: none; }
.accounts > summary:hover { color: var(--text); }
.accounts .chev { font-size: .7rem; color: var(--text-3); transition: transform .12s; }
.accounts[open] .chev { transform: rotate(180deg); }
.accounts-body { padding: 0 8px 8px; }
#account-search {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 9px; font-size: .8rem; outline: none;
}
#account-search:focus { border-color: var(--accent); }
.account-list { max-height: 320px; overflow-y: auto; margin-top: 6px; }
.account-list h4 {
  margin: 8px 0 3px; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-3);
}
.account-list .row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 6px; border-radius: 6px; font-size: .77rem; color: var(--text-2);
}
.account-list .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-list .row span:last-child { flex: none; color: var(--text-3); font-size: .72rem; }
.account-list .row.clickable { cursor: pointer; }
.account-list .row.clickable:hover { background: var(--accent-soft); color: var(--text); }
.account-empty { margin: 8px 6px 2px; font-size: .76rem; color: var(--text-3); }

/* ─────────────────── code blocks in answers ─────────────────── */
.prose .code {
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); margin: 4px 0 18px; overflow: hidden;
}
.prose .code > summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 7px 11px; font-size: .73rem; color: var(--text-3); list-style: none;
}
.prose .code > summary::-webkit-details-marker { display: none; }
.prose .code > summary::before { content: "▸"; font-size: .65rem; }
.prose .code[open] > summary::before { content: "▾"; }
.prose .code > summary:hover { background: var(--surface-3); color: var(--text-2); }
.code-lang { font-family: var(--mono); color: var(--text-2); }
.code-lines { flex: 1; }
.code-copy {
  background: none; border: 1px solid var(--border-strong); color: var(--text-3);
  border-radius: 6px; padding: 2px 8px; font-size: .7rem;
}
.code-copy:hover { color: var(--text); border-color: var(--accent); }
.prose .code pre { margin: 0; border: none; border-top: 1px solid var(--border); border-radius: 0; max-height: 460px; }

/* a pasted wall of text as the question */
.msg.user .long-question { cursor: pointer; }
.msg.user .long-question > summary {
  list-style: none; font-weight: 500; color: var(--text-2);
}
.msg.user .long-question > summary::-webkit-details-marker { display: none; }
.long-question-body {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  white-space: pre-wrap; font-size: .86rem; font-weight: 400;
  max-height: 420px; overflow-y: auto;
}
