/* Mapa de Empresas · Tech Contábil
   Mesmo visual do Dashboard Contábil e Financeiro (relatorios-internos), em CSS próprio e curto (sem Tailwind). */

/* [hidden] sempre esconde: sem isto, regras como .campo { display:flex } venciam o atributo
   (era o defeito da busca pelo nome que aparecia sem funcionar) */
[hidden] { display: none !important; }

:root {
  --navy: #0A2540; --navy-2: #143458;
  --gold: #FBBF24; --gold-600: #D97706; --gold-50: #FFFBEB; --gold-100: #FEF3C7;
  --fundo: #f6f8fb; --card: #fff; --card-2: #f8fafc; --borda: #e2e8f0; --borda-2: #cbd5e1;
  --texto: #0A2540; --texto-2: #475569; --texto-3: #64748b; --texto-4: #94a3b8;
  --barra: #0A2540; --barra-fundo: #eef2f7; --barra-sel: #D97706;
  --verde: #059669; --verde-escuro: #047857;
  --sombra: 0 1px 2px rgba(10,37,64,.04), 0 8px 24px -16px rgba(10,37,64,.18);
  --capsula: rgba(255,255,255,.82);
}
html[data-tema="escuro"] {
  color-scheme: dark;
  --fundo: #121214; --card: #1c1c1f; --card-2: #18181b; --borda: #323238; --borda-2: #3f3f46;
  --texto: #ececee; --texto-2: #b4b4bb; --texto-3: #a1a1aa; --texto-4: #8e8e98;
  --barra: #8AA6C6; --barra-fundo: #27272a; --barra-sel: #fbbf24;
  --sombra: 0 1px 2px rgba(0,0,0,.4); --capsula: rgba(28,28,31,.85);
  --gold-50: rgba(245,158,11,.13); --gold-100: rgba(245,158,11,.22);
  --verde: #10b981; --verde-escuro: #059669;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 10rem; }
body { margin: 0; min-height: 100vh; background: var(--fundo); color: var(--texto); font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.envolve { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .envolve { padding: 0 1.5rem; } }
/* ícones de linha (os gráficos têm SVG próprio e não entram aqui) */
.btn-redondo svg, .btn-principal svg, .selo-publico svg, .secao-icone svg, .btn-excel svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- faixa de vidro fosco atrás do cabeçalho e dos filtros (igual ao #faixa-topo do Dashboard) ---------- */
#faixa-topo { position: fixed; top: 0; left: var(--faixa-x, 0px); width: var(--faixa-w, 100%); height: var(--faixa-h, 0px); z-index: 20; pointer-events: none;
  background: rgba(246, 248, 251, .74); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  border-radius: 0 0 28px 28px; box-shadow: 0 14px 22px -16px rgba(10, 37, 64, .35); opacity: 0; transition: opacity .15s; }
html[data-tema="escuro"] #faixa-topo { background: rgba(18, 18, 20, .74); box-shadow: 0 14px 22px -16px rgba(0, 0, 0, .7); }
body.barra-presa #faixa-topo { opacity: 1; }

/* ---------- cabeçalho ---------- */
#cabecalho { position: sticky; top: 0; padding-top: .75rem; z-index: 50; }
.capsula { background: var(--capsula); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border: 1px solid var(--borda); box-shadow: 0 1px 2px rgba(10,37,64,.05); border-radius: 9999px;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .5rem .5rem 1rem; }
.marca { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.marca a { display: flex; align-items: center; height: 2.5rem; flex-shrink: 0; }
.marca img { height: 2.5rem; width: auto; }
.logo-escuro { display: none; }
html[data-tema="escuro"] .logo-claro { display: none; }
html[data-tema="escuro"] .logo-escuro { display: block; }
.divisor { width: 1px; height: 2rem; background: var(--borda); flex-shrink: 0; }
.marca-texto { min-width: 0; }
.marca-titulo { font-weight: 700; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-sub { font-size: 11px; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acoes { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.btn-redondo { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 9999px; border: 1px solid var(--borda); background: var(--card); cursor: pointer; }
.btn-redondo:hover { background: var(--barra-fundo); }
.btn-redondo svg { width: 18px; height: 18px; }
.btn-principal { display: inline-flex; align-items: center; gap: .5rem; background: #0A2540; color: #fff; text-decoration: none; font-weight: 600; font-size: 13px; padding: .6rem 1rem .6rem .9rem; border-radius: 9999px; box-shadow: 0 1px 2px rgba(0,0,0,.1); transition: transform .3s, box-shadow .3s; }
.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(10,37,64,.25); }
html[data-tema="escuro"] .btn-principal { background: #3f3f46; }
.btn-principal svg { width: 16px; height: 16px; }
@media (max-width: 639px) { .divisor, .marca-texto { display: none; } .btn-principal span { display: none; } .btn-principal { padding: .6rem; } }

main.envolve { padding-top: 1.75rem; padding-bottom: 2rem; display: grid; gap: 1rem; }

/* ---------- abertura ---------- */
.hero { display: grid; gap: 1.25rem; align-items: center; padding: .25rem 0 .5rem; }
@media (min-width: 1024px) { .hero { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 2rem; } }
.hero-sobre { display: inline-flex; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-600); }
html[data-tema="escuro"] .hero-sobre { color: var(--gold); }
.hero h1 { font-size: clamp(1.5rem, 3.2vw, 2.2rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.12; margin-top: .35rem; }
.hero-p { margin-top: .6rem; color: var(--texto-2); max-width: 48rem; }
.selo-publico { display: inline-flex; align-items: center; gap: .45rem; margin-top: .85rem; font-size: 12.5px; font-weight: 600; color: var(--texto-2);
  background: var(--card); border: 1px solid var(--borda); border-radius: 9999px; padding: .35rem .85rem .35rem .6rem; }
.selo-publico svg { width: 16px; height: 16px; color: var(--verde); flex-shrink: 0; }
.hero-passos { list-style: none; padding: 0; display: grid; gap: .5rem; }
.hero-passos li { display: flex; align-items: center; gap: .75rem; background: var(--card); border: 1px solid var(--borda); border-radius: 1rem; padding: .7rem .9rem; font-size: 14px; color: var(--texto-2); box-shadow: var(--sombra); }
.hero-passos b { flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 9999px; display: grid; place-items: center; background: var(--gold-100); color: var(--gold-600); font-size: 13px; }
html[data-tema="escuro"] .hero-passos b { color: var(--gold); }
.hero-passos strong { color: var(--texto); }
@media (max-width: 1023px) { .hero-passos { display: none; } }

/* ---------- filtros: duas cápsulas travadas abaixo do cabeçalho (como as barras do Dashboard) ----------
   linha 1 = o que procurar (cidade, atividade, bairro), campos largos e texto maior; linha 2 = refinar (porte, regime, abertura) */
#filtros { position: sticky; top: 4.9rem; z-index: 40; display: grid; gap: .3rem; justify-items: start; }
.filtros-linha { display: flex; align-items: center; gap: .15rem; background: var(--card); border: 1px solid var(--borda); border-radius: 9999px; padding: .25rem; box-shadow: 0 1px 2px rgba(10,37,64,.06); max-width: 100%; }
.filtros-linha.principal { width: 100%; }
/* "Refinar": só a largura do conteúdo (não estica até o fim da tela) */
.filtros-linha.refinar { width: auto; padding-left: .95rem; }
.refinar .campo-extra { flex: 0 0 auto; }
.refinar #f-porte { width: 12.5rem; } .refinar #f-regime { width: 14rem; } .refinar #f-ano { width: 7.5rem; }
/* navegadores novos: cada campo do Refinar tem a largura do texto escolhido (nada cortado, nada sobrando) */
@supports (field-sizing: content) { .refinar .campo-extra select { field-sizing: content; width: auto !important; min-width: 4.5rem; padding-right: 1.6rem; } }
.refinar-rotulo { font-size: 11px; font-weight: 800; color: var(--texto-2); text-transform: uppercase; letter-spacing: .06em; margin-right: .35rem; white-space: nowrap; }
.campo { position: relative; display: flex; align-items: center; gap: .4rem; background: transparent; border-radius: 9999px; padding: 0 .3rem 0 .85rem; min-height: 2.05rem; min-width: 0; transition: background .15s; }
.campo:hover { background: var(--barra-fundo); }
.campo:focus-within { background: var(--gold-50); box-shadow: 0 0 0 2px var(--gold); }
.filtros-linha .campo + .campo::before { content: ""; position: absolute; left: -.1rem; top: 25%; height: 50%; width: 1px; background: var(--borda); }
.filtros-linha .campo:hover::before, .filtros-linha .campo:focus-within::before, .filtros-linha .campo:hover + .campo::before, .filtros-linha .campo:focus-within + .campo::before { opacity: 0; }
.campo label { font-size: 11px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; cursor: pointer; }
.campo select, .campo input { border: 0; background: transparent; outline: none; font-weight: 600; font-size: 14px; padding: .3rem .25rem; min-width: 0; }
.campo select { cursor: pointer; text-overflow: ellipsis; }
.campo select option { background: var(--card); color: var(--texto); }
.campo input::placeholder { color: var(--texto-4); font-weight: 500; }
.campo-cnae { flex: 2.2 1 20rem; min-width: 14rem; }
.campo-cnae input, .campo-bairro input { width: 100%; text-overflow: ellipsis; }
.campo-bairro { flex: 1 1 12rem; min-width: 10rem; }
#f-cidade { width: 10rem; } #f-porte { width: 13rem; } #f-regime { width: 13.5rem; } #f-ano { width: 9rem; }
#btn-limpar { display: none; } /* "Limpar tudo" fica na linha dos filtros em uso */
.chips .limpar-tudo { border: 0; background: none; font-weight: 700; font-size: 12.5px; color: var(--gold-600); cursor: pointer; padding: .25rem .5rem; border-radius: 9999px; }
.chips .limpar-tudo:hover { background: var(--gold-50); }
html[data-tema="escuro"] .chips .limpar-tudo { color: var(--gold); }
.limpa-campo { border: 0; background: none; cursor: pointer; color: var(--texto-4); font-size: 18px; line-height: 1; padding: 0; width: 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; border-radius: 9999px; flex-shrink: 0; }
.limpa-campo:hover { background: var(--barra-fundo); }
.limpa-campo:hover { color: var(--texto); }
.btn-texto { border: 0; background: none; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--texto-2); padding: .5rem .75rem; border-radius: 9999px; }
.btn-texto:hover { color: var(--texto); background: var(--barra-fundo); }
@media (max-width: 767px) {
  #filtros { top: 4.4rem; gap: .3rem; justify-items: stretch; }
  .filtros-linha, .filtros-linha.refinar { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .35rem; border-radius: 1.25rem; }
  .refinar-rotulo { grid-column: 1 / -1; padding: .1rem .3rem 0; }
  .campo, .refinar .campo { min-height: 2.1rem; padding-left: .65rem; background: var(--barra-fundo); }
  .filtros-linha .campo + .campo::before { display: none; }
  .campo label { font-size: 10px; }
  .campo select, .campo input, .refinar .campo select { font-size: 13px; padding: .3rem .2rem; width: 100%; }
  #f-cidade, #f-porte, #f-regime, #f-ano { width: 100%; }
  .campo-cnae { grid-column: 1 / -1; order: -1; min-width: 0; }
  .campo-bairro { min-width: 0; }
  #filtros:not(.aberto) .refinar { display: none; }
  .btn-mais-filtros { display: block !important; grid-column: 1 / -1; }
  .refinar .campo-extra:last-of-type { grid-column: 1 / -1; }
  /* tabela de bairros do Raio-X: cada bairro vira um bloco */
  .tabela-bairros thead { display: none; }
  .tabela-bairros, .tabela-bairros tbody, .tabela-bairros tr { display: block; width: 100%; }
  .tabela-bairros tr { padding: .6rem .25rem; border-bottom: 1px solid var(--borda); }
  .tabela.tabela-bairros th, .tabela.tabela-bairros td { display: inline; border: 0; padding: 0; font-size: 12.5px; color: var(--texto-2); text-align: left; white-space: normal; }
  .rx-bairros-topo .seg { width: 100%; }
  .rx-bairros-topo .seg button { flex: 1; padding: .35rem .4rem; font-size: 12px; }
  .tabela.tabela-bairros th { display: block; font-size: 13.5px; color: var(--texto); margin-bottom: .25rem; }
  .tabela.tabela-bairros td[data-r]::before { content: attr(data-r) " "; color: var(--texto-3); }
  .tabela.tabela-bairros td:nth-of-type(1)::after, .tabela.tabela-bairros td:nth-of-type(2)::after { content: " · "; color: var(--texto-4); }
  .tabela.tabela-bairros td:last-child { display: block; margin-top: .3rem; }
  .tabela-bairros .peso-barra { display: none; }
}
.btn-mais-filtros { display: none; border: 1px dashed var(--borda-2); background: none; border-radius: 9999px; padding: .4rem .8rem; font-size: 12.5px; font-weight: 700; color: var(--texto-2); cursor: pointer; }

/* filtros em uso */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; min-height: 0; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--borda); background: var(--card); border-radius: 9999px; padding: .25rem .35rem .25rem .7rem; font-size: 12.5px; font-weight: 600; color: var(--texto-2); }
.chip b { color: var(--texto-3); font-weight: 600; }
.chip button { border: 0; background: var(--barra-fundo); color: var(--texto-2); width: 1.35rem; height: 1.35rem; border-radius: 9999px; cursor: pointer; line-height: 1; font-size: 14px; padding: 0; display: inline-grid; place-items: center; }
.chip button:hover { background: var(--gold-100); color: var(--texto); }
.aviso-filtro { display: flex; gap: .5rem; background: var(--gold-50); border: 1px solid rgba(245,158,11,.4); border-radius: .9rem; padding: .6rem .9rem; font-size: 13.5px; color: var(--texto-2); }

/* ---------- cartões ---------- */
#painel { display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--borda); border-radius: 1.1rem; box-shadow: var(--sombra); min-width: 0; }
.secao { padding: 1.25rem; }
@media (min-width: 640px) { .secao { padding: 1.4rem 1.5rem; } }
.card-titulo { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.card-sub { font-size: 13px; color: var(--texto-3); margin-top: .15rem; }
.sub-titulo { font-size: 14px; font-weight: 700; }
.mini-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-3); margin-top: 1rem; }
.nota { font-size: 12.5px; color: var(--texto-3); margin-top: .2rem; }
.nota-grande { font-size: 14px; margin-top: .5rem; }
.secao-topo { display: flex; gap: .85rem; align-items: flex-start; }
.secao-icone { flex-shrink: 0; width: 2.5rem; height: 2.5rem; border-radius: .8rem; display: grid; place-items: center; background: var(--gold-100); color: var(--gold-600); }
html[data-tema="escuro"] .secao-icone { color: var(--gold); }
.secao-icone svg { width: 20px; height: 20px; }
.secao-linha { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.grade-4 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 1024px) { .grade-4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.grade-2 { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1024px) { .grade-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.grade-3 { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1024px) { .grade-3 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }

.kpi { padding: 1rem 1.1rem; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); opacity: .9; }
.kpi-rotulo { font-size: 12px; font-weight: 600; color: var(--texto-3); }
.kpi-valor { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 800; letter-spacing: -.02em; margin-top: .15rem; }
.kpi-nota { font-size: 12px; color: var(--texto-3); margin-top: .1rem; }

/* barras horizontais em HTML puro (sem biblioteca de gráficos) */
.barras { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .25rem; }
.mini-titulo + .barras { margin-top: .4rem; }
.barra { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .15rem .75rem; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: .32rem .5rem; border-radius: .65rem; cursor: pointer; }
.barra:hover, .barra:focus-visible { background: var(--barra-fundo); outline: none; }
.barra[aria-pressed="true"] { background: var(--gold-50); box-shadow: inset 0 0 0 1px rgba(245,158,11,.45); }
.barra-nome { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-valor { font-size: 13px; font-weight: 700; }
.barra-valor small { font-weight: 500; color: var(--texto-3); margin-left: .35rem; }
.barra-trilho { grid-column: 1 / -1; height: 6px; border-radius: 9999px; background: var(--barra-fundo); overflow: hidden; }
.barra-trilho i { display: block; height: 100%; border-radius: inherit; background: var(--barra); }
.barra[aria-pressed="true"] .barra-trilho i { background: var(--barra-sel); }
.barra.estatica { cursor: default; }
.barra.estatica:hover { background: none; }
.pos { color: var(--texto-4); font-weight: 600; margin-right: .2rem; }
.cnae-cod { font-size: 11.5px; color: var(--texto-4); font-weight: 500; margin-left: .3rem; white-space: nowrap; }
.ver-mais { margin-top: .5rem; }
.vazio { color: var(--texto-3); font-size: 13.5px; padding: 1.25rem .5rem; text-align: center; }
.carregando { opacity: .55; transition: opacity .2s; }
#painel.com-erro { display: none; }

/* ---------- Raio-X da concorrência ---------- */
.raio-x { border-top: 3px solid var(--gold); }
.rx-vazio { margin-top: 1rem; font-size: 14px; color: var(--texto-2); }
.sugestoes { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.sugestoes button { border: 1px solid var(--borda); background: var(--card-2); border-radius: 9999px; padding: .4rem .85rem; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--texto); }
.sugestoes button:hover { border-color: var(--gold); background: var(--gold-50); }
.sugestoes small { color: var(--texto-3); font-weight: 500; margin-left: .3rem; }
.rx-grade { display: grid; gap: 1.5rem; margin-top: 1.1rem; }
@media (min-width: 1024px) { .rx-grade { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.funil { list-style: none; padding: 0; margin-top: .75rem; display: grid; gap: .45rem; }
.funil li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; align-items: center; }
.funil-rotulo { font-size: 13px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funil-rotulo strong { color: var(--texto); font-weight: 700; }
.funil-valor { font-size: 14px; font-weight: 800; text-align: right; }
.funil-valor small { display: block; font-size: 11px; font-weight: 500; color: var(--texto-3); }
.funil-trilho { grid-column: 1 / -1; height: 12px; border-radius: 9999px; background: var(--barra-fundo); overflow: hidden; }
.funil-trilho i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0A2540, #355D88); }
html[data-tema="escuro"] .funil-trilho i { background: linear-gradient(90deg, #5B7FA8, #8AA6C6); }
.funil li.ultimo .funil-trilho i { background: linear-gradient(90deg, #D97706, #FBBF24); }
.funil li.inativo .funil-rotulo, .funil li.inativo .funil-valor { color: var(--texto-4); }
.funil li.inativo .funil-trilho i { background: var(--borda-2); }
.rx-indicadores { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.ind { background: var(--card-2); border: 1px solid var(--borda); border-radius: .9rem; padding: .75rem .85rem; }
.ind-rotulo { font-size: 11.5px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .04em; }
.ind-valor { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin-top: .1rem; }
.ind-nota { font-size: 12px; color: var(--texto-3); margin-top: .1rem; line-height: 1.4; }
.ind.destaque { background: var(--gold-50); border-color: rgba(245,158,11,.45); }
.rx-bairros { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--borda); }
/* o seletor de ordem fica sempre no canto direito: o texto ao lado quebra linha, o seletor não sai do lugar */
.rx-bairros-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.rx-bairros-topo > div:first-child { flex: 1 1 auto; min-width: 0; }
.rx-bairros-topo .seg { flex-shrink: 0; }
@media (max-width: 767px) { .rx-bairros-topo { flex-direction: column; gap: .6rem; } }
.seg { display: inline-flex; background: var(--barra-fundo); border-radius: 9999px; padding: .2rem; gap: .1rem; }
.seg button { border: 0; background: none; padding: .35rem .8rem; border-radius: 9999px; font-size: 12.5px; font-weight: 600; color: var(--texto-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #0A2540; color: #fff; }
html[data-tema="escuro"] .seg button[aria-pressed="true"] { background: #3f3f46; }
.tabela-bairros tbody tr { cursor: pointer; }
.tabela-bairros tbody tr:hover td, .tabela-bairros tbody tr:hover th { background: var(--barra-fundo); }
.tabela-bairros tbody tr.sel td, .tabela-bairros tbody tr.sel th { background: var(--gold-50); }
.peso-barra { display: inline-block; vertical-align: middle; width: 4.5rem; height: 6px; border-radius: 9999px; background: var(--barra-fundo); margin-left: .5rem; overflow: hidden; }
.peso-barra i { display: block; height: 100%; background: var(--barra); border-radius: inherit; }
.indice { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 9999px; padding: .1rem .5rem; white-space: nowrap; }
/* cores neutras: concentração não é "bom" nem "ruim" (sugestão da auditoria) */
.indice.alto { background: #0A2540; color: #fff; }
.indice.medio { background: var(--barra-fundo); color: var(--texto-2); }
.indice.baixo { background: transparent; color: var(--texto-2); box-shadow: inset 0 0 0 1px var(--borda-2); }
html[data-tema="escuro"] .indice.alto { background: #8AA6C6; color: #121214; }

/* ---------- aberturas por ano: colunas em SVG, clicáveis ---------- */
.anos svg { width: 100%; height: auto; display: block; margin-top: .75rem; overflow: visible; }
.anos .col { cursor: pointer; }
.anos .col rect.fundo { fill: transparent; }
.anos .col:hover rect.fundo, .anos .col:focus-visible rect.fundo { fill: var(--barra-fundo); }
.anos .col:focus-visible { outline: none; }
.anos rect.valor { fill: var(--barra); }
.anos .col.parcial rect.valor { fill: var(--gold); }
.anos .col.sel rect.valor { fill: var(--barra-sel); }
.anos .col.apagada rect.valor { opacity: .3; }
.anos text { fill: var(--texto-3); font-size: 10px; font-family: inherit; }
.anos text.rot-valor { fill: var(--texto); font-weight: 700; }
.anos-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.anos-resumo div { background: var(--card-2); border: 1px solid var(--borda); border-radius: .9rem; padding: .6rem .8rem; }
.anos-resumo p { font-size: 12px; color: var(--texto-3); }
.anos-resumo strong { display: block; font-size: 1.15rem; font-weight: 800; color: var(--texto); }
@media (max-width: 639px) { .anos-resumo { grid-template-columns: 1fr; } }

/* ---------- mapa das cidades (contorno oficial do IBGE, em SVG) ---------- */
.mapa-grade { display: grid; gap: 1.25rem; margin-top: .75rem; align-items: start; }
@media (min-width: 1024px) { .mapa-grade { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.mapa-regiao svg { width: 100%; height: auto; display: block; max-height: 520px; }
.mapa-regiao path { stroke: var(--card); stroke-width: 1.5; cursor: pointer; transition: opacity .15s; }
.mapa-regiao g:hover path { opacity: .85; }
.mapa-regiao g.sel path { stroke: var(--gold); stroke-width: 3; }
.mapa-regiao g:focus-visible { outline: none; }
.mapa-regiao g:focus-visible path { stroke: var(--gold); stroke-width: 3; }
.mapa-regiao text { font-family: inherit; pointer-events: none; paint-order: stroke; stroke-linejoin: round; }
.mapa-regiao .rot-nome { font-size: 12px; font-weight: 700; }
.mapa-regiao .rot-num { font-size: 11px; font-weight: 600; }
.mapa-legenda { display: flex; align-items: center; gap: .5rem; font-size: 12px; color: var(--texto-3); margin-top: .5rem; flex-wrap: wrap; }
.mapa-legenda .escala { display: inline-block; width: 8rem; height: 8px; border-radius: 9999px; }

/* ---------- lista de empresas ---------- */
.lista-topo { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.lista-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
@media (min-width: 768px) { .lista-acoes { flex-wrap: nowrap; } }
.campo-busca { border: 1px solid var(--borda); flex: 0 1 18rem; }
.campo-busca input { width: 100%; }
.btn-excel { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--verde-escuro); background: var(--verde); color: #fff; font-weight: 600; font-size: 13px; padding: .55rem .95rem; border-radius: 9999px; cursor: pointer; white-space: nowrap; }
.btn-excel:hover { background: var(--verde-escuro); }
.btn-excel:disabled { opacity: .85; cursor: progress; }
.btn-excel svg { width: 16px; height: 16px; }
.excel-barra { height: 4px; border-radius: 9999px; background: var(--barra-fundo); overflow: hidden; margin-top: .75rem; }
.excel-barra i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s; }
.tabela-empresas td { vertical-align: top; }
.tabela-empresas .emp-nome { font-weight: 700; }
.tabela-empresas .emp-fant { display: block; font-size: 12.5px; color: var(--texto-3); margin-top: .1rem; }
.tabela-empresas .emp-cnpj { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  /* celular: cada empresa vira um bloco, sem tabela larga */
  .tabela-empresas thead { display: none; }
  .tabela-empresas, .tabela-empresas tbody, .tabela-empresas tr { display: block; width: 100%; }
  .tabela-empresas tr { padding: .65rem 0; border-bottom: 1px solid var(--borda); }
  .tabela.tabela-empresas td { display: inline; border: 0; padding: 0; text-align: left; font-size: 12.5px; color: var(--texto-2); }
  .tabela.tabela-empresas td:first-child { display: block; font-size: 13.5px; color: var(--texto); margin-bottom: .2rem; }
  .tabela.tabela-empresas td:not(:first-child):not(:last-child)::after { content: " · "; color: var(--texto-4); }
  .tabela.tabela-empresas td[data-r="Abertura"]::before { content: "aberta em "; }
  .tabela.tabela-empresas td[data-r="Regime"]::before { content: "regime: "; }
}

/* ---------- tabelas ---------- */
.tabela-rolagem { overflow-x: auto; margin-top: .75rem; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela th, .tabela td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela thead th { font-size: 11.5px; color: var(--texto-3); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tabela tbody th { font-weight: 700; white-space: nowrap; }
.tabela .dir { text-align: right; white-space: nowrap; }
.tabela a { text-decoration: none; border-bottom: 1px dashed var(--borda-2); }

/* ---------- chamada para a Tech ---------- */
.chamada { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; background: linear-gradient(135deg, #0A2540, #143458); color: #fff; border: 0; }
html[data-tema="escuro"] .chamada { background: linear-gradient(135deg, #1c1c1f, #27272a); border: 1px solid var(--borda); }
.chamada p { color: rgba(255,255,255,.78); font-size: 14px; margin-top: .25rem; max-width: 40rem; }
.chamada .card-titulo { color: #fff; font-size: 18px; }
.chamada-botoes { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-ouro { display: inline-flex; align-items: center; gap: .5rem; background: var(--gold); color: #0A2540; font-weight: 700; font-size: 14px; text-decoration: none; padding: .7rem 1.2rem; border-radius: 9999px; white-space: nowrap; }
.btn-ouro:hover { background: #fcd34d; }
.btn-contorno { display: inline-flex; align-items: center; color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; padding: .7rem 1.1rem; border-radius: 9999px; border: 1px solid rgba(255,255,255,.35); white-space: nowrap; }
.btn-contorno:hover { background: rgba(255,255,255,.08); }

/* ---------- texto fixo (Google e IAs) ---------- */
.secao-titulo { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-top: 1rem; }
.lista-top { margin: .75rem 0 0; padding-left: 1.3rem; display: grid; gap: .35rem; font-size: 13.5px; }
.lista-top li { padding-left: .2rem; }
.lista-top li .num { float: right; font-weight: 700; margin-left: .75rem; }
.faq-lista { margin-top: .5rem; }
.faq { border-bottom: 1px solid var(--borda); padding: .8rem 0; }
.faq:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 14.5px; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--gold-600); font-weight: 800; }
.faq[open] summary::after { content: "−"; }
.faq p { margin-top: .45rem; color: var(--texto-2); font-size: 14px; }
/* o texto gerado usa .card p-5 / p-6 */
.p-5 { padding: 1.25rem; }
@media (min-width: 640px) { .sm\:p-6 { padding: 1.5rem; } }
footer { color: var(--texto-3); font-size: 12.5px; padding: 1.5rem 0 2.5rem; text-align: center; }
footer a { color: var(--texto-2); }
footer p + p { margin-top: .35rem; }
.selo-publico b, footer b { color: var(--texto); }

@media print {
  #faixa-topo, #cabecalho, #filtros, .chamada, .acoes, .btn-excel, .seg, .chips button, .limpar-tudo { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- efeitos e vidro líquido (como no Dashboard). Botão ✦ no cabeçalho liga e desliga (guardado neste navegador).
   Só na tela: impressão e "reduzir movimento" do sistema ficam sem efeitos. Nenhuma cor nova, só translúcidas ---------- */
#btn-efeitos[aria-pressed="true"] { color: var(--gold-600); }
html[data-tema="escuro"] #btn-efeitos[aria-pressed="true"] { color: var(--gold); }
@media screen {
  /* fundo ambiente: manchas suaves com as cores da marca, para o vidro ter cor atrás para desfocar */
  html.fx-on body {
    background-image:
      radial-gradient(620px 460px at 6% 12%, rgba(37, 99, 235, .16), transparent 70%),
      radial-gradient(560px 420px at 92% 22%, rgba(201, 162, 39, .20), transparent 70%),
      radial-gradient(700px 520px at 40% 62%, rgba(10, 37, 64, .12), transparent 72%),
      radial-gradient(620px 480px at 85% 92%, rgba(37, 99, 235, .14), transparent 70%),
      radial-gradient(520px 420px at 12% 95%, rgba(201, 162, 39, .14), transparent 70%);
    background-attachment: fixed;
  }
  html.fx-on[data-tema="escuro"] body {
    background-image:
      radial-gradient(620px 460px at 6% 12%, rgba(96, 165, 250, .12), transparent 70%),
      radial-gradient(560px 420px at 92% 22%, rgba(201, 162, 39, .10), transparent 70%),
      radial-gradient(700px 520px at 40% 62%, rgba(99, 102, 241, .08), transparent 72%),
      radial-gradient(620px 480px at 85% 92%, rgba(96, 165, 250, .10), transparent 70%);
  }
  /* barras fixas (cabeçalho e filtros): vidro com reflexo claro em cima */
  html.fx-on .capsula, html.fx-on .filtros-linha {
    background-color: rgba(255, 255, 255, .62);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 70%);
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
    border-color: rgba(255, 255, 255, .75);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .3), 0 10px 30px -14px rgba(10, 37, 64, .28);
  }
  html.fx-on[data-tema="escuro"] .capsula, html.fx-on[data-tema="escuro"] .filtros-linha {
    background-color: rgba(28, 28, 31, .6);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 70%);
    border-color: rgba(255, 255, 255, .1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 10px 30px -14px rgba(0, 0, 0, .7);
  }
  html.fx-on #faixa-topo { background: rgba(246, 248, 251, .55); }
  html.fx-on[data-tema="escuro"] #faixa-topo { background: rgba(18, 18, 20, .6); }
  /* cartões: vidro líquido (desfoque do fundo, luz na borda de cima e à esquerda, brilho interno); o texto continua sobre fundo claro o bastante para ler */
  html.fx-on .card:not(.chamada) {
    background-color: rgba(255, 255, 255, .55);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, .15) 38%, rgba(255, 255, 255, .08) 62%, rgba(255, 255, 255, .3) 100%);
    -webkit-backdrop-filter: blur(24px) saturate(1.9); backdrop-filter: blur(24px) saturate(1.9);
    border-color: rgba(255, 255, 255, .65);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 1.5px 0 0 rgba(255, 255, 255, .55), inset 0 -1px 0 rgba(255, 255, 255, .3),
      0 1px 2px rgba(10, 37, 64, .06), 0 24px 50px -24px rgba(10, 37, 64, .3);
  }
  html.fx-on[data-tema="escuro"] .card:not(.chamada) {
    background-color: rgba(28, 28, 31, .55);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02) 45%, rgba(255, 255, 255, .05));
    border-color: rgba(255, 255, 255, .1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 22px 48px -24px rgba(0, 0, 0, .8);
  }
}
/* movimento: só quando o sistema não pede "reduzir movimento" */
@media screen and (prefers-reduced-motion: no-preference) {
  @keyframes fx-sobe { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
  @keyframes fx-revela { from { opacity: .35; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes fx-foco { from { opacity: 0; filter: blur(6px); transform: translateY(4px); } to { opacity: 1; filter: none; transform: none; } }
  html.fx-on .fx-cartao { animation: fx-sobe .65s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--fx-atraso, 0ms); }
  /* o que espera a rolagem fica meio visível (nunca some) e completa ao chegar na tela */
  html.fx-on .fx-espera { opacity: .35; transform: translateY(12px); }
  html.fx-on .fx-revela { animation: fx-revela .55s cubic-bezier(.16, 1, .3, 1) both; }
  /* números: o texto já é o valor final; só aparece com foco suave */
  html.fx-on .fx-valor { animation: fx-foco .6s cubic-bezier(.16, 1, .3, 1) both; }
  /* cartões de resumo levantam um pouco ao passar o mouse; botões afundam ao clicar */
  html.fx-on .kpi { transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease; }
  html.fx-on .kpi:hover { transform: translateY(-3px); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), 0 14px 34px -14px rgba(10, 37, 64, .3); }
  html.fx-on[data-tema="escuro"] .kpi:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 14px 34px -14px rgba(0, 0, 0, .75); }
  html.fx-on button:not(:disabled), html.fx-on .btn-principal { transition-property: color, background-color, border-color, box-shadow, opacity, transform; transition-duration: .15s; }
  html.fx-on button:not(:disabled):active, html.fx-on .btn-principal:active { transform: scale(.96); }
  html.fx-on { interpolate-size: allow-keywords; }
  html.fx-on details::details-content { transition: height .35s cubic-bezier(.16, 1, .3, 1), content-visibility .35s allow-discrete; height: 0; overflow: clip; }
  html.fx-on details[open]::details-content { height: auto; }
}
/* chamada (Vai abrir ou expandir a empresa?): continua azul-marinho com texto branco, em vidro escuro */
@media screen {
  html.fx-on .chamada { background: linear-gradient(135deg, rgba(10, 37, 64, .9), rgba(20, 52, 88, .84)); -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 24px 50px -24px rgba(10, 37, 64, .45); }
  html.fx-on[data-tema="escuro"] .chamada { background: linear-gradient(135deg, rgba(28, 28, 31, .75), rgba(39, 39, 42, .7)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 22px 48px -24px rgba(0, 0, 0, .8); }
}
@media print { .fx-cartao, .fx-espera, .fx-revela, .fx-valor { animation: none !important; opacity: 1 !important; transform: none !important; filter: none !important; } #btn-efeitos { display: none !important; } }

/* identificação da ferramenta: só no papel/PDF (na tela o cabeçalho já mostra) */
.so-impressao { display: none; }
@media print { .so-impressao { display: block; font-size: 11px; color: #475569; border-bottom: 1px solid #e2e8f0; padding-bottom: .4rem; margin-bottom: .6rem; } }

/* ---------- sugestões de atividade (lista própria: rápida, mostra código e quantas empresas há na cidade) ---------- */
.campo-cnae { position: relative; }
.lista-cnae { position: absolute; left: 0; right: 0; top: calc(100% + .45rem); z-index: 60; max-height: min(26rem, 60vh); overflow: auto; overscroll-behavior: contain;
  background: var(--card); border: 1px solid var(--borda); border-radius: 1rem; box-shadow: 0 18px 40px -16px rgba(10,37,64,.35); padding: .35rem; }
html[data-tema="escuro"] .lista-cnae { box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); }
.sug-item { display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem; align-items: center; width: 100%; text-align: left; border: 0; background: none; color: var(--texto); cursor: pointer; padding: .5rem .65rem; border-radius: .7rem; font: inherit; }
.sug-item:hover, .sug-item.ativo { background: var(--barra-fundo); }
.sug-item .sug-nome { font-size: 14px; font-weight: 600; line-height: 1.3; }
.sug-item .sug-cod { grid-column: 1; font-size: 12px; color: var(--texto-3); }
.sug-item .sug-qtd { grid-row: 1 / span 2; grid-column: 2; font-size: 13px; font-weight: 700; color: var(--texto-2); text-align: right; white-space: nowrap; }
.sug-item .sug-qtd small { display: block; font-size: 11px; font-weight: 500; color: var(--texto-3); }
.sug-item.zero .sug-nome, .sug-item.zero .sug-qtd { color: var(--texto-3); }
.sug-item.todas { border-bottom: 1px solid var(--borda); border-radius: .7rem .7rem 0 0; margin-bottom: .25rem; }
.sug-item.todas .sug-nome { color: var(--gold-600); }
html[data-tema="escuro"] .sug-item.todas .sug-nome { color: var(--gold); }
.sug-vazio { padding: .7rem .75rem; font-size: 13px; color: var(--texto-3); }
mark.sug-marca { background: var(--gold-100); color: inherit; border-radius: 3px; padding: 0 1px; }
/* atividades que entraram numa busca com mais de um CNAE */
.cnaes-incluidos { margin-top: .6rem; padding: .75rem .9rem; border: 1px solid var(--borda); border-radius: 1rem; background: var(--card); }
.cnaes-incluidos p { font-size: 13px; color: var(--texto-2); margin: 0 0 .5rem; }
.cnaes-incluidos ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }
.cnaes-incluidos li button { width: 100%; display: flex; justify-content: space-between; gap: .75rem; text-align: left; border: 1px solid var(--borda); background: var(--card-2); color: var(--texto); border-radius: .7rem; padding: .45rem .65rem; cursor: pointer; font: inherit; font-size: 13px; }
.cnaes-incluidos li button:hover { border-color: var(--gold); }
.cnaes-incluidos li span { color: var(--texto-3); font-size: 12px; }
.cnaes-incluidos li b { white-space: nowrap; }
.cnaes-incluidos .mais { margin-top: .45rem; border: 0; background: none; color: var(--gold-600); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: .2rem 0; }
@media screen { html.fx-on .cnaes-incluidos { background-color: rgba(255,255,255,.55); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); }
  html.fx-on[data-tema="escuro"] .cnaes-incluidos { background-color: rgba(28,28,31,.55); }
  html.fx-on .lista-cnae { background-color: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); }
  html.fx-on[data-tema="escuro"] .lista-cnae { background-color: rgba(28,28,31,.94); } }
@media (max-width: 767px) { .cnaes-incluidos ul { grid-template-columns: 1fr; } }
@media print { .lista-cnae, .cnaes-incluidos .mais { display: none !important; } .cnaes-incluidos li button { border: 0; padding: .1rem 0; } }

/* a lista de atividades abre por cima da barra "Refinar" (o vidro cria camadas próprias) */
.filtros-linha.principal { position: relative; z-index: 3; }
.filtros-linha.refinar { position: relative; z-index: 1; }

/* a barra de filtros fica presa no topo: ao clicar num campo dela a página não deve rolar (a margem de rolagem do html, usada pelos links internos, fazia o navegador "procurar" o campo e subir a página) */
#filtros input, #filtros select, #filtros button { scroll-margin-top: -20rem; scroll-margin-bottom: -20rem; }

/* ---------- porte e regime: várias opções (lista com caixas de marcar e explicação curta de cada uma) ---------- */
.multi { position: relative; }
.multi-botao { border: 0; background: transparent; color: var(--texto); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; padding: .3rem 1.35rem .3rem .25rem; white-space: nowrap; text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .2rem center; background-size: 14px; }
.multi-botao:focus-visible { outline: none; }
.multi-lista { position: absolute; left: 0; top: calc(100% + .45rem); z-index: 70; width: 22rem; max-width: calc(100vw - 2rem); max-height: min(28rem, 70vh); overflow: auto;
  background: var(--card); border: 1px solid var(--borda); border-radius: 1rem; box-shadow: 0 18px 40px -16px rgba(10,37,64,.35); padding: .4rem; }
html[data-tema="escuro"] .multi-lista { box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); }
.multi-dica { font-size: 11.5px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .05em; padding: .35rem .55rem .3rem; margin: 0; }
.multi-op { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .55rem; border-radius: .7rem; cursor: pointer; }
.multi-op:hover { background: var(--barra-fundo); }
.multi-op input { margin-top: .2rem; width: 1rem; height: 1rem; accent-color: #0A2540; flex-shrink: 0; cursor: pointer; }
html[data-tema="escuro"] .multi-op input { accent-color: var(--gold); }
.multi-op b { display: block; font-size: 14px; font-weight: 600; color: var(--texto); }
.multi-op small { display: block; font-size: 12px; color: var(--texto-3); line-height: 1.35; margin-top: .1rem; }
.multi-acoes { display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--borda); margin-top: .3rem; padding: .45rem .3rem .15rem; }
.multi-acoes button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: .35rem .6rem; border-radius: 9999px; color: var(--texto-2); }
.multi-acoes [data-multi-ok] { background: #0A2540; color: #fff; padding: .35rem 1rem; }
html[data-tema="escuro"] .multi-acoes [data-multi-ok] { background: #3f3f46; }
@media screen { html.fx-on .multi-lista { background-color: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8); }
  html.fx-on[data-tema="escuro"] .multi-lista { background-color: rgba(28,28,31,.95); } }
@media (max-width: 767px) { .multi-botao { width: 100%; font-size: 13px; } .refinar .multi[data-multi="regime"] .multi-lista { left: auto; right: 0; } }
@media print { .multi-lista { display: none !important; } }

/* lista das opções: não herda o estilo das etiquetas da barra (maiúsculas, sem quebra de linha); compacta, sem rolagem para o lado */
.multi-lista { width: 19rem; overflow-x: hidden; padding: .3rem; }
.campo .multi-op { display: flex; font-size: 13.5px; font-weight: 400; color: var(--texto); text-transform: none; letter-spacing: normal; white-space: normal; padding: .4rem .5rem; gap: .55rem; }
.campo .multi-op b { font-size: 13.5px; font-weight: 600; }
.campo .multi-op small { font-size: 11.5px; line-height: 1.3; }
.multi-dica { padding: .3rem .5rem .2rem; font-size: 11px; }
.multi-acoes { padding: .35rem .25rem .1rem; }
/* Abertura: uma opção só (a escolhida fica marcada) */
.unico .multi-lista { width: 13rem; max-height: min(22rem, 60vh); }
.campo .multi-op.opcao { padding: .4rem .6rem; }
.campo .multi-op.opcao.marcada { background: var(--barra-fundo); font-weight: 700; }
.multi-grupo { font-size: 11px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .05em; padding: .45rem .6rem .15rem; margin: 0; }
@media (max-width: 767px) { .refinar .unico .multi-lista { width: min(19rem, calc(100vw - 2rem)); } }
.campo .multi-op.opcao { width: 100%; border: 0; background: none; text-align: left; font-family: inherit; cursor: pointer; border-radius: .6rem; }
.campo .multi-op.opcao:hover { background: var(--barra-fundo); }
.campo .multi-op.opcao.marcada { background: var(--gold-50); color: var(--texto); font-weight: 700; }
html[data-tema="escuro"] .campo .multi-op.opcao.marcada { background: rgba(201,162,39,.16); }

/* lista de bairros: abre alinhada à direita do campo (ele fica no canto da barra) */
.lista-bairro { left: auto; right: 0; width: 24rem; max-width: calc(100vw - 2rem); }
@media (max-width: 767px) { .lista-bairro { width: min(22rem, calc(100vw - 2rem)); } }

/* empresas encontradas, visão da região: cidades para escolher com a contagem do filtro */
.emp-cidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .5rem; margin-top: .35rem; }
.emp-cidade { display: flex; justify-content: space-between; align-items: center; gap: .6rem; border: 1px solid var(--borda); background: var(--card-2); color: var(--texto); border-radius: .85rem; padding: .65rem .85rem; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.emp-cidade b { font-variant-numeric: tabular-nums; color: var(--texto-2); font-weight: 700; }
.emp-cidade:hover { border-color: var(--gold); background: var(--gold-50); }
.emp-cidade.zero { color: var(--texto-3); }
.emp-cidade.zero b { color: var(--texto-4); font-weight: 600; }
.emp-dica { margin: .85rem 0 0; font-size: 13px; color: var(--texto-3); }
@media screen { html.fx-on .emp-cidade { background-color: rgba(255,255,255,.55); } html.fx-on[data-tema="escuro"] .emp-cidade { background-color: rgba(255,255,255,.04); } }

/* cidade: lista do mesmo tipo, com o número de empresas de cada uma */
.campo-cidade .multi-botao { min-width: 8.5rem; }
.unico .lista-cidade { width: 17rem; max-height: min(26rem, 65vh); }
.campo .multi-op.opcao { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.campo .multi-op.opcao small { font-size: 12px; color: var(--texto-3); font-weight: 500; font-variant-numeric: tabular-nums; margin: 0; }

/* aviso do CNAE principal (Raio-X e lista de atividades) */
.nota-cnae { font-size: 12.5px; color: var(--texto-3); margin: .45rem 0 0; line-height: 1.45; max-width: 60rem; }
.nota-cnae b { color: var(--texto-2); font-weight: 600; }
.sug-rodape { font-size: 11.5px; color: var(--texto-3); padding: .5rem .65rem .35rem; margin: .25rem 0 0; border-top: 1px solid var(--borda); line-height: 1.4; }

/* "Ver mais" e "Ver menos" lado a lado */
.ver-menos { margin-left: .25rem; }
/* busca pelo nome: campo com lupa, mais largo e fácil de ver */
.campo-busca { flex: 0 1 21rem; min-width: 15rem; min-height: 2.5rem; background: var(--card); border: 1px solid var(--borda-2); padding: 0 .35rem 0 .8rem; gap: .5rem; box-shadow: inset 0 1px 2px rgba(10,37,64,.05); }
.campo-busca:hover { border-color: var(--gold); background: var(--card); }
.campo-busca:focus-within { border-color: var(--gold); background: var(--card); box-shadow: 0 0 0 3px var(--gold-100); }
.busca-icone { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: var(--texto-3); stroke-width: 2.2; stroke-linecap: round; }
.campo-busca:focus-within .busca-icone { stroke: var(--gold-600); }
.campo-busca input { font-size: 14px; font-weight: 500; padding: .45rem .1rem; }
.campo-busca input::placeholder { color: var(--texto-3); font-weight: 400; }
.campo-busca input::-webkit-search-cancel-button { display: none; }
@media screen { html.fx-on .campo-busca { background-color: rgba(255,255,255,.75); } html.fx-on[data-tema="escuro"] .campo-busca { background-color: rgba(255,255,255,.05); } }
@media (max-width: 767px) { .campo-busca { flex: 1 1 100%; min-width: 0; } }
@media (min-width: 768px) { .campo-busca { flex: 0 0 19.5rem; } .campo-busca input { min-width: 13rem; } }

/* atividades escolhidas: etiquetas dentro do campo (rolam para o lado quando são muitas) */
.cnae-escolhidos { display: flex; gap: .3rem; align-items: center; flex: 0 1 auto; max-width: 62%; overflow-x: auto; scrollbar-width: none; }
.cnae-escolhidos::-webkit-scrollbar { display: none; }
.cnae-escolhidos:empty { display: none; }
.chip-cnae { display: inline-flex; align-items: center; gap: .25rem; flex-shrink: 0; max-width: 15rem; background: var(--gold-50); border: 1px solid var(--gold); color: var(--texto); border-radius: 9999px; padding: .15rem .2rem .15rem .6rem; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
html[data-tema="escuro"] .chip-cnae { background: rgba(201,162,39,.16); }
.chip-cnae span { overflow: hidden; text-overflow: ellipsis; }
.chip-cnae small { font-weight: 500; color: var(--texto-3); }
.chip-cnae button { border: 0; background: none; color: var(--texto-2); cursor: pointer; width: 1.25rem; height: 1.25rem; border-radius: 9999px; padding: 0; display: inline-grid; place-items: center; font-size: 14px; line-height: 1; flex-shrink: 0; }
.chip-cnae button:hover { background: var(--gold-100); color: var(--texto); }
.campo-cnae #f-cnae { flex: 1 1 8rem; min-width: 7rem; }
.sug-item.escolhida .sug-nome::after { content: " ✓ escolhida"; font-size: 11.5px; font-weight: 700; color: var(--gold-600); }
@media (max-width: 767px) { .cnae-escolhidos { max-width: 100%; } .campo-cnae { flex-wrap: wrap; } }

/* linha que marca até onde a página muda com os filtros */
.fim-filtro { display: flex; align-items: center; gap: .9rem; margin: 2rem 0 1.25rem; }
.fim-filtro-linha { flex: 1 1 2rem; height: 0; border-top: 2px dashed var(--borda-2); }
.fim-filtro p { margin: 0; max-width: 40rem; text-align: center; font-size: 13px; color: var(--texto-3); line-height: 1.45; }
.fim-filtro p b { color: var(--texto-2); }
@media (max-width: 767px) { .fim-filtro { gap: .5rem; } .fim-filtro-linha { flex-basis: 1rem; } }
@media print { .fim-filtro { margin: 1rem 0; } }
.fim-filtro-linha { border-top-color: var(--gold); opacity: .8; }
.fim-filtro p { max-width: 50rem; font-size: 13.5px; color: var(--texto-2); }
.fim-filtro p b { color: var(--texto); }
@media (max-width: 767px) { .fim-filtro { flex-direction: column; gap: .6rem; } .fim-filtro-linha { width: 100%; flex: none; } .fim-filtro-linha:last-child { display: none; } }
/* tracejado cinza-claro (sem dourado) */
.fim-filtro-linha { border-top-color: var(--borda-2); opacity: 1; }
/* espaço entre as duas barras de filtro: 10px, o mesmo do Dashboard entre o cabeçalho e a barra de abas */
#filtros { gap: 10px; }

/* etiquetas de atividade: nunca cortadas; com mais de 2, a 1ª + "+N" */
.cnae-escolhidos { max-width: none; overflow: visible; flex: 0 1 auto; min-width: 0; }
.chip-cnae { max-width: 13.5rem; min-width: 0; flex-shrink: 1; }
.chip-mais { flex-shrink: 0; border: 1px solid var(--borda-2); background: var(--card); color: var(--texto); border-radius: 9999px; padding: .2rem .65rem; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip-mais:hover, .chip-mais[aria-expanded="true"] { border-color: var(--gold); background: var(--gold-50); }
.lista-escolhidas { width: 24rem; }
.lista-escolhidas .esc-item { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem .55rem; border-radius: .6rem; font-size: 13.5px; }
.lista-escolhidas .esc-item:hover { background: var(--barra-fundo); }
.lista-escolhidas .esc-item small { display: block; font-size: 12px; color: var(--texto-3); }
.lista-escolhidas .esc-item button { border: 0; background: var(--barra-fundo); width: 1.5rem; height: 1.5rem; border-radius: 9999px; cursor: pointer; display: inline-grid; place-items: center; padding: 0; font-size: 15px; color: var(--texto-2); flex-shrink: 0; }
.lista-escolhidas .esc-item button:hover { background: var(--gold-100); color: var(--texto); }
.lista-escolhidas .esc-acoes { border-top: 1px solid var(--borda); margin-top: .25rem; padding: .4rem .3rem .1rem; display: flex; justify-content: flex-end; }
.lista-escolhidas .esc-acoes button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--texto-2); cursor: pointer; padding: .3rem .6rem; border-radius: 9999px; }
.lista-escolhidas .esc-acoes button:hover { background: var(--barra-fundo); }
@media (max-width: 767px) { .chip-cnae { max-width: 11rem; } .lista-escolhidas { width: min(22rem, calc(100vw - 2rem)); } }

/* ---------- comparador de cidades e bairros ---------- */
.comp-escolha { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; }
.comp-escolha .campo { border: 1px solid var(--borda); background: var(--card); min-height: 2.5rem; }
.comp-escolha .comp-bairro { flex: 1 1 16rem; max-width: 26rem; }
.comp-escolha .comp-bairro input { flex: 1; }
.comp-add { border: 0; }
.comp-add:disabled { opacity: .45; cursor: not-allowed; }
.comp-lugares { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.comp-lugares:empty { display: none; }
.comp-tabela { width: 100%; border-collapse: collapse; margin-top: .75rem; font-size: 14px; }
.comp-tabela th, .comp-tabela td { padding: .6rem .7rem; border-bottom: 1px solid var(--borda); text-align: right; vertical-align: top; }
.comp-tabela th:first-child, .comp-tabela td:first-child { text-align: left; color: var(--texto-2); font-weight: 600; min-width: 12rem; }
.comp-tabela thead th { font-size: 13px; color: var(--texto); font-weight: 700; }
.comp-tabela thead th small { display: block; font-weight: 500; color: var(--texto-3); font-size: 11.5px; }
.comp-tabela td b { font-size: 15px; font-variant-numeric: tabular-nums; }
.comp-tabela td small { display: block; color: var(--texto-3); font-size: 11.5px; margin-top: .1rem; }
.comp-tabela td.maior b { color: var(--gold-600); }
html[data-tema="escuro"] .comp-tabela td.maior b { color: var(--gold); }
.comp-tabela .comp-barra { display: block; height: 4px; border-radius: 4px; background: var(--barra-fundo); margin-top: .35rem; overflow: hidden; }
.comp-tabela .comp-barra i { display: block; height: 100%; background: #0A2540; border-radius: 4px; }
html[data-tema="escuro"] .comp-tabela .comp-barra i { background: #8AA6C6; }
.comp-vazio { margin-top: 1rem; }
@media (max-width: 767px) { .comp-escolha > * { flex: 1 1 100%; max-width: none !important; } }
@media print { .comp-escolha, .comp-lugares button { display: none !important; } }
@media (max-width: 767px) { .comp-tabela { font-size: 13px; } .comp-tabela th:first-child, .comp-tabela td:first-child { min-width: 7.5rem; position: sticky; left: 0; background: var(--card); z-index: 1; } .comp-tabela th, .comp-tabela td { padding: .5rem .45rem; } .comp-tabela td { min-width: 6.5rem; } }

/* comparador: a lista de cidades abre por cima dos cartões de baixo (o vidro de cada cartão cria uma camada própria) */
.comparador { position: relative; z-index: 6; }
/* tabela compacta: os números ficam perto dos nomes, mesmo com um lugar só */
.comp-tabela { width: auto; max-width: 100%; }
.comp-tabela th:first-child, .comp-tabela td:first-child { width: 19rem; min-width: 14rem; max-width: 21rem; }
.comp-tabela th[scope="row"] { font-weight: 700; color: var(--texto); }
.comp-tabela th[scope="row"] small { display: block; font-weight: 400; font-size: 12px; color: var(--texto-3); line-height: 1.35; margin-top: .2rem; }
.comp-tabela thead th:not(:first-child), .comp-tabela td { min-width: 9.5rem; }
@media (max-width: 767px) { .comp-tabela th:first-child, .comp-tabela td:first-child { width: 9.5rem; min-width: 9.5rem; } .comp-tabela th[scope="row"] small { font-size: 11px; } .comp-tabela thead th:not(:first-child), .comp-tabela td { min-width: 6.5rem; } }

/* ---------- ampliar o mapa ---------- */
.btn-ampliar { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.btn-ampliar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mapa-dialogo { border: 0; padding: 1.1rem 1.25rem 1.25rem; border-radius: 1.25rem; width: min(1100px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--card); color: var(--texto); box-shadow: 0 30px 80px -20px rgba(10,37,64,.5); }
.mapa-dialogo::backdrop { background: rgba(10,37,64,.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.mapa-dialogo-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .5rem; }
.mapa-grande svg { width: 100%; height: auto; max-height: calc(100vh - 9rem); display: block; }
.mapa-grande text { font-size: 115%; }
@media print { .btn-ampliar, .mapa-dialogo { display: none !important; } }

/* ---------- chamada flutuante (abrir empresa / planejamento tributário) ---------- */
.cta-flutuante { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 45; }
.cta-cartao { position: relative; width: 20.5rem; background: linear-gradient(135deg, #0A2540, #143458); color: #fff; border-radius: 1.1rem; padding: 1rem 1.1rem 1.05rem; box-shadow: 0 24px 50px -18px rgba(10,37,64,.6); border: 1px solid rgba(255,255,255,.12); animation: cta-entra .45s cubic-bezier(.16,1,.3,1) both; }
@keyframes cta-entra { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.cta-titulo { font-weight: 800; font-size: 15px; line-height: 1.3; margin: 0 1.6rem .3rem 0; }
.cta-texto { font-size: 12.5px; color: rgba(255,255,255,.78); margin: 0 0 .75rem; line-height: 1.45; }
.cta-botoes { display: flex; flex-wrap: wrap; gap: .45rem; }
.cta-botoes a { flex: 1 1 auto; justify-content: center; text-align: center; font-size: 13px; padding: .55rem .8rem; }
.btn-contorno-escuro { display: inline-flex; justify-content: center; align-items: center; border: 1px solid rgba(255,255,255,.45); color: #fff; border-radius: 9999px; font-weight: 700; text-decoration: none; }
.btn-contorno-escuro:hover { background: rgba(255,255,255,.1); }
.cta-fecha { position: absolute; top: .55rem; right: .55rem; width: 1.6rem; height: 1.6rem; border: 0; border-radius: 9999px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; font-size: 16px; line-height: 1; }
.cta-fecha:hover { background: rgba(255,255,255,.22); }
.cta-pilula { display: inline-flex; align-items: center; gap: .5rem; border: 0; cursor: pointer; background: var(--gold); color: #0A2540; font: inherit; font-weight: 800; font-size: 13.5px; padding: .7rem 1.05rem; border-radius: 9999px; box-shadow: 0 14px 30px -10px rgba(10,37,64,.55); animation: cta-entra .35s cubic-bezier(.16,1,.3,1) both; }
.cta-pilula svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cta-pilula:hover { filter: brightness(1.05); }
html[data-tema="escuro"] .cta-cartao { background: linear-gradient(135deg, #1c1c1f, #27272a); border-color: var(--borda); }
@media (max-width: 767px) {
  .cta-flutuante { left: .75rem; right: .75rem; bottom: .75rem; }
  .cta-cartao { width: auto; padding: .85rem .95rem .9rem; }
  .cta-texto { display: none; }
  .cta-pilula { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .cta-cartao, .cta-pilula { animation: none; } }
@media print { .cta-flutuante { display: none !important; } }

/* aberturas em largura cheia; porte e regime em dois cartões abaixo */
.grade-3 { grid-template-columns: minmax(0, 1fr) !important; }
.porte-regime { margin-top: 0; }
.anos [data-grafico="anos"] svg { max-height: 200px; width: 100%; }

/* aviso do campo de bairro do comparador */
.comp-aviso { margin-top: .6rem; }

/* auditoria 30A01: as colunas da página nunca ficam mais largas que a tela; tabela larga rola dentro do próprio cartão */
main.envolve, #painel, #filtros { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1023px) { .grade-2 { grid-template-columns: minmax(0, 1fr); } }
/* auditoria 30A01: entre 768 e 1023 px os campos dos filtros encolhem (texto longo vira "…") em vez de alargar a página */
@media (min-width: 768px) and (max-width: 1023px) {
  #filtros { min-width: 0; }
  .filtros-linha.refinar { max-width: 100%; }
  .refinar .campo-extra, .filtros-linha .campo-cidade { flex: 0 1 auto; min-width: 0; }
  .filtros-linha .multi-botao { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .refinar #f-porte, .refinar #f-regime, .refinar #f-ano, #f-cidade { width: auto; }
  .campo-cnae { min-width: 0; } .campo-cnae #f-cnae { min-width: 4.5rem; } .campo-bairro { min-width: 7rem; }
  .cnae-escolhidos { min-width: 0; overflow: hidden; }
  .filtros-linha .campo-cidade { max-width: 12rem; } .campo-bairro { flex: 1 1 8rem; }
  .cnae-escolhidos .chip-cnae { min-width: 5.5rem; }
}
