:root {
  --amarelo: #ffcc03;
  --tinta: #1c170e;
  --creme: #fffae6;
  --azul: #0368ff;
  --fundo: #f5f5f3;
  --borda: #e6e4dc;
  --suave: #6b665a;
  --erro: #b42318;
  --fonte: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --t: 160ms ease;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { font-family: var(--fonte); background: var(--fundo); color: var(--tinta); font-size: 14px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; border-radius: 4px; }

/* topo */
.topo { background: #fff; border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 5; }
.topo-in { max-width: 1240px; margin: 0 auto; padding: 14px 16px 6px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.titulo-bloco { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-ato { height: 28px; width: auto; display: block; flex: none; }
.logo-ato .lg { fill: #081f2d; }
.logo-ato .dt { fill: #ff6b00; }
.divisor { width: 1px; height: 24px; background: var(--borda); flex: none; }
h1 { font-size: 18px; font-weight: 600; }
.controles { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.datas { display: flex; gap: 10px; }
.campo { display: flex; flex-direction: column; gap: 2px; }
.rotulo { font-size: 11px; color: var(--suave); }
select, input[type=date] { border: 1px solid var(--borda); background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; transition: border-color var(--t), box-shadow var(--t); }
select:hover, input[type=date]:hover { border-color: var(--tinta); }
.carimbo { font-size: 12px; color: var(--suave); padding-bottom: 8px; }
.abas { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.aba { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; cursor: pointer; font-weight: 500; color: var(--suave); transition: color var(--t), border-color var(--t), background var(--t); border-radius: 6px 6px 0 0; }
.aba:hover { color: var(--tinta); background: var(--creme); }
.aba[aria-selected=true] { color: var(--tinta); border-bottom-color: var(--amarelo); font-weight: 600; }

/* avisos */
.avisos { max-width: 1240px; margin: 12px auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.aviso { background: var(--creme); border: 1px solid #f0dc8a; border-left: 4px solid var(--amarelo); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.aviso.erro { background: #fff3f1; border-color: #f4c7c1; border-left-color: var(--erro); }

.conteudo { max-width: 1240px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.bloco { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 16px; min-width: 0; }
.bloco h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.sub { color: var(--suave); font-size: 12px; margin-bottom: 12px; }
.grade { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* cards */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 14px; transition: box-shadow var(--t), transform var(--t); min-width: 0; }
.card:hover { box-shadow: 0 4px 14px rgba(28, 23, 14, .08); }
.card.destaque { background: var(--creme); border-color: #f0dc8a; }
.card .nome { font-size: 12px; color: var(--suave); font-weight: 500; }
.card .valor { font-family: Montserrat, var(--fonte); font-weight: 700; font-size: clamp(20px, 1.6vw, 26px); margin: 4px 0 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.card .valor.azul { color: var(--azul); }
.card .extra { font-size: 12px; font-weight: 600; }
.card .formula { font-size: 11px; color: var(--suave); margin-top: 6px; }

/* tabelas */
.rolagem { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 640px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--borda); white-space: nowrap; }
th:first-child, td:first-child, th.esq, td.esq { text-align: left; }
td.nome, th.nome { white-space: normal; min-width: 180px; max-width: 360px; }
th { font-size: 12px; font-weight: 600; color: var(--suave); background: #fafaf8; position: sticky; top: 0; }
th button { background: none; border: 0; cursor: pointer; font-weight: 600; font-size: 12px; color: inherit; padding: 2px 4px; border-radius: 4px; transition: background var(--t), color var(--t); white-space: nowrap; }
th button:hover { background: var(--creme); color: var(--tinta); }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: #fcfbf5; }
td.num { font-variant-numeric: tabular-nums; }
td.icp, th.icp-h { background: rgba(255, 204, 3, .12); }
tr.sem-anuncio td { color: var(--suave); font-style: italic; }
.pequeno { font-size: 11px; color: var(--suave); display: block; }
.selo { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef0f3; }
.selo.ativo { background: #e3f6e8; color: #17653a; }
.selo.pausado { background: #eef0f3; color: #4d5560; }
.selo.frio { background: #e4eeff; color: #0a4fc4; }
.selo.quente { background: #ffe7d6; color: #a14400; }
.mini { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; background: #eee; }
a.mini-link { display: inline-block; border-radius: 8px; transition: transform var(--t), box-shadow var(--t); }
a.mini-link:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.sem-mini { width: 56px; height: 56px; border-radius: 8px; background: #eee; display: grid; place-items: center; color: var(--suave); font-size: 11px; }

/* filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 6px 12px; cursor: pointer; font-size: 12px; transition: background var(--t); }
.seg button + button { border-left: 1px solid var(--borda); }
.seg button:hover { background: var(--creme); }
.seg button[aria-pressed=true] { background: var(--amarelo); font-weight: 600; }
.link { background: none; border: 0; color: var(--azul); cursor: pointer; padding: 6px 2px; font-size: 13px; text-decoration: underline; transition: opacity var(--t); }
.link:hover { opacity: .7; }

/* funil */
.funil-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.funil { flex: 1 1 520px; display: flex; align-items: stretch; gap: 0; min-width: 0; }
.etapa { flex: 1; min-width: 0; background: #f3f7ff; border: 1px solid #cfe0ff; border-radius: 10px; padding: 12px; }
.etapa:last-child { background: var(--creme); border-color: #f0dc8a; }
.etapa .nome { font-size: 12px; color: var(--suave); }
.etapa .valor { font-family: Montserrat, var(--fonte); font-weight: 700; font-size: 22px; overflow-wrap: anywhere; }
.seta { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--suave); text-align: center; }
.seta b { font-size: 13px; color: var(--tinta); }
.seta::after { content: '→'; font-size: 16px; }
.laterais { flex: 0 1 200px; display: flex; flex-direction: column; gap: 8px; }
.lateral { border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; }
.lateral .nome { font-size: 12px; color: var(--suave); }
.lateral .valor { font-family: Montserrat, var(--fonte); font-weight: 700; font-size: 18px; }

/* barras de distribuição */
.dist { display: flex; flex-direction: column; gap: 10px; }
.dist-linha .topo-l { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.dist-linha .topo-l span:first-child { overflow-wrap: anywhere; }
.dist-linha .topo-l span:last-child { color: var(--suave); white-space: nowrap; font-variant-numeric: tabular-nums; }
.barra { height: 8px; background: #eef0f3; border-radius: 4px; margin-top: 3px; overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 4px; transition: width 300ms ease; }
.barra.total i { background: var(--azul); }
.barra.icp i { background: var(--amarelo); }
.legenda { display: flex; gap: 14px; font-size: 12px; color: var(--suave); margin-bottom: 10px; }
.legenda span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legenda .l-total::before { background: var(--azul); }
.legenda .l-icp::before { background: var(--amarelo); }

.grafico { position: relative; height: 280px; }
.vazio { text-align: center; padding: 28px 12px; color: var(--suave); }
.vazio b { display: block; color: var(--tinta); margin-bottom: 4px; }

/* esqueleto */
.esq { background: linear-gradient(90deg, #ececE8 25%, #f6f6f3 50%, #ececE8 75%); background-size: 200% 100%; animation: brilho 1.2s infinite linear; border-radius: 10px; }
@keyframes brilho { to { background-position: -200% 0; } }
.esq.card-e { height: 104px; }
.esq.bloco-e { height: 260px; }

@media (max-width: 600px) {
  h1 { font-size: 16px; }
  .logo-ato { height: 22px; }
  .conteudo { padding: 12px; }
  .grade { grid-template-columns: 1fr; }
  .funil { flex-direction: column; }
  .seta { width: auto; flex-direction: row; gap: 6px; padding: 6px 0; }
  .seta::after { content: '↓'; }
  .laterais { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .lateral { flex: 1 1 100px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
