/* ================================================================
   Engage — Admin Console
   Design system + page styles
   ================================================================ */

/* -- Tokens ------------------------------------------------------ */
:root {
  --bg:            #FAFAF7;
  --surface:       #FFFFFF;
  --surface-2:     #F5F4EE;
  --surface-3:     #EDEAE0;
  --fg:            #101012;
  --fg-muted:      #5C5C5E;
  --fg-subtle:     #8C8C8E;
  --border:        #E5E5E0;
  --border-strong: #D4D0C4;

  --accent:        #0071BB;
  --accent-hover:  #005A95;
  --accent-soft:   #D6EAF7;
  --accent-fg:     #FFFFFF;

  --teal:          #1F6F6B;
  --navy:          #2A4F8C;

  --hot:           #DC2626;
  --hot-soft:      #FEE2E2;
  --warm:          #D97706;
  --warm-soft:     #FEF3C7;
  --cold:          #2563EB;
  --cold-soft:     #DBEAFE;
  --success:       #16A34A;
  --success-soft:  #DCFCE7;
  --danger:        #DC2626;

  --radius-sm:     4px;
  --radius:        6px;
  --radius-lg:     10px;

  --shadow-sm:     0 1px 2px rgba(16,16,18,0.04);
  --shadow:        0 2px 8px rgba(16,16,18,0.06), 0 1px 2px rgba(16,16,18,0.04);
  --shadow-lg:     0 12px 32px rgba(16,16,18,0.10), 0 2px 6px rgba(16,16,18,0.06);

  --header-h:      56px;
  --sidebar-w:     232px;

  --font-ui:       'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif:    'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono:     'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* -- Reset ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
img, svg { display: block; max-width: 100%; }

/* tabular numerals on anything number-y */
.num, td.num, .stat, .stat-value, table tbody td:not(.text) { font-variant-numeric: tabular-nums; }

/* -- Auth shell (login, dealership-select) ----------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, rgba(196,84,26,0.06), transparent 60%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #2A8FD0 100%);
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 14px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-name .domain { font-weight: 400; color: var(--fg-subtle); margin-left: 2px; }

.auth-title { font-size: 22px; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-subtitle { color: var(--fg-muted); margin-bottom: 28px; font-size: 13px; }

.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; color: var(--fg-muted); }
.input, .select, textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--fg-subtle); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 13px;
  letter-spacing: -0.005em;
  transition: background .12s, border-color .12s, color .12s, transform .04s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary    { background: var(--fg); color: #fff; }
.btn-primary:hover  { background: #2a2a2c; }
.btn-accent     { background: var(--accent); color: #fff; }
.btn-accent:hover  { background: var(--accent-hover); }
.btn-secondary  { background: var(--surface); color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost      { background: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn-block      { width: 100%; }
.btn-lg         { height: 44px; padding: 0 22px; font-size: 14px; }
.btn[disabled]  { opacity: 0.5; cursor: not-allowed; }

.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.hint  { font-size: 12px; color: var(--fg-subtle); margin-top: 6px; }

.auth-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-subtle);
  text-align: center;
}

/* -- Dealership select ------------------------------------------ */
.deal-select-wrap {
  width: 100%;
  max-width: 880px;
  padding: 60px 24px;
}
.deal-select-header { text-align: center; margin-bottom: 36px; }
.deal-select-header h1 { font-size: 28px; letter-spacing: -0.02em; margin-bottom: 8px; }
.deal-select-header p  { color: var(--fg-muted); }

.deal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.deal-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
  text-align: left;
  position: relative;
}
.deal-card:hover {
  border-color: var(--fg);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.deal-card .monogram {
  width: 44px; height: 44px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}
.deal-card h3 { font-size: 16px; margin-bottom: 4px; }
.deal-card .city { color: var(--fg-muted); font-size: 13px; margin-bottom: 16px; }
.deal-card .stats { display: flex; gap: 16px; font-size: 12px; }
.deal-card .stats span { color: var(--fg-subtle); }
.deal-card .stats strong { color: var(--fg); font-weight: 600; }

/* -- App shell --------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; margin-bottom: 24px; }
.sidebar .brand .brand-name { font-size: 15px; }

.dealer-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  cursor: pointer;
  transition: background .12s;
  background: var(--surface);
}
.dealer-pill:hover { background: var(--surface-2); }
.dealer-pill .monogram {
  width: 26px; height: 26px;
  border-radius: 5px;
  display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 700;
}
.dealer-pill .name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dealer-pill .chev { color: var(--fg-subtle); font-size: 10px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.active { background: var(--surface-3); color: var(--fg); font-weight: 600; }
.nav .ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: 0.7; }
.nav a.active .ico { opacity: 1; }

.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-subtle); padding: 16px 10px 6px; font-weight: 600;
}

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  margin-left: -14px; margin-right: -14px;
  padding-left: 24px; padding-right: 24px;
}
.user-card .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--fg);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.user-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-card .info .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .info .email { font-size: 11px; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  margin-left: -14px; margin-right: -14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  text-align: left;
  width: calc(100% + 28px);
  transition: background .12s, color .12s;
}
.sidebar-signout svg { flex-shrink: 0; }
.sidebar-signout:hover {
  background: var(--surface-2);
  color: var(--danger);
}

/* -- Main / Topbar / Page --------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-muted); min-width: 0; flex-wrap: wrap; }
.topbar .crumbs a:hover { color: var(--fg); }
.topbar .crumbs .sep { color: var(--fg-subtle); }
.topbar .crumbs .here { color: var(--fg); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

/* hamburger (mobile only) + sidebar close button + backdrop */
.topbar-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--fg-muted);
  flex-shrink: 0;
  margin-right: 4px;
}
.topbar-menu-btn:hover { background: var(--surface-2); color: var(--fg); }
.sidebar-close-btn {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--fg-muted);
  margin-left: auto;
}
.sidebar-close-btn:hover { background: var(--surface-2); color: var(--fg); }
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(16,16,18,0.32);
  opacity: 0; visibility: hidden;
  transition: opacity .18s, visibility .18s;
  z-index: 90;
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }

