/* Elecciones 27 · hoja de estilos (sin estilos en línea por la política de seguridad) */
:root {
  --marca: #14284b;
  --acento: #2563eb;
  --fondo: #f3f5f9;
  --papel: #ffffff;
  --tinta: #101828;
  --tinta2: #475467;
  --tinta3: #667085;
  --linea: #e4e7ec;
  --rejilla: #eef0f4;
  --ok: #067647;
  --mal: #b42318;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .05);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: .35rem 0; }
p { margin: .35rem 0 .7rem; }
code { background: var(--rejilla); border-radius: 6px; padding: 2px 6px; word-break: break-all; }
.suave { color: var(--tinta3); font-size: .86rem; }
.ok-texto { color: var(--ok); font-weight: 600; }
.error-texto { color: var(--mal); font-weight: 600; }
.centrado { text-align: center; }

/* ---------- barra ---------- */
.barra {
  position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 1rem;
  background: var(--marca); color: #fff; padding: .55rem 1rem;
  padding-top: max(.55rem, env(safe-area-inset-top));
}
.marca { display: flex; align-items: center; gap: .6rem; color: #fff; min-width: 0; }
.marca:hover { text-decoration: none; }
.marca img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.marca span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.marca small { opacity: .8; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44vw; }
.sello {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: #fff; color: var(--marca); font-weight: 800; font-size: 1.05rem; flex: none;
}
.sello.grande { width: 64px; height: 64px; font-size: 1.7rem; border-radius: 18px; background: var(--marca); color: #fff; }
.menu { display: flex; gap: .25rem; margin-left: auto; }
.menu a { color: #fff; opacity: .78; padding: .45rem .8rem; border-radius: 999px; display: flex; gap: .4rem; font-weight: 600; font-size: .9rem; }
.menu a i { font-style: normal; }
.menu a:hover { opacity: 1; text-decoration: none; background: rgba(255, 255, 255, .1); }
.menu a.activo { opacity: 1; background: rgba(255, 255, 255, .18); }
.perfil { position: relative; }
.perfil summary {
  list-style: none; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); font-weight: 700;
}
.perfil summary::-webkit-details-marker { display: none; }
.desplegable {
  position: absolute; right: 0; top: 46px; width: 260px; background: var(--papel); color: var(--tinta);
  border-radius: var(--radio); box-shadow: 0 12px 40px rgba(16, 24, 40, .25); padding: .8rem; display: flex; flex-direction: column; gap: .25rem;
  max-height: 75vh; overflow: auto;
}
.desplegable a { color: var(--tinta); padding: .45rem .3rem; border-radius: 8px; }
.desplegable a:hover { background: var(--rejilla); text-decoration: none; }
.desplegable small { color: var(--tinta3); }

.contenedor { max-width: 1060px; margin: 0 auto; padding: 1rem; }
.panel { max-width: 1400px; margin: 0 auto; padding: 1rem; }
body.con-sesion main { padding-bottom: 3rem; }

/* ---------- piezas ---------- */
.tarjeta { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem; min-width: 0; }
.tarjeta.estrecha { max-width: 520px; margin-left: auto; margin-right: auto; }
.tarjeta.acceso { max-width: 380px; margin: 8vh auto; text-align: center; }
.tarjeta.acceso label { text-align: left; }
.tarjeta.enlace { display: flex; flex-direction: column; gap: .2rem; color: var(--tinta); }
.encabezado { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.encabezado h1, .encabezado h2 { margin: 0; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.rejilla > .tarjeta { margin: 0; }

.btn {
  appearance: none; border: 1px solid var(--linea); background: var(--papel); color: var(--tinta);
  border-radius: 10px; padding: .6rem 1rem; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: .35rem; min-height: 42px;
}
.btn:hover { background: var(--rejilla); text-decoration: none; }
.btn.primario { background: var(--marca); border-color: var(--marca); color: #fff; }
.btn.primario:hover { filter: brightness(1.15); }
.btn.peligro { color: var(--mal); border-color: #fecdca; }
.btn.chico { padding: .3rem .65rem; min-height: 34px; font-size: .84rem; }
.btn.bloque { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.botones { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .84rem; color: var(--tinta2); margin-bottom: .6rem; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--tinta); background: var(--papel); border: 1px solid #d0d5dd;
  border-radius: 10px; padding: .55rem .65rem; min-height: 42px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #93b4f8; outline-offset: 1px; }
input[type=color] { padding: 3px; height: 44px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--marca); margin: 0; flex: none; }
input[type=range] { padding: 0; border: 0; min-height: 32px; }
label.check { flex-direction: row; align-items: center; gap: .5rem; cursor: pointer; }
fieldset { border: 1px solid var(--linea); border-radius: 12px; margin: 0 0 .9rem; padding: .7rem .8rem; min-width: 0; }
legend { font-weight: 700; font-size: .85rem; padding: 0 .35rem; }
.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 .8rem; }
.filtros { display: flex; flex-wrap: wrap; gap: 0 .8rem; align-items: flex-end; }
.filtros > label { flex: 1 1 140px; }
.filtros > label.check { flex: 0 0 auto; min-height: 42px; }
.filtros > .botones { margin-bottom: .6rem; }

.rejilla-checks { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 220px; overflow: auto; }
label.chip { margin: 0; cursor: pointer; position: relative; }
label.chip input { position: absolute; opacity: 0; pointer-events: none; }
label.chip span { display: inline-block; border: 1px solid #d0d5dd; border-radius: 999px; padding: .35rem .8rem; font-size: .84rem; background: var(--papel); user-select: none; }
label.chip input:checked + span { background: var(--marca); border-color: var(--marca); color: #fff; }
label.chip input:focus-visible + span { outline: 3px solid #93b4f8; }
.alcance { margin-bottom: .6rem; }

.segmentos { display: inline-flex; background: var(--rejilla); border-radius: 12px; padding: 3px; gap: 3px; max-width: 100%; overflow-x: auto; }
.segmentos button, .segmentos label span {
  border: 0; background: transparent; font: inherit; font-size: .86rem; font-weight: 600; color: var(--tinta2);
  padding: .45rem .8rem; border-radius: 9px; cursor: pointer; white-space: nowrap; display: block; min-height: 36px;
}
.segmentos button.activo, .segmentos label input:checked + span { background: var(--papel); color: var(--tinta); box-shadow: 0 1px 3px rgba(16, 24, 40, .15); }
.segmentos.radios label { margin: 0; position: relative; }
.segmentos.radios input { position: absolute; opacity: 0; }
.segmentos.grande { display: flex; margin-bottom: 1rem; }
.segmentos.grande button { flex: 1; }
.segmentos.grande button small { display: block; font-weight: 500; font-size: .75rem; color: var(--tinta3); }

.aviso { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 600; background: #eff4ff; border: 1px solid #c7d7fe; }
.aviso.ok { background: #ecfdf3; border-color: #abefc6; color: var(--ok); }
.aviso.error { background: #fef3f2; border-color: #fecdca; color: var(--mal); }
.flotante { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 2000; box-shadow: 0 8px 30px rgba(16, 24, 40, .2); max-width: min(92vw, 480px); }

.tabla-scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.tabla-scroll.alta { max-height: 520px; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td:first-child, th:first-child { padding-left: .3rem; }
th { position: sticky; top: 0; background: var(--papel); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--tinta3); z-index: 1; }
th.orden { cursor: pointer; user-select: none; }
th.orden:hover { color: var(--tinta); }
td.num, th.num { text-align: right; }
th.angosta { width: 1%; }
.flota-sel { position: fixed; right: 14px; bottom: 18px; z-index: 1150; box-shadow: 0 8px 24px rgba(16, 24, 40, .35); border-radius: 999px; }
tr.pulsable { cursor: pointer; }
tr.pulsable:hover { background: #f9fafb; }
tr.marcada { background: #eff4ff; }
tr.total td { font-weight: 700; border-top: 2px solid var(--tinta3); }
tr.oculta { opacity: .5; }
td.calor { position: relative; }

.punto { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--c, #6b7280); margin-right: .4rem; vertical-align: -1px; flex: none; }
.etiqueta { display: inline-block; border-radius: 999px; background: var(--rejilla); padding: .08rem .6rem; font-size: .76rem; font-weight: 700; border-left: 6px solid var(--c, #98a2b3); width: fit-content; }
.insignia { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 .4rem; border-radius: 999px; background: var(--marca); color: #fff; font-size: .82rem; vertical-align: 2px; }

/* ---------- candidatos y noticias ---------- */
.persona { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; border-left: 6px solid var(--c, var(--marca)); }
.persona > div:nth-of-type(1) { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 160px; }
.persona h1 { margin: 0; font-size: 1.25rem; }
.foto { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex: none; background: var(--rejilla); }
.foto.inicial { display: grid; place-items: center; background: var(--c, var(--marca)); color: #fff; font-size: 1.8rem; font-weight: 800; }
.carrusel { display: flex; gap: .8rem; overflow-x: auto; padding: .25rem .1rem .8rem; }
.avatar { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 82px; flex: none; color: var(--tinta2); text-align: center; line-height: 1.2; }
.avatar img, .avatar .foto { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 3px solid transparent; font-size: 1.4rem; }
.avatar.activo img, .avatar.activo .foto { border-color: var(--acento); }
.avatar.activo small { font-weight: 700; color: var(--tinta); }
.cronologia { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 3px solid var(--linea); }
.cronologia li { position: relative; }
.cronologia li::before { content: ""; position: absolute; left: calc(-1rem - 8px); top: 1.2rem; width: 13px; height: 13px; border-radius: 50%; background: var(--marca); border: 3px solid var(--fondo); }
.cronologia li.destacada { border: 2px solid #f79009; }
.cronologia li.oculta { opacity: .55; }
.cronologia time { font-size: .8rem; color: var(--tinta3); font-weight: 700; }
.cronologia h3 { overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: .8rem; }
.qr { width: 220px; height: 220px; background: #fff; }
.pasos { text-align: left; }
.codigos { columns: 2; list-style: none; padding: 0; line-height: 2.2; }

/* ---------- panel ---------- */
.selector { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: flex-end; }
.selector > label { margin: 0; }
.selector > .segmentos { align-self: flex-end; }
.selector label.grande { flex: 1 1 240px; }
.selector label.grande select { font-size: 1.1rem; font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: .75rem .9rem; border-top: 4px solid var(--c, transparent); min-width: 0; }
.kpi span { display: block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--tinta3); }
.kpi b { display: block; font-size: 1.55rem; line-height: 1.25; overflow-wrap: anywhere; }
.kpi small { color: var(--tinta2); }
.dos { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; }
.mapa { height: 520px; border-radius: 12px; background: #e9edf3; z-index: 0; isolation: isolate; }
.mapa-caja select { width: auto; max-width: 100%; }
.leyenda { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .6rem; font-size: .84rem; font-weight: 600; }
.leyenda button { border: 0; background: transparent; font: inherit; cursor: pointer; padding: .2rem .35rem; border-radius: 8px; display: inline-flex; align-items: center; color: var(--tinta); }
.leyenda button.apagado { opacity: .35; }
.leyenda button.activo { background: var(--rejilla); }
.etiqueta-mapa { background: rgba(255, 255, 255, .92); border: 1px solid var(--tinta); border-radius: 6px; font: 700 11px/1.4 system-ui, sans-serif; text-align: center; white-space: nowrap; }

.fila-barra { display: grid; grid-template-columns: 68px minmax(0, 1fr) 74px; gap: .6rem; align-items: center; padding: .32rem 0; }
.fila-barra .nombre { min-width: 0; }
.fila-barra .nombre b { display: block; font-size: .8rem; overflow-wrap: anywhere; }
.fila-barra .nombre small { display: block; color: var(--tinta3); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-barra .pista { height: 14px; background: var(--rejilla); border-radius: 0 4px 4px 0; overflow: hidden; }
.fila-barra .relleno { height: 100%; background: var(--c, #6b7280); border-radius: 0 4px 4px 0; }
.fila-barra .valor { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fila-barra .valor small { display: block; color: var(--tinta3); font-size: .74rem; }
.fila-barra.ancha { grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) 74px; }

.grafica { position: relative; width: 100%; }
.grafica svg { display: block; width: 100%; height: auto; overflow: visible; font: 12px system-ui, sans-serif; }
.grafica .eje { fill: var(--tinta3); }
.grafica .guia { stroke: var(--rejilla); stroke-width: 1; }
.grafica .base { stroke: #d0d5dd; stroke-width: 1; }
.grafica .directa { fill: var(--tinta); font-weight: 600; font-size: 11px; }
.rango { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.rango label { flex-direction: row; align-items: center; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 110px; overflow: auto; margin-bottom: .6rem; }
.chips button { border: 1px solid #c7d7fe; background: #eff4ff; border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; }
.casillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .75rem; }
.casilla { border: 1px solid var(--linea); border-top: 5px solid var(--c, #98a2b3); border-radius: 12px; padding: .65rem .75rem; }
.casilla.marcada { outline: 3px solid var(--acento); }
.casilla header { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.casilla header label { flex-direction: row; align-items: center; margin: 0; color: var(--tinta); font-size: .92rem; }
.casilla .grande { font-size: 1.6rem; font-weight: 800; }
.sube { color: var(--ok); font-weight: 700; }
.baja { color: var(--mal); font-weight: 700; }

.globo, .leaflet-tooltip.globo-mapa {
  background: #101828; color: #fff; border: 0; border-radius: 10px; padding: .5rem .7rem; font: 12px/1.5 system-ui, sans-serif; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.globo { position: fixed; z-index: 3000; pointer-events: none; max-width: 260px; }
.leaflet-tooltip.globo-mapa::before { display: none; }
.globo .punto, .globo-mapa .punto { width: 10px; height: 10px; }

/* ---------- estimaciones ---------- */
.marcador { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.competidor { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: .8rem; text-align: center; border-top: 6px solid var(--c, #98a2b3); display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 0; }
.competidor.lider { outline: 3px solid var(--c); }
.competidor .foto { width: 68px; height: 68px; font-size: 1.5rem; }
.competidor .pct { font-size: 1.9rem; font-weight: 800; line-height: 1.2; }
.competidor small { color: var(--tinta3); }
.masivo { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; background: #eff4ff; border: 1px solid #c7d7fe; border-radius: 12px; padding: .7rem; margin-bottom: .7rem; }
.masivo > b { align-self: center; }
.masivo label { margin: 0; flex: 1 1 120px; }
dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, 96vw); max-height: 92vh; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(16, 24, 40, .55); }
dialog > div { padding: 1.1rem; }
dialog.chico { width: min(420px, 94vw); }
.control { display: grid; grid-template-columns: 90px minmax(0, 1fr) 84px; gap: .6rem; align-items: center; padding: .15rem 0; }
.control b { font-size: .78rem; border-left: 6px solid var(--c, #98a2b3); padding-left: .4rem; overflow-wrap: anywhere; }
.control input[type=range] { accent-color: var(--c, var(--marca)); }
.control input[type=number] { text-align: right; }
.suma { position: sticky; bottom: 0; background: var(--papel); padding: .6rem 0; border-top: 1px solid var(--linea); display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: center; }
.fila-contendiente { border: 1px solid var(--linea); border-left: 6px solid var(--c, #98a2b3); border-radius: 12px; padding: .7rem; margin-bottom: .6rem; }

/* ---------- teléfono ---------- */
@media (max-width: 900px) {
  .dos { grid-template-columns: minmax(0, 1fr); }
  .mapa { height: 62vh; min-height: 320px; }
}
@media (max-width: 760px) {
  .contenedor, .panel { padding: .65rem; }
  .barra { justify-content: space-between; }
  .barra .menu {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200; background: var(--papel); border-top: 1px solid var(--linea);
    justify-content: space-around; padding: .3rem .2rem calc(.3rem + env(safe-area-inset-bottom)); margin: 0;
  }
  .barra .menu a { flex-direction: column; align-items: center; gap: 0; color: var(--tinta2); font-size: .7rem; padding: .25rem .4rem; border-radius: 10px; opacity: 1; flex: 1; }
  .barra .menu a i { font-size: 1.25rem; line-height: 1.3; }
  .barra .menu a.activo { background: var(--rejilla); color: var(--tinta); }
  body.con-sesion main { padding-bottom: 5.5rem; }
  .flota-sel { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .tarjeta { padding: .8rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 1.3rem; }
  .selector > label, .selector > .segmentos, .selector label.grande { flex: 1 1 100%; }
  .selector label .segmentos { display: flex; }
  .selector label .segmentos button { flex: 1; }
  .marcador { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control { grid-template-columns: 84px minmax(0, 1fr) 76px; }
}
