:root {
  --fog: #edf0f3;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --ink: #16202a;
  --ink-2: #4a5866;
  --ink-3: #7a8794;
  --line: #d9dfe5;
  --line-2: #e7ebef;
  --blue: #2546a8;
  --blue-ink: #ffffff;
  --blue-soft: #e5ebfa;

  --answered: #1e8a5a;
  --noanswer: #b7791f;
  --cancelled: #c2413a;
  --voicemail: #6d5bd0;
  --other: #8a96a3;
  --invalid: #4a5866;

  --answered-soft: #e2f3ea;
  --cancelled-soft: #fbe9e7;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(22, 32, 42, 0.06), 0 8px 24px rgba(22, 32, 42, 0.06);
  --font: "Schibsted Grotesk", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fog: #0f151c;
    --panel: #161e27;
    --panel-2: #1b2530;
    --ink: #e7edf3;
    --ink-2: #a9b6c3;
    --ink-3: #7c8a98;
    --line: #2a3542;
    --line-2: #222c37;
    --blue: #7d9cf0;
    --blue-ink: #0f151c;
    --blue-soft: #1f2b4a;
    --answered: #4cc38a;
    --noanswer: #e0a64a;
    --cancelled: #ef7b72;
    --voicemail: #a495f2;
    --other: #6f7c89;
    --invalid: #a9b6c3;
    --answered-soft: #16342a;
    --cancelled-soft: #3a1f1e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--fog);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.cell-time, .num, .cell-phone, .legend b { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--radius-s);
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--blue); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; color: var(--ink); }
.btn-danger-quiet { color: var(--cancelled); }
.btn-danger-quiet:hover { border-color: var(--cancelled); background: var(--cancelled-soft); }
.btn-sm { padding: 6px 12px; font-size: 0.875rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px; line-height: 0; }
.btn-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
input {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 9px 11px;
  min-width: 0;
}
input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.req { font-weight: 500; color: var(--ink-3); }
.form-error { color: var(--cancelled); font-size: 0.875rem; min-height: 1.25em; }
.hint { color: var(--ink-2); font-size: 0.875rem; max-width: 62ch; }
.hint.warn { color: var(--noanswer); }

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--blue);
  display: grid; place-items: center;
}
.login-mark svg, .brand-mark { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.login-mark svg { width: 28px; height: 28px; stroke: var(--blue-ink); }
.login h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.login-sub { color: var(--ink-2); margin-top: -8px; }
.login-foot { text-align: center; color: var(--ink-3); font-size: 0.8125rem; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.0625rem; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; stroke: var(--blue); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user { color: var(--ink-2); font-size: 0.875rem; }

/* ---------- dialer band ---------- */

.dialer { background: var(--panel); border-bottom: 1px solid var(--line-2); }
.dialer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.dialer-state { display: flex; align-items: center; gap: 20px; }
.dialer-label { color: var(--ink-3); font-size: 0.875rem; font-weight: 600; }
.dialer-status { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.dialer-meta { color: var(--ink-2); margin-top: 4px; }
.dialer-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dialer-checked { color: var(--ink-3); font-size: 0.8125rem; }

.pulse {
  position: relative;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--other);
  flex: none;
}
.pulse[data-state="running"] { background: var(--answered); }
.pulse[data-state="talking"] { background: var(--blue); }
.pulse[data-state="stopped"] { background: var(--cancelled); }
.pulse[data-state="paused"] { background: var(--noanswer); }
.pulse[data-state="running"]::after,
.pulse[data-state="talking"]::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid currentColor;
  color: var(--answered);
  opacity: 0;
  animation: ring 2.4s ease-out infinite;
}
.pulse[data-state="talking"]::after { color: var(--blue); }
@keyframes ring {
  0% { transform: scale(0.6); opacity: 0.7; }
  80%, 100% { transform: scale(1.5); opacity: 0; }
}

#dialer-toggle[data-action="off"] { color: var(--cancelled); }
#dialer-toggle[data-action="off"]:hover { border-color: var(--cancelled); background: var(--cancelled-soft); }
#dialer-toggle[data-action="on"] { background: var(--answered); border-color: var(--answered); color: #fff; }

/* ---------- tabs ---------- */

.tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.tab {
  font: inherit;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 16px 12px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); }

