/* Painel do contador. Tokens em :root; componentes só consomem var(--…). */
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fontes/lexend-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/fontes/source-sans-3-latin-wght-normal.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --texto: #0f1f19;
  --muted: #4a5a53;
  --borda: #e1e8e4;
  --borda-campo: #78877f;
  --primario: #065f46;
  --on-primario: #ffffff;
  --link: #065f46;
  --ring: #1d4ed8;
  --ok-fg: #065f46;
  --ok-bg: #ecfdf5;
  --pend-fg: #92400e;
  --pend-bg: #fffbeb;
  --erro-fg: #b91c1c;
  --erro-bg: #fef2f2;
  --off-fg: #475569;
  --off-bg: #eaf0ed;
  /* QR nunca segue o tema: a câmera só lê escuro sobre claro */
  --qr-fundo: #ffffff;
  --qr-tinta: #000000;
  /* menu lateral: o azul-marinho da landing, o mesmo em claro e escuro */
  --nav-bg: #064e3b;
  --nav-texto: #c3d1e3;
  --nav-ativo: #ffffff;
  --nav-realce: rgba(255, 255, 255, 0.09);
  --selo: #a7f3d0;
  --nav-marca: #a7f3d0;
  --sombra: 0 1px 2px rgba(6, 40, 30, 0.06), 0 0 0 1px rgba(6, 40, 30, 0.02);

  --fonte-titulo: "Lexend", system-ui, "Segoe UI", sans-serif;
  --fonte-texto: "Source Sans 3", system-ui, "Segoe UI", sans-serif;
  /* público mais velho: texto-base 18px e nada abaixo de 16px (só o chip, que leva forma e texto, desce a 14px) */
  --fs-sm: 1rem;
  --fs-md: 1rem;
  --fs-base: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --raio: 12px;
  --raio-campo: 10px;
  --alvo: 48px;
  --menu-lateral: 264px;
  --dur: 150ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1512;
    --surface: #101f1a;
    --texto: #e8f1ed;
    --muted: #a3b8ad;
    --borda: #1c3028;
    --borda-campo: #5f7a6d;
    --primario: #065f46;
    --link: #7fe0b5;
    --ring: #7fe0b5;
    --ok-fg: #6ee7b7;
    --ok-bg: #052e22;
    --pend-fg: #fcd34d;
    --pend-bg: #2a1d05;
    --erro-fg: #fca5a5;
    --erro-bg: #3a1010;
    --off-fg: #a3b8ad;
    --off-bg: #15271f;
    --nav-bg: #032e22;
    --sombra: 0 0 0 1px rgba(255, 255, 255, 0.03);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: var(--fs-base) / 1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
h1, h2 { margin: 0; line-height: 1.25; font-weight: 650; }
h1 { font-size: var(--fs-xl); overflow-wrap: anywhere; }
h2 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.sm { font-size: var(--fs-md); }
.num { font-variant-numeric: tabular-nums; }
.pular { position: absolute; left: var(--sp-2); top: -64px; z-index: 10; padding: var(--sp-2) var(--sp-3); border-radius: var(--raio); background: var(--surface); color: var(--texto); border: 1px solid var(--borda-campo); }
.pular:focus-visible { top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 var(--sp-4); }
.topo { background: var(--surface); border-bottom: 1px solid var(--borda); }
.topo .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.marca { white-space: nowrap; font-weight: 700; letter-spacing: 0.01em; color: var(--texto); text-decoration: none; }
main.wrap { padding-block: var(--sp-5) var(--sp-6); display: grid; gap: var(--sp-4); }
.cabeca { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.cabeca > div { min-width: 0; }
.voltar { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--alvo); text-decoration: none; font-size: var(--fs-md); }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--alvo); padding: 0 var(--sp-4);
  border: 1px solid var(--borda-campo); border-radius: var(--raio);
  background: var(--surface); color: var(--texto);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur), border-color var(--dur), opacity var(--dur);
}
.btn:hover { background: var(--off-bg); }
.btn.primario { background: var(--primario); border-color: var(--primario); color: var(--on-primario); }
.btn.primario:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
/* desabilitado sem opacidade: o texto continua legível (contraste do muted sobre o fundo neutro) */
.btn[disabled], .btn[aria-disabled="true"] { background: var(--off-bg); border-color: var(--borda); color: var(--muted); cursor: not-allowed; }
.btn.texto { border-color: transparent; background: transparent; color: var(--link); padding-inline: var(--sp-2); }
.btn.perigo { color: var(--erro-fg); }
.btn svg, .voltar svg { width: 18px; height: 18px; flex: none; }

