html, body {
    min-width: auto;
    max-width: 100vw;
}

.reg-logo-wrapper .logo-container,
.reg-wrapper {
    width: auto;
}

.ui-panel {
    overflow: visible !important;
}

.custom-panel-blue-header-container>.ui-panel .ui-panel-titlebar {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

/* Credentials (Normal) */
.credentials-field-label {
    min-width: 110px;
}

/* Confirmation */
#idFrmStep6 .s6-container {
    min-height: 400px;
}

#idTextWhatsNext {
    color: #1F4273;
}

#idConfirmationImg {
    width: 219px;
    height: auto;
}

.top-mid-bot {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-mid-bot .reg-wrapper {
    margin: 0;
    min-height: auto;
}

.top-mid-bot .reg-wrapper .mb-100-before-footer {
    margin-bottom: 0 !important;
}

.top-mid-bot .footer-cont {
    margin-top: auto;
}

.top-mid-bot .footer-section {
    position: relative !important;
    margin-top: 30px;
}

.frmStep3_temp img#idGITempIdMob {
    max-width: 65% !important;
    height: auto !important;
    display: block;
    margin: 0 auto !important;
}

@media (max-width: 767.98px) {
    .cred-rules {
        flex-direction: column;
        gap: .25rem !important;
    }

    .frmStep3_temp img#idGITempIdMob {
        max-width: 80% !important;
    }
}

@media (max-width: 600px) {
    .frmStep3_temp img#idGITempIdMob {
        max-width: 100% !important;
    }
}

