/* ════════════════════════════════════════════
   TRMNL 303 — Component Styles
   Tokens, reset, layout, and utilities are in separate files.
   This file contains component-level styles.
   ════════════════════════════════════════════ */

/* ════════════════════════════════════════════
   DESIGN PRIMITIVES
   ════════════════════════════════════════════ */
.section-divider { height: 1px; background: rgba(255, 255, 255, 0.06); margin: 1.75rem 0; }
.data-highlight { color: rgba(255, 255, 255, 0.95); font-weight: 600; }
.section-subheader { margin: 0 0 0.75rem 0; font-size: 0.85rem; font-weight: 600;
    letter-spacing: 0.03em; text-transform: uppercase; }
.accent-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.accent-list li { padding: 0.6rem 0.75rem 0.6rem 1.75rem; position: relative;
    background: rgba(255, 255, 255, 0.02); border-radius: 6px; }
.accent-list li::before { content: '\25CF'; position: absolute; left: 0.65rem;
    color: var(--bullet-color); font-size: 0.5rem; top: 0.85rem; }
.accent-list p { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; line-height: 1.5; margin: 0; }
.verdict-badge { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.25rem;
    border-radius: 8px; }
.badge-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--badge-color); }
.badge-label { color: var(--badge-color); font-weight: 600; font-size: 0.95rem; }
.badge-subtitle { color: rgba(255, 255, 255, 0.5); font-size: 0.8rem; }
.analysis-body { color: rgba(255, 255, 255, 0.8); line-height: 1.8; margin: 0.5rem 0; font-size: 0.95rem; }

/* ── Spacing utilities ── */
.mb-section { margin-bottom: 1.5rem; }
.mb-content { margin-bottom: 2rem; }
.mb-subsection { margin-bottom: 1.75rem; }
.mb-half { margin-bottom: 0.5rem; }
.mb-quarter { margin-bottom: 0.25rem; }
.mt-section { margin-top: 1.5rem; }
.mt-content { margin-top: 1.25rem; }
.mt-content-lg { margin-top: 2rem; }
.mt-sm { margin-top: 1rem; }

/* ── Layout utilities ── */
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.flex-end-col { display: flex; flex-direction: column; align-items: flex-end; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }
.gap-xl { gap: 1.25rem; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }

/* ── Grid patterns ── */
.grid-factors { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.domain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 2rem; }

/* ── Shared component classes ── */
.meta-badge { color: var(--text-secondary); font-size: 0.85rem; margin-left: 0.5rem; }
.text-separator { margin: 0 1rem; opacity: 0.3; }
.trend-icon { font-size: 1.2rem; }
.rec-emoji { font-size: 1.5rem; }
.highlight-box { padding: 1rem; background: var(--accent-dim); border: 1px solid var(--border-active); border-radius: 8px; }
.betting-section { margin-bottom: 2rem; padding: 1rem; background: var(--accent-dim); border: 1px solid var(--border-active); border-radius: 8px; }
.highlight-box-label { color: var(--text-secondary); }
.strategies-btn-wrapper { text-align: center; margin: 1.25rem 0 0.5rem; }
.risk-breakdown-box { margin-top: 1rem; padding: 0.75rem; background: var(--accent-dim); border-radius: 6px; }
.muted-text { color: rgba(255, 255, 255, 0.4); font-size: 0.75rem; letter-spacing: 0.05em; }
.muted-text-sm { color: rgba(255, 255, 255, 0.4); font-size: 0.8rem; }
.muted-text-md { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; }
.source-age { color: rgba(255, 255, 255, 0.4); font-size: 0.75rem; }

/* ── Verdict header (sentiment/outcome) ── */
.verdict-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 2rem; padding: 1.25rem; border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent); }
.verdict-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.verdict-dot-lg { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.verdict-label { color: var(--accent); font-weight: 600; font-size: 1.1rem; }
.verdict-label-lg { color: var(--accent); font-weight: bold; font-size: 1.2rem; }
.verdict-sublabel { color: rgba(255, 255, 255, 0.4); font-size: 0.8rem; }
.verdict-explanation { color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; margin-top: 0.25rem; }
.verdict-explanation-muted { color: rgba(255, 255, 255, 0.5); font-size: 0.85rem; margin-top: 0.25rem; }

/* ── Sources section ── */
.sources-section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.source-list { display: flex; flex-direction: column; gap: 0.75rem; }
.source-item { display: flex; gap: 0.5rem; padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02); border-radius: 6px; }
.source-index { color: var(--accent); font-weight: 600; min-width: 1.5rem; font-size: 0.85rem; }
.source-title-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.priority-badge { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 4px;
    letter-spacing: 0.03em;
    background: color-mix(in srgb, var(--priority-color) 12%, transparent);
    color: var(--priority-color);
    border: 1px solid color-mix(in srgb, var(--priority-color) 25%, transparent); }
.source-link { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; flex: 1; font-size: 0.9rem; }
.source-link:hover { color: var(--text-primary); }

/* Container (legacy — layout.css handles the main shell) */
.container {
    position: relative;
    z-index: 1;
}

/* ════════════════════════════════════════════
   HEADER & LOGO
   ════════════════════════════════════════════ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    margin-bottom: var(--space-lg);
}


.logo {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--accent);
}

.bracket {
    color: var(--text-secondary);
}

.terminal-cursor {
    color: var(--bullish);
    animation: blink 1s step-end infinite;
}

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

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

.logo-text h1 {
    font-size: var(--text-2xl);
    font-weight: bold;
    letter-spacing: 0.05em;
}

.neon-text {
    color: var(--accent);
}

.tagline {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-top: 0.3rem;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bullish-dim);
    border: 1px solid rgba(0, 230, 118, 0.25);
    border-radius: var(--pill-radius);
    font-size: var(--text-xs);
    letter-spacing: 0.03em;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ════════════════════════════════════════════
   DATA DISPLAY (tabs, tables, badges, prices)
   ════════════════════════════════════════════ */

.asset-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.asset-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.asset-tab:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.asset-tab.active {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

.tab-icon {
    font-size: 1rem;
}

/* ════════════════════════════════════════════
   FORMS & INPUTS (selects, search, controls)
   ════════════════════════════════════════════ */

.control-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.title-icon {
    color: var(--text-muted);
}

/* Coin Grid */
.coin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.coin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-md);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.coin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.coin-card:hover {
    border-color: var(--border-active);
}

.coin-card:hover::before {
    opacity: 0;
}

.coin-card.selected {
    border-color: var(--border-active);
    background: var(--accent-dim);
}

.coin-card.selected::before {
    opacity: 0;
}

.coin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.coin-symbol {
    font-size: var(--text-lg);
    font-weight: bold;
    color: var(--text-primary);
}

.coin-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.coin-icon {
    font-size: 3rem;
    text-align: center;
    opacity: 0.6;
    position: relative;
    z-index: 1;
    height: 3rem;
    line-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* AI Provider Selection */
.ai-provider-section {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
}

.ai-provider-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.ai-provider-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.ai-model-select {
    flex: 1;
    max-width: 300px;
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%238B95A5' 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 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.ai-model-select:hover {
    border-color: var(--border-active);
}

.ai-model-select:focus {
    outline: none;
    border-color: var(--accent);
}

.ai-model-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* ════════════════════════════════════════════
   BUTTONS (analyze-btn, timeframe-btn, toggles)
   ════════════════════════════════════════════ */

.analyze-btn {
    width: 100%;
    height: 48px;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #6d5dbd, #8b5cf6);
    border: none;
    border-radius: var(--btn-radius);
    color: white;
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: opacity var(--transition-fast);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
}

.analyze-btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.analyze-btn:not(:disabled):hover {
    opacity: 0.9;
}

.btn-glow {
    display: none;
}

.analyze-btn:not(:disabled):hover .btn-glow {
    display: none;
}

/* ════════════════════════════════════════════
   LOADING STATES (spinners, shimmers, progress)
   ════════════════════════════════════════════ */

.loading-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-xl);
    text-align: center;
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--bg-elevated);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--accent);
    background-size: 200% 100%;
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0%; background-position: 0% 0%; }
    50% { width: 100%; background-position: 100% 0%; }
    100% { width: 0%; background-position: 200% 0%; }
}

/* ════════════════════════════════════════════
   CARDS & PANELS (result cards, analysis)
   ════════════════════════════════════════════ */

.results-section {
    display: grid;
    gap: 2rem;
}

.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.result-header {
    background: var(--bg-elevated);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-default);
}

