/* TheaCRM v2.8.507 – modal layer priority fix
   Bootstrap modals must always be above their backdrop and above mobile bottom/menu layers.
   This file intentionally does not style modal content; it only defines safe stacking. */
:root{
  --thea-z-modal-backdrop-critical:7000;
  --thea-z-modal-critical:7010;
}

body.thea-modal-layer-open .thea-mobile-bottom-nav,
body.thea-modal-layer-open .thea-mobile-quick-add,
body.thea-modal-layer-open .thea-mobile-quick-add-backdrop,
body.thea-modal-layer-open .thea-mobile-main-menu,
body.thea-modal-layer-open .thea-mobile-main-menu-backdrop,
body.thea-modal-layer-open #notificationDropdown,
body.thea-modal-layer-open #mailDropdown,
body.thea-modal-layer-open .thea-top-dropdown{
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

/* CSS fallback. JS assigns incremental z-indexes for stacked modals/backdrops. */
.modal-backdrop.show{
  z-index:var(--thea-z-modal-backdrop-critical) !important;
}
.modal.show,
.modal.thea-modal-layer-pending{
  z-index:var(--thea-z-modal-critical) !important;
  pointer-events:auto !important;
}
.modal.show .modal-dialog,
.modal.thea-modal-layer-pending .modal-dialog{
  position:relative;
  z-index:1;
}

/* Custom Thea modal-like overlays should also beat application chrome. */
.thea-ai-reply-backdrop.is-open,
.thea-mail-gallery.is-open,
.thea-mail-gallery-backdrop.is-open{
  z-index:calc(var(--thea-z-modal-critical) + 20) !important;
}

@media (max-width:767.98px){
  body.thea-modal-layer-open{
    overflow:hidden !important;
    padding-bottom:0 !important;
  }
}
