/* ─────────────────────────────────────────────────────────────────────
   NuMail design system — Resend-grade light surface, navy→cobalt brand
   Used by every dashboard screen. Inline-friendly: one file, no deps.
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-tint: #F5F5F5;
  --surface-soft: #FAFAFA;
  --fg: #0A0A0A;
  --fg-2: #1F1F1F;
  --on-fg: #FFFFFF;            /* text color when bg = var(--fg) */
  --muted: #6F6F6F;
  --muted-2: #A1A1A1;
  --border: #EBEBEB;
  --border-light: #F2F2F2;

  --accent: #5B7AFF;
  --accent-2: #6B5BFF;
  --accent-3: #7C5CFF;
  --accent-700: #3A53D8;
  --accent-soft: #EEF1FF;
  --navy: #0F1633;
  --navy-2: #2E3B8A;

  --success: #16A34A;
  --success-soft: #DCFCE7;
  --success-fg: #15803D;
  --gold: #B6862C;
  --gold-soft: #FEF6E0;
  --gold-fg: #92400E;
  --silver-soft: #F4F4F5;
  --silver: #71717A;
  --bronze-soft: #FFEDD5;
  --bronze: #9A3412;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --warn: #D97706;
  --warn-soft: #FEF3C7;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.08);
  --shadow-modal: 0 20px 60px -10px rgba(0,0,0,0.3);
  --backdrop: rgba(10,10,10,0.5);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --sidebar-w: 232px;
  --sidebar-min: 196px;
  --sidebar-max: 360px;
}

[data-theme="dark"] {
  --bg: #0B0B0E;
  --surface: #141418;
  --surface-tint: #1C1C22;
  --surface-soft: #101014;
  --fg: #F4F4F7;
  --fg-2: #D7D7DC;
  --on-fg: #0B0B0E;
  --muted: #9A9AA3;
  --muted-2: #5F5F68;
  --border: #2A2A31;
  --border-light: #22222A;

  --accent: #6F8BFF;
  --accent-2: #8478FF;
  --accent-3: #9377FF;
  --accent-700: #5B7AFF;
  --accent-soft: rgba(111,139,255,0.16);

  --success: #34D399;
  --success-soft: rgba(52,211,153,0.14);
  --success-fg: #6EE7B7;
  --gold: #FBBF24;
  --gold-soft: rgba(251,191,36,0.14);
  --gold-fg: #FCD34D;
  --silver-soft: rgba(161,161,170,0.14);
  --silver: #A1A1AA;
  --bronze-soft: rgba(251,146,60,0.14);
  --bronze: #FB923C;
  --danger: #F87171;
  --danger-soft: rgba(248,113,113,0.14);
  --warn: #FBBF24;
  --warn-soft: rgba(251,191,36,0.14);

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 4px 12px -2px rgba(0,0,0,0.45);
  --shadow-modal: 0 24px 64px -8px rgba(0,0,0,0.7);
  --backdrop: rgba(0,0,0,0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11";
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: inherit; }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ── Sidebar ── */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border-light);
  padding: 18px 12px 16px;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-resize {
  position: absolute;
  top: 0; right: -3px; bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 50;
  background: transparent;
  transition: background .15s;
}
.sidebar-resize::after {
  content: ""; position: absolute;
  top: 50%; right: 1px;
  transform: translateY(-50%);
  width: 2px; height: 28px;
  border-radius: 99px;
  background: var(--border);
  opacity: 0; transition: opacity .15s;
}
.sidebar-resize:hover::after,
.sidebar-resize.dragging::after { opacity: 1; background: var(--accent); }
.sidebar-resize.dragging { background: rgba(91,122,255,0.08); }
body.is-resizing { cursor: ew-resize; user-select: none; }
body.is-resizing iframe { pointer-events: none; }
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 8px 16px;
  text-decoration: none; color: inherit;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--accent) 100%);
  display: grid; place-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12);
}
.brand-mark svg { width: 22px; height: 22px; color: #FFFFFF; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.015em; }

.ws-switch {
  margin: 0 0 14px;
  padding: 7px 10px;
  border-radius: 7px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  color: var(--fg);
  text-decoration: none;
}
.ws-switch:hover { background: var(--surface-tint); }
.ws-mark {
  width: 22px; height: 22px; border-radius: 5px;
  background: linear-gradient(135deg, #FF8A65, #EF5350);
  color: white; font-weight: 700; font-size: 10px;
  display: grid; place-items: center;
}
.ws-name { font-weight: 500; font-size: 13.5px; }
.ws-chev { margin-left: auto; color: var(--muted-2); }

.nav-label {
  font-size: 11px;
  color: var(--muted);
  padding: 14px 10px 4px;
  font-weight: 500;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--fg-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
}
.nav a:hover { background: var(--surface-tint); }
.nav a.active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--border-light), 0 1px 2px rgba(0,0,0,0.04);
}
.nav .ico { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.nav a:hover .ico { color: var(--fg-2); }
.nav a.active .ico { color: var(--fg); }
/* Sidebar nav icons need to read as icons (not text) in dark mode — push them to chrome-grey */
[data-theme="dark"] .nav .ico,
[data-theme="dark"] .side-tools .theme-toggle .ico { color: #5A5A63; }
[data-theme="dark"] .nav a:hover .ico { color: var(--fg-2); }
[data-theme="dark"] .nav a.active .ico { color: var(--fg); }
[data-theme="dark"] .ws-chev { color: #5A5A63; }
[data-theme="dark"] .crumbs a:hover { color: var(--fg); }
.nav .badge-n {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
  font-family: var(--font-mono);
}
.nav a.active .badge-n { color: var(--fg); }

.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}
.side-foot .upgrade {
  padding: 14px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 100% 0%, rgba(124,92,255,0.15), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(91,122,255,0.12), transparent 60%),
    var(--surface);
  border: 1px solid var(--border-light);
  font-size: 12.5px;
}
.upgrade .ttl { font-weight: 600; margin-bottom: 3px; font-size: 13px; }
.upgrade .sub { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin-bottom: 10px; }
.upgrade .cta {
  background: var(--fg); color: var(--on-fg); border: 0;
  border-radius: 6px; padding: 6px 11px;
  font-size: 12px; font-weight: 500; font-family: var(--font-sans);
  cursor: pointer; text-decoration: none; display: inline-block;
}

.user-row {
  margin-top: 10px;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 4px;
  color: inherit; text-decoration: none;
  border-radius: 6px;
}
.user-row:hover { background: var(--surface-tint); }
.user-av {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #FF8A65, #EF5350);
  color: #FFFFFF; font-weight: 600; font-size: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 500; line-height: 1.2; }
.user-email { font-size: 11px; color: var(--muted); }

/* ── Content shell ── */
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  padding: 14px 32px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--fg); }
.crumbs strong { color: var(--fg); font-weight: 500; }
.crumbs .sep { color: var(--muted-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-input {
  width: 240px; padding: 6px 11px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 7px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  color: var(--muted);
}
.search-input .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted-2);
  background: var(--bg);
  border: 1px solid var(--border-light);
  padding: 0 5px; border-radius: 4px;
}

