:root {
  color-scheme: dark;
  --bg: #0c0914;
  --bg-soft: #120e1e;
  --sidebar: #100c1a;
  --sidebar-grad-1: #120d1d;
  --sidebar-grad-2: #0e0a16;
  --surface: #1a1328;
  --surface-2: #221833;
  --surface-3: #2a1f3d;
  --card: #1c152c;
  --border: rgba(167, 139, 250, 0.14);
  --border-strong: rgba(167, 139, 250, 0.28);
  --text: #f7f5ff;
  --text-muted: #9d93b3;
  --text-dim: #6f6688;
  --purple: #8b5cf6;
  --purple-2: #7c3aed;
  --purple-3: #a78bfa;
  --purple-soft: rgba(139, 92, 246, 0.16);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.14);
  --pink: #f472b6;
  --pink-soft: rgba(244, 114, 182, 0.14);
  --gradient: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  --gradient-glow: linear-gradient(135deg, rgba(168, 85, 247, 0.45), rgba(59, 130, 246, 0.18));
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --topbar-bg: rgba(12, 9, 20, 0.72);
  --scrim: rgba(8, 6, 15, 0.72);
  --tint-weak: rgba(255, 255, 255, 0.04);
  --tint-weaker: rgba(255, 255, 255, 0.02);
  --tint-medium: rgba(255, 255, 255, 0.05);
  --tint-strong: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --sidebar-w: 268px;
  --topbar-h: 68px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3fb;
  --bg-soft: #ede9f8;
  --sidebar: #ffffff;
  --sidebar-grad-1: #ffffff;
  --sidebar-grad-2: #fbfaff;
  --surface: #ffffff;
  --surface-2: #f4f2fb;
  --surface-3: #ece8f7;
  --card: #ffffff;
  --border: rgba(76, 29, 149, 0.10);
  --border-strong: rgba(76, 29, 149, 0.22);
  --text: #201c31;
  --text-muted: #625d78;
  --text-dim: #8b84a0;
  --purple: #8b5cf6;
  --purple-2: #7c3aed;
  --purple-3: #6d28d9;
  --purple-soft: rgba(124, 58, 237, 0.12);
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.12);
  --rose: #e11d48;
  --rose-soft: rgba(225, 29, 72, 0.10);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.12);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.10);
  --pink: #db2777;
  --pink-soft: rgba(219, 39, 119, 0.12);
  --shadow: 0 16px 40px rgba(76, 29, 149, 0.10);
  --topbar-bg: rgba(255, 255, 255, 0.75);
  --tint-weak: rgba(30, 20, 60, 0.045);
  --tint-weaker: rgba(30, 20, 60, 0.03);
  --tint-medium: rgba(30, 20, 60, 0.05);
  --tint-strong: rgba(30, 20, 60, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  overflow-x: clip;
}

body.sidebar-locked {
  overflow: hidden;
}

body,
.sidebar,
.topbar,
.panel,
.metric-card,
.modal-card,
.file-card,
.campaign-card,
.contact-row,
.chat-bubble,
.flow-node,
.agent-row,
.btn,
.badge,
.icon-wrap,
.icon-btn,
input,
select,
textarea {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

select option,
select optgroup {
  background-color: var(--surface);
  color: var(--text);
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  align-items: start;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(139, 92, 246, 0.16), transparent 55%),
    radial-gradient(800px 420px at 100% 80%, rgba(59, 130, 246, 0.08), transparent 50%),
    var(--bg);
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  background: linear-gradient(180deg, var(--sidebar-grad-1) 0%, var(--sidebar-grad-2) 100%);
  border-right: 1px solid var(--border);
  z-index: 20;
  overflow: hidden;
}

.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--gradient);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
  color: #fff;
}

.brand-copy {
  flex: 1;
  min-width: 0;
}

.brand-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.brand-copy span {
  color: var(--text-muted);
  font-size: 11px;
}

.brand-chevron {
  color: var(--text-dim);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 18px;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
}

.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
}

.search input::placeholder {
  color: var(--text-dim);
}

.kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--tint-medium);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.nav-section {
  padding: 0 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.nav-label {
  margin: 16px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  transition: 0.15s ease;
}

.nav-item:hover {
  background: var(--tint-weak);
  color: var(--text);
}

.nav-item.active {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.storage-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
}

.storage-head span {
  color: var(--text-muted);
}

.progress {
  height: 7px;
  border-radius: 99px;
  background: var(--tint-strong);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
}

.storage-meta {
  margin: 8px 0 12px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ---------- Main column ---------- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
  min-width: 0;
}

.topbar-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--tint-weak);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.tab {
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 500;
}

.tab.active {
  background: var(--surface-3);
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-actions .user-menu,
.topbar-actions .avatar {
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  position: relative;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gradient);
  font-weight: 700;
  color: #fff;
}

button.avatar {
  border: none;
  padding: 0;
  font: inherit;
}

button.avatar:hover,
button.avatar[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--purple-3);
}

.user-menu {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(240px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
  padding: 6px;
}

.user-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.user-menu-head strong {
  font-size: 13px;
}

.user-menu-head span {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--surface-2);
}

.user-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.user-menu-item-danger {
  color: var(--rose);
}

.user-menu-item-danger svg {
  color: var(--rose);
}

.user-menu-item-danger:hover {
  background: var(--rose-soft);
}

.form-field .field-error {
  margin: 0;
  min-height: 0;
  font-size: 12px;
  color: var(--rose);
}

.campaign-lock-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.content {
  padding: 28px 32px 40px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
  max-width: 560px;
}

.page-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.toolbar-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* ---------- Buttons / badges ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn[hidden] {
  display: none !important;
}

.btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.32);
}

.btn-primary:hover {
  filter: brightness(1.06);
  background: var(--gradient);
}

.btn-dark {
  background: #0b0812;
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.btn-dark:hover {
  background: #1a1626;
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-red {
  background: #e11d48;
  color: #fff;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-rose {
  background: var(--rose-soft);
  color: var(--rose);
}

.badge-purple {
  background: var(--purple-soft);
  color: var(--purple-3);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-muted {
  background: var(--tint-medium);
  color: var(--text-dim);
}

.seg-count {
  display: inline-flex;
  min-width: 18px;
  justify-content: center;
  margin-left: 4px;
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

.lead-expired {
  color: var(--rose);
  font-weight: 600;
}

.lead-highlight td {
  background: var(--purple-soft);
}

.leads-page {
  min-width: 0;
}

.leads-page .page-head p {
  max-width: 640px;
}

.leads-page .field {
  flex: 1 1 220px;
  min-width: 0;
}

.leads-page .toolbar-export {
  flex: 1 1 auto;
  justify-content: space-between;
}

.leads-page #lead-filter {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
}

.leads-page #lead-filter button {
  flex: 0 0 auto;
}

.leads-panel,
.calls-panel {
  padding: 8px 8px 0;
  overflow: hidden;
}

.calls-page {
  min-width: 0;
}

.calls-page .page-head p {
  max-width: 640px;
}

.calls-page .field {
  flex: 1 1 220px;
  min-width: 0;
}

.calls-page .filter-bar-tools {
  flex-wrap: wrap;
  align-items: stretch;
}

.calls-page .filter-bar-tools .field {
  flex: 1 1 220px;
  min-width: min(220px, 100%);
  max-width: none;
}

.calls-page #status-filter {
  flex: 1 1 520px;
  width: auto;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  flex-wrap: wrap;
}

.calls-page #status-filter button {
  flex: 0 1 auto;
}

.notify {
  position: relative;
}

.notify-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
}

.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.notify-head strong {
  font-size: 13px;
}

.notify-list {
  max-height: 360px;
  overflow-y: auto;
}

.notify-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.notify-item:last-child {
  border-bottom: none;
}

.notify-item:hover {
  background: var(--surface-2);
}

.notify-item strong {
  font-size: 13px;
}

.notify-item span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.notify-item em {
  font-size: 11px;
  color: var(--text-dim);
  font-style: normal;
}

.notify-item.is-unread {
  background: var(--purple-soft);
}

.notify-list .empty {
  padding: 20px 14px;
}

