.messages-list-v2,
.messages-list-wrapper-v3 {
    overflow: visible !important;
}

.messages-list-wrapper-v3 {
    position: relative;
}

.messages-row-menu-v3 {
    position: relative;
}

.messages-row-menu-v3[open] {
    z-index: 400;
}

.messages-row-menu-v3 > div {
    top: 46px;
    right: 4px;
    z-index: 420;
    width: 248px;
    max-height: min(360px, 62vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.messages-list-wrapper-v3:nth-last-child(-n + 3) .messages-row-menu-v3 > div {
    top: auto;
    bottom: 46px;
}

.messages-conversation-v31 {
    position: relative;
}

.messages-thread-v31 {
    padding-bottom: 18px;
}

.messages-new-update-v31 {
    position: sticky;
    top: 8px;
    z-index: 30;
    margin: 8px auto 0;
    padding: 8px 14px;
    display: block;
    border: 0;
    border-radius: 999px;
    background: #5d5fef;
    color: #fff;
    box-shadow: 0 8px 24px rgba(63, 66, 160, .24);
    cursor: pointer;
    font-weight: 800;
}

.messages-new-update-v31[hidden] {
    display: none;
}

.message-row-v31 {
    position: relative;
}

.message-bubble-v31 {
    overflow: visible;
}

.message-reply-quote-v31 {
    margin-bottom: 2px;
    padding: 7px 9px;
    display: grid;
    gap: 2px;
    border-left: 3px solid rgba(255, 255, 255, .7);
    border-radius: 9px;
    background: rgba(255, 255, 255, .14);
}

.message-row-v31:not(.own) .message-reply-quote-v31 {
    border-left-color: #5d5fef;
    background: #f1f2f8;
}

.message-reply-quote-v31 strong,
.message-reply-quote-v31 span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-reply-quote-v31 strong {
    font-size: 11px;
    font-weight: 900;
}

.message-reply-quote-v31 span {
    font-size: 11px;
    opacity: .82;
}

.message-attachments-v31 {
    display: grid;
    gap: 8px;
}

.message-image-link-v31 {
    display: block;
}

.message-image-v31,
.message-video-v31 {
    width: min(420px, 100%);
    max-height: 420px;
    display: block;
    border-radius: 13px;
    object-fit: cover;
    background: #111;
}

.message-video-v31 {
    object-fit: contain;
}

.message-file-v31 {
    min-width: 210px;
    max-width: 380px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .15);
    color: inherit;
    text-decoration: none;
}

.message-row-v31:not(.own) .message-file-v31 {
    background: #f1f2f8;
}

.message-file-v31 > span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.message-file-v31 strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-file-v31 small {
    opacity: .72;
}

.message-voice-v31 {
    min-width: 260px;
    max-width: 390px;
    padding: 9px 11px;
    display: grid;
    gap: 7px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .15);
}

.message-row-v31:not(.own) .message-voice-v31 {
    background: #f1f2f8;
}

.message-voice-v31 audio {
    width: 100%;
    max-width: 360px;
}

.message-reactions-v31 {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.message-reactions-v31 span {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .17);
    font-size: 11px;
    font-weight: 900;
}

.message-row-v31:not(.own) .message-reactions-v31 span {
    background: #eff0f5;
}

