/* ═══════════════════════════════════════════════════════════
   Lead Engine AI — Dashboard styles
   Theme tokens on :root; [data-theme] on <html> switches them.
   ═══════════════════════════════════════════════════════════ */

:root,
:root[data-theme="dark"] {
  --bg:          #0b0d12;
  --surface:     #12151c;
  --surface-2:   #181c25;
  --surface-3:   #1f2430;
  --border:      #262b38;
  --border-soft: #1d212c;
  --text:        #e6e8ee;
  --text-2:      #9aa1b2;
  --text-3:      #6b7285;
  --accent:      #6366f1;
  --accent-h:    #7c7ff5;
  --accent-soft: rgba(99, 102, 241, .14);
  --green:       #22c55e;
  --green-soft:  rgba(34, 197, 94, .14);
  --orange:      #f59e0b;
  --orange-soft: rgba(245, 158, 11, .14);
  --purple:      #c026d3;
  --purple-soft: rgba(192, 38, 211, .14);
  --blue:        #3b82f6;
  --blue-soft:   rgba(59, 130, 246, .14);
  --red:         #ef4444;
  --red-soft:    rgba(239, 68, 68, .14);
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --row-hover:   #161a23;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:          #f6f7f9;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --surface-3:   #f1f3f6;
  --border:      #e3e6ec;
  --border-soft: #eef0f3;
  --text:        #111827;
  --text-2:      #4b5563;
  --text-3:      #8a93a3;
  --accent:      #4f46e5;
  --accent-h:    #4338ca;
  --accent-soft: rgba(79, 70, 229, .09);
  --green:       #16a34a;
  --green-soft:  rgba(22, 163, 74, .10);
  --orange:      #d97706;
  --orange-soft: rgba(217, 119, 6, .10);
  --purple:      #a21caf;
  --purple-soft: rgba(162, 28, 175, .09);
  --blue:        #2563eb;
  --blue-soft:   rgba(37, 99, 235, .09);
  --red:         #dc2626;
  --red-soft:    rgba(220, 38, 38, .09);
  --shadow:      0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
  --row-hover:   #f8f9fb;
  color-scheme: light;
}

:root {
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
  display: flex;
  overflow: hidden;
}

svg { width: 16px; height: 16px; flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
code {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 12px; background: var(--surface-3);
  padding: 1px 5px; border-radius: 4px;
}
.hidden { display: none !important; }

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .2s ease;
  z-index: 20;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
}
.brand-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  font-size: 15px; flex-shrink: 0;
}
.brand-text { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { width: 17px; height: 17px; }
.nav-badge {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  padding: 1px 7px; border-radius: 10px;
}
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 8px;
}
.theme-toggle {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); display: grid; place-items: center; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); }
.wa-status-pill {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; cursor: pointer;
}
.wa-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.wa-status-pill.ready .wa-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.wa-status-pill.connecting .wa-dot { background: var(--orange); animation: pulse 1.2s infinite; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .wa-status-pill { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar-footer { justify-content: center; }

/* ─── Main + topbar ───────────────────────────────────── */
.main { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.sidebar-toggle {
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-2); border-radius: var(--radius-sm); display: grid; place-items: center;
}
.sidebar-toggle:hover { background: var(--surface-3); color: var(--text); }

/* ─── Progress banner ─────────────────────────────────── */
.progress-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 500;
}
.progress-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; }
.progress-info span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
.progress-bar-wrap { flex: 1; min-width: 80px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); border-radius: 3px; transition: width .3s ease; }
#progressPct { font-variant-numeric: tabular-nums; color: var(--accent); min-width: 36px; text-align: right; }

/* ─── Pages ───────────────────────────────────────────── */
.page { display: none; flex: 1; overflow-y: auto; padding: 22px 24px 28px; }
.page.active { display: block; }
.page-inner { max-width: 1400px; }
.section-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 18px; }
.page-lead-header { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-lead-header h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.page-lead-header p { color: var(--text-2); margin-top: 3px; }

.leads-tabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; }
.leads-tab { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: none; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.leads-tab:hover { color: var(--text); }
.leads-tab.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.leads-tab-count { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); }
.leads-tab.on .leads-tab-count { background: var(--accent-soft); color: var(--accent); }

/* ─── Stats row ───────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--text-3); }

/* ─── Pipeline ────────────────────────────────────────── */
.pipeline-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 14px; overflow-x: auto;
}
.pipeline-steps { display: flex; align-items: center; min-width: 620px; }
.pipeline-step {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 6px; border-radius: 20px;
  color: var(--text-3); font-weight: 500; white-space: nowrap;
  cursor: pointer; transition: background .12s, color .12s;
}
.pipeline-step:hover { background: var(--surface-3); color: var(--text-2); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  background: var(--surface-3); border: 1px solid var(--border);
}
.pipeline-step.active { color: var(--text); background: var(--accent-soft); }
.pipeline-step.active .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.pipeline-step.done { color: var(--text-2); }
.pipeline-step.done .step-num { background: var(--green-soft); border-color: transparent; color: var(--green); }
.pipeline-connector { flex: 1; height: 1px; background: var(--border); margin: 0 6px; min-width: 16px; }