.result-title {
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-family: var(--font-mono);
}

.result-price {
    font-size: var(--text-xl);
    font-weight: bold;
    color: var(--bullish);
    font-family: var(--font-mono);
}

.result-body {
    padding: 2rem;
}

/* Mono meta line at the top of a result card (e.g. "TIMEFRAME 4h · 250 CANDLES") */
.result-meta {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Technical Indicators */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.indicator-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-md);
}

.indicator-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.indicator-value {
    font-size: var(--text-md);
    font-weight: bold;
    color: var(--accent);
    font-family: var(--font-mono);
}

/* AI Analysis */
.ai-analysis {
    background: var(--bg-secondary);
    border-left: 2px solid var(--border-active);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 5px;
}

.ai-analysis h3 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.ai-analysis p {
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Recommendations */
.recommendations {
    display: grid;
    gap: 1rem;
}

.recommendation-card {
    background: var(--bg-surface);
    border: 1px solid;
    border-radius: var(--card-radius);
    padding: var(--space-md);
    position: relative;
    overflow: hidden;
}

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

.recommendation-card.high-risk {
    border-color: var(--danger);
}

.recommendation-card.high-risk::before {
    background: var(--danger);
}

.recommendation-card.mid-risk {
    border-color: var(--warning);
}

.recommendation-card.mid-risk::before {
    background: var(--warning);
}

.recommendation-card.low-risk {
    border-color: var(--success);
}

.recommendation-card.low-risk::before {
    background: var(--success);
}

.recommendation-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
}

.risk-badge {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.recommendation-body {
    padding-left: 1rem;
    white-space: pre-line;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .floating-chat-btn {
        bottom: 1rem;
        right: 1rem;
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }

    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .logo-text h1 {
        font-size: 2rem;
    }

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

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

/* ════════════════════════════════════════════
   ANALYSIS RESULTS (risk, volatility, sentiment)
   ════════════════════════════════════════════ */

.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Patterns Section */
.patterns-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.pattern-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--success);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
}

.pattern-icon {
    color: var(--success);
    font-weight: bold;
}

.pattern-name {
    color: var(--text-primary);
}

/* Risk Assessment Section */
.risk-assessment {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.risk-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
}

.risk-value {
    font-size: 2rem;
}

.risk-label {
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 1rem;
}

.risk-factors {
    margin-top: 1rem;
}

