/**
 * Last-in: scroll lock, sheets, popups, app board scroll.
 * Loaded after app-phone.css.
 */

html.bu-lock,
body.bu-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Hide floating chrome while any overlay owns the viewport */
body.bu-lock .bu-mobile-fab-stack,
body.bu-lock .bu-switch.bu-mobile-only,
body.bu-lock .bu-fresh-toast {
  visibility: hidden !important;
  pointer-events: none !important;
}

.bu-filter-sheet-scrim {
  display: none;
}
.bu-filter-sheet-scrim.is-on {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 20095;
  border: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

@media (max-width: 899px) {
  html,
  body.bu-app-page,
  body.bu-board-page {
    height: 100%;
  }
  body.bu-app-page,
  body.bu-board-page {
    overflow: hidden;
  }

  body.bu-app-page .bu-appshell {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.bu-app-page .bu-appshell-main {
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }
  body.bu-app-page:not(.bu-board-page) .bu-appshell-main,
  body.bu-app-page .bu-appscreen {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body.bu-app-page .bu-board-in-app,
  body.bu-app-page .bu-board,
  body.bu-board-page .bu-board {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.bu-app-page .bu-board-bar,
  body.bu-board-page .bu-board-bar {
    flex-shrink: 0;
  }
  body.bu-app-page .bu-board-body,
  body.bu-board-page .bu-board-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  body.bu-app-page .bu-board-list,
  body.bu-board-page .bu-board-list,
  body.bu-app-page .bu-board-list-scroll,
  body.bu-board-page .bu-board-list-scroll {
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }
  body.bu-app-page .bu-board-list-scroll,
  body.bu-board-page .bu-board-list-scroll {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.bu-app-page #bu-feed,
  body.bu-board-page #bu-feed {
    overflow: visible !important;
  }

  body.bu-filters-sheet-open #bu-filter-fold.open {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    z-index: 20105 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: min(86dvh, 740px) !important;
    margin: 0 !important;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 20px 20px 0 0 !important;
    border: 1px solid #e2e8f0 !important;
    background: #fff !important;
    box-shadow: 0 -18px 48px rgba(15, 23, 42, 0.22) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .bu-geo-list:not([hidden]) {
    max-height: min(40dvh, 280px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  #bu-mobile-detail-sheet,
  .bu-mobile-fleet-sheet,
  .bu-chat-drawer,
  .bu-notes,
  .bu-cal,
  .bu-post-confirm-sheet,
  .bu-vip-modal,
  .bu-offer-modal,
  .bu-help-modal,
  .bu-onboard,
  .bu-fleet-modal-sheet,
  .bu-tool-info-sheet,
  .bu-assign-sheet {
    overscroll-behavior: contain;
  }
  #bu-mobile-detail-body,
  .bu-mobile-fleet-sheet .bu-fleet-body,
  .bu-chat-drawer .bu-chat-body,
  .bu-post-confirm-body,
  .bu-notes-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  .bu-lang-menu,
  .bu-veh-drop-menu,
  .bu-live-menu,
  .bu-live-pop,
  .bu-tools-pop,
  .bu-support-menu,
  .bu-quick {
    max-height: min(70dvh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.bu-app-page .bu-appshell-nav {
    z-index: 60;
  }
}

@media (min-width: 900px) {
  .bu-filter-sheet-scrim { display: none !important; }
  .bu-post-confirm-body,
  .bu-chat-drawer .bu-chat-body,
  .bu-geo-list:not([hidden]) {
    overscroll-behavior: contain;
  }
}

@media (max-width: 899px) {
  #bu-chat-sheet.bu-chat-drawer-wrap {
    z-index: 20200 !important;
  }
}