main { padding: 28px 36px 64px; max-width: 1280px; width: 100%; }
@media (max-width: 700px) { main { padding: 20px 16px 48px; } .topbar { padding: 12px 16px; } }

/* ── Buttons ── */
.btn {
  font-family: var(--font-sans);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  line-height: 1.4;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-tint); }
.btn-primary { background: var(--fg); color: var(--on-fg); border-color: var(--fg); }
.btn-primary:hover { filter: brightness(0.92); }
.btn-accent { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); background: var(--surface-tint); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 9px 16px; font-size: 14px; border-radius: 8px; }
.btn-icon { padding: 6px; }

/* ── Page headers ── */
.page-head {
  display: flex; align-items: flex-end; gap: 18px;
  margin-bottom: 24px;
}
.page-head h1 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 4px;
}
.page-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── Hero (used on dashboard) ── */
.hero { margin-bottom: 36px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 99px;
  font-size: 12px; color: var(--muted);
  margin-bottom: 18px;
}
.hero-eyebrow .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
}
.hero h1 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(180deg, var(--fg) 0%, var(--fg) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h1 .lite { color: var(--muted-2); -webkit-text-fill-color: var(--muted-2); }
.hero-sub { margin-top: 14px; color: var(--muted); font-size: 16px; max-width: 580px; line-height: 1.55; }

/* ── Hero stats / KPI band ── */
.hero-stats, .stat-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 32px;
  padding: 24px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.stat-band.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-band.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-band.compact { padding: 18px 0; margin-top: 0; }
@media (max-width: 1100px) { .hero-stats, .stat-band { grid-template-columns: repeat(2, 1fr); gap: 24px 0; } }
.hs { padding: 0 24px; border-right: 1px solid var(--border-light); }
.hs:first-child { padding-left: 0; }
.hs:last-child { border-right: 0; }
@media (max-width: 1100px) { .hs:nth-child(2) { border-right: 0; padding-right: 0; } }
.hs-lbl { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; }
.hs-val { font-size: 32px; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hs-val small { font-size: 18px; color: var(--muted-2); font-weight: 500; margin-left: 2px; }
.hs-delta { margin-top: 6px; font-size: 12px; color: var(--success); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.hs-delta.down { color: var(--danger); }
.hs-delta.flat { color: var(--muted); }

/* ── Section ── */
.section { margin-bottom: 36px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.section-head .sub { color: var(--muted); font-size: 13px; }
.section-head .more {
  margin-left: auto;
  color: var(--fg);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-light);
  padding: 5px 11px;
  border-radius: 7px;
  background: var(--surface);
}
.section-head .more:hover { background: var(--surface-tint); }

/* ── Two-col / grid layouts ── */
.two-col { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
.two-col.balanced { grid-template-columns: 1fr 1fr; }
.two-col.flip { grid-template-columns: 1fr 1.55fr; }
@media (max-width: 1100px) { .two-col, .two-col.balanced, .two-col.flip { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Panel / Card ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
}
.panel-head { padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 18px 20px; }
.panel-body.tight { padding: 14px 18px; }
.panel-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--surface-soft);
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--muted);
}
.panel-foot .right { margin-left: auto; display: flex; gap: 8px; }

/* ── Table ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left;
  padding: 10px 20px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  white-space: nowrap;
}
.tbl tbody td { padding: 13px 20px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-tint); }
.tbl tbody tr.selected { background: var(--accent-soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.tight, .tbl th.tight { padding-left: 10px; padding-right: 10px; }
.tbl .row-title { font-weight: 500; color: var(--fg); }
.tbl .row-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.tbl .row-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--surface-tint);
  color: var(--muted);
  display: inline-grid; place-items: center;
  margin-right: 10px;
  vertical-align: middle;
}
.tbl a.link { color: var(--fg); text-decoration: none; }
.tbl a.link:hover { color: var(--accent-700); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn { padding: 3px 8px; font-size: 12px; }
.tbl input[type="checkbox"] { accent-color: var(--accent); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
  white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success-fg); }
.badge.gold { background: var(--gold-soft); color: var(--gold-fg); }
.badge.silver { background: var(--silver-soft); color: var(--silver); }
.badge.bronze { background: var(--bronze-soft); color: var(--bronze); }
.badge.draft { background: var(--surface-tint); color: var(--muted); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent-700); }
.badge.outline { background: var(--surface); color: var(--muted); border: 1px solid var(--border-light); }
[data-theme="dark"] .badge.accent { color: var(--accent); }

/* ── Filter bar ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 5px 11px;
  font-size: 12.5px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  border-radius: 7px;
  color: var(--fg-2);
  cursor: pointer;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-chip:hover { background: var(--surface-tint); }
.filter-chip.active { background: var(--fg); color: var(--on-fg); border-color: var(--fg); }
.filter-chip .count {
  font-size: 11px;
  background: var(--surface-tint);
  color: var(--muted);
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.filter-chip.active .count { background: color-mix(in srgb, var(--on-fg) 18%, transparent); color: var(--on-fg); }
.filter-bar .divider { width: 1px; height: 20px; background: var(--border-light); margin: 0 4px; }

/* ── Forms ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field .label { font-size: 12.5px; font-weight: 500; color: var(--fg); }
.field .help { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.field .err { font-size: 11.5px; color: var(--danger); }

input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="password"], textarea, select {
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 7px;
  outline: none;
  width: 100%;
  line-height: 1.4;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 96px; resize: vertical; font-family: var(--font-sans); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Toggle */
.toggle {
  position: relative;
  width: 34px; height: 20px;
  background: var(--border);
  border-radius: 99px;
  display: inline-block;
  cursor: pointer;
  transition: background .15s;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: left .15s;
}
[data-theme="dark"] .toggle::after { background: var(--on-fg); }
[data-theme="dark"] .toggle.on::after { background: #FFFFFF; }
.toggle.on { background: var(--fg); }
.toggle.on::after { left: 16px; }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-row .label { font-size: 13px; font-weight: 500; }
.toggle-row .help { font-size: 12px; color: var(--muted); }
.toggle-row .right { margin-left: auto; }

/* Code block */
.code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #0A0A0A;
  color: #EDEDED;
  padding: 14px 16px;
  border-radius: 9px;
  overflow-x: auto;
  line-height: 1.55;
}
.code .k { color: #C792EA; }
.code .s { color: #C3E88D; }
.code .c { color: #676E95; }
.code .n { color: #F78C6C; }
.code .v { color: #82AAFF; }
.inline-code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-tint); color: var(--fg-2);
  padding: 1px 6px; border-radius: 4px;
}

/* ── Tabs ── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 24px;
}
.tabs a, .tabs button {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-sans);
  display: inline-flex; align-items: center; gap: 7px;
}
.tabs a:hover, .tabs button:hover { color: var(--fg); }
.tabs a.active, .tabs button.active { color: var(--fg); border-bottom-color: var(--fg); }
.tabs .count {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  background: var(--surface-tint);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Wizard stepper ── */
.wizard-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  margin-top: 8px;
}
@media (max-width: 900px) { .wizard-shell { grid-template-columns: 1fr; } }
.stepper { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 90px; align-self: start; }
.step {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 11px;
  border-radius: 8px;
  text-decoration: none; color: var(--muted);
  font-size: 13px;
}
.step:hover { background: var(--surface-tint); }
.step .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-tint);
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.step .ttl { font-weight: 500; font-size: 13px; color: inherit; line-height: 1.3; }
.step .desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.step.active { color: var(--fg); background: var(--surface); box-shadow: 0 0 0 1px var(--border-light); }
.step.active .num { background: var(--fg); color: var(--on-fg); }
.step.done { color: var(--fg-2); }
.step.done .num { background: var(--success); color: #FFFFFF; }
.step.done .num::after { content: "✓"; }
.step.done .num span { display: none; }

.wizard-content { max-width: 640px; }
.wizard-content h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.wizard-content .sub { color: var(--muted); margin-bottom: 28px; font-size: 14px; }
.wizard-actions {
  display: flex; gap: 8px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}
.wizard-actions .right { margin-left: auto; display: flex; gap: 8px; }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty .ic {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--surface-tint);
  margin: 0 auto 16px;
  display: grid; place-items: center;
  color: var(--muted);
}
.empty .ttl { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.empty .sub { font-size: 13px; max-width: 360px; margin: 0 auto 18px; line-height: 1.5; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--backdrop);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.modal.wide { max-width: 720px; }
.modal-head {
  padding: 18px 22px 12px;
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; line-height: 0; }
.modal-head .x:hover { background: var(--surface-tint); color: var(--fg); }
.modal-body { padding: 4px 22px 18px; }
.modal-body .sub { color: var(--muted); font-size: 13px; margin: -4px 0 18px; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex; gap: 8px;
  background: var(--surface-soft);
  border-radius: 0 0 14px 14px;
}
.modal-foot .right { margin-left: auto; display: flex; gap: 8px; }

/* ── Insight callout ── */
.insight {
  background:
    radial-gradient(circle at 100% 0%, rgba(124,92,255,0.07), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(91,122,255,0.06), transparent 60%),
    var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 18px 22px;
  display: flex; gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}
.insight .ic {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #FFFFFF;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -2px rgba(91,122,255,0.4);
}
.insight .ttl { font-weight: 600; font-size: 14px; margin-bottom: 2px; letter-spacing: -0.01em; }
.insight .sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.insight .sub b { color: var(--fg); }
.insight .act { margin-left: auto; display: flex; gap: 8px; }

/* ── Upgrade overlay (gated features) ── */
.locked {
  position: relative;
}
.locked::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface) 40%, transparent),
    color-mix(in srgb, var(--surface) 88%, transparent));
  border-radius: inherit;
  pointer-events: none;
}
.lock-overlay {
  position: absolute; inset: 0;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.lock-pill {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--fg); color: var(--on-fg);
  border-radius: 99px;
  font-size: 12.5px; font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-2);
}

