/* ═══════════════════════════════════════════════════════════════════
   AFC Real Estate Platform — Design System
   Premium, scannable, mobile-first. Cards not casino dashboards.
═══════════════════════════════════════════════════════════════════ */

:root {
  /* Core Palette */
  --bg-primary: #0f1117;
  --bg-secondary: #161b24;
  --bg-card: #1a2030;
  --bg-card-hover: #1f2840;
  --bg-elevated: #222c3c;
  --bg-input: #1e2535;

  /* Borders */
  --border: #2a3548;
  --border-light: #344060;

  /* Text */
  --text-primary: #f0f4ff;
  --text-secondary: #8b9cc2;
  --text-muted: #5a6a8a;
  --text-inverse: #0f1117;

  /* Brand — restrained, signals without casino energy */
  --accent: #4f7cff;
  --accent-hover: #6b93ff;
  --accent-dim: rgba(79, 124, 255, 0.12);

  /* Opportunity Signals */
  --signal-strong: #22c55e;   /* strong buy */
  --signal-good: #84cc16;     /* good value */
  --signal-watch: #f59e0b;    /* watch */
  --signal-pass: #6b7280;     /* pass */

  /* Risk Colors */
  --risk-low: #22c55e;
  --risk-medium: #f59e0b;
  --risk-high: #ef4444;
  --risk-very-high: #dc2626;

  /* Opportunity Badge Colors */
  --badge-mispriced: #a78bfa;
  --badge-distressed: #ef4444;
  --badge-auction: #f59e0b;
  --badge-estate: #60a5fa;
  --badge-rental: #34d399;
  --badge-hidden: #c084fc;
  --badge-below: #22c55e;
  --badge-offmarket: #fb923c;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-focus: 0 0 0 3px rgba(79,124,255,0.3);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

/* ── Typography ───────────────────────────────────────────────────── */
.text-xs    { font-size: 11px; line-height: 1.4; }
.text-sm    { font-size: 13px; line-height: 1.5; }
.text-base  { font-size: 15px; line-height: 1.6; }
.text-lg    { font-size: 18px; line-height: 1.5; }
.text-xl    { font-size: 22px; line-height: 1.4; }
.text-2xl   { font-size: 28px; line-height: 1.3; }
.text-3xl   { font-size: 36px; line-height: 1.2; }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-green     { color: var(--signal-strong); }
.text-amber     { color: var(--signal-watch); }
.text-red       { color: var(--risk-high); }

.mono { font-family: var(--font-mono); }

/* ── Layout ──────────────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-6); }
.container-sm { max-width: 900px; margin: 0 auto; padding: 0 var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

/* ── Navigation ──────────────────────────────────────────────────── */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.nav-logo-accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-cta {
  background: var(--accent);
  color: white;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
}
.nav-cta:hover { background: var(--accent-hover); }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
}

.card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-elevated);
}

.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

/* ── Property Card (List View) ───────────────────────────────────── */
.property-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}

.property-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-card);
}

.property-card.selected {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 2px var(--accent);
}

