.messages-container{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column;gap:4px}

.msg-reaction:hover{transform:scale(1.15)}.msg-other .msg-reaction{background:var(--bg)}

/* Анимированные реакции */
.msg-reaction {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55) !important;
    font-size: 16px !important;
    padding: 4px 10px !important;
.msg-reaction:hover {
    transform: scale(1.3) !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2) !important;
.msg-reaction:active {
    animation: reactionPop 0.4s ease !important;
@keyframes reactionPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.5); }
    100% { transform: scale(1); }

/* Крупные смайлы в сообщениях */
    font-size: 16px !important;
    line-height: 1.5 !important;
/* Если сообщение состоит ТОЛЬКО из эмодзи - делаем huge */
    font-size: 48px !important;
    background: transparent !important;
    padding: 5px !important;
/* Эмодзи в тексте крупнее */
    font-size: 24px !important;
    vertical-align: middle;
.unread-divider{text-align:center;margin:16px 0;color:var(--danger);font-size:12px;font-weight:600}
.unread-divider span{background:rgba(239,68,68,0.1);padding:4px 16px;border-radius:10px}

/* Анимации сообщений */
@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }

/* Свайп влево (ответ) */

/* Свайп вправо (действия) */
.swipe-actions button {
    flex: 1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;




/* Свайп для чатов */
.chat-item {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
.chat-item 

/* Фикс наезжания сообщений */
.msg-content {
    max-width: 100%;
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    height: auto;
    display: block;

/* ФИКС: сообщение не обрезается */
    overflow: visible !important;
    display: flex;
    flex-direction: column;
.msg-content {
    overflow: visible !important;
    position: relative;
    z-index: 1;
    margin-top: 4px !important;
    padding-top: 2px;
    flex-shrink: 0;
    font-size: 11px !important;
    opacity: 0.7;
    white-space: nowrap;
    font-size: 11px !important;

/* Фикс для изображений в сообщении */
    margin-bottom: 4px;
    border-radius: 12px !important;
    border-radius: 12px !important;

/* Сообщение не обрезается снизу */



/* ФИКС ОТОБРАЖЕНИЯ СООБЩЕНИЙ */
    display: flex;
    flex-direction: column;
    padding: 8px 12px 6px 12px !important;
    margin-bottom: 5px;
    margin-bottom: 4px;
    margin-bottom: 5px;
    margin-top: 4px !important;
    padding-top: 4px !important;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 4px !important;
    min-height: 16px;
    font-size: 11px !important;
    opacity: 0.7;
    font-size: 11px !important;
    margin-left: 2px;

/* ПОЛНЫЙ ФИКС СООБЩЕНИЙ */

    padding: 10px 14px 8px 14px !important;
    border-radius: 16px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative;
    display: inline-block;
    max-width: 100%;
    min-width: 60px;

/* Текст внутри облака */
    margin-bottom: 4px;
    padding-right: 50px; /* место для времени */

/* Изображение в облаке */
    margin-bottom: 6px;
    border-radius: 12px !important;
    overflow: hidden;
    display: block;
    width: 100%;
    border-radius: 12px !important;

/* Реакции */
.msg-reactions {
    margin-bottom: 6px;
    margin-top: 2px;

/* Подвал с временем и статусом */
    position: absolute;
    bottom: 6px;
    right: 10px;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
    font-size: 11px !important;
    opacity: 0.8;
    white-space: nowrap;
    pointer-events: none;

    font-size: 11px !important;
    color: inherit;

    font-size: 10px !important;
    margin-left: 1px;

/* Моё сообщение */
    background: #4F8CFF !important;
    color: #fff !important;
    border-bottom-right-radius: 4px !important;
    color: rgba(255,255,255,0.7);

/* Чужое сообщение */
    background: #2a2a3e !important;
    color: #e0e0e0 !important;
    border-bottom-left-radius: 4px !important;
    color: rgba(255,255,255,0.5);

/* Облако с текстом должно быть достаточно высоким */
    min-height: 36px;
    padding-bottom: 22px !important;

/* Если нет текста, только фото */
    padding-bottom: 8px !important;


/* ФИКС: фото + подпись снизу */
    padding-bottom: 22px !important;
    position: absolute;
    bottom: 4px;
    right: 8px;
    position: absolute;
    bottom: 4px;
    right: 8px;
/* Если нет ни фото ни текста - не показываем */
    position: relative !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    margin-top: 2px !important;
/* НОВАЯ СТРУКТУРА СООБЩЕНИЙ */

    padding: 8px 12px !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    max-width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: break-word;

/* Фото/файл - сверху */
    order: 1;
    margin-bottom: 4px;
    border-radius: 12px !important;
    overflow: hidden;

/* Текст - под фото */
    order: 2;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;

/* Реакции */
.msg-reactions {
    order: 3;
    margin: 2px 0;

/* Время и статус - снизу */
    order: 4;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    padding-top: 2px;
    margin-top: 2px;

    background: #4F8CFF !important;
    color: #fff !important;
    color: rgba(255,255,255,0.7);
    background: #2a2a3e !important;
    color: #e0e0e0 !important;
    color: rgba(255,255,255,0.5);

    font-size: 11px !important;

/* Длинные сообщения */
    max-height: 300px;
    overflow: hidden;
    position: relative;
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--msg-mine, #4F8CFF));
    pointer-events: none;
    background: linear-gradient(transparent, #2a2a3e);
    max-height: none;
    overflow: visible;
    display: none;

/* Кнопка "Читать далее" */
.msg-read-more {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    text-align: center;
    opacity: 0.8;
    transition: opacity 0.2s;
    user-select: none;
.msg-read-more:hover {
    opacity: 1;
.msg-mine .msg-read-more {
    color: rgba(255,255,255,0.9);
.msg-other .msg-read-more {
    color: var(--primary, #4F8CFF);

/* ФОТО В СООБЩЕНИЯХ - ПРОСТО И ПРАВИЛЬНО */
    width: 220px;
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 6px;
    background: #1a1a2e;
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;

/* Облако сообщения */
    display: flex;
    flex-direction: column;
    padding: 8px !important;
    border-radius: 16px !important;
    max-width: 400px !important;
    overflow: visible !important;

/* Текст */
    padding: 0 4px;
    margin-bottom: 4px;
    word-break: break-word;
    line-height: 1.5;

/* Подвал */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    font-size: 11px;
    margin-top: auto;

    background: #4F8CFF;
    color: #fff;
}
    background: #2a2a3e;
    color: #e0e0e0;
}

/* Нижний блок: реакции + время */
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 4px;
    gap: 8px;
}
.msg-reactions {
    flex: 1;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
    color: rgba(255,255,255,0.7);
}
    color: rgba(255,255,255,0.5);
}
    font-size: 11px;
}

/* ЧИСТАЯ СТРУКТУРА ОБЛАКА */
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 8px !important;
    border-radius: 16px !important;
    max-width: 100% !important;
    min-width: 60px !important;
}

/* Фото */
    width: 250px;
    height: 250px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Текст */
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    padding: 0 4px;
}

/* Реакции */
.msg-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0 4px;
}

/* Время */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 0 4px 2px 4px;
    opacity: 0.8;
}

    background: #4F8CFF;
    color: #fff;
}
    color: rgba(255,255,255,0.7);
}
    background: #2a2a3e;
    color: #e0e0e0;
}
    color: rgba(255,255,255,0.5);
}

    font-size: 11px;
}
    color: inherit;
}

