/* ================================ */
/* CSS CUSTOM PROPERTIES */
/* ================================ */
:root {
    /* Color Palette */
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-slate-900: #0f172a;
    
    --color-blue-300: #93c5fd;
    --color-blue-400: #60a5fa;
    --color-blue-500: #3b82f6;
    --color-blue-600: #2563eb;
    --color-blue-700: #1d4ed8;
    --color-blue-800: #1e40af;
    --color-blue-900: #1e3a8a;
    
    --color-red-500: #ef4444;
    --color-red-600: #dc2626;
    --color-red-700: #b91c1c;
    
    --color-green-500: #22c55e;
    --color-yellow-400: #fbbf24;
    --color-yellow-500: #f59e0b;
    --color-yellow-700: #b45309;
    --color-yellow-100: #fef3c7;
    --color-yellow-600: #92400e;
    
    /* Semantic Colors */
    --bg-primary: var(--color-slate-900);
    --bg-secondary: var(--color-slate-800);
    --bg-tertiary: var(--color-slate-700);
    --bg-quaternary: var(--color-slate-600);
    
    --text-primary: var(--color-slate-100);
    --text-secondary: var(--color-slate-200);
    --text-tertiary: var(--color-slate-300);
    --text-muted: var(--color-slate-400);
    
    --border-primary: var(--color-slate-600);
    --border-secondary: var(--color-slate-700);
    
    /* --accent-primary / -light / -dark removed — consumers migrated
       to hsl(var(--primary)). */

    /* --success-color / --error-color / --warning-color removed —
       consumers migrated to hsl(var(--success/destructive/warning)). */
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.25rem;
    --spacing-2xl: 1.5rem;
    --spacing-3xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Dark theme specific shadows */
    --shadow-dark-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-dark-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-dark-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-dark-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    
    /* Gradients
       --gradient-blue / --gradient-blue-hover used to live here as
       linear-gradient stops. Removed: every consumer in styles.css
       now uses `hsl(var(--primary))` / `hsl(var(--primary) / 0.9)`
       directly. The shim in mmi-one-tokens.css still defines
       --gradient-blue with !important for theme files that consume
       it; once those are converted the shim line can also go. */
    --gradient-red: linear-gradient(135deg, var(--color-red-500) 0%, var(--color-red-600) 100%);
    --gradient-red-hover: linear-gradient(135deg, var(--color-red-600) 0%, var(--color-red-700) 100%);
    --gradient-slate: linear-gradient(135deg, var(--color-slate-600) 0%, var(--color-slate-700) 100%);
    --gradient-slate-light: linear-gradient(135deg, var(--color-slate-700) 0%, var(--color-slate-600) 100%);
    --gradient-slate-dark: linear-gradient(135deg, var(--color-slate-800) 0%, var(--color-slate-700) 100%);
    
    /* Typography */
    --font-family: "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-size-xs: 0.65rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.875rem;
    --font-size-md: 0.9rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.25rem;
    --font-size-3xl: 1.375rem;
    --font-size-4xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-indexes */
    --z-dropdown: 1000;
    --z-modal: 50;
    --z-toast: 50;
    --z-overlay: 10;
    --z-sticky: 10;
    
    /* Component specific */
    --input-padding: 0.875rem;
    --button-padding: 0.625rem 1.25rem;
    --message-max-width: 4xl;
}

/* ================================ */
/* BASE THEME SETUP */
/* ================================ */
html.dark {
    color-scheme: dark only !important;
    background: var(--bg-primary) !important;
}

.dark *, .dark *::before, .dark *::after {
    forced-color-adjust: none !important;
    color-scheme: inherit !important;
}

.dark:root {
    color-scheme: dark !important;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

body.dark {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    color-scheme: dark only !important;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    color-scheme: dark only !important;
}

/* ================================ */
/* MESSAGE STRUCTURE */
/* ================================ */
.message-bubble {
    max-width: var(--message-max-width);
    padding: var(--spacing-lg);
    border-radius: var(--radius-2xl);
    margin: var(--spacing-md) 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-message:not(.chatmmi-embedded.bonzo-theme .user-message) {
    background: hsl(var(--primary));
    color: white;
    border-radius: var(--radius-2xl) var(--radius-2xl) var(--spacing-xs) var(--radius-2xl);
}

.analyst-message {
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-2xl) var(--radius-2xl) var(--radius-2xl) var(--spacing-xs);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.system-message {
    background: var(--color-yellow-100);
    color: var(--color-yellow-600);
    border: 1px solid var(--color-yellow-400);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    padding: var(--spacing-md) var(--spacing-lg);
}

/* ================================ */
/* ANALYST RESPONSE CONTAINER */
/* ================================ */
.analyst-response {
    max-width: none;
    width: 100%;
    padding: var(--spacing-2xl);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-secondary);
    margin: var(--spacing-lg) 0;
    animation: fadeIn var(--transition-normal);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.analyst-response:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 4px 8px -1px rgba(59, 130, 246, 0.2);
}

/* Reduce gap between analyst message and its analysis group (separate cards, not merged) */
[data-item-key^="msg:"] + [data-item-key^="group:"] {
    margin-top: calc(-1 * var(--spacing-md));
}

/* ================================ */
/* CONTENT SECTIONS */
/* ================================ */
.content-section {
    margin-bottom: var(--spacing-2xl);
}

.content-section:last-child {
    margin-bottom: 0;
}

/* Shared section box (chat Query Results, dashboard sections) - single source of truth */
.section-box {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-lg);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-primary);
}

.section-icon {
    width: var(--spacing-lg);
    height: var(--spacing-lg);
    flex-shrink: 0;
    color: hsl(var(--primary));
}

/* ================================ */
/* FEEDBACK BUTTONS */
/* ================================ */
.feedback-section {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-secondary);
}

.feedback-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feedback-timestamp {
    font-size: var(--font-size-sm);
    opacity: 0.7;
    color: var(--text-muted);
}

.feedback-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.feedback-label {
    font-size: var(--font-size-sm);
    margin-right: var(--spacing-sm);
    color: var(--text-muted);
}

