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

:root {
  --bg:     #0a0a0c;
  --bg2:    #111115;
  --bg3:    #18181e;
  --border: #2a2a35;
  --accent: #f59e0b;
  --cyan:   #00d4ff;
  --text:   #e8e6e0;
  --muted:  #6b6875;
  --mono:   'Space Mono', monospace;
  --sans:   system-ui, sans-serif;
  --panel-w: 360px;
}

html, body, #app { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); transition: background 0.2s, color 0.2s; }

/* ── Light mode ── */
body.light-mode {
  --bg:     #f4f3ef;
  --bg2:    #ffffff;
  --bg3:    #eceae4;
  --border: #d4d0c8;
  --text:   #1a1a20;
  --muted:  #6b6875;
}
body.light-mode .header { background: rgba(244,243,239,0.95); }
body.light-mode .layers-panel { background: rgba(255,255,255,0.97); }
body.light-mode #search { color: var(--text); }
body.light-mode .result-item:hover { background: var(--bg3); }
body.light-mode .toggle-track { background: #c8c4bc; }

/* ── App Layout ── */
#app-layout {
  display: flex; flex-direction: row;
  position: absolute; top: 60px; left: 0; right: 0; bottom: 0;
}

#chat-panel {
  width: 0; min-width: 0; flex-shrink: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: #0f1117;
  border-right: 1px solid var(--border);
  z-index: 85;
  transition: width 0.2s ease;
}
#chat-panel.open {
  width: 280px; min-width: 280px;
}
#chat-header {
  padding: 14px 16px 12px;
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: var(--accent); letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-hex { font-size: 16px; margin-right: 4px; }

#chat-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}

/* Starter chips */
.chat-starter { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.chat-starter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.chat-chip {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: var(--text); cursor: pointer;
  text-align: left; transition: border-color 0.15s, background 0.15s;
  font-family: var(--sans);
}
.chat-chip:hover { border-color: var(--accent); background: rgba(245,158,11,0.08); }

/* Chat input row */
#chat-input-row {
  display: flex; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#chat-input {
  flex: 1; padding: 8px 10px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; outline: none;
  font-family: var(--sans);
}
#chat-input:focus { border-color: var(--accent); }
#chat-send {
  padding: 8px 10px; background: rgba(245,158,11,0.15);
  border: 1px solid var(--accent); border-radius: 6px;
  color: var(--accent); cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
#chat-send:hover { background: rgba(245,158,11,0.25); }
#chat-send svg { width: 14px; height: 14px; }

/* Chat messages */
.chat-msg { max-width: 95%; font-size: 13px; line-height: 1.5; }
.chat-msg-user {
  align-self: flex-end;
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px 10px 2px 10px;
  padding: 8px 12px; color: var(--text);
}
.chat-msg-assistant {
  align-self: flex-start;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px 10px 10px 2px;
  padding: 10px 12px; color: var(--text);
}

/* Thinking indicator */
.chat-thinking {
  align-self: flex-start;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
}

/* Card: stats */
.chat-card-stats .chat-stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-top: 8px;
}
.chat-stat-item {
  background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2);
  border-radius: 6px; padding: 8px; text-align: center;
}
.chat-stat-val {
  font-size: 16px; font-weight: 700; color: var(--accent);
  font-family: var(--mono);
}
.chat-stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* Card: table */
.chat-card-table { overflow-x: auto; margin-top: 8px; }
.chat-card-table table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.chat-card-table th {
  text-align: left; padding: 4px 6px; color: var(--muted);
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.chat-card-table td {
  padding: 4px 6px; border-bottom: 1px solid rgba(42,42,53,0.4);
  color: var(--text); white-space: nowrap;
}
.chat-card-table tr:last-child td { border-bottom: none; }

/* Chat toggle (mobile) */
#chat-toggle {
  display: none;
  position: fixed; bottom: 44px; right: 16px; z-index: 95;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); border: none; color: #0a0a0c;
  cursor: pointer; box-shadow: 0 4px 16px rgba(245,158,11,0.4);
  align-items: center; justify-content: center;
}
#chat-toggle svg { width: 20px; height: 20px; }

/* Map container */
#map-container { flex: 1; position: relative; overflow: hidden; }

/* ── Map ── */
#map { position: absolute; inset: 0; }

