/* Nunca Zera: tokens e componentes comuns (site público e área logada). */

:root {
  color-scheme: light;
  --fundo: #ffffff;
  --superficie: #f6f8fb;
  --superficie-2: #eef2f7;
  --texto: #0f172a;
  --texto-suave: #475569;
  --texto-fraco: #64748b;
  --borda: #e2e8f0;
  --borda-forte: #cbd5e1;
  --marca: #1d4ed8;
  --marca-hover: #1e40af;
  --marca-suave: #eff4ff;
  --sobre-marca: #ffffff;
  --sucesso: #15803d;
  --sucesso-suave: #ecfdf3;
  --alerta: #b45309;
  --alerta-suave: #fffbeb;
  --perigo: #b91c1c;
  --perigo-suave: #fef2f2;
  --foco: #2563eb;
  --sombra: 0 1px 2px rgb(15 23 42 / .06), 0 8px 24px rgb(15 23 42 / .06);
  --raio: 10px;
  --raio-g: 16px;
  --fonte: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fundo: #1c2638;
    --superficie: #222d42;
    --superficie-2: #2a364e;
    --texto: #f1f4f9;
    --texto-suave: #c3cddb;
    --texto-fraco: #a5b1c3;
    --borda: #344158;
    --borda-forte: #46546e;
    --marca: #7aa8ff;
    --marca-hover: #a3c2ff;
    --marca-suave: #26385c;
    --sobre-marca: #10182a;
    --sucesso: #5ee08f;
    --sucesso-suave: #1d3a2e;
    --alerta: #fcc94a;
    --alerta-suave: #3d3420;
    --perigo: #fb8a8a;
    --perigo-suave: #45272c;
    --foco: #93b8ff;
    --sombra: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fonte);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--marca); text-underline-offset: 2px; }
a:hover { color: var(--marca-hover); }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.015em; font-weight: 650; }
p { margin: 0 0 1em; }
small { font-size: .875rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.visualmente-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Botões */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .6em 1.15em;
  border-radius: var(--raio); border: 1px solid transparent;
  background: var(--marca); color: var(--sobre-marca);
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.botao:hover { background: var(--marca-hover); color: var(--sobre-marca); }
.botao--secundario { background: var(--fundo); color: var(--texto); border-color: var(--borda-forte); }
.botao--secundario:hover { background: var(--superficie); color: var(--texto); }
.botao--fantasma { background: transparent; color: var(--texto-suave); }
.botao--fantasma:hover { background: var(--superficie-2); color: var(--texto); }
.botao--perigo { background: var(--perigo); color: #fff; }
.botao--pequeno { min-height: 36px; padding: .4em .8em; font-size: .875rem; }
.botao--grande { min-height: 50px; padding: .75em 1.4em; font-size: 1rem; }
.botao--bloco { width: 100%; }

/* Formulários */
.campo { display: grid; gap: 6px; margin-bottom: 16px; }
.campo > label, .rotulo { font-weight: 600; font-size: .9rem; }
.campo .ajuda { color: var(--texto-fraco); font-size: .85rem; margin: 0; }
.campo .erro, .erro-campo { color: var(--perigo); font-size: .85rem; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: .55em .75em;
  font: inherit; font-size: .95rem; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--borda-forte); border-radius: var(--raio);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--foco); outline-offset: 0; border-color: var(--foco); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--perigo); }
.opcoes { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.opcoes label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-height: 32px; }
.opcoes input { width: 18px; height: 18px; accent-color: var(--marca); }
.grade-campos { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.acoes-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.acoes-form--centro { justify-content: center; }

/* Avisos */
.aviso { padding: 12px 14px; border-radius: var(--raio); border: 1px solid var(--borda); background: var(--superficie); margin-bottom: 16px; }
.aviso--sucesso { background: var(--sucesso-suave); border-color: transparent; color: var(--sucesso); }
.aviso--erro { background: var(--perigo-suave); border-color: transparent; color: var(--perigo); }
.aviso--alerta { background: var(--alerta-suave); border-color: transparent; color: var(--alerta); }
.aviso p:last-child, .aviso ul:last-child { margin-bottom: 0; }

/* Etiquetas */
.etiqueta { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--superficie-2); color: var(--texto-suave); white-space: nowrap; }
.etiqueta--sucesso { background: var(--sucesso-suave); color: var(--sucesso); }
.etiqueta--alerta { background: var(--alerta-suave); color: var(--alerta); }
.etiqueta--perigo { background: var(--perigo-suave); color: var(--perigo); }
.etiqueta--marca { background: var(--marca-suave); color: var(--marca); }

/* Cartões */
.cartao { background: var(--fundo); border: 1px solid var(--borda); border-radius: var(--raio-g); padding: 24px; }
.cartao--suave { background: var(--superficie); }

/* Tabelas */
.tabela-rolagem { overflow-x: auto; border: 1px solid var(--borda); border-radius: var(--raio-g); background: var(--fundo); }
.tabela { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabela th, .tabela td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-fraco); font-weight: 600; background: var(--superficie); white-space: nowrap; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela .acoes { text-align: right; white-space: nowrap; }
.tabela a { font-weight: 600; text-decoration: none; }
.tabela a:hover { text-decoration: underline; }
.vazio { padding: 40px 16px; text-align: center; color: var(--texto-suave); }
.vazio p { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.aviso--marca { background: var(--marca-suave); border-color: transparent; color: var(--texto); }