/* ── AI Reply card (used in unibox + dashboard) ── */
.reply-card { padding: 14px 18px; border-top: 1px solid var(--border-light); }
.reply-card:first-child { border-top: 0; }
.reply-from { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.reply-from .av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-tint);
  color: var(--fg);
  font-weight: 600; font-size: 10.5px;
  display: grid; place-items: center; flex-shrink: 0;
}
.reply-from .who { font-size: 12.5px; font-weight: 500; }
.reply-from .where { font-size: 11.5px; color: var(--muted); }
.reply-from .mins { margin-left: auto; font-size: 11px; color: var(--muted-2); font-family: var(--font-mono); }
.reply-quote {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.5;
  background: var(--surface-tint);
  padding: 9px 11px;
  border-radius: 7px;
  margin-bottom: 9px;
}
.reply-draft {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.55;
  padding: 11px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 7px;
  margin-bottom: 10px;
}
.reply-draft .label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent-700); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px;
}
.reply-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ra-btn {
  font-family: var(--font-sans);
  padding: 4px 10px; font-size: 11.5px; font-weight: 500;
  border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
.ra-btn.primary { background: var(--fg); color: var(--on-fg); border-color: var(--fg); }
.ra-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.ra-btn.ghost:hover { background: var(--surface-tint); color: var(--fg); }

/* ── Activity feed ── */
.activity { padding: 0; }
.act { display: flex; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--border-light); font-size: 13px; }
.act:first-child { border-top: 0; }
.act:hover { background: var(--surface-tint); }
.act-ic {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--surface-tint);
  color: var(--muted);
}
.act-ic.reply { background: var(--success-soft); color: var(--success); }
.act-ic.click { background: var(--accent-soft); color: var(--accent-700); }
.act-ic.bounce { background: var(--danger-soft); color: var(--danger); }
.act-ic.ai { background: rgba(124,92,255,0.1); color: var(--accent-3); }
.act-ic.send { background: var(--surface-tint); color: var(--muted); }
.act-ic.open { background: var(--gold-soft); color: var(--gold); }
.act-body { flex: 1; font-size: 12.5px; line-height: 1.45; min-width: 0; }
.act-body b { font-weight: 500; }
.act-meta { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.act-time { color: var(--muted-2); font-size: 11px; font-family: var(--font-mono); flex-shrink: 0; }

/* ── Chart placeholders ── */
.chart {
  height: 180px;
  display: flex; align-items: flex-end; gap: 4px;
  padding: 12px 16px;
}
.chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--accent-700));
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  opacity: 0.85;
  transition: opacity .15s;
}
.chart .bar:hover { opacity: 1; }
.chart .bar.muted { background: var(--border); }
.chart-labels {
  display: flex; padding: 0 16px;
  font-size: 10.5px; color: var(--muted);
  font-family: var(--font-mono);
  justify-content: space-between;
  padding-bottom: 10px;
}
.spark {
  height: 36px;
  display: flex; align-items: flex-end; gap: 2px;
}
.spark .bar { flex: 1; background: var(--accent); border-radius: 1px; min-height: 2px; opacity: 0.7; }

