:root {
  --bg: #1b2733;
  --bg2: #22303d;
  --txt: #eef3f7;
  --muted: #9fb0bd;
  --primary: #e8523f;
  --primary-d: #c63d2c;
  --linea: #33454f;
  --ok: #27ae60;
  --warn: #f1c40f;
  --sombra: 0 6px 24px rgba(0,0,0,.35);
  --radio: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--txt);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
a { color: #7fd1ff; }

/* Banner */
.banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #2a3b49, #1b2733);
  border-bottom: 1px solid var(--linea);
  padding: 8px 12px; min-height: 52px;
}
.banner__txt { display: flex; flex-direction: column; line-height: 1.25; font-size: .82rem; }
.banner__txt strong { font-size: .95rem; }
.banner__txt span { color: var(--muted); }
.banner__txt b { color: var(--warn); }
.banner__help {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: #33454f; color: var(--txt); border: 1px solid var(--linea);
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
}

/* Mapa */
#mapa { position: fixed; inset: 52px 0 0 0; background: #2b3a46; }
.leaflet-container { background: #2b3a46; font-family: inherit; }

/* Marcadores personalizados */
.mk {
  width: var(--sz); height: var(--sz);
  margin-left: calc(var(--sz) / -2); margin-top: calc(var(--sz) / -2);
  border-radius: 50%;
  background: var(--c);
  opacity: var(--op);
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  display: grid; place-items: center;
  font-size: calc(var(--sz) * .52); line-height: 1;
}
.mk--verificado { border-width: 3px; border-color: #fff; box-shadow: 0 0 0 3px rgba(192,57,43,.45), 0 2px 8px rgba(0,0,0,.5); }
.mk--no_verificado { border-style: dashed; }
.mk__glyph { filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }

/* Botones flotantes */
.fab-col { position: fixed; right: 14px; bottom: 18px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.fab {
  border: none; border-radius: 28px; cursor: pointer; font-size: 1rem; font-weight: 700;
  box-shadow: var(--sombra); color: #fff;
}
.fab--primary { background: var(--primary); padding: 14px 20px; }
.fab--primary:active { background: var(--primary-d); }
.fab--ghost { width: 48px; height: 48px; background: #2a3b49; border: 1px solid var(--linea); color: var(--txt); font-size: 1.3rem; }

/* Leyenda */
.leyenda-toggle {
  position: fixed; left: 14px; bottom: 18px; z-index: 1100;
  background: #2a3b49; color: var(--txt); border: 1px solid var(--linea);
  border-radius: 20px; padding: 9px 14px; font-size: .85rem; font-weight: 600; cursor: pointer; box-shadow: var(--sombra);
}
.leyenda {
  position: fixed; left: 14px; bottom: 64px; z-index: 1100; width: min(86vw, 320px);
  background: var(--bg2); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 14px 16px; box-shadow: var(--sombra); font-size: .85rem;
}
.leyenda h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 6px; }
.leyenda h2:first-child { margin-top: 0; }
.leyenda ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.leyenda__tipos { grid-template-columns: 1fr 1fr; }
.dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); vertical-align: -2px; }
.dot--v { border-width: 2px; box-shadow: 0 0 0 2px rgba(192,57,43,.5); }
.leyenda__nota { color: var(--muted); margin: 10px 0 0; font-size: .8rem; }

/* Modales y paneles */
.modal, .panel {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(8,12,16,.72); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.panel { align-items: flex-end; }
.modal__caja, .panel__caja {
  background: var(--bg2); border: 1px solid var(--linea); border-radius: 18px;
  width: min(540px, 100%); max-height: 88vh; overflow-y: auto; box-shadow: var(--sombra); padding: 20px;
}
.panel__caja { border-radius: 18px 18px 0 0; padding: 16px 18px 24px; }
.modal__caja h1 { margin: 0 0 10px; font-size: 1.4rem; }
.aviso__lista { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; font-size: .95rem; line-height: 1.35; }
.aviso__desap { background: #1f2c38; border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.panel__head h2 { margin: 0; font-size: 1.2rem; }
.panel__x { background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 4px 8px; }

/* Formulario */
.form__campo { border: none; padding: 0; margin: 0 0 18px; }
.form__campo legend { font-weight: 700; font-size: .95rem; padding: 0; margin-bottom: 8px; color: var(--txt); }
.ubic-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.ubic-estado { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.ubic-estado.ok { color: var(--ok); font-weight: 600; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cats label { position: relative; }
.cats input { position: absolute; opacity: 0; }
.cats span {
  display: block; padding: 11px 10px; border: 1px solid var(--linea); border-radius: 10px;
  background: #1f2c38; font-size: .9rem; cursor: pointer; text-align: center;
}
.cats--2 { grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
.rescate-q { font-size: .9rem; margin: 12px 0 6px; color: var(--txt); }
input[type="tel"], #repEquipoCual { width: 100%; background: #1f2c38; color: var(--txt); border: 1px solid var(--linea); border-radius: 10px; padding: 11px; font: inherit; font-size: .95rem; margin-bottom: 8px; }
.cats input:checked + span { border-color: var(--primary); background: #33272a; box-shadow: 0 0 0 1px var(--primary) inset; }
.cats input:focus-visible + span { outline: 2px solid #7fd1ff; }
textarea {
  width: 100%; background: #1f2c38; color: var(--txt); border: 1px solid var(--linea);
  border-radius: 10px; padding: 10px; font: inherit; font-size: .95rem; resize: vertical;
}
.pii-aviso { color: var(--warn); font-size: .85rem; margin: 8px 0 0; line-height: 1.3; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__nota { color: var(--muted); font-size: .82rem; margin: 10px 0 0; line-height: 1.35; }

/* Botones */
.btn { border: none; border-radius: 11px; padding: 13px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.btn--primary { background: var(--primary); color: #fff; width: 100%; font-size: 1.02rem; }
.btn--primary:disabled { background: #4a3a38; color: #9b8b88; cursor: not-allowed; }
.btn--primary:active:not(:disabled) { background: var(--primary-d); }
.btn--mini { background: #2a3b49; color: var(--txt); border: 1px solid var(--linea); padding: 11px 14px; font-size: .9rem; flex: 1; }
.btn--mini.activo { border-color: var(--primary); background: #33272a; }

/* Popup */
.leaflet-popup-content-wrapper { background: var(--bg2); color: var(--txt); border-radius: 12px; }
.leaflet-popup-tip { background: var(--bg2); }
.leaflet-popup-content { margin: 12px 14px; font-size: .9rem; line-height: 1.4; min-width: 210px; }
.pop__badge { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .03em; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.pop__badge--nv { background: #57606a; color: #fff; }
.pop__badge--v { background: var(--primary); color: #fff; }
.pop__tit { font-weight: 700; font-size: 1rem; margin: 8px 0 2px; }
.pop__meta { color: var(--muted); font-size: .82rem; margin: 2px 0; }
.pop__desc { margin: 8px 0; }
.pop__aprox { color: var(--warn); font-size: .78rem; }
.pop__votos { display: flex; gap: 8px; margin-top: 10px; }
.pop__votos button { flex: 1; border: 1px solid var(--linea); background: #1f2c38; color: var(--txt); border-radius: 9px; padding: 9px; font-weight: 700; cursor: pointer; font-size: .85rem; }
.pop__votos .si:active { background: #1d3a28; border-color: var(--ok); }
.pop__votos .no:active { background: #3a1d1d; }
.pop__conteo { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.pop__testigos { font-size: .82rem; color: #6fc28a; font-weight: 600; margin: 6px 0; }
.pop__dup { font-size: .8rem; color: var(--muted); font-style: italic; margin: 4px 0; }

/* Lista */
.lista { display: grid; gap: 16px; }
.lista__sector h3 { margin: 0 0 8px; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--linea); padding-bottom: 5px; }
.lista__item { background: #1f2c38; border: 1px solid var(--linea); border-radius: 11px; padding: 11px 12px; margin-bottom: 8px; }
.lista__item h4 { margin: 0 0 3px; font-size: .95rem; display: flex; align-items: center; gap: 7px; }
.lista__item .pop__meta { margin: 3px 0; }
.lista__votos { display: flex; gap: 8px; margin-top: 8px; }
.lista__votos button { flex: 1; border: 1px solid var(--linea); background: #25323e; color: var(--txt); border-radius: 8px; padding: 8px; font-weight: 700; cursor: pointer; font-size: .82rem; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 2000;
  background: #11181f; color: #fff; border: 1px solid var(--linea); border-radius: 10px;
  padding: 11px 16px; font-size: .9rem; box-shadow: var(--sombra); max-width: 90vw; text-align: center;
}
.toast--ok { border-color: var(--ok); }
.toast--err { border-color: var(--primary); }

@media (min-width: 720px) {
  .panel { align-items: center; }
  .panel__caja { border-radius: 18px; }
  .cats { grid-template-columns: 1fr 1fr 1fr; }
}
