/* ============================================
   Padrón ARPP · ERM 2026 — Dashboard styles
   Branding: rojo Renovación Popular + acento dorado
   ============================================ */

:root {
  /* Paleta canónica Renovación Popular — extraída del símbolo oficial */
  --rp-red: #007090;       /* azul teal canónico del símbolo RP (alias mantenido por compat) */
  --rp-blue: #007090;
  --rp-blue-dark: #005670;
  --rp-blue-darker: #003e58;
  --rp-blue-soft: #e0f0f5;
  --rp-blue-vivid: #0091ba;
  --rp-red-dark: #005670;  /* alias compat */
  --rp-red-soft: #e0f0f5;  /* alias compat */
  --rp-gold: #d4a437;
  /* ARPT (Renovación Popular y Toro) — variante navy del mismo color RP */
  --arpt: #003e58;
  --arpt-dark: #002636;
  --arpt-soft: #e3eaf0;
  --ink: #0e1a24;
  --ink-soft: #4b5b6a;
  --line: #d8e2eb;
  --bg: #ffffff;
  --bg-soft: #f3f7fa;
  --ok: #00873e;
  --ok-soft: #e6f5ec;
  --warn: #c25500;
  --warn-soft: #fff2e2;
  --err: #b3001b;
  --shadow-sm: 0 1px 2px rgba(0,60,80,.06), 0 1px 3px rgba(0,60,80,.08);
  --shadow-md: 0 4px 8px rgba(0,60,80,.06), 0 8px 24px rgba(0,60,80,.10);
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--rp-red); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

.container {
  width: 100%; max-width: 1200px;
  margin-inline: auto;
  padding-inline: 20px;
}

.visually-hidden {
  position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden;
}

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(8px);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 6px;
  background: var(--rp-blue);
  position: relative; flex-shrink: 0;
  border: 3px solid var(--rp-blue);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif; font-weight: 800;
  font-size: 24px; color: #fff; line-height: 1;
}
.brand__mark::before {
  content: "R";
  background: #fff; color: var(--rp-blue);
  width: 100%; height: 100%; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
}
.brand__text strong { display: block; font-weight: 800; font-size: 18px; line-height: 1.1; letter-spacing: -.01em; color: var(--ink); }
.brand__text small { display: block; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }

.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--rp-red-soft); color: var(--rp-red); text-decoration: none; }

@media (max-width: 760px) {
  .nav { display: none; }
}

