*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fundo, #0b1220);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #e8eef8;
}

#app-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--loading-fundo, #0b1220);
  transition: opacity var(--loading-fade-ms, 450ms) ease;
}

#app-loading.is-hiding {
  opacity: 0;
  pointer-events: none;
}

#app-loading img {
  width: var(--loading-logo-largura, 180px);
  height: auto;
  display: block;
}

#app-loading-titulo {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

#app-loading-barra {
  width: var(--loading-barra-largura, 180px);
  height: var(--loading-barra-altura, 3px);
  margin-top: 4px;
  border-radius: 99px;
  background: var(--loading-barra-trilha, rgba(255, 255, 255, 0.15));
  overflow: hidden;
}

#app-loading-barra > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--loading-barra-cor, rgba(255, 255, 255, 0.85));
  animation: app-loading-bar var(--loading-barra-duracao, 8s) ease-out forwards;
}

#app-loading.is-hiding #app-loading-barra > span {
  animation: none;
  width: 100%;
  transition: width 180ms ease;
}

@keyframes app-loading-bar {
  0% {
    width: 0;
  }
  20% {
    width: 28%;
  }
  50% {
    width: 55%;
  }
  75% {
    width: 78%;
  }
  100% {
    width: 92%;
  }
}

#map-wrap {
  position: absolute;
  inset: 0;
}

.map-scroll-shield {
  display: none;
}

.painel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--painel-largura, 360px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: rgba(11, 18, 32, 0.55);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #e8eef8;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.painel-direito {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--painel-direita-largura, 400px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 12px;
  background: rgba(10, 12, 16, 0.52);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  color: #e8eef8;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow-x: hidden;
}

.painel-direito[hidden] {
  display: none !important;
}

.pd-head {
  position: relative;
  flex-shrink: 0;
  margin-bottom: 8px;
  padding-right: calc(var(--p2-logo-largura, 68px) + 10px);
  min-height: calc(var(--p2-logo-largura, 68px) * 0.35);
}

.pd-titulo {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.02em;
}

.pd-uf-cols {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--pd-uf-gap, 6px);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 4px;
}

.pd-uf-cols[hidden] {
  display: none !important;
}

.pd-uf-urnas-label {
  flex: 1 1 auto;
  min-width: var(--pd-uf-barra-min, 28px);
  padding-right: calc(var(--pd-uf-pst-w, 4.2em) + var(--pd-uf-gap, 6px));
  font-size: var(--pd-uf-fonte-label, 11px);
  font-weight: 500;
  color: rgba(232, 238, 248, 0.55);
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
}

.pd-uf-cols-spacer {
  visibility: hidden;
  height: 0 !important;
  background: transparent !important;
}

.p2-logo-pd {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.pd-lista {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) rgba(0, 0, 0, 0.25);
}

.pd-lista::-webkit-scrollbar {
  width: 6px;
  height: 0;
}

.pd-lista::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 99px;
}

.pd-lista::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
}

.pd-lista::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.pd-lista.is-ufs {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.pd-uf {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--pd-uf-gap, 6px);
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pd-uf:last-child {
  border-bottom: 0;
}

.pd-uf-nome {
  flex: 0 0 var(--pd-uf-nome-w, 12.8em);
  width: var(--pd-uf-nome-w, 12.8em);
  max-width: var(--pd-uf-nome-w, 12.8em);
  font-size: var(--pd-uf-fonte-nome, 11px);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  white-space: nowrap;
  overflow: visible;
}

.pd-uf-bar {
  flex: 1 1 auto;
  min-width: var(--pd-uf-barra-min, 28px);
  height: var(--pd-uf-barra-h, 3px);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  align-self: center;
}

.pd-uf-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  max-width: 100%;
}

.pd-uf-foto {
  flex: 0 0 var(--pd-uf-foto, 18px);
  width: var(--pd-uf-foto, 18px);
  height: var(--pd-uf-foto, 18px);
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #333;
}