.page { padding: 32px; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 24px;
}
.page-header h1 { font-size: 26px; letter-spacing: -0.02em; }
.page-header .subtitle { color: var(--fg-muted); margin-top: 6px; font-size: 14px; }
.page-header .header-actions { display: flex; gap: 8px; }

/* -- KPI cards --------------------------------------------------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.kpi .label { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; }
.kpi .delta { font-size: 12px; color: var(--fg-subtle); margin-top: 6px; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }

/* clickable kpi (campaign detail page buckets, reporting page KPIs) */
.kpi.clickable { cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; position: relative; }
.kpi.clickable:hover { border-color: var(--fg); box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi .kpi-cta {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .12s;
}
.kpi.clickable:hover .kpi-cta { opacity: 1; }
.kpi .value.lead-hot  { color: var(--hot); }
.kpi .value.lead-warm { color: var(--warm); }
.kpi .value.lead-cold { color: var(--cold); }
.kpi .value.matchback { color: var(--success); }

/* -- Sections / cards -------------------------------------------- */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.section-header h2 { font-size: 14px; font-weight: 600; }
.section-header .meta { font-size: 12px; color: var(--fg-subtle); }
.section-body { padding: 20px; }
.section-body.flush { padding: 0; }

/* -- Status badges ----------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--fg-muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active   { color: var(--success); background: var(--success-soft); }
.badge.complete { color: var(--fg-muted); background: var(--surface-3); }
.badge.draft    { color: var(--fg-muted); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.badge.scheduled{ color: var(--cold); background: var(--cold-soft); }
.badge.paused   { color: var(--warm); background: var(--warm-soft); }

.badge.score-hot  { color: var(--hot);  background: var(--hot-soft);  }
.badge.score-warm { color: var(--warm); background: var(--warm-soft); }
.badge.score-cold { color: var(--cold); background: var(--cold-soft); }

.badge.channel-direct_mail { color: var(--accent); background: var(--accent-soft); }
.badge.channel-email       { color: var(--teal);   background: #DCEEEC; }
.badge.channel-sms         { color: #166534;       background: #DCFCE7; }

/* -- Tables ------------------------------------------------------ */
table.table { width: 100%; }
.table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  font-weight: 600;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; transition: background .08s; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .row-title { font-weight: 600; color: var(--fg); }
.table .row-sub { font-size: 12px; color: var(--fg-subtle); margin-top: 2px; }
.table td.num { text-align: right; }
.table th.num { text-align: right; }

/* -- Empty states ------------------------------------------------ */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--fg-muted);
}
.empty h3 { font-size: 16px; color: var(--fg); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* -- Drawer (slide-in) ------------------------------------------- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(16,16,18,0.32);
  opacity: 0; visibility: hidden;
  transition: opacity .18s, visibility .18s;
  z-index: 1000;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 600px; max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1001;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-header h2 { font-size: 16px; }
.drawer-header .meta { font-size: 12px; color: var(--fg-subtle); margin-top: 4px; }
.drawer-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--fg-subtle);
}
.drawer-close:hover { background: var(--surface-2); color: var(--fg); }
.drawer-body { flex: 1; overflow-y: auto; }

