/* SALDEX - ajustes de celular (Android/iPhone). Carregado depois do Tailwind. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

/* Sem rolagem horizontal involuntária da página */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; }

/* Áreas seguras (notch, barra de gestos) */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
main { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }

/* Altura real da tela no celular (a barra do navegador muda 100vh) */
@supports (height: 100dvh) {
  .h-screen { height: 100dvh; }
  .min-h-screen { min-height: 100dvh; }
  @media (max-width: 1024px) { .sidebar { height: 100dvh !important; } }
}
@media (max-width: 1024px) {
  .sidebar { padding-bottom: env(safe-area-inset-bottom); overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* Alvos de toque confortáveis e sem zoom automático do iOS ao focar campos */
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea { font-size: 16px !important; min-height: 44px; }
  button, .btn, a[role="button"] { min-height: 40px; }
  header button, header a { min-width: 40px; }
}

/* Modais: usáveis com o teclado aberto (rolam em vez de ficar cortados) */
@media (max-width: 768px) {
  div.fixed.inset-0 > div[class*="max-w-"],
  div.fixed.inset-0 > div[class*="w-full"] {
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  div.fixed.inset-0 { padding-bottom: env(safe-area-inset-bottom); }
}

/* Tabelas: rolam dentro da própria área, sem cortar as ações nem alargar a página */
@media (max-width: 768px) {
  main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Modo instalado: sem seleção de texto acidental nos controles */
@media (display-mode: standalone) {
  button, nav a { -webkit-user-select: none; user-select: none; }
}

/* Foco visível para navegação por teclado/leitor de tela */
:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
