/* =========================================================================
   Base: reset, tipografia, acessibilidade e utilitários
   ========================================================================= */

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

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

body {
  font-family: var(--fonte-corpo);
  font-size: 14px;
  line-height: 1.5;
  color: var(--txt);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-lenta) ease, color var(--t-lenta) ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--fonte-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }

a {
  color: var(--acc);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

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

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
}

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

::selection {
  background: color-mix(in srgb, var(--acc) 22%, transparent);
}

/* Barra de rolagem discreta */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--mut) 30%, transparent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--mut) 50%, transparent); }

/* Ícones Lucide (sprite) */
.icone {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.icone-xs { width: 14px; height: 14px; }
.icone-sm { width: 16px; height: 16px; }
.icone-lg { width: 22px; height: 22px; }
.icone-xl { width: 28px; height: 28px; }

/* Valores monetários ocultáveis (botão de olho no header) */
[data-valores="ocultos"] .valor {
  filter: blur(7px);
  user-select: none;
}
.valor { transition: filter var(--t) ease; white-space: nowrap; }
.valor-vazio { color: var(--mut); }

/* Utilitários */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mut { color: var(--mut); }
.txt-sm { font-size: 13px; }
.txt-xs { font-size: 12px; }
.txt-lg { font-size: 16px; }
.negrito { font-weight: 600; }
.mono { font-family: var(--fonte-mono); }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.quebrar { overflow-wrap: anywhere; }
.pre-linha { white-space: pre-line; }
.direita { text-align: right; }
.centro { text-align: center; }
.positivo { color: var(--sucesso-txt); }
.negativo { color: var(--critico-txt); }

.linha { display: flex; align-items: center; gap: 8px; }
.linha-entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.linha-quebra { flex-wrap: wrap; }
.coluna { display: flex; flex-direction: column; gap: 8px; }
.gap-4 { gap: 4px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.oculto { display: none !important; }

.grade { display: grid; gap: 16px; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grade-auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (max-width: 1100px) {
  .grade-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .grade-2,
  .grade-3,
  .grade-4 { grid-template-columns: minmax(0, 1fr); }
}

@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;
  }
}
