body.channel-discussion-open #channel-window {
    visibility: hidden;
}

.channel-discussion-modal.hidden {
    display: none !important;
}

.channel-discussion-modal {
    position: fixed;
    inset: 0 0 0 auto;
    width: 79%;
    z-index: 1000005;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    background: #101828;
}

.channel-comment-reaction-menu {
    z-index: 1000012 !important;
}

.channel-discussion-shell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.channel-discussion-shell.drag-over {
    outline: 2px dashed rgba(96, 165, 250, 0.95);
    outline-offset: -8px;
}

.channel-discussion-shell.drag-over::after {
    content: "Отпустите фото для отправки";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.78);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
}

.channel-discussion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(73, 96, 125, 0.55);
    background: rgba(36, 49, 65, 1);
    margin-top: 0;
}

.channel-discussion-header .chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.channel-discussion-header .chat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.channel-discussion-header .chat-title,
.channel-discussion-post-card__title {
    color: white !important;
}

.channel-discussion-header .chat-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    max-width: 40px;
    min-height: 40px;
    max-height: 40px;
    border-radius: 8px;
}

.channel-discussion-header .chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: 12px;
}

.channel-discussion-header .chat-header-actions .icon-btn {
    width: auto;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: none;
    border-radius: 10px;
    background: #343c63;
    color: white;
    cursor: pointer;
}

.channel-discussion-post-preview {
    padding: 10px 12px 6px;
    background: rgba(36, 49, 65, 1);
}

.channel-discussion-post-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(73, 96, 125, 0.65);
    background: rgba(18, 24, 37, 1);
}

.channel-discussion-post-card__media {
    width: 84px;
    height: 84px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.channel-discussion-post-card__body {
    min-width: 0;
    flex: 1;
}

.channel-discussion-post-card__title {
    margin-bottom: 4px;
    font-size: 0.92rem;
    font-weight: 700;
}

.channel-discussion-post-card__text {
    color: white;
    line-height: 1.45rem;
    word-break: break-word;
}

.channel-discussion-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 132px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: radial-gradient(circle at 24% 30%, #000000, #1d2f4b);
    scrollbar-width: thin;
    scrollbar-color: rgba(112, 134, 178, 0.9) rgba(20, 29, 45, 0.5);
}

.channel-discussion-list::-webkit-scrollbar {
    width: 10px;
}

.channel-discussion-list::-webkit-scrollbar-track {
    background: rgba(20, 29, 45, 0.5);
    border-radius: 12px;
}

.channel-discussion-list::-webkit-scrollbar-thumb {
    background: rgba(112, 134, 178, 0.9);
    border-radius: 12px;
    border: 2px solid rgba(20, 29, 45, 0.5);
}

.channel-discussion-row {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.channel-discussion-row.is-me {
    justify-content: flex-end;
}

.channel-discussion-row.is-other {
    justify-content: flex-start;
}

.channel-discussion-avatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px;
    max-width: 34px;
    min-height: 34px;
    max-height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-left: 20%;
}

.channel-discussion-list .msg,
#comments-list .msg {
    max-width: min(72%, 560px);
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.35;
    word-break: break-word;
    box-sizing: border-box;
}

.channel-discussion-list .msg--me,
#comments-list .msg--me {
    align-self: flex-end;
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
    margin-right: 16%;
}

.channel-discussion-list .msg--other,
#comments-list .msg--other {
    align-self: flex-start;
    background: rgb(29, 40, 55);
    color: white;
    border-bottom-left-radius: 4px;
    margin-left: 0%;
}

.channel-discussion-list .msg--sticker,
#comments-list .msg--sticker {
    background: transparent !important;
    padding: 0 !important;
}

.channel-discussion-list .msg-time,
#comments-list .msg-time {
    display: none;
}

.channel-discussion-sender {
    margin-bottom: 6px;
    color: #8cc3ff;
    font-size: 0.9rem;
    font-weight: 700;
}

.channel-discussion-image {
    width: 100%;
    max-width: 340px;
    max-height: 320px;
    display: block;
    margin-top: 10px;
    border-radius: 10px;
    object-fit: cover;
}

.channel-discussion-sticker {
    width: min(220px, 100%);
    max-width: 220px;
    display: block;
    margin-top: 10px;
    background: transparent;
    cursor: pointer;
}

.channel-comment-reactions-list {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.channel-comment-reaction-chip {
    width: auto !important;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: white;
    cursor: pointer;
}

.channel-comment-reaction-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.channel-comment-reaction-chip.is-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 18px;
    background: #007bff;
    color: white;
}

.channel-discussion-empty {
    margin: auto;
    text-align: center;
    color: white;
}

.channel-discussion-empty__title {
    margin-bottom: 6px;
    font-size: 1.05rem;
    font-weight: 700;
}

.channel-discussion-empty__text {
    color: #cfcfcf;
}

#channel-discussion-file-preview {
    position: absolute;
    left: 0;
    bottom: 86px;
    width: 100%;
    padding: 0 12px;
    box-sizing: border-box;
    z-index: 3;
}

#channel-discussion-file-preview .comment-file-preview__inner,
#channel-discussion-file-preview .comment-file-preview__inner img {
    width: 100%;
}

.channel-discussion-footer-parent {
    position: absolute;
    left: 50%;
    bottom: 20px;
    width: min(70%, 760px);
    display: flex;
    justify-content: center;
    transform: translateX(-50%);
    z-index: 3;
}

.channel-discussion-compose.chat-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 0;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.5);
}

.channel-discussion-compose-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.channel-discussion-compose.chat-footer .msg-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    max-height: 160px;
    padding: 12px 14px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: white;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    line-height: 1.25rem;
}