.regenerate-btn,
.feedback-btn {
    padding: var(--spacing-xs);
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-btn:hover {
    transform: translateY(-1px);
}

.feedback-btn:disabled {
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

.feedback-icon {
    width: var(--spacing-lg);
    height: var(--spacing-lg);
}

.feedback-positive {
    color: #9ca3af;
}

.feedback-positive:hover:not(:disabled) {
    color: hsl(var(--success));
    background-color: rgba(34, 197, 94, 0.1);
}

.feedback-negative {
    color: #9ca3af;
}

.feedback-negative:hover:not(:disabled) {
    color: hsl(var(--destructive));
    background-color: rgba(239, 68, 68, 0.1);
}

.feedback-positive-active {
    color: hsl(var(--success)) !important;
    background-color: rgba(34, 197, 94, 0.1) !important;
}

.feedback-negative-active {
    color: hsl(var(--destructive)) !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.feedback-disabled {
    opacity: 0.3 !important;
}

.feedback-error {
    color: #f87171 !important;
    background-color: rgba(248, 113, 113, 0.1) !important;
}

.feedback-loading {
    width: var(--spacing-md);
    height: var(--spacing-md);
    border: 1px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ================================ */
/* ARTIFACT STYLES */
/* ================================ */
.chatmmi-artifact {
    animation: fadeIn var(--transition-normal);
    width: 100%;
    max-width: none;
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    margin: var(--spacing-lg) 0;
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.artifact-header {
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.artifact-header h1 {
    font-size: var(--font-size-4xl);
    font-weight: bold;
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    color: var(--text-primary);
}

.chatmmi-artifact.artifact--flat {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    margin: 0 0 var(--spacing-lg) 0;
}

.chatmmi-artifact.artifact--flat .property-details,
.chatmmi-artifact.artifact--flat .property-map { 
    background: transparent; 
    padding: 0; 
    border-radius: 0;
}

.chatmmi-artifact.artifact--flat .map-container { 
    background: transparent; 
    border: none; 
}

/* LO Profile Card */
.lo-card {
    overflow: hidden;
    animation: fadeIn var(--transition-normal);
    position: relative;
}


/* Input hint — subtle tip below input, visible on focus. Two flex items
   (dot + text span); the text wraps internally on narrow widths so we
   don't trigger a horizontal scrollbar between 641px and the breakpoint
   where the whole thing hides. */
.input-hints {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 4px 2px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}


.input-hints kbd {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: hsl(var(--primary));
}

@media (max-width: 640px) {
    .input-hints { display: none; }
}

/* Identity row: avatar + name/meta/badges */
.lo-card-identity {
    display: flex;
    align-items: center;
    gap: var(--spacing-2xl);
    padding: var(--spacing-md) var(--spacing-sm);
    position: relative;
}

/* On mobile the 200px lender logo + long lender name can't share a row.
   Stack them and shrink the logo so the name gets the full width. */
@media (max-width: 640px) {
    .lo-card-identity {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
    .lo-card-avatar--logo {
        max-width: 100%;
        height: 72px;
    }
}

/* Table row favorite button */
.table-fav-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table-fav-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    opacity: 0.4;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.table-fav-btn:hover {
    opacity: 1;
    color: hsl(var(--primary));
}

.table-fav-btn--active {
    opacity: 1;
    color: hsl(var(--primary));
}

.table-fav-btn--active svg {
    fill: hsl(var(--primary));
}

/* Themes apply a blanket `button:not(.opp-card-why-toggle)` rule at
   (0,2,1) !important. Prefix `body.` to win at (0,2,2). Covers small
   per-row icon affordances that read as chrome, not buttons. The
   lo-card top-right cluster is intentionally OFF this list — those
   buttons keep their bg+border so they read as a group. */
body.bonzo-theme button.table-fav-btn,
body.bonzo-light-theme button.table-fav-btn,
body.elevate-theme button.table-fav-btn,
body.hiddenthings-theme button.table-fav-btn,
body.datacenter-theme button.table-fav-btn,
body.bonzo-theme button.row-push-btn,
body.bonzo-light-theme button.row-push-btn,
body.elevate-theme button.row-push-btn,
body.hiddenthings-theme button.row-push-btn,
body.datacenter-theme button.row-push-btn,
body.bonzo-theme button.row-purchase-btn,
body.bonzo-light-theme button.row-purchase-btn,
body.elevate-theme button.row-purchase-btn,
body.hiddenthings-theme button.row-purchase-btn,
body.datacenter-theme button.row-purchase-btn,
body.bonzo-theme button.row-outreach-btn,
body.bonzo-light-theme button.row-outreach-btn,
body.elevate-theme button.row-outreach-btn,
body.hiddenthings-theme button.row-outreach-btn,
body.datacenter-theme button.row-outreach-btn,
body.bonzo-theme button.property-details-btn,
body.bonzo-light-theme button.property-details-btn,
body.elevate-theme button.property-details-btn,
body.hiddenthings-theme button.property-details-btn,
body.datacenter-theme button.property-details-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* The roster page IS the top-LOs view, so the action row would be a
   self-link — suppress it on this surface. */
.synthetic-lender-card-container .lo-card-actions {
    display: none;
}

.lo-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: var(--spacing-md);
}

.lo-card-fav-btn,
.lo-card-crm-btn,
.lo-card-lender-action-btn,
.artifact-card-outreach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 0.6rem;
    background: transparent;
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lo-card-fav-btn > svg,
.lo-card-crm-btn > svg,
.artifact-card-outreach-btn > svg {
    flex-shrink: 0;
}

.artifact-card-action-emoji {
    font-size: 0.9rem;
    line-height: 1;
}

.lo-card-fav-btn:hover,
.lo-card-crm-btn:hover,
.lo-card-lender-action-btn:hover,
.artifact-card-outreach-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.lo-card-fav-btn--active svg {
    fill: hsl(var(--primary));
    stroke: hsl(var(--primary));
}

.lo-card-crm-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.lo-card-avatar-wrap {
    flex-shrink: 0;
}

.lo-card-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 4px var(--bg-secondary), 0 0 0 6px hsl(var(--primary));
}

.lo-card-avatar--logo {
    width: auto;
    max-width: 200px;
    height: 100px;
    border-radius: var(--radius-lg);
    background: white;
    padding: 10px 16px;
    object-fit: contain;
    box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 0 5px var(--border-primary);
}

.lo-card-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, hsl(var(--primary)), #8b5cf6);
    border: none;
    box-shadow: 0 0 0 4px var(--bg-secondary), 0 0 0 6px hsl(var(--primary));
}

.lo-card-identity-body {
    flex: 1;
    min-width: 0;
}

.lo-card-name {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.lo-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-top: var(--spacing-sm);
}

.lo-card-meta svg {
    opacity: 0.6;
    flex-shrink: 0;
    vertical-align: -1px;
}

/* Keep an icon and its label glued together on one line. Each meta entry
 * is one flex item; the icon and text inside it can still wrap as a unit
 * to the next line, but won't split between themselves. */
.lo-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.lo-card-dot {
    opacity: 0.3;
    margin: 0 2px;
}

.lo-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.lo-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.lo-card-badge--nmls {
    background: rgba(59, 130, 246, 0.15);
    color: hsl(var(--primary));
    border-color: rgba(59, 130, 246, 0.3);
}

.lo-card-badge--tier {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border-color: rgba(234, 179, 8, 0.3);
}

.lo-card-badge--reviews {
    position: relative;
    cursor: default;
}

.lo-card-badge--reviews .lo-card-badge-star {
    color: var(--color-yellow-400);
}

.lo-card-badge--reviews .lo-card-badge-muted {
    color: var(--text-muted);
    font-weight: 500;
}

.lo-card-badge--reviews[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-slate-900);
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: pre;
    pointer-events: none;
    z-index: 10;
    border: 1px solid var(--border-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    text-align: left;
    line-height: 1.6;
}

/* Stock Ticker */
.lo-stock-ticker {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: var(--spacing-md) 0 0;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.lo-stock-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lo-stock-symbol {
    font-size: 0.75rem;
    font-weight: 700;
    color: hsl(var(--primary));
    background: rgba(59, 130, 246, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    letter-spacing: 0.05em;
}

.lo-stock-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lo-stock-change {
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lo-stock-change--up { color: #22c55e; }
.lo-stock-change--down { color: #ef4444; }
.lo-stock-change--neutral { color: var(--text-muted); }

.lo-stock-exchange {
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.lo-stock-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.lo-stock-sep {
    opacity: 0.4;
}

/* KPI cards row */
.lo-kpi-row-wrap {
    position: relative;
    margin: var(--spacing-lg) 0 0;
}

.lo-kpi-debug {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    z-index: 1;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.lo-kpi-debug:hover {
    opacity: 1;
}

.lo-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Cap at 5 cards per row by setting flex-basis to ~1/5 of the row, but
   never go below 180px (forces wrap on narrower containers). With <=5 cards
   they fill one row; with 6+ the overflow wraps and the row-2 cards grow
   equally to fill the full width via flex-grow:1. */
.lo-kpi-row > .lo-kpi-card {
    flex: 1 1 calc((100% - 4 * 0.75rem) / 5);
    min-width: 180px;
}

.lo-kpi-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: var(--spacing-lg);
}

.lo-kpi-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lo-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-top: 2px;
}

.lo-kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 2px;
}

.lo-kpi-change--up { color: #22c55e; }
.lo-kpi-change--down { color: #ef4444; }
.lo-kpi-change--neutral { color: var(--text-muted); }

.lo-kpi-rank {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}


/* Sparkline */
.lo-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 32px;
    margin-top: var(--spacing-sm);
}

.lo-sparkline-bar {
    flex: 1;
    min-width: 0;
    background: rgba(59, 130, 246, 0.25);
    border-radius: 2px 2px 0 0;
    position: relative;
    cursor: pointer;
    transition: background 0.1s;
}

.lo-sparkline-bar:hover {
    background: rgba(59, 130, 246, 0.5);
}

.lo-sparkline-bar--current {
    background: hsl(var(--primary));
}

.lo-sparkline-bar--max {
    background: rgba(34, 197, 94, 0.5);
}

.lo-sparkline-bar--min {
    background: rgba(239, 68, 68, 0.4);
}

.lo-sparkline-bar--current:hover {
    background: hsl(var(--primary));
}

.lo-sparkline-bar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-slate-900);
    color: var(--text-primary);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Purpose mix bar */
.lo-purpose-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.lo-purpose-bar,
.lo-channel-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: visible;
    margin-top: 4px;
    position: relative;
}

.lo-purpose-bar-fill--purchase,
.lo-purpose-bar-fill--refi,
.lo-channel-bar-fill--broker,
.lo-channel-bar-fill--wholesale,
.lo-channel-bar-fill--direct {
    position: relative;
    cursor: pointer;
    transition: filter 0.15s;
}

.lo-purpose-bar-fill--purchase:hover,
.lo-purpose-bar-fill--refi:hover,
.lo-channel-bar-fill--broker:hover,
.lo-channel-bar-fill--wholesale:hover,
.lo-channel-bar-fill--direct:hover {
    filter: brightness(1.25);
}

.lo-purpose-bar-fill--purchase:first-child,
.lo-channel-bar-fill--broker:first-child {
    border-radius: 4px 0 0 4px;
}

.lo-purpose-bar-fill--refi:last-child,
.lo-channel-bar-fill--direct:last-child,
.lo-channel-bar-fill--wholesale:last-child,
.lo-channel-bar-fill--broker:last-child {
    border-radius: 0 4px 4px 0;
}

.lo-purpose-bar-fill--purchase:only-child,
.lo-channel-bar > :only-child {
    border-radius: 4px;
}

[class*="lo-purpose-bar-fill"][data-tooltip]:hover::after,
[class*="lo-channel-bar-fill"][data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-slate-900);
    color: var(--text-primary);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lo-purpose-bar-fill--purchase {
    background: hsl(var(--primary));
}

.lo-purpose-bar-fill--refi {
    background: #8b5cf6;
}

.lo-purpose-bar-fill--dual {
    background: #14b8a6;
}

.lo-channel-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.lo-channel-bar-fill--broker {
    background: var(--color-yellow-500);
}

.lo-channel-bar-fill--wholesale {
    background: hsl(var(--primary));
}

.lo-channel-bar-fill--direct {
    background: var(--color-green-500);
}

/* Section nav pills */
/* Dossier candidate cards (name search results) */
.dossier-candidates-strip {
    margin-bottom: var(--spacing-lg);
}

.dossier-candidates-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.dossier-candidates-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dossier-candidate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
    padding: 1.25rem 1rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.dossier-candidate-card:hover {
    background: var(--bg-quaternary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.dossier-candidate-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), #8b5cf6);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 0 5px hsl(var(--primary));
    overflow: hidden;
}

.dossier-candidate-logo {
    width: 100%;
    height: 48px;
    border-radius: var(--radius-md);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    padding: 4px 8px;
    overflow: hidden;
}

.dossier-candidate-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.dossier-candidate-avatar--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dossier-candidate-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.dossier-candidate-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.dossier-candidate-stat {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-success, #22c55e);
    margin-top: 6px;
}

.dossier-candidate-stat span {
    font-weight: 400;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dossier-candidate-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.dossier-candidate-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dossier-candidate-tag--person {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.dossier-candidate-tag--corporate {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.dossier-candidate-nmls {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lo-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    margin: calc(-1 * var(--spacing-sm)) 0;
}

.lo-section-pill {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-primary);
    cursor: default;
    transition: all 0.25s ease;
    white-space: nowrap;
    opacity: 0.5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lo-section-pill:not(.lo-section-pill--loaded)::after {
    content: '';
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.lo-section-pill--loaded {
    opacity: 1;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    cursor: pointer;
}

.lo-section-pill--loaded:hover {
    background: rgba(255,255,255,0.1);
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
}

/* In the News section */
.profile-card-news {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-primary);
}

.profile-news-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
}

.profile-news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

@media (max-width: 900px) {
    .profile-news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .profile-news-grid { grid-template-columns: 1fr; }
}

.profile-news-item {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    text-decoration: none;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    transition: all 0.15s ease;
    min-height: 0;
}

.profile-news-item:hover {
    border-color: hsl(var(--primary));
    background: rgba(59, 130, 246, 0.05);
}

.profile-news-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 4px;
}

.profile-news-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: hsl(var(--primary));
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.profile-news-title svg {
    flex-shrink: 0;
    opacity: 0.5;
    margin-top: 3px;
}

.profile-news-item:hover .profile-news-title {
    color: hsl(var(--primary));
}

.profile-news-item:hover .profile-news-title svg {
    opacity: 1;
}

.profile-news-summary {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: var(--spacing-xs);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Contact bar — pill links */
.synthetic-lender-card-container {
    margin-bottom: var(--spacing-lg);
}

.synthetic-lender-card-container .lo-card {
    margin: 0;
}

.lo-card-action-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-secondary);
}

.lo-card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lo-card-action-btn:hover {
    background: var(--bg-quaternary);
    color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

/* ================================ */
/* PINNED DOSSIERS / FAVORITES */
/* ================================ */
.pinned-page { display: flex; flex-direction: column; }
.pinned-page-header { margin-bottom: 1.5rem; }
.pinned-page-title { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }

.pinned-group { margin-bottom: 1.5rem; width: fit-content; max-width: 100%; }
.pinned-group .section-header { font-size: var(--font-size-lg); }
.pinned-group-name { text-transform: capitalize; }
.pinned-group-count { font-size: .7rem; color: hsl(var(--primary)); background: rgba(59,130,246,.1); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.pinned-group-actions { display: flex; gap: 4px; margin-left: 4px; }
.pinned-group-action { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; transition: color .15s, background .15s; }
.pinned-group-action:hover { color: var(--text-primary); background: var(--bg-quaternary); }
.pinned-group-action--danger:hover { color: var(--error-color, #ef4444); }
.pinned-group-empty { font-size: .8rem; color: var(--text-muted); padding: .5rem 0; font-style: italic; }

.pinned-grid { display: flex; flex-wrap: wrap; gap: .75rem; }
.pinned-card { width: 200px; flex-shrink: 0; position: relative; display: flex; flex-direction: column; align-items: center; padding: 1.25rem 1rem 1rem; background: var(--bg-tertiary); border: 1px solid var(--border-secondary); border-radius: 12px; cursor: pointer; transition: all .15s; text-align: center; }
.pinned-card[data-type="lender"] { width: 220px; }
.pinned-card:hover { background: var(--bg-quaternary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.pinned-card--active { border-color: hsl(var(--primary)); box-shadow: 0 0 0 1px hsl(var(--primary)), var(--shadow-sm); background: var(--bg-quaternary); }
.pinned-card-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.pinned-card:hover .pinned-card-actions { opacity: 1; }
.pinned-card-unpin, .pinned-card-move { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 5px; border-radius: 4px; line-height: 1; font-size: 1.1rem; transition: color .15s, background .15s; }
.pinned-card-unpin:hover { color: var(--error-color, #ef4444); background: rgba(239,68,68,.1); }
.pinned-card-move:hover { color: hsl(var(--primary)); background: rgba(59,130,246,.1); }
.pinned-card-heart { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 5px; border-radius: 4px; transition: color .15s; }
.pinned-card-heart:hover { color: #ef4444; }
.pinned-card-heart--active { color: #ef4444; }
.pinned-load-more { display: block; margin: 1rem auto 0; padding: .5rem 1.5rem; background: var(--bg-tertiary); border: 1px solid var(--border-secondary); border-radius: 8px; color: var(--text-secondary); cursor: pointer; font-size: .85rem; transition: all .15s; }
.pinned-load-more:hover { background: var(--bg-quaternary); color: var(--text-primary); border-color: hsl(var(--primary)); }
.pinned-move-dropdown { position: absolute; top: 28px; right: 4px; background: var(--bg-secondary); border: 1px solid var(--border-primary); border-radius: 6px; box-shadow: var(--shadow-md); z-index: 10; min-width: 140px; overflow: hidden; }
.pinned-move-dropdown.hidden { display: none; }
.pinned-move-option { display: block; width: 100%; padding: 6px 12px; border: none; background: none; color: var(--text-secondary); cursor: pointer; font-size: .8rem; text-align: left; transition: background .15s; }
.pinned-move-option:hover { background: var(--bg-quaternary); color: var(--text-primary); }

.pinned-card-avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.1rem; margin-bottom: .5rem; flex-shrink: 0; overflow: hidden; box-shadow: 0 0 0 3px var(--bg-secondary), 0 0 0 5px hsl(var(--primary)); }
.pinned-card-avatar--initials { background: linear-gradient(135deg, hsl(var(--primary)), #8b5cf6); color: #fff; }
.pinned-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pinned-card-logo { width: 100%; height: 72px; border-radius: var(--radius-md); background: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: .5rem; padding: 6px 12px; overflow: hidden; }
.pinned-card-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pinned-card-logo-fallback { font-weight: 700; font-size: 1.25rem; color: #334155; letter-spacing: .05em; }

.pinned-card-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.3; }
.pinned-card-detail { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.3; }
.pinned-card-location { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.pinned-card-stat { font-size: .75rem; font-weight: 600; color: #22c55e; margin-top: 6px; }
.pinned-card-stat-label { font-weight: 400; font-size: .6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.pinned-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.pinned-card-nmls { font-size: .7rem; color: var(--text-muted); }
.pinned-card-tag { padding: 2px 8px; border-radius: 10px; font-size: .7rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.pinned-card-tag--lo { background: rgba(59,130,246,.15); color: #60a5fa; }
.pinned-card-tag--lender { background: rgba(139,92,246,.15); color: #a78bfa; }
.pinned-card-tag--agent { background: rgba(20,184,166,.15); color: #5eead4; }

.pinned-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; color: var(--text-muted); text-align: center; }
.pinned-empty h3 { margin: .75rem 0 .25rem; font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); }
.pinned-empty p { margin: 0; font-size: .875rem; max-width: 320px; line-height: 1.5; }

.pinned-inline-input { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 1rem; padding: 0 0 0 .75rem; }
.pinned-list-name-input { width: 240px; padding: 6px 10px; border: 1px solid var(--border-primary); border-radius: 6px; background: var(--bg-tertiary); color: var(--text-primary); font-size: .875rem; outline: none; }
.pinned-list-name-input:focus { border-color: hsl(var(--primary)); }
.pinned-list-name-input--inline { padding: 2px 6px; font-size: .95rem; font-weight: 600; text-transform: capitalize; letter-spacing: .02em; width: auto; min-width: 100px; }
.pinned-inline-save, .pinned-inline-cancel { padding: 5px 12px; border: none; border-radius: 5px; cursor: pointer; font-size: .8rem; font-weight: 500; }
.pinned-inline-save { background: hsl(var(--primary)); color: #fff; }
.pinned-inline-cancel { background: var(--bg-tertiary); color: var(--text-secondary); }

.pinned-card--skeleton { pointer-events: none; border-color: transparent; }
.fav-skeleton-circle { width: 44px; height: 44px; border-radius: 50%; margin-bottom: .5rem; }
.fav-skeleton-line { height: 10px; border-radius: 4px; }
.fav-skeleton-line--name { width: 70%; margin-bottom: 6px; }
.fav-skeleton-line--detail { width: 50%; }
.fav-skeleton-circle, .fav-skeleton-line { background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-quaternary) 50%, var(--bg-tertiary) 100%); background-size: 200% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (max-width: 1023px) { .pinned-page { padding: 1rem; } .pinned-card { width: 150px; } .pinned-card[data-type="lender"] { width: 170px; } }

.lo-card-contact-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding: 0 var(--spacing-xs);
}

.lo-card-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-primary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.lo-card-contact:hover {
    background: rgba(255,255,255,0.08);
    border-color: hsl(var(--primary));
    color: hsl(var(--primary));
}

.lo-card-contact svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.lo-card-contact--social {
    padding: 6px 10px;
}
.lo-card-contact--social svg {
    opacity: 0.85;
}
.lo-card-contact--social:hover svg {
    opacity: 1;
}

/* Locked variant — used when contact details are masked for tiers without
   pii_access. Click opens the login/upgrade modal (handled by event-system). */
.lo-card-contact--locked {
    cursor: pointer;
    color: var(--text-muted, #94a3b8);
    background: rgba(255, 255, 255, 0.02);
    user-select: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.lo-card-contact--locked:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: hsl(var(--primary));
    color: var(--text-primary, #f1f5f9);
}
.lo-card-contact--locked:hover .lo-card-contact-lock,
.lo-card-contact--locked:hover .lo-card-contact-lock-badge {
    opacity: 1;
}
.lo-card-contact--locked > span {
    letter-spacing: 0.04em;
}
.lo-card-contact-lock {
    opacity: 0.7;
    margin-left: 4px;
    flex-shrink: 0;
}
.lo-card-contact--social.lo-card-contact--locked {
    position: relative;
}
.lo-card-contact-lock-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--bg-secondary);
    border-radius: 50%;
    padding: 1px;
    color: var(--text-muted);
}



/* Only target section headers inside the profile card artifact, not data sections */
.lo-card + .section-header,
.analyst-response:has(.lo-card) .section-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Dossier flow — tight spacing between sections */
.dossier-flow .dossier-section {
    margin-top: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

/* Stitch consecutive dossier sections — wrappers are the siblings now, not the .dossier-flow divs */
[data-item-key]:has(> .dossier-flow) + [data-item-key]:has(> .dossier-flow) .dossier-section {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

[data-item-key]:has(> .dossier-flow):has(+ [data-item-key]:has(> .dossier-flow)) .dossier-section {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Sparkline tooltip */
.lo-sparkline-bar:hover {
    background: rgba(59, 130, 246, 0.5);
}

.lo-sparkline-bar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-slate-900);
    color: var(--text-primary);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    border: 1px solid var(--border-primary);
}

/* Slash Command Menu */
.slash-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 100;
}

.slash-menu-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border-primary);
}

.slash-menu-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background 0.1s;
}

.slash-menu-item:hover,
.slash-menu-item--selected {
    background: var(--bg-tertiary);
}

.slash-menu-command {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: hsl(var(--primary));
}

.slash-menu-args {
    font-weight: 400;
    color: var(--text-muted);
}

.slash-menu-desc {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-top: 2px;
}


.detail-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-primary);
    align-items: center;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item span:first-child {
    font-weight: 500;
    flex-shrink: 0;
    margin-right: var(--spacing-lg);
    color: var(--text-muted);
}

.detail-item span:last-child {
    text-align: right;
    word-break: break-word;
    color: var(--text-primary);
}

/* ================================ */
/* DATA TABLE STYLES */
/* ================================ */
.data-table-container {
    margin: var(--spacing-lg) 0;
}

.data-table {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    max-height: 600px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    background: var(--bg-secondary);
    scrollbar-color: var(--border-primary) var(--bg-secondary);
}

.data-table::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.data-table::-webkit-scrollbar-track {
    border-radius: 4px;
    background: var(--bg-secondary);
}

.data-table::-webkit-scrollbar-thumb {
    border-radius: 4px;
    transition: background 0.15s ease;
    background: var(--border-primary);
}

.data-table::-webkit-scrollbar-thumb:hover {
    background: var(--color-slate-500);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
    table-layout: auto;
}

.data-table th, .data-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-slate-700);
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: var(--z-overlay);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-primary);
    background-color: var(--color-slate-700) !important;
    color: var(--text-primary);
}

.data-table td {
    color: var(--text-secondary);
}

.data-table tbody tr:nth-child(even) {
    background-color: var(--color-slate-700) !important;
}

.data-table tbody tr:nth-child(odd) {
    background-color: var(--bg-secondary) !important;
}

.data-table tbody tr:hover {
    background-color: var(--border-primary);
}

/* Column group header row (spanning headers like "CALLING", "SMS") */
.data-table tr.column-group-row th.column-group-header {
    position: sticky;
    top: 0;
    z-index: calc(var(--z-overlay) + 1);
    background-color: var(--color-slate-800, #1e293b) !important;
    color: var(--text-muted, #94a3b8) !important;
    border-bottom: none !important;
    border-left: 1px solid var(--color-slate-600, #475569);
    text-align: center !important;
    font-weight: 700 !important;
    font-size: var(--font-size-sm, 0.8125rem) !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 12px;
}

.data-table tr.column-group-row th.column-group-header:first-child {
    border-left: none;
}

.data-table tr.column-group-row th.column-group-header--empty {
    border-bottom-color: transparent !important;
    border-left: none !important;
    background-color: var(--color-slate-700, #334155) !important;
    box-shadow: 0 6px 0 0 var(--color-slate-700) !important;
}

/* Group color variants — matches CHART_COLORS from chart-config-builder.mjs.
   Inset shadow paints the colored bottom line entirely inside the cell so it
   travels with the sticky row (border-collapse: collapse would detach a real
   border on scroll). Outset slate-700 shadow fills any sub-pixel gap between
   the cell's bottom and the next sticky row's top — same color as the
   regular header below, so the fill is invisible. */
.data-table tr.column-group-row th.column-group-header--g0 {
    color: #3b82f6 !important;
    box-shadow: inset 0 -3px 0 0 #3b82f6, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g1 {
    color: #10b981 !important;
    box-shadow: inset 0 -3px 0 0 #10b981, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g2 {
    color: #f59e0b !important;
    box-shadow: inset 0 -3px 0 0 #f59e0b, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g3 {
    color: #ef4444 !important;
    box-shadow: inset 0 -3px 0 0 #ef4444, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g4 {
    color: #8b5cf6 !important;
    box-shadow: inset 0 -3px 0 0 #8b5cf6, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g5 {
    color: #06b6d4 !important;
    box-shadow: inset 0 -3px 0 0 #06b6d4, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(6, 182, 212, 0.12), rgba(6, 182, 212, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

.data-table tr.column-group-row th.column-group-header--g6 {
    color: #fb923c !important;
    box-shadow: inset 0 -3px 0 0 #fb923c, 0 6px 0 0 var(--color-slate-700) !important;
    background:
        linear-gradient(rgba(251, 146, 60, 0.12), rgba(251, 146, 60, 0.12)),
        var(--color-slate-800, #1e293b) !important;
}

/* Push regular header row below group row when both are sticky.
   Slight overlap (28px vs. the group row's ~30px rendered height) makes the
   regular header tuck under the group row instead of leaving a gap data can
   scroll through. Group row has higher z-index so the overlap isn't visible. */
.data-table .column-group-row + tr th {
    top: var(--column-group-row-height, 28px);
}

/* No border/outline/background on table icon action buttons. Themed
   stylesheets apply a blanket `.theme-name button { border: ...; background: ... }`
   with !important that was turning these icon-only buttons into boxed
   chrome. `.data-table .row-*-btn` beats `.theme button` on specificity
   (two classes vs one-class-one-element) so these rules win. */
.data-table .property-icon-link,
.data-table .row-outreach-btn,
.data-table .row-push-btn,
.data-table .row-purchase-btn,
.data-table .property-details-btn {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}
.data-table .property-icon-link:focus,
.data-table .row-outreach-btn:focus,
.data-table .row-push-btn:focus,
.data-table .row-purchase-btn:focus,
.data-table .property-details-btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ================================ */
/* CHART CONTAINER STYLES */
/* ================================ */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    padding: 16px;
    margin: var(--spacing-lg) 0;
    background: var(--bg-secondary) !important;
}

.chart-container canvas {
    background: var(--bg-secondary) !important;
}

/* ================================ */
/* INSIGHTS AND SUMMARIES */
/* ================================ */
.insights-list {
    space-y: var(--spacing-lg);
}

.insight-item {
    position: relative;
    padding-left: var(--spacing-2xl);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
    color: var(--text-secondary);
}

.insight-item::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 1.2em;
    color: hsl(var(--primary));
}

/* ================================ */
/* DEFINITION STYLES */
/* ================================ */
/* Explore Context Card (dashboard widget click-to-explore) */
.explore-context {
    max-width: var(--message-max-width);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin: var(--spacing-xl) 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.explore-context__header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 600;
    font-size: var(--font-size-base);
    color: hsl(var(--primary));
    margin-bottom: var(--spacing-xs);
}

.explore-context__header svg {
    color: hsl(var(--primary));
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.explore-context__metric {
    font-size: var(--font-size-lg, 1.125rem);
    color: var(--text-primary);
}

.explore-context__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.explore-context__tag {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--font-size-xs, 0.75rem);
    background: var(--bg-quaternary, rgba(255, 255, 255, 0.06));
    color: var(--text-secondary);
}

.explore-context__dimensions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.explore-context__dim {
    display: inline-block;
    padding: 2px var(--spacing-sm);
    border-radius: var(--radius-full, 9999px);
    font-size: var(--font-size-xs, 0.75rem);
    background: var(--color-blue-800, rgba(59, 130, 246, 0.15));
    color: var(--text-secondary);
}

.definition-content {
    position: relative;
}

.definition-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    background: var(--color-blue-800);
    color: #c7d2fe;
}

.definition-text {
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.definition-term {
    font-weight: 600;
    color: #c7d2fe;
}

.related-terms {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-secondary);
}

.related-terms-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    color: var(--text-muted);
}

.related-terms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.related-term-btn {
    font-size: var(--font-size-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
}

/* ================================ */
/* SUGGESTIONS */
/* ================================ */
.suggestions-container {
    margin-top: var(--spacing-2xl);
}

.suggestions-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    color: var(--text-muted);
}

.suggestions-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.suggestion-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-slate-600);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: var(--border-secondary);
    color: var(--text-secondary);
}

.suggestion-btn:hover {
    background: var(--color-slate-500);
    border-color: #6b7280;
    transform: translateY(-1px);
}

/* ================================ */
/* EMPTY RESULTS ANALYSIS */
/* ================================ */
.empty-results-analysis {
    margin-bottom: var(--spacing-lg);
}

.empty-results-apology {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-base);
}

.empty-results-issue {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* ================================ */
/* CROSS-SELL SUGGESTIONS */
/* ================================ */
/* ================================ */
/* CROSS-SELL SUGGESTIONS */
/* ================================ */
.crosssell-container {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(251, 191, 36, 0.03) 100%);
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-lg);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.crosssell-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.crosssell-message {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
}

.crosssell-message strong {
    color: var(--text-primary);
    font-weight: 600;
}

.crosssell-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: #fbbf24;
    text-decoration: underline;
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-top: var(--spacing-xs);
}

.crosssell-link:hover {
    color: #fcd34d;
    text-decoration: none;
}

.crosssell-link:active {
    color: #f59e0b;
}

/* ================================ */
/* BANNER / CTA SYSTEM */
/* ================================ */
.banners-container {
    margin-bottom: var(--spacing-3xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Banners extend topic-button styles */
.banner-cta {
    position: relative;
    overflow: hidden;
}

.banner-cta::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: hsl(var(--primary));
}

/* Clickable banner styles */
.banner-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.banner-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Banner type variations - Colored accent bars */
.banner-primary::before {
    background: var(--color-blue-500);
}

.banner-info::before {
    background: var(--color-blue-400);
}

.banner-success::before {
    background: var(--color-green-500);
}

.banner-warning::before {
    background: var(--color-yellow-500);
}

.banner-close {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
}

.banner-close:hover {
    background: var(--color-slate-500);
    color: var(--text-primary);
}

.banner-close svg {
    width: 1rem;
    height: 1rem;
}

.banner-content {
    padding-right: 2rem; /* Space for close button */
}

.banner-button {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-xl);
    background: var(--color-blue-600);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    grid-row: 3;
    grid-column: 2;
    justify-self: start;
    margin-top: var(--spacing-xs);
}

.banner-button:hover {
    background: var(--color-blue-700);
    transform: translateY(-1px);
}

.banner-button:active {
    transform: translateY(0);
    background: var(--color-blue-800);
}

.banner-button svg {
    margin-left: var(--spacing-sm);
}

/* Animations */
.banner-cta {
    animation: bannerSlideIn 0.4s ease-out;
}

@keyframes bannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .banner-button {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================================
   FEATURE ANNOUNCEMENT MODAL (carousel for new feature intros)
   ============================================================================ */

.feature-announcement-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-slow);
    pointer-events: none;
}

.feature-announcement-modal.entering {
    opacity: 1;
    pointer-events: auto;
}

.feature-announcement-modal.exiting {
    opacity: 0;
    pointer-events: none;
}

/* Backdrop visibility — the backdrop is a sibling, not a child of .conversation-modal */
.modal-backdrop.entering {
    opacity: 1;
}

.modal-backdrop.exiting {
    opacity: 0;
}

.fa-backdrop {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.fa-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    max-width: 28rem;
    width: 90vw;
    overflow: hidden;
    box-shadow: var(--shadow-dark-xl);
    transform: scale(0.95);
    transition: transform var(--transition-slow);
}

.feature-announcement-modal.entering .fa-modal-content {
    transform: scale(1);
}

.feature-announcement-modal.exiting .fa-modal-content {
    transform: scale(0.95);
}

.fa-modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 2;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: var(--radius-full);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-slate-300);
    transition: all var(--transition-fast);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fa-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: white;
}

.fa-modal-close svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Slide media (animated GIF / image area) */
.fa-slide-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg-tertiary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fa-slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fa-slide-placeholder {
    font-size: 3rem;
    opacity: 0.6;
}

/* Slide body text */
.fa-slide-body {
    padding: var(--spacing-xl) var(--spacing-2xl);
}

.fa-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: hsl(var(--primary));
    background: rgba(96, 165, 250, 0.15);
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-full);
    margin-bottom: var(--spacing-md);
}

.fa-slide-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.fa-slide-description {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Navigation footer */
.fa-slide-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-2xl);
    border-top: 1px solid var(--border-primary);
}

.fa-dots {
    display: flex;
    gap: 0.375rem;
}

.fa-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0.4;
}

.fa-dot:hover {
    opacity: 0.7;
}

.fa-dot.active {
    background: hsl(var(--primary));
    opacity: 1;
    transform: scale(1.3);
}

.fa-nav-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.fa-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.fa-btn:hover {
    transform: translateY(-1px);
}

.fa-btn:active {
    transform: translateY(0);
}

.fa-btn-primary {
    background: hsl(var(--primary));
    color: white;
}

.fa-btn-primary:hover {
    background: hsl(var(--primary));
}

.fa-btn-back {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-primary);
}

.fa-btn-back:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.fa-btn-try {
    background: transparent;
    color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.fa-btn-try:hover {
    background: rgba(96, 165, 250, 0.1);
}

/* Video support in media area */
.fa-slide-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Feature Announcement: CSS Animations ---- */

/* Shared animation container */
.fa-anim {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, var(--color-slate-800) 0%, var(--color-slate-900) 100%);
    overflow: hidden;
}

/* ---- Animation 1: Profile Card ---- */

.fa-anim-card {
    width: 85%;
    max-width: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: faCardSlideUp 0.6s ease-out both;
}

@keyframes faCardSlideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.fa-anim-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    animation: faFadeIn 0.4s ease-out 0.3s both;
}

.fa-anim-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background: rgba(96, 165, 250, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: hsl(var(--primary));
}

.fa-anim-avatar svg {
    width: 1.25rem;
    height: 1.25rem;
}

.fa-anim-info {
    min-width: 0;
}

.fa-anim-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.fa-anim-detail {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.fa-anim-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 0 var(--spacing-lg);
    animation: faFadeIn 0.3s ease-out 0.5s both;
}

.fa-anim-stats {
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-sm);
}

.fa-anim-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    animation: faFadeIn 0.3s ease-out both;
}

.fa-anim-stat:nth-child(1) { animation-delay: 0.6s; }
.fa-anim-stat:nth-child(2) { animation-delay: 0.8s; }
.fa-anim-stat:nth-child(3) { animation-delay: 1.0s; }

.fa-anim-stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    width: 5rem;
    flex-shrink: 0;
}

.fa-anim-bar-track {
    flex: 1;
    height: 6px;
    background: var(--color-slate-600);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.fa-anim-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: hsl(var(--primary));
    animation: faBarGrow 0.8s ease-out both;
}

.fa-anim-bar-1 { width: 82%; animation-delay: 0.8s; }
.fa-anim-bar-2 { width: 65%; animation-delay: 1.0s; background: var(--color-green-500); }
.fa-anim-bar-3 { width: 48%; animation-delay: 1.2s; background: var(--color-yellow-500); }

@keyframes faBarGrow {
    from { width: 0; }
}

.fa-anim-stat-value {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 3rem;
    text-align: right;
    animation: faFadeIn 0.3s ease-out both;
}

.fa-anim-stat:nth-child(1) .fa-anim-stat-value { animation-delay: 1.2s; }
.fa-anim-stat:nth-child(2) .fa-anim-stat-value { animation-delay: 1.4s; }
.fa-anim-stat:nth-child(3) .fa-anim-stat-value { animation-delay: 1.6s; }

/* Sparkline */
.fa-anim-sparkline {
    padding: var(--spacing-xs) var(--spacing-lg) var(--spacing-md);
    animation: faFadeIn 0.5s ease-out 1.4s both;
}

.fa-anim-sparkline svg {
    width: 100%;
    height: 28px;
}

.fa-anim-spark-line {
    fill: none;
    stroke: hsl(var(--primary));
    stroke-width: 2;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: faSparkDraw 1.5s ease-out 1.6s forwards;
}

.fa-anim-spark-fill {
    fill: rgba(96, 165, 250, 0.1);
    opacity: 0;
    animation: faFadeIn 0.5s ease-out 2.5s forwards;
}

@keyframes faSparkDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes faFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Animation 2: LO + Lender dual cards ---- */

.fa-anim-dual {
    gap: var(--spacing-lg);
}

.fa-anim-mini-card {
    width: 45%;
    max-width: 160px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
}

.fa-anim-mini-lo {
    animation: faSlideFromLeft 0.5s ease-out 0.2s both;
}

.fa-anim-mini-lender {
    animation: faSlideFromRight 0.5s ease-out 0.4s both;
}

@keyframes faSlideFromLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes faSlideFromRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.fa-anim-mini-icon {
    width: 2rem;
    height: 2rem;
    margin: 0 auto var(--spacing-sm);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fa-anim-mini-lo .fa-anim-mini-icon {
    background: rgba(96, 165, 250, 0.15);
    color: hsl(var(--primary));
}

.fa-anim-mini-lender .fa-anim-mini-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-green-500);
}

