* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: "Segoe UI", Roboto, Arial, sans-serif; color: #222; }
body { display: flex; flex-direction: column; }

/* ---------- Cabecera ---------- */
#cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 14px; background: #fff; border-bottom: 3px solid #2e6b3a;
  min-height: 56px; z-index: 1000;
}
#titulo { margin: 0; font-size: 1.15rem; font-weight: 600; }
#logos { display: flex; align-items: center; gap: 12px; }
#logos img { height: 42px; width: auto; display: block; }

#mapa { flex: 1; }

/* ---------- Controles propios ---------- */
.ctl-boton {
  display: flex !important; align-items: center; justify-content: center;
  width: 34px; height: 34px; font-size: 17px; line-height: 1;
  background: #fff; color: #333; cursor: pointer; text-decoration: none;
}
.ctl-boton:hover { background: #f2f2f2; }
.ctl-boton.activo { background: #2e6b3a; color: #fff; }

/* Buscador */
.ctl-buscar { background: #fff; border-radius: 6px; padding: 6px; width: 260px; }
.ctl-buscar input {
  width: 100%; padding: 7px 9px; font-size: 14px;
  border: 1px solid #bbb; border-radius: 4px;
}
.ctl-buscar ul { list-style: none; margin: 4px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ctl-buscar li { padding: 6px 8px; cursor: pointer; border-bottom: 1px solid #eee; font-size: 13px; }
.ctl-buscar li:hover, .ctl-buscar li.sel { background: #e8f1ea; }
.ctl-buscar li small { color: #777; display: block; }
.ctl-buscar .sin-resultados { color: #888; cursor: default; }

/* Coordenadas */
.ctl-coords { background: rgba(255,255,255,.85); padding: 2px 6px; font-size: 12px; border-radius: 3px; }

/* Panel de medición */
#panel-medida {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 1000; background: #fff; border-radius: 6px; padding: 8px 12px;
  box-shadow: 0 1px 5px rgba(0,0,0,.35); font-size: 14px; text-align: center;
}
#panel-medida b { font-size: 16px; }
#panel-medida small { display: block; color: #666; margin-top: 2px; }
#panel-medida button { margin-top: 6px; padding: 4px 10px; cursor: pointer; }
.etiqueta-medida {
  background: #2e6b3a; color: #fff; border: none; font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.etiqueta-medida::before { display: none; }
.medir-activo { cursor: crosshair !important; }

/* ---------- Ventana de consulta ---------- */
.ficha h3 { margin: 0 0 6px; font-size: 15px; padding-right: 14px; }
.ficha table { border-collapse: collapse; width: 100%; font-size: 13px; margin-bottom: 8px; }
.ficha td { padding: 3px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
.ficha td:first-child { color: #666; white-space: nowrap; width: 1%; }
.ficha .logo-entidad { text-align: center; margin: 6px 0 8px; }
.ficha .logo-entidad img { max-height: 50px; max-width: 160px; }
.ficha .fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ficha figure { margin: 0; }
.ficha figure img {
  width: 100%; height: 95px; object-fit: cover; border-radius: 4px;
  cursor: zoom-in; display: block; background: #eee;
}
.ficha figcaption { font-size: 12px; text-align: center; color: #555; margin-top: 2px; }
.ficha .capa { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 20px;
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 95%; max-height: 85%; box-shadow: 0 0 20px #000; }
#lightbox-pie { color: #fff; margin-top: 10px; font-size: 15px; }

/* ---------- Aviso ---------- */
#aviso {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 2000;
  background: #b3261e; color: #fff; padding: 10px 16px; border-radius: 6px;
  max-width: 90%; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  #titulo { font-size: .95rem; }
  #logos img { height: 30px; }
  .ctl-buscar { width: 190px; }
  .ctl-coords { display: none; }
}
