/* KMU Eigenwerk 6.3.2 — iPhone/iPad mobile navigation fix.
   The drawer itself must own the vertical scroll; scrolling the page body is
   intentionally disabled while the menu is open. */
@media (max-width: 820px) {
  body.menu-open {
    overflow: hidden !important;
    touch-action: auto !important;
  }

  #topnavWrap.topnav-wrap.mobile-open {
    bottom: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 101px) !important;
    max-height: calc(100dvh - 101px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y !important;
    padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
  }

  #topnavWrap.topnav-wrap.mobile-open > nav,
  #topnavWrap.topnav-wrap.mobile-open > .tenant-switcher,
  #topnavWrap.topnav-wrap.mobile-open > .global-search-box,
  #topnavWrap.topnav-wrap.mobile-open > .settings-menu {
    flex: 0 0 auto !important;
    min-height: 0;
  }

  /* On mobile the long settings list belongs to the drawer's document flow.
     This avoids an absolutely positioned submenu extending below the viewport. */
  #topnavWrap.topnav-wrap.mobile-open .settings-menu {
    position: relative !important;
  }

  #topnavWrap.topnav-wrap.mobile-open .settings-dropdown.open {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    margin-top: 8px !important;
  }
}