.notify-foot {
  display: flex;
  justify-content: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.notify-foot .btn {
  width: 100%;
}

.alerts-page > .date-range {
  margin-bottom: 16px;
}

.alerts-page .alerts-panel {
  padding: 20px;
}

.alerts-page .alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alerts-page .alert-list .empty {
  margin: 0;
  padding: 24px 8px;
  color: var(--text-muted);
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.alert-item:hover {
  background: var(--surface-3);
}

.alert-item.is-unread {
  background: var(--purple-soft);
  border-color: var(--border-strong);
}

.alert-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--purple-soft);
  color: var(--purple-3);
}

.alert-item-icon.is-read {
  background: var(--tint-medium);
  color: var(--text-dim);
}

.alert-item-icon svg {
  width: 18px;
  height: 18px;
}

.alert-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.alert-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.alert-item-top strong {
  font-size: 14px;
}

.alert-item-body span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.alert-item-body em {
  font-size: 12px;
  color: var(--text-dim);
  font-style: normal;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.trend.up {
  color: var(--green);
}

.trend.down {
  color: var(--rose);
}

/* ---------- Cards / grids ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metrics-pipeline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.pipeline-panel {
  margin-bottom: 18px;
}

.pipeline-panel .metrics {
  margin-bottom: 0;
}

a.metric-link {
  color: inherit;
}

a.metric-link:hover {
  border-color: var(--border-strong);
}

.metric-hint {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.metric-card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px 18px 14px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-top span {
  color: var(--text-muted);
  font-size: 13px;
}

.icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--purple-soft);
  color: var(--purple-3);
}

.icon-wrap.green { background: var(--green-soft); color: var(--green); }
.icon-wrap.rose { background: var(--rose-soft); color: var(--rose); }
.icon-wrap.amber { background: var(--amber-soft); color: var(--amber); }
.icon-wrap.blue { background: var(--blue-soft); color: var(--blue); }
.icon-wrap.pink { background: var(--pink-soft); color: var(--pink); }

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: 0.92fr 1.28fr;
  gap: 16px;
}

.split.campaigns-split {
  grid-template-columns: 1.2fr 1fr;
  align-items: start;
  margin-top: 16px;
}

.split.dashboard-split {
  grid-template-columns: 1.7fr 0.8fr;
  align-items: stretch;
}

.split.dashboard-split > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.split.dashboard-split > .panel > .stack {
  flex: 1 1 auto;
  min-height: 0;
}

.calls-campaign-field {
  width: min(560px, 100%);
  max-width: 100%;
  margin-bottom: 16px;
  min-width: 0;
}

.calls-campaign-field select {
  max-width: 100%;
  min-width: 0;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.filter-bar-tools {
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 0 1 280px;
}

.filter-group-label,
.filter-group > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-control {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  min-width: min(280px, 100%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
}

.filter-control select {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  color-scheme: inherit;
}

.filter-control select option {
  background-color: var(--surface);
  color: var(--text);
}

.filter-bar .field {
  background: var(--surface-2);
}

.date-range {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 0 1 auto;
}

.panel > .date-range {
  margin-bottom: 16px;
}

.filter-bar-row .date-range {
  flex: 0 1 auto;
}

.date-range-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.date-range-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.date-range-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  cursor: pointer;
  flex: 0 1 auto;
  min-width: 0;
}

.filter-bar-row .date-range-box {
  flex: 0 0 auto;
  width: max-content;
}

.date-range-box:focus-within {
  border-color: var(--border-strong);
}

.date-range-sep {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.date-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.date-range input[type="date"] {
  border: 0;
  outline: none;
  background: transparent;
  min-width: 128px;
  width: 128px;
  color: var(--text);
  font-weight: 600;
  font-family: inherit;
  color-scheme: inherit;
  cursor: pointer;
}

.date-range input[type="date"].is-empty {
  color: var(--text-muted);
}

.date-range input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  appearance: none;
  -webkit-appearance: none;
}

.date-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  flex-shrink: 0;
}

.date-open:hover {
  background: var(--tint-medium);
  color: var(--purple-3);
}

.date-range-presets {
  flex: 0 0 auto;
  height: auto;
  overflow: hidden;
  align-items: center;
}

.filter-bar-tools .field {
  flex: 1 1 240px;
}

.filter-bar-tools .toolbar-export,
.filter-bar-tools .segmented {
  flex: 1 1 auto;
}

.date-range-clear {
  color: var(--text-muted);
  flex-shrink: 0;
}

.date-range-compact {
  flex: 0 1 auto;
  flex-direction: row;
  align-items: center;
}

.panel-head .date-range {
  justify-content: flex-end;
}

.campaigns-pane .date-range {
  flex: 0 0 auto;
}

.chart-panel .panel-head {
  flex-wrap: wrap;
  align-items: flex-end;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.panel-meta {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 11px;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--scrim);
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  max-height: min(640px, 85vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-card-sm {
  width: min(420px, 100%);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-row {
  display: flex;
}

.chat-row-agent {
  justify-content: flex-start;
}

.chat-row-user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
}

.chat-row-user .chat-bubble {
  background: var(--purple-soft);
  border-color: var(--border-strong);
}

.chat-bubble .chat-role {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chat-row-user .chat-bubble .chat-role {
  color: var(--purple-3);
}

.chat-bubble p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.recording-player {
  width: 100%;
  margin: 4px 0 16px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.segmented button.active {
  background: var(--purple);
  color: #fff;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chart-panel .panel-head {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.chart-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  height: 280px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.chart-wrap canvas {
  display: block;
  max-width: 100%;
}

.rate-chart-panel .panel-head {
  margin-bottom: 4px;
}

.rate-chart-wrap {
  flex: 0 0 auto;
  height: 240px;
  min-height: 240px;
  max-width: 240px;
  margin: auto;
}

.rate-chart-center {
  position: absolute;
  inset: 0 0 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.rate-chart-center strong {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.rate-chart-center span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chart-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.stat-chip svg {
  width: 16px;
  height: 16px;
}

.stat-chip.green { color: var(--green); }
.stat-chip.rose { color: var(--rose); }

.agent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.agent-copy strong {
  display: block;
}

.agent-copy .meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.agent-stats {
  text-align: right;
}

.agent-stats .rate {
  font-weight: 700;
}

.agent-stats .model {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 11px;
}

/* ---------- Tables / lists ---------- */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--text);
}