/* -- Map --------------------------------------------------------- */
#campaign-map { height: 480px; width: 100%; border-radius: var(--radius); overflow: hidden; }
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  font-family: var(--font-ui) !important;
}
.leaflet-popup-content { margin: 12px 14px !important; font-size: 13px !important; }
.leaflet-popup-content .pop-name { font-weight: 600; margin-bottom: 4px; }
.leaflet-popup-content .pop-vehicle { color: var(--fg-muted); font-size: 12px; margin-bottom: 6px; }
.leaflet-popup-content .pop-row { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; }
.leaflet-popup-content .pop-row .k { color: var(--fg-subtle); }
.leaflet-popup-content .pop-row .v { font-weight: 600; }
.leaflet-popup-content .pop-row .v.sales { color: var(--accent); }
.leaflet-popup-content .pop-row .v.service { color: var(--teal); }

.legend {
  display: flex; gap: 16px; align-items: center;
  font-size: 12px; color: var(--fg-muted);
}
.legend .swatch { width: 10px; height: 10px; border-radius: 50%; }

/* -- Wizard ------------------------------------------------------ */
.wizard { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: flex-start; }
.steps {
  position: sticky; top: calc(var(--header-h) + 32px);
  display: flex; flex-direction: column; gap: 2px;
}
.step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.step:hover { background: var(--surface-2); color: var(--fg); }
.step.current { color: var(--fg); background: var(--surface-3); font-weight: 600; }
.step.done { color: var(--fg); }
.step .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  flex-shrink: 0;
}
.step.current .num { background: var(--fg); color: #fff; border-color: var(--fg); }
.step.done .num { background: var(--success); color: #fff; border-color: var(--success); }
.step.done .num::before { content: "✓"; }
.step.done .num span { display: none; }

.wizard-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  min-height: 480px;
  display: flex; flex-direction: column;
}
.wizard-pane h2 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 4px; }
.wizard-pane .pane-sub { color: var(--fg-muted); margin-bottom: 24px; font-size: 13px; }
.wizard-actions {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border);
}

/* -- Audience grid (wizard step 1) ------------------------------ */
.audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.audience-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  background: var(--surface);
  text-align: left;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.audience-card:hover { border-color: var(--fg); }