.risk-factors-title {
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.risk-factor {
    color: var(--text-secondary);
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* Volatility Section */
.volatility-prediction {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.volatility-stats {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.volatility-stats strong {
    color: var(--text-primary);
}

.volatility-trend {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.volatility-prediction-text {
    text-align: left;
    color: var(--accent);
    font-style: italic;
    font-size: 0.95rem;
}

/* Market Analysis Section (Progressive Loading) */
.market-analysis {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border: 2px solid;
    border-radius: 25px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.analysis-text {
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* Meta-Analysis Section Styling */
.analysis-text h2 {
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
    padding: 0.6rem 0.75rem;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: var(--pill-radius);
}

.analysis-text h2:first-child {
    margin-top: 0;
}

.analysis-text h3 {
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-active);
}

.key-signals,
.risk-warnings {
    margin-bottom: 1rem;
}

.key-signals h4,
.risk-warnings h4 {
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.key-signals ul,
.risk-warnings ul {
    list-style: none;
    padding-left: 0;
}

.key-signals li,
.risk-warnings li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    position: relative;
}

.key-signals li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.risk-warnings li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    color: var(--warning);
}

.market-structure {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.market-structure strong {
    color: var(--accent);
}

/* Strategies Loading Indicator */
.strategies-loading {
    background: var(--bg-surface);
    border: 1px dashed var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-lg);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

@keyframes pulse-border {
    0%, 100% {
        border-color: var(--border-default);
    }
    50% {
        border-color: var(--border-active);
    }
}

/* ════════════════════════════════════════════
   CHARTS (legacy shell + timeframe buttons — prediction page)
   The asset-page live chart uses the CHART FRAME section below.
   ════════════════════════════════════════════ */

.live-chart-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
}

.timeframe-selector {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: center;
}

.timeframe-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    border-radius: var(--btn-radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.timeframe-btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.timeframe-btn.active {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

/* ════════════════════════════════════════════
   MARKET TABLE (overview, rows, prices, stocks)
   ════════════════════════════════════════════ */

.market-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.market-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.refresh-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    border-color: var(--border-active);
    color: var(--accent);
}

.refresh-btn:active .refresh-icon {
    animation: rotate-refresh 0.6s ease-in-out;
}

@keyframes rotate-refresh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Market List Table */
.market-list {
    margin-bottom: 2rem;
    overflow-x: auto;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.market-table thead {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
}

.market-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

/* Explicit column widths */
.col-name {
    width: 40% !important;
}

.col-price {
    width: 20% !important;
}

.col-change {
    width: 20% !important;
}

.col-volume {
    width: 20% !important;
}

/* Market Rows */
.market-row {
    border-bottom: 1px solid rgba(30, 42, 58, 0.5);
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
    border-left: 3px solid transparent;
}

.market-row:hover {
    background: var(--bg-elevated);
    border-left-color: var(--accent);
}

.market-row.selected {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.market-row td {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-align: left;
}

/* Column-specific alignment for body cells */
.market-row td.col-price,
.market-row td.col-change,
.market-row td.col-volume {
    text-align: left;
}

/* Asset Name Column with Icon */
.asset-name-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.asset-icon {
    font-size: 1.3rem;
    display: inline-block;
    opacity: 0.8;
    flex-shrink: 0;
}

.market-row:hover .asset-icon {
    opacity: 1;
}

.market-row.selected .asset-icon {
    opacity: 1;
}

.asset-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.asset-symbol {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
}

.asset-full-name {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.market-row:hover .asset-symbol {
    color: var(--accent);
}

.market-row.selected .asset-symbol {
    color: var(--accent);
}

/* Price Column */
.col-price {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.price-value {
    font-family: var(--font-mono);
}

.market-row:hover .price-value {
    color: var(--text-primary);
}

.market-row.selected .price-value {
    color: var(--text-primary);
}

/* Change Column */
.col-change {
    font-size: var(--text-sm);
    font-weight: 600;
}

.change-value {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--pill-radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.change-value.positive {
    color: var(--bullish);
    background: var(--bullish-dim);
}

.change-value.negative {
    color: var(--bearish);
    background: var(--bearish-dim);
}

/* Volume Column */
.col-volume {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.volume-value {
    font-family: var(--font-mono);
}

.market-row:hover .volume-value {
    color: var(--text-primary);
}

.market-row.selected .volume-value {
    color: var(--text-primary);
}

/* Loading State for Market Data */
.market-row .price-value:empty::after,
.market-row .change-value:empty::after,
.market-row .volume-value:empty::after {
    content: '...';
    color: var(--text-secondary);
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive Market Table */
@media (max-width: 768px) {
    .market-table {
        font-size: 0.85rem;
    }

    .market-table thead th,
    .market-row td {
        padding: 0.8rem 0.5rem;
    }

    .asset-symbol {
        font-size: 1rem;
    }

    .asset-full-name {
        font-size: 0.75rem;
    }

    .col-price {
        font-size: 1.1rem;
    }

    .col-change {
        font-size: 0.95rem;
    }

    .col-volume {
        display: none;
        font-size: 1.1rem;
    }

    .market-table thead th.col-volume {
        display: none;
    }

    .asset-icon {
        font-size: 1.2rem;
    }

    .asset-name-wrapper {
        gap: 0.5rem;
    }
}

/* ════════════════════════════════════════════
   STOCKS (search, filters, index badges)
   ════════════════════════════════════════════ */

/* Stocks Search Bar */
.stocks-search-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    margin-bottom: 1rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 250px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: 0.4rem 0.75rem;
    transition: border-color var(--transition-fast);
}

.search-input-wrapper:focus-within {
    border-color: var(--accent);
}

.search-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
    opacity: 0.7;
}

.stock-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    outline: none;
}

.stock-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Filter Badges */
.stocks-filter-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-badge {
    padding: 0.3rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--pill-radius);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.filter-badge:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.filter-badge.active {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

/* Stocks Count */
.stocks-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

#stocksDisplayCount {
    color: var(--accent);
    font-weight: 600;
}

/* Index Badges */
.index-badges {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}

.index-badge {
    padding: 0.15rem 0.4rem;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-radius: var(--pill-radius);
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.index-badge.sp500 {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--border-active);
}

.index-badge.nasdaq {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--border-active);
}

/* Sector Column */
.col-sector {
    width: 20% !important;
}

.sector-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Price Loading State */
.price-loading {
    color: var(--text-secondary);
    animation: loading-dots 1.5s infinite;
}

.price-error {
    color: var(--danger);
    font-size: 0.8rem;
}

/* Loading/Error Rows */
.loading-row td,
.error-row td,
.no-results-row td {
    text-align: center !important;
    padding: 2rem !important;
}

.loading-cell,
.error-cell,
.no-results-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.error-cell {
    color: var(--warning);
}

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

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

/* Responsive Stocks */
@media (max-width: 768px) {
    .stocks-search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-wrapper {
        min-width: 100%;
    }

    .stocks-filter-badges {
        justify-content: center;
    }

    .stocks-count {
        text-align: center;
    }

    .col-sector {
        display: none;
    }

    .market-table thead th.col-sector {
        display: none;
    }

    .index-badges {
        display: none;
    }
}

/* ════════════════════════════════════════════
   NAVIGATION (back-btn, analyze section)
   ════════════════════════════════════════════ */

.back-navigation {
    margin-bottom: 2rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.back-btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.back-icon {
    font-size: 1rem;
}

.back-btn:hover .back-icon {
    /* no transform */
}

/* Analyze Section */
.analyze-section {
    margin-bottom: 2rem;
}

.analyze-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.analyze-buttons-grid > button,
.analyze-buttons-grid > div {
    min-width: 0;
}

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

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

/* ════════════════════════════════════════════
   CANDLE ANALYSIS (screenshots, patterns)
   ════════════════════════════════════════════ */

.candle-analysis-result {
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.candle-analysis-content {
    padding: 0;
}

.candle-screenshot-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: var(--card-radius);
    border: 1px solid rgba(255,255,255,0.08);
}

.candle-screenshot-section .screenshot-label {
    color: rgba(255,255,255,0.45);
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.candle-screenshot {
    width: 100%;
    max-width: 800px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
}

.candle-analysis-section {
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
}

.candle-analysis-section .analysis-label {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

.candle-analysis-text {
    color: rgba(255,255,255,0.8);
    line-height: 1.7;
    font-size: 0.95rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
    letter-spacing: 0.01em;
}

.candle-analysis-text > p:first-child {
    margin-top: 0;
}

.candle-analysis-text p {
    margin: 0 0 1rem 0;
}

/* Section titles like "Patterns Found:", "Summary:" — hidden via JS class */
.candle-analysis-text .candle-section-title {
    display: none;
}

.candle-analysis-text strong {
    color: rgba(255,255,255,0.95);
    font-weight: 600;
}

.candle-analysis-text ul, .candle-analysis-text ol {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
    margin-top: 0.25rem;
}

.candle-analysis-text li {
    margin-bottom: 0.35rem;
    padding-left: 0.25rem;
    line-height: 1.6;
}

.candle-analysis-text li::marker {
    color: rgba(255,255,255,0.25);
}


/* Candle patterns list (JSON renderer) */
.candle-patterns-list {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
    letter-spacing: 0.01em;
}

/* ── Candle pattern components ── */
.candle-pattern-separator { border-top: 1px solid rgba(255, 255, 255, 0.06); margin-top: 1.5rem; padding-top: 1.5rem; }
.candle-pattern-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.candle-pattern-name { color: var(--warning); font-size: 1rem; font-weight: 600; }
.candle-type-badge { font-size: 0.75rem; padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: 500;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 19%, transparent); }
.candle-pattern-meta { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.05em; margin: -0.4rem 0 0.6rem 0.05rem; }
.pattern-annotated { margin: 0.75rem 0 0.25rem; }
.pattern-annotated .candle-screenshot { display: block; }
.pattern-annotated-caption { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.4rem; }
.candle-detail-col { display: flex; flex-direction: column; gap: 0.5rem; margin-left: 0.25rem; }
.candle-detail-block { padding: 0.5rem 0.75rem; background: rgba(255, 255, 255, 0.02); border-radius: 6px;
    font-size: 0.9rem; line-height: 1.5; }
.candle-detail-label { color: rgba(255, 255, 255, 0.45); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.candle-detail-text { color: rgba(255, 255, 255, 0.9); }
.candle-detail-text-muted { color: rgba(255, 255, 255, 0.8); }
.candle-summary { margin-top: 1.5rem; padding: 1rem; background: rgba(255, 255, 255, 0.02);
    border-radius: 8px; border-left: 3px solid rgba(255, 255, 255, 0.15); }
.candle-summary-label { color: rgba(255, 255, 255, 0.45); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.candle-summary-text { color: rgba(255, 255, 255, 0.85); font-size: 0.95rem; line-height: 1.6; }

/* Candle Analysis Config Sections */
.candle-config-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255,255,255,0.02);
    border-radius: var(--card-radius);
    border: 1px solid rgba(255,255,255,0.08);
}

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

.candle-config-section.has-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.config-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

.candle-config-section .candle-screenshot-section {
    margin-bottom: 1rem;
    padding: 0;
    background: transparent;
    border: none;
}

.candle-config-section .candle-analysis-section {
    padding: 0;
    background: transparent;
    border-radius: 0;
}

/* ── Candle Timeframe Picker ── */
/* Positioning context for any analyze button that opens a picker */
.picker-btn-wrapper {
    position: relative;
    display: inline-block;
}

.candle-tf-picker {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    background: var(--card-bg, #0f1219);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 1rem;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.candle-tf-picker-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.candle-tf-picker-header--spaced {
    margin-top: var(--space-md);
}

.candle-tf-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

/* Helper text under a picker grid */
.candle-tf-picker-note {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: calc(-1 * var(--space-xs)) 0 var(--space-sm);
    line-height: 1.4;
}

.candle-tf-chip {
    cursor: pointer;
    display: inline-flex;
}

.candle-tf-chip input { display: none; }

.candle-tf-chip span {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    transition: all 0.15s;
}

.candle-tf-chip input:checked + span {
    color: #fff;
    background: var(--accent, #3b82f6);
    border-color: var(--accent, #3b82f6);
}

.candle-tf-chip:hover span {
    border-color: rgba(255,255,255,0.25);
}

.meta-v2-candle-select {
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    margin-bottom: 0.25rem;
    outline: none;
    cursor: pointer;
}

.meta-v2-candle-select:focus {
    border-color: var(--accent, #3b82f6);
}

.meta-v2-candle-select option {
    background: #1a1e2e;
    color: rgba(255,255,255,0.9);
}

.candle-tf-run-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #fff;
    background: var(--accent, #3b82f6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.candle-tf-run-btn:hover { opacity: 0.85; }

/* ── Candle Tabs ── */
.candle-tabs-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0;
    overflow-x: auto;
}

.candle-tab-btn {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.45);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.candle-tab-btn:hover { color: rgba(255,255,255,0.7); }

.candle-tab-btn.active {
    color: var(--accent, #3b82f6);
    border-bottom-color: var(--accent, #3b82f6);
}

.candle-tab-btn.candle-tab-summary {
    margin-left: auto;
    color: var(--warning, #fbbf24);
}

.candle-tab-btn.candle-tab-summary.active {
    color: var(--warning, #fbbf24);
    border-bottom-color: var(--warning, #fbbf24);
}

.candle-tab-pane { display: none; }
.candle-tab-pane.active { display: block; }

/* ── Candle Summary ── */
.candle-summary-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}

.loading-spinner-sm {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.candle-summary-result {
    padding: 1.5rem;
    background: rgba(255,255,255,0.02);
    border-radius: var(--card-radius, 12px);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    font-size: 0.95rem;
    line-height: 1.7;
}

.candle-summary-result h1,
.candle-summary-result h2,
.candle-summary-result h3 {
    color: rgba(255,255,255,0.95);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.candle-summary-result h2 { font-size: 1.1rem; }
.candle-summary-result h3 { font-size: 1rem; }

.candle-summary-result p { margin: 0 0 0.75rem 0; }

.candle-summary-result ul, .candle-summary-result ol {
    margin-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.candle-summary-result li { margin-bottom: 0.35rem; }

.candle-summary-result strong { color: rgba(255,255,255,0.95); }

/* ════════════════════════════════════════════
   CHART FRAME (shared by PatternChart + LiveChart: toolbar, chips, HUD, replay, expand)
   ════════════════════════════════════════════ */

.tchart-frame {
    position: relative;
    background: var(--bg-canvas);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    margin-bottom: var(--space-md);
    outline: none;
    transition: border-color var(--transition-normal);
}
.tchart-frame:focus-visible,
.tchart-frame.tchart-flash { border-color: var(--border-active); }

/* Toolbar */
.tchart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-default);
}
.tchart-title-group { display: flex; align-items: baseline; gap: var(--space-sm); min-width: 0; }
.tchart-title {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.tchart-subtitle { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }

.tchart-legend { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }
.tchart-legend-item {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary);
    letter-spacing: 0.03em;
}
.tchart-swatch { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; }
.tchart-swatch-ema      { color: var(--warning); border-top-width: 1px; }
.tchart-swatch-neckline { color: var(--warning); border-top-style: dashed; }
.tchart-swatch-trend    { color: var(--accent); }
.tchart-swatch-support  { color: var(--bullish); }
.tchart-swatch-resist   { color: var(--bearish); }
.tchart-swatch-target   { color: var(--neon-purple); border-top-style: dashed; }

.tchart-controls { display: flex; align-items: center; gap: var(--space-xs); }

/* Buttons */
.tchart-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    min-width: 30px; height: 28px;
    padding: 0 var(--space-sm);
    border-radius: var(--btn-radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.tchart-btn:hover { border-color: var(--border-active); color: var(--text-primary); }
.tchart-btn:active, .tchart-btn.active { background: var(--accent-dim); border-color: var(--border-active); color: var(--accent); }
.tchart-btn-icon { padding: 0; width: 30px; }
.tchart-playing .tchart-play { background: var(--accent-dim); border-color: var(--border-active); color: var(--accent); }

/* Pattern overlay chips */
.tchart-chips {
    display: flex; flex-wrap: wrap; gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-default);
}
.tchart-chips:empty { display: none; }
.tchart-chip {
    --chip-tone: var(--accent);
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--pill-radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.03em;
    cursor: pointer;
    max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.tchart-chip.bullish { --chip-tone: var(--bullish); }
.tchart-chip.bearish { --chip-tone: var(--bearish); }
.tchart-chip.neutral { --chip-tone: var(--warning); }
.tchart-chip:hover { color: var(--text-primary); border-color: color-mix(in srgb, var(--chip-tone) 40%, transparent); }
.tchart-chip.active {
    color: var(--chip-tone);
    background: color-mix(in srgb, var(--chip-tone) 12%, transparent);
    border-color: color-mix(in srgb, var(--chip-tone) 35%, transparent);
}

/* Stage */
.tchart-stage { position: relative; overflow: hidden; }
.tchart-canvas { width: 100%; height: 420px; }
.tchart-frame { min-width: 0; max-width: 100%; }
.tchart-resizing .tchart-canvas { transition: none; }
.tchart-hud {
    position: absolute; top: var(--space-sm); left: var(--space-sm); z-index: 2;
    /* Bound the box so a long OHLC line wraps inside the chart instead of
       running past the plot area and over the price-axis labels. The box
       still shrinks to its content — this only caps it. */
    max-width: calc(100% - var(--space-sm) * 2);
    display: flex; gap: var(--space-sm); flex-wrap: wrap;
    pointer-events: none;
    font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-secondary);
    background: color-mix(in srgb, var(--bg-canvas) 78%, transparent);
    padding: 3px 8px; border-radius: var(--pill-radius);
}
.tchart-hud:empty { display: none; }
.tchart-hud b { color: var(--text-primary); font-weight: 500; }
.tchart-hud-idx { color: var(--accent); font-weight: 600; }
.tchart-hud-ema { color: var(--warning); }
.tchart-hud-ema b { color: var(--warning); }
.tchart-up { color: var(--bullish); }
.tchart-down { color: var(--bearish); }

/* Replay bar */
.tchart-replay {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-default);
}
.tchart-replaying .tchart-replay { border-top-color: var(--border-active); }
.tchart-scrub {
    flex: 1; min-width: 80px;
    -webkit-appearance: none; appearance: none;
    height: 2px; background: var(--border-default); border-radius: 2px; outline: none; cursor: pointer;
}
.tchart-scrub::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg-canvas);
    transition: background var(--transition-fast);
}
.tchart-scrub::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-canvas); }
.tchart-scrub::-moz-range-track { height: 2px; background: var(--border-default); }
.tchart-scrub-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); min-width: 64px; text-align: right; }

/* Vertical resize handle */
.tchart-resize-handle {
    height: 10px; cursor: ns-resize;
    display: flex; align-items: center; justify-content: center;
    border-top: 1px solid transparent;
    transition: border-color var(--transition-fast);
}
.tchart-resize-handle span { width: 36px; height: 3px; border-radius: 2px; background: var(--border-default); transition: background var(--transition-fast); }
.tchart-resize-handle:hover span, .tchart-resizing .tchart-resize-handle span { background: var(--accent); }
.tchart-resizing { user-select: none; }

/* Expanded (fullscreen overlay) */
.tchart-overlay {
    position: fixed; inset: 0; z-index: var(--z-modal);
    background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.tchart-overlay.open { opacity: 1; }
.tchart-overlay-inner { width: min(100%, 1600px); }
.tchart-overlay-open { overflow: hidden; }
.tchart-expanded { margin-bottom: 0; border-color: var(--border-active); }
.tchart-expanded .tchart-resize-handle { display: none; }
.tchart-expanded [data-pc="expand"] { background: var(--accent-dim); border-color: var(--border-active); color: var(--accent); }

/* "View on chart" link inside pattern lists */
.tchart-focus-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--pill-radius);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.tchart-focus-btn:hover { border-color: var(--border-active); color: var(--accent); }

/* ── Live chart additions (asset page) ── */
.live-chart-section:has(> .tchart-frame) { padding: 0; border: 0; background: transparent; }
.tchart-live { margin-bottom: 0; }
.tchart-live .tchart-title-group { gap: var(--space-md); }
.tchart-live .tchart-title { font-size: var(--text-md); }
.tchart-price {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    transition: color var(--transition-normal);
}
.tchart-price.tick-up { color: var(--bullish); }
.tchart-price.tick-down { color: var(--bearish); }
.tchart-change {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--pill-radius);
    color: var(--text-secondary);
    background: var(--neutral-dim);
}
.tchart-change.positive { color: var(--bullish); background: var(--bullish-dim); }
.tchart-change.negative { color: var(--bearish); background: var(--bearish-dim); }
.tchart-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.06em;
    color: var(--text-muted);
}
.tchart-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.tchart-status[data-mode="live"] { color: var(--bullish); }
.tchart-status[data-mode="live"] .tchart-status-dot { background: var(--bullish); animation: pulse-dot 2s ease-in-out infinite; }
.tchart-status[data-mode="polling"] { color: var(--text-secondary); }
.tchart-status[data-mode="polling"] .tchart-status-dot { background: var(--warning); }
.tchart-status[data-mode="replay"] { color: var(--accent); }
.tchart-status[data-mode="replay"] .tchart-status-dot { background: var(--accent); }
.tchart-status[data-mode="error"] { color: var(--bearish); }
.tchart-status[data-mode="error"] .tchart-status-dot { background: var(--bearish); }

/* Chip lanes.
   `display: contents` makes the wrapper invisible to layout, so the desktop
   chip bar lays out exactly as if the lanes were not wrapped at all. Narrow
   viewports switch it to a real box and collapse the lane behind its trigger
   (see mobile.css). */
.tchart-lane { display: contents; }
.tchart-lane-trigger { display: none; }

/* On-chart fullscreen affordance — phone widths only, where the toolbar
   controls are hidden. */
.tchart-expand-fab {
    display: none;
    position: absolute;
    right: var(--space-sm);
    bottom: var(--space-sm);
    z-index: 3;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tchart-expand-fab:active { color: var(--accent); border-color: var(--border-active); }
.tchart-expanded .tchart-expand-fab { color: var(--accent); border-color: var(--border-active); }

/* Chip bar: timeframes · indicators · tools */
.tchart-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-default);
}
.tchart-bar .tchart-chips { padding: 0; border: 0; }
.tchart-timeframes .tchart-chip { min-width: 34px; text-align: center; }
.tchart-chip-group { position: relative; }
.tchart-chip-pop.open, .tchart-chip[data-tool].active { color: var(--accent); background: var(--accent-dim); border-color: var(--border-active); }
.tchart-chip-muted { color: var(--text-muted); }
.tchart-caret { display: inline-block; width: 0; height: 0; margin-left: 5px; vertical-align: 2px;
    border-left: 3px solid transparent; border-right: 3px solid transparent; border-top: 4px solid currentColor; }
.tchart-popover {
    display: none;
    position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-dropdown);
    min-width: 150px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-xs);
}
.tchart-popover.open { display: flex; flex-direction: column; gap: 2px; }
.tchart-popover-item {
    display: flex; align-items: center; gap: var(--space-sm);
    width: 100%; text-align: left;
    background: transparent; border: 1px solid transparent; border-radius: var(--btn-radius);
    color: var(--text-secondary);
    padding: 6px 10px;
    font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.03em;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.tchart-popover-item::before {
    content: ''; width: 12px; height: 12px; border-radius: 3px;
    border: 1px solid var(--border-default); background: var(--bg-canvas);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.tchart-popover-item:hover { color: var(--text-primary); background: var(--accent-dim); }
.tchart-popover-item.active { color: var(--accent); }
.tchart-popover-item.active::before { background: var(--accent); border-color: var(--accent); }

/* Type-a-period row (SMA / EMA) */
.tchart-popover-custom {
    display: flex; align-items: center; gap: var(--space-xs);
    margin-top: var(--space-xs); padding-top: var(--space-xs);
    border-top: 1px solid var(--border-default);
}
.tchart-popover-input {
    flex: 1; min-width: 0;
    background: var(--bg-canvas);
    border: 1px solid var(--border-default); border-radius: var(--btn-radius);
    color: var(--text-primary);
    padding: 5px 8px;
    font-family: var(--font-mono); font-size: var(--text-xs);
    appearance: textfield; -moz-appearance: textfield;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.tchart-popover-input::-webkit-outer-spin-button,
.tchart-popover-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tchart-popover-input:focus { outline: none; border-color: var(--border-active); }
.tchart-popover-input.invalid { border-color: var(--bearish); color: var(--bearish); }
.tchart-popover-add {
    background: transparent;
    border: 1px solid var(--border-default); border-radius: var(--btn-radius);
    color: var(--text-secondary);
    padding: 5px 8px;
    font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.03em;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.tchart-popover-add:hover { color: var(--accent); background: var(--accent-dim); border-color: var(--border-active); }

/* Legend swatch for indicator overlays (colour from --ind) */
.tchart-swatch-ind { color: var(--ind, var(--accent)); }
.tchart-hud-ind { color: var(--ind, var(--accent)); }
.tchart-hud-ind b { color: var(--ind, var(--accent)); }
.tchart-hud-vol b { color: var(--text-secondary); }
.tchart-swatch-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ind, var(--accent)); }

/* Oscillator panes */
.tchart-panes:empty { display: none; }
.tchart-pane { border-top: 1px solid var(--border-default); }
.tchart-pane-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px var(--space-md);
    font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-secondary);
}
.tchart-pane-close { width: 22px; height: 22px; min-width: 22px; font-size: var(--text-sm); }
.tchart-pane-canvas { width: 100%; height: 140px; }

/* Selected-drawing actions (floats over the stage) */
.tchart-drawing-actions {
    display: none;
    position: absolute; top: var(--space-sm); right: var(--space-sm); z-index: 3;
    align-items: center; gap: var(--space-xs);
    padding: 4px 6px;
    background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
    border: 1px solid var(--border-active);
    border-radius: var(--card-radius);
}
.tchart-drawing-actions.open { display: flex; }
.tchart-drawing-actions-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); letter-spacing: 0.05em; padding: 0 6px; }
.tchart-btn-danger:hover { color: var(--bearish); border-color: color-mix(in srgb, var(--bearish) 40%, transparent); }
.tchart-actions-group { display: inline-flex; gap: 2px; }
.tchart-width-dot { display: block; width: 14px; height: var(--w, 2px); background: currentColor; border-radius: 2px; }
.tchart-chip[data-magnet].active { color: var(--accent); background: var(--accent-dim); border-color: var(--border-active); }
.tchart-mini-range {
    width: 72px; height: 2px; margin: 0 4px;
    -webkit-appearance: none; appearance: none;
    background: var(--border-default); border-radius: 2px; outline: none; cursor: pointer;
}
.tchart-mini-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg-canvas);
}
.tchart-mini-range::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-canvas); }
.tchart-mini-range::-moz-range-track { height: 2px; background: var(--border-default); }
.tchart-armed .tchart-canvas { cursor: crosshair; }

/* Save-state indicator for persisted drawings */
.tchart-save-state { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); letter-spacing: 0.05em; margin-left: var(--space-xs); }
.tchart-save-state:empty { display: none; }
.tchart-save-state[data-state="saving"] { color: var(--text-secondary); }
.tchart-save-state[data-state="saved"] { color: var(--bullish); }
.tchart-save-state[data-state="error"] { color: var(--bearish); }
.tchart-save-state[data-state="offline"] { color: var(--warning); cursor: pointer; }

@media (max-width: 900px) {
    .tchart-live .tchart-legend { display: none; }
}

@media (max-width: 720px) {
    .tchart-legend { display: none; }
    .tchart-canvas { height: 320px; }
}

/* ════════════════════════════════════════════
   CHAT COMPANION (drawer, messages, input)
   ════════════════════════════════════════════ */

.floating-chat-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: normal;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    z-index: 900;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.floating-chat-btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.chat-icon-small {
    font-size: 1rem;
    opacity: 0.8;
}

.chat-text {
    font-size: 0.85rem;
}

.floating-chat-btn.chat-open {
    border-color: var(--border-active);
    color: var(--accent);
    background: var(--accent-dim);
}

.floating-chat-btn.chat-open .chat-icon-small {
    opacity: 1;
}

/* Responsive Asset Page */
@media (max-width: 768px) {
    .back-btn {
        font-size: 0.8rem;
        padding: 0.6rem 1.2rem;
    }
}

/* AI Chat Drawer */
.chat-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.chat-overlay.active {
    display: block;
}

.chat-drawer {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-default);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    min-width: 350px;
    max-width: 90vw;
}

