#chat-screen {
    display: none;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.chat-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.sidebar-header h2 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}
.sidebar-header h2 .icon { color: var(--cyan); }
.sidebar-actions { display: flex; gap: 4px; }

.sidebar-search { padding: 12px 16px; flex-shrink: 0; }
.sidebar-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}
.sidebar-search input::placeholder { color: var(--text-dim); }
.sidebar-search input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.06);
}
.sidebar-search-wrap { position: relative; }
.sidebar-search-wrap .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    width: 16px;
    height: 16px;
    pointer-events: none;
}
.sidebar-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.sidebar-search-clear:hover { color: var(--error); }
.sidebar-search-clear .icon { width: 14px; height: 14px; }
.sidebar-search-clear.visible { display: flex; }

/* ============================================================
   CHAT LIST
   ============================================================ */

.chat-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 2px;
    border: 1px solid transparent;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.chat-item:hover { background: var(--bg-card-hover); }
.chat-item.active {
    background: rgba(0, 212, 255, 0.06);
    border-color: var(--border-cyan);
}
.chat-item:active { transform: scale(0.99); }

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 100, 200, 0.1));
    border: 1px solid var(--border-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--cyan);
    flex-shrink: 0;
    text-transform: uppercase;
}

.chat-info { flex: 1; min-width: 0; }
.chat-info-top { display: flex; justify-content: space-between; align-items: center; }
.chat-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-time {
    font-size: 11px;
    color: var(--text-dim);
    flex-shrink: 0;
    margin-left: 8px;
    font-family: 'JetBrains Mono', monospace;
}
.chat-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}
.chat-preview-sender { color: var(--cyan); font-weight: 500; }

.no-chats { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.no-chats .icon { color: var(--text-dim); margin-bottom: 12px; }
.no-chats p { font-size: 14px; }
.no-chats .hint { font-size: 12px; margin-top: 4px; color: var(--text-dim); }

/* ============================================================
   CHAT AREA
   ============================================================ */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-deep);
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.chat-header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-header-text h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.chat-header-text span {
    font-size: 12px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
}
.chat-header-actions { display: flex; gap: 4px; }

.online-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(0, 204, 136, 0.5);
}

.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text-dim);
    gap: 12px;
}
.empty-chat .icon { color: var(--text-dim); opacity: 0.5; }
.empty-chat p { font-size: 15px; }
.empty-chat .shortcut-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.shortcut-hint kbd {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ============================================================
   NOTIFICATION BANNER
   ============================================================ */

.notif-banner {
    padding: 10px 16px;
    background: rgba(0, 212, 255, 0.06);
    border-bottom: 1px solid var(--border-cyan);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}
.notif-banner-text {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.notif-banner-text .icon { color: var(--cyan); flex-shrink: 0; }
.notif-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.notif-banner .btn { padding: 6px 14px; font-size: 12px; }

/* ... всё что было раньше остаётся ... */

/* ============================================================
   TYPING INDICATOR
   ============================================================ */

   .typing-indicator {
    padding: 4px 24px 8px;
    font-size: 12px;
    color: var(--cyan);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    min-height: 24px;
    flex-shrink: 0;
    display: none;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s ease;
}
.typing-indicator.visible {
    display: flex;
}
.typing-dots {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}
.typing-dots span {
    width: 4px;
    height: 4px;
    background: var(--cyan);
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ============================================================
   CHAT HEADER STATUS
   ============================================================ */

.chat-header-status {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-header-status .online-dot {
    width: 5px;
    height: 5px;
}
.status-online { color: var(--success); }
.status-offline { color: var(--text-dim); }
.status-typing { color: var(--cyan); }