/* cartões */
.card { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--borda); min-height: 56px; }
.card > .corpo { padding: var(--sp-4); display: grid; gap: var(--sp-4); }
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--borda); min-height: 56px; }
.lista > li:first-child { border-top: 0; }
.txt { min-width: 0; display: grid; }
.txt > * { overflow-wrap: anywhere; }

/* formulários */
form { margin: 0; }
.campos { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.campos > .cheia { grid-column: 1 / -1; }
.campo { display: grid; gap: var(--sp-1); min-width: 0; }
.campo > label { font-size: var(--fs-md); font-weight: 600; }
.campo .dica { font-size: var(--fs-sm); color: var(--muted); }
input[type="text"], input[type="search"], input[type="password"], input[type="tel"], input[type="email"], input[type="number"], input[type="file"], select {
  width: 100%; min-height: var(--alvo); padding: 0 var(--sp-3);
  border: 1px solid var(--borda-campo); border-radius: var(--raio);
  background: var(--surface); color: var(--texto); font: inherit;
}
textarea { width: 100%; min-height: calc(var(--alvo) * 3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--borda-campo); border-radius: var(--raio); background: var(--surface); color: var(--texto); font: inherit; resize: vertical; }
input[type="file"] { padding: 5px var(--sp-2); color: var(--muted); }
input[type="file"]::file-selector-button {
  margin-right: var(--sp-3); min-height: 32px; padding: 0 var(--sp-3);
  border: 1px solid var(--borda-campo); border-radius: 6px;
  background: var(--off-bg); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer;
}
.campos.cert { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }
.campos.linha { grid-template-columns: minmax(0, 1fr) auto; }
/* lista dentro de um .corpo: o recuo do .corpo já alinha, sem o recuo da linha */
.lista.rente > li { padding-inline: 0; }
input:disabled { background: var(--off-bg); }
::placeholder { color: var(--muted); opacity: 1; }
input[aria-invalid="true"] { border-color: var(--erro-fg); border-width: 2px; }
.acoes { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.pilha { display: grid; gap: var(--sp-4); }
/* lista com um controle por linha (select + botão): quebra no celular em vez de espremer */
.lista.fontes > li { flex-wrap: wrap; row-gap: var(--sp-2); }
.lista.fontes select { width: auto; min-width: 9rem; }
/* gasto do mês: três números lado a lado (duas colunas no celular, o valor ocupa a linha de baixo) */
.gasto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: 0; }
.gasto > div { display: grid; gap: 2px; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--borda); border-radius: var(--raio); min-width: 0; }
.gasto dt { font-size: var(--fs-sm); color: var(--muted); }
.gasto dd { margin: 0; font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.alerta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--raio); border: 1px solid currentColor; font-size: var(--fs-md); font-weight: 500; }
.alerta svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alerta.erro { background: var(--erro-bg); color: var(--erro-fg); }
.alerta.ok { background: var(--ok-bg); color: var(--ok-fg); }
.alerta.pend { background: var(--pend-bg); color: var(--pend-fg); }

/* chips: cor + forma + texto (nunca só cor) */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok-fg); } .chip.ok::before { border-radius: 50%; }
.chip.pend { background: var(--pend-bg); color: var(--pend-fg); } .chip.pend::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.chip.off { background: var(--off-bg); color: var(--off-fg); }
.chip.erro { background: var(--erro-bg); color: var(--erro-fg); } .chip.erro::before { transform: rotate(45deg); }

/* QR de pareamento */
.qrbox { justify-items: center; }
.qr { width: min(100%, 320px); height: auto; display: block; border-radius: var(--raio); }
.qr rect { fill: var(--qr-fundo); }
.qr path { fill: var(--qr-tinta); }
.codigo { font-size: var(--fs-xl); font-weight: 700; letter-spacing: 0.12em; }
.topo .menu { display: flex; align-items: center; gap: var(--sp-1); }
.contador { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; background: var(--pend-bg); color: var(--pend-fg); font-size: var(--fs-sm); font-weight: 700; line-height: 18px; text-align: center; }

