/* ══════════════════════════════════════════════════════
   MERCADOMAPA — Design System
   ══════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --brand-ocean:     #1652F0;
  --brand-lime:      #A3E635;
  --brand-lime-dark: #3D8B0E;

  /* Palette */
  --navy:        #0D2137;
  --navy-mid:    #1B3A5C;
  --primary:     #1652F0;
  --accent:      #FF6B2B;
  --success:     #16A34A;
  --success-bg:  #DCFCE7;
  --success-border: #BBF7D0;
  --warning:     #D97706;
  --warning-bg:  #FEF3C7;
  --danger:      #DC2626;
  --danger-bg:   #FEE2E2;
  --info:        #1652F0;
  --info-bg:     #EEF2FF;
  --bg:          #F1F5F9;
  --surface:     #FFFFFF;
  --border:      #E2E8F0;
  --border-dark: #CBD5E1;
  --text:        #1E293B;
  --text-muted:  #64748B;
  --text-light:  #94A3B8;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-xs:   5px;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.06);
  --shadow:      0 1px 3px rgba(0,0,0,.05), 0 3px 8px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --header-h:    56px;
  --filter-h:    56px;
}

/* ── Pulse animation ─────────────────────────────── */
@keyframes mm-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.15); }
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
select { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── Header ────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  height: var(--header-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}
.header-inner {
  width: 100%;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.brand {
  align-self: center;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 36px;
}
.brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.brand-name {
  color: #fff;
  font-family: 'Geist', 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.015em;
}

/* Nav */
.main-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 14px;
  border-radius: 0;
  color: rgba(255,255,255,.62);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  letter-spacing: 0;
  height: 100%;
  white-space: nowrap;
}
.nav-btn:hover  { color: rgba(255,255,255,.85); }
.nav-btn.active {
  color: #fff;
  font-weight: 500;
  border-bottom-color: var(--brand-lime);
}
.nav-btn svg { flex-shrink: 0; opacity: .7; }
.nav-btn.active svg { opacity: 1; }

/* Header meta */
.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
}
.header-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-lime);
  box-shadow: 0 0 10px var(--brand-lime);
  flex-shrink: 0;
  animation: mm-pulse 2.4s ease-in-out infinite;
}
.header-meta-text {
  font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Layout ────────────────────────────────────────── */
.site-main { min-height: calc(100vh - var(--header-h)); }
.container  { width: 100%; margin: 0 auto; padding: 28px 32px; }

/* Tab panels */
.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 0;
  flex-wrap: wrap;
}
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-note {
  padding: 6px 24px 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── KPI Grid ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-label {
  font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-value {
  font-family: 'Geist', 'Inter', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0;
}
.kpi-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-lime);
  box-shadow: 0 0 10px var(--brand-lime);
  flex-shrink: 0;
  animation: mm-pulse 2.4s ease-in-out infinite;
}
.kpi-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  cursor: default;
  vertical-align: middle;
  position: relative;
  line-height: 1;
}

/* ── Charts ────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card { padding-bottom: 20px; }
.chart-wrap { padding: 16px 20px 4px; height: 280px; position: relative; overflow: visible; }
.chart-wrap--donut { height: 200px; }

/* Source ranked list */
.source-list {
  padding: 4px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.source-row:last-child { border-bottom: none; }
.source-row--clickable {
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 4px;
  padding-left: 4px;
  margin: 0 -4px;
}
.source-row--clickable:hover { background: var(--bg); }
.source-row--active {
  background: var(--info-bg);
  border-left: 3px solid var(--primary);
  padding-left: 5px;
}
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-name--muted { color: var(--text-muted); font-weight: 400; }
.source-bar-track {
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.source-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
}
.source-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  min-width: 36px;
}
.source-pct {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  min-width: 30px;
}

/* Chart header controls */
.chart-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Dashboard filter bar — Airbnb style ───────────── */
.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 48px;
  padding: 8px 12px;
  width: fit-content;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.dash-drop-sep {
  width: 1px;
  height: 20px;
  background: #d4d4d4;
  margin: 0 4px;
}

/* Dropdown trigger button — Airbnb */
.dash-drop { position: relative; }
.dash-drop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1.5px solid #b0b0b0;
  border-radius: 999px;
  background: #fff;
  color: #222;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, box-shadow .15s;
}
.dash-drop-btn:hover { border-color: #222; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.dash-drop.active .dash-drop-btn {
  border-color: #222;
  background: #fff;
  color: #222;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.dash-drop-badge {
  background: #222;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

/* Dropdown panel — Airbnb */
.dash-drop-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  z-index: 200;
  overflow: hidden;
}
.dash-drop.open .dash-drop-panel { display: block; }
.dash-drop-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #ebebeb;
  color: #717171;
}
.dash-drop-search {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  font-family: inherit;
  color: #222;
}
.dash-drop-search::placeholder { color: #b0b0b0; }
.dash-drop-search-row:focus-within { border-color: #222; }
.dash-drop-hint {
  padding: 6px 14px 8px;
  font-size: 11px;
  color: #b0b0b0;
  font-style: italic;
}
.dash-drop-list {
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}
/* Reuse barrio-item checkbox style */
.dash-drop-list .barrio-item { font-size: 13px; }
.dash-drop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid #ebebeb;
}
.dash-drop-clear {
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: #717171;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: color .15s;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dash-drop-clear:hover { color: #222; }
.dash-drop-done {
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  background: #222;
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 8px;
  transition: background .15s;
}
.dash-drop-done:hover { background: #000; }

/* Barrio picker dropdown (legacy — no longer used in DOM) */
.barrio-picker { position: relative; }

.barrio-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.barrio-picker-btn:hover {
  border-color: var(--border-dark);
  color: var(--text);
}
.barrio-picker-btn.has-active {
  border-color: var(--primary);
  background: #EFF6FF;
  color: var(--primary);
}
.barrio-picker-chevron { transition: transform .2s; flex-shrink: 0; }
.barrio-picker.open .barrio-picker-chevron { transform: rotate(180deg); }

.barrio-picker-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}
.barrio-picker.open .barrio-picker-panel { display: block; }

.barrio-picker-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-light);
}
.barrio-picker-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.barrio-picker-search-input::placeholder { color: var(--text-light); }

.barrio-picker-list {
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}