.fa-anim-mini-icon svg {
    width: 1rem;
    height: 1rem;
}

.fa-anim-mini-label {
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.125rem;
}

.fa-anim-mini-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-anim-mini-stats {
    text-align: left;
}

.fa-anim-mini-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--text-muted);
    padding: 0.125rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    animation: faFadeIn 0.3s ease-out both;
}

.fa-anim-mini-lo .fa-anim-mini-row:nth-child(1) { animation-delay: 0.7s; }
.fa-anim-mini-lo .fa-anim-mini-row:nth-child(2) { animation-delay: 0.9s; }
.fa-anim-mini-lo .fa-anim-mini-row:nth-child(3) { animation-delay: 1.1s; }
.fa-anim-mini-lender .fa-anim-mini-row:nth-child(1) { animation-delay: 0.9s; }
.fa-anim-mini-lender .fa-anim-mini-row:nth-child(2) { animation-delay: 1.1s; }
.fa-anim-mini-lender .fa-anim-mini-row:nth-child(3) { animation-delay: 1.3s; }

.fa-anim-mini-val {
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Animation 3: Slash command typing ---- */

.fa-anim-cmd {
    padding: var(--spacing-2xl);
}

.fa-anim-chat-window {
    width: 90%;
    max-width: 300px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: faCardSlideUp 0.4s ease-out both;
}

.fa-anim-chat-header {
    display: flex;
    gap: 0.375rem;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-slate-600);
}

.fa-anim-chat-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--color-slate-400);
    opacity: 0.5;
}

.fa-anim-chat-body {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.fa-anim-input-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.fa-anim-input {
    flex: 1;
    background: var(--color-slate-600);
    border: 1px solid var(--color-slate-500);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 1.75rem;
    display: flex;
    align-items: center;
}

.fa-anim-typed-text {
    color: hsl(var(--primary));
    font-weight: 500;
}

.fa-anim-typed-text::after {
    content: '/me';
    animation: faTypeText 1.5s steps(3) 0.5s both;
}

@keyframes faTypeText {
    0% { content: ''; }
    33% { content: '/'; }
    66% { content: '/m'; }
    100% { content: '/me'; }
}

.fa-anim-cursor {
    color: hsl(var(--primary));
    animation: faCursorBlink 0.8s step-end infinite;
    font-weight: 300;
}

@keyframes faCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.fa-anim-send-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-md);
    background: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.fa-anim-send-btn svg {
    width: 0.75rem;
    height: 0.75rem;
}

.fa-anim-menu {
    background: var(--color-slate-600);
    border: 1px solid var(--color-slate-500);
    border-radius: var(--radius-md);
    overflow: hidden;
    animation: faMenuSlideUp 0.3s ease-out 1.8s both;
}

@keyframes faMenuSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fa-anim-menu-header {
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs);
}

.fa-anim-menu-item {
    padding: var(--spacing-sm) var(--spacing-md);
    animation: faFadeIn 0.2s ease-out both;
}

.fa-anim-menu-item:nth-child(2) { animation-delay: 2.0s; }
.fa-anim-menu-item:nth-child(3) { animation-delay: 2.15s; }
.fa-anim-menu-item:nth-child(4) { animation-delay: 2.3s; }

.fa-anim-menu-item-active {
    background: rgba(96, 165, 250, 0.1);
}

.fa-anim-menu-cmd {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.fa-anim-menu-args {
    font-weight: 400;
    color: var(--text-muted);
}

.fa-anim-menu-desc {
    font-size: 0.5625rem;
    color: var(--text-muted);
}

/* ---- Animation 4: Favorites / saved profiles ---- */

.fa-anim-favs {
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-2xl);
}

.fa-anim-favs-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    animation: faFadeIn 0.4s ease-out 0.2s both;
}

.fa-anim-favs-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-yellow-500);
}

.fa-anim-favs-list {
    width: 90%;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.fa-anim-fav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    animation: faFavSlideIn 0.4s ease-out both;
}

.fa-anim-fav-1 { animation-delay: 0.5s; }
.fa-anim-fav-2 { animation-delay: 0.8s; }
.fa-anim-fav-3 { animation-delay: 1.1s; }

@keyframes faFavSlideIn {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

.fa-anim-fav-star {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--color-yellow-500);
    animation: faStarPop 0.3s ease-out both;
}

.fa-anim-fav-1 .fa-anim-fav-star { animation-delay: 0.8s; }
.fa-anim-fav-2 .fa-anim-fav-star { animation-delay: 1.1s; }
.fa-anim-fav-3 .fa-anim-fav-star { animation-delay: 1.4s; }

@keyframes faStarPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.fa-anim-fav-star svg {
    width: 100%;
    height: 100%;
}

.fa-anim-fav-info {
    flex: 1;
    min-width: 0;
}

.fa-anim-fav-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-anim-fav-sub {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.fa-anim-fav-vol {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--primary));
    flex-shrink: 0;
}

/* Star-to-save animation */
.fa-anim-star {
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-2xl);
}

.fa-anim-star-list {
    width: 90%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.fa-anim-star-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    opacity: 0;
    animation: faFavSlideIn 0.4s ease-out forwards;
}

.fa-anim-star-row-1 { animation-delay: 0.3s; }
.fa-anim-star-row-2 { animation-delay: 0.5s; }
.fa-anim-star-row-3 { animation-delay: 0.7s; }

/* Highlight glow on starred rows */
.fa-anim-star-row-1,
.fa-anim-star-row-2 {
    animation: faFavSlideIn 0.4s ease-out forwards, faStarHighlight 0.6s ease-out 1.4s;
}

@keyframes faStarHighlight {
    0% { background: var(--bg-tertiary); }
    40% { background: rgba(234, 179, 8, 0.08); }
    100% { background: var(--bg-tertiary); }
}

.fa-anim-star-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-secondary);
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.fa-anim-star-info {
    flex: 1;
    min-width: 0;
}

.fa-anim-star-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-anim-star-sub {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.fa-anim-star-btn {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--text-muted);
    position: relative;
}

.fa-anim-star-btn svg {
    width: 100%;
    height: 100%;
}

/* Filled star overlays the outline, starts hidden */
.fa-anim-star-filled {
    position: absolute;
    inset: 0;
    color: var(--color-yellow-500);
    opacity: 0;
    transform: scale(0);
}

/* Toggle animation — filled star pops in */
.fa-anim-star-row-1 .fa-anim-star-filled {
    animation: faStarToggle 0.4s ease-out 1.2s forwards;
}

.fa-anim-star-row-2 .fa-anim-star-filled {
    animation: faStarToggle 0.4s ease-out 1.5s forwards;
}

@keyframes faStarToggle {
    0% { opacity: 0; transform: scale(0); }
    60% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

/* "Saved to Favorites" hint */
.fa-anim-star-hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-yellow-500);
    opacity: 0;
    animation: faFadeIn 0.5s ease-out 1.9s forwards;
}

.fa-anim-star-hint-icon {
    width: 0.875rem;
    height: 0.875rem;
}

@keyframes faFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   LEAD STORE ANIMATIONS
   ============================================================================ */

.fa-anim-leads {
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-2xl);
}

.fa-anim-leads-table {
    width: 92%;
    max-width: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.fa-anim-leads-header {
    display: flex;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fa-anim-leads-row {
    display: flex;
    padding: var(--spacing-sm) var(--spacing-md);
    align-items: center;
    opacity: 0;
    animation: faFavSlideIn 0.4s ease-out forwards;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.fa-anim-leads-row-1 { animation-delay: 0.3s; }
.fa-anim-leads-row-2 { animation-delay: 0.5s; }
.fa-anim-leads-row-3 { animation-delay: 0.7s; }

.fa-anim-leads-col-name {
    flex: 1.5;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-anim-leads-col {
    flex: 1;
    display: flex;
    justify-content: center;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.fa-anim-leads-cart {
    position: relative;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-muted);
}

.fa-anim-leads-cart svg { width: 100%; height: 100%; }

.fa-anim-leads-check {
    position: absolute;
    inset: 0;
    color: var(--color-green-500);
    opacity: 0;
    transform: scale(0);
}

.fa-anim-leads-row-1 .fa-anim-leads-col:nth-child(2) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.0s forwards; }
.fa-anim-leads-row-1 .fa-anim-leads-col:nth-child(3) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.15s forwards; }
.fa-anim-leads-row-2 .fa-anim-leads-col:nth-child(2) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.3s forwards; }
.fa-anim-leads-row-2 .fa-anim-leads-col:nth-child(3) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.45s forwards; }
.fa-anim-leads-row-3 .fa-anim-leads-col:nth-child(2) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.6s forwards; }
.fa-anim-leads-row-3 .fa-anim-leads-col:nth-child(3) .fa-anim-leads-check { animation: faStarToggle 0.4s ease-out 1.75s forwards; }

.fa-anim-leads-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-green-500);
    opacity: 0;
    animation: faFadeIn 0.5s ease-out 2.1s forwards;
}

.fa-anim-leads-badge svg { width: 0.875rem; height: 0.875rem; }

/* Opportunity Finder — AI-scored refi cards fading in with lane badges */
.fa-anim-opps {
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
}

.fa-anim-opps-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm);
    width: 92%;
    max-width: 340px;
}

.fa-anim-opps-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.55rem;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    opacity: 0;
    transform: translateY(4px);
    animation: faFavSlideIn 0.4s ease-out forwards;
}
.fa-anim-opps-card-1 { animation-delay: 0.25s; }
.fa-anim-opps-card-2 { animation-delay: 0.45s; }
.fa-anim-opps-card-3 { animation-delay: 0.65s; }
.fa-anim-opps-card-4 { animation-delay: 0.85s; }

