/* Base: elementos HTML sem classe, foco e movimento reduzido. */

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

/* O atributo hidden sempre esconde, mesmo com display definido por classe. */
[hidden] { display: none !important; }

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

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

h1, h2, h3 { margin: 0 0 var(--esp-3); font-weight: var(--peso-medio); line-height: 1.25; color: var(--texto); }
h1 { font-size: var(--texto-xl); }
h2 { font-size: var(--texto-md); }
h3 { font-size: var(--texto-base); }
p { margin: 0 0 var(--esp-3); }
small { font-size: var(--texto-xs); }

a { color: var(--cor-primaria); text-decoration: none; transition: color var(--transicao); }
a:hover { color: var(--cor-primaria-forte); text-decoration: underline; }

ul, ol { margin: 0 0 var(--esp-3); padding-left: var(--esp-5); }

/* Foco visível em tudo que recebe foco pelo teclado */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: var(--raio-sm); }

::selection { background: var(--cor-primaria-suave); }

/* Formulários: herdam a fonte e seguem o mesmo tamanho de controle */
button, input, select, textarea { font: inherit; color: inherit; }

input:where(:not([type=checkbox], [type=radio], [type=file])),
select,
textarea {
  min-height: var(--altura-controle);
  padding: var(--esp-1) var(--esp-3);
  background: var(--superficie);
  border: 1px solid var(--borda-forte);
  border-radius: var(--raio);
  transition: border-color var(--transicao), box-shadow var(--transicao);
}
input:where(:not([type=checkbox], [type=radio], [type=file])):hover,
select:hover,
textarea:hover { border-color: var(--cinza-500); }
input:focus-visible, select:focus-visible, textarea:focus-visible,
input:focus, select:focus, textarea:focus { border-color: var(--cor-primaria); box-shadow: var(--foco); outline: none; }
input:disabled, select:disabled, textarea:disabled { background: var(--cinza-100); color: var(--texto-suave); cursor: not-allowed; }
textarea { width: 100%; min-height: 72px; padding: var(--esp-2) var(--esp-3); resize: vertical; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--cor-primaria); }
::placeholder { color: #8a94a1; }

/* Tabelas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--esp-2) var(--esp-3); border-bottom: 1px solid var(--borda); vertical-align: top; }
th {
  font-size: var(--texto-xs); font-weight: var(--peso-medio); color: var(--texto-suave);
  background: var(--cinza-50); text-transform: none; white-space: nowrap;
}
tbody tr { transition: background-color var(--transicao); }
tbody tr:last-child td { border-bottom: none; }

/* Quem prefere menos movimento não vê transições */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
body.sem-rolagem { overflow: hidden; }