.chat-drawer.active {
    right: 0;
}

.chat-drawer.resizing {
    transition: none;
}

/* Resize Handle */
.chat-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 100%;
    cursor: ew-resize;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-resize-handle:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-resize-handle:hover .resize-indicator {
    opacity: 0.8;
}

.resize-indicator {
    width: 3px;
    height: 60px;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.3;
    transition: all 0.2s ease;
}

.chat-drawer.resizing .resize-indicator {
    opacity: 0.8;
}

.chat-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-icon {
    font-size: 1.5rem;
    animation: pulse-chat 2s ease-in-out infinite;
}

@keyframes pulse-chat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chat-header-title h3 {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.close-chat-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-chat-btn:hover {
    background: rgba(255, 0, 85, 0.1);
    border-color: var(--danger);
    color: var(--danger);
    transform: rotate(90deg);
}

.chat-context-indicator {
    padding: 0.75rem var(--space-md);
    background: var(--accent-dim);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-xs);
    color: var(--accent);
    font-family: var(--font-mono);
}

.chat-context-indicator.loading {
    background: rgba(255, 170, 0, 0.1);
    border-color: rgba(255, 170, 0, 0.2);
    color: var(--warning);
}

.context-icon {
    font-size: 1.2rem;
}

.context-text {
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* Live Data Toggle */
.live-data-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
    border-color: var(--border-active);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
    background: var(--accent);
}

