/* Apuração Eleições 2026 — estilos públicos */
.aep-app {
	--aep-primary: #0b5fff;
	--aep-accent: #16a34a;
	--aep-bg: #ffffff;
	--aep-surface: #f5f7fb;
	--aep-border: #e3e8f0;
	--aep-text: #0f172a;
	--aep-muted: #5b677a;
	--aep-bar-bg: #e8edf5;
	box-sizing: border-box;
	max-width: 960px;
	margin: 24px auto;
	padding: 20px;
	background: var(--aep-bg);
	color: var(--aep-text);
	border: 1px solid var(--aep-border);
	border-radius: 16px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.4;
}
.aep-app *, .aep-app *::before, .aep-app *::after { box-sizing: border-box; }

.aep-app[data-tema="escuro"] {
	--aep-bg: #0f1623; --aep-surface: #172033; --aep-border: #25314a;
	--aep-text: #eef2f9; --aep-muted: #9aa8c0; --aep-bar-bg: #25314a;
}
@media (prefers-color-scheme: dark) {
	.aep-app[data-tema="auto"] {
		--aep-bg: #0f1623; --aep-surface: #172033; --aep-border: #25314a;
		--aep-text: #eef2f9; --aep-muted: #9aa8c0; --aep-bar-bg: #25314a;
	}
}

.aep-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.aep-title { margin: 0; font-size: 1.6rem; line-height: 1.15; color: var(--aep-text); }
.aep-sub { margin: 4px 0 0; color: var(--aep-muted); font-size: .95rem; }

.aep-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--aep-surface); color: var(--aep-muted); border: 1px solid var(--aep-border); }
.aep-live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.aep-live.is-live { color: #b91c1c; }
.aep-live.is-live::before { background: #ef4444; animation: aep-pulse 1.4s infinite; }
.aep-live.is-final { color: var(--aep-accent); }
.aep-live.is-final::before { background: var(--aep-accent); }
@keyframes aep-pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 70% { box-shadow: 0 0 0 9px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }

.aep-aviso { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--aep-surface); border-left: 4px solid var(--aep-primary); font-size: .92rem; }
.aep-aviso a { color: var(--aep-primary); }

.aep-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.aep-tab { appearance: none; border: 1px solid var(--aep-border); background: var(--aep-surface); color: var(--aep-text); padding: 8px 14px; border-radius: 999px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.aep-tab:hover { border-color: var(--aep-primary); }
.aep-tab.is-on { background: var(--aep-primary); border-color: var(--aep-primary); color: #fff; }

.aep-controls { margin-bottom: 14px; }
.aep-lbl { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--aep-muted); }
.aep-select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--aep-border); background: var(--aep-surface); color: var(--aep-text); font: inherit; max-width: 100%; }

.aep-prog { margin-bottom: 16px; padding: 14px; background: var(--aep-surface); border-radius: 12px; border: 1px solid var(--aep-border); }
.aep-prog:empty { display: none; }
.aep-prog-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; margin-bottom: 8px; }
.aep-prog-head strong { font-size: 1.15rem; }
.aep-prog-bar { height: 10px; background: var(--aep-bar-bg); border-radius: 999px; overflow: hidden; }
.aep-prog-fill { height: 100%; background: var(--aep-primary); border-radius: 999px; transition: width .6s ease; }
.aep-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.aep-chip { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--aep-bg); border: 1px solid var(--aep-border); border-radius: 10px; }
.aep-chip-l { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--aep-muted); }
.aep-chip-v { font-size: .9rem; }

.aep-list { display: flex; flex-direction: column; gap: 10px; }
.aep-list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; color: var(--aep-muted); font-size: .9rem; }
.aep-list-head strong { color: var(--aep-text); font-size: 1.05rem; }
.aep-msg { margin: 0; padding: 22px; text-align: center; background: var(--aep-surface); border-radius: 12px; color: var(--aep-muted); }

.aep-card { --aep-bar: var(--aep-primary); display: grid; grid-template-columns: 28px 64px 1fr auto; gap: 12px; align-items: center; padding: 12px; background: var(--aep-surface); border: 1px solid var(--aep-border); border-radius: 14px; }
.aep-card.is-lead { border-color: var(--aep-bar); }
.aep-card.is-elected { border-color: var(--aep-accent); box-shadow: 0 0 0 1px var(--aep-accent) inset; }
.aep-rank { font-weight: 800; font-size: 1.05rem; color: var(--aep-muted); text-align: center; }

.aep-ph { position: relative; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--aep-bar-bg); flex: none; }
.aep-ph .aep-ini { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--aep-muted); font-size: 1.15rem; }
.aep-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; opacity: 0; transition: opacity .3s; }
.aep-ph.has-img img { opacity: 1; }
.aep-card.is-lead .aep-ph, .aep-card.is-elected .aep-ph { outline: 3px solid var(--aep-bar); outline-offset: 2px; }
.aep-card.is-elected .aep-ph { outline-color: var(--aep-accent); }

.aep-body { min-width: 0; }
.aep-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aep-name { margin: 0; font-size: 1.02rem; line-height: 1.2; color: var(--aep-text); font-weight: 700; overflow-wrap: anywhere; }
.aep-badge { padding: 2px 8px; border-radius: 999px; background: var(--aep-accent); color: #fff; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.aep-meta { margin-top: 2px; color: var(--aep-muted); font-size: .85rem; }
.aep-sub2 { color: var(--aep-muted); font-size: .8rem; }
.aep-bar { margin-top: 8px; height: 8px; border-radius: 999px; background: var(--aep-bar-bg); overflow: hidden; }
.aep-bar-fill { height: 100%; border-radius: 999px; background: var(--aep-bar); transition: width .6s ease; }

.aep-nums { text-align: right; white-space: nowrap; }
.aep-pct { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.aep-votes { color: var(--aep-muted); font-size: .8rem; }

.aep-more { display: block; margin: 14px auto 0; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--aep-border); background: var(--aep-surface); color: var(--aep-text); font: inherit; font-weight: 600; cursor: pointer; }
.aep-more:hover { border-color: var(--aep-primary); }
.aep-more[hidden], .aep-live[hidden], .aep-tabs[hidden] { display: none; }

.aep-foot { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--aep-muted); }

@media (max-width: 560px) {
	.aep-app { padding: 14px; border-radius: 12px; }
	.aep-title { font-size: 1.3rem; }
	.aep-card { grid-template-columns: 22px 52px 1fr; grid-template-areas: "rank ph body" "nums nums nums"; gap: 8px 10px; }
	.aep-rank { grid-area: rank; }
	.aep-ph { grid-area: ph; width: 52px; height: 52px; }
	.aep-body { grid-area: body; }
	.aep-nums { grid-area: nums; display: flex; justify-content: space-between; align-items: baseline; text-align: left; padding-left: 32px; }
	.aep-pct { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
	.aep-live.is-live::before { animation: none; }
	.aep-bar-fill, .aep-prog-fill, .aep-ph img { transition: none; }
}