.channel-discussion-compose.chat-footer .attach,
.channel-discussion-compose.chat-footer .send,
.channel-discussion-compose.chat-footer .sticker-btn {
    width: auto;
    min-width: 44px;
    height: 44px;
    padding: 4px;
    border: none;
    border-radius: 0;
    background: transparent;
    flex: 0 0 auto;
}

.channel-discussion-compose.chat-footer .sticker-btn {
    margin-left: 4px;
}

.channel-discussion-compose.chat-footer .attach {
    margin-left: 0;
    margin-right: 0;
}

.channel-discussion-compose.chat-footer .send {
    margin-right: 4px;
}

.channel-discussion-compose.chat-footer .attach img,
.channel-discussion-compose.chat-footer .send img,
.channel-discussion-compose.chat-footer .sticker-btn img {
    width: 30px;
    height: 30px;
}

.channel-discussion-compose.chat-footer .attach {
    opacity: 0.55;
}

@media (max-width: 1000px) {
    .channel-discussion-modal {
        inset: 0;
        width: 100%;
    }

    .channel-discussion-header {
        padding: 10px;
    }

    .channel-discussion-header .chat-avatar {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px;
        max-width: 34px;
        min-height: 34px;
        max-height: 34px;
    }

    .channel-discussion-list {
        padding-bottom: 118px;
    }

    .channel-discussion-list .msg,
    #comments-list .msg {
        max-width: 84%;
    }

    .channel-discussion-list .msg--me,
    #comments-list .msg--me {
        margin-right: 0;
    }

    .channel-discussion-list .msg--other,
    #comments-list .msg--other {
        margin-left: 0;
    }

    .channel-discussion-sticker {
        width: min(160px, 100%);
        max-width: 160px;
    }

    .channel-comment-reaction-chip {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    .channel-comment-reaction-chip.is-active {
        background: #007bff !important;
    }

    #channel-discussion-file-preview {
        bottom: 78px;
        padding: 0 10px;
    }

    .channel-discussion-footer-parent {
        left: 10px;
        width: calc(100% - 20px);
        transform: none;
        bottom: 10px;
    }

    .channel-discussion-avatar{
        margin-left: 0%;
    }
}

body:not(.channel-discussion-open) .channel-discussion-modal {
    display: none !important;
}

.kg-app-v2 .channel-discussion-modal {
    background: #101828;
}

.kg-app-v2 .channel-discussion-post-preview {
    flex: 0 0 auto;
}

.kg-app-v2 .channel-discussion-list {
    gap: 3px;
    padding: 14px 16px 120px;
}

.kg-app-v2 .channel-discussion-row {
    width: 100%;
}

.kg-app-v2 .channel-discussion-row.is-me {
    justify-content: flex-end;
    padding-right: 15%;
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-row.is-other {
    justify-content: flex-start;
    padding-left: 18%;
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-list .msg {
    max-width: min(620px, 64%);
    margin: 0;
}

.kg-app-v2 .channel-discussion-list .msg--me {
    margin-right: 0;
}

.kg-app-v2 .channel-discussion-list .msg--other {
    margin-left: 0;
}

.kg-app-v2 .channel-discussion-avatar {
    margin-left: 0;
}

.kg-app-v2 .channel-discussion-footer-parent {
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-compose.chat-footer {
    width: 100%;
    box-sizing: border-box;
    padding: 4px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.55);
}

.kg-app-v2 .channel-discussion-compose-row {
    width: 100%;
    gap: 8px;
    align-items: flex-end;
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-compose.chat-footer .msg-input {
    width: 100%;
    min-height: 44px;
    max-height: 200px;
    overflow-y: hidden;
    resize: none;
    transition: height 0.16s ease;
    border: 0;
    border-radius: 20px;
    background: transparent;
    box-sizing: border-box;
}

.kg-app-v2 #channel-discussion-input:focus,
.kg-app-v2 #channel-discussion-input:focus-visible {
    outline: none;
    box-shadow: none;
    border-color: transparent;
}

.kg-app-v2 .channel-discussion-compose.chat-footer .send,
.kg-app-v2 .channel-discussion-compose.chat-footer .sticker-btn {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-compose.chat-footer .attach {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 4px;
    box-sizing: border-box;
}

.kg-app-v2 .channel-discussion-compose.chat-footer .attach img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.kg-app-v2 .channel-discussion-compose.chat-footer .sticker-btn {
    transform: translateY(-2px);
}

.kg-app-v2 .channel-discussion-compose.chat-footer .send {
    margin-right: 0;
}

@media (max-width: 1000px) {
    .kg-app-v2 #channel-window,
    .kg-app-v2 .channel-discussion-modal {
        left: 0;
        right: 0;
        width: 100%;
        z-index: 100030;
    }

    .kg-app-v2 .channel-discussion-row.is-me,
    .kg-app-v2 .channel-discussion-row.is-other {
        padding-left: 0;
        padding-right: 0;
    }

    .kg-app-v2 .channel-discussion-list .msg {
        max-width: 84%;
    }

    .kg-app-v2 .channel-discussion-footer-parent {
        left: 50%;
        width: calc(100% - 16px);
        transform: translateX(-50%);
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .kg-app-v2 .channel-discussion-compose-row {
        gap: 5px;
    }

    .kg-app-v2 .channel-discussion-compose.chat-footer .attach,
    .kg-app-v2 .channel-discussion-compose.chat-footer .send,
    .kg-app-v2 .channel-discussion-compose.chat-footer .sticker-btn {
        flex-basis: 38px;
        width: 38px;
        min-width: 38px;
        height: 38px;
    }
}
