/* ==========================================================
   Directorio Económico — estilos
   HTML + CSS + JS puro. Sin frameworks.
   ========================================================== */

:root {
  --paper: #f5f2ea;
  --paper-2: #ece7db;
  --card: #fffdf8;
  --ink: #18201c;
  --ink-2: #4a544e;
  --ink-3: #7d8680;
  --line: #ddd6c6;
  --line-2: #cfc6b2;
  --accent: #1d6b4c;
  --accent-2: #154f38;
  --accent-soft: #dcebe2;
  --warm: #c5532b;
  --warm-soft: #f6dfd3;
  --focus: #2f8f68;
  --shadow: 0 1px 2px rgb(24 32 28 / .06), 0 8px 24px -12px rgb(24 32 28 / .18);
  --shadow-lg: 0 24px 60px -20px rgb(24 32 28 / .35);
  --r: 14px;
  --r-sm: 9px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --side: 300px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121614;
    --paper-2: #1a201d;
    --card: #19201c;
    --ink: #eef0ea;
    --ink-2: #b5bdb6;
    --ink-3: #85908a;
    --line: #2b332e;
    --line-2: #39433d;
    --accent: #5cc595;
    --accent-2: #8bdcb6;
    --accent-soft: #1f3a2d;
    --warm: #f08a5d;
    --warm-soft: #3c2519;
    --focus: #6fd3a5;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
svg:not(.leaflet-pane svg) { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--paper);
  transition: opacity .4s ease, visibility .4s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-card { width: min(320px, 80vw); text-align: center; }
.loader-mark { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.loader-mark span {
  width: 12px; height: 12px; border-radius: 3px; background: var(--accent);
  animation: hop 1s ease-in-out infinite;
}
.loader-mark span:nth-child(2) { background: var(--warm); animation-delay: .12s; }
.loader-mark span:nth-child(3) { background: var(--ink); animation-delay: .24s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } }
.loader-title { font: 700 20px/1.2 var(--display); margin: 0 0 14px; }
.loader-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 8%; background: var(--accent); border-radius: inherit; transition: width .2s; }
.loader-bar.indet i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.loader-note { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }

/* ---------- Header ---------- */
.top { border-bottom: 1px solid var(--line); background: var(--paper); }
.top-inner {
  max-width: 1360px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; position: relative; overflow: hidden;
  background:
    linear-gradient(var(--accent) 0 0) 0 0 / 50% 50% no-repeat,
    linear-gradient(var(--warm) 0 0) 100% 0 / 50% 50% no-repeat,
    linear-gradient(var(--ink) 0 0) 0 100% / 50% 50% no-repeat,
    var(--paper-2);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font: 700 16px var(--display); letter-spacing: -.01em; }
.brand-text small { color: var(--ink-3); font-size: 12.5px; }
.top-meta { color: var(--ink-3); font-size: 13px; text-align: right; }
.top-meta b { color: var(--ink-2); font-weight: 600; }

/* ---------- Hero / búsqueda ---------- */
.hero { border-bottom: 1px solid var(--line); background:
  radial-gradient(1200px 300px at 85% -40%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
  radial-gradient(800px 260px at 0% 120%, color-mix(in srgb, var(--warm) 12%, transparent), transparent 70%);
}
.hero-inner { max-width: 1360px; margin: 0 auto; padding: 40px 24px 26px; }
.hero h1 {
  font: 800 clamp(30px, 4.4vw, 52px)/1.02 var(--display);
  letter-spacing: -.03em; margin: 0 0 12px; max-width: 18ch;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub { margin: 0 0 22px; color: var(--ink-2); font-size: 16px; max-width: 60ch; }
.hero-sub span { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.search { position: relative; max-width: 760px; }
.search input {
  width: 100%; height: 58px; padding: 0 56px 0 52px;
  border: 1.5px solid var(--line-2); border-radius: 16px;
  background: var(--card); font-size: 17px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.search input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 21px; height: 21px; color: var(--ink-3); pointer-events: none; }
.search-kbd, .search-clear {
  position: absolute; right: 14px; top: 50%; translate: 0 -50%;
}
.search-kbd {
  font: 500 12px var(--mono); color: var(--ink-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px;
}
.search input:focus ~ .search-kbd { display: none; }
.search-clear {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--paper-2);
  font-size: 20px; line-height: 1; color: var(--ink-2);
}
.search-clear:hover { background: var(--line); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick button {
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--card) 70%, transparent);
  border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.quick button:hover { border-color: var(--accent); color: var(--accent); background: var(--card); }
.quick-label { font-size: 13px; color: var(--ink-3); align-self: center; margin-right: 2px; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1360px; margin: 0 auto; padding: 24px;
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 28px; align-items: start;
}

/* ---------- Filtros ---------- */
.filters {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px); overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 18px 8px; box-shadow: var(--shadow);
  scrollbar-width: thin;
}
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.filters-head h2 { font: 700 18px var(--display); margin: 0; }
.filters .filters-close, .filters .filters-apply { display: none; }
.link { border: 0; background: none; color: var(--accent); font-size: 13.5px; font-weight: 500; padding: 4px 0; }
.link:hover { text-decoration: underline; }

.field { border: 0; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); min-width: 0; }
.filters-head + .field { border-top: 0; padding-top: 6px; }
.field > label:not(.toggle), .field > legend {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px; padding: 0;
}
fieldset.field > legend { float: left; width: 100%; }
fieldset.field > legend + * { clear: both; }

.select { position: relative; }
.select::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select select {
  appearance: none; width: 100%; height: 42px; padding: 0 34px 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper);
  font-size: 14.5px; text-overflow: ellipsis;
}
.select select:disabled { opacity: .55; }
.select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.select-sm select { height: 38px; font-size: 14px; background: var(--card); }

