/* ============================================================
   MAPA DEL DELITO — LA COSTA · v5 (muestra D)
   Eje: CONTRASTE Y BLOQUES. El mapa ocupa toda la pantalla,
   siempre. Encima, información en bloques sólidos de alto
   contraste, límites duros, esquinas rectas. Señalética, no
   editorial. Legible al sol. Se resigna la delicadeza y el aire.
   ============================================================ */

:root {
  --negro:   #14130F;
  --negro-2: #22201A;
  --hueso:   #F4F1E8;
  --hueso-2: #E7E2D3;
  --gris:    #8C877A;
  --raya:    #14130F;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --borde: 2px solid var(--raya);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--hueso); color: var(--negro);
  font: 15px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

.app { position: fixed; inset: 0; }

/* ---------------- mapa: ocupa todo ---------------- */

#mapa { position: absolute; inset: 0; z-index: 0; background: var(--hueso-2); }
.leaflet-tile-pane { filter: grayscale(1) contrast(1.05) brightness(1.03); }
.leaflet-container { background: var(--hueso-2); font: inherit; }
.leaflet-control-zoom { border: var(--borde) !important; margin: 0 !important; position: absolute; }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 14px 14px 0 !important; }
.leaflet-control-zoom a {
  background: var(--hueso) !important; color: var(--negro) !important;
  border-bottom: 2px solid var(--raya) !important;
  width: 34px !important; height: 34px !important; line-height: 32px !important; font-size: 18px !important;
  font-weight: 700;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-attribution {
  background: var(--negro) !important; color: var(--hueso-2) !important;
  font-size: 10px !important; padding: 2px 7px !important; border-radius: 0 !important;
}
.leaflet-control-attribution a { color: #C9BEA0 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--hueso); border: var(--borde); border-radius: 0; box-shadow: 6px 6px 0 rgba(20,19,15,.15); }
.leaflet-popup-content { margin: 12px 14px; font: inherit; }
.leaflet-popup-content .p-c { display: inline-block; padding: 2px 7px; color: var(--hueso); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.leaflet-popup-content .p-d { font-size: 17px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.01em; }
.leaflet-popup-content .p-m { font-size: 11px; color: var(--gris); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.leaflet-popup-content .p-x { font-size: 13px; line-height: 1.5; margin: 7px 0 0; }
.leaflet-popup-close-button { color: var(--negro) !important; font-size: 18px !important; }

.pin span { display: block; width: 14px; height: 14px; border: 3px solid var(--hueso); box-shadow: 0 0 0 2px var(--negro); }
.pin.grande span { width: 20px; height: 20px; }
.pin-ref span { display: block; width: 9px; height: 9px; background: var(--negro); border: 2px solid var(--hueso); }
.pin-busc span { display: block; width: 14px; height: 14px; background: var(--hueso); border: 3px solid var(--negro); }

/* ---------------- barra superior: bloque negro macizo ---------------- */

.top {
  position: relative; z-index: 40;
  display: flex; align-items: stretch;
  background: var(--negro); color: var(--hueso);
  border-bottom: var(--borde);
}
.top-marca {
  display: flex; flex-direction: column; justify-content: center;
  padding: 8px 18px; flex: none; border-right: 2px solid var(--negro-2);
}
.top-marca b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.top-marca span { font-size: 9px; letter-spacing: .18em; color: var(--gris); text-transform: uppercase; margin-top: 2px; }

.top-buscar { flex: 1; position: relative; display: flex; align-items: center; border-right: 2px solid var(--negro-2); }
.top-buscar input {
  width: 100%; height: 100%; background: transparent; border: 0; outline: none;
  padding: 0 16px; font-size: 14px; color: var(--hueso);
}
.top-buscar input::placeholder { color: var(--gris); }
#resultados {
  position: absolute; left: -2px; right: -2px; top: 100%; z-index: 60;
  list-style: none; margin: 0; padding: 0;
  background: var(--hueso); color: var(--negro); border: var(--borde);
  max-height: 55vh; overflow: auto;
}
#resultados li { padding: 10px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--hueso-2); }
#resultados li:last-child { border-bottom: 0; }
#resultados li:hover { background: var(--negro); color: var(--hueso); }
#resultados li.vacio { color: var(--gris); cursor: default; font-weight: 500; font-size: 12.5px; line-height: 1.45; }
#resultados li.vacio:hover { background: var(--hueso); color: var(--gris); }

.top-reportar {
  flex: none; padding: 0 22px; display: flex; align-items: center;
  background: var(--hueso); color: var(--negro);
  font-weight: 800; font-size: 14px; letter-spacing: .01em;
}
.top-reportar:hover { background: var(--hueso-2); }

/* ---------------- tira de localidades: bloques ---------------- */

.tira {
  position: relative; z-index: 39;
  display: flex; background: var(--negro); border-bottom: var(--borde);
  overflow-x: auto; scrollbar-width: none;
}
.tira::-webkit-scrollbar { display: none; }
.top-wrap { position: absolute; top: 0; left: 0; right: 0; z-index: 40; }
.top-wrap .tira { position: static; }

.loc-b {
  flex: none; padding: 9px 15px; white-space: nowrap;
  color: var(--gris); font-weight: 700; font-size: 12.5px;
  letter-spacing: .02em; border-right: 2px solid var(--negro-2);
}
.loc-b:hover { color: var(--hueso); }
.loc-b.on { background: var(--hueso); color: var(--negro); }
.loc-b .n { display: inline-block; margin-left: 7px; font-weight: 800; }
.loc-b.on .n { color: var(--negro); }

/* ---------------- panel lateral: bloque hueso macizo ---------------- */

.panel {
  position: absolute; left: 14px; bottom: 14px; z-index: 35;
  width: 340px; max-height: calc(100% - 190px);
  display: flex; flex-direction: column;
  background: var(--hueso); border: var(--borde);
  box-shadow: 8px 8px 0 rgba(20,19,15,.18);
}
.panel-cab {
  flex: none; display: flex; align-items: baseline; justify-content: space-between;
  padding: 11px 14px; background: var(--negro); color: var(--hueso);
}
.panel-cab b { font-size: 15px; font-weight: 800; }
.panel-cab span { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); }
.panel-filtros {
  flex: none; display: flex; gap: 5px; flex-wrap: wrap; padding: 9px 12px;
  border-bottom: var(--borde); background: var(--hueso-2);
}
.f-chip {
  font-size: 11px; font-weight: 700; padding: 3px 8px;
  border: 2px solid var(--raya); color: var(--negro); text-transform: uppercase; letter-spacing: .03em;
}
.f-chip.on { background: var(--negro); color: var(--hueso); }
.f-chip.cat { display: inline-flex; align-items: center; gap: 5px; }
.f-chip.cat .d { width: 8px; height: 8px; }
.f-chip.cat.off { opacity: .35; }
.f-chip.cat.off .d { background: var(--gris) !important; }

.panel-lista { flex: 1; overflow-y: auto; }
.h-b {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; border-bottom: 1px solid var(--hueso-2);
  border-left: 5px solid transparent;
}
.h-b:hover { background: var(--hueso-2); }
.h-b.foco { background: var(--negro); color: var(--hueso); border-left-color: var(--hueso); }
.h-b .c { display: inline-block; padding: 1px 6px; font-size: 9.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--hueso); margin-bottom: 6px; }
.h-b.foco .c { outline: 1px solid var(--hueso); }
.h-b .d { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.h-b .m { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--gris); margin-top: 2px; }
.h-b.foco .m { color: var(--hueso-2); }

.vacio-b { padding: 20px 14px; }
.vacio-b b { display: block; font-size: 15px; font-weight: 800; margin-bottom: 5px; }
.vacio-b p { font-size: 13px; line-height: 1.5; margin: 0; color: var(--negro); }

.panel-pie {
  flex: none; padding: 8px 14px; border-top: var(--borde);
  background: var(--negro); color: var(--gris);
  font-size: 10px; font-weight: 600; line-height: 1.45; letter-spacing: .02em;
}

/* ---------------- aviso muestra: franja amarilla dura ---------------- */

.aviso {
  position: absolute; top: 0; left: 0; z-index: 45;
  background: #F2C500; color: var(--negro); border: var(--borde); border-top: 0; border-left: 0;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 12px;
}

/* ---------------- capas: bloque desde la derecha ---------------- */

.capas-btn {
  position: absolute; z-index: 35; right: 14px;
  background: var(--hueso); border: var(--borde); box-shadow: 4px 4px 0 rgba(20,19,15,.18);
  padding: 8px 14px; font-weight: 800; font-size: 13px;
}
.capas-btn:hover { background: var(--hueso-2); }
.capas-panel {
  position: absolute; z-index: 36; right: 14px;
  width: 264px; max-height: calc(100% - 210px); overflow: auto;
  background: var(--hueso); border: var(--borde); box-shadow: 8px 8px 0 rgba(20,19,15,.18);
}
.capas-panel h3 { margin: 0; padding: 9px 13px; background: var(--negro); color: var(--hueso); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cg { border-bottom: 1px solid var(--hueso-2); }
.cg > button { display: flex; justify-content: space-between; width: 100%; padding: 8px 13px; font-size: 12.5px; font-weight: 700; }
.cg > button:hover { background: var(--hueso-2); }
.cg > button i { font-style: normal; font-weight: 800; }
.cg-lista { display: none; padding: 0 0 6px; }
.cg.abierto .cg-lista { display: block; }
.cg-item { display: block; width: 100%; text-align: left; padding: 5px 13px 5px 24px; font-size: 12px; font-weight: 600; color: var(--gris); }
.cg-item:hover { color: var(--negro); background: var(--hueso-2); }
.cg-item.on { color: var(--negro); }
.cg-item.on::before { content: "\25AA  "; }

/* ---------------- modal ---------------- */

.modal { position: fixed; inset: 0; z-index: 1000; background: rgba(20,19,15,.5); display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-caja { background: var(--hueso); border: var(--borde); box-shadow: 10px 10px 0 rgba(20,19,15,.25); width: 100%; max-width: 400px; padding: 20px 22px 22px; }
.modal-caja h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.modal-caja p { font-size: 13.5px; line-height: 1.55; margin: 0 0 14px; }
.modal-caja .paso { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--gris); text-transform: uppercase; }
.modal-caja .cerrar { margin-top: 16px; background: var(--negro); color: var(--hueso); padding: 8px 16px; font-weight: 800; }

/* ---------------- celular ---------------- */

@media (max-width: 780px) {
  .top { flex-wrap: wrap; }
  .top-marca { flex: 1; }
  .top-reportar { flex: none; }
  .top-buscar { flex-basis: 100%; order: 3; border-right: 0; border-top: 2px solid var(--negro-2); height: 40px; }
  .panel {
    left: 0; right: 0; bottom: 0; width: auto; max-height: none; height: 44vh;
    border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none;
  }
  .app { overflow: hidden; }
  #mapa { bottom: 44vh; }
  .capas-btn, .capas-panel { right: 0; left: 0; width: auto; }
  .capas-panel { max-height: 60%; }
}
