/* ---- Design Tokens ---- */
:root {
    /* Surfaces */
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --bg-surface: #f8f9fa;
    --bg-input: #ffffff;
    --bg-header: #1a1a2e;
    --bg-chart: #ffffff;
    --bg-chart-grid: #f0f0f0;
    --bg-chart-border: #e0e0e0;
    --bg-overlay: rgba(0,0,0,0.06);

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-muted: #888;
    --text-on-header: rgba(255,255,255,0.7);
    --text-on-card: #333;

    /* Borders */
    --border: #e0e0e0;
    --border-subtle: #f0f0f0;
    --border-input: #ddd;

    /* Brand */
    --color-primary: #3f51b5;
    --color-primary-hover: #303f9f;
    --color-accent: #4fc3f7;

    /* Semantic */
    --color-positive: #66bb6a;
    --color-negative: #ef5350;
    --color-warning: #ff9800;
    --color-lstm: #7b1fa2;
    --color-ensemble: #00897b;

    /* Shadows */
    --shadow-card: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-elevated: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-modal: 0 8px 32px rgba(0,0,0,0.12);

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

    /* Gradient */
    --gradient-header: linear-gradient(135deg, #3f51b5 0%, #1a237e 100%);

    /* Semantic badge backgrounds */
    --badge-positive-bg: rgba(102,187,106,0.15);
    --badge-negative-bg: rgba(239,83,80,0.15);
    --badge-warning-bg: rgba(255,152,0,0.15);
    --badge-primary-bg: rgba(63,81,181,0.12);
    --badge-accent-bg: rgba(79,195,247,0.15);
    --badge-lstm-bg: rgba(123,31,162,0.15);
    --badge-ensemble-bg: rgba(0,137,123,0.15);

    /* Status badge text (for light bg badges) */
    --status-positive-text: #2e7d32;
    --status-negative-text: #c62828;
    --status-warning-text: #e65100;
    --status-neutral-text: #616161;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: #1a1a2e;
        --bg-card: #1e1e2e;
        --bg-surface: #16213e;
        --bg-input: #16213e;
        --bg-header: #16213e;
        --bg-chart: #1a1a2e;
        --bg-chart-grid: #2a2a3e;
        --bg-chart-border: #2a2a3e;
        --bg-overlay: rgba(255,255,255,0.04);

        --text-primary: #e0e0e0;
        --text-secondary: #b0bec5;
        --text-muted: #888;
        --text-on-card: #ccc;

        --border: #333;
        --border-subtle: #2a2a3e;
        --border-input: #444;

        --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
        --shadow-elevated: 0 4px 16px rgba(0,0,0,0.4);
        --shadow-modal: 0 8px 32px rgba(0,0,0,0.5);

        --gradient-header: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);

        --badge-positive-bg: rgba(102,187,106,0.2);
        --badge-negative-bg: rgba(239,83,80,0.2);
        --badge-warning-bg: rgba(255,152,0,0.2);
        --badge-primary-bg: rgba(63,81,181,0.2);
        --badge-accent-bg: rgba(79,195,247,0.2);
        --badge-lstm-bg: rgba(123,31,162,0.25);
        --badge-ensemble-bg: rgba(0,137,123,0.25);

        --status-positive-text: #66bb6a;
        --status-negative-text: #ef5350;
        --status-warning-text: #ffb74d;
        --status-neutral-text: #999;
    }
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

/* ---- Auth ---- */
#auth-view {
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
}

.auth-container {
    background: var(--bg-card); padding: 2rem; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal); width: 100%; max-width: 400px; text-align: center;
}
.auth-container h1 { color: var(--color-primary); margin-bottom: 1.5rem; }

.auth-form input {
    width: 100%; padding: 0.75rem; margin-bottom: 0.75rem;
    border: 1px solid var(--border-input); border-radius: var(--radius-md);
    font-size: 0.95rem; background: var(--bg-input); color: var(--text-primary);
}

.auth-form button {
    width: 100%; padding: 0.75rem; background: var(--color-primary); color: white;
    border: none; border-radius: var(--radius-md); font-size: 1rem; cursor: pointer; font-weight: 600;
}
.auth-form button:hover { background: var(--color-primary-hover); }

