/* Insights - Performance Analysis Dashboard
   Clean, professional design with dark/light mode support */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== Light Mode (default) ===== */
:root {
    /* Brand color */
    --brand: #2563EB;
    --brand-light: #3B82F6;
    --brand-dark: #1D4ED8;
    --brand-subtle: rgba(37, 99, 235, 0.08);

    /* Semantic colors */
    --success: #059669;
    --success-light: #10B981;
    --success-subtle: rgba(5, 150, 105, 0.1);

    --warning: #D97706;
    --warning-light: #F59E0B;
    --warning-subtle: rgba(217, 119, 6, 0.1);

    --danger: #DC2626;
    --danger-light: #EF4444;
    --danger-subtle: rgba(220, 38, 38, 0.1);

    /* Surfaces */
    --surface: #FFFFFF;
    --surface-secondary: #F9FAFB;
    --surface-tertiary: #F3F4F6;
    --surface-invert: #1F2937;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;

    /* Borders */
    --border: #E5E7EB;
    --border-light: #F3F4F6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 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);

    /* Chart colors (exposed for JS) */
    --chart-grid: #F3F4F6;
    --chart-axis: #E5E7EB;
    --chart-text: #6B7280;
    --chart-title: #111827;
    --tooltip-bg: #FFFFFF;
    --tooltip-border: #E5E7EB;
    --tooltip-text: #111827;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;

    /* Color scheme hint for native form controls */
    color-scheme: light dark;
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
    :root {
        /* Brand - slightly brighter for dark mode */
        --brand: #3B82F6;
        --brand-light: #60A5FA;
        --brand-dark: #2563EB;
        --brand-subtle: rgba(59, 130, 246, 0.15);

        /* Semantic colors - adjusted for dark backgrounds */
        --success: #10B981;
        --success-light: #34D399;
        --success-subtle: rgba(16, 185, 129, 0.15);

        --warning: #F59E0B;
        --warning-light: #FBBF24;
        --warning-subtle: rgba(245, 158, 11, 0.15);

        --danger: #EF4444;
        --danger-light: #F87171;
        --danger-subtle: rgba(239, 68, 68, 0.15);

        /* Surfaces */
        --surface: #111827;
        --surface-secondary: #1F2937;
        --surface-tertiary: #374151;
        --surface-invert: #F9FAFB;

        /* Text */
        --text-primary: #F9FAFB;
        --text-secondary: #D1D5DB;
        --text-tertiary: #6B7280;
        --text-inverse: #111827;

        /* Borders */
        --border: #374151;
        --border-light: #1F2937;

        /* Shadows - more subtle in dark mode */
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);

        /* Chart colors */
        --chart-grid: #374151;
        --chart-axis: #4B5563;
        --chart-text: #9CA3AF;
        --chart-title: #F9FAFB;
        --tooltip-bg: #1F2937;
        --tooltip-border: #374151;
        --tooltip-text: #F9FAFB;
    }
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--surface-secondary);
    -webkit-font-smoothing: antialiased;
}

/* Focus states */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* App Layout */
.lcars-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.lcars-header {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 var(--space-6);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: var(--space-4);
}

.lcars-header-end {
    display: none;
}

.lcars-header-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.lcars-title-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.lcars-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    padding-left: var(--space-3);
    border-left: 1px solid var(--border);
}

.lcars-header-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
    background: transparent;
    padding: 0;
    border: none;
}


/* Buttons */
.lcars-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--space-4);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.lcars-button:hover {
    transform: translateY(-1px);
}

.lcars-button:active {
    transform: translateY(0);
}

.lcars-button-blue,
.lcars-button-orange {
    background: var(--brand);
    color: white;
}

.lcars-button-blue:hover,
.lcars-button-orange:hover {
    background: var(--brand-dark);
}

.lcars-button-secondary,
.lcars-button-purple,
.lcars-button-tan {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.lcars-button-secondary:hover,
.lcars-button-purple:hover,
.lcars-button-tan:hover {
    background: var(--surface-tertiary);
    border-color: var(--text-tertiary);
}

/* Main Layout */
.lcars-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.lcars-sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    overflow: hidden;
    transition: width 0.2s ease;
    position: relative;
}