/* Combobox de giro */
.combo { position: relative; }
.combo input {
  width: 100%; height: 42px; padding: 0 34px 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); font-size: 14.5px;
}
.combo input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.combo.has-value input { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); font-weight: 500; }
.combo-clear {
  position: absolute; right: 6px; top: 7px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; font-size: 18px; color: var(--ink-2);
}
.combo-clear:hover { background: var(--line); }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  max-height: 320px; overflow: auto;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.combo-list li {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; line-height: 1.3;
}
.combo-list li small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.combo-list li b { font-weight: 500; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--accent-soft); }
.combo-list li.none { color: var(--ink-3); cursor: default; background: none; }
.combo-list mark { background: none; color: var(--accent); font-weight: 600; }

/* Chips de tamaño */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--paper);
  border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--ink-2);
  transition: all .15s;
}
.chip b { font-weight: 500; color: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[aria-pressed="true"] b { color: rgb(255 255 255 / .75); }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { color: #0d1a14; } .chip[aria-pressed="true"] b { color: rgb(0 0 0 / .6); } }
.chip.zero { opacity: .45; }

/* Toggles */
.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14.5px; cursor: pointer; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 400; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sw { width: 34px; height: 20px; border-radius: 20px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(14px); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 3px; background: var(--paper); }
.seg button { border: 0; background: none; border-radius: 6px; padding: 6px 4px; font-size: 13.5px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; border: 1px solid transparent; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0d1a14; } }
.btn-ghost { background: var(--card); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink-3); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper-2); font-size: 22px; line-height: 1; color: var(--ink-2); }
.icon-btn:hover { background: var(--line); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11.5px; min-width: 19px; height: 19px; display: inline-grid; place-items: center; padding: 0 5px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.count { display: flex; align-items: baseline; gap: 8px; }
.count strong { font: 800 30px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.count span { color: var(--ink-2); }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.show-filters { display: none; }

.views { display: flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 3px; background: var(--card); }
.views button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; background: none; border-radius: 6px; font-size: 14px; color: var(--ink-2); }
.views button svg { width: 16px; height: 16px; }
.views button.on { background: var(--ink); color: var(--paper); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-lg);
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 11px; border-radius: 8px; font-size: 14px; }
.menu button:hover { background: var(--paper-2); }

/* Filtros activos */
.active { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; margin-bottom: 16px; }
.active:empty { margin-bottom: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 999px;
  padding: 5px 8px 5px 12px; font-size: 13px;
}
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill i { font-style: normal; opacity: .6; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.pill em { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .16); font-size: 14px; line-height: 1; }
.pill:hover em { background: rgb(255 255 255 / .3); }