.fa-anim-opps-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.fa-anim-opps-lane {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.fa-anim-opps-lane--rate-term { background: rgba(34, 197, 94, .15);  color: #22c55e; border-color: rgba(34, 197, 94, .3); }
.fa-anim-opps-lane--cash      { background: rgba(168, 85, 247, .15); color: #c084fc; border-color: rgba(168, 85, 247, .3); }
.fa-anim-opps-lane--pmi       { background: rgba(59, 130, 246, .15); color: #60a5fa; border-color: rgba(59, 130, 246, .3); }
.fa-anim-opps-lane--both      { background: rgba(245, 158, 11, .15); color: #f59e0b; border-color: rgba(245, 158, 11, .3); }

.fa-anim-opps-score {
    min-width: 20px;
    height: 18px;
    padding: 0 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 999px;
    color: var(--color-slate-900);
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transform: scale(0.6);
    animation: faStarToggle 0.35s ease-out forwards;
}
.fa-anim-opps-score--hot  { background: #22c55e; }
.fa-anim-opps-score--warm { background: #f59e0b; }
.fa-anim-opps-card-1 .fa-anim-opps-score { animation-delay: 0.55s; }
.fa-anim-opps-card-2 .fa-anim-opps-score { animation-delay: 0.75s; }
.fa-anim-opps-card-3 .fa-anim-opps-score { animation-delay: 0.95s; }
.fa-anim-opps-card-4 .fa-anim-opps-score { animation-delay: 1.15s; }

.fa-anim-opps-name {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-anim-opps-chips {
    display: flex;
    gap: 0.25rem;
}

.fa-anim-opps-chip {
    font-size: 0.5625rem;
    font-weight: 600;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.fa-anim-opps-chip--save   { background: rgba(34, 197, 94, .12);  color: #22c55e; border-color: rgba(34, 197, 94, .3); }
.fa-anim-opps-chip--equity { background: rgba(59, 130, 246, .12); color: #60a5fa; border-color: rgba(59, 130, 246, .3); }

.fa-anim-opps-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.7rem;
    font-weight: 500;
    color: hsl(var(--primary));
    opacity: 0;
    animation: faFadeIn 0.5s ease-out 1.45s forwards;
}
.fa-anim-opps-badge-icon {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--color-yellow-400, #fbbf24);
    animation: faOppsSparkle 1.6s ease-in-out 1.6s infinite;
    transform-origin: center;
}
.fa-anim-opps-badge-icon svg { width: 100%; height: 100%; }

@keyframes faOppsSparkle {
    0%, 100% { transform: scale(1)   rotate(0deg); opacity: 0.85; }
    50%      { transform: scale(1.2) rotate(20deg); opacity: 1; }
}

/* Lead Store Checkout */
.fa-anim-checkout {
    padding: var(--spacing-xl);
}

.fa-anim-checkout-panel {
    width: 90%;
    max-width: 260px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    opacity: 0;
    animation: faCardSlideUp 0.5s ease-out 0.2s forwards;
}

.fa-anim-checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fa-anim-checkout-count {
    background: hsl(var(--primary));
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.fa-anim-checkout-items {
    padding: 0 var(--spacing-lg);
}

.fa-anim-checkout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    opacity: 0;
    animation: faFavSlideIn 0.3s ease-out forwards;
}

.fa-anim-checkout-item-1 { animation-delay: 0.5s; }
.fa-anim-checkout-item-2 { animation-delay: 0.7s; }
.fa-anim-checkout-item-3 { animation-delay: 0.9s; }

.fa-anim-checkout-item-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.fa-anim-checkout-item-sub {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.fa-anim-checkout-item-price {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--primary));
}

.fa-anim-checkout-total {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-lg);
    margin-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 1.1s forwards;
}

.fa-anim-checkout-btn {
    margin: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: hsl(var(--primary));
    border-radius: var(--radius-md);
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 1.4s forwards;
}

/* ============================================================================
   OUTREACH ANIMATIONS
   ============================================================================ */

.fa-anim-outreach {
    padding: var(--spacing-xl);
}

.fa-anim-outreach-panel {
    width: 92%;
    max-width: 280px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    opacity: 0;
    animation: faCardSlideUp 0.5s ease-out 0.2s forwards;
}

.fa-anim-outreach-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fa-anim-outreach-badge {
    font-size: 0.5625rem;
    font-weight: 500;
    color: hsl(var(--primary));
    padding: 1px 6px;
    border: 1px solid hsl(var(--primary));
    border-radius: 8px;
}

.fa-anim-outreach-tabs {
    display: flex;
    margin: 0 var(--spacing-lg);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 3px;
}

.fa-anim-outreach-tab {
    flex: 1;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: var(--spacing-xs) 0;
    border-radius: calc(var(--radius-md) - 2px);
    color: var(--text-muted);
}

.fa-anim-outreach-tab--active {
    background: hsl(var(--primary));
    color: white;
}

.fa-anim-outreach-content {
    padding: var(--spacing-md) var(--spacing-lg);
}

.fa-anim-outreach-field {
    opacity: 0;
    animation: faFadeIn 0.4s ease-out forwards;
}

.fa-anim-outreach-field-1 { animation-delay: 0.6s; margin-bottom: var(--spacing-md); }
.fa-anim-outreach-field-2 { animation-delay: 0.8s; }

.fa-anim-outreach-label {
    font-size: 0.5625rem;
    font-weight: 700;
    color: hsl(var(--primary));
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.fa-anim-outreach-input {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.fa-anim-outreach-body {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 4rem;
}

.fa-anim-outreach-line {
    font-size: 0.625rem;
    line-height: 1.5;
    color: var(--text-primary);
    opacity: 0;
    animation: faFadeIn 0.4s ease-out forwards;
}

.fa-anim-outreach-line-1 { animation-delay: 1.0s; margin-bottom: 4px; }
.fa-anim-outreach-line-2 { animation-delay: 1.3s; color: var(--text-secondary); margin-bottom: 4px; }
.fa-anim-outreach-line-3 { animation-delay: 1.6s; }

.fa-anim-outreach-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-md);
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 1.9s forwards;
}

.fa-anim-outreach-tone {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.fa-anim-outreach-tone-val {
    color: var(--text-secondary);
    font-weight: 500;
}

.fa-anim-outreach-copy-btn {
    font-size: 0.6875rem;
    font-weight: 600;
    color: white;
    background: hsl(var(--primary));
    padding: 3px 12px;
    border-radius: var(--radius-sm);
}

/* Outreach Row Action */
.fa-anim-outreach-rows {
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-2xl);
}

.fa-anim-outreach-table {
    width: 92%;
    max-width: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.fa-anim-outreach-tbl-header {
    display: flex;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fa-anim-outreach-tbl-row {
    display: flex;
    padding: var(--spacing-sm) var(--spacing-md);
    align-items: center;
    opacity: 0;
    animation: faFavSlideIn 0.4s ease-out forwards;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.fa-anim-outreach-tbl-row-1 { animation-delay: 0.3s; }
.fa-anim-outreach-tbl-row-2 { animation-delay: 0.5s; }
.fa-anim-outreach-tbl-row-3 { animation-delay: 0.7s; }

.fa-anim-outreach-tbl-col-name {
    flex: 1.5;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.fa-anim-outreach-tbl-col {
    flex: 1;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: right;
}

.fa-anim-outreach-tbl-col-sm {
    width: 2rem;
    display: flex;
    justify-content: center;
}

.fa-anim-outreach-pen {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    opacity: 0;
    animation: faFadeIn 0.3s ease-out 0.9s forwards;
}

.fa-anim-outreach-pen svg { width: 100%; height: 100%; }

.fa-anim-outreach-pen--active {
    color: hsl(var(--primary));
    animation: faFadeIn 0.3s ease-out 0.9s forwards, faStarHighlight 0.6s ease-out 1.3s;
}

.fa-anim-outreach-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0;
    animation: faFadeIn 0.5s ease-out 1.6s forwards;
}

/* ============================================================================
   BONZO ANALYTICS ANIMATION
   ============================================================================ */

.fa-anim-bonzo-dash {
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg) var(--spacing-xl);
}

/* Scorecard row */
.fa-anim-bonzo-scorecards {
    display: flex;
    gap: 6px;
    width: 95%;
    max-width: 340px;
}

.fa-anim-bonzo-sc {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    animation: faFadeIn 0.3s ease-out forwards;
}

.fa-anim-bonzo-sc-1 { animation-delay: 0.3s; }
.fa-anim-bonzo-sc-2 { animation-delay: 0.45s; }
.fa-anim-bonzo-sc-3 { animation-delay: 0.6s; }
.fa-anim-bonzo-sc-4 { animation-delay: 0.75s; }

.fa-anim-bonzo-sc-label {
    font-size: 0.4375rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.fa-anim-bonzo-sc-value {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-top: 1px;
}

.fa-anim-bonzo-sc-change {
    font-size: 0.5rem;
    font-weight: 600;
    margin-top: 1px;
}

.fa-anim-bonzo-up { color: var(--color-green-500); }
.fa-anim-bonzo-down { color: hsl(var(--destructive)); }
.fa-anim-bonzo-neutral { color: var(--text-muted); }

/* Area chart */
.fa-anim-bonzo-chart {
    width: 95%;
    max-width: 340px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 10px 6px;
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 1.0s forwards;
}

.fa-anim-bonzo-chart-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.5rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    justify-content: center;
}

.fa-anim-bonzo-legend-sent,
.fa-anim-bonzo-legend-delivered {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.fa-anim-bonzo-legend-sent { background: rgba(59, 130, 246, 0.7); margin-left: 4px; }
.fa-anim-bonzo-legend-delivered { background: rgba(16, 185, 129, 0.7); margin-left: 4px; }

.fa-anim-bonzo-svg {
    width: 100%;
    height: 60px;
    display: block;
}

.fa-anim-bonzo-area-sent {
    fill: rgba(59, 130, 246, 0.25);
    stroke: none;
}

.fa-anim-bonzo-area-delivered {
    fill: rgba(16, 185, 129, 0.2);
    stroke: none;
}

.fa-anim-bonzo-line-sent {
    fill: none;
    stroke: rgba(59, 130, 246, 0.8);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: faBonzoLineDraw 1.2s ease-out 1.2s forwards;
}

.fa-anim-bonzo-line-delivered {
    fill: none;
    stroke: rgba(16, 185, 129, 0.7);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: faBonzoLineDraw 1.2s ease-out 1.4s forwards;
}

@keyframes faBonzoLineDraw {
    to { stroke-dashoffset: 0; }
}

/* Bonzo chat interaction */
.fa-anim-bonzo-chat {
    flex-direction: column;
    padding: var(--spacing-xl);
}

.fa-anim-bonzo-chat-window {
    width: 92%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.fa-anim-bonzo-chat-q {
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 0.3s forwards;
}

.fa-anim-bonzo-chat-a {
    display: flex;
    justify-content: flex-start;
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 0.9s forwards;
}

.fa-anim-bonzo-chat-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    font-size: 0.6875rem;
    line-height: 1.4;
}

.fa-anim-bonzo-chat-user {
    background: hsl(var(--primary));
    color: white;
    border-bottom-right-radius: 4px;
}

.fa-anim-bonzo-chat-bot {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.fa-anim-bonzo-chat-kpi-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: 6px;
}

.fa-anim-bonzo-chat-kpi-label {
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.fa-anim-bonzo-chat-kpi-val {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.fa-anim-bonzo-chat-mini-chart {
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.fa-anim-bonzo-chat-mini-chart svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fa-anim-bonzo-chat-area {
    fill: rgba(59, 130, 246, 0.15);
}

.fa-anim-bonzo-chat-line {
    fill: none;
    stroke: rgba(59, 130, 246, 0.6);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: faBonzoLineDraw 1s ease-out 1.3s forwards;
}

/* Dashboard picker */
.fa-anim-bonzo-picker {
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xl);
    gap: var(--spacing-xs);
}

.fa-anim-bonzo-picker-title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--text-primary);
    opacity: 0;
    animation: faFadeIn 0.3s ease-out 0.2s forwards;
}

.fa-anim-bonzo-picker-sub {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
    opacity: 0;
    animation: faFadeIn 0.3s ease-out 0.3s forwards;
}

.fa-anim-bonzo-picker-grid {
    display: flex;
    gap: 6px;
    width: 95%;
    max-width: 340px;
}

.fa-anim-bonzo-pick {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    opacity: 0;
    animation: faCardSlideUp 0.35s ease-out forwards;
}

.fa-anim-bonzo-pick-1 { animation-delay: 0.4s; }
.fa-anim-bonzo-pick-2 { animation-delay: 0.5s; }
.fa-anim-bonzo-pick-3 { animation-delay: 0.6s; }
.fa-anim-bonzo-pick-4 { animation-delay: 0.7s; }
.fa-anim-bonzo-pick-5 { animation-delay: 0.8s; }

.fa-anim-bonzo-pick svg {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(var(--primary));
}

.fa-anim-bonzo-pick-name {
    font-size: 0.5625rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.fa-anim-bonzo-picker-link {
    font-size: 0.6875rem;
    font-weight: 600;
    color: hsl(var(--primary));
    margin-top: var(--spacing-sm);
    opacity: 0;
    animation: faFadeIn 0.4s ease-out 1.0s forwards;
}

/* ============================================================================
   NOTIFICATION CENTER
   ============================================================================ */

.notification-center {
    position: relative;
}

.notification-bell {
    position: relative;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* Mobile hides: chrome that doesn't earn its space on iPhone-width
   screens. The notification center JS un-hides the wrapper after auth,
   so the media query needs !important to override the visible state.
   #importFavoritesBtn is added by pinned-dossiers when favorites mounts. */
@media (max-width: 640px) {
    #notificationCenter,
    #importFavoritesBtn {
        display: none !important;
    }
}

/* Dropdown panel */
.nc-panel {
    position: absolute;
    top: calc(100% + var(--spacing-sm));
    right: 0;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 100;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.nc-panel.entering {
    opacity: 1;
    transform: translateY(0);
}

.nc-panel.exiting {
    opacity: 0;
    transform: translateY(-4px);
}

.nc-header {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.01em;
}

.nc-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    font-family: inherit;
}

.nc-item:hover:not([disabled]) {
    background: var(--bg-tertiary);
}

.nc-item[disabled] {
    cursor: default;
    opacity: 0.6;
}

.nc-item + .nc-item {
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.04));
}

.nc-item:nth-child(even) {
    background: rgba(255, 255, 255, 0.04);
}

.nc-item-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.nc-item-body {
    flex: 1;
    min-width: 0;
}

.nc-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.nc-item-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nc-item-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.nc-empty {
    padding: var(--spacing-2xl) var(--spacing-lg);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
    .fa-modal-content {
        width: 95vw;
        max-width: none;
    }

    .fa-slide-body {
        padding: var(--spacing-lg);
    }

    .fa-slide-nav {
        padding: var(--spacing-md) var(--spacing-lg);
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .fa-nav-buttons {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ================================ */
/* WELCOME SCREEN */
/* ================================ */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: var(--spacing-2xl);
}

.welcome-content {
    max-width: 36rem;
    width: 100%;
    text-align: center;
}

.welcome-header {
    margin-bottom: var(--spacing-3xl);
}

.welcome-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
    background: hsl(var(--primary));
    color: white;
}

.welcome-icon svg {
    width: var(--spacing-2xl);
    height: var(--spacing-2xl);
}

.welcome-header h1 {
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.welcome-header p {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .welcome-title,
    .welcome-icon {
        display: none;
    }
}

.topics-grid {
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: 1fr;
}

.topic-button {
    padding: var(--spacing-lg);
    text-align: left;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-slate-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: var(--spacing-sm) var(--spacing-md);
    align-items: start;
    background: var(--border-secondary);
    color: #f9fafb;
}

.topic-icon {
    font-size: var(--spacing-2xl);
    line-height: 1;
    grid-row: 1 / 3;
    grid-column: 1;
    margin-top: var(--spacing-xs);
    filter: brightness(1.1);
}

.topic-button h3 {
    font-weight: 600;
    margin: 0;
    font-size: var(--font-size-lg);
    grid-row: 1;
    grid-column: 2;
}

.topic-button p {
    font-size: var(--font-size-base);
    line-height: 1.4;
    margin: 0;
    grid-row: 2;
    grid-column: 2;
}

.topic-feature-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    letter-spacing: 0.02em;
    grid-row: 3;
    grid-column: 2;
    justify-self: start;
    margin-top: -0.25rem;
}

.topic-button {
    position: relative;
}

.topic-button:hover {
    background: var(--color-slate-500);
    border-color: #6b7280;
    transform: translateY(-2px);
}

/* ================================ */
/* AUTH MODAL STYLES */
/* ================================ */
.auth-modal-backdrop {
    pointer-events: auto !important;
    cursor: default !important;
}

.auth-modal-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-modal {
    position: relative;
    overflow: visible;
}

.auth-modal .modal-content {
    max-width: 48rem;
    width: 100%;
    padding: var(--spacing-3xl);
    background: var(--bg-secondary);
    border: none;
    box-shadow: var(--shadow-dark-xl), 
                0 0 40px rgba(59, 130, 246, 0.1);
    position: relative;
    overflow: visible;
}

.auth-modal .modal-content::before {
    content: '';
    position: absolute;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 110%;
    max-width: 52rem;
    height: 250px;
    background: radial-gradient(ellipse at center,
        rgba(59, 130, 246, 0.5) 0%,
        rgba(59, 130, 246, 0.3) 15%,
        rgba(59, 130, 246, 0.2) 30%,
        rgba(59, 130, 246, 0.1) 50%,
        rgba(59, 130, 246, 0.05) 70%,
        transparent 90%);
    pointer-events: none;
    filter: blur(50px);
    z-index: -1;
}

.auth-modal .modal-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--color-blue-500) 0%, 
        var(--color-blue-400) 50%, 
        var(--color-blue-500) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    opacity: 0.6;
}


.auth-modal-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-modal-header {
    margin-bottom: var(--spacing-3xl);
    position: relative;
}

.auth-modal-header .welcome-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
    background: hsl(var(--primary));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 0 0 4px rgba(59, 130, 246, 0.1);
    position: relative;
}

.auth-modal-header .welcome-icon svg {
    width: var(--spacing-2xl);
    height: var(--spacing-2xl);
}

.auth-modal-title {
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.auth-modal-description {
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-xl) 0;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

.auth-modal-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    margin: 0 0 var(--spacing-2xl) 0;
}

.auth-modal-tiles {
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: 1fr;
    max-width: 36rem;
    margin: 0 auto;
}

.auth-tile {
    padding: var(--spacing-lg);
    text-align: left;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-slate-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: var(--spacing-sm) var(--spacing-md);
    align-items: start;
    background: var(--border-secondary);
    color: #f9fafb;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-dark-sm);
}

.auth-tile::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: hsl(var(--primary));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.auth-tile-login::before {
    background: var(--color-blue-500);
}

.auth-tile-trial::before {
    background: var(--color-green-500);
}

.auth-tile-signup::before {
    background: var(--color-blue-600);
}

.auth-tile:hover {
    background: var(--color-slate-500);
    border-color: #6b7280;
    transform: translateY(-2px);
    box-shadow: var(--shadow-dark-md), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.auth-tile:hover::before {
    opacity: 1;
}

.auth-tile-icon {
    font-size: var(--spacing-2xl);
    line-height: 1;
    grid-row: 1 / 3;
    grid-column: 1;
    margin-top: var(--spacing-xs);
    filter: brightness(1.1);
}

.auth-tile h3 {
    font-weight: 600;
    margin: 0;
    font-size: var(--font-size-lg);
    grid-row: 1;
    grid-column: 2;
    color: var(--text-primary);
}

.auth-tile p {
    font-size: var(--font-size-base);
    line-height: 1.4;
    margin: 0;
    grid-row: 2;
    grid-column: 2;
    color: var(--text-secondary);
}

@media (max-width: 640px) {
    .auth-modal .modal-content {
        padding: var(--spacing-2xl);
    }
    
    .auth-modal-title {
        font-size: var(--font-size-2xl);
    }
    
    .auth-tile {
        padding: var(--spacing-lg);
    }
}

/* ================================ */
/* THINKING BUBBLE STYLES */
/* ================================ */
.thinking-container {
    padding: var(--spacing-lg) 0;
    margin: var(--spacing-lg) 0;
    scroll-margin-bottom: 100px;
    background: transparent;
    transition: opacity var(--transition-normal);
    position: relative;
    z-index: var(--z-overlay);
}

.thinking-container.hidden {
    display: none !important;
}

.thinking-bubble {
    display: flex;
    justify-content: flex-start;
    margin-bottom: var(--spacing-lg);
    animation: fadeIn var(--transition-normal);
    position: relative;
    z-index: 11;
}

.thinking-bubble-content {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: var(--spacing-2xl) var(--spacing-2xl) var(--spacing-2xl) var(--spacing-sm);
    box-shadow: var(--shadow-dark-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 400px;
    border: 1px solid var(--color-slate-500);
    position: relative;
    overflow: hidden;
    background: var(--gradient-slate) !important;
    color: #d1d5db !important;
}

.thinking-bubble-content .flex.items-center {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.thinking-dots {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: block;
    animation: thinkingPulse 1.4s infinite ease-in-out both;
    transform-origin: center;
    background: #9ca3af !important;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-animation: thinkingPulse 1.4s infinite ease-in-out both;
    -moz-animation: thinkingPulse 1.4s infinite ease-in-out both;
    -o-animation: thinkingPulse 1.4s infinite ease-in-out both;
    animation-fill-mode: both;
    animation-iteration-count: infinite;
    animation-play-state: running;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0s;
}

.thinking-text {
    font-size: var(--font-size-md);
    font-style: italic;
    min-width: 0;
    flex: 1;
    transition: color var(--transition-fast);
    color: #d1d5db !important;
}

.thinking-text.success {
    color: hsl(var(--success)) !important;
    font-weight: 500;
}

.thinking-text.error {
    color: hsl(var(--destructive)) !important;
    font-weight: 500;
}

.thinking-progress {
    margin-top: var(--spacing-sm);
    width: 100%;
}

.thinking-progress .w-full {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.thinking-progress .bg-gray-700 {
    background: var(--border-secondary) !important;
}

.thinking-progress .bg-blue-500 {
    background: hsl(var(--primary)) !important;
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.thinking-progress .text-xs {
    margin-top: var(--spacing-xs);
    text-align: center;
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.pending-task-indicator {
    animation: fadeIn 0.2s ease-in;
}

.pending-task-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    /* Token-based so it lifts on dark AND light/embedded surfaces. */
    background-image: linear-gradient(
        90deg,
        hsl(var(--foreground) / 0.06) 0%,
        hsl(var(--foreground) / 0.14) 40%,
        hsl(var(--foreground) / 0.22) 50%,
        hsl(var(--foreground) / 0.14) 60%,
        hsl(var(--foreground) / 0.06) 100%
    );
    background-size: 300% 100%;
    background-color: transparent;
    animation: shimmer 2s ease-in-out infinite;
}

.skeleton-line--long { width: 90%; }
.skeleton-line--medium { width: 70%; }
.skeleton-line--short { width: 45%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================ */
/* ANIMATIONS */
/* ================================ */
@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ================================ */
/* INTERACTIVE ELEMENTS */
/* ================================ */
button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.clickable-entity {
    font-weight: bold;
    color: hsl(var(--primary));
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    transition: all var(--transition-fast);
    position: relative;
}

.clickable-entity:hover {
    color: #93c5fd;
    text-decoration-style: solid;
    background-color: rgba(96, 165, 250, 0.2);
}

.clickable-entity:hover::after {
    opacity: 1;
}

/* ================================ */
/* UI ELEMENT OVERRIDES */
/* ================================ */
.bg-white {
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-secondary) !important;
    box-shadow: var(--shadow-dark-md) !important;
}

.bg-gray-50 {
    background-color: var(--bg-primary) !important;
}

.bg-gray-100 {
    background-color: var(--color-slate-700) !important;
}

.text-gray-800 {
    color: var(--text-primary) !important;
}

.text-gray-700 {
    color: var(--color-slate-300) !important;
}

.text-gray-500, .text-gray-600 {
    color: var(--text-muted) !important;
}

.border-gray-300 {
    border-color: var(--border-primary) !important;
}

.border-gray-200 {
    border-color: var(--color-slate-700) !important;
}

/* ================================ */
/* INPUT STYLING */
/* ================================ */
input[type="text"] {
    transition: all var(--transition-fast) !important;
    background-color: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    -webkit-text-size-adjust: 100%;
}

input[type="text"]:focus {
    border-color: hsl(var(--primary)) !important;
    background-color: var(--bg-secondary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

input[type="text"]::placeholder {
    color: var(--color-slate-500) !important;
}

input[type="text"]:disabled {
    background-color: var(--border-secondary) !important;
    color: #6b7280 !important;
    border-color: var(--color-slate-500) !important;
    cursor: not-allowed !important;
}

textarea, select {
    font-size: 16px !important; /* Prevents zoom on iOS */
    -webkit-text-size-adjust: 100%;
}

/* ================================ */
/* BUTTON STYLING */
/* ================================ */
.bg-blue-600 {
    background: hsl(var(--primary)) !important;
    color: white !important;
}

.hover\:bg-blue-700:hover {
    background: hsl(var(--primary) / 0.9) !important;
}

button:disabled {
    cursor: not-allowed !important;
    transform: none !important;
}

#stopButton {
    background: var(--gradient-red) !important;
    color: white !important;
    border: none !important;
}

#stopButton:hover {
    background: var(--gradient-red-hover) !important;
}

#stopButton:disabled {
    background-color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ================================ */
/* HEADER BUTTONS */
/* ================================ */
#darkModeToggle {
    background-color: var(--color-slate-700) !important;
    border: 1px solid var(--border-primary) !important;
}

#darkModeToggle:hover {
    background-color: var(--border-primary) !important;
}

#darkModeToggle svg {
    color: var(--color-yellow-400) !important;
}

#newChatBtn, button:contains("New Chat"), button[class*="new-chat"] {
    border: none !important;
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 500;
    transition: all var(--transition-fast);
    background-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

#newChatBtn:hover, button:contains("New Chat"):hover, button[class*="new-chat"]:hover {
    background-color: var(--color-slate-500) !important;
}

#currentTopic, #topicIndicator span, .topic-indicator {
    border: none !important;
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 500;
    color: var(--text-primary) !important;
}

#startOverButton, #startOverBtn {
    border: none !important;
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 500;
    transition: all var(--transition-fast);
    background-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

#startOverButton:hover, #startOverBtn:hover {
    background-color: var(--color-slate-500) !important;
}

/* ================================ */
/* STATUS INDICATORS */
/* ================================ */
.text-green-600 {
    color: hsl(var(--success)) !important;
    font-weight: 600 !important;
}

.text-red-600 {
    color: hsl(var(--destructive)) !important;
}

/* ================================ */
/* FOCUS STATES */
/* ================================ */
input:focus, textarea:focus, button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ================================ */
/* TOOLTIPS */
/* ================================ */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: var(--z-dropdown);
    pointer-events: none;
    text-align: center;
    max-width: 400px;
    white-space: normal;
    word-wrap: break-word;
}

/* ================================ */
/* LAYOUT IMPROVEMENTS */
/* ================================ */
.max-w-6xl {
    max-width: none !important;
    width: 100%;
    padding: 0 var(--spacing-3xl);
}

.message-results {
    max-width: none !important;
    width: 100%;
}

#messagesContainer {
    margin-bottom: 0.2rem !important;
    scroll-behavior: smooth;
}

/* ================================ */
/* DATA DICTIONARY STYLING */
/* ================================ */
.data-dictionary-container {
    max-width: none;
    width: 100%;
    margin: var(--spacing-lg) 0;
}

.data-dictionary-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    line-height: 1.6;
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    font-weight: 400;
}

.data-dictionary-content-flat {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    line-height: 1.6;
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    font-weight: 400;
}

.data-dict-title {
    font-size: var(--font-size-4xl);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    border-bottom: 2px solid hsl(var(--primary));
    padding-bottom: 0.375rem;
}

.data-dictionary-content-flat .data-dict-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: hsl(var(--primary));
    margin-bottom: var(--spacing-lg);
    margin-top: 0;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: var(--spacing-sm);
}

.data-dict-section {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: hsl(var(--primary));
    margin: var(--spacing-3xl) 0 var(--spacing-lg) 0;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: var(--spacing-xs);
}

.data-dict-subsection {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: #93c5fd;
    margin: var(--spacing-lg) 0 var(--spacing-sm) 0;
}

.data-dict-field {
    color: hsl(var(--primary));
    font-weight: 600;
    display: inline;
}

.data-dict-example {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    display: inline;
}

.data-dict-paragraph {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    margin-top: 0;
    line-height: 1.6;
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    font-weight: 400;
}

.data-dict-divider {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: var(--spacing-2xl) 0;
}

.data-dict-list {
    margin: var(--spacing-lg) 0;
    padding-left: 0;
}

.data-dict-list-item {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-2xl);
    position: relative;
    font-size: var(--font-size-md);
}

.data-dict-list-item::before {
    content: "•";
    color: hsl(var(--primary));
    font-weight: bold;
    position: absolute;
    left: var(--spacing-sm);
}

/* ================================ */
/* CONVERSATION MANAGEMENT */
/* ================================ */
.conversation-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
    min-height: 60px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.conversation-item:active {
    background: hsl(var(--primary));
    transform: scale(0.98);
}

.conversation-meta {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.conversation-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 16px;
}

.topic-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: var(--spacing-sm);
}

.conversation-date {
    flex-shrink: 0;
    font-size: var(--font-size-xs);
    opacity: 0.8;
}

.conversation-title {
    font-weight: 500;
    margin-bottom: 0.375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.conversation-menu {
    position: relative;
    flex-shrink: 0;
}

.menu-toggle-btn {
    opacity: 0;
    padding: var(--spacing-xs);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.conversation-item:hover .menu-toggle-btn {
    opacity: 1;
}

.menu-toggle-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--color-slate-500);
}

.conversation-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--border-secondary);
    border: 1px solid var(--color-slate-600);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: var(--z-dropdown);
    min-width: 120px;
    overflow: hidden;
}