/* fila de pedidos de acesso */
.pedido > header { align-items: flex-start; }
.pedido .lista > li { flex-wrap: wrap; row-gap: var(--sp-2); }
.pedido .lista > li > .txt { flex: 1 1 200px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }

/* faixa do operador dentro de um escritório: o mesmo par âmbar do alerta pendente */
.faixa-op { background: var(--pend-bg); color: var(--pend-fg); border-bottom: 1px solid currentColor; font-size: var(--fs-md); }
.faixa-op .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--alvo); }
.faixa-op .nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faixa-op .btn.texto { color: inherit; text-decoration: underline; }

/* checklist */
.passos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.passos li { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-md); font-weight: 500; }
.passos svg { width: 18px; height: 18px; }
.passos .feito { color: var(--ok-fg); }
.passos .falta { color: var(--pend-fg); }

/* barra de filtros */
.barra { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.barra .busca { flex: 1 1 220px; }
.barra select { width: auto; flex: 0 1 160px; }
.paginas { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); }

/* tabela -> cartões no celular */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--borda); }
td { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--borda); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
td.dir, th.dir { text-align: right; white-space: nowrap; }
.rot { display: none; color: var(--muted); }
tr.linha { position: relative; transition: background-color var(--dur); }
tr.linha:hover { background: var(--off-bg); }
tr.linha a.abrir { color: var(--texto); font-weight: 600; text-decoration: none; }
tr.linha a.abrir::after { content: ""; position: absolute; inset: 0; }
tr.linha:focus-within { outline: 2px solid var(--ring); outline-offset: -2px; }
tr.linha a.abrir:focus-visible { outline: none; }

.vazio { padding: var(--sp-6) var(--sp-4); display: grid; justify-items: center; gap: var(--sp-3); text-align: center; }

.opcoes { display: grid; gap: var(--sp-2); }
fieldset.opcoes { border: 0; padding: 0; margin: 0; min-width: 0; }
.opcao { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--borda); border-radius: var(--raio); cursor: pointer; min-height: var(--alvo); transition: border-color var(--dur), background-color var(--dur); }
.opcao:hover { background: var(--off-bg); }
.opcao:has(input:checked) { border-color: var(--primario); border-width: 2px; padding: calc(var(--sp-3) - 1px) calc(var(--sp-4) - 1px); }
.opcao .txt .desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.opcao input { margin-top: 5px; width: 18px; height: 18px; flex: none; accent-color: var(--primario); }

.login { width: 100%; max-width: 380px; margin: 10vh auto 0; }
.login .card > .corpo { gap: var(--sp-4); }

@media (max-width: 719px) {
  main.wrap { padding-block: var(--sp-4) var(--sp-5); }
  h1 { font-size: 1.25rem; }
  td .rot { display: inline; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody tr { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--borda); }
  tbody tr:first-child { border-top: 0; }
  td { border: 0; padding: 2px 0; }
  td.dir { text-align: left; }
  .card > header { flex-wrap: wrap; }
  .campos.cert, .campos.linha { grid-template-columns: 1fr; }
  .gasto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gasto > div:last-child { grid-column: 1 / -1; }
  .acoes .btn.bloco, .acoes form { flex: 1 1 100%; }
  .acoes .btn.bloco { width: 100%; }
  .pedido .lista > li > .acoes { flex: 1 1 100%; flex-wrap: nowrap; }
  .pedido .lista > li > .acoes form { flex: 1 1 0; }
  .pedido .lista > li > .acoes .btn { width: 100%; }
  /* o menu vira barra inferior (seção "casca" no fim do arquivo) */
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* tela do cliente: blocos recolhidos e leitura de uma linha */
h3 { margin: 0; font-size: var(--fs-md); font-weight: 650; color: var(--muted); }
details.recolhe > summary, details.sub > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--alvo); cursor: pointer; list-style: none; }
details.recolhe > summary { padding: var(--sp-3) var(--sp-4); min-height: 56px; }
details.recolhe > summary::-webkit-details-marker, details.sub > summary::-webkit-details-marker { display: none; }
details.recolhe > summary::after, details.sub > summary::after { content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform var(--dur); }
details[open] > summary::after { transform: rotate(-135deg); }
details.recolhe > summary > h2 { margin-right: auto; }
details.recolhe[open] > summary { border-bottom: 1px solid var(--borda); }
details.sub { border-top: 1px solid var(--borda); padding-top: var(--sp-1); }
details.sub > summary { font-size: var(--fs-md); font-weight: 600; color: var(--link); }
details.sub > :not(summary) { margin-top: var(--sp-3); }
.leitura { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); }