/* Light mode overrides for chat */
body.light-mode #chat-panel { background: #f8f7f4; }
body.light-mode #chat-input { background: #fff; }
body.light-mode .chat-msg-assistant { background: #fff; }

/* ── Header ── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: rgba(10,10,12,0.95);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  backdrop-filter: blur(10px);
}
.header-left { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.label { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; }
.subtitle { font-size: 10px; color: var(--muted); }

/* ── Search ── */
.search-wrap { position: relative; flex: 1; max-width: 520px; }

.search-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 6px 2px 4px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--cyan); }

#search {
  flex: 1; padding: 6px 8px;
  background: transparent; border: none;
  color: var(--text); font-size: 14px; outline: none;
  min-width: 0;
}

.results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  max-height: 280px; overflow-y: auto; z-index: 200;
}
.results.hidden { display: none; }

.result-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--bg3); }
.result-item strong { font-size: 13px; color: var(--text); }
.result-item span   { font-size: 11px; color: var(--muted); }
.result-item .result-value { color: var(--accent); }

/* ── Panel ── */
.panel {
  position: fixed;
  top: 60px; right: 0; bottom: 0;
  width: var(--panel-w);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 90;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease;
}
.panel.hidden { display: none; }

.panel-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; z-index: 10;
}
.panel-actions button {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px 6px; border-radius: 4px;
}
.panel-actions button:hover { color: var(--text); background: var(--border); }
#panel-close, #btn-print-report { /* inherits .panel-actions button */ }

#panel-content {
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