.auth-switch { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-switch a { color: var(--color-primary); text-decoration: none; font-weight: 500; }

.consent-label {
    display: flex; gap: 0.5rem; align-items: flex-start; text-align: left;
    font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.4;
}
.consent-label input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.consent-label a { color: var(--color-primary); text-decoration: underline; }

.auth-legal-footer { margin-top: 1rem; font-size: 0.75rem; color: var(--text-muted); }
.auth-legal-footer a { color: var(--text-muted); text-decoration: underline; }

/* ---- Disclaimer banner ---- */
.disclaimer-banner {
    background: #fff8e1; color: #5d4037; padding: 0.5rem 1rem;
    display: flex; align-items: center; gap: 0.75rem; font-size: 0.82rem;
    border-bottom: 1px solid #ffe082; position: sticky; top: 56px; z-index: 99;
}
@media (prefers-color-scheme: dark) {
    .disclaimer-banner { background: #2a2200; color: #ffe082; border-color: #4a3800; }
}
.disclaimer-banner.hidden { display: none; }
.disclaimer-banner span { flex: 1; }
.disclaimer-link { color: inherit; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.disclaimer-dismiss { background: none; border: none; color: inherit; font-size: 1.1rem; cursor: pointer; padding: 0 0.25rem; opacity: 0.7; }
.disclaimer-dismiss:hover { opacity: 1; }

/* ---- Legal modal ---- */
.legal-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
}
.legal-modal-content {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 2rem;
    max-width: 680px; width: 90%; max-height: 80vh; overflow-y: auto;
    position: relative; box-shadow: var(--shadow-modal);
}
.legal-modal-close {
    position: absolute; top: 0.75rem; right: 1rem; background: none; border: none;
    font-size: 1.6rem; cursor: pointer; color: var(--text-muted); line-height: 1;
}
.legal-modal-close:hover { color: var(--text-primary); }
#legal-modal-body h2 { margin-top: 0; color: var(--color-primary); }
#legal-modal-body h3 { margin-top: 1.5rem; color: var(--text-primary); }
#legal-modal-body p, #legal-modal-body li { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
#legal-modal-body ul { padding-left: 1.25rem; }

/* ---- App footer ---- */
.app-footer {
    padding: 1rem 1.5rem; font-size: 0.78rem; color: var(--text-muted);
    border-top: 1px solid var(--border-card); display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
}
.app-footer a { color: var(--text-muted); text-decoration: underline; }

.error { color: var(--color-negative); margin-top: 0.5rem; font-size: 0.85rem; }

/* ---- Header ---- */
header {
    background: var(--bg-header); color: white; padding: 0 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    height: 56px; position: sticky; top: 0; z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.header-brand { color: white; text-decoration: none; font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.header-nav { display: flex; gap: 0; flex-wrap: wrap; }

.nav-link {
    color: rgba(255,255,255,0.6); text-decoration: none; padding: 0.5rem 0.7rem;
    border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 500; transition: all 0.2s; white-space: nowrap;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-link.active { color: white; background: rgba(255,255,255,0.15); }

.header-actions { display: flex; align-items: center; gap: 1rem; }
#user-display { font-size: 0.85rem; color: var(--text-on-header); }

.btn-secondary {
    background: rgba(255,255,255,0.1); color: white;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.35rem 0.9rem; border-radius: var(--radius-md); cursor: pointer; font-size: 0.8rem;
    transition: background 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.2); }

/* ---- Toast ---- */
#toast-container {
    position: fixed; top: 64px; right: 16px; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 0.75rem 1.25rem; border-radius: var(--radius-md); font-size: 0.85rem;
    color: white; box-shadow: var(--shadow-elevated);
    transform: translateX(120%); transition: transform 0.3s ease; max-width: 360px;
}
.toast.show { transform: translateX(0); }
.toast-info { background: var(--color-primary); }
.toast-success { background: var(--color-positive); }
.toast-error { background: var(--color-negative); }
.toast-warning { background: #f57f17; }

/* ---- Pages ---- */
.page { min-height: calc(100vh - 56px); }

/* ---- Dashboard layout ---- */
.dashboard-layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
    width: 260px; background: var(--bg-card); border-right: 1px solid var(--border);
    padding: 1rem; overflow-y: auto; flex-shrink: 0;
}

.main-content { flex: 1; padding: 1.25rem; overflow-y: auto; min-width: 0; }

/* ---- Toolbar ---- */
.toolbar { margin-bottom: 1.25rem; }
.search-bar { display: flex; gap: 0.5rem; max-width: 400px; }

.search-bar input {
    flex: 1; padding: 0.55rem 0.9rem; border: 1px solid var(--border-input);
    border-radius: var(--radius-md); font-size: 0.9rem; background: var(--bg-input); color: var(--text-primary);
}
.search-bar input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(63,81,181,0.15); }

.search-bar button {
    padding: 0.55rem 1.2rem; background: var(--color-primary); color: white;
    border: none; border-radius: var(--radius-md); cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.search-bar button:hover { background: var(--color-primary-hover); }

/* ---- Stock cards grid ---- */
.stock-cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}

.stock-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 1rem;
    box-shadow: var(--shadow-card); cursor: pointer;
    border: 1px solid var(--border-subtle); transition: box-shadow 0.2s, transform 0.15s;
}
.stock-card:hover { box-shadow: var(--shadow-elevated); transform: translateY(-2px); }

.card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.25rem; }
.card-symbol { font-size: 1rem; color: var(--text-primary); }
.card-price { font-size: 1rem; font-weight: 600; }

.card-change { font-size: 0.8rem; margin-bottom: 0.5rem; }
.card-change.up { color: var(--color-positive); }
.card-change.down { color: var(--color-negative); }

.sparkline { display: block; width: 100%; height: 40px; margin-bottom: 0.5rem; }

.card-pred { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.5rem; align-items: center; }
.pred-type { background: var(--badge-primary-bg); color: var(--color-primary); padding: 0.1rem 0.4rem; border-radius: 3px; font-weight: 600; text-transform: uppercase; font-size: 0.65rem; }
.pred-value { font-weight: 500; }

.tier-badge { padding: 0.1rem 0.4rem; border-radius: 3px; font-weight: 600; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.03em; }
.tier-1 { background: rgba(38, 166, 154, 0.15); color: #26a69a; }
.tier-2 { background: rgba(66, 165, 245, 0.15); color: #42a5f5; }
.tier-3 { background: rgba(171, 71, 188, 0.15); color: #ab47bc; }

.empty-state {
    text-align: center; padding: 3rem; color: var(--text-muted); font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ---- Watchlists ---- */
.watchlist-section h3 { margin-bottom: 0.75rem; color: var(--text-on-card); font-size: 0.95rem; }

.watchlist-card {
    background: var(--bg-surface); border-radius: var(--radius-md); padding: 0.65rem; margin-bottom: 0.65rem;
}

.watchlist-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem;
}
.watchlist-header strong { font-size: 0.85rem; }

.btn-icon {
    background: none; border: none; font-size: 1.1rem;
    cursor: pointer; color: var(--text-muted); padding: 0 0.2rem; line-height: 1;
}
.btn-icon:hover { color: var(--color-negative); }

.symbol-tag {
    display: inline-flex; align-items: center; background: var(--color-primary); color: white;
    padding: 0.15rem 0.45rem; border-radius: var(--radius-sm); margin: 0.1rem;
    font-size: 0.75rem; cursor: pointer; font-weight: 500;
}
.symbol-tag:hover { background: var(--color-primary-hover); }

.btn-remove {
    background: none; border: none; color: rgba(255,255,255,0.6);
    cursor: pointer; margin-left: 0.2rem; font-size: 0.8rem;
}

.watchlist-add, .add-watchlist { display: flex; gap: 0.4rem; margin-top: 0.4rem; }

.watchlist-add input, .add-watchlist input {
    flex: 1; padding: 0.35rem 0.5rem; border: 1px solid var(--border-input);
    border-radius: var(--radius-sm); font-size: 0.8rem; background: var(--bg-input); color: var(--text-primary);
}

.watchlist-add button, .add-watchlist button {
    padding: 0.35rem 0.6rem; background: var(--color-primary); color: white;
    border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; font-size: 0.85rem;
}

/* ---- Panels ---- */
.panel {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 1rem;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-subtle);
}
.panel h3 { margin-bottom: 0.75rem; font-size: 0.95rem; color: var(--text-on-card); }

/* ---- Signals ---- */
.signal-card {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.75rem; border-radius: var(--radius-md); margin-bottom: 0.4rem;
    background: var(--bg-surface); cursor: pointer; transition: background 0.15s;
}
.signal-card:hover { background: var(--bg-overlay); }

.signal-badge {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 0.75rem; font-weight: 600;
}
.signal-buy { background: var(--badge-positive-bg); color: var(--color-positive); }
.signal-sell { background: var(--badge-negative-bg); color: var(--color-negative); }
.signal-hold { background: var(--badge-warning-bg); color: var(--color-warning); }
.signal-buy .signal-badge { background: var(--color-positive); color: white; }
.signal-sell .signal-badge { background: var(--color-negative); color: white; }
.signal-hold .signal-badge { background: var(--color-warning); color: white; }

.signal-strength { font-size: 0.8rem; color: var(--text-secondary); }
.signal-time { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }

.muted { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }

/* ---- Stock Detail ---- */
.stock-detail { padding: 1.25rem; max-width: 1200px; margin: 0 auto; }

.stock-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem;
}

.stock-title { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }

.back-link {
    color: var(--color-accent); text-decoration: none; font-size: 0.9rem; font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

.rec-jump-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0 14px;
}

.rec-symbol-search {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-primary);
}

