/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #080C16;
  --surface:     #0F1623;
  --surface-2:   #151D2E;
  --surface-3:   #1C2540;
  --border:      rgba(255,255,255,0.06);
  --border-2:    rgba(255,255,255,0.10);
  --gold:        #C8A84B;
  --gold-light:  #D4B45A;
  --gold-dim:    rgba(200,168,75,0.12);
  --gold-dim2:   rgba(200,168,75,0.20);
  --text-1:      #EDF2FF;
  --text-2:      #8B9DC3;
  --text-3:      #4A5880;
  --green:       #22C55E;
  --green-dim:   rgba(34,197,94,0.12);
  --blue:        #4A9EFF;
  --blue-dim:    rgba(74,158,255,0.12);
  --orange:      #F97316;
  --orange-dim:  rgba(249,115,22,0.12);
  --purple:      #A855F7;
  --purple-dim:  rgba(168,85,247,0.12);
  --red:         #EF4444;
  --red-dim:     rgba(239,68,68,0.12);
  --radius:      10px;
  --radius-lg:   14px;
  --sidebar-w:   240px;
  --transition:  0.18s ease;
}

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 34px; height: 34px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  color: #000;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.logo-title { display: block; font-weight: 700; font-size: 14px; color: var(--text-1); }
.logo-sub   { display: block; font-size: 11px; color: var(--text-3); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
}
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background 0.5s;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Mobile Header ──────────────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 99;
}
.mobile-title { font-weight: 700; font-size: 15px; color: var(--gold); }
.hamburger {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border-radius: 7px;
}
.hamburger svg { width: 20px; height: 20px; }
.hamburger:hover { background: var(--surface-2); }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  overflow-y: auto;
}

/* ── Page Shell ─────────────────────────────────────────────────────────────── */
.page { display: none; padding: 32px; animation: fadeIn 0.2s ease; }
.page.active { display: block; }

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

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-1); }
.page-sub   { font-size: 13px; color: var(--text-3); margin-top: 3px; }

/* ── Stat Cards ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.gold   { background: var(--gold-dim);   color: var(--gold); }
.stat-icon.green  { background: var(--green-dim);  color: var(--green); }
.stat-icon.blue   { background: var(--blue-dim);   color: var(--blue); }
.stat-icon.purple { background: var(--purple-dim); color: var(--purple); }
.stat-icon.orange { background: var(--orange-dim); color: var(--orange); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 5px;
}
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-change {
  position: absolute;
  top: 20px; right: 20px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}
.stat-change.up   { background: var(--green-dim); color: var(--green); }
.stat-change.down { background: var(--red-dim);   color: var(--red); }

/* ── Cards / Panels ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text-1); }

/* ── Two-col layout ─────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
thead th:hover { color: var(--text-2); }
thead th.sorted { color: var(--gold); }

tbody tr {
  border-top: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 12px 16px;
  color: var(--text-2);
  white-space: nowrap;
}
tbody td.primary { color: var(--text-1); font-weight: 500; }
tbody td.mono    { font-variant-numeric: tabular-nums; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-new        { background: var(--blue-dim);   color: var(--blue); }
.badge-contacted  { background: var(--gold-dim);   color: var(--gold); }
.badge-hot        { background: var(--orange-dim); color: var(--orange); }
.badge-contracted { background: var(--purple-dim); color: var(--purple); }
.badge-closed     { background: var(--green-dim);  color: var(--green); }
.badge-dead       { background: var(--red-dim);    color: var(--red); }
.badge-enriched   { background: var(--blue-dim);   color: var(--blue); }
.badge-skip_traced{ background: var(--purple-dim); color: var(--purple); }
.badge-offer_sent { background: var(--orange-dim); color: var(--orange); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--gold);
  color: #000;
}
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(200,168,75,0.3); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon:hover { background: var(--surface-3); color: var(--text-1); }

/* ── Form Controls ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 7px;
  color: var(--text-1);
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.form-control::placeholder { color: var(--text-3); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B9DC3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

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

/* ── Filters ────────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar .form-control { width: auto; }
.search-input { min-width: 220px; }

/* ── Activity Feed ──────────────────────────────────────────────────────────── */
.activity-list { padding: 4px 0; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  transition: background var(--transition);
}
.activity-item:hover { background: var(--surface-2); }
.activity-item:first-child { border-top: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.activity-text strong { color: var(--text-1); font-weight: 500; }
.activity-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ── Offer Engine ───────────────────────────────────────────────────────────── */
.offer-layout { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; }

.offer-form { padding: 24px; }

.offer-results {
  padding: 24px;
  position: relative;
}

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.result-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color var(--transition);
}
.result-item.highlight {
  border-color: var(--gold);
  background: var(--gold-dim);
}
.result-item.highlight .result-value { color: var(--gold); }

