.chat-page {
    padding-bottom: 2rem;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2.4fr);
    gap: 1.4rem;
    align-items: stretch;
}

.chat-sidebar,
.chat-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 1rem 1.2rem 0.6rem;
    border-bottom: 1px solid #e5e7eb;
}

.chat-sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.chat-thread-list {
    display: grid;
}

.chat-thread {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid #f1f5f9;
    color: inherit;
}

.chat-thread:last-child {
    border-bottom: none;
}

.chat-thread.is-active {
    background: #f8fafc;
}

.chat-thread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #cbd5f5;
}

.chat-thread-title {
    font-weight: 700;
    color: #0f172a;
}

.chat-thread-preview {
    color: #64748b;
    font-size: 0.85rem;
}

.chat-thread-context {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 0.6rem;
    margin: 0.4rem 0;
}

.chat-thread-context img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.chat-thread-context-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-thread-context-meta {
    color: #64748b;
    font-size: 0.8rem;
}

.chat-panel {
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.chat-panel-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.chat-panel-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.chat-panel-context {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 0.7rem;
    margin-top: 0.6rem;
}

.chat-panel-context img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.chat-panel-context-title {
    font-weight: 600;
}

.chat-panel-context-meta {
    color: #64748b;
    font-size: 0.85rem;
}

.chat-messages {
    padding: 1rem 1.4rem;
    display: grid;
    gap: 0.8rem;
    overflow-y: auto;
    max-height: 420px;
}

.chat-message {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    max-width: 70%;
}

.chat-message.is-mine {
    margin-left: auto;
    background: #dbeafe;
}

.chat-message-meta {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

.chat-read {
    color: #0f766e;
    font-weight: 600;
}

.chat-form {
    padding: 1rem 1.4rem 1.4rem;
    border-top: 1px solid #e5e7eb;
}

.chat-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
}

.chat-input-row input {
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    border: 1px solid #d1d5db;
}

.chat-empty {
    padding: 1.2rem;
    color: #64748b;
}

.chat-empty--panel {
    text-align: center;
}

@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
}