/* Убираем старые костыли */


/* ФИНАЛЬНЫЕ СТИЛИ ОБЛАКА */

/* Фото */

/* Текст */

/* Время */

/* Цвета */

.msg-time, .msg-status {
    font-size: 11px !important;
}

/* ВСЕ СТИЛИ ДЛЯ ФОТО В CSS */

/* Облако */

/* Время */

/* МИНИАТЮРЫ 350×350 */

/* ОБЛАКО РЕЗИНОВОЕ */

/* ДЛИННЫЙ ТЕКСТ */

.msg-read-more {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    opacity: 0.8;
}
.msg-mine .msg-read-more { color: #fff; }
.msg-other .msg-read-more { color: #4F8CFF; }

/* ВРЕМЯ */

/* ЦВЕТА */

/* ======================================== */
/* === СТИЛИ СООБЩЕНИЙ — ЧИСТАЯ ВЕРСИЯ === */
/* ======================================== */

/* Контейнер сообщения */
.msg-wrapper {
    display: flex;
    margin-bottom: 6px;
    width: 100%;
}

/* МОИ сообщения — СПРАВА */
.msg-mine {
    justify-content: flex-end !important;
}

/* ЧУЖИЕ сообщения — СЛЕВА */
.msg-other {
    justify-content: flex-start !important;
}

/* Контент сообщения (текст + реакции + время) */
.msg-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}
.msg-mine .msg-content {
    align-items: flex-end;
}
.msg-other .msg-content {
    align-items: flex-start;
}

/* Аватар */
.msg-avatar {
    width: 34px; height: 34px; min-width: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
    margin-right: 8px; overflow: hidden; cursor: pointer;
    align-self: flex-start;
}

/* Отправитель */
.msg-sender {
    font-size: 11px; font-weight: 600; color: #667eea;
    margin-bottom: 2px; padding: 0 4px; cursor: pointer;
}

/* Облако сообщения */
.msg-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 16px;
    text-align: left;
    word-break: break-word;
    position: relative;
    font-size: 14px;
    line-height: 1.45;
}
.msg-mine .msg-bubble {
    background: #4F8CFF;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-other .msg-bubble {
    background: #2a2a3e;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* Текст */
.msg-text {
    line-height: 1.4;
}

/* Нижняя строка: реакции + время + статус */
.msg-bottom-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 2px;
    padding: 0 4px;
}