.audience-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.audience-card.selected::after {
  content: "✓";
  position: absolute; top: 12px; right: 12px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.audience-card .name { font-weight: 600; font-size: 14px; }
.audience-card .desc { font-size: 12px; color: var(--fg-muted); line-height: 1.45; }
.audience-card .meta { display: flex; gap: 12px; font-size: 11px; color: var(--fg-subtle); margin-top: 4px; }
.audience-card .src-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.src-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-muted);
  font-weight: 500;
}

/* -- Channel chooser -------------------------------------------- */
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  text-align: center;
  background: var(--surface);
  position: relative;
}
.choice-card:hover { border-color: var(--fg); }
.choice-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice-card .ico-big { font-size: 28px; margin-bottom: 12px; }
.choice-card .name { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.choice-card .desc { font-size: 12px; color: var(--fg-muted); }

/* -- Artwork grid ------------------------------------------------ */
.artwork-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.artwork-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  display: flex; flex-direction: column;
}
.artwork-card:hover { border-color: var(--fg); transform: translateY(-1px); box-shadow: var(--shadow); }
.artwork-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.artwork-thumb {
  height: 180px;
  background: var(--surface-3);
  background-size: cover; background-position: center;
  border-bottom: 1px solid var(--border);
}
.artwork-meta { padding: 12px 14px; }
.artwork-meta .name { font-weight: 600; font-size: 13px; }
.artwork-meta .format { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }

/* -- Preview step (wizard step 5) -------------------------------- */
.preview-slot {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.preview-slot .k {
  font-size: 10px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 4px;
}
.preview-slot .v {
  font-size: 13px;
  font-weight: 500;
  word-wrap: break-word;
}
.preview-slot .v .muted { font-weight: 400; }

/* -- Review (wizard step 6) ------------------------------------- */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.review-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.review-item .label { font-size: 11px; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.review-item .val { font-weight: 600; margin-top: 4px; }

/* -- Campaign detail page ---------------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.artwork-preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.artwork-preview-card .thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: #fff;
}
.artwork-preview-card .thumb svg, .artwork-preview-card .thumb img { display: block; width: 100%; height: auto; }
.artwork-preview-card .label { font-size: 11px; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 4px; }
.artwork-preview-card h3 { font-size: 15px; }
.artwork-preview-card .meta { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

.stat-buckets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-buckets.three { grid-template-columns: repeat(3, 1fr); }
.stat-bucket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.stat-bucket:hover { border-color: var(--fg); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-bucket .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); font-weight: 600; }
.stat-bucket .val { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1; }
.stat-bucket .pct { font-size: 12px; color: var(--fg-subtle); margin-top: 6px; }
.stat-bucket.hot  .val { color: var(--hot); }
.stat-bucket.warm .val { color: var(--warm); }
.stat-bucket.cold .val { color: var(--cold); }
.stat-bucket.matchback { background: linear-gradient(135deg, var(--surface), var(--success-soft)); }
.stat-bucket.matchback .val { color: var(--success); }
.stat-bucket.revenue { background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.stat-bucket.revenue .val { color: var(--accent); font-size: 22px; }

.campaign-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 14px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
}
.campaign-meta-strip .item .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-subtle); font-weight: 600; }
.campaign-meta-strip .item .v { font-weight: 600; margin-top: 2px; }

/* -- Recipient list (in drawer) ---------------------------------- */
.recipient-list { padding: 12px 0; }
.recipient-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}
.recipient-row:last-child { border-bottom: none; }
.recipient-row .left { min-width: 0; }
.recipient-row .name { font-weight: 600; font-size: 14px; }
.recipient-row .sub  { font-size: 12px; color: var(--fg-subtle); margin-top: 2px; }
.recipient-row .right { text-align: right; }
.recipient-row .right .amt { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

/* -- Recipient row clickable affordance ------------------------- */
.recipient-row.clickable { cursor: pointer; transition: background .08s; }
.recipient-row.clickable:hover { background: var(--surface-2); }
.recipient-row .row-chev {
  display: inline-block;
  margin-left: 10px;
  color: var(--fg-subtle);
  font-size: 18px;
  vertical-align: middle;
}

/* -- Lead detail (drilldown from drawer) ------------------------ */
.lead-back-btn {
  font-size: 12px;
  color: var(--fg-muted);
  background: none;
  padding: 0;
  margin-bottom: 4px;
}
.lead-back-btn:hover { color: var(--fg); }

.lead-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
  padding: 0 24px;
  gap: 4px;
}
.lead-tab {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.lead-tab:hover { color: var(--fg); }
.lead-tab.active {
  color: var(--fg);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

#lead-tab-content { padding: 16px 24px 24px; }

/* Conversation transcript */
.transcript { display: flex; flex-direction: column; gap: 12px; }
.msg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  max-width: 100%;
}
.msg .msg-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 8px;
}
.msg .msg-time {
  font-size: 11px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.msg .msg-content { margin-top: 6px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg-ai { background: var(--surface); }
.msg-user {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  margin-left: 24px;
}
.msg-user .msg-label { color: var(--accent); }
.msg-system {
  background: var(--surface-2);
  border-style: dashed;
  font-size: 12px;
}
.msg-system .msg-content { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.msg-tool, .msg-tool-result {
  background: #0F1115;
  color: #E8E8E3;
  border-color: #2a2a2c;
}
.msg-tool .msg-label, .msg-tool-result .msg-label { color: #6BA8E8; }
.msg-tool .msg-time, .msg-tool-result .msg-time { color: #6B7280; }
.msg-tool .tool-args {
  font-family: var(--font-mono);
  font-size: 11px;
  background: #000;
  padding: 8px 10px;
  border-radius: 4px;
  margin-top: 8px;
  margin-bottom: 0;
  overflow-x: auto;
  color: #C0C0C0;
}
.msg-tool-result .msg-content {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #88C088;
}
.msg-tool-result .tool-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #B0B0B0;
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px solid #2a2a2c;
}

/* Lead summary */
.lead-summary { display: grid; gap: 10px; }
.lead-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
}
.lead-row .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  font-weight: 600;
  padding-top: 2px;
}
.lead-row .v { font-weight: 500; word-wrap: break-word; }
.lead-row .v code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 3px;
}

/* CRM delivery */
.lead-crm .section-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--fg-muted);
  margin: 18px 0 8px;
}
.lead-crm .section-tag:first-child { margin-top: 0; }
.delivery-log { display: grid; gap: 6px; margin-bottom: 16px; }
.delivery-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}
.delivery-row .k {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-subtle);
  padding-top: 2px;
}
.adf-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  background: #0F1115;
  color: #E8E8E3;
  padding: 16px;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 480px;
  line-height: 1.55;
  margin: 0;
  white-space: pre;
}

/* -- Inline overlay loader -------------------------------------- */
.loading-row {
  padding: 32px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 13px;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -- Toast ------------------------------------------------------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 2000;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* -- Settings page ---------------------------------------------- */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: flex-start;
}
.settings-nav {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  display: flex; flex-direction: column;
  gap: 2px;
}
.settings-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.settings-nav a:hover { background: var(--surface-2); color: var(--fg); }
.settings-nav a.active { background: var(--surface-3); color: var(--fg); font-weight: 600; }

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.settings-panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.settings-panel-header h2 { font-size: 16px; margin-bottom: 4px; }
.settings-panel-header .muted { font-size: 13px; }
.settings-panel-body { padding: 8px 24px 18px; }

.settings-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px dashed var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .k {
  font-size: 13px;
  font-weight: 600;
  padding-top: 8px;
}
.settings-row .v { min-width: 0; }
.settings-row .v .input,
.settings-row .v .select { width: 100%; max-width: 480px; }
.settings-row .v .textarea {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  outline: none;
  resize: vertical;
  background: var(--surface);
}
.settings-row .v .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings-divider { height: 1px; background: var(--border); margin: 8px 0; }