.property-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.property-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.property-address {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.property-neighborhood {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.property-card-meta {
  display: flex;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--text-secondary);
  margin: var(--space-3) 0;
}

.property-card-meta span { display: flex; align-items: center; gap: 4px; }

.money-line {
  font-size: 13px;
  font-weight: 500;
  color: var(--signal-strong);
  margin: var(--space-2) 0;
  line-height: 1.4;
}

.catch-line {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.property-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* ── Score Badge ─────────────────────────────────────────────────── */
.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  font-weight: 700;
  flex-shrink: 0;
}

.score-badge .score-num {
  font-size: 20px;
  line-height: 1;
}

.score-badge .score-label {
  font-size: 9px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.8;
}

.score-a   { background: rgba(34,197,94,0.15); border: 1px solid var(--signal-strong); color: var(--signal-strong); }
.score-b   { background: rgba(132,204,22,0.12); border: 1px solid var(--signal-good); color: var(--signal-good); }
.score-c   { background: rgba(245,158,11,0.12); border: 1px solid var(--signal-watch); color: var(--signal-watch); }
.score-d   { background: rgba(107,114,128,0.12); border: 1px solid var(--signal-pass); color: var(--signal-pass); }

/* ── Opportunity Badge / Chip ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-mispriced { background: rgba(167,139,250,0.15); color: var(--badge-mispriced); border: 1px solid rgba(167,139,250,0.3); }
.badge-distressed, .badge-pre-foreclosure, .badge-foreclosure { background: rgba(239,68,68,0.12); color: var(--badge-distressed); border: 1px solid rgba(239,68,68,0.3); }
.badge-auction, .badge-foreclosure-auction { background: rgba(245,158,11,0.12); color: var(--badge-auction); border: 1px solid rgba(245,158,11,0.3); }
.badge-estate { background: rgba(96,165,250,0.12); color: var(--badge-estate); border: 1px solid rgba(96,165,250,0.3); }
.badge-rental { background: rgba(52,211,153,0.12); color: var(--badge-rental); border: 1px solid rgba(52,211,153,0.3); }
.badge-hidden { background: rgba(192,132,252,0.12); color: var(--badge-hidden); border: 1px solid rgba(192,132,252,0.3); }
.badge-below, .badge-strong-buy, .badge-good-value { background: rgba(34,197,94,0.12); color: var(--badge-below); border: 1px solid rgba(34,197,94,0.3); }
.badge-offmarket { background: rgba(251,146,60,0.12); color: var(--badge-offmarket); border: 1px solid rgba(251,146,60,0.3); }
.badge-value-add { background: rgba(79,124,255,0.12); color: var(--accent); border: 1px solid rgba(79,124,255,0.3); }
.badge-watch { background: rgba(245,158,11,0.12); color: var(--signal-watch); border: 1px solid rgba(245,158,11,0.3); }
.badge-motivated { background: rgba(251,146,60,0.12); color: var(--badge-offmarket); border: 1px solid rgba(251,146,60,0.3); }
.badge-cash-flow { background: rgba(52,211,153,0.12); color: var(--badge-rental); border: 1px solid rgba(52,211,153,0.3); }
.badge-default { background: rgba(139,156,194,0.1); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Chip (filter) ───────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}

.chip:hover { background: var(--bg-card-hover); border-color: var(--border-light); color: var(--text-primary); }

.chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Search Bar ───────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px var(--space-5);
  transition: border-color 0.15s;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
}

.search-bar input::placeholder { color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: var(--font-sans);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; }

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); color: var(--text-primary); }

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

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

.btn-success { background: rgba(34,197,94,0.15); color: var(--signal-strong); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-amber { background: rgba(245,158,11,0.15); color: var(--signal-watch); border: 1px solid rgba(245,158,11,0.3); }
.btn-amber:hover { background: rgba(245,158,11,0.25); }

/* ── Inputs ──────────────────────────────────────────────────────── */
.input, .select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6a8a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.input::placeholder { color: var(--text-muted); }

/* ── Range Slider ────────────────────────────────────────────────── */
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
}

/* ── Homepage ─────────────────────────────────────────────────────── */
.hero {
  padding: 80px var(--space-6) 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(79,124,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(79,124,255,0.25);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-5);
}

.hero-title {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: var(--space-5);
  color: var(--text-primary);
}

.hero-title .gradient {
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-8);
  line-height: 1.7;
}

.trust-strip {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trust-item .trust-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.trust-item .trust-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Mode Buttons */
.mode-grid {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--space-6) 0;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.18s;
  min-width: 120px;
  text-decoration: none;
  color: var(--text-primary);
}

.mode-btn:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.mode-btn .mode-icon { font-size: 24px; line-height: 1; }
.mode-btn .mode-label { font-size: 13px; font-weight: 600; text-align: center; }
.mode-btn .mode-sub { font-size: 11px; color: var(--text-muted); text-align: center; }