.conversation-dropdown.hidden {
    display: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: none;
    color: #e5e7eb;
    cursor: pointer;
    font-size: var(--font-size-base);
    text-align: left;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-slate-500);
}

.dropdown-item.delete-btn {
    color: hsl(var(--destructive));
}

.dropdown-item.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ================================ */
/* SHARED CONVERSATION STYLES */
/* ================================ */
.shared-by-text {
    color: var(--text-muted) !important;
    font-size: var(--font-size-xs) !important;
    font-style: italic;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shared-conversation .conversation-title {
    display: flex;
    align-items: center;
}

.shared-by-text {
    color: hsl(var(--primary)) !important;
    font-size: var(--font-size-xs) !important;
    font-style: italic;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shared-notification-bar {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    margin: 0 var(--spacing-lg) var(--spacing-lg) var(--spacing-lg);
    padding: 8px 12px;
    font-size: 0.8rem;
    color: hsl(var(--primary));
}

.shared-notification-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

#sidebar.collapsed .shared-notification-bar {
    display: none;
}

/* ================================ */
/* NOTIFICATION BADGES */
/* ================================ */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--gradient-red);
    color: white;
    border-radius: 12px;
    padding: 3px 7px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1;
    min-width: 20px;
    text-align: center;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-dark-sm);
    z-index: 20;
    animation: notificationPulse 2s ease-in-out infinite;
}

.notification-badge.large-count {
    font-size: var(--font-size-xs);
    padding: 2px 5px;
    min-width: 24px;
}

.conversation-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: hsl(var(--primary));
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-secondary);
    z-index: 20;
}

.row-count-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: hsl(var(--primary));
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-secondary);
    box-shadow: var(--shadow-dark-sm);
    z-index: 20;
}

.row-count-badge.large-count {
    font-size: 0.6rem;
    padding: 1px 4px;
}

@keyframes notificationPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1;
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.9;
    }
}

/* ================================ */
/* APP HEADER (shared: chat + dashboard) */
/* ================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-2xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dark-sm);
    margin-bottom: var(--spacing-md);
}

.app-header__left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.app-header__logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: var(--text-primary);
}

.app-header__title {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.app-header__sep {
    color: var(--text-muted);
}

.app-header-pill {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 600;
}

/* Leaderboard variant — keep the pill as inline-block (matches plain text
   pills exactly); inline the trophy SVG and use vertical-align: middle plus
   a tiny upward nudge so it parks at the text's optical center. */
.app-header-pill.lb-header-pill .lb-header-trophy {
    display: inline-block;
    color: #fbbf24;
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-right: 0.35em;
    margin-top: -0.12em;
}

/* Pill is clickable on the leaderboard — resets all filters to defaults. */
.app-header-pill.lb-header-pill {
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.app-header-pill.lb-header-pill:hover {
    background: var(--bg-quaternary);
}

/* Leaderboard share group — generic share button on the left, then small
   icon-only direct-post buttons for LinkedIn/X/Facebook. Styled to feel
   secondary to the primary "Share" so the primary keeps the spotlight. */
.lb-share-group {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.lb-social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    padding: 0;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 0.12s, transform 0.08s, box-shadow 0.12s;
}
.lb-social-btn svg {
    width: 18px;
    height: 18px;
}
.lb-social-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.lb-social-btn:active {
    transform: translateY(0);
}
.lb-social-btn--linkedin {
    background: #0a66c2;
}
.lb-social-btn--twitter {
    background: #000;
}
.lb-social-btn--facebook {
    background: #1877f2;
}
/* Specificity (0,2,2) beats every theme's `.<theme> button:not(...){...!important}`
   blanket rule (0,2,1). Without this, themes overwrite the network color
   with their generic button background. */
body.leaderboard-view-active button.lb-social-btn {
    color: #fff !important;
    border: 1px solid transparent !important;
}
body.leaderboard-view-active button.lb-social-btn--linkedin {
    background: #0a66c2 !important;
}
body.leaderboard-view-active button.lb-social-btn--twitter {
    background: #000 !important;
}
body.leaderboard-view-active button.lb-social-btn--facebook {
    background: #1877f2 !important;
}

.app-header__right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.app-header-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.app-header-btn--secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.app-header-btn--secondary:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

.app-header-btn--primary {
    background: hsl(var(--primary));
    color: white;
}

.app-header-btn--primary:hover {
    background: hsl(var(--primary));
    color: white;
}

.app-header-btn--success {
    background: hsl(var(--success));
    color: white;
}

.app-header-btn--success:hover {
    background: #16a34a;
    color: white;
}

/* ================================ */
/* LOADING STATES */
/* ================================ */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-3xl) var(--spacing-lg);
    gap: var(--spacing-lg);
}

.loading-spinner {
    width: var(--spacing-3xl);
    height: var(--spacing-3xl);
    animation: spin 1s linear infinite;
    color: hsl(var(--primary));
}

.loading-message {
    font-size: var(--font-size-base);
    color: #d1d5db;
    text-align: center;
}

/* ================================ */
/* MODAL SYSTEM */
/* ================================ */
.conversation-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow: visible;
}

.auth-modal {
    overflow: visible !important;
}

.conversation-modal.entering .modal-backdrop {
    opacity: 1;
}

.conversation-modal.entering .modal-content {
    opacity: 1;
    transform: scale(1);
}

.conversation-modal.exiting .modal-backdrop {
    opacity: 0;
}

.conversation-modal.exiting .modal-content {
    opacity: 0;
    transform: scale(0.95);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity var(--transition-slow);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    max-width: 28rem;
    width: 100%;
    margin: 0 var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dark-xl);
    transform: scale(0.95);
    opacity: 0;
    transition: all var(--transition-slow);
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--spacing-2xl);
    border: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

.modal-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  color: var(--text-primary); /* Changed from hardcoded #f9fafb */
}

.modal-close {
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: calc(-1 * var(--spacing-sm)) calc(-1 * var(--spacing-sm)) calc(-1 * var(--spacing-sm)) var(--spacing-lg);
  flex-shrink: 0;
  color: var(--text-muted); /* Changed from hardcoded #9ca3af */
}

.modal-close:hover {
  color: var(--text-primary); /* Changed from hardcoded #d1d5db */
  background: var(--bg-tertiary); /* Changed from rgba(255, 255, 255, 0.1) */
}

.modal-body {
    margin-bottom: var(--spacing-3xl);
}

.modal-text {
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-lg);
  line-height: 1.5;
  color: var(--text-secondary); /* Changed from hardcoded #d1d5db */
}

.modal-text.primary {
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  font-size: 0.9375rem;
  color: var(--text-primary); /* Changed from hardcoded #f9fafb */
}

.modal-text.small {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-sm);
  margin-bottom: 0;
  color: var(--text-muted); /* Changed from hardcoded #9ca3af */
}

.modal-warning {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-base);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(239, 68, 68, 0.4);
    margin-bottom: var(--spacing-lg);
    background: rgba(239, 68, 68, 0.15);
}

.modal-warning-icon {
    flex-shrink: 0;
    width: var(--spacing-xl);
    height: var(--spacing-xl);
    color: hsl(var(--destructive));
    margin-top: 0.125rem;
}

