/* Kanyou Dialer — one stylesheet, light + dark tokens. */
:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --sunken: #efefeb;
  --border: #e4e3de;
  --border-strong: #d3d2cc;
  --ink: #1a1c1b;
  --ink-2: #565b58;
  --muted: #868b88;
  --accent: #0f7a5a;
  --accent-hover: #0c6a4e;
  --accent-ink: #ffffff;
  --accent-soft: #e5f2ec;
  --chart: #0f7a5a;
  --danger: #c63f2e;
  --danger-hover: #ad3424;
  --danger-soft: #fbeae7;
  --warn: #9a6408;
  --warn-soft: #fbf1dc;
  --info: #2a62a8;
  --info-soft: #e7eef8;
  --star: #b7791f;
  --shadow: 0 1px 2px rgba(20, 22, 21, .05), 0 4px 16px rgba(20, 22, 21, .04);
  --shadow-lg: 0 10px 40px rgba(20, 22, 21, .16);
  --radius: 10px;
  --radius-sm: 7px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e100f; --surface: #161918; --surface-2: #1a1d1c; --sunken: #121413;
    --border: #262b29; --border-strong: #343a37;
    --ink: #eceeed; --ink-2: #a9afac; --muted: #7b827e;
    --accent: #2fa67a; --accent-hover: #38b586; --accent-ink: #04140d; --accent-soft: #15291f; --chart: #2fa67a;
    --danger: #e0604f; --danger-hover: #ea7062; --danger-soft: #2c1714;
    --warn: #d9a441; --warn-soft: #2a2110; --info: #6d9fe0; --info-soft: #142033; --star: #d9a441;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e100f; --surface: #161918; --surface-2: #1a1d1c; --sunken: #121413;
  --border: #262b29; --border-strong: #343a37;
  --ink: #eceeed; --ink-2: #a9afac; --muted: #7b827e;
  --accent: #2fa67a; --accent-hover: #38b586; --accent-ink: #04140d; --accent-soft: #15291f; --chart: #2fa67a;
  --danger: #e0604f; --danger-hover: #ea7062; --danger-soft: #2c1714;
  --warn: #d9a441; --warn-soft: #2a2110; --info: #6d9fe0; --info-soft: #142033; --star: #d9a441;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; } /* default icon size; components override */
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
a.link { color: var(--accent); text-decoration: none; }
a.link:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Shell ───────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 650; font-size: 15px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand-mark svg { width: 16px; height: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.phone-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--danger); }
.dot.live { background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(198, 63, 46, .45); } 50% { box-shadow: 0 0 0 5px rgba(198, 63, 46, 0); } }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 0 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 28px 32px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* Live call bar shown on every page while a call is active */
.callbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 10px 32px; background: var(--ink); color: var(--bg); font-weight: 500;
}
.callbar .grow { color: var(--bg); opacity: .85; }
.callbar .btn { --b: transparent; }

