/* Cidades Inteligentes — design system.
   Tokens do guia de redesign (navy na barra lateral, azul de ação, slate no texto) e a
   paleta categórica validada (scripts/validate_palette.js, claro e escuro). Nada de estilo
   dentro da página: a CSP do site só aceita este arquivo. */

:root {
  --navy-950: #0B1730; --navy-900: #10213D; --navy-800: #182c4d; --navy-line: #22385c;
  --blue-600: #2563EB; --blue-700: #1d4ed8; --blue-100: #DBEAFE; --blue-50: #eff6ff;
  --green-600: #16A34A; --green-100: #dcfce7; --amber-500: #F59E0B; --amber-700: #b45309; --amber-100: #fef3c7;
  --red-600: #DC2626; --red-100: #fee2e2; --purple-600: #7C3AED;
  --slate-950: #0F172A; --slate-700: #334155; --slate-600: #475569; --slate-500: #64748b;
  --slate-300: #cbd5e1; --slate-200: #e2e8f0; --slate-100: #F1F5F9; --white: #FFFFFF;

  --fundo: var(--slate-100); --superficie: var(--white); --superficie-2: #f8fafc;
  --tinta: var(--slate-950); --tinta-2: var(--slate-600); --tinta-3: var(--slate-500);
  --linha: var(--slate-200); --linha-forte: var(--slate-300);
  --acao: var(--blue-600); --acao-hover: var(--blue-700); --acao-fundo: var(--blue-100); --acao-tinta: #fff;
  --bom: var(--green-600); --bom-fundo: var(--green-100);
  --atencao: var(--amber-700); --atencao-fundo: var(--amber-100);
  --ruim: var(--red-600); --ruim-fundo: var(--red-100);
  /* série categórica, ordem fixa (validada) */
  --s1: #2563EB; --s2: #EA580C; --s3: #0D9488; --s4: #7C3AED;
  --grade: var(--slate-200);

  --raio: 12px; --raio-p: 8px; --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sombra-alta: 0 10px 30px rgba(15, 23, 42, .18);
  --fonte: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --lateral: 248px; --lateral-recolhida: 76px; --topo: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #0b1220; --superficie: #111A2E; --superficie-2: #0f1729;
    --tinta: #e5e9f0; --tinta-2: #a3aec2; --tinta-3: #8591a8;
    --linha: #1f2b44; --linha-forte: #2b3a58;
    --acao: #3b82f6; --acao-hover: #60a5fa; --acao-fundo: #172554; --acao-tinta: #fff;
    --bom: #4ade80; --bom-fundo: #052e16; --atencao: #fbbf24; --atencao-fundo: #3a2a06;
    --ruim: #f87171; --ruim-fundo: #3b0d0d;
    --s1: #3B82F6; --s2: #EA580C; --s3: #0D9488; --s4: #8B5CF6;
    --grade: #1f2b44;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fundo); color: var(--tinta); font: 15px/1.5 var(--fonte); }
a { color: var(--acao); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--acao); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.5rem; font-weight: 700; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0; }
h3 { font-size: .92rem; font-weight: 600; margin: 0; }
p { margin: 0 0 .5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.controle { position: absolute; opacity: 0; pointer-events: none; }
.icone { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
         stroke-linecap: round; stroke-linejoin: round; }
.icone.p { width: 16px; height: 16px; }

/* ── AppShell ─────────────────────────────────────────────────────────── */
.lateral { position: fixed; inset: 0 auto 0 0; width: var(--lateral); z-index: 30; display: flex; flex-direction: column;
           background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); color: #cbd5e1;
           transition: width .18s ease, transform .2s ease; }
