* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e9ecef;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}
.header {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding-top: max(10px, env(safe-area-inset-top, 10px));
    padding-bottom: 10px;
}
.header h1 { font-size: 1.3rem; margin: 0; }
.header .user-info { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.header .user-info span { font-weight: 500; }
.header button {
    background: white;
    color: #007bff;
    border: none;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}
.header button:hover { background: #f0f0f0; }
.header .push-btn { background: #28a745; color: white; padding: 5px 12px; }
.header .push-btn:hover { background: #1e7e34; }
.header .push-btn.off { background: #6c757d; }
.header .push-btn.off:hover { background: #5a6268; }

.main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.users-panel {
    width: 280px;
    background: white;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
}
.users-panel .panel-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.users-panel .panel-header .actions {
    display: flex;
    gap: 6px;
}
.users-panel .panel-header button {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.users-panel .panel-header button:hover { background: #1e7e34; }
.users-panel .panel-header button.danger { background: #dc3545; }
.users-panel .panel-header button.danger:hover { background: #b02a37; }

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    -webkit-overflow-scrolling: touch;
}
.user-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.15s;
    min-height: 48px;
}
.user-item:hover { background: #f1f3f5; }
.user-item.active { background: #e2e8f0; }
.user-item .username { font-weight: 500; }
.user-item .right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-item .status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e9ecef;
    white-space: nowrap;
}
.user-item .status-badge.online { background: #d4edda; color: #155724; }
.user-item .status-badge.offline { background: #f8d7da; color: #721c24; }
.user-item .unread-badge {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    display: inline-block;
}
.user-item .remove-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    margin-left: 4px;
}
.user-item .remove-btn:hover { color: #b02a37; }
.empty-state { padding: 20px; text-align: center; color: #6c757d; font-size: 0.95rem; }

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    height: 100%;
    overflow: hidden;
}
.chat-header {
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-header .back-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    display: none;
    line-height: 1;
    padding: 0 4px;
    color: #007bff;
}
.chat-header .chat-user { color: #007bff; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8f9fa;
    -webkit-overflow-scrolling: touch;
}
.message-item {
    max-width: 70%;
    padding: 8px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
    align-self: flex-start;
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message-item.sent { align-self: flex-end; background: #d1e7dd; }
.message-item .meta {
    font-size: 0.65rem;
    color: #6c757d;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.message-item .meta .status-icon { font-size: 0.7rem; }
.message-item .meta .time { opacity: 0.7; }
.message-item .meta .edited-badge { font-size: 0.6rem; color: #6c757d; margin-left: 4px; font-style: italic; }
.message-item .attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.message-item .attachments .file-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 4px;
    background: #f8f9fa;
    max-width: 120px;
}
.message-item .attachments .file-item img { max-width: 100px; max-height: 100px; border-radius: 4px; object-fit: cover; }
.message-item .attachments .file-item .file-name { font-size: 0.7rem; word-break: break-all; text-align: center; margin-top: 2px; }
.message-item .attachments .file-item .file-size { font-size: 0.6rem; color: #6c757d; }
.message-item .attachments .file-item a { text-decoration: none; color: #007bff; cursor: pointer; }
.message-item .reply-indicator {
    background: #f1f3f5;
    border-left: 3px solid #007bff;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 4px;
}
.message-item .reply-indicator .reply-arrow { font-size: 1rem; }
.message-item .reply-indicator .reply-text { white-space: pre-wrap; word-break: break-word; }
.message-item .reply-btn, .message-item .edit-btn {
    cursor: pointer;
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 8px;
    background: none;
    border: none;
}
.message-item .reply-btn:hover, .message-item .edit-btn:hover { color: #007bff; }
.message-item.highlighted { background: #fff3cd !important; border: 2px solid #ffc107; transition: background 0.3s ease, border 0.3s ease; }

.chat-input .reply-preview, .chat-input .edit-preview {
    width: 100%;
    background: #f1f3f5;
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 4px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #495057;
    border-left: 3px solid #007bff;
}
.chat-input .reply-preview .cancel-reply, .chat-input .edit-preview .cancel-edit {
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
    margin-left: auto;
    background: none;
    border: none;
}
.chat-input .reply-preview .cancel-reply:hover, .chat-input .edit-preview .cancel-edit:hover { color: #b02a37; }
.chat-input {
    display: flex;
    padding: 12px 20px;
    background: white;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    position: relative; /* для позиционирования панели эмодзи */
}
.chat-input input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 24px;
    outline: none;
    font-size: 0.95rem;
    min-width: 120px;
}
.chat-input input[type="text"]:focus { border-color: #007bff; }
.chat-input button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}
.chat-input button:hover { background: #0056b3; }
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-input .attach-btn {
    background: #6c757d;
    padding: 10px 14px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
}
.chat-input .attach-btn:hover { background: #5a6268; }
.chat-input .file-status { font-size: 0.8rem; color: #28a745; margin-left: 4px; white-space: nowrap; }

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 16px;
}
.login-box {
    background: white;
    padding: 40px 35px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 380px;
    max-width: 100%;
}
.login-box h2 { margin-bottom: 20px; text-align: center; color: #007bff; }
.login-box .form-group { margin-bottom: 16px; }
.login-box .form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 0.9rem; }
.login-box .form-group input { width: 100%; padding: 10px 12px; border: 1px solid #ced4da; border-radius: 6px; font-size: 0.95rem; }
.login-box .flex { display: flex; gap: 10px; margin-top: 10px; }
.login-box .flex button { flex: 1; padding: 10px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-box .flex button.primary { background: #007bff; color: white; }
.login-box .flex button.primary:hover { background: #0056b3; }
.login-box .flex button.secondary { background: #6c757d; color: white; }
.login-box .flex button.secondary:hover { background: #5a6268; }
.login-box .message { margin-top: 12px; font-size: 0.9rem; text-align: center; }
.login-box .message.error { color: #dc3545; }
.login-box .message.success { color: #28a745; }
.login-box .hint { margin-top: 12px; font-size: 0.85rem; color: #6c757d; text-align: center; }

.hidden { display: none !important; }

/* Модальное окно для поиска и добавления контакта */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 16px;
}
.modal-box {
    background: white;
    padding: 30px 25px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 400px;
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-box h3 { margin-bottom: 16px; color: #007bff; }
.modal-box .search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.modal-box .search-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
}
.modal-box .search-row button {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.modal-box .search-results {
    overflow-y: auto;
    flex: 1;
    border-top: 1px solid #dee2e6;
    padding-top: 12px;
}
.modal-box .search-results .result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
}
.modal-box .search-results .result-item .name { font-weight: 500; }
.modal-box .search-results .result-item .add-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.modal-box .search-results .result-item .add-btn:hover { background: #1e7e34; }
.modal-box .close-btn {
    margin-top: 16px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
}
.modal-box .close-btn:hover { background: #5a6268; }

.loading-indicator { text-align: center; color: #6c757d; font-size: 0.8rem; padding: 8px 0; display: none; }
.toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #007bff;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    max-width: 350px;
    cursor: pointer;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 768px) {
    body {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
    }
    .header {
        padding: 8px 12px;
        padding-top: max(8px, env(safe-area-inset-top, 8px));
        flex-wrap: wrap;
        gap: 5px;
    }
    .header h1 { font-size: 1rem; }
    .header .user-info span { font-size: 0.85rem; }
    .header button { font-size: 0.75rem; padding: 4px 10px; }
    .header .push-btn { padding: 4px 8px; }

    .main {
        flex-direction: column;
        padding-bottom: 0;
    }
    .users-panel {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        border-right: none;
        background: white;
        transition: transform 0.2s ease;
        display: flex;
        transform: translateX(0);
    }
    .users-panel.hidden {
        transform: translateX(-100%);
        pointer-events: none;
    }
    .users-panel.hidden {
        display: none;
    }
    .users-panel:not(.hidden) {
        display: flex;
        transform: translateX(0);
        pointer-events: auto;
    }

    .chat-panel {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 2;
        display: none;
        background: #f8f9fa;
    }
    .chat-panel.active {
        display: flex;
    }

    .chat-header .back-btn {
        display: inline-block;
        font-size: 2rem;
        line-height: 1;
        padding: 0 4px;
    }
    .chat-header {
        font-size: 1rem;
        padding: 8px 12px;
        padding-top: max(8px, env(safe-area-inset-top, 8px));
    }
    .chat-messages {
        padding: 10px 12px;
    }
    .message-item {
        max-width: 85%;
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    .chat-input {
        padding: 8px 12px;
        gap: 6px;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    }
    .chat-input input[type="text"] {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: 60px;
    }
    .chat-input button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    .chat-input .attach-btn {
        padding: 8px 10px;
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .login-box {
        padding: 30px 20px;
        width: 100%;
        max-width: 340px;
    }
    .login-box h2 { font-size: 1.3rem; }
    .login-box .flex button { font-size: 0.9rem; padding: 8px; }
    .user-item {
        padding: 12px 16px;
        min-height: 52px;
    }
    .user-item .username { font-size: 0.95rem; }
    .user-item .status-badge { font-size: 0.65rem; padding: 2px 6px; }
    .toast {
        bottom: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 0.9rem;
        padding: 10px 16px;
    }
    .modal-box {
        width: 90%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 { font-size: 0.9rem; }
    .header .user-info span { font-size: 0.75rem; }
    .header button { font-size: 0.7rem; padding: 3px 8px; }
    .chat-header { font-size: 0.85rem; padding: 6px 10px; }
    .chat-header .back-btn { font-size: 1.6rem; }
    .message-item { max-width: 92%; font-size: 0.85rem; padding: 6px 10px; }
    .chat-input input[type="text"] { padding: 6px 10px; font-size: 0.85rem; }
    .chat-input button { padding: 6px 12px; font-size: 0.8rem; }
    .chat-input .attach-btn { width: 34px; height: 34px; font-size: 1rem; }
    .login-box { padding: 20px 16px; }
    .login-box h2 { font-size: 1.1rem; }
    .user-item { padding: 10px 12px; min-height: 44px; }
    .user-item .username { font-size: 0.85rem; }
}

/* Индикатор печатания */
#typingIndicator {
    animation: blink 1.2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Модальное окно предпросмотра */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    padding: 20px;
}
.image-preview-overlay.active {
    display: flex;
}
.image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.image-preview-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    cursor: default;
}
.image-preview-close {
    position: fixed;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10001;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.image-preview-close:hover { opacity: 1; }
.image-preview-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 40px;
    padding: 20px 12px;
    cursor: pointer;
    border-radius: 8px;
    z-index: 10001;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}
.image-preview-nav:hover { background: rgba(255,255,255,0.4); }
.image-preview-prev { left: 20px; }
.image-preview-next { right: 20px; }
.image-preview-nav.hidden-nav { display: none; }
.image-preview-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
}
@media (max-width: 768px) {
    .image-preview-close { font-size: 30px; top: 10px; right: 15px; }
    .image-preview-nav { font-size: 30px; padding: 12px 8px; }
    .image-preview-prev { left: 10px; }
    .image-preview-next { right: 10px; }
}

/* Кнопка смайликов */
.emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.emoji-btn:hover {
    transform: scale(1.2);
}

/* Контейнер для пикера */
#emojiPickerContainer {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 100;
    max-height: 320px;
    width: 320px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
    overflow: hidden;
}
/* Стили для самого веб-компонента */
emoji-picker {
    --num-columns: 8;
    --emoji-size: 1.6rem;
    width: 100% !important;
    height: 300px !important;
    border: none !important;
    background: transparent !important;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    #emojiPickerContainer {
        left: 50%;
        transform: translateX(-50%);
        width: 90vw;
        max-width: 340px;
    }
    emoji-picker {
        --num-columns: 6;
        --emoji-size: 1.5rem;
        height: 280px !important;
    }
}

/* Стили для групповых чатов */
.modal-box .group-member-checkbox { margin-right: 8px; }
.modal-box .group-member-label { cursor: pointer; }

/* Кнопка настроек группы в списке чатов */
.group-settings-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    color: #6c757d;
    transition: color 0.2s;
    margin-left: 4px;
}
.group-settings-btn:hover {
    color: #007bff;
}

/* Стили внутри модалки управления группой */
.group-settings-section {
    margin-bottom: 16px;
}
.group-settings-section label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}
.group-settings-section input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
}
.group-settings-section .save-name-btn {
    margin-top: 6px;
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
}
.group-settings-section .save-name-btn:hover {
    background: #1e7e34;
}

.group-participants-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 4px;
}
.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #f1f3f5;
}
.participant-item .participant-name {
    font-weight: 500;
}
.participant-item .participant-role {
    font-size: 0.75rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 0 6px;
    border-radius: 4px;
}
.participant-item .remove-participant-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 4px;
}
.participant-item .remove-participant-btn:hover {
    color: #b02a37;
}
.participant-item .online-status {
    font-size: 0.7rem;
    margin-left: 6px;
}
.participant-item .online-status.online { color: #28a745; }
.participant-item .online-status.offline { color: #6c757d; }

.group-add-member-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.group-add-member-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}
.group-add-member-row button {
    padding: 6px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.group-add-member-row button:hover {
    background: #0056b3;
}

.group-search-results {
    margin-top: 8px;
    max-height: 120px;
    overflow-y: auto;
    border-top: 1px solid #dee2e6;
    padding-top: 6px;
}
.group-search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f5;
}
.group-search-result-item .add-member-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.group-search-result-item .add-member-btn:hover {
    background: #1e7e34;
}

.group-danger-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    border-top: 1px solid #dee2e6;
    padding-top: 12px;
}
.group-danger-actions button {
    padding: 6px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.group-danger-actions .delete-group-btn {
    background: #dc3545;
    color: white;
}
.group-danger-actions .delete-group-btn:hover {
    background: #b02a37;
}
.group-danger-actions .leave-group-btn {
    background: #ffc107;
    color: #212529;
}
.group-danger-actions .leave-group-btn:hover {
    background: #e0a800;
}
.file-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 4px;
}
.file-icon {
    font-size: 2rem;
    line-height: 1;
}

.message-status-popover {
    font-size: 0.85rem;
}
.message-status-popover .status-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f5;
}
.message-status-popover .status-item .username {
    font-weight: 500;
}
.message-status-popover .status-item .status-badge {
    font-size: 0.75rem;
    padding: 0 6px;
    border-radius: 4px;
}
.message-status-popover .status-item .status-badge.sent { color: #6c757d; }
.message-status-popover .status-item .status-badge.delivered { color: #0d6efd; }
.message-status-popover .status-item .status-badge.read { color: #198754; }
.message-status-popover .status-item .online-status {
    font-size: 0.7rem;
    margin-left: 6px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ★★★ Большой смайлик ★★★ */
.message-item .big-emoji {
    font-size: 3.5rem;
    line-height: 1.2;
    padding: 4px 0;
}

@media (max-width: 768px) {
    .message-item .big-emoji {
        font-size: 2.8rem;
    }
}

/* ★★★ Исправление для модалки "Добавить контакт" на мобильных ★★★ */
@media (max-width: 768px) {
    .modal-box .search-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .modal-box .search-row input {
        flex: 1 1 100%;
        min-width: 0;
    }
    .modal-box .search-row button {
        flex: 1 1 100%;
        width: 100%;
        margin-top: 0;
    }
}