/* ─── Panel cards ─────────────────────────────────────── */
.step-panel { margin-bottom: 14px; }
.panel-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.panel-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.panel-card--accent::before { background: var(--blue); }
.panel-card--purple::before { background: var(--purple); }
.panel-card--orange::before { background: var(--orange); }
.panel-card--green::before  { background: var(--green); }
.panel-card-header { margin-bottom: 14px; }
.panel-card-header h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.panel-card-sub { color: var(--text-2); margin-top: 2px; }

.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-input-wrap { flex: 1; min-width: 260px; position: relative; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-input {
  width: 100%; height: 42px; padding: 0 14px 0 38px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-input::placeholder { color: var(--text-3); }
.search-options { display: flex; gap: 10px; }
.search-options .select-sm { height: 42px; }
.search-options .btn { height: 42px; padding: 0 18px; }

.search-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.tag-label { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.tag {
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  transition: all .12s;
}
.tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.step2-actions, .step3-actions, .step4-actions, .step5-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.step3-actions, .step5-actions { margin-top: 12px; }
.hint { font-size: 12px; color: var(--text-3); }

/* ─── Forms ───────────────────────────────────────────── */
.input, .select, .textarea, .select-sm, .filter-input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.input, .select { width: 100%; height: 38px; padding: 0 12px; }
.textarea { width: 100%; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.select-sm { height: 34px; padding: 0 10px; font-size: 13px; }
.filter-input { height: 34px; padding: 0 12px; width: 220px; }
.input:focus, .select:focus, .textarea:focus, .select-sm:focus, .filter-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder, .filter-input::placeholder { color: var(--text-3); }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px;
}
.label-badge { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }
.label-badge.free { background: var(--green-soft); color: var(--green); }
.label-badge.set  { background: var(--blue-soft);  color: var(--blue); }

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover:not(:disabled) { filter: brightness(1.1); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger-ghost { background: var(--surface); border-color: var(--border); color: var(--red); }
.btn-danger-ghost:hover:not(:disabled) { color: var(--red); border-color: var(--red); background: var(--red-soft); }

/* ─── Table ───────────────────────────────────────────── */
.table-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead-count-badge {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 4px 10px; background: var(--surface-3); border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

.table-wrap { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.leads-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.leads-table th.sortable { cursor: pointer; user-select: none; }
.leads-table th.sortable:hover { color: var(--text); }
.sort-icon { opacity: .5; font-size: 10px; }
.leads-table th.sorted .sort-icon { opacity: 1; color: var(--accent); }

.leads-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  vertical-align: middle; white-space: nowrap;
}
.leads-table tbody tr:not(.empty-row) { cursor: pointer; transition: background .08s; }
.leads-table tbody tr:not(.empty-row):hover td { background: var(--row-hover); }
.leads-table tbody tr:last-child td { border-bottom: none; }

.col-num { width: 44px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cell-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cell-sub  { font-size: 12px; color: var(--text-3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cell-muted { color: var(--text-3); }
.cell-link { color: var(--accent); font-weight: 500; }
.cell-link:hover { text-decoration: underline; }
.cell-mono { font-variant-numeric: tabular-nums; }
.cell-trunc { max-width: 180px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.more-count { font-size: 11px; color: var(--text-3); margin-left: 4px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 12px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-preview   { background: var(--surface-3); color: var(--text-2); }
.badge-saved     { background: var(--blue-soft);   color: var(--blue); }
.badge-ig        { background: var(--purple-soft); color: var(--purple); }
.badge-enriched  { background: var(--orange-soft); color: var(--orange); }
.badge-completed { background: var(--green-soft);  color: var(--green); }
.badge-sample    { background: var(--surface-3); color: var(--text-3); }

.src-chip {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; margin-right: 3px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}

.row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all .12s;
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-3); }
.icon-btn.ig:hover:not(:disabled)   { color: var(--purple); border-color: var(--purple); background: var(--purple-soft); }
.icon-btn.wa:hover:not(:disabled)   { color: var(--green);  border-color: var(--green);  background: var(--green-soft); }
.icon-btn.call:hover:not(:disabled) { color: var(--blue);   border-color: var(--blue);   background: var(--blue-soft); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 20px; color: var(--text-3); text-align: center;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .6; }
.empty-state p { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty-state span { font-size: 12.5px; margin-top: 2px; }

.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2);
}
.pagination { display: flex; gap: 4px; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
.page-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Leads page gets a taller table */


/* ─── Settings ────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
}
.settings-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.settings-save-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.save-toast { color: var(--green); font-weight: 600; font-size: 13px; }

.wa-status-row { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.dot.ready { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.connecting, .dot.qr_pending { background: var(--orange); animation: pulse 1.2s infinite; }
.dot.failed { background: var(--red); }
.wa-actions { display: flex; gap: 8px; margin-top: 16px; }
.qr-container {
  margin-top: 14px; padding: 14px; text-align: center;
  background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.qr-container img { width: 220px; height: 220px; display: block; margin: 0 auto; }
.qr-hint { font-size: 12px; color: #4b5563; margin-bottom: 8px; }

/* ─── Modals ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 7, 12, .6); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; animation: fadeIn .15s ease; }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  animation: slideUp .18s ease;
}
.modal-lg { max-width: 680px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border: none; background: transparent; border-radius: 6px;
  color: var(--text-3); font-size: 14px;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.detail-grid dt { color: var(--text-3); font-size: 12px; font-weight: 500; padding-top: 1px; }
.detail-grid dd { font-weight: 500; word-break: break-word; }
.detail-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); margin: 20px 0 10px;
}
.detail-msg {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; white-space: pre-wrap; font-size: 13px;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ─── Toasts ──────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 13px; font-weight: 500;
  animation: slideIn .2s ease;
}
.toast::before { content: ''; width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); flex-shrink: 0; }
.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.warn::before    { background: var(--orange); }
.toast.leaving { opacity: 0; transform: translateX(20px); transition: all .2s ease; }

.key-alert-container {
  position: fixed; bottom: 20px; left: 20px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px; max-width: 360px;
}
.key-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--red); box-shadow: var(--shadow);
  font-size: 13px; font-weight: 500; animation: slideInLeft .2s ease;
}
.key-alert svg { width: 18px; height: 18px; color: var(--red); flex: none; margin-top: 1px; }
.key-alert span { flex: 1; line-height: 1.5; }
.key-alert-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 13px; flex: none; padding: 0 2px; }
.key-alert-close:hover { color: var(--text); }
.key-alert.leaving { opacity: 0; transform: translateX(-20px); transition: all .2s ease; }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-20px); } }

/* ─── Animations ──────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }

/* ─── Scrollbars ──────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .topbar-right .btn span, .topbar-right .btn-label { display: none; }
  .filter-input { width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .settings-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; }
  .detail-grid dd { margin-bottom: 8px; }
}

/* Progress meter: counter + elapsed time */
#progressPct { font-size: 13px; font-weight: 700; }
.progress-time { white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  font-variant-numeric: tabular-nums; min-width: 170px; text-align: right;
}

/* Verification chips in the Sources column */
.src-chip.ai   { background: var(--green-soft); color: var(--green); border-color: transparent; }
.src-chip.post { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.src-chip.warn { background: var(--orange-soft); color: var(--orange); border-color: transparent; }

/* Instagram account check */
.ig-ok { color: var(--green); font-weight: 700; }
.ig-missing { color: var(--red); text-decoration: line-through; font-size: 12.5px; }

/* Step card: "New search" sits at the top right of steps 2–5 */
.panel-card { padding: 16px 20px; }
.panel-card-header { position: relative; }
.panel-back { position: absolute; top: -2px; right: 0; }
.panel-card-header:has(.panel-back) { padding-right: 130px; }

/* Theme switch in the top bar */
.theme-switch svg { width: 15px; height: 15px; }

/* Search sources */
.source-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.src-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.src-toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.src-toggle input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.src-toggle .select-sm { height: 28px; font-size: 12px; }
.src-toggle .select-sm:disabled { opacity: .45; }

/* Maps data in the table */
.cell-addr { max-width: 240px; display: block; }
.src-chip.maps  { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.src-chip.insta { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.maps-result {
  margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; line-height: 1.6;
}
.maps-result.ok   { border-color: var(--green); background: var(--green-soft); }
.maps-result.warn { border-color: var(--orange); background: var(--orange-soft); }

/* Phone · WhatsApp column */
.phone-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.phone-link { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text); }
.phone-link:hover { color: var(--accent); text-decoration: underline; }
.wa-badge {
  width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center;
  background: #25D366; color: #fff; font-size: 10px; font-weight: 800; line-height: 1;
}
.wa-badge.unknown { background: transparent; color: var(--text-3); border: 1px dashed var(--text-3); font-weight: 600; }
#btnWaCheck .wa-badge { width: 16px; height: 16px; }

/* Sources column: overlapping logo circles */
.src-logos { display: flex; align-items: center; }
.src-logo {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: #fff; border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  margin-left: -8px; position: relative;
}
.src-logo:first-child { margin-left: 0; }
.src-logo svg { width: 15px; height: 15px; }
.src-logo.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.src-logo.instagram svg { width: 14px; height: 14px; }
.src-logo.warn { background: var(--orange); color: #fff; font-size: 12px; font-weight: 800; }
.src-logo:nth-child(1) { z-index: 3; } .src-logo:nth-child(2) { z-index: 2; } .src-logo:nth-child(3) { z-index: 1; }

/* Websites source */
.free-note { font-size: 10px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 1px 6px; border-radius: 8px; margin-left: 2px; }
.src-logo.website { background: #ecfdf5; }
.src-logo:nth-child(4) { z-index: 0; }
.web-dot { font-size: 13px; line-height: 1; }

/* ── Phase 4: fit score & AI profile ── */
.col-fit { min-width: 170px; }
.fit-wrap { display: flex; align-items: center; gap: 9px; }
.fit-text { min-width: 0; }
.fit-type { font-weight: 600; font-size: 12.5px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit-text .cell-sub { max-width: 170px; white-space: nowrap; }
.fit-pill {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 24px; padding: 0 6px; border-radius: 12px;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.fit-pill.hot  { background: var(--green-soft);  color: var(--green); }
.fit-pill.warm { background: var(--orange-soft); color: var(--orange); }
.fit-pill.cold { background: var(--surface-3);   color: var(--text-3); }
.fit-pill.big  { min-width: 48px; height: 36px; border-radius: 18px; font-size: 16px; }
.profile-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 6px; }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fit-bars { display: grid; gap: 6px; margin-bottom: 12px; }
.fit-bar { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.fit-bar b { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.fit-track { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.fit-track > div { height: 100%; background: var(--accent); border-radius: 3px; }
textarea.input { resize: vertical; min-height: 64px; font-family: inherit; line-height: 1.45; }

/* IndiaMART details */
.im-warn { color: var(--orange); font-weight: 600; }

/* ── API keys ── */
.settings-card--wide { grid-column: 1 / -1; }
.keys-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.keys-head h3 { margin-bottom: 4px; }
.keys-list { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.key-group { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface); min-width: 0; overflow-x: auto; }
.key-group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.key-group-head h4 { font-size: 14px; font-weight: 700; margin: 0 0 2px; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.keys-table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.keys-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.keys-table tr:last-child td { border-bottom: none; }
.key-name { font-weight: 600; white-space: nowrap; }
.key-role { display: inline-block; margin-top: 3px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 8px; }
.key-role.role-main { background: var(--green-soft); color: var(--green); }
.key-role.role-backup { background: var(--surface-3); color: var(--text-2); }
.key-mask { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; background: var(--surface-3); padding: 3px 8px; border-radius: 6px; }
.key-usage { min-width: 220px; }
.usage-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-bottom: 5px; max-width: 240px; }
.usage-bar > div { height: 100%; background: var(--green); border-radius: 3px; }
.usage-bar.mid > div { background: var(--orange); }
.usage-bar.low > div { background: var(--red); }
.usage-text { font-size: 12px; color: var(--text-2); }
.usage-text b { color: var(--text); }
.key-renew { white-space: nowrap; }
.key-actions { text-align: right; white-space: nowrap; }
.btn-xs { padding: 3px 9px; font-size: 11.5px; border-radius: 6px; }
.btn-xs.danger:hover { color: var(--red); border-color: var(--red); }
.key-err { color: var(--red); font-size: 12px; }
.key-none { margin-bottom: 10px; }
.key-add { display: grid; grid-template-columns: minmax(120px, 180px) 1fr auto; gap: 8px; }
.input-sm { padding: 7px 10px; font-size: 13px; }
@media (max-width: 760px) {
  .keys-table thead { display: none; }
  .keys-table tr { display: grid; grid-template-columns: 1fr; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .keys-table td { border: none; padding: 4px 0; }
  .key-actions { text-align: left; }
  .key-add { grid-template-columns: 1fr; }
}

/* ══ Campaigns ══ */
.camp-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.camp-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.camp-sub { margin: 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.camp-top-actions { display: flex; gap: 10px; align-items: center; }
.camp-select { min-width: 260px; border-radius: 10px; }
.camp-top-actions .btn, .camp-list-head .btn { border-radius: 10px; font-weight: 700; }
.camp-top-actions .btn svg, .camp-list-head .btn svg { width: 15px; height: 15px; }
.camp-view { max-width: 980px; margin: 0 auto; }
.camp-list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.camp-list-head h3 { font-size: 20px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.camp-list-head p { margin: 0; font-size: 13px; color: var(--text-3); }
.camp-list { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.camp-row { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.camp-row:last-child { border-bottom: none; }
.camp-row:hover { background: var(--row-hover); }
.camp-row-main { flex: 1; min-width: 0; }
.camp-row-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.camp-name { font-weight: 700; font-size: 15px; }
.camp-row-tags, .dash-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.camp-tag { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.camp-tag.ctx { background: var(--accent-soft, rgba(99,102,241,.12)); color: var(--accent); border-color: transparent; }
.camp-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; border: 1px solid; }
.camp-badge.progress { color: var(--blue); background: var(--blue-soft); border-color: rgba(59,130,246,.35); }
.camp-badge.done { color: var(--green); background: var(--green-soft); border-color: rgba(34,197,94,.35); }
.camp-badge.new { color: var(--text-3); background: var(--surface-3); border-color: var(--border); }
.camp-badge.running { color: var(--orange); background: var(--orange-soft); border-color: rgba(245,158,11,.35); }
.camp-row .btn { border-radius: 10px; font-weight: 700; }
.camp-row .btn svg { width: 13px; height: 13px; }
.icon-btn.danger { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.camp-empty { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.7; }

/* New campaign */
.new-card { max-width: 540px; margin: 10px auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 34px 34px 26px; }
.new-card h2 { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 8px; }
.new-sub { text-align: center; color: var(--text-2); font-size: 13.5px; line-height: 1.6; margin: 0 auto 26px; max-width: 400px; }
.new-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin: 18px 0 8px; }
.new-label .req { color: var(--red); font-size: 13px; }
.new-input { width: 100%; padding: 13px 15px; font-size: 14px; border-radius: 11px; }
.new-input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.new-hint { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.new-run { width: 100%; margin-top: 28px; padding: 14px; font-size: 14px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; border-radius: 12px; justify-content: center; }
.new-cancel { width: 100%; margin-top: 8px; justify-content: center; }

.new-mode-tabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin-bottom: 22px; }
.new-mode-tab { flex: 1; padding: 9px 10px; border-radius: 8px; border: none; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.new-mode-tab:hover { color: var(--text); }
.new-mode-tab.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.upload-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; border: 1.5px dashed var(--border); border-radius: 12px; cursor: pointer; color: var(--text-2); text-align: center; transition: border-color .12s, background .12s; }
.upload-drop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.upload-drop svg { width: 26px; height: 26px; }
.upload-drop span { font-size: 12.5px; font-weight: 600; }
.upload-drop.has-file { border-color: var(--green); background: var(--green-soft); color: var(--green); }

.upload-preview { margin-top: 16px; }
.upload-stats { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; line-height: 1.8; color: var(--text-2); }
.upload-stats b { color: var(--text); }
.upload-stats .ok-tick { color: var(--green); font-weight: 700; }
.upload-warn { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--red-soft); border: 1px solid var(--red); color: var(--red); font-size: 12.5px; font-weight: 600; line-height: 1.6; }
.upload-warn svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* Campaign dashboard */
#campDashView { max-width: none; }
.dash-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-title { flex: 1; min-width: 200px; }
.dash-title h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.dash-meta { margin-top: 6px; }
.dash-actions { display: flex; gap: 8px; align-items: center; }
.steps-grid { display: block; margin-bottom: 16px; }

/* Compact step bar: one step at a time, breadcrumbs for all */
.step-bar { display: flex; align-items: center; gap: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px; box-shadow: var(--shadow); }
.step-bar.running { border-color: var(--orange); }
.sb-main { flex: 1; min-width: 260px; }
.sb-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.sb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.step-bar.running .sb-dot { background: var(--orange); animation: pulse 1.2s infinite; }
.sb-crumbs { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sb-crumb { background: none; border: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--text-3); padding: 3px 9px; border-radius: 7px; cursor: pointer; }
.sb-crumb:hover { color: var(--text); background: var(--surface-2); }
.sb-crumb.done { color: var(--green); }
.sb-crumb.on { background: var(--blue-soft); color: var(--blue); }
.sb-sep { color: var(--text-3); font-size: 11px; }
.sb-status-row { margin-top: 8px; font-size: 12px; }
.sb-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-2); }
.sb-status.done { color: var(--green); }
.sb-status.running { color: var(--orange); }
.sb-opts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sb-opts:empty { display: none; }
.sb-crumbs { flex-wrap: nowrap; overflow-x: auto; }
.sb-opts .step-cost { font-size: 11.5px; }
.sb-tags { width: 210px; }
.sb-actions { display: flex; gap: 10px; align-items: center; }
.sb-actions .btn { border-radius: 11px; font-weight: 700; padding: 10px 20px; }
.sb-run { min-width: 128px; justify-content: center; }
@media (max-width: 760px) {
  .step-bar { padding: 16px; flex-direction: column; align-items: stretch; }
  .sb-crumbs { flex-wrap: wrap; }
  .sb-actions { width: 100%; }
  .sb-actions .btn { flex: 1; justify-content: center; }
  .sb-tags { width: 100%; }
}

/* Details pop-up: only "Copy details", bottom right */
#detailModal .modal-footer { justify-content: flex-end; }
#detailModal .detail-grid dd .src-logos { margin-top: 2px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.step-card.next { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.step-card.done { border-color: rgba(34,197,94,.45); }
.step-card.running { border-color: var(--orange); }
.step-top { display: flex; align-items: center; gap: 10px; }
.step-top h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.step-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: var(--surface-3); color: var(--text-2); flex: none; }
.step-card.next .step-no { background: var(--accent); color: #fff; }
.step-card.done .step-no { background: var(--green-soft); color: var(--green); }
.step-card.running .step-no { background: var(--orange-soft); color: var(--orange); }
.step-desc { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; flex: 1; }
.step-status { font-size: 12px; min-height: 34px; }
.step-state { font-weight: 600; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.step-state.done { color: var(--green); }
.step-state.running { color: var(--orange); }
.step-summary { color: var(--text-2); margin-top: 3px; }
.step-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.step-opts { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.step-cost { font-size: 11px; color: var(--text-3); }
.step-cost.free { color: var(--green); font-weight: 700; }
.step-foot .btn { white-space: nowrap; border-radius: 9px; font-weight: 700; }
.hidden { display: none !important; }
@media (max-width: 1100px) { .steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .steps-grid { grid-template-columns: 1fr; }
  .camp-row { flex-wrap: wrap; }
  .camp-select { min-width: 0; flex: 1; }
  .camp-top-actions { width: 100%; }
  .new-card { padding: 24px 18px; }
}

/* ── Compact table: clickable contact logos ── */
.src-logos.clickable { gap: 6px; }
.src-logos.clickable .src-logo { margin-left: 0; cursor: pointer; transition: transform .12s, box-shadow .12s; text-decoration: none; }
.src-logos.clickable .src-logo:hover { transform: translateY(-2px) scale(1.08); box-shadow: 0 0 0 2px var(--accent); }
.src-logo.email { background: #fff; }
.src-logo.email svg { width: 16px; height: 16px; }
.leads-table .col-name { min-width: 260px; }
.leads-table td .cell-name { max-width: 380px; }
.leads-table td .cell-sub { max-width: 380px; }
.hover-tip { position: fixed; z-index: 9999; max-width: 360px; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; line-height: 1.4;
  background: #111827; color: #f9fafb; box-shadow: 0 6px 20px rgba(0,0,0,.3); pointer-events: none; opacity: 0; transition: opacity .1s; word-break: break-word; }
.hover-tip.show { opacity: 1; }
:root[data-theme="dark"] .hover-tip { background: #f3f4f6; color: #111827; }

/* Step 1 hashtags */
.step-tags { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.step-tags label { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.step-tags label .hint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.step-tags .input { min-width: 0; }

/* Hashtag leads from other cities */
.other-city { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--orange); background: var(--orange-soft); padding: 1px 7px; border-radius: 6px; }
.other-city.inline { margin: 0 2px; }

/* ══ Settings: Integration Credentials & API Keys ══ */
.cred-card { padding: 28px 30px; border-radius: 16px; }
.cred-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cred-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 6px !important; }
.cred-title svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.cred-sub { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.cred-head-actions { display: flex; gap: 10px; }
.cred-head-actions .btn { border-radius: 11px; font-weight: 700; padding: 10px 18px; }
.cred-head-actions .btn svg { width: 16px; height: 16px; }
.cred-list { display: block; }
.cred-row { display: grid; grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.cred-row:last-child { border-bottom: none; padding-bottom: 4px; }
.cred-row.exhausted { background: var(--red-soft); border-radius: 12px; padding-left: 14px; padding-right: 14px; margin: 0 -14px; }
.cred-name { font-size: 15px; font-weight: 700; }
.cred-tag { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--orange); background: var(--orange-soft); padding: 2px 8px; border-radius: 6px; }
.cred-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cred-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 4px 10px; border-radius: 7px; }
.cred-status.ok { color: var(--green); background: var(--green-soft); }
.cred-status.off { color: var(--orange); background: var(--orange-soft); }
.cred-status.bad { color: var(--red); background: var(--red-soft); }
.cred-status.exhausted { color: var(--red); background: var(--red-soft); border: 1px solid var(--red); }
.cred-status.wait { color: var(--text-3); background: var(--surface-3); }
.cred-status.small { font-weight: 700; letter-spacing: 0; }
.cred-right { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* A saved key: role, masked value and actions on one bar, credits on the line below */
.cred-key-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border-radius: 10px 10px 0 0; background: var(--surface-2); border: 1px solid var(--border-soft); border-bottom: none; }
.cred-key-line.exhausted { border-color: var(--red); background: var(--red-soft); }
.cred-key-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cred-key-mask { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; color: var(--text-2); background: var(--surface-3); padding: 2px 7px; border-radius: 5px; flex: 1; min-width: 120px; }
.cred-key-actions { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.cred-usage-row { padding: 7px 12px 9px; border-radius: 0 0 10px 10px; background: var(--surface-2); border: 1px solid var(--border-soft); border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-3); }
.cred-usage-row.exhausted { border-color: var(--red); background: var(--red-soft); }
.cred-usage-text b { color: var(--text); }
.cred-usage-text.mid b { color: var(--orange); }
.cred-usage-text.low b, .cred-usage-text.exhausted b { color: var(--red); }

/* A key being added or edited: its own small form with its own Save */
.cred-key.new, .cred-key.editing { padding: 12px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--surface-2); }
.cred-key-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cred-key-name { flex: 1; min-width: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 9px; border-radius: 7px; }
.cred-key-type { flex: none; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 8px; border-radius: 7px; }
.cred-key-name:focus { outline: none; border-color: var(--accent); }
.link-btn { background: none; border: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }
.key-role.role-new { background: var(--accent-soft, rgba(99,102,241,.14)); color: var(--accent); }
.cred-input-wrap { position: relative; }
.cred-input { width: 100%; padding: 12px 44px 12px 14px; font-size: 13.5px; letter-spacing: .02em; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.cred-input::placeholder { color: var(--text-3); letter-spacing: .04em; font-family: inherit; }
.cred-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, rgba(99,102,241,.2)); }
.cred-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; border: none; background: none; color: var(--text-3); cursor: pointer; border-radius: 8px; }
.cred-key-line .cred-eye { position: static; transform: none; width: 26px; height: 26px; }
.cred-eye:hover { color: var(--text); background: var(--surface-3); }
.cred-eye svg { width: 17px; height: 17px; }
.cred-edit-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 9px; }
.cred-empty { font-size: 13px; color: var(--text-3); }
.cred-add { align-self: flex-start; background: none; border: 1px dashed var(--border); color: var(--accent); font: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.cred-add:hover { border-color: var(--accent); background: var(--surface-2); }

/* OpenAI nested under Gemini as its backup */
.cred-subsection { margin-top: 8px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); }
.cred-subhead { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.cred-subhint { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text-3); }

/* ══ Settings: Internal working ══ */
.how-card { padding: 28px 30px; border-radius: 16px; }
.how-card > .cred-sub { margin-bottom: 18px; }
.how-steps { display: grid; gap: 10px; }
.how-step { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.how-step summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; font-size: 14.5px; }
.how-step summary::-webkit-details-marker { display: none; }
.how-step summary::after { content: '▸'; margin-left: 8px; color: var(--text-3); transition: transform .15s; }
.how-step[open] summary::after { transform: rotate(90deg); }
.how-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 800; flex: none; }
.how-cost { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.how-body { padding: 0 18px 16px 54px; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.how-goal { margin: 0 0 8px; font-weight: 600; color: var(--text); }
.how-body ol { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.how-body b { color: var(--text); }
.how-rules { margin-top: 18px; padding: 16px 18px; border-radius: 12px; background: var(--blue-soft); }
.how-rules h4 { margin: 0 0 8px; font-size: 13.5px; }
.how-rules ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.65; color: var(--text-2); display: grid; gap: 4px; }
.how-rules b { color: var(--text); }

.danger-card { border-color: var(--red-soft); }
.danger-title { color: var(--red); }
.danger-title svg { color: var(--red); }
.danger-row { display: flex; gap: 10px; margin-top: 14px; max-width: 480px; }
.danger-row .select { flex: 1; }
.danger-row .btn { flex: none; }

.sources-box { margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.sources-box-title { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 9px; }
.sources-line { display: flex; flex-wrap: wrap; gap: 8px; }
.source-pill { font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 20px; border: 1px solid transparent; }
.source-pill.active { background: var(--green-soft); color: var(--green); }
.source-pill.skip { background: var(--surface-3); color: var(--text-3); }
.sources-note { margin: 10px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.6; }
@media (max-width: 760px) {
  .cred-row { grid-template-columns: 1fr; gap: 12px; }
  .cred-card, .how-card { padding: 20px 16px; }
  .how-body { padding-left: 18px; }
  .how-cost { display: none; }
}

/* ══ Campaign dashboard v3 ══ */
/* Bigger contact logos */
.src-logos.clickable { gap: 8px; }
.src-logos.clickable .src-logo { width: 32px; height: 32px; }
.src-logos.clickable .src-logo svg { width: 18px; height: 18px; }
.src-logos.clickable .src-logo.email svg { width: 19px; height: 19px; }
.src-logos.clickable .src-logo.instagram svg { width: 17px; height: 17px; }

/* No top bar: menu button only on phones */
.mobile-menu { display: none; }
@media (max-width: 760px) {
  .mobile-menu { display: grid; position: fixed; top: 10px; left: 10px; z-index: 60; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
  .page { padding-top: 56px; }
}

/* Step settings gear */
.sb-title { flex-wrap: wrap; }
.sb-gear { width: 34px; height: 34px; margin-left: 4px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: border-color .12s, color .12s; }
.sb-gear:hover { color: var(--accent); border-color: var(--accent); }
.sb-gear svg { width: 17px; height: 17px; }
.sb-gear.saved { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.sb-note { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--green); }

/* Pop-ups */
.modal-sm { max-width: 440px; }
.modal-md { max-width: 580px; }
.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.field > span i { text-transform: none; letter-spacing: 0; font-weight: 500; font-style: normal; color: var(--text-3); }
.field > small { font-size: 12px; color: var(--text-3); }
.field .select, .field .input { width: 100%; padding: 11px 13px; font-size: 14px; border-radius: 10px; }
.ss-tags { min-height: 110px; resize: vertical; line-height: 1.6; font-family: inherit; }
.settings-required { margin-bottom: 16px; padding: 11px 14px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 700; }
.cost-box { margin-top: 18px; padding: 13px 15px; border-radius: 10px; background: var(--blue-soft); font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.cost-box b { color: var(--text); }
.cost-title { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); margin-bottom: 3px; }
.dialog-msg { font-size: 14px; line-height: 1.6; color: var(--text); }
.dialog-text { width: 100%; margin-top: 10px; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.btn-danger { background: var(--red); color: #fff; border: 1px solid var(--red); }
.btn-danger:hover { filter: brightness(1.08); }

/* Filter button with its ✕ */
.filter-btn-wrap { display: inline-flex; align-items: stretch; }
#btnFilter.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft, rgba(99,102,241,.12)); }
#btnFilter.active:has(+ .filter-clear:not(.hidden)) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
#btnFilter svg { width: 14px; height: 14px; }
.filter-clear { border: 1px solid var(--accent); border-left: none; background: var(--accent-soft, rgba(99,102,241,.12)); color: var(--accent); padding: 0 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; font-size: 12px; font-weight: 700; }
.filter-clear:hover { background: var(--accent); color: #fff; }

/* Settings: theme + export row */
.app-prefs { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 30px; border-radius: 16px; }
.app-prefs .cred-sub { margin-top: 4px; }
.field .select { height: auto; min-height: 44px; line-height: 1.35; padding-top: 10px; padding-bottom: 10px; }

/* ══ Leads page: Note button ══ */
.note-btn { font-weight: 600; border-radius: 9px; }
.note-btn svg { width: 14px; height: 14px; }
.note-btn.has-notes { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ══ Lead CRM pop-up ══ */
.modal-crm { max-width: 460px; }
.crm-contact { text-align: center; padding: 6px 0 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.crm-avatar { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.crm-name { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.crm-phone { margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.crm-phone svg { width: 13px; height: 13px; color: var(--green); }
.crm-phone .phone-link { color: var(--text-2); }
.crm-links { margin-top: 10px; display: flex; justify-content: center; }
.crm-links .src-logos { justify-content: center; }

.crm-section { margin-bottom: 20px; }
.crm-section:last-child { margin-bottom: 0; }
.crm-label { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); margin-bottom: 9px; }

.crm-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#crmCallPills.crm-pills { grid-template-columns: repeat(2, 1fr); }
.crm-pill { padding: 11px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .12s; }
.crm-pill:hover { border-color: var(--text-3); }
.crm-pill.status-interested.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.crm-pill.status-warm.on { background: var(--orange-soft); border-color: var(--orange); color: var(--orange); }
.crm-pill.status-not_interested.on { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.crm-pill.call-yes.on { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.crm-pill.call-no.on { background: var(--surface-3); border-color: var(--text-3); color: var(--text); }

.crm-section input[type="date"] { width: 100%; padding: 11px 13px; font-size: 14px; border-radius: 10px; margin-bottom: 8px; }

.crm-note-input { width: 100%; resize: vertical; font-family: inherit; margin-bottom: 8px; }
.crm-add-note { width: 100%; justify-content: center; font-weight: 700; border-radius: 10px; margin-bottom: 4px; }
.crm-notes { display: grid; gap: 8px; margin-top: 10px; max-height: 220px; overflow-y: auto; }
.crm-notes-empty { font-size: 12.5px; color: var(--text-3); padding: 6px 2px; }
.crm-note { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.crm-note-text { font-size: 13px; line-height: 1.5; color: var(--text); }
.crm-note-date { color: var(--text-3); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.crm-note-del { width: 28px; height: 28px; flex: none; font-size: 13px; }

.crm-save { width: 100%; justify-content: center; padding: 13px; font-weight: 800; border-radius: 11px; }
