/* Reset enxuto e elementos básicos. Mobile-first: tudo aqui vale a partir de
   320px; media query só existe para ganhar espaço, nunca para consertar. */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--fonte);
    font-size: var(--txt-base);
    line-height: 1.55;
    color: var(--texto);
    background: var(--fundo);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }

h1 { font-size: var(--txt-xl); line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: var(--txt-lg); line-height: 1.3; letter-spacing: -0.005em; }
h3 { font-size: var(--txt-md); line-height: 1.35; }

img, svg { max-width: 100%; height: auto; display: block; }

a {
    color: var(--acento);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
a:hover { color: var(--acento-forte); }

/* Foco sempre visível — a navegação por teclado é acessibilidade, não enfeite */
:focus-visible {
    outline: 2px solid var(--foco);
    outline-offset: 2px;
    border-radius: var(--raio-sm);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

/* Número em coluna alinha quando é tabular */
.num, td.num, .valor, time {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* --- Layout ------------------------------------------------------------ */

.envolucro {
    width: 100%;
    max-width: var(--largura-conteudo);
    margin-inline: auto;
    padding-inline: var(--e-4);
}

.envolucro--largo { max-width: var(--largura-admin); }

/* Telas de erro: estreitas e centradas na vertical. */
.envolucro--erro {
    max-width: 480px;
    padding-block: var(--e-8);
}

.pilha > * + * { margin-top: var(--e-4); }
.pilha-sm > * + * { margin-top: var(--e-2); }
.pilha-lg > * + * { margin-top: var(--e-6); }

.linha {
    display: flex;
    flex-wrap: wrap;
    gap: var(--e-3);
    align-items: center;
}
.linha--entre { justify-content: space-between; }
.linha--fim { justify-content: flex-end; }

.crescer { flex: 1 1 auto; min-width: 0; }

/* --- Tipografia utilitária -------------------------------------------- */

.rotulo {
    font-size: var(--txt-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--texto-apagado);
}

.suave  { color: var(--texto-suave); }
.apagado { color: var(--texto-apagado); }
.pequeno { font-size: var(--txt-sm); }
.mono { font-family: var(--fonte-mono); }
.negrito { font-weight: 600; }
.centro { text-align: center; }
.direita { text-align: right; }
.quebra-tudo { overflow-wrap: anywhere; }

.so-leitor {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* [hidden] tem que ganhar de qualquer componente. O display do navegador para
   esse atributo é da folha do agente, então basta um `.campo { display:block }`
   para o elemento continuar aparecendo — e o bug é silencioso: o HTML jura que
   está escondido. Este é o único !important que vale a pena no projeto. */
[hidden] { display: none !important; }

/* --- Movimento --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Impressão --------------------------------------------------------- */

@media print {
    body { background: #fff; color: #000; }
    .sem-impressao { display: none !important; }
    .cartao { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    a[href]::after { content: ""; }
}
