:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6a7180;
  --line: #e4e7ec;
  --accent: #4b4fd6;
  --accent-text: #ffffff;
  --soft: #eef0fb;
  --agent: #f1f3f7;
  --ok: #15803d;
  --ok-soft: #e8f6ee;
  --bad: #c2410c;
  --bad-soft: #fdf0e8;
  --wait: #b7791f;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --card: #161920;
    --text: #e7e9ee;
    --muted: #9198a6;
    --line: #262a33;
    --accent: #7c80f2;
    --accent-text: #0e1014;
    --soft: #1d1f33;
    --agent: #1e222b;
    --ok: #4ade80;
    --ok-soft: #13261b;
    --bad: #fb923c;
    --bad-soft: #2a1a10;
    --wait: #fbbf24;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* Over the display rules of .grid, .step and the rest. */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

code, .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.muted { color: var(--muted); margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { font-size: 12px; color: var(--muted); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px 24px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 5px, transparent 6px),
              radial-gradient(circle at 50% 50%, transparent 0 8px, var(--accent) 9px 10px, transparent 11px);
}
.top-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.version { font-size: 13px; color: var(--muted); }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.version code { color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.grid {
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px;
  padding: 12px 24px 40px;
}
.evals { grid-column: 1 / -1; }
@media (max-width: 880px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow); min-width: 0;
}

.debtor {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.debtor .name { font-size: 20px; font-weight: 650; }
.debtor .digits { text-align: right; }
.debtor .code { font-size: 20px; letter-spacing: 0.12em; }

.choice { padding-top: 16px; }
.choice label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; max-width: 100%; }
.choice select {
  appearance: auto; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; max-width: 100%;
}
.choice select:disabled { opacity: 0.55; }
.choice select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 0 12px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 999px; cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.dot.connecting { background: var(--wait); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.error { background: var(--bad); }
.pill { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--soft); border-radius: 999px; padding: 2px 10px; }
.timer { font-variant-numeric: tabular-nums; }
.error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }

.transcript {
  list-style: none; margin: 0; padding: 4px 0; display: flex; flex-direction: column; gap: 10px;
  min-height: 220px; max-height: 460px; overflow-y: auto;
}
.transcript .placeholder { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }
.transcript li.agent, .transcript li.caller { max-width: 82%; }
.transcript li.caller { align-self: flex-end; text-align: right; }
.transcript .who { display: block; font-size: 11px; color: var(--muted); margin: 0 4px 2px; }
.transcript p { margin: 0; padding: 9px 13px; border-radius: 14px; display: inline-block; text-align: left; overflow-wrap: anywhere; }
.transcript .agent p { background: var(--agent); border-top-left-radius: 4px; }
.transcript .caller p { background: var(--accent); color: var(--accent-text); border-top-right-radius: 4px; }
.transcript .interim p { opacity: 0.6; }

.result { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.result ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.result li { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; }
.result li.ok { background: var(--ok-soft); }
.result li.refused { background: var(--bad-soft); }
.result li.none { color: var(--muted); padding-left: 0; }
.result .what { font-weight: 650; }
.result .ok .state { color: var(--ok); }
.result .refused .state { color: var(--bad); }
.result .meta { color: var(--muted); font-size: 13px; }

/* One label column width for every section, so the values line up from top to bottom. */
.config dl { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; }
.config dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.config dd { margin: 0; overflow-wrap: anywhere; line-height: 1.4; }
.config h3 { padding-top: 14px; border-top: 1px solid var(--line); }
.config h3:first-child { padding-top: 0; border-top: none; }
.config h3:first-child { margin-top: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.evals h3 { margin-top: 22px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
/* Same columns in every table, so the eye can run down one column across the groups. */
.evals table { table-layout: fixed; min-width: 760px; }
.evals th:nth-child(1) { width: 27%; }
.evals th:nth-child(2) { width: 38%; }
.evals th:nth-child(3) { width: 24%; }
.evals th:nth-child(4) { width: 11%; }
.evals td .lead { font-weight: 650; }
.evals td .extra { color: var(--muted); font-size: 13px; }
.evals tr.active td { background: var(--ok-soft); }
.evals th:first-child, .evals td:first-child { padding-left: 10px; }
.evals tr.active td:first-child { border-radius: 8px 0 0 8px; }
.evals tr.active td:last-child { border-radius: 0 8px 8px 0; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
td .line { display: block; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 0 8px; margin-left: 6px; vertical-align: 1px; }
.version-cell code { white-space: nowrap; }
.version-cell.current .sub { color: var(--ok); }

.signin { display: flex; justify-content: center; padding: 48px 24px; }
.signin form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.signin h2 { margin: 0; font-size: 17px; }
.signin .step { display: flex; flex-direction: column; gap: 12px; }
.signin label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.signin input {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
}
.signin input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.signin .error { margin: 0; }
.signin .reset { font-size: 13px; color: var(--accent); text-align: center; }