.pd-uf-foto.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--pd-uf-foto, 18px) * 0.45);
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.pd-uf-pst {
  flex: 0 0 var(--pd-uf-pst-w, 4.2em);
  width: var(--pd-uf-pst-w, 4.2em);
  box-sizing: border-box;
  font-size: var(--pd-uf-fonte-pst, 10px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  text-align: right;
  line-height: 1;
}

.pd-uf-partido {
  display: none;
}

.pd-uf-pct {
  flex: 0 0 var(--pd-uf-pct-w, 5.2em);
  width: var(--pd-uf-pct-w, 5.2em);
  box-sizing: border-box;
  font-size: var(--pd-uf-fonte-pct, 12px);
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-align: right;
  line-height: 1;
}

.pd-uf-loading,
.pd-uf-erro {
  padding: 12px 0;
  font-size: 12px;
  color: rgba(232, 238, 248, 0.45);
}

.pd-item {
  display: grid;
  grid-template-columns: 44px 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pd-item-slot {
  overflow: hidden;
}

.pd-item-slot.is-nova {
  max-height: 0;
  animation: pd-slot-abre var(--pd-transicao-entrada, 900ms) ease forwards;
}

.pd-item-slot.is-nova > .pd-item {
  opacity: 0;
  transform: translateX(36px);
  animation: pd-item-lado var(--pd-transicao-entrada, 900ms) ease forwards;
}

@keyframes pd-slot-abre {
  0% {
    max-height: 0;
  }
  45% {
    max-height: 140px;
  }
  100% {
    max-height: 180px;
  }
}

@keyframes pd-item-lado {
  0%,
  40% {
    opacity: 0;
    transform: translateX(36px);
    background: rgba(255, 255, 255, 0.08);
  }
  100% {
    opacity: 1;
    transform: none;
    background: transparent;
  }
}

.pd-item:last-child {
  border-bottom: 0;
}

.pd-item.is-ultrapassa {
  margin: 4px 0;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--pd-ultra-borda, rgba(255, 255, 255, 0.25));
  background: var(--pd-ultra-fundo, rgba(255, 255, 255, 0.06));
  border-bottom: 1px solid var(--pd-ultra-borda, rgba(255, 255, 255, 0.25));
}

.pd-item.is-ultrapassa .pd-icone.is-ultrapassa {
  box-shadow: 0 0 0 2px var(--pd-ultra-borda, rgba(255, 255, 255, 0.35));
}

.pd-item.is-ultrapassa .pd-secoes-titulo {
  color: #fff;
}

.pd-item.is-ultrapassa .pd-hora {
  color: var(--pd-ultra-hora, rgba(255, 255, 255, 0.7));
}

.pd-hora {
  font-size: 12px;
  font-weight: 500;
  color: rgba(232, 238, 248, 0.45);
  padding-top: 8px;
  font-variant-numeric: tabular-nums;
}

.pd-icone {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.pd-icone.is-anel {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
}

.pd-icone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.pd-icone.is-fallback {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.pd-corpo {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(232, 238, 248, 0.88);
  padding-top: 6px;
}

.pd-corpo strong {
  color: #fff;
  font-weight: 400;
}

.pd-secoes-titulo {
  font-weight: 400;
  color: #fff;
  margin-bottom: 4px;
}

.pd-cand-linha {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}

.pd-cand-linha strong {
  font-weight: 700;
}

.selo-resultado {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--selo-cor, #fff);
  background: var(--selo-fundo, rgba(255, 255, 255, 0.12));
  border: 1px solid var(--selo-borda, rgba(255, 255, 255, 0.3));
  vertical-align: middle;
}

.pd-cand-linha .selo-resultado {
  margin-top: 0;
  margin-left: 2px;
}

.pd-item.is-resultado {
  margin: 4px 0;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--pd-res-borda, rgba(74, 222, 128, 0.45));
  background: var(--pd-res-fundo, rgba(34, 197, 94, 0.1));
}

.pd-item.is-resultado .pd-hora {
  color: var(--pd-res-hora, rgba(74, 222, 128, 0.85));
}

.pd-item.is-resultado .pd-secoes-titulo {
  color: #fff;
}

.pd-cand-pct {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.painel-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.painel-cargo {
  font-size: 12px;
  font-weight: 600;
  color: #9fb0c9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.painel-local {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.painel-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #7a8ba3;
}

.painel-progress {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.painel-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: #9fb0c9;
  margin-bottom: 8px;
}

.painel-progress-label strong {
  color: #fff;
  font-size: 14px;
}

.painel-progress-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.painel-progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: #3d7cc4;
  border-radius: 99px;
  transition: width 0.35s ease;
}

.painel-lista {
  flex: 1;
  overflow: auto;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(158, 197, 240, 0.35) transparent;
}

.painel-lista::-webkit-scrollbar {
  width: 6px;
}

.painel-lista::-webkit-scrollbar-track {
  background: transparent;
}

.painel-lista::-webkit-scrollbar-thumb {
  background: rgba(158, 197, 240, 0.35);
  border-radius: 99px;
}

.painel-lista::-webkit-scrollbar-thumb:hover {
  background: rgba(158, 197, 240, 0.55);
}

.cand-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px 10px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cand-num {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.cand-nome {
  font-size: 14px;
  font-weight: 600;
  color: #f2f7ff;
}

.cand-partido {
  font-size: 11px;
  color: #9fb0c9;
}

.cand-pct {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: right;
}

.cand-votos {
  grid-column: 2 / -1;
  font-size: 11px;
  color: #7a8ba3;
}

.cand-bar {
  grid-column: 2 / -1;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.cand-bar > span {
  display: block;
  height: 100%;
  background: #4d86c9;
  border-radius: 99px;
}

.painel-vazio {
  padding: 24px 16px;
  color: #7a8ba3;
  font-size: 13px;
  text-align: center;
}

.painel-v1,
.painel-v2 {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.painel-v1[hidden],
.painel-v2[hidden] {
  display: none !important;
}

/* --- Painel v2 --- */
.painel.is-v2 {
  background: rgba(10, 12, 16, 0.52);
  border-right-color: rgba(255, 255, 255, 0.06);
}

.painel-v2 {
  padding: 12px 12px 12px;
  gap: 0;
}

.p2-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.p2-abrangencia {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  line-height: 1.2;
}

.p2-abr-cargo {
  font-size: var(--p2-abr-cargo-size, 12px);
  font-weight: 500;
  color: var(--p2-abr-cargo-cor, rgba(232, 238, 248, 0.5));
  letter-spacing: 0.02em;
}

.p2-abr-local {
  font-size: var(--p2-abr-local-size, 22px);
  font-weight: var(--p2-abr-local-weight, 800);
  color: var(--p2-abr-local-cor, #ffffff);
  letter-spacing: -0.03em;
}

.p2-badge {
  flex-shrink: 0;
  max-width: 58%;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2-duelo {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.p2-logo {
  display: block;
  width: var(--p2-logo-largura, 68px);
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.p2-logo-duelo {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 2;
}

.p2-logo-regioes,
.p2-logo-estados {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.p2-cand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.p2-cand-b {
  align-items: flex-end;
  text-align: right;
}

.p2-cand-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p2-cand-b .p2-cand-head {
  flex-direction: row-reverse;
}

.p2-foto-wrap {
  width: 78px;
  height: 102px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.p2-foto {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: transparent;
}

.p2-foto.is-fallback,
.p2-foto-wrap .p2-foto.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.p2-id {
  min-width: 0;
}

.p2-id .selo-resultado {
  display: inline-block;
}

.p2-cand-b .p2-id .selo-resultado {
  margin-left: auto;
}

.p2-nome {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.p2-partido {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.p2-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p2-cand-b .p2-stats {
  align-items: flex-end;
}

.p2-pct {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.p2-pct small {
  font-size: 0.52em;
  font-weight: 800;
  margin-left: 2px;
  vertical-align: 0.12em;
}

.p2-votos {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.p2-bar-wrap {
  margin-top: 0;
  padding-top: 0;
}

.p2-bar {
  display: flex;
  align-items: stretch;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.p2-bar-a,
.p2-bar-b {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width 0.4s ease;
}

.p2-bar-div {
  width: 2px;
  flex-shrink: 0;
  background: #fff;
  align-self: stretch;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.p2-regioes {
  --p2-reg-fonte-escala: 0.8;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  min-height: 0;
  flex: 1.4 1 0;
  display: flex;
  flex-direction: column;
}

.p2-regioes[hidden] {
  display: none !important;
}

.p2-regioes-head {
  position: relative;
  flex-shrink: 0;
  margin-bottom: 8px;
  padding-right: calc(var(--p2-logo-largura, 68px) + 10px);
}

.p2-regioes-head-text {
  min-width: 0;
}

.p2-regioes-titulo {
  font-size: calc(16px * var(--p2-reg-fonte-escala));
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.p2-regioes-sub {
  margin-top: 2px;
  font-size: calc(12px * var(--p2-reg-fonte-escala));
  color: rgba(232, 238, 248, 0.5);
}

.p2-regioes-lista {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.p2-regiao {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr) 3.4em;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.p2-regiao:last-child {
  border-bottom: 0;
}

.p2-regiao-info {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  min-width: 0;
}

.p2-regiao-nome {
  font-size: calc(14px * var(--p2-reg-fonte-escala));
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2-regiao-pst {
  margin-top: 2px;
  font-size: calc(11px * var(--p2-reg-fonte-escala));
  color: var(--p2-reg-pst-cor, #ffffff);
}

.p2-regiao-mid {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.p2-regiao-score {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
}

.p2-regiao-pct {
  font-size: calc(14px * var(--p2-reg-fonte-escala));
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1;
  min-width: 4.2em;
}

.p2-regiao-pct-a {
  text-align: right;
}

.p2-regiao-fotos {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.p2-regiao-foto {
  width: var(--p2-reg-foto, 28px);
  height: var(--p2-reg-foto, 28px);
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: #333;
  flex-shrink: 0;
}

.p2-regiao-foto.is-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(11px * var(--p2-reg-fonte-escala));
  font-weight: 800;
  color: #fff;
}

.p2-regiao-pct-b {
  text-align: left;
}

.p2-regiao-delta {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  font-size: calc(12px * var(--p2-reg-fonte-escala));
  font-weight: 600;
  color: rgba(232, 238, 248, 0.45);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.p2-regiao-votos {
  font-size: calc(11px * var(--p2-reg-fonte-escala));
  font-weight: 500;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.p2-regiao-bar {
  display: none !important;
}

.p2-regiao-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  max-width: 100%;
}

.p2-regiao-bar > i {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  border-radius: 1px;
}

.p2-regioes-loading,
.p2-regioes-erro {
  padding: 12px 0;
  font-size: calc(12px * var(--p2-reg-fonte-escala));
  color: rgba(232, 238, 248, 0.45);
}

.p2-grafico {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.p2-grafico[hidden] {
  display: none !important;
}

.p2-grafico-titulo {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.p2-grafico-legenda {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.p2-grafico-legenda-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(232, 238, 248, 0.75);
  white-space: nowrap;
}

.p2-grafico-legenda-item i {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 99px;
  flex-shrink: 0;
}

.p2-grafico-legenda-item i.is-quad {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.p2-grafico-svg {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
}

.p2-grafico-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.p2-grafico-svg text {
  font-family: inherit;
}

.p2-vazio {
  padding: 28px 8px;
  color: rgba(232, 238, 248, 0.45);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 768px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .topbar {
    display: none !important;
  }

  .painel {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    overflow-x: hidden;
    overflow-y: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .painel-v2 {
    max-width: 100%;
    overflow-x: hidden;
  }

  .painel-v1,
  .painel-v2 {
    flex: none;
    overflow: visible;
  }

  /* Desktop usa flex equidistante; no mobile as linhas precisam de altura natural */
  .p2-regioes {
    flex: none;
    overflow: visible;
    min-height: 0;
  }

  .p2-regioes-lista {
    flex: none;
    justify-content: flex-start;
  }

  .p2-regiao {
    flex: none;
    min-height: auto;
    padding: 8px 0;
  }

  .p2-grafico {
    flex: none;
    min-height: 0;
    overflow: visible;
  }

  .p2-grafico-svg {
    flex: none;
    min-height: var(--p2-grafico-altura-mobile, 160px);
    height: var(--p2-grafico-altura-mobile, 160px);
  }

  .p2-grafico-svg svg {
    height: 100%;
  }

  .p2-top {
    gap: 8px;
    align-items: flex-start;
  }

  .p2-abrangencia {
    flex: 1 1 auto;
    min-width: 0;
  }

  .p2-badge {
    flex: 1 1 auto;
    max-width: 62%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-size: 10px;
    padding: 5px 8px;
  }

  .p2-nome {
    font-size: 14px;
  }

  #map-wrap {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    height: var(--mobile-mapa-min-altura, 38vh);
    min-height: var(--mobile-mapa-min-altura, 38vh);
    overflow: hidden;
  }

  .map-scroll-shield {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 5;
    background: transparent;
    touch-action: pan-y;
    pointer-events: auto;
    cursor: default;
  }

  #map {
    touch-action: pan-y;
    cursor: default;
    pointer-events: none;
  }

  #map.is-dragging {
    cursor: default;
  }

  #estados path {
    cursor: default;
  }

  .legenda,
  #label-layer,
  #marker-layer,
  .mapa-logo {
    display: none !important;
  }

  .painel-direito {
    display: none !important;
  }

  .lista-estados:not([hidden]) {
    display: block !important;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 14px 12px 24px;
    overflow-x: hidden;
    background: rgba(10, 12, 16, 0.72);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    --p2-reg-fonte-escala: 0.85;
  }

  .lista-estados-head {
    position: relative;
    margin-bottom: 12px;
    padding-right: calc(var(--p2-logo-largura, 68px) + 10px);
    min-height: calc(var(--p2-logo-largura, 68px) * 0.35);
  }

  .lista-estados-head-text {
    min-width: 0;
  }

  .lista-estados-titulo {
    font-size: calc(16px * var(--p2-reg-fonte-escala));
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
  }

  .lista-estados-sub {
    margin-top: 2px;
    font-size: calc(12px * var(--p2-reg-fonte-escala));
    color: rgba(232, 238, 248, 0.5);
  }

  .lista-estados-lista {
    display: flex;
    flex-direction: column;
    flex: none;
    justify-content: flex-start;
    gap: 0;
  }

  .lista-estados-lista .p2-regiao {
    flex: none;
    min-height: auto;
    padding: 10px 0;
  }
}

.lista-estados {
  display: none !important;
}

#label-layer,
#marker-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

#marker-layer .muni-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  user-select: none;
}

#marker-layer .muni-marker.is-visible {
  display: flex;
}

#marker-layer .muni-marker .dot {
  width: var(--marker-dot-size, 8px);
  height: var(--marker-dot-size, 8px);
  border-radius: 50%;
  background: var(--marker-dot-cor, #fff);
  border: var(--marker-dot-borda, 2px) solid var(--marker-dot-borda-cor, #0b1220);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

#marker-layer .muni-marker .nome {
  color: var(--marker-nome-cor, #fff);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: var(--marker-nome-size, 13px);
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: var(
    --marker-nome-shadow,
    0 2px 6px rgba(0, 0, 0, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.95)
  );
}

#label-layer .uf-label {
  position: absolute;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--label-fill, #f2f7ff);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 700;
  font-size: var(--label-font-size-px, 20px);
  line-height: 1;
  white-space: nowrap;
  text-shadow: var(
    --label-text-shadow,
    0 4px 12px rgba(0, 0, 0, 0.9),
    0 1px 3px rgba(0, 0, 0, 0.95)
  );
  user-select: none;
  pointer-events: none;
}

#label-layer .uf-label .uf-sigla {
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

#label-layer .uf-label .uf-resultado {
  display: flex;
  align-items: center;
  gap: var(--uf-resultado-gap, 4px);
  font-size: var(--uf-resultado-font, 11px);
  font-weight: 700;
  line-height: 1;
  color: var(--label-fill, #f2f7ff);
}

#label-layer .uf-label .uf-resultado-swatch {
  width: var(--uf-resultado-quad, 8px);
  height: var(--uf-resultado-quad, 8px);
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

#label-layer .uf-label .uf-resultado-pct {
  font-variant-numeric: tabular-nums;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  background: var(--fundo, #0b1220);
}

#map.is-dragging {
  cursor: grabbing;
}

#estados path {
  fill: var(--estado-fill, #2a5080);
  stroke: var(--estado-stroke, #9ec5f0);
  stroke-width: var(--estado-stroke-width, 5500);
  stroke-linejoin: round;
  cursor: pointer;
}

/* Municípios clicáveis: estados só desenham borda, sem capturar clique */
body.mapa-munis-sempre #estados,
body.mapa-aba-estado #estados {
  pointer-events: none;
}

body.mapa-munis-sempre #estados path,
body.mapa-aba-estado #estados path {
  fill: var(--estado-fill-com-munis, transparent);
  stroke-width: var(--estado-stroke-width-com-munis, 7000);
}

body.mapa-munis-sempre #municipios,
body.mapa-aba-estado #municipios {
  display: block;
}

#estados path:hover,
#estados path.is-hover {
  fill: var(--estado-fill-hover, #3d6fad);
}

#estados path.is-active {
  fill: var(--estado-fill-active, #4d86c9);
}

#estados.path-dim path:not(.is-active) {
  fill: var(--estado-fill-dim, #152338);
  stroke: var(--estado-stroke-dim, #3a5070);
  pointer-events: none;
}

#municipios path {
  fill: var(--muni-fill, #ffffff);
  stroke: var(--muni-stroke, #a8d0f5);
  stroke-width: var(--muni-stroke-width, 1800);
  stroke-linejoin: round;
  cursor: pointer;
}

body.muni-cor-animada #municipios path {
  transition: fill var(--muni-transicao-cor, 1600ms) ease;
}

#municipios path:hover,
#municipios path.is-hover {
  fill: var(--muni-fill-hover, #4a82c4);
}

#municipios path.is-active {
  fill: var(--muni-fill-active, #7eb6f0);
  stroke: var(--muni-stroke-active, #e8f3ff);
}

#municipios path[data-cor-partido]:hover {
  filter: brightness(1.12);
}

.topbar {
  position: absolute;
  z-index: 4;
  top: 16px;
  left: calc(var(--painel-largura, 360px) + 16px);
  right: calc(var(--painel-direita-largura, 0px) + 16px);
  pointer-events: none;
}

.topbar-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  pointer-events: auto;
  padding: 8px 8px 6px 10px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  max-width: 100%;
}

.app-title {
  margin: 0;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.2;
  text-align: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
  justify-content: var(--abas-justify, flex-start);
  align-content: var(--abas-align-content, flex-start);
}

body.abas-duas-linhas .tabs-duas-linhas {
  max-height: calc(var(--abas-linhas, 2) * 32px + 4px);
  overflow: hidden;
}

body.abas-siglas .tabs {
  max-height: none;
  overflow: visible;
}

body.abas-siglas .tab {
  min-width: 34px;
  padding: 5px 6px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
}

.tab {
  flex-shrink: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: #9fb0c9;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  line-height: 1.2;
}

.tab:hover {
  color: #fff;
}

.tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  cursor: default;
}

.hover-label {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(12px, 12px);
}

.legenda-stack {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-width: min(320px, calc(100vw - 32px));
  pointer-events: none;
}

.legenda-stack[hidden] {
  display: none !important;
}

.turno-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  pointer-events: none;
}

.polling-countdown {
  display: block;
  pointer-events: none;
  margin: 0;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(232, 238, 248, 0.55);
  text-align: center;
  white-space: nowrap;
}

.polling-countdown[hidden] {
  display: none !important;
}

.turno-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.turno-switch[hidden] {
  display: none !important;
}

.turno-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(11, 18, 32, 0.92);
  color: #9fb0c9;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  line-height: 1.2;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.turno-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.turno-btn.is-ativo {
  color: #0b1220;
  background: #e8eef8;
  border-color: #e8eef8;
  cursor: default;
}

.legenda {
  position: relative;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.92);
  border: 1px solid rgba(158, 197, 240, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #e8f0fa;
  font-size: 12px;
  pointer-events: none;
}

.legenda[hidden] {
  display: none !important;
}

/* Troca rápida: legenda.posicao no mapa-config.json (aplica no stack) */
.legenda-stack.legenda-topo-esquerda {
  top: 16px;
  bottom: auto;
  left: calc(var(--painel-largura, 360px) + 16px);
  right: auto;
}

.legenda-stack.legenda-topo-direita {
  top: 16px;
  bottom: auto;
  right: calc(var(--painel-direita-largura, 0px) + 16px);
  left: auto;
}

.legenda-stack.legenda-rodape-esquerda {
  top: auto;
  bottom: 16px;
  left: calc(var(--painel-largura, 360px) + 16px);
  right: auto;
}

.legenda-stack.legenda-rodape-direita {
  top: auto;
  bottom: 16px;
  right: calc(var(--painel-direita-largura, 0px) + 16px);
  left: auto;
}

.mapa-logo {
  position: fixed;
  z-index: 5;
  bottom: 16px;
  right: calc(var(--painel-direita-largura, 0px) + 16px);
  width: var(--p2-logo-largura, 68px);
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.btn-tela-cheia {
  position: fixed;
  z-index: 6;
  bottom: var(--tela-cheia-bottom, var(--tela-cheia-offset, 16px));
  right: calc(var(--painel-direita-largura, 0px) + var(--tela-cheia-offset, 16px));
  width: var(--tela-cheia-tamanho, 34px);
  height: var(--tela-cheia-tamanho, 34px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--tela-cheia-borda, rgba(255, 255, 255, 0.14));
  border-radius: 8px;
  background: var(--tela-cheia-fundo, rgba(11, 18, 32, 0.55));
  color: var(--tela-cheia-icone, rgba(255, 255, 255, 0.85));
  opacity: var(--tela-cheia-opacidade, 0.4);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 160ms ease, background 160ms ease;
}

.btn-tela-cheia:hover,
.btn-tela-cheia:focus-visible {
  opacity: var(--tela-cheia-opacidade-hover, 0.75);
  outline: none;
}

.btn-tela-cheia[hidden] {
  display: none !important;
}

.btn-tela-cheia-icon {
  width: 18px;
  height: 18px;
  display: block;
}

body.is-tela-cheia .btn-tela-cheia .is-entrar {
  display: none;
}

body.is-tela-cheia .btn-tela-cheia .is-sair {
  display: block !important;
}

body:not(.is-tela-cheia) .btn-tela-cheia .is-sair {
  display: none !important;
}

.mapa-logo[hidden] {
  display: none !important;
}

.legenda-titulo {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 240, 250, 0.7);
}

.legenda-partido {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 6px 8px;
  align-items: center;
  margin-top: 8px;
}

.legenda-partido:first-of-type {
  margin-top: 0;
}

.legenda-partido-nome {
  font-weight: 700;
  font-size: 12px;
}

.legenda-faixas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.legenda-faixa {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.legenda-swatch {
  width: 100%;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.legenda-faixa-rotulo {
  font-size: 9px;
  line-height: 1.1;
  color: rgba(232, 240, 250, 0.65);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .legenda {
    padding: 8px 10px;
  }

  .legenda-stack.legenda-topo-esquerda,
  .legenda-stack.legenda-topo-direita {
    top: 10px;
  }

  .legenda-stack.legenda-rodape-esquerda,
  .legenda-stack.legenda-rodape-direita {
    bottom: 10px;
  }

  .legenda-stack.legenda-topo-esquerda,
  .legenda-stack.legenda-rodape-esquerda {
    left: 10px;
    right: auto;
  }

  .legenda-stack.legenda-topo-direita,
  .legenda-stack.legenda-rodape-direita {
    right: 10px;
    left: auto;
  }

  .mapa-logo {
    right: 10px;
    bottom: 10px;
  }
}

.form-faixas {
  position: fixed;
  z-index: 6;
  top: 16px;
  right: 16px;
  width: min(280px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(11, 18, 32, 0.94);
  border: 1px solid rgba(158, 197, 240, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  color: #e8f0fa;
  font-size: 12px;
  pointer-events: auto;
}

.form-faixas-titulo {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(232, 240, 250, 0.7);
}

.form-faixas-grupo {
  margin-top: 10px;
}

.form-faixas-grupo:first-of-type {
  margin-top: 0;
}

.form-faixas-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(232, 240, 250, 0.85);
}

.form-faixas-limites {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.form-faixas-campo {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.form-faixas-campo span {
  font-size: 9px;
  color: rgba(232, 240, 250, 0.55);
}

.form-faixas-campo input[type="number"] {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid rgba(158, 197, 240, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #e8f0fa;
  font-size: 12px;
}

.form-faixas-cores {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.form-faixas-cores input[type="color"] {
  width: 100%;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.form-faixas-hint {
  margin: 4px 0 0;
  font-size: 9px;
  color: rgba(232, 240, 250, 0.45);
}

@media (max-width: 768px) {
  .form-faixas {
    top: 10px;
    right: 10px;
    width: min(260px, calc(100vw - 20px));
  }
}