/* ── Funnel ── */
.funnel { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; }
.funnel-row { display: grid; grid-template-columns: 140px 1fr 110px; gap: 14px; align-items: center; padding: 8px 0; }
.funnel-row .lbl { font-size: 12.5px; color: var(--fg-2); font-weight: 500; }
.funnel-row .lbl .pct { color: var(--muted); font-family: var(--font-mono); font-size: 11px; margin-left: 6px; }
.funnel-row .bar {
  height: 28px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 5px;
  position: relative;
}
.funnel-row .bar.muted { background: var(--border); }
.funnel-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }

/* ── Sequence editor (campaign detail) ── */
.seq { display: flex; flex-direction: column; gap: 14px; }
.seq-step {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: hidden;
}
.seq-step-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-soft);
}
.seq-step-head .step-n {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--on-fg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-mono);
}
.seq-step-head .ttl { font-weight: 600; font-size: 13.5px; }
.seq-step-head .meta { color: var(--muted); font-size: 12px; }
.seq-step-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.seq-step-body { padding: 16px 18px; }
.seq-delay {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  background: var(--surface-soft);
  border-radius: 99px;
  align-self: center;
  font-size: 12px;
  color: var(--muted);
  width: max-content;
  margin: 0 auto;
  border: 1px dashed var(--border);
}
.seq-add {
  align-self: center;
  margin: 4px auto 0;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.seq-add:hover { border-color: var(--fg); color: var(--fg); background: var(--surface-tint); }
.seq-step .variant-tabs { padding: 0 18px; border-bottom: 1px solid var(--border-light); }
.email-preview {
  padding: 14px 16px;
  background: var(--surface-soft);
  border-radius: 9px;
  border: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.55;
}
.email-preview .subj { font-weight: 600; margin-bottom: 10px; }
.email-preview .body { color: var(--fg-2); white-space: pre-wrap; }
.email-preview .var { background: var(--accent-soft); color: var(--accent-700); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: 11.5px; }

/* ── Health bars ── */
.health-bar { height: 4px; background: var(--surface-tint); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.health-bar .fill { height: 100%; background: var(--success); border-radius: 99px; }
.health-bar .fill.gold { background: var(--gold); }
.health-bar .fill.warn { background: var(--warn); }
.health-bar .fill.danger { background: var(--danger); }

/* ── Mailbox card ── */
.mb-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.mb-card:hover { background: var(--surface-tint); }
.mb-card .av {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--surface-tint);
  display: grid; place-items: center;
  color: var(--muted);
}
.mb-card .em { font-weight: 500; font-size: 13.5px; }
.mb-card .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ── Pricing / plan box ── */
.plan-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.plan-box.current { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.plan-box .tier-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.plan-box .price { font-size: 32px; font-weight: 600; letter-spacing: -0.025em; }
.plan-box .price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan-feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--fg-2); }
.plan-feats li { display: flex; gap: 8px; align-items: flex-start; }
.plan-feats li::before { content: "✓"; color: var(--success); font-weight: 600; flex-shrink: 0; }