.stock-title h2 { font-size: 1.5rem; color: var(--text-primary); }

.current-price { font-size: 1.3rem; font-weight: 600; color: var(--text-on-card); }

.price-change { font-size: 0.9rem; font-weight: 500; }
.price-change.up { color: var(--color-positive); }
.price-change.down { color: var(--color-negative); }

.stock-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn-action {
    padding: 0.45rem 0.9rem; border: none; border-radius: var(--radius-md);
    cursor: pointer; font-size: 0.8rem; font-weight: 600; color: white;
    background: var(--color-primary); transition: background 0.2s;
}
.btn-action:hover { background: var(--color-primary-hover); }
.btn-lstm { background: var(--color-lstm); }
.btn-lstm:hover { background: #6a1b9a; }
.btn-train { background: #f57c00; }
.btn-train:hover { background: #e65100; }
.btn-refresh { background: var(--color-ensemble); }
.btn-refresh:hover { background: #00695c; }

/* ---- Chart ---- */
.chart-container {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 0.75rem;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-subtle);
    margin-bottom: 1.25rem;
}

.tv-chart { width: 100%; height: 400px; }
.tv-volume-chart { width: 100%; height: 100px; }

/* ---- Detail panels ---- */
.detail-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Predictions ---- */
.prediction-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.85rem;
    flex-wrap: wrap;
}
.prediction-row:last-child { border-bottom: none; }

.pred-type-badge {
    padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.7rem;
    font-weight: 700; color: white; text-transform: uppercase; letter-spacing: 0.5px;
}
.pred-technical           { background: var(--color-warning); }
.pred-lstm                { background: var(--color-lstm); }
.pred-transformer         { background: #ff9800; }
.pred-full_ensemble       { background: #4caf50; }
.pred-sentiment_momentum  { background: #e91e63; }
.pred-seasonality         { background: #00bcd4; }
.pred-aggregate           { background: #4caf50; }
.pred-unknown             { background: var(--text-muted); }

.pred-val { font-weight: 600; color: var(--text-primary); }
.pred-conf { color: var(--text-secondary); }
.pred-horizon { color: var(--text-muted); font-size: 0.75rem; }
.pred-date { color: var(--text-muted); font-size: 0.75rem; margin-left: auto; }

.pred-agg-section { margin-bottom: 0.25rem; }
.agg-row { background: color-mix(in srgb, #4caf50 8%, transparent); border-radius: var(--radius-sm); padding: 0.4rem 0.5rem !important; }
.pred-divider { border: none; border-top: 1px solid var(--border-subtle); margin: 0.5rem 0; }

/* ---- Models ---- */
.models-view { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.models-view h2 { margin-bottom: 1.25rem; color: var(--text-primary); }

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

.model-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.25rem;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-subtle);
}

.model-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.model-header h4 { font-size: 1rem; color: var(--text-primary); }

.model-description { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.45; margin: 0.5rem 0; }

.model-type {
    background: var(--badge-primary-bg); color: var(--color-primary); padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm); font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}

.model-meta { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

.model-metrics { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.metric {
    display: flex; gap: 0.3rem; font-size: 0.8rem; padding: 0.3rem 0.6rem;
    background: var(--bg-surface); border-radius: var(--radius-sm);
}
.metric-label { color: var(--text-secondary); }
.metric-value { font-weight: 600; color: var(--text-primary); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .detail-panels { grid-template-columns: 1fr; }
    .stock-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; }
    .sidebar {
        width: 100%; border-right: none; border-bottom: 1px solid var(--border);
        max-height: 40vh; overflow-y: auto;
    }
    header { padding: 0 0.75rem; height: auto; min-height: 56px; flex-wrap: wrap; gap: 0.25rem; padding-block: 0.4rem; }
    .header-left { gap: 0.5rem; flex-wrap: wrap; }
    .header-nav { gap: 0; }
    .nav-link { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
    .stock-cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .stock-detail { padding: 0.75rem; }
    .stock-actions { width: 100%; }
    .stock-actions .btn-action { flex: 1; text-align: center; }
    .tv-chart { height: 300px; }
    .tv-volume-chart { height: 60px; }
    #toast-container { right: 8px; left: 8px; }
    .toast { max-width: 100%; }
}

@media (max-width: 480px) {
    .header-brand { font-size: 0.95rem; }
    .stock-title h2 { font-size: 1.2rem; }
    .current-price { font-size: 1.1rem; }
    .stock-cards-grid { grid-template-columns: 1fr; }
}

/* ---- News ---- */
.news-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border-subtle); }
.news-item:last-child { border-bottom: none; }
.news-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap; }
.news-title { color: var(--text-primary); font-weight: 500; text-decoration: none; font-size: 0.95rem; }
.news-title:hover { color: var(--color-primary); text-decoration: underline; }
.sentiment-badge {
    font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm); white-space: nowrap;
}
.sentiment-badge.positive { background: var(--badge-positive-bg); color: var(--status-positive-text); }
.sentiment-badge.negative { background: var(--badge-negative-bg); color: var(--status-negative-text); }
.sentiment-badge.neutral { background: var(--bg-surface); color: var(--status-neutral-text); }
.news-meta { display: flex; gap: 0.75rem; margin-top: 0.25rem; font-size: 0.8rem; color: var(--text-muted); }
.news-summary { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.4rem; line-height: 1.4; }

/* ---- Fundamentals ---- */
.fundamentals-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.5rem;
}
.fundamental-item {
    display: flex; justify-content: space-between; padding: 0.5rem 0.75rem;
    background: var(--bg-surface); border-radius: var(--radius-md);
}
.fund-label { font-size: 0.85rem; color: var(--text-secondary); }
.fund-value { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }

/* ---- Alerts ---- */
.alerts-view { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.alerts-view h2 { margin-bottom: 1rem; }
.add-alert-form {
    display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center;
}
.add-alert-form input, .add-alert-form select {
    padding: 0.6rem; border: 1px solid var(--border-input); border-radius: var(--radius-md);
    font-size: 0.9rem; background: var(--bg-input); color: var(--text-primary);
}
.add-alert-form input[type="text"] { width: 120px; }
.add-alert-form input[type="number"] { width: 100px; }
.alerts-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.alert-card {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-card); padding: 0.75rem 1rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}
.alert-card.inactive { opacity: 0.5; }
.alert-info { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.alert-condition { font-size: 0.85rem; color: var(--text-secondary); }
.alert-triggered { font-size: 0.8rem; color: var(--text-muted); }
.alert-actions { display: flex; gap: 0.25rem; }

/* ---- Ensemble button ---- */
.btn-ensemble { background: var(--color-ensemble) !important; }
.btn-ensemble:hover { background: #00695c !important; }
.btn-transformer { background: #00897b !important; }
.btn-transformer:hover { background: #00695c !important; }

/* ---- Model type badges ---- */
.model-type-lstm { background: var(--badge-lstm-bg); color: var(--color-lstm); }
.model-type-ensemble { background: var(--badge-ensemble-bg); color: var(--color-ensemble); }
.model-type-technical { background: var(--badge-warning-bg); color: #e65100; }
.model-type-fundamentals { background: #e8f5e9; color: #2e7d32; }
.model-type-cross-sectional { background: #e3f2fd; color: #1565c0; }
.model-type-regime { background: #f3e5f5; color: #7b1fa2; }
.model-type-seasonality { background: #fff3e0; color: #e65100; }
.model-type-sentiment-momentum { background: #fce4ec; color: #c62828; }
.model-type-transformer { background: #e0f2f1; color: #00695c; }

/* ---- Backtest ---- */
.btn-backtest { background: #5c6bc0; }
.btn-backtest:hover { background: var(--color-primary); }
.backtest-panel { margin-top: 1rem; }
.backtest-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 0.5rem; }
.backtest-metric { background: var(--bg-surface); border-radius: var(--radius-md); padding: 0.75rem; }
.backtest-metric .metric-value.positive { color: var(--color-positive); }
.backtest-metric .metric-value.negative { color: var(--color-negative); }
.backtest-chart { margin-top: 1rem; border-radius: var(--radius-md); overflow: hidden; }

/* ---- Portfolio / Paper Trading ---- */
.portfolios-view { padding: 1.5rem; color: var(--text-primary); }

/* Schedule Status Bar */
.schedule-status-bar { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.75rem 1.25rem; margin-bottom: 1.25rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; color: var(--text-secondary); font-size: 0.85rem; }
.schedule-info { display: flex; align-items: center; gap: 0.6rem; }
.schedule-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.schedule-dot.active { background: var(--color-positive); box-shadow: 0 0 6px rgba(102,187,106,0.6); animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.schedule-info strong { color: var(--text-primary); font-size: 0.9rem; }
.schedule-detail { color: var(--text-muted); }
.schedule-snapshots { color: var(--text-muted); font-size: 0.8rem; }

/* Tracked Symbols */
.tracked-symbols-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.tracked-symbols-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.tracked-symbols-header h3 { margin: 0; color: var(--text-primary); font-size: 1.1rem; }
.add-symbol-form { display: flex; gap: 0.5rem; align-items: center; }
.add-symbol-form input { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); width: 160px; font-size: 0.9rem; text-transform: uppercase; }
.tracked-symbols-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tracked-symbol-chip { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 20px; padding: 0.35rem 0.5rem 0.35rem 0.75rem; font-size: 0.85rem; transition: border-color 0.15s; }
.tracked-symbol-chip:hover { border-color: var(--color-accent); }
.tracked-symbol-chip .symbol-link { color: var(--color-accent); font-weight: 600; text-decoration: none; letter-spacing: 0.5px; }
.tracked-symbol-chip .symbol-link:hover { text-decoration: underline; }
.tracked-symbol-chip .symbol-name { color: var(--text-muted); font-size: 0.8rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 0 0.25rem; line-height: 1; border-radius: 50%; }
.chip-remove:hover { color: var(--color-negative); background: var(--badge-negative-bg); }

.portfolios-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.create-portfolio-form { display: flex; gap: 0.5rem; align-items: center; }
.create-portfolio-form input { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); }
.portfolios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.portfolio-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.portfolio-card:hover { transform: translateY(-2px); border-color: var(--color-accent); }
.portfolio-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.portfolio-card-header h3 { margin: 0; font-size: 1.1rem; color: var(--text-primary); }
.auto-trade-badge { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 10px; background: var(--bg-surface); color: var(--text-muted); font-weight: 600; }
.auto-trade-badge.active { background: var(--badge-positive-bg); color: var(--color-positive); }
.portfolio-card-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
.portfolio-card-stats .stat { display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.stat-value.positive { color: var(--color-positive); }
.stat-value.negative { color: var(--color-negative); }
.portfolio-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.portfolio-initial { font-size: 0.8rem; color: var(--text-muted); }
.btn-delete-small { background: none; border: none; color: var(--color-negative); font-size: 1.2rem; cursor: pointer; padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); }
.btn-delete-small:hover { background: var(--badge-negative-bg); }

/* Portfolio Detail */
.portfolio-detail-view { padding: 1.5rem; color: var(--text-primary); }
.portfolio-detail-header { margin-bottom: 1.5rem; }
.portfolio-detail-header h2 { margin: 0.5rem 0; color: var(--text-primary); }
.summary-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; padding: 1rem; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.trade-form-section { margin-bottom: 1.5rem; }
.trade-form-section h3 { margin-bottom: 0.75rem; color: var(--text-primary); }
.trade-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.trade-form input, .trade-form select { padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-input); color: var(--text-primary); }
.trade-form select { min-width: 80px; }

/* Data tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { text-align: left; padding: 0.6rem; border-bottom: 2px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 0.6rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.data-table td a { color: var(--color-accent); text-decoration: none; }
.data-table td a:hover { text-decoration: underline; }
.data-table tr:hover { background: var(--bg-overlay); }
.trade-buy td:nth-child(3) { color: var(--color-positive); font-weight: 600; }
.trade-sell td:nth-child(3) { color: var(--color-negative); font-weight: 600; }
.empty-message { color: var(--text-muted); font-style: italic; padding: 1rem 0; }
.portfolio-chart { min-height: 300px; border-radius: var(--radius-md); overflow: hidden; }

/* Auto-trade toggle switch */
.auto-trade-toggle { display: flex; align-items: center; gap: 0.5rem; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); transition: 0.3s; border-radius: 24px; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--text-primary); transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background: var(--color-positive); }
input:checked + .slider:before { transform: translateX(20px); }

/* ---- Admin Dashboard ---- */
.admin-view { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.admin-section { background: var(--bg-card); border-radius: var(--radius-md); padding: 1.2rem; margin-bottom: 1.2rem; border: 1px solid var(--border); }
.admin-section h3 { margin: 0 0 1rem 0; color: var(--text-on-card); }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.admin-section-header h3 { margin: 0; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
.admin-table td { padding: 0.5rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); }
.role-badge { padding: 2px 8px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.role-admin { background: var(--badge-accent-bg); color: var(--color-accent); }
.role-user { background: var(--badge-positive-bg); color: var(--color-positive); }
.btn-small { padding: 4px 10px; font-size: 0.8rem; border: 1px solid var(--border); background: transparent; color: var(--text-primary); border-radius: var(--radius-sm); cursor: pointer; }
.btn-small:hover { background: var(--bg-surface); }
.btn-tiny { padding: 2px 6px; font-size: 0.7rem; border: 1px solid var(--border); background: transparent; color: var(--text-muted); border-radius: 3px; cursor: pointer; margin-left: 6px; }
.btn-tiny:hover { background: var(--bg-surface); }
.btn-danger { border-color: var(--color-negative); color: var(--color-negative); }
.btn-danger:hover { background: var(--badge-negative-bg); }
.invite-code-cell code { background: var(--bg-surface); padding: 3px 8px; border-radius: var(--radius-sm); font-family: monospace; font-size: 0.85rem; color: var(--color-warning); }
.invite-status { padding: 2px 8px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 500; }
.invite-active { background: var(--badge-positive-bg); color: var(--color-positive); }
.invite-used { background: var(--bg-surface); color: var(--text-muted); }
.invite-expired { background: var(--badge-negative-bg); color: var(--color-negative); }
.admin-invite-form { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1rem; }
.admin-invite-form label { color: var(--text-muted); font-size: 0.9rem; }
.admin-invite-form input { width: 80px; padding: 4px 8px; background: var(--bg-surface); border: 1px solid var(--border-input); border-radius: var(--radius-sm); color: var(--text-primary); }
.health-status { padding: 0.8rem; border-radius: var(--radius-md); margin-bottom: 0.8rem; font-size: 0.95rem; }
.health-ok { background: var(--badge-positive-bg); border: 1px solid var(--color-positive); color: var(--color-positive); }
.health-degraded { background: var(--badge-negative-bg); border: 1px solid var(--color-negative); color: var(--color-negative); }
.health-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; }
.health-check { background: var(--bg-surface); padding: 0.6rem; border-radius: var(--radius-sm); display: flex; justify-content: space-between; }
.health-label { color: var(--text-muted); text-transform: capitalize; }
.health-value { font-weight: 600; }
.health-value.health-ok { color: var(--color-positive); }
.health-value.health-bad { color: var(--color-negative); }

/* ---- Admin Notification Diagnostics ---- */
.admin-diagnostics { display: grid; gap: 0.9rem; }
.diag-metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 0.6rem; }
.diag-metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.7rem;
    display: grid;
    gap: 0.2rem;
}
.diag-label { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.4px; }
.diag-value { color: var(--text-primary); font-size: 1rem; font-weight: 600; }
.diag-updated { font-size: 0.82rem; font-weight: 500; }
.diag-reasons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.diag-reason-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.7rem;
}
.diag-reason-block h4 { margin: 0 0 0.5rem 0; color: var(--text-secondary); font-size: 0.86rem; }
.diag-reasons-list { display: flex; flex-direction: column; gap: 0.35rem; }
.diag-reason-item { color: var(--text-secondary); font-size: 0.82rem; }
.diag-table-wrap { overflow-x: auto; }
.diag-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.diag-table th, .diag-table td { text-align: left; padding: 0.5rem 0.6rem; border-top: 1px solid var(--border-subtle); vertical-align: top; color: var(--text-secondary); }
.diag-table th { color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.4px; border-top: none; }

/* ---- Admin Config ---- */
.config-category { background: var(--bg-surface); border-radius: var(--radius-md); margin-bottom: 0.8rem; overflow: hidden; }
.config-category-title { margin: 0; padding: 0.8rem 1rem; color: var(--text-on-card); cursor: pointer; user-select: none; display: flex; align-items: center; font-size: 0.95rem; }
.config-category-title::before { content: '▾'; margin-right: 0.5rem; transition: transform 0.2s; }
.config-category.collapsed .config-category-title::before { transform: rotate(-90deg); }
.config-category.collapsed .config-items { display: none; }
.config-items { padding: 0 1rem 0.8rem; }
.config-item { padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); }
.config-item:last-child { border-bottom: none; }
.config-item-header { margin-bottom: 0.3rem; }
.config-label { color: var(--text-primary); font-size: 0.9rem; font-weight: 500; }
.config-desc { color: var(--text-muted); font-size: 0.78rem; display: block; margin-top: 2px; }
.config-item-controls { display: flex; align-items: center; gap: 0.5rem; }
.config-input { width: 120px; padding: 4px 8px; background: var(--bg-card); border: 1px solid var(--border-input); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.85rem; }
.config-updated { color: var(--text-muted); font-size: 0.75rem; }
.config-restart-note { color: var(--color-warning); font-size: 0.75rem; font-weight: 400; }

/* ---- Profile Page ---- */
.profile-view { padding: 1.5rem; max-width: 700px; margin: 0 auto; }
.profile-section { background: var(--bg-card); border-radius: var(--radius-md); padding: 1.2rem; margin-bottom: 1.2rem; border: 1px solid var(--border); }
.profile-section h3 { margin: 0 0 0.8rem 0; color: var(--text-on-card); }
.section-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1rem 0; }
.profile-info { display: grid; gap: 0.6rem; }
.profile-field { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); }
.profile-field label { color: var(--text-muted); font-size: 0.9rem; }
.profile-field span { color: var(--text-primary); font-weight: 500; }
.experience-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.exp-btn { background: var(--bg-surface); border: 2px solid var(--border); border-radius: var(--radius-md); padding: 1rem; cursor: pointer; text-align: center; transition: all 0.2s; color: var(--text-secondary); }
.exp-btn strong { display: block; margin-bottom: 0.3rem; color: var(--text-primary); font-size: 0.95rem; }
.exp-btn span { font-size: 0.8rem; color: var(--text-muted); }
.exp-btn:hover { border-color: var(--color-accent); background: rgba(79,195,247,0.05); }
.exp-btn.active { border-color: var(--color-accent); background: rgba(79,195,247,0.1); }
.exp-btn.active strong { color: var(--color-accent); }
.notify-toggles { display: grid; gap: 0.8rem; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; color: var(--text-secondary); }
.password-change-form { display: grid; gap: 0.8rem; max-width: 400px; }
.password-change-form .form-field { display: grid; gap: 0.3rem; }
.password-change-form .form-field label { color: var(--text-muted); font-size: 0.85rem; }
.password-change-form .form-field input { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; color: var(--text-primary); font-size: 0.9rem; }
.password-change-form .form-field input:focus { outline: none; border-color: var(--color-accent); }

/* ---- Recommendations / Insights Page ---- */
.recommendations-view { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.recommendations-view h2 { margin: 0 0 0.3rem 0; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.5rem 0; }
.recommendations-grid { display: grid; gap: 1rem; }
.rec-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 1.2rem; cursor: pointer; border-left: 4px solid var(--text-muted); transition: transform 0.15s, box-shadow 0.15s; }
.rec-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevated); }
.rec-buy { border-left-color: var(--color-positive); }
.rec-sell { border-left-color: var(--color-negative); }
.rec-hold { border-left-color: var(--color-warning); }
.rec-pending { border-left-color: var(--text-muted); opacity: 0.8; }
.rec-header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.rec-emoji { font-size: 1.3rem; }
.rec-symbol { font-size: 1.1rem; color: var(--text-primary); }
.rec-name { color: var(--text-muted); font-size: 0.85rem; }
.rec-price { color: var(--color-accent); font-weight: 600; font-size: 1rem; margin-left: auto; }
.rec-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.6rem; }
.rec-tier { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.tier-core { background: var(--badge-accent-bg); color: var(--color-accent); }
.tier-extended { background: var(--badge-lstm-bg); color: #ab47bc; }
.tier-discovery { background: var(--badge-warning-bg); color: var(--color-warning); }
.rec-sector-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; background: var(--bg-overlay); color: var(--text-muted); }
.rec-sentiment { font-size: 0.75rem; padding: 2px 8px; border-radius: var(--radius-lg); }
.sentiment-positive { background: var(--badge-positive-bg); color: var(--color-positive); }
.sentiment-negative { background: var(--badge-negative-bg); color: var(--color-negative); }
.sentiment-neutral { background: var(--badge-warning-bg); color: var(--color-warning); }
.rec-body { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.8rem; }
.rec-footer { display: flex; justify-content: space-between; align-items: center; }
.signal-badge-buy { background: var(--badge-positive-bg); color: var(--color-positive); padding: 2px 10px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 600; }
.signal-badge-sell { background: var(--badge-negative-bg); color: var(--color-negative); padding: 2px 10px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 600; }
.signal-badge-hold { background: var(--badge-warning-bg); color: var(--color-warning); padding: 2px 10px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 600; }
.signal-badge-pending { background: var(--bg-overlay); color: var(--text-muted); padding: 2px 10px; border-radius: var(--radius-lg); font-size: 0.8rem; font-weight: 600; }
.rec-time { color: var(--text-muted); font-size: 0.8rem; }

/* Tier/sector filter bar */
.rec-filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.2rem; }
.rec-filter { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 0.8rem; transition: all 0.15s; }
.rec-filter:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rec-filter.active { background: var(--badge-accent-bg); border-color: var(--color-accent); color: var(--color-accent); }
.rec-sector-select { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; margin-left: auto; }

/* Beginner signal card enhancements */
.signal-header { display: flex; align-items: center; gap: 0.4rem; }
.signal-emoji { font-size: 1.1rem; }
.signal-explain { color: var(--text-secondary); font-size: 0.85rem; margin: 0.3rem 0; line-height: 1.4; }
.recommendations-view .empty-state { text-align: center; padding: 3rem 1rem; }
.recommendations-view .empty-state h3 { color: var(--text-on-card); margin-bottom: 0.5rem; }
.recommendations-view .empty-state p { color: var(--text-muted); }
.recommendations-view .empty-state a { color: var(--color-accent); }

@media (max-width: 600px) {
    .experience-selector { grid-template-columns: 1fr; }
    .rec-header { gap: 0.4rem; }
    .rec-sentiment { margin-left: 0; }
}

/* ---- Analytics Page ---- */
.analytics-view { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.analytics-overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.analytics-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.2rem; border: 1px solid var(--border); }
.analytics-card-muted { opacity: 0.7; }
.analytics-card-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.3rem; }
.analytics-card-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.analytics-card-value.positive { color: var(--color-positive); }
.analytics-card-value.neutral { color: var(--color-warning); }
.analytics-card-value.negative { color: var(--color-negative); }
.analytics-card-detail { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.3rem; }

.analytics-section { margin-bottom: 2rem; }
.analytics-section h3 { color: var(--text-on-card); margin-bottom: 0.8rem; font-size: 1.1rem; }

.analytics-table-container { overflow-x: auto; }
.analytics-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius-md); overflow: hidden; }
.analytics-table th { background: var(--bg-surface); color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 0.7rem 1rem; text-align: left; }
.analytics-table td { padding: 0.7rem 1rem; border-top: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: 0.9rem; }
.analytics-table tr:hover { background: var(--bg-surface); }
.analytics-table .positive { color: var(--color-positive); }
.analytics-table .negative { color: var(--color-negative); }

