/* Final mobile safety layer: desktop styling remains unchanged. */
@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        overflow-x: clip;
    }

    /* Keep WhatsApp available without colliding with the mobile action dock. */
    .xf-whatsapp-float {
        left: 12px !important;
        right: auto !important;
        bottom: calc(98px + env(safe-area-inset-bottom)) !important;
        width: 54px !important;
        min-width: 54px !important;
        height: 54px !important;
        min-height: 54px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border: 2px solid rgba(255,255,255,.9) !important;
        border-radius: 50% !important;
        z-index: 610 !important;
        box-shadow: 0 13px 32px rgba(15,126,66,.3) !important;
    }

    .xf-whatsapp-float span {
        display: none !important;
    }

    .xf-whatsapp-float i {
        font-size: 27px !important;
    }

    /* Keep each floating helper in its own reserved position. */
    .nc-assistant {
        right: 12px !important;
        bottom: calc(98px + env(safe-area-inset-bottom)) !important;
        z-index: 620 !important;
    }

    .nc-invitation,
    .nc-invitation.show {
        display: none !important;
    }

    .xf-back-top,
    .xf-back-top.visible {
        right: 76px !important;
        bottom: calc(101px + env(safe-area-inset-bottom)) !important;
        z-index: 610 !important;
    }

    .nc-assistant.open {
        inset: 0 !important;
        z-index: 12000 !important;
    }

    .nc-assistant.open .nc-panel {
        position: fixed !important;
        top: max(10px,env(safe-area-inset-top)) !important;
        right: 10px !important;
        bottom: calc(88px + env(safe-area-inset-bottom)) !important;
        left: 10px !important;
        width: auto !important;
        height: auto !important;
        max-height: none !important;
    }

    .nc-assistant.open .nc-launcher {
        display: none !important;
    }
}

@media (max-width: 620px) {
    /* Give the homepage visual and its badges a predictable, non-overlapping box. */
    .home-screen-page .slide-layout {
        gap: 24px !important;
        padding-top: 18px !important;
    }

    .home-screen-page .slide-media {
        width: 100% !important;
        height: 370px !important;
        margin: 0 !important;
    }

    .home-screen-page .honeycomb-media > img {
        width: 106% !important;
        max-width: none !important;
        height: 285px !important;
        margin: 18px 0 0 -3% !important;
        object-fit: contain !important;
        transform: none !important;
    }

    .home-screen-page .media-badge {
        box-shadow: 0 13px 32px rgba(12,105,98,.12) !important;
    }

    .home-screen-page .media-badge.top {
        top: 8px !important;
        right: 2px !important;
        width: auto !important;
        max-width: 138px;
        padding: 12px 14px !important;
        border-radius: 14px !important;
    }

    .home-screen-page .media-badge.top strong {
        font-size: 28px !important;
        line-height: 1;
    }

    .home-screen-page .media-badge.top span {
        margin-top: 4px;
        font-size: 9px !important;
        line-height: 1.3;
    }

    .home-screen-page .media-badge.bottom.connected-care-badge,
    .home-screen-page .media-badge.bottom.care-built-badge {
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        min-height: 69px;
        gap: 10px !important;
        padding: 11px 14px !important;
        border-radius: 16px !important;
    }

    .home-screen-page .media-badge.bottom i {
        width: 36px !important;
        height: 36px !important;
        flex: 0 0 36px;
    }

    .home-screen-page .media-badge.bottom b {
        font-size: 12px !important;
        line-height: 1.25;
    }

    .home-screen-page .media-badge.bottom small {
        margin-top: 3px;
        font-size: 9px !important;
        white-space: normal !important;
    }

    .home-screen-page .slide-copy {
        position: relative;
        z-index: 1;
    }

    .home-screen-page .slide-copy h1 {
        overflow-wrap: anywhere;
        font-size: clamp(38px,10.5vw,47px) !important;
        line-height: 1.02 !important;
    }

    .nc-launcher {
        min-width: 54px !important;
        width: 54px !important;
        height: 54px !important;
        padding: 4px !important;
    }

    .nc-launcher-avatar {
        width: 46px !important;
        height: 46px !important;
        font-size: 23px !important;
    }
}

@media (max-width: 380px) {
    .home-screen-page .slide-media {
        height: 345px !important;
    }

    .home-screen-page .honeycomb-media > img {
        height: 260px !important;
    }

    .mf-actions {
        left: 6px !important;
        right: 6px !important;
    }

    .xf-back-top,
    .xf-back-top.visible {
        right: 71px !important;
    }
}
