/* AI Panel — ChatGPT/Claude-Code-flavoured shell. Dark by default, light via [data-theme=light].
   No inline styles anywhere (the CSP forbids them), so every variant lives here. */

:root {
  --bg: #0f1115;
  --bg-elev: #16181d;
  --bg-side: #0b0d11;
  --bg-hover: #1d2026;
  --border: #262a31;
  --border-soft: #1e2228;
  --text: #e8eaed;
  --text-dim: #9aa0a8;
  --text-faint: #6b7280;
  --accent: #7c9cff;
  --accent-ink: #0b0d11;
  --accent-weak: rgba(124, 156, 255, 0.14);
  --user-bubble: #1f2530;
  --code-bg: #101318;
  --code-head: #171b21;
  --danger: #f87171;
  --ok: #4ade80;
  --warn: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f7f8fa;
  --bg-side: #f4f5f7;
  --bg-hover: #eceef2;
  --border: #dfe3e8;
  --border-soft: #e8ebef;
  --text: #17191c;
  --text-dim: #5c636b;
  --text-faint: #8b929a;
  --accent: #3355d8;
  --accent-ink: #ffffff;
  --accent-weak: rgba(51, 85, 216, 0.1);
  --user-bubble: #eef1f6;
  --code-bg: #f6f7f9;
  --code-head: #eceef2;
  --danger: #c02626;
  --ok: #15803d;
  --warn: #a16207;
  --shadow: 0 10px 30px rgba(20, 25, 35, 0.12);
}

* { box-sizing: border-box; }

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

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, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.mut { color: var(--text-dim); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.space { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-height: 0; }

/* ---------- shell ---------- */

.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 14px 12px;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.side-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar > * { flex: 0 0 auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-weak);
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 550;
  text-align: left;
}
.new-chat:hover { background: var(--bg-hover); }
.new-chat .plus { font-size: 17px; line-height: 1; color: var(--text-dim); }

.side-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nav-item {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-weak); color: var(--text); border-color: var(--border); }

.side-section { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.side-section.grow { flex: 1 0 auto; min-height: 0; }
.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.bot-list { display: flex; flex-direction: column; gap: 2px; }

.bot-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  font-size: 14px;
}
.bot-item:hover { background: var(--bg-hover); color: var(--text); }
.bot-item.active { background: var(--bg-elev); border-color: var(--border); color: var(--text); }
.bot-item .avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.bot-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-item .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex: none; }
.bot-item .pip.on { background: var(--ok); }
.bot-item .pip.off { background: var(--text-faint); }

.session-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; max-height: 38vh; overscroll-behavior: contain; }
.session-item {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  font-size: 13.5px;
}
.session-item:hover { background: var(--bg-hover); color: var(--text); }
.session-item.active { background: var(--bg-elev); border-color: var(--border); color: var(--text); }
.session-item .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .m { display: block; font-size: 11.5px; color: var(--text-faint); }

.side-foot { border-top: 1px solid var(--border-soft); padding-top: 10px; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.me img { width: 22px; height: 22px; border-radius: 50%; }
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- main ---------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  flex: none;
}
.chat-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.model-picker {
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 13px;
}

.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }
.panel-view { overflow-y: auto; padding: 20px 20px 40px; gap: 14px; }

/* ---------- thread ---------- */

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 16px 8px;
  scroll-behavior: smooth;
}

.msg { max-width: 820px; margin: 0 auto 22px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--user-bubble);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.assistant .bubble { padding: 0; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-faint);
}
.msg-meta .who { font-weight: 650; color: var(--text-dim); }

/* Paged transcript: the control that pulls the page above the oldest visible row. */
.thread-more { display: flex; justify-content: center; padding: 4px 0 16px; }

.hero {
  max-width: 640px;
  margin: 12vh auto 0;
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}
.hero h2 { margin: 0; font-size: 26px; letter-spacing: -0.2px; }
.hero p { margin: 0 0 6px; max-width: 460px; }
.hero .row { justify-content: center; }

