:root {
  --navy: #0a3050;
  --navy-2: #12486f;
  --accent: #1a7ab0;
  --red: #c1121f;
  --bg: #eef3f7;
  --card: #ffffff;
  --ink: #1c2b36;
  --muted: #5c6b7a;
  --line: #d5dee6;
  --ok: #1f7a4d;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.flag {
  height: 4px;
  background: linear-gradient(90deg, #d91023 0 33%, #fff 33% 67%, #d91023 67% 100%);
}
.top {
  background: var(--navy);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  background: #d91023;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.top h1 { margin: 0; font-size: 18px; font-weight: 700; }
.top p { margin: 2px 0 0; color: #c5d8e8; font-size: 12px; }
.kpis { display: flex; gap: 8px; flex-wrap: wrap; }
.kpi {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 92px;
}
.kpi b { display: block; font-size: 18px; }
.kpi span { font-size: 11px; color: #c5d8e8; }
.toolbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 8px 14px 10px;
}
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumb button {
  background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0;
}
.crumb button:hover { text-decoration: underline; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input, select, button.tab {
  font: 13px/1.3 "Segoe UI", system-ui, sans-serif;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
}
input[type=search] { min-width: 180px; flex: 1; }
#fil-depto, #fil-prov, #fil-dist, #anio, #tipo, #fil-n-eventos { max-width: 180px; }
#fil-colegio { max-width: 240px; min-width: 160px; }
.chk {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; white-space: nowrap;
}
.btn-reset {
  font: 13px/1.3 "Segoe UI", system-ui, sans-serif;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}
.btn-reset:hover { background: #f4f8fb; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab { cursor: pointer; background: #f3f6f9; }
.tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
main { flex: 1; position: relative; min-height: 0; }
.vista { display: none; height: 100%; }
.vista.on { display: block; }
#vista-mapa { position: relative; }
#mapa { height: 100%; background: #d9e4ee; }
.panel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: min(380px, calc(100% - 24px));
  max-height: calc(100% - 84px);
  overflow: auto;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(10,48,80,.18);
  padding: 14px;
  z-index: 500;
}
.panel h2 { margin: 0 0 4px; font-size: 16px; }
.panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.panel .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.mini div {
  background: #f4f8fb;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}
.mini b { display: block; font-size: 16px; color: var(--navy); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.item {
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
}
.item b { display: block; }
.tag {
  display: inline-block;
  background: #e8f3fb;
  color: var(--navy-2);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  margin-right: 4px;
}
.leyenda {
  position: absolute;
  left: 12px;
  bottom: 22px;
  background: var(--card);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  box-shadow: 0 6px 18px rgba(10,48,80,.14);
  z-index: 500;
}
.leyenda .row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.sw { width: 14px; height: 12px; border-radius: 2px; border: 1px solid #c9d4de; }
.tabla-wrap { height: 100%; overflow: auto; padding: 10px 14px 18px; }
.tabla-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
}
.tabla-toolbar .hint { margin: 0; flex: 1; }
.tabla-acciones { display: flex; gap: 8px; flex-shrink: 0; }
.btn-export {
  flex-shrink: 0;
  font: 13px/1.3 "Segoe UI", system-ui, sans-serif;
  border: 1px solid var(--navy);
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn-export:hover { background: var(--navy-2); }
.btn-mapa {
  font: 12px/1.2 "Segoe UI", system-ui, sans-serif;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 5px 9px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn-mapa:hover { background: #e8f3fb; }
.fila-pron { cursor: pointer; }
.fila-pron td.periodo { white-space: nowrap; font-weight: 600; color: var(--navy); }
.fila-pron.abierta td { background: #e8f3fb; }
.fila-detalle td {
  background: #f8fbfd;
  padding: 0 10px 12px 42px;
}
.tabla-detalle { margin: 8px 0 4px; border: 1px solid var(--line); }
.tabla-detalle th { position: static; background: #e8eef3; color: var(--navy); font-size: 12px; }
.chk-col { width: 36px; text-align: center; }
.chk-col input { cursor: pointer; width: 16px; height: 16px; }
#vista-eventos .dataTables_wrapper { font-size: 13px; }
#vista-eventos table.dataTable thead th { position: sticky; }
#vista-eventos .dataTables_filter input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
}
#vista-eventos .dataTables_paginate .paginate_button.current {
  background: var(--navy) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
}
.lista-zona { margin: 8px 0 0; padding: 0; list-style: none; }
.lista-zona li {
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.lista-zona li:hover { color: var(--accent); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--navy); color: #fff; font-weight: 600; }
tr:hover td { background: #f4f8fb; }
.carga {
  position: fixed; inset: 0;
  background: rgba(10,48,80,.72);
  color: #fff;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 2000;
}
.carga.off { display: none; }
.spinner {
  width: 42px; height: 42px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.confianza-alta { color: #b42318; font-weight: 700; }
.confianza-media { color: #b7791f; font-weight: 700; }
.confianza-baja { color: var(--muted); }
.btn-evento {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  cursor: pointer;
  font: 13px/1.35 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}
.btn-evento:hover { background: #f4f8fb; border-color: var(--accent); }
.btn-evento strong { display: block; color: var(--navy); }
.btn-evento span { color: var(--muted); font-size: 12px; }
.btn-pdf {
  display: inline-block;
  margin: 8px 0 4px;
  background: var(--navy);
  color: #fff !important;
  text-decoration: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}
.btn-pdf:hover { background: var(--navy-2); }
.campo { font-size: 13px; margin: 6px 0; }
.campo .k { color: var(--muted); font-size: 11px; display: block; }
.item.click { cursor: pointer; border-radius: 8px; padding: 8px 6px; margin: 0 -6px; }
.item.click:hover { background: #f4f8fb; }
.item.click.on { background: #e8f3fb; }
.btn-volver {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font: 12px "Segoe UI", sans-serif; padding: 0; margin-bottom: 8px;
}
.btn-volver:hover { text-decoration: underline; }
.pron-box {
  background: #f4f8fb;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 12px;
}
.pron-box.alta { border-left-color: #c1121f; }
.pron-box.media { border-left-color: #b7791f; }
.pron-box.baja { border-left-color: #8aa0b3; }
.pron-box .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pron-box .tit { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.pron-box .det { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pdf-item { font-size: 12px; word-break: break-all; }
.pdf-item .nom { font-family: Consolas, "Cascadia Mono", monospace; font-size: 11px; }
@media (max-width: 900px) {
  .top { flex-direction: column; align-items: flex-start; }
  .panel { position: static; width: auto; max-height: 40%; margin: 0; border-radius: 0; }
  #vista-mapa { display: flex; flex-direction: column; }
  #mapa { flex: 1; min-height: 280px; }
}