/* Реакции */
.msg-reactions {
    display: inline-flex;
    gap: 3px;
    flex-wrap: wrap;
}

.msg-footer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    opacity: 0.8;
    flex-shrink: 0;
}
.msg-reaction {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid rgba(255,255,255,0.08);
}
.msg-reaction img {
    width: 14px; height: 14px;
}
.msg-reaction:hover {
    background: rgba(255,255,255,0.2);
}

/* Футер */
.msg-footer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    opacity: 0.8;
}
.msg-time {
    white-space: nowrap;
}
.msg-mine .msg-time {
    color: rgba(255,255,255,0.6);
}
.msg-other .msg-time {
    color: #888;
}
.msg-status {
    font-size: 10px;
    white-space: nowrap;
}

/* Триггер реакции (плюсик) */
.msg-reaction-trigger {
    position: absolute;
    bottom: -8px;
    right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #2a2a3e;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px; color: #fff;
    z-index: 5;
}
.msg-mine .msg-reaction-trigger {
    right: auto; left: 4px;
}
.msg-bubble:hover .msg-reaction-trigger {
    opacity: 1;
}
.msg-reaction-trigger:hover {
    background: #4F8CFF;
    transform: scale(1.2);
}

/* Картинки */
.msg-image-file {
    max-width: 240px;
    border-radius: 10px;
    overflow: hidden;
    margin: 4px 0;
    cursor: pointer;
}
.msg-image-file img {
    width: 100%; display: block;
}

/* Стикеры */
.msg-sticker img {
    width: 80px; height: 80px;
    object-fit: contain;
}

/* Разделители дат */
.date-separator {
    text-align: center;
    margin: 16px 0;
}
.date-separator span {
    background: rgba(255,255,255,0.08);
    color: #888;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 11px;
}
    left: auto;
    right: -180px;
    top: 50%;
    transform: translateY(-50%);
}

/* Фикс для Twemoji */
img.emoji {
    height: 1.2em !important;
    width: 1.2em !important;
    margin: 0 0.05em 0 0.1em !important;
    vertical-align: -0.2em !important;
    pointer-events: none;
}
.msg-text img.emoji {
    height: 1.3em !important;
    width: 1.3em !important;
}

/* Красивые эмодзи */
.msg-text, .msg-reaction, #msg-input, .msg-bubble, 
.chat-name, .chat-preview, .emoji-panel span,
.msg-reaction span, .ctx-menu-item {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "EmojiOne Color", sans-serif !important;
}

/* Крупные эмодзи в сообщениях если только эмодзи */
.msg-text:empty::before,
.msg-text:only-child {
    font-size: 1.3em;
}

/* Огромные одиночные эмодзи (как в Telegram) */
.msg-text-emoji-only {
    font-size: 80px !important;
    line-height: 1 !important;
    padding: 10px 0 !important;
    text-align: center !important;
}
.msg-text-emoji-only img.emoji {
    width: 80px !important;
    height: 80px !important;
}

/* 2-3 эмодзи — поменьше */
.msg-text:not(.msg-text-emoji-only) {
    font-size: 15px;
    line-height: 1.5;
}

