/* =====================================================================
   Modal (vira folha inferior no celular) — partial: componentes/_modal
   ===================================================================== */
.modal-fundo {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--espaco-6);
  background: var(--overlay);
  animation: aparecer 160ms ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--superficie); color: var(--texto);
  border-radius: var(--raio-lg);
  box-shadow: var(--sombra-2);
  animation: subir 180ms ease;
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 760px; }
.modal-cabecalho { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--espaco-3); padding: 18px var(--espaco-5) var(--espaco-3); }
.modal-cabecalho h2 { font-size: var(--tamanho-xl); font-weight: var(--peso-bold); padding-top: var(--espaco-1-5); }
.modal-cabecalho p { color: var(--texto-2); font-size: var(--tamanho-md); margin-top: var(--espaco-1); }
.modal-corpo { padding: var(--espaco-2) var(--espaco-5) var(--espaco-5); overflow-y: auto; overscroll-behavior: contain; }
.modal-rodape { display: flex; justify-content: flex-end; gap: var(--espaco-2-5); padding: var(--espaco-3-5) var(--espaco-5); border-top: 1px solid var(--borda); flex-wrap: wrap; }
.modal-rodape .esquerda { margin-right: auto; }

@media (max-width: 640px) {
  .modal-fundo { align-items: flex-end; padding: 0; }
  .modal, .modal-sm, .modal-lg {
    max-width: none; max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: subir-folha 200ms ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-rodape .btn { flex: 1; }
  .modal-rodape .esquerda { flex: 0 0 auto; }
}
