/* Custom styling for TraceAlpha Web Dashboard */

:root {
    --bg-dark: hsl(222, 28%, 7%);
    --bg-panel: hsla(222, 20%, 12%, 0.65);
    --bg-card: hsla(222, 20%, 16%, 0.45);
    --border-color: hsla(222, 20%, 25%, 0.4);
    
    --accent: hsl(210, 100%, 60%);
    --accent-hover: hsl(210, 100%, 68%);
    --accent-glow: hsla(210, 100%, 60%, 0.25);
    
    --text-primary: hsl(0, 0%, 93%);
    --text-secondary: hsl(215, 15%, 72%);
    --text-muted: hsl(215, 12%, 52%);
    
    --color-green: hsl(145, 60%, 45%);
    --color-green-glow: hsla(145, 60%, 45%, 0.15);
    --color-red: hsl(355, 70%, 52%);
    --color-red-glow: hsla(355, 70%, 52%, 0.15);
    --color-gray: hsl(215, 12%, 52%);
    --color-gray-glow: hsla(215, 12%, 52%, 0.15);
    
    --font-outfit: 'Outfit', sans-serif;
    --font-inter: 'Inter', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-inter);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Glassmorphic Background Glows */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, hsla(210, 95%, 55%, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 85% 70%, hsla(145, 80%, 45%, 0.04) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, hsla(355, 80%, 50%, 0.03) 0%, transparent 50%);
}

/* Layout App Container */
.app-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 100;
}

.header-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.logo-area:hover {
    opacity: 0.9;
    transform: translateY(-0.5px);
}

.logo-area:active {
    transform: translateY(0);
}

.logo-badge {
    background: linear-gradient(135deg, var(--accent), hsl(210, 100%, 75%));
    color: var(--bg-dark);
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
}

.logo-area h1 {
    font-family: var(--font-outfit);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-area h1 span {
    color: var(--accent);
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-inter);
    border-left: 1px solid var(--border-color);
    padding-left: 12px;
    margin-left: 4px;
}

