/* Keep native phone layouts untouched; frame the same pages on larger screens. */
@media screen and (min-width: 800px) {
    :root {
        --phone-width: 430px;
        --phone-height: min(844px, calc(100dvh - 80px));
        --phone-top: max(40px, calc((100dvh - 844px) / 2));
        --phone-bottom: calc(100dvh - var(--phone-top) - var(--phone-height));
    }
    html { background: #e7edf5; scroll-padding-top: calc(var(--phone-top) + 82px); }
    body {
        display: flow-root;
        width: var(--phone-width);
        max-width: var(--phone-width);
        min-height: var(--phone-height);
        margin: var(--phone-top) auto var(--phone-bottom) !important;
        padding: 0;
        background: #f2f5fa !important;
    }
    /* The fixed bezel masks content as it scrolls behind the screen edges.
       Document scrolling is retained for photo dragging and back-to-top. */
    body::before {
        content: "";
        position: fixed;
        z-index: 20000;
        top: calc(var(--phone-top) - 12px);
        left: calc(50% - var(--phone-width) / 2 - 12px);
        width: calc(var(--phone-width) + 24px);
        height: calc(var(--phone-height) + 24px);
        box-sizing: border-box;
        border: 12px solid #121a27;
        border-radius: 42px !important;
        box-shadow: 0 0 0 2px #607087, 0 24px 65px #17243a55, 0 0 0 100vmax #e7edf5;
        pointer-events: none;
    }
    body::after {
        content: "";
        position: fixed;
        z-index: 20001;
        top: calc(var(--phone-top) - 8px);
        left: calc(50% - 24px);
        width: 48px;
        height: 4px;
        border-radius: 4px !important;
        background: #506079;
        pointer-events: none;
    }
    .page-wrapper { width: 100%; min-height: var(--phone-height); padding-top: 64px; }
    .page-container { margin-top: 0 !important; }
    .page-header.navbar {
        top: var(--phone-top) !important;
        left: calc(50% - var(--phone-width) / 2) !important;
        width: var(--phone-width) !important;
        border-radius: 28px 28px 0 0 !important;
    }
    .page-content-wrapper .page-content {
        width: 100%;
        min-height: calc(var(--phone-height) - 140px) !important;
    }
    .page-footer { padding-bottom: 24px !important; }
    .vehicle-cover { height: 190px; }
    .photo-toolbar {
        left: calc(50% - var(--phone-width) / 2);
        right: auto;
        bottom: var(--phone-bottom);
        width: var(--phone-width);
        border-radius: 0 0 28px 28px !important;
        padding-bottom: 18px;
    }
    .photo-order-message {
        top: calc(var(--phone-top) + 74px);
        left: calc(50% - var(--phone-width) / 2 + 16px);
        right: auto;
        width: calc(var(--phone-width) - 32px);
    }
    .mobile-refresh { top: calc(var(--phone-top) + 70px); }
    .mobile-back-top {
        right: calc(50% - var(--phone-width) / 2 + 16px);
        bottom: calc(var(--phone-bottom) + 16px);
    }
    .mobile-photo-controls .mobile-back-top {
        bottom: calc(var(--phone-bottom) + var(--photo-panel-height, 120px) + 16px);
    }
    .modal, .modal-backdrop {
        top: var(--phone-top);
        left: calc(50% - var(--phone-width) / 2);
        right: auto;
        bottom: var(--phone-bottom);
        width: var(--phone-width);
        height: var(--phone-height);
        border-radius: 28px !important;
    }
    .modal-dialog { width: auto; margin: 18px 12px; }
    .modal .col-md-6 { width: 100%; float: none; }
    .photo-viewer {
        top: var(--phone-top);
        left: calc(50% - var(--phone-width) / 2);
        right: auto;
        bottom: var(--phone-bottom);
        width: var(--phone-width);
        height: var(--phone-height);
        border-radius: 28px !important;
    }
    .photo-viewer::backdrop { background: transparent; }
    /* The standalone login does not use the shared signed-in header. */
    .user-login-5, .user-login-5 .login-container { min-height: var(--phone-height); }
    .user-login-5 .login-bg { display: none; }
    .user-login-5 .login-container { width: 100%; float: none; padding: 0 0 24px; }
    .user-login-5 .login-logo.login-6 {
        position: relative;
        top: auto; left: auto;
        display: block;
        width: 270px;
        max-width: calc(100% - 56px) !important;
        height: auto;
        margin: 32px 28px 38px;
    }
    .user-login-5 .login-container > .login-content { padding: 0 28px; margin-top: 0 !important; }
    .user-login-5 .login-container > .login-content > .login-form { margin-top: 32px; }
    .user-login-5 .login-form .col-xs-6, .user-login-5 .login-form .col-sm-8 { width: 100%; float: none; }
    .user-login-5 .login-form .col-sm-4 { width: 100%; float: none; }
    .user-login-5 .login-form .rem-password { margin-bottom: 16px; }
    .user-login-5 .login-container > .login-footer { position: relative; margin-top: 32px; padding: 0 24px; }
    .user-login-5 .login-container .login-copyright { padding: 0; }
    body.modal-open { padding-right: 0 !important; }
}
