/* ============================================================
   SWM/OS · Mobile sweep · shared
   ------------------------------------------------------------
   Mínimo viable de touch-correctness:
     · tap targets ≥ 44×44 (WCAG 2.5.8)
     · evita estados hover congelados en touch
     · inputs nunca causan zoom en iOS (font-size ≥ 16px)
     · safe-area-inset para iPhone notch / home indicator
     · scroll suavizado solo si no hay reduced-motion
   ============================================================ */

/* iOS auto-zoom kill · inputs deben tener 16px mínimo */
@media (max-width: 600px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Tap target floor · solo touch devices · sin romper layout desktop */
@media (hover: none) and (pointer: coarse) {

  /* Botones, links interactivos, controles de form · todos ≥ 44px */
  button:not([disabled]),
  [role="button"]:not([disabled]),
  a[href],
  input[type="checkbox"],
  input[type="radio"],
  input[type="button"],
  input[type="submit"],
  input[type="reset"],
  select {
    min-height: 44px;
  }

  /* Disable :hover state que se queda pegado en touch */
  *:hover {
    transition-duration: 0s !important;
  }

  /* Targets de baja visibilidad · expandir hit area */
  .swm-icon-btn,
  .icon-only,
  [aria-label][role="button"]:not(.btn-text) {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Filas de tabla y listas · padding generoso para tap */
  table tbody td {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* Modal · respeta safe area */
  .swm-modal,
  .modal,
  [role="dialog"] {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* Form rows en wizard · más air */
  .wizard-step .field,
  .form-field {
    margin-bottom: 16px;
  }
}

/* Layout: viewport-safe en notch · aplica siempre, no solo touch */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Tablas con overflow-x cuando no caben en mobile */
@media (max-width: 720px) {
  .table-scroll,
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Reduce motion respeta sistema */
@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;
  }
}

/* Print: oculta FAB cmdk y toasts */
@media print {
  .swm-cmdk-fab,
  .swm-cmdk-backdrop,
  .swm-toast-stack {
    display: none !important;
  }
}
