/* ==========================================================================
   Base: reset leve, tipografia, comportamento global e correções de PWA/iOS.
   ========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-main);
  transition: background .2s, color .2s;
  /* Respeita a safe-area do iPhone (notch/barra) no modo standalone. */
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Evita realce azul ao tocar em elementos no iOS. */
a, button { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { margin: 0; }
img { max-width: 100%; }

/* Ícones SVG inline */
.ic { display: block; flex: none; }

/* CORREÇÃO iOS: o Safari dá zoom automático ao focar um campo com font-size < 16px.
   Fixar 16px em todos os controles de formulário elimina o zoom sem desabilitar o
   gesto de pinça (acessível). */
input, select, textarea, button {
  font-family: inherit;
  font-size: 16px;
}

/* Utilitários */
[hidden] { display: none !important; }
.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;
}

/* Foco visível e consistente para navegação por teclado. */
:focus-visible { outline: 2px solid var(--teal-l); outline-offset: 2px; border-radius: 6px; }

/* Respeita quem prefere menos movimento. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Barra de carregamento (usada em views que buscam dados). */
.loading-bar {
  height: 3px; border-radius: 3px; overflow: hidden; position: relative; background: var(--border);
}
.loading-bar::after {
  content: ''; position: absolute; inset: 0; width: 40%; background: var(--teal);
  animation: slide 1s infinite ease-in-out;
}
@keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }

/* Mensagem de erro genérica. */
.erro {
  background: #fff0f0; border: 1px solid #f3c9c9; color: var(--neg);
  padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
}
[data-theme="dark"] .erro { background: #2a1414; border-color: #5b2626; }
