:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16202c;
  --muted: #5a6778;
  --line: #dde2e8;
  --accent: #0263c5;
  --good: #1a7f4b;
  --warn: #a15c00;
  --bad: #b3261e;
  --chip: #eef2f7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #18202a;
    --text: #e6ebf1;
    --muted: #9aa7b6;
    --line: #2b3643;
    --accent: #6cb2ff;
    --good: #5cc98c;
    --warn: #e0a54a;
    --bad: #ff7b72;
    --chip: #222c38;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* the header's controls wait for the sign-in */
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.brand { font-weight: 700; font-size: 16px; text-decoration: none; color: var(--text); }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.controls select { margin-left: 6px; }
.check { display: inline-flex; gap: 6px; align-items: center; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 6px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 0; }
.stat { background: var(--chip); border-radius: 6px; padding: 8px 10px; }
.stat dt { font-size: 12px; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; }
.stat dd small { font-size: 12px; font-weight: 400; color: var(--muted); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.good { color: var(--good); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--chip); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--chip); font-size: 12px; }
.turn { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 10px; }
.turn.visitor { border-left: 3px solid var(--muted); }
.turn.assistant { border-left: 3px solid var(--accent); }
.turn .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.turn .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.form { display: grid; gap: 12px; max-width: 520px; }
.form label { display: grid; gap: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button { font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: 0.6; cursor: default; }
pre { background: var(--chip); padding: 10px; border-radius: 6px; overflow: auto; font-size: 12px; }
.note { padding: 10px 12px; border-radius: 6px; background: var(--chip); margin: 10px 0; }
.error { color: var(--bad); }
@media (max-width: 640px) {
  main { padding: 12px; }
  .bar { padding: 10px 12px; }
  th:nth-child(n+4), td:nth-child(n+4) { display: none; }
}
