/* UDS SkyPlanner — estilos (versión oscura de la marca, según la maqueta aprobada). */
:root {
  --fondo: #0b0d12;
  --panel: #12151c;
  --caja: #0f1218;
  --caja-2: #181c25;
  --borde: #262b38;
  --borde-2: #343a4a;
  --texto: #e8eaf0;
  --texto-2: #d6dae4;
  --suave: #a3abbd;
  --tenue: #8b93a6;
  --naranja: #f47920;
  --azul: #5aa9ff;
  --azul-2: #3d8bff;
  --amarillo: #ffd23f;
  --rojo: #ff7a5c;
  --ambar: #f9a54c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Aktiv Grotesk', system-ui, sans-serif;
}
a { color: #ffb070; }
a:hover { color: #ffd2ad; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
[hidden] { display: none !important; }

.app { display: flex; height: 100vh; overflow: hidden; }

/* Panel lateral */
.panel {
  flex: 1 1 380px; max-width: 400px; min-width: 300px; height: 100%;
  background: var(--panel); border-right: 1px solid var(--borde);
  display: flex; flex-direction: column; overflow-y: auto;
}
.encabezado {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--borde);
  display: flex; align-items: center; gap: 12px;
}
.encabezado img { width: 44px; height: 44px; object-fit: contain; }
.marca { font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.modo-dev {
  margin-left: auto; font-size: 11px; color: var(--ambar);
  border: 1px dashed var(--ambar); border-radius: 6px; padding: 2px 6px;
}
.seccion {
  padding: 16px 20px; display: flex; flex-direction: column; gap: 10px;
  border-bottom: 1px solid var(--borde);
}
.seccion-capas { border-bottom: none; gap: 8px; }
.rotulo { font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: 0.08em; }
.ayuda { font-size: 12px; color: var(--suave); }
.ayuda-larga { font-size: 12.5px; line-height: 1.45; }
.mensaje { font-size: 13px; color: var(--ambar); }
.mensaje:empty { display: none; }
.error { color: var(--rojo); font-size: 13px; }

/* Buscador */
.buscador { display: flex; gap: 8px; margin: 0; }
.buscador input {
  flex-grow: 1; min-width: 0; height: 44px; padding: 0 14px;
  background: var(--fondo); border: 1px solid var(--naranja); border-radius: 10px;
  color: var(--texto); font-size: 15px;
}
.buscador button {
  width: 44px; height: 44px; flex: none; border-radius: 10px; border: none;
  background: var(--naranja); color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
}
.resultados {
  list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--borde-2); border-radius: 10px; background: var(--caja);
}
.resultados button {
  width: 100%; min-height: 40px; text-align: left; padding: 6px 10px; border-radius: 8px;
  border: none; background: transparent; color: var(--texto);
  display: flex; flex-direction: column; gap: 2px;
}
.resultados button:hover, .resultados button:focus-visible { background: rgba(244, 121, 32, 0.12); }
.resultados .detalle { font-size: 12px; color: var(--suave); }

/* Categorías */
.categorias { display: flex; flex-direction: column; gap: 6px; }
.categoria {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  min-height: 44px; padding: 10px 12px; border-radius: 10px;
  background: transparent; color: var(--texto-2); border: 1px solid var(--borde-2);
}
.categoria[aria-pressed="true"] {
  background: rgba(244, 121, 32, 0.14); color: #ffe3cc; border: 2px solid var(--naranja);
}
.categoria .titulo-cat { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; flex-wrap: wrap; }
.categoria .para { font-weight: 400; font-size: 12.5px; opacity: 0.85; }
.categoria .desc { font-size: 12.5px; line-height: 1.45; opacity: 0.9; }
.altura { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--texto-2); }
.altura input {
  width: 96px; height: 40px; padding: 0 10px; border-radius: 10px;
  background: var(--fondo); border: 1px solid var(--borde-2); color: var(--texto); font-size: 15px;
}

