:root {
  /*
   * Visual language ported from LeadsFlows (apps/web/app/globals.css):
   * navy #0b2d5b · blue #2563eb · ink #0a1830 ·
   * slate #64748b · mist #e2e8f0 · green #138a5b. Plain CSS, no build step;
   * Manrope is used when installed — the CSP allows no external fonts.
   */
  --font: Manrope, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text: #0a1830;
  --text-strong: #0a1830;
  --label: #0b2d5b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-light: #edf1f7;
  --line-strong: #cbd5e1;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --sidebar: #0a2344;
  --sidebar-text: #a9c5ed;
  --sidebar-line: #83b8ff;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --lf-navy: #0b2d5b;
  --navy: var(--lf-navy);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf1ff;
  --accent-line: #dce9ff;
  --warn-bg: #fef3c7;
  --warn-text: #b45309;
  --warn-line: #fde68a;
  --warn-dot: #f59e0b;
  --ok-bg: #dcf5ea;
  --ok-text: #138a5b;
  --ok-line: #bbf7d0;
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;
  --danger-line: #fecaca;
  --shadow: 0 1px 2px rgba(11, 45, 91, 0.04), 0 1px 3px rgba(11, 45, 91, 0.06);
  --shadow-md: 0 18px 50px -24px rgba(11, 45, 91, 0.22);
  --shadow-lg: 0 28px 60px -30px rgba(18, 56, 102, 0.36);
  --focus-ring: 0 0 0 2px #fff, 0 0 0 4px rgba(37, 99, 235, 0.32);
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 28px;
  --space-7: 40px;
  --h1: 1.5rem;
  --h2: 1.125rem;
  --h3: 0.875rem;
  --sidebar-width: 248px;
  --topbar-height: 64px;
  color: var(--text);
  background: var(--bg);
  color-scheme: light;
  font-family: var(--font);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-size: 14px; line-height: 1.5; min-height: 100vh;
  background: radial-gradient(ellipse at 85% -10%, #e3edff, transparent 50%), linear-gradient(180deg, #f6f9fe 0%, var(--bg) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.hidden { display: none !important; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  background:
    repeating-radial-gradient(circle at 100% 100%, transparent 0 46px, rgba(131, 184, 255, 0.05) 46px 47px),
    radial-gradient(ellipse at 0% 0%, #1d4f9a 0%, transparent 55%),
    var(--sidebar);
  color: #e9eef9;
  width: var(--sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  padding: 28px 14px 20px;
  flex-shrink: 0;
}
.identity { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--sidebar-text);
  opacity: 0.7;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 14px 12px;
}
#navigation, .sidebar-footer { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--sidebar-hover); color: white; }
.nav-link .nav-icon { color: var(--sidebar-line); }
.nav-link:hover .nav-icon, .nav-link.active .nav-icon { color: white; }
.nav-link.active {
  background: linear-gradient(145deg, #3b82f6 0%, var(--accent) 55%, var(--accent-hover) 100%);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
  color: white;
}
.nav-icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-note {
  margin: auto 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  font-weight: 600;
}
.sidebar-note small { display: block; color: var(--sidebar-text); margin: 8px 0 0 16px; font-size: 12px; line-height: 1.4; font-weight: 450; }
.dot, .pill-dot { display: inline-block; background: var(--warn-dot); width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.app { flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 5;
}
.breadcrumbs { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.breadcrumbs strong { color: var(--text-strong); font-weight: 600; }
.slash { color: var(--line-strong); }
.top-actions { display: flex; align-items: center; gap: 16px; }
.pill {
  display: flex; align-items: center; border-radius: 999px; padding: 6px 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: 0.025em;
}
.pill-dot { width: 6px; height: 6px; background: var(--accent); margin-right: 7px; }
.quiet { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.quiet:hover { color: var(--text-strong); }
/* Full width, aligned with the top bar: the same side padding, no centred column. */
main { width: 100%; margin: 0; padding: 32px var(--space-6) 64px; flex: 1; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-5); }
.eyebrow { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 6px; }
h1 { font-size: var(--h1); font-weight: 700; letter-spacing: -0.025em; color: var(--text-strong); line-height: 1.2; margin: 0; }
.hero p:not(.eyebrow) { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.mode-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.025em; color: var(--warn-text); background: var(--warn-bg);
  border: 0; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.mode-badge span { color: var(--warn-dot); margin-left: 4px; }
.intro {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--label); font-size: 13px; margin-bottom: var(--space-4);
}
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: var(--space-4); }
.kpi, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi { padding: 18px 20px; min-width: 0; position: relative; overflow: hidden; transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.kpi:hover { border-color: #cfdcf6; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi span, .kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin: 10px 0 4px; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; color: var(--text-strong); }
.kpi small { line-height: 1.4; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { padding: 24px; margin-bottom: 16px; min-width: 0; }
.grid-two > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .section-title { font-size: var(--h2); font-weight: 600; letter-spacing: -0.02em; color: var(--text-strong); margin: 0 0 4px; }
.card-head p, .section-title + p { font-size: 13px; color: var(--muted); margin: 0; }
h3 { margin: 0; font-size: var(--h3); font-weight: 600; color: var(--text-strong); }
.status-tag, .badge {
  display: inline-flex; align-items: center; border: 1px solid var(--line-light); background: var(--surface-soft);
  color: var(--muted); white-space: nowrap; border-radius: 999px; padding: 4px 10px; font-weight: 600; font-size: 11px; letter-spacing: 0.025em;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.badge.muted { background: var(--surface-soft); color: var(--muted); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-line); }
.facts { margin: 0; display: grid; }
.facts div { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-top: 1px solid var(--line-light); padding: 10px 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { font-size: 13px; color: var(--text); font-weight: 600; margin: 0; text-align: right; overflow-wrap: anywhere; }
code { font-size: 12px; }
.warning-text, .hint {
  background: var(--warn-bg); color: var(--warn-text); border-left: 3px solid var(--warn-line);
  padding: 10px 12px; font-size: 12px; border-radius: 4px; margin: 12px 0 0; line-height: 1.5;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field span, .check-line { font-size: 13px; font-weight: 500; color: var(--label); }
.field.wide, .form-actions, .span-2, .form-grid > .wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .inline-form input, .filter-bar input, .login-card input {
  min-width: 0; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text); outline: none; font-size: 14px; box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; line-height: 1.55; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus, .filter-bar input:focus, .login-card input:focus {
  border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11, 45, 91, 0.15);
}
.field input:disabled, .field textarea:disabled, .field select:disabled { background: var(--surface-soft); color: var(--muted); }
.checkbox-field, .check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label); font-weight: 500; }
.checkbox-field input, .check-line input { accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line-light); padding-top: 14px; }
.primary, .secondary-button, .quiet-button, .danger-button, .pause-button {
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; min-height: 40px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.primary { border: 1px solid var(--accent); background: var(--accent); color: white; padding: 10px 16px; box-shadow: var(--shadow); }
.primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.primary:active:not(:disabled) { transform: scale(0.98); }
.primary span { margin-left: 16px; }
.secondary-button, .quiet-button { background: white; color: var(--accent); border: 1px solid var(--line); padding: 8px 14px; }
.secondary-button:hover:not(:disabled), .quiet-button:hover:not(:disabled) { background: var(--surface-soft); }
.danger-button { background: white; color: var(--danger-text); border: 1px solid var(--danger-line); padding: 8px 14px; }
.danger-button:hover:not(:disabled) { background: var(--danger-bg); }
.muted { color: var(--muted); font-size: 12px; }
.inline-form, .filter-bar, .toolbar, .action-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-row.spaced { margin-top: 12px; }
.inline-form input, .filter-bar input { flex: 1; }
.toolbar { justify-content: space-between; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-light); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; background: var(--surface-soft); }
tr:last-child td { border-bottom: 0; }
.empty { border: 1px dashed var(--line-strong); background: rgba(247, 249, 252, 0.8); border-radius: var(--radius); padding: 40px 32px; text-align: center; }
.empty strong { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.empty p { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.plain-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.tabs, .subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button, .tabs a, .subnav button, .subnav a {
  border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; text-decoration: none;
}
.tabs button.active, .tabs a.active, .tabs a:hover, .subnav button.active, .subnav a:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.block { scroll-margin-top: 84px; padding-top: 4px; }
.version-row, .campaign { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-light); padding: 12px 0; }
.footnote { padding: 12px 14px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 12px; border-radius: var(--radius-sm); }
.login-card {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius-lg); max-width: 440px;
  margin: 48px auto 24px; padding: 32px; box-shadow: var(--shadow-lg);
}
.login-symbol { margin-bottom: 12px; line-height: 0; }
.login-card h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
.login-card p { font-size: 13px; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.login-card label { font-size: 13px; font-weight: 500; color: var(--label); }
.login-card button { margin-top: 6px; justify-content: center; width: 100%; }
.login-brand { font-size: 20px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.02em; }
.login-brand span { color: var(--accent); }
.login-card .login-foot { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line-light); font-size: 12px; color: var(--faint); text-align: center; }
/* Signed out: a standalone login screen, no sidebar or workspace chrome. */
body.auth-locked {
  background: radial-gradient(1200px 600px at 15% -10%, #2b5b97 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #1d4ed8 0%, transparent 55%), var(--sidebar);
}
body.auth-locked .sidebar, body.auth-locked .topbar, body.auth-locked .mobile-overlay { display: none; }
body.auth-locked .app { background: transparent; }
body.auth-locked main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 16px;
}
body.auth-locked .login-card { width: 100%; margin: 0; padding: 36px 32px 24px; border-color: transparent; }
body.auth-locked .login-symbol { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
body.auth-locked .notice { width: 100%; max-width: 440px; margin: 16px 0 0; }
.notice { padding: 12px 14px; background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-text); margin-bottom: 16px; border-radius: var(--radius-sm); font-size: 13px; }
.notice.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-text); }
footer { border-top: 1px solid var(--line-light); padding: 14px var(--space-6); display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar { width: 220px; }
  main, .topbar, footer { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 56px; padding: 8px 16px; flex-wrap: wrap; gap: 8px; }
  main { padding: 20px 16px 40px; }
  .hero { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.5rem; }
  .kpi-grid, .grid-two, .form-grid { grid-template-columns: 1fr; }
  .card,       footer { padding: 14px 16px; flex-direction: column; }
  table { min-width: 640px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
td .action-row { flex-wrap: wrap; gap: 6px; min-width: 200px; }
td .action-row button, .version-row .action-row button { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.danger-button:disabled { opacity: 0.45; }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 12px; margin: auto -2px 0; }
.provider-field > span { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.provider-field .check-line { margin-top: 2px; font-weight: 500; }

/* Pages instead of popups: links that look like buttons, header actions, crumbs. */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.nav-link, .nav-link:hover { text-decoration: none; }
a.primary, a.secondary-button, a.quiet-button, a.danger-button {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap;
}
a.primary { color: white; }
.hero { align-items: flex-end; }
.hero h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.hero h1 .badge { font-size: 12px; letter-spacing: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.hero-actions:empty { display: none; }
.breadcrumbs { flex-wrap: wrap; min-width: 0; gap: 8px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.tabs { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 18px; }
.row-link { font-weight: 600; color: var(--text); }
.row-link + small, td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.toolbar { gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--line-light); background: var(--surface-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 8px; }
.segmented button.active { background: white; color: var(--text); box-shadow: var(--shadow); }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0 0 16px; counter-reset: step; }
.stepper li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: white; color: var(--muted); font-weight: 600; font-size: 13px; }
.stepper li span { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: 12px; }
.stepper li.current { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.stepper li.current span { background: var(--accent); border-color: var(--accent); color: white; }
.stepper li.done span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-light); font-size: 13px; }
.checklist li:first-child { border-top: 0; }
.checklist .check { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: 11px; font-weight: 700; }
.checklist li.done .check { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.checklist li:not(.done) { color: var(--text); }
.checklist li .muted { margin-left: auto; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-light); font-size: 13px; }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); flex: none; width: 150px; }
.card-foot { margin: 12px 0 0; font-size: 13px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-row div { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat-row strong { display: block; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-row span { color: var(--muted); font-size: 12px; }
.day-row { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: inline-grid; place-items: center; min-width: 44px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--muted); background: white; cursor: pointer; }
.day-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.day-chip input:focus-visible + span { box-shadow: var(--focus-ring); }
.hint.wide, .muted.wide { grid-column: 1 / -1; margin: 0; }
.empty .primary, .empty .secondary-button { margin-top: 14px; }
@media (max-width: 760px) {
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .hero-actions { justify-content: flex-start; }
  .top-actions .mode-badge { display: none; }
  .timeline li { flex-direction: column; gap: 2px; }
  .timeline time { width: auto; }
}

/* CallEngine mark in the LeadsFlows style (apps/web/components/brand/logo-mark.tsx):
   the AI voice (bars) becomes a wave that reaches the call. Intro on load and
   on hover, then the bars keep speaking, a spark runs along the wave and the
   call rings. Static copy: icon.svg. */
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -0.035em; color: #fff; }
.wordmark span { color: var(--sidebar-line); }
.ce-logo { flex: none; overflow: visible; }
.ce-logo .ce-logo-bar { transform-box: fill-box; transform-origin: center; animation: ce-bar-rise 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both, ce-voice 1.1s ease-in-out 1.5s infinite; }
.ce-logo .ce-logo-bar:nth-child(2) { animation-delay: 0.1s, 1.65s; animation-duration: 0.45s, 0.9s; }
.ce-logo .ce-logo-bar:nth-child(3) { animation-delay: 0.2s, 1.8s; animation-duration: 0.45s, 1.3s; }
.ce-logo .ce-logo-wave { animation: ce-draw 0.6s cubic-bezier(0.3, 0, 0.2, 1) 0.35s both; }
.ce-logo .ce-logo-spark { opacity: 0; stroke-dasharray: 0.22 0.78; animation: ce-spark 2.2s linear 1.6s infinite; }
.ce-logo .ce-logo-call { transform-box: view-box; transform-origin: 25px 16px; animation: ce-call-on 0.5s ease-out 0.85s both, ce-call-ring 2.2s ease-in-out 1.6s infinite; }
.ce-logo .ce-logo-ring { transform-box: view-box; transform-origin: 25px 16px; animation: ce-pulse 2.2s ease-out 1.35s infinite; }
@keyframes ce-bar-rise { from { transform: scaleY(0.1); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
@keyframes ce-voice { 0%, 100% { transform: scaleY(1); } 30% { transform: scaleY(0.45); } 60% { transform: scaleY(1.15); } 80% { transform: scaleY(0.7); } }
@keyframes ce-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
@keyframes ce-spark { 0% { opacity: 0; stroke-dashoffset: 0.22; } 8% { opacity: 1; } 50% { opacity: 1; stroke-dashoffset: -0.78; } 55%, 100% { opacity: 0; stroke-dashoffset: -0.78; } }
@keyframes ce-call-on { 0% { opacity: 0; transform: scale(0.3); } 60% { opacity: 1; transform: scale(1.3); } 100% { opacity: 1; transform: scale(1); } }
@keyframes ce-call-ring { 0%, 70%, 100% { rotate: 0deg; } 74% { rotate: -12deg; } 78% { rotate: 10deg; } 82% { rotate: -8deg; } 86% { rotate: 6deg; } 90% { rotate: 0deg; } }
@keyframes ce-pulse { 0% { opacity: 0.9; transform: scale(0.8); } 70%, 100% { opacity: 0; transform: scale(1.6); } }
@media (prefers-reduced-motion: reduce) {
  .ce-logo .ce-logo-bar, .ce-logo .ce-logo-wave, .ce-logo .ce-logo-spark,
  .ce-logo .ce-logo-call, .ce-logo .ce-logo-ring { animation: none; }
}

/* Overview numbers, entity cards, two-column detail pages. */
.kpi-link { color: inherit; text-decoration: none; display: block; }
.kpi-link:hover { text-decoration: none; }
.kpi small { margin-top: 2px; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-light); font-size: 13px; }
.item-list li:first-child { border-top: 0; padding-top: 0; }
.item-list .row-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-list li > span:not(.badge) { color: var(--muted); white-space: nowrap; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.entity-card { display: block; color: inherit; text-decoration: none; margin: 0; transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.entity-card:hover { text-decoration: none; border-color: #cfdcf6; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.entity-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.entity-head > div { flex: 1; min-width: 0; }
.entity-head strong { display: block; font-size: 15px; }
.entity-head small { color: var(--muted); font-size: 12px; }
.avatar { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; color: white; font-weight: 700; font-size: 14px;
  background: linear-gradient(145deg, #3b82f6 0%, var(--accent) 55%, var(--accent-hover) 100%); box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.split > .card { margin-bottom: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* Mobile drawer (LeadsFlows breakpoint): the sidebar slides in under 1024 px. */
.mobile-menu-toggle, .mobile-menu-close, .mobile-overlay { display: none; }
@media (max-width: 1023px) {
  body { background-attachment: scroll; }
  .shell { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 42;
    width: min(320px, 84vw); height: 100dvh; min-height: 0;
    padding: 20px 12px; overflow-y: auto; overflow-x: hidden;
    transform: translateX(-102%); visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .mobile-nav-open .sidebar { transform: translateX(0); visibility: visible; }
  .mobile-nav-open { overflow: hidden; }
  .identity { padding-bottom: 18px; }
  .mobile-menu-close {
    display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.18); color: white;
    border-radius: 10px; min-width: 36px; min-height: 36px; font-size: 22px;
  }
  .mobile-menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 40px; height: 40px; background: white; border: 1px solid var(--line);
    color: var(--navy); border-radius: 12px; font-size: 22px; line-height: 1;
  }
  .mobile-overlay {
    display: block; visibility: hidden; opacity: 0; position: fixed; inset: 0; z-index: 41;
    border: 0; background: rgba(10, 24, 48, 0.52); transition: opacity 0.2s ease, visibility 0.2s;
  }
  .mobile-nav-open .mobile-overlay { visibility: visible; opacity: 1; }
  .topbar { padding: 10px 16px; gap: 12px; justify-content: flex-start; }
  .top-actions { margin-left: auto; }
  main { padding: 20px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .mobile-overlay { transition: none; }
}

/* Unified lists and the script editor. */
.row-actions { flex-wrap: nowrap; justify-content: flex-end; }
td:last-child { width: 1%; white-space: nowrap; }

/* Icon actions in lists. */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line);
  background: white; color: var(--navy); padding: 0; min-height: 0; text-decoration: none; transition: background-color 0.15s ease, border-color 0.15s ease; }
.icon-button:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--line-strong); text-decoration: none; }
.icon-button.danger { color: var(--danger-text); border-color: var(--danger-line); }
.icon-button.danger:hover:not(:disabled) { background: var(--danger-bg); }
.icon-button.play { color: var(--ok-text); border-color: var(--ok-line); }
.icon-button.pause { color: var(--warn-text); border-color: var(--warn-line); }
.icon-button:disabled { opacity: 0.4; cursor: not-allowed; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.play .icon, .start-button .icon { fill: currentColor; stroke-width: 1.2; }
.icon-button.pause .icon, .pause-button .icon { fill: none; stroke: currentColor; stroke-width: 2.2; }
.start-button, .pause-button { display: inline-flex; align-items: center; gap: 8px; }
.start-button { background: #138a5b; border-color: #138a5b; }
.pause-button { background: #b45309; border: 1px solid #b45309; color: white; padding: 10px 16px; box-shadow: var(--shadow); }
.pause-button:hover:not(:disabled) { background: #9a4508; }
.start-button .icon, .pause-button .icon { width: 14px; height: 14px; }

/* Leads: interest select and inline note. */
.outcome-select { border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; background: white; color: var(--text); }
.outcome-select.outcome-interested { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.outcome-select.outcome-not_interested { background: var(--surface-soft); color: var(--muted); }
.outcome-select.outcome-recall { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.campaign-progress-kpis { margin-bottom: 16px; }
.item-list .icon-button { margin-left: 8px; flex-shrink: 0; }
.readonly-block {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--surface-soft); color: var(--muted); white-space: pre-wrap;
  font-size: 13px; line-height: 1.45; max-height: 160px; overflow: auto;
}
.note-input { width: 100%; min-width: 160px; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; font-size: 13px; background: transparent; }
.note-input:hover, .note-input:focus { border-color: var(--line-strong); background: white; outline: none; }
td code + small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- Motion ----------
 * One set of tokens for every transition. app.js never hard-codes a
 * duration: it waits on getAnimations(). Only opacity and transform animate, so nothing reflows.
 * Entrances use fill-mode "backwards": they never hold a transform after
 * they finish, so hover lifts and the mobile drawer keep working.
 * Reduced motion: the global rule above shortens everything; delays are
 * cleared at the end of this section so staggered items never wait. */
:root {
  --motion-fast: 150ms;
  --motion: 260ms;
  --motion-slow: 420ms;
  --motion-leave: 180ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress-grow { from { transform: scaleX(0); } to { transform: scaleX(0.85); } }

/* Page change: content rises in, top-level blocks one after another. */
#workspace.page-enter > * { animation: fade-up var(--motion) var(--ease-out) backwards; }
#workspace.page-enter > :nth-child(2) { animation-delay: 40ms; }
#workspace.page-enter > :nth-child(3) { animation-delay: 80ms; }
#workspace.page-enter > :nth-child(4) { animation-delay: 120ms; }
#workspace.page-enter > :nth-child(n+5) { animation-delay: 160ms; }
#page-head.head-enter { animation: fade-in var(--motion) var(--ease-out) backwards; }

/* Entering the app after login or with a live session. */
.shell.app-enter .topbar { animation: fade-in var(--motion-slow) var(--ease-out) backwards; }
/* Desktop only: below 1024 px the sidebar is an off-canvas drawer moved by transform. */
@media (min-width: 1024px) {
  .shell.app-enter .sidebar { animation: slide-in-left var(--motion-slow) var(--ease-out) backwards; }
}

/* Login card: in on show, out once the workspace is loaded, shake on refusal. */
body.auth-locked .login-card:not(.hidden) { animation: pop-in var(--motion-slow) var(--ease-out) backwards; }
body.auth-locked .login-card.is-leaving { animation: pop-out var(--motion-leave) var(--ease-in) both; }
body.auth-locked .login-card.is-rejected { animation: shake 360ms ease-in-out; }
.notice:not(.hidden) { animation: fade-up var(--motion) var(--ease-out) backwards; }

/* Spinner, used by the boot screen and busy buttons. */
.spinner {
  display: inline-block; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; opacity: 0.85;
  animation: spin 0.7s linear infinite;
}
.login-card button[type="submit"] { display: inline-flex; align-items: center; gap: 10px; }
.login-card button[type="submit"] .spinner { display: none; }
.login-card form.is-busy button[type="submit"] .spinner { display: inline-block; }
.login-card form.is-busy button[type="submit"]:disabled { opacity: 1; cursor: progress; }
.login-card input:disabled { opacity: 0.7; }

/* Boot: shown only while the session check runs, after a short delay so a
 * fast answer never flashes it. The login card waits for the answer too. */
.boot { display: none; }
body.booting .boot {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; color: var(--sidebar-text); font-size: 13px;
  animation: fade-in var(--motion) var(--ease-out) 200ms backwards;
}
body.booting .boot .spinner { width: 28px; height: 28px; border-width: 3px; color: #9ec5ff; }
body.booting #login { display: none; }

/* Top progress bar; the 120 ms delay hides quick requests (app.js: SHOW_DELAY_MS). */
.top-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 50; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), #60a5fa); transform-origin: left; transform: scaleX(0); opacity: 0;
}
.top-progress.is-active { opacity: 1; animation: progress-grow 2.4s var(--ease-out) 120ms both; }
.top-progress.is-done {
  animation: none; transform: scaleX(1); opacity: 0;
  transition: transform var(--motion-fast) var(--ease-out), opacity var(--motion) ease var(--motion-fast);
}

/* Paged call list. */
.list-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 4px 0; font-size: 13px; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  #workspace.page-enter > *, body.booting .boot { animation-delay: 0ms !important; }
  .spinner { animation-duration: 1.4s !important; }
}

/* Orderable lists: a handle per row; the row being dragged fades back. */
.drag-cell { width: 1%; padding-right: 0; }
.drag-handle {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 32px;
  border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: grab; touch-action: none;
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}
.drag-handle .icon { width: 16px; height: 16px; fill: currentColor; }
.drag-handle:hover, .drag-handle:focus-visible { background: var(--surface-soft); color: var(--accent); }
.drag-handle:active { cursor: grabbing; }
tr.is-dragging { opacity: 0.45; }
tr.is-dragging td { background: var(--accent-soft); }
/* Why a field cannot change here. */
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 400; }
.field-hint a { color: var(--accent); }
/* List rows open their record on click. */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--surface-soft); }

/* Account: avatar button in the top bar with a small menu. */
.account { position: relative; }
.account-button {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 1px solid transparent;
  border-radius: 999px; background: transparent; color: var(--text-strong); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.account-button:hover, .account-button[aria-expanded="true"] { background: var(--surface-soft); border-color: var(--line); }
.account-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.account-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; color: var(--muted);
  transition: transform var(--motion-fast) var(--ease-out); }
.account-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #2b5b97, var(--accent)); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent-line);
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  transform-origin: top right;
}
.account-menu.is-open { animation: menu-in var(--motion-fast) var(--ease-out) backwards; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
.account-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line-light); }
.account-head strong { display: block; font-size: 14px; color: var(--text-strong); }
.account-head small { display: block; font-size: 12px; color: var(--muted); }
.account-menu hr { border: 0; border-top: 1px solid var(--line-light); margin: 6px 0; }
.account-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.account-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.account-item:hover, .account-item:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.account-item:hover svg, .account-item:focus-visible svg { color: currentColor; }
.account-item.danger:hover, .account-item.danger:focus-visible { background: var(--danger-bg); color: var(--danger-text); }
@media (max-width: 760px) { .account-name, .chevron { display: none; } }

/* Voiso extension status in the top bar. */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease;
}
.status-pill:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-pill[data-state="online"] { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.status-pill[data-state="online"] .status-dot { background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); animation: status-pulse 2s ease-out infinite; }
.status-pill[data-state="offline"] { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-text); }
.status-pill[data-state="offline"] .status-dot { background: #dc2626; }
.status-pill.is-checking .status-dot { animation: status-blink 0.8s ease-in-out infinite alternate; }
@keyframes status-pulse { to { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); } }
@keyframes status-blink { from { opacity: 1; } to { opacity: 0.25; } }
@media (max-width: 760px) { .status-pill .status-label { display: none; } .status-pill { padding: 8px; } }

/* Agents: one card each, a ⋯ menu, editing in a small dialog. */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.agent-card {
  position: relative; display: flex; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); transition: box-shadow var(--motion-fast) ease, border-color var(--motion-fast) ease, transform var(--motion-fast) ease;
}
.agent-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.agent-card-main { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; padding: 18px 8px 18px 18px; color: inherit; text-decoration: none; }
.agent-card-main strong { display: block; font-size: 15px; color: var(--text-strong); margin-bottom: 4px; }
.agent-card-main code, .agent-card-main .muted { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-menu { position: relative; margin: 12px 10px 0 0; }
.card-menu summary {
  list-style: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 8px; color: var(--muted); cursor: pointer;
}
.card-menu summary::-webkit-details-marker { display: none; }
.card-menu summary:hover, .card-menu[open] summary { background: var(--surface-soft); color: var(--text-strong); }
.card-menu summary .icon { width: 18px; height: 18px; fill: currentColor; }
.card-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 160px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  animation: menu-in var(--motion-fast) var(--ease-out) backwards; transform-origin: top right;
}
.card-menu-item {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.card-menu-item:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.card-menu-item.danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-text); }
.card-menu-item:disabled { color: var(--faint); cursor: not-allowed; }
dialog.modal {
  width: min(480px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal[open] { animation: pop-in var(--motion) var(--ease-out) backwards; }
dialog.modal::backdrop { background: rgba(10, 24, 48, 0.45); backdrop-filter: blur(2px); }
dialog.modal h2 { margin: 0 0 4px; font-size: 18px; }
dialog.modal .form-grid { grid-template-columns: 1fr; }

/* Agent creation: concise three-part form, native accessible modal. */
.agent-create-modal { width: min(720px, calc(100vw - 24px)); max-height: min(90vh, 900px); overflow-y: auto; }
.agent-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px; }
.agent-create-form .wide { grid-column: 1 / -1; }
.agent-modal-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.agent-modal-head h2 { margin: 6px 0 8px; }
.agent-modal-kicker { font-size: 11px; letter-spacing: .09em; font-weight: 700; color: var(--muted); }
.agent-modal-head p { margin: 0; line-height: 1.5; }
.agent-form-section { display: flex; gap: 8px 16px; align-items: baseline; flex-wrap: wrap; margin-top: 8px; }
.agent-form-section strong { font-size: 14px; }
.agent-form-section .muted { font-size: 12px; }
.agent-form-info { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); font-size: 13px; }
.agent-form-info p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.agent-create-form textarea { resize: vertical; }
@media (max-width: 600px) {
  .agent-create-modal { padding: 18px; }
  .agent-create-form { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Dedicated create/edit workspace, no modal sizing constraints. */
.agent-create-page {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.agent-create-page .agent-create-form { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.agent-create-page .agent-create-form .wide { grid-column: 1 / -1; width: 100%; min-width: 0; }
.agent-create-page .agent-create-form .wide .field { width: 100%; }
.agent-create-page .agent-create-form input,
.agent-create-page .agent-create-form select,
.agent-create-page .agent-create-form textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 640px) {
  .agent-create-page { padding: 16px; }
  .agent-create-page .agent-create-form { grid-template-columns: minmax(0,1fr); }
}

/* Pagination: jump straight to any page, even page 12 of 50. */
.call-list-pages { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding:14px 4px; }
.call-pages-count, .call-pages-nav, .call-page-jump { display:flex; align-items:center; gap:9px; }
.call-pages-count { color:var(--muted); font-size:13px; }
.call-pages-count label { margin-left:12px; display:flex; align-items:center; gap:8px; }
.call-pages-count select, .call-page-jump input, .call-pages-nav button {
  min-height:36px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text);
}
.call-pages-count select { padding:4px 9px; }
.call-pages-nav { margin-left:auto; }
.call-pages-nav > button { width:36px; padding:4px; cursor:pointer; font-size:20px; }
.call-pages-nav > button:disabled { opacity:.35; cursor:not-allowed; }
.call-page-jump { margin:0 5px; font-size:13px; white-space:nowrap; }
.call-page-jump input { width:68px; padding:5px 7px; text-align:center; font:inherit; }
.call-page-jump button { padding:5px 12px; cursor:pointer; font-size:13px; font-weight:600; }
@media(max-width:640px) { .call-pages-nav { margin-left:0; } .call-list-pages { justify-content:center; } }

/* Three-zone footer: count left, page navigation centered, page size right. */
.call-list-pages { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:14px; }
.call-pages-count { justify-self:start; }
.call-pages-nav { justify-self:center; margin-left:0; }
.call-pages-size { justify-self:end; display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); white-space:nowrap; }
.call-pages-size select { min-height:36px; padding:5px 9px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text); }
@media(max-width:760px) {
  .call-list-pages { grid-template-columns:1fr auto; }
  .call-pages-count { grid-column:1; }
  .call-pages-size { grid-column:2; grid-row:1; }
  .call-pages-nav { grid-column:1/-1; grid-row:2; justify-self:center; }
}

/* Campaign settings: timezone, single-row weekdays, hours, limits. */
.campaign-settings-form .campaign-days { display:flex; flex-wrap:nowrap; align-items:center; gap:8px; width:100%; overflow-x:auto; padding-bottom:4px; }
.campaign-settings-form .campaign-days .day-chip { flex:1 0 auto; white-space:nowrap; justify-content:center; }
.campaign-settings-form .wide { grid-column:1/-1; }
.campaign-settings-form .wide .field, .campaign-settings-form .wide select { width:100%; }

/* Campaign edit: exactly two columns with weekday chips on the timezone row. */
.campaign-settings-form { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 20px; }
.campaign-settings-form > .field { min-width:0; }
.campaign-settings-form .campaign-days { width:100%;min-width:0;gap:4px;overflow-x:auto;flex-wrap:nowrap; }
.campaign-settings-form .campaign-days .day-chip { flex:1 0 auto;padding-inline:5px; }
.campaign-settings-form input[type=time] { font-variant-numeric:tabular-nums; }
@media(max-width:780px) { .campaign-settings-form { grid-template-columns:minmax(0,1fr); } }

/* Anrufliste: filters next to the search, and the contact on the line now. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar select {
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--text); font-size: 14px; box-shadow: var(--shadow); max-width: 100%;
}
.badge.live { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-line); }
.badge.live::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: var(--accent); vertical-align: 1px; animation: live-pulse 1.2s ease-in-out infinite;
}
tr.is-live td { background: var(--accent-soft); }
@keyframes live-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .badge.live::before { animation: none; } }

/* ---------- Tablet and phone (≤ 1023 px, the drawer breakpoint) ----------
   Kept last so it wins over the desktop rules above. */
@media (max-width: 1023px) {
  /* Tables become a list of cards: label left, value right. */
  .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .table-wrap table { min-width: 0; width: 100%; border-collapse: separate; }
  .table-wrap thead { display: none; }
  .table-wrap tbody, .table-wrap tr { display: block; }
  .table-wrap tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  }
  .table-wrap td {
    display: grid; grid-template-columns: minmax(84px, 34%) minmax(0, 1fr); gap: 10px; align-items: center;
    padding: 6px 0; border: 0; min-width: 0; overflow-wrap: anywhere;
  }
  .table-wrap td::before {
    content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
  }
  .table-wrap td > * { justify-self: start; max-width: 100%; }
  .table-wrap td > select { justify-self: stretch; }
  /* Action cell: a footer row of buttons on the right. */
  .table-wrap td[data-label=""] {
    display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
    margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line-light);
  }
  .table-wrap td[data-label=""]::before { display: none; }
  .table-wrap td:last-child { width: auto; white-space: normal; }
  .icon-button { width: 40px; height: 40px; }
  .table-wrap td[data-label=""] > * { margin: 0; }
  /* Drag handles (first, unlabeled cell) and the running number are desktop-only. */
  .table-wrap td[data-label=""]:first-child { display: none; }
  .table-wrap td[data-label="Nr."] { display: none; }
  .table-wrap td:empty { display: none; }
  .table-wrap td .row-actions, .table-wrap td .action-row { justify-content: flex-end; min-width: 0; }
  .table-wrap td select { width: 100%; }
  .table-wrap tr.is-live { border-color: var(--accent); background: var(--accent-soft); }
  .table-wrap tr.is-live td { background: transparent; }

  /* Campaign settings: weekdays wrap instead of scrolling. */
  .campaign-settings-form .campaign-days { flex-wrap: wrap; overflow: visible; gap: 6px; }
  .campaign-settings-form .campaign-days .day-chip { flex: 1 0 calc(25% - 6px); }
  .campaign-settings-form .campaign-days .day-chip span { width: 100%; }

}
/* Tablets: two cards per row. */
@media (min-width: 640px) and (max-width: 1023px) {
  .table-wrap tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .table-wrap tr { margin-bottom: 0; }
}