.back-link svg {
  width: 14px;
  height: 14px;
}

#campaign-filter-label {
  color: var(--purple-3);
}

#campaign-filter-label:not(:empty)::before {
  content: " · ";
  color: var(--text-dim);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-dim);
  min-width: 240px;
}

.field input,
.field select {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
}

.table-wrap {
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}

table.data th,
table.data td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

table.data tr:hover td {
  background: var(--tint-weaker);
}

table.data td.empty {
  color: var(--text-dim);
  text-align: center;
  padding: 28px 12px;
  white-space: normal;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.campaigns-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 2px;
}

#leads-pagination,
#calls-pagination,
#alerts-pagination {
  margin-top: 16px;
}

#file-pagination {
  margin-top: 16px;
  flex-direction: column;
  align-items: stretch;
}

.pagination-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination .btn svg {
  width: 14px;
  height: 14px;
}

.pagination-page {
  min-width: 32px;
  padding: 0 8px;
}

.pagination-page.is-current {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.28);
}

.pagination-ellipsis {
  width: 24px;
  text-align: center;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.file-card,
.campaign-card,
.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-card {
  cursor: pointer;
}

.file-card:hover,
.campaign-card:hover,
.file-card.is-selected {
  border-color: var(--border-strong);
}

.file-card.is-selected {
  border-color: var(--purple-3);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.10), transparent 80%), var(--card);
}

.contact-row {
  align-items: flex-start;
}

.contact-row-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.contact-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.contact-row-head strong {
  display: block;
  font-size: 14px;
}

.contact-row-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.contact-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.contact-meta i {
  width: 13px;
  height: 13px;
  color: var(--text-dim);
}

.contact-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.btn-success {
  color: var(--green);
  border-color: rgba(52, 211, 153, 0.28);
  background: var(--green-soft);
}

.btn-success:hover {
  border-color: rgba(52, 211, 153, 0.45);
  background: var(--green-soft);
  filter: brightness(1.06);
}

.btn-danger {
  color: var(--rose);
  border-color: rgba(251, 113, 133, 0.28);
  background: var(--rose-soft);
}

.btn-danger:hover {
  border-color: rgba(251, 113, 133, 0.45);
  background: var(--rose-soft);
  filter: brightness(1.06);
}

.badge-pulse {
  position: relative;
}

