/* ══════════════════════════════════════════════
   Prospector — iOS / Airbnb Design System
   Clean, warm, light — big-tech mobile-first
   ══════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg: #F5F5F7;
  --bg-white: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-hover: #F0F0F2;
  --bg-active: #E8E8EC;
  --bg-wash: #FAFAFA;

  /* Text */
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;
  --text-placeholder: #C7C7CC;

  /* Borders */
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.10);
  --border-focus: rgba(16, 185, 129, 0.4);

  /* Accent */
  --accent: #10B981;
  --accent-hover: #059669;
  --accent-light: #D1FAE5;
  --accent-bg: rgba(16, 185, 129, 0.08);
  --accent-text: #047857;

  /* Semantic */
  --red: #FF3B30;
  --red-bg: rgba(255, 59, 48, 0.08);
  --orange: #FF9500;
  --orange-bg: rgba(255, 149, 0, 0.08);
  --blue: #007AFF;
  --blue-bg: rgba(0, 122, 255, 0.08);
  --purple: #AF52DE;
  --purple-bg: rgba(175, 82, 222, 0.08);
  --yellow-star: #FFB800;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.12), 0 8px 20px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.14);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* Type */
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Menlo', monospace;

  /* Timing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 0.3s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; touch-action: manipulation; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-light); color: var(--accent-text); }

/* ── Scrollbar ─────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── Login ─────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.login-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.login-card {
  width: 380px;
  max-width: 90vw;
  padding: 48px 36px 40px;
  background: var(--bg-white);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-xl);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  margin-bottom: 36px;
  color: var(--text-primary);
}

.login-card .form-group { margin-bottom: 20px; }

.login-card .form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 1rem;
  transition: all 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
  background: var(--bg-white);
}

.login-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--red-bg);
  border-radius: var(--r-md);
  color: var(--red);
  font-size: 0.87rem;
  font-weight: 500;
  text-align: center;
}

/* ── Topbar ────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.logo svg { flex-shrink: 0; }

.topbar-stats {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

.stat { color: var(--text-secondary); font-weight: 500; }
.stat strong { color: var(--accent); font-family: var(--font-mono); font-size: 0.9em; }

.topbar-nav {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--r-pill);
  padding: 3px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  color: var(--text-secondary);
  font-size: 0.87rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  transition: all 0.2s var(--ease-out);
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
}

.nav-tab svg { width: 15px; height: 15px; opacity: 0.6; }
.nav-tab.active svg { opacity: 1; }

#logoutBtn {
  color: var(--text-tertiary);
  border-radius: var(--r-pill);
  padding: 8px;
  margin-left: 8px;
}
#logoutBtn:hover { color: var(--red); background: var(--red-bg); }

/* ── Views ─────────────────────────────────── */

.view {
  padding: 32px 28px;
  max-width: 1280px;
  margin: 0 auto;
  animation: fadeIn 0.25s var(--ease-out);
}

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

.hidden { display: none !important; }

/* ── Buttons ───────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.93rem;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-lg { padding: 15px 32px; font-size: 1rem; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--bg-white);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-xs { padding: 5px 10px; font-size: 0.75rem; }
.btn-success { color: var(--accent) !important; }
.mt-8 { margin-top: 8px; }

/* ── Search Hero ───────────────────────────── */

.search-hero {
  text-align: center;
  padding: 52px 0 44px;
}

.search-hero h2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.search-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 36px;
}

.search-form { max-width: 720px; margin: 0 auto; }

.search-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-white);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 8px 8px 8px 20px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.search-inputs:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-bg);
}

.search-field { flex: 1; }

.search-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.search-field input {
  width: 100%;
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
}

.search-field input:focus { outline: none; }
.search-field input::placeholder { color: var(--text-placeholder); }

.search-inputs .btn-primary { border-radius: var(--r-lg); padding: 14px 28px; }

