:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --muted: #646b78;
  --border: #e2e5ea;
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --ok: #1d7a46;
  --warn: #a35d00;
  --bad: #b42318;
  --mark: #fff1a8;
  --radius: 10px;
  --s0: #2f5bd3; --s1: #c2410c; --s2: #0f766e; --s3: #9333ea; --s4: #be123c; --s5: #4d7c0f; --s6: #0369a1; --s7: #a16207;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --text: #e8eaee; --muted: #9aa1ad; --border: #2a2f39;
    --accent: #7c9cff; --accent-ink: #0f1115; --accent-soft: #1d2640; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --mark: #5b4b00;
    --s0: #7c9cff; --s1: #fb923c; --s2: #2dd4bf; --s3: #c084fc; --s4: #fb7185; --s5: #a3e635; --s6: #38bdf8; --s7: #facc15;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --text: #e8eaee; --muted: #9aa1ad; --border: #2a2f39;
  --accent: #7c9cff; --accent-ink: #0f1115; --accent-soft: #1d2640; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --mark: #5b4b00;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 system-ui, "Segoe UI", "Rubik", "Assistant", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; margin: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { white-space: nowrap; padding: 6px 12px; border-radius: 8px; color: var(--muted); }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pill { font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--muted); }
.list { display: grid; gap: 8px; }
.it { display: grid; gap: 4px; }
.it .title { font-weight: 600; overflow-wrap: anywhere; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.done { color: var(--ok); }
.badge.error { color: var(--bad); }
.badge.run { color: var(--accent); background: var(--accent-soft); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.result .ctx { margin: 6px 0 0; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.answer { white-space: pre-wrap; }
.speakers { display: flex; gap: 8px; flex-wrap: wrap; }
.spk { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; font-size: 14px; }
.spk input { width: 130px; padding: 3px 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.turn { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.turn .who { font-size: 13px; font-weight: 600; }
.turn .t { font-size: 12px; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.turn .t:hover { color: var(--accent); }
.turn p { margin: 0; }
.player { position: sticky; top: 58px; z-index: 4; background: var(--bg); padding: 8px 0; }
audio { width: 100%; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 10; max-width: calc(100% - 32px); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
table { width: 100%; border-collapse: collapse; }
@media (max-width: 640px) {
  .top { gap: 8px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .turn { grid-template-columns: 1fr; gap: 2px; }
  .player { top: 96px; }
}