.tools { display: grid; gap: 8px; margin-bottom: 10px; }
.tools:empty { display: none; }

.offscreen {
  position: fixed;
  top: -1000px;
  left: -1000px;
  opacity: 0;
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- markdown ---------- */

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { margin: 20px 0 8px; line-height: 1.3; }
.md h1 { font-size: 1.4em; }
.md h2 { font-size: 1.22em; }
.md h3 { font-size: 1.08em; }
.md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 3px 0; }
.md blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--text-dim);
}
.md hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.md code.inline {
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.88em;
}
.md table { border-collapse: collapse; margin: 0 0 12px; width: 100%; font-size: 0.94em; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--bg-elev); font-weight: 600; }
.md del { color: var(--text-faint); }

/* ---------- code blocks ---------- */

.code-block {
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--code-head);
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--mono);
}
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.6;
  tab-size: 2;
}
.code-block code { font-family: inherit; }

.tok-kw { color: #c792ea; }
.tok-str { color: #a5d6a7; }
.tok-num { color: #f0b37e; }
.tok-com { color: var(--text-faint); font-style: italic; }
.tok-fn { color: #82aaff; }
.tok-type { color: #ffcb6b; }
.tok-var { color: #f78c6c; }
.tok-meta { color: #89ddff; }
.tok-tag { color: #f07178; }
.tok-attr { color: #ffcb6b; }
.tok-sel { color: #c792ea; }
.tok-add { color: var(--ok); background: rgba(74, 222, 128, 0.08); display: inline-block; width: 100%; }
.tok-del { color: var(--danger); background: rgba(248, 113, 113, 0.08); display: inline-block; width: 100%; }

[data-theme="light"] .tok-kw { color: #8b3ec4; }
[data-theme="light"] .tok-str { color: #1a7f37; }
[data-theme="light"] .tok-num { color: #b45309; }
[data-theme="light"] .tok-fn { color: #1d4ed8; }
[data-theme="light"] .tok-type { color: #a16207; }
[data-theme="light"] .tok-var { color: #b91c1c; }
[data-theme="light"] .tok-meta { color: #0369a1; }
[data-theme="light"] .tok-tag { color: #b91c1c; }
[data-theme="light"] .tok-attr { color: #a16207; }
[data-theme="light"] .tok-sel { color: #8b3ec4; }

.copy {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 11.5px;
}
.copy:hover { background: var(--bg-hover); color: var(--text); }

/* ---------- thinking / tools / approvals ---------- */

.thinking, .tool {
  margin: 0 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  overflow: hidden;
}
.thinking > summary, .tool > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
  list-style: none;
  user-select: none;
}
.thinking > summary::-webkit-details-marker, .tool > summary::-webkit-details-marker { display: none; }
.thinking > summary::before, .tool > summary::before {
  content: "▸";
  color: var(--text-faint);
  font-size: 10px;
  transition: transform 0.15s;
}
.thinking[open] > summary::before, .tool[open] > summary::before { transform: rotate(90deg); }
.thinking .body, .tool .body { padding: 0 12px 10px; }
.thinking .body {
  font-family: var(--mono);
  font-size: 12.3px;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tool .body { display: grid; gap: 8px; }
.tool .tool-line { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--text-dim); }
.tool .tool-line .k { color: var(--text-faint); min-width: 64px; }
.tool pre {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 12.3px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tool .state-ok { color: var(--ok); }
.tool .state-err { color: var(--danger); }

.approval {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-weak);
}
.approval .title { font-weight: 650; margin-bottom: 6px; }
.approval pre {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 12.3px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.approval .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- composer ---------- */

.composer-wrap { flex: none; padding: 8px 16px 14px; }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1;
  min-height: 24px;
  max-height: 220px;
  padding: 6px 0;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  line-height: 1.5;
}
.send {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 700;
}
.send:disabled { opacity: 0.45; cursor: default; }
.send.stop { background: var(--danger); color: #fff; font-size: 12px; }
.composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 820px;
  margin: 6px auto 0;
  padding: 0 6px;
  font-size: 11.5px;
  color: var(--text-faint);
}
.composer-hint kbd {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.quick { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- buttons / forms ---------- */

button.primary, button.ghost, button.danger {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; color: var(--text-dim); }
button.ghost:hover { background: var(--bg-hover); color: var(--text); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: rgba(248, 113, 113, 0.1); }
button.sm { padding: 5px 10px; font-size: 12.5px; }
button.tiny { padding: 3px 8px; font-size: 11.5px; }
button:disabled { opacity: 0.5; cursor: default; }

.icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
}
.icon:hover { background: var(--bg-hover); color: var(--text); }
.icon.tiny { width: 22px; height: 22px; font-size: 12px; }

input[type="text"], input:not([type]), select, textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--text-dim); }

/* ---------- panels / cards ---------- */

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view-head h2 { margin: 0; font-size: 18px; }
.panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  display: grid;
  gap: 10px;
}
.panel h3, .panel h4 { margin: 4px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 4px; font-size: 14.5px; }
.card .k { font-size: 12.5px; color: var(--text-dim); }
.card .v { font-size: 20px; font-weight: 650; margin: 4px 0; }
.card .v.sm { font-size: 15px; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.log { display: grid; gap: 1px; font-family: var(--mono); font-size: 12px; }
.log .line { display: grid; grid-template-columns: 64px 44px 1fr; gap: 8px; padding: 4px 8px; border-radius: 4px; }
.log .line:nth-child(odd) { background: var(--bg-elev); }
.log .s2 { color: var(--ok); }
.log .s3 { color: var(--warn); }
.log .s4, .log .s5 { color: var(--danger); }

/* ---------- toast / modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 90vw;
}
.toast.err { border-color: var(--danger); color: var(--danger); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}
.modal-box {
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}
.modal-box h3 { margin: 0; }
.modal-box p { margin: 0; color: var(--text-dim); white-space: pre-wrap; }

.scrim { display: none; }
.only-mobile { display: none; }

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: grid; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: min(86vw, 320px);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.5);
  }
  .thread { padding: 16px 12px 4px; }
  .msg.user .bubble { max-width: 88%; }
  .composer-wrap { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .model-picker { max-width: 150px; }
  .panel-view { padding: 14px 12px 32px; }
  .log .line { grid-template-columns: 54px 36px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Auth gate: hide the app shell until /api/me succeeds; show the login card when signed out. */
html[data-auth="pending"] #app,
html[data-auth="out"] #app { display: none; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-screen[hidden] { display: none; }
.login-card { display: grid; gap: 16px; text-align: center; padding: 32px; border-radius: 16px;
  border: 1px solid var(--border, rgba(127,127,127,.25)); background: var(--panel, transparent); max-width: 360px; width: 100%; }
.login-btn { display: inline-block; padding: 12px 18px; border-radius: 10px; background: #5865f2; color: #fff;
  text-decoration: none; font-weight: 600; }
.model-picker:empty { display: none; }

/* Connection dot: proxy/tunnel/gateway state, so a dead backend is visible before sending. */
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mut, #8b90a0); }
.health::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8b90a0; }
.health[data-state="ok"] { color: #4ade80; }
.health[data-state="ok"]::before { background: #4ade80; }
.health[data-state="warn"] { color: #fbbf24; }
.health[data-state="warn"]::before { background: #fbbf24; }
.health[data-state="down"] { color: #f87171; }
.health[data-state="down"]::before { background: #f87171; }

/* Inline error with a retry button, instead of a bare "Load failed" line. */
.err-box { display: grid; gap: 8px; padding: 10px 12px; margin: 8px 0; border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }
.err-text { font-size: 13px; color: #fca5a5; }
.err-box button { justify-self: start; }

.transcript-event { margin: 4px 0 8px 12px; display: grid; gap: 4px; font-size: 13px; }
.transcript-event .tool-log { margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(127,127,127,.08); }