.toggle-label {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.live-data-toggle:has(input:checked) .toggle-label {
    color: var(--accent);
    font-weight: 600;
}

.toggle-info {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.toggle-info:hover {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

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

.chat-message {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: slideInMessage 0.3s ease-out;
}

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

.chat-message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    border-radius: var(--btn-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.65rem;
    flex-shrink: 0;
    flex-grow: 0;
    border: 1px solid;
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
    padding: 0 0.25rem;
}

.ai-message .message-avatar {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

.user-message .message-avatar {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message-text {
    background: var(--bg-elevated);
    padding: 0.75rem;
    border-radius: var(--card-radius);
    line-height: 1.6;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    font-size: var(--text-sm);
}

.ai-message .message-text {
    border-left: 2px solid var(--accent);
}

.user-message .message-text {
    border-right: 2px solid var(--text-muted);
    background: var(--bg-surface);
}

/* Rich text formatting in chat messages */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    color: var(--text-primary);
    margin: 0.75rem 0 0.5rem 0;
    font-weight: bold;
}

.message-text h1 { font-size: 1.4rem; }
.message-text h2 { font-size: 1.3rem; }
.message-text h3 { font-size: 1.2rem; }
.message-text h4 { font-size: 1.1rem; }
.message-text h5 { font-size: 1rem; }
.message-text h6 { font-size: 0.95rem; }

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child {
    margin-top: 0;
}

.message-text p {
    margin: 0.5rem 0;
}

.message-text p:first-child {
    margin-top: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong,
.message-text b {
    color: var(--text-primary);
    font-weight: bold;
}

.message-text em,
.message-text i {
    color: var(--text-secondary);
    font-style: italic;
}

.message-text ul,
.message-text ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.message-text ul li::marker {
    color: var(--text-secondary);
}

.message-text ol li::marker {
    color: var(--accent);
    font-weight: bold;
}

.message-text code {
    background: rgba(0, 0, 0, 0.3);
    color: var(--accent);
    padding: 0.15rem 0.35rem;
    border-radius: var(--pill-radius);
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid var(--border-default);
}

.message-text a,
.message-text .chat-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--border-active);
    transition: color var(--transition-fast);
    word-break: break-all;
}

.message-text a:hover,
.message-text .chat-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: 0.75rem;
    margin: 0.75rem 0;
    overflow-x: auto;
}

.message-text pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

.message-text blockquote {
    border-left: 2px solid var(--border-active);
    margin: 0.75rem 0;
    padding-left: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.message-text a {
    color: var(--accent);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.message-text a:hover {
    color: var(--text-primary);
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.message-text th,
.message-text td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.message-text th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 600;
}

.message-text tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

/* Chat Screenshot Display */
.chat-screenshot-container {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
}

.chat-screenshot-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-family: var(--font-mono);
}

.chat-screenshot-preview {
    width: 100%;
    max-width: 400px;
    border-radius: var(--btn-radius);
    border: 1px solid var(--border-default);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.chat-screenshot-preview:hover {
    border-color: var(--border-active);
}

.chat-screenshot-download {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    background: var(--accent);
    color: var(--bg-canvas);
    text-decoration: none;
    border-radius: var(--pill-radius);
    font-size: var(--text-xs);
    font-weight: 600;
    transition: opacity var(--transition-fast);
}

.chat-screenshot-download:hover {
    opacity: 0.85;
}

.chat-loading {
    padding: 0.75rem var(--space-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-default);
}

.chat-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--bg-surface);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.chat-loading-text {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
}

.chat-input-container {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-controls-row {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 0.75rem;
}

.chat-model-selector {
    display: flex;
    align-items: center;
}

.chat-model-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: 0.4rem 0.6rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: border-color var(--transition-fast);
    width: auto;
    min-width: 160px;
}

.chat-model-select:hover {
    border-color: var(--border-active);
}

.chat-model-select:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-model-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem;
}

.chat-input-row {
    display: flex;
    gap: 1rem;
}

.chat-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-chat-btn {
    background: var(--accent);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--card-radius);
    color: var(--bg-canvas);
    font-size: 1.1rem;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-chat-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.send-chat-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-chat-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.send-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.send-chat-btn:hover:not(:disabled) .send-icon {
    transform: translateX(3px);
}

/* Responsive Chat Drawer */
@media (max-width: 768px) {
    .chat-drawer {
        width: 100% !important;
        right: -100% !important;
        max-width: 100% !important;
    }

    .chat-drawer.active {
        right: 0 !important;
    }

    .chat-resize-handle {
        display: none;
    }
}

/* ════════════════════════════════════════════
   PREDICTIONS (cards, analysis, factors)
   ════════════════════════════════════════════ */
.predictions-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    margin: 1rem 0;
    overflow: hidden;
}

.predictions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.predictions-header:hover {
    background: var(--bg-elevated);
}

.predictions-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.predictions-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.predictions-toggle {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.predictions-content {
    padding: 0.75rem;
}

.predictions-loading {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
}

.predictions-loading .loading-dot {
    animation: blink 1.4s infinite both;
}

.predictions-loading .loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.predictions-loading .loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

.predictions-empty {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.predictions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.prediction-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: 0.75rem;
    transition: border-color var(--transition-fast);
}

.prediction-card:hover {
    border-color: var(--border-active);
}

.prediction-question {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.prediction-question:hover {
    color: var(--accent);
}

.prediction-bar-container {
    position: relative;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.prediction-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bullish), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.prediction-percentage {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.prediction-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.prediction-volume {
    color: var(--neon-orange);
}

.prediction-end {
    color: var(--text-secondary);
}

.predictions-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

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

.predictions-refresh {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--pill-radius);
    cursor: pointer;
    font-size: var(--text-xs);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.predictions-refresh:hover {
    border-color: var(--border-active);
    color: var(--accent);
}

.predictions-show-more {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.75rem;
    background: transparent;
    border: 1px dashed var(--border-default);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    border-radius: var(--pill-radius);
}

.predictions-show-more:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--border-active);
    border-style: solid;
    color: var(--accent);
}

.predictions-show-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Placeholder Buttons and Coming Soon Badge */
.placeholder-btn,
.placeholder-tab {
    opacity: 0.5;
    cursor: not-allowed !important;
    position: relative;
}

.placeholder-btn:hover,
.placeholder-tab:hover {
    transform: none !important;
    box-shadow: none !important;
}

.coming-soon-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, var(--neon-orange), var(--danger));
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.4);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.asset-tab.placeholder-tab {
    position: relative;
}

