/* Spawn Dialer. Tokens first; light and dark are each chosen, not flipped. Spacing on a 4/8 grid. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f2f1ed; --surface-3: #e9e7e1;
  --text: #17171a; --text-2: #45454d; --muted: #66666f; --line: #e3e1db; --line-2: #d3d0c8;
  --accent: #2f6fe4; --accent-text: #2459c4; --accent-soft: #e8effc; --on-accent: #ffffff;
  --call: #15803d; --call-hover: #116b33; --call-soft: #e6f4ea; --on-call: #ffffff;
  --hang: #c81e1e; --hang-hover: #a91818; --hang-soft: #fbe9e9; --on-hang: #ffffff;
  --warn: #9a4d05; --warn-soft: #fdf1e2; --warn-line: #f1d3ac;
  --ok: #1d6f4d; --ok-soft: #e5f3ec;
  --focus: #2f6fe4;
  --shadow-1: 0 1px 2px rgba(23, 23, 26, .05), 0 1px 1px rgba(23, 23, 26, .03);
  --shadow-2: 0 8px 24px rgba(23, 23, 26, .08), 0 2px 6px rgba(23, 23, 26, .05);
  --r-1: 8px; --r-2: 12px; --r-3: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #19191c; --surface-2: #222226; --surface-3: #2b2b30;
    --text: #ececef; --text-2: #c9c9d0; --muted: #9d9da6; --line: #2c2c32; --line-2: #3a3a41;
    --accent: #3b6fd8; --accent-text: #8db3ff; --accent-soft: #1d2a45; --on-accent: #ffffff;
    --call: #15803d; --call-hover: #18934a; --call-soft: #15291c; --on-call: #ffffff;
    --hang: #c81e1e; --hang-hover: #dc2a2a; --hang-soft: #3a1a1a; --on-hang: #ffffff;
    --warn: #f0b35c; --warn-soft: #2e2214; --warn-line: #5a3f17;
    --ok: #5cc794; --ok-soft: #13291f;
    --focus: #8db3ff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #19191c; --surface-2: #222226; --surface-3: #2b2b30;
  --text: #ececef; --text-2: #c9c9d0; --muted: #9d9da6; --line: #2c2c32; --line-2: #3a3a41;
  --accent: #3b6fd8; --accent-text: #8db3ff; --accent-soft: #1d2a45; --on-accent: #ffffff;
  --call: #15803d; --call-hover: #18934a; --call-soft: #15291c; --on-call: #ffffff;
  --hang: #c81e1e; --hang-hover: #dc2a2a; --hang-soft: #3a1a1a; --on-hang: #ffffff;
  --warn: #f0b35c; --warn-soft: #2e2214; --warn-line: #5a3f17;
  --ok: #5cc794; --ok-soft: #13291f;
  --focus: #8db3ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
kbd { font: 600 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface); color: var(--text-2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: var(--r-1); z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; padding: 4px; border-radius: 7px; background: var(--call); fill: #fff; flex: none; }
.brand.big { font-size: 17px; margin-bottom: 24px; }
.brand.big .logo { width: 32px; height: 32px; padding: 6px; border-radius: 9px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text-2); padding: 6px 12px; border-radius: 999px; font-weight: 550; font-size: 14px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); border: 1px solid var(--line); padding: 5px 11px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.from { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.from b { color: var(--text-2); font-weight: 600; }
.menu { position: relative; }
.userbtn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-size: 14px; font-weight: 550; }
.userbtn:hover { border-color: var(--line-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-2); padding: 6px; }
.menu-pop button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.menu-pop button:hover { background: var(--surface-2); }

/* ---------- layout ---------- */
.view { max-width: 1240px; margin: 0 auto; padding: 16px 16px 96px; outline: none; }
.boot { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 96px 0; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banners { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: grid; gap: 8px; }
.banners:not(:empty) { padding-top: 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 16px; }
.page-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.crumb { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.grid-dial { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.side { position: sticky; top: 72px; display: grid; gap: 16px; }
@media (max-width: 1023px) {
  /* One column: lead, call controls, script, outcome, up next (the script sits next to the call while talking). */
  .grid-dial { grid-template-columns: minmax(0, 1fr); }
  .grid-dial > .col, .grid-dial > .side { display: contents; }
  #lead { order: 1; } #callbar { order: 2; } #script { order: 3; } #outcomes { order: 4; } #next { order: 5; }
  .side { position: static; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px; }
@media (min-width: 640px) { .card-pad { padding: 20px; } }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.card-h h2, .card-h h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; font-weight: 650; }
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.call { background: var(--call); border-color: var(--call); color: var(--on-call); }
.btn.call:hover { background: var(--call-hover); }
.btn.hang { background: var(--hang); border-color: var(--hang); color: var(--on-hang); }
.btn.hang:hover { background: var(--hang-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn.xl { min-height: 56px; font-size: 17px; border-radius: 14px; padding: 12px 24px; }
.btn.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent-text); }
.btn .k { margin-left: 4px; }
.btn.call kbd, .btn.hang kbd, .btn.primary kbd { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 550; font-size: 14px; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--hang); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .linkbtn.danger { color: #ff8a8a; } }

/* segmented + switch */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; min-height: 30px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid transparent; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.live { background: var(--call-soft); color: var(--call); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.live { color: #5cd18a; } }
:root[data-theme="dark"] .chip.live { color: #5cd18a; }
.chip.hot { background: var(--hang-soft); color: var(--hang); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.outline { background: transparent; border-color: var(--line-2); }
.pulse .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* banners */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-2); border: 1px solid var(--warn-line); background: var(--warn-soft); color: var(--text); font-size: 14px; flex-wrap: wrap; }
.banner .ico { width: 20px; height: 20px; flex: none; color: var(--warn); }
.banner .grow { flex: 1 1 260px; min-width: 0; }
.banner b { font-weight: 650; }
.banner.info { border-color: var(--line); background: var(--surface); }
.banner.info .ico { color: var(--ok); }
.banner audio { height: 32px; max-width: 220px; }

/* ---------- bets list ---------- */
.bets { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.bet-card { display: flex; flex-direction: column; gap: 20px; padding: 20px; }
.bet-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bet-card h2 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.bet-card .brandline { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bet-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.num b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.num span { font-size: 12px; color: var(--muted); }

/* ---------- lead card ---------- */
.lead { padding: 20px; }
.lead-top { display: flex; gap: 16px; align-items: flex-start; }
.initials { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: var(--accent-soft); color: var(--accent-text); }
.lead-id { min-width: 0; flex: 1; }
.lead-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.lead-role { color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.lead-role a { font-weight: 550; }
.lead-time { text-align: right; flex: none; display: grid; gap: 4px; justify-items: end; }
.lead-time .clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: 14px; }
.lead-meta .phone { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; display: inline-flex; gap: 8px; align-items: center; }
.lead-meta a, .lead-meta span { display: inline-flex; align-items: center; gap: 6px; }
.lead-meta svg { width: 16px; height: 16px; color: var(--muted); }
.why { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-2); background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.why b { color: var(--text); font-weight: 650; }
.attempts { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hist { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.hist li { display: flex; gap: 8px; color: var(--text-2); }
.hist time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 112px; }
details summary { cursor: pointer; color: var(--accent-text); font-size: 13px; font-weight: 550; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* ---------- call bar ---------- */
.callbar { padding: 16px; display: grid; gap: 12px; }
@media (min-width: 640px) { .callbar { padding: 20px; } }
.callrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.callrow .btn.xl { flex: 1 1 200px; }
.callstate { display: flex; align-items: center; gap: 12px; flex: 1 1 200px; min-width: 0; }
.timer { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.phase { font-size: 14px; color: var(--text-2); }
.incall { display: flex; gap: 8px; flex-wrap: wrap; }
.callnote { font-size: 13px; color: var(--muted); line-height: 1.9; }
.callnote .chip { vertical-align: middle; }
.countdown { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-2); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.countdown .grow { flex: 1; }
.keypad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: start; }
.keypad button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 18px; font-weight: 650; cursor: pointer; }
.keypad button:hover { background: var(--surface-3); }

/* parallel lines */
.lines { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.line { border: 1px solid var(--line); border-radius: var(--r-2); padding: 10px 12px; background: var(--surface-2); display: grid; gap: 4px; min-width: 0; transition: border-color .2s, background .2s; }
.line .ln { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.line .nm { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .co { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line.connected { border-color: var(--call); background: var(--call-soft); }
.line.idle { border-style: dashed; background: transparent; }

/* outcomes */
.outcomes { padding: 16px; }
@media (min-width: 640px) { .outcomes { padding: 20px; } }
.ogrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 639px) { .ogrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.obtn { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-align: left; font-weight: 600; font-size: 14px; transition: background .12s, border-color .12s, box-shadow .12s; }
.obtn:hover { background: var(--surface-2); }
.obtn kbd { flex: none; }
.obtn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.obtn.good[aria-pressed="true"] { border-color: var(--call); box-shadow: inset 0 0 0 1px var(--call); background: var(--call-soft); color: var(--call); }
.obtn:disabled { opacity: .5; cursor: not-allowed; }
.needlog { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1); }
.orow { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.subpanel { margin-top: 12px; padding: 12px; border-radius: var(--r-2); background: var(--surface-2); display: grid; gap: 10px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 9px 12px; font-size: 14px; min-height: 40px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }

/* up next */
.next { padding: 8px; }
.next-h { padding: 8px 8px 4px; }
.qrow { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; }
.qrow:hover { background: var(--surface-2); }
.qrow[aria-current="true"] { background: var(--accent-soft); }
.qrow .mini { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text-2); }
.qrow .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .r { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.laterline { font-size: 13px; color: var(--muted); padding: 8px; }

/* script */
.script { padding: 20px; }
.ask { border-radius: var(--r-2); padding: 12px 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); margin-bottom: 16px; }
.ask .lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 4px; }
.ask p { margin: 0; font-weight: 600; }
.md { font-size: 14px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; }
.md h2, .md h3, .md h4 { color: var(--text); font-size: 14px; margin: 18px 0 6px; letter-spacing: -.005em; }
.md h2:first-child, .md h3:first-child { margin-top: 0; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text); }
.md strong { color: var(--text); }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md hr { border: 0; height: 1px; background: var(--line); margin: 14px 0; }

/* stats */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select { width: auto; min-width: 160px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1023px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 559px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 550; }
.kpi .val { font-size: 30px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; margin-top: 6px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t th:first-child, table.t td:first-child, table.t th.l, table.t td.l { text-align: left; }
table.t th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.l { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: 14px; }
.foot { color: var(--muted); font-size: 12.5px; margin-top: 12px; line-height: 1.55; }

/* settings */
.rec { display: grid; gap: 16px; }
.recrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.meter { flex: 1 1 160px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--call); border-radius: 999px; transition: width .08s linear; }
.rec audio { width: 100%; max-width: 420px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 559px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 8px; } }

/* sign-in page */
.center-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.signin { width: 100%; max-width: 400px; padding: 32px 28px; }
.signin h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 8px; }
.signin p { margin: 0 0 20px; }
.err { color: var(--hang); font-size: 14px; min-height: 20px; margin: 12px 0 0; }

/* toast + dialog */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 14px; font-weight: 550; z-index: 60; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--hang); color: #fff; }
.dlg { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); color: var(--text); padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-2); }
.dlg::backdrop { background: rgba(10, 10, 12, .4); }
.dlg h2 { font-size: 18px; margin: 0 0 12px; }
.dlg .rows { display: grid; gap: 8px; font-size: 14px; }
.dlg .rows div { display: flex; justify-content: space-between; gap: 12px; }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

@media (max-width: 639px) {
  .top-in { gap: 12px; }
  .top .brand span { display: none; }
  .from { display: none; }
  .userbtn span:last-child { display: none; }
  .userbtn { padding: 4px; }
  .page-head h1 { font-size: 20px; }
  .lead { padding: 16px; }
  .lead-name { font-size: 20px; }
  .lead-top { flex-wrap: wrap; }
  .lead-time { text-align: left; justify-items: start; width: 100%; grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
  .timer { font-size: 24px; }
  .script { padding: 16px; }
}
/* Touch screens: no keyboard hints; the call bar floats at the bottom so Call / Hang up stay under the thumb. */
@media (hover: none) and (pointer: coarse) { kbd, .keyhint { display: none !important; } }
@media (max-width: 1023px) { #callbar { position: sticky; bottom: 8px; z-index: 6; box-shadow: var(--shadow-2); } }
@media (max-width: 639px) { #callbar.is-conn .lines { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
