.chat-page {
    padding: 1.5rem 0 2.5rem;
    color: #1f2937;
}

.chat-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    border-radius: 24px;
    background: linear-gradient(135deg, #f8fbff, #eef5ff);
    border: 1px solid #dbeafe;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    margin-bottom: 1.25rem;
}

.chat-eyebrow {
    margin: 0 0 .35rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .75rem;
    font-weight: 800;
    color: #2563eb;
}

.chat-hero h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    color: #0f172a;
}

.chat-subtitle {
    margin: .35rem 0 0;
    max-width: 760px;
    color: #64748b;
}

.chat-hero-badge {
    white-space: nowrap;
    padding: .65rem 1rem;
    border-radius: 999px;
    background: #ffffff;
    color: #2563eb;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px #bfdbfe;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr);
    gap: 1rem;
    align-items: start;
}

.chat-layout-staff {
    grid-template-columns: minmax(260px, .8fr) minmax(0, 1.4fr) minmax(320px, .8fr);
}

.chat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.chat-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid #eef2f7;
}

.chat-card-header.compact {
    padding-bottom: .8rem;
}

.chat-card-header h2,
.chat-form-card h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f172a;
}

.chat-card-header p,
.chat-form-note {
    margin: .2rem 0 0;
    color: #64748b;
    font-size: .92rem;
}

.chat-refresh,
.chat-submit {
    border: none;
    border-radius: 14px;
    padding: .7rem 1rem;
    font-weight: 800;
    cursor: pointer;
}

.chat-refresh {
    background: #eff6ff;
    color: #2563eb;
}

.chat-submit {
    width: 100%;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.chat-submit:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.chat-messages {
    height: 560px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8fafc;
}

.chat-message {
    display: flex;
    margin-bottom: .85rem;
}

.chat-message.public {
    justify-content: flex-start;
}

.chat-message.staff {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 78%;
    border-radius: 18px;
    padding: .85rem 1rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.chat-message.staff .chat-bubble {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.chat-message-topline {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: .25rem;
}

.chat-role {
    font-size: .72rem;
    font-weight: 800;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}

.chat-bubble p {
    margin: 0 0 .4rem;
    white-space: pre-wrap;
}

.chat-bubble small {
    color: #94a3b8;
}

.chat-message.staff .chat-bubble small {
    color: rgba(255, 255, 255, .78);
}

.chat-form-card {
    padding: 1.15rem;
}

.chat-form {
    margin-top: 1rem;
}

.chat-field {
    margin-bottom: 1rem;
}

.chat-field label {
    display: block;
    font-weight: 800;
    margin-bottom: .35rem;
    color: #334155;
}

.chat-field .form-control {
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    padding: .72rem .85rem;
}

.chat-conversation-list {
    max-height: 625px;
    overflow-y: auto;
    padding: .75rem;
    background: #f8fafc;
}

.chat-conversation-link {
    display: block;
    text-decoration: none;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: .85rem;
    margin-bottom: .65rem;
}

.chat-conversation-link.active,
.chat-conversation-link:hover {
    border-color: #2563eb;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
}

.conversation-name,
.conversation-preview,
.conversation-meta {
    display: block;
}

.conversation-name {
    font-weight: 900;
    color: #0f172a;
}

.conversation-preview {
    margin-top: .2rem;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-meta {
    margin-top: .35rem;
    font-size: .78rem;
    color: #94a3b8;
}

.chat-empty {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 180px;
    color: #64748b;
    gap: .25rem;
}

.chat-empty.small {
    min-height: 100px;
    padding: 1rem;
}

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

    .chat-messages {
        height: 460px;
    }

    .chat-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

.chat-live-status {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    border-radius: 16px;
    font-weight: 800;
    border: 1px solid transparent;
}

.chat-live-status.connected {
    background: #ecfdf5;
    color: #047857;
    border-color: #bbf7d0;
}

.chat-live-status.connecting {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.chat-live-status.disconnected {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