/* Dictamen */
.dictamen {
  border: 1px solid var(--borde-2); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; background: var(--caja);
}
.dictamen.vacio { border-style: dashed; }
.dictamen.PUEDE_VOLAR { border-color: var(--azul); }
.dictamen.CONDICIONADO { border-color: var(--ambar); }
.dictamen.NO_PUEDE { border-color: var(--rojo); }
.dictamen-cabeza { display: flex; align-items: center; gap: 12px; }
.dictamen-cabeza svg { flex: none; }
.dictamen-titulo { font-size: 20px; font-weight: 700; }
.dictamen-lugar { font-size: 13px; color: var(--suave); overflow-wrap: anywhere; }
.bloque { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--borde); padding-top: 10px; }
.bloque-titulo { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.bloque-vuelo .bloque-titulo { color: #cfe2ff; }
.bloque-seguridad .bloque-titulo { color: #ffd2ad; }
.bloque-sub { font-size: 12px; color: var(--tenue); }
.bloque ul {
  margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px;
  font-size: 14px; line-height: 1.45; color: var(--texto-2);
}
.bloque li { display: flex; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.nivel { flex: none; font-size: 12px; width: 14px; text-align: center; }
.nivel.NO_APTO { color: var(--rojo); }
.nivel.CONDICIONADO { color: var(--ambar); }
.nivel.INFO { color: var(--azul); }
.requisitos { font-size: 13px; color: var(--suave); border-top: 1px solid var(--borde); padding-top: 10px; line-height: 1.45; }
.requisitos ul { margin: 4px 0 0; padding-left: 18px; }
.fechas { font-size: 12px; color: var(--tenue); }
.cargando { font-size: 14px; color: var(--suave); }

/* Capas */
.boton-capas {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--naranja); background: var(--caja-2);
  color: var(--texto); font-size: 14px; width: 100%;
}
.boton-capas #resumenCapas { flex-grow: 1; text-align: left; }
.boton-capas #flechaCapas { font-size: 12px; }
.lista-capas {
  border: 1px solid var(--borde-2); border-radius: 10px; background: var(--caja);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.acciones-capas { display: flex; gap: 8px; padding: 4px 6px 8px; }
.acciones-capas button {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--borde-2);
  background: transparent; color: var(--texto-2); font-size: 12.5px;
}
.casilla {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px;
  border-radius: 8px; font-size: 13.5px; cursor: pointer; color: var(--texto);
}
.casilla input { width: 18px; height: 18px; flex: none; accent-color: var(--naranja); }
.casilla .glifo { width: 20px; flex: none; display: flex; justify-content: center; color: var(--amarillo); }
.casilla .nombre { flex-grow: 1; }
.casilla .fuente { font-size: 11.5px; color: var(--tenue); text-align: right; }
.casilla .fuente.cargando-capa { color: var(--ambar); }
.casilla.deshabilitada { opacity: 0.45; cursor: not-allowed; }

.pie {
  margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--borde);
  font-size: 11.5px; line-height: 1.5; color: var(--suave);
}
.pie-marca { color: #c9cfdc; }

/* Mapa */
.zona-mapa { flex: 999 1 560px; min-width: 0; height: 100%; position: relative; background: #0d1a14; }
/* Con id para ganarle a `.maplibregl-map { position: relative }`: el lienzo necesita altura real desde el inicio. */
#mapa.mapa { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.controles {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.base, .zoom {
  display: flex; background: rgba(18, 21, 28, 0.92); border: 1px solid var(--borde-2);
  border-radius: 10px; overflow: hidden;
}
.zoom { flex-direction: column; }
.base button { height: 40px; padding: 0 14px; border: none; background: transparent; color: var(--texto); }
.base button[aria-pressed="true"] { background: var(--naranja); color: #1a1a1a; font-weight: 700; }
.zoom button { width: 44px; height: 44px; border: none; background: transparent; color: var(--texto); font-size: 20px; }
.zoom button + button { border-top: 1px solid var(--borde-2); }
.aviso-mapa {
  position: absolute; top: 16px; left: 16px; z-index: 2; max-width: calc(100% - 200px);
  padding: 8px 12px; background: rgba(18, 21, 28, 0.92); border: 1px dashed var(--naranja);
  border-radius: 10px; font-size: 13px; color: #ffd2ad;
}
.maplibregl-ctrl-attrib { font-size: 11px; }
.punto-consulta { width: 36px; height: 49px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }

/* Carga de archivos */
.boton-cargar {
  min-height: 44px; padding: 0 14px; border-radius: 10px; width: 100%;
  border: 1px solid var(--azul-2); background: transparent; color: #cfe2ff; font-size: 14px; font-weight: 600;
}
.boton-cargar:hover, .boton-cargar:focus-visible { background: rgba(61, 139, 255, 0.12); }
.soltar {
  position: absolute; inset: 12px; z-index: 4; pointer-events: none;
  border: 2px dashed var(--naranja); border-radius: 14px; background: rgba(11, 13, 18, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center;
}
.soltar span {
  padding: 10px 16px; background: rgba(18, 21, 28, 0.94); border: 1px dashed var(--naranja);
  border-radius: 10px; font-size: 15px; color: #ffd2ad;
}

/* Lote: panel inferior sobre el mapa (maqueta aprobada) */
.lote {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 3;
  background: rgba(18, 21, 28, 0.96); border: 1px solid var(--borde-2); border-radius: 14px;
  display: flex; flex-direction: column; max-height: min(320px, 55%); min-height: 0;
}
.lote-cabeza {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--borde);
}
.lote-titulo { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.lote-datos { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lote-resumen { font-size: 13px; color: var(--suave); }
.lote-categoria { font-size: 12px; color: var(--tenue); }
.lote-categoria:empty { display: none; }
.lote-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.lote-cabeza button { height: 40px; padding: 0 14px; border-radius: 10px; }
.lote-exportar { border: 1px solid var(--azul-2); background: transparent; color: #cfe2ff; }
.lote-sheets { border: none; background: var(--naranja); color: #1a1a1a; font-weight: 700; }
.lote-cabeza button:disabled { opacity: 0.45; cursor: not-allowed; }
.lote-boton { border: 1px solid var(--borde-2); background: transparent; color: var(--texto-2); }
#loteCerrar { width: 40px; padding: 0; }
.lote-avance { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13px; color: var(--texto-2); }
.lote-avance progress { flex-grow: 1; height: 8px; accent-color: var(--naranja); }
.lote-mensaje { padding: 8px 16px 0; }
.lote-mensaje:empty { display: none; }
.lote-reintentar {
  height: 36px; padding: 0 14px; margin: 4px 0; border-radius: 10px;
  border: none; background: var(--naranja); color: #1a1a1a; font-weight: 700;
}
.lote-cuerpo { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.lote-sin { padding: 8px 16px; border-bottom: 1px solid var(--borde); font-size: 13px; color: var(--ambar); }
.lote-sin summary { cursor: pointer; min-height: 28px; }
.lote-sin ul { margin: 6px 0 0; padding-left: 18px; color: var(--texto-2); max-height: 96px; overflow-y: auto; }
.lote-tabla { overflow: auto; min-height: 0; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.lote-tabla table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.lote-tabla thead th {
  position: sticky; top: 0; background: #151922; color: var(--suave); text-align: left;
  padding: 8px; font-weight: 500;
}
.lote-tabla th:first-child, .lote-tabla td:first-child { padding-left: 16px; }
.lote-tabla th:last-child, .lote-tabla td:last-child { padding-right: 16px; }
.lote-tabla tbody tr { cursor: pointer; border-top: 1px solid #222734; }
.lote-tabla tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
.lote-tabla tbody tr.elegida { background: rgba(244, 121, 32, 0.12); }
.lote-tabla tbody tr:focus-visible { outline: 2px solid var(--naranja); outline-offset: -2px; }
.lote-tabla td { padding: 8px; vertical-align: top; }
.col-sitio { width: 1%; min-width: 120px; max-width: 240px; }
.sitio-id { font-weight: 700; display: block; overflow-wrap: anywhere; }
.sitio-nombre { display: block; font-size: 12px; color: var(--suave); overflow-wrap: anywhere; }
.col-municipio, .col-dictamen { white-space: nowrap; width: 1%; }
.col-motivo { color: #c9cfdc; min-width: 300px; }
.chip {
  display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px;
  border: 1px solid currentColor; font-weight: 600;
}
.chip.PUEDE_VOLAR { color: var(--azul); }
.chip.CONDICIONADO { color: var(--ambar); }
.chip.NO_PUEDE { color: var(--rojo); }
.chip.chip-error { color: var(--tenue); }
.chip-icono { display: inline-flex; }
.chip-icono svg { width: 16px; height: 16px; }

/* Entrada con Google */
.entrada {
  position: fixed; inset: 0; z-index: 10; background: rgba(11, 13, 18, 0.94);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.caja-entrada {
  background: var(--panel); border: 1px solid var(--borde-2); border-radius: 14px;
  padding: 24px; max-width: 360px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.caja-entrada .error:empty { display: none; }

/* Celular: el panel pasa debajo del mapa. */
@media (max-width: 767px) {
  .app { flex-direction: column; height: auto; overflow: visible; }
  .zona-mapa { order: 1; flex: none; width: 100%; height: 55vh; }
  .panel { order: 2; flex: none; width: 100%; max-width: none; min-width: 0; height: auto; overflow: visible; border-right: none; }
  body { overflow-x: hidden; }
  .seccion, .encabezado, .pie { padding-left: 16px; padding-right: 16px; }
  .aviso-mapa { max-width: calc(100% - 32px); top: auto; bottom: 28px; }
  .lote { left: 8px; right: 8px; bottom: 8px; max-height: 80%; }
  .lote-cabeza { gap: 6px; padding: 8px 12px; }
  .lote-titulo { font-size: 14px; }
  .lote-resumen { font-size: 12px; }
  .lote-acciones { margin-left: 0; gap: 6px; }
  .lote-cabeza button { height: 36px; padding: 0 10px; font-size: 12.5px; }
  #loteCerrar { width: 36px; }
}
