.crm-chats-hub {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 0;
    min-height: calc(100vh - 180px);
    max-height: calc(100vh - 140px);
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.crm-chats-sidebar {
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    min-height: 0;
}
.crm-chats-sidebar-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.crm-chats-sidebar-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}
.crm-chats-thread-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.crm-chats-thread {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.crm-chats-thread:hover { background: #eef2ff; }
.crm-chats-thread.active {
    background: #fff;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e0e7ff;
}
.crm-chats-thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.crm-chats-thread-avatar.group { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.crm-chats-thread-body { flex: 1; min-width: 0; }
.crm-chats-thread-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-chats-thread-preview {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-chats-thread-meta {
    font-size: 10px;
    color: #94a3b8;
    flex-shrink: 0;
}
.crm-chats-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}
.crm-chats-main-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.crm-chats-main-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.crm-chats-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 40%);
}
.crm-chats-msg {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.crm-chats-msg.mine {
    align-self: flex-end;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}
.crm-chats-msg.theirs {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--border-light);
}
.crm-chats-msg-author {
    font-size: 11px;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 4px;
}
.crm-chats-msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 6px;
}
.crm-chats-compose {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.crm-chats-compose input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #dbe1ea;
    border-radius: 12px;
    font-size: 14px;
}
.crm-chats-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px;
    text-align: center;
}
.crm-chats-group-members {
    font-size: 12px;
    color: var(--text-muted);
}
.crm-chats-group-pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    margin: 12px 0;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
}
.crm-chats-group-pick label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
@media (max-width: 900px) {
    .crm-chats-hub {
        grid-template-columns: 1fr;
        max-height: none;
    }
    .crm-chats-sidebar { max-height: 240px; border-right: none; border-bottom: 1px solid var(--border-light); }
}
