.messaging-v2-modal {
    position: fixed;
    inset: 0;
    z-index: 3100;
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    padding: 16px;
    display: flex;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.32);
}

.messaging-v2-modal[hidden] {
    display: none !important;
}

.messaging-v2-modal__panel {
    position: relative;
    box-sizing: border-box;
    width: min(100%, 420px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 20px;
    overflow-y: auto;
    border-radius: 20px;
    background: #fff;
    color: #111827;
    box-shadow: 0 18px 48px rgba(7, 26, 47, 0.18);
}

.messaging-v2-modal__close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #eef1f4;
    color: #667781;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.messaging-v2-modal__heading {
    padding: 4px 38px 18px;
    display: grid;
    justify-items: center;
    gap: 4px;
    text-align: center;
}

.messaging-v2-modal__heading h2 {
    margin: 0;
    color: #7b8490;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

.messaging-v2-modal__recipient {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    color: #111827;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messaging-v2-modal form {
    display: grid;
    gap: 12px;
}

.messaging-v2-modal__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.messaging-v2-modal textarea {
    box-sizing: border-box;
    width: 100%;
    height: clamp(140px, 24dvh, 156px);
    min-height: 140px;
    max-height: 160px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    outline: 0;
    resize: none;
    direction: rtl;
    background: #f1f5f9;
    color: #111827;
    font: inherit;
    font-size: 16px;
    line-height: 1.7;
    text-align: right;
}

.messaging-v2-modal textarea::placeholder {
    color: #8a96a3;
}

.messaging-v2-modal textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.messaging-v2-modal button[type="submit"],
.messaging-v2-modal__secondary {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #123b68;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.messaging-v2-modal button[type="submit"]:disabled {
    background: #9aabba;
    cursor: not-allowed;
}

.messaging-v2-modal__error {
    margin: 0;
    color: #b42318;
    font-size: 13px;
    line-height: 1.6;
}

.messaging-v2-modal__success {
    padding: 18px 0 0;
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
}

.messaging-v2-modal__success[hidden] {
    display: none;
}

.messaging-v2-modal__success .messaging-v2-modal__recipient {
    margin: 0;
}

.messaging-v2-modal__success-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e8f7ed;
    color: #22a447;
    font-size: 22px;
    font-weight: 800;
}

.messaging-v2-modal__success h2 {
    margin: 0 0 6px;
    color: #374151;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
}

.messaging-v2-modal__secondary {
    margin-top: 4px;
}

@media (max-height: 520px) {
    .messaging-v2-modal {
        align-items: flex-start;
    }

    .messaging-v2-modal__panel {
        margin-block: auto;
    }

    .messaging-v2-modal__heading {
        padding-bottom: 12px;
    }
}