/* ---------- Insights ---------- */
.insights {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 20px;
}
.insight { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.insight h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.insight h3.mt { margin-top: 18px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bars li button {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  border: 0; background: none; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; text-align: left; width: calc(100% + 12px);
}
.bars li button:hover { background: var(--paper-2); }
.bars .lbl { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .val { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bars .bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.bars .bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .35s ease; }

.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--paper-2); gap: 2px; }
.stack i { display: block; height: 100%; transition: flex-basis .35s ease; min-width: 0; }
.stack-legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; font-size: 12.5px; color: var(--ink-2); }
.stack-legend li { display: flex; align-items: center; gap: 7px; }
.stack-legend li::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); flex: none; }
.stack-legend b { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.contact-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.contact-stats div { background: var(--paper); border-radius: 10px; padding: 9px 10px; }
.contact-stats b { display: block; font: 700 19px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.contact-stats span { font-size: 12px; color: var(--ink-3); }

/* ---------- Tarjetas ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%;
  width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 16px 14px 19px; overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.card-giro { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; line-height: 1.3; }
.card-giro span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.card h3 { font: 700 17px/1.25 var(--display); letter-spacing: -.01em; margin: 0; }
.card h3 mark, .card-addr mark, .card-giro mark, .card-rs mark { background: color-mix(in srgb, var(--warm) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.card-rs { font-size: 12.5px; color: var(--ink-3); margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-addr { font-size: 13.5px; color: var(--ink-2); margin: 0; line-height: 1.4; }
.card-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag svg { width: 13px; height: 13px; }
.tag-loc { background: none; padding: 0; font-weight: 500; color: var(--ink); }
.card-icons { margin-left: auto; display: flex; gap: 4px; }
.card-icons i { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.card-icons svg { width: 13px; height: 13px; }

.more { display: flex; justify-content: center; padding: 22px 0 6px; }
.empty { text-align: center; padding: 60px 20px; }
.empty-ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background:
  radial-gradient(circle at 42% 42%, transparent 13px, var(--ink-3) 14px 17px, transparent 18px),
  linear-gradient(45deg, transparent 46%, var(--ink-3) 46% 54%, transparent 54%) 38px 38px / 18px 18px no-repeat,
  var(--paper-2); }
.empty h3 { font: 700 22px var(--display); margin: 0 0 6px; }
.empty p { color: var(--ink-2); margin: 0 0 18px; }

/* ---------- Mapa ---------- */
.map-wrap { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
#map { height: min(72vh, 760px); min-height: 420px; background: var(--paper-2); }
.leaflet-container { font-family: var(--sans); }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12px; max-width: 260px;
  display: grid; gap: 3px; box-shadow: var(--shadow);
}
.map-legend span { display: flex; align-items: center; gap: 7px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.map-note {
  position: absolute; right: 12px; top: 12px; z-index: 500; max-width: 300px;
  background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 11px; font-size: 12.5px; color: var(--ink-2); box-shadow: var(--shadow);
}
.map-note:empty { display: none; }
.map-pop { font: 13px/1.4 var(--sans); }
.map-pop b { font: 700 14px/1.25 var(--display); display: block; margin-bottom: 2px; }
.map-pop button { margin-top: 6px; border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }
.leaflet-popup-content-wrapper { border-radius: 12px; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgb(15 20 17 / .38); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(480px, 100vw);
  background: var(--card); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.drawer-sector { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.drawer-sector::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.drawer-body { overflow: auto; padding: 22px 22px 32px; }
.d-name { font: 800 26px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.d-rs { color: var(--ink-3); font-size: 13.5px; margin: 0 0 14px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.d-actions .btn { height: 42px; text-decoration: none; }
.d-actions .btn-ghost { color: var(--ink); }
.d-map { height: 180px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 18px; background: var(--paper-2); }
.d-list { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 0; }
.d-list dt, .d-list dd { padding: 10px 0; border-top: 1px solid var(--line); margin: 0; font-size: 14px; }
.d-list dt { color: var(--ink-3); font-size: 12.5px; padding-top: 11px; }
.d-list dd { word-break: break-word; }
.d-list code { font: 500 12.5px var(--mono); background: var(--paper-2); padding: 1px 6px; border-radius: 5px; }
.d-copy { border: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 0 0 0 6px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); border-radius: 10px; padding: 10px 16px; font-size: 14px; box-shadow: var(--shadow-lg);
  transition: opacity .2s, translate .2s;
}
.toast.show { opacity: 1; translate: -50% 0; }

/* ---------- Footer ---------- */
.foot { max-width: 1360px; margin: 0 auto; padding: 10px 24px 40px; color: var(--ink-3); font-size: 13px; }
.foot a { color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .insights { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .filters {
    position: fixed; z-index: 70; inset: auto 0 0 0; top: auto; max-height: 88vh;
    border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .filters.open { transform: none; }
  .filters .filters-close { display: grid; place-items: center; margin-left: 10px; }
  .filters-head .link { margin-left: auto; }
  .filters .filters-apply { display: flex; width: 100%; height: 46px; position: sticky; bottom: 0; margin: 8px 0 4px; }
  .show-filters { display: inline-flex; }
  .hero-inner { padding: 26px 16px 18px; }
  .top-inner { padding: 12px 16px; }
  .top-meta { display: none; }
  .cards { grid-template-columns: 1fr; }
  .toolbar { gap: 10px; }
  .count strong { font-size: 26px; }
  .search input { height: 52px; font-size: 16px; }
  .search-kbd { display: none; }
}
@media (max-width: 520px) {
  .toolbar-actions { width: 100%; }
  .toolbar-actions .select-sm { flex: 1 1 120px; min-width: 0; }
  .toolbar-actions .views { flex: none; }
  .views button { padding: 0 9px; }
  .menu-wrap .btn { padding: 0 10px; }
  .stack-legend { grid-template-columns: 1fr; }
  .d-list { grid-template-columns: 100px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.main { min-width: 0; }
.active .pill { max-width: 100%; }
.is-map .insights { display: none; }

/* Sugerencias de giro y corrección */
.suggest { margin: -4px 0 16px; display: grid; gap: 8px; }
.fix { margin: 0; font-size: 14px; color: var(--ink-2); }
.fix b { color: var(--ink); }
.sug { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--r);
  background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 25%, transparent); }
.sug > span { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-right: 2px; }
.sug button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--card);
  border-radius: 999px; padding: 6px 8px 6px 12px; font-size: 13.5px; text-align: left; line-height: 1.25; max-width: 100%;
  transition: border-color .15s, transform .15s; }
.sug button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.sug button b { font-weight: 600; font-size: 12px; background: var(--paper-2); border-radius: 999px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.sug button:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.cards .sep { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 18px 2px 4px;
  border-top: 1px dashed var(--line-2); margin-top: 6px; }
.cards .sep:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.cards .sep span { font: 700 17px var(--display); }
.cards .sep small { color: var(--ink-3); font-size: 13px; }
.sug button.sug-mun::before { display: none; }
.sug button.sug-mun svg { width: 14px; height: 14px; color: var(--accent); }

/* Tamaño en lenguaje común */
.chips:has(.chip-size) { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip-size { justify-content: space-between; border-radius: 10px; padding: 7px 10px; text-align: left; }
.chip-size span { display: flex; flex-direction: column; line-height: 1.2; font-weight: 500; color: var(--ink); }
.chip-size small { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.chip-size[aria-pressed="true"] span, .chip-size[aria-pressed="true"] small { color: inherit; }
.d-official { margin: 18px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.d-official code { font: 500 11px var(--mono); background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

/* Explora por categoría */
.explore h2 { font: 700 20px var(--display); margin: 4px 0 14px; letter-spacing: -.01em; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile {
  position: relative; width: 100%; height: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  align-content: start; padding: 14px 14px 14px 18px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--card); overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.tile-name { font: 700 15.5px/1.25 var(--display); }
.tile-n { grid-row: 1; grid-column: 2; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--paper-2); border-radius: 999px; padding: 2px 8px; align-self: start; font-variant-numeric: tabular-nums; }
.tile-ex { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.is-browsing .count strong { font-size: 24px; }
/* En celular, primero los resultados: el resumen se oculta */
@media (max-width: 900px) { .insights { display: none !important; } .tiles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } }

/* Mapa base propio */
#map, .d-map { background: color-mix(in srgb, var(--paper-2) 70%, var(--line)); }
.map-label { background: none; border: 0; white-space: nowrap; pointer-events: none; }
.map-label span { display: inline-block; transform: translate(-50%, -50%); font-family: var(--sans); color: var(--ink-2);
  text-shadow: 0 0 3px var(--card), 0 0 3px var(--card), 0 0 6px var(--card); }
.lbl-mun span { font: 700 12.5px var(--display); letter-spacing: .02em; color: var(--ink-2); text-transform: uppercase; opacity: .75; }
.lbl-loc span { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.lbl-col span { font-size: 11px; color: var(--ink-3); font-style: italic; }
.d-map { position: relative; }

/* Selector de estilo de mapa */
.map-styles { display: flex; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.map-styles button { border: 0; background: none; border-radius: 7px; padding: 6px 11px; font: 500 13px var(--sans); color: var(--ink-2); cursor: pointer; }
.map-styles button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.d-map .leaflet-control-attribution { font-size: 9px; }
.has-tiles .lbl-mun span { opacity: 1; color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff, 0 0 8px #fff; }
.foot .ver { opacity: .6; margin-left: 6px; }
