/* ===== БАЗОВЫЕ СТИЛИ (полная версия с правками) ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f12;
    color: #e8e8e8;
}

.page {
    display: none;
    width: 100%;
    height: 100%;
}
.page.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ---- АВТОРИЗАЦИЯ ---- */
.auth-container {
    background: #1e1e24;
    padding: 40px 32px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    width: 400px;
    max-width: 92%;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-image { width: 64px; height: 64px; display: block; margin: 0 auto 6px; border-radius: 16px; object-fit: contain; }
.auth-logo h1 { color: rgb(151,0,178); font-size: 26px; font-weight: 600; letter-spacing: -0.5px; }
.auth-logo .version { color: #666; font-size: 11px; margin-top: 2px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid #2a2a32; }
.tab { flex: 1; padding: 10px 0 8px; border: none; background: none; font-size: 15px; font-weight: 500; color: #888; transition: all 0.3s; cursor: pointer; text-align: center; }
.tab.active { color: rgb(151,0,178); border-bottom: 2px solid rgb(151,0,178); }
.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }
.auth-form input { padding: 12px 14px; background: #2a2a32; border: 1px solid #3a3a44; border-radius: 10px; font-size: 14px; color: #e8e8e8; transition: border-color 0.3s; width: 100%; }
.auth-form input:focus { outline: none; border-color: rgb(151,0,178); }
.auth-form input::placeholder { color: #666; }
.auth-form button, .auth-form .btn-primary, .auth-form .btn-secondary {
    padding: 10px 16px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s, transform 0.1s; width: 100%; text-align: center;
}
.auth-form button:hover, .auth-form .btn-primary:hover { background: rgb(130,0,155); }
.auth-form .btn-primary { background: rgb(151,0,178); color: #fff; }
.auth-form .btn-secondary { background: #2a2a32; color: #e8e8e8; }
.auth-form .btn-secondary:hover { background: #3a3a44; }
.auth-form .button-group { display: flex; gap: 10px; }
.auth-form .button-group button { flex: 1; padding: 10px 12px; font-size: 13px; }
.error { color: #ef5350; font-size: 13px; margin-top: 4px; text-align: center; }
.hint { color: #666; font-size: 12px; margin-top: 4px; text-align: center; }

/* ---- МЕССЕНДЖЕР ---- */
.messenger {
    display: flex;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    max-height: 100vh;
    background: #0f0f12;
    overflow: hidden;
    padding: 8px;
    gap: 0;
    position: relative;
    align-items: stretch;
}

/* ---- БОКОВАЯ ПАНЕЛЬ ---- */
.sidebar {
    width: 340px;
    min-width: 340px;
    background: #16161c;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 8px 0 8px 8px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 20px rgba(0,0,0,0.4);
}
.sidebar-header { padding: 14px 16px; background: #1a1a20; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: space-between; min-height: 56px; flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo-small-img { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; flex-shrink: 0; }
.sidebar-title { font-size: 20px; color: rgb(151,0,178); font-weight: 700; margin: 0; padding: 0; letter-spacing: -0.3px; }

/* ---- НИЖНЯЯ ПАНЕЛЬ НАВИГАЦИИ ---- */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 16px;
    width: 340px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: #1a1a20;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-radius: 0 0 28px 28px;
    z-index: 10;
    flex-shrink: 0;
    box-sizing: border-box;
}
.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #aaa;
}
.nav-item.active {
    color: rgb(151,0,178);
}
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgb(151,0,178);
}
.nav-item svg {
    width: 22px;
    height: 22px;
}

.search-container { padding: 10px 16px; display: flex; gap: 8px; background: #16161c; border-bottom: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; }
#searchInput { flex: 1; padding: 8px 14px; background: #2a2a32; border: 1px solid #3a3a44; border-radius: 20px; font-size: 14px; color: #e8e8e8; }
#searchInput:focus { outline: none; border-color: rgb(151,0,178); }
#searchInput::placeholder { color: #666; }
#searchBtn { padding: 8px 16px; background: #2a2a32; color: #888; border: none; border-radius: 20px; transition: background 0.3s; cursor: pointer; }
#searchBtn:hover { background: #3a3a44; }

/* ----- РЕЗУЛЬТАТЫ ПОИСКА (исправлены) ----- */
#searchResult {
    padding: 10px 16px;
    background: #16161c;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: none;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3a3a44 transparent;
}
#searchResult.show { display: block; }

.search-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.search-user-info {
    flex: 1;
    min-width: 0;
}
.search-user-name {
    font-weight: 500;
    color: #e8e8e8;
    font-size: 15px;
}
.search-user-status {
    font-size: 13px;
    color: #666;
}
.search-btn {
    padding: 6px 16px;
    background: rgb(151,0,178);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}
.search-btn:hover { background: rgb(130,0,155); }

/* ---- ДИАЛОГИ ---- */
.dialogs { flex: 1; overflow-y: auto; padding: 8px 10px; padding-bottom: 70px; min-height: 0; }
.dialogs h3 { color: #666; font-size: 12px; padding: 10px 5px 8px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.dialog-item { display: flex; align-items: center; padding: 10px 12px; border-radius: 10px; transition: background 0.2s; margin-bottom: 2px; gap: 12px; cursor: pointer; }
.dialog-item:hover { background: #2a2a32; }
.dialog-item.active { background: #2a2a3a; }
.dialog-info { flex: 1; min-width: 0; }
.dialog-name { font-weight: 500; color: #e8e8e8; font-size: 15px; }
.dialog-last-message { font-size: 13px; color: #666; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-status { font-size: 12px; margin-top: 1px; margin-bottom: 1px; }
.dialog-status.online { color: #66bb6a; }
.dialog-status.afk { color: #ffd54f; }
.dialog-status.dnd { color: #ef5350; }
.dialog-status.offline { color: #666; }
.dialog-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.dialog-time { font-size: 11px; color: #555; }
.unread-badge { background: rgb(151,0,178); color: #fff; font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ---- АВАТАРКИ ---- */
.avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 4px rgba(0,0,0,0.15);
}
.avatar-small {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 3px rgba(0,0,0,0.15);
}
.avatar-chat {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 4px rgba(0,0,0,0.15);
}
.avatar .online-dot,
.avatar-small .online-dot,
.avatar-chat .online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #66bb6a;
    border-radius: 50%;
    border: 2px solid #1a1a20;
    display: none;
}
.avatar .online-dot.active,
.avatar-small .online-dot.active,
.avatar-chat .online-dot.active {
    display: block;
}
.dialog-avatar {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.dialog-avatar .online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #66bb6a;
    border-radius: 50%;
    border: 2px solid #16161c;
    display: none;
}
.dialog-avatar .online-dot.active {
    display: block;
}
.chat-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}
.chat-avatar-wrapper .online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 13px;
    height: 13px;
    background: #66bb6a;
    border-radius: 50%;
    border: 2px solid #1a1a20;
    display: none;
}
.chat-avatar-wrapper .online-dot.active {
    display: block;
}
.color-0 { background: #e57373; }
.color-1 { background: #ffb74d; }
.color-2 { background: #ffd54f; }
.color-3 { background: #81c784; }
.color-4 { background: #4dd0e1; }
.color-5 { background: #64b5f6; }
.color-6 { background: #9575cd; }
.color-7 { background: #f06292; }

.role-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 3px;
}
.role-badge.developer {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
    animation: floatBadge 2s ease-in-out infinite;
}
@keyframes floatBadge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}
.dialog-item .role-badge.developer { width: 16px; height: 16px; }
.chat-user-name .role-badge.developer { width: 18px; height: 18px; }

/* ---- ЧАТ ---- */
.chat {
    flex: 1;
    display: none !important;
    flex-direction: column;
    background: transparent;
    min-width: 0;
    height: 100%;
    margin: 8px 8px 8px 0;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 20px rgba(0,0,0,0.4);
}
.chat.active { display: flex !important; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

.chat-header {
    position: sticky;
    top: 8px;
    z-index: 10;
    margin: 0 12px;
    padding: 10px 18px;
    min-height: 56px;
    background: rgba(30,30,38,0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chat-header:hover {
    background: rgba(38, 38, 46, 0.88);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}
.back-btn-mobile {
    display: none !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 28px;
    color: rgb(151,0,178);
    padding: 0 4px;
    line-height: 1;
    cursor: pointer;
}
.back-btn-mobile:hover { color: rgb(130,0,155); }

.chat-avatar-wrapper .avatar-chat { width: 42px; height: 42px; font-size: 17px; }

.chat-user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.chat-user-name {
    font-weight: 600;
    color: #e8e8e8;
    font-size: 17px;
    letter-spacing: -0.2px;
    line-height: 1.2;
}
.chat-user-status {
    font-size: 13px;
    color: #888;
    transition: color 0.3s;
    line-height: 1.2;
}
.chat-user-status.online { color: #66bb6a; }
.chat-user-status.afk { color: #ffd54f; }
.chat-user-status.dnd { color: #ef5350; }
.chat-user-status.offline { color: #888; }

.chat-messages {
    flex: 1;
    padding: 12px 16px 8px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 0;
    background: transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }
.empty-chat { display: none; }

/* ---- СООБЩЕНИЯ ---- */
.message {
    max-width: 75%;
    padding: 6px 12px;
    border-radius: 16px;
    animation: slideIn 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    position: relative;
}
.message.sent { align-self: flex-end; background: rgb(151,0,178); color: #fff; border-bottom-right-radius: 4px; }
.message.received { align-self: flex-start; background: #2a2a32; color: #e8e8e8; border-bottom-left-radius: 4px; }
.message-content { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; width: 100%; gap: 0; }
.message-text { flex: 0 1 auto; word-wrap: break-word; line-height: 1.35; font-size: 14px; }
.message-time-status { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: 1px; font-size: 10px; opacity: 0.6; white-space: nowrap; padding-left: 4px; }

/* ===== ПЕРЕСЛАННЫЕ СООБЩЕНИЯ (Telegram-стиль) ===== */
.msg-fwd-header {
    font-size: 12px;
    color: #88929e;
    font-weight: 400;
    padding: 0 0 2px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.message.sent .msg-fwd-header { color: rgba(255,255,255,0.6); }
.message.received .msg-fwd-header { color: #88929e; }
.msg-fwd-header:hover { opacity: 0.8; }

/* Блок отправителя внутри сообщения — аватарка + юзернейм */
.msg-fwd-sender {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}
.msg-fwd-sender:hover .fwd-sender-name {
    text-decoration: underline;
}
.fwd-sender-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.fwd-sender-name {
    font-size: 13px;
    font-weight: 600;
    color: #4fc3f7;
}
.message:has(.voice-message) .message-content { flex-wrap: nowrap; align-items: center; gap: 6px; }
.message:has(.voice-message) .message-time-status { align-self: flex-end; padding-left: 0; }
.message-status { display: inline-flex; align-items: center; }
.check-icon { width: 14px; height: 14px; display: inline-block; vertical-align: middle; }

/* ---- ГОЛОСОВЫЕ СООБЩЕНИЯ ---- */
.voice-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    min-width: 160px;
    flex: 1;
}
.voice-message .play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}
.voice-message .play-btn:hover { background: rgba(255,255,255,0.25); }
.voice-message .play-btn.playing { background: rgba(255,255,255,0.25); }
.voice-message .voice-duration {
    font-size: 11px;
    opacity: 0.7;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* Waveform — Telegram-style bars */
.voice-wave {
    flex: 1;
    height: 24px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-width: 60px;
}
/* Dim background bars */
.voice-wave-bg {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
}
.voice-wave-bg span {
    display: block;
    width: 3px;
    min-height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
    height: var(--h, 8px);
}
/* Colored played bars — clipped by width */
.voice-wave-fill {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    width: 0%;
    transition: width 0.1s linear;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}
.voice-wave-fill span {
    display: block;
    width: 3px;
    min-height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.85);
    flex-shrink: 0;
    height: var(--h, 8px);
}

/* ---- ФАЙЛЫ ---- */
.file-preview-container {
    display: none;
    padding: 6px 12px;
    background: #1a1a20;
    border-top: 1px solid #2a2a32;
    gap: 6px;
    flex-wrap: wrap;
}
.file-preview-container.active { display: flex; }
.file-preview-item {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    background: #2a2a32;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #3a3a44;
}
.file-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.file-preview-item .file-preview-icon { font-size: 20px; }
.file-preview-item .remove-file {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef5350;
    color: white;
    border: none;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
}
.file-preview-item .remove-file:hover { background: #d32f2f; }
.file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    cursor: pointer;
}
.file-attachment .file-icon { font-size: 24px; flex-shrink: 0; }
.file-attachment .file-info { min-width: 0; }
.file-attachment .file-name { font-size: 13px; font-weight: 500; word-break: break-word; }
.file-attachment .file-size { font-size: 11px; opacity: 0.7; margin-top: 2px; }

/* ---- ПОЛЕ ВВОДА ---- */
.chat-input {
    padding: 12px 16px 14px 16px;
    background: transparent;
    border-top: none;
    display: none;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}
.chat.active .chat-input { display: flex; }

.attach-btn {
    width: 38px; height: 38px; border-radius: 50%; background: #2a2a32; border: 1px solid #3a3a44; font-size: 18px; color: #888; display: flex; align-items: center; justify-content: center; transition: all 0.2s; cursor: pointer; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.attach-btn:hover { background: #3a3a44; color: rgb(151,0,178); border-color: rgb(151,0,178); box-shadow: 0 2px 10px rgba(151, 0, 178, 0.2); }
.attach-btn:active { transform: scale(0.95); }

.microphone-btn {
    width: 38px; height: 38px; border-radius: 50%; background: #2a2a32; border: 1px solid #3a3a44; font-size: 18px; color: #888; display: flex; align-items: center; justify-content: center; transition: all 0.2s; cursor: pointer; flex-shrink: 0; box-shadow: 0 2px 6px rgba(0,0,0,0.2); position: relative;
}
.microphone-btn:hover { background: #3a3a44; color: rgb(151,0,178); border-color: rgb(151,0,178); box-shadow: 0 2px 10px rgba(151, 0, 178, 0.2); }
.microphone-btn:active { transform: scale(0.95); }
.microphone-btn .stop-icon { display: none; font-size: 16px; }
.microphone-btn.recording { color: #ef5350; background: rgba(239,83,80,0.15); border-color: #ef5350; animation: pulseMic 1.2s ease-in-out infinite; }
.microphone-btn.recording .mic-icon { display: none; }
.microphone-btn.recording .stop-icon { display: inline; }

.input-wrapper {
    flex: 1; display: flex; align-items: center; background: #2a2a32; border-radius: 24px; border: 1px solid #3a3a44; transition: border-color 0.3s, box-shadow 0.3s; padding: 0 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.2); position: relative;
}
.input-wrapper:focus-within { border-color: rgb(151,0,178); box-shadow: 0 0 0 3px rgba(151,0,178,0.15); }

.emoji-btn {
    width: 32px; height: 32px; border-radius: 50%; background: transparent; border: none; font-size: 16px; color: #888; display: flex; align-items: center; justify-content: center; transition: all 0.2s; cursor: pointer; flex-shrink: 0;
}
.emoji-btn:hover { background: rgba(151,0,178,0.12); color: rgb(151,0,178); }
.emoji-btn.active { background: rgba(151,0,178,0.2); color: rgb(151,0,178); }

#messageInput { flex: 1; padding: 8px 6px; background: transparent; border: none; font-size: 14px; color: #e8e8e8; outline: none; min-width: 0; }
#messageInput::placeholder { color: #666; }
#messageInput.recording { opacity: 0.3; }

.send-btn {
    width: 38px; height: 38px; border-radius: 50%; background: rgb(151,0,178); color: #fff; font-size: 20px; font-weight: bold; border: none; display: none; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; box-shadow: 0 2px 8px rgba(151,0,178,0.3);
}
.send-btn:hover:not(:disabled) { background: rgb(130,0,155); transform: scale(1.05); box-shadow: 0 4px 12px rgba(151, 0, 178, 0.4); }
.send-btn:active:not(:disabled) { transform: scale(0.95); }

/* ---- ВОЙС ИНДИКАТОР ---- */
.voice-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2a2a32;
    border-radius: 24px;
    border: 1px solid rgb(151,0,178);
    display: none;
    align-items: center;
    padding: 0 12px;
    z-index: 2;
    animation: pulseBorder 1s ease-in-out infinite;
}
.voice-indicator.active { display: flex; }
@keyframes pulseBorder {
    0%, 100% { border-color: rgb(151,0,178); }
    50% { border-color: #4fc3f7; }
}
.voice-indicator-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.voice-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef5350;
    animation: blink 0.8s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.voice-text { color: #e8e8e8; font-size: 13px; font-weight: 500; }
.voice-timer {
    color: #4fc3f7;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}
.voice-cancel-btn-inline {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    padding: 0 4px;
    transition: color 0.3s;
    cursor: pointer;
}
.voice-cancel-btn-inline:hover { color: #ef5350; }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.chat-input.has-text .microphone-btn { display: none; }
.chat-input.has-text .send-btn { display: flex; }

/* ---- ВЫЕЗЖАЮЩЕЕ МЕНЮ ---- */
.side-menu { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; }
.side-menu.active { pointer-events: all; opacity: 1; }
.side-menu-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.side-menu-content { position: absolute; top: 0; left: -280px; width: 280px; height: 100%; max-height: 100vh; overflow-y: auto; background: #1e1e26; box-shadow: 4px 0 24px rgba(0,0,0,0.4); transition: left 0.3s ease; display: flex; flex-direction: column; padding: 20px 0; border-radius: 0 28px 28px 0; border-right: 1px solid rgba(255,255,255,0.06); }
.side-menu.active .side-menu-content { left: 0; }

.side-menu-header { display: flex; align-items: center; gap: 14px; padding: 0 16px 16px 16px; border-bottom: 1px solid #2a2a32; flex-shrink: 0; margin: 0 8px; }
.menu-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: white; flex-shrink: 0; cursor: pointer; box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 4px rgba(0,0,0,0.15); }
.menu-user-info { flex: 1; min-width: 0; }
.menu-display-name { font-size: 16px; font-weight: 600; color: #e8e8e8; cursor: pointer; }
.menu-username { font-size: 13px; color: #888; }

.side-menu-currency { display: flex; align-items: center; padding: 8px 16px; border-bottom: 1px solid #2a2a32; gap: 10px; transition: background 0.2s; margin: 0 8px; border-radius: 12px; cursor: pointer; flex-shrink: 0; }
.side-menu-currency:hover { background: #2a2a32; }
.currency-icon-wrap { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, rgba(255,215,0,0.25) 0%, rgba(255,215,0,0) 70%); flex-shrink: 0; }
.currency-icon { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; }
.currency-balance { font-size: 14px; font-weight: 600; color: #ffd54f; }

.side-menu-item { display: flex; align-items: center; gap: 14px; padding: 12px 20px; transition: background 0.2s; color: #e8e8e8; font-size: 15px; cursor: pointer; flex-shrink: 0; border-radius: 12px; margin: 0 8px; }
.side-menu-item:hover { background: #2a2a32; }
.side-menu-item .menu-icon { display: flex; align-items: center; justify-content: center; width: 24px; text-align: center; }
.side-menu-item.logout-item { color: #ef5350; }
.side-menu-item.logout-item:hover { background: rgba(239,83,80,0.15); }
.side-menu-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid #2a2a32; flex-shrink: 0; margin: 0 8px; }
.side-menu-footer:last-child { padding-bottom: 8px; }
.menu-version { font-size: 12px; color: #555; }

/* ---- НАСТРОЙКИ (Telegram-style two-panel, replaces sidebar) ---- */
.settings-page {
    display: none;
    flex: 1;
    background: #16161c;
    overflow: hidden;
    min-height: 0;
    min-width: 0;
    margin: 8px 0 8px 8px;
    border-radius: 28px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 20px rgba(0,0,0,0.4);
    position: relative;
    z-index: 5;
}
.settings-page.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.2s ease;
}
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #3a3a44 transparent;
}
.settings-content::-webkit-scrollbar { width: 4px; }
.settings-content::-webkit-scrollbar-track { background: transparent; }
.settings-content::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }
.settings-layout {
    display: flex;
    width: 100%;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Левая колонка — список настроек */
.settings-sidebar {
    width: 340px;
    min-width: 340px;
    background: #1a1a22;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.settings-sidebar-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 56px;
}
.settings-sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #e8e8e8;
    margin: 0;
}
.settings-search {
    padding: 0 12px 10px;
    flex-shrink: 0;
}
.settings-search input {
    width: 100%;
    padding: 8px 14px;
    background: #2a2a32;
    border: 1px solid #3a3a44;
    border-radius: 20px;
    font-size: 14px;
    color: #e8e8e8;
    outline: none;
    transition: border-color 0.3s;
}
.settings-search input:focus { border-color: rgb(151,0,178); }
.settings-search input::placeholder { color: #666; }

/* Карточка профиля */
.settings-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.settings-profile-card:hover { background: #1e1e26; }
.settings-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    user-select: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 4px rgba(0,0,0,0.15);
}
.settings-profile-info {
    flex: 1;
    min-width: 0;
}
.settings-display-name {
    font-size: 16px;
    font-weight: 600;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-profile-username {
    font-size: 14px;
    color: #888;
}

/* Список настроек */
.settings-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    min-height: 0;
    color: #888;
}
.settings-list::-webkit-scrollbar { width: 4px; }
.settings-list::-webkit-scrollbar-track { background: transparent; }
.settings-list::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }
.settings-list-bottom {
    padding: 6px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.settings-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.settings-list-item:hover { background: #1e1e26; }
.settings-list-item.active { background: #2a2a3a; }

.settings-list-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
}
.settings-list-item:hover .settings-list-icon {
    opacity: 0.8;
}
.settings-list-label {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-list-value {
    font-size: 14px;
    color: #888;
    flex-shrink: 0;
    margin-right: 4px;
}
.settings-arrow {
    color: #555;
    font-size: 20px;
    flex-shrink: 0;
}

/* Правая колонка — контент */
.settings-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f12;
    overflow: hidden;
    min-width: 0;
}
.settings-content-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 56px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.settings-content-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: #e8e8e8;
    margin: 0;
}
.back-btn-settings {
    background: none;
    border: none;
    color: rgb(151,0,178);
    font-size: 28px;
    padding: 0 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}
.back-btn-settings:hover { color: rgb(130,0,155); }

.settings-content-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px 20px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #3a3a44 transparent;
}
.settings-content-body::-webkit-scrollbar { width: 4px; }
.settings-content-body::-webkit-scrollbar-track { background: transparent; }
.settings-content-body::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }

/* Секции контента */
.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 0 8px;
}
.settings-section-title:first-child { padding-top: 4px; }

.settings-group {
    background: #1a1a20;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    cursor: pointer;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: #222230; }
.settings-row-label {
    font-size: 15px;
    color: #e8e8e8;
    flex: 1;
}
.settings-row-value {
    font-size: 14px;
    color: #888;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Тоггл (переключатель) */
.toggle-switch {
    width: 46px;
    height: 28px;
    background: #3a3a44;
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.25s;
    flex-shrink: 0;
}
.toggle-switch.on { background: rgb(151,0,178); }
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch.on::after { transform: translateX(18px); }

/* Старые совместимые стили (оставляем для поддержки) */
.settings-profile { display: flex; align-items: center; gap: 16px; padding: 16px; background: #1e1e26; border-radius: 12px; margin-bottom: 12px; }
.settings-name { flex: 1; }
.settings-name .role-badge.developer { width: 20px; height: 20px; }
.settings-name #settingsDisplayName { font-size: 20px; font-weight: 600; color: #e8e8e8; }
.settings-name #settingsUsername { font-size: 14px; color: #888; }
.settings-bio { padding: 12px 16px; background: #1e1e26; border-radius: 12px; color: #aaa; font-size: 14px; line-height: 1.5; margin-bottom: 20px; min-height: 40px; }
.settings-divider { height: 1px; background: #2a2a32; margin: 8px 0; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 10px; transition: background 0.2s; color: #e8e8e8; font-size: 15px; cursor: pointer; }
.settings-item:hover { background: #2a2a32; }

/* ---- РЕДАКТИРОВАНИЕ ПРОФИЛЯ ---- */
.edit-form { display: flex; flex-direction: column; gap: 16px; }
.edit-field { display: flex; flex-direction: column; gap: 6px; }
.edit-field label { color: #888; font-size: 13px; font-weight: 500; }
.edit-field input, .edit-field textarea { padding: 10px 14px; background: #2a2a32; border: 1px solid #3a3a44; border-radius: 10px; color: #e8e8e8; font-size: 14px; font-family: inherit; transition: border-color 0.3s; }
.edit-field input:focus, .edit-field textarea:focus { outline: none; border-color: rgb(151,0,178); }
.edit-field textarea { resize: vertical; min-height: 60px; }
.save-btn { padding: 12px; background: rgb(151,0,178); color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; transition: background 0.3s; margin-top: 8px; cursor: pointer; }
.save-btn:hover { background: rgb(130,0,155); transform: scale(1.01); }
.save-btn:active { transform: scale(0.97); }

/* ---- КОШЕЛЁК ---- */
.wallet-card {
    margin: 8px 16px;
    background: linear-gradient(135deg, #1a1a28, #2a1a38);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.wallet-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(151,0,178,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.wallet-card-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.wallet-amount {
    font-size: 48px;
    font-weight: 700;
    color: #ffd54f;
    letter-spacing: -1px;
    line-height: 1;
    -webkit-text-stroke: 1px rgba(0,0,0,0.5);
    text-shadow: 0 0 40px rgba(255,213,79,0.3), 0 0 80px rgba(255,213,79,0.15);
    position: relative;
    z-index: 1;
}
.wallet-currency {
    font-size: 14px;
    color: #888;
    margin-top: 4px;
}
.wallet-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.wallet-particle {
    position: absolute;
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    will-change: transform, opacity;
}

/* ---- ДЕЙСТВИЯ В КОШЕЛЬКЕ ---- */
.wallet-actions {
    display: flex;
    gap: 12px;
    padding: 12px 16px 0;
}
.wallet-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: rgb(151,0,178);
    color: #fff;
}
.wallet-btn:hover { background: rgb(130,0,155); transform: scale(1.02); }
.wallet-btn:active { transform: scale(0.97); }
.wallet-btn-secondary {
    background: #2a2a32;
    color: #e8e8e8;
}
.wallet-btn-secondary:hover { background: #3a3a44; }

/* ---- МОДАЛКА ПОПОЛНЕНИЯ ---- */
.topup-modal {
    padding: 28px 24px 24px;
}
.topup-modal .profile-modal-body {
    padding: 0 24px 24px;
}
.topup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.topup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2a2a32;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.topup-row:hover {
    background: #353540;
    border-color: rgba(255,213,79,0.2);
    transform: scale(1.01);
}
.topup-row:active { transform: scale(0.98); }
.topup-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topup-gram-img {
    width: 40px;
    height: auto;
    border-radius: 6px;
    filter: drop-shadow(0 0 6px rgba(255,213,79,0.3));
    transition: filter 0.3s;
}
.topup-row:hover .topup-gram-img {
    filter: drop-shadow(0 0 12px rgba(255,213,79,0.6));
}
.topup-grams {
    font-size: 18px;
    font-weight: 700;
    color: #ffd54f;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.3);
}
.topup-grams-label {
    font-size: 14px;
    color: #888;
}
.topup-price {
    font-size: 16px;
    font-weight: 600;
    color: #e8e8e8;
}

/* ---- ИСТОРИЯ ГРАММОВ ---- */
.wallet-history {
    margin-top: 12px;
    padding: 0 16px 16px;
}
.wallet-history-header {
    color: #888;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
}
.tx-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background 0.15s;
    font-size: 13px;
}
.tx-row:hover {
    background: #2a2a32;
}
.tx-label {
    width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 12px;
}
.tx-label.tx-positive { color: #66bb6a; }
.tx-label.tx-negative { color: #e53935; }
.tx-fromto-wrap {
    flex: 1;
    min-width: 0;
    padding: 0 4px;
}
.tx-fromto {
    color: #888;
    font-size: 12px;
    font-family: 'SF Mono', 'Menlo', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-amount {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.tx-amount.tx-positive { color: #66bb6a; }
.tx-amount.tx-negative { color: #e53935; }
.tx-gram-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.8;
}

/* ---- ЧЕК ТРАНЗАКЦИИ В ЧАТЕ ---- */
.message-transaction {
    background: transparent !important;
}
.message-transaction .message-content {
    display: none;
}
.tx-check {
    background: linear-gradient(135deg, #1a1a24 0%, #22222e 100%);
    border: 1px solid rgba(151,0,178,0.25);
    border-radius: 14px;
    padding: 14px 16px;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.tx-check-header,
.tx-check-body {
    position: relative;
    z-index: 1;
}
.message.sent .tx-check {
    border-color: rgba(151,0,178,0.35);
}
.message.received .tx-check {
    border-color: rgba(255,255,255,0.1);
}
.tx-check-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tx-check-icon {
    font-size: 20px;
}
.tx-check-title {
    font-size: 14px;
    font-weight: 700;
    color: #e8e8e8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tx-check-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tx-check-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.tx-check-label {
    color: #888;
    font-weight: 500;
}
.tx-check-value {
    color: #ccc;
    font-weight: 600;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 12px;
}
.tx-check-amount {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 4px;
    padding: 10px;
    background: rgba(255,213,79,0.08);
    border-radius: 10px;
    border: 1px solid rgba(255,213,79,0.15);
    position: relative;
    overflow: hidden;
}
.tx-check-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.tx-check-particle {
    position: absolute;
    width: 14px;
    height: 14px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    will-change: transform, opacity;
}
.tx-check-amount-value,
.tx-check-amount-unit {
    position: relative;
    z-index: 1;
}
.tx-check-amount-value {
    font-size: 24px;
    font-weight: 800;
    color: #ffd54f;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.3);
}
.tx-check-amount-unit {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}
.tx-check-date {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

/* ---- МОДАЛКА ОТПРАВКИ ГРАМ ---- */
.send-modal {
    max-width: 400px;
    width: 90vw;
}
.send-modal-title {
    color: #e8e8e8;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin: 0 0 16px;
    padding: 0 24px;
}
.send-search-wrap {
    padding: 0 24px;
    margin-bottom: 12px;
}
.send-search-input {
    width: 100%;
    padding: 10px 14px;
    background: #2a2a32;
    border: 1px solid #3a3a44;
    border-radius: 10px;
    color: #e8e8e8;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.send-search-input:focus {
    border-color: rgb(151,0,178);
}
.send-search-input::placeholder {
    color: #666;
}
.send-users-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 0 8px;
}
.send-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
}
.send-user-row:hover {
    background: #2a2a32;
}
.send-user-row.selected {
    background: rgba(151,0,178,0.15);
    border: 1px solid rgba(151,0,178,0.3);
}
.send-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 0 0 3px rgba(0,0,0,0.12);
}
.send-user-info {
    flex: 1;
    min-width: 0;
}
.send-user-name {
    font-size: 15px;
    font-weight: 600;
    color: #e8e8e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.send-user-username {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.send-user-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgb(151,0,178);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.send-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 24px 20px;
    border-bottom: 1px solid #2a2a32;
    margin-bottom: 8px;
}
.send-recipient-label {
    color: #aaa;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
}
.send-amount-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e1e24;
    border: 2px solid #3a3a44;
    border-radius: 12px;
    padding: 4px 16px;
    transition: border-color 0.2s;
}
.send-amount-wrap:focus-within {
    border-color: rgb(151,0,178);
}
.send-amount-wrap.has-error {
    border-color: #e53935;
    box-shadow: 0 0 12px rgba(229,57,53,0.3);
}
.send-amount-input {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: #ffd54f;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    -moz-appearance: textfield;
    min-width: 0;
}
.send-amount-input::-webkit-outer-spin-button,
.send-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.send-amount-input.error {
    color: #e53935;
}
.send-amount-input:disabled {
    opacity: 0.35;
    cursor: default;
}
.send-amount-suffix {
    color: #888;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}
.send-error {
    display: none;
    color: #e53935;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}
.send-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: rgb(151,0,178);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.send-submit-btn:hover:not(:disabled) {
    background: rgb(130,0,155);
    transform: scale(1.02);
}
.send-submit-btn:active:not(:disabled) {
    transform: scale(0.97);
}
.send-submit-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---- ВЫБОР ЦВЕТА ФОНА ---- */
.bg-color-picker { display: flex; gap: 10px; padding: 8px 16px 16px; flex-wrap: wrap; }
.bg-color-circle { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; transition: all 0.25s; border: 2px solid transparent; flex-shrink: 0; }
.bg-color-circle:hover { transform: scale(1.1); }
.bg-color-circle.selected { border-color: #fff; box-shadow: 0 0 0 2px rgb(151,0,178), 0 0 16px rgba(151,0,178,0.4); transform: scale(1.1); }

.bg-gradient-picker { display: flex; gap: 10px; padding: 0 16px 16px; flex-wrap: wrap; }
.bg-gradient-circle { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; transition: all 0.25s; border: 2px solid rgba(255,255,255,0.2); flex-shrink: 0; background-size: cover; }
.bg-gradient-circle:hover { transform: scale(1.1); border-color: rgba(255,255,255,0.5); }
.bg-gradient-circle.selected { border-color: #fff; box-shadow: 0 0 0 2px rgb(151,0,178), 0 0 16px rgba(151,0,178,0.4); transform: scale(1.1); }

/* Превью профиля */
.bg-color-preview {
    margin: 8px 16px 16px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.bg-preview-header {
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: background 0.3s;
}
.bg-preview-avatar-wrap {
    display: flex;
    justify-content: center;
}
.bg-preview-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3), 0 2px 8px rgba(0,0,0,0.2);
}
.bg-preview-name {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}
.bg-preview-status {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

/* ---- СТАТУС ОНЛАЙН ---- */
.status-picker { padding: 4px 0; }
.status-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #1e1e26;
    border-radius: 12px;
    transition: all 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
    margin-bottom: 6px;
}
.status-option:hover { background: #2a2a32; border-color: #3a3a44; }
.status-option.selected { border-color: rgb(151,0,178); background: #2a2a3a; }
.status-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.status-icon svg { display: block; }
.status-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.status-name { font-size: 15px; font-weight: 500; color: #e8e8e8; }
.status-desc { font-size: 12px; color: #888; line-height: 1.4; }
.status-check {
    font-size: 18px;
    color: rgb(151,0,178);
    font-weight: 700;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ---- ЗВУКИ ---- */
.sound-list { display: flex; flex-direction: column; gap: 10px; }
.sound-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: #1e1e26; border-radius: 12px; transition: all 0.2s; border: 2px solid transparent; cursor: pointer; }
.sound-item:hover { background: #2a2a32; border-color: #3a3a44; }
.sound-item.active { border-color: rgb(151,0,178); background: #2a2a3a; }
.sound-info { display: flex; flex-direction: column; gap: 2px; }
.sound-name { font-size: 16px; font-weight: 500; color: #e8e8e8; }
.sound-desc { font-size: 13px; color: #888; }
.sound-check { font-size: 20px; color: #66bb6a; display: none; }
.sound-check.visible { display: inline; }
.sound-info-text { margin-top: 16px; padding: 12px 16px; background: #1e1e26; border-radius: 10px; color: #888; font-size: 13px; line-height: 1.6; }
.sound-info-text p { margin: 0; }

/* ---- ТИКЕТЫ ---- */
.ticket-form { display: flex; flex-direction: column; gap: 16px; }
.ticket-info { color: #888; font-size: 14px; line-height: 1.6; padding: 12px 16px; background: #1e1e26; border-radius: 10px; }
#ticketMessage { padding: 12px 16px; background: #2a2a32; border: 1px solid #3a3a44; border-radius: 10px; color: #e8e8e8; font-size: 14px; font-family: inherit; resize: vertical; min-height: 120px; }
#ticketMessage:focus { outline: none; border-color: rgb(151,0,178); }
#sendTicketBtn { padding: 12px 28px; background: rgb(151,0,178); color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; transition: all 0.3s ease; width: 100%; margin-top: 8px; cursor: pointer; }
#sendTicketBtn:hover { background: rgb(130,0,155); transform: scale(1.01); }
#sendTicketBtn:active { transform: scale(0.97); }

/* ---- DEVELOPER PANEL ---- */
.dev-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.dev-stat-item { background: #1e1e26; padding: 16px; border-radius: 12px; text-align: center; transition: background 0.2s; border: 1px solid transparent; cursor: pointer; }
.dev-stat-item:hover { background: #2a2a32; border-color: #3a3a44; }
.dev-stat-label { display: block; color: #888; font-size: 13px; margin-bottom: 6px; }
.dev-stat-value { display: block; color: #e8e8e8; font-size: 28px; font-weight: 600; }
.ticket-item { background: #1e1e26; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid #2a2a32; }
.ticket-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ticket-user { font-weight: 500; color: #e8e8e8; font-size: 14px; }
.ticket-status { font-size: 13px; font-weight: 500; padding: 2px 10px; border-radius: 12px; background: rgba(255,255,255,0.05); }
.ticket-message { color: #aaa; font-size: 14px; line-height: 1.5; padding: 8px 0; word-break: break-word; }
.ticket-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid #2a2a32; }
.ticket-time { color: #666; font-size: 12px; }
.ticket-actions { display: flex; gap: 6px; }
.ticket-btn { padding: 4px 12px; background: #3a3a44; color: #e8e8e8; border: none; border-radius: 6px; font-size: 12px; transition: background 0.2s; cursor: pointer; }
.ticket-btn:hover { background: #4a4a54; }
.ticket-btn.resolve { background: #66bb6a; color: #0f0f12; }
.ticket-btn.resolve:hover { background: #4caf50; }
.ticket-action-btn { padding: 6px 14px; background: #3a3a44; color: #e8e8e8; border: none; border-radius: 10px; font-size: 12px; font-weight: 500; transition: all 0.2s; cursor: pointer; }
.ticket-action-btn:hover { background: #4a4a54; transform: scale(1.02); }
.ticket-action-btn.resolved { background: #66bb6a; color: #0f0f12; }
.ticket-action-btn.resolved:hover { background: #4caf50; }
.ticket-date { color: #666; font-size: 12px; margin-bottom: 8px; }

.dev-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid #2a2a32; padding-bottom: 8px; }
.dev-tab { padding: 8px 16px; background: transparent; border: none; color: #888; font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.dev-tab:hover { background: #2a2a32; color: #e8e8e8; }
.dev-tab.active { color: rgb(151,0,178); background: rgba(151,0,178,0.1); }
.dev-tab-content { display: none; animation: fadeIn 0.2s ease; }
.dev-tab-content.active { display: block; }
.broadcast-form { display: flex; flex-direction: column; gap: 8px; }
#broadcastMessage { padding: 12px 16px; background: #2a2a32; border: 1px solid #3a3a44; border-radius: 12px; color: #e8e8e8; font-size: 14px; font-family: inherit; resize: vertical; min-height: 120px; }
#broadcastMessage:focus { outline: none; border-color: rgb(151,0,178); }
#broadcastStatus { padding: 8px 12px; border-radius: 8px; background: #1e1e26; color: #888; }

/* ---- МОДАЛЬНЫЕ ОКНА ---- */
.profile-view { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(4px); }
.profile-view.active { display: flex; }
.profile-modal { background: #1e1e26; border-radius: 16px; max-width: 400px; width: 90%; max-height: 80vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.8); border: 1px solid #2a2a32; }
.profile-modal::-webkit-scrollbar { width: 4px; }
.profile-modal::-webkit-scrollbar-track { background: transparent; }
.profile-modal::-webkit-scrollbar-thumb { background: #3a3a44; border-radius: 4px; }
.profile-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: rgba(255,255,255,0.7); font-size: 24px; transition: color 0.3s; cursor: pointer; z-index: 2; }
.profile-close:hover { color: #fff; }
.profile-modal-header { border-radius: 16px 16px 0 0; position: relative; }
.profile-modal-body { padding: 20px 32px 32px; }
.profile-modal .profile-avatar { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 600; color: white; user-select: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.35), 0 0 0 6px rgba(0,0,0,0.15); }
.profile-modal .profile-fullname { text-align: center; font-size: 22px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.profile-modal .profile-username { text-align: center; font-size: 15px; color: rgba(255,255,255,0.7); margin-bottom: 4px; text-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.profile-modal-status { text-align: center; font-size: 14px; color: rgba(255,255,255,0.85); text-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.profile-modal .profile-bio { padding: 12px 16px; background: #2a2a32; border-radius: 10px; color: #aaa; font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.profile-modal .profile-info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #2a2a32; color: #888; font-size: 14px; }
.profile-modal .profile-info-row .label { color: #666; }
.profile-modal .profile-info-row .value { color: #e8e8e8; }
.profile-modal .profile-info-row .value.online { color: #66bb6a; }
.profile-gift-section { margin: 8px 0; padding: 8px 0; border-top: 1px solid #2a2a32; }
.profile-gift-label { display: block; color: #888; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.profile-gifts-grid { display: grid; grid-template-columns: repeat(6, 48px); gap: 6px; }
.profile-gift-emoji { width: 48px; height: 48px; font-size: 48px; line-height: 1; display: flex; align-items: center; justify-content: center; background: #1e1e26; border-radius: 8px; border: 1px solid #2a2a32; animation: giftPulse 2s ease-in-out infinite; }
.profile-gift-emoji:hover { filter: drop-shadow(0 0 8px rgba(255,215,0,0.5)); animation-duration: 0.6s; }

/* ---- ПРОФИЛЬ В ВИДЕ СТРАНИЦЫ ---- */
.profile-card { background: #1e1e26; border-radius: 16px; padding: 28px 24px 20px; text-align: center; border: 1px solid #2a2a32; }
.profile-card-avatar { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 600; color: white; margin: 0 auto 12px; user-select: none; }
.profile-card-name { font-size: 22px; font-weight: 600; color: #e8e8e8; margin-bottom: 2px; }
.profile-card-username { font-size: 15px; color: #888; margin-bottom: 16px; }
.profile-card-bio { padding: 12px 16px; background: #2a2a32; border-radius: 10px; color: #aaa; font-size: 14px; line-height: 1.5; margin-bottom: 12px; text-align: left; }
.profile-card-info { text-align: left; }
.profile-card-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #2a2a32; color: #888; font-size: 14px; }
.profile-card-row .label { color: #666; }
.profile-card-row .value { color: #e8e8e8; }
.profile-card-row .value.online { color: #66bb6a; }
.profile-card-row:last-child { border-bottom: none; }

/* ---- ПРОФИЛЬ (Telegram-стиль) ---- */
.profile-page-header {
    position: relative;
    padding: 48px 24px 32px;
    text-align: center;
    color: white;
    border-radius: 0 0 16px 16px;
}
.profile-page-back {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}
.profile-page-back:hover { background: rgba(0,0,0,0.4); }
.profile-page-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}
.profile-avatar-frame {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.profile-page-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 600;
    color: white;
    border: 4px solid rgba(255,255,255,0.4);
    user-select: none;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1), 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
}
.profile-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}
.profile-page-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.profile-page-status {
    font-size: 14px;
    opacity: 0.85;
}

/* Информация */
.profile-page-info {
    background: #1a1a22;
    margin: 12px;
    border-radius: 12px;
    overflow: hidden;
}
.profile-info-row {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.profile-info-row:last-child { border-bottom: none; }
.profile-info-label {
    font-size: 13px;
    color: rgb(151,0,178);
    margin-bottom: 3px;
}
.profile-info-value {
    font-size: 15px;
    color: #e8e8e8;
}

/* Вкладки */
.profile-page-tabs {
    margin: 0 12px 12px;
    background: #1a1a22;
    border-radius: 12px;
    overflow: hidden;
}
.profile-page-tabs-header {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.profile-tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.profile-tab-btn.active {
    color: rgb(151,0,178);
}
.profile-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 2px;
    background: rgb(151,0,178);
    border-radius: 2px;
}
.profile-tab-btn:hover { color: #bbb; }
.profile-tab-content {
    display: none;
}
.profile-tab-content.active {
    display: block;
}

/* ---- МАГАЗИН ПОДАРКОВ ---- */
.gift-shop-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; display: none; justify-content: center; align-items: center; pointer-events: none; }
.gift-shop-modal.active { display: flex; pointer-events: auto; }
.gift-shop-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.gift-shop-content { position: relative; background: #1a1a20; border-radius: 16px; max-width: 600px; width: 92%; max-height: 85vh; overflow: hidden; border: 1px solid #2a2a32; box-shadow: 0 24px 64px rgba(0,0,0,0.8); z-index: 1; display: flex; flex-direction: column; }
.gift-shop-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid #2a2a32; background: #16161c; flex-shrink: 0; }
.gift-shop-header h3 { color: #e8e8e8; font-size: 18px; font-weight: 500; margin: 0; }
.gift-shop-close { background: none; border: none; color: #666; font-size: 24px; padding: 0 4px; transition: color 0.3s; line-height: 1; cursor: pointer; }
.gift-shop-close:hover { color: #ef5350; }
.gift-shop-body { padding: 20px; overflow-y: auto; flex: 1; }
.gift-shop-description { color: #888; font-size: 14px; text-align: center; margin-bottom: 16px; }
.gram-badge-clickable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255,213,79,0.12);
    color: #ffd54f;
    font-size: 15px;
    font-weight: 700;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.4);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, transform 0.15s;
}
.gram-badge-clickable:hover {
    background: rgba(255,213,79,0.22);
    transform: scale(1.04);
}
.gram-badge-clickable:active {
    transform: scale(0.96);
}
.gram-badge-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.gift-card { background: #1e1e26; border-radius: 12px; padding: 16px 12px; text-align: center; border: 1px solid #2a2a32; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; }
.gift-card:hover { border-color: #3a3a44; transform: translateY(-2px); }
.gift-image { width: 140px; height: 140px; border-radius: 50%; background: #0f0f12; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; border: 1px solid #2a2a32; }
.gift-emoji { font-size: 96px !important; line-height: 1; display: inline-block; animation: giftPulse 2s ease-in-out infinite; }
@keyframes giftPulse { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.gift-image .gift-emoji:hover { filter: drop-shadow(0 0 8px rgba(255,215,0,0.5)); animation-duration: 0.6s; }
.gift-name { color: #e8e8e8; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.gift-price { color: #ffd54f; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.currency-icon-small { width: 16px; height: 16px; vertical-align: middle; margin-right: 4px; object-fit: contain; }
.gift-buy-btn { background: rgb(151,0,178); color: #fff; border: none; border-radius: 8px; padding: 6px 16px; font-size: 13px; font-weight: 600; transition: background 0.2s; width: 100%; cursor: pointer; }
.gift-buy-btn:hover { background: rgb(130,0,155); }
.gram-link { color: rgb(151, 0, 178); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; transition: opacity 0.2s; }
.gram-link:hover { opacity: 0.7; }
.side-menu-item .menu-icon img { width: 20px; height: 20px; border-radius: 4px; object-fit: contain; }

/* ---- ОБРЕЗКА АВАТАРА ---- */
.avatar-crop-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; display: none; justify-content: center; align-items: center; pointer-events: none; }
.avatar-crop-modal.active { display: flex; pointer-events: auto; }
.avatar-crop-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.avatar-crop-box { position: relative; background: #1a1a20; border-radius: 16px; max-width: 460px; width: 92%; max-height: 90vh; overflow: hidden; border: 1px solid #2a2a32; box-shadow: 0 24px 64px rgba(0,0,0,0.8); z-index: 1; margin: auto; }
.avatar-crop-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #2a2a32; background: #16161c; }
.avatar-crop-title { color: #e8e8e8; font-size: 16px; font-weight: 500; }
.avatar-crop-close { background: none; border: none; color: #666; font-size: 22px; padding: 0 4px; transition: color 0.3s; line-height: 1; cursor: pointer; }
.avatar-crop-close:hover { color: #ef5350; }
.avatar-crop-body { padding: 16px 18px 20px; background: #121217; }
.avatar-crop-image-wrap { position: relative; width: 100%; overflow: hidden; border-radius: 12px; background: #0a0a0f; border: 1px solid #2a2a32; touch-action: none; }
.avatar-crop-image-wrap canvas { width: 100%; height: auto; display: block; cursor: grab; touch-action: none; }
.avatar-crop-image-wrap canvas:active { cursor: grabbing; }
.avatar-crop-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 8px 12px; background: #16161c; border-radius: 10px; border: 1px solid #2a2a32; }
.avatar-crop-hint { display: flex; flex-direction: column; gap: 1px; }
.avatar-crop-hint span { color: #555; font-size: 11px; }
.avatar-crop-preview-wrap { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 2px solid #2a2a32; background: #0a0a0f; flex-shrink: 0; }
.avatar-crop-preview-wrap canvas { width: 100%; height: 100%; display: block; }
.avatar-crop-buttons { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }
.avatar-crop-btn { padding: 9px 26px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; transition: all 0.2s ease; cursor: pointer; }
.avatar-crop-btn.cancel { background: #2a2a32; color: #888; }
.avatar-crop-btn.cancel:hover { background: #3a3a44; color: #aaa; }
.avatar-crop-btn.save { background: rgb(151,0,178); color: #fff; }
.avatar-crop-btn.save:hover { background: rgb(130,0,155); transform: scale(1.02); }
.avatar-crop-btn.save:active { transform: scale(0.96); }

/* ---- АНИМАЦИИ ---- */
@keyframes fadeIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseMic { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,83,80,0.3); } 50% { transform: scale(1.05); box-shadow: 0 0 20px 5px rgba(239,83,80,0.15); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,83,80,0); } }
@keyframes giftPulse { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ---- МОБИЛЬНАЯ АДАПТАЦИЯ ---- */
@media screen and (max-width: 768px) {
    .messenger { height: 100vh; max-height: 100vh; border-radius: 0; flex-direction: column; position: relative; width: 100%; max-width: 100%; overflow: hidden; }
    .sidebar { width: 100%; min-width: unset; height: 100%; border-right: none; display: flex !important; flex-direction: column; flex: 1; border-radius: 0; margin: 0; }
    .chat { display: none !important; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: #121217; z-index: 100; border-radius: 0 !important; flex-direction: column; margin: 0 !important; box-shadow: none !important; }
    .chat.active { display: flex !important; flex-direction: column; }
    .settings-page { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; background: #121217; z-index: 100; border-radius: 0 !important; flex-direction: column; margin: 0 !important; box-shadow: none !important; }
    .settings-page.active { display: flex; flex-direction: column; }
    .chat-header { border-radius: 0 !important; min-height: 60px; padding: 10px 16px; }
    .settings-header { border-radius: 0 !important; min-height: 60px; padding: 10px 16px; margin: 0; }
    .chat-input { border-radius: 0 !important; padding: 10px 12px; gap: 8px; flex-wrap: nowrap; }
    .chat-messages { padding: 12px 16px; }
    .message { max-width: 80%; font-size: 14px; padding: 8px 14px; }
    .chat-header .back-btn-mobile { display: flex !important; font-size: 28px; color: rgb(151, 0, 178); background: none; border: none; padding: 4px 8px; cursor: pointer; line-height: 1; }
    .chat-header .back-btn-mobile:hover { color: rgb(130, 0, 155); }
    .chat-avatar-wrapper .avatar-chat { width: 40px; height: 40px; font-size: 16px; }
    .avatar-crop-box { width: 95%; }
    .profile-modal { width: 95%; max-width: 95%; margin: 20px; }
    .profile-modal-body { padding: 16px 20px 24px; }
    .gift-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
    .gift-image { width: 100px; height: 100px; }
    .gift-emoji { font-size: 64px !important; }
    .emoji-grid { grid-template-columns: repeat(7, 1fr); }
    .dev-stats { grid-template-columns: repeat(2, 1fr); }
    .profile-gifts-grid { grid-template-columns: repeat(5, 44px); }
    .side-menu-content { width: 260px; left: -260px; }
    .side-menu.active .side-menu-content { left: 0; }
    .settings-content { padding: 16px; }
    .settings-item { font-size: 14px; padding: 12px 14px; }
    .settings-profile { padding: 12px; gap: 12px; }
    .settings-avatar { width: 56px; height: 56px; font-size: 24px; }
    .settings-name #settingsDisplayName { font-size: 18px; }
    .search-container { padding: 8px 12px; }
    #searchInput { font-size: 13px; padding: 6px 12px; }
    #searchBtn { padding: 6px 12px; font-size: 13px; }
    .dialog-item { padding: 8px 10px; gap: 10px; }
    .dialog-name { font-size: 14px; }
    .dialog-last-message { font-size: 12px; }
    .dialog-status { font-size: 11px; }
    .dialog-avatar .avatar { width: 38px; height: 38px; font-size: 15px; }
}

@media screen and (max-width: 480px) {
    .auth-container { padding: 24px; width: 95%; }
    .auth-logo h1 { font-size: 24px; }
    .logo-image { width: 60px; height: 60px; }
    .settings-content { padding: 12px; }
    .settings-profile { flex-direction: column; text-align: center; gap: 10px; }
    .settings-avatar { width: 72px; height: 72px; font-size: 28px; }
    .settings-name #settingsDisplayName { font-size: 17px; }
    .chat-messages { padding: 10px 12px; }
    .message { max-width: 85%; font-size: 13px; padding: 7px 12px; }
    .chat-input { padding: 8px 10px; gap: 6px; }
    .attach-btn, .emoji-btn, .microphone-btn { width: 36px; height: 36px; font-size: 17px; }
    #messageInput { font-size: 14px; padding: 8px 12px; }
    .send-btn { padding: 6px 14px; font-size: 13px; min-width: 60px; }
    .emoji-grid { grid-template-columns: repeat(6, 1fr); max-height: 180px; }
    .emoji-panel { max-width: 100%; left: 0; right: 0; bottom: 60px; border-radius: 16px 16px 0 0; max-height: 280px; }
    .dev-stats { grid-template-columns: 1fr; }
    .gift-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .gift-image { width: 70px; height: 70px; }
    .gift-emoji { font-size: 40px !important; }
    .gift-card { padding: 12px 8px; }
    .gift-name { font-size: 12px; }
    .gift-price { font-size: 12px; }
    .gift-buy-btn { font-size: 12px; padding: 4px 10px; }
    .profile-gifts-grid { grid-template-columns: repeat(4, 40px); }
    .profile-gift-emoji { width: 40px; height: 40px; font-size: 40px; }
    .profile-modal { width: 95%; max-width: 95%; margin: 10px; }
    .profile-modal-body { padding: 12px 16px 20px; }
    .profile-modal .profile-avatar { width: 64px; height: 64px; font-size: 26px; }
    .profile-modal .profile-fullname { font-size: 18px; }
    .profile-modal .profile-username { font-size: 13px; }
    .profile-modal-status { font-size: 13px; }
    .profile-modal .profile-bio { font-size: 13px; padding: 10px 12px; }
    .profile-modal .profile-info-row { font-size: 13px; padding: 6px 0; }
    .dialog-item { padding: 6px 8px; gap: 8px; }
    .dialog-name { font-size: 13px; }
    .dialog-last-message { font-size: 11px; }
    .dialog-status { font-size: 11px; }
    .dialog-avatar .avatar { width: 32px; height: 32px; font-size: 13px; }
    .unread-badge { font-size: 10px; min-width: 16px; height: 16px; padding: 0 4px; }
    .dialog-time { font-size: 10px; }
    .side-menu-content { width: 240px; left: -240px; }
    .side-menu-item { font-size: 14px; padding: 10px 16px; }
    .menu-avatar { width: 40px; height: 40px; font-size: 17px; }
    .menu-display-name { font-size: 14px; }
    .menu-username { font-size: 12px; }
    .currency-icon-wrap { width: 32px; height: 32px; }
    .currency-icon { width: 20px; height: 20px; }
    .currency-balance { font-size: 13px; }
    .ticket-item { padding: 10px 12px; }
    .ticket-message { font-size: 13px; }
    .ticket-user { font-size: 13px; }
    .ticket-status { font-size: 11px; padding: 1px 8px; }
}

@media screen and (max-width: 360px) {
    .chat-messages { padding: 8px 10px; }
    .message { max-width: 90%; font-size: 12px; padding: 6px 10px; }
    .chat-input { padding: 6px 8px; gap: 4px; }
    .attach-btn, .emoji-btn, .microphone-btn { width: 32px; height: 32px; font-size: 15px; }
    #messageInput { font-size: 13px; padding: 6px 10px; }
    .send-btn { padding: 4px 10px; font-size: 12px; min-width: 50px; }
    .chat-header { padding: 8px 12px; min-height: 50px; }
    .chat-user-name { font-size: 14px; }
    .chat-user-status { font-size: 11px; }
    .chat-avatar-wrapper .avatar-chat { width: 32px; height: 32px; font-size: 14px; }
    .gift-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .gift-image { width: 60px; height: 60px; }
    .gift-emoji { font-size: 32px !important; }
    .gift-card { padding: 10px 6px; }
    .gift-name { font-size: 11px; }
    .gift-price { font-size: 11px; }
    .gift-buy-btn { font-size: 11px; padding: 3px 8px; }
    .profile-gifts-grid { grid-template-columns: repeat(3, 36px); }
    .profile-gift-emoji { width: 36px; height: 36px; font-size: 36px; }
    .emoji-grid { grid-template-columns: repeat(5, 1fr); max-height: 150px; }
    .emoji-item { font-size: 20px; padding: 4px 2px; }
    .side-menu-content { width: 200px; left: -200px; }
    .side-menu-item { font-size: 13px; padding: 8px 14px; }
    .menu-avatar { width: 36px; height: 36px; font-size: 15px; }
    .menu-display-name { font-size: 13px; }
    .menu-username { font-size: 11px; }
    .auth-container { padding: 16px; width: 98%; }
    .auth-logo h1 { font-size: 20px; }
    .auth-form input { padding: 10px 12px; font-size: 13px; }
    .auth-form button { padding: 10px; font-size: 14px; }
    .settings-item { font-size: 13px; padding: 10px 12px; }
    .settings-arrow { font-size: 17px; }
    .settings-header h2 { font-size: 16px; }
    .settings-header { padding: 12px 16px; }
}

/* ---- ПАНЕЛЬ ЭМОДЗИ ---- */
.emoji-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    left: auto;
    max-width: 400px;
    width: 100%;
    background: #1e1e26;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid #2a2a32;
    z-index: 100;
    max-height: 320px;
    display: none !important;
    flex-direction: column;
    overflow: hidden;
}
.emoji-panel.active {
    display: flex !important;
}
.emoji-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #2a2a32;
    flex-shrink: 0;
}
.emoji-title {
    font-size: 14px;
    font-weight: 500;
    color: #e8e8e8;
}
.emoji-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    padding: 4px 8px;
    transition: color 0.3s;
    cursor: pointer;
}
.emoji-close:hover {
    color: #ef5350;
}
.emoji-categories {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a32;
    flex-shrink: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
}
.emoji-cat-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.3s;
    cursor: pointer;
}
.emoji-cat-btn:hover {
    background: #2a2a32;
    color: #e8e8e8;
}
.emoji-cat-btn.active {
    background: rgba(151, 0, 178, 0.2);
    color: rgb(151, 0, 178);
}
.emoji-category-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.3s;
    cursor: pointer;
}
.emoji-category-btn:hover {
    background: #2a2a32;
    color: #e8e8e8;
}
.emoji-category-btn.active {
    background: rgba(151, 0, 178, 0.2);
    color: rgb(151, 0, 178);
}
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    max-height: 220px;
}
.emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    padding: 6px 4px;
    border-radius: 8px;
    transition: all 0.2s;
    background: transparent;
    border: none;
    user-select: none;
    cursor: pointer;
}
.emoji-item:hover {
    background: rgba(151, 0, 178, 0.15);
    transform: scale(1.15);
}
.emoji-item:active {
    transform: scale(0.9);
}

/* ===== ТОСТ-УВЕДОМЛЕНИЯ ===== */
.milligram-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #2a2a35;
    color: #e8e8e8;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    max-width: 90vw;
    text-align: center;
}
.milligram-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.milligram-toast.toast-success { border-color: #66bb6a; }
.milligram-toast.toast-error   { border-color: #ef5350; }
.milligram-toast.toast-warning { border-color: #ffd54f; }
.milligram-toast.toast-info    { border-color: #4fc3f7; }

/* Тост в стиле грам-бейджика */
.milligram-toast.gram-toast {
    background: rgba(255,213,79,0.15);
    color: #ffd54f;
    font-weight: 700;
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.4);
    border-color: rgba(255,213,79,0.3);
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

/* ===== МЕНЮ ДЕЙСТВИЙ НАД СООБЩЕНИЕМ ===== */
.msg-action-menu {
    position: fixed;
    background: #1e1e28;
    border: 1px solid #2a2a38;
    border-radius: 10px;
    padding: 4px;
    z-index: 99999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    min-width: 180px;
    animation: msgMenuIn 0.15s ease-out;
}
@keyframes msgMenuIn {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: #d0d0d8;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.msg-action-btn:hover {
    background: rgba(255,255,255,0.06);
}
.msg-action-btn svg {
    flex-shrink: 0;
    opacity: 0.6;
}
.msg-action-btn.delete:hover {
    background: rgba(239,83,80,0.12);
    color: #ef5350;
}

/* Поле редактирования сообщения */
.msg-edit-input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(151,0,178,0.4);
    border-radius: 6px;
    color: #e8e8e8;
    font-size: 15px;
    padding: 6px 10px;
    width: 100%;
    outline: none;
    font-family: inherit;
}
.msg-edit-input:focus {
    border-color: rgba(151,0,178,0.7);
}

/* Пометки на сообщениях */
.msg-edited-label {
    font-size: 10px;
    color: #888;
    margin-right: 4px;
    font-weight: 500;
}

/* Модалка выбора контакта для пересылки */
.forward-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fpFadeIn 0.15s ease-out;
}
@keyframes fpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.forward-picker-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}
.forward-picker-content {
    position: relative;
    background: #1a1a24;
    border: 1px solid #2a2a38;
    border-radius: 14px;
    width: 92%;
    max-width: 340px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8);
    overflow: hidden;
}
.forward-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #2a2a38;
    background: #16161e;
    flex-shrink: 0;
}
.forward-picker-header h4 {
    color: #e8e8e8;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}
.forward-picker-close {
    background: none;
    border: none;
    color: #666;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.forward-picker-close:hover {
    color: #ef5350;
}
.forward-picker-list {
    overflow-y: auto;
    padding: 8px;
    flex: 1;
}
.forward-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.forward-user:hover {
    background: rgba(255,255,255,0.06);
}
.forward-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2), 0 0 0 3px rgba(0,0,0,0.12);
}
.forward-user-name {
    color: #d0d0d8;
    font-size: 14px;
    font-weight: 500;
}

/* ===== МОДАЛЬНЫЕ ОКНА (alert / confirm) ===== */
.milligram-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100001;
    opacity: 0;
    transition: opacity 0.25s;
}
.milligram-modal-overlay.show {
    opacity: 1;
}
.milligram-modal {
    background: #1a1a24;
    border: 1px solid #2a2a38;
    border-radius: 14px;
    width: 92%;
    max-width: 360px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8);
    transform: scale(0.92);
    transition: transform 0.25s;
}
.milligram-modal.show {
    transform: scale(1);
}
.milligram-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 0;
}
.milligram-modal-title {
    color: #e8e8e8;
    font-size: 17px;
    font-weight: 600;
}
.milligram-modal-close {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.milligram-modal-close:hover {
    color: #ef5350;
}
.milligram-modal-body {
    padding: 12px 20px 16px;
}
.milligram-modal-body p {
    color: #b0b0b8;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}
.milligram-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 20px 16px;
}
.milligram-modal-btn {
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.milligram-modal-btn.confirm {
    color: #fff;
}
.milligram-modal-btn.cancel {
    background: rgba(255,255,255,0.08);
    color: #b0b0b8;
}
.milligram-modal-btn.cancel:hover {
    background: rgba(255,255,255,0.12);
}
.milligram-modal-btn.confirm:hover {
    opacity: 0.85;
}

/* ===== КНОПКИ В ШАПКЕ ЧАТА ===== */
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}
.chat-header-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.chat-header-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
}

/* ===== СТРОКА ПОИСКА ===== */
.chat-search-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    margin: 0 12px;
    background: rgba(30,30,38,0.82);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 30px;
    flex-shrink: 0;
}
.chat-search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: #e8e8e8;
    font-size: 14px;
    outline: none;
    padding: 4px 0;
    font-family: inherit;
}
.chat-search-bar input::placeholder {
    color: #666;
}
.chat-search-close {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.chat-search-close:hover {
    color: #ef5350;
}

/* Подсветка найденных сообщений */
.chat-messages .message-highlight {
    outline: 2px solid #4fc3f7;
    outline-offset: 2px;
    border-radius: 16px;
}
mark.search-mark {
    background: rgba(79,195,247,0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ===== МЕНЮ ТРОЕТОЧИЯ ===== */
.chat-menu-dropdown {
    position: fixed;
    background: #1e1e28;
    border: 1px solid #2a2a38;
    border-radius: 10px;
    padding: 4px;
    z-index: 99999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    min-width: 200px;
    animation: menuIn 0.15s ease-out;
}
@keyframes menuIn {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: #d0d0d8;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.chat-menu-item:hover {
    background: rgba(255,255,255,0.06);
}
.chat-menu-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* ===== РЕЖИМ ПЕРЕСЫЛКИ ===== */
.forward-selectable {
    position: relative;
    cursor: pointer;
    transition: opacity 0.15s;
}
.forward-checkbox {
    position: absolute;
    left: -32px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    cursor: pointer;
    z-index: 2;
    transition: color 0.15s;
}
.forward-checkbox:hover {
    color: rgba(255,255,255,0.6);
}
.forward-selected .forward-checkbox {
    color: #4fc3f7;
}
.forward-selected {
    opacity: 0.85;
}
.chat-messages .forward-selectable {
    margin-left: 32px;
}
.forward-mode-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #1e1e28;
    border-top: 1px solid #2a2a38;
    flex-shrink: 0;
}
.forward-mode-count {
    color: #888;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}
.forward-mode-send {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: rgb(151,0,178);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.forward-mode-send:disabled {
    opacity: 0.35;
    cursor: default;
}
.forward-mode-send:not(:disabled):hover {
    opacity: 0.85;
}
.forward-mode-cancel {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.forward-mode-cancel:hover {
    color: #ef5350;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .forward-checkbox {
        left: -28px;
    }
    .chat-messages .forward-selectable {
        margin-left: 28px;
    }
}

/* ===== MILLIGRAM GOLD (PREMIUM) ===== */

/* Золотая рамка аватаров */
.premium-border {
    box-shadow: 0 0 0 2px rgba(255, 213, 79, 0.5), 0 0 12px rgba(255, 213, 79, 0.15), 0 8px 32px rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    border: 1.5px solid rgba(255, 213, 79, 0.6) !important;
}

/* Золотое имя */
.premium-name {
    color: #ffd700 !important;
}

/* Золотой бейджик */
.premium-badge {
    display: none;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
}
.menu-username + .premium-badge {
    vertical-align: middle;
}
.settings-profile-username + .premium-badge {
    vertical-align: middle;
    font-size: 14px;
}

/* Страница Gold */
.gold-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    text-align: center;
}
.gold-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #1a1a22;
    border: 3px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}
.gold-avatar {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gold-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.gold-title {
    font-size: 24px;
    color: #e8e8e8;
    font-weight: 700;
    margin-bottom: 6px;
}
.gold-slogan {
    font-size: 15px;
    color: #888;
    margin-bottom: 20px;
    font-style: italic;
}
.gold-status {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
    background: #2a2a32;
    color: #888;
}
.gold-status.active {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}
.gold-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
    width: 100%;
    max-width: 280px;
}
.gold-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #2a2a32;
    border-radius: 10px;
}
.gold-feature-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.gold-feature-text {
    font-size: 14px;
    color: #ccc;
}
.gold-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.gold-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gold-btn:hover {
    transform: scale(1.05);
}
.gold-btn-buy {
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: #1a1a22;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3);
}
.gold-btn-buy:hover {
    box-shadow: 0 6px 24px rgba(255, 215, 0, 0.5);
}
.gold-btn-reset {
    background: #2a2a32;
    color: #e17076;
    border: 1px solid #3a3a44;
}
.gold-btn-reset:hover {
    background: #3a3a44;
}

.gold-icon svg {
    color: #ffd700;
}

/* ===== ЗОЛОТАЯ РАМКА ВОКРУГ НИКА (как тост) ===== */
.premium-name-block {
    border: 1px solid rgba(255, 213, 79, 0.35);
    border-radius: 10px;
    padding: 4px 14px;
    background: rgba(255, 213, 79, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.premium-name-block .menu-display-name,
.premium-name-block .settings-display-name {
    color: #ffd700;
    font-weight: 600;
}

/* ===== АНИМАЦИЯ БЛЕСКА "Gold" ===== */
@keyframes goldShimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
.gold-shimmer-text {
    background: linear-gradient(90deg, #ffd700 0%, #fff8c4 25%, #ffd700 50%, #fff8c4 75%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShimmer 3s linear infinite;
}

/* ===== АНИМАЦИЯ БЛЕСКА КРИСТАЛЛИКА ===== */
@keyframes diamondShimmer {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(255,215,0,0.3)) brightness(1); }
    50% { filter: drop-shadow(0 0 14px rgba(255,215,0,0.7)) brightness(1.2); }
}
.gold-diamond-shimmer {
    animation: diamondShimmer 2s ease-in-out infinite;
    display: inline-flex;
    vertical-align: middle;
}

/* ===== ПОПАП MILIGRAM GOLD ===== */
.gold-popup-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.gold-popup {
    position: relative;
    background: linear-gradient(135deg, #1e1e26 0%, #1a1a22 100%);
    border: 1.5px solid rgba(255, 215, 0, 0.45);
    border-radius: 20px;
    padding: 36px 28px 28px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.1);
    animation: goldPopupIn 0.3s ease;
}
.gold-popup-icon {
    font-size: 48px;
    margin-bottom: 10px;
}
.gold-popup-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}
.gold-popup-title .mg-pink {
    color: #f06292;
}
.gold-popup-title .mg-gold {
    background: linear-gradient(90deg, #ffd700 0%, #fff8c4 25%, #ffd700 50%, #fff8c4 75%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShimmer 3s linear infinite;
}
.gold-popup-text {
    font-size: 15px;
    color: rgba(255, 215, 0, 0.7);
    margin-bottom: 12px;
}
.gold-popup-grams {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}
.gold-popup-btn {
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: #1a1a22;
    border: none;
    border-radius: 12px;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}
.gold-popup-btn:hover {
    transform: scale(1.05);
}
.gold-popup-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
}
.gold-popup-close:hover {
    color: white;
}

@keyframes goldPopupIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== STORIES (истории как в ТГ) ===== */

/* Плашка историй в боковой панели */
.story-bar {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: #1a1a20;
}
.story-bar::-webkit-scrollbar { display: none; }

.story-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    width: 56px;
    height: 56px;
}
.story-avatar {
    width: 52px;
    min-width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    transition: transform 0.15s;
    background-size: cover;
    background-position: center;
    background-color: #2a2a35;
    overflow: hidden;
}
.story-avatar:hover {
    transform: scale(1.08);
}
.story-avatar-wrap.has-story .story-avatar {
    border: 2.5px solid rgba(255, 213, 79, 0.7);
}
.story-avatar-wrap.my-story .story-avatar {
    border: 2.5px solid rgba(255,255,255,0.2);
}
.story-add-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4d7cff;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1a1a20;
    line-height: 1;
}

/* ===== СОЗДАНИЕ ИСТОРИИ ===== */
.story-creator-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.story-creator-preview {
    position: relative;
    width: min(100vw, 420px);
    height: min(100vh, 750px);
    background: #1a1a22;
    border-radius: 0;
    overflow: hidden;
}
.story-creator-preview canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}
/* Элементы на холсте истории */
.story-element {
    position: absolute;
    z-index: 5;
}
.story-element:hover .story-element-del {
    opacity: 1;
}
.story-element-del {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.story-element-del:hover {
    background: rgba(255,0,0,0.7);
}
.story-creator-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.story-creator-tools {
    display: flex;
    gap: 12px;
}
.story-tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.story-tool-btn:hover {
    background: rgba(255,255,255,0.2);
}
.story-send-btn {
    background: linear-gradient(135deg, #4d7cff, #6c63ff);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}
.story-send-btn:hover {
    transform: scale(1.05);
}
.story-close-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* TTL — кастомные кнопки */
.story-ttl-wrap {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    display: flex;
    gap: 4px;
}
.story-ttl-btn {
    background: rgba(0,0,0,0.45);
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.story-ttl-btn:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
}
.story-ttl-btn.active {
    background: rgba(255, 213, 79, 0.15);
    border-color: rgba(255, 213, 79, 0.4);
    color: #ffd700;
}

/* Палитра цвета и размер кисти */
.story-color-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.story-color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.story-color-dot:hover {
    transform: scale(1.15);
}
.story-color-dot.active {
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}
.story-size-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.story-size-btn {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 12px;
}
.story-size-btn.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

/* Корзина снизу справа (красная, SVG) */
.story-viewer-trash {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 83, 80, 0.2);
    border: 1.5px solid rgba(239, 83, 80, 0.4);
    color: #ef5350;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.story-viewer-trash:hover {
    background: rgba(239, 83, 80, 0.35);
    border-color: #ef5350;
    transform: scale(1.1);
}
.story-tool-btn.active {
    background: rgba(255,255,255,0.2);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}

/* ===== ПРОСМОТР ИСТОРИЙ ===== */
.story-viewer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.story-viewer-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 12px 16px;
    background: linear-gradient(rgba(0,0,0,0.6), transparent);
    display: flex;
    align-items: center;
    gap: 10px;
}
.story-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    z-index: 15;
}
.story-progress-segment {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    overflow: hidden;
}
.story-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 2px;
}
.story-viewer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}
.story-viewer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.story-viewer-name {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}
.story-viewer-time {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}
.story-viewer-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    margin-top: 16px;
}
.story-viewer-content {
    width: min(100vw, 420px);
    height: min(100vh, 750px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a22;
    overflow: hidden;
}
.story-viewer-text {
    position: absolute;
    max-width: 80%;
    word-wrap: break-word;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    pointer-events: none;
    z-index: 5;
}
.story-viewer-nav-left,
.story-viewer-nav-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35%;
    z-index: 8;
    cursor: pointer;
}
.story-viewer-nav-left { left: 0; }
.story-viewer-nav-right { right: 0; }

/* Кнопка камеры в хедере */
.header-story-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.header-story-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