/* toggle row */
.settings-row.toggle-row .v { display: flex; align-items: center; justify-content: flex-end; padding-top: 4px; }
.toggle-label { font-size: 13px; font-weight: 600; }
.switch {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  transition: background .15s, border-color .15s;
}
.switch span::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }

/* integration row */
.integration-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}
.integration-row:last-child { border-bottom: none; }
.integration-row .ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
}
.integration-row .info { flex: 1; min-width: 0; }
.integration-row .info strong { font-size: 13px; }

/* hours grid */
.hours-grid { display: grid; gap: 6px; }
.hours-row {
  display: grid;
  grid-template-columns: 50px 130px auto 130px auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.hours-row .day { font-weight: 600; }
.hours-row .closed-toggle { font-size: 12px; color: var(--fg-muted); cursor: pointer; }
.hours-row .closed-toggle input { margin-right: 4px; }

/* avatar large */
.avatar-large {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--fg);
  color: #fff;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
}

/* session row in security */
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.session-row:last-child { border-bottom: none; }

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-row { grid-template-columns: 1fr; }
}

/* -- Leads toolbar (search + filter pills) ---------------------- */
.leads-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.leads-search {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 420px;
}
.leads-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-subtle);
  pointer-events: none;
}
.leads-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.leads-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.leads-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.filter-pill {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, background .12s;
}
.filter-pill:hover { border-color: var(--fg); }
.filter-pill .muted { color: var(--fg-subtle); margin-right: 4px; }
.filter-pill strong { font-weight: 600; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.date-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--fg);
  background: none;
  cursor: pointer;
}
.date-opt:hover { background: var(--surface-2); }
.date-opt.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* -- Reporting filter bar + popover ----------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-bar .filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.filter-bar .filter-trigger {
  flex: 0 1 380px;
  min-width: 240px;
  height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--fg);
  transition: border-color .12s, box-shadow .12s;
}
.filter-bar .filter-trigger:hover { border-color: var(--fg); }
.filter-bar .filter-trigger .chev { color: var(--fg-subtle); font-size: 11px; }
.filter-bar .btn-clear { height: 36px; padding: 0 12px; font-size: 12px; }
.filter-bar .spacer { flex: 1; }
.filter-bar .filter-status { font-size: 12px; color: var(--fg-muted); }
.filter-bar .filter-status strong { color: var(--fg); font-weight: 600; }

