/* Customer payment and reconnect dialogs. */
body.modal-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------
   Base modal shell
   ------------------------------------------------------------------ */
.message-modal {
    align-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(12px, 3vw, 24px);
    background: rgba(8, 25, 38, .62);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.message-modal__content {
    width: min(100%, 460px);
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 30px;
    border: 1px solid #dce8eb;
    border-top: 0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(4, 23, 35, .28);
    animation: modal-enter .18s ease-out both;
}

.message-modal__content h2 {
    margin: 0 36px 9px 0;
    color: #102a43;
    font-size: clamp(21px, 4vw, 24px);
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.2;
}

.modal-eyebrow {
    margin-bottom: 8px;
    color: #16877c;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

.modal-selected-package {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    max-width: 100%;
    margin: 18px 0 20px;
    padding: 15px 16px;
    border: 1px solid #cfe8e2;
    border-radius: 9px;
    background: #eff9f6;
    color: #176c65;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#selectedPackageDetails { color: #344e5b; font-size: 14px; font-weight: 650; }
#selectedPackageAmount { flex: 0 0 auto; color: #16877c; font-size: 14px; font-weight: 700; white-space: nowrap; }
#messageModal .message-modal__content h2 { margin-right: 0; font-size: 21px; }
#messageModal .form-group { margin-top: 18px; }
#messageModal .form-group label { margin-bottom: 7px; }
#messageModal .form-group input[type="tel"] { min-height: 47px; letter-spacing: .02em; }
#messageModal .form-group input[type="tel"]:focus { border-color: #16877c; box-shadow: 0 0 0 3px rgba(22, 135, 124, .14); }
.payment-pin-note { margin: 10px 0 0; color: #687e89; font-size: 11px; text-align: center; }

.modal-hint,
.modal-security {
    color: #607783;
    font-size: 13px;
    line-height: 1.55;
}

.modal-security {
    margin: 0 0 18px;
}

.message-modal__content .form-group {
    margin: 18px 0 12px;
}

.message-modal__content .form-group label {
    display: block;
    margin-bottom: 7px;
    color: #344e5b;
    font-size: 13px;
    font-weight: 700;
}

.message-modal__content .form-group input {
    min-height: 50px;
    border: 1px solid #d5e1e6;
    border-radius: 10px;
    font-size: 16px;
}

.message-modal__content .form-group input:focus {
    border-color: #16877c;
    box-shadow: 0 0 0 3px rgba(22, 135, 124, .13);
}

.modal-close {
    top: 14px;
    right: 14px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid #e2eaed;
    border-radius: 11px;
    background: #f7fafb;
    color: #526b77;
    font-size: 25px;
}

.modal-close:hover {
    background: #edf4f5;
    color: #102a43;
}

.modal-close:focus-visible,
.modal-actions button:focus-visible,
.message-modal__content [tabindex="-1"]:focus-visible {
    outline: 3px solid rgba(22, 135, 124, .35);
    outline-offset: 2px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.modal-actions button {
    width: auto;
    min-height: 48px;
    flex: 1 1 0;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
}

.modal-actions .pay-button {
    background: #16877c;
    box-shadow: none;
}

.modal-actions .pay-button:hover {
    background: #10695f;
    box-shadow: 0 5px 13px rgba(16, 105, 95, .22);
}

.modal-actions .pay-button:disabled {
    background: #98c9c0;
}

.modal-cancel {
    border: 1px solid #d7e1e5;
    border-radius: 10px;
    background: #f5f8f9;
    color: #344e5b;
}

.modal-cancel:hover {
    background: #eaf0f2;
    box-shadow: none;
}

.message-modal[data-state="success"] .message-modal__content {
    border-top-color: #16877c;
}

.message-modal[data-state="error"] .message-modal__content {
    border-top-color: #c2413a;
}

/* ------------------------------------------------------------------
   Processing / full-screen wait state
   ------------------------------------------------------------------ */
.message-modal--processing {
    z-index: 1100;
    background: rgba(7, 24, 37, .72);
}

.message-modal--processing .payment-wait-card {
    position: relative;
    width: min(100%, 430px);
    padding: 38px 34px 34px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .8);
    border-top: 0;
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 2%, rgba(219, 246, 240, .72), transparent 35%),
        #fff;
    box-shadow: 0 32px 90px rgba(3, 19, 30, .34);
    text-align: center;
}

.payment-wait-dismiss {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff1f0;
    color: #912018;
    font: inherit;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.payment-wait-dismiss:hover { background: #fbd9d6; }
.payment-wait-dismiss:focus-visible { outline: 3px solid rgba(180, 35, 24, .25); outline-offset: 2px; }
.payment-wait-dismiss[hidden] { display: none; }

.message-modal--processing .payment-wait-card::before,
.message-modal--processing .payment-wait-card::after {
    position: absolute;
    right: 0;
    left: 0;
    height: 4px;
    content: "";
}

.message-modal--processing .payment-wait-card::before {
    top: 0;
    background: linear-gradient(90deg, #0e766c, #50c5a9, #0e766c);
}

.message-modal--processing .payment-wait-card::after {
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #32a894, transparent);
    transform: translateX(-100%);
    animation: payment-wait-progress 2.2s ease-in-out infinite;
}

.payment-wait-card h2 {
    margin: 0 0 12px;
    color: #102a43;
    font-size: clamp(23px, 5vw, 27px);
    letter-spacing: -.04em;
}

.payment-wait-card .modal-eyebrow {
    margin: 2px 0 8px;
    color: #12806f;
    letter-spacing: .16em;
}

.payment-wait-message {
    max-width: 330px;
    margin: 0 auto;
    color: #5d7480;
    font-size: 14px;
    line-height: 1.65;
}

.payment-wait-animation {
    position: relative;
    display: grid;
    width: 94px;
    height: 94px;
    margin: 0 auto 22px;
    place-items: center;
    border: 1px solid #dcefe9;
    border-radius: 50%;
    background: rgba(239, 249, 246, .8);
    box-shadow: 0 8px 24px rgba(22, 135, 124, .08);
}

.payment-wait-animation__ring {
    width: 62px;
    height: 62px;
    border: 4px solid #d8efea;
    border-top-color: #16877c;
    border-right-color: #16877c;
    border-radius: 50%;
    animation: payment-wait-spin .9s linear infinite;
}

.payment-wait-animation__dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16877c;
    animation: payment-wait-pulse 1.1s ease-in-out infinite;
}

.payment-wait-animation__dot--one { top: 6px; left: 43px; }
.payment-wait-animation__dot--two { right: 9px; bottom: 18px; animation-delay: .18s; }
.payment-wait-animation__dot--three { bottom: 18px; left: 9px; animation-delay: .36s; }

.payment-wait-error-icon {
    display: none;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: #b42318;
    color: #fff;
    animation: payment-error-enter .24s ease-out both;
}

.payment-wait-error-icon svg { width: 28px; height: 28px; }
.payment-wait-success-icon {
    display: none;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 50%;
    background: #43b02a;
    color: #fff;
    animation: payment-error-enter .24s ease-out both;
}
.payment-wait-success-icon svg { width: 28px; height: 28px; }
.payment-wait-close {
    min-width: 120px;
    min-height: 44px;
    margin-top: 22px;
    padding: 0 20px;
    border: 0;
    border-radius: 9px;
    background: #b42318;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.payment-wait-close:hover { background: #912018; }
.payment-wait-close:focus-visible { outline: 3px solid rgba(180, 35, 24, .25); outline-offset: 2px; }

.message-modal--processing[data-state="error"] .payment-wait-card::before { background: #b42318; }
.message-modal--processing[data-state="error"] .payment-wait-card::after { display: none; }
.message-modal--processing[data-state="error"] .payment-wait-animation {
    border-color: #f2c7c3;
    background: #fff5f4;
    box-shadow: 0 8px 24px rgba(180, 35, 24, .1);
}
.message-modal--processing[data-state="error"] .payment-wait-animation__ring,
.message-modal--processing[data-state="error"] .payment-wait-animation__dot { display: none; }
.message-modal--processing[data-state="error"] .payment-wait-error-icon { display: grid; }
.message-modal--processing[data-state="error"] .payment-wait-card h2 { color: #912018; }
.message-modal--processing[data-state="error"] .payment-wait-card .modal-eyebrow { color: #b42318; }
.message-modal--processing[data-state="error"] .payment-wait-message { color: #6f3430; }
.message-modal--processing[data-state="success"] .payment-wait-card::before { background: #16877c; }
.message-modal--processing[data-state="success"] .payment-wait-card::after { display: none; }
.message-modal--processing[data-state="success"] .payment-wait-animation {
    border-color: #cbe9c1;
    background: #f4fbf1;
    box-shadow: 0 8px 24px rgba(67, 176, 42, .12);
}
.message-modal--processing[data-state="success"] .payment-wait-animation__ring,
.message-modal--processing[data-state="success"] .payment-wait-animation__dot { display: none; }
.message-modal--processing[data-state="success"] .payment-wait-success-icon { display: grid; }
.message-modal--processing[data-state="success"] .payment-wait-card .modal-eyebrow { color: #10695f; }
.message-modal--processing[data-state="success"] .payment-wait-message { color: #28651c; font-weight: 700; }
.message-modal--processing[data-state="success"] .payment-wait-close { background: #16877c; }
.message-modal--processing[data-state="success"] .payment-wait-close:hover { background: #10695f; }

@keyframes payment-wait-spin {
    to { transform: rotate(360deg); }
}

@keyframes payment-wait-pulse {
    0%, 100% { opacity: .35; transform: scale(.8); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes payment-wait-progress {
    0% { transform: translateX(-100%); }
    55%, 100% { transform: translateX(100%); }
}

@keyframes payment-error-enter {
    from { opacity: 0; transform: scale(.65); }
    to { opacity: 1; transform: scale(1); }
}

/* Phone number entry modal styled after the selected customer reference. */
.message-modal:not(.message-modal--processing) {
    background: rgba(3, 10, 20, .76);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.message-modal:not(.message-modal--processing) .message-modal__content {
    position: relative;
    width: min(100%, 680px);
    max-height: calc(100dvh - 32px);
    padding: 36px;
    border: 1px solid rgba(20, 137, 116, .55);
    border-radius: 26px;
    background: linear-gradient(145deg, #0d1526 0%, #101a2b 100%);
    box-shadow: 0 0 0 1px rgba(10, 174, 139, .08), 0 24px 80px rgba(0, 0, 0, .48), 0 0 34px rgba(0, 180, 142, .1);
    color: #f6f8fb;
}

.message-modal:not(.message-modal--processing) .message-modal__content h2 {
    margin: 0 48px 24px 0;
    color: #f7f8fa;
    font-size: clamp(22px, 4vw, 27px);
    font-weight: 760;
    letter-spacing: -.025em;
    line-height: 1.2;
    text-transform: uppercase;
}

.payment-modal-description {
    margin: 0 0 24px;
    color: #d0d5dd;
    font-size: 16px;
    line-height: 1.55;
}
.payment-modal-description strong { color: #fff; font-weight: 750; white-space: nowrap; }
.payment-modal-description span { color: #e4e8ef; font-weight: 600; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.message-modal:not(.message-modal--processing) .form-group {
    margin: 0;
}
.message-modal:not(.message-modal--processing) .form-group input[type="tel"] {
    min-height: 68px;
    padding: 16px 20px;
    border: 1px solid #29384e;
    border-radius: 13px;
    background: #172235;
    color: #f7f8fa;
    font-size: 18px;
    letter-spacing: .025em;
}
.message-modal:not(.message-modal--processing) .form-group input[type="tel"]::placeholder { color: #78869b; opacity: 1; }
.message-modal:not(.message-modal--processing) .form-group input[type="tel"]:focus {
    border-color: #0bb68a;
    outline: none;
    background: #172235;
    box-shadow: 0 0 0 3px rgba(11, 182, 138, .18);
}

.message-modal:not(.message-modal--processing) .modal-actions {
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding: 0;
    border: 0;
}
.message-modal:not(.message-modal--processing) .modal-actions button {
    min-height: 52px;
    flex: 0 0 auto;
    padding: 0 23px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 650;
}
.message-modal:not(.message-modal--processing) .modal-actions .modal-cancel {
    min-width: 104px;
    border: 1px solid #465366;
    background: transparent;
    color: #d0d5dd;
}
.message-modal:not(.message-modal--processing) .modal-actions .modal-cancel:hover {
    background: #1b2739;
    color: #fff;
    transform: none;
}
.message-modal:not(.message-modal--processing) .modal-actions .pay-button {
    min-width: 140px;
    background: #08a879;
    color: #fff;
    box-shadow: none;
}
.message-modal:not(.message-modal--processing) .modal-actions .pay-button:hover {
    background: #07966d;
    box-shadow: none;
    transform: translateY(-1px);
}
.message-modal:not(.message-modal--processing) .modal-actions .pay-button:disabled {
    background: #34594f;
    color: #b5c7c1;
    cursor: not-allowed;
}
.message-modal:not(.message-modal--processing) .payment-pin-note {
    margin: 14px 0 0;
    color: #8793a5;
    font-size: 12px;
    text-align: left;
}
.message-modal:not(.message-modal--processing) .modal-close {
    top: 23px;
    right: 23px;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9aa5b5;
    font-size: 30px;
}
.message-modal:not(.message-modal--processing) .modal-close:hover {
    background: #1a2638;
    color: #fff;
}
.message-modal:not(.message-modal--processing) .modal-close:focus-visible,
.message-modal:not(.message-modal--processing) .modal-actions button:focus-visible {
    outline: 3px solid rgba(11, 182, 138, .5);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .message-modal:not(.message-modal--processing) {
        align-items: center;
        padding: 16px;
    }
    .message-modal:not(.message-modal--processing) .message-modal__content {
        width: 100%;
        max-height: calc(100dvh - 32px);
        padding: 28px 22px 24px;
        border-radius: 21px;
        animation: modal-enter .18s ease-out both;
    }
    .message-modal:not(.message-modal--processing) .message-modal__content h2 { margin-bottom: 18px; }
    .payment-modal-description { margin-bottom: 20px; font-size: 14px; }
    .message-modal:not(.message-modal--processing) .form-group input[type="tel"] { min-height: 60px; font-size: 16px; }
    .message-modal:not(.message-modal--processing) .modal-actions { flex-direction: row; margin-top: 18px; }
    .message-modal:not(.message-modal--processing) .modal-actions button { min-height: 48px; padding: 0 17px; }
    .message-modal:not(.message-modal--processing) .modal-actions .modal-cancel { min-width: 88px; }
    .message-modal:not(.message-modal--processing) .modal-actions .pay-button { min-width: 116px; }
    .message-modal:not(.message-modal--processing) .modal-close { top: 15px; right: 15px; }
}

/* ------------------------------------------------------------------
   Inline status messages
   ------------------------------------------------------------------ */
#message:empty,
#reconnectMessage:empty {
    display: none;
}

#message,
#reconnectMessage {
    margin-top: 14px;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

#message.error,
#reconnectMessage.error {
    color: #a12622;
}

#message.success,
#reconnectMessage.success {
    color: #08785d;
}

#reconnectCode {
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

@keyframes modal-enter {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------------
   Entry dialogs (non-processing): payment + purchase recovery
   ------------------------------------------------------------------ */
.message-modal:not(.message-modal--processing) {
    background: rgba(13, 29, 40, .68);
    -webkit-backdrop-filter: blur(8px) saturate(115%);
    backdrop-filter: blur(8px) saturate(115%);
}

.message-modal:not(.message-modal--processing) .message-modal__content {
    width: min(100%, 430px);
    padding: 30px;
    border: 1px solid rgba(226, 234, 237, .9);
    border-top: 0;
    border-radius: 24px;
    background: linear-gradient(180deg, #fff 0%, #fcfefe 100%);
    box-shadow: 0 32px 90px rgba(5, 24, 35, .3);
}

.message-modal:not(.message-modal--processing) .message-modal__content h2 {
    margin: 0 42px 12px 0;
    color: #102a43;
    font-size: clamp(23px, 5vw, 27px);
    font-weight: 780;
    letter-spacing: -.04em;
    line-height: 1.15;
}

.message-modal:not(.message-modal--processing) .modal-eyebrow {
    margin-bottom: 7px;
    color: #16877c;
    font-size: 10px;
    letter-spacing: .15em;
}

.modal-leading-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 0 20px;
    place-items: center;
    border: 0;
    border-radius: 17px;
    background: linear-gradient(145deg, #e3f6f1, #f2faf8);
    color: #117469;
}

.modal-leading-icon svg {
    width: 26px;
    height: 26px;
}

.message-modal:not(.message-modal--processing) .modal-selected-package {
    display: block;
    width: 100%;
    margin: 0 0 16px;
    padding: 13px 15px;
    border: 1px solid #d9ece7;
    border-radius: 13px;
    background: #f3faf8;
    color: #12685f;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.45;
}

.message-modal:not(.message-modal--processing) .modal-hint {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #667b85;
    font-size: 13px;
    line-height: 1.6;
}

.message-modal:not(.message-modal--processing) .form-group {
    margin: 0 0 12px;
}

.message-modal:not(.message-modal--processing) .form-group label {
    margin-bottom: 8px;
    color: #263f4c;
    font-size: 12px;
    font-weight: 750;
}

.message-modal:not(.message-modal--processing) .form-group input {
    width: 100%;
    min-height: 54px;
    padding: 13px 15px;
    border: 1px solid #d6e1e5;
    border-radius: 13px;
    background: #fbfdfd;
    color: #102a43;
    font-size: 17px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.message-modal:not(.message-modal--processing) .form-group input::placeholder {
    color: #96a7ae;
}

.message-modal:not(.message-modal--processing) .form-group input:focus {
    border-color: #16877c;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 135, 124, .11);
}

.message-modal:not(.message-modal--processing) .modal-security {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0 0;
    color: #687e84;
    font-size: 11px;
    line-height: 1.5;
}

.message-modal:not(.message-modal--processing) .modal-security::before {
    display: inline-grid;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    place-items: center;
    border-radius: 50%;
    background: #e7f5f0;
    color: #147867;
    content: "✓";
    font-size: 11px;
    font-weight: 800;
}

.message-modal:not(.message-modal--processing) .modal-actions {
    gap: 9px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #edf1f3;
}

.message-modal:not(.message-modal--processing) .modal-actions button {
    min-height: 50px;
    border-radius: 12px;
    font-size: 13px;
}

.message-modal:not(.message-modal--processing) .modal-actions .pay-button {
    background: #16877c;
    box-shadow: 0 5px 14px rgba(67, 176, 42, .2);
}

.message-modal:not(.message-modal--processing) .modal-actions .pay-button:hover {
    background: #10695f;
    box-shadow: 0 7px 17px rgba(55, 143, 34, .24);
    transform: translateY(-1px);
}

.message-modal:not(.message-modal--processing) .modal-actions .pay-button:disabled {
    background: #98c9c0;
    box-shadow: none;
    transform: none;
}

.message-modal:not(.message-modal--processing) .modal-actions .modal-cancel {
    border: 1px solid #dce5e8;
    background: #f7f9fa;
    color: #526b75;
}

.message-modal:not(.message-modal--processing) .modal-close {
    top: 17px;
    right: 17px;
    width: 38px;
    height: 38px;
    border: 1px solid #e6edef;
    border-radius: 12px;
    background: #f8fafa;
    color: #56707b;
    font-size: 22px;
}

.message-modal:not(.message-modal--processing) .modal-close:hover {
    background: #edf5f3;
    color: #12685f;
}

.message-modal:not(.message-modal--processing) [role="alert"].error:not(:empty) {
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid #f0d1ce;
    border-radius: 9px;
    background: #fff5f4;
}

.message-modal:not(.message-modal--processing) [role="alert"].success:not(:empty) {
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid #cce8dc;
    border-radius: 9px;
    background: #f1faf5;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 480px) {
    .message-modal {
        align-items: flex-end;
        padding: 10px;
    }

    .message-modal__content {
        width: 100%;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
        padding: 26px 20px 20px;
        border-radius: 18px 18px 14px 14px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
        flex: 0 0 auto;
    }

    /* Processing state stays centered on small screens */
    .message-modal--processing {
        align-items: center;
    }

    .message-modal--processing .payment-wait-card {
        width: min(100%, 390px);
        padding: 32px 23px 30px;
        border-radius: 22px;
    }

    .payment-wait-animation {
        width: 84px;
        height: 84px;
        margin-bottom: 19px;
    }

    .payment-wait-animation__ring {
        width: 56px;
        height: 56px;
    }

    .payment-wait-animation__dot--one { top: 1px; left: 38px; }
    .payment-wait-animation__dot--two { right: 7px; bottom: 16px; }
    .payment-wait-animation__dot--three { bottom: 16px; left: 7px; }

    /* Entry dialogs become bottom sheets */
    .message-modal:not(.message-modal--processing) {
        align-items: flex-end;
        padding: 10px;
    }

    .message-modal:not(.message-modal--processing) .message-modal__content {
        width: 100%;
        max-height: calc(100dvh - 20px);
        padding: 25px 21px 20px;
        border-radius: 24px 24px 17px 17px;
        animation: modal-sheet-enter .22s ease-out both;
    }

    .modal-leading-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 14px;
        border-radius: 13px;
    }

    .message-modal:not(.message-modal--processing) .modal-leading-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 16px;
        border-radius: 15px;
    }

    .message-modal:not(.message-modal--processing) .modal-actions {
        flex-direction: column-reverse;
    }

    .message-modal:not(.message-modal--processing) .modal-actions button {
        width: 100%;
        flex: 0 0 auto;
    }
}

@keyframes modal-sheet-enter {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .message-modal__content,
    .message-modal:not(.message-modal--processing) .message-modal__content,
    .payment-wait-animation__ring,
    .payment-wait-animation__dot,
    .payment-wait-error-icon,
    .payment-wait-success-icon {
        animation: none;
    }

    .message-modal--processing .payment-wait-card::after {
        animation: none;
        transform: translateX(0);
    }
}

/* Keep the customer payment modal aligned with the portal's light palette. */
.message-modal:not(.message-modal--processing) {
    background: rgba(16, 42, 67, .48);
}
.message-modal:not(.message-modal--processing) .message-modal__content {
    background: #fff;
    border: 1px solid #e0e9ed;
    box-shadow: 0 28px 80px rgba(4, 23, 35, .24);
    color: #102a43;
}
.message-modal:not(.message-modal--processing) .message-modal__content h2 { color: #102a43; }
.message-modal:not(.message-modal--processing) .payment-modal-description { color: #52606d; }
.message-modal:not(.message-modal--processing) .payment-modal-description strong { color: #16877c; }
.message-modal:not(.message-modal--processing) .payment-modal-description span { color: #334e68; }
.message-modal:not(.message-modal--processing) .form-group input[type="tel"] {
    border-color: #cbd5e1;
    background: #f7fafc;
    color: #102a43;
}
.message-modal:not(.message-modal--processing) .form-group input[type="tel"]::placeholder { color: #829ab1; }
.message-modal:not(.message-modal--processing) .form-group input[type="tel"]:focus {
    border-color: #16877c;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 135, 124, .14);
}
.message-modal:not(.message-modal--processing) .modal-actions {
    justify-content: flex-end;
    flex-direction: row;
    padding: 0;
    border: 0;
}
.message-modal:not(.message-modal--processing) .modal-actions button {
    width: auto;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 15px;
    font-size: 14px;
}
.message-modal:not(.message-modal--processing) .modal-actions .modal-cancel {
    border-color: #cbd5e1;
    background: transparent;
    color: #334e68;
}
.message-modal:not(.message-modal--processing) .modal-actions .modal-cancel:hover { background: #f1f5f9; color: #102a43; }
.message-modal:not(.message-modal--processing) .modal-actions .pay-button { background: #16877c; color: #fff; }
.message-modal:not(.message-modal--processing) .modal-actions .pay-button:hover { background: #10695f; }
.message-modal:not(.message-modal--processing) .modal-actions .pay-button:disabled {
    background: #d9e8e5;
    color: #42615c;
    opacity: 1;
}
.message-modal:not(.message-modal--processing) .payment-pin-note { color: #627d98; text-align: left; }
.message-modal:not(.message-modal--processing) .modal-close {
    border: 0;
    background: transparent;
    color: #829ab1;
}
.message-modal:not(.message-modal--processing) .modal-close:hover { background: #f1f5f9; color: #102a43; }

@media (max-width: 480px) {
    .message-modal:not(.message-modal--processing) { align-items: center; padding: 16px; }
    .message-modal:not(.message-modal--processing) .message-modal__content {
        width: 100%;
        padding: 28px 22px 24px;
        border-radius: 21px;
        animation: modal-enter .18s ease-out both;
    }
    .message-modal:not(.message-modal--processing) .modal-actions { flex-direction: row; }
    .message-modal:not(.message-modal--processing) .modal-actions button { width: auto; }
}

#messageModal .message-modal__content { background: #fff; }
#messageModal .message-modal__content h2 { color: #102a43; }
#messageModal .payment-modal-description { color: #52606d; }
#messageModal .payment-modal-description strong { color: #16877c; }
#messageModal .payment-modal-description span { color: #334e68; }
#messageModal .form-group input[type="tel"] { background: #f7fafc; border-color: #cbd5e1; color: #102a43; }
#messageModal .form-group input[type="tel"]::placeholder { color: #829ab1; }
#messageModal .phone-number-hint { margin: 7px 0 0; color: #627d98; font-size: 12px; }
#messageModal .modal-close { background: transparent; border: 0; color: #829ab1; }
#messageModal .modal-actions { justify-content: flex-end; flex-direction: row; padding: 0; border: 0; }
#messageModal .modal-actions button { width: auto; flex: 0 0 auto; min-height: 42px; padding: 0 15px; font-size: 14px; }
#messageModal .modal-actions .modal-cancel { background: transparent; border-color: #cbd5e1; color: #334e68; }
#messageModal .modal-actions .pay-button { background: #16877c; color: #fff; }
#messageModal .modal-actions .pay-button:disabled { background: #d9e8e5; color: #42615c; opacity: 1; }
#messageModal .payment-pin-note { color: #627d98; text-align: left; }

@media (max-width: 480px) {
    #messageModal { align-items: center; padding: 16px; }
    #messageModal .message-modal__content { width: 100%; padding: 28px 22px 24px; border-radius: 21px; }
    #messageModal .modal-actions { flex-direction: row; }
    #messageModal .modal-actions button { width: auto; }
}

/* Polished payment status dialog: calm, centered, and easy to scan. */
.message-modal__content { border-top: 0; }
.message-modal--processing {
    background:
        radial-gradient(ellipse at 50% 20%, rgba(22, 135, 124, .18), transparent 55%),
        rgba(8, 12, 30, .78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.message-modal--processing .payment-wait-card {
    width: min(100%, 570px);
    padding: 54px clamp(24px, 6vw, 58px) 42px;
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 34px 100px rgba(3, 8, 25, .4);
}

.message-modal--processing .payment-wait-card::before { display: none; }

.message-modal--processing .payment-wait-card::after { display: none; }

.message-modal--processing .payment-wait-animation {
    width: 108px;
    height: 108px;
    margin-bottom: 27px;
    border: 0;
    background: #eaf7f4;
    box-shadow: 0 0 0 8px rgba(22, 135, 124, .08);
}

.message-modal--processing .payment-wait-animation__ring {
    width: 76px;
    height: 76px;
    border-width: 5px;
    border-color: #d4ebe6;
    border-top-color: #16877c;
    border-right-color: #16877c;
}

.message-modal--processing .payment-wait-animation__dot { background: #16877c; }
.message-modal--processing .payment-wait-card .modal-eyebrow {
    margin: 0 0 11px;
    color: #16877c;
    font-size: 11px;
    letter-spacing: .19em;
    text-transform: uppercase;
}

.message-modal--processing .payment-wait-card h2 {
    margin: 0 0 12px;
    color: #171a2a;
    font-size: clamp(24px, 5vw, 30px);
    font-weight: 650;
    letter-spacing: -.035em;
    line-height: 1.2;
}

.message-modal--processing .payment-wait-message {
    max-width: 400px;
    color: #737786;
    font-size: 15px;
    line-height: 1.65;
}

.message-modal--processing .payment-wait-close {
    min-width: 160px;
    min-height: 46px;
    margin-top: 26px;
    padding: 0 22px;
    border: 1px solid #d9d8e4;
    border-radius: 999px;
    background: #fff;
    color: #555766;
    font-size: 14px;
    font-weight: 650;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.message-modal--processing .payment-wait-close:hover {
    border-color: #a9d7cd;
    background: #f0f8f6;
    color: #10695f;
    transform: translateY(-1px);
}

.message-modal--processing .payment-wait-close:focus-visible,
.message-modal--processing .payment-wait-dismiss:focus-visible {
    outline: 3px solid rgba(22, 135, 124, .28);
    outline-offset: 3px;
}

.message-modal--processing .payment-wait-dismiss {
    top: 15px;
    right: 15px;
    width: 38px;
    height: 38px;
    background: #f4f4f7;
    color: #777989;
    font-size: 24px;
}

.message-modal--processing .payment-wait-dismiss:hover { background: #e8f2f0; color: #263f4c; }

.message-modal--processing[data-state="error"] .payment-wait-card::before { background: #d94e53; }
.message-modal--processing[data-state="error"] .payment-wait-animation {
    border: 0;
    background: #fff0f0;
    box-shadow: 0 0 0 8px rgba(217, 78, 83, .08);
}
.message-modal--processing[data-state="error"] .payment-wait-error-icon {
    width: 62px;
    height: 62px;
    background: linear-gradient(145deg, #ef7272, #d94e53);
    box-shadow: 0 8px 20px rgba(217, 78, 83, .2);
}
.message-modal--processing[data-state="error"] .payment-wait-card h2 { color: #202130; }
.message-modal--processing[data-state="error"] .payment-wait-card .modal-eyebrow { color: #d94e53; }
.message-modal--processing[data-state="error"] .payment-wait-message { color: #696b79; }
.message-modal--processing[data-state="error"] .payment-wait-close {
    border-color: #d9d8e4;
    background: #fff;
    color: #555766;
}
.message-modal--processing[data-state="error"] .payment-wait-close:hover { background: #f0f8f6; color: #10695f; }

.message-modal--processing[data-state="success"] .payment-wait-animation {
    border: 0;
    background: #edfaf3;
    box-shadow: 0 0 0 8px rgba(34, 155, 99, .08);
}
.message-modal--processing[data-state="success"] .payment-wait-success-icon {
    width: 62px;
    height: 62px;
    background: linear-gradient(145deg, #42c98a, #16875c);
    box-shadow: 0 8px 20px rgba(22, 135, 92, .2);
}
.message-modal--processing[data-state="success"] .payment-wait-card h2 { color: #202130; }
.message-modal--processing[data-state="success"] .payment-wait-card .modal-eyebrow { color: #16875c; }
.message-modal--processing[data-state="success"] .payment-wait-message { color: #626b69; font-weight: 400; }
.message-modal--processing[data-state="success"] .payment-wait-close {
    border-color: #d9d8e4;
    background: #fff;
    color: #555766;
}

@media (max-width: 480px) {
    .message-modal--processing .payment-wait-card {
        padding: 48px 24px 32px;
        border-radius: 20px;
    }
    .message-modal--processing .payment-wait-animation { width: 94px; height: 94px; }
    .message-modal--processing .payment-wait-animation__ring { width: 68px; height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
    .message-modal--processing .payment-wait-close { transition: none; }
}

/* Keep the phone-entry dialog in the same visual family as payment status. */
#messageModal .message-modal__content {
    width: min(100%, 570px);
    padding: 42px clamp(24px, 5vw, 48px) 38px;
    border: 1px solid #e0e9ed;
    border-top: 0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 34px 100px rgba(3, 8, 25, .32);
    color: #102a43;
}

#messageModal .message-modal__content h2 {
    margin: 0 44px 14px 0;
    color: #171a2a;
    font-size: clamp(24px, 5vw, 30px);
    font-weight: 650;
    letter-spacing: -.035em;
    line-height: 1.2;
    text-transform: none;
}

#messageModal .payment-modal-description {
    margin: 0 0 20px;
    color: #737786;
    font-size: 15px;
    line-height: 1.65;
}

#messageModal .payment-modal-description strong { color: #16877c; }
#messageModal .payment-modal-description span { color: #334e68; }
#messageModal .form-group input[type="tel"] {
    min-height: 54px;
    border-color: #d5e1e5;
    border-radius: 12px;
    background: #f7fafc;
    color: #102a43;
    font-size: 16px;
}
#messageModal .form-group input[type="tel"]:focus {
    border-color: #16877c;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 135, 124, .14);
}
#messageModal .modal-close {
    top: 15px;
    right: 15px;
    color: #829ab1;
}
#messageModal .modal-close:hover { background: #e8f2f0; color: #263f4c; }
#messageModal .modal-actions { margin-top: 20px; }
#messageModal .modal-actions button { min-height: 46px; border-radius: 999px; }
#messageModal .modal-actions .modal-cancel { border-color: #d9d8e4; }
#messageModal .payment-pin-note { margin-top: 14px; color: #737786; }

/* Explicitly suppress top edges and accent strips for every status state. */
.message-modal .message-modal__content,
.message-modal[data-state="error"] .message-modal__content,
.message-modal[data-state="success"] .message-modal__content,
.message-modal--processing .payment-wait-card {
    border-top: 0;
}
.message-modal--processing .payment-wait-card::before { display: none; }

@media (max-width: 480px) {
    #messageModal .message-modal__content { padding: 38px 22px 28px; }
    #messageModal .message-modal__content h2 { margin-bottom: 14px; }
}