.lcars-sidebar.collapsed {
    width: 32px;
}

.lcars-sidebar-toggle {
    width: 32px;
    min-width: 32px;
    background: var(--surface-elevated);
    border: none;
    border-left: 1px solid var(--border-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 12px;
    transition: background 0.15s ease, color 0.15s ease;
    order: 1;
}

.lcars-sidebar-toggle:hover {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.lcars-sidebar-toggle .toggle-icon {
    transition: transform 0.2s ease;
}

.lcars-sidebar.collapsed .lcars-sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}

.lcars-sidebar-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.lcars-sidebar.collapsed .lcars-sidebar-content-wrapper {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.lcars-sidebar-cap {
    display: none;
}

.lcars-sidebar-panel {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    margin: 0;
    background: transparent;
}

.lcars-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.lcars-sidebar-content {
    font-size: 13px;
}

.lcars-sidebar-spacer {
    flex: 1;
    margin: 0;
    background: transparent;
}

.lcars-sidebar-footer {
    display: none;
}

.lcars-empty-state {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Readouts */
.lcars-readout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
}

.lcars-readout + .lcars-readout {
    border-top: 1px solid var(--border-light);
}

.lcars-readout-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.lcars-readout-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Main Display */
.lcars-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-6);
    overflow: hidden;
    background: var(--surface-secondary);
}

/* Dropzone */
.lcars-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-12);
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition-normal);
}

.lcars-dropzone:hover,
.lcars-dropzone.dragover {
    border-color: var(--brand);
    background: var(--brand-subtle);
}

.lcars-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
}

.lcars-dropzone-icon {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
}

.lcars-dropzone:hover .lcars-dropzone-icon,
.lcars-dropzone.dragover .lcars-dropzone-icon {
    color: var(--brand);
}

.lcars-dropzone-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.lcars-dropzone-subtext {
    font-size: 13px;
    color: var(--text-tertiary);
}

.lcars-demo-button {
    margin-top: var(--space-6);
    padding: var(--space-3) var(--space-6);
    background: transparent;
    border: 1px solid var(--brand);
    border-radius: var(--radius-md);
    color: var(--brand);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: var(--transition-fast);
}

.lcars-demo-button:hover {
    background: var(--brand);
    color: white;
}

.lcars-demo-buttons {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.lcars-demo-buttons .lcars-demo-button {
    margin-top: 0;
}

/* Analyze Button Container */
.lcars-analyze-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
}

.lcars-analyze-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 200px;
    height: 200px;
    background: var(--brand);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.lcars-analyze-button:hover {
    background: var(--brand-dark);
    transform: scale(1.03);
}

.lcars-analyze-button:active {
    transform: scale(0.98);
}

.lcars-analyze-icon {
    width: 48px;
    height: 48px;
    color: white;
}

.lcars-analyze-text {
    font-size: 18px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.025em;
}

.lcars-analyze-subtext {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    max-width: 140px;
    text-align: center;
}

/* Cache Toggle */
.lcars-cache-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    user-select: none;
}

.lcars-cache-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--brand);
    cursor: pointer;
}

.lcars-cache-toggle:hover {
    color: var(--text-secondary);
}

/* KPI Selector */
.lcars-kpi-selector {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.lcars-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    text-align: center;
}

.lcars-kpi-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.lcars-kpi-option {
    display: block;
    cursor: pointer;
}

.lcars-kpi-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lcars-kpi-button {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition-fast);
}

.lcars-kpi-option:hover .lcars-kpi-button {
    background: var(--surface);
    border-color: var(--brand);
    color: var(--text-primary);
}

.lcars-kpi-option input:checked + .lcars-kpi-button {
    background: var(--brand);
    border-color: var(--brand);
    color: white;
}

