.chat-header {
    background: var(--white);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    height: 64px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.header-left .logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.status {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}
.status.online {
    background: #DCFCE7;
    color: #166534;
}
.status.offline {
    background: #FEE2E2;
    color: #991B1B;
}

.chat-layout {
    display: flex;
    height: calc(100vh - 64px);
}

/* Сайдбар (40%) */
.chat-sidebar {
    width: 40%;
    min-width: 280px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}
.search-bar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: #FAFBFC;
}
.search-bar input {
    flex: 1;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all 0.2s;
}
.search-bar input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}
.search-bar .btn-icon {
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 8px 14px;
}
.search-bar .btn-icon:hover {
    background: var(--primary-dark);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    background: #FAFBFC;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
}
.chat-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.08);
}
.chat-item.active {
    border-color: var(--primary);
    background: #F8F7FF;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.12);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
}
.chat-info {
    flex: 1;
    min-width: 0;
}
.chat-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
}
.chat-last {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.chat-time {
    font-size: 11px;
    color: #9CA3AF;
    flex-shrink: 0;
}

/* Окно чата (60%) */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FAFBFC;
}
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    margin: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.welcome-content {
    text-align: center;
    color: var(--text-light);
}
.welcome-content h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 8px;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #FAFBFC;
}

.message {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 16px;
    background: var(--white);
    box-shadow: var(--shadow);
    animation: fadeIn 0.15s ease;
    word-wrap: break-word;
    line-height: 1.4;
}
.message-sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.message-received {
    align-self: flex-start;
    background: var(--white);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}
.message-sent .message-time {
    color: rgba(255,255,255,0.7);
}

.chat-input {
    flex-shrink: 0;

    padding: 12px 20px;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;

    z-index: 20;
}

.chat-input textarea {
    flex: 1;
    resize: none;
    border-radius: 20px;
    padding: 10px 16px;
    min-height: 42px;
    max-height: 120px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}
.chat-input textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}
.chat-input .btn-send {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 18px;
}
.chat-input .btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .chat-layout {
        flex-direction: column;
    }
    .chat-main {
        height: 60vh;
    }
    .message {
        max-width: 85%;
    }
}

/* Profile Page */
.profile-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #FAFBFC;
    padding: 20px;
}

.profile-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 40px 20px;
}

.profile-content {
    text-align: center;
    max-width: 400px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 48px;
    flex-shrink: 0;
    margin: 0 auto 24px;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.25);
}

.profile-info {
    text-align: center;
}

.profile-username {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px 0;
}

.profile-email,
.profile-phone,
.profile-uuid {
    font-size: 15px;
    color: var(--text-light);
    margin: 8px 0;
    word-break: break-all;
    font-family: 'Courier New', monospace;
}