:root {
    --crm-bg: #f5f7fb;
    --crm-border: #dde4ee;
    --crm-text: #1f2937;
    --crm-muted: #64748b;
    --crm-primary: #2563eb;
}

body {
    background: var(--crm-bg);
    color: var(--crm-text);
}

.navbar-brand {
    color: var(--crm-primary);
}

.nav-link.active {
    color: var(--crm-primary) !important;
    font-weight: 600;
}

.page-heading {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-heading h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
}

.panel,
.metric,
.login-panel {
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.panel {
    padding: 1rem;
}

.panel-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.metric {
    padding: 1.15rem;
}

.metric span {
    color: var(--crm-muted);
    display: block;
    font-size: .9rem;
    margin-bottom: .5rem;
}

.metric strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.filter-bar {
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(160px, 220px)) auto;
    margin-bottom: 1rem;
}

.login-shell {
    display: grid;
    min-height: calc(100vh - 120px);
    place-items: center;
}

.login-panel {
    max-width: 460px;
    padding: 2rem;
    width: 100%;
}

.message-list {
    display: grid;
    gap: .75rem;
}

.message-preview {
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    color: inherit;
    display: grid;
    gap: .75rem;
    grid-template-columns: auto 1fr;
    padding: .85rem;
    text-decoration: none;
}

.message-preview p {
    color: var(--crm-muted);
    margin: .2rem 0;
}

.chat-panel {
    min-height: 70vh;
}

.chat-timeline {
    background: #eef3f8;
    border-radius: 8px;
    display: grid;
    gap: .85rem;
    max-height: 62vh;
    overflow: auto;
    padding: 1rem;
}

.chat-message {
    display: flex;
}

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

.bubble {
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    max-width: min(680px, 86%);
    padding: .8rem .9rem;
}

.outgoing .bubble {
    background: #e8f0ff;
    border-color: #bfcef8;
}

.bubble-meta {
    color: var(--crm-muted);
    display: flex;
    font-size: .78rem;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: .45rem;
}

.bubble p {
    margin-bottom: .35rem;
    white-space: normal;
    word-break: break-word;
}

.details {
    display: grid;
    gap: .45rem .75rem;
    grid-template-columns: 120px 1fr;
}

.details dt {
    color: var(--crm-muted);
    font-weight: 600;
}

.details dd {
    margin: 0;
}

.json-box {
    background: #0f172a;
    border-radius: 8px;
    color: #dbeafe;
    font-size: .82rem;
    max-height: 320px;
    overflow: auto;
    padding: 1rem;
}

.table code {
    color: #334155;
}

@media (max-width: 992px) {
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .bubble {
        max-width: 100%;
    }
}