/* ── Controls ────────────────────────────────────────────── */
.btn {
  --b: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--b);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--sunken); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { --b: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { --b: var(--danger); background: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.btn.ghost { --b: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.subtle-danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: var(--radius); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.on { background: var(--ink); color: var(--bg); --b: var(--ink); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 7px 10px; min-height: 34px; width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); margin: 0; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
label.check input { margin-top: 2px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search input { padding-left: 32px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 9px; border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; font: inherit; font-weight: 550; font-size: 13px; color: var(--ink-2); padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; flex: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; border: 0; padding: 0; min-height: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── Surfaces ────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 15px; }
.empty .btn { margin-top: 14px; }

.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; align-items: flex-start; border: 1px solid transparent; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.notice.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.notice.ok { background: var(--accent-soft); color: var(--accent); }
.notice b { font-weight: 600; }
.notice .ink { color: var(--ink); }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ready { background: var(--accent-soft); color: var(--accent); }
.badge.needs_tps { background: var(--warn-soft); color: var(--warn); }
.badge.invalid { background: var(--danger-soft); color: var(--danger); }
.badge.dnc { background: var(--ink); color: var(--bg); }
.badge.called { background: var(--info-soft); color: var(--info); }
.badge.interested { background: #fdf3d9; color: #8a5a00; }
:root[data-theme="dark"] .badge.interested { background: #2b230f; color: #e6b54f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.interested { background: #2b230f; color: #e6b54f; } }
.badge.checking { background: var(--sunken); color: var(--muted); }
.badge.mode-ai { background: var(--info-soft); color: var(--info); }
.badge.mode-human { background: var(--sunken); color: var(--ink-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.chip.active .count { color: inherit; opacity: .7; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 550; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.selected td { background: var(--accent-soft); }
.table td.check, .table th.check { width: 36px; padding-right: 0; }
.cell-title { font-weight: 550; }
.cell-sub { color: var(--muted); font-size: 12.5px; }

.bulkbar { position: sticky; bottom: 16px; z-index: 20; margin: 12px auto 0; width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.bulkbar .btn { --b: transparent; background: transparent; color: var(--bg); }
.bulkbar .btn:hover { background: rgba(255,255,255,.12); }
.bulkbar .sep { width: 1px; height: 20px; background: rgba(255,255,255,.2); margin: 0 4px; }

/* ── Progress ────────────────────────────────────────────── */
.progress { height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s ease; }

/* ── Modal & drawer ──────────────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(14, 16, 15, .38); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: rise .16s ease; border: 1px solid var(--border); }
.modal.lg { width: min(980px, 100%); }
.modal-head { padding: 18px 20px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal-head p { color: var(--muted); margin-top: 4px; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.drawer-overlay { justify-content: flex-end; padding: 0; align-items: stretch; }
.drawer { width: min(560px, 100%); background: var(--surface); height: 100%; overflow: auto; box-shadow: var(--shadow-lg); animation: slide .18s ease; border-left: 1px solid var(--border); }
.drawer-head { position: sticky; top: 0; background: var(--surface); padding: 18px 20px 14px; border-bottom: 1px solid var(--border); z-index: 2; }
.drawer-body { padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 380px; animation: rise .16s ease; display: flex; gap: 10px; align-items: center; }
.toast.error { background: var(--danger); color: #fff; }
.toast .btn { height: 26px; }

/* ── Key-value ───────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ── Login ───────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login .brand { padding: 0 0 22px; }

/* ── Dashboard ───────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 620; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 12px; font-size: 13.5px; }
.funnel-track { height: 22px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.funnel-bar { height: 100%; background: var(--chart); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .5s ease; }
.funnel-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-row .v small { color: var(--muted); margin-left: 6px; }

.hours { display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px; align-items: end; height: 150px; padding-top: 10px; position: relative; }
.hour { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; position: relative; cursor: default; }
.hour .bar { width: 70%; max-width: 26px; background: var(--chart); border-radius: 4px 4px 0 0; min-height: 2px; }
.hour .bar.zero { background: var(--border); }
.hour .lab { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hour:hover .bar { filter: brightness(1.15); }
.hour .tip { display: none; position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 7px; font-size: 12px; white-space: nowrap; z-index: 5; pointer-events: none; }
.hour:hover .tip { display: block; }
.hours-axis { border-top: 1px solid var(--border); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }

/* ── Lists page ──────────────────────────────────────────── */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 34px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--accent); }
.dropzone h3 { margin-top: 8px; font-size: 15px; }
.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.list-card { padding: 16px 18px; cursor: pointer; transition: border-color .15s, transform .1s; text-decoration: none; display: block; }
.list-card:hover { border-color: var(--border-strong); }
.list-card .stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.preview-table { font-size: 12.5px; }
.preview-table th.mapped { color: var(--accent); }
.preview-table td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* ── Dialer ──────────────────────────────────────────────── */
.dialer-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.clocks { display: flex; gap: 14px; align-items: center; margin-left: auto; font-size: 13px; color: var(--ink-2); }
.clock { white-space: nowrap; }
.clock b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.dialer { display: grid; grid-template-columns: 270px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.queue { max-height: calc(100vh - 150px); display: flex; flex-direction: column; position: sticky; top: 16px; }
.queue-list { overflow: auto; }
.queue-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; border-left: 3px solid transparent; }
.queue-item:hover { background: var(--surface-2); }
.queue-item.current { background: var(--accent-soft); border-left-color: var(--accent); }
.queue-item .b { font-weight: 550; }
.lead-card { padding: 22px 24px; }
.lead-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.lead-phone { font-size: 20px; font-variant-numeric: tabular-nums; font-weight: 550; margin-top: 6px; letter-spacing: .01em; }
.lead-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); margin-top: 10px; font-size: 13.5px; }
.lead-meta span { display: inline-flex; align-items: center; gap: 5px; }
.lead-meta svg { width: 15px; height: 15px; color: var(--muted); }
.stars { color: var(--star); font-weight: 600; }
.script { white-space: pre-wrap; line-height: 1.65; font-size: 14.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.script mark { background: var(--accent-soft); color: var(--accent); padding: 0 3px; border-radius: 3px; font-weight: 550; }
.history-item { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.history-item:last-child { border-bottom: 0; }
.callpanel { position: sticky; top: 16px; }
.call-state { text-align: center; padding: 20px 18px 16px; }
.call-state .status { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: inline-flex; gap: 7px; align-items: center; }
.call-state .timer { font-size: 38px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 4px 0 10px; }
.meter { display: flex; gap: 3px; justify-content: center; height: 16px; align-items: flex-end; }
.meter i { width: 4px; border-radius: 2px; background: var(--border-strong); height: 30%; transition: height .08s, background .08s; }
.meter i.on { background: var(--accent); }
.call-btns { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 0 18px; }
.call-btns .btn.lg { width: 100%; }
.call-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 18px 16px; }
.call-tools .btn { width: 100%; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 18px 16px; }
.keypad button { height: 42px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); font: inherit; font-size: 17px; font-weight: 550; cursor: pointer; color: var(--ink); }
.keypad button:hover { background: var(--sunken); }
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.outcome { display: flex; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); min-height: 38px; }
.outcome:hover { border-color: var(--border-strong); background: var(--surface-2); }
.outcome kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.outcome.good { color: var(--accent); }
.outcome.bad { color: var(--danger); }
.outcome.chosen { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.outcome.chosen kbd { color: inherit; background: transparent; border-color: rgba(255,255,255,.3); }
.outcome:disabled { opacity: .4; cursor: not-allowed; }
.countdown { position: fixed; inset: auto 0 28px 0; margin: auto; width: fit-content; z-index: 90; background: var(--ink); color: var(--bg); padding: 12px 14px 12px 18px; border-radius: 12px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-lg); font-weight: 500; }
.countdown .n { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; width: 20px; text-align: center; }
.countdown .btn { --b: rgba(255,255,255,.25); background: transparent; color: var(--bg); }

/* ── Transcript ──────────────────────────────────────────── */
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; padding-right: 4px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; }
.bubble.agent { background: var(--sunken); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.lead { background: var(--accent-soft); color: var(--ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.partial { opacity: .6; font-style: italic; }
.bubble.event { align-self: center; background: transparent; color: var(--muted); font-size: 12px; padding: 2px; }
.transcript-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; max-height: 320px; overflow: auto; }

audio { width: 100%; height: 40px; }

/* ── Settings ────────────────────────────────────────────── */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.tabs-v { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.tabs-v button { text-align: left; border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--ink-2); padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.tabs-v button:hover { background: var(--sunken); color: var(--ink); }
.tabs-v button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; font: inherit; font-weight: 550; color: var(--muted); padding: 10px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 32px; border-radius: 7px; border: 1px solid var(--border-strong); cursor: pointer; font-weight: 550; font-size: 12.5px; user-select: none; }
.days input { display: none; }
.days label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.envcheck { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.envcheck:last-child { border-bottom: 0; }

/* ── Mobile ──────────────────────────────────────────────── */
.tabbar { display: none; }
.queue-toggle { display: none; }
@media (max-width: 1180px) {
  .queue-toggle { display: inline-flex; }
  .dialer { grid-template-columns: minmax(0, 1fr) 320px; }
  .queue { display: none; }
  .dialer.show-queue .queue { display: flex; position: static; max-height: 300px; grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: 18px 16px 96px; }
  .callbar { padding: 10px 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0; font-weight: 550; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: var(--accent); }
  .mobile-top { display: flex !important; }
  .dialer { grid-template-columns: 1fr; }
  .callpanel { position: static; order: -1; }
  .cols-2, .cols-3, .form-grid { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
  .tabs-v { flex-direction: row; overflow-x: auto; position: static; }
  .tabs-v button { white-space: nowrap; }
  .clocks { margin-left: 0; width: 100%; }
  .kv { grid-template-columns: 100px 1fr; }
  .hide-sm { display: none !important; }
  .lead-title { font-size: 21px; }
  .funnel-row { grid-template-columns: 90px 1fr 70px; }
  .toasts { left: 16px; right: 16px; bottom: 80px; align-items: stretch; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
