/* Market Explorer — Modern drill-down market data page */

:root {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --info-light: #ecfeff;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --transition: 0.2s ease;

  /* Tier badge colours */
  --tier-a: #16a34a;
  --tier-a-bg: #dcfce7;
  --tier-b: #2563eb;
  --tier-b-bg: #dbeafe;
  --tier-c: #d97706;
  --tier-c-bg: #fef3c7;
  --tier-d: #dc2626;
  --tier-d-bg: #fee2e2;
  --tier-f: #7c3aed;
  --tier-f-bg: #ede9fe;
  --tier-none: #64748b;
  --tier-none-bg: #f1f5f9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 0.875rem;
  white-space: nowrap;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Legal disclaimer (tiers/scores not investment advice) ───────────────── */
.market-explorer-disclaimer {
  padding: 0.65rem 1rem;
  background: var(--warning-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.market-explorer-disclaimer strong { color: var(--warning); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
  transition: color var(--transition);
  background: none;
  border: none;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0;
}
.breadcrumb-item:hover { color: var(--primary-dark); text-decoration: underline; }
.breadcrumb-item.current {
  color: var(--text);
  font-weight: 600;
  cursor: default;
}
.breadcrumb-item.current:hover { text-decoration: none; }

.breadcrumb-sep { color: var(--text-light); user-select: none; }

/* ── Level header ────────────────────────────────────────────────────────── */
.level-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.level-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.level-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  font-family: inherit;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.35rem;
}

/* ── Data freshness badge ────────────────────────────────────────────────── */
.data-as-of {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  background: var(--info-light);
  color: var(--info);
  border: 1px solid rgba(8, 145, 178, 0.2);
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── Time-filter buttons ─────────────────────────────────────────────────── */
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.time-filter-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.775rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.time-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.time-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ── Charts ──────────────────────────────────────────────────────────────── */
.charts-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chart-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light), var(--shadow-sm);
}

.chart-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  user-select: none;
}

/* ── Chart expand modal ───────────────────────────────────────────────────── */
#chartModal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  animation: modalFadeIn 0.15s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.chart-modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 96vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.18s ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(16px); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1; }
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chart-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.chart-modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.chart-modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.chart-modal-body {
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
  min-height: 0;
}

.chart-modal-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#chartModalCanvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  #chartModal { padding: 0.5rem; }
  .chart-modal-box { width: 100vw; height: 100vh; border-radius: 0; }
}

.chart-canvas-wrap {
  position: relative;
  height: 220px;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  color: var(--text-light);
  font-size: 0.8125rem;
}

/* ── Wholesaling laws table ──────────────────────────────────────────────── */
.laws-disclaimer {
  padding: 0.875rem 1.25rem;
  background: var(--warning-light);
  border-bottom: 1px solid var(--border);
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.laws-disclaimer strong { color: var(--warning); }
.laws-disclaimer a { color: var(--primary); }

.laws-table th { white-space: nowrap; }
.laws-table td { font-size: 0.775rem; vertical-align: top; max-width: 200px; }

.law-ok   { color: var(--success); font-weight: 500; }
.law-warn { color: var(--warning); font-weight: 500; }
.law-bad  { color: var(--danger);  font-weight: 500; }

/* ── Table card ──────────────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.table-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--bg);
  width: 200px;
  transition: all var(--transition);
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  gap: 0;
  background: var(--bg);
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--primary); background: var(--primary-light); }
thead th.sort-asc::after  { content: ' ↑'; color: var(--primary); }
thead th.sort-desc::after { content: ' ↓'; color: var(--primary); }

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

tbody tr:hover { background: var(--primary-light); }

tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td:first-child { color: var(--primary); }

td {
  padding: 0.7rem 0.875rem;
  color: var(--text);
  vertical-align: middle;
}

td.cell-name {
  font-weight: 600;
  color: var(--text);
}

.drill-arrow {
  color: var(--text-light);
  font-size: 0.75rem;
  margin-left: 0.375rem;
}
tr.clickable:hover .drill-arrow { color: var(--primary); }

/* ── Tier badge ──────────────────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}

.tier-A { background: var(--tier-a-bg); color: var(--tier-a); }
.tier-B { background: var(--tier-b-bg); color: var(--tier-b); }
.tier-C { background: var(--tier-c-bg); color: var(--tier-c); }
.tier-D { background: var(--tier-d-bg); color: var(--tier-d); }
.tier-F { background: var(--tier-f-bg); color: var(--tier-f); }
.tier-  { background: var(--tier-none-bg); color: var(--tier-none); }

/* ── Numeric cells ───────────────────────────────────────────────────────── */
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

.dom-hot    { color: var(--success); font-weight: 600; }  /* ≤40  green */
.dom-normal { color: var(--info);    font-weight: 600; }  /* ≤75  teal  */
.dom-slow   { color: var(--warning); font-weight: 600; }  /* ≤110 amber */
.dom-cold   { color: var(--danger);  font-weight: 600; }  /* 111+ red   */

.val-na  { color: var(--text-light); font-style: italic; }
.chg-up  { color: #16a34a; font-weight: 600; }
.chg-down{ color: #dc2626; font-weight: 600; }

/* ── Score bar (county final_score) ─────────────────────────────────────── */
.score-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.score-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 80px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s ease;
}
.score-num { font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--text-muted); width: 26px; }

/* ── Loading / empty states ─────────────────────────────────────────────── */
.loading-row td,
.empty-row td {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Table count badge ───────────────────────────────────────────────────── */
.count-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Level transition ────────────────────────────────────────────────────── */
.level-panel {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.75rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-section { grid-template-columns: 1fr; }
  .chart-canvas-wrap { height: 220px; }
}

@media (max-width: 768px) {
  .page-wrapper { padding: 1rem; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .search-input { width: 150px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.25rem; }
}

/* ── Charts then Map stacked (full width each) ───────────────────────────── */
.me-content-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
  align-items: start;
}

/* Collapsible panel wrapper */
.me-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
  min-width: 0;
}

.me-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.me-panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.me-panel-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-light);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  line-height: 1;
}
.me-panel-toggle:hover { background: var(--bg); color: var(--text-muted); }