/* menu: página aberta e filtros de notas */
.topo .menu .btn.texto[aria-current="page"] { color: var(--texto); box-shadow: inset 0 -2px 0 var(--primario); border-radius: 0; }
.filtros { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.filtro { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--alvo); padding: 0 var(--sp-3); border: 1px solid var(--borda); border-radius: 999px; background: var(--surface); color: var(--texto); font-size: var(--fs-md); font-weight: 600; text-decoration: none; }
.filtro:hover { background: var(--off-bg); }
.filtro[aria-current="true"] { background: var(--primario); border-color: var(--primario); color: var(--on-primario); }
.filtro .num { font-weight: 500; opacity: 0.85; }

/* grupos da Config */
h2.grupo { margin-top: var(--sp-3); font-size: var(--fs-md); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* marca e rótulo de leitura */
.marca { display: inline-flex; align-items: center; gap: var(--sp-2); }
.marca svg { width: 22px; height: 22px; flex: none; color: var(--link); }
.campo > .rotulo { font-size: var(--fs-md); font-weight: 600; }

/* rodapé: ajuda, privacidade e suporte em toda página */
.rodape { border-top: 1px solid var(--borda); margin-top: var(--sp-5); }
.rodape .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); padding-block: var(--sp-3); }
.rodape nav { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }
.rodape a { display: inline-flex; align-items: center; min-height: var(--alvo); }

/* ajuda */
details.faq { background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); }
details.faq > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; font-weight: 600; }
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::after { content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform var(--dur); }
details.faq[open] > summary::after { transform: rotate(-135deg); }
details.faq > ol, details.faq > p { margin: 0; padding: 0 var(--sp-4) var(--sp-4) calc(var(--sp-4) + 1.25rem); }
details.faq > p { padding-left: var(--sp-4); }
details.faq > ol li + li { margin-top: var(--sp-2); }

/* onboarding: Pronto para emitir */
.passos-grandes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); counter-reset: passo; }
.passo { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); min-height: 64px; counter-increment: passo; }
.passo::before { content: counter(passo); display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: 50%; border: 2px solid var(--borda-campo); font-weight: 700; }
.passo.feito::before { content: "✓"; background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-fg); }
.passo.agora { border-color: var(--primario); border-width: 2px; }
.passo .txt { flex: 1 1 auto; }
.progresso { height: 8px; border-radius: 999px; background: var(--off-bg); overflow: hidden; }
.progresso > span { display: block; height: 100%; background: var(--primario); }

/* ===================================================================================================================
   Casca do app e acabamento. Menu lateral azul-marinho no computador, barra inferior no celular; Lexend nos títulos e
   Source Sans 3 no texto (as mesmas fontes e a mesma paleta da landing); cartões com borda fina em vez de sombra pesada.
   Referências: Linear (hierarquia por tom, menu que recua), Stripe (filtros e estados vazios), Polaris (uma ação primária).
   =================================================================================================================== */