.lcars-kpi-option input:focus-visible + .lcars-kpi-button {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* Results Display */
.lcars-results {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

/* Thinking Indicator */
.lcars-thinking {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-12);
}

.lcars-thinking-animation {
    width: 160px;
    height: 4px;
    background: var(--surface-tertiary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.lcars-scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    animation: scan 1.2s ease-in-out infinite;
}

@keyframes scan {
    0% { transform: translateX(-60px); }
    100% { transform: translateX(160px); }
}

.lcars-thinking-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Result Text */
.lcars-result-text {
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    font-size: 14px;
    line-height: 1.7;
    animation: fadeIn 0.2s ease;
}

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

.lcars-result-text h1,
.lcars-result-text h2,
.lcars-result-text h3 {
    color: var(--text-primary);
    margin: var(--space-4) 0 var(--space-2) 0;
    font-weight: 600;
}

.lcars-result-text h1 { font-size: 18px; }
.lcars-result-text h2 { font-size: 16px; }
.lcars-result-text h3 { font-size: 14px; }

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

.lcars-result-text code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--surface-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--brand);
}

.lcars-result-text pre {
    background: var(--surface-tertiary);
    color: var(--text-primary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-3) 0;
    border: 1px solid var(--border);
}

.lcars-result-text pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.lcars-result-text ul,
.lcars-result-text ol {
    margin: var(--space-3) 0;
    padding-left: var(--space-5);
}

.lcars-result-text li {
    margin: var(--space-1) 0;
}

.lcars-result-text li::marker {
    color: var(--brand);
}

.lcars-result-text p {
    margin: var(--space-2) 0;
}

/* Error Message */
.lcars-error-message {
    background: var(--danger-subtle);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--danger);
    font-size: 13px;
    margin: var(--space-3) 0;
}

/* Tool Calls */
.lcars-tool-call {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin: var(--space-3) 0;
    font-size: 12px;
}

.lcars-tool-call-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.lcars-tool-call-name {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--brand);
}

.lcars-tool-call-status {
    font-size: 11px;
    color: var(--text-tertiary);
}

.lcars-tool-result {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--surface-tertiary);
    color: var(--text-secondary);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Charts */
.lcars-charts-container {
    margin-top: var(--space-6);
}

.lcars-charts-container h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.lcars-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.lcars-chart {
    height: 200px;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

/* Headlines and Insights */
.lcars-headline {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-5) 0 var(--space-3) 0;
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--brand);
}

.lcars-headline.lcars-healthy {
    border-bottom-color: var(--success);
}