.modal-warning-content {
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

.modal-input {
  width: 100%;
  padding: var(--input-padding);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  transition: all var(--transition-fast);
  border: 1px solid var(--border-primary); /* Changed from var(--color-slate-500) */
  margin-bottom: var(--spacing-sm);
  font-family: inherit;
  background: var(--bg-secondary); /* Changed from var(--color-slate-700) */
  color: var(--text-primary); /* Changed from hardcoded #f9fafb */
}

.modal-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.modal-input::placeholder {
  opacity: 0.65;
  color: var(--text-muted); /* Changed from hardcoded #9ca3af */
}

.modal-btn {
    padding: var(--button-padding);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    font-family: inherit;
}

.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.modal-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.modal-btn:not(:disabled):active {
    transform: translateY(0);
}

.modal-btn .btn-spinner {
    width: var(--spacing-lg);
    height: var(--spacing-lg);
    margin-right: var(--spacing-sm);
    animation: spin 1s linear infinite;
}

.btn-cancel {
  background: var(--bg-tertiary); /* Changed from var(--border-primary) */
  color: var(--text-secondary);
  border-color: var(--border-primary); /* Changed from var(--color-slate-500) */
}

.btn-cancel:hover:not(:disabled) {
  background: var(--bg-quaternary); /* Changed from var(--color-slate-500) */
  border-color: var(--border-secondary); /* Changed from var(--text-muted) */
}

.btn-danger {
    background: hsl(var(--destructive));
    color: white;
    border-color: hsl(var(--destructive));
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-red-600);
    border-color: var(--color-red-600);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.modal-btn.btn-primary {
    background: hsl(var(--primary)) !important;
    color: white !important;
    border-color: hsl(var(--primary)) !important;
}

.modal-btn.btn-primary:hover:not(:disabled) {
    background: hsl(var(--primary)) !important;
    border-color: hsl(var(--primary)) !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3) !important;
}

/* ================================ */
/* TOAST NOTIFICATIONS */
/* ================================ */
/* Used by:
     - client/core/http.js                — overlay-mode system error
                                            toasts (login redirect,
                                            rate-limit messages)
     - client/ui/feedback-modal.js        — feedback submission success
   The legacy ConversationHistoryUI inlined its own showToast against
   these classes; it's been retired. Dashboard / chat-action toasts use
   `client/ui/notifications.js` (Tailwind utility chips) instead.
   Eventually consolidating http.js + feedback-modal.js onto
   notifications.js would let this block go too — both consumers
   currently rely on the slide-in animation and the explicit
   `toast-error` / `toast-success` color tokens here. */
.toast-notification {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-toast);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-notification.entering {
    transform: translateX(0);
}

.toast-notification.exiting {
    transform: translateX(100%);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.toast-text {
    font-size: var(--font-size-base);
    font-weight: 500;
}

.toast-success {
    background: hsl(var(--success));
    color: white;
}

.toast-error {
    background: hsl(var(--destructive));
    color: white;
}

.toast-info {
    background: hsl(var(--primary));
    color: white;
}

.toast-warning {
    background: hsl(var(--warning));
    color: white;
}

/* ================================ */
/* ADMIN MESSAGES */
/* ================================ */
.admin-message {
    max-width: var(--message-max-width);
    width: 100%;
    margin: var(--spacing-md) 0;
    border-radius: var(--radius-2xl);
    border: 1px solid hsl(var(--primary));
    background: var(--gradient-slate-dark);
    color: var(--text-primary);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.admin-content {
    padding: 0;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-2xl);
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.admin-icon {
    width: var(--spacing-xl);
    height: var(--spacing-xl);
    color: hsl(var(--primary));
    flex-shrink: 0;
}

.admin-label {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: hsl(var(--primary));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-body {
    padding: var(--spacing-2xl);
    line-height: 1.6;
    font-family: var(--font-family);
}

.admin-paragraph {
    margin: 0;
    color: var(--text-secondary);
}

.admin-paragraph + .admin-paragraph {
    margin-top: var(--spacing-lg);
}

.admin-body strong {
    color: hsl(var(--primary));
    font-weight: 600;
}

.admin-bullet {
    margin: var(--spacing-xs) 0;
    padding-left: var(--spacing-sm);
    color: var(--text-secondary);
}

.admin-code {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: var(--font-size-base);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.admin-message:hover {
    border-color: hsl(var(--primary));
    box-shadow: 0 6px 12px -1px rgba(59, 130, 246, 0.3);
    transition: all var(--transition-fast);
}

/* ================================ */
/* AUTH LINKS */
/* ================================ */
.system-message .auth-login-link,
.message-bubble .auth-login-link,
a.auth-login-link {
    color: hsl(var(--primary)) !important;
    text-decoration: underline !important;
    font-weight: 500 !important;
    cursor: pointer !important;
}

.system-message .auth-login-link:hover,
.message-bubble .auth-login-link:hover,
a.auth-login-link:hover {
    color: #93c5fd !important;
    text-decoration: none !important;
}

/* ================================ */
/* MICROPHONE BUTTON */
/* ================================ */
#micButton {
    background: transparent;
    border: none;
    cursor: pointer;
}

#micButton[aria-pressed="true"] {
    color: red;
}

/* ================================ */
/* TOPIC SUGGESTION MESSAGES */
/* ================================ */
.topic-suggestion-message {
    max-width: var(--message-max-width);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    margin: var(--spacing-md) 0;
    background: var(--gradient-slate-light);
    color: var(--text-primary);
    border: 2px solid hsl(var(--primary));
    box-shadow: 0 4px 8px rgba(96, 165, 250, 0.25), 0 0 0 1px rgba(96, 165, 250, 0.1);
}

.topic-suggestion-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 700;
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--text-secondary);
}

.topic-suggestion-header svg {
    color: hsl(var(--primary));
    flex-shrink: 0;
}

.topic-suggestion-content {
    line-height: 1.5;
}

.topic-suggestion-message .suggestions-container {
    margin-top: var(--spacing-lg);
}

.topic-suggestion-message .suggestion-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

.topic-suggestion-message .suggestion-btn:hover {
    background: var(--bg-quaternary);
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

/* ================================ */
/* TOPIC TRANSITION */
/* ================================ */
.topic-redirect {
    max-width: var(--message-max-width);
    margin: var(--spacing-lg) 0;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary, #3b82f6);
    border-radius: var(--radius-lg);
}
.topic-redirect__body {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}
.topic-redirect__icon {
    color: var(--accent-primary, #3b82f6);
    flex-shrink: 0;
}
.topic-redirect__btn.suggestion-btn {
    display: inline-block;
    width: auto;
    margin-left: auto;
    flex-shrink: 0;
    padding: 0.375rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: center;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.topic-redirect__btn.suggestion-btn:hover {
    background: var(--accent-light, #60a5fa);
    transform: none;
    border-color: transparent;
}

.topic-transition-divider {
    max-width: var(--message-max-width);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin: var(--spacing-xl) 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
}

.topic-transition-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 600;
    font-size: var(--font-size-base);
    color: hsl(var(--primary));
    margin-bottom: var(--spacing-md);
}

.topic-transition-header svg {
    color: hsl(var(--primary));
    flex-shrink: 0;
}

.topic-transition-intro {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.topic-transition-summary {
    padding: var(--spacing-lg);
    background: var(--bg-quaternary);
    border-radius: var(--radius-lg);
    border-left: 3px solid hsl(var(--primary));
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.6;
}

/* ================================ */
/* USER PROFILE */
/* ================================ */
.user-profile {
    position: relative;
}

.user-avatar {
    position: relative;
    overflow: visible;
}

#sidebar.collapsed .row-count-badge {
    display: none;
}

#sidebar.collapsed .notification-badge {
    right: -5px;
    top: -5px;
}

/* ================================ */
/* LOGIN WELCOME SCREEN */
/* ================================ */
.login-features {
    margin: var(--spacing-3xl) 0;
}

.feature-grid {
    display: grid;
    gap: var(--spacing-2xl);
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-item {
    text-align: center;
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-slate-600);
    transition: all var(--transition-fast);
    background: var(--border-secondary);
    color: #f9fafb;
}

.feature-item:hover {
    background: var(--color-slate-500);
    border-color: #6b7280;
    transform: translateY(-2px);
}

.feature-icon {
    font-size: var(--spacing-3xl);
    margin-bottom: var(--spacing-lg);
    display: block;
}

.feature-item h3 {
    font-weight: 600;
    margin: 0 0 var(--spacing-sm) 0;
    font-size: var(--font-size-xl);
    color: var(--text-primary);
}

.feature-item p {
    font-size: var(--font-size-base);
    line-height: 1.4;
    margin: 0;
    color: #d1d5db;
}

.login-actions {
    text-align: center;
    margin-top: var(--spacing-3xl);
}

.login-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-3xl);
    background: hsl(var(--primary));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: var(--font-size-xl);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.login-button:hover {
    background: hsl(var(--primary) / 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-help {
    margin-top: var(--spacing-lg);
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

.login-help a {
    color: hsl(var(--primary));
    text-decoration: underline;
    font-weight: 500;
}

.login-help a:hover {
    color: #93c5fd;
    text-decoration: none;
}

/* ================================ */
/* FAQ STYLES */
/* ================================ */
.faq-content {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.faq-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-2xl);
    background: var(--color-blue-800);
    color: #dbeafe;
}

.faq-text {
    line-height: 1.6;
}

.faq-paragraph {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.faq-paragraph:last-child {
    margin-bottom: 0;
}

.faq-highlight {
    color: hsl(var(--primary));
    font-weight: 600;
}

.faq-bullet {
    color: var(--text-secondary);
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
    position: relative;
}

.faq-bullet::before {
    content: "";
    position: absolute;
    left: 0;
    top: var(--spacing-md);
    width: 4px;
    height: 4px;
    background: hsl(var(--primary));
    border-radius: 50%;
}

.faq-section-header {
    font-weight: 600;
    color: #93c5fd;
    margin: var(--spacing-2xl) 0 var(--spacing-md) 0;
    font-size: 1.1rem;
}

.faq-section-header:first-child {
    margin-top: 0;
}

.faq-link {
    color: hsl(var(--primary));
    text-decoration: underline;
    font-weight: 500;
}

.faq-link:hover {
    color: #93c5fd;
    text-decoration: none;
}

/* ================================ */
/* EXTERNAL NEWS STYLES */
/* ================================ */
.external-news-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.external-news-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-color);
}

.external-news-title {
    display: block;
    color: hsl(var(--primary));
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 2px;
    line-height: 1.5;
}

.external-news-title:hover {
    text-decoration: underline;
    color: #93c5fd;
}

.external-news-meta {
    display: flex;
    gap: var(--spacing-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.external-news-publisher {
    font-weight: 500;
}

.external-news-date {
    opacity: 0.8;
}

.external-news-summary {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Collapsible external sources in summary card */
.external-sources-toggle {
    margin-top: var(--spacing-md);
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    overflow: hidden;
}

.external-sources-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: hsl(var(--primary));
    font-size: var(--font-size-base);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    list-style: none;
    user-select: none;
    transition: background 0.2s ease;
}

.external-sources-header::-webkit-details-marker {
    display: none;
}

.external-sources-toggle[open] .external-sources-icon {
    transform: rotate(0deg);
}

.external-sources-header:hover {
    background: rgba(59, 130, 246, 0.12);
}

.external-sources-icon {
    font-size: 1.1em;
}

.external-sources-toggle .external-news-container {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
    border-top: 1px solid rgba(59, 130, 246, 0.15);
}

/* Loading state for external sources */
.external-sources-loading {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: hsl(var(--primary));
    font-size: var(--font-size-base);
}

.external-sources-loading-icon {
    display: flex;
    align-items: center;
}

.external-sources-loading-icon svg {
    color: hsl(var(--primary));
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ================================ */
/* SIDEBAR COMPATIBILITY */
/* ================================ */
body.sidebar-open .topic-header {
    margin-left: 280px;
}

body.sidebar-collapsed .topic-header {
    margin-left: 48px;
}

@media (max-width: 1024px) {
    body.sidebar-open .topic-header,
    body.sidebar-collapsed .topic-header {
        margin-left: 0;
    }
}

.sidebar-header {
    position: relative !important;
    overflow: visible !important;
}

/* ================================ */
/* RESPONSIVE BREAKPOINTS */
/* ================================ */
@media (max-width: 1023px) {
    #topicIndicator {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    #topicIndicator.show-topic {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .max-w-6xl {
        max-width: 100%;
        padding: var(--spacing-sm);
    }

    .analyst-response {
        padding: var(--spacing-lg);
        margin: var(--spacing-sm) 0;
    }

    .content-section {
        margin-bottom: var(--spacing-xl);
    }

    .section-header {
        font-size: 0.95rem;
        margin-bottom: var(--spacing-md);
    }

    .data-table {
        max-width: 100vw;
    }

    .data-table table {
        font-size: var(--font-size-sm);
        min-width: 600px;
    }

    .data-table th, .data-table td {
        padding: 8px 6px;
        font-size: var(--font-size-sm);
    }

    .topics-grid {
        grid-template-columns: 1fr;
    }

    .topic-button {
        padding: 0.875rem;
    }

    .welcome-header h1 {
        font-size: var(--font-size-4xl);
    }

    .welcome-screen {
        padding: var(--spacing-lg);
        min-height: 40vh;
    }

    .message-bubble {
        padding: var(--spacing-lg);
        max-width: 95%;
    }

    .chatmmi-artifact {
        padding: var(--spacing-lg);
        margin: var(--spacing-sm) 0;
    }

    .chatmmi-artifact .grid {
        grid-template-columns: 1fr;
    }

    .chatmmi-artifact .detail-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .suggestions-grid {
        gap: var(--spacing-xs);
    }

    .suggestion-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.8rem;
    }

    .data-dictionary-content {
        padding: var(--spacing-xl);
    }
    
    .data-dict-title {
        font-size: var(--font-size-3xl);
    }
    
    .data-dict-section {
        font-size: var(--font-size-lg);
    }

    .admin-header {
        padding: 0.875rem var(--spacing-lg);
    }
    
    .admin-body {
        padding: var(--spacing-lg);
        font-size: 0.875rem;
    }
    
    .admin-code {
        font-size: 0.8rem;
    }

    .thinking-bubble-content {
        max-width: 90vw;
        padding: 0.875rem var(--spacing-lg);
    }
    
    .thinking-text {
        font-size: 0.85rem;
    }
    
    .thinking-dots span {
        width: 6px;
        height: 6px;
    }

    .topic-content h3 {
        font-size: var(--font-size-md);
    }
    
    .topic-content p {
        font-size: var(--font-size-xs);
    }

    .feature-item {
        padding: var(--spacing-lg);
    }
    
    .feature-icon {
        font-size: var(--spacing-2xl);
    }
    
    .login-button {
        width: 100%;
        justify-content: center;
    }

    .faq-section-header {
        font-size: var(--font-size-lg);
    }

    .query-explanation {
        display: none !important;
    }
    
    .data-table td a.text-blue-600,
    table td a.text-blue-600 {
        color: hsl(var(--primary)) !important;
    }

    .modal-content {
        margin: var(--spacing-sm);
        max-width: calc(100vw - var(--spacing-lg));
        padding: var(--spacing-xl);
    }
    
    .modal-btn {
        min-width: 70px;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.8rem;
    }
    
    .modal-footer {
        gap: var(--spacing-sm);
    }
    
    .modal-title {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 650px) {
    #startOverBtn span {
        display: none !important;
    }
}

/* Consistent table action button styles for all screen sizes */
.crm-push-btn,
.table-action-btn,
.favorite-all-btn,
.lead-store-bulk-btn,
button[data-action="copy"],
button[data-action="export"] {
    height: 32px !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.75rem !important;
    line-height: 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Show abbreviated text on mobile */
@media (max-width: 640px) {
    .crm-btn-text-short {
        font-size: inherit;
        font-weight: 500;
    }

    /* Hide View Query button on mobile */
    button[data-action="view-sql"] {
        display: none !important;
    }
}

/* ================================ */
/* PRINT STYLES */
/* ================================ */
@media print {
    /*
     * Force light print-friendly colors regardless of active theme.
     * Themes apply variables via :root and body class selectors —
     * we override both with high-specificity selectors.
     */
    :root,
    html,
    html.dark,
    .dark:root,
    body,
    body.dark,
    body[class*="-theme"] {
        --bg-primary: #ffffff !important;
        --bg-secondary: #f8fafc !important;
        --bg-tertiary: #f1f5f9 !important;
        --bg-quaternary: #e2e8f0 !important;
        --text-primary: #1a1a1a !important;
        --text-secondary: #334155 !important;
        --text-tertiary: #475569 !important;
        --text-muted: #64748b !important;
        --border-primary: #cbd5e1 !important;
        --border-secondary: #e2e8f0 !important;
        /* --accent-primary / -light / -dark removed — consumers
           migrated to hsl(var(--primary)). */
        --color-slate-700: #f3f4f6 !important;
        --color-slate-800: #f8fafc !important;
        --color-slate-900: #ffffff !important;
        color-scheme: light !important;
        background: white !important;
        color: #1a1a1a !important;
    }

    /* Disable forced dark color-scheme */
    .dark *, .dark *::before, .dark *::after {
        color-scheme: light !important;
    }

    /* Hide all UI chrome */
    .app-header,
    #inputBar,
    #artifactSidebar,
    #emptyState,
    #messages-bottom,
    #thinking-container,
    .thinking-container,
    .suggestion-btn,
    .suggestions-container,
    .feedback-buttons,
    .regenerate-btn,
    .table-controls,
    .table-action-btn,
    .sql-copy-btn,
    .row-push-btn,
    .row-outreach-btn,
    .row-purchase-btn,
    .property-actions,
    .conversation-sidebar,
    .notification-badge,
    button,
    [data-action] {
        display: none !important;
    }

    /*
     * Tailwind CDN injects utility styles (e.g. .flex) AFTER this stylesheet,
     * so `display: none !important` loses to Tailwind's `display: flex !important`
     * at equal specificity. Use visibility + size collapse as a fallback.
     */
    button.flex,
    button.inline-flex,
    [data-action].flex,
    [data-action].inline-flex {
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        overflow: hidden !important;
        position: absolute !important;
    }

    /* Remove flex/scroll constraints so content flows onto pages */
    body > .max-w-6xl,
    body > .max-w-6xl > .flex {
        display: block !important;
        max-width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #messagesContainer {
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0.25in !important;
        margin: 0 !important;
        background: white !important;
    }

    /* Message bubbles */
    .analyst-response {
        border: 1px solid #e2e8f0 !important;
        border-left: 3px solid #2563eb !important;
        background: #f8fafc !important;
        color: #1a1a1a !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .message-bubble {
        border: 1px solid #e2e8f0 !important;
        background: white !important;
        color: #1a1a1a !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .user-message {
        background: #eff6ff !important;
        color: #1e3a5f !important;
    }

    .section-header {
        border-bottom: 1px solid #cbd5e1 !important;
        color: #334155 !important;
    }

    /* Content text */
    .content-section,
    .content-section *,
    .faq-style-response,
    .faq-style-response * {
        color: #1a1a1a !important;
    }

    a {
        color: #2563eb !important;
    }

    /* Tables */
    table {
        font-size: 8pt !important;
        page-break-inside: auto;
        border-collapse: collapse !important;
    }

    tr {
        page-break-inside: avoid;
    }

    th {
        background: #f1f5f9 !important;
        color: #334155 !important;
        border: 1px solid #cbd5e1 !important;
    }

    td {
        background: white !important;
        color: #1a1a1a !important;
        border: 1px solid #cbd5e1 !important;
    }

    tr:nth-child(even) td {
        background: #f8fafc !important;
    }

    /* Info banners */
    .sql-info-banner,
    .info-banner {
        background: #eff6ff !important;
        color: #1e40af !important;
        border-color: #bfdbfe !important;
    }

    /* ---- Page break control ---- */

    /* User messages: small, keep on one page */
    .message-bubble {
        break-inside: avoid;
    }

    /*
     * Analyst responses are large containers (table + summary + chart).
     * Allow breaks INSIDE them — control breaks at the sub-section level.
     */
    .analyst-response {
        break-inside: auto;
    }

    /* Section headers: never stranded at the bottom of a page */
    .section-header {
        break-after: avoid;
    }

    .section-box {
        background: white !important;
        border-color: #cbd5e1 !important;
    }

    /* Repeat table column headers on every printed page */
    thead {
        display: table-header-group;
    }

    /* Don't split a single row across pages */
    tr {
        break-inside: avoid;
    }

    /* Charts: constrain to page width and keep together */
    .chart-container {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        max-height: 5in !important;
        overflow: hidden !important;
        break-inside: avoid;
        background: white !important;
        border-color: #cbd5e1 !important;
    }

    .chart-container canvas {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
        background: white !important;
    }

    canvas {
        max-width: 100% !important;
        break-inside: avoid;
    }

    /* Print header/footer injected by pdf-export.js */
    #print-header {
        border-bottom: 2px solid #2563eb;
        padding-bottom: 12px;
        margin-bottom: 24px;
    }

    #print-footer {
        margin-top: 32px;
        padding-top: 12px;
        border-top: 1px solid #e5e7eb;
        font-size: 8pt;
        color: #9ca3af;
        text-align: center;
    }
}

/* Print header/footer: hidden on screen, visible only in print */
#print-header,
#print-footer {
    display: none;
}

@media print {
    #print-header,
    #print-footer {
        display: block !important;
    }
}