@media (max-width: 500px) {
    .s1-btn-grid,
    .s1-btn-grid tbody,
    .s2-grid-btn,
    .s2-grid-btn tbody,
    .s3-grid-btn,
    .s3-grid-btn tbody,
    .s4-grid-btn,
    .s4-grid-btn tbody,
    .s5-grid-btn,
    .s5-grid-btn tbody {
        display: block !important;
        width: 100% !important;
    }

    .s1-btn-grid tr,
    .s2-grid-btn tr,
    .s3-grid-btn tr,
    .s4-grid-btn tr,
    .s5-grid-btn tr {
        display: flex !important;
        flex-direction: column-reverse !important; /* Stacks Cancel on top, Next on bottom */
        width: 100% !important;
        gap: 12px !important;
        margin-top: 15px !important;
    }

    .s1-btn-grid td,
    .s1-btn-grid td > div,
    .s1-btn-grid td .mr-15,
    .s2-grid-btn td,
    .s2-grid-btn td > div,
    .s2-grid-btn td .mr-15,
    .s3-grid-btn td,
    .s3-grid-btn td > div,
    .s3-grid-btn td .mr-15,
    .s4-grid-btn td,
    .s4-grid-btn td > div,
    .s4-grid-btn td .mr-15,
    .s5-grid-btn td,
    .s5-grid-btn td > div,
    .s5-grid-btn td .mr-15 {
        display: block !important;
        width: 100% !important;
        margin-right: 0 !important;
        padding: 0 !important;
    }

    .s1-btn-grid button,
    .s2-grid-btn button,
    .s3-grid-btn button,
    .s4-grid-btn button,
    .s5-grid-btn button  {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 767.98px) {
    .terms {
        width: auto !important;
        margin: 0 20px !important;
    }

    .input-w-280 {
        width: 100% !important;
    }

    #idTbTitle > div.text-center.pt-80 > h4,
    #idTbTitle > div.text-center.pt-80 > h4 > label,
    .s6-container > label.f28 {
        font-size: 16px !important;
    }

    .s6-container > span.f24 {
        font-size: 14px !important;
    }
}

@media (max-width: 991.98px) {
    .reg-wrapper {
        padding-left: 2.5%;
        padding-right: 2.5%;
    }

    /* 1. Un-table the Main Form Grid */
    .s1-form-grid,
    .s1-form-grid tbody,
    .s1-form-grid tr,
    .s1-form-grid td {
        display: block !important;
        width: 100% !important;
        border: none !important;
    }

    /* Move labels to the left and sit them above the inputs */
    .s1-form-grid td.tbl_col_label {
        text-align: left !important;
        padding: 15px 0 5px 0 !important;
    }

    /* Make inputs, custom dropdown wrappers, and popup menus stretch 100% width */
    .s1-form-grid td:not(.tbl_col_label) {
        padding: 0 !important;
    }
    .s1-form-grid .dropdown,
    .s1-form-grid .h-dd-togg,
    .s1-form-grid .input-w-200,
    .s1-form-grid .input-w-202 {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Correct menu placement and 100% width on mobile */
    .s1-form-grid .dropdown-menu {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: 2px !important;
        box-sizing: border-box !important;
    }

    /* 2. Un-table the Captcha block */
    .s1-captcha-table,
    .s1-captcha-table tbody,
    .s1-captcha-table tr,
    .s1-captcha-table td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 !important;
    }
    .s1-captcha-table td {
        /*padding-bottom: 10px !important;*/
    }
    .s1-captcha-table .w210px,
    .s1-captcha-table .input-w-202 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 3. Stack the Buttons (Optional: use flex to place them side-by-side on mobile) */
    .s1-btn-grid,
    .s1-btn-grid tbody {
        display: block !important;
        width: 100% !important;
    }
    .s1-btn-grid tr {
        display: flex !important;
        justify-content: flex-end !important;
        gap: 15px !important;
        margin-top: 15px !important;
    }
    .s1-btn-grid td {
        display: block !important;
        width: auto !important;
        padding: 0 !important;
    }

    /* OTP */
    /* 1. Un-table ONLY the outer JSF panelGrid so the label stacks on top */
    #idPGTACAdd,
    #idPGTACAdd > tbody,
    #idPGTACAdd > tbody > tr,
    #idPGTACAdd > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 !important;
        border: none !important;
    }

    /* 2. Fix label spacing */
    #idPGTACAdd > tbody > tr > td:first-child {
        margin-bottom: 5px !important;
    }
    #idPGTACAdd label {
        margin-bottom: 0 !important;
    }

    /* 3. Keep inner table as a full-width table layout */
    #idPGTACAdd table {
        display: table !important;
        width: 100% !important;
    }

    /* Align input and Resend link vertically in the center of their row */
    #idPGTACAdd table > tbody > tr:first-child > td {
        display: table-cell !important;
        vertical-align: middle !important;
        padding: 0 !important;
    }

    /* 4. Let the input cell stretch, shrink the Resend cell */
    #idPGTACAdd table > tbody > tr:first-child > td:first-child {
        width: 100% !important;
    }

    #idPGTACAdd table > tbody > tr:first-child > td:last-child {
        width: 1% !important;
        white-space: nowrap !important;
        padding-left: 15px !important;
    }

    /* 5. Target the error message row (2nd row) and clean up padding */
    #idPGTACAdd table > tbody > tr:last-child > td {
        display: table-cell !important;
        padding-top: 5px !important;
    }

    #idPGTACAdd table > tbody > tr:last-child span {
        padding-left: 0 !important;
    }

    /* 6. Input styling */
    #idPGTACAdd input[type="text"],
    #idPGTACAdd input[type="password"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 1. Prevent top banner graphic from overflowing */
    .frmStep3_temp img#idGITempId {
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 0 auto !important;
    }

    /* 2. Un-table all formGrids inside Step 3 (Email & Temp ID tables) */
    .frmStep3_temp table:not(.s3-grid-btn),
    .frmStep3_temp table:not(.s3-grid-btn) > tbody,
    .frmStep3_temp table:not(.s3-grid-btn) > tbody > tr,
    .frmStep3_temp table:not(.s3-grid-btn) > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: none !important;
    }

    /* 3. Re-align labels cleanly above fields on mobile */
    .frmStep3_temp table:not(.s3-grid-btn) td:first-child {
        text-align: left !important;
        padding: 10px 0 2px 0 !important;
        width: 100% !important;
    }

    .frmStep3_temp table:not(.s3-grid-btn) td:last-child {
        text-align: left !important;
        padding: 2px 0 10px 0 !important;
        width: 100% !important;
        word-break: break-word !important; /* Prevents long emails from breaking container */
    }

    /* 4. Force Temporary ID input box to stretch 100% width */
    .frmStep3_temp input#idTempId {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        height: 38px !important;
        padding: 6px 12px !important;
    }

    .anon-el {
        display: none !important;
    }

    .moneylock-background-grey > tbody {
        padding: 0 20px;
    }

    /* Security Questions */
    #idFrmStep5 .s5-form-grid,
    #idFrmStep5 .s5-form-grid > tbody,
    #idFrmStep5 .s5-form-grid > tbody > tr,
    #idFrmStep5 .s5-form-grid > tbody > tr > td {
        display: block !important;
        width: 100% !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    #idFrmStep5 .s5-info-grid th {
        padding-left: 0 !important;
    }

    /* 2. Reset label column styling (Question and Answer) so they sit cleanly above inputs */
    #idFrmStep5 .s5-form-grid > tbody > tr > td.w15 {
        text-align: left !important;
        padding: 12px 0 5px 0 !important;
        white-space: normal !important;
    }

    /* 3. Reset input/dropdown column styling */
    #idFrmStep5 .s5-form-grid > tbody > tr > td:not(.w15) {
        padding: 0 0 10px 0 !important;
    }

    /* 4. Make dropdowns, inputs, and dropdown menus expand 100% width on mobile */
    #idFrmStep5 .w90-impl,
    #idFrmStep5 .h-dd-togg,
    #idFrmStep5 input[type="text"],
    #idFrmStep5 input[type="password"],
    #idFrmStep5 .dropdown-menu {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Singpass */
    .notice-container.pl-90 {
        padding-left: 0;
        text-align: center;
    }

    .s2-singpass-form-grid td.ct-box {
        box-sizing: border-box;
    }
}

#idTbTitle > div.text-center.pt-80 {
    padding-top: 35px;
}

.spass-ctn {
    max-width: 300px;
    margin: 0 auto;
}