.content { max-width: 1200px; margin: 0 auto; padding: 20px 24px 64px; }
.panel { display: flex; flex-direction: column; gap: 20px; }

/* ---------- filters ---------- */

.filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filters .grow { flex: 1 1 200px; max-width: 280px; }

/* ---------- tape (signature) ---------- */

.tape-wrap {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-m);
  padding: 20px 20px 12px;
}
.tape-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.875rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend b { color: var(--ink); font-weight: 700; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--other); }

.tape {
  position: relative;
  height: 64px;
  border-radius: var(--radius-s);
  background:
    repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(100% / var(--slots, 24))),
    var(--panel-2);
}
.tick {
  position: absolute;
  bottom: 0;
  width: var(--tick-w, 3px);
  margin-left: calc(var(--tick-w, 3px) / -2);
  border-radius: 2px 2px 0 0;
  background: var(--other);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s;
  transform-origin: bottom;
}
.tick:hover, .tick:focus-visible { transform: scaleX(2); z-index: 1; }
.tape-axis { position: relative; height: 20px; font-size: 0.75rem; color: var(--ink-3); }
.tape-axis span { position: absolute; transform: translateX(-50%); top: 4px; }

.r-answered { --c: var(--answered); }
.r-noanswer { --c: var(--noanswer); }
.r-cancelled { --c: var(--cancelled); }
.r-voicemail { --c: var(--voicemail); }
.r-invalid { --c: var(--invalid); }
.r-other { --c: var(--other); }
.tick, .swatch, .chip::before { background: var(--c, var(--other)); }

/* ---------- table ---------- */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-m);
  overflow-x: auto;
}
table.calls { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.calls th {
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.calls td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.calls tbody tr { cursor: pointer; }
.calls tbody tr:hover { background: var(--panel-2); }
.calls tbody tr:last-child td { border-bottom: none; }
.calls .num { text-align: right; }
.cell-phone { white-space: nowrap; }
.cell-time { white-space: nowrap; font-weight: 600; }
.cell-time small { display: block; font-weight: 400; color: var(--ink-3); }
.lead-name { font-weight: 600; }
.lead-no { color: var(--ink-3); font-size: 0.8125rem; }
.retry { color: var(--ink-3); font-size: 0.8125rem; }
.muted { color: var(--ink-3); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
  white-space: nowrap;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip.r-answered { font-weight: 600; color: var(--answered); }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }

/* ---------- lead forms ---------- */

.lead-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.card {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-m);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-quiet { background: var(--panel-2); }
.card .btn { align-self: flex-start; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: span 2; }

/* ---------- audit ---------- */

.audit-head { display: flex; flex-direction: column; gap: 6px; }
.audit { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-m); }
.audit li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.audit li:last-child { border-bottom: none; }
.audit time { color: var(--ink-3); font-size: 0.875rem; }
.audit .what { font-weight: 600; }
.audit .who { color: var(--ink-2); font-size: 0.875rem; }
.audit .fail { color: var(--cancelled); }
.audit details { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.audit summary { cursor: pointer; }
.audit pre { white-space: pre-wrap; word-break: break-word; background: var(--panel-2); padding: 10px; border-radius: var(--radius-s); margin: 6px 0 0; font-size: 0.8125rem; }

/* ---------- drawer ---------- */

.drawer { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(15, 21, 28, 0.35); opacity: 0; transition: opacity 0.2s; }
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.22s ease-out;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-scrim { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; }
.drawer-kicker { color: var(--ink-3); font-size: 0.875rem; }
.drawer-head h2 { font-size: 1.375rem; font-weight: 800; }
.drawer-phone { color: var(--ink-2); }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.schedule { display: flex; gap: 6px; }
.schedule input { padding: 5px 8px; font-size: 0.875rem; }
.drawer-msg { font-size: 0.875rem; min-height: 1.25em; color: var(--ink-2); }
.drawer-msg.error { color: var(--cancelled); }
.drawer-sub { font-size: 0.9375rem; font-weight: 700; }
.history { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.history li { position: relative; }
.history li::before {
  content: "";
  position: absolute;
  left: -25px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c, var(--other));
  box-shadow: 0 0 0 3px var(--panel);
}
.history .h-when { font-size: 0.8125rem; color: var(--ink-3); }
.history .h-what { font-weight: 600; }
.history .h-tab { font-size: 0.875rem; color: var(--ink-2); }
.history audio { width: 100%; margin-top: 8px; height: 36px; }
.history .play { margin-top: 6px; }

/* ---------- confirm & toast ---------- */

.confirm {
  border: none;
  border-radius: var(--radius-l);
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.confirm::backdrop { background: rgba(15, 21, 28, 0.45); }
.confirm h2 { font-size: 1.25rem; margin-bottom: 10px; }
.confirm p { color: var(--ink-2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
#confirm-ok.danger { background: var(--cancelled); border-color: var(--cancelled); color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--fog);
  padding: 12px 18px;
  border-radius: var(--radius-m);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--cancelled); color: #fff; }

/* ---------- refine filters ---------- */

select, textarea {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 9px 11px;
  min-width: 0;
}
textarea { resize: vertical; line-height: 1.45; }
select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--panel); padding: 3px; gap: 2px; align-self: flex-end; }
.seg-btn { font: inherit; font-weight: 600; font-size: 0.875rem; color: var(--ink-2); background: none; border: none; border-radius: 4px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue); }

.refine {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-m);
}
.refine .grow { flex: 1 1 240px; }
.time-range { display: flex; gap: 6px; }
.time-range input { width: 76px; }

