/* Bound the drawer to the visible screen; keep the shop's existing colours. */
.bb-top .bb-account-menu-panel,
.mobile-bottom-nav .sw-mobile-account-menu .bb-account-menu-panel {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  scroll-padding-block: 8px;
}

.bb-top .bb-account-menu-panel {
  max-height: calc(var(--bb-account-menu-viewport-height, 100vh) - var(--bb-top-desktop-h, 60px) - 16px - env(safe-area-inset-bottom, 0px));
}

html body.has-bb-header .bb-top-desktop .bb-user-menu.sw-account-menu.hierarchy-mobile-member-menu,
html body:has(.bb-top) .bb-top-desktop .bb-user-menu.sw-account-menu.hierarchy-mobile-member-menu {
  top: calc(var(--bb-account-menu-viewport-top, 0px) + var(--bb-top-desktop-h, 60px) + 8px) !important;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(var(--bb-account-menu-viewport-height, 100vh) - var(--bb-top-desktop-h, 60px) - 64px - env(safe-area-inset-bottom, 0px)) !important;
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
}

.bb-top-desktop .hierarchy-mobile-member-menu .bb-account-menu-panel {
  flex: 0 1 auto;
  max-height: calc(var(--bb-account-menu-viewport-height, 100vh) - var(--bb-top-desktop-h, 60px) - 64px - env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 900px), (orientation: landscape) and (min-width: 901px) and (max-width: 1024px) and (max-height: 600px) {
  .mobile-bottom-nav .sw-mobile-account-menu.sw-account-menu {
    top: var(--bb-account-menu-viewport-top, 0px);
    max-height: calc(var(--bb-account-menu-viewport-height, 100vh) - var(--bb-bottom-mobile-h, 56px) - env(safe-area-inset-bottom, 0px));
    min-height: 0;
  }

  .mobile-bottom-nav .sw-mobile-account-menu.sw-account-menu .bb-account-menu-panel {
    flex: 0 1 auto;
    max-height: calc(var(--bb-account-menu-viewport-height, 100vh) - var(--bb-top-mobile-h, 47px) - var(--bb-bottom-mobile-h, 56px) - env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
