/* ============================
   LandScout — Redesign v2 styles
   ============================ */

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

:root {
  /* New design tokens */
  --bg:           #0a0d0a;
  --bg-2:         #0f130f;
  --bg-3:         #141a14;
  --bg-4:         #1a2219;
  --bg-5:         #1f291e;
  --border:       #2a3829;
  --border-hi:    #3d5239;
  --text:         #d4e8d0;
  --text-2:       #8aaa84;
  --text-3:       #506650;
  --accent:       oklch(75% 0.22 130);
  --accent-dim:   oklch(60% 0.18 130);
  --accent-glow:  oklch(75% 0.22 130 / 0.15);
  --accent-bg:    oklch(75% 0.22 130 / 0.08);
  --red:          oklch(65% 0.2 20);
  --red-dim:      oklch(50% 0.18 20);
  --amber:        oklch(75% 0.18 70);
  --amber-dim:    oklch(60% 0.14 70);
  --blue:         oklch(68% 0.18 250);
  --font-ui:      'Space Grotesk', sans-serif;
  --font-mono:    'Space Mono', monospace;
  --sidebar-w:    300px;
  --header-h:     52px;
  --bottom-nav-h: 58px;

  /* Legacy aliases — keep old app.js inline styles working */
  --bg-card:      var(--bg-3);
  --bg-sidebar:   var(--bg-2);
  --text-muted:   var(--text-2);
  --muted:        var(--text-3);
  --surface:      var(--bg-3);
  --accent-hover: var(--accent-dim);
  --green:        var(--accent);
  --yellow:       var(--amber);
  --radius:       2px;
  --shadow:       0 4px 20px rgba(0,0,0,0.6);
}

html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  background-image:
    radial-gradient(ellipse 120% 60% at 70% 50%, oklch(20% 0.06 130 / 0.3) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

/* ── Header ─────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px; gap: 18px;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
}
.header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim) 30%, var(--accent-dim) 70%, transparent);
  opacity: 0.4;
}

.logo-mark { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon {
  width: 28px; height: 28px;
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--accent-bg);
}
.logo-icon svg { width: 14px; height: 14px; color: var(--accent); }
.logo-text {
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  color: var(--text); letter-spacing: 0.05em;
}
.logo-text span { color: var(--accent); }
.logo { font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: .05em; }
.tagline { display: none; }

.header-divider { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

.pipeline-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-2);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
}
.status-dot.idle { background: var(--text-3); }
.status-dot.running {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.stat-pills { display: flex; align-items: center; gap: 1px; }
.stat-pill {
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.stat-pill:first-child { border-radius: 2px 0 0 2px; }
.stat-pill:last-child { border-radius: 0 2px 2px 0; }
.stat-pill .val { color: var(--text); font-weight: 700; }
.stat-pill .val.accent { color: var(--accent); }
.stat-pill .val.amber { color: var(--amber); }

.stats-bar { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 11px; font-family: var(--font-mono); }
.stats-bar .sep { color: var(--border); }

.header-right, .header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-left { display: flex; align-items: center; gap: 14px; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 2px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer; border: none; transition: all 0.12s;
  background: transparent; color: var(--text-2);
}
.btn-accent, .btn-primary {
  background: var(--accent); color: #0a0d0a; border: 1px solid var(--accent);
}
.btn-accent:hover, .btn-primary:hover { filter: brightness(1.1); }

.btn-ghost, .btn-outline {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover, .btn-outline:hover { border-color: var(--border-hi); color: var(--text); }

.btn-danger {
  background: var(--red-dim); color: #fff; border: 1px solid var(--red-dim);
}
.btn-danger:hover { background: var(--red); }

.btn-sm { padding: 4px 9px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; margin-top: 6px; }
.btn-icon, .btn-icon-only {
  width: 30px; height: 30px; padding: 0; justify-content: center;
}
.btn:disabled { opacity: 0.5; cursor: wait; }

.btn-apply {
  width: 100%; padding: 8px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-dim); color: var(--accent);
  border-radius: 2px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: all 0.12s;
}
.btn-apply:hover { background: var(--accent); color: #0a0d0a; }

/* ── View toggle ────────────────────────────────────── */
.view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 2px; overflow: hidden;
}
.view-btn {
  padding: 5px 10px; background: transparent;
  border: none; border-right: 1px solid var(--border);
  color: var(--text-3); cursor: pointer; font-size: 11px;
  font-family: var(--font-mono); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: all 0.1s;
}
.view-btn:last-child { border-right: none; }
.view-btn.active { background: var(--accent-bg); color: var(--accent); }
.view-btn:hover:not(.active) { background: var(--bg-3); color: var(--text-2); }

