:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1b1f24; --muted: #5d6673; --line: #e2e5ea;
  --accent: #4b3fd1; --accent-ink: #ffffff; --ok: #157347; --warn: #9a6200; --bad: #b42318;
  --sim-bg: #fff4d6; --sim-ink: #7a4b00; --agent: #eef0ff; --caller: #f1f5f2;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --panel: #171a21; --ink: #e7e9ee; --muted: #9aa3b2; --line: #2a2f3a;
    --accent: #8d84ff; --accent-ink: #0f1115; --ok: #4cc38a; --warn: #f0b952; --bad: #ff7b72;
    --sim-bg: #3a2c05; --sim-ink: #f7d27a; --agent: #1f2240; --caller: #18261f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
header h1 { font-size: 17px; margin: 0; font-weight: 650; }
header nav { margin-left: auto; display: flex; gap: 14px; }
header nav a { color: var(--muted); text-decoration: none; }
header nav a.on { color: var(--ink); font-weight: 600; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.sim { background: var(--sim-bg); color: var(--sim-ink); border-color: transparent; font-weight: 600; }
.badge.live { background: var(--ok); color: #fff; border-color: transparent; }
main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 60px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=time], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: inherit; }
textarea { min-height: 64px; resize: vertical; }
button { font: inherit; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.field { margin-bottom: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 13px; }
.transcript { display: flex; flex-direction: column; gap: 8px; min-height: 280px; max-height: 56vh; overflow-y: auto; padding: 4px 2px; }
.bubble { padding: 8px 12px; border-radius: 10px; max-width: 88%; }
.bubble.agent { background: var(--agent); align-self: flex-start; }
.bubble.caller { background: var(--caller); align-self: flex-end; }
.bubble .who { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }
.unheard { text-decoration: line-through; color: var(--muted); }
.tag { font-size: 11px; color: var(--warn); margin-left: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.events { font-family: ui-monospace, Menlo, monospace; font-size: 12px; max-height: 260px; overflow-y: auto; white-space: pre-wrap; }
.events .lat { color: var(--ok); } .events .bad { color: var(--bad); } .events .warn { color: var(--warn); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .t { font-size: 12px; color: var(--muted); }
.ok { color: var(--ok); } .bad { color: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.ks { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.notice { padding: 8px 12px; border-radius: 8px; background: var(--sim-bg); color: var(--sim-ink); font-size: 13px; margin-bottom: 12px; }
.mic { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.mic.on { background: var(--bad); box-shadow: 0 0 0 4px rgba(180, 35, 24, .15); }