/* ── Usage meter ── */
.usage { display: flex; flex-direction: column; gap: 6px; }
.usage .row { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.usage .row b { font-weight: 600; font-family: var(--font-mono); }
.usage .row .total { color: var(--muted); }
.usage .meter {
  height: 8px; background: var(--surface-tint); border-radius: 99px; overflow: hidden;
}
.usage .meter .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; }
.usage .meter .fill.warn { background: var(--warn); }
.usage .meter .fill.danger { background: var(--danger); }

/* ── Helpers ── */
.flex { display: flex; align-items: center; gap: 8px; }
.flex.col { flex-direction: column; align-items: flex-start; }
.flex.between { justify-content: space-between; }
.flex.wrap { flex-wrap: wrap; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-36 { margin-top: 36px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-36 { margin-bottom: 36px; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.fg { color: var(--fg); }
.success { color: var(--success); }
.danger { color: var(--danger); }
.accent { color: var(--accent-700); }
.text-12 { font-size: 12px; } .text-13 { font-size: 13px; } .text-14 { font-size: 14px; }
.weight-500 { font-weight: 500; } .weight-600 { font-weight: 600; }
.tnum { font-variant-numeric: tabular-nums; }
.right { margin-left: auto; }
.hidden { display: none !important; }

/* ── Theme toggle + side-foot row ── */
.side-tools {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  padding: 4px 4px 0;
}
.side-tools .theme-toggle {
  flex: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.side-tools .theme-toggle:hover { background: var(--surface-tint); }
.side-tools .theme-toggle .ico { width: 14px; height: 14px; color: var(--muted); }
.side-tools .theme-toggle .lbl { line-height: 1; }
.side-tools .theme-toggle .sun { display: inline; }
.side-tools .theme-toggle .moon { display: none; }
[data-theme="dark"] .side-tools .theme-toggle .sun { display: none; }
[data-theme="dark"] .side-tools .theme-toggle .moon { display: inline; }
.side-tools .icon-btn {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  position: relative;
}
.side-tools .icon-btn:hover { color: var(--fg); background: var(--surface-tint); }

/* ── Dark-mode component polish ── */
[data-theme="dark"] .upgrade {
  background:
    radial-gradient(circle at 100% 0%, rgba(124,92,255,0.20), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(91,122,255,0.16), transparent 65%),
    var(--surface);
}
[data-theme="dark"] .insight {
  background:
    radial-gradient(circle at 100% 0%, rgba(124,92,255,0.14), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(91,122,255,0.10), transparent 65%),
    var(--surface);
}
[data-theme="dark"] .brand-mark {
  box-shadow: 0 2px 8px rgba(91,122,255,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
[data-theme="dark"] .panel,
[data-theme="dark"] .seq-step,
[data-theme="dark"] .plan-box {
  background: var(--surface);
  border-color: var(--border-light);
}
[data-theme="dark"] .panel-foot,
[data-theme="dark"] .seq-step-head,
[data-theme="dark"] .email-preview,
[data-theme="dark"] .modal-foot { background: var(--surface-soft); }
[data-theme="dark"] .tbl thead th { background: var(--bg); color: var(--muted); }
[data-theme="dark"] .tbl tbody tr.selected { background: rgba(111,139,255,0.10); }
[data-theme="dark"] .row-icon,
[data-theme="dark"] .mb-card .av,
[data-theme="dark"] .reply-from .av { background: var(--surface-tint); }
[data-theme="dark"] .code {
  background: #050507;
  border: 1px solid var(--border-light);
}
[data-theme="dark"] .search-input,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--muted-2); }
[data-theme="dark"] .search-input .kbd { background: var(--surface-soft); border-color: var(--border-light); }
[data-theme="dark"] .chart .bar.muted,
[data-theme="dark"] .funnel-row .bar.muted,
[data-theme="dark"] .health-bar,
[data-theme="dark"] .usage .meter { background: var(--surface-tint); }
[data-theme="dark"] .stat-band,
[data-theme="dark"] .hero-stats { border-color: var(--border-light); }
[data-theme="dark"] .hs { border-right-color: var(--border-light); }
[data-theme="dark"] .ws-mark { box-shadow: 0 1px 2px rgba(0,0,0,0.4); }
[data-theme="dark"] .topbar { background: var(--bg); border-bottom-color: var(--border-light); }
[data-theme="dark"] .modal-head .x:hover { background: var(--surface-tint); }
[data-theme="dark"] select { appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
[data-theme="dark"] .reply-quote { background: var(--surface-tint); color: var(--fg-2); }

/* Scrollbar in dark mode */
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* Subtle theme-change transition (skipped during resize for perf) */
html:not(.is-resizing) body,
html:not(.is-resizing) .sidebar,
html:not(.is-resizing) .panel,
html:not(.is-resizing) .topbar,
html:not(.is-resizing) .btn,
html:not(.is-resizing) input,
html:not(.is-resizing) .tbl thead th,
html:not(.is-resizing) .tbl tbody td {
  transition: background-color .15s, border-color .15s, color .15s;
}

/* ─────────────────────────────────────────────────────────────────
   Toast notifications — fire-and-forget feedback
   ───────────────────────────────────────────────────────────────── */
.toast-host {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px 11px 12px;
  box-shadow: var(--shadow-modal);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  min-width: 240px; max-width: 380px;
  animation: toastIn .22s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toastOut .18s ease-in forwards; }
.toast .toast-ic {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--success-soft);
  color: var(--success-fg);
}
.toast.error .toast-ic { background: var(--danger-soft); color: var(--danger); }
.toast.info .toast-ic { background: var(--accent-soft); color: var(--accent-700); }
.toast.warn .toast-ic { background: var(--warn-soft); color: var(--warn); }
.toast .toast-msg { flex: 1; line-height: 1.4; }
.toast .toast-msg b { font-weight: 600; }
.toast .toast-x {
  color: var(--muted-2); cursor: pointer; padding: 2px 4px; border-radius: 4px;
  line-height: 0;
}
.toast .toast-x:hover { color: var(--fg); background: var(--surface-tint); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);   }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(.98); }
}

/* ─────────────────────────────────────────────────────────────────
   Dropdown menu (used by sidebar workspace switcher + user menu +
   row action menus on lists)
   ───────────────────────────────────────────────────────────────── */
.dd-wrap { position: relative; }
.dd-menu {
  position: absolute;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-modal);
  padding: 6px;
  z-index: 80;
  font-size: 13px;
  opacity: 0; transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity .12s, transform .12s;
}
.dd-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dd-menu.right { right: 0; }
.dd-menu.up    { bottom: calc(100% + 6px); }
.dd-menu.down  { top: calc(100% + 6px); }
.dd-menu .dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--fg-2);
  text-decoration: none;
  white-space: nowrap;
}
.dd-menu .dd-item:hover { background: var(--surface-tint); color: var(--fg); }
.dd-menu .dd-item .ico { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.dd-menu .dd-item:hover .ico { color: var(--fg-2); }
.dd-menu .dd-item.danger { color: var(--danger); }
.dd-menu .dd-item.danger:hover { background: var(--danger-soft); }
.dd-menu .dd-item.danger .ico { color: var(--danger); }
.dd-menu .dd-item .kbd {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted-2);
  background: var(--surface-tint);
  padding: 1px 5px; border-radius: 3px;
}
.dd-menu .dd-sep { height: 1px; background: var(--border-light); margin: 4px 2px; }
.dd-menu .dd-label {
  padding: 6px 10px 4px;
  font-size: 10.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.dd-menu .dd-check {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--accent);
  margin-left: auto;
  flex-shrink: 0;
}
[data-theme="dark"] .dd-menu { background: var(--surface); border-color: var(--border); }