/* ── Layout ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
}
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-tab {
  flex: 1; padding: 10px 4px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-3); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  transition: all 0.12s; margin-bottom: -1px;
}
.sidebar-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sidebar-tab:hover:not(.active) { color: var(--text-2); }

.sidebar-body {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.sidebar-drag-handle { display: none; }
.sidebar-overlay { display: none; }

/* ── Sidebar section / collapsible ──────────────────── */
.sidebar-section {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 0;
  margin-bottom: 0;
}
.sidebar-section > h3 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-2);
  margin: 0;
}
.sidebar-section > h3:hover { background: var(--bg-4); }
.sidebar-section > h3::after {
  content: '▼';
  font-size: 9px; color: var(--text-3);
  transition: transform 0.15s;
  margin-left: auto; padding-left: 8px;
}
.sidebar-section.collapsed > h3::after { transform: rotate(-90deg); }
.sidebar-section.collapsed > :not(h3) { display: none; }
.sidebar-section > :not(h3) {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}

/* ── Tabs (legacy area-tabs) ────────────────────────── */
.area-tabs {
  display: flex; gap: 0;
  margin: -10px -12px 8px -12px;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  flex: 1; padding: 8px 4px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-3); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: all 0.12s; margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text-2); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Filter chips ───────────────────────────────────── */
.area-chips, .checkbox-row {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.area-chip {
  padding: 4px 9px; border: 1px solid var(--border);
  border-radius: 2px; cursor: pointer;
  font-size: 11px; color: var(--text-2);
  transition: all 0.1s; background: var(--bg-4);
  font-family: var(--font-mono);
}
.area-chip:hover { border-color: var(--accent-dim); color: var(--text); }
.area-chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* checkbox row → chip-style */
.checkbox-label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 7px; border: 1px solid var(--border);
  border-radius: 2px; cursor: pointer;
  font-size: 11px; color: var(--text-2);
  background: var(--bg-4);
  transition: all 0.1s;
}
.checkbox-label:hover { border-color: var(--border-hi); }
.checkbox-label input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }
.checkbox-label:has(input:checked) {
  background: var(--accent-bg); border-color: var(--accent-dim); color: var(--accent);
}

/* ── Filter inputs ──────────────────────────────────── */
.filter-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.filter-group > label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  display: block;
}

.input-sm, input[type=text], input[type=number], input[type=email], input[type=password], select, textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 2px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  width: 100%;
  transition: border-color 0.1s;
}
.input-sm:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-dim);
}
input[type=number].input-sm { width: auto; flex: 1; }
textarea { font-family: var(--font-ui); line-height: 1.5; }

.range-inputs { display: flex; align-items: center; gap: 6px; }
.range-inputs span { color: var(--text-3); font-size: 11px; flex-shrink: 0; }
.input-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }

.slider, input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: var(--border); border-radius: 2px; cursor: pointer;
  accent-color: var(--accent);
}
.slider::-webkit-slider-thumb,
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 2px; background: var(--accent);
  border: none; cursor: pointer;
}
.slider::-moz-range-thumb,
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 2px; background: var(--accent); border: none;
}
.slider-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent); text-align: right; margin-top: 2px;
}

/* drawn area info banner */
.drawn-info {
  background: var(--bg); border: 1px solid var(--accent-dim);
  border-radius: 2px; padding: 6px 9px; font-size: 11px; color: var(--accent);
  margin-top: 8px; font-family: var(--font-mono);
}

/* ── Main content ───────────────────────────────────── */
.main-content {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* Toolbar */
.view-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.view-controls .view-toggle { margin-right: auto; }

.result-count {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
}
.result-count .n { color: var(--text); font-weight: 700; }

#sort-select, .sort-select {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-2); border-radius: 2px;
  padding: 4px 8px; font-size: 11px; font-family: var(--font-mono);
  cursor: pointer; width: auto;
}
#sort-select:focus { border-color: var(--accent-dim); outline: none; }

