@media (max-width: 767px) {
    html.pwa-standalone {
        --salemdos-header-safe-top: env(safe-area-inset-top, 0px);
        overscroll-behavior-y: none;
    }

    html.pwa-standalone body {
        height: auto;
        min-height: 100dvh;
        overscroll-behavior-y: none;
    }

    /* Give short iOS standalone documents a minimal scroll range. */
    html.pwa-standalone.pwa-ios-standalone:not(.legacy-menu-open):not(.pwa-menu-scroll-locked) body:not(.modal-open):not(.legacy-popup-open) {
        min-height: calc(100dvh + 1px);
    }

    html.pwa-standalone body:has(> .app-page-header) {
        padding-top: calc(var(--app-header-offset) + 16px);
    }

    html.pwa-standalone body > .app-page-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    html.pwa-standalone.legacy-menu-open,
    html.pwa-standalone body.legacy-menu-open {
        overflow: clip;
    }

    html.pwa-standalone.pwa-menu-scroll-locked body {
        position: fixed;
        top: var(--pwa-locked-page-top, 0px);
        left: 0;
        right: 0;
    }

    /* Keep the closed bar independent of the full-height menu. */
    html.pwa-standalone body .panel-new:not(.active) {
        --pwa-bottom-bar-height: 80px;
        position: fixed;
        bottom: 0;
        height: var(--pwa-bottom-bar-height);
        min-height: var(--pwa-bottom-bar-height) !important;
        transform: translateX(-50%);
    }

    html.pwa-ios-standalone.pwa-bottom-starting body .panel-new:not(.active) {
        visibility: hidden;
    }

    @media (orientation: portrait) {
        html.pwa-standalone.pwa-ios-standalone:not(.legacy-menu-open):not(.pwa-menu-scroll-locked) body:not(.modal-open):not(.legacy-popup-open) {
            min-height: 100lvh;
        }
        html.pwa-ios-standalone.pwa-bottom-starting body .panel-new:not(.active) {
            visibility: visible;
        }
    }

    html.pwa-standalone body .panel-new:not(.active) > :not(.top) {
        visibility: hidden;
    }

    html.pwa-standalone body .panel-new:not(.active) > .top {
        box-sizing: border-box;
        height: calc(var(--pwa-bottom-bar-height) + env(safe-area-inset-bottom, 0px));
        min-height: calc(var(--pwa-bottom-bar-height) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        flex-shrink: 0;
    }

    html.pwa-standalone body .panel-new.active {
        --pwa-panel-safe-top: max(0px, calc(var(--salemdos-header-safe-top, 0px) - var(--pwa-visible-top, 0px)));
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior-y: none;
        padding-top: var(--pwa-panel-safe-top);
        background: #fff !important;
        isolation: isolate;
        /* Extend this surface only below its viewport-sized border box. */
        box-shadow: 0 var(--pwa-visible-height, 100dvh) 0 0 #fff;
    }

    html.pwa-standalone body .panel-new.active > .top {
        position: sticky;
        top: 0;
        z-index: 3;
        height: 64px;
        min-height: 64px;
        padding-block: 0;
    }

    html.pwa-standalone body .panel-new.active > .top::before {
        content: '';
        position: absolute;
        inset: auto 0 100%;
        height: var(--pwa-panel-safe-top);
        background: inherit;
        pointer-events: none;
    }

    html.pwa-standalone body .panel-new.active > .menu-wrapper {
        background: #fff;
        display: block;
        flex: 0 0 auto;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        scroll-padding-block: 16px 48px;
    }

}

@media (max-width: 480px) {
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > .app-page-header,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > .panel-new,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content > .worktime-page {
        max-width: 100% !important;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content > .container,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content > .worktime-page > .container,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content > .worktime-page > .salemdos-sticky-filter > .container {
        max-width: 100% !important;
        padding-inline: 10px !important;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .about-page > #about {
        margin-inline: 0;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .osi-detail-page > .row.align-items-center,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .worktime-page .rent-worker-list .card {
        margin-inline: 0 !important;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .osi-detail-page > .osi-user-vote-form > .raiting,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .osi-detail-page > .panel-title,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .osi-detail-page > #accordion-osi-data,
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .osi-detail-page > a.legacy-row-link {
        margin-inline: 0 !important;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content > .container > .salemdos-sticky-filter {
        width: 100% !important;
        margin-inline: 0 !important;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .legacy-rental-workspace > .salemdos-sticky-filter > :is(.employee-toolbar, .employee-search-fields),
    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content .worktime-page > .salemdos-sticky-filter > .container > .row.bg-grey {
        margin-inline: 0;
    }

    html:is(.pwa-standalone.pwa-ios-standalone, :not(.pwa-standalone)) body > main.frontend-content :is(
        .bc-structure-page > .room-tab,
        .bc-structure-page .entrance,
        .bc-structure-page .bc-floor-row,
        #bc-equipment > .room-tab,
        #bc-equipment .entrance,
        #bc-equipment .etazh,
        #osi-equipment > .osi-equipment-tabs,
        #osi-equipment .etazh,
        #osi-equipment .equipment-parking-feature,
        #osi-equipment .equipment-yard-form,
        .vuz-structure-page .vuz-main-tabs,
        .vuz-structure-page .vuz-level,
        .osi-structure-page > .room-tab-content > [data-tab="3"] > .row
    ) {
        margin-inline: 0 !important;
    }
}

@media (max-width: 480px) and (hover: none) and (pointer: coarse) {
    html:not(.pwa-standalone) body > .panel-new:not(.active) {
        background-color: #ff7916;
    }
}

/* Only the About document in installed iOS PWA uses an inner content scroller. */
@media (max-width: 767px) {
    html.pwa-standalone.pwa-ios-standalone:has(> body > main.page.frontend-content > .about-page),
    html.pwa-standalone.pwa-ios-standalone body:has(> main.page.frontend-content > .about-page) {
        overflow: clip;
    }

    html.pwa-standalone.pwa-ios-standalone body > main.page.frontend-content:has(> .about-page) {
        position: fixed;
        top: calc(var(--app-header-offset, 64px) + 16px);
        bottom: 80px;
        left: 0;
        right: 0;
        height: auto;
        min-height: 0;
        padding-bottom: 0;
        overflow-y: auto;
        overscroll-behavior-y: none;
    }

    html.pwa-standalone.pwa-ios-standalone.legacy-menu-open body > main.page.frontend-content:has(> .about-page) {
        overflow-y: hidden;
    }
}