/* ── Panel Header ── */
.panel-header {
  padding: 16px 40px 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.panel-address {
  font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.3;
}
.panel-pidn {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  margin-top: 4px; letter-spacing: 0.05em;
}

/* ── Tabs ── */
.tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.tab {
  flex: 1; padding: 10px 8px; font-size: 12px; font-weight: 600;
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.tab:hover  { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tab Panes ── */
.tab-pane { flex: 1; overflow-y: auto; padding: 14px; }
.tab-pane.hidden { display: none; }

/* ── Info Grid ── */
.info-grid {
  display: grid; grid-template-columns: 90px 1fr;
  gap: 8px 12px; font-size: 13px;
}
.info-grid dt {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding-top: 2px;
}
.info-grid dd { color: var(--text); line-height: 1.4; }
.info-grid dd.value-highlight { color: var(--accent); font-weight: 700; font-size: 15px; }
.info-grid dd.legal-text { color: var(--muted); font-size: 11px; font-style: italic; }

/* ── Detail extras ── */
.detail-loading {
  margin-top: 14px; display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px;
}

.itax-btn {
  display: block; margin: 14px 0 10px;
  padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; color: var(--accent); font-size: 13px; font-weight: 600;
  text-decoration: none; text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.itax-btn:hover { background: rgba(245,158,11,0.1); border-color: var(--accent); }

.detail-section-title {
  margin: 16px 0 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--cyan);
}

.detail-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.detail-table th {
  text-align: left; padding: 4px 6px; color: var(--muted);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.detail-table td {
  padding: 5px 6px; border-bottom: 1px solid rgba(42,42,53,0.5);
  color: var(--text); vertical-align: top;
}
.detail-table tr:last-child td { border-bottom: none; }

/* ── Gallery ── */
.gallery-loading {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; margin-top: 8px;
}
.gallery {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 4px;
}
.gallery-item {
  display: block; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 4/3;
  transition: border-color 0.15s;
}
.gallery-item:hover { border-color: var(--accent); }
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.no-media {
  margin-top: 12px; font-size: 12px; text-align: center;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  border-radius: 4px; box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

/* ── Spinner ── */
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Lucide icon sizing ── */
button svg { width: 14px; height: 14px; stroke-width: 2; vertical-align: -2px; flex-shrink: 0; }
.mode-pill svg { width: 12px; height: 12px; }
#panel-close svg, #btn-print-report svg { width: 16px; height: 16px; }
.hdr-btn.icon-only { padding: 5px 8px; }

/* ── Header actions ── */
.header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.hdr-btn {
  padding: 6px 10px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hdr-btn:hover  { background: var(--bg3); border-color: var(--muted); }
.hdr-btn.active { border-color: var(--accent); color: var(--accent); }
#btn-draw.active { background: rgba(0,212,255,0.12); border-color: var(--cyan); color: var(--cyan); }

/* ── Search mode pills (inside the search bar) ── */
.mode-pill {
  flex-shrink: 0;
  padding: 3px 8px; background: transparent; border: 1px solid transparent;
  border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
  letter-spacing: 0.02em;
}
.mode-pill:hover  { color: var(--text); background: var(--bg3); }
.mode-pill.active { color: var(--accent); background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); }

/* ── AI search ── */
.ai-hint  { font-style: italic; font-size: 12px; }
.ai-where { font-size: 11px; color: var(--muted); background: var(--bg3); padding: 6px 10px; }
.ai-where code { color: var(--cyan); font-family: var(--mono); font-size: 10px; }
.ai-loading { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* ── Owner portfolio ── */
.owner-link {
  color: var(--cyan); text-decoration: none; cursor: pointer;
}
.owner-link:hover { text-decoration: underline; }

.portfolio-stats {
  display: flex; gap: 16px; font-size: 12px; color: var(--muted);
  margin-bottom: 10px;
}
.portfolio-stats b { color: var(--text); }

.portfolio-list { display: flex; flex-direction: column; gap: 2px; }
.portfolio-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 8px; border-radius: 5px; cursor: pointer; font-size: 12px;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.portfolio-item:hover { background: var(--bg3); border-color: var(--border); }
.portfolio-addr { color: var(--text); }
.portfolio-val  { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ── Disclaimer splash ── */
.disclaimer-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  padding: 16px;
}
.disclaimer-overlay.hidden { display: none; }

.disclaimer-modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; max-width: 560px; width: 100%;
  padding: 28px 28px 22px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  max-height: 90vh; overflow-y: auto;
}
.disclaimer-logo {
  font-family: 'Space Mono', monospace; font-size: 22px; font-weight: 700;
  letter-spacing: 0.15em; color: var(--accent); margin-bottom: 2px;
}
.disclaimer-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 16px; }
.disclaimer-rule { border: none; border-top: 1px solid var(--border); margin-bottom: 16px; }
.disclaimer-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0 0 12px; }
.disclaimer-body { font-size: 13px; line-height: 1.65; color: var(--muted); }
.disclaimer-body p { margin: 0 0 10px; }
.disclaimer-body strong { color: var(--text); }
.disclaimer-body ul { margin: 0 0 10px; padding-left: 18px; }
.disclaimer-body ul li { margin-bottom: 6px; }
.disclaimer-body a { color: var(--cyan); text-decoration: none; }
.disclaimer-body a:hover { text-decoration: underline; }
.disclaimer-fine { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 8px !important; }

.disclaimer-btn {
  width: 100%; margin-top: 18px; padding: 12px;
  background: rgba(245,158,11,0.12); border: 1px solid var(--accent);
  border-radius: 8px; color: var(--accent);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s;
}
.disclaimer-btn:hover { background: rgba(245,158,11,0.22); }
.disclaimer-btn svg { width: 16px; height: 16px; }

.disclaimer-footer {
  margin-top: 14px; font-size: 10px; color: var(--muted);
  text-align: center; opacity: 0.6;
}

/* ── Stats bar ── */
.stats-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
  background: rgba(10,10,12,0.92); border-top: 1px solid var(--border);
  padding: 7px 16px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
  backdrop-filter: blur(8px);
}
body.light-mode .stats-bar { background: rgba(244,243,239,0.95); }
.stats-bar span { color: var(--accent); font-weight: 600; }
.stats-csv-btn {
  margin-left: auto; padding: 3px 10px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 4px; color: var(--cyan);
  font-size: 11px; cursor: pointer;
}
.stats-csv-btn:hover { border-color: var(--cyan); }

/* ── Draw banner ── */
.draw-banner.hidden { display: none; }
.draw-banner {
  position: fixed; top: 68px; left: 50%; transform: translateX(-50%);
  z-index: 95; background: rgba(0,212,255,0.12); border: 1px solid var(--cyan);
  border-radius: 6px; padding: 8px 16px; font-size: 13px; color: var(--cyan);
  white-space: nowrap;
}
.draw-finish-btn {
  margin-left: 10px; padding: 3px 10px; background: rgba(0,212,255,0.18);
  border: 1px solid var(--cyan); border-radius: 4px; color: var(--cyan);
  font-size: 12px; cursor: pointer; font-weight: 600;
}
.draw-finish-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.draw-finish-btn:not(:disabled):hover { background: rgba(0,212,255,0.3); }
.draw-cancel-btn {
  margin-left: 12px; padding: 2px 8px; background: none;
  border: 1px solid var(--cyan); border-radius: 4px; color: var(--cyan);
  font-size: 12px; cursor: pointer;
}
.draw-cancel-btn:hover { background: rgba(0,212,255,0.15); }

/* ── Filter panel ── */
.filter-panel {
  position: fixed; top: 68px; right: 8px; z-index: 95;
  width: min(260px, calc(100vw - 16px));
  box-sizing: border-box;
  background: rgba(17,17,21,0.97); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px 14px; backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
body.light-mode .filter-panel { background: rgba(255,255,255,0.97); }
.filter-panel.hidden { display: none; }

.filter-group { margin-bottom: 14px; }
.filter-group > label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px;
}
.filter-group > label .range-val {
  font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0;
}
.range-row {
  display: flex; flex-direction: column; gap: 4px;
}
.range-row .slider-line {
  display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted);
}
.range-row .slider-line span { width: 42px; text-align: right; flex-shrink: 0; }
.range-row .slider-line span:last-child { text-align: left; }
.range-row input[type=range] {
  flex: 1; min-width: 0; accent-color: var(--accent); cursor: pointer;
}
.filter-actions { display: flex; gap: 8px; margin-top: 4px; }
.filter-btn {
  flex: 1; padding: 7px; border-radius: 5px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3); color: var(--text);
}
.filter-btn.primary { background: rgba(245,158,11,0.15); border-color: var(--accent); color: var(--accent); }
.filter-btn:hover { border-color: var(--accent); }
.filter-count { margin-top: 8px; font-size: 11px; color: var(--muted); text-align: center; }

