.message-content {
    position: relative;
}

.chat-message-actions {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: 2px;
    z-index: 12;
}

.chat-message-menu-button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 11px;
    color: #aebbd0;
    background: rgba(7, 14, 28, .42);
    box-shadow: none;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s ease;
}

.chat-message-menu-button:hover,
.chat-message-menu-button[aria-expanded="true"] {
    border-color: rgba(96, 165, 250, .48);
    color: #f8fafc;
    background: rgba(59, 130, 246, .16);
}

.chat-message-menu-button:active {
    transform: scale(.96);
}

.chat-message-menu-button:focus-visible,
.chat-message-menu button:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.chat-message-menu {
    position: absolute;
    right: 0;
    left: auto;
    top: calc(100% + 7px);
    z-index: 90;
    display: grid;
    min-width: 205px;
    padding: 7px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 14px;
    background: rgba(12, 22, 40, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
    backdrop-filter: blur(18px);
}

.chat-message-menu[hidden] {
    display: none;
}

.chat-message-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 0;
    border-radius: 10px;
    color: #dce6f5;
    background: transparent;
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.chat-message-menu button i {
    width: 18px;
    color: #93c5fd;
    text-align: center;
}

.chat-message-menu button:hover {
    background: rgba(96, 165, 250, .12);
}

.chat-message-menu button.is-danger {
    color: #fecaca;
}

.chat-message-menu button.is-danger i {
    color: #fb7185;
}

.chat-message-menu button.is-danger:hover {
    background: rgba(244, 63, 94, .13);
}

.chat-action-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
}

.chat-action-modal[hidden],
.chat-action-dialog form[hidden],
.chat-action-result[hidden] {
    display: none;
}

.chat-action-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 20, .76);
    backdrop-filter: blur(8px);
}

.chat-action-dialog {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 22px;
    border: 1px solid rgba(96, 165, 250, .22);
    border-radius: 22px;
    color: #e8eef8;
    background: linear-gradient(145deg, rgba(20, 32, 56, .99), rgba(10, 18, 34, .99));
    box-shadow: 0 30px 90px rgba(0, 0, 0, .58);
}

.chat-action-dialog > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.chat-action-dialog h2 {
    margin: 3px 0 0;
    font-size: 1.35rem;
}

.chat-action-dialog .eyebrow {
    color: #93c5fd;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.chat-action-dialog .icon-button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 11px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
}

.chat-action-message-preview,
.chat-action-warning {
    margin-bottom: 16px;
    padding: 13px 14px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 13px;
    background: rgba(2, 8, 20, .28);
}

.chat-action-message-preview > span {
    color: #93a4bd;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.chat-action-message-preview blockquote {
    margin: 7px 0 0;
    color: #e2e8f0;
}

.chat-action-dialog form,
.chat-action-dialog label {
    display: grid;
    gap: 8px;
}

.chat-action-dialog form {
    gap: 15px;
}

.chat-action-dialog label > span {
    color: #cbd5e1;
    font-size: .82rem;
    font-weight: 750;
}

.chat-action-dialog select,
.chat-action-dialog textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 12px;
    color: #f1f5f9;
    background: rgba(3, 10, 24, .72);
}

.chat-action-dialog select {
    min-height: 44px;
    padding: 0 12px;
}

.chat-action-dialog textarea {
    padding: 11px 12px;
    resize: vertical;
}

.chat-action-dialog select:focus,
.chat-action-dialog textarea:focus {
    border-color: #60a5fa;
    outline: 2px solid rgba(96, 165, 250, .18);
}

.chat-action-warning {
    margin: 0;
    border-color: rgba(251, 113, 133, .2);
    color: #fecdd3;
    font-size: .82rem;
}

.chat-action-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 4px;
}

.chat-action-result {
    margin: 16px 0 0;
    padding: 11px 13px;
    border-radius: 11px;
    background: rgba(52, 211, 153, .12);
}

body.chat-action-open {
    overflow: hidden;
}

.chat-message.role-bot {
    gap: 9px;
    padding-block: 8px;
    border-color: rgba(96, 165, 250, .1);
    background: rgba(30, 58, 92, .18);
}

.chat-message.role-bot .message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    opacity: .82;
}

.chat-message.role-bot .message-meta strong {
    font-size: .8rem;
}

.chat-message.role-bot .message-text {
    color: #aebbd0;
    font-size: .86rem;
}

.chat-message.role-bot .chat-social-actions,
.chat-message.role-bot .chat-reaction-counts,
.chat-message.role-bot .chat-message-actions {
    display: none !important;
}

@media (max-width: 720px) {
    .chat-message-menu-button {
        width: 38px;
        height: 38px;
    }

    .chat-message-menu {
        min-width: 190px;
        max-width: calc(100vw - 34px);
    }

    .chat-action-modal {
        align-items: end;
        padding: 10px;
    }

    .chat-action-dialog {
        max-height: calc(100vh - 20px);
        padding: 18px;
        border-radius: 20px;
    }

    .chat-action-dialog-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}