/* ── Search Workspace ─────────────────────────────────────────────── */
.search-workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.search-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.search-controls {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.results-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.results-header {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* ── Map ─────────────────────────────────────────────────────────── */
.map-container {
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
}

/* Leaflet overrides */
.leaflet-container {
  background: #1a1e2a;
  font-family: var(--font-sans);
}

.leaflet-tile-pane { filter: brightness(0.85) saturate(0.7); }

/* Custom map markers */
.map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform 0.15s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.map-marker:hover { transform: scale(1.1); z-index: 1000 !important; }

.marker-strong { background: var(--signal-strong); color: #000; border: 2px solid rgba(0,0,0,0.2); }
.marker-good   { background: var(--signal-good); color: #000; border: 2px solid rgba(0,0,0,0.2); }
.marker-watch  { background: var(--signal-watch); color: #000; border: 2px solid rgba(0,0,0,0.2); }
.marker-pass   { background: var(--text-muted); color: #fff; border: 2px solid rgba(0,0,0,0.2); }
.marker-auction { background: var(--badge-auction); color: #000; border: 2px solid rgba(0,0,0,0.2); }
.marker-estate  { background: var(--badge-estate); color: #000; border: 2px solid rgba(0,0,0,0.2); }

/* ── Property Detail ─────────────────────────────────────────────── */
.detail-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.detail-address {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.detail-neighborhood {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Four summary boxes */
.summary-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.summary-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.summary-box-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.summary-box-value {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Key numbers strip */
.key-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.key-number {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
}

.key-number-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}

.key-number-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabs */
.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Risk strip */
.risk-strip {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: var(--space-5) 0;
}

.risk-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
}

.risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.risk-dot-low    { background: var(--risk-low); }
.risk-dot-medium { background: var(--risk-medium); }
.risk-dot-high   { background: var(--risk-high); }
.risk-dot-very-high { background: var(--risk-very-high); }

/* Score Radar */
.score-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.score-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 120px;
  flex-shrink: 0;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.score-bar-value {
  font-size: 12px;
  color: var(--text-secondary);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Financial Tabs ───────────────────────────────────────────────── */
.fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.fin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.fin-row:last-child { border-bottom: none; }
.fin-row-label { color: var(--text-secondary); }
.fin-row-value { font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); }
.fin-row-value.positive { color: var(--signal-strong); }
.fin-row-value.negative { color: var(--risk-high); }
.fin-row-value.neutral  { color: var(--signal-watch); }
.fin-row.total { border-top: 1px solid var(--border-light); padding-top: var(--space-3); margin-top: var(--space-2); }
.fin-row.total .fin-row-label { font-weight: 600; color: var(--text-primary); }
.fin-row.total .fin-row-value { font-size: 18px; }

.sensitivity-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sensitivity-table th {
  text-align: center;
  padding: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.3px;
}
.sensitivity-table td { text-align: center; padding: 7px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.sensitivity-table td:first-child { color: var(--text-secondary); font-size: 11px; }
.sensitivity-table .positive-cell { color: var(--signal-strong); font-weight: 600; }
.sensitivity-table .negative-cell { color: var(--risk-high); font-weight: 600; }

/* ── Acquisition Module ───────────────────────────────────────────── */
.acquisition-stepper {
  position: relative;
  padding-left: 28px;
}

.acq-step {
  position: relative;
  padding-bottom: var(--space-5);
}

.acq-step::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.acq-step:last-child::before { display: none; }

.acq-step-dot {
  position: absolute;
  left: -28px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-light);
  z-index: 1;
}

.acq-step.done .acq-step-dot {
  background: var(--signal-strong);
  border-color: var(--signal-strong);
}

.acq-step.current .acq-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79,124,255,0.2);
}

.acq-step-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.acq-step-desc  { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.acq-step-days  { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Mortgage Drawer / Financing ──────────────────────────────────── */
.mortgage-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.mortgage-pill:hover { border-color: var(--accent); }
.mortgage-pill .pill-amount { font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }
.mortgage-pill .pill-label  { color: var(--text-muted); }

/* ── AI Explainer ─────────────────────────────────────────────────── */
.ai-box {
  background: linear-gradient(135deg, rgba(79,124,255,0.08), rgba(167,139,250,0.06));
  border: 1px solid rgba(79,124,255,0.2);
  border-radius: var(--radius);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}

.ai-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
}

.ai-box-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.ai-box-content { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ── Context Cards ─────────────────────────────────────────────────── */
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}

.context-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
}

.context-score {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}

.context-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.context-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Compare / Watchlist ──────────────────────────────────────────── */
.watchlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-12);
  color: var(--text-muted);
  text-align: center;
}

.watchlist-empty .empty-icon { font-size: 48px; opacity: 0.4; }

/* ── Drawer (mobile bottom sheet / desktop right panel) ───────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
}

.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  right: 0;
  top: 60px;
  bottom: 0;
  width: 480px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.drawer.open { transform: translateX(0); }

.drawer-close {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.drawer-content { padding: var(--space-5); }

/* ── Notification / Toast ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-5);
  font-size: 14px;
  box-shadow: var(--shadow-elevated);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.25s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ── Loading / Skeleton ───────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Accordion ────────────────────────────────────────────────────── */
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.15s;
  user-select: none;
}

.accordion-header:hover { color: var(--text-primary); }
.accordion-header.open  { color: var(--text-primary); }

.accordion-chevron {
  transition: transform 0.2s;
  color: var(--text-muted);
}

.accordion-header.open .accordion-chevron { transform: rotate(180deg); }

.accordion-content {
  display: none;
  padding: var(--space-4) 0;
}

.accordion-content.open { display: block; }

/* ── Utility ─────────────────────────────────────────────────────── */
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.block { display: block; }
.relative { position: relative; }
.sticky-top { position: sticky; top: 0; z-index: 10; }
.overflow-hidden { overflow: hidden; }
.border-bottom { border-bottom: 1px solid var(--border); }
.divider { border: none; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
.cursor-pointer { cursor: pointer; }

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

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .search-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-container {
    height: 300px;
    order: -1;
  }

  .search-sidebar {
    height: calc(100vh - 360px);
  }

  .detail-hero { grid-template-columns: 1fr; }
  .fin-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .trust-strip { gap: var(--space-5); flex-wrap: wrap; }
  .mode-grid { gap: var(--space-2); }
  .mode-btn { min-width: 90px; padding: var(--space-3); }
  .drawer { width: 100%; top: auto; bottom: 0; height: 85vh; border-left: none; border-top: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .container { padding: 0 var(--space-4); }
  .hero { padding: 48px var(--space-4) 32px; }
  .nav-links { display: none; }
  .key-numbers { grid-template-columns: repeat(3, 1fr); }
}
