:root{ --neutral-bar:#A3A9AE; --other-bar:#5C6369; --grid:#E6E6E0; --tooltip-bg:#15191C; --tooltip-ink:#F6F6F3; }
@media (prefers-color-scheme: dark){
  :root{ --neutral-bar:#646B71; --other-bar:#A3A9AE; --grid:#262C30; --tooltip-bg:#ECEDEA; --tooltip-ink:#111416; }
}

/* Aviso de datos de ejemplo */
.sample-note{display:flex;gap:10px;align-items:flex-start;padding:12px 16px;border-radius:8px;background:var(--err-bg);color:var(--err);font-size:14px;font-weight:600;line-height:1.5}

/* Sección en portada */
.results{padding-block:88px;display:flex;flex-direction:column;gap:36px}
.results-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;flex-wrap:wrap}
.results-head .head{max-width:640px}

/* Tarjetas */
.poll-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:20px}
.poll-card{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden;text-decoration:none;color:var(--ink)}
.poll-card:hover{border-color:var(--accent);color:var(--ink)}
.poll-card:hover .poll-card-title{color:var(--accent)}
.cover{position:relative;display:flex;flex-direction:column;justify-content:flex-end;gap:2px;min-height:150px;padding:20px;background:var(--bg);border-bottom:1px solid var(--line);overflow:hidden}
.cover::after{content:"";position:absolute;right:-30px;top:-30px;width:150px;height:150px;border-radius:50%;border:1px solid var(--deco);box-shadow:0 0 0 24px var(--bg),0 0 0 25px var(--deco)}
.cover-kicker{font-family:var(--font-mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--accent);position:relative;z-index:1}
.cover-place{font-size:28px;font-weight:800;letter-spacing:-.02em;line-height:1.05;position:relative;z-index:1}
.cover-state{font-size:13px;color:var(--muted2);position:relative;z-index:1}
.poll-card-body{display:flex;flex-direction:column;gap:10px;padding:20px;flex:1}
.poll-card-title{font-size:17px;font-weight:700;line-height:1.35;letter-spacing:-.005em}
.poll-meta{display:flex;flex-wrap:wrap;gap:6px 12px;font-size:13px;color:var(--muted2)}
.tag{display:inline-flex;align-items:center;min-height:24px;padding:0 10px;border-radius:999px;background:var(--bg);border:1px solid var(--line);font-size:12px;font-weight:600;color:var(--muted)}
.leader{margin-top:auto;padding-top:12px;border-top:1px solid var(--line);font-size:14px;color:var(--muted)}
.leader b{color:var(--ink)}

/* Página de listado */
.page-head{padding-block:56px 28px;display:flex;flex-direction:column;gap:14px}
.page-head h1{font-size:clamp(32px,4.4vw,52px);line-height:1.05;letter-spacing:-.03em;font-weight:800}
.page-head p{font-size:17px;line-height:1.6;color:var(--muted);max-width:60ch}
.crumbs{font-size:14px;color:var(--muted2)} .crumbs a{color:var(--muted2)}
.filters{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;padding-bottom:28px}
.filters .field{min-width:200px;flex:0 1 240px}
.empty{padding:40px;border:1px dashed var(--field);border-radius:12px;text-align:center;color:var(--muted)}
.list-wrap{padding-bottom:96px;display:flex;flex-direction:column;gap:20px}

/* Ficha de encuesta */
.poll-page{padding-bottom:96px;display:flex;flex-direction:column;gap:28px}
.poll-page h1{font-size:clamp(28px,3.6vw,44px);line-height:1.12;letter-spacing:-.025em;font-weight:800;max-width:30ch}
.chart-card{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:28px;display:flex;flex-direction:column;gap:20px;min-width:0}
@media (max-width:560px){.chart-card{padding:20px}}
.chart-card h2{font-size:20px;line-height:1.35;letter-spacing:-.01em;font-weight:700}
.chart-note{font-size:13px;color:var(--muted2)}