/* ── Symbology switcher ── */
.sym-group { display: flex; flex-wrap: wrap; gap: 4px; }
.sym-btn {
  padding: 4px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--border); color: var(--muted);
  transition: all 0.15s;
}
.sym-btn:hover { color: var(--text); border-color: var(--muted); }
.sym-btn.active { background: rgba(245,158,11,0.15); border-color: var(--accent); color: var(--accent); }

/* ── Color ramp swatches ── */
.ramp-group { display: flex; flex-direction: column; gap: 4px; }
.ramp-swatch {
  width: 100%; height: 24px; border-radius: 4px; cursor: pointer;
  border: 2px solid transparent; color: transparent; font-size: 0;
  transition: border-color 0.15s, transform 0.1s;
}
.ramp-swatch:hover  { border-color: rgba(255,255,255,0.4); transform: scaleY(1.15); }
.ramp-swatch.active { border-color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,0.3); }

/* ── Layers panel ── */
.layers-panel {
  position: fixed; top: 68px; right: 16px; z-index: 95;
  width: 240px;
  background: rgba(17,17,21,0.97);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.layers-panel.hidden { display: none; }

.layers-header {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.layers-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: 6px;
}

.layer-row { margin-bottom: 8px; }
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px; color: var(--text);
  user-select: none;
}
.toggle-label input[type="checkbox"] { display: none; }

/* Toggle switch */
.toggle-track {
  width: 32px; height: 18px; border-radius: 9px;
  background: var(--border); flex-shrink: 0;
  position: relative; transition: background 0.2s;
}
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s, background 0.2s;
}
input[type="checkbox"]:checked ~ .toggle-track { background: rgba(245,158,11,0.3); border: 1px solid var(--accent); }
input[type="checkbox"]:checked ~ .toggle-track .toggle-thumb { transform: translateX(14px); background: var(--accent); }

/* Layer color swatch */
.lyr-icon {
  width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

/* ── Legend ── */
.legend { margin-top: 4px; }
.legend-bar {
  height: 12px; border-radius: 4px;
  background: linear-gradient(to right, #1a1a20, #2a3a4a, #1a4a6a, #f59e0b);
  margin-bottom: 4px;
}
.legend-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--muted);
}
.legend-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); margin-bottom: 4px;
}
.swatch {
  width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0;
}