.filter-popover {
  position: fixed;
  z-index: 1500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 520px;
}
.filter-search-wrap { padding: 12px; border-bottom: 1px solid var(--border); }
.filter-search {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  font: inherit;
  background: var(--surface);
}
.filter-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.filter-list { flex: 1; overflow-y: auto; padding: 6px; }
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}
.filter-row:hover { background: var(--surface-2); }
.filter-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px; height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.filter-row .info { flex: 1; min-width: 0; }
.filter-row .info .name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filter-row .info .meta {
  font-size: 11px; color: var(--fg-subtle);
  margin-top: 4px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.filter-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 13px;
}
.filter-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
}
.filter-bulk { display: flex; gap: 14px; }
.btn-link {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.btn-link:hover { text-decoration: underline; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { height: 32px; padding: 0 14px; font-size: 12px; }

/* -- Reporting page grid ---------------------------------------- */
.report-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .report-grid { grid-template-columns: 1fr; }
}

/* -- Campaigns list (toolbar with tabs + search) ---------------- */
.campaigns-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.tab {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.tab:hover { color: var(--fg); }
.tab.active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.search-wrap { width: 280px; max-width: 100%; }
.search-wrap .input { height: 36px; }

/* -- Dealer picker (searchable combobox) ------------------------ */
.dealer-picker { position: relative; width: 100%; }
.dealer-picker-input-wrap { position: relative; }
.dealer-picker-input {
  padding-left: 36px;
  height: 40px;
  font-size: 14px;
}
.dealer-picker-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-subtle);
  pointer-events: none;
}
.dealer-picker-list {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 360px;
  overflow-y: auto;
}
.dealer-picker-count {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--fg-subtle);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.dealer-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.dealer-picker-row:last-child { border-bottom: none; }
.dealer-picker-row:hover,
.dealer-picker-row.active { background: var(--surface-2); }
.dealer-picker-row.current { background: var(--accent-soft); }
.dealer-picker-row.current.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.dealer-picker-row .monogram {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.dealer-picker-row .info { flex: 1; min-width: 0; }
.dealer-picker-row .info .name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dealer-picker-row .info .meta {
  font-size: 11px; color: var(--fg-subtle); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dealer-picker-row .badge.tiny {
  font-size: 9px; padding: 1px 6px; margin-left: 6px;
}
.dealer-picker-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 13px;
}
.dealer-picker-empty .strong { color: var(--fg); font-weight: 600; }

.dealer-picker-popover {
  position: fixed;
  z-index: 1500;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
}
.dealer-picker-popover .dealer-picker-list { max-height: 380px; }

/* -- Misc -------------------------------------------------------- */
.dot-sep { color: var(--fg-subtle); margin: 0 6px; }
.tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  background: var(--surface-3);
  border-radius: 3px;
  color: var(--fg-muted);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* -- Responsive bits -------------------------------------------- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 12px; }
  .step { white-space: nowrap; }
}
@media (max-width: 720px) {
  /* Off-canvas sidebar */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    max-width: 86vw;
    padding: 16px 14px;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: inline-flex; }
  .topbar-menu-btn { display: inline-flex; }

  /* Topbar + page chrome */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .crumbs { font-size: 12px; }
  .page { padding: 16px; }

  /* Page header: title row, then actions wrap below full-width */
  .page-header { flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
  .page-header h1 { font-size: 22px; }
  .page-header .header-actions { flex-wrap: wrap; width: 100%; }
  .page-header .header-actions .btn { flex: 1 1 auto; }

  /* Tables: allow horizontal scroll when overflowing */
  .section-body.flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table thead th { padding: 10px 12px; }
  .table tbody td { padding: 12px; }

  /* Section + wizard padding */
  .section-header { padding: 12px 16px; }
  .section-body { padding: 16px; }
  .wizard-pane { padding: 20px; min-height: 0; }
  .wizard-actions { margin-top: 20px; padding-top: 16px; }
  .wizard-actions .btn { flex: 1 1 auto; }

  /* Settings panel */
  .settings-panel-header { padding: 14px 16px; }
  .settings-panel-body { padding: 4px 16px 12px; }

  /* Toolbars */
  .campaigns-toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { width: 100%; }
  .tabs { overflow-x: auto; }
  .leads-search { min-width: 0; max-width: none; flex: 1 1 100%; }

  /* Data row layouts collapse on narrow screens */
  .lead-row, .delivery-row { grid-template-columns: 1fr; gap: 4px; }
  .lead-row .k, .delivery-row .k { padding-top: 0; }
  .recipient-row { padding: 12px 16px; }

  /* Auth */
  .auth-page { padding: 16px; }
  .auth-card { padding: 28px 24px; }

  /* Layout collapses */
  .review-grid, .choice-grid, .choice-grid.three { grid-template-columns: 1fr; }
  .stat-buckets, .stat-buckets.three { grid-template-columns: 1fr 1fr; }
  .campaign-meta-strip { gap: 14px; padding: 12px 16px; }

  /* User-message indent reads as gutter, not push, on narrow screens */
  .msg-user { margin-left: 12px; }
}

@media (max-width: 520px) {
  .drawer { width: 100%; max-width: 100%; }
  .page-header h1 { font-size: 20px; }
  .stat-buckets, .stat-buckets.three { grid-template-columns: 1fr; }
  .filter-popover, .dealer-picker-popover {
    left: 12px !important;
    right: 12px;
    width: auto !important;
  }
}