.legend { gap: 6px; }
.legend-btn {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.legend-btn:hover { border-color: var(--line); }
.legend-btn[aria-pressed="true"] { border-color: var(--c); background: var(--panel-2); color: var(--ink); }
.legend-btn[aria-pressed="false"].dim { opacity: 0.45; }
.legend-btn b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.tick.faded { opacity: 0.15; }

/* ---------- lead form ---------- */

.lead-form fieldset { border: none; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.lead-form legend { font-weight: 700; font-size: 0.9375rem; padding: 0; margin-bottom: 4px; float: left; width: 100%; }
.lead-form legend + * { clear: both; }
.lead-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 16px; }

.slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.slots:empty { display: none; }
.slots li { display: flex; align-items: center; gap: 8px; }
.slots .n { width: 22px; color: var(--ink-3); font-size: 0.875rem; text-align: right; font-variant-numeric: tabular-nums; }
.slots .br-date { flex: none; width: 150px; }
.slots .br-time { flex: none; width: 76px; }
.slots .say { color: var(--ink-2); font-size: 0.875rem; flex: 1; }
.slots .say.bad { color: var(--cancelled); }

.api-code {
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  padding: 12px;
  margin: 8px 0 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ---------- API docs ---------- */

.api-intro { gap: 14px; }
.api-cred { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.api-label { font-size: 0.8125rem; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.api-key-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.api-key-row > div:first-child { min-width: 0; }
.api-key-actions { display: flex; gap: 6px; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.875em; overflow-wrap: anywhere; }
.api-key { display: block; }
.api-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.api-toc a { font-size: 0.8125rem; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--panel); }
.api-toc a:hover { color: var(--ink); border-color: var(--ink-3); }
.api-endpoints { display: flex; flex-direction: column; gap: 16px; }
.endpoint { scroll-margin-top: 16px; }
.endpoint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.method { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; color: #fff; background: var(--blue); }
.method.get { background: var(--answered); }
.method.delete { background: var(--cancelled); }
.endpoint-path { font-size: 0.9375rem; font-weight: 600; }
.endpoint h3 { font-size: 1rem; }
.endpoint table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.endpoint th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 0.8125rem; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.endpoint td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.endpoint td:first-child { white-space: nowrap; }
.endpoint .sub { font-size: 0.8125rem; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.code-wrap { position: relative; }
.code-wrap .copy { position: absolute; top: 14px; right: 8px; }

/* ---------- BR date/time fields ---------- */

.dt-field { position: relative; display: inline-flex; align-items: center; }
.dt-field .br-date { width: 150px; padding-right: 36px; }
.dt-pick {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  border: none; background: none; color: var(--ink-3); border-radius: 4px; cursor: pointer; padding: 0;
}
.dt-pick:hover { color: var(--ink); background: var(--panel-2); }
.dt-pick svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.dt-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.br-time { width: 76px; font-variant-numeric: tabular-nums; }
.br-date { font-variant-numeric: tabular-nums; }
input.invalid { border-color: var(--cancelled); }
input.invalid:focus-visible { box-shadow: 0 0 0 3px var(--cancelled-soft); }
.schedule { align-items: center; }
.schedule .br-date { width: 150px; }
.slots .dt-field + .br-time { margin-left: 2px; }

/* ---------- audit days ---------- */

.audit-count { color: var(--ink-2); font-size: 0.875rem; margin-bottom: -8px; }
.audit-days { display: flex; flex-direction: column; gap: 20px; }
.audit-day h3 { font-size: 0.9375rem; font-weight: 700; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.audit-day h3 span { color: var(--ink-3); font-weight: 500; font-size: 0.8125rem; }
.audit li { grid-template-columns: 90px 1fr; }

/* ---------- pager ---------- */

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -4px; }
.pg-info { color: var(--ink-2); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.pg-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg-num {
  font: inherit; font-size: 0.875rem; font-weight: 600; font-variant-numeric: tabular-nums;
  min-width: 34px; height: 32px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-s);
  background: none; color: var(--ink-2); cursor: pointer;
}
.pg-num:hover { background: var(--panel); border-color: var(--line); color: var(--ink); }
.pg-num[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.pg-gap { color: var(--ink-3); padding: 0 4px; }

/* ---------- webhooks ---------- */

.wh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.wh-head > div { display: flex; flex-direction: column; gap: 6px; max-width: 70ch; }
.wh-poller { color: var(--ink-3); font-size: 0.8125rem; }
.wh-form h3, .wh-secret h3 { font-size: 1rem; }
.wh-form fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wh-form legend { font-weight: 600; font-size: 0.875rem; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.wh-event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 16px; padding-left: 24px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; color: var(--ink); }
label.check input { margin-top: 3px; accent-color: var(--blue); }
label.check code { font-size: 0.8125rem; color: var(--ink-2); margin-right: 4px; }
.wh-form-actions { display: flex; gap: 8px; }
.wh-secret { border-color: var(--noanswer); background: var(--panel); }
.wh-secret-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wh-secret-row code { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 8px 10px; flex: 1; min-width: 0; }
.wh-secret .btn-ghost { align-self: flex-start; }

.wh-list { display: flex; flex-direction: column; gap: 12px; }
.wh-card { gap: 12px; padding: 18px 20px; }
.wh-card.paused { background: var(--panel-2); }
.wh-card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wh-card-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wh-desc { font-weight: 700; }
.wh-url { color: var(--ink-2); font-size: 0.8125rem; }
.wh-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.wh-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tag-warn { color: var(--noanswer); border-color: var(--noanswer); font-family: var(--font); }
.wh-stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.875rem; color: var(--ink-2); }
.wh-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.wh-stats b.fail { color: var(--cancelled); }

.chip.d-ok { --c: var(--answered); color: var(--answered); font-weight: 600; }
.chip.d-pending { --c: var(--noanswer); color: var(--noanswer); }
.chip.d-failed { --c: var(--cancelled); color: var(--cancelled); font-weight: 600; }

.wh-log-head { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.deliveries { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-m); }
.deliveries li { border-bottom: 1px solid var(--line-2); }
.deliveries li:last-child { border-bottom: none; }
.deliveries summary {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) minmax(0, 220px) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  cursor: pointer;
  list-style: none;
}
.deliveries summary::-webkit-details-marker { display: none; }
.deliveries summary:hover { background: var(--panel-2); }
.deliveries time { color: var(--ink-3); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.d-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-what code { font-weight: 600; }
.d-to { color: var(--ink-2); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.d-body .btn { align-self: flex-start; margin-top: 6px; }
.d-meta { color: var(--ink-2); font-size: 0.875rem; }
.sub { font-size: 0.8125rem; font-weight: 700; color: var(--ink-2); }
#d-more { align-self: center; }

/* ---------- event format viewer ---------- */

.fmt { gap: 18px; }
.fmt-head { display: flex; flex-direction: column; gap: 6px; }
.fmt-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.fmt-events { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; }
.fmt-ev {
  font: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 12px; border-radius: var(--radius-s);
  border: 1px solid transparent; background: none; color: var(--ink-2);
}
.fmt-ev code { font-weight: 600; color: var(--ink); font-size: 0.8125rem; }
.fmt-ev span { font-size: 0.8125rem; }
.fmt-ev:hover { background: var(--panel-2); }
.fmt-ev[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); }
.fmt-ev[aria-pressed="true"] code { color: var(--blue); }
.fmt-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fmt-when { font-weight: 600; }
.fmt-sub-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.fmt-fields { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.fmt-fields th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 0.8125rem; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.fmt-fields td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.fmt-fields td:first-child { white-space: nowrap; }

/* ---------- automations ---------- */

.auto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.auto-rule { gap: 14px; }
.auto-rule.off .auto-row, .auto-rule.off .auto-next { opacity: 0.5; }
.auto-rule-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auto-rule h3, .auto-argus h3, .auto-hist-title { font-size: 1rem; }
.auto-hist-title { margin-bottom: 8px; }
.auto-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.auto-days { display: flex; gap: 4px; flex-wrap: wrap; }
.auto-day {
  font: inherit; font-size: 0.8125rem; font-weight: 600; min-width: 42px; padding: 8px 6px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--panel); color: var(--ink-3); cursor: pointer;
}
.auto-day[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.auto-next { font-weight: 600; }
.auto-last { color: var(--ink-2); font-size: 0.875rem; }
.auto-last.fail { color: var(--cancelled); }
.auto-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.auto-actions .form-error { min-height: 0; }
.switch { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background-color 0.15s; margin: 0; border: none; padding: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked { background: var(--answered); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; box-shadow: none; }
.auto-argus { gap: 10px; background: var(--panel-2); }
.auto-argus-times { display: flex; gap: 32px; flex-wrap: wrap; margin: 4px 0 0; }
.auto-argus-times dt { color: var(--ink-3); font-size: 0.8125rem; }
.auto-argus-times dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.auto-argus-note:empty, #auto-argus-note:empty { display: none; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .lead-grid { grid-template-columns: 1fr; }
  .lead-side { position: static; }
  .auto-grid { grid-template-columns: 1fr; }
  .api-cred { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar, .dialer-inner, .tabs, .content { padding-left: 16px; padding-right: 16px; }
  .user { display: none; }
  .dialer-status { font-size: 1.75rem; }
  .dialer-actions { align-items: stretch; width: 100%; }
  .fields { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .audit li { grid-template-columns: 1fr; gap: 4px; }
  .deliveries summary { grid-template-columns: 1fr auto; }
  .fmt-grid { grid-template-columns: 1fr; }
  .fmt-events { position: static; flex-direction: row; flex-wrap: wrap; }
  .fmt-ev { flex: none; }
  .fmt-ev span { display: none; }
  .d-to { display: none; }
  .wh-event-list { grid-template-columns: 1fr; padding-left: 0; }
  .calls th:nth-child(6), .calls td:nth-child(6) { display: none; }
  .tape-axis span:nth-child(odd) { display: none; }
}

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

.audit:empty, .deliveries:empty { display: none; }