/* Divider between fields */
.search-field + .search-field {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

/* ── Loading ───────────────────────────────── */

.search-loading { text-align: center; padding: 56px 0; }
.search-loading p { color: var(--text-secondary); margin-top: 16px; font-weight: 500; }

.loader {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

.loader-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results Grid ──────────────────────────── */

.search-results { margin-top: 28px; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.results-header h3 {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.results-actions { display: flex; gap: 8px; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.result-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all 0.2s var(--ease-out);
  cursor: default;
}

.result-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.result-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.result-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.result-rating {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-secondary);
}

.stars { color: var(--yellow-star); letter-spacing: -1px; }
.stars-sm { color: var(--yellow-star); font-size: 0.75rem; letter-spacing: -1px; }

.result-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.result-address {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.result-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.contact-chip {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-secondary);
}

.contact-chip.link { color: var(--accent); cursor: pointer; }
.contact-chip.link:hover { background: var(--accent-bg); text-decoration: none; }

.result-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Recent Searches ───────────────────────── */

.section-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 40px 0 14px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.recent-list { display: flex; flex-direction: column; gap: 4px; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-white);
  border-radius: var(--r-md);
  font-size: 0.87rem;
  transition: background 0.15s;
}

.recent-item:hover { background: var(--bg-hover); }

.recent-query { font-weight: 700; color: var(--text-primary); }
.recent-location { color: var(--text-secondary); font-weight: 500; }
.recent-count { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 0.8rem; margin-left: auto; }

.recent-status {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-completed { background: var(--accent-bg); color: var(--accent-text); }
.badge-failed { background: var(--red-bg); color: var(--red); }
.badge-searching { background: var(--blue-bg); color: var(--blue); }
.badge-pending { background: var(--bg); color: var(--text-tertiary); }

/* ── Leads View ────────────────────────────── */

.leads-header { margin-bottom: 20px; }

.leads-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.stage-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stage-tabs::-webkit-scrollbar { display: none; }

.stage-tab {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.87rem;
  font-weight: 600;
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.stage-tab:hover { background: var(--bg-hover); color: var(--text-primary); }

.stage-tab.active {
  background: var(--text-primary);
  color: #FFFFFF;
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.7;
  margin-left: 3px;
}

.leads-search input {
  padding: 9px 16px;
  background: var(--bg-white);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-pill);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.87rem;
  width: 220px;
  transition: all 0.2s;
}

.leads-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.leads-table-wrap {
  overflow-x: auto;
  background: var(--bg-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.leads-table { width: 100%; border-collapse: collapse; }

.leads-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-wash);
}

.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
  vertical-align: middle;
}

.leads-table tr:last-child td { border-bottom: none; }

.lead-row { cursor: pointer; transition: background 0.1s; }
.lead-row:hover { background: var(--bg-hover); }

.lead-name { font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.lead-type { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 2px; font-weight: 500; }

.badge-stage, .badge-email {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-new { background: var(--bg); color: var(--text-tertiary); }
.badge-analyzed { background: var(--blue-bg); color: var(--blue); }
.badge-emailed { background: var(--orange-bg); color: var(--orange); }
.badge-responded { background: var(--purple-bg); color: var(--purple); }
.badge-won { background: var(--accent-bg); color: var(--accent-text); }
.badge-lost { background: var(--red-bg); color: var(--red); }
.badge-none { background: var(--bg); color: var(--text-tertiary); }
.badge-draft { background: var(--orange-bg); color: var(--orange); }
.badge-sent { background: var(--accent-bg); color: var(--accent-text); }

.badge-pain {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--red-bg);
  color: var(--red);
}

.leads-empty {
  text-align: center;
  padding: 72px 0;
  color: var(--text-tertiary);
  font-weight: 500;
}

.muted { color: var(--text-tertiary); }

/* ── Map View ──────────────────────────────── */

#view-map { padding: 0; max-width: none; animation: none; }

.map-container {
  display: flex;
  height: calc(100vh - 60px);
}

.leaflet-map { flex: 1; min-height: 100%; }

.map-sidebar {
  width: 360px;
  background: var(--bg-white);
  border-left: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
}

.map-sidebar h3 {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.map-empty-msg { color: var(--text-tertiary); font-size: 0.93rem; font-weight: 500; }

.map-detail h4 {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.map-detail-type {
  color: var(--text-secondary);
  font-size: 0.87rem;
  font-weight: 500;
  margin-bottom: 10px;
}

.map-detail p { font-size: 0.87rem; margin-bottom: 6px; color: var(--text-secondary); }

.map-detail-analysis {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--r-md);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Markers */
.custom-marker { background: none !important; border: none !important; }

.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  border: 2.5px solid #FFF;
}

.marker-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  transform: rotate(45deg);
}

/* Leaflet popups */
.leaflet-popup-content-wrapper {
  background: var(--bg-white) !important;
  color: var(--text-primary) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 4px !important;
}

.leaflet-popup-tip { background: var(--bg-white) !important; }
.leaflet-popup-close-button { color: var(--text-tertiary) !important; }

.map-popup {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  padding: 4px;
}

.map-popup strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

/* ── Settings View ─────────────────────────── */

.settings-container {
  max-width: 600px;
  margin: 0 auto;
}

.settings-container h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.settings-subtitle {
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 36px;
}

.settings-form {
  background: var(--bg-white);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  overflow: hidden;
}

.settings-section {
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child { border-bottom: none; }

.settings-section h3 {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.settings-form > .btn-primary {
  margin: 20px 28px 28px;
}

.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.93rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
  background: var(--bg-white);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-placeholder); }

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23AEAEB2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 5px;
  font-weight: 500;
}

.form-hint a { color: var(--accent); font-weight: 600; }

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.settings-warning {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--orange-bg);
  border-radius: var(--r-md);
  color: var(--orange);
  font-size: 0.87rem;
  font-weight: 600;
}

.settings-ok {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--accent-bg);
  border-radius: var(--r-md);
  color: var(--accent-text);
  font-size: 0.87rem;
  font-weight: 600;
}