body { font-family: var(--fonte-texto); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .btn, .marca, .chip, .contador, .codigo, details.faq > summary, .passo .txt strong { font-family: var(--fonte-titulo); }
h1 { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
h2 { font-weight: 600; letter-spacing: -0.01em; }
main.wrap { max-width: 1120px; }
.cabeca { margin-bottom: var(--sp-1); }

/* ícones do menu e do estado vazio: máscara de SVG, herdam a cor do texto (img-src permite data:) */
.topo .menu {
  --ic-clientes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  --ic-notas: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/%3E%3C/svg%3E");
  --ic-pedidos: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
  --ic-config: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E");
  --ic-sair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}
.topo .menu a::before, .topo .menu form button::before { content: ""; width: 22px; height: 22px; flex: none; background-color: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.topo .menu a[href="/clientes"] { --ic: var(--ic-clientes); }
.topo .menu a[href="/notas"] { --ic: var(--ic-notas); }
.topo .menu a[href="/pedidos"] { --ic: var(--ic-pedidos); }
.topo .menu a[href="/config"] { --ic: var(--ic-config); }
.topo .menu form button { --ic: var(--ic-sair); }
:root { --ic-vazio: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E"); }
.vazio::before { content: ""; width: 56px; height: 56px; background-color: var(--borda-campo); -webkit-mask: var(--ic-vazio) center / 40px no-repeat; mask: var(--ic-vazio) center / 40px no-repeat; opacity: 0.7; }

/* topo e menu */
.topo { background: var(--nav-bg); color: var(--nav-texto); border-bottom: 0; position: sticky; top: 0; z-index: 20; }
.topo .wrap { min-height: 60px; }
.topo .marca { color: #ffffff; font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }
.topo .marca svg { color: var(--nav-marca); width: 24px; height: 24px; }
.topo .menu .btn.texto { color: var(--nav-texto); font-family: var(--fonte-texto); font-size: 1rem; font-weight: 600; gap: var(--sp-3); justify-content: flex-start; padding-inline: var(--sp-3); border-radius: var(--raio-campo); box-shadow: none; }
.topo .menu .btn.texto:hover { background: var(--nav-realce); color: #ffffff; }
.topo .menu .btn.texto[aria-current="page"] { background: var(--nav-realce); color: var(--nav-ativo); box-shadow: inset 3px 0 0 var(--nav-marca); border-radius: var(--raio-campo); }
.topo .menu .btn.texto:focus-visible { outline-color: #ffffff; }
.topo .contador { margin-left: auto; background: var(--pend-bg); color: var(--pend-fg); border-color: var(--pend-fg); }

/* cartões, tabelas, botões e campos */
.card { border-radius: var(--raio); box-shadow: var(--sombra); }
.card > .corpo { padding: var(--sp-5); }
.card > header { padding: var(--sp-4) var(--sp-5); }
th { background: var(--off-bg); color: var(--muted); font-weight: 600; padding: var(--sp-3) var(--sp-5); }
td { padding: var(--sp-4) var(--sp-5); }
.card > table { border-collapse: separate; border-spacing: 0; }
.card > table th:first-child { border-top-left-radius: calc(var(--raio) - 1px); }
.card > table th:last-child { border-top-right-radius: calc(var(--raio) - 1px); }
tr.linha:hover { background: var(--off-bg); }
.btn { border-radius: var(--raio-campo); font-size: 1rem; font-weight: 600; box-shadow: var(--sombra); }
.btn.texto { box-shadow: none; }
.btn.primario { background: var(--primario); border-color: var(--primario); box-shadow: 0 1px 2px rgba(6, 95, 70, 0.35); }
.btn.primario:hover { background: #064e3b; border-color: #064e3b; filter: none; }
input[type="text"], input[type="search"], input[type="password"], input[type="tel"], input[type="email"], input[type="number"], input[type="file"], select { border-radius: var(--raio-campo); }
input:focus-visible, select:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
.opcao { border-radius: var(--raio); }
.alerta { border-radius: var(--raio-campo); }
body > .alerta { margin: var(--sp-4) auto 0; width: calc(100% - 2 * var(--sp-4)); max-width: 1088px; }
.rodape { margin-top: var(--sp-6); }

/* entrada e telas públicas */
.login { margin-top: 8vh; }
.login .card { box-shadow: 0 12px 32px rgba(6, 40, 30, 0.10), var(--sombra); }
.login .card > .corpo { padding: var(--sp-6) var(--sp-5); }
.login h1 { font-size: 1.5rem; }

/* computador: menu lateral fixo (só com menu de navegação; /admin e telas públicas mantêm a barra do topo) */
@media (min-width: 1024px) {
  body:has(.topo .menu a) { padding-left: var(--menu-lateral); }
  .topo:has(.menu a) { position: fixed; inset: 0 auto 0 0; width: var(--menu-lateral); overflow-y: auto; }
  .topo:has(.menu a) .wrap { max-width: none; min-height: 100%; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--sp-5); padding: var(--sp-5) var(--sp-3); }
  .topo:has(.menu a) .marca { margin: 0; padding: 0 var(--sp-3); }
  .topo .menu:has(a) { flex: 1; flex-direction: column; align-items: stretch; gap: 2px; }
  .topo .menu:has(a) form { margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid rgba(255, 255, 255, 0.10); }
  .topo .menu:has(a) form .btn { width: 100%; }
  main.wrap { padding: var(--sp-6); }
}

/* celular e tablet: barra de navegação fixa embaixo, ao alcance do polegar */
@media (max-width: 1023px) {
  body:has(.topo .menu a) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .topo .menu:has(a) { position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--nav-bg); border-top: 1px solid rgba(255, 255, 255, 0.10); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .topo .menu:has(a) .btn.texto { flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: 4px 2px; font-size: 0.9375rem; font-weight: 600; border-radius: 12px; position: relative; text-align: center; }
  .topo .menu:has(a) .btn.texto[aria-current="page"] { box-shadow: none; }
  .topo .menu:has(a) .btn.texto[aria-current="page"]::before { color: var(--nav-marca); }
  .topo .menu form { display: contents; }
  .topo .menu .contador { position: absolute; top: 2px; left: calc(50% + 8px); margin: 0; min-width: 20px; padding: 0 5px; font-size: 0.75rem; line-height: 18px; }
}

/* escritório no rodapé do menu: o contador sabe em qual conta está */
.conta { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); min-width: 0; color: var(--nav-texto); }
.conta .avatar { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--nav-realce); color: #ffffff; font: 700 1rem/1 var(--fonte-titulo); }
.conta .nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* resumo por status: o número que o contador procura primeiro; cada um filtra a lista (padrão de abas de status do Stripe) */
.resumo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.resumo a { display: grid; gap: 2px; min-height: var(--alvo); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); color: var(--muted); font-weight: 600; text-decoration: none; transition: border-color var(--dur); }
.resumo a:hover { border-color: var(--borda-campo); }
.resumo .num { color: var(--texto); font: 650 1.75rem/1.1 var(--fonte-titulo); letter-spacing: -0.02em; }
.resumo a[aria-current="true"] { border-color: var(--primario); box-shadow: inset 0 0 0 1px var(--primario); }

/* tela de entrada e telas públicas em duas colunas no computador: painel azul-marinho com o nome e a frase, formulário ao lado */
.topo .lema { display: none; }
@media (min-width: 1024px) {
  body:has(.login) { display: grid; grid-template-columns: minmax(400px, 5fr) 7fr; grid-template-rows: 1fr auto; min-height: 100vh; }
  body:has(.login) .topo { grid-row: 1 / 3; position: static; }
  body:has(.login) .topo .wrap { max-width: none; min-height: 100%; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 48px; }
  body:has(.login) .topo .marca { font-size: 1.375rem; }
  body:has(.login) .topo .lema { display: block; max-width: 11ch; color: #ffffff; font: 650 clamp(2rem, 3.2vw, 3rem) / 1.08 var(--fonte-titulo); letter-spacing: -0.03em; }
  body:has(.login) main { grid-column: 2; align-self: center; }
  body:has(.login) .login { margin-top: 0; }
  body:has(.login) .rodape { grid-column: 2; margin-top: 0; }
  .topo .menu:has(a) .conta { margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid rgba(255, 255, 255, 0.10); }
  .topo .menu:has(a) .conta + form { margin-top: 0; border-top: 0; padding-top: 0; }
}
@media (max-width: 1023px) {
  .conta { display: none; }
}
@media (max-width: 719px) {
  .resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* campos lado a lado alinham pelo topo: a dica de um não empurra o campo do vizinho */
.campos { align-items: start; }
.campos .btn { align-self: end; }

/* celular: a tabela vira cartões; o respiro vem do cartão, não da célula */
@media (max-width: 719px) {
  td { padding: 2px 0; }
  tbody tr { padding: var(--sp-4); }
  .resumo a { padding: var(--sp-2) var(--sp-3); }
  .resumo .num { font-size: 1.5rem; }
}

/* botão solto numa página em grade não estica até a borda */
main.wrap > .btn, main.wrap > a.btn { justify-self: start; }

/* alinhamento: topo, conteúdo e rodapé usam a mesma largura e o mesmo respiro lateral */
.wrap { max-width: 1120px; }
@media (min-width: 1024px) {
  body:not(:has(.login)) .topo:not(:has(.menu a)) .wrap, .rodape .wrap, .faixa-op .wrap { padding-inline: var(--sp-6); }
  .login { max-width: 440px; }
  body:has(.login) .topo .marca { font-size: 1.5rem; }
}

/* identidade: símbolo da marca (balão de conversa com a ponta dobrada de uma nota), papel e selo */
.topo .marca .simbolo { width: 34px; height: 34px; flex: none; border-radius: 10px; }
.topo .marca { gap: var(--sp-3); }
.topo .cena { display: none; }
.cena text { font-family: var(--fonte-texto); }
@media (min-width: 1024px) {
  body:has(.login) .topo .wrap { justify-content: flex-start; gap: 0; }
  body:has(.login) .topo .marca .simbolo { width: 44px; height: 44px; border-radius: 12px; }
  body:has(.login) .topo .lema { margin-top: 14vh; }
  body:has(.login) .topo .cena { display: block; margin-top: auto; width: min(100%, 440px); height: auto; }
  body:has(.login) .topo { background: radial-gradient(120% 70% at 100% 100%, rgba(167, 243, 208, 0.10), transparent 60%), var(--nav-bg); }
}

/* ===================================================================================================================
   Forma da marca: o BALÃO. Todo controle e todo selo usa o contorno do balão de conversa do símbolo (cantos redondos e uma
   ponta quadrada embaixo à esquerda). É isso que separa este painel dos que usam canto arredondado igual em tudo.
   Referências: Nubank (formas próprias, botão com personalidade), Linear (estrutura calma), Stripe (abas de status).
   =================================================================================================================== */
:root { --balao: 16px 16px 16px 4px; --balao-pequeno: 12px 12px 12px 3px; --balao-grande: 22px 22px 22px 6px; }

.btn { border-radius: var(--balao); font-family: var(--fonte-titulo); letter-spacing: -0.005em; }
.btn.texto { border-radius: var(--balao-pequeno); }
.btn.primario { box-shadow: 0 2px 0 #043d2e; transform: none; }
.btn.primario:active { box-shadow: 0 0 0 #043d2e; transform: translateY(2px); }
.btn:not(.primario):not(.texto) { box-shadow: 0 2px 0 var(--borda); }
.btn:not(.primario):not(.texto):active { box-shadow: 0 0 0 var(--borda); transform: translateY(2px); }
.card, details.faq { border-radius: var(--balao-grande); }
.card > table th:first-child { border-top-left-radius: 21px; }
.card > table th:last-child { border-top-right-radius: 21px; }
input[type="text"], input[type="search"], input[type="password"], input[type="tel"], input[type="email"], input[type="number"], input[type="file"], select { border-radius: var(--balao); border-width: 1.5px; }
.chip { border-radius: var(--balao-pequeno); padding: 3px 12px; }
.alerta { border-radius: var(--balao); }
.opcao { border-radius: var(--balao-grande); }
.topo .menu .btn.texto, .topo .menu .btn.texto[aria-current="page"] { border-radius: var(--balao); }
.topo .marca .simbolo, .conta .avatar { border-radius: 12px 12px 12px 4px; }

/* abas de status e filtros: um só desenho, cheio quando ativo */
.resumo a, .filtro { border-radius: var(--balao); border: 1.5px solid var(--borda); background: var(--surface); box-shadow: none; transition: background-color var(--dur), border-color var(--dur), color var(--dur); }
.resumo a:hover, .filtro:hover { border-color: var(--primario); background: var(--surface); }
.resumo a[aria-current="true"], .filtro[aria-current="true"] { background: var(--primario); border-color: var(--primario); color: #ffffff; box-shadow: none; }
.resumo a[aria-current="true"] .num, .filtro[aria-current="true"] .num { color: #ffffff; opacity: 1; }
.resumo { gap: var(--sp-3); }
.resumo a { padding: var(--sp-3) var(--sp-5); }
/* o seletor de status vira as abas: continua no formulário (a busca leva o filtro junto), só não aparece */
.resumo ~ form.barra select, .resumo ~ form.barra label[for="status"] { display: none; }

/* busca com a mesma forma e uma lupa dentro */
.barra .busca input[type="search"] { padding-left: 46px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378877f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") 14px center / 20px no-repeat; }
.barra .btn { min-width: 112px; }

/* tabela: leitura em linhas calmas, nome forte, dado secundário apagado */
tr.linha td:first-child a.abrir { font-family: var(--fonte-titulo); font-weight: 600; font-size: 1rem; letter-spacing: -0.005em; }
tr.linha:hover { background: color-mix(in srgb, var(--primario) 5%, var(--surface)); }
.card > table th { font-size: 0.875rem; letter-spacing: 0.04em; text-transform: uppercase; }