/* СЕРДЕЧКО ПРИ НАВЕДЕНИИ */
.msg-bubble {
    position: relative;
    overflow: visible !important;
}


.msg-mine 
.msg-other 
.msg-other 
.msg-bubble:hover 

/* СЕРДЕЧКО РЕАКЦИЙ */


.msg-mine 
.msg-other 
.msg-bubble:hover 

/* СЕРДЕЧКО РЕАКЦИЙ — над облаком */
.msg-bubble {
    position: relative;
    overflow: visible !important;
}
.msg-reaction-trigger {
    position: absolute;
    top: -14px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2a2a3e;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}
.msg-reaction-trigger:hover {
    transform: scale(1.2);
    border-color: rgba(255,255,255,0.3);
}
.msg-mine .msg-reaction-trigger {
    left: -10px;
}
.msg-other .msg-reaction-trigger {
    right: -10px;
}
.msg-bubble:hover .msg-reaction-trigger {
    display: flex;
}

/* ЧИНИМ ОБРЕЗАНИЕ СЕРДЕЧКА */
.msg-wrapper {
    overflow: visible !important;
}
.msg-content {
    overflow: visible !important;
}
.msg-mine {
    overflow: visible !important;
}
.msg-bubble {
    overflow: visible !important;
}
/* Сердечко поверх всего */
.msg-reaction-trigger {
    z-index: 100 !important;
}

/* Разделитель новых сообщений */
.unread-divider {
    text-align: center;
    margin: 16px 0;
}
.unread-divider span {
    background: rgba(79, 140, 255, 0.2);
    color: #4F8CFF;
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Время и статус всегда видны */
.msg-footer {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    padding-top: 4px !important;
    opacity: 0.7 !important;
    min-height: 16px !important;
}
.msg-time {
    font-size: 11px !important;
}
.msg-status {
    font-size: 10px !important;
}
.msg-mine .msg-footer {
    color: rgba(255,255,255,0.7) !important;
}
.msg-other .msg-footer {
    color: rgba(255,255,255,0.5) !important;
}

/* Статусы сообщений */
.msg-status {
    font-size: 10px !important;
    margin-left: 2px;
}
.msg-status[style*="#4FC3F7"] {
    color: #4FC3F7 !important;
}

/* Большие эмодзи если только они */
.msg-text-emoji-only {
    font-size: 0 !important;
    line-height: 1 !important;
    padding: 5px 0 !important;
}
.msg-text-emoji-only .emoji-inline {
    width: 64px !important;
    height: 64px !important;
    margin: 2px;
}

/* Обычные эмодзи в тексте */
.emoji-inline {
    width: 20px !important;
    height: 20px !important;
    vertical-align: middle;
    margin: 0 1px;
}

/* Эмодзи в сообщениях */
.emoji-inline {
    vertical-align: middle;
}

/* Один эмодзи — 150x150 */
.msg-text-emoji-only {
    font-size: 0 !important;
    line-height: 1 !important;
    padding: 5px 0 !important;
}
.msg-text-emoji-only .emoji-inline {
    width: 150px !important;
    height: 150px !important;
    margin: 2px;
}

/* Несколько эмодзи — 68x68 */
.msg-text-emojis {
    font-size: 0 !important;
    line-height: 1.2 !important;
    padding: 3px 0 !important;
}
.msg-text-emojis .emoji-inline {
    width: 68px !important;
    height: 68px !important;
    margin: 2px;
}

/* Эмодзи с текстом — 20x20 */
.msg-text-mixed .emoji-inline,
.msg-text .emoji-inline {
    width: 20px !important;
    height: 20px !important;
}

.emoji-inline { width:20px;height:20px;vertical-align:middle;margin:0 1px; }

.forward-chat-item {
    transition: background 0.2s;
}
.forward-chat-item:hover {
    background: var(--bg) !important;
}

@keyframes sendPulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
.msg-wrapper:last-child {
    animation: sendPulse 0.3s ease;
}

/* Аудио-сообщение */
.msg-audio-thumb {
    transition: transform 0.2s, box-shadow 0.2s;
}
.msg-audio-thumb:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

/* Разделитель новых сообщений */
.unread-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.unread-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--primary);
    opacity: 0.3;
}
.unread-divider span {
    position: relative;
    background: var(--bg);
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.unread-divider {
    text-align: center;
    margin: 12px 0;
    position: relative;
}
.unread-divider::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: var(--primary);
    opacity: 0.3;
}
.unread-divider span {
    position: relative;
    background: var(--bg);
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

/* Информационное облако */
.info-cloud {
    text-align: center;
    margin: 16px auto;
    max-width: 400px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    animation: cloudIn 0.4s ease;
}
@keyframes cloudIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Системное сообщение-облако */
.msg-system {
    text-align: center !important;
    justify-content: center !important;
}
.msg-system .msg-bubble {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1)) !important;
    border: 1px solid rgba(102,126,234,0.2) !important;
    border-radius: 16px !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    color: #999 !important;
    max-width: 400px !important;
    margin: 0 auto !important;
    animation: cloudIn 0.4s ease !important;
}
@keyframes cloudIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Видео-миниатюра */
.msg-video-thumb {
    position: relative;
    max-width: 250px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}
