/* ==========================================================================
   Base — reset e elementos fundamentais
   ========================================================================== */

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

/* Tentei usar overflow-x: hidden aqui como rede de segurança contra
   estouro horizontal no mobile, mas descobri que isso quebra a rolagem: pela
   spec de CSS Overflow, ter overflow-x diferente de "visible" força o
   overflow-y computado para "auto" mesmo que seja declarado "visible"
   explicitamente — o body vira seu próprio container de rolagem, desalinhado
   do scroll do documento que o `position: sticky` da sidebar/topbar espera.
   A causa raiz do estouro horizontal (grid tracks não encolhendo) já foi
   corrigida em layout.css (`.grid > * { min-width: 0 }`), então essa rede de
   segurança não é necessária — melhor não arriscar a rolagem normal da
   página por uma proteção redundante. */
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
p { margin: 0; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

ul, ol { margin: 0; padding: 0; list-style: none; }

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

::selection { background: var(--color-blue-100); color: var(--color-blue-dark); }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* Scrollbar refinada */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* Loading inicial */
.app-loading {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-5); background: var(--color-bg); z-index: 999;
}
.app-loading__mark { animation: pulse-scale 1.4s var(--ease-in-out) infinite; }
.app-loading__bar { width: 160px; height: 3px; background: var(--color-gray-100); border-radius: var(--radius-full); overflow: hidden; }
.app-loading__bar span { display: block; width: 40%; height: 100%; background: var(--color-blue); border-radius: var(--radius-full); animation: loading-slide 1.1s var(--ease-in-out) infinite; }

.app { min-height: 100%; }

/* Utilitários genéricos */
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
