div:where(.swal3-container) div:where(.swal3-popup),
.swal2-popup,
.swal3-popup {
  background: var(--bkg-color1) !important;
  max-width: calc(100% - 24px) !important;
  box-sizing: border-box !important;
}

/* BUG-009 : en thème sombre, --bkg-color1 (#0f0f0f) est quasi-invisible
   sur le fond sombre du backdrop. On aligne sur --bkg-color59 (#171717),
   même valeur que .modal-content en dark mode. */
:root.dark .swal2-popup,
:root.dark .swal3-popup {
  background: var(--bkg-color59) !important;
}
div:where(.swal3-container) {
  z-index: 1201 !important;
}

/* Formulaires en modale Swal : les champs standard (form-control,
   selectpicker, textarea) se confondaient avec le fond blanc, notamment sur
   la commande fournisseur. On donne un relief commun aux formulaires en
   table.noBorder sans toucher aux tables de donnees affichees en modale. */
.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select),
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) td,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) td {
  padding: 3px 6px;
  vertical-align: middle;
}

.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) td:first-child label,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) td:first-child label {
  color: var(--eb-text, var(--txt-color3));
  font-weight: 500;
}

.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control,
.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea,
.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle {
  background: var(--eb-surface-hover, var(--bkg-color12)) !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 7px !important;
  color: var(--eb-text, var(--txt-color92)) !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.03) !important;
}

.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control:focus,
.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea:focus,
.swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle:focus,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control:focus,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea:focus,
.swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle:focus {
  border-color: var(--eb-primary, #2563eb) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

:root.dark .swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control,
:root.dark .swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea,
:root.dark .swal2-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle,
:root.dark .swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .form-control,
:root.dark .swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) textarea,
:root.dark .swal3-popup form table.noBorder:not(.TableListOfFiles):has(select, textarea, .form-control, .bootstrap-select) .bootstrap-select > .dropdown-toggle {
  border-color: var(--eb-border, #333333) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.24) !important;
}

/* Boutons centrés dans le footer de toutes les modales Swal (legacy + native) */
.swal2-actions,
.swal3-actions,
div:where(.swal3-container) .swal3-actions {
  justify-content: center !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding: 0.75em 1em !important;
}

/* #11677 — Mobile : modale « Envoi d'information à l'événement »
   (mail_evenement.php). Le formulaire (Email/SMS/Notification + Destinataire
   + filtres + Sujet + éditeur TinyMCE) dépasse la hauteur du viewport
   WebView. Le overflow-y de .swal2-container centre la popup et le scroll
   tactile reste piégé par l'iframe TinyMCE → le bouton « Envoyer »
   (data-swal-actions déplacé dans .swal2-actions) reste hors champ. On
   borne la popup à la hauteur du viewport, on scrolle le contenu en
   interne et on garde .swal2-actions ancré en bas, visible. Portée
   verrouillée à cette modale via :has(#submit_message). */
@media (max-width: 768px) {
  .swal2-popup:has(#submit_message),
  .swal3-popup:has(#submit_message) {
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }
  .swal2-popup:has(#submit_message) .swal2-content,
  .swal3-popup:has(#submit_message) .swal3-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .swal2-popup:has(#submit_message) .swal2-actions,
  .swal3-popup:has(#submit_message) .swal3-actions {
    flex-shrink: 0 !important;
    background: var(--bkg-color1) !important;
  }
}