/* Sidebar variants of dropdown (anchored to ws-switch + user-row) */
.ws-switch.dd-trigger,
.user-row.dd-trigger { position: relative; }
.dd-menu.sidebar-anchored {
  left: 0; right: 0;
  min-width: 0;
}

/* ─────────────────────────────────────────────────────────────────
   Confirm modal — used by sidebar.js confirm() helper for
   destructive actions
   ───────────────────────────────────────────────────────────────── */
.confirm-modal { max-width: 440px; }
.confirm-modal .modal-body { padding: 6px 22px 16px; }
.confirm-modal .icon-row {
  display: flex; gap: 14px; align-items: flex-start;
  margin-bottom: 8px;
}
.confirm-modal .icon-row .ic {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--danger-soft);
  color: var(--danger);
}
.confirm-modal.info .icon-row .ic { background: var(--accent-soft); color: var(--accent-700); }
.confirm-modal.warn .icon-row .ic { background: var(--warn-soft); color: var(--warn); }
.confirm-modal .ttl { font-weight: 600; font-size: 15px; margin-bottom: 4px; letter-spacing: -0.005em; }
.confirm-modal .msg { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ─────────────────────────────────────────────────────────────────
   Drawer (right-side slide-in) — used for lead detail quick view,
   campaign-step edit, etc.
   ───────────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: var(--backdrop);
  display: none;
  z-index: 110;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0;
  width: 480px; max-width: 92vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
  z-index: 120;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 12px;
}
.drawer-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.drawer-head .x { margin-left: auto; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; line-height: 0; }
.drawer-head .x:hover { background: var(--surface-tint); color: var(--fg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border-light); background: var(--surface-soft); display: flex; gap: 8px; }
.drawer-foot .right { margin-left: auto; display: flex; gap: 8px; }

