/* Intelligence Analysis Workspace - Castor
   Premium design for financial intelligence platform
   Competing with: OpenAI, Gemini, Bloomberg, AlphaSense
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Mode (Default) */
    --bg-primary: #0a0d12;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-elevated: #374151;
    --bg-hover: #4b5563;

    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;

    --border-color: #374151;
    --border-light: #4b5563;

    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #06b6d4;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f59e0b);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Spacing */
    --header-height: 64px;
}

/* Light Mode */
body.light-mode {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #e2e8f0;
    --bg-hover: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --border-color: #e2e8f0;
    --border-light: #cbd5e1;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);
}

/* Base Styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== Header ==================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-md);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.page-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.badge-live {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    background: var(--accent-success);
    color: white;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* Theme Toggle */
.icon-moon { display: none; }
body.light-mode .icon-sun { display: none; }
body.light-mode .icon-moon { display: block; }

/* ==================== Main Content ==================== */
.main {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ==================== Hero Section ==================== */
.hero-section {
    padding: 80px 24px 60px;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.hero-content {
    margin-bottom: 40px;
}

.hero-title {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

/* Search Box */
.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 8px 8px 20px;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-icon-arrow {
    transition: transform var(--transition-fast);
}

.search-btn:hover .btn-icon-arrow {
    transform: translateX(3px);
}

/* Search Hints */
.search-hints {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.hint-label {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.hint-btn {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.hint-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Templates Section */
.templates-section {
    margin-top: 60px;
}

.templates-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: left;
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.template-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.template-icon.credit {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.template-icon.bank {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.template-icon.retail {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.template-icon.ma {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.template-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.template-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Data Sources */
.data-sources {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.source-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.source-dot.fred { background: var(--accent-primary); }
.source-dot.sec { background: var(--accent-success); }
.source-dot.live { background: var(--accent-warning); animation: pulse 2s infinite; }

/* ==================== Loading Section ==================== */
.loading-section {
    padding: 100px 24px;
    text-align: center;
}

.loading-content {
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

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

.loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    opacity: 0.5;
    transition: var(--transition-normal);
}

.loading-step.active {
    opacity: 1;
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.loading-step.completed {
    opacity: 1;
}

.loading-step.completed .step-icon {
    background: var(--accent-success);
}

.step-icon {
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.loading-step.active .step-icon {
    background: var(--accent-primary);
    color: white;
}

.step-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==================== Results Section ==================== */
.results-section {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

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

/* Results Header */
.results-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.query-display {
    flex: 1;
    min-width: 200px;
}

.query-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.query-text {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 2px;
}

.results-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.action-btn.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.action-btn.primary:hover {
    background: var(--accent-primary-hover);
}

/* Summary Card */
.summary-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.summary-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-title-row svg {
    color: var(--accent-primary);
}

.summary-title-row h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-meta {
    display: flex;
    gap: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.summary-body {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.summary-body p {
    margin-bottom: 16px;
}

.summary-body p:last-child {
    margin-bottom: 0;
}

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

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.result-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
}

.result-section.full-width {
    grid-column: 1 / -1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header svg {
    color: var(--text-muted);
}

.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.section-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.section-badge.fred {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

/* Company Cards */
.company-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.company-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition-fast);
}

.company-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.company-ticker {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.company-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.company-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.company-change.positive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.company-change.negative {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.company-change.neutral {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.company-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.metric-item {
    text-align: center;
    padding: 8px 6px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: help;
    transition: background 0.2s;
}

.metric-item:hover {
    background: var(--bg-tertiary);
}

.metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.2;
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.metric-period {
    font-size: 0.55rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Period Toggle (10-Q / 10-K) */
.period-toggle-container {
    margin: 12px 0;
    display: flex;
    justify-content: flex-end;
}

.period-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.period-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.period-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Macro Cards */
.macro-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.macro-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.macro-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.macro-card.positive::before { background: var(--accent-success); }
.macro-card.negative::before { background: var(--accent-danger); }
.macro-card.neutral::before { background: var(--text-muted); }

.macro-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Truncatable label styles */
.macro-label-truncate {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

/* Only add padding for truncated labels */
.macro-label-truncate.is-truncated {
    padding-bottom: 14px; /* Space for the expand indicator */
}

.macro-label-truncate.expanded {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

.macro-label-truncate:not(.expanded):hover {
    color: var(--text-secondary);
}

/* Expand/collapse indicator positioned below text */
.macro-label-truncate.is-truncated::after {
    content: '▼ more';
    position: absolute;
    bottom: 0;
    left: 0;
    font-size: 0.55rem;
    color: var(--accent-primary);
    opacity: 0.7;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.macro-label-truncate.expanded.is-truncated::after {
    content: '▲ less';
}

.macro-label-truncate.is-truncated:hover::after {
    opacity: 1;
    text-decoration: underline;
}

.macro-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.macro-card.positive .macro-value { color: var(--accent-success); }
.macro-card.negative .macro-value { color: var(--accent-danger); }

.macro-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    margin-top: 6px;
}

.macro-trend.up { color: var(--accent-danger); }
.macro-trend.down { color: var(--accent-success); }

/* Industry Cards */
.industry-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.industry-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.industry-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.industry-impact {
    font-size: 2rem;
    font-weight: 800;
}

.industry-impact.positive { color: var(--accent-success); }
.industry-impact.negative { color: var(--accent-danger); }
.industry-impact.neutral { color: var(--text-muted); }

.industry-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Strategic Grid */
.strategic-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .strategic-grid {
        grid-template-columns: 1fr;
    }
}

.strategic-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
}

.strategic-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.strategic-card.drivers h4 { color: var(--accent-success); }
.strategic-card.risks h4 { color: var(--accent-danger); }

.strategic-list {
    list-style: none;
}

.strategic-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.strategic-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 8px;
    flex-shrink: 0;
}

.strategic-card.drivers .strategic-list li::before {
    background: var(--accent-success);
}

.strategic-card.risks .strategic-list li::before {
    background: var(--accent-danger);
}

/* History Cards */
.history-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.history-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid var(--accent-secondary);
}

.history-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.history-outcome {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.history-result {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.history-result.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.history-result.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.history-result.mixed {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 14px 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: var(--transition-normal);
    z-index: 10000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .header-left {
        gap: 12px;
    }

    .logo-text {
        display: none;
    }

    .page-title {
        font-size: 0.9rem;
    }

    .hero-section {
        padding: 60px 16px 40px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .search-box {
        flex-direction: column;
        padding: 12px;
    }

    .search-input {
        width: 100%;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .results-section {
        padding: 16px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .company-cards,
    .macro-cards,
    .industry-cards {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .company-cards,
    .macro-cards {
        grid-template-columns: 1fr;
    }

    .data-sources {
        flex-direction: column;
        gap: 12px;
    }
}

/* ==================== Section Actions (Add Buttons) ==================== */
.section-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-light);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.add-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    border-style: solid;
}

.add-btn.secondary {
    background: transparent;
}

/* ==================== FRED Index Display ==================== */
.fred-index-display {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.fred-index-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.index-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.index-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.index-change {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.index-change.positive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.index-change.negative {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.index-description {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ==================== Clickable Macro Cards ==================== */
.macro-card.clickable {
    cursor: pointer;
    position: relative;
}

.macro-card.clickable:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.macro-card.clickable::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.macro-card.clickable:hover::after {
    opacity: 1;
}

.macro-card-weight {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ==================== Modals ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

.modal-content.modal-lg {
    max-width: 700px;
}

.modal-content.modal-xl {
    max-width: 1000px;
    width: 95%;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input::placeholder {
    color: var(--text-dim);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 6px;
    margin-bottom: 8px;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

/* Search Results in Modals */
.search-results {
    max-height: 250px;
    overflow-y: auto;
    margin-top: 16px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.search-result-item.selected {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.search-result-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    flex-shrink: 0;
}

.search-result-item.selected .search-result-checkbox {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-result-description {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}

/* Agent 7+8 Macro Card Enhancements */
.macro-card.has-report {
    border-color: var(--accent-primary);
    cursor: pointer;
}

.macro-card.has-report:hover {
    border-color: #22d3ee;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 211, 238, 0.15);
}

.macro-card.needs-analysis {
    border-style: dashed;
    border-color: var(--text-muted);
    opacity: 0.85;
}

.macro-card.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.macro-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.run-agent7-btn {
    margin-top: 12px;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.run-agent7-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.run-agent7-btn:active {
    transform: scale(0.98);
}

/* Card Header - Label and Badge side by side */
.macro-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.macro-card-header .macro-label {
    flex: 1;
    font-size: 0.85rem;
}

.report-badge {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #22d3ee 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Positive indicator badge - high values are favorable for user's query */
.positive-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 600;
    margin-bottom: 4px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Negative indicator badge - high values are unfavorable for user's query */
.negative-badge {
    display: inline-block;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 600;
    margin-bottom: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Legacy support - keep inverse-badge for backward compatibility */
.inverse-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 600;
    margin-bottom: 4px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Risk interpretation text next to index label */
.risk-interpretation {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 2px;
    margin-left: 4px;
}

.risk-interpretation.positive {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.risk-interpretation.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.risk-interpretation.neutral {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

.macro-card {
    position: relative;
}

/* Index Label */
.macro-index-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* Rich Stats Display for Agent 7+8 Results - 2x2 Grid */
.macro-rich-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rich-stat {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
}

.rich-stat-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.rich-stat-value.positive {
    color: #10b981;
}

.rich-stat-value.negative {
    color: #ef4444;
}

.rich-stat-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Card Footer - Coverage and Weight */
.macro-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.macro-coverage {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.macro-card-footer .macro-card-weight {
    font-size: 0.7rem;
    color: var(--accent-info);
    font-weight: 600;
    margin-top: 0;
}

/* Larger card for rich data */
.macro-card.has-report {
    min-height: 200px;
    padding: 14px;
}

/* Button Styles in Modals */
.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-primary {
    padding: 10px 20px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-search {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-search:hover {
    background: var(--accent-primary-hover);
}

/* Indicator Categories */
.indicator-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
}

.category-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.category-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.category-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Weights Editor */
.weights-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.weight-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weight-label {
    flex: 0 0 150px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.weight-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
}

.weight-value {
    flex: 0 0 50px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.weights-total {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    margin-top: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-weight: 600;
}

/* My Reports Modal */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.reports-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
}

.reports-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
}

.report-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.report-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.report-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 10px;
    color: var(--accent-primary);
}

.report-info {
    flex: 1;
}

.report-query {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.report-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.report-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-index {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.report-index-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.report-index-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.report-actions {
    display: flex;
    gap: 8px;
}

.report-action-btn {
    padding: 8px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.report-action-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
}

.report-action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Selected Items Chips */
.selected-companies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.selected-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid var(--accent-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.selected-chip button {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* Loading States */
.loading-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
}

.loading-results .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty State */
.empty-results {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.empty-results svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Company Cards - Clickable */
.company-card {
    cursor: pointer;
    transition: var(--transition-fast);
}

.company-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
    border-color: var(--accent-primary);
}

.company-card .click-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.company-card:hover .click-hint {
    opacity: 1;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.metric-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.metric-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.metric-selector select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 200px;
}

.metric-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.company-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.company-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.company-toggle:hover {
    border-color: var(--accent-primary);
}

.company-toggle.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-primary);
}

.company-toggle input {
    display: none;
}

.company-toggle .ticker {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.company-toggle .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* SEC Filing Links */
.sec-links-container {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sec-links-container h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.sec-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.sec-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.sec-link:hover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.sec-link .ticker {
    font-weight: 600;
    font-size: 0.9rem;
}

.sec-link .form-type {
    font-size: 0.75rem;
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

.sec-link .period {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.sec-link svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* Company Card Responsive Improvements */
@media (min-width: 600px) {
    .company-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Better company card container on large screens */
.company-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Tooltip for truncated metric labels */
.metric-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1000;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.metric-item {
    position: relative;
}

/* ============================================
   MACRO IMPACT PATTERNS SECTION
   Premium hedge-fund quality styling
   ============================================ */

/* Section description */
.section-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: -8px 0 16px 0;
    line-height: 1.5;
}

.section-description strong {
    color: var(--text-secondary);
}

/* Section header right side */
.section-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.section-badge.pattern {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

/* Pattern Summary Stats */
.pattern-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.pattern-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pattern-stat .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.pattern-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pattern-stat.high .stat-value {
    color: #10b981;
}

/* Pattern Cards Grid */
.pattern-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    min-height: 200px;
}

/* Pattern Loading State */
.pattern-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px;
    color: var(--text-muted);
}

.pattern-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Individual Pattern Card */
.pattern-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.pattern-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.pattern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), #8b5cf6);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pattern-card:hover::before {
    opacity: 1;
}

/* Pattern Card Header */
.pattern-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.pattern-direction {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.pattern-direction-arrow {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.pattern-direction .source {
    color: #3b82f6;
}

.pattern-direction .target {
    color: #10b981;
}

/* Confidence Badge */
.confidence-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.confidence-badge.high {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.confidence-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.confidence-badge.low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.confidence-bar {
    width: 40px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.confidence-badge.high .confidence-bar-fill {
    background: #10b981;
}

.confidence-badge.moderate .confidence-bar-fill {
    background: #f59e0b;
}

.confidence-badge.low .confidence-bar-fill {
    background: #ef4444;
}

/* Pattern Condition and Outcome */
.pattern-condition {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.pattern-when {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.pattern-keyword {
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.pattern-metric {
    font-weight: 600;
    color: var(--text-primary);
}

.pattern-threshold {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.pattern-threshold.above {
    color: #ef4444;
}

.pattern-threshold.below {
    color: #3b82f6;
}

.pattern-then {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    margin-left: 10px;
}

.pattern-outcome {
    font-weight: 600;
}

.pattern-outcome.increased {
    color: #10b981;
}

.pattern-outcome.decreased {
    color: #ef4444;
}

/* Pattern Statistics */
.pattern-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.pattern-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pattern-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pattern-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Pattern Insight */
.pattern-insight {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.pattern-insight svg {
    flex-shrink: 0;
    color: var(--accent-primary);
    margin-top: 2px;
}

.pattern-insight-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Lag Period Badge */
.lag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Empty State */
.pattern-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px;
    text-align: center;
    color: var(--text-muted);
}

.pattern-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.pattern-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pattern-empty-desc {
    font-size: 0.85rem;
    max-width: 400px;
}

/* Pattern Card Actions */
.pattern-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.pattern-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-action-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.pattern-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .pattern-cards {
        grid-template-columns: 1fr;
    }

    .pattern-summary {
        flex-direction: column;
        gap: 16px;
    }

    .pattern-stat {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* ==================== Company Sensitivity Ranking ==================== */

.company-sensitivity {
    margin: 24px 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.sensitivity-header {
    margin-bottom: 16px;
}

.sensitivity-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.sensitivity-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.sensitivity-ranking {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sensitivity-company {
    display: grid;
    grid-template-columns: 40px 120px 1fr 180px;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sensitivity-company:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.sensitivity-company.most-sensitive {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.sensitivity-company.least-sensitive {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.sensitivity-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.sensitivity-company.most-sensitive .sensitivity-rank {
    color: #ef4444;
}

.sensitivity-company.least-sensitive .sensitivity-rank {
    color: #10b981;
}

.sensitivity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sensitivity-ticker {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.sensitivity-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.sensitivity-score {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sensitivity-bar-container {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.sensitivity-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.sensitivity-company.most-sensitive .sensitivity-bar {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.sensitivity-company.least-sensitive .sensitivity-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.sensitivity-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 45px;
    text-align: right;
}

.sensitivity-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.sensitivity-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.sensitivity-indicator {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-primary);
}

/* ==================== Pattern Company Chips ==================== */

.pattern-companies {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.pattern-companies-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pattern-company-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.company-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: default;
    transition: all 0.2s ease;
}

.company-chip:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.chip-confidence {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    padding: 1px 4px;
    background: var(--bg-secondary);
    border-radius: 3px;
}

.company-chip.more {
    background: transparent;
    border-style: dashed;
    color: var(--text-secondary);
}

/* Responsive adjustments for sensitivity ranking */
@media (max-width: 768px) {
    .sensitivity-company {
        grid-template-columns: 30px 1fr;
        grid-template-rows: auto auto;
        gap: 8px;
    }

    .sensitivity-score {
        grid-column: span 2;
    }

    .sensitivity-detail {
        grid-column: span 2;
        text-align: left;
        flex-direction: row;
        gap: 8px;
    }
}

/* ==========================================
   Economic Causal Analysis Section
   ========================================== */

#causal-section {
    margin-top: 24px;
}

.section-badge.ai-powered {
    background: linear-gradient(135deg, var(--accent-purple, #8b5cf6), var(--accent-primary, #6366f1));
    color: white;
}

/* Causal Loading */
.causal-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 32px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 20px;
}

.causal-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.causal-loading-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loading-stage {
    font-weight: 600;
    color: var(--text-primary);
}

.loading-detail {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Causal Results */
.causal-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Causal Summary */
.causal-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
}

.causal-stat {
    text-align: center;
}

.causal-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.causal-stat .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Causal Relationships Grid */
.causal-relationships {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.causal-relationship-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.causal-relationship-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.causal-relationship-card.coherent {
    border-left: 4px solid var(--accent-green, #10b981);
}

.causal-relationship-card.needs-review {
    border-left: 4px solid var(--accent-amber, #f59e0b);
}

.relationship-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.relationship-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.relationship-flow .arrow {
    color: var(--accent-primary);
    font-size: 16px;
}

.relationship-confidence {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.relationship-confidence.high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green, #10b981);
}

.relationship-confidence.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber, #f59e0b);
}

.relationship-confidence.low {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.relationship-validation {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-bottom: 10px;
}

.relationship-validation.valid {
    color: var(--accent-green, #10b981);
}

.relationship-validation.warning {
    color: var(--accent-amber, #f59e0b);
}

.relationship-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.rel-stat {
    text-align: center;
}

.rel-stat .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.rel-stat .stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.relationship-reasoning {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Causal Narrative */
.causal-narrative-section {
    margin-top: 8px;
}

.causal-narrative-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.causal-narrative {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.causal-narrative p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
    font-size: 14px;
}

.causal-narrative p:last-child {
    margin-bottom: 0;
}

/* Causal Placeholder */
.causal-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-tertiary);
}

.placeholder-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.causal-placeholder p {
    max-width: 400px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .causal-relationships {
        grid-template-columns: 1fr;
    }

    .causal-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================================================
   THRESHOLD PATTERNS SECTION
   ============================================================================= */

.threshold-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.threshold-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 16px;
}

.threshold-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-tertiary);
}

.threshold-placeholder p {
    max-width: 450px;
    font-size: 14px;
    line-height: 1.6;
}

/* Index Card */
.threshold-index-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.threshold-index-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.index-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.index-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.index-current {
    font-size: 13px;
    font-weight: 500;
}

.index-current.elevated {
    color: var(--accent-red);
}

.index-current.depressed {
    color: var(--accent-blue);
}

.threshold-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.threshold-badge.above {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.threshold-badge.below {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

/* Pattern Rows */
.threshold-patterns-list {
    padding: 12px 0;
}

.threshold-pattern-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.threshold-pattern-row:last-child {
    border-bottom: none;
}

.threshold-pattern-row:hover {
    background: var(--bg-tertiary);
}

.pattern-target {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.pattern-target .ticker {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-blue);
    background: var(--accent-blue-dim);
    padding: 4px 8px;
    border-radius: 4px;
}

.pattern-target .metric {
    font-size: 13px;
    color: var(--text-secondary);
}

.pattern-outcome {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
}

.pattern-outcome .outcome-icon {
    font-size: 16px;
    font-weight: 700;
}

.pattern-outcome .outcome-text {
    font-size: 13px;
    font-weight: 500;
}

.pattern-outcome.increase {
    color: var(--accent-red);
}

.pattern-outcome.decrease {
    color: var(--accent-green);
}

.pattern-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 100px;
    justify-content: flex-end;
}

.pattern-stats .hit-rate {
    font-size: 13px;
    color: var(--text-secondary);
}

.pattern-stats .confidence {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.pattern-stats .confidence.high {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.pattern-stats .confidence.medium {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.pattern-stats .confidence.low {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .threshold-results {
        grid-template-columns: 1fr;
    }

    .threshold-pattern-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pattern-target {
        flex: 1 1 100%;
    }
}

/* =============================================================================
   NO COMPANIES MESSAGE (Macro-Only Queries)
   ============================================================================= */

.no-companies-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    grid-column: 1 / -1;
}

.no-companies-icon {
    color: var(--accent-blue);
    opacity: 0.6;
    margin-bottom: 16px;
}

.no-companies-message h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.no-companies-message p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.no-companies-message p.hint {
    font-size: 13px;
    color: var(--text-tertiary);
    font-style: italic;
}
