:root {
  --azul: #c2410c;
  --azul-claro: #f97316;
  --verde: #15803d;
  --vermelho: #b91c1c;
  --cinza-bg: #f3f4f6;
  --cinza-borda: #e5e7eb;
  --texto: #1f2937;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--cinza-bg);
  color: var(--texto);
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar {
  background: var(--azul);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.navbar .brand { font-weight: 700; font-size: 1.1rem; color: #fff; }
.navbar .brand:hover { text-decoration: none; }

.navbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
}
.navbar nav a {
  color: #dbeafe;
  font-size: 0.92rem;
  padding: 0.2rem 0;
}
.navbar nav a.active, .navbar nav a:hover { color: #fff; font-weight: 600; }

.navbar .userbox { display: flex; align-items: center; gap: 0.8rem; font-size: 0.85rem; color: #dbeafe; }
.navbar form { margin: 0; }

.container { max-width: 1600px; margin: 0 auto; padding: 1.5rem; }

@media (max-width: 640px) {
  .navbar { padding: 0.7rem 1rem; }
  .navbar nav { gap: 0.15rem 0.8rem; }
  .navbar nav a { font-size: 0.85rem; }
  .navbar .userbox { width: 100%; justify-content: space-between; }
  .container { padding: 0.9rem; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.05rem; }
  .card { padding: 0.9rem; }
}

.card {
  background: #fff;
  border: 1px solid var(--cinza-borda);
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { text-align: center; }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--azul); }
.stat .label { font-size: 0.85rem; color: #6b7280; }
.stat .sublabel { font-size: 0.8rem; color: var(--verde); font-weight: 600; margin-top: 0.3rem; }
@media (max-width: 640px) {
  .stat .num { font-size: 1.6rem; }
  .stat .label { font-size: 0.78rem; }
  .stat .sublabel { font-size: 0.72rem; }
}

h1, h2, h3 { color: var(--azul); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

.tabela-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 68vh;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
  scrollbar-color: #9ca3af #f3f4f6;
}
/* deixa a barra de rolagem horizontal (embaixo) bem visivel, em vez da fininha
   padrao que passa despercebida. A vertical (direita) fica bem fina, so pra nao
   cortar visualmente o conteudo da tabela (ela fica meio que "no meio" da linha
   quando a tabela e mais larga que a caixa, ja que fica presa na borda da caixa
   e nao na borda da tabela toda). */
.tabela-scroll::-webkit-scrollbar:horizontal { height: 12px; }
.tabela-scroll::-webkit-scrollbar:vertical { width: 6px; }
.tabela-scroll::-webkit-scrollbar-track { background: #f3f4f6; }
.tabela-scroll::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 999px; }
.tabela-scroll::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* sombra na borda direita como dica visual de que tem mais colunas pra ver */
.tabela-scroll::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 12px;
  width: 20px;
  background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.08));
  pointer-events: none;
}

/* border-collapse:separate (em vez de collapse) evita um bug conhecido do Chrome onde
   cabecalho fixo (position:sticky) dentro de tabela com bordas coladas deixa pedaco de
   linha "vazando" por cima dele enquanto rola - por isso a borda embaixo de cada celula
   agora e feita com box-shadow (que nao depende do border-collapse) em vez de border. */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; box-shadow: inset 0 -1px 0 var(--cinza-borda); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
th { background: #f9fafb; color: #374151; font-weight: 600; }
tr:hover td { background: #f8fafc; }

/* alca pra arrastar e redimensionar a largura da coluna (public/js/tabela-resize.js) -
   fica com uma marquinha visivel sempre (nao so quando passa o mouse em cima), pra dar
   pra perceber que aquela borda e arrastavel sem precisar descobrir por acaso. */
.coluna-redimensionar {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 10px;
  cursor: col-resize;
  z-index: 5;
}
.coluna-redimensionar::after {
  content: '';
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: #9ca3af;
  border-radius: 3px;
}
.coluna-redimensionar:hover, .coluna-redimensionar:active {
  background: rgba(37, 99, 235, 0.15);
}
.coluna-redimensionar:hover::after, .coluna-redimensionar:active::after {
  background: var(--azul-claro);
  width: 4px;
}

/* cabecalho fica fixo no topo enquanto rola pra baixo dentro da caixa da tabela -
   assim a barra de rolagem lateral (embaixo da caixa) fica sempre por perto,
   sem precisar descer a pagina inteira pra chegar nela.
   O sticky vai no <thead> inteiro (nao em cada <th> separado) - grudar cada celula
   individualmente deixava a linha do cabecalho as vezes "descolar" e aparecer fora
   de ordem durante a rolagem. Com o thead inteiro grudando de uma vez só, ele sempre
   se move como uma peça só. */
.tabela-scroll thead {
  position: sticky;
  top: 0;
  z-index: 3;
  /* forca o Chrome a tratar o cabecalho como uma camada propria (GPU), em vez de
     redesenhar ele every frame durante a rolagem - sem isso, em rolagens rapidas
     o navegador as vezes mostra por uma fracao de segundo o conteudo antigo (a
     linha que estava por baixo) antes de repintar o cabecalho por cima. */
  will-change: transform;
  transform: translateZ(0);
}
.tabela-scroll thead th {
  position: relative;
}

/* primeira coluna (nome) fica fixa enquanto rola pro lado, pra sempre saber de quem e a linha */
.tabela-scroll th:first-child, .tabela-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}
.tabela-scroll th:first-child { z-index: 4; background: #f9fafb; }
.tabela-scroll tr:hover td:first-child { background: #f8fafc; }

/* tabela com coluna de checkbox de selecao (ex: excluir eleitores em massa) -
   a checkbox vira a 1a coluna fixa, entao a 2a coluna (nome) tambem precisa
   ficar fixa do lado dela pra continuar dando pra saber de quem e a linha. */
.tabela-selecao th:first-child, .tabela-selecao td:first-child {
  width: 2.4rem;
  text-align: center;
}
.tabela-selecao th:nth-child(2), .tabela-selecao td:nth-child(2) {
  position: sticky;
  left: 2.4rem;
  z-index: 2;
  background: #fff;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}
.tabela-selecao th:nth-child(2) { z-index: 4; background: #f9fafb; }
.tabela-selecao tr:hover td:nth-child(2) { background: #f8fafc; }

@media (max-width: 640px) {
  table { font-size: 0.82rem; }
  th, td { padding: 0.45rem 0.5rem; }
  .tabela-scroll::before {
    content: '← arraste para o lado para ver mais colunas →';
    display: block;
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
    padding-bottom: 0.4rem;
  }
}

.btn {
  display: inline-block;
  background: var(--azul-claro);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn:hover { background: var(--azul); text-decoration: none; color: #fff; }
.btn-secundario { background: #6b7280; }
.btn-secundario:hover { background: #4b5563; }
.btn-perigo { background: var(--vermelho); }
.btn-perigo:hover { background: #7f1d1d; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

.form-group { margin-bottom: 0.9rem; }
.form-group small { display: block; margin-top: 0.25rem; font-size: 0.78rem; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: #374151; }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul-claro); border-color: transparent; }

.filtros { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filtros .form-group { margin-bottom: 0; min-width: 160px; }
@media (max-width: 640px) {
  .filtros .form-group { min-width: 100%; }
}

/* dropdown de filtro com varias caixinhas marcaveis ao mesmo tempo (ex: status em
   Ligações) - o botao mostra um resumo do que ta marcado, e o painel com as opcoes
   so aparece quando clica (public/js/multiselect.js cuida de abrir/fechar). */
.multiselect { position: relative; }
.multiselect-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.multiselect-toggle:hover { border-color: #9ca3af; }
.multiselect-seta { color: #6b7280; font-size: 0.7rem; margin-left: 0.5rem; }
.multiselect-painel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  padding: 0.35rem;
  z-index: 20;
  white-space: nowrap;
}
.multiselect.aberto .multiselect-painel { display: block; }
.multiselect-busca {
  width: 100%;
  margin-bottom: 0.3rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--cinza-borda);
  border-radius: 4px;
}
.multiselect-acoes {
  display: flex;
  gap: 0.6rem;
  padding: 0 0.4rem 0.35rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid var(--cinza-borda);
}
.multiselect-acoes button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--azul, #1e3a8a);
  cursor: pointer;
  text-decoration: underline;
}
.multiselect-acoes button:hover { color: #111827; }
.multiselect-opcoes { max-height: 260px; overflow-y: auto; }
.multiselect-painel label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: normal;
  font-size: 0.88rem;
  color: #111827;
  margin-bottom: 0;
}
.multiselect-painel label:hover { background: #f3f4f6; }
.multiselect-painel input[type="checkbox"] { width: auto; margin: 0; }
.multiselect-sem-resultado { padding: 0.4rem; font-size: 0.85rem; color: #6b7280; }

/* autocomplete de texto livre com busca sem acento (candidatos do Call Center) -
   public/js/autocomplete-acento.js cuida da filtragem e do clique/teclado. */
.autocomplete-wrap { position: relative; }
.autocomplete-lista {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  z-index: 20;
}
.autocomplete-item { padding: 0.45rem 0.6rem; cursor: pointer; font-size: 0.88rem; }
.autocomplete-item:hover, .autocomplete-item.ativo { background: #f3f4f6; }

/* campo com resposta que nao bate com nenhuma opcao oficial da lista (texto
   livre digitado sem escolher da lista) - o formulario nao envia assim. */
.input-invalido { border-color: #dc2626 !important; background: #fef2f2; }

.alert { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-erro { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-sucesso { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-aviso { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* aviso de nome parecido/igual no formulario de Novo Cadastro (campo Nome,
   ver public/js/duplicados-cadastro.js) - "parecido" e so o texto em amarelo
   (mesmo aviso informativo de sempre, nao bloqueia salvar); "igual" vira uma
   caixa vermelha listando nome/indicacao/grupo de cada cadastro que bate
   exatamente, pra dar pra comparar sem precisar abrir os outros cadastros. */
.campo-aviso { display: block; margin-top: 0.25rem; font-size: 0.78rem; }
.campo-aviso-parecido { color: #92400e; }
.campo-aviso-igual { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; border-radius: 4px; padding: 0.4rem 0.6rem; }
.campo-aviso-igual strong { display: block; margin-bottom: 0.2rem; }
.campo-aviso-igual .campo-aviso-match { margin-top: 0.15rem; }

.badge {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-vota { background: #dcfce7; color: #166534; }
.badge-nao_vota { background: #fee2e2; color: #991b1b; }
.badge-nao_atendeu { background: #fef3c7; color: #92400e; }
.badge-nao_chama { background: #e5e7eb; color: #374151; }
.badge-casa_fechada { background: #e5e7eb; color: #374151; }
.badge-carro_adesivado_outro { background: #ffedd5; color: #9a3412; }
.badge-nao_quis_informar { background: #e0e7ff; color: #3730a3; }
.badge-nao_quis_responder { background: #fae8ff; color: #86198f; }
.badge-retornar_mais_tarde { background: #dbeafe; color: #1e40af; }
.badge-estrangeiro { background: #ede9fe; color: #5b21b6; }
.badge-pendente { background: #f3f4f6; color: #6b7280; border: 1px dashed #d1d5db; }
.badge-enquete_pendente { background: #f3f4f6; color: #6b7280; border: 1px dashed #d1d5db; }

.ligar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--verde);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.ligar-btn:hover { background: #166534; color: #fff; text-decoration: none; }

.mapa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--azul-claro);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}
.mapa-btn:hover { background: var(--azul); color: #fff; text-decoration: none; }

.progress-bar { background: #e5e7eb; border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar > div { background: var(--verde); height: 100%; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
}
.login-box {
  background: #fff;
  padding: 2.2rem;
  border-radius: 12px;
  width: 340px;
  max-width: calc(100vw - 2rem);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.login-box h1 { text-align: center; margin-top: 0; }
.login-box .subtitulo { text-align: center; color: #6b7280; font-size: 0.85rem; margin-bottom: 1.5rem; }

.pagination { display: flex; gap: 0.4rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--cinza-borda);
  border-radius: 6px;
  font-size: 0.85rem;
}
.pagination .ativo { background: var(--azul-claro); color: #fff; border-color: var(--azul-claro); }

.acoes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.text-muted { color: #6b7280; font-size: 0.85rem; }

/* botoes tipo "pill" pra escolher sexo/faixa etaria/status na Pesquisa de
   Opiniao - preferido a <select> aqui porque e usado em campo, no celular,
   e um toque grande e mais rapido/confiavel que abrir um dropdown andando
   de porta em porta. */
.opcoes-pill { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.opcoes-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opcoes-pill label {
  display: inline-flex; align-items: center; cursor: pointer;
  padding: 0.55rem 1rem; border: 1px solid var(--cinza-borda); border-radius: 999px;
  font-size: 0.88rem; user-select: none; background: #fff;
}
.opcoes-pill input:checked + span { color: #fff; }
.opcoes-pill label:has(input:checked) { background: var(--azul); border-color: var(--azul); color: #fff; }

@media (max-width: 640px) {
  .btn { padding: 0.55rem 0.9rem; }
  .btn-sm { padding: 0.4rem 0.7rem; }
}

@media print {
  .navbar, .no-print { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0.5rem 0; margin-bottom: 1rem; break-inside: avoid; }
  .tabela-scroll { max-height: none !important; overflow: visible !important; }
  .tabela-scroll th, .tabela-scroll td { position: static !important; }
  body { background: #fff; }
}

/* ===== Mapa de Lideres ===== */
.mapa-busca {
  width: 100%; max-width: 420px; padding: 0.55rem 0.8rem;
  border: 1px solid var(--cinza-borda); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit;
}
.mapa-busca-resultado {
  margin-top: 0.6rem; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--cinza-borda); border-radius: 8px;
}
.mapa-busca-item {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--cinza-borda); font-size: 0.88rem;
  cursor: pointer;
}
.mapa-busca-item:last-child { border-bottom: none; }
.mapa-busca-item:hover { background: var(--cinza-bg); }

/* layout: mapa ocupando toda a largura em cima, painel (lideres do municipio +
   liderados do lider selecionado) embaixo, lado a lado - empilha em telas
   estreitas (pedido do Rodrigo: mapa maior, paineis embaixo em vez de
   espremidos numa coluna estreita do lado). */
.mapa-layout { display: flex; flex-direction: column; gap: 1rem; }
.mapa-col-mapa { width: 100%; }
.mapa-col-painel { display: flex; flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
/* flex-grow:0 (em vez de 1) de proposito - cada painel fica do tamanho dele
   (300 a 440px), lado a lado, sem esticar pra preencher a linha toda quando
   so tem 1 ou 2 abertos (era isso que deixava um painel sozinho enorme, com
   o resto vazio do lado). */
.mapa-col-painel > .mapa-painel-fixo { flex: 0 1 400px; min-width: 300px; max-width: 440px; }

.mapa-wrapper-real {
  /* mapa ficou grande demais ocupando a largura toda do card (que pode
     chegar a 1600px no container) - limita o tamanho maximo e centraliza,
     mantendo responsivo em telas estreitas (max-width: 100% cobre isso). */
  position: relative; width: 100%; max-width: 620px; margin: 0 auto; background: #eef2ff; border-radius: 12px; overflow: hidden;
}
.mapa-svg-real { display: block; width: 100%; height: auto; }

.mapa-valor-total-geral {
  position: absolute; right: 0.6rem; bottom: 0.6rem; background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--cinza-borda); border-radius: 8px; padding: 0.35rem 0.65rem;
  font-size: 0.8rem; font-weight: 700; color: var(--texto); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.mapa-valor-total-geral span { color: var(--verde); }
@media (max-width: 640px) {
  .mapa-valor-total-geral { font-size: 0.7rem; padding: 0.28rem 0.5rem; }
}

.mapa-regiao {
  stroke: #fff; stroke-width: 0.5; cursor: pointer; transition: filter 0.1s ease;
}
.mapa-regiao:hover { filter: brightness(0.93); }
.mapa-regiao.selecionada { stroke: var(--azul); stroke-width: 1.4; }

.mapa-cor-0 { fill: #c7d2fe; }
.mapa-cor-1 { fill: #a7f3d0; }
.mapa-cor-2 { fill: #fde68a; }
.mapa-cor-3 { fill: #fbcfe8; }
.mapa-cor-4 { fill: #bae6fd; }
.mapa-cor-5 { fill: #fecaca; }
.mapa-cor-6 { fill: #ddd6fe; }
.mapa-cor-7 { fill: #fed7aa; }

.mapa-regiao-label {
  font-size: 2.3px; font-weight: 700; fill: var(--texto); pointer-events: none;
  paint-order: stroke; stroke: rgba(255,255,255,0.85); stroke-width: 0.5px; stroke-linejoin: round;
}
.mapa-regiao-sub { font-size: 1.9px; font-weight: 600; fill: var(--azul); }
.mapa-regiao-valor { font-size: 1.9px; font-weight: 700; fill: var(--verde); }

.mapa-painel-fixo { max-height: 46vh; overflow-y: auto; }
.mapa-painel-titulo { font-weight: 700; font-size: 0.88rem; color: var(--azul); margin-bottom: 0.5rem; }
.mapa-busca-municipio { margin-bottom: 0.6rem; font-size: 0.85rem; padding: 0.4rem 0.6rem; }

.mapa-lista-lideres { list-style: none; margin: 0; padding: 0; }
.mapa-lista-lideres li {
  display: flex; justify-content: space-between; gap: 0.6rem;
  padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--cinza-borda); font-size: 0.85rem;
  cursor: pointer; border-radius: 4px;
}
.mapa-lista-lideres li:last-child { border-bottom: none; }
.mapa-lista-lideres li:hover { background: var(--cinza-bg); }
.mapa-lider-info { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.mapa-lider-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapa-lider-grupo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.74rem; color: #6b7280; }
.mapa-lider-total { font-weight: 700; color: var(--azul-claro); flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; }
/* destaque de quem tem valor lancado (proprio ou dos liderados) na lista de
   lideres de um municipio - pedido do Rodrigo pra achar rapido "onde tem
   dinheiro" em municipios com muitos lideres (ex.: Boa Vista), sem precisar
   clicar um por um. Ver checkbox "So com valor lancado" em selecionarMunicipio. */
.mapa-lider-valor-badge { font-size: 0.72rem; color: var(--verde); font-weight: 700; }
.mapa-lista-lideres li.mapa-lider-com-valor { background: #f0fdf4; }
.mapa-lista-lideres li.mapa-lider-com-valor:hover { background: #dcfce7; }
.mapa-lista-solta { max-height: 320px; overflow-y: auto; }

.mapa-tabela-liderados { width: 100%; border-collapse: collapse; font-size: 0.83rem; table-layout: fixed; }
.mapa-tabela-liderados th, .mapa-tabela-liderados td { text-align: left; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--cinza-borda); }
.mapa-tabela-liderados th { background: #f9fafb; color: #374151; font-weight: 600; position: sticky; top: 0; }
/* nome e municipio podem quebrar linha (em vez de forcar rolagem lateral so
   pra caber nome comprido) - assim o campo de Valor sempre fica visivel sem
   precisar arrastar a tabela pro lado pra digitar. */
.mapa-tabela-liderados td:first-child, .mapa-tabela-liderados td:nth-child(2) {
  white-space: normal; word-break: break-word; overflow-wrap: break-word;
}
.mapa-tabela-liderados td:last-child, .mapa-tabela-liderados th:last-child { width: 92px; }
.mapa-tabela-liderados th:nth-child(2), .mapa-tabela-liderados td:nth-child(2) { width: 30%; }

.mapa-valor-input {
  width: 100%; padding: 0.25rem 0.35rem; font-size: 0.83rem;
  border: 1px solid var(--cinza-borda); border-radius: 4px; font-family: inherit;
}
.mapa-valor-input.mapa-salvando { border-color: var(--azul-claro); background: #eff6ff; }
.mapa-valor-input.mapa-salvo { border-color: var(--verde); background: #f0fdf4; }
.mapa-valor-input.mapa-erro { border-color: var(--vermelho); background: #fef2f2; }

.mapa-total-lider {
  margin-top: 0.7rem; padding-top: 0.6rem; border-top: 2px solid var(--cinza-borda);
  font-weight: 700; font-size: 0.9rem; color: var(--texto);
}
.mapa-total-lider span { color: var(--azul); }

.mapa-lider-valor-proprio {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  margin-bottom: 0.7rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--cinza-borda);
  font-weight: 600; font-size: 0.88rem;
}
.mapa-lider-valor-proprio input.mapa-valor-input { max-width: 130px; }

/* valor do proprio lider POR MES (pedido do Rodrigo: Julho, Agosto, Setembro...
   em vez de um unico valor) - grade de mes+valor, com controle de
   adicionar/excluir mes pra admin (a lista de mes e global, compartilhada
   entre todos os lideres). */
.mapa-lider-valor-mensal {
  margin-bottom: 0.7rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--cinza-borda);
}
.mapa-lider-valor-mensal-cabecalho {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  font-weight: 600; font-size: 0.88rem; margin-bottom: 0.5rem;
}
.mapa-add-mes-form {
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; flex-wrap: wrap;
}
.mapa-add-mes-form input {
  flex: 1 1 160px; padding: 0.3rem 0.5rem; font-size: 0.83rem;
  border: 1px solid var(--cinza-borda); border-radius: 4px; font-family: inherit;
}
.mapa-add-mes-form .text-muted { color: var(--vermelho); }
.mapa-lider-meses-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.mapa-lider-mes-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  font-size: 0.85rem;
}
.mapa-lider-mes-nome { color: #374151; }
.mapa-lider-mes-item input.mapa-valor-input { max-width: 130px; }
.mapa-mes-excluir {
  border: none; background: none; color: #9ca3af; cursor: pointer; font-size: 0.9rem;
  line-height: 1; padding: 0 0.15rem;
}
.mapa-mes-excluir:hover { color: var(--vermelho); }

.mapa-valor-com-prefixo {
  display: flex; align-items: stretch; max-width: 150px;
  border: 1px solid var(--cinza-borda); border-radius: 4px; overflow: hidden;
}
.mapa-valor-com-prefixo .prefixo {
  display: flex; align-items: center; padding: 0 0.4rem; background: #f3f4f6;
  border-right: 1px solid var(--cinza-borda); font-size: 0.83rem; font-weight: 600; color: #6b7280;
}
.mapa-valor-com-prefixo input.mapa-valor-input {
  border: none; border-radius: 0; max-width: none; flex: 1;
}
.mapa-valor-com-prefixo input.mapa-valor-input.mapa-salvando,
.mapa-valor-com-prefixo input.mapa-valor-input.mapa-salvo,
.mapa-valor-com-prefixo input.mapa-valor-input.mapa-erro { border: none; }
.mapa-valor-com-prefixo.mapa-salvando { border-color: var(--azul-claro); }
.mapa-valor-com-prefixo.mapa-salvo { border-color: var(--verde); }
.mapa-valor-com-prefixo.mapa-erro { border-color: var(--vermelho); }

@media (max-width: 640px) {
  .mapa-regiao-label { font-size: 2.9px; }
  .mapa-regiao-sub { font-size: 2.4px; }
  .mapa-regiao-valor { font-size: 2.4px; }
}

/* ===== Abas de mesclagem (Novo Cadastro: Mesclar Grupo/Bairro/Cidade) ===== */
.mesclar-abas {
  display: flex; gap: 0.4rem; flex-wrap: wrap; border-bottom: 2px solid #bfdbfe; padding-bottom: 0.5rem;
}
.mesclar-aba-btn {
  background: transparent; border: 1px solid transparent; border-radius: 6px 6px 0 0;
  padding: 0.4rem 0.8rem; font-size: 0.85rem; font-weight: 600; color: #1e40af; cursor: pointer;
}
.mesclar-aba-btn:hover { background: rgba(37, 99, 235, 0.08); }
.mesclar-aba-btn.ativa { background: #fff; border-color: #bfdbfe; border-bottom-color: #fff; color: var(--azul); }
.mesclar-aba-painel { padding-top: 0.2rem; }