/* Reuse zlc-row pattern for barrio items */
.barrio-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-left: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
  font-size: 13.5px;
  color: #222;
  position: relative;
}
.barrio-item::after {
  content: '';
  width: 18px;
  height: 18px;
  margin-left: auto;
  flex-shrink: 0;
  border: 1.5px solid #b0b0b0;
  border-radius: 4px;
  background: #fff;
  transition: background .12s, border-color .12s;
}
.barrio-item:hover { background: #f7f7f7; }
.barrio-item:hover::after { border-color: #222; }
.barrio-item.selected {
  background: #f7f7f7;
  border-left-color: #222;
  color: #222;
  font-weight: 600;
}
.barrio-item.selected::after {
  background: #222;
  border-color: #222;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolyline points='2,6 5,9 10,3' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}
.barrio-picker-list.has-active .barrio-item:not(.selected) { opacity: .45; }
.barrio-picker-list.has-active .barrio-item:not(.selected):hover { opacity: .85; }

.barrio-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.barrio-picker-footer button {
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: none;
  transition: all .15s;
}
#barrio-picker-clear {
  color: var(--text-muted);
  background: transparent;
}
#barrio-picker-clear:hover { color: var(--danger); }
.barrio-picker-done {
  background: var(--primary);
  color: #fff;
}
.barrio-picker-done:hover { background: var(--navy-mid); }

/* Toggle group */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-xs);
  padding: 3px;
  gap: 2px;
}
.toggle-btn {
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .15s;
}
.toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── Table ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; padding: 12px 0 4px; }
.data-table { font-size: 13px; }
.data-table th {
  padding: 8px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th.num { text-align: right; }
.sort-th {
  cursor: pointer;
  user-select: none;
  transition: color .15s, background .15s;
}
.sort-th:hover { color: var(--brand-ocean); background: var(--info-bg); }
.sort-th.sort-active { color: var(--brand-ocean); }
.sort-icon {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  vertical-align: -1px;
  opacity: .55;
  margin-left: 6px;
  transition: opacity .15s;
}
.sort-th:hover .sort-icon { opacity: .85; }
.sort-th.sort-active .sort-icon { opacity: 1; }
.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--bg); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 40px 16px; font-size: 14px; }

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge--green  { background: var(--success-bg);  color: var(--success); }
.badge--red    { background: var(--danger-bg);   color: var(--danger); }
.badge--amber  { background: var(--warning-bg);  color: var(--warning); }
.badge--blue   { background: var(--info-bg);     color: var(--info); }
.badge--gray   { background: #F1F5F9;            color: var(--text-muted); }
.badge--navy   { background: rgba(13,33,55,.08); color: var(--navy); }

.tipo-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tipo-badge--Casa    { background: #FFF0E8; color: #C45213; }
.tipo-badge--Terreno { background: #F0FDF4; color: #166534; }

.inmob-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.inmob-badge--Remax        { background: #FEE2E2; color: #9B1C1C; }
.inmob-badge--Century21    { background: #FFFBEB; color: #92400E; }
.inmob-badge--MercadoLibre { background: #FFF9C2; color: #78400C; }
.inmob-badge--ZonaProp     { background: #EDE9FE; color: #4C1D95; }

/* ── Filter Bar — Airbnb style ─────────────────────── */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.filter-bar-inner {
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filter-bar-inner::-webkit-scrollbar { display: none; }

/* ── Chip base (selects + toggle labels) — estilo Airbnb */
.fc-select,
.fc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1.5px solid #b0b0b0;
  border-radius: 999px;
  background: #fff;
  color: #222;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
  user-select: none;
}
.fc-select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.fc-select:focus { outline: none; border-color: #222; box-shadow: 0 0 0 2px rgba(0,0,0,.12); }
.fc-select:hover,
.fc-toggle:hover {
  border-color: #222;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

/* Active chip — Airbnb: borde negro + sombra, sin relleno de color */
.fc-select.is-active {
  border-color: #222;
  background: #fff;
  color: #222;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.fc-toggle.is-active {
  border-color: #222;
  background: #fff;
  color: #222;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.fc-toggle input[type="checkbox"] { display: none; }
.fc-toggle-icon { display: inline-flex; align-items: center; opacity: .75; }
.fc-toggle.is-active .fc-toggle-icon { opacity: 1; }

/* Separator */
.fc-sep {
  flex-shrink: 0;
  width: 1px;
  height: 20px;
  background: #d4d4d4;
  margin: 0 6px;
}

/* ── Inline price range chip — Airbnb style */
.fc-price-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 14px 0 14px;
  border: 1.5px solid #b0b0b0;
  border-radius: 999px;
  background: #fff;
  flex-shrink: 0;
  transition: border-color .15s, box-shadow .15s;
}
.fc-price-range:hover { border-color: #222; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.fc-price-range:focus-within {
  border-color: #222;
  box-shadow: 0 0 0 2px rgba(0,0,0,.12);
  outline: none;
}
.fc-price-range.is-active {
  border-color: #222;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.fc-price-label {
  font-size: 11px;
  font-weight: 600;
  color: #717171;
  letter-spacing: .03em;
  flex-shrink: 0;
  user-select: none;
}
.fc-price-range.is-active .fc-price-label { color: #222; }
.fc-price-input {
  width: 64px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: #222;
  font-family: inherit;
  text-align: right;
  padding: 0;
  min-width: 0;
}
.fc-price-input::placeholder { color: #b0b0b0; font-weight: 400; }
.fc-price-range.is-active .fc-price-input { color: #222; }
.fc-price-input.is-invalid { color: var(--danger) !important; }
.fc-price-sep {
  font-size: 12px;
  color: #b0b0b0;
  flex-shrink: 0;
  user-select: none;
}

/* Signal toggles — Airbnb style overrides */
.fc-toggle {
  background: #fff;
}
#lbl-oport .fc-toggle-icon { color: #f59e0b; }
#lbl-bajas .fc-toggle-icon { color: var(--danger); }
#lbl-oport.is-active .fc-toggle-icon { color: #f59e0b; opacity: 1; }
#lbl-bajas.is-active .fc-toggle-icon { color: var(--danger); opacity: 1; }

/* Clear button — Airbnb style: subtle underline text */
.btn-clear {
  display: none;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid #b0b0b0;
  border-radius: 999px;
  background: #fff;
  color: #717171;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, color .15s, box-shadow .15s;
}
.btn-clear:hover { border-color: #222; color: #222; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.btn-clear.visible { display: inline-flex; }

/* Sort select (reused in results bar, keeps old sizing) */
.filter-select {
  padding: 6px 26px 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.filter-select--sm { font-size: 12px; padding: 5px 26px 5px 10px; }

/* ── Results bar ───────────────────────────────────── */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.results-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sort-label { font-size: 13px; color: var(--text-muted); }
.sort-dir-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.sort-dir-btn:hover { border-color: var(--border-dark); color: var(--text); }

/* ── Cards Grid ────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* Property card */
.prop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.prop-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.prop-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  gap: 8px;
  flex-wrap: wrap;
}
.card-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-baja-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}
.prop-price {
  padding: 10px 16px 2px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.prop-price-sub {
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.prop-address {
  padding: 0 16px 4px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prop-barrio {
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.prop-divider { height: 1px; background: var(--border); margin: 0 16px; }
.prop-specs {
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.spec-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.spec-val  { font-size: 13px; font-weight: 600; color: var(--text); }
.spec-lbl  { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: .04em; }
.prop-footer {
  padding: 10px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.prop-signals { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.signal-dias {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: background .15s;
  white-space: nowrap;
}
.btn-link:hover     { background: var(--navy-mid); }
.btn-link--disabled { background: var(--border); color: var(--text-muted); cursor: default; }

/* ── Pagination ────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0 40px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all .15s;
}
.page-btn:hover   { border-color: var(--border-dark); color: var(--text); }
.page-btn.active  { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-ellipsis { color: var(--text-muted); font-size: 14px; padding: 0 4px; }

/* ── Barrios Table ─────────────────────────────────── */
.bar-vis {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.bar-fill {
  height: 6px;
  border-radius: 3px;
  background: var(--primary);
  transition: width .3s;
}
.bar-pct { font-size: 11px; color: var(--text-muted); }

/* ── Crecimiento urbano ────────────────────────────── */
.crec-card { margin-top: 20px; }
.crec-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 132px;
  height: 22px;
}
.crec-bar-fill {
  position: absolute;
  left: 0;
  height: 6px;
  border-radius: 3px;
  background: var(--primary);
  opacity: .8;
}
.crec-bar span {
  position: relative;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: var(--surface);
  padding-left: 6px;
}

/* ── Map ───────────────────────────────────────────── */
.map-layout {
  display: flex;
  height: calc(100vh - var(--header-h));
}
.map-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.map-container { flex: 1; }

/* ── Home / reset button ──────────────────────────── */
.map-home-btn {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 8px !important;
  height: 30px;
  background: var(--surface);
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
  transition: background .15s, color .15s;
}
.map-home-btn:hover {
  background: var(--navy-mid);
  color: #fff;
}
.map-home-btn:hover svg { stroke: #fff; }
.map-home-btn svg { flex-shrink: 0; transition: stroke .15s; }
.map-legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.map-count {
  margin-top: auto;
  padding-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Map popup ─────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: 'Inter', sans-serif !important;
}
.leaflet-popup-content { margin: 0 !important; }
.map-popup {
  padding: 14px 16px;
  min-width: 220px;
  max-width: 280px;
}
.map-popup-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.map-popup-price  { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.map-popup-dir    { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.map-popup-specs  { display: flex; gap: 12px; margin-bottom: 10px; }
.map-popup-spec   { font-size: 11px; }
.map-popup-spec b { display: block; font-size: 13px; font-weight: 600; }
.map-popup-link {
  display: block;
  text-align: center;
  padding: 6px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
}
.map-popup-link:hover { background: var(--navy-mid); }

/* Zona badge inline en popup */
.zona-inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  letter-spacing: .02em;
}

/* Bloque potencial edificable */
.map-popup-dev {
  margin: 8px 0 10px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.mpd-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #166534;
  margin-bottom: 8px;
}
.mpd-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.mpd-kpi {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mpd-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.mpd-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #4B7257;
}

.mpd-compare {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #BBF7D0;
  font-size: 10.5px;
  color: #4B7257;
}

/* Normativa + potencial edificable en tarjetas de Explorar */
.prop-dev {
  margin: 0 16px 4px;
  padding: 9px 10px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prop-dev-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.prop-dev-meta {
  font-size: 11px;
  font-weight: 600;
  color: #4B7257;
  font-variant-numeric: tabular-nums;
}
.prop-dev-main {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.prop-dev-main b { color: var(--text); font-weight: 800; }
.prop-dev-cmp { display: flex; }

/* ── Tooltip (JS-powered DOM element) ───────────────── */
[data-tip] { cursor: default; }
#mm-tooltip {
  position: fixed;
  z-index: 9000;
  background: #1E293B;
  color: #F1F5F9;
  font-family: 'Geist', 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  padding: 7px 11px;
  border-radius: 6px;
  max-width: 240px;
  box-shadow: 0 4px 14px rgba(0,0,0,.22), 0 1px 4px rgba(0,0,0,.14);
  pointer-events: none;
  white-space: normal;
  opacity: 0;
  transition: opacity .12s ease;
}
#mm-tooltip.visible { opacity: 1; }

/* ── No data state ─────────────────────────────────── */
.no-data-banner {
  max-width: 560px;
  margin: 80px auto;
  text-align: center;
  padding: 48px 32px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.no-data-banner h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.no-data-banner p  { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.no-data-banner code {
  display: inline-block;
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--navy);
  font-family: 'Courier New', monospace;
}

/* ── Hamburger toggle ───────────────────────────────── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: rgba(255,255,255,.8);
  flex-shrink: 0;
  transition: background .15s;
  margin-left: 8px;
}
.nav-toggle:hover { background: rgba(255,255,255,.1); }

/* ── Wide desktop (1800px+) ─────────────────────────── */
@media (min-width: 1800px) {
  .container { padding: 32px 40px; }
  .header-inner { padding: 0 32px; }
  .charts-row { grid-template-columns: 1fr 420px; gap: 24px; }
  .kpi-grid { gap: 20px; }
  .chart-wrap { height: 320px; }
}

/* ── Small desktop / tablet landscape (≤1100px) ─────── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .chart-card--sm { order: -1; }
}

/* ── Header spacing (≤900px) ────────────────────────── */
@media (max-width: 900px) {
  .brand { margin-right: 16px; }
  .nav-btn { padding: 4px 10px; font-size: 12.5px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Seis pestañas: entre tablet y desktop angosto no entran con íconos y fecha */
@media (min-width: 769px) and (max-width: 1060px) {
  .nav-btn svg { display: none; }
  .nav-btn { padding: 4px 9px; }
  .header-meta { display: none; }
}

/* ── Tablet portrait (≤768px) ───────────────────────── */
@media (max-width: 768px) {
  /* Hamburger */
  .nav-toggle { display: flex; }
  .header-meta { display: none; }
  .header-inner { padding: 0 16px; gap: 8px; }
  .brand { margin-right: 0; }

  /* Mobile nav dropdown */
  .main-nav {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: #0D2137;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 0 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    z-index: 99;
  }
  .main-nav.nav--open { display: flex; }
  .nav-btn {
    height: 48px;
    padding: 0 24px;
    border-bottom: none !important;
    border-left: 3px solid transparent;
    border-radius: 0;
    font-size: 14px;
    width: 100%;
    justify-content: flex-start;
  }
  .nav-btn:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.9); }
  .nav-btn.active {
    border-left-color: var(--brand-lime);
    background: rgba(255,255,255,.04);
    color: #fff;
  }

  /* Layout */
  .container { padding: 16px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .kpi-card { padding: 16px; gap: 4px; }
  .kpi-value { font-size: 26px; }
  .charts-row { gap: 12px; margin-bottom: 16px; }
  .chart-wrap { height: 220px; }

  /* Filter bars */
  .dash-filter-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .dash-drop-panel { min-width: 180px; max-width: calc(100vw - 32px); }
  .filter-bar-inner { padding: 8px 16px; }

  /* Map */
  .map-sidebar { width: 200px; }

  /* Tables */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 7px 12px; }
}

/* ── Mobile (≤520px) ────────────────────────────────── */
@media (max-width: 520px) {
  .container { padding: 12px 12px; }

  /* KPIs */
  .kpi-grid { grid-template-columns: 1fr; gap: 8px; }
  .kpi-card { padding: 14px 16px; }
  .kpi-value { font-size: 28px; }

  /* Charts */
  .chart-wrap { height: 180px; }
  .charts-row { gap: 8px; }

  /* Cards grid */
  .cards-grid { grid-template-columns: 1fr; }

  /* Map — stacked, sidebar scrollable */
  .map-layout { flex-direction: column; height: auto; }
  .map-container { height: 52vh; min-height: 240px; }
  .map-sidebar {
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border);
    flex-direction: column;
    max-height: 40vh;
    overflow-y: auto;
  }

  /* Tables */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 10px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Opportunities */
  .oport-head { padding: 12px 14px 10px; }
  .oport-head__title-row { flex-wrap: wrap; gap: 6px; }
  .oport-controls { gap: 4px; }

  /* Filter bars */
  .filter-bar-inner { padding: 8px 12px; }
  .dash-filter-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* range fields stacked en mobile */
  .range-row { flex-direction: column; gap: 4px; }
  .range-sep { display: none; }

  /* Modals / panels */
  .dash-drop-panel { max-width: calc(100vw - 24px); left: 0; right: 0; margin: 0 12px; }
}

/* ── Small phone (≤380px) ───────────────────────────── */
@media (max-width: 380px) {
  .container { padding: 10px 10px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 24px; }
  .brand-name { font-size: 14px; }
  .kpi-grid { gap: 6px; }
}

/* ── Oportunidades: header ──────────────────────────── */
.oport-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.oport-head__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.oport-head__title-row h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.oport-count-pill {
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: 6px;
  padding: 1px 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}
.oport-count-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}
.oport-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.oport-controls__text {
  font-size: 12px;
  color: var(--text-muted);
}
.oport-controls__sep {
  color: var(--text-light);
  font-size: 13px;
  margin: 0 2px;
}

/* ── Oportunidades: segmented control Top % ─────────── */
.oport-top-seg {
  display: inline-flex;
  background: #f2f2f2;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.oport-top-btn {
  padding: 4px 13px;
  font-size: 12px;
  font-weight: 500;
  color: #717171;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
  line-height: 1.5;
  white-space: nowrap;
  font-family: inherit;
}
.oport-top-btn:hover:not(.active) {
  color: #222;
  background: rgba(0,0,0,.05);
}
.oport-top-btn.active {
  background: #fff;
  color: #222;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.13), 0 0 0 0.5px rgba(0,0,0,.05);
}


.oport-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}
.oport-chip:hover {
  border-color: var(--border-dark);
  color: var(--text);
}
.oport-chip.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  font-weight: 600;
}
.oport-chip--baja.active {
  background: var(--success);
  border-color: var(--success);
}

.oport-baja-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Map Sidebar — Airbnb style ─────────────────────── */
.map-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #ebebeb;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 0;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #222;
  padding: 14px 20px;
}
.sidebar-section-header svg { color: #717171; flex-shrink: 0; }
.sidebar-section-header .toggle-chevron { color: #717171; }

.sidebar-section-header--toggle {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
.sidebar-section-header--toggle:hover { color: #000; }
.sidebar-section-header--toggle .toggle-chevron {
  margin-left: auto;
  opacity: .6;
  transition: transform .2s ease, opacity .15s;
}
.sidebar-section-header--toggle:hover .toggle-chevron { opacity: 1; }
.sidebar-section-header--toggle.collapsed .toggle-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-body {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height .25s ease, opacity .2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  padding: 4px 20px 20px;
  border-top: 1px solid #ebebeb;
}
.sidebar-section-body.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  padding-top: 0;
  padding-bottom: 0;
  border-top: none;
}

.price-legend {
  overflow: hidden;
  max-height: 300px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.price-legend.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-select {
  width: 100%;
  font-size: 13.5px;
  padding: 10px 32px 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #b0b0b0;
  background-color: #fff;
  color: #222;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23222' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-family: inherit;
  cursor: pointer;
}
.sidebar-select:hover  { border-color: #222; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.sidebar-select:focus  { outline: none; border-color: #222; box-shadow: 0 0 0 2px rgba(0,0,0,.1); }

/* Toggle row — Airbnb style */
.sidebar-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
}
.sidebar-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #222;
  font-weight: 500;
  user-select: none;
}
.sidebar-toggle-label svg { opacity: .5; }

/* Toggle switch — iOS style Airbnb */
.sidebar-toggle-switch { position: relative; flex-shrink: 0; }
.sidebar-toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sidebar-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #b0b0b0;
  position: relative;
  transition: background .2s;
  cursor: pointer;
}
.sidebar-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  transition: transform .2s;
}
.sidebar-toggle-switch input:checked + .sidebar-toggle-track {
  background: #222;
}
.sidebar-toggle-switch input:checked + .sidebar-toggle-track::after {
  transform: translateX(18px);
}

/* Zona legend grid */
.zona-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 2px;
}
.zona-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}
.zona-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  opacity: .85;
}

/* Price legend */
.price-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}
.price-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.price-legend-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.price-legend-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Price legend toggle states */
.price-legend-item {
  width: 100%;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 6px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, opacity .15s;
  margin: 0 -6px;
  width: calc(100% + 12px);
}
.price-legend-item:hover { background: var(--bg); }
.pli-text { flex: 1; min-width: 0; }

.pli-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}
.price-legend-item:not(.active) .pli-count { opacity: .35; }

.price-legend-item:not(.active) {
  opacity: .55;
}
.price-legend-item:not(.active) .price-legend-dot {
  background: var(--border-dark) !important;
}
.price-legend-item:not(.active) .price-legend-label {
  text-decoration: line-through;
  color: var(--text-muted);
}
/* iOS-style toggle — Airbnb */
.pli-toggle {
  flex-shrink: 0;
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #b0b0b0;
  transition: background .2s;
}
.pli-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.price-legend-item.active .pli-toggle {
  background: #222;
}
.price-legend-item.active .pli-toggle::after {
  transform: translateX(14px);
}

/* ── Oport pill — Airbnb style ──────────────────────── */
.sidebar-oport-strip {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* full-width equal-columns override for sidebar */
.sidebar-oport-seg {
  width: 100%;
  box-sizing: border-box;
  transition: opacity .2s;
}
.sidebar-oport-seg.is-disabled {
  opacity: .35;
  pointer-events: none;
}
.sidebar-oport-seg .oport-top-btn {
  flex: 1;
  text-align: center;
  padding: 6px 0;
}
/* dead rule kept for safety */
.sidebar-oport-top-label {
  display: none;
  font-size: 11px;
  font-weight: 500;
  color: #717171;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.oport-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid #BBF7D0;
  background: #F0FDF4;
  color: #15803D;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
  box-shadow: 0 1px 3px rgba(21,128,61,.08);
}
.oport-pill svg { color: #16A34A; flex-shrink: 0; transition: transform .2s; }
.oport-pill:hover {
  background: #DCFCE7;
  border-color: #86EFAC;
  box-shadow: 0 2px 8px rgba(21,128,61,.15);
}
.oport-pill:hover svg { transform: scale(1.15); }
.oport-pill.active {
  background: #16A34A;
  border-color: #15803D;
  color: #fff;
  box-shadow: 0 2px 10px rgba(21,128,61,.30);
}
.oport-pill.active svg { color: #fff; }
.oport-pill-count {
  margin-left: auto;
  background: rgba(255,255,255,.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  display: none;
  line-height: 1.4;
}
.oport-pill:not(.active) .oport-pill-count {
  display: block;
  background: #16A34A;
  color: #fff;
}
.oport-pill.active .oport-pill-count { display: block; }

/* ── Section active-filter badge ───────────────────── */
.section-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  display: none;
  line-height: 1.6;
  flex-shrink: 0;
}
.section-badge.visible { display: inline-block; }

/* ── Tooltip (ⓘ) ────────────────────────────────────── */
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dark);
  background: transparent;
  color: var(--text-muted);
  font-size: 0;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
  margin-left: 3px;
  user-select: none;
  transition: border-color .12s, color .12s;
}
.tip::before {
  content: 'i';
  font-size: 9px;
  font-style: italic;
  font-weight: 600;
  font-family: Georgia, 'Times New Roman', serif;
  color: inherit;
  line-height: 1;
}
.tip:hover { border-color: var(--primary); color: var(--primary); }

.map-result-pill {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #222;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  padding: 12px 24px;
  border-radius: 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .18s ease;
  opacity: 0;
}
.map-result-pill.visible {
  opacity: 1;
}
.map-result-pill.bump {
  animation: pill-bump .22s ease;
}
@keyframes pill-bump {
  0%   { transform: translateX(-50%) scale(1); }
  45%  { transform: translateX(-50%) scale(1.06); }
  100% { transform: translateX(-50%) scale(1); }
}

.map-count-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #ebebeb;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  z-index: 2;
}
.map-count-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.map-count-label {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}
.map-count-clear {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 5px;
  transition: background .12s, color .12s;
  cursor: pointer;
}
.map-count-clear:hover { background: var(--info-bg); }

/* ── Chip filter groups ─────────────────────────────── */
.filter-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  opacity: 0.7;
}

.filter-group-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.map-chip {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.map-chip:hover  { border-color: var(--border-dark); color: var(--text); }
.map-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }

/* ── Range inputs (min/max con unidad) ──────────────── */
.range-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-top: 2px;
}
.range-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.range-label {
  font-size: 10.5px;
  color: var(--text-muted, #888);
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
}
.range-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.range-input {
  width: 100%;
  padding: 5px 28px 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.range-input::-webkit-inner-spin-button,
.range-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.range-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.range-input--wide { padding-left: 36px; padding-right: 8px; }
.range-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent);
}
.range-unit {
  position: absolute;
  right: 7px;
  font-size: 10px;
  color: var(--text-muted, #aaa);
  pointer-events: none;
}
.range-unit--prefix { right: auto; left: 8px; }
.range-sep {
  font-size: 13px;
  color: var(--text-muted, #aaa);
  padding-bottom: 6px;
  flex-shrink: 0;
}
.range-hint {
  font-size: 10.5px;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
  line-height: 1.35;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.range-hint::before {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  transform: translateY(-2px);
}
.range-hint b {
  color: var(--text);
  font-weight: 600;
}
.range-hint--error {
  color: var(--danger);
  font-weight: 500;
}
.range-hint--error::before {
  background: var(--danger);
}

/* ── Zona popup ─────────────────────────────────────── */
.zona-popup { padding: 14px 16px; min-width: 210px; font-family: 'Inter', sans-serif; }
.zp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.zp-code {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}
.zp-area {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 99px;
}
.zp-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}
.zp-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.zp-kpi {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: default;
}
.zp-kpi-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.zp-kpi-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.zp-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  background: #FFF9C2;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  line-height: 1.5;
}

/* ── Zona list in sidebar ────────────────────────────── */
.zona-list-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 0 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  transition: color .15s;
  font-family: inherit;
}
.zona-list-header:hover { color: var(--text); }
.zona-list-header svg   { flex-shrink: 0; opacity: .5; }

.zona-list-body {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}

.zlc-group + .zlc-group { border-top: 1px solid var(--border); }

.zlc-group-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-light);
  padding: 7px 12px 4px;
}

.zlc-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-left: 2px solid transparent;
  transition: background .12s, opacity .12s;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.zlc-row::after {
  content: '';
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  border: 1.5px solid var(--border-dark);
  border-radius: 4px;
  background: var(--surface);
  transition: background .12s, border-color .12s;
}
.zlc-row:hover { background: var(--bg); }
.zlc-row:hover::after { border-color: var(--primary); }

.zlc-row--active {
  background: rgba(30,111,165,.08);
  border-left-color: var(--primary);
}
.zlc-row--active::after {
  background: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolyline points='2,6 5,9 10,3' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 10px;
}
.zlc-row--active .zlc-code { color: var(--primary); }
.zlc-row--active:hover { background: rgba(30,111,165,.13); }

/* Atenuar no-seleccionadas cuando hay selección activa */
.zlc-list--has-active .zlc-row:not(.zlc-row--active) {
  opacity: .45;
}
.zlc-list--has-active .zlc-row:not(.zlc-row--active):hover {
  opacity: .85;
}

.zlc-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

.zlc-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.zlc-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  transition: color .1s;
}

.zlc-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

.zlc-chevron {
  margin-left: auto;
  transition: transform .2s ease;
}

.zlc-hint {
  padding: 8px 12px 5px;
  font-size: 11px;
  color: var(--text-muted, #999);
  display: flex;
  align-items: center;
  gap: 5px;
}
.zlc-hint::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--border-dark, #ccc);
  border-radius: 3px;
  flex-shrink: 0;
}

.zlc-clear-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  background: rgba(30,111,165,.05);
  user-select: none;
  gap: 6px;
}
.zlc-clear-row:hover { background: rgba(30,111,165,.12); }

/* ── Tendencia overlay toggles ──────────────────────────── */
.tend-overlay {
  position: relative;
  opacity: .5;
  transition: opacity .15s, background .12s;
}
.tend-overlay.active {
  opacity: 1;
}
.tend-overlay:hover {
  background: color-mix(in srgb, var(--bg) 70%, transparent) !important;
}
.tend-overlay .tend-overlay-text {
  flex: 1;
}
.tend-overlay .tend-overlay-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #1e293b);
  line-height: 1.3;
  display: block;
}
.tend-overlay .tend-overlay-desc {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
  margin-top: 1px;
  display: block;
}
.tend-overlay .tend-toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
  margin-top: 6px;
  transition: background .15s;
}
.tend-overlay.active .tend-toggle-dot {
  background: currentColor;
}
/* Inactive: SVG icon desaturated */
.tend-overlay:not(.active) svg line,
.tend-overlay:not(.active) svg polygon,
.tend-overlay:not(.active) svg path {
  stroke: var(--text-light) !important;
  fill: var(--text-light) !important;
}

/* tend-delta KPI */
.tend-delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.tend-delta--up { color: var(--success); }
.tend-delta--dn { color: var(--danger); }

/* ── Oportunidades pagination ───────────────────────── */
.oport-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 20px 18px;
  flex-wrap: wrap;
}
.oport-page-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}
.oport-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  font-variant-numeric: tabular-nums;
}
.oport-page-btn:hover:not(.disabled) {
  background: var(--border);
  color: var(--text);
  border-color: var(--text-muted);
}
.oport-page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}
.oport-page-btn.disabled {
  opacity: .35;
  cursor: default;
}
.oport-page-ellipsis {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 2px;
  line-height: 32px;
}

/* ── Buscador del mapa (portado de Munimapa) ──────────── */
.bsc-wrap {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1000;
  width: 380px;
  max-width: calc(100% - 76px); /* deja lugar al zoom de la derecha */
  font-family: inherit;
}
.bsc-bar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px 0 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.bsc-bar:hover { box-shadow: var(--shadow-lg); }
.bsc-bar:focus-within { box-shadow: var(--shadow-lg); border-color: var(--primary); }
.bsc-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--text);
}
.bsc-input::placeholder { color: var(--text-light); }
.bsc-action {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: background .15s ease;
}
.bsc-action:hover { background: var(--bg); }
.bsc-action svg { width: 20px; height: 20px; }
.bsc-action[hidden] { display: none; }
.bsc-clear { color: var(--text-light); }
.bsc-clear svg { width: 16px; height: 16px; }
.bsc-mic.listening { color: var(--danger); animation: bsc-pulse 1s ease-in-out infinite; }
@keyframes bsc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.bsc-divider { width: 1px; height: 22px; margin: 0 8px 0 4px; background: var(--border); }
.bsc-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-muted); }