.result-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.result-value { font-size: 24px; font-weight: 800; color: var(--text-1); letter-spacing: -0.5px; }
.result-sub   { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.offer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-3);
  gap: 12px;
  text-align: center;
}
.offer-empty svg { width: 48px; height: 48px; opacity: 0.2; }
.offer-empty p { font-size: 13px; }

.narrative-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin-top: 16px;
}
.narrative-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* ── Kanban ─────────────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.kanban-title { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.kanban-count {
  font-size: 11px;
  font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  color: var(--text-2);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.kanban-col.drag-over { background: var(--surface-2); border-color: var(--gold); }
.kanban-col.drag-over .kanban-cards { background: var(--gold-dim); border-radius: 8px; }

.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 13px;
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
}
.kanban-card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }

.kcard-name { font-size: 13px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard-addr { font-size: 11.5px; color: var(--text-3); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard-meta { display: flex; align-items: center; justify-content: space-between; }
.kcard-arv  { font-size: 12px; font-weight: 700; color: var(--gold); }
.kcard-county { font-size: 10px; font-weight: 600; color: var(--text-3); background: var(--surface-3); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }

/* ── Buyer Cards ────────────────────────────────────────────────────────────── */
.buyers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.buyer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: all var(--transition);
}
.buyer-card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.25); }

.buyer-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

.buyer-avatar {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  color: #000;
  flex-shrink: 0;
}

.buyer-name { font-size: 14px; font-weight: 700; color: var(--text-1); }
.buyer-type { font-size: 12px; color: var(--text-3); margin-top: 1px; }

.buyer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.buyer-stat { background: var(--surface-2); border-radius: 7px; padding: 10px 12px; }
.buyer-stat-val { font-size: 16px; font-weight: 700; color: var(--text-1); }
.buyer-stat-lbl { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.buyer-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.buyer-tag {
  font-size: 11px; font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 3px 8px;
  border-radius: 5px;
}

/* ── Progress / Meter ───────────────────────────────────────────────────────── */
.meter { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.meter-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.8s ease; }

/* ── Skeleton loading ───────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.sm { height: 11px; width: 60%; }
.skeleton-val  { height: 28px; width: 100px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-1);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  animation: slideUp 0.2s ease;
}
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); }
.toast.error   .toast-dot { background: var(--red); }
.toast.info    .toast-dot { background: var(--blue); }

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

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.light {
  border-color: rgba(255,255,255,0.15);
  border-top-color: var(--text-2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section divider ────────────────────────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-3);
  gap: 10px;
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.2; margin-bottom: 4px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state p { font-size: 13px; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Gold line accent ───────────────────────────────────────────────────────── */
.gold-line { width: 32px; height: 2px; background: var(--gold); border-radius: 1px; margin-bottom: 10px; }

/* ── Pipeline page-level action strip ──────────────────────────────────────── */
.pipeline-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.page-btn {
  min-width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  transition: all var(--transition);
}
.page-btn:hover { background: var(--surface-2); color: var(--text-1); }
.page-btn.active { background: var(--gold); color: #000; }
.page-info { font-size: 12px; color: var(--text-3); margin-right: 8px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .offer-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.5); }
  .mobile-header { display: flex; }
  .main { margin-left: 0; padding-top: 54px; }
  .page { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .buyers-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   SMS OUTREACH PAGE
══════════════════════════════════════════════════════════════════════════════ */

/* Stats row */
.sms-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.sms-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sms-stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
}
.sms-stat-val.orange { color: var(--orange); }
.sms-stat-val.green  { color: var(--green); }
.sms-stat-lbl {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* A2P notice banner */
.sms-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--orange-dim);
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}
.sms-notice svg { flex-shrink: 0; margin-top: 2px; color: var(--orange); }
.sms-notice code {
  background: rgba(249,115,22,0.15);
  color: var(--orange);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
}

/* Main two-col layout */
.sms-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  align-items: start;
}

/* Lead list panel */
.sms-lead-list {
  min-height: 400px;
  max-height: 560px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sms-lead-list .card-header {
  flex-shrink: 0;
}
#sms-lead-items {
  overflow-y: auto;
  flex: 1;
}
.sms-lead-item {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.sms-lead-item:hover   { background: var(--surface-2); }
.sms-lead-item.selected {
  background: var(--gold-dim);
  border-left: 2px solid var(--gold);
}
.sms-lead-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 3px;
}
.sms-lead-addr {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sms-msg-count {
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  flex-shrink: 0;
}

/* Preview panel */
.sms-preview-panel {
  min-height: 400px;
  max-height: 560px;
  overflow-y: auto;
}
.sms-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 40px 20px;
  color: var(--text-3);
  gap: 10px;
  text-align: center;
}
.sms-empty-state svg { opacity: 0.2; margin-bottom: 4px; }
.sms-empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-2); }
.sms-empty-state p  { font-size: 13px; }