/* ── Status strip ───────────────────────────────────── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0;
}
.status-card {
  background: var(--bg-2);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px;
  border-radius: 0;
  border: none;
}
.status-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 0;
}
.status-value {
  font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--text);
}
.status-card:nth-child(2) .status-value,
.status-card:nth-child(4) .status-value { color: var(--accent); }

/* ── Onboarding empty state ─────────────────────────── */
.empty-state {
  margin: 14px 16px 0;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: 2px;
  background: var(--bg-3);
}
.empty-state h3 { margin-bottom: 8px; font-size: 13px; color: var(--text); }
.empty-state p { color: var(--text-2); line-height: 1.6; font-size: 12px; }

/* ── View panels ────────────────────────────────────── */
.view-panel { flex: 1; overflow: hidden; }
.view-panel.hidden { display: none !important; }

/* Map */
#map, #map-split { width: 100%; height: 100%; position: relative; }
.leaflet-container { background: #0d120d; font-family: var(--font-ui); }
#view-map, #view-split { position: relative; }

/* Split view */
.split-panel { display: flex !important; }
.split-panel #map-split { flex: 1; min-height: 0; }
.split-list {
  width: 320px;
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  overflow-y: auto;
}
.plots-list { padding: 0; }

/* ── Plot grid ──────────────────────────────────────── */
#view-list { overflow-y: auto; padding: 14px; }
.plots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

/* ── Plot card ──────────────────────────────────────── */
.plot-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s, transform 0.12s;
  display: flex; flex-direction: column;
  border-radius: 0;
  animation: fadeUp 0.25s ease both;
  overflow: hidden;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.plot-card:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.plot-card.selected, .plot-card.highlighted { border-color: var(--accent); }

.card-image {
  width: 100%; height: 150px;
  object-fit: cover;
  display: block;
  background: var(--bg-4);
}
.card-image-placeholder {
  width: 100%; height: 150px;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(
    45deg, var(--bg-4), var(--bg-4) 4px, var(--bg-5) 4px, var(--bg-5) 8px
  );
  color: var(--text-3);
  font-size: 18px;
}

.card-body {
  padding: 10px 12px;
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
}

/* Card action buttons (favourite / compare / workflow chip) — inline row at top of card-body */
.card-actions {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.card-action-btn {
  width: 24px !important; height: 24px !important;
  background: var(--bg-4) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-2) !important;
  font-size: 12px !important;
  padding: 0 !important;
  border-radius: 2px !important;
}
.card-action-btn:hover { border-color: var(--accent-dim) !important; color: var(--accent) !important; }

.card-title {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-location {
  font-size: 11px; color: var(--text-2);
  font-family: var(--font-mono);
}
.card-price {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
  color: var(--accent);
}
.card-ppsm {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-3);
  margin-top: -3px;
}

.card-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.meta-chip {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 10px; color: var(--text-2);
  font-family: var(--font-mono);
  background: var(--bg-4);
}
.meta-chip.green { border-color: oklch(75% 0.22 130 / 0.4); color: var(--accent-dim); }
.meta-chip.yellow { border-color: oklch(75% 0.18 70 / 0.4); color: var(--amber-dim); }
.meta-chip.type { color: var(--text); }
.meta-chip.rating { background: oklch(75% 0.18 70 / 0.1); color: var(--amber); border-color: var(--amber-dim); }
.meta-chip.hazard { background: oklch(65% 0.2 20 / 0.1); color: var(--red); border-color: var(--red-dim); }
.meta-chip.refined { background: oklch(68% 0.18 250 / 0.1); color: var(--blue); border-color: oklch(68% 0.18 250 / 0.4); }

/* Workflow chip on card */
.workflow-chip {
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--bg-4);
}
.workflow-chip.shortlisted,
.workflow-chip.reviewing,
.workflow-chip.contacted,
.workflow-chip.visited {
  border-color: var(--accent-dim); color: var(--accent); background: var(--accent-bg);
}
.workflow-chip.rejected {
  border-color: var(--red-dim); color: var(--red);
  background: oklch(65% 0.2 20 / 0.08);
}
.favorite-star { color: var(--amber); }