.bsc-results {
  display: none;
  margin-top: 8px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.bsc-results.open { display: block; }
.bsc-res {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.bsc-res:last-child { border-bottom: none; }
.bsc-res:hover, .bsc-res.active { background: #F8FAFC; }
.bsc-res-icon { width: 17px; height: 17px; margin-top: 2px; flex-shrink: 0; color: var(--text-muted); }
.bsc-res-text { flex: 1; min-width: 0; }
.bsc-res-tag {
  margin-bottom: 1px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-light);
}
.bsc-res-title { display: flex; align-items: center; gap: 6px; }
.bsc-res-sub {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bsc-zona-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.bsc-res--loading { color: var(--text-muted); font-style: italic; cursor: default; }
.bsc-res--empty { align-items: center; gap: 12px; cursor: default; }
.bsc-res--empty:hover { background: transparent; }
.bsc-empty-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger);
}
.bsc-empty-icon svg { width: 18px; height: 18px; }
.bsc-empty-title { font-weight: 600; }
.bsc-empty-hint { font-size: 12px; color: var(--text-muted); }
.bsc-empty-hint code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  font-size: 11px;
}

/* Pin del resultado */
.bsc-pin {
  width: 26px;
  height: 26px;
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(0,0,0,.3);
}

/* Ficha del punto buscado */
.bsc-ficha { display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.bsc-ficha-dir {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.bsc-ficha-dir .bsc-res-icon { width: 14px; height: 14px; margin-top: 1px; color: var(--accent); }
.bsc-mk {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #F8FAFC;
}
.bsc-mk--empty { font-size: 12px; color: var(--text-muted); }
.bsc-mk-title {
  margin-bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.bsc-mk-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bsc-mk-row b { color: var(--text); font-weight: 800; }
.bsc-mk-row span:last-child { min-width: 88px; text-align: right; color: var(--text); font-weight: 600; }

@media (max-width: 520px) {
  .bsc-wrap { top: 10px; left: 10px; }
  .bsc-bar { height: 44px; }
  .bsc-input { font-size: 16px; } /* evita el zoom automático de iOS */
}

/* ── Munimapa integrado (web/munimapa/) ───────────────── */
.munimapa-frame {
  display: block;
  width: 100%;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  border: 0;
  background: var(--bg);
}
.munimapa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--navy);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.munimapa-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* ── Usos del suelo (COUT, vía Munimapa) ─────────────── */
.uso-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.uso-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.uso--si  { background: rgba(22,163,74,.10);  color: #15803D; border-color: rgba(22,163,74,.25); }
.uso--cor { background: rgba(217,119,6,.10);  color: #B45309; border-color: rgba(217,119,6,.25); }
.uso--no  { background: rgba(100,116,139,.08); color: var(--text-light); border-color: var(--border); text-decoration: line-through; }
.prop-dev .uso-chips { margin: 0; }
.zp-extra {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.zp-extra b { color: var(--text); font-weight: 700; }
.zp-usos-title {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-light);
}
.senal-edif { margin-bottom: 20px; }
.senal-edif .uso-chips { margin: 4px 0 0; }

/* Subdivisión según el lote mínimo de la zona */
.subdiv-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 11.5px;
  color: #1E40AF;
}
.subdiv-line b { font-weight: 700; }
.subdiv-line svg { flex-shrink: 0; }

/* ── Capas de desarrollo (mapa) ────────────────────── */
.crec-legend { margin: 4px 0 10px; display: flex; flex-direction: column; gap: 4px; }
.crec-legend-row { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text); }
.crec-legend-sw { width: 14px; height: 10px; border-radius: 2px; border: 1px solid rgba(13,33,55,.15); }
.crec-legend-note { font-size: 10.5px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }
.crec-legend-n { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.empr-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(13,33,55,.15); }
.crec-tooltip {
  background: var(--navy); color: #fff; border: 0; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12px; min-width: 190px;
}
.crec-tooltip::before { display: none; }
.crec-tooltip strong { display: block; font-size: 13px; margin-bottom: 6px; }
.crec-tt-row { display: flex; justify-content: space-between; gap: 16px; color: rgba(255,255,255,.7); line-height: 1.7; }
.crec-tt-row b { color: #fff; font-variant-numeric: tabular-nums; }
.empr-popup .empr-foto { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-xs); margin-bottom: 8px; display: block; }
.empr-nombre { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.empr-dev { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ── Sidebar del mapa: riel de íconos que se despliega al pasar el mouse ── */
/* Íconos: set único (Lucide), 20px, trazo 1.75, dentro de un botón de 40×40 */
.rail-ico {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  color: var(--ico);
  transition: background .15s, color .15s;
}
.rail-ico svg { width: 20px; height: 20px; }

/* Colores de los íconos como variables: la misma familia sirve sobre blanco y sobre oscuro.
   Sobre oscuro los estados son translúcidos (nada de cajas pastel) y el punto lleva aro del fondo. */
.map-sidebar, .on-light {
  --ico: #3F3F46;          --ico-hover: #111;        --ico-hover-bg: #F2F2F2;
  --ico-open: var(--primary, #1652F0);                --ico-open-bg: #EEF3FF;
  --ico-oport: #16A34A;    --ico-oport-bg: #F0FDF4;  --ico-oport-hover-bg: #DCFCE7;
  --ico-oport-on: #16A34A; --ico-dot: var(--primary, #1652F0); --ico-ring: #fff;
}
.on-dark {
  --ico: #CBD5E1;          --ico-hover: #fff;        --ico-hover-bg: rgba(255, 255, 255, .08);
  --ico-open: #93C5FD;                               --ico-open-bg: rgba(96, 165, 250, .16);
  --ico-oport: #4ADE80;    --ico-oport-bg: rgba(74, 222, 128, .10); --ico-oport-hover-bg: rgba(74, 222, 128, .18);
  --ico-oport-on: #22C55E; --ico-dot: #60A5FA;       --ico-ring: #0D2137;
}
.sidebar-section-header .rail-ico svg { color: inherit; }
.map-sidebar .sidebar-section-header {
  position: relative;
  gap: 10px;
  padding: 6px 16px 6px 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -.005em;
  color: #222;
  outline: none;
}
.map-sidebar .sidebar-section-header--toggle:hover .rail-ico { background: var(--ico-hover-bg); color: var(--ico-hover); }
.map-sidebar .sidebar-section-header--toggle:not(.collapsed) .rail-ico { background: var(--ico-open-bg); color: var(--ico-open); }
.rail-label { white-space: nowrap; transition: opacity .18s ease, transform .18s ease; }

/* Foco de teclado: anillo negro como en Airbnb, solo con teclado */
.map-sidebar .sidebar-section-header--toggle:focus-visible .rail-ico,
.map-sidebar .oport-pill:focus-visible .rail-ico { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222; }
.map-sidebar :is(.mode-btn, .price-legend-item, .oport-top-btn, .map-count-clear):focus-visible {
  outline: 2px solid #222; outline-offset: 2px;
}
.map-sidebar .oport-pill:focus-visible { outline: none; }

/* Oportunidades: misma fila que el resto; el verde vive solo en el ícono y el contador */
.map-sidebar .sidebar-oport-strip { padding: 8px 8px 12px; gap: 10px; }
.map-sidebar .oport-pill {
  gap: 10px; height: 52px; padding: 0 12px 0 0;
  border: 0; border-radius: 12px; background: transparent; box-shadow: none;
  color: #222; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em;
}
.map-sidebar .oport-pill:hover { background: transparent; border: 0; box-shadow: none; }
.map-sidebar .oport-pill .rail-ico { color: var(--ico-oport); background: var(--ico-oport-bg); }
.map-sidebar .oport-pill .rail-ico svg { color: inherit; transition: transform .2s ease; }
.map-sidebar .oport-pill:hover .rail-ico { background: var(--ico-oport-hover-bg); }
.map-sidebar .oport-pill:hover svg { transform: none; }
.map-sidebar .oport-pill:hover .rail-ico svg { transform: scale(1.08); }
.map-sidebar .oport-pill.active { background: transparent; color: #15803D; box-shadow: none; border: 0; }
.map-sidebar .oport-pill.active .rail-ico { background: var(--ico-oport-on); color: #fff; }
.map-sidebar .oport-pill.active .rail-ico svg { fill: currentColor; }
.map-sidebar .oport-pill .rail-label { flex: 1; text-align: left; }
.map-sidebar .oport-pill .oport-pill-count,
.map-sidebar .oport-pill.active .oport-pill-count {
  background: #16A34A; color: #fff; font-variant-numeric: tabular-nums;
}
.map-sidebar .sidebar-oport-seg { margin-left: 50px; width: calc(100% - 50px); }

/* Selector de qué muestran las etiquetas: segmentado con pastilla blanca */
.sidebar-price-mode { padding: 12px 16px; border-top: 1px solid #EBEBEB; }
.mode-seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #F2F2F2; }
.mode-btn {
  flex: 1; padding: 8px 0; border: 0; border-radius: 10px;
  background: transparent; color: #6A6A6A;
  font: 600 12.5px/1 inherit; font-family: inherit; letter-spacing: -.005em;
  cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
}
.mode-btn:hover { color: #222; }
.mode-btn.is-on {
  background: #fff; color: #222;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .06);
}

.map-count-unit { display: none; }

@media (min-width: 521px) {
  .map-layout { position: relative; }
  .map-container { margin-left: 56px; }
  .map-sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    z-index: 1100;
    width: 56px;
    overflow-x: hidden;
    scrollbar-width: none;
    border-right: 1px solid #EBEBEB;
    /* Cierre con leve demora: no se cierra por un roce del mouse */
    transition: width .22s cubic-bezier(.2, .8, .2, 1) .12s, box-shadow .22s ease .12s;
  }
  .map-sidebar::-webkit-scrollbar { display: none; }
  /* El contenido mantiene su ancho final: no se reacomoda durante la animación */
  .map-sidebar > * { width: 268px; flex-shrink: 0; box-sizing: border-box; }
  .map-sidebar:hover,
  .map-sidebar:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus) {
    width: 268px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .04), 12px 0 32px rgba(13, 33, 55, .16);
    /* Apertura con intención: pasar de largo hacia el mapa no la dispara */
    transition-delay: .08s;
  }
  .map-sidebar:hover .rail-label,
  .map-sidebar:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus) .rail-label { transition-delay: .1s; }

  /* ── Estado riel (sin hover ni foco): solo íconos ── */
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .rail-label { opacity: 0; transform: translateX(-6px); }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) :is(
    .sidebar-section-body, .price-legend, .sidebar-oport-seg, .sidebar-price-mode,
    .oport-pill-count, .map-count-label, .map-count-clear, .toggle-chevron
  ) { display: none; }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .sidebar-section { border-bottom-color: transparent; }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .sidebar-section-header { padding-top: 2px; padding-bottom: 2px; }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .sidebar-oport-strip { padding-bottom: 6px; border-bottom-color: transparent; }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .oport-pill { width: 40px; height: 44px; padding: 0; }

  /* Filtro activo: punto de marca sobre el ícono */
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .section-badge.visible {
    position: absolute; left: 38px; top: 6px;
    width: 9px; height: 9px; padding: 0; font-size: 0;
    background: var(--ico-dot); box-shadow: 0 0 0 2px var(--ico-ring);
  }

  /* Contador: cifra + unidad, apilados al pie del riel */
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .map-count-bar {
    width: 56px; padding: 12px 0 14px; box-shadow: none; border-top-color: transparent;
    flex-direction: column; justify-content: center; gap: 1px;
  }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .map-count-num {
    font-size: 13px; font-weight: 700; color: #222; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  }
  .map-sidebar:not(:hover):not(:has(:focus-visible, select:focus, input:is([type=text], [type=search]):focus)) .map-count-unit {
    display: block; font-size: 10px; font-weight: 500; color: #717171;
  }
}

/* Celular: el panel va arriba del mapa a todo el ancho (esta regla va después de la de 268px) */
@media (max-width: 520px) {
  .map-sidebar { width: 100%; }
}

/* ══ Interior del panel del mapa: mismo lenguaje que el riel ══════════════
   Tipografía 13.5–14px, bordes #B0B0B0 → #222 al hover, foco negro de 2px,
   radios de 12px y un único tamaño de interruptor. */
.map-sidebar .sidebar-section-body {
  max-height: 1600px; /* la zonificación con su lista supera los 600px */
  padding: 4px 16px 18px;
  gap: 14px;
  border-top: 0;
}
.map-sidebar .sidebar-section-body.collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; }

/* Selectores */
.map-sidebar .sidebar-select {
  height: 48px; padding: 0 36px 0 14px;
  border: 1px solid #B0B0B0; border-radius: 12px;
  font-size: 14px; color: #222;
  background-position: right 14px center;
  transition: border-color .15s, box-shadow .15s;
}
.map-sidebar .sidebar-select:hover { border-color: #222; box-shadow: none; }
.map-sidebar .sidebar-select:focus { border-color: #222; box-shadow: inset 0 0 0 1px #222; }

/* Rangos: caja con la etiqueta adentro (Mínimo / Máximo) */
.map-sidebar .range-row { align-items: center; gap: 8px; margin-top: 0; }
.map-sidebar .range-field {
  gap: 2px; padding: 7px 12px 8px;
  border: 1px solid #B0B0B0; border-radius: 12px; background: #fff;
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.map-sidebar .range-field:hover { border-color: #222; }
.map-sidebar .range-field:focus-within { border-color: #222; box-shadow: inset 0 0 0 1px #222; }
.map-sidebar .range-field:has(.is-invalid) { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.map-sidebar .range-label { font-size: 11px; font-weight: 500; color: #717171; letter-spacing: 0; line-height: 1.2; }
.map-sidebar .range-input {
  height: 20px; padding: 0 22px 0 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-size: 14px; font-weight: 600; color: #222; font-variant-numeric: tabular-nums;
}
.map-sidebar .range-input:focus,
.map-sidebar .range-input.is-invalid { border: 0; box-shadow: none; }
.map-sidebar .range-input::placeholder { color: #B0B0B0; font-weight: 500; }
.map-sidebar .range-input--wide { padding-left: 32px; padding-right: 0; }
.map-sidebar .range-unit { right: 0; font-size: 12px; font-weight: 500; color: #717171; }
.map-sidebar .range-unit--prefix { left: 0; right: auto; }
.map-sidebar .range-sep { width: 8px; height: 1px; padding: 0; font-size: 0; background: #B0B0B0; }
.map-sidebar .range-hint { font-size: 12px; color: #6A6A6A; margin-top: -4px; }
.map-sidebar .range-hint::before { width: 4px; height: 4px; transform: translateY(-1px); }
.map-sidebar .range-hint b { color: #222; font-variant-numeric: tabular-nums; }

/* Interruptores: un solo tamaño en todo el panel (36×22) */
.map-sidebar .sidebar-toggle-row { padding: 6px 0; gap: 12px; }
.map-sidebar .sidebar-toggle-label { font-size: 14px; font-weight: 500; color: #222; }
.map-sidebar :is(.sidebar-toggle-track, .pli-toggle) {
  width: 36px; height: 22px; border-radius: 11px; background: #DDDDDD;
  transition: background .2s ease;
}
.map-sidebar :is(.sidebar-toggle-track, .pli-toggle)::after {
  top: 2px; left: 2px; width: 18px; height: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 1px 4px rgba(0, 0, 0, .12);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.map-sidebar .sidebar-toggle-switch input:checked + .sidebar-toggle-track,
.map-sidebar .price-legend-item.active .pli-toggle { background: #222; }
.map-sidebar .sidebar-toggle-switch input:checked + .sidebar-toggle-track::after,
.map-sidebar .price-legend-item.active .pli-toggle::after { transform: translateX(14px); }
.map-sidebar .sidebar-toggle-switch input:focus-visible + .sidebar-toggle-track { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #222; }

/* Zonificación: títulos en oración, chips como los de Airbnb */
.map-sidebar .filter-section-title {
  margin: 4px 0 10px; opacity: 1;
  font-size: 12px; font-weight: 600; color: #717171; text-transform: none; letter-spacing: 0;
}
.map-sidebar .filter-group-label { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: #222; }
.map-sidebar .filter-group-label[style*="margin-top"] { margin-top: 16px !important; }
.map-sidebar .chip-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.map-sidebar .map-chip {
  padding: 8px 0; text-align: center; border: 1px solid #DDDDDD; border-radius: 99px; background: #fff;
  font-size: 12.5px; font-weight: 500; color: #222;
  transition: border-color .15s, background .15s, color .15s;
}
.map-sidebar .map-chip:hover { border-color: #222; }
.map-sidebar .map-chip.active { background: #222; border-color: #222; color: #fff; font-weight: 600; }
.map-sidebar .map-chip:focus-visible { outline: 2px solid #222; outline-offset: 2px; }
.map-sidebar #zona-list-wrap { margin-top: 18px !important; }

/* Precio relativo: filas limpias; el interruptor comunica el estado */
.map-sidebar .price-legend { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.map-sidebar .price-legend.collapsed { padding-bottom: 0; }
.map-sidebar .price-legend-item {
  gap: 12px; padding: 8px; margin: 0 -8px; width: calc(100% + 16px);
  border: 0; border-radius: 10px;
}
.map-sidebar .price-legend-item:hover { background: #F7F7F7; }
.map-sidebar .price-legend-item:focus-visible { outline: 2px solid #222; outline-offset: 0; }
.map-sidebar .price-legend-dot { width: 12px; height: 12px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.map-sidebar .price-legend-label { font-size: 13.5px; font-weight: 600; color: #222; line-height: 1.3; }
.map-sidebar .price-legend-sub { font-size: 12px; color: #717171; line-height: 1.3; }
.map-sidebar .pli-count { font-size: 12px; font-weight: 600; color: #6A6A6A; font-variant-numeric: tabular-nums; }
.map-sidebar .price-legend-item:not(.active) { opacity: 1; }
.map-sidebar .price-legend-item:not(.active) :is(.price-legend-label, .price-legend-sub, .pli-count) { color: #B0B0B0; text-decoration: none; opacity: 1; }
.map-sidebar .pl-divider { height: 1px; background: #EBEBEB; margin: 6px 0; }

/* ══ Celular: hoja inferior (bottom sheet) como Airbnb ═══════════════════
   El mapa ocupa toda la pantalla; la hoja asoma 64px con el resumen y sube
   tocando o arrastrando el asa. */
.sheet-head { display: none; }
.sheet-badge {
  display: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: #222; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.sheet-badge.visible { display: inline-block; }

@media (max-width: 520px) {
  .map-layout { position: relative; height: calc(100dvh - var(--header-h)); overflow: hidden; }
  .map-container { flex: 1; height: 100%; min-height: 0; }
  .map-sidebar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100;
    width: 100%; height: 86%; max-height: none;
    border: 0; border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, .06), 0 -8px 32px rgba(13, 33, 55, .16);
    overflow: hidden; overscroll-behavior: contain;
    transform: translateY(calc(100% - 64px));
    transition: transform .34s cubic-bezier(.2, .8, .2, 1);
  }
  .map-sidebar.sheet-open { transform: translateY(0); overflow-y: auto; }

  .sheet-head {
    display: block; position: sticky; top: 0; z-index: 3; flex-shrink: 0;
    width: 100%; height: 64px; padding: 8px 20px 0; box-sizing: border-box;
    background: #fff; border: 0; border-bottom: 1px solid transparent; border-radius: 20px 20px 0 0;
    font-family: inherit; text-align: left; cursor: grab; touch-action: none;
    -webkit-tap-highlight-color: transparent; transition: border-color .2s;
  }
  .map-sidebar.sheet-open .sheet-head { border-bottom-color: #EBEBEB; }
  .sheet-head:focus-visible { outline: 2px solid #222; outline-offset: -4px; }
  .sheet-grabber { display: block; width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: #D0D0D0; }
  .sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .sheet-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: #222; letter-spacing: -.01em; }
  .sheet-count { font-size: 13px; color: #717171; font-variant-numeric: tabular-nums; }
  .sheet-count b { color: #222; font-weight: 700; }

  /* El contador del pie ya está en el asa: el pie queda solo con "Limpiar" */
  .map-sidebar .map-count-bar { justify-content: flex-end; }
  .map-sidebar .map-count-bar :is(.map-count-num, .map-count-label) { display: none; }

  /* Lo que vive al pie del mapa se corre por encima del asa */
  .map-result-pill { bottom: 80px; }
  #map .leaflet-bottom { bottom: 64px; }
}

/* ══ Lista de zonas: buscador + filas con casilla, al nivel del resto ══════ */
.map-sidebar .zona-list-header {
  padding: 0 0 10px; gap: 8px;
  font-size: 13px; font-weight: 600; color: #222;
}
.map-sidebar .zona-list-header:focus-visible { outline: 2px solid #222; outline-offset: 2px; border-radius: 6px; }
.zlc-count { font-size: 12px; font-weight: 500; color: #717171; font-variant-numeric: tabular-nums; }
.map-sidebar .zlc-chevron { margin-left: auto; color: #717171; transition: transform .2s ease; }
#zona-list-wrap.is-collapsed .zlc-chevron { transform: rotate(180deg); }
#zona-list-wrap.is-collapsed :is(.zlc-search, .zona-list-body) { display: none; }

.zlc-search {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; margin-bottom: 8px;
  border: 1px solid #B0B0B0; border-radius: 12px; background: #fff; color: #717171;
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.zlc-search:hover { border-color: #222; }
.zlc-search:focus-within { border-color: #222; box-shadow: inset 0 0 0 1px #222; color: #222; }
.zlc-search svg { flex-shrink: 0; }
.zlc-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; outline: 0; background: transparent;
  font: 500 13.5px/1 inherit; font-family: inherit; color: #222;
}
.zlc-search input::placeholder { color: #9A9A9A; font-weight: 400; }
.zlc-search input::-webkit-search-cancel-button { cursor: pointer; }

.map-sidebar .zona-list-body {
  max-height: 300px; padding: 0 0 4px;
  border: 1px solid #DDDDDD; border-radius: 12px; background: #fff;
  overscroll-behavior: contain;
}
.map-sidebar .zlc-group + .zlc-group { border-top: 0; }
.map-sidebar .zlc-group[hidden], .map-sidebar .zlc-row[hidden] { display: none; }
.map-sidebar .zlc-group-header {
  position: sticky; top: 0; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px 6px; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(4px);
  font-size: 12px; font-weight: 600; color: #717171; text-transform: none; letter-spacing: 0;
}
.map-sidebar .zlc-group-header span { font-weight: 500; color: #9A9A9A; font-variant-numeric: tabular-nums; }

.map-sidebar .zlc-row {
  gap: 10px; margin: 0 4px; padding: 8px 8px;
  border-left: 0; border-radius: 10px; outline: none;
}
.map-sidebar .zlc-row::after { display: none; }
.map-sidebar .zlc-row:hover { background: #F7F7F7; }
.map-sidebar .zlc-row:focus-visible { box-shadow: inset 0 0 0 2px #222; }
.map-sidebar .zlc-row--active,
.map-sidebar .zlc-row--active:hover { background: #F7F7F7; }
.map-sidebar .zlc-list--has-active .zlc-row:not(.zlc-row--active) { opacity: 1; }
.map-sidebar .zlc-dot { width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.map-sidebar .zlc-info { flex: 1; }
.map-sidebar .zlc-code { font-size: 13px; font-weight: 600; color: #222; }
.map-sidebar .zlc-row--active .zlc-code { color: #222; }
.map-sidebar .zlc-desc {
  font-size: 11.5px; color: #717171; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Casilla estilo Airbnb: 20px, radio 6, negra con tilde al marcar */
.zlc-check {
  flex-shrink: 0; width: 20px; height: 20px;
  border: 1px solid #B0B0B0; border-radius: 6px; background: #fff;
  transition: background .15s, border-color .15s, transform .12s;
}
.zlc-row:hover .zlc-check { border-color: #222; }
.zlc-row:active .zlc-check { transform: scale(.92); }
.zlc-row--active .zlc-check {
  border-color: #222; background: #222 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpolyline points='2.5,6.2 5,8.6 9.5,3.6' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}

/* Selección activa: una línea con la cantidad y "Limpiar" */
.map-sidebar .zlc-clear-row {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 10px 12px; border: 0; border-bottom: 1px solid #EBEBEB; background: #fff;
  font: 500 12.5px/1.2 inherit; font-family: inherit; color: #222; cursor: pointer; text-align: left;
}
.map-sidebar .zlc-clear-row:hover { background: #F7F7F7; }
.map-sidebar .zlc-clear-row b { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.map-sidebar .zlc-clear-row:focus-visible { outline: 2px solid #222; outline-offset: -2px; }
.map-sidebar .zlc-list--has-active .zlc-group-header { top: 39px; }

.map-sidebar .zlc-empty { padding: 18px 12px; font-size: 12.5px; color: #717171; text-align: center; }
.map-sidebar .zlc-empty[hidden] { display: none; }

/* ── Capas de Munimapa sobre el mapa ─────────────────── */
.capas-bar {
  position: absolute;
  top: 14px;
  left: 408px;
  z-index: 1000;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.capa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.capa-chip:hover { background: var(--bg); color: var(--text); }
.capa-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.capa-chip svg { flex-shrink: 0; }
/* Alineación con el buscador (48px de alto, a 14px del borde):
   al lado, los botones se centran con él; abajo, arrancan en su mismo borde izquierdo */
.capas-bar { top: 20px; align-items: center; }
/* Mapa angosto: los botones bajan debajo del buscador */
@media (max-width: 1180px) {
  .capas-bar { top: 70px; left: 14px; right: 60px; }
  .capa-chip { height: 32px; padding: 0 11px; font-size: 12px; }
}
@media (max-width: 520px) {
  .capas-bar { top: 66px; left: 10px; }
}
.capas-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1000;
  transform: translate(-50%, -50%);
  padding: 9px 16px;
  border-radius: 20px;
  background: rgba(15, 23, 42, .88);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.capas-hint.visible { opacity: 1; }

/* Bloque "Parcela ARBA" de la ficha del punto */
.fp-parcela {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid #FED7AA;
  border-radius: var(--radius-sm);
  background: #FFF7ED;
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fp-parcela--muted { border-color: var(--border); background: #F8FAFC; color: var(--text-muted); }
.fp-parcela-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fp-parcela-tag {
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.fp-parcela-line { line-height: 1.45; }
.fp-parcela b { font-weight: 800; }
.fp-muted { color: var(--text-muted); font-weight: 400; }
.popup-abierto .map-result-pill { opacity: 0 !important; pointer-events: none; }