.bars{display:flex;flex-direction:column;gap:14px;margin:0;padding:0;list-style:none}
.bar-row{display:grid;grid-template-columns:minmax(110px,180px) 1fr 56px;align-items:center;gap:14px}
@media (max-width:560px){.bar-row{grid-template-columns:1fr 52px}.bar-row .bar-track{grid-column:1 / -1;grid-row:2}}
.bar-name{display:flex;align-items:center;gap:8px;font-size:15px;font-weight:600;min-width:0}
.swatch{flex:none;width:10px;height:10px;border-radius:3px}
.bar-track{height:28px;position:relative}
.bar-fill{height:100%;border-radius:0 4px 4px 0;min-width:2px}
.bar-value{font-size:16px;font-weight:800;text-align:right;font-variant-numeric:tabular-nums}
.bar-row:hover .bar-fill{filter:brightness(1.08)}

.trend{position:relative;width:100%;overflow:hidden}
.trend svg{display:block;width:100%;height:auto}
.trend text{font-family:var(--font-display);font-size:12px;fill:var(--muted2)}
.trend .grid-line{stroke:var(--grid);stroke-width:1}
.trend .series{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.trend .pt{stroke:var(--surface);stroke-width:2}
.trend .xhair{stroke:var(--muted2);stroke-width:1;stroke-dasharray:3 3}
.tip{position:absolute;pointer-events:none;background:var(--tooltip-bg);color:var(--tooltip-ink);border-radius:8px;padding:10px 12px;font-size:13px;line-height:1.5;min-width:150px;box-shadow:0 4px 16px rgba(0,0,0,.18);z-index:2}
.tip b{display:block;margin-bottom:4px}
.tip-row{display:flex;justify-content:space-between;gap:14px;font-variant-numeric:tabular-nums}
.legend{display:flex;flex-wrap:wrap;gap:8px 18px;margin:0;padding:0;list-style:none;font-size:14px;color:var(--muted)}
.legend li{display:flex;align-items:center;gap:8px}

.data-table{overflow-x:auto}
.data-table summary{font-size:14px;font-weight:600;color:var(--accent);cursor:pointer;min-height:32px;display:flex;align-items:center}
.data-table table{border-collapse:collapse;font-size:14px;margin-top:10px;min-width:100%}
.data-table th,.data-table td{padding:8px 10px;border-bottom:1px solid var(--line);text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.data-table th:first-child,.data-table td:first-child{text-align:left}

.tech{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:18px 24px;margin:0}
.tech div{display:flex;flex-direction:column;gap:4px}
.tech dt{font-family:var(--font-mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted2)}
.tech dd{margin:0;font-size:15px;font-weight:600}

.share{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.share span{font-size:14px;color:var(--muted);margin-right:4px}
.share a,.share button{display:inline-flex;align-items:center;min-height:40px;padding:0 16px;border-radius:999px;border:1px solid var(--field);background:var(--surface);color:var(--ink);font-size:14px;font-weight:600;text-decoration:none;cursor:pointer}
.share a:hover,.share button:hover{border-color:var(--accent);color:var(--accent)}

/* Candidatos con foto */
.avatar{flex:none;display:block;border-radius:50%;object-fit:cover;border:2px solid var(--line);background:var(--bg)}
.faces{display:flex}
.faces .avatar{margin-left:-8px;border-color:var(--surface) !important;box-shadow:0 0 0 1px var(--line)}
.faces .avatar:first-child{margin-left:0}
.leader.pending{display:flex;align-items:center;gap:12px}
.tag-live{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.cands{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:20px}
.cand{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:24px 16px;border:1px solid var(--line);border-radius:12px;background:var(--bg)}
.cand .avatar{width:120px;height:120px;border-width:3px;margin-bottom:6px}
.cand-name{font-size:18px;font-weight:800;letter-spacing:-.01em;line-height:1.2}
.cand-party{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted)}
.cand-val{margin-top:6px;font-family:var(--font-mono);font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted2)}
.bar-name .avatar{width:36px;height:36px}
.bar-name .who{display:flex;flex-direction:column;line-height:1.2;min-width:0}
.bar-name .who small{font-size:12px;font-weight:500;color:var(--muted2)}
.bar-empty{display:flex;align-items:center;height:100%;padding-left:12px;border:1px dashed var(--field);border-radius:4px;font-family:var(--font-mono);font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted2)}
.bars:has(.avatar) .bar-row{grid-template-columns:minmax(150px,230px) 1fr 56px}
.bars:has(.avatar) .bar-track{height:36px}
@media (max-width:560px){.bars:has(.avatar) .bar-row{grid-template-columns:1fr 52px}}
.legend .avatar{width:24px;height:24px;border-width:2px}
.trend-empty{position:relative;display:flex;align-items:center;justify-content:center;min-height:200px;padding:24px;border:1px dashed var(--field);border-radius:8px;overflow:hidden}
.trend-empty-grid{position:absolute;inset:16px;background:repeating-linear-gradient(to bottom,transparent 0,transparent 39px,var(--grid) 39px,var(--grid) 40px)}
.trend-empty p{position:relative;max-width:46ch;text-align:center;font-size:14px;line-height:1.6;color:var(--muted);background:var(--surface);padding:8px 12px;border-radius:6px}
.cands{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:16px}
.cand{border-top:4px solid var(--c,var(--line))}
.cand .avatar{border-color:var(--c) !important}
.cand-pct{font-size:30px;font-weight:800;letter-spacing:-.02em;line-height:1;font-variant-numeric:tabular-nums}
.cand-top{background:var(--surface);box-shadow:0 0 0 2px var(--c) inset}
@media (max-width:560px){.cands{grid-template-columns:repeat(2,minmax(0,1fr))}.cand .avatar{width:88px;height:88px}.cand-pct{font-size:24px}}

/* Marca de agua y sello de fuente */
.chart-card{position:relative;overflow:hidden;isolation:isolate}
.chart-card>:not(.wm){position:relative;z-index:1}
.wm{position:absolute;left:50%;top:50%;width:min(62%,380px);height:auto;transform:translate(-50%,-46%);z-index:0;pointer-events:none;
  fill:none;stroke:var(--ink);stroke-width:1.4;opacity:.08}
.wm .wm-dot{fill:var(--ink);stroke:none}
/* Marca de agua repetida (como sello de seguridad) en todo el fondo de la gráfica */
.chart-card::before{content:"";position:absolute;inset:-40%;z-index:0;pointer-events:none;transform:rotate(-14deg);background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='140' viewBox='0 0 260 140'%3E%3Cg fill='none' stroke='%2315191C' stroke-width='1.6'%3E%3Ccircle cx='30' cy='40' r='13'/%3E%3Ccircle cx='30' cy='40' r='7'/%3E%3Ccircle cx='160' cy='110' r='13'/%3E%3Ccircle cx='160' cy='110' r='7'/%3E%3C/g%3E%3Cg fill='%2315191C' font-family='Arial,Helvetica,sans-serif' font-weight='700' font-size='17' letter-spacing='3'%3E%3Ccircle cx='30' cy='40' r='2.5'/%3E%3Ccircle cx='160' cy='110' r='2.5'/%3E%3Ctext x='50' y='46'%3EVISOR%3C/text%3E%3Ctext x='180' y='116'%3EVISOR%3C/text%3E%3C/g%3E%3C/svg%3E") 0 0/260px 140px repeat;opacity:.075}
@media (prefers-color-scheme: dark){.chart-card::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='140' viewBox='0 0 260 140'%3E%3Cg fill='none' stroke='%23ECEDEA' stroke-width='1.6'%3E%3Ccircle cx='30' cy='40' r='13'/%3E%3Ccircle cx='30' cy='40' r='7'/%3E%3Ccircle cx='160' cy='110' r='13'/%3E%3Ccircle cx='160' cy='110' r='7'/%3E%3C/g%3E%3Cg fill='%23ECEDEA' font-family='Arial,Helvetica,sans-serif' font-weight='700' font-size='17' letter-spacing='3'%3E%3Ccircle cx='30' cy='40' r='2.5'/%3E%3Ccircle cx='160' cy='110' r='2.5'/%3E%3Ctext x='50' y='46'%3EVISOR%3C/text%3E%3Ctext x='180' y='116'%3EVISOR%3C/text%3E%3C/g%3E%3C/svg%3E");opacity:.06}}
.wm text{fill:var(--ink);stroke:none;font-family:var(--font-display);font-weight:800;font-size:38px;letter-spacing:12px}
.fuente{display:flex;align-items:center;gap:8px;margin:0;padding-top:4px;font-size:12px;line-height:1.4;color:var(--muted2)}
.fuente svg{flex:none;fill:none;stroke:var(--muted2);stroke-width:2}
.fuente svg .fd{fill:var(--accent);stroke:none}
.fuente b{color:var(--ink);font-weight:700}
.share .dl{background:var(--accent);border-color:var(--accent);color:var(--on-accent);gap:8px;margin-right:8px}
.share .dl:hover{background:var(--accent-hover);border-color:var(--accent-hover);color:var(--on-accent)}
.share .dl:disabled{opacity:.75;cursor:progress}

/* Aviso de privacidad */
.legal-doc{max-width:760px;padding-bottom:96px;display:flex;flex-direction:column;gap:14px;font-size:16px;line-height:1.7;color:var(--muted)}
.legal-doc h2{font-size:21px;line-height:1.3;color:var(--ink);margin-top:22px;letter-spacing:-.01em}
.legal-doc ul{margin:0;padding-left:22px;display:flex;flex-direction:column;gap:6px}
.legal-doc b{color:var(--ink)}
.legal b{color:inherit}

/* Barras en escala 0–100% con un solo color */
.bars-100 .bar-track{background:color-mix(in srgb,var(--line) 55%,transparent);border-radius:4px}
.bars-100 .bar-fill{border-radius:4px}
.bar-scale{margin-top:-4px}
.bar-scale .scale{position:relative;height:18px;font-size:11px;color:var(--muted2);font-variant-numeric:tabular-nums}
.bar-scale .scale span{position:absolute;top:0;transform:translateX(-50%)}
.bar-scale .scale span:first-child{transform:none}
.bar-scale .scale span:last-child{transform:translateX(-100%)}
@media (max-width:560px){.bar-scale{display:none}}

/* Pestañas por año y mes */
.periodos{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:12px}
.periodos .tabs{justify-content:flex-start;align-items:center}
.tabs{display:flex;flex-wrap:wrap;gap:4px}
.tab{appearance:none;font:inherit;cursor:pointer;text-decoration:none}
.tabs-year{gap:8px}
.tabs-year .tab{min-height:34px;padding:0 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--muted);font-family:var(--font-mono);font-size:13px;letter-spacing:.06em}
.tabs-year .tab:hover{border-color:var(--accent);color:var(--accent)}
.tabs-year .tab[aria-selected="true"]{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.tabs-month{border-bottom:1px solid var(--line)}
.tabs-month .tab{display:inline-flex;align-items:center;min-height:42px;padding:0 16px;margin-bottom:-1px;border:0;border-bottom:3px solid transparent;background:none;color:var(--muted);font-size:15px;font-weight:600}
.tabs-month .tab:hover{color:var(--ink)}
.tabs-month .tab[aria-selected="true"],.tabs-month .tab[aria-current="page"]{color:var(--accent);border-bottom-color:var(--accent)}
.list-wrap .periodos{margin-bottom:4px}