@media (max-width: 1023px) {
    /* Hide menu buttons */
    .menu-toggle-btn,
    .conversation-menu {
        display: none !important;
    }
}

/* Hide print button on small screens — not useful on mobile */
@media (max-width: 639px) {
    #exportPdfBtn {
        display: none !important;
    }
}

/* --- Sidebar: fix mobile scroll + bottom anchoring --- */
#sidebar {
  /* Use dynamic viewport height to avoid iOS 100vh bug */
  height: 100dvh;
  min-height: 0;                 /* allow flex children to shrink */
  display: flex;
  flex-direction: column;
  overflow: hidden;              /* fine: the scroller is inside */
}

.sidebar-content {
  flex: 1 1 auto;
  min-height: 0;                 /* critical for nested flex scroll */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversation-list {
  flex: 1 1 auto;
  min-height: 0;                 /* critical */
  overflow-y: auto;              /* let this be the only scroller */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;           /* ensure vertical scroll gestures */
}

.user-profile {
  flex: 0 0 auto;
  margin-top: auto;              /* anchors it to bottom within the column */
}

/* Mobile slide-in */
@media (max-width: 1023px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    transform: translateX(-100%);
    z-index: 1000;
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  /* keep parents shrinkable on mobile too */
  #sidebar, #sidebar .sidebar-content, #sidebar .conversation-list { min-height: 0; }
}

/* --- iOS Chrome: make the drawer match visible height --- */
@supports (height: 100svh) {
  #sidebar,
  #sidebar.mobile-open { height: 100svh !important; } /* beats your 100vh !important */
}
@supports (height: 100dvh) {
  #sidebar,
  #sidebar.mobile-open { height: 100dvh !important; }
}

/* Ensure the flex chain can shrink so the list scrolls */
#sidebar,
#sidebar .sidebar-content,
#sidebar .conversation-list { min-height: 0 !important; }

#sidebar .conversation-list {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Keep profile visible above the iOS bottom bar */
#sidebar .user-profile {
  margin-top: auto !important;                                  /* pins to bottom of column */
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 12px) !important; /* safe area */
  background: var(--bg-secondary);                              /* not overlapped visually */
  position: sticky;                                             /* extra insurance if it sits in a scroller */
  bottom: 0;
}

/* ChatMMI Table Renderer - Sortable Headers CSS (Dark Theme Compatible) */
/* Replace the previous CSS with this version */

.hidden-column { 
    display: none !important; 
}

.table-building { 
    opacity: 0.7; 
    pointer-events: none; 
}

/* Sortable Headers - Minimal changes to preserve your existing theme */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.15s ease;
    padding-right: 25px !important;
    /* Don't override background - use your existing styles */
}

.sortable-header:hover {
    /* Subtle hover effect that works with any background */
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Sort indicators - minimal and clean */
.sortable-header::after {
    content: '↕';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    font-size: 12px;
    color: currentColor; /* Use the text color of the header */
}

.sortable-header:hover::after {
    opacity: 0.9;
    transform: translateY(-50%) scale(1.1);
}

/* Active sort states - subtle indicators */
.sortable-header.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #4caf50; /* Green for ascending */
    font-weight: bold;
}

.sortable-header.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #ff9800; /* Orange for descending */
    font-weight: bold;
}

/* Loading state while sorting */
.table-sorting {
    opacity: 0.6;
    pointer-events: none;
}

/* Optional: Add subtle glow effect for dark themes */
.sortable-header:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.sortable-header.sort-asc,
.sortable-header.sort-desc {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Animation for click feedback */
@keyframes sortClick {
    0% { transform: translateY(-1px) scale(1); }
    50% { transform: translateY(0) scale(0.98); }
    100% { transform: translateY(-1px) scale(1); }
}

.sortable-header:active {
    animation: sortClick 0.15s ease;
}

#userpilot-resource-centre-beacon,
[id*="userpilot-resource-centre"],
.userpilot-resource-centre {
    display: none !important;
}

/* More specific selectors to override button styles */
button.tier-restricted,
.tier-restricted {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  position: relative;
  pointer-events: auto; /* Ensure clicks still work for upgrade modal */
}

button.tier-restricted:hover,
.tier-restricted:hover {
  opacity: 0.8 !important;
  transform: translateY(-1px);
}

button.tier-restricted::after,
.tier-restricted::after {
  content: "🔒";
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: 50%;
  padding: 2px 3px;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* PII masking styling */
.pii-masked {
  background: repeating-linear-gradient(
    45deg,
    #374151,
    #374151 2px,
    #4b5563 2px,
    #4b5563 4px
  );
  color: #9ca3af;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.upgrade-notice-sidebar {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-primary);
}

.upgrade-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.upgrade-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upgrade-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.upgrade-btn-sidebar {
    display: inline-block;
    background: hsl(var(--primary));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.upgrade-btn-sidebar:hover {
    background: hsl(var(--primary));
}

.upgrade-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    font-style: italic;
}

.privacy-notice {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--color-yellow-500);
    border-radius: var(--radius-md);
}

.privacy-notice-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--color-yellow-400);
}

.limit-icon, .privacy-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.upgrade-link {
    color: var(--color-yellow-400);
    text-decoration: underline;
    font-weight: 500;
}

.row-limit-notice {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--color-blue-500);
  border-radius: var(--radius-md);
}

.row-limit-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--color-blue-400);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color, #ef4444);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

#sidebar.collapsed .logout-btn {
  padding: 0.75rem;
}

body.menu-open #conversationList .conversation-item { pointer-events: none; }
body.menu-open .conversation-dropdown,
body.menu-open .conversation-menu,
body.menu-open .conversation-menu * { pointer-events: auto; }

.bonzo-theme .row-push-btn,
.row-push-btn {
  opacity: .5;
  transition: opacity 0.2s;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #E91E63 !important; /* Pink arrow */
}

.bonzo-theme .row-push-btn:hover,
.row-push-btn:hover {
  background: rgba(233, 30, 99, 0.1) !important; /* Subtle pink background on hover */
}

tr:hover .row-push-btn {
  opacity: 1;
}

.row-push-btn:active {
  transform: scale(0.95);
}

.row-push-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Success state */
.row-push-btn.text-green-400 {
  opacity: 1 !important;
  background: transparent !important;
  color: #22c55e !important; /* Green checkmark */
}

.icon-column {
    width: 1px;
    white-space: nowrap;
    text-align: center;
}

body.datacenter-theme .topic-button[data-topic-id*="bonzo"] .topic-icon {
  font-size: 0 !important;
  width: 34px !important;
  height: 34px !important;
  display: inline-block !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 58 58'%3E%3Cpath d='M28.958,57.916A28.958,28.958,0,1,1,57.916,28.958,28.9908,28.9908,0,0,1,28.958,57.916ZM28.958,4A24.958,24.958,0,1,0,53.916,28.958,24.9865,24.9865,0,0,0,28.958,4Z' fill='%23000000'/%3E%3Cpath d='M42.2256,32.5518a8.3715,8.3715,0,0,0-1.7812-2.4581,7.5289,7.5289,0,0,0-2.1934-1.4482q-1.1527-.4819-1.9336-.7461a12.3459,12.3459,0,0,0,1.6377-.79,7.7448,7.7448,0,0,0,1.77-1.3828,7.6376,7.6376,0,0,0,1.4209-2.129,7.3893,7.3893,0,0,0,.59-3.1162,8.09,8.09,0,0,0-.68-3.4892,7.1329,7.1329,0,0,0-1.7754-2.37,8.6035,8.6035,0,0,0-2.4854-1.4854,14.162,14.162,0,0,0-2.8916-.79,25.6156,25.6156,0,0,0-2.915-.3066c-.3115-.0147-.5938-.0234-.8828-.0332-5.9678.043-5.5586,6.8574-5.5586,6.8574h3.1553a13.6849,13.6849,0,0,1,1.5576.0879,4.04,4.04,0,0,1,1.4043.417,2.6643,2.6643,0,0,1,1.0322.9443,2.9669,2.9669,0,0,1,.3945,1.6231,3.2054,3.2054,0,0,1-.373,1.6679,2.5416,2.5416,0,0,1-.9873.9434,3.891,3.891,0,0,1-1.4483.418,16.7864,16.7864,0,0,1-1.7558.0869h-2.98v6.1006h3.3574a14.313,14.313,0,0,1,2.2051.1553,4.8253,4.8253,0,0,1,1.7031.5742,2.8911,2.8911,0,0,1,1.1143,1.1465,3.943,3.943,0,0,1,.3935,1.8759,3.8689,3.8689,0,0,1-.48,2.0547,3.1982,3.1982,0,0,1-1.2452,1.17,5.2645,5.2645,0,0,1-1.6806.5293,12.8831,12.8831,0,0,1-1.835.1309H24.5352l.0224,7.1953H28.417c.9033,0,1.8877-.0469,2.9522-.1055a24.1955,24.1955,0,0,0,3.1943-.4179,16.3929,16.3929,0,0,0,3.1289-.9219,8.9339,8.9339,0,0,0,2.69-1.69,7.7524,7.7524,0,0,0,1.8818-2.6757,9.679,9.679,0,0,0,.7-3.8848,8.382,8.382,0,0,0-.7793-3.71Z' fill='%23000000'/%3E%3Cpath d='M24.53,38.7832H14.9619v2.0449c-.0029.07-.01.1387-.01.209a4.8448,4.8448,0,0,0,.3867,1.93,4.73,4.73,0,0,0,1.0752,1.5644,5.2382,5.2382,0,0,0,1.5713,1.0508,4.7189,4.7189,0,0,0,1.915.3965c.127,0,.3516.002.4873.002a1.0624,1.0624,0,0,0,.1133-.002h4.0566l-.0224-7.1953Z' fill='%23ee3c96'/%3E%3Cpath d='M24.5352,31.1465V25.0459H24.53V18.8574h.0049S24.126,12.043,30.0938,12l.0215-.001c-.087-.0029-.1661-.0049-.251-.0068-.1348-.0039-.2676-.0078-.3975-.0108-.3535-.0088-.6953-.0146-1.0078-.0146l-8.7519.0068h.0244a4.495,4.495,0,0,0-1.7461.4092,5.6815,5.6815,0,0,0-1.5713,1.0723,4.817,4.817,0,0,0-1.4619,3.4531c0,.1436.0088.2832.02.4228h-.01V31.1465h9.5733Z' fill='%23ee3c96'/%3E%3C/svg%3E") center/contain no-repeat !important;
}

/* Dark mode - white B with pink accents */
body:not(.datacenter-theme) .topic-button[data-topic-id*="bonzo"] .topic-icon {
  font-size: 0 !important;
  width: 34px !important;
  height: 34px !important;
  display: inline-block !important;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 58 58'%3E%3Cpath d='M28.958,57.916A28.958,28.958,0,1,1,57.916,28.958,28.9908,28.9908,0,0,1,28.958,57.916ZM28.958,4A24.958,24.958,0,1,0,53.916,28.958,24.9865,24.9865,0,0,0,28.958,4Z' fill='%23ffffff'/%3E%3Cpath d='M42.2256,32.5518a8.3715,8.3715,0,0,0-1.7812-2.4581,7.5289,7.5289,0,0,0-2.1934-1.4482q-1.1527-.4819-1.9336-.7461a12.3459,12.3459,0,0,0,1.6377-.79,7.7448,7.7448,0,0,0,1.77-1.3828,7.6376,7.6376,0,0,0,1.4209-2.129,7.3893,7.3893,0,0,0,.59-3.1162,8.09,8.09,0,0,0-.68-3.4892,7.1329,7.1329,0,0,0-1.7754-2.37,8.6035,8.6035,0,0,0-2.4854-1.4854,14.162,14.162,0,0,0-2.8916-.79,25.6156,25.6156,0,0,0-2.915-.3066c-.3115-.0147-.5938-.0234-.8828-.0332-5.9678.043-5.5586,6.8574-5.5586,6.8574h3.1553a13.6849,13.6849,0,0,1,1.5576.0879,4.04,4.04,0,0,1,1.4043.417,2.6643,2.6643,0,0,1,1.0322.9443,2.9669,2.9669,0,0,1,.3945,1.6231,3.2054,3.2054,0,0,1-.373,1.6679,2.5416,2.5416,0,0,1-.9873.9434,3.891,3.891,0,0,1-1.4483.418,16.7864,16.7864,0,0,1-1.7558.0869h-2.98v6.1006h3.3574a14.313,14.313,0,0,1,2.2051.1553,4.8253,4.8253,0,0,1,1.7031.5742,2.8911,2.8911,0,0,1,1.1143,1.1465,3.943,3.943,0,0,1,.3935,1.8759,3.8689,3.8689,0,0,1-.48,2.0547,3.1982,3.1982,0,0,1-1.2452,1.17,5.2645,5.2645,0,0,1-1.6806.5293,12.8831,12.8831,0,0,1-1.835.1309H24.5352l.0224,7.1953H28.417c.9033,0,1.8877-.0469,2.9522-.1055a24.1955,24.1955,0,0,0,3.1943-.4179,16.3929,16.3929,0,0,0,3.1289-.9219,8.9339,8.9339,0,0,0,2.69-1.69,7.7524,7.7524,0,0,0,1.8818-2.6757,9.679,9.679,0,0,0,.7-3.8848,8.382,8.382,0,0,0-.7793-3.71Z' fill='%23ffffff'/%3E%3Cpath d='M24.53,38.7832H14.9619v2.0449c-.0029.07-.01.1387-.01.209a4.8448,4.8448,0,0,0,.3867,1.93,4.73,4.73,0,0,0,1.0752,1.5644,5.2382,5.2382,0,0,0,1.5713,1.0508,4.7189,4.7189,0,0,0,1.915.3965c.127,0,.3516.002.4873.002a1.0624,1.0624,0,0,0,.1133-.002h4.0566l-.0224-7.1953Z' fill='%23ee3c96'/%3E%3Cpath d='M24.5352,31.1465V25.0459H24.53V18.8574h.0049S24.126,12.043,30.0938,12l.0215-.001c-.087-.0029-.1661-.0049-.251-.0068-.1348-.0039-.2676-.0078-.3975-.0108-.3535-.0088-.6953-.0146-1.0078-.0146l-8.7519.0068h.0244a4.495,4.495,0,0,0-1.7461.4092,5.6815,5.6815,0,0,0-1.5713,1.0723,4.817,4.817,0,0,0-1.4619,3.4531c0,.1436.0088.2832.02.4228h-.01V31.1465h9.5733Z' fill='%23ee3c96'/%3E%3C/svg%3E") center/contain no-repeat !important;
}

/* IMPERSONATION BANNER */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
}
.impersonation-banner__clear {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
}
.impersonation-banner__clear:hover {
    background: rgba(255,255,255,0.35);
}

/* IMPERSONATION PICKER — base styles
   Duplicated from dashboard.css so the chat page (which doesn't load
   dashboard.css) has the foundational rules the sidebar overrides rely on. */
