:root {
  color-scheme: light;
  --surface-0: #f4f4f2; --surface-1: #fcfcfb; --border: #e2e1dc;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #77766f;
  --series-1: #2a78d6; --accent: #2a78d6; --grid: #e7e6e1;
  --good: #0a7a2f; --critical: #c0302f; --warn-bg: #fff4d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface-0: #111110; --surface-1: #1a1a19; --border: #33322f;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9a998f;
    --series-1: #3987e5; --accent: #3987e5; --grid: #2b2a27;
    --good: #3fbf6a; --critical: #e66767; --warn-bg: #3a3218;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--surface-0);
  color: var(--text-primary); padding-bottom: 70px; }
a { color: var(--accent); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--surface-1); border-bottom: 1px solid var(--border); }
.grow { flex: 1; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--warn-bg); color: var(--text-primary); }
.icon { background: none; border: 0; font-size: 20px; position: relative; cursor: pointer; }
.dot { position: absolute; top: 0; right: -2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--critical);
  color: #fff; font: 11px/16px system-ui; text-align: center; font-style: normal; padding: 0 3px; }
main { max-width: 900px; margin: 0 auto; padding: 12px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--surface-1);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 8px 0; text-decoration: none; color: var(--text-secondary); font-size: 20px;
  position: relative; }
.tabs a span { display: block; font-size: 11px; }
.tabs a.on { color: var(--accent); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 4px 0 10px; }
h3 { font-size: 15px; margin: 12px 0 6px; }
.muted { color: var(--text-muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input, select, textarea, button { font: inherit; }
input, select, textarea { padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1);
  color: var(--text-primary); max-width: 100%; }
textarea { width: 100%; min-height: 60px; }
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.err { color: var(--critical); }
/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tile .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12px; color: var(--text-secondary); }
/* column chart (single series: answer rate %) */
.chart { position: relative; height: 172px; display: flex; align-items: flex-end; gap: 2px; padding: 12px 0 18px 30px;
  border-bottom: 1px solid var(--text-muted); }
.chart .grid { position: absolute; left: 30px; right: 0; border-top: 1px solid var(--grid); font-size: 10px; color: var(--text-muted); }
.chart .grid span { position: absolute; left: -30px; top: -7px; width: 26px; text-align: right; }
.chart .col { flex: 1 1 0; min-width: 2px; max-width: 24px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%;
  position: relative; cursor: default; }
.chart .col .bar { background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 0; }
.chart .col .none { height: 0; }
.chart .col:hover .bar, .chart .col:focus .bar { filter: brightness(1.15); }
.chart .col .x { position: absolute; bottom: -17px; left: 50%; transform: translateX(-50%); font-size: 10px;
  color: var(--text-muted); white-space: nowrap; }
.tip { position: fixed; z-index: 20; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; font-size: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.15); pointer-events: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list li:last-child { border: 0; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--text-secondary); }
.pill.missed { color: var(--critical); border-color: var(--critical); }
.pill.ai { color: var(--accent); border-color: var(--accent); }
.bubble { max-width: 80%; padding: 8px 10px; border-radius: 12px; margin: 6px 0; white-space: pre-wrap; }
.bubble.in { background: var(--surface-0); border: 1px solid var(--border); }
.bubble.out { background: var(--accent); color: #fff; margin-left: auto; }
.bubble.note { background: var(--warn-bg); border: 1px dashed var(--text-muted); margin: 6px auto; max-width: 90%; }
.bubble .meta { font-size: 11px; opacity: .75; margin-top: 2px; }
pre.transcript { white-space: pre-wrap; font: 13px/1.5 system-ui; background: var(--surface-0); padding: 8px; border-radius: 8px; }
.panel { position: fixed; right: 8px; top: 48px; width: min(360px, 94vw); max-height: 60vh; overflow: auto; z-index: 10;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.login { display: grid; place-items: center; min-height: 100vh; }
.login form { width: min(340px, 92vw); display: grid; gap: 10px; }
.login label { display: grid; gap: 4px; }
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 260px; }
.dialpad button { padding: 14px; font-size: 20px; }
@media (min-width: 700px) { .tabs { max-width: 900px; margin: 0 auto; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; } }
label.row { flex-wrap: nowrap; align-items: flex-start; margin: 4px 0; }
label.row input[type=checkbox] { margin-top: 3px; flex: none; }
.scroll-x { overflow-x: auto; }
