/* =============================================================
   LeadGen CRM — app.css  (v2 — premium redesign)
   ============================================================= */

/* ── Google Font ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;

  /* Sidebar */
  --sidebar-bg:    #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text:  #94a3b8;
  --sidebar-active-text: #60a5fa;
  --sidebar-border: rgba(255,255,255,.06);
  --sidebar-width: 230px;

  /* Surface */
  --surface:       #fff;
  --surface-2:     #f8fafc;
  --surface-3:     #f1f5f9;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --bg:            #f0f3f8;

  /* Text */
  --text-primary:  #0f172a;
  --text-secondary:#475569;
  --text-muted:    #94a3b8;

  /* Semantic colours */
  --green:  #22c55e;
  --red:    #ef4444;
  --amber:  #f59e0b;
  --cyan:   #06b6d4;
  --purple: #8b5cf6;
  --orange: #f97316;

  /* Radius */
  --radius-sm:  .375rem;
  --radius:     .625rem;
  --radius-lg:  .875rem;
  --radius-xl:  1.25rem;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.03);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.04);

  /* Transitions */
  --t-fast: .12s ease;
  --t-base: .18s ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { color: var(--brand-600); }
img { max-width: 100%; }

/* ── App layout ──────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
  transition: transform var(--t-base);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 99px; }

/* Brand area */
.sidebar-brand {
  padding: 1.1rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-text strong {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.sidebar-brand-text span {
  font-size: .68rem;
  color: var(--sidebar-text);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Nav */
.sidebar-nav { list-style: none; padding: .6rem 0; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 1rem;
  margin: 1px .6rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .855rem;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-nav li a:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  text-decoration: none;
}
.sidebar-nav li a.active {
  background: rgba(59,130,246,.15);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.sidebar-nav li a .nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity var(--t-fast);
}
.sidebar-nav li a:hover .nav-icon,
.sidebar-nav li a.active .nav-icon { opacity: 1; }
.sidebar-nav li a.active .nav-icon { color: var(--brand-500); }

.sidebar-section {
  padding: .8rem 1.6rem .3rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  font-weight: 700;
  margin-top: .2rem;
}

/* Search Now CTA in sidebar */
.sidebar-cta {
  margin: .75rem .75rem .5rem;
  padding: .6rem .9rem;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #fff !important;
  font-size: .855rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
  transition: opacity var(--t-fast), transform var(--t-fast) !important;
  text-decoration: none;
}
.sidebar-cta:hover {
  opacity: .92;
  transform: translateY(-1px);
  text-decoration: none !important;
  color: #fff !important;
}
.sidebar-cta .nav-icon { opacity: 1 !important; color: #fff !important; }

/* Sidebar badge */
.sidebar-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: .62rem;
  font-weight: 700;
  padding: .08rem .38rem;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Main content ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t-base);
}

/* ── Top bar ─────────────────────────────────────────────────── */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
  gap: 1rem;
}
.top-bar-left { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; }

/* Hamburger */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .25rem .35rem;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-3); color: var(--text-primary); }

.top-bar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.top-bar-breadcrumb a { color: var(--text-secondary); }
.top-bar-breadcrumb a:hover { color: var(--brand-500); }
.top-bar-breadcrumb .sep { color: var(--border-strong); }

.top-bar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }

.top-search-btn {
  display: flex; align-items: center; gap: .4rem;
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  padding: .38rem .75rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast);
  font-family: inherit;
}
.top-search-btn:hover { background: var(--brand-600); color: #fff; text-decoration: none; }
.top-search-btn .bi { font-size: .85rem; }

.top-bar-debug {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  cursor: pointer;
  display: flex; align-items: center; gap: .3rem;
  font-family: inherit;
  transition: background var(--t-fast), color var(--t-fast);
}
.top-bar-debug:hover { background: var(--surface-3); color: var(--text-primary); }

.top-bar-user {
  display: flex; align-items: center; gap: .4rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem .7rem;
}
.top-bar-user .bi { color: var(--brand-500); font-size: .9rem; }

/* Debug banner */
.debug-banner {
  background: var(--red);
  color: #fff;
  text-align: center;
  padding: .35rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

/* ── Content area ────────────────────────────────────────────── */
.content-area { padding: 1.5rem; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.card-header {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  gap: .75rem;
}
.card-header .card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-primary);
}
.card-header .card-title .bi { color: var(--brand-500); }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: .82rem;
}