.asset-tab.placeholder-tab .coming-soon-badge {
    top: -6px;
    right: -6px;
    font-size: 0.5rem;
    padding: 1px 4px;
}

/* Sidebar & hamburger styles are in layout.css */

/* ════════════════════════════════════════════
   PREDICTIONS MARKET LIST (filters, grid)
   ════════════════════════════════════════════ */

.predictions-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.predictions-category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.prediction-category-tab {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.prediction-category-tab:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
}

.prediction-category-tab.active {
    background: var(--accent-dim);
    border-color: var(--border-active);
    color: var(--accent);
}

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

.predictions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.predictions-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-secondary);
}

.prediction-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: 1rem;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.prediction-card:hover {
    border-color: var(--border-active);
}

.prediction-question {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.prediction-odds-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
}

.prediction-odds-yes {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    height: 100%;
}

.prediction-odds-no {
    background: linear-gradient(135deg, #ff4444, #cc3333);
    height: 100%;
}

.prediction-odds-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
}

.prediction-yes-label {
    color: #00ff88;
}

.prediction-no-label {
    color: #ff4444;
}

.prediction-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.prediction-volume {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.prediction-tag {
    padding: 0.15rem 0.4rem;
    background: var(--accent-dim);
    border-radius: var(--pill-radius);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 500;
}

.prediction-end-date {
    color: var(--text-muted);
}

.predictions-load-more {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.predictions-load-more .load-more-btn {
    padding: 0.5rem 1.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-secondary);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.predictions-load-more .load-more-btn:hover {
    border-color: var(--border-active);
    color: var(--accent);
}

.predictions-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* (Meta V2 shimmer animations) */

/* ════════════════════════════════════════════
   META-ANALYSIS V2 (domain cards, synthesis, scoreboard)
   ════════════════════════════════════════════ */

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

.mv2-shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.03) 75%, transparent 100%);
    background-size: 200% 100%;
    animation: mv2-shimmer 2s ease-in-out infinite;
    border-radius: var(--btn-radius);
}

.mv2-shimmer-block {
    height: 1rem;
    margin: 0.4rem 0;
    border-radius: 4px;
}

.mv2-progress-section {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.mv2-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.mv2-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--text-muted));
    border-radius: 2px;
    width: 0%;
    transition: width 0.6s ease-out;
}