/* Score badge — supports old (high/mid/low/pending) and new (hi/mid/lo/none) */
.score-badge {
  position: absolute; top: 8px; right: 8px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid; border-radius: 2px;
  font-family: var(--font-mono); font-weight: 700;
  font-size: 14px;
  z-index: 2;
}
.score-badge.high, .score-badge.hi {
  background: oklch(75% 0.22 130 / 0.12);
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px oklch(75% 0.22 130 / 0.2);
}
.score-badge.mid {
  background: oklch(75% 0.18 70 / 0.12);
  border-color: var(--amber); color: var(--amber);
}
.score-badge.low, .score-badge.lo {
  background: oklch(65% 0.2 20 / 0.08);
  border-color: var(--red); color: var(--red);
}
.score-badge.none, .score-badge.pending {
  background: var(--bg-4);
  border-color: var(--border);
  color: var(--text-3);
}
.score-badge.pending { animation: pulse-pending 1.8s ease-in-out infinite; }
@keyframes pulse-pending { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.card-pending { opacity: 0.85; }

/* New badge */
.new-badge, .new-tag {
  position: absolute; bottom: 8px; left: 8px;
  padding: 2px 6px; border-radius: 2px;
  background: var(--accent); color: #0a0d0a;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  z-index: 2;
}

/* Source tag/badge */
.source-badge, .source-tag {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 6px; border-radius: 2px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  z-index: 2;
}
.source-badge.olx, .source-tag.olx {
  background: #1a2744; color: #7099cc; border: 1px solid #2a3a60;
}
.source-badge.otodom, .source-tag.otodom {
  background: #0d2215; color: #5aaa70; border: 1px solid #1a4025;
}
.source-badge.gratka, .source-tag.gratka {
  background: #2a0d22; color: #cc7099; border: 1px solid #401a35;
}
.source-badge.kowr, .source-tag.kowr {
  background: #251a05; color: #c08030; border: 1px solid #4a3010;
}
.modal-source-tag { position: static; display: inline-block; margin-bottom: 6px; }

/* Card utilities */
.card-utilities {
  display: flex; gap: 8px;
  margin-top: auto;
  padding: 7px 0 0;
  border-top: 1px solid var(--border);
}
.util-icon {
  font-size: 11px; opacity: 0.3;
  color: var(--text-3);
}
.util-icon.active { opacity: 1; color: var(--accent-dim); }

/* ── Plot list item (split view) ────────────────────── */
.plot-list-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  display: flex; gap: 10px;
  align-items: flex-start;
  background: transparent;
  border-left: 2px solid transparent;
}
.plot-list-item:hover { background: var(--bg-3); }
.plot-list-item.highlighted, .plot-list-item.active {
  background: var(--accent-bg); border-left-color: var(--accent);
}
.list-title {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.list-meta {
  display: flex; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2);
  flex-wrap: wrap;
  align-items: center;
}
.list-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── Map popup ──────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--bg-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 2px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6) !important;
}
.leaflet-popup-tip { background: var(--bg-2) !important; border: 1px solid var(--border) !important; }
.leaflet-popup-content {
  margin: 12px 14px !important; min-width: 220px;
  font-family: var(--font-ui);
}
.leaflet-popup-close-button { color: var(--text-3) !important; top: 6px !important; right: 6px !important; }
.popup-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; line-height: 1.3; }
.popup-price {
  color: var(--accent); font-family: var(--font-mono); font-weight: 700; font-size: 14px;
}
.popup-score {
  display: inline-block; padding: 2px 8px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  border-radius: 2px;
}
.popup-btn {
  display: block; width: 100%; margin-top: 8px; padding: 6px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent-dim);
  cursor: pointer; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: all 0.12s;
  border-radius: 2px;
}
.popup-btn:hover { background: var(--accent); color: #0a0d0a; }

/* Leaflet controls dark theme */
.leaflet-control-layers, .leaflet-bar {
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 2px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
  color: var(--text) !important;
}
.leaflet-bar a {
  background: var(--bg-3) !important; color: var(--text-2) !important;
  border-color: var(--border) !important;
}
.leaflet-bar a:hover { background: var(--bg-4) !important; color: var(--text) !important; }
.leaflet-control-layers-toggle {
  background-color: var(--bg-3) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238aaa84' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}
.leaflet-control-layers-expanded {
  background: var(--bg-2) !important; color: var(--text) !important;
  font-family: var(--font-ui); font-size: 12px;
  padding: 8px 10px !important;
}
.leaflet-control-layers-base label, .leaflet-control-layers-overlays label {
  display: flex; align-items: center; gap: 6px;
}
.leaflet-control-attribution {
  background: rgba(15, 19, 15, 0.85) !important;
  color: var(--text-3) !important;
  font-size: 10px !important;
  font-family: var(--font-mono);
}
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-draw-toolbar a { background-color: var(--bg-3) !important; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none !important; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 0;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--bg-4);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 28px; height: 28px;
  border-radius: 2px;
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-content { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }

.modal-images {
  display: flex; gap: 6px; overflow-x: auto;
}
.modal-images img {
  height: 160px; flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  object-fit: cover;
}

.modal-title {
  font-size: 16px; font-weight: 600; line-height: 1.3;
  color: var(--text);
}
.modal-location {
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--font-mono);
}

.modal-price-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.modal-price {
  font-family: var(--font-mono); font-size: 24px; font-weight: 700;
  color: var(--accent);
}
.modal-ppsm {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-2);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.modal-stat {
  background: var(--bg-3);
  padding: 10px 12px;
}
.modal-stat-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 3px;
}
.modal-stat-value {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--text);
}