/* Calibration dashboard */
.analytics-calibration-container { display: flex; flex-direction: column; gap: 1.2rem; }
.calibration-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 1rem 1.2rem; border: 1px solid var(--border-subtle); }
.calibration-card h4 { margin: 0 0 0.6rem; color: var(--text-primary); font-size: 1rem; }
.calibration-flag { background: rgba(255, 87, 34, 0.12); color: #ff5722; padding: 0.4rem 0.8rem; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 0.6rem; }
.calibration-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.cal-stat { display: flex; flex-direction: column; gap: 0.15rem; }
.cal-label { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.4px; }
.cal-value { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); }
.cal-value.positive { color: var(--color-positive); }
.cal-value.negative { color: var(--color-negative); }
.calibration-regimes { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; font-size: 0.85rem; }
.regime-tag { background: var(--bg-surface); padding: 0.2rem 0.5rem; border-radius: var(--radius-sm); color: var(--text-secondary); }
.calibration-curve { margin-top: 0.5rem; }
.calibration-curve .cal-label { display: block; margin-bottom: 0.4rem; }
.cal-table { font-size: 0.85rem; }
.flag-badge { color: #ff5722; cursor: help; font-size: 0.9rem; }

.analytics-recent-list { display: flex; flex-direction: column; gap: 0.5rem; }
.outcome-card { background: var(--bg-card); border-radius: var(--radius-md); padding: 0.8rem 1rem; border-left: 3px solid var(--border); }
.outcome-correct { border-left-color: var(--color-positive); }
.outcome-incorrect { border-left-color: var(--color-negative); }
.outcome-header { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.outcome-icon { font-size: 1rem; }
.outcome-symbol { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.outcome-symbol:hover { text-decoration: underline; }
.outcome-dir { color: var(--text-muted); font-size: 0.85rem; }
.outcome-change { font-weight: 600; font-size: 0.85rem; }
.outcome-change.positive { color: var(--color-positive); }
.outcome-change.negative { color: var(--color-negative); }
.outcome-date { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }
.outcome-detail { display: flex; gap: 1rem; margin-top: 0.4rem; flex-wrap: wrap; }
.outcome-detail span { color: var(--text-muted); font-size: 0.8rem; }

@media (max-width: 600px) {
    .analytics-overview-grid { grid-template-columns: 1fr 1fr; }
    .outcome-header { font-size: 0.85rem; }
    .outcome-date { margin-left: 0; }
}

/* ---- Nav Dropdown ---- */
.nav-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal); min-width: 180px; padding: 0.5rem 0; z-index: 200; margin-top: 0.25rem;
}
.nav-dropdown-item {
    display: block; padding: 0.6rem 1.2rem; color: var(--text-secondary);
    text-decoration: none; font-size: 0.9rem; transition: background 0.15s;
}
.nav-dropdown-item:hover { background: var(--bg-overlay); color: var(--text-primary); }
.nav-dropdown-item.active { color: var(--color-accent); }

/* ---- Onboarding ---- */
.onboarding-view {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 56px); padding: 2rem;
}
.onboarding-card {
    background: var(--bg-card); border-radius: 16px; padding: 3rem;
    max-width: 480px; width: 100%; text-align: center;
    box-shadow: var(--shadow-modal);
}
.onboarding-card h2 { margin-bottom: 1rem; color: var(--text-primary); }
.onboarding-card p { color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.6; }
.onboarding-form label { display: block; font-weight: 600; margin-bottom: 0.75rem; color: var(--text-on-card); }
.amount-input-group {
    display: flex; align-items: center; border: 2px solid var(--border-input); border-radius: var(--radius-lg);
    overflow: hidden; margin-bottom: 0.75rem;
}
.amount-prefix {
    padding: 0.9rem 1rem; background: var(--bg-surface); font-weight: 600; color: var(--text-secondary);
    font-size: 1.2rem; border-right: 1px solid var(--border-input);
}
.amount-input-group input {
    flex: 1; padding: 0.9rem 1rem; border: none; font-size: 1.2rem; outline: none;
    background: var(--bg-input); color: var(--text-primary);
}
.onboarding-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.btn-large { padding: 0.9rem 2rem; font-size: 1.1rem; width: 100%; }