/* Heir card inside preview */
.sms-heir-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.sms-heir-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sms-heir-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold-dim2);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sms-heir-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.sms-heir-phones {
  font-size: 11px;
  color: var(--text-3);
  font-family: monospace;
  margin-top: 2px;
}

/* Individual message row inside heir card */
.sms-msg-row {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.sms-msg-row:first-of-type { border-top: none; }

/* Phone chip */
.sms-phone-chip {
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  font-family: monospace;
  border: 1px solid var(--border-2);
}

/* Message bubble */
.sms-message-bubble {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-top-left-radius: 3px;
  padding: 11px 13px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Email chip */
.sms-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-dim);
  color: var(--blue);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 11px;
  border: 1px solid rgba(74,158,255,0.2);
}

/* Responsive */
@media (max-width: 900px) {
  .sms-layout { grid-template-columns: 1fr; }
  .sms-lead-list, .sms-preview-panel { max-height: none; }
  .sms-stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .sms-stats-row { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   LEAD DETAIL DRAWER
══════════════════════════════════════════════════════════════════════════════ */

/* Overlay backdrop */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Drawer panel */
.lead-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 42%;
  min-width: 380px;
  max-width: 680px;
  background: var(--surface);
  border-left: 1px solid var(--border-2);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.26s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: -8px 0 48px rgba(0,0,0,0.45);
}
.lead-drawer.open {
  transform: translateX(0);
}

/* Drawer header */
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.drawer-header-info { flex: 1; min-width: 0; }
.drawer-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text-3);
  background: transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--surface-3); color: var(--text-1); }

/* Drawer scrollable body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Section inside drawer */
.drawer-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* KPI grid inside drawer */
.drawer-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.drawer-kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.drawer-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.drawer-kpi-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}
.drawer-kpi-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

/* Property detail rows */
.drawer-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.drawer-detail-row:last-child { border-bottom: none; }
.drawer-detail-label { color: var(--text-3); }
.drawer-detail-value { color: var(--text-1); font-weight: 500; }

/* Heir card inside drawer */
.drawer-heir {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.drawer-heir:last-child { margin-bottom: 0; }
.drawer-heir-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.drawer-heir-avatar {
  width: 36px; height: 36px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-dim2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}
.drawer-heir-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.drawer-heir-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.drawer-phone-chip {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-family: monospace;
}
.drawer-email-chip {
  background: var(--blue-dim);
  border: 1px solid rgba(74,158,255,0.2);
  color: var(--blue);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
}

/* SMS log rows inside drawer */
.drawer-sms-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.drawer-sms-row:last-child { border-bottom: none; }
.drawer-sms-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-3);
}
.drawer-sms-msg {
  color: var(--text-2);
  line-height: 1.5;
}

/* Narrative box */
.drawer-narrative {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  font-style: italic;
}

/* Drawer footer with action buttons */
.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-2);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Loading state */
.drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  color: var(--text-3);
  font-size: 13px;
}

/* Clickable lead row */
.lead-row-clickable { cursor: pointer; }
.lead-row-clickable:hover td { background: rgba(200,168,75,0.04); }

/* Responsive */
@media (max-width: 768px) {
  .lead-drawer {
    width: 100%;
    min-width: unset;
    max-width: unset;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   CSV IMPORT MODAL
══════════════════════════════════════════════════════════════════════════════ */

.import-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.import-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translateY(-48%) scale(0.97) translateX(-50%);
  width: min(520px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  z-index: 301;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.25,0.46,0.45,0.94);
  max-height: 90vh;
  overflow-y: auto;
}

.import-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.import-option {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* CSV drag & drop zone */
.csv-drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  transition: all var(--transition);
}
.csv-drop-zone:hover,
.csv-drop-zone.drag-active {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--text-2);
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════════════════════════════════════ */

.login-page {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo-mark {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #1e3a5f, #d4af37);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.login-logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.login-logo-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.login-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-submit-btn {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
}

.login-error {
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-top: 10px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  margin: 20px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-beta-btn {
  width: 100%;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gold);
  border: 1px solid var(--gold-dim2);
  padding: 9px;
}
.login-beta-btn:hover {
  background: var(--gold-dim);
}

.login-beta-panel {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 4px;
}

/* ── Sidebar user block ──────────────────────────────────────────────────────── */

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #d4af37);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.sidebar-logout-btn:hover {
  background: var(--red-dim);
  color: var(--red);
}
