/*
 * CRM: light visual layer on top of Filament (no build step).
 * Targets Filament's stable fi-* classes and its color variables.
 */

:root {
    --crm-radius: 0.875rem;
    --crm-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 4px 16px -4px rgb(15 23 42 / 0.08);
}

/* App background */
.fi-body {
    background-color: var(--gray-50);
}

.dark .fi-body {
    background-color: var(--gray-950);
}

/* Cards: sections, widgets, tables */
.fi-section,
.fi-wi-stats-overview-stat,
.fi-ta-ctn,
.fi-wi-chart .fi-section {
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
}

/* Stat cards: bigger numbers, accent line */
.fi-wi-stats-overview-stat {
    position: relative;
    overflow: hidden;
}

.fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), oklch(0.606 0.25 292.717));
    opacity: 0.85;
}

.fi-wi-stats-overview-stat-value {
    letter-spacing: -0.02em;
}

/* Page titles */
.fi-header-heading {
    letter-spacing: -0.02em;
}

/* Top bar with a subtle blur */
.fi-topbar nav,
.fi-topbar {
    backdrop-filter: saturate(180%) blur(8px);
}

/* Login, password reset and invitation pages */
.fi-simple-layout {
    background:
        radial-gradient(60rem 40rem at 10% -10%, oklch(0.93 0.034 272.788 / 0.9), transparent 60%),
        radial-gradient(50rem 35rem at 110% 110%, oklch(0.943 0.029 294.588 / 0.9), transparent 60%),
        var(--gray-50);
}

.dark .fi-simple-layout {
    background:
        radial-gradient(60rem 40rem at 10% -10%, oklch(0.359 0.144 278.697 / 0.35), transparent 60%),
        radial-gradient(50rem 35rem at 110% 110%, oklch(0.38 0.189 293.745 / 0.3), transparent 60%),
        var(--gray-950);
}

.fi-simple-main {
    border-radius: 1.25rem;
    box-shadow: 0 10px 40px -12px rgb(15 23 42 / 0.25);
}

/* "View as client" banner */
.crm-view-as-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #fff;
    background: linear-gradient(90deg, var(--primary-600), oklch(0.541 0.281 293.009));
}

.crm-view-as-banner a {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    color: var(--primary-700);
    background: #fff;
    text-decoration: none;
}

/* Lead conversation (chat) */
.crm-chat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 32rem;
    overflow-y: auto;
    padding: 0.25rem;
}

.crm-chat-row {
    display: flex;
    justify-content: flex-start;
}

.crm-chat-row--out {
    justify-content: flex-end;
}

.crm-chat-bubble {
    max-width: min(80%, 36rem);
    padding: 0.5rem 0.75rem;
    border-radius: 1rem 1rem 1rem 0.25rem;
    background: var(--gray-100);
    color: var(--gray-900);
}

.crm-chat-row--out .crm-chat-bubble {
    border-radius: 1rem 1rem 0.25rem 1rem;
    background: var(--primary-600);
    color: #fff;
}

.dark .crm-chat-bubble {
    background: var(--gray-800);
    color: var(--gray-100);
}

.dark .crm-chat-row--out .crm-chat-bubble {
    background: var(--primary-500);
}

.crm-chat-body {
    white-space: pre-line;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
    line-height: 1.4;
}

.crm-chat-meta {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    opacity: 0.7;
}

.crm-chat-empty {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Brand (logo = mark + APP_NAME) */
.crm-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    height: 100%;
}

.crm-brand-mark {
    height: 100%;
    width: auto;
}

.crm-brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--gray-950);
}

.dark .crm-brand-name {
    color: #fff;
}