.impersonate-picker {
    padding: 0.375rem 0.75rem 0.5rem;
}
.impersonate-picker__search {
    width: 100%;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-primary, #475569);
    border-radius: 0.25rem;
    background: var(--bg-primary, #0f172a);
    color: var(--text-primary, #e2e8f0);
    outline: none;
}
.impersonate-picker__search:focus {
    border-color: var(--accent-primary, #3b82f6);
}
.impersonate-picker__results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.25rem;
}
.impersonate-picker__item {
    display: flex;
    flex-direction: column;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    line-height: 1.3;
}
.impersonate-picker__item:hover {
    background: var(--bg-tertiary, #334155);
}
.impersonate-picker__item-name {
    color: var(--text-primary, #e2e8f0);
    font-weight: 500;
}
.impersonate-picker__role-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    vertical-align: middle;
    margin-left: 0.25rem;
}
.impersonate-picker__item-org {
    color: var(--text-tertiary, #94a3b8);
    font-size: 0.75rem;
}
.impersonate-picker__active {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    margin-top: 0.25rem;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
}
.impersonate-picker__active-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.impersonate-picker__clear {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.8;
}
.impersonate-picker__clear:hover {
    opacity: 1;
}
.impersonate-picker__all-orgs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #cbd5e1);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background 0.1s;
    user-select: none;
}
.impersonate-picker__all-orgs:hover {
    background: var(--bg-tertiary, #334155);
    color: var(--text-primary, #e2e8f0);
}
.impersonate-picker__all-orgs-checkbox {
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent-primary, #3b82f6);
}

/* IMPERSONATION PICKER — chat sidebar overrides
   Scoped under .impersonation-picker-slot for sidebar context
   (absolute dropdown, tighter sizing, different bg). */
.impersonation-picker-slot {
    padding: 0.375rem 0;
    position: relative;
}
.impersonation-picker-slot .impersonate-picker {
    position: relative;
}
.impersonation-picker-slot .impersonate-picker__label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #64748b);
    margin-bottom: 0.25rem;
}
.impersonation-picker-slot .impersonate-picker__search {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-tertiary, #1e293b);
    box-sizing: border-box;
}
.impersonation-picker-slot .impersonate-picker__results {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-primary, #475569);
    border-radius: 0.375rem;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
    z-index: 100;
    margin-bottom: 0.25rem;
}
.impersonation-picker-slot .impersonate-picker__results:empty {
    display: none;
}
.impersonation-picker-slot .impersonate-picker__item {
    border-radius: 0;
    font-size: 0.75rem;
}
.impersonation-picker-slot .impersonate-picker__item:hover {
    background: var(--bg-quaternary, #334155);
}
.impersonation-picker-slot .impersonate-picker__item-org {
    font-size: 0.675rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.impersonation-picker-slot .impersonate-picker__active {
    gap: 0.375rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}
.impersonation-picker-slot .impersonate-picker__clear {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
    padding: 0 0.125rem;
    flex-shrink: 0;
}
.impersonation-picker-slot .impersonate-picker__clear:hover {
    color: #fff;
}
.impersonation-picker-slot .impersonate-picker__all-orgs {
    margin-top: 0.375rem;
    padding: 0.25rem 0.375rem;
    font-size: 0.7rem;
}
#sidebar.collapsed .impersonation-picker-slot {
    display: none;
}

/* SQL VIEWER MODAL */
.sql-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.sql-modal {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border-primary, #475569);
  border-radius: 8px;
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.sql-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-primary, #475569);
}

.sql-modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #f1f5f9);
}

.sql-modal-close {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sql-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #f1f5f9);
}

.sql-modal-body {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
}

.sql-modal-body pre {
  margin: 0;
  padding: 1rem;
  background: var(--bg-primary, #0f172a);
  border: 1px solid var(--border-secondary, #334155);
  border-radius: 6px;
  overflow-x: auto;
}

.sql-modal-body code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary, #e2e8f0);
  white-space: pre;
}

.sql-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-primary, #475569);
  display: flex;
  justify-content: flex-end;
}

.sql-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-blue-600, #2563eb);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sql-copy-btn:hover {
  background: var(--color-blue-700, #1d4ed8);
}

.sql-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Hide button text on phone-sized screens (up to tablet) */
@media (max-width: 768px) {
  #unwrappedBtn span,
  #upgradeBtn span,
  #startOverBtn span,
  #saveConversationBtn span,
  #shareConversationBtn span {
    display: none !important;
  }
  
  /* Reduce button padding when text is hidden */
  #unwrappedBtn,
  #upgradeBtn,
  #startOverBtn,
  #saveConversationBtn,
  #shareConversationBtn {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* Phone-sized screens - full edge-to-edge layout */
@media (max-width: 768px) {
  .sql-modal {
    max-height: 90vh;
  }
  
  .sql-modal-body pre {
    font-size: 0.75rem;
  }
  
  /* Remove outer padding on mobile to maximize content area */
  body > div:first-child {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  
  /* Remove rounded corners and spacing on mobile for edge-to-edge layout */
  body > div:first-child > div:first-child {
    /* Header */
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }
  
  #messagesContainer {
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0.5rem !important; /* Reduce padding but keep some space for disclaimer */
  }
  
  #inputBar {
    border-radius: 0 !important;
  }
  
  /* Remove gap between flex items on mobile */
  body > div:first-child > .flex {
    gap: 0 !important;
    margin-bottom: 0 !important;
  }
  
  /* Hide welcome header on mobile to save space */
  .welcome-header {
    display: none !important;
  }
}

/* ================================ */
/* DIGEST VIEWER NOTICE */
/* ================================ */

.digest-viewer-notice {
  background: var(--color-blue-900);
  color: var(--color-blue-200);
  border: 1px solid var(--color-blue-700);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

/* ================================ */
/* PUBLIC CONVERSATION / DIGEST HEADER */
/* ================================ */

.digest-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-lg);
  align-items: center;
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-dark-sm);
}

.digest-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--color-blue-500) 0%, var(--color-blue-700) 100%);
}

.digest-header-icon {
  font-size: 2rem;
  line-height: 1;
  filter: brightness(1.1);
}

.digest-header-content h2 {
  font-weight: 600;
  margin: 0 0 var(--spacing-xs) 0;
  font-size: var(--font-size-xl);
  color: var(--text-primary);
}

.digest-header-content p {
  font-size: var(--font-size-sm);
  margin: 0;
  color: var(--text-muted);
}

/* ================================ */
/* BLUR PAYWALL STYLES */
/* ================================ */

/* Blur Paywall Overlay - Medium-style gradient overlay */
.blur-paywall-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0) 0%,
    var(--bg-primary) 40%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
}

.paywall-content {
  text-align: center;
  max-width: 420px;
  padding: var(--spacing-3xl);
  background: var(--bg-secondary);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-dark-xl);
}

.paywall-content h2 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.paywall-content > p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2xl);
  line-height: 1.5;
  font-size: var(--font-size-base);
}

.paywall-ctas {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Paywall auth tiles - reuse welcome screen auth tile styling */
.paywall-auth-tiles {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.paywall-auth-tiles .auth-tile {
  text-align: left;
}

/* Paywall buttons - reuse login-button pattern */
.paywall-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg) var(--spacing-3xl);
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--font-size-base);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.paywall-btn:hover {
  transform: translateY(-2px);
}

.paywall-btn.btn-primary {
  background: hsl(var(--primary));
  color: white;
}

.paywall-btn.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.paywall-btn.btn-secondary {
  background: var(--color-green-500);
  color: white;
}

.paywall-btn.btn-secondary:hover {
  background: #16a34a;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.paywall-btn.btn-outline {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

.paywall-btn.btn-outline:hover {
  background: var(--bg-quaternary);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.paywall-trial-note {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--spacing-lg);
}

/* Mobile adjustments for paywall */
@media (max-width: 768px) {
  .blur-paywall-overlay {
    height: 60vh;
    padding: var(--spacing-lg);
  }
  
  .paywall-content {
    padding: var(--spacing-2xl);
  }
  
  .paywall-content h2 {
    font-size: var(--font-size-xl);
  }
  
  .paywall-btn {
    padding: var(--spacing-md) var(--spacing-2xl);
    font-size: var(--font-size-sm);
  }
}

/* ============================================================================
   OPPORTUNITY CARDS — AI-scored refi candidates (mortgage-opportunities topic)
   ============================================================================ */
.opp-cards-container { margin: 1rem 0; }
.opp-cards-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-secondary);
}
.opp-cards-title { font-weight: 600; font-size: var(--font-size-lg); color: var(--text-primary); }

/* Standalone /rates message escapes the chat-bubble max-width so the chart
   and today chips have room to breathe. Set on the container wrapper only
   when message.standalone is true. */
.opp-rate-standalone {
  width: 100%;
  max-width: 1600px !important;
}

/* AI-written framing above the widget — plain text, no container. Only
   shown in the /rates standalone view, not in the inline rate-context task. */
.opp-rate-summary-band {
  margin-bottom: .75rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Market rate widget: chart on the left, today's values on the right.
   align-items: stretch (default) makes both columns match the tallest
   sibling's height so the chart doesn't look scrunched next to 6 chips. */
.opp-rate-widget {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
  padding: .75rem;
  margin-bottom: .875rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
}
@media (max-width: 900px) { .opp-rate-widget { grid-template-columns: 1fr; } }

.opp-rate-widget-caption {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .375rem;
  font-weight: 600;
}
/* Chart.js responsive mode writes inline sizing on the canvas. If the parent
   has no fixed height, Chart.js's own resize nudges the container and loops
   forever. We give it a min-height floor and let the grid equalize row
   heights so the chart stretches to match the today-chips column.
   position:relative + absolute canvas gives Chart.js a stable box to size to. */
.opp-rate-widget-chart {
  position: relative;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}
.opp-rate-widget-chart canvas {
  position: absolute;
  inset: 1.25rem 0 0 0; /* leave room for the caption above */
  width: 100% !important;
  height: calc(100% - 1.25rem) !important;
}

.opp-rate-widget-today { display: flex; flex-direction: column; }
.opp-rate-today-chips { display: flex; flex-direction: column; gap: .25rem; }

.opp-rate-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .25rem .5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  font-size: .75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.opp-rate-chip-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.opp-rate-chip-label { color: var(--text-muted); flex: 1; }
.opp-rate-chip-value { color: var(--text-primary); font-weight: 600; }
.opp-rate-trend { font-size: .65rem; opacity: .85; }
.opp-rate-trend--down { color: hsl(var(--success)); }
.opp-rate-trend--up   { color: hsl(var(--destructive)); }

/* Standalone /rates view — stat tiles + news strip. Inline .opp-rate-widget unaffected. */

/* Prominent header block — icon tile + title + subtitle. */
.opp-rate-standalone-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-secondary);
}
.opp-rate-standalone-header-icon {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, .15), rgba(168, 85, 247, .15));
  border: 1px solid var(--border-secondary);
  border-radius: 14px;
  font-size: 2.25rem;
  line-height: 1;
}
.opp-rate-standalone-header-text { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.opp-rate-standalone-header-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.opp-rate-standalone-header-sub {
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .opp-rate-standalone-header-icon { width: 56px; height: 56px; font-size: 1.75rem; }
  .opp-rate-standalone-header-title { font-size: 1.3rem; }
}

.opp-rate-stat-grid {
  display: grid;
  gap: .5rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: .75rem;
}
@media (max-width: 1280px) { .opp-rate-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px)  { .opp-rate-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .opp-rate-stat-grid { grid-template-columns: 1fr; } }

.opp-rate-stat-tile {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .6rem .7rem .4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  min-width: 0;
}
.opp-rate-stat-header { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.opp-rate-stat-swatch { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.opp-rate-stat-label {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opp-rate-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.opp-rate-stat-delta {
  font-size: .7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}
.opp-rate-stat-delta-period { font-weight: 500; opacity: .7; margin-left: .15rem; }
.opp-rate-stat-spark {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: .15rem;
  opacity: .9;
}

/* Chart panel in standalone mode — full width, taller than the inline widget. */
.opp-rate-chart-panel {
  position: relative;
  min-height: 260px;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
}
.opp-rate-chart-panel canvas {
  position: absolute;
  inset: 2.2rem 1rem 1rem 1rem; /* leave room for the caption above */
  max-width: none !important;
}

/* News strip — lender-card-style 3-column layout. */
.opp-rate-news { margin-top: .5rem; }
.opp-rate-news-header {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .5rem;
  padding-bottom: .375rem;
  border-bottom: 1px solid var(--border-secondary);
}
.opp-rate-news-grid {
  display: grid;
  gap: .5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) { .opp-rate-news-grid { grid-template-columns: 1fr; } }

.opp-rate-news-card {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .65rem .75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.opp-rate-news-card:hover {
  background: var(--bg-quaternary);
  border-color: hsl(var(--primary));
  transform: translateY(-1px);
}
.opp-rate-news-meta {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.opp-rate-news-title {
  font-size: .825rem;
  font-weight: 600;
  line-height: 1.3;
  color: hsl(var(--primary));
}
.opp-rate-news-arrow {
  display: inline-block;
  font-size: .7rem;
  opacity: .7;
  margin-left: .15rem;
  vertical-align: super;
}
.opp-rate-news-summary {
  font-size: .75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.opp-intro-band {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .625rem;
  padding: .75rem 1rem;
  margin-bottom: .75rem;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
}
.opp-intro-content {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: 100%;
}
.opp-intro-paragraph {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.5;
  font-size: .85rem;
}
.opp-intro-show-rates {
  align-self: flex-start;
  padding: .3rem .6rem;
  border-radius: 6px;
  border: 1px solid var(--border-secondary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease;
}
.opp-intro-show-rates:hover {
  background: var(--bg-hover, var(--bg-primary));
  border-color: var(--accent-primary, var(--border-primary));
}
.opp-intro-show-rates-arrow { margin-left: .25rem; opacity: .75; }

/* Filter pills row — lane toggles only, no aggregate stat pills */
.opp-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-bottom: .75rem;
}

/* Clickable lane filter pills — active = cards of this lane visible.
   Colours mirror the on-card .opp-card-lane-badge so the pill → badge
   relationship is visually obvious. */
.opp-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-secondary);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  opacity: .55;
}
.opp-filter-pill:hover { opacity: .85; }
.opp-filter-pill--active { opacity: 1; }

.opp-filter-pill--active.opp-filter-pill--rate-term {
  background: rgba(34, 197, 94, .15);
  color: hsl(var(--success));
  border-color: rgba(34, 197, 94, .35);
}
.opp-filter-pill--active.opp-filter-pill--cash-out {
  background: rgba(168, 85, 247, .15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, .35);
}
.opp-filter-pill--active.opp-filter-pill--pmi-removal {
  background: rgba(59, 130, 246, .15);
  color: hsl(var(--primary));
  border-color: rgba(59, 130, 246, .35);
}
.opp-filter-pill--active.opp-filter-pill--both {
  background: rgba(245, 158, 11, .15);
  color: hsl(var(--warning));
  border-color: rgba(245, 158, 11, .35);
}

/* Card grid — 4 wide at max, stepping down as width shrinks */
.opp-cards-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1280px) { .opp-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .opp-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .opp-cards-grid { grid-template-columns: 1fr; } }

/* "Generate 10 more" tile — occupies one grid cell at the end of the list.
   Centered icon+label+subtitle block so the tile doesn't feel like a
   gaping empty card when it's the only thing on its grid row. */
.opp-generate-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 100%;
  padding: 1rem .75rem;
  background: transparent;
  border: 1.5px dashed var(--border-secondary);
  border-radius: 12px;
  color: var(--text-secondary);
  font: inherit;
  font-size: .825rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.opp-generate-more:hover {
  background: var(--bg-tertiary);
  border-color: hsl(var(--primary));
  color: var(--text-primary);
}
.opp-generate-more:active { transform: translateY(1px); }
.opp-generate-more-icon { font-size: 1.5rem; line-height: 1; opacity: .8; }
.opp-generate-more-label { font-size: .825rem; font-weight: 600; }
.opp-generate-more-sub {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.opp-generate-more--loading {
  cursor: progress;
  opacity: .7;
  animation: opp-generate-pulse 1.2s ease-in-out infinite;
}
.opp-generate-more--exhausted {
  cursor: default;
  opacity: .6;
  border-style: dotted;
  pointer-events: none;
}
@keyframes opp-generate-pulse {
  0%, 100% { opacity: .5; }
  50%      { opacity: .85; }
}

.opp-card {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 12px;
  padding: .625rem .875rem .625rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.opp-card:hover {
  background: var(--bg-quaternary);
  border-color: hsl(var(--primary));
  box-shadow: var(--shadow-sm);
}

.opp-card-score {
  position: absolute;
  top: .625rem;
  right: .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: transparent;
  padding: 0;
}
/* Four-tier gradient so the score color communicates intensity, not a
   binary threshold. Elite (95+) reads darkest, fair (<80) reads mutest. */
.opp-card-score--elite  { color: #15803d; } /* deep emerald */
.opp-card-score--strong { color: hsl(var(--success)); }
.opp-card-score--solid  { color: hsl(var(--warning)); }
.opp-card-score--fair   { color: var(--text-secondary); }

/* Lane badge sits inline at the top of the card (before the name) so the
   card flow handles spacing. Score badge stays absolute top-right. */
.opp-card-lane-badge {
  flex: 0 0 auto;
  padding: .08rem .45rem;
  border-radius: 999px;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.opp-card-lane-badge--rate-term {
  background: rgba(34, 197, 94, .15);
  color: hsl(var(--success));
  border-color: rgba(34, 197, 94, .3);
}
.opp-card-lane-badge--cash-out {
  background: rgba(168, 85, 247, .15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, .3);
}
.opp-card-lane-badge--pmi-removal {
  background: rgba(59, 130, 246, .15);
  color: hsl(var(--primary));
  border-color: rgba(59, 130, 246, .3);
}
.opp-card-lane-badge--both {
  background: rgba(245, 158, 11, .15);
  color: hsl(var(--warning));
  border-color: rgba(245, 158, 11, .3);
}

/* Heading row: lane badge on the left, lender · product meta next to it. */
.opp-card-heading {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-right: 48px; /* clear the top-right score badge */
  flex-wrap: wrap;
}
.opp-card-meta {
  font-size: .7rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.opp-card-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  padding-right: 48px;
  letter-spacing: .01em;
}
.opp-card-address {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Stat grid — fixed 3-column layout so SAVINGS / RATE / LTV line up across
   cards. Values use tabular-nums so digits share the same column width. */
.opp-card-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  padding: .5rem .625rem;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
}
.opp-card-stat { min-width: 0; }
.opp-card-stat-label {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.opp-card-stat-value {
  margin-top: .125rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opp-card-stat-arrow {
  margin: 0 .125rem;
  color: var(--text-muted);
  font-weight: 400;
}

.opp-card-reason {
  font-size: .8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* "Why score N" disclosure — toggles the factor list. */
.opp-card-why-toggle {
  align-self: flex-start;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-primary, var(--text-primary));
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
}
.opp-card-why-toggle[aria-expanded="true"] .opp-card-why-chevron {
  transform: rotate(180deg);
  display: inline-block;
}
.opp-card-why-chevron { display: inline-block; transition: transform 150ms ease; }
.opp-card-why-panel {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .5rem .625rem;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
}
.opp-card-factor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .75rem;
}
.opp-card-factor-label {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.opp-card-factor-weight {
  flex: 0 0 auto;
  padding: .1rem .4rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid var(--border-secondary);
}
.opp-card-factor-weight--high {
  background: rgba(34, 197, 94, .15);
  color: var(--success-color, #22c55e);
  border-color: rgba(34, 197, 94, .3);
}
.opp-card-factor-weight--medium {
  background: rgba(59, 130, 246, .15);
  color: var(--accent-primary, #3b82f6);
  border-color: rgba(59, 130, 246, .3);
}
.opp-card-factor-weight--low {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Labeled action buttons — replace the icon-only "📝 🛒" pair so the
   actions self-describe. Equal-width buttons in a single row. */
.opp-card-actions {
  display: flex;
  gap: .5rem;
  margin-top: auto;
  padding-top: .25rem;
}
.opp-card-btn {
  flex: 1 1 0;
  padding: .45rem .5rem;
  border-radius: 6px;
  border: 1px solid var(--border-secondary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.opp-card-btn:hover {
  background: var(--bg-hover, var(--bg-primary));
  border-color: var(--accent-primary, var(--border-primary));
}
.opp-card-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Score badge gains a small "score" label beneath the number so the number
   has context when the card's visual weight shifts to the stat grid. */
.opp-card-score-label {
  font-size: .55rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .7;
  margin-top: -2px;
}