/* AI section */
.ai-section {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 14px;
}
.ai-score-big {
  font-family: var(--font-mono); font-size: 40px; font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}
.ai-summary {
  color: var(--text-2); font-size: 12px;
  line-height: 1.6; margin-bottom: 12px;
}
.pros-cons {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.pros-cons > .pros, .pros-cons > .cons {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
}
.pros-cons > .pros { border-top: 2px solid var(--accent); }
.pros-cons > .cons { border-top: 2px solid var(--red); }
.pros-cons h4 {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 8px;
}
.pros-cons .pros h4 { color: var(--accent); }
.pros-cons .cons h4 { color: var(--red); }
.pros-cons ul { list-style: none; padding-left: 0; font-size: 12px; color: var(--text-2); }
.pros-cons li {
  display: flex; align-items: flex-start; gap: 6px;
  margin-bottom: 5px; line-height: 1.4;
}
.pros-cons li::before { content: '—'; flex-shrink: 0; }
.pros-cons .pros li::before { color: var(--accent-dim); }
.pros-cons .cons li::before { color: var(--red-dim); }

.modal-description {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 12px;
  font-size: 12px; color: var(--text-2);
  line-height: 1.7;
  max-height: 180px; overflow-y: auto;
}

.modal-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 0 0;
}
.modal-actions.wrap { flex-wrap: wrap; }

/* Workflow / rating / location panels in modal */
.workflow-panel, .rating-panel, .location-panel, .hazards-panel {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 12px;
}
.workflow-panel-header, .location-panel-header, .rating-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.workflow-panel-header > span:first-child,
.location-panel-header > span:first-child,
.rating-panel-header > span:first-child,
.hazards-panel > h4 {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
}
.workflow-panel textarea, .rating-note { min-height: 70px; resize: vertical; }
.workflow-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* meta-grid (AI provenance under AI section) */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  margin-top: 10px;
  border: 1px solid var(--border);
}
.meta-item { background: var(--bg-3); padding: 6px 10px; }
.meta-item-label {
  color: var(--text-3); font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
  margin-bottom: 2px;
}
.meta-item-value {
  font-size: 12px; font-weight: 600;
  font-family: var(--font-mono);
}