.lateral a { color: inherit; text-decoration: none; }
.marca { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1.2rem; color: #fff; min-height: var(--topo); }
.marca-sinal { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--blue-600);
               display: grid; place-items: center; color: #fff; }
.marca-texto strong { display: block; font-size: 1rem; line-height: 1.15; }
.marca-texto span { font-size: .72rem; color: #94a3b8; }
.nav { flex: 1; overflow-y: auto; padding: .25rem .75rem; }
.nav-grupo { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .6rem .35rem; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .55rem .65rem; border-radius: var(--raio-p);
         font-size: .9rem; white-space: nowrap; }
.nav a:hover { background: var(--navy-800); color: #fff; }
.nav a.atual { background: var(--blue-600); color: #fff; }
.lateral-pe { border-top: 1px solid var(--navy-line); padding: .8rem 1rem; font-size: .78rem; color: #94a3b8; }
.lateral-pe .quem { color: #e2e8f0; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral-pe a { color: #93c5fd; }
.recolher { display: flex; align-items: center; gap: .5rem; cursor: pointer; color: #94a3b8; margin-top: .5rem; }

.app { margin-left: var(--lateral); min-height: 100vh; display: flex; flex-direction: column; transition: margin .18s ease; }
.topo { position: sticky; top: 0; z-index: 20; height: var(--topo); display: flex; align-items: center; gap: 1rem;
        padding: 0 1.5rem; background: color-mix(in srgb, var(--superficie) 92%, transparent);
        backdrop-filter: blur(8px); border-bottom: 1px solid var(--linha); }
.abrir-menu { display: none; cursor: pointer; color: var(--tinta); padding: .4rem; border-radius: var(--raio-p); }
.trilha { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--tinta-3); min-width: 0;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trilha a { color: var(--tinta-2); }
.busca { position: relative; margin-left: auto; width: min(360px, 34vw); }
.busca input { width: 100%; padding: .5rem .75rem .5rem 2.2rem; border-radius: 999px; background: var(--superficie-2); }
.busca .icone { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--tinta-3); pointer-events: none; }
.sugestoes { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--superficie); border: 1px solid var(--linha);
             border-radius: var(--raio-p); box-shadow: var(--sombra-alta); padding: .3rem; z-index: 40; }
.sugestoes a { display: block; padding: .45rem .6rem; border-radius: 6px; color: var(--tinta); font-size: .88rem; }
.sugestoes a:hover, .sugestoes a.ativo { background: var(--acao-fundo); text-decoration: none; }
.sugestoes .tipo { font-size: .72rem; color: var(--tinta-3); margin-left: .35rem; }
.situacao-global { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--tinta-2); white-space: nowrap; }
.situacao-global small { display: block; color: var(--tinta-3); font-size: .72rem; line-height: 1.1; }
.conteudo { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 1.5rem; }
.rodape { padding: 1rem 1.5rem; color: var(--tinta-3); font-size: .75rem; border-top: 1px solid var(--linha); }
.veu { display: none; }

#nav-recolher:checked ~ .lateral { width: var(--lateral-recolhida); }
#nav-recolher:checked ~ .lateral .marca-texto, #nav-recolher:checked ~ .lateral .nav-grupo,
#nav-recolher:checked ~ .lateral .nav span, #nav-recolher:checked ~ .lateral .lateral-pe .txt { display: none; }
#nav-recolher:checked ~ .lateral .nav a { justify-content: center; }
#nav-recolher:checked ~ .app { margin-left: var(--lateral-recolhida); }

@media (max-width: 1199px) {
  .lateral { transform: translateX(-100%); width: var(--lateral) !important; box-shadow: var(--sombra-alta); }
  .lateral .marca-texto, .lateral .nav-grupo, .lateral .nav span, .lateral .lateral-pe .txt { display: revert !important; }
  .lateral .nav a { justify-content: flex-start !important; }
  .app, #nav-recolher:checked ~ .app { margin-left: 0; }
  .abrir-menu { display: inline-flex; }
  .recolher { display: none; }
  #nav-abrir:checked ~ .lateral { transform: none; }
  #nav-abrir:checked ~ .veu { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(2, 6, 23, .45); }
}
@media (max-width: 767px) {
  .kpi { padding: .8rem .8rem .7rem; }
  .kpi .valor { font-size: 1.15rem; }
  .faixa-resumo > div { padding: .7rem .9rem; }
  .mun-cab { padding: 1rem; }
  .topo { padding: 0 .75rem; gap: .5rem; }
  .situacao-global small, .situacao-global .txt { display: none; }
  .busca { width: auto; flex: 1; }
  .trilha { display: none; }
  .conteudo { padding: 1rem; }
}

/* ── Componentes ──────────────────────────────────────────────────────── */
.cabecalho-pagina { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.cabecalho-pagina p { color: var(--tinta-2); margin: .25rem 0 0; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.cartao { background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); }
.cartao-cab { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem;
              border-bottom: 1px solid var(--linha); }
.cartao-cab h2 { display: flex; align-items: center; gap: .5rem; }
.cartao-corpo { padding: 1rem 1.1rem; }
.cartao-pe { padding: .6rem 1.1rem; border-top: 1px solid var(--linha); font-size: .75rem; color: var(--tinta-3); }

.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 38px;
               padding: .45rem .95rem; border-radius: var(--raio-p); border: 1px solid transparent; font: inherit; font-size: .88rem;
               font-weight: 550; cursor: pointer; background: var(--acao); color: var(--acao-tinta); text-decoration: none; }
.btn:hover, button:hover { background: var(--acao-hover); text-decoration: none; }
.btn.sec, button.sec { background: var(--superficie); color: var(--tinta); border-color: var(--linha-forte); }
.btn.sec:hover, button.sec:hover { background: var(--superficie-2); }
.btn.fantasma, button.fantasma { background: transparent; color: var(--acao); padding: .3rem .5rem; min-height: 0; }
.btn.fantasma:hover, button.fantasma:hover { background: var(--acao-fundo); }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
button.carregando { opacity: .7; cursor: progress; }
input, select, textarea { font: inherit; font-size: .9rem; color: var(--tinta); background: var(--superficie);
                          border: 1px solid var(--linha-forte); border-radius: var(--raio-p); padding: .45rem .65rem; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acao); outline-offset: -1px; border-color: transparent; }
label.campo { display: grid; gap: .25rem; font-size: .8rem; color: var(--tinta-2); }

.selo { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 550; padding: .12rem .5rem;
        border-radius: 999px; background: var(--superficie-2); color: var(--tinta-2); border: 1px solid var(--linha); white-space: nowrap; }
.selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.selo.sem-ponto::before { display: none; }
.selo.bom { color: var(--bom); background: var(--bom-fundo); border-color: transparent; }
.selo.atencao { color: var(--atencao); background: var(--atencao-fundo); border-color: transparent; }
.selo.ruim { color: var(--ruim); background: var(--ruim-fundo); border-color: transparent; }
.selo.info { color: var(--acao); background: var(--acao-fundo); border-color: transparent; }
.etiqueta { font-size: .72rem; background: var(--superficie-2); border: 1px solid var(--linha); border-radius: 6px; padding: 0 .4rem; color: var(--tinta-2); }

.suave { color: var(--tinta-2); }
.fraco { color: var(--tinta-3); }
.pequeno { font-size: .8rem; }
.mini { font-size: .72rem; }
.mono { font-family: var(--mono); font-size: .86em; }
.quebra { overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alerta-texto { color: var(--ruim); }

.vazio { display: grid; justify-items: center; gap: .4rem; text-align: center; padding: 2rem 1rem; color: var(--tinta-2); }
.vazio .icone { width: 32px; height: 32px; color: var(--tinta-3); }
.vazio strong { color: var(--tinta); }
.vazio p { max-width: 46ch; margin: 0; font-size: .88rem; }
.vazio.compacto { padding: 1rem; }

.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela th, .tabela td { padding: .65rem .9rem; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: middle; }
.tabela thead th { position: sticky; top: 0; background: var(--superficie-2); font-size: .72rem; color: var(--tinta-3);
                   font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tabela thead th a { color: inherit; }
.tabela thead th a.ordem::after { content: " ↕"; opacity: .4; }
.tabela thead th a.ordem.asc::after { content: " ↑"; opacity: 1; }
.tabela thead th a.ordem.desc::after { content: " ↓"; opacity: 1; }
.tabela tbody tr:hover td { background: var(--superficie-2); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela.compacta th, .tabela.compacta td { padding: .4rem .6rem; }
.tabela tr.destaque td { background: var(--acao-fundo); }
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1.1rem;
             border-top: 1px solid var(--linha); font-size: .82rem; color: var(--tinta-2); }

.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .9rem 1.1rem; border-bottom: 1px solid var(--linha); }
.filtros input[name=q] { min-width: 220px; flex: 1; }
.filtros input.curto { width: 5rem; }

.abas { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--linha); scrollbar-width: thin; }
.abas a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem .85rem; color: var(--tinta-2); font-size: .88rem;
          font-weight: 550; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.abas a:hover { color: var(--tinta); text-decoration: none; }
.abas a[aria-selected="true"] { color: var(--acao); border-bottom-color: var(--acao); }
.abas a .contagem { font-size: .7rem; font-weight: 600; color: var(--tinta-3); background: var(--superficie-2);
                    border: 1px solid var(--linha); border-radius: 999px; padding: 0 .4rem; }
.abas a.vazia { color: var(--tinta-3); }

.grade-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.resumo { padding: .9rem 1rem; }
.resumo .rotulo { font-size: .78rem; color: var(--tinta-2); display: flex; align-items: center; gap: .4rem; }
.resumo .valor { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.resumo .valor.ruim { color: var(--ruim); }
.resumo .apoio { font-size: .75rem; color: var(--tinta-3); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: .75rem; margin-top: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; padding: .95rem 1rem .8rem; position: relative; min-width: 0; }
.kpi .nome { font-size: .8rem; color: var(--tinta-2); font-weight: 550; }
.kpi .valor { white-space: nowrap; font-size: clamp(1.15rem, 1.6vw + .5rem, 1.55rem); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.kpi .detalhe { font-size: .75rem; color: var(--tinta-3); }
.kpi .detalhe strong { color: var(--tinta-2); font-weight: 600; }
.kpi .variacao { font-size: .75rem; color: var(--tinta-2); }
.kpi .rodape-kpi { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .35rem; }
.kpi .faisca { width: 100%; height: 34px; margin-top: .3rem; display: block; }
.kpi .sem-dado, .sem-dado { color: var(--tinta-3); font-size: 1rem; font-weight: 550; }
.kpi .aviso-periodo { font-size: .72rem; color: var(--atencao); }

/* Indicadores (aba) */
.ind-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: .9rem; }
.ind { display: flex; flex-direction: column; min-width: 0; }
.ind-cab { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; padding: .9rem 1rem .25rem; }
.ind-valor { padding: 0 1rem; }
.ind-valor .valor { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.ind-valor .detalhe { font-size: .78rem; color: var(--tinta-3); }
.ind-grafico { padding: .4rem 1rem 0; }
.ind-meta { padding: .6rem 1rem .8rem; font-size: .74rem; color: var(--tinta-3); margin-top: auto; }
.ind-meta .linha-meta { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.ind details { border-top: 1px solid var(--linha); }
.ind summary { padding: .55rem 1rem; font-size: .8rem; color: var(--acao); cursor: pointer; list-style: none; }
.ind summary::-webkit-details-marker { display: none; }
.ind summary::before { content: "▸ "; }
.ind details[open] summary::before { content: "▾ "; }
.ind details .tabela-rolagem { max-height: 260px; overflow-y: auto; padding: 0 .5rem .5rem; }
.aviso-dado { font-size: .76rem; color: var(--atencao); padding: .1rem 1rem; }
.nota-metodologica { font-size: .74rem; color: var(--tinta-3); padding: 0 1rem .6rem; }

.ind.largo { grid-column: 1 / -1; }
.link-discreto { color: inherit; }
.link-discreto:hover { color: var(--acao); }

/* Gráficos SVG */
.grafico { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .grade-linha { stroke: var(--grade); stroke-width: 1; }
.grafico .eixo-texto { fill: var(--tinta-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.grafico .serie { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico .area { fill: var(--s1); opacity: .1; }
.grafico .ponto { fill: var(--s1); stroke: var(--superficie); stroke-width: 2; }
.grafico .ponto-fim { fill: var(--s1); stroke: var(--superficie); stroke-width: 2; }
.grafico .alvo { fill: transparent; cursor: crosshair; }
.grafico .alvo:hover + .ponto, .grafico .alvo:focus + .ponto { r: 5; }
.grafico .rotulo-fim { fill: var(--tinta); font-size: 11px; font-weight: 600; }
.grafico .barra { fill: var(--s1); }
.grafico .barra:hover, .grafico a:focus .barra { fill: var(--acao-hover); }
.grafico .barra-texto { fill: var(--tinta); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.grafico .barra-nome { fill: var(--tinta-2); font-size: 11.5px; }
.grafico .s1 { stroke: var(--s1); } .grafico .s2 { stroke: var(--s2); } .grafico .s3 { stroke: var(--s3); } .grafico .s4 { stroke: var(--s4); }
.grafico .f1 { fill: var(--s1); } .grafico .f2 { fill: var(--s2); } .grafico .f3 { fill: var(--s3); } .grafico .f4 { fill: var(--s4); }
.faisca .serie { stroke: var(--tinta-3); stroke-width: 1.5; fill: none; }
.faisca .ponto-fim { fill: var(--s1); stroke: var(--superficie); stroke-width: 2; }
.legenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .78rem; color: var(--tinta-2); }
.legenda span { display: inline-flex; align-items: center; gap: .35rem; }
.legenda i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legenda i.f1 { background: var(--s1); } .legenda i.f2 { background: var(--s2); } .legenda i.f3 { background: var(--s3); } .legenda i.f4 { background: var(--s4); }
.dica { position: fixed; z-index: 60; pointer-events: none; background: var(--superficie); color: var(--tinta);
        border: 1px solid var(--linha); border-radius: var(--raio-p); box-shadow: var(--sombra-alta); padding: .45rem .6rem;
        font-size: .78rem; min-width: 120px; }
.dica strong { display: block; font-size: .95rem; }
.dica .s { color: var(--tinta-3); }
.dica-linha { display: flex; align-items: center; gap: .4rem; }
.dica-linha i { width: 12px; height: 2px; display: inline-block; }
.dica-linha strong { display: inline; font-size: .9rem; }
.dica-linha i.f1 { background: var(--s1); } .dica-linha i.f2 { background: var(--s2); } .dica-linha i.f3 { background: var(--s3); } .dica-linha i.f4 { background: var(--s4); }

/* Município */
.mun-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; }
.mun-titulo { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.mun-pino { width: 44px; height: 44px; border-radius: 12px; background: var(--acao-fundo); color: var(--acao); display: grid; place-items: center; flex: none; }
.mun-titulo h1 { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.mun-meta { display: flex; flex-wrap: wrap; gap: .15rem .9rem; font-size: .82rem; color: var(--tinta-2); margin-top: .2rem; }
.mun-meta span strong { color: var(--tinta); font-weight: 600; }
.mun-foto { position: relative; height: 150px; border-radius: var(--raio); overflow: hidden; margin-bottom: 1rem; background: var(--navy-900); }
.mun-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mun-foto .credito { position: absolute; right: .6rem; bottom: .4rem; font-size: .7rem; color: #fff; background: rgba(2, 6, 23, .55);
                     padding: .1rem .45rem; border-radius: 6px; }
.dados-territoriais { padding: 0 1.25rem 1rem; }
.dados-territoriais summary { font-size: .82rem; color: var(--acao); cursor: pointer; }
.ficha { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: .6rem 1.25rem; margin: .75rem 0 0; }
.ficha div { min-width: 0; }
.ficha dt { font-size: .72rem; color: var(--tinta-3); text-transform: uppercase; letter-spacing: .04em; }
.ficha dd { margin: 0; overflow-wrap: anywhere; }

.faixa-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-top: 1px solid var(--linha); }
.faixa-resumo > div { padding: .8rem 1.25rem; border-right: 1px solid var(--linha); border-bottom: 1px solid var(--linha); margin-bottom: -1px; }
.faixa-resumo > div:last-child { border-right: 0; }
.faixa-resumo .rotulo { font-size: .72rem; color: var(--tinta-3); text-transform: uppercase; letter-spacing: .04em; }
.faixa-resumo .valor { font-size: 1.05rem; font-weight: 650; }
.faixa-resumo .apoio { font-size: .74rem; color: var(--tinta-3); }
.medidor { height: 6px; background: var(--acao-fundo); border-radius: 999px; overflow: hidden; margin-top: .35rem; }
.medidor i.w0 { width: 0%; } .medidor i.w10 { width: 10%; } .medidor i.w20 { width: 20%; } .medidor i.w30 { width: 30%; } .medidor i.w40 { width: 40%; } .medidor i.w50 { width: 50%; } .medidor i.w60 { width: 60%; } .medidor i.w70 { width: 70%; } .medidor i.w80 { width: 80%; } .medidor i.w90 { width: 90%; } .medidor i.w100 { width: 100%; } 
.medidor i { display: block; height: 100%; background: var(--acao); border-radius: 999px; }

.mun-grade { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 1rem; margin-top: 1rem; align-items: start; }
.mun-grade > * { min-width: 0; }
.pilha { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }
@media (max-width: 1199px) { .mun-grade { grid-template-columns: minmax(0, 1fr); } }

.mapa { height: 460px; border-radius: 0 0 var(--raio) var(--raio); background: var(--superficie-2); position: relative; z-index: 0; }
.mapa-semjs svg { width: 100%; height: 100%; }
.mapa-semjs .limite { fill: var(--acao-fundo); stroke: var(--acao); stroke-width: 1.5; }
.mapa-semjs .centro { fill: var(--tinta); }
@media (max-width: 767px) { .mapa { height: 320px; } }
.leaflet-container { font: inherit; background: var(--superficie-2); }
.leaflet-control-attribution { font-size: 10px; }
.mapa-legenda { background: var(--superficie); color: var(--tinta); border: 1px solid var(--linha); border-radius: var(--raio-p);
                padding: .45rem .6rem; font-size: .74rem; line-height: 1.5; box-shadow: var(--sombra); }
.mapa-legenda i { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: .35rem; border-radius: 3px; }
.mapa-legenda i.limite { border: 2px solid var(--acao); background: var(--acao-fundo); }
.mapa-legenda i.centro { border-radius: 50%; background: var(--tinta); width: 8px; height: 8px; margin: 0 .55rem 0 .15rem; }

.alertas { display: grid; }
.mun-grade .alertas { max-height: 470px; overflow-y: auto; }
.alerta { display: grid; grid-template-columns: 4px minmax(0, 1fr); overflow-wrap: anywhere; gap: .75rem; padding: .75rem 1.1rem; border-bottom: 1px solid var(--linha); }
.alerta:last-child { border-bottom: 0; }
.alerta .barra-cor { border-radius: 4px; background: var(--linha-forte); }
.alerta.ruim .barra-cor { background: var(--ruim); }
.alerta.atencao .barra-cor { background: var(--amber-500); }
.alerta.info .barra-cor { background: var(--acao); }
.alerta h3 { font-size: .85rem; }
.alerta p { font-size: .78rem; color: var(--tinta-2); margin: .1rem 0 .3rem; }
.alerta .pe { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; font-size: .72rem; color: var(--tinta-3); }

.barras-funcao { padding: .5rem 1.1rem 1rem; }

.nota-item { border-left: 3px solid var(--linha-forte); padding: .1rem 0 .1rem .8rem; margin-bottom: .8rem; }
.nota-item p { margin: 0; }
.form-linha { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.form-pilha { display: grid; gap: .6rem; }

/* Gaveta de origem */
.gaveta { position: fixed; inset: 0 0 0 auto; width: min(560px, 100vw); z-index: 70; background: var(--superficie);
          box-shadow: var(--sombra-alta); transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.gaveta.aberta { transform: none; }
.gaveta-cab { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--linha); }
.gaveta-corpo { overflow-y: auto; padding: 1rem 1.25rem 2rem; }
.gaveta-veu { position: fixed; inset: 0; z-index: 65; background: rgba(2, 6, 23, .4); display: none; }
.gaveta-veu.aberta { display: block; }
.esqueleto { background: linear-gradient(90deg, var(--superficie-2), var(--linha), var(--superficie-2)); background-size: 200% 100%;
             animation: brilho 1.2s infinite; border-radius: 6px; height: 14px; margin: .5rem 0; }
@keyframes brilho { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .esqueleto { animation: none; } .lateral, .gaveta, .app { transition: none; } }

.origem-valor { font-size: 1.8rem; font-weight: 700; }
.lista-def { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .86rem; margin: 0; }
.lista-def dt { color: var(--tinta-3); }
.lista-def dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .lista-def { grid-template-columns: 1fr; } .lista-def dt { margin-top: .4rem; } }
.secao { margin-top: 1.1rem; }
.secao h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tinta-3); margin-bottom: .5rem; }

.duas-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 1rem; }
.estreito { max-width: 440px; margin: 4rem auto; }
.entrar { padding: 2rem; text-align: center; }
.entrar .marca-sinal { margin: 0 auto 1rem; width: 52px; height: 52px; border-radius: 14px; }

/* Quadro de oportunidades */
.quadro { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.coluna { background: var(--superficie-2); border: 1px solid var(--linha); border-radius: var(--raio); padding: .6rem; min-height: 120px; }
.coluna h3 { display: flex; justify-content: space-between; font-size: .8rem; padding: .2rem .3rem .6rem; color: var(--tinta-2); }
.op { display: block; background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio-p); padding: .65rem .75rem;
      margin-bottom: .5rem; color: var(--tinta); box-shadow: var(--sombra); }
.op:hover { border-color: var(--acao); text-decoration: none; }
.op strong { display: block; font-size: .86rem; }
.op span { font-size: .74rem; color: var(--tinta-3); }

@media print {
  .lateral, .topo, .rodape, .acoes, .abas, form, .gaveta, .veu { display: none !important; }
  .app { margin: 0 !important; }
  body { background: #fff; }
  .cartao { box-shadow: none; break-inside: avoid; }
}

/* Comparativo */
.selecao { border: 1px solid var(--linha); border-radius: var(--raio-p); padding: .6rem .8rem .8rem; margin: 0; min-width: 0; }
.selecao legend { font-size: .8rem; font-weight: 600; color: var(--tinta-2); padding: 0 .3rem; }
.opcoes { display: flex; flex-wrap: wrap; gap: .35rem .5rem; max-height: 210px; overflow-y: auto; }
.opcao { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; padding: .3rem .6rem; border: 1px solid var(--linha);
         border-radius: 999px; background: var(--superficie-2); cursor: pointer; }
.opcao input { min-height: 0; accent-color: var(--acao); }
.opcao:has(input:checked) { border-color: var(--acao); background: var(--acao-fundo); }
.avisos { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .2rem; font-size: .8rem; color: var(--atencao); }
.avisos li { display: flex; gap: .35rem; align-items: center; }

/* ajustes da varredura de larguras */
.kpis.conectores { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); margin-top: 0; }
.kpis.conectores .selo { white-space: normal; }
.kpi .nome, .kpi .detalhe { overflow-wrap: anywhere; }
.filtros .campo { min-width: 0; max-width: 100%; }
.filtros select, .filtros input { max-width: 100%; }
@media (max-width: 767px) { .filtros input[name=q] { min-width: 0; width: 100%; } .filtros .campo { flex: 1 1 140px; } }
label.campo { grid-template-columns: minmax(0, 1fr); }
.filtros select { width: 100%; }
.cartao-corpo > .grafico, .secao > .grafico { max-width: 760px; }
details > summary { cursor: pointer; color: var(--acao); font-size: .85rem; }

/* Logo Peixe Persa */
.marca-logo { display: block; height: 36px; width: auto; flex: none; }
#nav-recolher:checked ~ .lateral .marca { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
#nav-recolher:checked ~ .lateral .marca-logo { height: 30px; }
.logo-entrar { display: block; margin: 0 auto 1.25rem; }
.logo-entrar img { display: block; margin: 0 auto; height: 64px; width: auto; }

/* ══ Camada visual v2: cor por eixo, chips de ícone, faixa de destaque ══════════ */
:root {
  --e-demo: #2563EB; --e-econ: #16A34A; --e-saude: #DC2626; --e-educ: #D97706; --e-amb: #059669; --e-san: #0891B2;
  --e-mob: #7C3AED; --e-seg: #4F46E5; --e-cult: #DB2777; --e-fisc: #0F766E; --e-tec: #0D9488; --e-qvida: #EA580C;
}
.c-demo { --cor: var(--e-demo); } .c-econ { --cor: var(--e-econ); } .c-saude { --cor: var(--e-saude); }
.c-educ { --cor: var(--e-educ); } .c-amb { --cor: var(--e-amb); } .c-san { --cor: var(--e-san); }
.c-mob { --cor: var(--e-mob); } .c-seg { --cor: var(--e-seg); } .c-cult { --cor: var(--e-cult); }
.c-fisc { --cor: var(--e-fisc); } .c-tec { --cor: var(--e-tec); } .c-qvida { --cor: var(--e-qvida); }
.chip { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
        color: var(--cor, var(--acao)); background: color-mix(in srgb, var(--cor, var(--acao)) 13%, transparent); }
.chip .icone { width: 22px; height: 22px; stroke-width: 2; }
.chip.p { width: 32px; height: 32px; border-radius: 9px; }
.chip.p .icone { width: 17px; height: 17px; }

body { background: radial-gradient(1200px 500px at 70% -10%, color-mix(in srgb, var(--acao) 7%, transparent), transparent), var(--fundo); }
.cartao { border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .04); }

/* barra lateral com silhueta */
.lateral { background: linear-gradient(180deg, #0B1730 0%, #0e1f3d 60%, #0b1a35 100%); }
.lateral::after { content: ""; position: absolute; left: 0; right: 0; bottom: 92px; height: 150px; pointer-events: none;
                  background: url(/static/skyline.svg) center bottom / cover no-repeat; opacity: .55; }
.lateral .nav, .lateral .lateral-pe, .lateral .marca { position: relative; z-index: 1; }
.nav a.atual { background: linear-gradient(90deg, #2563EB, #3b82f6); box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
#nav-recolher:checked ~ .lateral::after { display: none; }

/* topo: sino e avatar */
.sino { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--tinta-2); flex: none; }
.sino:hover { background: var(--superficie-2); text-decoration: none; }
.sino .bolha { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
               background: var(--red-600); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center;
               border: 2px solid var(--superficie); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700;
          color: #fff; background: linear-gradient(135deg, #0B1730, #2563EB); flex: none; }
@media (max-width: 767px) { .avatar { display: none; } }
.rodape { background: #0B1730; color: #94a3b8; border-top: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
          position: relative; overflow: hidden; }
.rodape::after { content: ""; position: absolute; right: 0; bottom: 0; width: 420px; max-width: 60%; height: 60px; opacity: .35;
                 pointer-events: none; background: url(/static/skyline.svg) right bottom / cover no-repeat; }
.rodape span { position: relative; z-index: 1; }
.rodape strong { color: #e2e8f0; }

/* faixa de destaque do município */
.faixa-destaque { position: relative; overflow: hidden; border-radius: 14px; margin: 1rem 0 0; min-height: 132px; color: #fff;
                  background: linear-gradient(100deg, #0B1730 0%, #10213D 45%, #1d4ed8 120%); display: flex; align-items: center; }
.faixa-destaque::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 35%; pointer-events: none;
                         background: url(/static/skyline.svg) right bottom / cover no-repeat; opacity: .9; }
.faixa-destaque img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.faixa-destaque.com-foto::before { content: ""; position: absolute; inset: 0; z-index: 1;
                                   background: linear-gradient(90deg, rgba(11, 23, 48, .88) 0%, rgba(11, 23, 48, .55) 50%, rgba(11, 23, 48, .1) 100%); }
.faixa-destaque.com-foto::after { display: none; }
.faixa-texto { position: relative; z-index: 2; padding: 1.25rem 1.5rem; }
.faixa-texto h2 { font-size: clamp(1.1rem, 1.6vw + .6rem, 1.6rem); font-weight: 700; color: #fff; }
.faixa-texto p { margin: .35rem 0 0; color: #cbd5e1; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.faixa-texto p span::before { content: "•"; margin-right: .5rem; color: #60a5fa; }
.faixa-texto p span:first-child::before { display: none; }
.faixa-destaque .credito { position: absolute; z-index: 2; right: .6rem; bottom: .4rem; font-size: .7rem; color: #e2e8f0;
                           background: rgba(2, 6, 23, .5); padding: .1rem .45rem; border-radius: 6px; }

/* KPI colorido */
.kpi-topo { display: flex; gap: .7rem; align-items: center; }
.kpi-topo .nome { line-height: 1.25; }
.kpi .faisca { height: 40px; margin-top: .4rem; }
.kpi .faisca .serie { stroke: var(--cor, var(--s1)); stroke-width: 2; }
.kpi .faisca .area { fill: var(--cor, var(--s1)); opacity: .12; stroke: none; }
.kpi .faisca .ponto-fim { fill: var(--cor, var(--s1)); }
.kpi .variacao { color: var(--tinta-2); font-weight: 600; }
.kpi .variacao .icone { width: 13px; height: 13px; vertical-align: -2px; color: var(--cor); }

/* anéis por eixo (cobertura de dados) */
.aneis { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; padding: 1rem; }
.anel-item { display: grid; justify-items: center; gap: .15rem; padding: .7rem .4rem .6rem; border: 1px solid var(--linha); border-radius: 12px;
             background: var(--superficie); color: var(--tinta); text-align: center; position: relative; }
.anel-item:hover { border-color: var(--cor); text-decoration: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--cor) 18%, transparent); }
.anel-caixa { position: relative; width: 74px; height: 74px; }
.anel-caixa .chip { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: none; width: 26px; height: 26px; }
.anel-caixa .chip .icone { width: 18px; height: 18px; }
.anel { width: 74px; height: 74px; display: block; }
.anel-trilho { fill: none; stroke: color-mix(in srgb, var(--cor) 14%, transparent); stroke-width: 6; }
.anel-valor { fill: none; stroke: var(--cor); stroke-width: 6; stroke-linecap: round; }
.anel-item .pct { font-size: 1.05rem; font-weight: 700; line-height: 1.1; }
.anel-item .rot { font-size: .75rem; font-weight: 600; line-height: 1.2; }
.anel-item .sub { font-size: .66rem; color: var(--tinta-3); }
.anel-item.sem-fonte { opacity: .72; }

/* grade de 3 painéis */
.grade-3 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3.2fr); gap: 1rem; margin-top: 1rem; align-items: stretch; }
.grade-3 > * { min-width: 0; }
@media (max-width: 1399px) { .grade-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grade-3 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) { .grade-3 { grid-template-columns: minmax(0, 1fr); } }
.grade-3 .alertas { max-height: 420px; overflow-y: auto; }
.grade-3 .mapa { height: 400px; }
.grade-3 .cartao-corpo > .grafico { max-width: none; }

/* barras: o município da página em cor, os demais neutros (ênfase) */
.grafico .barra-outra { fill: var(--slate-300); }

/* eixos em destaque */
.destaque-eixo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center;
                 padding: .75rem 1.1rem; border-bottom: 1px solid var(--linha); color: var(--tinta); }
.destaque-eixo:last-child { border-bottom: 0; }
.destaque-eixo:hover { background: var(--superficie-2); text-decoration: none; }
.destaque-eixo strong { display: block; font-size: .88rem; }
.destaque-eixo span { font-size: .76rem; color: var(--tinta-2); }
.destaque-eixo .ir { color: var(--acao); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.cartao-cab h2 .icone { color: var(--acao); }
.abas a .icone { width: 16px; height: 16px; color: var(--cor); }
.seletor-mini { display: flex; gap: .3rem; flex-wrap: wrap; }
.seletor-mini a { font-size: .74rem; padding: .15rem .55rem; border: 1px solid var(--linha); border-radius: 999px; color: var(--tinta-2); }
.seletor-mini a[aria-current="true"] { border-color: var(--acao); color: var(--acao); background: var(--acao-fundo); }
.faixa-destaque img { object-position: center 68%; }

/* proporções v2.1 */
.aneis { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .45rem; padding: .8rem; }
.anel-item { padding: .5rem .25rem .45rem; border-radius: 10px; }
.anel-caixa, .anel { width: 54px; height: 54px; }
.anel-caixa .chip { width: 22px; height: 22px; }
.anel-caixa .chip .icone { width: 15px; height: 15px; }
.anel-item .pct { font-size: .9rem; }
.anel-item .rot { font-size: .7rem; }
.anel-item .sub { font-size: .62rem; }
.kpi .chip { width: 34px; height: 34px; border-radius: 10px; }
.kpi .chip .icone { width: 18px; height: 18px; }
.kpi-topo { gap: .55rem; align-items: flex-start; }
.kpi-topo .nome { font-size: .78rem; }
@media (max-width: 767px) { .faixa-texto { padding: 1rem 1rem 1.6rem; } .faixa-texto p { font-size: .8rem; } }
.faixa-destaque { margin: 0 0 1rem; min-height: 150px; }