.message-footer-v31 {
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.message-actions-v31 {
    position: relative;
}

.message-actions-v31 > summary {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    font-size: 18px;
    line-height: 1;
    opacity: .82;
}

.message-actions-v31 > summary::-webkit-details-marker {
    display: none;
}

.message-actions-v31[open] > summary {
    background: rgba(255, 255, 255, .16);
}

.message-row-v31:not(.own) .message-actions-v31[open] > summary {
    background: #eceef4;
}

.message-actions-v31 > div {
    position: absolute;
    right: 0;
    bottom: 31px;
    z-index: 500;
    width: 226px;
    max-height: min(390px, 70vh);
    padding: 7px;
    overflow-y: auto;
    border: 1px solid #e0e2ea;
    border-radius: 14px;
    background: #fff;
    color: #303548;
    box-shadow: 0 18px 55px rgba(25, 27, 43, .24);
}

.message-actions-v31 button {
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}

.message-actions-v31 button:hover {
    background: #f2f3f8;
}

.message-actions-v31 button.danger {
    color: #b83232;
}

.message-reaction-picker-v31 {
    margin: 3px 0 6px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.message-reaction-picker-v31 button {
    padding: 7px 2px;
    text-align: center;
    font-size: 18px;
}

.message-compose-reply-v31 {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e5e7ee;
    background: #f5f5ff;
}

.message-compose-reply-v31[hidden] {
    display: none;
}

.message-compose-reply-v31 > div {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 2px;
    padding-left: 9px;
    border-left: 3px solid #5d5fef;
}

.message-compose-reply-v31 strong {
    color: #4f52d4;
    font-size: 11px;
}

.message-compose-reply-v31 span {
    overflow: hidden;
    color: #606578;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.message-compose-reply-v31 > button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
}

.messages-composer-v31 {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px 46px;
    gap: 6px;
    align-items: end;
}

.message-attach-button-v31,
.message-voice-button-v31 {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: #f0f1f7;
    color: #555b70;
    cursor: pointer;
    font-size: 20px;
}

.message-media-dialog-v31 {
    width: min(620px, calc(100vw - 28px));
    max-height: min(760px, calc(100vh - 34px));
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(24, 27, 45, .26);
}

.message-media-dialog-v31::backdrop {
    background: rgba(20, 22, 35, .45);
}

.message-media-dialog-v31 > header {
    padding: 18px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9eaf0;
}

.message-media-dialog-v31 > header span {
    color: #5d5fef;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .16em;
}

.message-media-dialog-v31 > header h3 {
    margin: 3px 0 0;
    font-size: 22px;
}

.message-media-dialog-v31 > header button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: #f1f2f7;
    cursor: pointer;
    font-size: 20px;
}

.message-media-form-v31 {
    padding: 15px 20px;
    display: grid;
    gap: 10px;
    border-bottom: 1px solid #eceef3;
}

.message-media-form-v31:last-child {
    border-bottom: 0;
}

.message-media-form-v31 label {
    display: grid;
    gap: 7px;
}

.message-media-form-v31 input[type="file"],
.message-media-form-v31 input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

.message-media-form-v31 button {
    justify-self: start;
    padding: 9px 14px;
    border: 0;
    border-radius: 11px;
    background: #5d5fef;
    color: #fff;
    cursor: pointer;
    font-weight: 800;
}

.message-voice-recorder-v31 {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    min-width: 340px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ffd6d6;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 60px rgba(30, 31, 48, .25);
}

.message-voice-recorder-v31[hidden] {
    display: none;
}

.message-voice-recorder-v31 > span:nth-of-type(2) {
    flex: 1;
}

.message-voice-recorder-v31 button {
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.message-voice-recorder-v31 #sendVoiceV31 {
    background: #5d5fef;
    color: #fff;
}

@media (max-width: 700px) {
    .messages-row-menu-v3 > div {
        position: fixed !important;
        inset: auto 12px 78px 12px !important;
        width: auto !important;
        max-height: 56vh;
        z-index: 900;
    }

    .message-actions-v31 > div {
        position: fixed;
        inset: auto 12px 72px 12px;
        width: auto;
        max-height: 62vh;
        z-index: 950;
    }

    .messages-composer-v31 {
        grid-template-columns: 38px minmax(0, 1fr) 38px 42px;
    }

    .message-voice-recorder-v31 {
        right: 10px;
        bottom: 78px;
        left: 10px;
        min-width: 0;
    }

    .message-image-v31,
    .message-video-v31 {
        width: min(78vw, 380px);
    }

    .message-voice-v31 {
        min-width: min(72vw, 280px);
    }
}
