:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #5f5f66;
  --border: #dddbd4;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --bar-bg: #ecebe6;
  --ok: #1d7a45;
  --err: #b3261e;
  --op-paro_total: #2a78d6;
  --op-adhiero_clases: #eb6834;
  --op-no: #1baf7a;
  --op-abstencion: #eda100;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131316;
    --surface: #1c1c21;
    --text: #ececef;
    --muted: #a3a3ad;
    --border: #2f2f37;
    --accent: #7aa7e6;
    --accent-text: #0e1420;
    --bar-bg: #2a2a31;
    --ok: #5cc98a;
    --err: #f2877f;
    --op-paro_total: #3987e5;
    --op-adhiero_clases: #d95926;
    --op-no: #199e70;
    --op-abstencion: #c98500;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }

header { margin-bottom: 24px; }
.kicker { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 6px 0 8px; font-size: clamp(24px, 5vw, 34px); line-height: 1.2; text-wrap: balance; }
.meta { margin: 0; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
h2 { margin: 0 0 10px; font-size: 19px; }
h3 { margin: 0 0 8px; font-size: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.pill { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.barra { margin: 12px 0; }
.barra-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.barra-top b { font-variant-numeric: tabular-nums; }
.barra-track { height: 12px; background: var(--bar-bg); border-radius: 6px; overflow: hidden; margin-top: 5px; }
.barra-fill { height: 100%; border-radius: 6px; transition: width .6s ease; }
.nota { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.fila { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=email] {
  flex: 1 1 220px; min-width: 0;
  padding: 11px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input[type=email]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  padding: 11px 18px; font: inherit; font-weight: 600;
  color: var(--accent-text); background: var(--accent);
  border: 0; border-radius: 8px; cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }

fieldset { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.opcion {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 16px; margin: 0; cursor: pointer;
}
.opcion:has(input:checked) { border-color: var(--accent); outline: 1px solid var(--accent); }
.opcion input { accent-color: var(--accent); width: 18px; height: 18px; }

.msg { min-height: 1.5em; margin: 10px 0 0; font-size: 15px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

.posturas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.posturas article { border-top: 3px solid var(--border); padding-top: 10px; }
.posturas ul, .privacidad ul { margin: 0; padding-left: 20px; }
.posturas li, .privacidad li { margin-bottom: 6px; }
@media (max-width: 640px) { .posturas { grid-template-columns: 1fr; } }

details summary { cursor: pointer; color: var(--muted); }
.fuentes { padding-left: 20px; font-size: 14px; }
.fuentes li { margin: 4px 0; }
a { color: var(--accent); }

/* ---------- /estadisticas ---------- */
main.stats { max-width: 880px; }
.meta a { white-space: nowrap; }
.kpis { display: grid; grid-template-columns: minmax(120px, 1fr) 4fr; gap: 12px; margin-bottom: 16px; }
.kpis-opciones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kpi-label { color: var(--muted); font-size: 13px; line-height: 1.3; display: flex; align-items: flex-start; gap: 8px; }
.kpi-label .punto { margin-top: 3px; }
.kpi-valor { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr; }
  .kpis-opciones { grid-template-columns: 1fr; }
  .kpi { flex-direction: row; justify-content: space-between; align-items: center; }
  .kpi-valor { font-size: 26px; }
}
.linea { position: relative; }
.linea svg { display: block; overflow: visible; touch-action: pan-y; }
.linea .grid { stroke: var(--border); stroke-width: 1; }
.linea .eje { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.linea .serie { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.linea .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.linea .marca { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tooltip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 13px;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none;
}
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
#nota-resultados { text-align: center; }
#form-voto input[type=email] { width: 100%; margin-bottom: 14px; }
@media (max-width: 900px) and (min-width: 641px) {
  .kpis { grid-template-columns: 1fr; }
  .kpis-opciones { grid-template-columns: repeat(2, 1fr); }
}
.barra-top span { min-width: 0; }
.barra-top b { white-space: nowrap; }