/* Card hover variant */
.card-hover { transition: box-shadow var(--t-base), transform var(--t-base); cursor: pointer; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .875rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid transparent;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .stat-icon { font-size: 1.25rem; margin-bottom: .15rem; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; letter-spacing: .01em; }
.stat-card.primary { border-left-color: var(--brand-500); }
.stat-card.primary .stat-icon,
.stat-card.primary .stat-value { color: var(--brand-500); }
.stat-card.success { border-left-color: var(--green); }
.stat-card.success .stat-icon,
.stat-card.success .stat-value { color: var(--green); }
.stat-card.warning { border-left-color: var(--amber); }
.stat-card.warning .stat-icon,
.stat-card.warning .stat-value { color: var(--amber); }
.stat-card.danger { border-left-color: var(--red); }
.stat-card.danger .stat-icon,
.stat-card.danger .stat-value { color: var(--red); }
.stat-card.info { border-left-color: var(--cyan); }
.stat-card.info .stat-icon,
.stat-card.info .stat-value { color: var(--cyan); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-card.purple .stat-icon,
.stat-card.purple .stat-value { color: var(--purple); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: .855rem; }
thead th {
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  padding: .6rem .9rem;
  text-align: left;
  font-weight: 700;
  font-size: .75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
}
thead th:first-child { border-radius: 0; }
tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--t-fast);
}
tbody tr:hover { background: var(--brand-50); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: .65rem .9rem; vertical-align: middle; }
tbody tr.selected { background: #eff6ff !important; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25em;
  padding: .22em .6em;
  border-radius: .4rem;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: .01em;
}
.bg-primary   { background: var(--brand-50); color: var(--brand-700); }
.bg-secondary { background: var(--surface-3); color: var(--text-secondary); }
.bg-success   { background: #f0fdf4; color: #15803d; }
.bg-danger    { background: #fef2f2; color: #b91c1c; }
.bg-warning   { background: #fffbeb; color: #92400e; }
.bg-info      { background: #ecfeff; color: #0e7490; }
.bg-dark      { background: var(--sidebar-bg); color: #e2e8f0; }
.bg-light     { background: var(--surface-3); color: var(--text-secondary); }
.bg-orange    { background: #fff7ed; color: #c2410c; }
.text-dark    { color: var(--text-primary) !important; }
.text-white   { color: #fff !important; }

/* Score badge */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: .8rem;
  border: 2px solid currentColor;
}
.score-badge.high   { color: var(--red);   border-color: #fca5a5; background: #fef2f2; }
.score-badge.medium { color: var(--amber); border-color: #fcd34d; background: #fffbeb; }
.score-badge.low    { color: var(--green); border-color: #86efac; background: #f0fdf4; }

/* ── Flag pills ──────────────────────────────────────────────── */
.flag-pill {
  display: inline-flex; align-items: center; gap: .2em;
  padding: .2em .55em;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
}
.flag-red    { background: #fef2f2; color: #dc2626; }
.flag-amber  { background: #fffbeb; color: #b45309; }
.flag-blue   { background: #eff6ff; color: #1d4ed8; }
.flag-green  { background: #f0fdf4; color: #15803d; }
.flag-gray   { background: var(--surface-3); color: var(--text-secondary); }
.flag-purple { background: #faf5ff; color: #6d28d9; }

.check-yes { color: var(--green); }
.check-no  { color: var(--red); }
.check-na  { color: var(--text-muted); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; letter-spacing: .01em; }
.form-control, .form-select {
  display: block; width: 100%;
  padding: .5rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .65rem center;
  background-size: .9rem;
  padding-right: 2.25rem;
  cursor: pointer;
}
.form-check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; }
.form-check input[type=checkbox] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--brand-500); }
.form-hint { font-size: .77rem; color: var(--text-muted); margin-top: .3rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.form-row .form-group { flex: 1 1 200px; }

/* Large search inputs */
.input-xl {
  font-size: 1.05rem !important;
  padding: .75rem 1rem !important;
  border-radius: var(--radius-lg) !important;
}

/* Input group */
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); flex: 1; }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; white-space: nowrap; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .46rem 1rem;
  border-radius: var(--radius);
  font-size: .855rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  text-decoration: none;
  line-height: 1.4;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,.35); }
.btn-secondary { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-success   { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger    { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning   { background: var(--amber); color: #1e293b; border-color: var(--amber); }
.btn-warning:hover { background: #d97706; }
.btn-outline   { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); color: var(--text-primary); }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }

.btn-lg { padding: .65rem 1.4rem; font-size: .95rem; border-radius: var(--radius-lg); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-xs { padding: .2rem .5rem; font-size: .73rem; border-radius: var(--radius-sm); }
.btn-icon { padding: .42rem; width: 2rem; height: 2rem; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon.btn-sm { padding: .28rem; width: 1.7rem; height: 1.7rem; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: .855rem;
  margin-bottom: 1rem;
  border: 1.5px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert .bi { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--brand-50); color: #1d4ed8; border-color: var(--brand-100); }

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .875rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  box-shadow: var(--shadow-xs);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }
.filter-bar .form-label { font-size: .75rem; }

/* Filter flag chips */
.filter-flag-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-self: flex-end; padding-bottom: .05rem; }
.filter-flag-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .3rem .7rem;
  border-radius: 99px;
  font-size: .76rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}
.filter-flag-chip input { display: none; }
.filter-flag-chip:has(input:checked) {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
.filter-flag-chip:hover { border-color: var(--brand-500); color: var(--brand-500); }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; height: 2rem; padding: 0 .55rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.pagination a:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.pagination .active span, .pagination .current { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.pagination .disabled span { color: var(--text-muted); background: var(--surface-2); }

/* ── Score gauge ─────────────────────────────────────────────── */
.score-gauge-wrap { display: flex; align-items: center; gap: 1.5rem; }
.score-gauge { position: relative; width: 110px; height: 110px; }
.score-gauge svg { width: 110px; height: 110px; transform: rotate(-90deg); }
.score-gauge-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; }
.score-gauge-label { font-size: .7rem; color: var(--text-muted); font-weight: 500; margin-top: .1rem; }

/* ── Timeline ────────────────────────────────────────────────── */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: .75rem; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { padding-left: 2.5rem; position: relative; margin-bottom: 1.1rem; }
.timeline-item::before { content: ''; position: absolute; left: .45rem; top: .35rem; width: .65rem; height: .65rem; border-radius: 50%; background: var(--brand-500); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--brand-500); }
.timeline-meta { font-size: .78rem; color: var(--text-muted); }
.timeline-text { font-size: .875rem; margin-top: .15rem; }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}
.login-left {
  flex: 1;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 4rem;
  color: #e2e8f0;
}
.login-left h2 { font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: .75rem; line-height: 1.2; }
.login-left p { color: #94a3b8; font-size: 1rem; line-height: 1.7; max-width: 380px; }
.login-feature-list { list-style: none; margin-top: 2rem; display: flex; flex-direction: column; gap: .75rem; }
.login-feature-list li { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: #cbd5e1; }
.login-feature-list li .bi { color: var(--brand-500); font-size: 1rem; }
.login-right {
  width: 420px;
  min-width: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255,255,255,.08);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon {
  width: 54px; height: 54px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  border-radius: var(--radius-lg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff;
  margin-bottom: .75rem;
  box-shadow: 0 4px 16px rgba(59,130,246,.4);
}
.login-logo h1 { font-size: 1.4rem; font-weight: 800; margin-top: .1rem; color: var(--text-primary); letter-spacing: -.02em; }
.login-logo p { font-size: .855rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Import upload zone ──────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--brand-500); background: var(--brand-50); }
.upload-zone .bi { font-size: 2.5rem; color: var(--text-muted); }
.upload-zone p { margin-top: .5rem; font-size: .9rem; color: var(--text-secondary); }

/* ── Toast notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .8rem 1.1rem;
  border-radius: var(--radius-lg);
  background: var(--sidebar-bg);
  color: #f1f5f9;
  font-size: .855rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  max-width: 340px;
  animation: toastIn .25s cubic-bezier(.16,1,.3,1);
  transition: opacity .2s, transform .2s;
  border-left: 3px solid var(--brand-500);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast .toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--amber); }
.toast-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: .9rem;
  padding: .1rem .25rem;
  border-radius: .25rem;
  flex-shrink: 0;
}
.toast-dismiss:hover { color: #fff; }
.toast.leaving { opacity: 0; transform: translateX(20px); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Bulk action bar ─────────────────────────────────────────── */
.bulk-bar {
  display: none;
  position: sticky;
  bottom: 1rem;
  left: 0; right: 0;
  margin: 0 .5rem;
  background: var(--sidebar-bg);
  color: #f1f5f9;
  border-radius: var(--radius-lg);
  padding: .75rem 1.25rem;
  box-shadow: var(--shadow-lg);
  align-items: center;
  gap: 1rem;
  z-index: 90;
  animation: bulkBarIn .2s cubic-bezier(.16,1,.3,1);
  border: 1px solid rgba(255,255,255,.1);
}
.bulk-bar.visible { display: flex; }
.bulk-bar-count { font-size: .875rem; font-weight: 700; white-space: nowrap; }
.bulk-bar-count span { color: var(--brand-500); }
.bulk-bar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.bulk-bar-actions .btn { font-size: .78rem; padding: .32rem .7rem; }
.bulk-bar-close { margin-left: auto; background: rgba(255,255,255,.1); border: none; color: #94a3b8; border-radius: var(--radius-sm); width: 1.8rem; height: 1.8rem; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: .85rem; flex-shrink: 0; }
.bulk-bar-close:hover { background: rgba(255,255,255,.2); color: #fff; }

@keyframes bulkBarIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Floating Action Button ──────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 80;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(59,130,246,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  text-decoration: none;
}
.fab:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(59,130,246,.6); color: #fff; text-decoration: none; }
.fab:active { transform: scale(.96); }
.fab-tooltip {
  position: absolute;
  right: calc(100% + .6rem);
  white-space: nowrap;
  background: var(--sidebar-bg);
  color: #fff;
  padding: .3rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.fab:hover .fab-tooltip { opacity: 1; transform: translateX(0); }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: .65rem 1.1rem;
  font-size: .855rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--brand-500); border-bottom-color: var(--brand-500); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}
.empty-state h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-secondary); margin-bottom: .4rem; }
.empty-state p { font-size: .875rem; max-width: 320px; margin: 0 auto .75rem; line-height: 1.6; }

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm        { font-size: .8rem; }
.text-xs        { font-size: .72rem; }
.fw-bold        { font-weight: 700; }
.fw-600         { font-weight: 600; }
.fw-800         { font-weight: 800; }
.mt-1  { margin-top: .4rem; }
.mt-2  { margin-top: .75rem; }
.mt-3  { margin-top: 1.25rem; }
.mt-4  { margin-top: 2rem; }
.mb-1  { margin-bottom: .4rem; }
.mb-2  { margin-bottom: .75rem; }
.mb-3  { margin-bottom: 1.25rem; }
.mb-0  { margin-bottom: 0; }
.p-0   { padding: 0; }
.p-1   { padding: .5rem; }
.gap-1 { gap: .4rem; }
.gap-2 { gap: .75rem; }
.gap-3 { gap: 1.25rem; }
.d-flex         { display: flex; }
.d-none         { display: none; }
.d-grid         { display: grid; }
.align-center   { align-items: center; }
.align-start    { align-items: flex-start; }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.justify-center { justify-content: center; }
.w-100          { width: 100%; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.two-col-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.three-col-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
@media (max-width: 1100px) { .three-col-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .three-col-grid, .two-col-grid { grid-template-columns: 1fr; } }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Pipeline Controls ────────────────────────────────────────── */
.pipeline-btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.pipeline-btn { width: 100%; text-align: left; padding: .6rem .9rem; font-size: .85rem; display: flex; align-items: center; gap: .4rem; }

/* ── Review badges ────────────────────────────────────────────── */
.review-quick-btns { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }

/* ── Score breakdown ─────────────────────────────────────────── */
.score-breakdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
.score-breakdown-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .84rem;
}

/* ── Insights bars ───────────────────────────────────────────── */
.insight-bar-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; font-size: .84rem; }
.insight-bar-label { min-width: 110px; font-weight: 600; }
.insight-bar-track { flex: 1; background: var(--surface-3); border-radius: 3px; height: 8px; overflow: hidden; }
.insight-bar-fill { height: 100%; border-radius: 3px; background: var(--brand-500); transition: width .4s ease; }

/* ── Terminal / run log ──────────────────────────────────────── */
.run-log-terminal {
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .78rem;
  padding: 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}
.run-log-info   { color: #86efac; }
.run-log-error  { color: #fca5a5; }
.run-log-warn   { color: #fde68a; }

/* ── Digest preview ──────────────────────────────────────────── */
.digest-section { margin-bottom: 1.5rem; }
.digest-section-title {
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .5rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}

/* ── Table checkboxes ────────────────────────────────────────── */
.table input[type="checkbox"] { cursor: pointer; accent-color: var(--brand-500); }

/* ── Section header ──────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.section-header h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }

/* ── Source tags (search_now) ────────────────────────────────── */
.source-tag {
  display: inline-flex; align-items: center; gap: .2em;
  padding: .15em .45em;
  border-radius: var(--radius-sm);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.source-ddg      { background: #fef9c3; color: #854d0e; }
.source-bing     { background: #e0f2fe; color: #075985; }
.source-yp       { background: #fff7ed; color: #c2410c; }
.source-facebook { background: #eff6ff; color: #1d4ed8; }
.source-instagram{ background: #fdf4ff; color: #86198f; }

/* ── Lead card (search_now grid) ─────────────────────────────── */
.lead-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.lead-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.lead-card:hover { box-shadow: var(--shadow); border-color: var(--brand-500); }
.lead-card-name { font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.lead-card-meta { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.lead-card-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.lead-card-actions { display: flex; gap: .4rem; margin-top: .25rem; }

/* ── Wizard steps (setup.php) ────────────────────────────────── */
.wizard-steps { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 2rem; overflow-x: auto; }
.wizard-step {
  display: flex; align-items: center; gap: .5rem;
  font-size: .82rem; font-weight: 600; color: var(--text-muted);
  white-space: nowrap;
  padding: 0 .75rem;
}
.wizard-step-num {
  width: 1.9rem; height: 1.9rem;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: all var(--t-base);
}
.wizard-step.active .wizard-step-num {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.wizard-step.done .wizard-step-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.wizard-step.active { color: var(--brand-500); }
.wizard-step.done  { color: var(--green); }
.wizard-connector { flex: 1; height: 2px; background: var(--border); min-width: 1.5rem; max-width: 3rem; }
.wizard-connector.done { background: var(--green); }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: #000; }
  .sidebar, .top-bar, .fab, .bulk-bar { display: none !important; }
  .main-content { margin-left: 0 !important; }
}

/* ── Responsive / Mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 230px; }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex !important; }
  .content-area { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .top-search-btn .btn-label { display: none; }
  .fab { bottom: 1.25rem; right: 1.25rem; width: 2.8rem; height: 2.8rem; font-size: 1rem; }
  .lead-card-grid { grid-template-columns: 1fr; }
  .filter-bar { padding: .75rem .875rem; }
  .filter-bar .form-group { min-width: 120px; }
  .two-col-grid { grid-template-columns: 1fr; }
  .login-right { width: 100%; }
  .bulk-bar { flex-wrap: wrap; bottom: .75rem; margin: 0 .25rem; }
}

@media (min-width: 1200px) {
  .login-left { display: flex; }
}
