/* ==========================================================================
   Emendômetro — estilos
   Paleta do UOL, amostrada do uol.com.br:
     vermelho da marca #cb0003 · azul #355a9d
     fundo #f2f2f2 · tinta #212529 · amarelo #ffce00 (só em notas)
   Uma cor de dado por gráfico (o vermelho da marca); o azul marca valores
   negativos, por ser o polo frio oposto — é o par mais separável sob
   daltonismo, e o sinal também vai no rótulo, nunca só na cor.
   Contraste e separação conferidos: ver nota no README.
   ========================================================================== */

:root {
  color-scheme: light;

  --surface-1:      #ffffff;   /* superfície dos cartões/gráficos */
  --page:           #f2f2f2;   /* fundo do uol.com.br */
  --text-primary:   #212529;
  --text-secondary: #5a5a5a;
  --text-muted:     #767676;   /* o #808080 do UOL não alcança 4.5:1 */
  --gridline:       #e6e6e6;
  --baseline:       #cccccc;
  --border:         rgba(33, 37, 41, 0.14);

  --marca:          #cb0003;   /* vermelho UOL — cor de dado e de destaque */
  --marca-suave:    #fceaea;   /* mesmo matiz, bem clareado */
  --marca-escura:   #a30002;   /* hover */
  --negativa:       #355a9d;   /* azul UOL — polo oposto nos gráficos */
  --secreto:        #e8801a;   /* laranja — orçamento secreto (apadrinhamento) */
  --aviso-fundo:    #fff8e1;   /* amarelo UOL clareado, para notas */
  --aviso-borda:    #ffce00;
  --tinta-sobre-marca: #ffffff;   /* 5.93:1 sobre #cb0003 */

  --raio: 3px;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1:      #141414;
    --page:           #0a0a0a;
    --text-primary:   #f2f2f2;
    --text-secondary: #c4c4c4;
    --text-muted:     #9a9a9a;
    --gridline:       #2a2a2a;
    --baseline:       #3a3a3a;
    --border:         rgba(255, 255, 255, 0.14);
    --marca:          #f4443f;   /* vermelho UOL clareado p/ fundo escuro */
    --marca-suave:    #3a1414;
    --marca-escura:   #ff6b66;
    --negativa:       #7b9fe0;
    --secreto:        #f0a04b;
    --aviso-fundo:    #33290a;
    --aviso-borda:    #ffce00;
    --tinta-sobre-marca: #141414;   /* 5.04:1 sobre #f4443f */
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #141414;
  --page:           #0a0a0a;
  --text-primary:   #f2f2f2;
  --text-secondary: #c4c4c4;
  --text-muted:     #9a9a9a;
  --gridline:       #2a2a2a;
  --baseline:       #3a3a3a;
  --border:         rgba(255, 255, 255, 0.14);
  --marca:          #f4443f;
  --marca-suave:    #3a1414;
  --marca-escura:   #ff6b66;
  --negativa:       #7b9fe0;
  --secreto:        #f0a04b;
  --aviso-fundo:    #33290a;
  --aviso-borda:    #ffce00;
  --tinta-sobre-marca: #141414;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }

/* ---------- topo ---------- */

.topo {
  background: var(--surface-1);
  border-bottom: 3px solid var(--marca);
  padding: 34px 0 26px;
  position: relative;
}
/* faixa da marca no topo */
.topo::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--marca);
}
.topo h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.titulo-home {
  color: inherit;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.titulo-home:hover { border-bottom-color: var(--marca); }

/* barra de retorno, visível só quando um perfil está aberto */
.voltar-barra {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.voltar-barra[hidden] { display: none; }
.voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--marca);
  text-decoration: none;
}
.voltar:hover { text-decoration: underline; }
.subtitulo {
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 0 24px;
}

.resumo-geral dd { color: var(--text-primary); }