/* ---- New Dashboard ---- */
.dashboard-new { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

.system-status-banner {
    background: #f59e0b;
    color: #1a1a1a;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
}

.dash-summary {
    background: var(--gradient-header);
    border-radius: 16px; padding: 2rem; color: white; margin-bottom: 1.5rem;
}
.dash-value-main { text-align: center; margin-bottom: 1.5rem; }
.dash-label { display: block; color: rgba(255,255,255,0.6); font-size: 0.85rem; margin-bottom: 0.25rem; }
.dash-big-number { display: block; font-size: 2.5rem; font-weight: 700; }
.dash-pnl { display: block; font-size: 1.1rem; margin-top: 0.25rem; }
.dash-pnl.positive { color: var(--color-positive); }
.dash-pnl.negative { color: var(--color-negative); }
.dash-following { display: block; font-size: 0.9rem; margin-top: 0.5rem; color: rgba(255,255,255,0.7); }
.dash-following a { color: var(--color-accent); }
.primary-star { color: #ffd700; font-size: 0.8em; }
.portfolio-card.portfolio-primary { border: 2px solid var(--color-accent); }

.dash-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; text-align: center; }
.dash-stat-label { display: block; color: rgba(255,255,255,0.5); font-size: 0.75rem; margin-bottom: 0.25rem; }
.dash-stat-value { display: block; font-weight: 600; font-size: 1.1rem; }

.dash-section { margin-bottom: 1.5rem; }
.dash-section h3 { color: var(--text-on-card); margin-bottom: 1rem; font-size: 1.1rem; }

.dash-trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.trust-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center;
    box-shadow: var(--shadow-card); border: 1px solid var(--border-subtle);
}
.trust-label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.5rem; }
.trust-value { display: block; font-weight: 700; font-size: 1.5rem; margin-bottom: 0.25rem; }
.trust-value.positive { color: var(--color-positive); }
.trust-value.neutral { color: var(--color-warning); }
.trust-value.negative { color: var(--color-negative); }
.trust-detail { display: block; color: var(--text-muted); font-size: 0.75rem; }