/* View Toggle Navigation */
.view-toggle {
    display: flex;
    justify-content: center;
    background: hsla(222, 20%, 8%, 0.5);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 18px;
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.nav-btn:hover {
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Status Panel */
.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.live {
    background-color: var(--color-green);
    box-shadow: 0 0 8px var(--color-green);
    animation: pulse 2s infinite;
}

/* User Profile & Dropdown */
.user-profile-container {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #2196F3);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(100, 200, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(100, 200, 255, 0.4);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    overflow: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.dropdown-header {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding: 12px 16px;
    color: var(--text-primary);
    text-align: left;
    font-size: 14px;
    font-family: var(--font-inter);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

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

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
}

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

.mock-trigger-btn {
    background: hsla(210, 100%, 60%, 0.12);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-family: var(--font-outfit);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mock-trigger-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Section Header styling */
.section-header {
    margin-bottom: 24px;
}

#view-heatmap .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

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

.section-header h2 {
    font-family: var(--font-outfit);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.section-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Main Viewport Routing */
.content-viewport {
    flex-grow: 1;
    margin-bottom: 32px;
}

.viewport-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.viewport-section.active {
    display: block;
}

/* VIEW A: NEWS FEED LAYOUT */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Dynamic Card System */
.event-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.event-card:hover {
    transform: translateY(-2px);
    border-color: hsla(210, 100%, 60%, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Color Coding and Desaturation (Signal Decay) */
.event-card.signal-bull {
    border-left: 4px solid var(--color-green);
    background: linear-gradient(90deg, var(--color-green-glow) 0%, var(--bg-panel) 300px);
}

.event-card.signal-bear {
    border-left: 4px solid var(--color-red);
    background: linear-gradient(90deg, var(--color-red-glow) 0%, var(--bg-panel) 300px);
}

.event-card.signal-neutral {
    border-left: 4px solid var(--color-gray);
    background: linear-gradient(90deg, var(--color-gray-glow) 0%, var(--bg-panel) 300px);
}

/* Signal decay (7-day desaturation gradient) */
.event-card.decayed {
    /* Desaturation style based on opacity and saturation properties */
    filter: saturate(0.2) opacity(0.85);
}

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

.news-publisher-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.publisher-badge {
    background: hsla(0, 0%, 100%, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.timestamp {
    color: var(--text-muted);
    white-space: nowrap;
}

.ticker-price-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-ticker-badge {
    background: hsla(0, 0%, 100%, 0.1);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.card-price-ticker {
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.score-badge {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
}

.score-badge.bull {
    background: var(--color-green);
    color: var(--bg-dark);
}

.score-badge.bear {
    background: var(--color-red);
    color: var(--bg-dark);
}

.score-badge.neutral {
    background: var(--color-gray);
    color: var(--text-primary);
}

.event-headline {
    font-family: var(--font-outfit);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.headline-link {
    color: var(--text-primary);
    text-decoration: none;
}

.headline-link:hover {
    color: var(--accent);
}

/* Accordion Thesis Content */
.thesis-accordion-trigger {
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: var(--font-outfit);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    margin-top: 8px;
}

.thesis-accordion-trigger:hover {
    color: var(--accent-hover);
}

.thesis-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.thesis-accordion-content.expanded {
    max-height: 1500px;
    transition: max-height 0.6s ease-in;
    margin-top: 16px;
    border-top: 1px dashed var(--border-color);
    padding-top: 16px;
}

.thesis-block, .thesis-block-expanded {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .thesis-block, .thesis-block-expanded {
        grid-template-columns: 1fr;
    }
    .thesis-summary-area {
        margin-bottom: 24px;
    }
}

.thesis-summary-area h4, .contrarian-area h4 {
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.thesis-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 8px;
}

.bear-case-text {
    background: hsla(355, 70%, 52%, 0.04);
    border-left: 2px solid var(--color-red);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    max-height: 120px;
    overflow-y: auto;
}

.thesis-block-expanded .thesis-text,
.thesis-block-expanded .bear-case-text {
    max-height: none;
    overflow-y: visible;
}

.tail-risk-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.risk-tag {
    background: hsla(0, 0%, 100%, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: justify;
    width: 100%;
    display: block;
    white-space: normal;
    max-height: 40px;
    overflow-y: auto;
}

.claims-timeline {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.claims-timeline h4 {
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.claim-row {
    background: hsla(0, 0%, 100%, 0.02);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.citation-badge {
    background: var(--accent);
    color: var(--bg-dark);
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    white-space: nowrap;
}

.citation-badge:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* VIEW B: TICKER TERMINAL LAYOUT */
.ticker-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

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

.ticker-sidebar {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ticker-search-box {
    margin-bottom: 12px;
}

#ticker-search-input {
    min-width: 0;
    background: hsla(222, 20%, 8%, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font-inter);
    outline: none;
    transition: var(--transition-smooth);
}

#ticker-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.ticker-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 520px;
    overflow-y: auto;
}

.ticker-sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.ticker-sidebar-card:hover {
    border-color: var(--accent);
    transform: translateX(2px);
}

.ticker-sidebar-card.active {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.ticker-sidebar-sym {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 16px;
}

.ticker-sidebar-name {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profile details pane */
.ticker-profile-details {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.empty-profile-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.profile-meta h3 {
    font-family: var(--font-outfit);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-sector-badge {
    background: hsla(210, 100%, 60%, 0.12);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid hsla(210, 100%, 60%, 0.2);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.profile-stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 8px;
    text-align: center;
}

.profile-stat-val {
    display: block;
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
}

.profile-stat-val.positive {
    color: var(--color-green);
}

.profile-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Thesis Trajectory Timeline component */
.trajectory-section h4 {
    font-family: var(--font-outfit);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.trajectory-timeline {
    position: relative;
    padding-left: 28px;
}

.trajectory-timeline::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 8px;
    width: 2px;
    height: calc(100% - 12px);
    background: var(--border-color);
}

.timeline-node {
    position: relative;
    margin-bottom: 20px;
}

.timeline-node:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 5px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 3px solid var(--border-color);
    z-index: 2;
}

.timeline-dot.active {
    border-color: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
}

.timeline-dot.terminated {
    border-color: var(--color-red);
    box-shadow: 0 0 6px var(--color-red);
}

.timeline-dot.matured {
    border-color: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.timeline-node-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
}

.node-date {
    font-size: 11px;
    color: var(--text-muted);
}

.node-title {
    font-family: var(--font-outfit);
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

.node-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

/* VIEW C: ANALYTICS TRACK RECORD LAYOUT */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

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

.metric-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.metric-title {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: var(--font-inter);
    margin-bottom: 6px;
}

.metric-value {
    display: block;
    font-family: var(--font-outfit);
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.metric-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.analytics-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .analytics-layout-grid {
        grid-template-columns: 1fr;
    }
}

.analytics-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
}

.analytics-panel h3 {
    font-family: var(--font-outfit);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Custom Chart bars */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 180px;
    justify-content: center;
}

.chart-bar-row {
    display: grid;
    grid-template-columns: 90px 1fr 50px;
    align-items: center;
    gap: 12px;
}

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

.chart-bar-track {
    background: hsla(0, 0%, 100%, 0.05);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 6px;
}

.chart-bar-fill.positive {
    background: var(--color-green);
}

.chart-bar-fill.negative {
    background: var(--color-red);
}

.chart-bar-val {
    font-size: 12px;
    font-family: var(--font-outfit);
    font-weight: 600;
    text-align: right;
}

/* Confusion Matrix boxes */
.confusion-matrix-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 180px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 80px 100px 100px;
    grid-template-rows: 24px 70px 70px;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.matrix-cell.empty {
    grid-area: 1 / 1 / 2 / 2;
}

.matrix-header-col {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.matrix-header-row {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    text-align: right;
    padding-right: 8px;
}

.matrix-box {
    height: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.matrix-box.true-pos {
    background: rgba(145, 230, 160, 0.06);
    border-color: rgba(145, 230, 160, 0.2);
}

.matrix-box.true-neg {
    background: rgba(145, 230, 160, 0.06);
    border-color: rgba(145, 230, 160, 0.2);
}

.matrix-box.false-pos {
    background: rgba(230, 100, 100, 0.06);
    border-color: rgba(230, 100, 100, 0.2);
}

.matrix-box.false-neg {
    background: rgba(230, 100, 100, 0.06);
    border-color: rgba(230, 100, 100, 0.2);
}

.matrix-box .box-count {
    font-family: var(--font-outfit);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.matrix-box .box-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Ledger Panel table */
.ledger-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
}

.ledger-panel h3 {
    font-family: var(--font-outfit);
    font-size: 18px;
    margin-bottom: 16px;
}

.table-wrapper {
    overflow-x: auto;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.ledger-table th, .ledger-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.ledger-table th {
    font-family: var(--font-outfit);
    color: var(--text-secondary);
    font-weight: 600;
    background: hsla(222, 20%, 8%, 0.4);
    white-space: nowrap;
    vertical-align: bottom;
}

.ledger-table tbody tr:hover {
    background: hsla(0, 0%, 100%, 0.02);
}

.ledger-table td.sig-gain {
    color: var(--color-green);
    font-weight: 600;
}

.ledger-table td.sig-loss {
    color: var(--color-red);
    font-weight: 600;
}

.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.matured {
    background: hsla(210, 100%, 60%, 0.15);
    color: var(--accent);
}

.status-badge.terminated, .status-badge.terminated_early {
    background: hsla(355, 70%, 52%, 0.15);
    color: var(--color-red);
}

.status-badge.active {
    background: hsla(145, 60%, 45%, 0.15);
    color: var(--color-green);
}

/* Permanent Legal Disclaimer Footer */
.mandatory-legal-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
    text-align: justify;
}

/* Modal Overlay & Modal Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 650px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: zoomIn 0.3s ease-out forwards;
}

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

.modal-header h3 {
    font-family: var(--font-outfit);
    font-size: 18px;
    font-weight: 600;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

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

.modal-body {
    padding: 24px;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-inter);
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
}

.auth-btn {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--accent-color), #2196F3);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-outfit);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(100, 200, 255, 0.3);
}

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

.citation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.meta-tag {
    background: hsla(210, 100%, 60%, 0.1);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

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

.meta-link {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}

.meta-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.citation-quote-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 10px;
}

.quote-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

#cite-quote {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 16px;
    color: hsl(0, 0%, 100%);
}

.quote-check-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--color-green);
    font-weight: 600;
}

.badge-icon {
    background: var(--color-green);
    color: var(--bg-dark);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 9px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1.0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* =====================================================================
   Risk Classification and Category Filtering
   ===================================================================== */

.section-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.timeline-legend {
    display: flex;
    gap: 14px;
    font-size: 11px;
    font-family: var(--font-outfit);
    font-weight: 600;
    align-items: center;
    margin-top: 2px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.legend-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-indicator.vibrant {
    background-color: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.legend-indicator.decayed {
    background-color: var(--text-muted);
    filter: saturate(0.2);
    opacity: 0.7;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.filter-label {
    font-family: var(--font-outfit);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-pill {
    background: hsla(0, 0%, 100%, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-outfit);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
}

.filter-pill:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: hsla(210, 100%, 60%, 0.05);
}

.filter-pill.active {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 10px var(--accent-glow);
}

.risk-categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.risk-category-badge {
    background: hsla(210, 100%, 60%, 0.1);
    color: var(--accent);
    border: 1px solid hsla(210, 100%, 60%, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: var(--font-outfit);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        text-align: center;
        padding: 20px 24px;
    }
    .logo-area {
        gap: 6px;
    }
    .logo-subtitle {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-top: 4px;
    }
}

/* Global Typography Overrides for TraceAlpha Analysis Blocks */
.thesis-text, 
.bear-case-text, 
.confidence-rationale, 
.claim-row span, 
.tail-risks-bullet-list li,
.splash-thesis-container p,
.splash-thesis-container li {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* Ledger Table Filters */
.ledger-filter {
    background: hsla(222, 20%, 8%, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-family: var(--font-inter);
    outline: none;
    transition: var(--transition-smooth);
    margin-top: 8px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    color-scheme: dark;
}

select.ledger-filter, select.news-filter {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238b9bb4%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px auto;
    padding-right: 28px;
    cursor: pointer;
}

select.news-filter {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    padding-right: 28px;
    border-radius: 4px;
    font-family: var(--font-inter);
    font-size: 13px;
    outline: none;
}

.ledger-filter::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.ledger-filter::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.ledger-filter:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.ledger-filter option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.ledger-page-btn {
    background: hsla(222, 20%, 8%, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.ledger-page-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.ledger-page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.ledger-table tr.row-alpha-positive td {
    background-color: hsla(145, 60%, 45%, 0.05);
}

.ledger-table tr.row-alpha-negative td {
    background-color: hsla(355, 70%, 52%, 0.05);
}

/* Data Table (Bookmarks, Admin, etc) */
.table-container {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    font-family: var(--font-inter);
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Modal Action Buttons */
.modal-action-btn {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-outfit);
}
.modal-action-btn.cancel-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}
.modal-action-btn.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}
.modal-action-btn.confirm-btn {
    background: #f44336;
    border: none;
    color: white;
}
.modal-action-btn.confirm-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}
.modal-action-btn.primary-btn {
    background: var(--accent);
    border: none;
    color: var(--bg-dark);
}
.modal-action-btn.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Custom Tooltip */
.custom-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    width: 14px;
    height: 14px;
    background: hsla(210, 100%, 60%, 0.15);
    color: var(--accent);
    border-radius: 50%;
    text-align: center;
    line-height: 14px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 4px;
    vertical-align: middle;
}

.custom-tooltip .tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1000;
    bottom: 150%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 12px;
    font-family: var(--font-inter);
    line-height: 1.4;
    font-weight: normal;
}

.custom-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ========================================= */
/* Mobile Responsiveness (max-width: 768px)  */
/* ========================================= */
@media (max-width: 768px) {
    /* App Container */
    .app-container {
        padding: 12px;
    }
    
    /* Header */
    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
        padding: 16px;
    }
    .view-toggle {
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
    .header-status {
        width: 100%;
        justify-content: flex-end;
    }


    /* Ticker Terminal Layout */
    .ticker-layout {
        grid-template-columns: minmax(0, 1fr) !important; /* Override the 250px 1fr grid */
    }
    .profile-stats-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .ticker-header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .ticker-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .profile-header > div:last-child {
        align-items: flex-start !important;
    }
    .ticker-profile-details {
        padding: 16px;
    }

    /* Analytics Ledger Tables */
    .analytics-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .ledger-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
        width: calc(100% + 24px);
    }
    .ledger-table {
        min-width: 900px; /* Force scroll */
    }
    .metrics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .date-filter-group {
        width: 100%;
        justify-content: flex-start;
    }
}

/* User Management Role Dropdown Styles */
.role-select {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    outline: none;
    transition: var(--transition-smooth);
    background-color: var(--bg-card);
    color: var(--text-primary);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 28px;
}

.role-select.role-admin {
    background-color: hsla(270, 70%, 50%, 0.15); /* Purple tint for admin */
    border-color: hsla(270, 70%, 50%, 0.3);
    color: hsl(270, 80%, 75%);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='hsl(270, 80%25, 75%25)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.role-select.role-user {
    background-color: hsla(215, 12%, 52%, 0.1);
    border-color: hsla(215, 12%, 52%, 0.2);
    color: var(--text-secondary);
}

.role-select:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.role-select:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================= */
/* Market Heatmap Layout                     */
/* ========================================= */

.heatmap-split-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
    margin-top: 20px;
}

.heatmap-main {
    flex: 1 1 0; /* Take up remaining space */
    min-width: 0; /* Prevent flex blowout */
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.heatmap-chart-container {
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.heatmap-sidebar {
    flex: 0 0 350px; /* Fixed width for the sidebar so it doesn't squish */
    min-width: 300px; /* Ensure it stays readable */
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}

.heatmap-sidebar .movers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 560px; /* Aligns roughly with 600px chart container */
}

/* Heatmap Responsive Design */
@media (max-width: 900px) {
    .heatmap-split-layout {
        flex-direction: column;
    }
    
    .heatmap-chart-container {
        height: 400px; /* Slightly shorter on mobile/tablet */
    }
    
    .heatmap-sidebar {
        flex: auto;
        min-width: 0;
        width: 100%;
        min-height: 400px;
    }
    
    .heatmap-sidebar .movers-list {
        max-height: 400px;
    }
}