.resumo-geral {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin: 0;
}
.resumo-geral dt {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.resumo-geral dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

/* ---------- seletor ---------- */

.seletor {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  background: var(--page);
}
.seletor h2 { font-size: 1.125rem; margin-bottom: 16px; }

/* três portas de entrada da home */
.entradas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.entradas[hidden] { display: none; }
.entrada {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 18px 18px 20px;
  font: inherit;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--marca);
  border-radius: var(--raio);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.entrada:hover, .entrada:focus-visible {
  border-color: var(--marca);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  outline: none;
}
.entrada-titulo { font-size: 1.0625rem; font-weight: 700; color: var(--marca); }
.entrada-desc { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.35; }

.painel-entrada[hidden] { display: none; }
.voltar-entradas {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  cursor: pointer;
}
.voltar-entradas[hidden] { display: none; }
.voltar-entradas:hover { background: var(--surface-1); color: var(--marca); }

/* alternador parlamentar / empresa (legado) */
.modo-busca {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 18px;
  padding: 2px;
  background: var(--gridline);
  border-radius: var(--raio);
}
.modo {
  padding: 7px 14px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: calc(var(--raio) - 1px);
  cursor: pointer;
}
.modo[aria-selected="true"] {
  background: var(--surface-1);
  color: var(--marca);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.busca-rapida { position: relative; max-width: 460px; margin-bottom: 24px; }
.busca-rapida[hidden] { display: none; }
.busca-rapida label,
.filtro label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ajuda {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

input[type="search"], select {
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  min-height: 40px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 1px;
}
select:disabled { opacity: 0.5; }

.busca-resultados {
  position: absolute;
  z-index: 20;
  top: calc(100% - 14px);
  left: 0; right: 0;
  margin: 0; padding: 4px;
  list-style: none;
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  max-height: 300px;
  overflow-y: auto;
}
.busca-resultados li {
  padding: 8px 10px;
  border-radius: var(--raio);
  cursor: pointer;
  font-size: 0.875rem;
  min-height: 24px;
}
.busca-resultados li:hover,
.busca-resultados li[aria-selected="true"] { background: var(--marca-suave); }
.busca-resultados .r-meta { color: var(--text-muted); font-size: 0.8125rem; }
.busca-resultados .r-vazio { color: var(--text-muted); cursor: default; }

/* ---------- escolha do tipo de emenda ---------- */

.tipos {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
}
.tipos legend {
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.tipos-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.tipo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 14px 16px;
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  cursor: pointer;
  min-height: 44px;
}
.tipo:hover { border-color: var(--marca); }
.tipo[aria-checked="true"] {
  border-color: var(--marca);
  box-shadow: inset 0 0 0 1px var(--marca);
  background: var(--marca-suave);
}
.tipo-nome { font-weight: 600; font-size: 0.9375rem; }
.tipo-desc { font-size: 0.8125rem; color: var(--text-secondary); }
.tipo-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
}
.filtros[hidden] { display: none; }
.filtro[hidden] { display: none; }
.filtro-final { grid-column: span 2; }
.contador { font-weight: 400; color: var(--text-muted); }

.botao-limpar {
  padding: 9px 14px;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  cursor: pointer;
  min-height: 40px;
}
.botao-limpar:hover { background: var(--surface-1); }

/* ---------- perfil ---------- */

.perfil { padding: 32px 0 8px; }

.ficha {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
}
.ficha-foto {
  width: 96px; height: 128px;
  object-fit: cover;
  border-radius: var(--raio);
  background: var(--gridline);
  border: 1px solid var(--border);
  flex: none;
}
.ficha-foto[hidden] { display: none; }
.ficha-texto h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
.ficha-cargo { margin: 0; color: var(--text-secondary); }
.ficha-mandatos {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.ficha-mandatos li { margin-bottom: 1px; }
.ficha-mandatos .anos { color: var(--text-muted); }
/* nota de contexto: amarelo do UOL, que avisa sem soar alarme */
.destaque-ressalva {
  margin: 14px 0 0;
  padding: 9px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--aviso-fundo);
  border-left: 3px solid var(--aviso-borda);
  border-radius: 0 var(--raio) var(--raio) 0;
  max-width: 72ch;
}
.destaque-ressalva[hidden] { display: none; }

.destaque {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--marca);
  border-radius: var(--raio);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.destaque-rotulo {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.destaque-valor {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  /* figuras proporcionais: número isolado grande não leva tabular-nums */
}
.destaque-nota {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 68ch;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 36px;
}
.tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 14px 16px;
}
.tile dt {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.tile dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

/* nomes de favorecido/área são longos; entram menores e empilhados */
.tile-largo { grid-column: span 2; }
.tile-largo dd,
#p-area { display: flex; flex-direction: column; gap: 1px; }
.tile-nome {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
.tile-valor {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .tile-largo { grid-column: span 1; }
}

/* ---------- blocos de gráfico ---------- */

.bloco {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  padding: 20px 22px 22px;
  margin-bottom: 16px;
}
/* título de seção com o filete vermelho, como as editorias do UOL */
.bloco h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  padding-left: 10px;
  border-left: 3px solid var(--marca);
  line-height: 1.25;
}
.bloco-desc {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 70ch;
}
.bloco[hidden] { display: none; }

/* ---------- portal de transparência local ---------- */

.portal-local {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: var(--marca-suave);
  border: 1px solid var(--border);
  border-left: 4px solid var(--marca);
  border-radius: var(--raio);
}
.portal-local[hidden] { display: none; }
.portal-nota {
  margin: 0 0 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  max-width: 72ch;
}
.botao-portal {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tinta-sobre-marca);
  background: var(--marca);
  border-radius: var(--raio);
  text-decoration: none;
}
.botao-portal:hover { filter: brightness(0.92); }
.botao-portal .ext { font-size: 0.8125rem; }

/* ---------- links externos e download ---------- */

.ficha-links { margin: 8px 0 0; }
.link-externo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--marca);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.link-externo:hover {
  border-bottom-color: var(--marca);
}
.link-externo .ext { font-size: 0.75rem; }

.bloco-download { border-left: 3px solid var(--marca); }
.botao-download {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  /* <button> não herda a fonte do site como o <a> herda; força a herança
     para o botão de download do favorecido ficar igual ao dos parlamentares */
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  /* no claro, branco sobre o vermelho dá 5.93:1; no escuro o vermelho é mais
     claro e o branco cairia para 3.66:1, então a tinta inverte */
  color: var(--tinta-sobre-marca);
  background: var(--marca);
  border-radius: var(--raio);
  text-decoration: none;
}
.botao-download:hover { filter: brightness(0.92); }
.botao-meta {
  font-weight: 400;
  font-size: 0.8125rem;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

/* ---------- apadrinhamento (ADPF 854) ---------- */

.apad-comparacao {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}
.apad-topo {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 0.875rem;
  margin-bottom: 4px;
}
.apad-valor { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.apad-linha .barra-trilho { height: 14px; }
/* própria: cinza sóbrio; apadrinhada: vermelho da marca — o contraste é a mensagem */
.barra-preenchida.apad-propria { background: var(--marca); }
.barra-preenchida.apad-secreto { background: var(--secreto); }
/* destinos do orçamento secreto: barras em laranja */
[data-chart="apad-favorecidos"] .barra-preenchida { background: var(--secreto); }
.apad-sub { font-size: 0.9375rem; margin: 18px 0 6px; color: var(--text-secondary); }
.apad-detalhe {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ---------- executores na ponta ---------- */

.executores {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.executor {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--marca);
  border-radius: 0 var(--raio) var(--raio) 0;
  background: var(--page);
}
.executor-topo {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.executor-nome { font-weight: 700; font-size: 0.9375rem; }
.executor-valor {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.executor-objeto {
  margin: 5px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}
.executor-meta {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.executor-meta .link-externo { font-size: 0.75rem; font-weight: 600; }

/* barras horizontais */
.barras { display: flex; flex-direction: column; gap: 10px; }

.barra-linha {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  position: relative;
  padding: 2px 0;
  cursor: default;
}
/* o display:grid acima vence o [hidden] padrão; reforça o ocultar ao colapsar */
.barra-linha[hidden] { display: none; }
/* barra que leva a outro perfil (autores no perfil de empresa) */
button.barra-linha {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}
.barra-clicavel { cursor: pointer; border-radius: var(--raio); }
.barra-clicavel:hover .barra-nome { color: var(--marca); text-decoration: underline; }
.barra-clicavel:hover .barra-preenchida { background: var(--marca-escura); }
.barra-topo {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 0.8125rem;
}
.barra-nome {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.barra-valor {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.barra-trilho {
  height: 8px;
  background: var(--gridline);
  border-radius: var(--raio);
  overflow: hidden;
}
.barra-preenchida {
  height: 100%;
  background: var(--marca);
  border-radius: var(--raio);
  min-width: 2px;
}
.barra-preenchida.negativa { background: var(--negativa); }

/* explicação de favorecido que não é destinatário final */
.barra-nota {
  margin: 4px 0 0;
  padding: 6px 9px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-secondary);
  background: var(--aviso-fundo);
  border-left: 3px solid var(--aviso-borda);
  border-radius: 0 var(--raio) var(--raio) 0;
}

/* tooltip */
.barra-linha:hover .barra-dica,
.barra-linha:focus-within .barra-dica { opacity: 1; }
.barra-dica {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 0;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--surface-1);
  font-size: 0.75rem;
  padding: 6px 9px;
  border-radius: var(--raio);
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* alternância tabela */
.alternar-tabela {
  margin-top: 14px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  cursor: pointer;
  min-height: 32px;
}
.alternar-tabela:hover { background: var(--page); }

/* "Ver todos" das listas colapsadas — discreto, no tom do texto secundário */
.ver-todos {
  margin-top: 10px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--marca);
  background: transparent;
  border: 1px solid var(--baseline);
  border-radius: var(--raio);
  cursor: pointer;
  min-height: 32px;
}
.ver-todos:hover { background: var(--page); }

.tabela-envolucro { overflow-x: auto; margin-top: 12px; }
table.tabela-dados {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8125rem;
}
table.tabela-dados th,
table.tabela-dados td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--gridline);
}
table.tabela-dados th { color: var(--text-muted); font-weight: 600; }
table.tabela-dados td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sem-dados { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

.legenda-negativa {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.amostra-negativa {
  flex: none;
  width: 16px;
  height: 8px;
  border-radius: var(--raio);
  background: var(--negativa);
}

/* ---------- vazio / rodapé ---------- */

.vazio {
  padding: 48px 0;
  color: var(--text-muted);
  text-align: center;
}
.vazio[hidden] { display: none; }

.rodape {
  margin-top: 40px;
  padding: 32px 0 48px;
  background: var(--surface-1);
  border-top: 3px solid var(--marca);
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.rodape h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metodologia p { margin: 0 0 10px; max-width: 78ch; }
.metodologia strong { color: var(--text-primary); }
.fonte { color: var(--text-muted); font-size: 0.8125rem; margin-top: 18px; }

/* ---------- responsivo ---------- */

@media (max-width: 640px) {
  .topo { padding: 28px 0 20px; }
  .topo h1 { font-size: 1.5rem; }
  .resumo-geral { gap: 20px; }
  .filtro-final { grid-column: span 1; }
  .ficha { flex-direction: column; align-items: flex-start; text-align: left; }
  .bloco { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- página de metodologia ---------- */
.metodologia-pagina { padding: 32px 0 56px; }
.metodologia-pagina h2 {
  font-size: 1.25rem;
  margin: 30px 0 10px;
  color: var(--marca);
}
.metodologia-pagina h2:first-child { margin-top: 0; }
.metodologia-pagina p {
  max-width: 68ch;
  line-height: 1.65;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.m-lista, .m-etapas {
  max-width: 68ch;
  line-height: 1.6;
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text-primary);
}
.m-lista li, .m-etapas li { margin-bottom: 9px; }
.m-etapas li { padding-left: 4px; }
.m-fonte {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 26px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.rodape-link { margin-bottom: 8px; }
.rodape-link a { font-weight: 600; color: var(--marca); }

/* ---------- drill-down do perfil (filtros na própria página) ---------- */
.dica-filtro {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}
.perfil-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: var(--marca-suave);
  border: 1px solid var(--border);
  border-radius: var(--raio);
}
.perfil-filtros[hidden] { display: none; }
.pf-rotulo { font-size: 0.8125rem; font-weight: 700; color: var(--text-secondary); }
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tinta-sobre-marca);
  background: var(--marca);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.pf-chip:hover { background: var(--marca-escura); }
.pf-limpar {
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.pf-ir-favorecido {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--marca);
  text-decoration: none;
  white-space: nowrap;
}
.pf-ir-favorecido:hover { text-decoration: underline; }

/* ---------- alternador de tema (claro/escuro) ---------- */
.tema-toggle {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.tema-toggle:hover { color: var(--marca); border-color: var(--marca); }
.tema-toggle svg { display: block; }