/* ============ HERO ============ */
.hero {
  padding: 64px 0 48px;
  background:
    radial-gradient(1200px 400px at 20% 10%, rgba(200,16,46,.06), transparent 60%),
    linear-gradient(180deg, #fcfcfd 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  margin: 0 0 16px; font-size: clamp(28px, 4vw, 44px); line-height: 1.15;
  font-weight: 800; letter-spacing: -.02em;
}
.hl { color: var(--rp-red); }
.lead { font-size: 18px; color: var(--ink-soft); max-width: 760px; margin: 0 0 32px; }

.hero__stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin: 32px 0;
}
.stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat__num { display: block; font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.stat__num--ok { color: var(--ok); }
.stat__num--warn { color: var(--warn); }
.stat__lbl { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ============ ALIANZA SWITCH ============ */
.alianza-switch {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin: 24px 0 28px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.alianza-switch__btn {
  flex: 1 1 280px;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 10px;
  background: transparent; border: 2px solid transparent; cursor: pointer;
  text-align: left; transition: background .15s, border-color .15s;
}
.alianza-switch__btn:hover { background: var(--bg-soft); }
.alianza-switch__btn--active { background: var(--rp-blue-soft); border-color: var(--rp-blue); }
body[data-alianza="ARPT"] .alianza-switch__btn--active { background: var(--arpt-soft); border-color: var(--arpt); }
.alianza-switch__btn strong { display: block; font-size: 18px; font-weight: 800; color: var(--ink); }
.alianza-switch__btn small { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.dot--rp { background: var(--rp-blue); }
.dot--pj { background: var(--arpt); }

/* Pill que indica la alianza activa en cada sección */
.alianza-pill {
  display: inline-block; padding: 4px 12px; border-radius: 16px;
  background: var(--rp-blue); color: #fff;
  font-size: 14px; font-weight: 700; vertical-align: middle;
}
body[data-alianza="ARPT"] .alianza-pill { background: var(--arpt); }

/* Cuando ARPT está activa, las acciones primarias toman el navy */
body[data-alianza="ARPT"] .btn--primary { background: var(--arpt); }
body[data-alianza="ARPT"] .btn--primary:hover { background: var(--arpt-dark); }
body[data-alianza="ARPT"] .btn--outline { color: var(--arpt); border-color: var(--arpt); }
body[data-alianza="ARPT"] .btn--outline:hover { background: var(--arpt-soft); }
body[data-alianza="ARPT"] .data-table tbody tr:hover { background: var(--arpt-soft); }
body[data-alianza="ARPT"] .data-table tbody tr:nth-child(even):hover { background: var(--arpt-soft); }
body[data-alianza="ARPT"] .nav a:hover { background: var(--arpt-soft); color: var(--arpt); }
body[data-alianza="ARPT"] .brand__mark { background: var(--arpt); border-color: var(--arpt); }
body[data-alianza="ARPT"] .brand__mark::before { color: var(--arpt); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px; border-radius: 8px;
  font-weight: 600; font-size: 15px; transition: transform .08s, box-shadow .15s, background .15s;
  border: 1px solid transparent;
}
.btn--primary { background: var(--rp-red); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--rp-red-dark); text-decoration: none; transform: translateY(-1px); }
.btn--outline { background: transparent; color: var(--rp-red); border-color: var(--rp-red); }
.btn--outline:hover { background: var(--rp-red-soft); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--ink-soft); padding: 6px 10px; }
.btn--ghost:hover { background: var(--bg-soft); text-decoration: none; }

/* ============ SECTIONS ============ */
.section { padding: 64px 0; }
.section--bg { background: var(--bg-soft); }
.section__title {
  font-size: clamp(22px, 2.5vw, 30px); font-weight: 800; letter-spacing: -.015em;
  margin: 0 0 8px;
}
.section__sub { color: var(--ink-soft); font-size: 16px; max-width: 760px; margin: 0 0 32px; }

/* ============ ALIANZAS ============ */
.alianzas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.alianza { display: flex; flex-direction: column; }
.alianza header { margin-bottom: 16px; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.badge--principal { background: var(--rp-red-soft); color: var(--rp-red); }
.badge--secundaria { background: #f0f0f5; color: var(--ink-soft); }
.alianza h3 { margin: 8px 0 4px; font-size: 19px; font-weight: 700; }
.alianza__alcance { color: var(--ink-soft); font-size: 14px; margin: 0; }
.partidos { list-style: none; padding: 0; margin: 0 0 16px; flex: 1; }
.partidos li {
  padding: 14px 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 70px 1fr; gap: 4px 14px;
}
.partidos li:last-child { padding-bottom: 0; }
.partido__siglas {
  grid-row: span 3; align-self: start;
  background: var(--ink); color: #fff; padding: 8px 0; border-radius: 6px;
  text-align: center; font-weight: 800; font-size: 13px; letter-spacing: .05em;
}
.alianza--principal .partido__siglas { background: var(--rp-red); }
.partido__nombre { font-weight: 600; font-size: 14px; }
.partido__rol { font-size: 13px; color: var(--ink-soft); }
.partido__count { font-size: 13px; font-weight: 700; color: var(--ok); }
.alianza__norma {
  font-size: 13px; color: var(--ink-soft); padding-top: 12px; border-top: 1px solid var(--line);
}

/* ============ DESCARGAS DNROP ============ */
.descargas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.descarga { display: flex; flex-direction: column; }
.descarga header { margin-bottom: 12px; }
.descarga h3 { margin: 8px 0 4px; font-size: 18px; font-weight: 700; color: var(--ink); }
.descarga__corte { font-size: 13px; color: var(--ink-soft); margin: 0; }
.descarga__body { flex: 1; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.descarga__cifra { font-size: 32px; margin: 4px 0; color: var(--rp-blue); font-weight: 800; letter-spacing: -.02em; }
.descarga__cifra strong { color: var(--rp-blue); }
.descarga--arpt .descarga__cifra strong { color: var(--arpt); }
.descarga__alcance { font-size: 14px; font-weight: 600; color: var(--ink); margin: 4px 0 8px; }
.descarga__nota { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.45; }
.descarga__btn { width: 100%; justify-content: center; }

/* ============ CIFRAS ============ */
.cifras-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.cifra {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
.cifra h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cifra__num { font-size: 32px; font-weight: 800; margin: 0; letter-spacing: -.02em; line-height: 1; }
.cifra__num--small { font-size: 16px; font-weight: 600; margin: 4px 0; color: var(--ok); }
.cifra__detalle { margin: 8px 0 4px; font-size: 13px; color: var(--ink); }
.cifra__nota { margin: 0; font-size: 12px; color: var(--ink-soft); }
.cifra--total { background: linear-gradient(135deg, #fff8e6 0%, #fff 100%); border-color: var(--rp-gold); }
.cifra--total .cifra__num { color: var(--rp-red); }
.cifra--ok .cifra__num { color: var(--ok); }
.cifra--warn .cifra__num { color: var(--warn); }

/* ============ TABLA TERRITORIAL ============ */
.table-tools {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.table-tools input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; min-width: 240px;
}
.table-tools input:focus {
  outline: 2px solid var(--rp-red); outline-offset: 1px;
}
.table-tools__hint { font-size: 13px; color: var(--ink-soft); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 14px; min-width: 800px;
}
.data-table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--ink); color: #fff;
  padding: 12px 10px; text-align: left; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; user-select: none;
}
.data-table th.num { text-align: right; }
.data-table th[data-sort]:hover { background: #2a3041; }
.data-table th[data-sort]::after { content: " ⇅"; opacity: .35; font-size: 10px; }
.data-table th.sort-asc::after { content: " ▲"; opacity: 1; }
.data-table th.sort-desc::after { content: " ▼"; opacity: 1; }
.data-table td {
  padding: 11px 10px; border-bottom: 1px solid var(--line);
}
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: var(--rp-red-soft); }
.data-table tbody tr:nth-child(even) { background: var(--bg-soft); }
.data-table tbody tr:nth-child(even):hover { background: var(--rp-red-soft); }
.data-table tfoot td { font-weight: 700; background: var(--bg-soft); border-top: 2px solid var(--ink); }

/* ============ DRILL DOWN ============ */
.drill {
  margin-top: 24px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.drill__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.drill__head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.drill__body { padding: 16px 20px; }
.drill .data-table { min-width: auto; }
.drill h4 { margin: 16px 0 8px; font-size: 14px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }

/* ============ CONSULTA ============ */
.consulta {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; max-width: 640px; box-shadow: var(--shadow-sm);
}
.consulta fieldset { border: 0; padding: 0; margin: 0 0 18px; display: flex; gap: 16px; }
.radio, .check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .check input { margin-top: 2px; }
.consulta__panel label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 12px 0 6px; }
.consulta__panel input[type="text"] {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 16px;
}
.consulta__panel input[type="text"]:focus {
  outline: 2px solid var(--rp-red); outline-offset: 1px; border-color: var(--rp-red);
}
.consulta__hint { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }
.consulta__captcha { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); }

/* ============ RESULTADO ============ */
.resultado { margin-top: 24px; }
.resultado .res-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.res-card__head {
  padding: 20px 24px; color: #fff;
}
.res-card__head--ok { background: linear-gradient(135deg, var(--ok) 0%, #006a2e 100%); }
.res-card__head--warn { background: linear-gradient(135deg, var(--warn) 0%, #963f00 100%); }
.res-card__head--err { background: linear-gradient(135deg, var(--err) 0%, #7a000c 100%); }
.res-card__head h3 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.res-card__head p { margin: 0; opacity: .9; font-size: 14px; }
.res-card__body { padding: 24px; }
.res-card__row {
  display: grid; grid-template-columns: 200px 1fr; gap: 12px 20px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.res-card__row:last-child { border: 0; }
.res-card__row dt { font-size: 13px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.res-card__row dd { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.res-card__row dd.big { font-size: 22px; font-weight: 700; }

.mesa-info {
  margin-top: 20px; padding: 18px 20px; background: var(--bg-soft); border-radius: var(--radius);
  border-left: 4px solid var(--rp-red);
}
.mesa-info--pendiente { background: var(--warn-soft); border-color: var(--warn); }
.mesa-info h4 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.mesa-info p { margin: 6px 0; }

@media (max-width: 580px) {
  .res-card__row { grid-template-columns: 1fr; gap: 4px; }
  .res-card__row dt { margin-bottom: 0; }
}

/* ============ NOMBRES candidatos en búsqueda por nombre ============ */
.candidatos-list {
  list-style: none; padding: 0; margin: 16px 0 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  max-height: 360px; overflow-y: auto;
}
.candidatos-list li {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.candidatos-list li:last-child { border: 0; }
.candidato__nombre { font-weight: 600; }
.candidato__meta { font-size: 12px; color: var(--ink-soft); }

/* ============ PRIVACIDAD ============ */
.privacidad {
  margin-top: 28px; padding: 16px 20px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.privacidad summary { font-weight: 600; cursor: pointer; }
.privacidad summary:hover { color: var(--rp-red); }
.privacidad ul { margin: 12px 0 0; padding-left: 20px; }
.privacidad li { margin: 6px 0; font-size: 14px; color: var(--ink-soft); }

/* ============ PROCESO ============ */
.proceso { list-style: none; padding: 0; counter-reset: step; }
.proceso li {
  counter-increment: step;
  padding: 18px 20px 18px 60px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative;
}
.proceso li::before {
  content: counter(step); position: absolute; left: 16px; top: 18px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--rp-red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.proceso__fecha { display: inline-block; background: var(--rp-red-soft); color: var(--rp-red);
                  padding: 3px 10px; border-radius: 16px; font-size: 12px; font-weight: 700;
                  text-transform: uppercase; letter-spacing: .04em; }
.proceso h4 { margin: 8px 0 4px; font-size: 17px; font-weight: 700; }
.proceso p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.reglas {
  margin-top: 32px; padding: 24px; background: var(--bg-soft);
  border-radius: var(--radius); border-left: 4px solid var(--rp-gold);
}
.reglas h3 { margin: 0 0 8px; font-size: 18px; }
.reglas__norma { color: var(--ink-soft); font-size: 13px; margin: 0 0 12px; font-style: italic; }
.reglas ul { margin: 0; padding-left: 20px; }
.reglas li { margin: 8px 0; font-size: 14px; }
.reglas li strong { color: var(--rp-red); }

/* ============ FOOTER ============ */
.footer { background: var(--ink); color: #c8ccd6; padding: 48px 0 24px; margin-top: 32px; }
.footer__cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px; margin-bottom: 32px;
}
.footer h5 { color: #fff; margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.footer p { margin: 4px 0; font-size: 13px; }
.footer__legal { padding-top: 24px; border-top: 1px solid #2a3041; font-size: 12px; color: #8d93a3; }

/* ============ LOADING ============ */
.loading { display: inline-block; width: 18px; height: 18px;
  border: 3px solid var(--line); border-top-color: var(--rp-red);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Respeto a usuarios con preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* Filas circunscripciones fuera operativo (extranjero, Lima Prov ARPT) */
.row-fuera-op{background:#f9eee0;color:#6b5238;font-style:italic;opacity:.85}
.row-fuera-op td strong{color:#a87a1d}
.row-fuera-op:hover{background:#f5e3c8}
.tag-fuera{display:inline-block;background:#d4a437;color:#0e1a24;padding:1px 7px;border-radius:10px;font-size:10px;font-weight:600;margin-left:6px;vertical-align:middle;letter-spacing:.3px}
.row-total-op{background:#e0f0f5;font-weight:600}
.row-total-op td{border-top:2px solid #007090;padding-top:10px}
.row-foot-total{background:#f3f7fa;color:#4b5b6a;font-size:12px}
.row-foot-total td{padding:6px 12px;border-top:1px dashed #b0b8c2}