/* ─────────────────────────────────────────────────────────────────
   Sticky save bar — shown by markDirty() / shown when a form has
   pending edits
   ───────────────────────────────────────────────────────────────── */
.save-bar {
  position: fixed; bottom: 18px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--fg); color: var(--on-fg);
  border-radius: 12px;
  padding: 8px 8px 8px 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  box-shadow: var(--shadow-modal);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .22s cubic-bezier(.2,.8,.2,1);
}
.save-bar.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.save-bar .msg { color: color-mix(in srgb, var(--on-fg) 70%, transparent); }
.save-bar .msg b { color: var(--on-fg); font-weight: 600; }
.save-bar button {
  font-family: var(--font-sans);
  font-size: 12.5px; font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  border: 0; cursor: pointer;
}
.save-bar .discard { background: transparent; color: var(--on-fg); }
.save-bar .discard:hover { background: color-mix(in srgb, var(--on-fg) 12%, transparent); }
.save-bar .save { background: var(--on-fg); color: var(--fg); }
.save-bar .save:hover { filter: brightness(0.92); }

/* ─────────────────────────────────────────────────────────────────
   Final dark-mode polish — tabs, sub heads, dashboards
   ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] .tabs { border-bottom-color: var(--border-light); }
[data-theme="dark"] .tabs .count { background: var(--surface-tint); color: var(--muted); }
[data-theme="dark"] .tabs a.active,
[data-theme="dark"] .tabs button.active { border-bottom-color: var(--fg); color: var(--fg); }
[data-theme="dark"] .seq-delay,
[data-theme="dark"] .seq-add { background: var(--surface-soft); border-color: var(--border-light); color: var(--muted); }
[data-theme="dark"] .seq-add:hover { color: var(--fg); border-color: var(--fg); background: var(--surface-tint); }
[data-theme="dark"] .filter-chip { background: var(--surface); color: var(--fg-2); border-color: var(--border-light); }
[data-theme="dark"] .filter-chip:hover { background: var(--surface-tint); }
[data-theme="dark"] .filter-chip.active { background: var(--fg); color: var(--on-fg); border-color: var(--fg); }
[data-theme="dark"] .filter-chip .count { background: var(--surface-soft); color: var(--muted); }
[data-theme="dark"] .filter-chip.active .count { background: color-mix(in srgb, var(--on-fg) 18%, transparent); color: var(--on-fg); }
[data-theme="dark"] .lock-pill { background: var(--fg); color: var(--on-fg); }
[data-theme="dark"] .activity .act-ic.ai { background: rgba(147,119,255,0.18); color: var(--accent-3); }
[data-theme="dark"] .ai-flag { background: rgba(147,119,255,0.18) !important; color: var(--accent) !important; }
[data-theme="dark"] .ai-flag.handled { background: var(--success-soft) !important; color: var(--success-fg) !important; }
[data-theme="dark"] .stepper .step .num { background: var(--surface-tint); color: var(--muted); }
[data-theme="dark"] .step.active .num { background: var(--fg); color: var(--on-fg); }
[data-theme="dark"] .step.done .num { background: var(--success); color: #0B0B0E; }
[data-theme="dark"] .step.active { background: var(--surface); }
[data-theme="dark"] .cr-cta .btn-light { background: var(--fg); color: var(--on-fg); }
[data-theme="dark"] .mb-card:hover { background: var(--surface-tint); }
[data-theme="dark"] hr { border-color: var(--border-light); }
[data-theme="dark"] .ws-mark,
[data-theme="dark"] .user-av { color: #FFFFFF; }
[data-theme="dark"] .badge.draft { background: var(--surface-tint); color: var(--muted); }
[data-theme="dark"] .insight .ic { box-shadow: 0 4px 12px -2px rgba(91,122,255,0.5); }
[data-theme="dark"] .reply-card .reply-draft { color: var(--fg); }
[data-theme="dark"] .reply-from .av { color: var(--fg); }
[data-theme="dark"] .empty .ic { background: var(--surface-tint); color: var(--muted); }
[data-theme="dark"] .health-bar .fill.warn { background: var(--warn); }
[data-theme="dark"] .funnel-row .bar { background: linear-gradient(90deg, var(--accent), var(--accent-3)); }
[data-theme="dark"] .usage .meter .fill { background: linear-gradient(90deg, var(--accent), var(--accent-3)); }
[data-theme="dark"] .toggle { background: var(--surface-tint); }
[data-theme="dark"] .toggle.on { background: var(--accent); }
[data-theme="dark"] .toggle::after { background: #FFFFFF; }
[data-theme="dark"] .ws-chev,
[data-theme="dark"] .nav-label { color: var(--muted); }
[data-theme="dark"] .side-foot .upgrade .ttl { color: var(--fg); }
[data-theme="dark"] .side-foot .upgrade .cta { background: var(--accent); color: #FFFFFF; border: 0; }

/* dark-mode: settings nav, drawers, save-bar contrast tweaks */
[data-theme="dark"] .settings-nav a.active { background: var(--surface); box-shadow: 0 0 0 1px var(--border-light); }
[data-theme="dark"] .save-bar { background: var(--surface); color: var(--fg); border: 1px solid var(--border); }
[data-theme="dark"] .save-bar .save { background: var(--accent); color: #FFFFFF; }
[data-theme="dark"] .save-bar .discard { color: var(--fg-2); }
[data-theme="dark"] .save-bar .discard:hover { background: var(--surface-tint); }
[data-theme="dark"] .save-bar .msg b { color: var(--fg); }
[data-theme="dark"] .save-bar .msg { color: var(--muted); }