/* ── Modal (iOS bottom-sheet style) ────────── */

.slideout-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.slideout-overlay.hidden { display: none; }

.slideout {
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  background: var(--bg-white);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.4s var(--ease-out);
  box-shadow: var(--shadow-float);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Drag handle */
.slideout::before {
  content: '';
  display: block;
  width: 36px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 3px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.slideout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 12px;
  flex-shrink: 0;
}

.slideout-header h2 {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.slideout-header .btn-ghost {
  color: var(--text-tertiary);
  border-radius: 50%;
  padding: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideout-header .btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.slideout-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 32px;
  -webkit-overflow-scrolling: touch;
}

.slideout-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.slideout-section:last-child { border-bottom: none; padding-bottom: 0; }

.slideout-section h3 {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.info-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.info-value {
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}
.info-value a { color: var(--accent); font-weight: 600; }

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.social-chip {
  padding: 5px 12px;
  background: var(--bg);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.social-chip:hover {
  background: var(--accent-bg);
  color: var(--accent);
  text-decoration: none;
}

/* Stage select */
.stage-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.93rem;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23AEAEB2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: all 0.2s;
}

.stage-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }

/* ── Pain Points ───────────────────────────── */

.analysis-summary {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 14px;
  font-weight: 500;
}

.pain-points-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.pain-point {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--r-md);
  border-left: 4px solid var(--text-tertiary);
}

.pain-point.high { border-left-color: var(--red); }
.pain-point.medium { border-left-color: var(--orange); }
.pain-point.low { border-left-color: var(--blue); }

.pp-issue {
  font-weight: 700;
  font-size: 0.87rem;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.pp-quote {
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 6px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
  line-height: 1.5;
}

.pp-opportunity {
  font-size: 0.78rem;
  color: var(--accent-text);
  font-weight: 600;
  margin-top: 8px;
}

.analysis-extras {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ── Email ─────────────────────────────────── */

.email-preview {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 18px;
  margin-bottom: 12px;
}

.email-subject {
  font-size: 0.87rem;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.email-body {
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.email-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Activity Timeline ─────────────────────── */

.activity-timeline { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.activity-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 24px;
  bottom: -10px;
  width: 1.5px;
  background: var(--border-strong);
}

.activity-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-white);
  border: 2.5px solid var(--accent);
  flex-shrink: 0;
  margin-top: 3px;
}

.activity-desc { font-size: 0.82rem; color: var(--text-primary); font-weight: 500; }
.activity-time { font-size: 0.72rem; color: var(--text-tertiary); margin-top: 2px; }

/* ── Notes ─────────────────────────────────── */

.slideout-section textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.87rem;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.5;
  transition: all 0.2s;
}

.slideout-section textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
  background: var(--bg-white);
}

/* ── Toast ─────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-primary);
  font-size: 0.87rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.35s var(--ease-spring);
  max-width: 380px;
}

.toast-success { border-left: 4px solid var(--accent); }
.toast-error { border-left: 4px solid var(--red); }
.toast-info { border-left: 4px solid var(--blue); }

.toast.leaving { opacity: 0; transform: translateX(20px); transition: all 0.25s var(--ease-out); }

@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ── Responsive ────────────────────────────── */

@media (min-width: 769px) {
  /* Desktop: centered modal instead of bottom sheet */
  .slideout-overlay {
    align-items: center;
    padding: 32px;
  }

  .slideout {
    max-height: 85vh;
    border-radius: var(--r-2xl);
  }

  .slideout::before { display: none; }

  @keyframes sheetUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    height: auto;
    padding: 10px 16px;
    gap: 8px;
  }

  .topbar-left { width: 100%; justify-content: space-between; }
  .topbar-stats { display: none; }
  .topbar-nav { width: 100%; justify-content: center; }

  .search-inputs {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .search-field + .search-field {
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .search-inputs .btn-primary { width: 100%; border-radius: var(--r-md); }

  .results-grid { grid-template-columns: 1fr; }

  .map-container { flex-direction: column; }
  .map-sidebar {
    width: 100%;
    height: 220px;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .leads-filters { flex-direction: column; align-items: stretch; }

  .slideout { max-width: 100%; }

  .info-grid { grid-template-columns: 1fr; }

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

  .view { padding: 20px 16px; }

  .search-hero h2 { font-size: 1.6rem; }
  .search-hero { padding: 32px 0 28px; }

  /* Prevent iOS auto-zoom on input focus (requires >= 16px) */
  input, select, textarea { font-size: 16px !important; }
}
