/* Notas fiscais — cores e tipografia */
:root {
  --papel: #F2F5F4;
  --superficie: #FFFFFF;
  --tinta: #14211F;
  --suave: #566763;
  --linha: #D3DCD9;
  --acao: #0B5D52;
  --acao-texto: #FFFFFF;
  --aprovado: #0E7C6B;
  --revisar: #C28516;
  --semcpf: #A8324A;
  --erro-fundo: #F9E4E8;
  --ok-fundo: #DDF1EC;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0F1816;
    --superficie: #17221F;
    --tinta: #E5EDEA;
    --suave: #9BAFAA;
    --linha: #2B3B37;
    --acao: #3CC4AE;
    --acao-texto: #06201C;
    --aprovado: #3CC4AE;
    --revisar: #E3AE4A;
    --semcpf: #E57690;
    --erro-fundo: #3A1A22;
    --ok-fundo: #123029;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font: 400 1rem/1.5 "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--acao); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--acao); outline-offset: 2px; border-radius: 4px; }
code { font-size: 0.92em; background: var(--superficie); border: 1px solid var(--linha); border-radius: 4px; padding: 0.05em 0.35em; }

.barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 2rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--superficie); border-bottom: 1px solid var(--linha);
}
.marca { font-weight: 700; font-size: 1.05rem; color: var(--tinta); text-decoration: none; letter-spacing: -0.01em; }
.barra nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; flex: 1; }
.barra nav a { color: var(--suave); text-decoration: none; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.barra nav a[aria-current="page"] { color: var(--tinta); border-bottom-color: var(--aprovado); font-weight: 600; }
.barra nav a:last-child { margin-left: auto; }

main { max-width: 72rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.15rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1.2rem; margin: 2.5rem 0 0.75rem; letter-spacing: -0.01em; }
.lede { max-width: 62ch; color: var(--suave); margin: 0 0 1.5rem; }
.nota { color: var(--suave); font-size: 0.9rem; }
.trilha { margin: 0 0 0.5rem; font-size: 0.9rem; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Avisos */
.aviso { padding: 0.75rem 1rem; border-radius: 8px; margin: 0 0 1.5rem; border-left: 4px solid; }
.aviso-ok { background: var(--ok-fundo); border-color: var(--aprovado); }
.aviso-erro { background: var(--erro-fundo); border-color: var(--semcpf); }

/* Botões e campos */
button, .botao {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
  border-radius: 8px; padding: 0.55rem 1rem; border: 1px solid transparent;
}
.primario { background: var(--acao); color: var(--acao-texto); }
.primario:hover { filter: brightness(1.08); }
.discreto { background: transparent; color: var(--tinta); border-color: var(--linha); padding: 0.4rem 0.75rem; font-weight: 500; }
.discreto:hover { border-color: var(--suave); }
input[type="password"], input[type="search"], input[type="file"], input[name="doc"] {
  font: inherit; color: var(--tinta); background: var(--superficie);
  border: 1px solid var(--linha); border-radius: 8px; padding: 0.5rem 0.7rem; max-width: 100%;
}
label { display: grid; gap: 0.3rem; font-weight: 500; }

/* Entrada */
.porta { max-width: 26rem; margin: 12vh auto 0; background: var(--superficie); border: 1px solid var(--linha); border-radius: 14px; padding: 2rem; }
.porta h1 { font-size: 1.5rem; }
.porta p { color: var(--suave); margin-top: 0; }
.porta form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.porta input { width: 100%; }

.envio { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; background: var(--superficie); border: 1px solid var(--linha); border-radius: 12px; padding: 1.25rem; }

/* Placar e régua */
.placar { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem 2.5rem; margin: 1.5rem 0 1.25rem; }
.placar p { margin: 0; color: var(--suave); }
.placar .grande-num { font-size: clamp(2rem, 4.5vw, 2.9rem); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; color: var(--aprovado); margin-bottom: 0.3rem; }
.placar .de-fora .grande-num { color: var(--semcpf); }
.regua { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--linha); margin-top: 0.4rem; }
.regua.grande { height: 18px; border-radius: 6px; margin: 0.5rem 0; }
.r-ap { fill: var(--aprovado); } .r-rev { fill: var(--revisar); } .r-sem { fill: var(--semcpf); }
.legenda { color: var(--suave); font-size: 0.9rem; margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; gap: 0.2rem 0.5rem; align-items: center; }
.ponto { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin: 0 0.35em 0 0.6em; vertical-align: baseline; }
.legenda .ponto:first-child, th .ponto { margin-left: 0; }
.p-ap { background: var(--aprovado); } .p-rev { background: var(--revisar); } .p-sem { background: var(--semcpf); }

/* Tabelas */
.rolagem { overflow-x: auto; background: var(--superficie); border: 1px solid var(--linha); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid var(--linha); vertical-align: top; }
thead th { font-weight: 600; color: var(--suave); font-size: 0.85rem; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
.n { text-align: right; white-space: nowrap; }
tbody th { font-weight: 500; }
td small { display: block; color: var(--suave); font-size: 0.82rem; margin-top: 0.15rem; }
.doc { white-space: nowrap; }
.meses tbody th { min-width: 10.5rem; }
.meses thead th { white-space: normal; vertical-align: bottom; }
.meses th, .meses td { padding-left: 0.7rem; padding-right: 0.7rem; }
.resumo .sub th, .resumo .sub td { color: var(--suave); padding-top: 0.4rem; padding-bottom: 0.4rem; border-bottom-style: dashed; }
.resumo .sub th { padding-left: 2rem; }
.resumo .forte > *, .resumo .total > * { font-weight: 700; }
.resumo .total > * { border-top: 2px solid var(--tinta); }

/* Mês */
.cabeca { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }
.cabeca h1 { margin-bottom: 0.25rem; }
.estado { display: inline-block; margin: 0; font-size: 0.85rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid var(--linha); color: var(--suave); }
.estado.fechado { border-color: var(--aprovado); color: var(--aprovado); }
.regua.grande + .rolagem { margin-top: 1.25rem; }
.fechamento { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; margin: 1.25rem 0 2.5rem; padding: 1rem 1.25rem; border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie); }
.fechamento p { margin: 0; max-width: 60ch; }
.abas { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; border-bottom: 1px solid var(--linha); margin-bottom: 1rem; }
.abas a { padding: 0.5rem 0; color: var(--suave); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.abas a[aria-current="page"] { color: var(--tinta); border-bottom-color: var(--tinta); font-weight: 700; }
.abas span { font-weight: 400; color: var(--suave); }
.ferramentas { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; margin-bottom: 1rem; }
.busca { display: flex; gap: 0.5rem; flex: 1 1 18rem; max-width: 30rem; }
.busca input { flex: 1; min-width: 0; }
.preencher { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.preencher input[name="doc"] { width: 11rem; padding: 0.35rem 0.6rem; }
.candidatos { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.candidato { font-weight: 500; font-size: 0.85rem; padding: 0.25rem 0.6rem; background: var(--papel); color: var(--tinta); border-color: var(--linha); }
.candidato span { color: var(--suave); }
.vazio { padding: 2rem; text-align: center; color: var(--suave); background: var(--superficie); border: 1px dashed var(--linha); border-radius: 12px; }
.paginas { display: flex; gap: 1.25rem; justify-content: center; align-items: center; margin-top: 1.25rem; color: var(--suave); }

@media (max-width: 40rem) {
  th, td { padding: 0.55rem 0.6rem; }
  .barra nav a:last-child { margin-left: 0; }
}

/* Cruzamento */
.cruzando { background: var(--superficie); border: 1px solid var(--linha); border-radius: 12px; padding: 1.5rem; display: grid; gap: 1rem; justify-items: start; max-width: 40rem; }
.cruzando progress { width: 100%; height: 18px; accent-color: var(--aprovado); }
.cruzando .andamento { margin: 0; color: var(--suave); }
button:disabled { opacity: 0.6; cursor: default; }
td.n small { text-align: right; }

/* Perfil dos clientes */
.perfil { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.25rem; align-items: start; }
.barrinha { display: block; width: 100%; height: 5px; border-radius: 3px; background: var(--linha); margin-top: 0.35rem; }
.barrinha rect { fill: var(--aprovado); }
.perfil tbody th { min-width: 8rem; white-space: nowrap; }
.candidato strong { font-weight: 700; }
