/* TraumAstur V6: stable iOS PWA navigation and shared floating dialogs. */
html.ta-v6-modal-open { scroll-behavior:auto!important; overscroll-behavior:none; }
body.ta-v6-modal-lock {
 position:fixed!important; left:0!important; right:0!important; width:100%!important;
 overflow:hidden!important; overscroll-behavior:none!important;
}
/* All dialog surfaces scroll independently, the backdrop NEVER scrolls. */
.modalback:not(.hide) {
 position:fixed!important; inset:0!important; width:100%!important;
 height:100dvh!important; min-height:0; max-height:100dvh!important;
 overflow:hidden!important; overscroll-behavior:none!important;
 display:flex; align-items:center; justify-content:center;
 padding:clamp(10px,2.2vh,22px) 12px;
 box-sizing:border-box; touch-action:auto;
}
.modalback:not(.hide) > .modal {
 position:relative; box-sizing:border-box; margin:auto;
 width:min(100%,980px); max-width:min(100%,980px);
 min-width:0; min-height:0;
 max-height:calc(100dvh - 28px)!important;
 overflow-x:hidden!important; overflow-y:auto!important;
 overscroll-behavior:contain!important;
 -webkit-overflow-scrolling:touch; touch-action:pan-y;
 background:#fff; border-radius:20px;
}
/* Preserve the existing original limits for compact dialogs. */
#overlay:not(.hide) > .modal{max-width:740px!important;}
#helpOverlay:not(.hide) > .modal{max-width:830px!important;}
#reportOverlay:not(.hide) > .modal{max-width:750px!important;}
#adminOverlay:not(.hide) > .modal{max-width:860px!important;}
#invoicesOverlay:not(.hide) > .modal{max-width:1000px!important;}
#releaseNoticeOverlay:not(.hide) > .modal{max-width:540px!important;}
#urgentOverlay:not(.hide) > .modal{max-width:560px!important;}
/* Headers are consistent on all screens, also when the help title wraps. */
.modalback:not(.hide) > .modal > .modalheader {
 min-width:0; display:grid!important;
 grid-template-columns:minmax(0,1fr) 44px;
 align-items:start; column-gap:12px;
}
.modalback:not(.hide) > .modal > .modalheader > div,
.modalback:not(.hide) > .modal > .modalheader > h2 {grid-column:1;grid-row:1;min-width:0}
.modalback:not(.hide) > .modal > .modalheader > .x {
 grid-column:2;grid-row:1;justify-self:end;align-self:start;
 display:grid;place-items:center;width:44px;min-width:44px;height:44px;
 padding:0;line-height:1;
}

@media(max-width:790px){
 html,body { min-width:0; max-width:100%; }
 #mobileNav.mobile-nav:not(.hide){
  position:fixed!important; top:auto!important; bottom:0!important;
  inset-inline:0!important; left:0!important; right:0!important;
  width:100%!important; max-width:100%!important;
  margin:0!important; z-index:60;
  transform:none!important; -webkit-transform:none!important;
  will-change:auto!important; contain:none!important;
  padding-bottom:max(8px, env(safe-area-inset-bottom, 0px));
 }
 .modalback:not(.hide){
  /* Deliberate border around sheets so the underlying page is visible. */
  padding:max(12px, env(safe-area-inset-top, 0px)) 12px max(12px,env(safe-area-inset-bottom,0px))!important;
  align-items:center!important; justify-content:center!important;
 }
 .modalback:not(.hide) > .modal,
 #overlay.modalback:not(.hide) > .modal {
  width:100%!important; max-width:100%!important; min-width:0!important;
  height:auto!important; min-height:0!important;
  max-height:calc(100dvh - 42px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;
  border-radius:20px!important;
  margin:auto!important;
  padding:19px 16px max(20px, env(safe-area-inset-bottom,0px))!important;
 }
 .modalback:not(.hide) > .modal .formgrid { min-width:0; }
 .modalback:not(.hide) > .modal .field { min-width:0; }
 .modalback:not(.hide) > .modal input,.modalback:not(.hide) > .modal select,
 .modalback:not(.hide) > .modal textarea { max-width:100%; }
 .modalback:not(.hide) > .modal input[type="date"] { min-width:0; }
}
@supports not (height:100dvh){
 .modalback:not(.hide){height:100vh!important;max-height:100vh!important}
 .modalback:not(.hide) > .modal{max-height:calc(100vh - 40px)!important}
}
