:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-2: #1c212a;
  --line: #262c37;
  --text: #e6e9ef;
  --muted: #98a1b3;
  --accent: #7aa2f7;
  --accent-dim: #2b3a5c;
  --user: #223049;
  --high: #f7768e;
  --medium: #e0af68;
  --ok: #9ece6a;
  --radius: 10px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-2: #f0f2f6;
    --line: #dde1e8;
    --text: #1b1f27;
    --muted: #5d6675;
    --accent: #3c6de0;
    --accent-dim: #d7e2fb;
    --user: #e6edfb;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { font-size: 15px; margin: 0; letter-spacing: .2px; }
.brand .sub { color: var(--muted); font-size: 12px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); align-self: center;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: 1px solid transparent; color: var(--muted);
  padding: 5px 12px; border-radius: var(--radius); font: inherit; font-size: 13px;
  cursor: pointer;
}
.tab:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--accent-dim); color: var(--text); border-color: var(--accent);
}
.tab:disabled { opacity: .45; cursor: not-allowed; }
.btn {
  font: inherit; font-size: 13px; padding: 6px 14px;
  border-radius: var(--radius); cursor: pointer; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #0b1020; font-weight: 600; }
.btn--ghost { background: none; }
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge--muted { background: var(--panel-2); }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 16px; font-size: 13px;
  background: color-mix(in srgb, var(--medium) 12%, var(--panel));
  border-bottom: 1px solid var(--line);
  color: var(--text); flex: none;
}
.notice code {
  background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.notice-close {
  margin-left: auto; background: none; border: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.layout { flex: 1; min-height: 0; display: flex; }
.chat {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  max-width: 900px; width: 100%; margin: 0 auto;
}
.transcript {
  flex: 1; overflow-y: auto; padding: 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 78%; }
.msg--user { align-self: flex-end; align-items: flex-end; }
.msg--ai { align-self: flex-start; }
.msg-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.msg-body {
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.msg--user .msg-body { background: var(--user); }
.msg--error .msg-body { border-color: var(--high); color: var(--high); }
.msg-meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; margin: auto; font-size: 14px; }
.cursor::after {
  content: "▍"; color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
.composer {
  display: flex; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--line); background: var(--panel); flex: none;
}
.composer textarea {
  flex: 1; resize: none; font: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px; max-height: 160px;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.status {
  margin: 0; padding: 0 16px 10px; font-size: 12px; color: var(--muted);
  min-height: 18px; flex: none;
}
.status--error { color: var(--high); }