.lcars-insight {
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

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

.lcars-insight-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4) 0;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.lcars-insight-list li {
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.lcars-insight-list li:last-child {
    border-bottom: none;
}

.lcars-insight-list li::before {
    content: "•";
    color: var(--brand);
    font-weight: bold;
    flex-shrink: 0;
}

.lcars-insight-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Analysis Summary */
.lcars-analysis-summary {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* Re-analyze Button */
.lcars-reanalyze-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: var(--space-4);
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
}

.lcars-reanalyze-hint {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Comparison Mode */
.lcars-comparison-legend {
    display: flex;
    gap: var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.lcars-legend-item {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.lcars-legend-a { color: var(--brand); }
.lcars-legend-b { color: var(--success); }

.lcars-legend-note {
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
}

.lcars-dataset-a .lcars-readout-value { color: var(--brand); }
.lcars-dataset-b .lcars-readout-value { color: var(--success); }

/* Delta Badges */
.lcars-delta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.lcars-delta-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-md);
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

.lcars-delta-improved {
    background: var(--success-subtle);
    color: var(--success);
}

.lcars-delta-regressed {
    background: var(--danger-subtle);
    color: var(--danger);
}

.lcars-delta-neutral {
    background: var(--brand-subtle);
    color: var(--brand);
}

/* Scenario Badges */
.lcars-scenario-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.lcars-scenario-client_server {
    background: var(--brand-subtle);
    color: var(--brand);
}

.lcars-scenario-ab_test {
    background: var(--warning-subtle);
    color: var(--warning);
}

.lcars-scenario-identical,
.lcars-scenario-unknown {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

/* Status Classes */
.lcars-regressed { color: var(--danger) !important; }
.lcars-improved { color: var(--success) !important; }

/* Findings */
.lcars-findings-container {
    padding: var(--space-4);
}

.lcars-comparison-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.lcars-finding {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.lcars-finding-warning {
    border-left: 3px solid var(--danger);
}

.lcars-finding-improved {
    border-left: 3px solid var(--success);
}

.lcars-finding-info {
    border-left: 3px solid var(--brand);
}

.lcars-finding-header {
    margin-bottom: var(--space-3);
}

.lcars-finding-headline {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.lcars-finding-insights {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4) 0;
}

.lcars-finding-insights li {
    padding: var(--space-2) 0;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.lcars-finding-insights li::before {
    content: "→";
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.lcars-finding-insights li.lcars-regressed::before { color: var(--danger); }
.lcars-finding-insights li.lcars-improved::before { color: var(--success); }

.lcars-finding-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin: var(--space-4) 0;
}

.lcars-finding-charts .lcars-chart {
    height: 180px;
}

.lcars-finding-recommendation {
    background: var(--warning-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: var(--space-4);
}

.lcars-rec-label {
    font-weight: 600;
    color: var(--warning);
    margin-right: var(--space-2);
}

.lcars-no-chart-data {
    grid-column: 1 / -1;
    padding: var(--space-5);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    background: var(--surface-secondary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

/* Footer */
.lcars-footer {
    display: flex;
    align-items: center;
    height: 32px;
    padding: 0 var(--space-6);
    background: var(--surface);
    border-top: 1px solid var(--border);
    gap: var(--space-2);
}

.lcars-footer-bar {
    display: none;
}

.lcars-footer-links {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
    font-size: 12px;
}

.lcars-footer-links a {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.lcars-footer-links a:hover {
    color: var(--brand);
}

.lcars-footer-separator {
    color: var(--border);
}

.lcars-footer-end {
    display: none;
}

/* Disclosure Banner */
.lcars-disclosure {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-invert);
    color: var(--text-inverse);
    padding: var(--space-3) var(--space-6);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.lcars-disclosure.hidden {
    display: none;
}

.lcars-disclosure-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: 1200px;
    margin: 0 auto;
}

.lcars-disclosure-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--warning);
    color: var(--surface-invert);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.lcars-disclosure-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.lcars-disclosure-text a {
    color: var(--brand-light);
    text-decoration: underline;
}

.lcars-disclosure-text a:hover {
    color: var(--brand);
}

.lcars-disclosure-close {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: 1px solid var(--text-inverse);
    border-radius: var(--radius-md);
    color: var(--text-inverse);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.lcars-disclosure-close:hover {
    background: var(--text-inverse);
    color: var(--surface-invert);
}

/* AI Analysis Layout - Two Column */
.lcars-analysis-layout {
    display: grid;
    grid-template-columns: 2fr minmax(400px, 1fr);
    gap: var(--space-5);
    align-items: start;
}

/* AI-Driven Charts Section */
.lcars-ai-charts {
    min-width: 0; /* Prevent grid blowout */
}

.lcars-ai-charts .lcars-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.lcars-ai-chart-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.lcars-ai-chart-title {
    padding: var(--space-3) var(--space-4);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface-secondary);
    border-bottom: 1px solid var(--border);
}

.lcars-ai-chart-wrapper .lcars-chart {
    height: 180px;
    padding: var(--space-2);
}

.lcars-ai-chart-reason {
    padding: var(--space-2) var(--space-4) var(--space-3);
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
    border-top: 1px solid var(--border-light);
}

.lcars-ai-heatmap {
    min-height: 120px;
    max-height: 300px;
    padding: var(--space-2);
    border-top: 1px solid var(--border-light);
}

/* Quick Summary (shows while AI is processing) */
.lcars-quick-summary {
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.lcars-quick-headline {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

.lcars-quick-metrics {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--brand);
    background: var(--brand-subtle);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    display: inline-block;
}

.lcars-quick-findings {
    margin: 0;
    padding-left: var(--space-5);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.lcars-quick-findings li {
    margin: var(--space-2) 0;
}

.lcars-quick-findings li::marker {
    color: var(--brand);
}

/* AI Interpretation Section */
.lcars-interpretation {
    border: 1px solid var(--brand);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    position: sticky;
    top: var(--space-4);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.lcars-interpretation-header {
    background: var(--brand);
    color: white;
    padding: var(--space-3) var(--space-4);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.lcars-interpretation-content {
    padding: var(--space-5);
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-secondary);
    overflow-y: auto;
    flex: 1;
}

.lcars-interpretation-content h1,
.lcars-interpretation-content h2,
.lcars-interpretation-content h3 {
    color: var(--text-primary);
    margin: var(--space-4) 0 var(--space-2) 0;
    font-weight: 600;
}

.lcars-interpretation-content h1 { font-size: 18px; }
.lcars-interpretation-content h2 { font-size: 16px; }
.lcars-interpretation-content h3 { font-size: 14px; }

.lcars-interpretation-content p {
    margin: var(--space-3) 0;
}

.lcars-interpretation-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.lcars-interpretation-content em {
    color: var(--text-tertiary);
}

.lcars-interpretation-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--surface-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--brand);
}

.lcars-interpretation-content ul,
.lcars-interpretation-content ol {
    margin: var(--space-3) 0;
    padding-left: var(--space-5);
}

.lcars-interpretation-content li {
    margin: var(--space-2) 0;
}

.lcars-interpretation-content li::marker {
    color: var(--brand);
}

.lcars-interpretation-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6);
    color: var(--text-tertiary);
    font-size: 13px;
}

.lcars-interpretation-loading .lcars-thinking-animation {
    width: 120px;
}

.lcars-interpretation-content .lcars-error {
    color: var(--danger);
}

/* Chatbox for requesting additional charts */
.lcars-chatbox {
    border-top: 1px solid var(--border);
    padding: var(--space-3);
    background: var(--surface-secondary);
    flex-shrink: 0;
}

.lcars-chatbox-form {
    display: flex;
    gap: var(--space-2);
}

.lcars-chatbox-input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-sans);
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

.lcars-chatbox-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-subtle);
}

.lcars-chatbox-input::placeholder {
    color: var(--text-tertiary);
}

.lcars-chatbox-submit {
    padding: var(--space-2) var(--space-3);
    font-size: 13px;
    font-weight: 500;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.lcars-chatbox-submit:hover {
    background: var(--brand-dark);
}

.lcars-chatbox-submit:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
}

.lcars-chatbox-status {
    margin-top: var(--space-2);
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.lcars-chatbox-status .lcars-mini-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Query-specific charts section */
.lcars-query-charts-section {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.lcars-query-charts-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.lcars-query-charts-header::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--brand);
    border-radius: 2px;
    flex-shrink: 0;
}

.lcars-query-charts-header span {
    color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-tertiary) transparent;
}

/* Responsive */
@media (max-width: 1200px) {
    .lcars-analysis-layout {
        grid-template-columns: 1fr;
    }

    .lcars-interpretation {
        position: static;
        max-height: none;
        margin-top: var(--space-4);
    }

    .lcars-charts-grid,
    .lcars-finding-charts {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lcars-sidebar,
    .lcars-sidebar-toggle {
        display: none;
    }

    .lcars-header {
        padding: 0 var(--space-4);
    }

    .lcars-subtitle {
        display: none;
    }

    .lcars-display {
        padding: var(--space-4);
    }

    .lcars-charts-grid,
    .lcars-finding-charts {
        grid-template-columns: 1fr;
    }

    .lcars-analyze-button {
        width: 160px;
        height: 160px;
    }

    .lcars-analyze-text {
        font-size: 14px;
    }

    .lcars-analyze-icon {
        width: 36px;
        height: 36px;
    }
}