/* Hazard chips */
.hazards-panel { padding: 10px 12px; }
.hazards-panel h4 { margin-bottom: 8px; font-size: 10px; }
.hazard-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.hazard-chip {
  padding: 3px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.hazard-chip.hazard-safe { background: var(--bg-4); color: var(--text-3); }
.hazards-empty { font-size: 12px; color: var(--text-3); }

/* Rating panel */
.rating-stars { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.rating-star {
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  transition: color 0.15s;
  user-select: none;
}
.rating-star:hover { color: var(--amber-dim); }
.rating-star.filled { color: var(--amber); }
.rating-meta { font-size: 10px; color: var(--text-3); margin-top: 4px; font-family: var(--font-mono); }
.rating-note { width: 100%; min-height: 60px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; }

/* Location panel */
.loc-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}
.loc-badge-scraper { background: var(--bg-4); color: var(--text-2); }
.loc-badge-geocoded { background: oklch(75% 0.18 70 / 0.1); color: var(--amber); border-color: var(--amber-dim); }
.loc-badge-manual { background: oklch(68% 0.18 250 / 0.1); color: var(--blue); border-color: oklch(68% 0.18 250 / 0.4); }
.location-coords {
  font-size: 11px; color: var(--text-3);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}
.location-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.location-editor-map {
  width: 100%; height: 280px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.location-editor-hint {
  font-size: 11px; color: var(--text-3);
  margin-bottom: 6px; font-family: var(--font-mono);
}

/* Manual location marker */
.refined-marker {
  width: 18px; height: 18px;
  transform: rotate(45deg);
  background: var(--blue);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  position: relative;
}
.refined-marker::after {
  content: "✓";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  color: #fff;
  font-size: 11px; font-weight: bold;
  line-height: 1;
}

/* ── Settings modal ─────────────────────────────────── */
.settings-modal {
  max-width: 580px;
  padding: 0;
  background: var(--bg-2);
}
.settings-modal .modal-close { top: 14px; right: 14px; }
.settings-modal h2 {
  padding: 14px 20px 0;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-2);
  margin: 0;
}

.settings-group {
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.settings-group:last-of-type { border-bottom: none; }
.settings-group h4 {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
  margin: 0 0 4px 0;
}
.settings-group .hint { color: var(--text-3); font-size: 11px; line-height: 1.5; margin-bottom: 4px; font-family: var(--font-mono); }
.settings-group code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 4px; border-radius: 2px;
  color: var(--accent);
}

.toggle-row {
  display: flex; align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 0;
}
.toggle-row:hover { background: var(--bg-4); }
.toggle-text { flex: 1; min-width: 0; }
.toggle-label { display: block; font-weight: 500; font-size: 13px; color: var(--text); }
.toggle-desc { font-size: 11px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.toggle-cb { display: none; }
.toggle-switch {
  position: relative; display: inline-block; flex-shrink: 0;
  width: 36px; height: 20px;
}
.toggle-switch::before {
  content: ''; position: absolute; inset: 0;
  background: var(--border); border-radius: 2px;
  transition: background 0.2s;
}
.toggle-switch::after {
  content: ''; position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--bg-3); border-radius: 1px;
  transition: transform 0.2s;
}
.toggle-cb:checked + .toggle-switch::before { background: var(--accent-dim); }
.toggle-cb:checked + .toggle-switch::after { transform: translateX(16px); background: #0a0d0a; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
}
.settings-row label { font-size: 12px; color: var(--text-2); }

.settings-divider { border-top: 1px solid var(--border); margin: 10px 0; }
.stage-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.stack-actions { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }

.ai-provider-config { padding: 4px 0; }
.ai-provider-config.hidden { display: none; }

/* Saved filter card */
.saved-filter-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 10px;
  margin-top: 8px;
}
.saved-filter-meta { color: var(--text-3); font-size: 10px; margin-top: 4px; font-family: var(--font-mono); }
.saved-filter-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Compare modal */
.compare-modal { max-width: 1100px; }
.compare-table-wrapper { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.compare-table th, .compare-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  background: var(--bg-3);
  color: var(--text);
}
.compare-table th {
  text-align: left;
  background: var(--bg-2);
  min-width: 220px;
  color: var(--text-2);
  font-weight: 600;
}

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; }
.page-btn {
  padding: 5px 10px; background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-mono); font-size: 11px;
}
.page-btn.active { background: var(--accent-bg); border-color: var(--accent-dim); color: var(--accent); }

/* ── Layer switcher (custom overlay on map) ─────────── */
.map-layer-toggle {
  position: absolute;
  bottom: 40px; left: 12px;
  z-index: 400;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px;
  display: flex; gap: 2px;
}
.layer-btn {
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-3);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 2px;
  transition: all 0.1s;
}
.layer-btn.active { background: var(--accent-bg); border-color: var(--accent-dim); color: var(--accent); }
.layer-btn:hover:not(.active) { background: var(--bg-4); color: var(--text-2); }

/* ── Toast ──────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 3000;
}
.toast {
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 12px; min-width: 220px;
  font-family: var(--font-ui);
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
}
.toast.success { border-color: var(--accent-dim); color: var(--accent); }
.toast.error { border-color: var(--red-dim); color: var(--red); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Loading spinner ────────────────────────────────── */
.loading-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { color: var(--text-3); font-size: 11px; line-height: 1.5; margin-bottom: 6px; }
.hidden { display: none !important; }