.dash-chart { background: var(--bg-chart); border-radius: var(--radius-lg); overflow: hidden; min-height: 300px; }

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

/* ---- Trade/Sync Cards ---- */
.trade-alert-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 1rem 1.25rem;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: var(--shadow-card); border-left: 4px solid var(--border);
}
.trade-alert-card.alert-buy { border-left-color: var(--color-positive); }
.trade-alert-card.alert-sell { border-left-color: var(--color-negative); }

.ta-main { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; flex: 1; }
.ta-side {
    font-weight: 700; font-size: 0.85rem; padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm); background: var(--badge-positive-bg); color: var(--status-positive-text);
}
.alert-sell .ta-side { background: var(--badge-negative-bg); color: var(--status-negative-text); }
.ta-detail { font-size: 0.95rem; color: var(--text-on-card); }
.ta-detail a { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.ta-detail a:hover { text-decoration: underline; }
.ta-conf { color: var(--text-muted); font-size: 0.8rem; }
.ta-time { color: var(--text-muted); font-size: 0.8rem; }

/* ---- Primary Portfolio ---- */
.primary-portfolio-view { padding: 1.5rem; max-width: 1000px; margin: 0 auto; }

/* ---- Holdings Page ---- */
.holdings-view { padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.holdings-input-row { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; align-items: center; }
.holdings-input-row input { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg); color: var(--text); }
.holdings-input-row input[type="text"] { width: 120px; text-transform: uppercase; }
.holdings-input-row input[type="number"] { width: 120px; }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.8rem; border-radius: 4px; cursor: pointer; border: none; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; }
.global-portfolio-card { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.75rem; }
.gp-info { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.portfolios-section-title { margin: 1.5rem 0 0.75rem; font-size: 1.1rem; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; grid-column: 1 / -1; }
.portfolios-section-title:first-child { margin-top: 0; }

/* ---- Onboarding Portfolio Cards ---- */
.onboarding-portfolio-card { padding: 1.25rem; background: var(--card-bg); border: 2px solid var(--border); border-radius: 10px; margin-bottom: 1rem; cursor: pointer; transition: border-color 0.2s, transform 0.1s; }
.onboarding-portfolio-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.onboarding-portfolio-stats { display: flex; gap: 1.5rem; margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-muted); flex-wrap: wrap; }