/* ---------- Phone layout (≤ 760 px) ---------- */
@media (max-width: 760px) {
  /* Top bar: one line — menu, current page, status, account. */
  .topbar { flex-wrap: nowrap; gap: 10px; }
  .breadcrumbs { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
  .breadcrumbs > :not(:last-child) { display: none; }
  .breadcrumbs strong { overflow: hidden; text-overflow: ellipsis; }
  .top-actions { gap: 10px; flex: none; }

  /* Page head: title left, actions under it, left aligned. */
  .hero, .hero > div { align-items: flex-start; width: 100%; }
  .hero { gap: 12px; margin-bottom: 16px; }
  .hero-actions { justify-content: flex-start; }
  .hero h1 { font-size: 1.4rem; }

  /* Toolbars: search full width, filters share the row. */
  .toolbar { align-items: stretch; }
  .toolbar > *, .filter-bar { width: 100%; }
  .filter-bar > input[type="search"], .filter-bar > input { flex: 1 1 100%; width: 100%; }
  .filter-bar > select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar .action-row { justify-content: stretch; }
  .toolbar .action-row > * { flex: 1 1 auto; justify-content: center; text-align: center; }
  .segmented { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented button { flex: none; white-space: nowrap; }

  /* Overview lists: the name gets its own line, details wrap under it. */
  .item-list li { flex-wrap: wrap; row-gap: 6px; }
  .item-list .row-link { flex: 1 0 100%; white-space: normal; }

  /* KPI tiles two per row. */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Pagination fits a phone. */
  .call-pages-nav { gap: 4px; flex-wrap: wrap; justify-content: center; }
  .call-page-jump label { display: none; }
  .call-page-jump input { width: 56px; }
}
@media (max-width: 340px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 400px) {
  .call-pages-nav > button[data-contacts-page="1"],
  .call-pages-nav > button[aria-label="Letzte Seite"] { display: none; }
}

/* Controls inside list cards read like the values around them: same size,
   and the note shows its field border instead of an unexplained indent. */
@media (max-width: 1023px) {
  .table-wrap td { font-size: 14px; }
  .table-wrap td .outcome-select, .table-wrap td .note-input { font-size: inherit; }
  .table-wrap td .note-input { min-width: 0; border-color: var(--line); background: var(--surface); }
}
/* iOS Safari zooms into any control under 16 px on focus. Only there, the
   controls and the card values around them go to 16 px together. */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 1023px) {
    input, select, textarea { font-size: 16px !important; }
    .table-wrap td { font-size: 16px; }
  }
}

/* Einstellungen → Integrationen: one tile per provider, settings in a dialog. */
.integration-tile { display: flex; flex-direction: column; }
.integration-tile .form-actions { margin-top: auto; padding-top: 12px; justify-content: flex-end; }
dialog.provider-dialog { width: min(560px, calc(100vw - 32px)); }
dialog.provider-dialog .card-head { margin-bottom: 12px; }
