/* v1.06 — modal always stays above bottom navigation */
#modal:not(:empty){
  position:fixed!important;
  inset:0!important;
  z-index:10000!important;
  isolation:isolate!important;
}

#modal:not(:empty) .modal{
  position:fixed!important;
  inset:0!important;
  z-index:10001!important;
}

#modal:not(:empty) .sheet{
  position:relative!important;
  z-index:10002!important;
  max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom))!important;
  max-height:calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom))!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
}

/* Do not allow the fixed navigation to sit over an open modal. */
body:has(#modal:not(:empty)) .bottom-nav{
  z-index:-1!important;
  pointer-events:none!important;
}

@media(max-width:599px){
  #modal:not(:empty) .sheet{
    width:100%!important;
    max-width:100%!important;
    border-radius:16px 16px 0 0!important;
    padding-bottom:calc(17px + env(safe-area-inset-bottom))!important;
  }
}