.mv2-status-text {
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.mv2-domain-card {
    transition: all 0.3s ease;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 8px;
    padding: 1rem;
}

.mv2-domain-card-interactive {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mv2-domain-card-interactive:hover {
    border-color: var(--accent);
}

.mv2-domain-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.mv2-domain-icon { font-size: 1.2rem; }
.mv2-domain-label { font-size: 0.85rem; letter-spacing: 0.03em; text-transform: uppercase; font-weight: 600;
    color: var(--accent); }
.mv2-domain-arrow { margin-left: auto; opacity: 0.4; font-size: 0.8rem; }
.mv2-domain-body { font-size: 0.9rem; color: rgba(255, 255, 255, 0.8); line-height: 1.5; }

.mv2-domain-loading {
    opacity: 0.7;
}

.mv2-domain-complete {
    opacity: 1;
    cursor: pointer;
}

.mv2-domain-complete:hover {
    border-color: var(--accent);
}

.mv2-domain-error {
    opacity: 0.5;
    border-color: #f87171 !important;
}

.mv2-domain-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes mv2-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mv2-fade-in {
    animation: mv2-fade-in 0.5s ease-out forwards;
}

.mv2-synthesis-loading {
    border: 1px dashed var(--border-default);
    border-radius: var(--card-radius);
    padding: 1rem;
    animation: pulse-border 2s ease-in-out infinite;
}

/* ── Metric buttons row ── */
.mv2-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.mv2-metric-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-mono);
    transition: border-color var(--transition-fast);
}

.mv2-metric-btn:hover {
    border-color: var(--border-active);
}

.mv2-metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mv2-metric-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
}

/* ── Tooltips ── */
.mv2-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    cursor: help;
    flex-shrink: 0;
}

.mv2-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: #1a1f2e;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    z-index: 100;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.mv2-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border-color);
}

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

/* ── Metric popup overlay ── */
.mv2-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mv2-fade-in 0.2s ease-out;
}

.mv2-popup-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    max-width: 640px;
    width: 92%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    font-family: var(--font-mono);
}

.mv2-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    transition: color 0.2s;
}

.mv2-popup-close:hover {
    color: white;
}

.mv2-back-btn {
    background: none;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: var(--btn-radius);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    margin-bottom: 1.25rem;
    transition: border-color var(--transition-fast);
}

.mv2-back-btn:hover {
    border-color: var(--border-active);
}

/* ── Inline-style replacements ── */
.mv2-check {
    color: #4ade80;
}

.mv2-error {
    color: #f87171;
}

.mv2-arrow {
    margin-left: 0.25rem;
    opacity: 0.4;
    font-size: 0.8rem;
}

.mv2-section-title--flush {
    margin-top: 0;
}

.mv2-domain-summary {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.mv2-popup-section {
    margin-bottom: 1rem;
}

.mv2-popup-desc {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-size: 0.9rem;
}

.mv2-popup-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
}

.mv2-text-separator {
    margin: 0 1rem;
    opacity: 0.3;
}

.mv2-prediction-text {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

.mv2-text-muted {
    color: rgba(255, 255, 255, 0.5);
}

.mv2-confidence-label {
    opacity: 0.6;
    font-size: 0.8rem;
}

.mv2-key-signals {
    margin-top: 1.25rem;
}

.mv2-list-section {
    margin-top: 1rem;
}

.mv2-accent {
    color: var(--accent);
}

/* ════════════════════════════════════════════
   POSITIONING ANALYSIS (metrics grid, tooltips)
   ════════════════════════════════════════════ */

.pos-tooltip-trigger {
    position: relative;
    display: inline-flex;
}

.pos-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1f2e;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: normal;
    text-transform: none;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    width: 220px;
    white-space: normal;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
}

.pos-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(255,255,255,0.12);
}

.pos-tooltip-trigger:hover .pos-tooltip {
    display: block;
}

/* ── Positioning card components ── */
.pos-card-elevated { border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3); }
.pos-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.pos-title { color: rgba(255, 255, 255, 0.92); font-size: 1.25rem; font-weight: 600; margin: 0 0 0.25rem 0; letter-spacing: -0.01em; }
.pos-subtitle { color: rgba(255, 255, 255, 0.4); font-size: 0.85rem; }
.pos-metric-card { position: relative; padding: 1.25rem 1rem; background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--card-radius); }
.pos-metric-label { color: rgba(255, 255, 255, 0.45); font-size: 0.85rem; font-weight: 500;
    letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.35rem; }
.pos-metric-value { color: var(--accent); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.pos-metric-sub { color: rgba(255, 255, 255, 0.35); font-size: 0.8rem; margin-top: 0.4rem; }
.pos-tooltip-icon { cursor: help; font-size: 1rem; text-transform: none; }
.pos-tooltip-icon-inner { opacity: 0.5; }
.pos-data-quality { font-size: 0.8rem; color: var(--accent); }
.pos-squeeze-box { margin-bottom: 1.75rem; padding: 1rem 1.25rem; border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 3%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent); }

/* ════════════════════════════════════════════
   SETTINGS PAGE (toggles, notifications, layout)
   ════════════════════════════════════════════ */

.settings-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: var(--text-secondary);
}

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.setting-info {
    flex: 1;
}

.setting-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.setting-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 56px;
    height: 28px;
    margin-left: 1rem;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 28px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
    border-color: var(--border-active);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(28px);
    background-color: var(--accent);
}

.toggle-switch input:focus + .toggle-slider {
    border-color: var(--accent);
}

/* Save notification */
.save-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: var(--bg-canvas);
    padding: 0.75rem 1.25rem;
    border-radius: var(--card-radius);
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.save-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.feature-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-weight: 600;
}

.feature-badge.premium {
    background: linear-gradient(135deg, #ff6b00, #ff9500);
    color: white;
}

/* ════════════════════════════════════════════
   PREDICTION PAGE (detail view, odds, chart, analysis)
   ════════════════════════════════════════════ */

/* Prediction Page Layout */
.prediction-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.prediction-title-area {
    flex: 1;
    min-width: 280px;
}

.prediction-question-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0 0 0.5rem 0;
}

.prediction-badges {
    display: flex;
    gap: 0.5rem;
}

.prediction-category-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--accent-dim);
    color: var(--text-secondary);
    border: 1px solid var(--border-active);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prediction-meta-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

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

.meta-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.polymarket-link {
    color: var(--accent);
    text-decoration: none;
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    transition: border-color var(--transition-fast);
}

.polymarket-link:hover {
    background: var(--accent-dim);
    border-color: var(--border-active);
}

/* Content Row - Odds + Chart side by side */
.prediction-content-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

/* Odds Panel */
.prediction-odds-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prediction-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.odds-compact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.odds-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
}