.msg-video-thumb video {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    pointer-events: none;
}
.play-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 44px; height: 44px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-btn::after {
    content: '';
    border-left: 14px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    margin-left: 3px;
}



/* === РЕАКЦИИ И ФУТЕР ВНЕ ОБЛАКА === */

/* Реакции - под облаком, по ширине облака */
.msg-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
    padding: 0 4px;
}

/* Футер - под облаком/реакциями, по ширине облака */
.msg-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    padding: 0 4px;
    font-size: 10px;
    opacity: 0.8;
}

/* Для своих - выравнивание вправо */
.msg-mine .msg-footer {
    justify-content: flex-end;
}

/* Для чужих - выравнивание влево */
.msg-other .msg-footer {
    justify-content: flex-start;
}

/* Время */
.msg-time {
    color: var(--text-secondary, #888);
    white-space: nowrap;
}

.msg-mine .msg-time {
    color: rgba(255,255,255,0.6);
}

/* Статус */
.msg-status {
    font-size: 10px;
    white-space: nowrap;
}

/* Реакция (кнопка) */
.msg-reaction {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border, #2a2a4a);
}

.msg-reaction:hover {
    background: rgba(255,255,255,0.15);
}

.msg-reaction img {
    width: 14px;
    height: 14px;
}

/* Триггер реакции - скрываем (используем долгое нажатие) */
.msg-reaction-trigger {
    display: none;
}

/* === ФИКС: msg-content по размеру содержимого === */
.msg-content {
    display: inline-flex !important;
    flex-direction: column !important;
    max-width: 75% !important;
    min-width: 60px;
}

.msg-mine .msg-content {
    align-items: flex-end;
}

.msg-other .msg-content {
    align-items: flex-start;
}

/* Реакции и футер НАСЛЕДУЮТ ширину от msg-content */
.msg-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
    width: 100%;
}

.msg-mine .msg-reactions {
    justify-content: flex-end;
}

.msg-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    width: 100%;
    font-size: 10px;
    opacity: 0.8;
}

.msg-mine .msg-footer {
    justify-content: flex-end;
}

.msg-other .msg-footer {
    justify-content: flex-start;
}

.msg-time {
    color: #888;
    white-space: nowrap;
}

.msg-mine .msg-time {
    color: rgba(255,255,255,0.6);
}

.msg-status {
    font-size: 10px;
    white-space: nowrap;
}

/* ======================================== */
/* === ЕДИНЫЕ СТИЛИ СООБЩЕНИЙ (ФИНАЛ) === */
/* ======================================== */

/* Обёртка */
.msg-wrapper {
    display: flex !important;
    margin-bottom: 4px !important;
    width: 100% !important;
    clear: both !important;
}
.msg-mine {
    justify-content: flex-end !important;
}
.msg-other {
    justify-content: flex-start !important;
}

/* Аватар */
.msg-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #4F8CFF, #6c5ce7);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
    flex-shrink: 0; margin-right: 8px; overflow: hidden; cursor: pointer;
}

/* Контент - ПО РАЗМЕРУ ОБЛАКА */
.msg-content {
    display: flex !important;
    flex-direction: column !important;
    max-width: 75% !important;
    min-width: 60px;
}
.msg-mine .msg-content { align-items: flex-end; }
.msg-other .msg-content { align-items: flex-start; }