/* ---- Risk Badges ---- */
.risk-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; text-transform: capitalize; }
.risk-conservative { background: #e8f5e9; color: #2e7d32; }
.risk-moderate { background: #fff3e0; color: #e65100; }
.risk-aggressive { background: #ffebee; color: #c62828; }

.sync-portfolio-label { margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-muted); }

@media (max-width: 768px) {
    .dash-stats-row { grid-template-columns: repeat(2, 1fr); }
    .dash-trust-grid { grid-template-columns: 1fr; }
    .trade-alert-card { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .header-nav { gap: 0; }
    .nav-link { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
    .holdings-input-row { flex-direction: column; align-items: stretch; }
    .holdings-input-row input { width: 100%; }
    .global-portfolio-card { flex-direction: column; gap: 0.75rem; align-items: stretch; }
    .diag-metrics-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
    .diag-reasons-grid { grid-template-columns: 1fr; }
}

/* ---- Training Status ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-fresh  { background: var(--badge-positive-bg); color: var(--color-positive); }
.badge-stale  { background: var(--badge-warning-bg);  color: #e65100; }
.badge-failed { background: var(--badge-negative-bg); color: var(--color-negative); }

.training-fresh  { color: var(--color-positive); font-weight: 700; }
.training-stale  { color: #e65100; font-weight: 700; }
.training-failed { color: var(--color-negative); font-weight: 700; }

.training-section-header {
    margin: 1rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
}

.training-filters {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}
.training-filters label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}
.training-filters select {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
}
.training-status-table td { vertical-align: middle; }
.training-error { color: var(--color-negative); font-size: 0.78rem; }