/* ── Bottom nav (mobile only; hidden by default) ────── */
.bottom-nav { display: none; }

/* Filter button in header is mobile-only (sidebar is always visible on desktop) */
#btn-mobile-filters { display: none; }

/* ── Responsive: ≤768px ─────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: 50px; }

  .header { padding: 0 12px; gap: 10px; }
  .header-divider, .pipeline-status, .stat-pills,
  .stats-bar, .header .view-toggle, .tagline,
  .view-controls .view-toggle { display: none !important; }
  .btn-icon, .btn-icon-only { width: 40px; height: 40px; }
  #btn-scrape, #btn-stop-pipeline { padding: 8px 12px; font-size: 13px; }
  #btn-scrape .btn-label, #btn-stop-pipeline .btn-label { display: none; }
  #btn-mobile-filters { display: inline-flex; }

  .app-layout { flex-direction: column; height: calc(100vh - var(--header-h)); }
  .app-body { position: relative; }

  /* Sidebar → bottom sheet */
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%; min-width: 0;
    height: 75vh; max-height: 75vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    z-index: 1500;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  }
  .sidebar.open { transform: translateY(0); }

  .sidebar-drag-handle {
    display: flex !important;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .sidebar-drag-handle::after {
    content: '';
    width: 36px; height: 4px;
    background: var(--border-hi);
    border-radius: 2px;
  }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1490;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }

  /* Toolbar */
  .view-controls { padding: 6px 10px; gap: 6px; flex-wrap: wrap; }
  .result-count { flex-wrap: wrap; }
  .result-count #btn-compare-open,
  .result-count #btn-export-csv,
  .result-count #btn-export-json,
  .result-count #btn-export-calibration { display: none; }

  /* Status strip → 2×2 */
  .status-strip { grid-template-columns: 1fr 1fr; }

  /* Main content padded for bottom nav */
  .main-content { padding-bottom: var(--bottom-nav-h); }

  /* Bottom nav visible */
  .bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-h);
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none; cursor: pointer;
    color: var(--text-3);
    padding: 0;
    min-height: 44px;
    transition: color 0.1s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item:active { background: var(--bg-3); }
  .bottom-nav-icon { font-size: 20px; line-height: 1; }
  .bottom-nav-label {
    font-family: var(--font-mono);
    font-size: 9px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
  }

  /* Split view stacks */
  .split-panel { flex-direction: column !important; }
  .split-panel #map-split { height: 55vh !important; flex: none !important; }
  .split-list {
    width: 100%; max-height: 45vh;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  /* Cards: single column */
  .plots-grid { grid-template-columns: 1fr; }
  .card-image, .card-image-placeholder { height: 180px; }

  /* Plot modal: bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100% !important; max-height: 92vh !important;
    border-radius: 12px 12px 0 0;
    border-left: none; border-right: none; border-bottom: none;
  }
  .modal-grid { grid-template-columns: 1fr 1fr; }
  .pros-cons { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }

  /* Settings: full screen */
  .settings-modal { border-radius: 12px 12px 0 0; }

  /* Filter chips: larger touch targets */
  .area-chip { padding: 7px 10px; font-size: 12px; }
  .checkbox-label { padding: 6px 10px; font-size: 12px; }
  .input-sm,
  input[type=text], input[type=number], input[type=email], input[type=password], select { padding: 9px 10px; font-size: 14px; }
  .slider, input[type=range] { height: 6px; }
  .slider::-webkit-slider-thumb,
  input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; }
}

/* Tablet: tighter sidebar */
@media (min-width: 769px) and (max-width: 1100px) {
  :root { --sidebar-w: 280px; }
}