/* Отправитель */
.msg-sender { font-size: 11px; font-weight: 600; color: #4F8CFF; margin-bottom: 2px; padding: 0 4px; cursor: pointer; }

/* ОБЛАКО */
.msg-bubble {
    display: inline-block !important;
    max-width: 100% !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    text-align: left !important;
    word-break: break-word !important;
    position: relative;
}
.msg-mine .msg-bubble { background: #4F8CFF !important; color: #fff !important; border-bottom-right-radius: 4px !important; }
.msg-other .msg-bubble { background: #2a2a3e !important; color: #e0e0e0 !important; border-bottom-left-radius: 4px !important; }

/* Текст */
.msg-text { line-height: 1.4; }
.msg-mine .msg-text { color: #fff; }
.msg-other .msg-text { color: #e0e0e0; }

/* Реакции - ПОД облаком */
.msg-reactions {
    display: flex !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    margin-top: 3px !important;
    padding: 0 4px !important;
}
.msg-mine .msg-reactions { justify-content: flex-end !important; }
.msg-other .msg-reactions { justify-content: flex-start !important; }

.msg-reaction {
    background: rgba(255,255,255,0.1) !important;
    border-radius: 8px !important;
    padding: 2px 7px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}

/* Футер - ПОД облаком/реакциями */
.msg-footer {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-top: 2px !important;
    padding: 0 4px !important;
    font-size: 10px !important;
    opacity: 0.8 !important;
}
.msg-mine .msg-footer { justify-content: flex-end !important; }
.msg-other .msg-footer { justify-content: flex-start !important; }

.msg-time { white-space: nowrap; }
.msg-mine .msg-time { color: rgba(255,255,255,0.6) !important; }
.msg-other .msg-time { color: #888 !important; }

.msg-status { font-size: 10px; white-space: nowrap; }

/* Картинки */
.msg-image-file { max-width: 240px; border-radius: 10px; overflow: hidden; margin: 4px 0; cursor: pointer; }
.msg-image-file img { width: 100%; display: block; }

/* Стикеры */
.msg-sticker img { width: 80px; height: 80px; object-fit: contain; }

/* Триггер */


/* === ФИНАЛЬНЫЕ ПРАВКИ === */

/* Облака прижаты к краям */
.msg-wrapper {
    display: flex !important;
    margin-bottom: 4px !important;
    width: 100% !important;
}
.msg-mine {
    justify-content: flex-end !important;
}
.msg-other {
    justify-content: flex-start !important;
}

/* Контент */
.msg-content {
    display: flex !important;
    flex-direction: column !important;
    max-width: 75% !important;
}
.msg-mine .msg-content { align-items: flex-end !important; }
.msg-other .msg-content { align-items: flex-start !important; }

/* Облако */
.msg-bubble {
    display: inline-block !important;
    padding: 8px 12px !important;
    border-radius: 16px !important;
    position: relative !important;
}
.msg-mine .msg-bubble { background: #4F8CFF !important; color: #fff !important; border-bottom-right-radius: 4px !important; }
.msg-other .msg-bubble { background: #2a2a3e !important; color: #e0e0e0 !important; border-bottom-left-radius: 4px !important; }

/* Триггер реакции */

.msg-mine .msg-reaction-trigger { right: auto; left: 6px; }
.msg-bubble:hover .msg-reaction-trigger,
.msg-wrapper:hover .msg-reaction-trigger {
    opacity: 1;
}

/* Нижняя строка: реакции + время + статус В ОДНУ СТРОКУ */
.msg-bottom-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 3px !important;
    padding: 0 4px !important;
    width: 100% !important;
}

.msg-mine .msg-bottom-row {
    justify-content: flex-end !important;
}

.msg-other .msg-bottom-row {
    justify-content: flex-start !important;
}

/* Реакции - в строке */
.msg-reactions {
    display: inline-flex !important;
    gap: 3px !important;
    flex-wrap: wrap !important;
}

/* Футер - в строке */
.msg-footer {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 10px !important;
    opacity: 0.8 !important;
}

.msg-time { white-space: nowrap; }
.msg-mine .msg-time { color: rgba(255,255,255,0.6) !important; }
.msg-other .msg-time { color: #888 !important; }
.msg-status { font-size: 10px; white-space: nowrap; }

/* ===== АБСОЛЮТНО ТОЧНЫЕ СТИЛИ ===== */

.msg-wrapper {
    display: flex !important;
    margin-bottom: 6px !important;
    width: 100% !important;
}

.msg-mine {
    justify-content: flex-end !important;
}

.msg-other {
    justify-content: flex-start !important;
}

.msg-content {
    display: flex !important;
    flex-direction: column !important;
    max-width: 75% !important;
}

.msg-mine .msg-content {
    align-items: flex-end !important;
}
.msg-mine .msg-bottom-row {
    align-self: flex-end;
}

.msg-other .msg-content {
    align-items: flex-start !important;
}

/* Триггер реакции */


.msg-mine .msg-reaction-trigger {
    right: auto;
    left: 4px;
}

.msg-bubble:hover .msg-reaction-trigger,
.msg-wrapper:hover .msg-reaction-trigger {
    opacity: 1 !important;
}

.msg-bubble {
    position: relative !important;
}

/* ===== ТРИГГЕР РЕАКЦИИ (ЕДИНСТВЕННЫЙ) ===== */
.msg-reaction-trigger {
    position: absolute;
    bottom: -8px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2a2a3e;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
    font-size: 12px;
    color: #fff;
}
.msg-mine .msg-reaction-trigger {
    right: auto;
    left: 4px;
}
.msg-bubble:hover .msg-reaction-trigger,
.msg-wrapper:hover .msg-reaction-trigger {
    opacity: 1 !important;
}
.msg-reaction-trigger:hover {
    background: #4F8CFF;
    transform: scale(1.2);
}

/* ===== ФИНАЛЬНОЕ ВЫРАВНИВАНИЕ ===== */
.msg-mine {
    display: flex !important;
    justify-content: flex-end !important;
    width: 100% !important;
}

.msg-other {
    display: flex !important;
    justify-content: flex-start !important;
    width: 100% !important;
}

.msg-content {
    display: flex !important;
    flex-direction: column !important;
    max-width: 75% !important;
}

.msg-mine .msg-content {
    align-items: flex-end !important;
}
.msg-mine .msg-bottom-row {
    align-self: flex-end;
}

.msg-other .msg-content {
    align-items: flex-start !important;
}

/* Реакция с фоном */
.msg-reaction {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    cursor: pointer !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    transition: all 0.15s !important;
}
.msg-reaction:hover {
    background: rgba(255,255,255,0.15) !important;
    transform: scale(1.05);
}
.msg-reaction img {
    width: 14px; height: 14px;
}

/* Триггер реакции — внутри msg-bubble, позиционируется абсолютно */
.msg-reaction-trigger {
    position: absolute;
    bottom: -8px;
    right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #2a2a3e;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 12px; color: #fff;
    z-index: 5;
}
.msg-mine .msg-reaction-trigger { right: auto; left: 4px; }
.msg-bubble:hover .msg-reaction-trigger { opacity: 1; }

/* Строка с реакциями и временем */
.msg-bottom-row {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    margin-top: 2px !important;
    padding: 0 2px;
    width: auto !important;
    max-width: 100%;
}
.msg-bottom-row > * { flex-shrink: 0; }

/* ГАРАНТИЯ: bottom-row не растягивается */
.msg-bottom-row {
    display: inline-flex !important;
    width: auto !important;
    min-width: 0 !important;
    flex-shrink: 0;
}
.msg-mine .msg-bottom-row {
    align-self: flex-end;
}
.msg-other .msg-bottom-row {
    align-self: flex-start;
}

/* ===== ФИНАЛЬНАЯ СТРУКТУРА ===== */

/* Реакции — внутри облака, снизу */
.msg-reactions {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.msg-mine .msg-reactions {
    justify-content: flex-end;
}

/* Футер — СНАРУЖИ облака, под ним */
.msg-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    padding: 0 4px;
    font-size: 10px;
    opacity: 0.8;
}
.msg-mine .msg-footer {
    justify-content: flex-end;
}
.msg-other .msg-footer {
    justify-content: flex-start;
}

/* Убираем msg-bottom-row */
.msg-bottom-row {
    display: none;
}

/* Триггер реакций — появляется при наведении на облако */
.msg-reaction-trigger {
    position: absolute;
    bottom: -10px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2a2a3e;
    border: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    font-size: 13px;
    color: #ccc;
    z-index: 5;
}
.msg-mine .msg-reaction-trigger {
    right: auto;
    left: 6px;
}
.msg-bubble:hover .msg-reaction-trigger {
    opacity: 1;
}
.msg-reaction-trigger:hover {
    background: #4F8CFF;
    color: #fff;
    border-color: #4F8CFF;
    transform: scale(1.15);
}
