/* AutoGestão Pro: modal financeiro com rolagem independente e botões acessíveis. */
.agp-payment-modal { height: 100dvh; max-height: 100dvh; overscroll-behavior: contain; box-sizing: border-box; }
.agp-payment-modal > div { min-height: 0; max-height: calc(100dvh - 1rem); }
.agp-payment-modal > div > div:first-child { flex-shrink: 0; }
.agp-payment-modal .agp-payment-form { min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.agp-payment-modal .agp-payment-form input,
.agp-payment-modal .agp-payment-form select,
.agp-payment-modal .agp-payment-form textarea { min-width: 0; max-width: 100%; }
.agp-payment-modal .agp-payment-actions { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.agp-payment-modal .agp-payment-actions button { min-height: 42px; }
@media (min-width: 640px) { .agp-payment-modal > div { max-height: 90dvh; } }
@media (max-width: 639px) { .agp-payment-modal { align-items: stretch; padding: max(6px,env(safe-area-inset-top)) 6px max(6px,env(safe-area-inset-bottom)); }
 .agp-payment-modal > div { margin:auto; max-width:100%; max-height: calc(100dvh - 12px); } }
/* Other modal forms: correction only when modal already has a scrolling shell. */
@media (max-width: 767px) { div[class~="fixed"][class~="inset-0"] > div[class*="max-h-"][class*="flex-col"] { min-height:0; }
 div[class~="fixed"][class~="inset-0"] > div[class*="max-h-"][class*="flex-col"] > form { overflow-y:auto; min-height:0; overscroll-behavior:contain; } }

/* Modais de formulário de outros módulos com estrutura flex preexistente. */
@supports selector(:has(> form)) {
  div[class~="fixed"][class~="inset-0"] > div[class*="max-w-"][class*="flex-col"]:has(> form) {
    max-height: min(92dvh, 900px); min-height: 0;
  }
  div[class~="fixed"][class~="inset-0"] > div[class*="max-w-"][class*="flex-col"]:has(> form) > form {
    overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto;
  }
}