/* ── Status panel ──────────────────────────────────────────────────────────── */
.status-panel-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: flex-end;
}
.status-panel-overlay.hidden { display: none; }
.status-panel {
  width: min(680px, 100vw);
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.status-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}
.status-panel-title { font-weight: 600; font-size: 14px; letter-spacing: .04em; }
.status-panel-refreshed { font-size: 11px; color: var(--text-muted); }
.status-panel-body {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.sp-section { display: flex; flex-direction: column; gap: 8px; }
.sp-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sp-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.sp-card-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.sp-card-value { font-size: 18px; font-weight: 600; font-family: 'Space Mono', monospace; }
.sp-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sp-ok  { color: #4caf50; }
.sp-warn { color: #ff9800; }
.sp-err { color: #f44336; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sp-table th {
  text-align: left; padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
}
.sp-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.sp-table tr:last-child td { border-bottom: none; }
.sp-hist { display: flex; gap: 4px; align-items: flex-end; height: 48px; }
.sp-hist-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.sp-hist-bar { width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; }
.sp-hist-label { font-size: 9px; color: var(--text-muted); text-align: center; line-height: 1; }
.sp-errors-list { display: flex; flex-direction: column; gap: 4px; }
.sp-error-item {
  font-size: 11px; padding: 6px 10px;
  background: rgba(244,67,54,.08); border: 1px solid rgba(244,67,54,.2);
  border-radius: 6px; font-family: 'Space Mono', monospace;
}
.sp-none { font-size: 12px; color: var(--text-muted); font-style: italic; }
.sp-loading { font-size: 13px; color: var(--text-muted); text-align: center; padding: 40px; }
.btn-sm { padding: 4px 8px; font-size: 12px; }
@media (max-width: 768px) {
  .status-panel { width: 100vw; border-left: none; }
}

/* ── Locate control ─────────────────────────────────── */
.locate-btn {
  display: flex !important;
  align-items: center; justify-content: center;
  width: 30px !important; height: 30px !important;
  padding: 0 !important;
  color: #444 !important;
  transition: color 0.15s, background 0.15s;
}
.locate-btn:hover { color: #2563eb !important; }
.locate-btn.locate-active { color: #2563eb !important; background: #dbeafe !important; }
.locate-btn.locate-loading { color: #94a3b8 !important; }
.locate-btn svg { display: block; pointer-events: none; }

/* User-location marker */
.user-location-marker {
  position: relative;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}
.user-location-dot {
  width: 12px; height: 12px;
  background: #2563eb;
  border: 2.5px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(37,99,235,0.5);
  position: relative; z-index: 1;
  flex-shrink: 0;
}
.user-location-ring {
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(37,99,235,0.45);
  background: rgba(37,99,235,0.1);
  animation: geo-pulse 2s ease-out infinite;
}
@keyframes geo-pulse {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* tinder keyboard nav hint */
.tinder-hint {
  margin-top: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2, rgba(255,255,255,0.05));
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  font-size: 0.78em;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.01em;
}
.tinder-counter {
  font-weight: 600;
  color: var(--text-secondary, var(--text-muted));
  margin-left: 8px;
}

/* ── Search bars ─────────────────────────────────────────────────────────── */
.search-section { padding-bottom: 0; }
.search-row { display: flex; gap: 6px; }
.search-input { flex: 1; }

.geo-search-bar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 6px;
  width: min(420px, calc(100% - 24px));
  pointer-events: auto;
}
.geo-search-input {
  flex: 1;
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.geo-search-btn {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  white-space: nowrap;
}


/* ============================
   Trip Lists modal
   ============================ */

.trip-lists-modal {
  max-width: 620px;
  width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.tl-loading {
  color: var(--text-muted);
  padding: 20px 0;
  text-align: center;
}

/* Create new list form */
.tl-create-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tl-create-row .input-sm {
  flex: 1;
}

/* List of trip lists */
.tl-lists {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.tl-item:hover {
  border-color: var(--border-hi);
}

.tl-item-name {
  flex: 1;
  font-weight: 500;
}

.tl-item-count {
  font-size: 0.78em;
  color: var(--text-muted);
  white-space: nowrap;
}

.tl-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Single list detail view */
.tl-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.82em;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.tl-back-btn:hover { color: var(--text); }

.tl-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tl-detail-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.tl-plot-row {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tl-plot-row:hover { border-color: var(--border-hi); }

.tl-plot-info {
  flex: 1;
  min-width: 0;
}

.tl-plot-title {
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-plot-meta {
  font-size: 0.75em;
  color: var(--text-muted);
  margin-top: 2px;
}

.tl-empty {
  color: var(--text-muted);
  font-size: 0.85em;
  padding: 16px 0;
  text-align: center;
}

/* "Add to list" inline picker in plot modal */
.tl-add-picker {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tl-add-picker select {
  flex: 1;
}