.odds-item.yes {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.odds-item.no {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.odds-item .odds-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.odds-item .odds-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.odds-item.yes .odds-value {
    color: #00ff88;
}

.odds-item.no .odds-value {
    color: #ff4444;
}

.odds-bar-compact {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.bar-yes {
    background: linear-gradient(90deg, #00ff88, #00cc6a);
    height: 100%;
    transition: width 0.3s;
}

.bar-no {
    background: linear-gradient(90deg, #ff4444, #cc3333);
    height: 100%;
    transition: width 0.3s;
}

/* Chart Panel */
.prediction-chart-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.chart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chart-panel-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.probability-chart {
    height: 180px;
    width: 100%;
}

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

    .prediction-odds-panel {
        order: -1;
    }

    .prediction-header-row {
        flex-direction: column;
    }

    .prediction-meta-info {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

/* Single button layout */
.analyze-buttons-single {
    display: flex;
    justify-content: center;
}

.analyze-buttons-single .analyze-btn {
    min-width: 200px;
}

/* Other styles */
.prediction-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.back-link-error {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.back-link-error:hover {
    color: var(--text-primary);
}

/* Sentiment badges */
.result-sentiment {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sentiment-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sentiment-badge.bullish {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.sentiment-badge.bearish {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.sentiment-badge.neutral {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.confidence-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.web-analysis-content {
    line-height: 1.7;
    color: var(--text-secondary);
}

.web-analysis-content h1,
.web-analysis-content h2,
.web-analysis-content h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.web-analysis-content ul,
.web-analysis-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.web-analysis-content li {
    margin-bottom: 0.5rem;
}

.web-analysis-content strong {
    color: var(--text-primary);
}

.web-sources {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.web-sources h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.web-sources ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.web-sources li {
    margin-bottom: 0.25rem;
}

.web-sources a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}

.web-sources a:hover {
    text-decoration: underline;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ff4444;
    padding: 1rem;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 8px;
}

.error-icon {
    font-size: 1.5rem;
}

/* Category badge colors */
.category-politics { background: rgba(59, 130, 246, 0.2); color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); }
.category-sports { background: rgba(34, 197, 94, 0.2); color: #22c55e; border-color: rgba(34, 197, 94, 0.3); }
.category-crypto { background: rgba(249, 115, 22, 0.2); color: #f97316; border-color: rgba(249, 115, 22, 0.3); }
.category-tech { background: rgba(168, 85, 247, 0.2); color: #a855f7; border-color: rgba(168, 85, 247, 0.3); }
.category-finance { background: rgba(234, 179, 8, 0.2); color: #eab308; border-color: rgba(234, 179, 8, 0.3); }
.category-geopolitics { background: rgba(239, 68, 68, 0.2); color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.category-science { background: rgba(14, 165, 233, 0.2); color: #0ea5e9; border-color: rgba(14, 165, 233, 0.3); }
.category-entertainment { background: rgba(236, 72, 153, 0.2); color: #ec4899; border-color: rgba(236, 72, 153, 0.3); }
.category-general { background: rgba(156, 163, 175, 0.2); color: #9ca3af; border-color: rgba(156, 163, 175, 0.3); }

/* ════════════════════════════════════════════
   AUTH — Login Modal & Sidebar Auth Section
   ════════════════════════════════════════════ */

/* ── Login Modal Overlay ── */
.login-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.login-modal-overlay.active { display: flex; }

.login-modal-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    width: 360px; max-width: 90vw;
    text-align: center;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.login-modal-close {
    position: absolute; top: 0.75rem; right: 1rem;
    background: none; border: none;
    color: rgba(255, 255, 255, 0.4); font-size: 1.5rem;
    cursor: pointer; line-height: 1;
}
.login-modal-close:hover { color: rgba(255, 255, 255, 0.8); }

.login-modal-header {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.login-modal-logo {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem; color: rgba(255, 255, 255, 0.6);
}
.login-modal-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.1rem; font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.login-reason {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin: 0 0 1.75rem;
}

.login-error {
    display: none;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--bearish);
    background: var(--bearish-dim);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: var(--space-xs) var(--space-sm);
    margin: 0 0 var(--space-sm);
    text-align: left;
}
.login-error.active { display: block; }

.login-modal-buttons {
    display: flex; flex-direction: column; gap: 0.75rem;
}

.login-oauth-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    width: 100%; padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem; font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.login-oauth-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ── Sidebar Auth Section ── */
.sidebar-auth {
    margin-top: auto;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-login-btn {
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%; padding: 0.5rem 0.75rem;
    background: none; border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.auth-login-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.auth-user-info {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.25rem 0; overflow: hidden;
}

.auth-avatar {
    width: 28px; height: 28px;
    border-radius: 50%; flex-shrink: 0;
    object-fit: cover;
}
.auth-avatar-initials {
    display: flex; align-items: center; justify-content: center;
    background: rgba(99, 179, 237, 0.2);
    color: rgba(99, 179, 237, 0.9);
    font-size: 0.7rem; font-weight: 600;
}

.auth-user-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.auth-logout-btn {
    background: none; border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem; cursor: pointer;
    padding: 0.25rem 0;
    transition: color 0.15s;
}
.auth-logout-btn:hover { color: rgba(255, 255, 255, 0.7); }

/* ── Collapsed sidebar: hide auth labels ── */
.sidebar.collapsed .auth-user-name,
.sidebar.collapsed .auth-logout-btn { display: none; }
.sidebar.collapsed .auth-login-btn .sidebar-nav-label { display: none; }
.sidebar.collapsed .auth-login-btn { justify-content: center; padding: 0.5rem; }


/* ==========================================
   MY ANALYSES PAGE
   ========================================== */
.my-analyses-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.my-analyses-header {
    margin-bottom: 1.5rem;
}

.my-analyses-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.25rem;
}

/* Filter bar */
.my-analyses-filters {
    margin-bottom: 1.5rem;
}

.my-analyses-filters .filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-select,
.filter-search {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    outline: none;
    transition: border-color 0.15s;
}

.filter-select:focus,
.filter-search:focus {
    border-color: rgba(255, 255, 255, 0.25);
}

.filter-select option {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.85);
}

.filter-search {
    flex: 1;
    min-width: 160px;
}

/* Auth gate */
.my-analyses-auth-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Analysis list */
.my-analyses-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.analyses-loading {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.analysis-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    color: inherit;
    gap: 1rem;
}

.analysis-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.analysis-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 140px;
}

.analysis-item-symbol {
    font-weight: 600;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.92);
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

.analysis-item-name {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
}

.analysis-item-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.analysis-type-badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

.analysis-sentiment-badge {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

.analysis-confidence-badge {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

.analysis-item-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 100px;
    justify-content: flex-end;
}

.analysis-provider {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
}

.analysis-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.35);
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

/* Load more */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

/* Empty state */
.my-analyses-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
}

.my-analyses-empty .btn-primary {
    margin-top: 1rem;
}

/* Saved analysis indicator banner */
.saved-analysis-indicator {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    color: rgba(59, 130, 246, 0.8);
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
}

/* Responsive */
@media (max-width: 640px) {
    .analysis-list-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .analysis-item-center {
        justify-content: flex-start;
        order: 3;
        width: 100%;
    }
    .analysis-item-right {
        min-width: auto;
    }
}

/* Generic buttons used on my-analyses page */
.btn-primary {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: rgba(59, 130, 246, 0.9);
    font-size: 0.8rem;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
}
.btn-primary:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ════════════════════════════════════════════
   WATCHLIST MANAGER — Manage-watchlist modal
   ════════════════════════════════════════════ */

.wl-modal-overlay {
    position: fixed; inset: 0; z-index: var(--z-modal, 9999);
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.wl-modal-overlay.active { display: flex; }

.wl-modal-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--card-radius);
    padding: var(--space-lg);
    width: 720px; max-width: 94vw;
    max-height: 84vh;
    display: flex; flex-direction: column;
}

.wl-modal-close {
    position: absolute; top: var(--space-sm); right: var(--space-md);
    background: none; border: none;
    color: var(--text-muted); font-size: var(--text-xl);
    cursor: pointer; line-height: 1;
}
.wl-modal-close:hover { color: var(--text-primary); }

.wl-modal-title {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-md);
}

#wlModalBody { overflow-y: auto; min-height: 0; }

.wl-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}
@media (max-width: 640px) {
    .wl-columns { grid-template-columns: 1fr; }
}

.wl-col { min-width: 0; }

.wl-col-title {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-sm);
}

.wl-list {
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    background: var(--bg-canvas);
    max-height: 48vh;
    overflow-y: auto;
}

/* Unified search results render directly on the modal — no nested box */
.wl-search {
    width: 100%;
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.wl-search-results {
    max-height: 48vh;
    overflow-y: auto;
}

/* Groups (category blocks) */
.wl-group { border-bottom: 1px solid var(--border-default); }
.wl-group:last-child { border-bottom: none; }

.wl-group-header {
    display: flex; align-items: center; gap: var(--space-xs);
    padding: var(--space-sm) var(--space-sm) 2px;
}

.wl-group-name {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex: 1; min-width: 0;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.wl-group-name--muted { color: var(--text-muted); }

.wl-group-name--editable { cursor: pointer; }
.wl-group-name--editable:hover { color: var(--accent-hover); }

/* Item rows (both list and add-results) */
.wl-item {
    display: flex; align-items: center; gap: var(--space-sm);
    padding: 5px var(--space-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}
.wl-item:hover { background: var(--bg-elevated); }

.wl-item-icon { width: 20px; text-align: center; flex-shrink: 0; }

.wl-item-symbol {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 48px;
}

.wl-item-name {
    color: var(--text-muted);
    flex: 1; min-width: 0;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-family: var(--font-sans);
}

.wl-empty {
    padding: var(--space-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.wl-added {
    font-size: var(--text-xs);
    color: var(--bullish);
    white-space: nowrap;
}

/* Controls */
.wl-input, .wl-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 4px var(--space-sm);
}
.wl-input:focus, .wl-select:focus {
    outline: none;
    border-color: var(--border-active);
}
.wl-input--inline { width: 100%; }

.wl-item-move { max-width: 110px; }

.wl-btn {
    background: var(--accent-dim);
    border: 1px solid var(--border-active);
    border-radius: var(--btn-radius);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    padding: 4px var(--space-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color var(--transition-fast);
}
.wl-btn:hover { border-color: var(--accent); }

.wl-icon-btn {
    background: none; border: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer; line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}
.wl-icon-btn:hover { color: var(--text-primary); }

.wl-type-tag {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.wl-new-cat {
    display: flex; gap: var(--space-xs);
    margin-top: var(--space-sm);
}
.wl-new-cat .wl-input { flex: 1; min-width: 0; }

.wl-error {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--bearish);
    background: var(--bearish-dim);
    border: 1px solid var(--border-default);
    border-radius: var(--btn-radius);
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-sm);
}