/* ── Utility ── */
.muted { color: var(--muted); }

/* ── Mobile ── */
@media (max-width: 768px) {
  :root { --panel-w: 100vw; }
  .panel { top: 60px; }

  #chat-panel {
    display: none !important;
    position: fixed; top: 60px; left: 0; bottom: 0;
    width: 100vw; z-index: 200;
  }
  #chat-panel.open {
    display: flex !important;
    width: 100vw; min-width: unset;
  }
  #chat-toggle {
    display: flex;
  }
}

@media (max-width: 600px) {
  :root { --panel-w: 100vw; }
}

/* ── Pro Badge ── */
.pro-badge.hidden { display: none; }
.pro-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #f59e0b; color: #1a1a20; font-size: 10px; font-weight: 800;
  letter-spacing: 0.08em; padding: 3px 7px; border-radius: 4px;
  cursor: default; user-select: none; height: 24px; margin-left: 4px;
}
.light .pro-badge { background: #d97706; color: #fff; }
.pro-badge.hidden { display: none; }

/* ── Paywall Backdrop / Modal ── */
.paywall-backdrop.hidden { display: none; }
.paywall-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.paywall-modal {
  background: var(--surface, #1e1e2e); border: 1px solid var(--border, #2d2d3d);
  border-radius: 16px; padding: 32px 28px; max-width: 420px; width: 100%;
  position: relative; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.paywall-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--muted, #888); line-height: 1;
}
.paywall-close:hover { color: var(--text, #fff); }
.paywall-icon { font-size: 40px; margin-bottom: 8px; }
.paywall-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--text, #fff); }
.paywall-desc { color: var(--muted, #aaa); font-size: 14px; margin: 0 0 16px; }
.paywall-features {
  list-style: none; padding: 0; margin: 0 0 20px;
  font-size: 14px; color: var(--text, #eee); text-align: left; display: inline-block;
}
.paywall-features li { padding: 4px 0; }
.paywall-cta {
  display: block; background: #f59e0b; color: #1a1a20; font-weight: 700;
  font-size: 16px; padding: 12px 24px; border-radius: 8px; text-decoration: none;
  margin-bottom: 20px; transition: background 0.15s;
}
.paywall-cta:hover { background: #d97706; }
.paywall-restore { border-top: 1px solid var(--border, #2d2d3d); padding-top: 16px; font-size: 13px; }
.paywall-restore p { color: var(--muted, #aaa); margin: 0 0 8px; }
.paywall-restore-row { display: flex; gap: 8px; }
.paywall-input {
  flex: 1; background: var(--bg, #12121a); border: 1px solid var(--border, #2d2d3d);
  color: var(--text, #fff); padding: 8px 12px; border-radius: 6px; font-size: 13px;
}
.paywall-restore-btn {
  background: var(--border, #2d2d3d); color: var(--text, #eee); border: none;
  padding: 8px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.paywall-restore-btn:hover { background: #3d3d5d; }
.paywall-error { color: #ef4444; margin: 8px 0 0; font-size: 12px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #1e1e2e; border: 1px solid #f59e0b; color: #f5f5f5;
  padding: 12px 20px; border-radius: 8px; font-size: 14px;
  z-index: 2000; opacity: 0; transition: opacity 0.3s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }

/* ── Nearby parcels tab ── */
.nearby-header {
  font-size: 12px; color: var(--muted, #aaa); text-transform: uppercase;
  letter-spacing: 0.06em; padding: 12px 16px 8px; border-bottom: 1px solid var(--border, #2d2d3d);
}
.nearby-list { padding: 0; }
.nearby-item {
  padding: 10px 16px; border-bottom: 1px solid var(--border, #2d2d3d);
  cursor: pointer; transition: background 0.12s;
}
.nearby-item:hover { background: rgba(245,158,11,0.07); }
.nearby-addr { font-size: 13px; font-weight: 600; color: var(--text, #fff); margin-bottom: 3px; }
.nearby-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted, #aaa); margin-bottom: 3px; }
.nearby-dist { color: #f59e0b; font-weight: 600; }
.nearby-vals { font-size: 12px; color: var(--text, #fff); display: flex; gap: 8px; align-items: center; }
.nearby-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--muted, #aaa); }