/* Metric selector bar — lives between the panel header and the map body */
.me-metric-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.me-metric-bar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}

.me-metric-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.me-metric-btn:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text);
  border-color: var(--text-light);
}
.me-metric-btn.active {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: var(--accent, #2563eb);
  font-weight: 600;
}

/* Also hide metric bar when panel is collapsed */
.me-panel.me-collapsed .me-metric-bar { display: none; }

.me-panel-body {
  overflow: hidden;
}

.me-panel.me-collapsed .me-panel-body {
  display: none;
}
.me-panel.me-collapsed .me-panel-header {
  border-bottom: none;
}

/* Charts inside the panel */
.me-charts-panel .me-panel-body {
  padding: 0;
}

/* Map container — taller when full width (stacked layout) */
.me-map-container {
  width: 100%;
  height: 520px;
  background: var(--bg);
  position: relative;
}

.me-map-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255,255,255,0.82);
  z-index: 2;
  border-radius: 0 0 var(--radius) var(--radius);
}

.me-map-status-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light, #666);
  letter-spacing: 0.01em;
}

/* DOM map markers */
.dom-marker {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  border: 2px solid rgba(255,255,255,0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.2;
}
.dom-marker:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 10px rgba(0,0,0,0.28);
}

.dom-marker:hover {
  z-index: 9999 !important;
}
/* 4-band DOM scale: hot → normal → slow → cold */
.dom-marker-hot    { background: #16a34a; border-color: rgba(255,255,255,0.5); } /* ≤40  green  */
.dom-marker-normal { background: #0891b2; border-color: rgba(255,255,255,0.5); } /* ≤75  teal   */
.dom-marker-slow   { background: #d97706; border-color: rgba(255,255,255,0.5); } /* ≤110 amber  */
.dom-marker-cold   { background: #dc2626; border-color: rgba(255,255,255,0.5); } /* 111+ red    */
.dom-marker-na     { background: #94a3b8; border-color: rgba(255,255,255,0.5); } /* no data grey */
.dom-marker-premium{ background: #7c3aed; border-color: rgba(255,255,255,0.5); } /* price top Q  purple */

/* InfoWindow load-charts button */
.iw-load-btn {
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.iw-load-btn:hover { background: var(--primary-dark); }

/* InfoWindow content */
.iw-content {
  font-family: inherit;
  min-width: 150px;
}
.iw-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 4px;
}
.iw-row {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 2px 0;
}
.iw-row strong { color: var(--text); }

/* Map legend */
.me-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.875rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.me-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.me-legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Responsive: shorter map on small screens */
@media (max-width: 768px) {
  .me-map-container {
    height: 360px;
  }
}