.badge-pulse::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: badge-pulse 1.6s ease-out infinite;
}

@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 0.9; }
  100% { box-shadow: 0 0 0 8px transparent; opacity: 0.15; }
}

.contact-row.is-terminal {
  opacity: 0.92;
}

.grow {
  flex: 1;
  min-width: 0;
}

.campaign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.muted {
  color: var(--text-muted);
}

.dim {
  color: var(--text-dim);
}

.dropzone {
  display: block;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.08), transparent 70%),
    var(--card);
  margin-bottom: 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover {
  border-color: var(--purple-3);
}

.dropzone.is-active {
  border-color: var(--purple-3);
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.16), transparent 70%),
    var(--card);
}

.dropzone.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.dropzone h3 {
  margin: 10px 0 4px;
}

.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: auto;
  padding: 8px 0 4px;
}

.flow-node {
  min-width: 160px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.flow-node h4 {
  margin: 10px 0 0;
  font-size: 14px;
}

.flow-line {
  flex: 1;
  min-width: 28px;
  border-top: 1.5px dashed var(--border-strong);
}

.activity {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.activity-item p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-top: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.mobile-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 1280px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .split,
  .split.campaigns-split,
  .split.dashboard-split,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .split.dashboard-split > .panel {
    height: auto;
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    width: var(--sidebar-w);
    z-index: 30;
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 25;
  }

  .mobile-toggle {
    display: grid;
    place-items: center;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metrics-pipeline {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px 16px 32px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-lead {
    gap: 8px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions > .btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
  }

  .topbar-actions .btn-label {
    display: none;
  }

  .icon-btn,
  .mobile-toggle,
  .avatar {
    width: 36px;
    height: 36px;
  }

  .tabs {
    display: none;
  }

  .leads-page .page-head,
  .calls-page .page-head,
  .alerts-page .page-head,
  .leads-page .toolbar,
  .calls-page .toolbar,
  .leads-page .toolbar-export,
  .filter-bar-row,
  .filter-bar-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .leads-page .page-head p,
  .calls-page .page-head p,
  .alerts-page .page-head p {
    max-width: none;
  }

  .leads-page .field,
  .calls-page .field {
    width: 100%;
    flex-basis: auto;
  }

  .leads-page .toolbar-export,
  .leads-page #export-leads,
  .calls-page .page-actions,
  .calls-page #export-calls {
    width: 100%;
    flex-shrink: 0;
  }

  .leads-page .segmented,
  .leads-page #lead-filter,
  .calls-page .segmented {
    flex: 1 1 auto;
    flex-wrap: wrap;
    overflow: visible;
    width: 100%;
  }

  .leads-page .segmented button,
  .leads-page #lead-filter button,
  .calls-page .segmented button {
    flex: 1 1 calc(33.33% - 4px);
    justify-content: center;
    padding: 6px 8px;
    font-size: 13px;
  }

  .calls-campaign-field,
  .filter-group,
  .filter-control,
  .calls-page .filter-bar-tools .field {
    width: 100%;
    flex: 0 1 auto;
  }

  .date-range,
  .date-range-compact,
  .date-range-box,
  .panel-head .date-range {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .date-range-controls,
  .date-range-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .date-range-box {
    justify-content: space-between;
    height: auto;
    min-height: 40px;
  }

  .date-chip {
    flex: 1 1 0;
    min-width: 0;
  }

  .date-range input[type="date"] {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .date-range input[type="date"]::-webkit-calendar-picker-indicator {
    display: block;
    appearance: auto;
    -webkit-appearance: auto;
    opacity: 1;
    width: 18px;
    height: 18px;
    cursor: pointer;
  }

  .date-open {
    display: none;
  }

  .date-range-presets {
    width: 100%;
    overflow: visible;
  }

  .date-range-presets button {
    flex: 1 1 auto;
  }

  .panel-head:has(.date-range) {
    flex-direction: column;
    align-items: stretch;
  }

  .card-table {
    overflow: visible;
  }

  .card-table table.data,
  .card-table table.data thead,
  .card-table table.data tbody,
  .card-table table.data tbody tr,
  .card-table table.data tbody th,
  .card-table table.data tbody td {
    display: block;
    width: 100%;
  }

  .card-table table.data thead {
    display: none;
  }

  .card-table table.data tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 4px 12px;
  }

  .card-table table.data tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 14px;
  }

  .card-table table.data tbody tr:hover td {
    background: transparent;
  }

  .card-table table.data tbody td {
    display: grid;
    grid-template-columns: minmax(110px, 32%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .card-table table.data tbody td:last-child {
    border-bottom: 0;
  }

  .card-table table.data tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding-top: 2px;
  }

  .card-table table.data tbody td.empty {
    display: block;
    text-align: center;
    padding: 28px 12px;
  }

  .card-table table.data tbody td.empty::before {
    content: none;
  }

  .card-table table.data tbody tr:has(td.empty) {
    background: transparent;
    border: 0;
    padding: 8px;
  }

  .card-table table.data tbody tr.lead-highlight {
    background: var(--purple-soft);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.35);
  }

  .card-table table.data tbody tr.lead-highlight td {
    background: transparent;
  }

  .card-table .btn-sm {
    width: fit-content;
  }
}

@media (max-width: 640px) {
  .notify-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  .notify-head {
    gap: 8px;
    padding: 10px 12px;
  }

  .notify-head strong {
    min-width: 0;
  }

  .notify-head .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
  }

  .notify-list {
    max-height: min(360px, calc(100dvh - var(--topbar-h) - 140px));
  }

  .notify-list .empty {
    padding: 14px 12px;
  }

  .notify-foot {
    padding: 8px 12px;
  }

  .notify-foot .btn {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 0 12px;
  }

  .metrics,
  .form-grid,
  .chart-footer {
    grid-template-columns: 1fr;
  }

  .split.dashboard-split > .panel {
    height: auto;
  }

  .chart-panel {
    min-width: 0;
    padding: 16px;
  }

  .chart-panel .panel-head {
    margin-bottom: 10px;
  }

  .chart-wrap {
    flex: 0 0 auto;
    height: 220px;
    min-height: 220px;
  }

  .rate-chart-wrap {
    height: 200px;
    min-height: 200px;
    max-width: 200px;
  }

  .rate-chart-center {
    inset: 0 0 28px;
  }

  .rate-chart-center strong {
    font-size: 24px;
  }

  .page-head,
  .toolbar,
  .file-card,
  .campaign-card,
  .contact-row {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-row-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact-row-badges {
    justify-content: flex-start;
  }

  .date-range-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .date-range-sep {
    align-self: center;
  }

  .date-chip {
    flex: 1 1 auto;
    width: 100%;
  }

  .page-head h1 {
    font-size: 26px;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-controls {
    flex-wrap: wrap;
  }

  .leads-page .segmented button,
  .leads-page #lead-filter button,
  .calls-page .segmented button {
    flex-basis: calc(50% - 4px);
  }

  #leads-pagination .pagination-controls {
    justify-content: space-between;
  }

  #leads-pagination .pagination-page {
    flex: 1 1 auto;
  }
}

/* Toasts */
.toast-viewport {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  pointer-events: auto;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(24px);
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.toast-icon svg {
  width: 15px;
  height: 15px;
}

.toast-success .toast-icon {
  background: var(--green-soft);
  color: var(--green);
}

.toast-error .toast-icon {
  background: var(--rose-soft);
  color: var(--rose);
}

.toast-success {
  border-color: var(--green-soft);
}

.toast-error {
  border-color: var(--rose-soft);
}

.toast-body {
  flex: 1;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  padding-top: 4px;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.toast-close svg {
  width: 13px;
  height: 13px;
}

.upload-error-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px;
}

.upload-error-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.upload-error-head strong {
  font-size: 13px;
}

.upload-error-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.upload-error-row {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--rose-soft);
  border: 1px solid rgba(251, 113, 133, 0.16);
}

.upload-error-more {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 10px;
}

@media (max-width: 640px) {
  .toast-viewport {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

body:has(.page-loader:not([hidden])) {
  overflow: hidden;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 32%, transparent);
  pointer-events: auto;
}

.page-loader:not([hidden]) {
  display: flex;
}

.page-loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--purple-soft);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: page-loader-spin 0.7s linear infinite;
}

@keyframes page-loader-spin {
  to {
    transform: rotate(360deg);
  }
}
