:root {
  --bg: #0f1115; --card: #171a21; --line: #262b36; --text: #e7e9ee; --muted: #9aa3b2;
  --accent: #6ea8fe; --accent-ink: #0b1220; --good: #4cc38a; --warn: #f2b84b; --bad: #f2705e;
  --you: #1d2a3f; --ai: #1f2229;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px 32px; }
.tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 15px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%;
}
textarea { resize: vertical; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; margin: 14px 0 4px; font-size: 14px; }
label.check input { width: auto; margin-top: 3px; }
button { font: inherit; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 11px 16px; cursor: pointer; }
button.primary { width: 100%; margin-top: 12px; background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 700; font-size: 17px; padding: 14px; }
button.danger { background: var(--bad); border: 0; color: #1b0d0b; font-weight: 700; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.row button { flex: 1; }
.warn { background: #3a2a10; border: 1px solid #6b4d16; color: #f5d9a6; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.live-head { display: flex; justify-content: space-between; align-items: center; }
#clock { font-variant-numeric: tabular-nums; color: var(--muted); }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.pill.listening { background: #143524; color: var(--good); }
.pill.speaking { background: #1b2a47; color: var(--accent); }
.pill.reconnecting, .pill.connecting { background: #3a2a10; color: var(--warn); }
.meter { height: 6px; background: var(--bg); border-radius: 4px; margin: 12px 0; overflow: hidden; }
#level { height: 100%; width: 0; background: var(--good); transition: width 80ms linear; }
#transcript { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.turn { padding: 9px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; }
.turn.assistant { background: var(--ai); align-self: flex-start; }
.turn.user { background: var(--you); align-self: flex-end; }
.turn .meta { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.turn.interrupted::after { content: " (interrupted)"; color: var(--muted); font-size: 12px; }
#report h2 { font-size: 18px; margin: 0 0 10px; }
#report h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); }
.scores { display: flex; flex-wrap: wrap; gap: 8px; }
.score { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 14px; }
.score b { color: var(--accent); }
.ans { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ans summary { cursor: pointer; }
.v-strong { color: var(--good); } .v-ok { color: var(--warn); } .v-weak { color: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); font-size: 13px; }
#recurring .chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 3px 9px; margin: 3px 4px 0 0; font-size: 13px; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 12px; }
.hist { display: block; width: 100%; text-align: left; margin-bottom: 6px; font-size: 14px; }
#save-settings { margin-top: 8px; }
pre { white-space: pre-wrap; }
.pill.hearing { background: #3a1f3f; color: #e08ef0; }
.wide-label { margin-top: 12px; }
