/* Scoped to the website pages embedded in the apps; desktop and PDF layouts stay separate. */
@media screen and (max-width: 767px) {
    .mm-app-page {
        -webkit-text-size-adjust: 100%;
    }

    /* Keep the existing mobile navigation in a single compact row. */
    .mm-app-page .elementor-location-header .elementor-inner-section.elementor-hidden-desktop.elementor-hidden-tablet > .elementor-container {
        flex-wrap: nowrap;
        align-items: center;
        padding: 8px 16px;
        gap: 8px;
    }
    .mm-app-page .elementor-location-header .elementor-inner-section.elementor-hidden-desktop.elementor-hidden-tablet > .elementor-container > .elementor-column {
        width: 48px;
        flex: 0 0 48px;
    }
    .mm-app-page .elementor-location-header .elementor-inner-section.elementor-hidden-desktop.elementor-hidden-tablet > .elementor-container > .elementor-column:first-child {
        width: auto;
        flex: 1;
    }
    .mm-app-page .elementor-location-header .elementor-widget-wrap {
        padding: 0;
    }
    .mm-app-page .elementor-location-header .elementor-widget-theme-site-logo img {
        height: 40px !important;
        width: auto !important;
        margin: 0;
    }
    .mm-app-page .elementor-location-header .elementor-icon {
        font-size: 24px;
    }
    .mm-app-page .elementor-location-header .elementor-icon svg {
        width: 24px;
        height: 24px;
    }
    .mm-app-page .elementor-location-header .elementor-menu-toggle,
    .mm-app-page .elementor-location-header .elementor-icon {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mm-app-page main#content:not(.hero-image),
    .mm-app-page #sections {
        padding-top: 24px;
        padding-bottom: 32px;
    }
    .mm-app-page main .elementor-widget-heading .elementor-heading-title,
    .mm-app-page #sections h1 {
        font-size: 30px !important;
        line-height: 1.2;
        overflow-wrap: break-word;
    }
    .mm-app-page main h3,
    .mm-app-page #sections h2,
    .mm-app-page #sections h3 {
        font-size: 24px;
        line-height: 1.3;
    }
    .mm-app-page main .elementor-widget-text-editor,
    .mm-app-page #sections {
        overflow-wrap: anywhere;
    }
    .mm-app-page main .elementor-widget-text-editor,
    .mm-app-page main .elementor-text-editor,
    .mm-app-page main .elementor-widget-text-editor p {
        text-align: left !important;
    }
    .mm-app-page main .elementor-widget-text-editor p,
    .mm-app-page #sections p {
        font-size: 16px;
        line-height: 1.6;
        margin-bottom: 16px;
    }
    .mm-app-page main .elementor-widget-spacer {
        --spacer-size: 24px !important;
    }
    .mm-app-page main .page-content > .elementor > .elementor-top-section > .elementor-container {
        padding-left: 16px;
        padding-right: 16px;
    }
    .mm-app-page main .elementor-column,
    .mm-app-page main .elementor-widget,
    .mm-app-page main .elementor-widget-container {
        min-width: 0;
    }
    .mm-app-page main img,
    .mm-app-page #sections img {
        max-width: 100%;
        height: auto;
    }
    .mm-app-page main .elementor-toggle .elementor-tab-title {
        padding: 16px;
        line-height: 1.4;
    }

    /* Larger controls prevent iOS focus zoom and give fingers room to tap. */
    .mm-app-page :is(main, #create-trade-account) :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
        font-size: 16px;
        min-height: 48px;
        max-width: 100%;
        border-radius: 6px;
    }
    .mm-app-page :is(main, #create-trade-account) :is(input, select, textarea):focus-visible {
        outline: 2px solid #1a5f8e;
        outline-offset: 2px;
    }
    .mm-app-page :is(main, #sections, #create-trade-account) .btn,
    .mm-app-page main .elementor-button {
        min-height: 48px;
        white-space: normal;
    }
    .mm-app-page :is(#pem_form, #hcc_form, #pem_form_contact, #hcc_form_contact) {
        margin: 0 !important;
        max-width: 100% !important;
    }
    .mm-app-page :is(#pem_form, #hcc_form) .col-xs-6 {
        width: 100%;
    }
    .mm-app-page #pem_form .col-xs-2 {
        width: 50%;
    }
    .mm-app-page :is(#pem_form, #hcc_form, #pem_form_contact, #hcc_form_contact) .form-group {
        margin-bottom: 20px;
    }
    .mm-app-page :is(#pem_form, #hcc_form) h2 {
        font-size: 24px;
        margin: 24px 0 16px;
    }
    .mm-app-page :is(#pem_form, #hcc_form, #pem_form_contact, #hcc_form_contact) .btn {
        width: 100%;
    }
    .mm-app-page :is(main, #create-trade-account) .checkbox label,
    .mm-app-page #create-trade-account .radios label:not(.main_label) {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
        line-height: 1.5;
    }

    /* The original widgets hide the report on phones. Keep it readable and scroll only tables. */
    .mm-app-page .mm-calculator-results {
        padding: 0 !important;
    }
    .mm-app-page #resultsMain {
        display: block !important;
        padding: 12px;
        border-radius: 8px;
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .mm-app-page #stage_3_results_header {
        gap: 16px;
        align-items: stretch !important;
    }
    .mm-app-page #resultsMain :is(th, td) {
        font-size: 14px;
        padding: 8px !important;
        overflow-wrap: normal;
    }
    .mm-app-page #resultsMain table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .mm-app-page :is(#pemCanvasWrapper, #hccCanvasWrapper) {
        width: 100% !important;
        max-width: 100% !important;
        height: 300px !important;
    }
    .mm-app-page :is(#pemCanvas, #hccCanvas) {
        width: 100% !important;
        max-width: 100% !important;
    }

    .mm-app-page .licence_block {
        min-height: 0;
        margin-bottom: 20px;
        padding: 20px;
        border: 1px solid #e8e8e8;
        border-radius: 8px;
        text-align: center;
        gap: 16px;
    }
    .mm-app-page .licence_block .img-container {
        min-height: 0;
    }
    .mm-app-page .licence_block .img-container img {
        max-height: 240px;
        width: auto;
        object-fit: contain;
    }
    .mm-app-page .licence_block h4 {
        font-size: 20px;
        line-height: 1.4;
        margin: 0;
    }
    .mm-app-page .licence_block .btn {
        width: 100%;
    }
    .mm-app-page #create-trade-account {
        padding: 24px 16px 32px;
        width: 100%;
        min-width: 0;
    }
    .mm-app-page #create-trade-account .content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .mm-app-page #create-trade-account fieldset > input:not([type="radio"]):not([type="checkbox"]) {
        width: 100%;
    }
    .mm-app-page #create-trade-account legend {
        font-size: 28px;
        line-height: 1.25;
        padding-bottom: 12px;
    }
    .mm-app-page #create-trade-account label {
        display: inline-block;
        margin-bottom: 6px;
    }
}

/* reCAPTCHA has a fixed 304px footprint, wider than the content of a 320px phone. */
@media screen and (max-width: 359px) {
    .mm-app-page #create-trade-account .g-recaptcha {
        transform: scale(0.89);
        transform-origin: left top;
        width: 304px;
    }
}
