/* Apollo Signal Service — Dark Theme */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-hover: #1f2a42;
    --border: #2a3550;
    --text-primary: #e8edf5;
    --text-secondary: #8899b5;
    --text-muted: #5a6a85;
    --accent: #00d4ff;
    --accent-hover: #33deff;
    --green: #00e676;
    --green-dim: rgba(0, 230, 118, 0.15);
    --red: #ff4757;
    --red-dim: rgba(255, 71, 87, 0.15);
    --yellow: #ffc107;
    --yellow-dim: rgba(255, 193, 7, 0.15);
    --blue: #2196f3;
    --blue-dim: rgba(33, 150, 243, 0.15);
    --purple: #9c27b0;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, #111827 0%, #0a0e17 70%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 48px;
    color: var(--accent);
    line-height: 1;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 8px 0 4px;
}

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

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 32px;
}

.header-logo {
    font-size: 24px;
    color: var(--accent);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: rgba(0, 212, 255, 0.1); }
.nav-admin { color: var(--yellow); }
.nav-admin.active { color: var(--yellow); background: var(--yellow-dim); }

/* Pending-review badge shared by main nav + mc-tabs */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    margin-left: 4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    border-radius: 9px;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

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

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 20px;
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Dashboard */
.dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.section {
    margin-bottom: 28px;
}

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

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section-header .section-title { margin-bottom: 0; }

/* Regime Bar */
.regime-bar {
    display: flex;
    gap: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.regime-item { display: flex; flex-direction: column; gap: 2px; }
.regime-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.regime-value { font-size: 16px; font-weight: 600; }
.regime-low, .regime-normal { color: var(--green); }
.regime-high, .regime-elevated { color: var(--red); }
.regime-moderate { color: var(--yellow); }

/* Market Data Bar */
.market-data-bar {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}
.md-group {
    display: flex;
    gap: 6px;
    align-items: stretch;
}
.md-group + .md-group { border-left: 1px solid var(--border); padding-left: 6px; }
.md-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 62px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.02);
}
.md-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.md-value {
    font-size: 13px;
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
    white-space: nowrap;
}
.md-sub {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Consolas, monospace;
}
.md-change-up { color: var(--green); }
.md-change-down { color: var(--red); }
.md-regime-normal { color: var(--green); }
.md-regime-high { color: var(--red); }
.md-regime-low { color: var(--green); }
.md-regime-extreme { color: var(--red); }
.md-regime-weak { color: var(--red); }
.md-regime-moderate { color: var(--yellow); }
.md-regime-medium { color: var(--yellow); }
.md-regime-strong { color: var(--green); }
.md-gap-up { color: var(--green); }
.md-gap-down { color: var(--red); }
.md-updated {
    margin-left: auto;
    display: flex;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
}

/* Signal Grid */
.signal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.signal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.2s;
}

.signal-card:hover { border-color: var(--accent); }
.signal-card.signal-long { border-left: 3px solid var(--green); }
.signal-card.signal-wait { border-left: 3px solid var(--text-muted); }

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

.signal-name { font-weight: 600; font-size: 15px; }

.signal-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.3;
}

.signal-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.signal-badge.signal-long { background: var(--green-dim); color: var(--green); }
.signal-badge.signal-wait { background: rgba(90, 106, 133, 0.2); color: var(--text-muted); }

/* VIX-filtered signal cards — signal is real but blocked by VIX threshold */
.signal-card.signal-filtered { border-left: 3px solid #f0a500; }
.signal-badge.signal-filtered { background: rgba(240, 165, 0, 0.15); color: #f0a500; }

/* Disabled / greyed-out signal cards (e.g., metals on Apex) */
.signal-card.signal-disabled {
    border-left: 3px solid var(--text-muted);
    opacity: 0.4;
    filter: grayscale(0.7);
}
.signal-card.signal-disabled:hover { border-color: var(--text-muted); opacity: 0.55; }
.signal-badge.signal-disabled { background: rgba(90, 106, 133, 0.15); color: var(--text-muted); }

/* Tomorrow's signal preview — highlight cards that fire next session */
.signal-card.signal-tomorrow {
    border-left: 3px solid #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}
.signal-badges { display: flex; gap: 6px; align-items: center; }
.tmw-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}
.tmw-badge.tmw-pending {
    background: rgba(59, 130, 246, 0.22);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.45);
}
.preview-date {
    font-size: 12px;
    font-weight: 400;
    color: #f59e0b;
    margin-left: 8px;
}
.today-date {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Tomorrow's signal preview — ruled out by inputs (cannot fire) */
.signal-card.signal-ruled-out {
    border-left: 3px solid #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.20);
    opacity: 0.85;
}
.tmw-badge.tmw-ruled-out {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

/* Signal rollup header */
.signal-rollup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}
.signal-rollup-count {
    font-size: 20px;
    font-weight: 700;
    font-family: 'SF Mono', Consolas, monospace;
    color: var(--text-primary);
}
.signal-rollup-count.has-active { color: var(--green); }
.signal-rollup-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.signal-grid.collapsed + .signal-rollup-arrow,
.signal-grid.collapsed ~ .signal-rollup-arrow { /* fallback */ }
.signal-rollup-header:hover .signal-rollup-arrow { color: var(--text-secondary); }
.signal-grid.collapsed { display: none; }
#market-data-wrap.collapsed { display: none; }

.signal-details { display: flex; flex-direction: column; gap: 6px; }

/* --- Signal Table (row-per-strategy view) --- */
.signal-table-wrap { overflow-x: auto; width: 100%; margin-left: 0; margin-right: 0; }
@media (max-width: 900px) {
    .signal-table-wrap { width: 100%; margin-left: 0; margin-right: 0; }
}
.signal-table { font-size: 13px; width: 100%; }
.signal-table th { white-space: nowrap; }
.signal-table td { vertical-align: middle; }
.signal-table .sig-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    line-height: 1.25;
}
.signal-table .sig-asset {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.signal-table .sig-asset-ah {
    color: #ffb84d;
    font-weight: 600;
}
.signal-table .sig-hold {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 600;
    color: #ffb84d;
    background: rgba(255, 184, 77, 0.10);
    border: 1px solid rgba(255, 184, 77, 0.35);
    border-radius: 3px;
    vertical-align: 1px;
}
.signal-table .sig-desc {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}
.signal-table .sig-num {
    font-family: 'SF Mono', Consolas, monospace;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}
.signal-table .sig-today, .signal-table .sig-tmw { text-align: center; white-space: nowrap; }
.signal-table .sig-streak { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.signal-table .tmw-none { color: var(--text-muted); opacity: 0.4; }

.signal-table .sig-num.pnl-positive { color: var(--green); }
.signal-table .sig-num.pnl-negative { color: var(--red); }

/* Clickable YTD P&L cell — opens trade-list modal */
.signal-table .sig-ytd-pnl.clickable {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    text-decoration-color: currentColor;
}
.signal-table .sig-ytd-pnl.clickable:hover { background: rgba(0, 212, 255, 0.08); }

/* YTD Trades modal */
.ytd-modal-card {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    width: min(640px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
}
.ytd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ytd-modal-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.ytd-modal-subtitle { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ytd-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
}
.ytd-modal-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }
.ytd-modal-body {
    overflow-y: auto;
    padding: 8px 0;
    flex: 1;
}
.ytd-modal-table { width: 100%; }
.ytd-modal-table th, .ytd-modal-table td { padding: 6px 14px; font-size: 12px; }
.ytd-modal-table th { position: sticky; top: 0; background: #1a1f2e; z-index: 1; }
.ytd-modal-table .ytd-pnl-col { text-align: right; font-family: 'SF Mono', Consolas, monospace; }
.ytd-modal-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.ytd-modal-footer {
    padding: 10px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

/* Row-level status color — left border on first cell (TR borders don't render in collapsed tables) */
.signal-table tr.signal-row td:first-child { border-left: 3px solid var(--text-muted); }
.signal-table tr.signal-long td:first-child { border-left: 3px solid var(--green); }
.signal-table tr.signal-wait td:first-child { border-left: 3px solid var(--text-muted); }
.signal-table tr.signal-filtered td:first-child { border-left: 3px solid #f0a500; }
.signal-table tr.signal-tomorrow td:first-child { border-left: 3px solid #f59e0b; }
.signal-table tr.signal-ruled-out td:first-child { border-left: 3px solid #ef4444; }
.signal-table tr.signal-ruled-out td { opacity: 0.85; }

/* Paper-probation strategies — visually separated from live rows */
.signal-table tr.signal-paper td { background: rgba(147, 197, 253, 0.04); }
.signal-table tr.signal-paper .sig-name { font-style: italic; }
.signal-table tr.signal-section-header td {
    background: rgba(147, 197, 253, 0.10);
    color: #93c5fd;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 6px 12px;
    border-top: 1px solid rgba(147, 197, 253, 0.25);
    border-bottom: 1px solid rgba(147, 197, 253, 0.25);
}
/* --- Lifecycle pill (canonical) ---
   Single source of truth for strategy lifecycle-status display.
   Use `<span class="lc-chip lc-{live,paper,grad,retired,other}">LABEL</span>`.
   Defined here so every page that loads apollo.css gets it (dashboard, performance,
   bridge, etc.). bridge-one.css `.b1-rost-lc` is a page-scoped size wrapper that
   reuses these color modifiers. NOT the same as hermes.php's `.mode-badge`
   (Hermes engine execution mode) or activity.php's `.ac-bdg .mode-*` (per-trade
   trade_mode display) — those are intentionally separate concepts. */
.lc-chip {
    font-size: 9px; padding: 2px 6px; border-radius: 3px;
    letter-spacing: 0.08em; font-weight: 800; display: inline-block;
}
.lc-grad   { background: var(--green-dim); color: var(--green); }
.lc-live   { background: rgba(0,212,255,0.15); color: var(--accent); }
.lc-paper  { background: rgba(255,193,7,0.15); color: var(--yellow); }
.lc-retired{ background: rgba(255,255,255,0.04); color: var(--text-muted); }
.lc-other  { background: rgba(255,255,255,0.04); color: var(--text-muted); }

.signal-detail {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.detail-label { color: var(--text-secondary); }
.detail-value { font-weight: 500; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(42, 53, 80, 0.5);
}

.data-table tr:hover td { background: var(--bg-hover); }

/* Trade History — daily rollup */
.th-day-header { cursor: pointer; background: rgba(255,255,255,0.03); }
.th-day-header:hover { background: rgba(255,255,255,0.06); }
.th-day-header td { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; padding-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-day-header td:first-child::before { content: '\25BE '; color: var(--text-muted); font-size: 10px; }
.th-day-header.th-collapsed td:first-child::before { content: '\25B8 '; }
.th-trade-row td:first-child { padding-left: 20px; }
.th-trade-row td { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-trade-row td.pnl-positive { color: var(--green); }
.th-trade-row td.pnl-negative { color: var(--red); }
.th-hidden { display: none; }
.th-filter-hidden { display: none !important; }
/* Per-trade price-chart drill-down (Orion forward record). The chart row hides
   when collapsed OR when its day group is collapsed (.th-hidden); it shows only
   when both classes are absent. !important wins over the day-expand toggle so a
   day expand never reveals a chart the user hasn't clicked open. */
.th-chart-row.th-chart-collapsed { display: none !important; }
.th-chartable .th-chart-caret { display: inline-block; transition: transform 0.12s ease; color: var(--text-muted); font-size: 9px; }
.th-chartable.th-chart-open .th-chart-caret { transform: rotate(90deg); }

.empty-state, .error-state, .loading-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
}

.error-state { color: var(--red); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active { background: var(--green-dim); color: var(--green); }
.badge-suspended { background: var(--red-dim); color: var(--red); }
.badge-pending { background: var(--yellow-dim); color: var(--yellow); }
.badge-admin { background: rgba(156, 39, 176, 0.15); color: #ce93d8; }
.badge-sub { background: var(--blue-dim); color: var(--blue); }
.badge-viewer { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.badge-sandbox { background: rgba(255, 152, 0, 0.15); color: #ffb74d; }
.badge-eval { background: var(--yellow-dim); color: var(--yellow); }
.badge-funded { background: var(--green-dim); color: var(--green); }
.badge-blown { background: var(--red-dim); color: var(--red); }
.badge-withdrawn { background: rgba(90, 106, 133, 0.2); color: var(--text-muted); }
.badge-paused { background: var(--blue-dim); color: var(--blue); }

/* Lifecycle badges (Delphi §3.5 probation states) */
.badge-paper-probation { background: rgba(255, 193, 7, 0.18); color: #ffd54f; }
.badge-live-probation  { background: rgba(255, 152, 0, 0.18); color: #ffb74d; }
.badge-live            { background: var(--green-dim); color: var(--green); }
.badge-regime-narrow   { background: rgba(0, 188, 212, 0.18); color: #4dd0e1; }
.badge-retired         { background: rgba(90, 106, 133, 0.2); color: var(--text-muted); }
.badge-sm { font-size: 10px; padding: 1px 7px; }

/* Lifecycle paper-only mechanism additions (lifecycle.php ?tab=paper|rollup) */
.lc-callout-warn {
    background: rgba(255, 193, 7, 0.08);
    border-left: 3px solid #ffc107;
    padding: 10px 14px;
    border-radius: 4px;
    margin: 12px 0 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.lc-callout-warn em { font-style: normal; font-weight: 600; color: #ffd54f; }
.lc-section-h3 {
    font-size: 14px;
    color: var(--text);
    margin: 18px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.lc-progress-bar {
    display: inline-block;
    width: 100px;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 6px;
}
.lc-progress-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #00d4ff 0%, #4dd0e1 100%);
    transition: width 0.2s;
}
.lc-empty-block {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    margin: 8px 0 12px;
}
.lc-cheatsheet {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 0;
    margin-top: 8px;
}
.lc-cheat-row {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.lc-cheat-row:last-child { border-bottom: none; }
.lc-cheat-label {
    flex: 0 0 160px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    padding-top: 1px;
}

.side-badge {
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.side-long { background: var(--green-dim); color: var(--green); }
.side-short { background: var(--red-dim); color: var(--red); }

.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }

/* Book-class chips — paper_trades.book display label.
   See Apollo/docs/BOOK_TAXONOMY.md §1 & §4. */
.book-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    vertical-align: middle;
    line-height: 1.4;
}
.book-chip-live     { background: rgba(0, 212, 255, 0.18); color: var(--accent); }
.book-chip-replay   { background: rgba(150, 150, 150, 0.18); color: var(--text-secondary); }
.book-chip-skip     { background: rgba(255, 165, 0, 0.18); color: #ffa500; }
.book-chip-gap      { background: rgba(255, 100, 100, 0.18); color: #ff8a8a; }
.book-chip-observer { background: rgba(120, 120, 120, 0.18); color: var(--text-secondary); font-style: italic; }
.book-chip-pruned   { background: rgba(80, 80, 80, 0.18); color: #888; text-decoration: line-through; }
.book-chip-ah       { background: rgba(180, 120, 255, 0.18); color: #b478ff; }
.book-chip-g        { background: rgba(120, 200, 255, 0.18); color: #78c8ff; }
.book-chip-artemis  { background: rgba(255, 200, 80, 0.18); color: #ffc850; }
.book-chip-orion    { background: rgba(120, 255, 180, 0.18); color: #78ffb4; }
.book-chip-unknown  { background: rgba(200, 200, 200, 0.18); color: #aaa; }

/* YTD modal — skip-row treatment for $0 PMF skip / data-gap rows. */
.ytd-skip-row td { opacity: 0.55; }
.ytd-skip-row td:first-child { opacity: 1; } /* keep chip + date readable */
.ytd-pnl-skip { color: var(--text-secondary); font-style: italic; }
.ytd-skip-note { color: var(--text-muted); font-style: italic; font-size: 11px; }

/* Forms */
.form-group { margin-bottom: 16px; }

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

.form-input,
.login-form input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

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

textarea.form-input { resize: vertical; font-family: inherit; }

select.form-input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238899b5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.checkbox-label:hover { background: var(--bg-hover); }
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Login Form */
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ff6b7a; }
.btn-warning { background: var(--yellow); color: #000; }
.btn-warning:hover { background: #ffd54f; }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover { background: #33ff99; }
.btn-full { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 71, 87, 0.3); }
.alert-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0, 230, 118, 0.3); }
.alert-info { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(33, 150, 243, 0.3); }

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--text-secondary); }
.filter-btn.active { background: rgba(0, 212, 255, 0.1); border-color: var(--accent); color: var(--accent); }

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.profile-item {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.profile-label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.5px; }
.profile-value { font-size: 15px; font-weight: 500; }

.password-form { max-width: 400px; }
.user-form { max-width: 700px; }
.prop-form { max-width: 800px; }

/* Account Cards */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

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

.account-card.account-funded { border-left: 3px solid var(--green); }
.account-card.account-eval_phase1,
.account-card.account-eval_phase2 { border-left: 3px solid var(--yellow); }
.account-card.account-blown { border-left: 3px solid var(--red); }

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(42, 53, 80, 0.5);
}

.account-firm { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.account-label { font-size: 12px; color: var(--text-secondary); }

.account-body { padding: 12px 16px; }

.account-stat {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.account-stat-label { color: var(--text-secondary); }
.account-stat-value { font-weight: 500; }

.account-strategies { padding: 6px 0; }

.strategy-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.strategy-tag {
    padding: 2px 8px;
    background: var(--blue-dim);
    color: var(--blue);
    border-radius: 4px;
    font-size: 11px;
}

.account-notes {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--bg-primary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.account-actions {
    padding: 10px 16px;
    border-top: 1px solid rgba(42, 53, 80, 0.5);
    display: flex;
    gap: 8px;
}

/* Firm Info Box (accounts form) */
.firm-info-box {
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}
.firm-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.firm-info-row + .firm-info-row {
    margin-top: 4px;
}
.firm-info-tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.firm-info-note {
    color: var(--text-muted);
    font-style: italic;
    font-size: 11px;
}

/* Firm pills on prop eval */
.firm-pill-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Empty State Box */
.empty-state-box {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
}

/* Access Log */
.log-warn td { background: rgba(255, 71, 87, 0.03); }
.log-event { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.log-login_failed, .log-account_suspended, .log-account_deleted { color: var(--red); }
.log-login_success, .log-account_created, .log-account_activated { color: var(--green); }
.log-admin_login { color: var(--purple); }
.log-password_change { color: var(--yellow); }
.log-logout { color: var(--text-muted); }

.nowrap { white-space: nowrap; }
.mono { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; }
.detail-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { white-space: nowrap; display: flex; gap: 6px; }

/* Danger Zone */
.danger-title { color: var(--red); }
.danger-text { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }

/* ═══════════════════════════════════════════════════════════════
   ACTIVE TRADES — Contract-Level Breakdown
   ═══════════════════════════════════════════════════════════════ */

/* Daily Totals Bar */
.at-daily-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    flex-wrap: wrap;
}
.at-daily-date {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    min-width: 120px;
}
.at-daily-date strong {
    display: block;
    font-size: 15px;
    color: var(--text-primary);
}
.at-daily-stats {
    display: flex;
    gap: 28px;
    flex: 1;
    flex-wrap: wrap;
}
.at-daily-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.at-daily-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    font-weight: 600;
}
.at-daily-value {
    font-size: 18px;
    font-weight: 700;
}

/* Daily trades table under daily bar */
.at-daily-trades { padding: 0 4px 8px; }
.at-daily-table { font-size: 12px; }
.at-daily-table th { font-size: 10px; padding: 6px 8px; }
.at-daily-table td { padding: 5px 8px; }
.at-status-open { color: var(--accent); font-weight: 600; font-size: 11px; }
.at-status-closed { color: var(--text-muted); font-size: 11px; }

/* Connect bar to eval trades table */
.at-daily-bar { border-radius: var(--radius); margin-bottom: 16px; flex-direction: column; align-items: stretch; }

/* Closed rows — dimmed with badge */
.at-closed-row td { opacity: 0.5; }
.at-closed-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    vertical-align: middle;
}

/* Jumbo rows — slightly indented/dimmed */
.at-jumbo-row td { opacity: 0.85; }
.at-jumbo-row td:first-child { padding-left: 24px; }

/* Dip entry rows — slightly indented like jumbo */
.at-dip-row td { opacity: 0.85; }
.at-dip-row td:first-child { padding-left: 24px; }
.at-dip-pending-row td { opacity: 0.55; }
.at-dip-pending-row td:first-child { padding-left: 24px; }

/* EH badges */
.at-eh-sf {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--blue-dim);
    color: var(--blue);
}
.at-eh-jumbo {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--green-dim);
    color: var(--green);
}
.at-eh-dip-pending {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(251,191,36,0.15);
    color: #fbbf24;
}
.at-eh-bb {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(251,146,60,0.18);
    color: #fb923c;
    cursor: help;
}

.bb-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    background: rgba(251,146,60,0.18);
    color: #fb923c;
    cursor: help;
    vertical-align: 1px;
}

/* Pace manager badge (prop-only sizing) */
.pace-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
    vertical-align: middle;
}

/* Intraday-strategy flag shown after slug name in Active/Recent Trades tables */
.id-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    vertical-align: middle;
}

/* Total row */
.at-total-row td {
    border-top: 2px solid var(--border);
    padding-top: 10px;
    background: rgba(0, 212, 255, 0.03);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* Mobile */
@media (max-width: 768px) {
    .app-header { flex-wrap: wrap; padding: 10px 16px; }
    .header-nav { display: none; order: 3; width: 100%; flex-direction: column; padding-top: 10px; }
    .header-nav.open { display: flex; max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .header-right { display: none; }
    .mobile-menu-btn { display: block; margin-left: auto; }
    .nav-link { padding: 10px 14px; }

    .dashboard { padding: 16px; }
    .signal-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .account-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .regime-bar { gap: 16px; }
    .market-data-bar { gap: 4px; padding: 8px 10px; }
    .md-group + .md-group { border-left: none; padding-left: 0; }
    .md-item { min-width: 56px; }
    .md-updated { margin-left: 0; width: 100%; justify-content: flex-end; }
    .filter-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }

    .stat-value { font-size: 18px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 8px; }
    .actions-cell { flex-direction: column; }

    /* Active trades — mobile card layout */
    #active-trades-table thead { display: none; }
    #active-trades-table,
    #active-trades-table tbody,
    #active-trades-table tr { display: block; width: 100%; }
    #active-trades-table tr:not(.at-total-row) {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 2px 8px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border);
    }
    #active-trades-table .at-col-contract {
        grid-column: 1; grid-row: 1;
        font-size: 13px; border: none; padding: 0;
    }
    #active-trades-table .at-col-side {
        grid-column: 2; grid-row: 1;
        text-align: right; border: none; padding: 0;
    }
    #active-trades-table .at-col-signal {
        grid-column: 1 / -1; grid-row: 2;
        font-size: 11px !important; opacity: 0.7;
        border: none; padding: 2px 0 0;
    }
    #active-trades-table .at-col-entry {
        grid-column: 1; grid-row: 3;
        border: none; padding: 4px 0 0;
        font-size: 12px;
    }
    #active-trades-table .at-col-entry::before { content: 'Entry '; color: var(--text-muted); font-size: 10px; }
    #active-trades-table .at-col-current {
        grid-column: 1; grid-row: 4;
        border: none; padding: 0;
        font-size: 12px;
    }
    #active-trades-table .at-col-current::before { content: 'Now '; color: var(--text-muted); font-size: 10px; }
    #active-trades-table .at-col-pts {
        grid-column: 2; grid-row: 3;
        text-align: right; border: none; padding: 4px 0 0;
        font-size: 12px;
    }
    #active-trades-table .at-col-pnl {
        grid-column: 2; grid-row: 4;
        text-align: right; border: none; padding: 0;
        font-size: 14px; font-weight: 700;
    }
    #active-trades-table .at-col-eh,
    #active-trades-table .at-col-delta { display: none; }
    #active-trades-table .at-total-row {
        display: flex; justify-content: space-between;
        padding: 10px 12px; border-top: 2px solid var(--border);
    }
    #active-trades-table .at-total-row td { border: none; padding: 0; background: none; }
    #active-trades-table .at-total-row td:not(:first-child):not(:nth-child(7)) { display: none; }
    #active-trades-table .at-total-row td:first-child { flex: 1; }
    #active-trades-table .at-total-row td:nth-child(7) { text-align: right; }

    /* Daily bar — stack on mobile */
    .at-daily-bar { flex-direction: column; gap: 8px; padding: 12px; }
    .at-daily-date { min-width: unset; }
    .at-daily-stats { gap: 16px; }
    .at-daily-value { font-size: 15px; }
}

@media (max-width: 480px) {
    .login-container { margin: 16px; padding: 24px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .checkbox-grid { grid-template-columns: 1fr; }
    .at-daily-stats { gap: 12px; }
    .at-daily-stat { min-width: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   HEALTH CHECK DASHBOARD
   ═══════════════════════════════════════════════════════════════ */

/* Summary Bar */
.hc-summary {
    display: flex;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.hc-summary-item { display: flex; flex-direction: column; gap: 2px; }
.hc-summary-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.hc-summary-value { font-size: 18px; font-weight: 700; }
.hc-ok { color: var(--green); }
.hc-warn { color: var(--yellow); }
.hc-err { color: var(--red); }
.hc-muted { color: var(--text-muted); }

/* Fix Log */
.hc-fix-log {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 12px;
}
.hc-fix-entry { padding: 3px 0; color: var(--text-secondary); }
.hc-fix-ok { color: var(--green); }
.hc-fix-fail { color: var(--red); }

/* Check Sections */
.hc-section { margin-bottom: 24px; }

.hc-cat-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}
.hc-cat-ok { background: var(--green-dim); color: var(--green); }
.hc-cat-warn { background: var(--yellow-dim); color: var(--yellow); }
.hc-cat-err { background: var(--red-dim); color: var(--red); }

/* Check Items Grid */
.hc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 10px;
}

.hc-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    transition: border-color 0.2s;
}
.hc-item:hover { border-color: var(--accent); }
.hc-item-ok { border-left: 3px solid var(--green); }
.hc-item-err { border-left: 3px solid var(--red); }
.hc-item-warn { border-left: 3px solid var(--yellow); }

.hc-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.hc-item-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}
.hc-item-ok .hc-item-icon { color: var(--green); }
.hc-item-err .hc-item-icon { color: var(--red); }
.hc-item-warn .hc-item-icon { color: var(--yellow); }

.hc-item-label { font-weight: 600; font-size: 13px; flex: 1; }
.hc-item-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

.hc-fix-btn {
    font-size: 10px !important;
    padding: 2px 8px !important;
    opacity: 0.8;
}
.hc-fix-btn:hover { opacity: 1; }

/* Signal Status List */
.hc-signal-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.hc-sig-active, .hc-sig-wait {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.hc-sig-active { background: var(--green-dim); color: var(--green); }
.hc-sig-wait { background: rgba(90, 106, 133, 0.2); color: var(--text-muted); }

/* EH Exit Reason Tags */
.hc-eh-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.hc-eh-tag {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.hc-eh-ph { background: var(--green-dim); color: var(--green); }
.hc-eh-rc { background: var(--red-dim); color: var(--red); }
.hc-eh-sr { background: var(--yellow-dim); color: var(--yellow); }

/* EH Playbook Grid */
.hc-eh-grid {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 3px;
}
.hc-eh-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
}
.hc-eh-strat { color: var(--text-primary); font-weight: 500; }
.hc-eh-vals { color: var(--accent); font-family: 'SF Mono', Consolas, monospace; font-size: 10px; }

/* Active Positions */
.hc-positions { margin-top: 6px; }
.hc-pos-row {
    display: flex;
    gap: 10px;
    font-size: 11px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
    align-items: center;
}
.hc-pos-strat { font-weight: 600; min-width: 120px; }
.hc-pos-side {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
}
.hc-pos-side.side-long { background: var(--green-dim); color: var(--green); }
.hc-pos-side.side-short { background: var(--red-dim); color: var(--red); }

/* PM2 Memory Bar */
.hc-mem-bar-wrap {
    position: relative;
    height: 6px;
    background: rgba(42, 53, 80, 0.5);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}
.hc-mem-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.hc-mem-bar-label {
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'SF Mono', Consolas, monospace;
}

/* Resource Bars (disk, RAM, load) */
.hc-resource-bar-wrap {
    position: relative;
    height: 8px;
    background: rgba(42, 53, 80, 0.5);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}
.hc-resource-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.hc-resource-bar-label {
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'SF Mono', Consolas, monospace;
}

/* Bar color states */
.hc-bar-ok { background: var(--green); opacity: 0.7; }
.hc-bar-mid { background: var(--yellow); opacity: 0.7; }
.hc-bar-warn { background: var(--red); opacity: 0.7; }

/* Self-Heal Log */
.hc-heal-log {
    margin-top: 8px;
    max-height: 160px;
    overflow-y: auto;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
}
.hc-heal-entry {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
    color: var(--text-secondary);
}
.hc-heal-ts { color: var(--text-muted); min-width: 130px; }
.hc-heal-action { font-weight: 600; min-width: 100px; }
.hc-heal-signal { color: var(--text-primary); }
.hc-heal-clear .hc-heal-action { color: var(--yellow); }
.hc-heal-restart .hc-heal-action { color: var(--red); }

/* Computed flags */
.hc-computed-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.hc-computed-fail {
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: var(--red-dim);
    color: var(--red);
}

/* Mobile adjustments for health check */
@media (max-width: 768px) {
    .hc-grid { grid-template-columns: 1fr; }
    .hc-summary { gap: 12px; }
    .hc-eh-grid { grid-template-columns: 1fr; }
    .hc-heal-entry { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════
   NAV DROPDOWN (generic — Artemis, etc.)
   ═══════════════════════════════════════════════════════════════ */
.nav-dropdown-wrap {
    position: relative;
    display: inline-flex;
}
.nav-dd-arrow { font-size: 9px; opacity: 0.6; margin-left: 2px; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 150px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
    overflow: hidden;
}
.nav-dropdown-wrap:hover .nav-dropdown-menu { display: block; }
.nav-dd-item {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-dd-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-dd-item.active { color: var(--accent); }

/* Utility-cluster top-level links (Ops/Labs/Reference/Profile) — visually secondary */
.nav-link.nav-util { color: var(--text-tertiary, #64748b); font-size: 13px; }
.nav-link.nav-util:hover { color: var(--text-primary); }
.nav-link.nav-util.active { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   HEALTH NAV DROPDOWN
   ═══════════════════════════════════════════════════════════════ */

.health-nav-wrap {
    position: relative;
    display: inline-flex;
}

.health-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}

/* Status Dot */
.health-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.health-dot-ok { background: var(--green); box-shadow: 0 0 6px rgba(0, 230, 118, 0.5); }
.health-dot-warn { background: var(--yellow); box-shadow: 0 0 6px rgba(255, 193, 7, 0.5); }
.health-dot-err { background: var(--red); box-shadow: 0 0 6px rgba(255, 71, 87, 0.5); animation: health-pulse 1.5s ease-in-out infinite; }
.health-dot-loading { background: var(--text-muted); }

@keyframes health-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(255, 71, 87, 0.5); }
    50% { opacity: 0.5; box-shadow: 0 0 12px rgba(255, 71, 87, 0.8); }
}

/* Dropdown Panel */
.health-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    overflow: hidden;
}
.health-dropdown.open { display: block; }

/* Dropdown Header */
.health-dd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.health-dd-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.health-dd-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.health-dd-badge-ok { background: var(--green-dim); color: var(--green); }
.health-dd-badge-warn { background: var(--yellow-dim); color: var(--yellow); }
.health-dd-badge-err { background: var(--red-dim); color: var(--red); }

/* Dropdown Body */
.health-dd-body {
    padding: 8px 0;
}
.health-dd-loading {
    padding: 16px 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Category Rows */
.health-dd-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 13px;
    transition: background 0.15s;
}
.health-dd-row:hover { background: var(--bg-hover); }

.health-dd-cat {
    flex: 1;
    color: var(--text-primary);
}
.health-dd-counts {
    font-size: 11px;
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
}
.health-dd-count-ok { color: var(--green); }
.health-dd-count-warn { color: var(--yellow); }
.health-dd-count-err { color: var(--red); }

/* Meta row (market status + time) */
.health-dd-meta {
    display: flex;
    justify-content: space-between;
    padding: 6px 14px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}

/* Fixable issues notice */
.health-dd-fixable {
    padding: 4px 14px 2px;
    font-size: 11px;
    color: var(--yellow);
}

/* Dropdown Footer */
.health-dd-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.health-dd-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
.health-dd-link:hover { color: var(--accent-hover); }

/* Mobile: dropdown goes full width */
@media (max-width: 768px) {
    .health-dropdown {
        position: fixed;
        top: 56px;
        left: 8px;
        right: 8px;
        width: auto;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RULES POPOVER (Penthouse / Pace info panels)
   ═══════════════════════════════════════════════════════════════ */

.rules-trigger {
    cursor: pointer;
    position: relative;
    border-bottom: 1px dashed currentColor;
}
.rules-trigger:hover { opacity: 0.85; }

.rules-panel {
    display: none;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.rules-panel.open { display: block; }

.rules-panel-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
}
.rules-grid dt {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    padding-top: 2px;
}
.rules-grid dd {
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 11px;
}

.rules-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(42, 53, 80, 0.5);
}
.rules-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.rules-mode-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 1px 0;
}
.rules-mode-name {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
    font-size: 11px;
}
.rules-mode-desc {
    color: var(--text-secondary);
    font-size: 10px;
}

/* Today's Markets Grid */
.tm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.tm-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.tm-col.tm-active {
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.08);
}
.tm-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.tm-market-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.tm-col.tm-active .tm-market-name {
    color: var(--green);
}
.tm-market-price {
    font-size: 13px;
    font-family: 'SF Mono', Consolas, monospace;
    color: var(--text-secondary);
}
.tm-count-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    background: rgba(90, 106, 133, 0.2);
    color: var(--text-muted);
}
.tm-count-badge.has-active {
    background: var(--green-dim);
    color: var(--green);
}
.tm-strategies {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tm-strat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}
.tm-strat-row:hover {
    background: rgba(255, 255, 255, 0.05);
}
.tm-strat-row.tm-strat-long {
    color: var(--text-primary);
    background: var(--green-dim);
}
.tm-strat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}
.tm-strat-row.tm-strat-long .tm-strat-dot {
    background: var(--green);
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.5);
}
.tm-strat-name {
    flex: 1;
}
.tm-strat-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 8px;
}
.tm-strat-row.tm-strat-long .tm-strat-badge {
    background: rgba(0, 230, 118, 0.2);
    color: var(--green);
}
.tm-strat-row:not(.tm-strat-long) .tm-strat-badge {
    color: var(--text-muted);
}
.tm-strat-detail {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'SF Mono', Consolas, monospace;
}
.tm-strat-row.tm-strat-long .tm-strat-detail {
    color: var(--text-secondary);
}
/* Today's Markets — Intl variant (6 columns) */
.tm-grid.tm-intl {
    grid-template-columns: repeat(6, 1fr);
}
@media (max-width: 1200px) {
    .tm-grid.tm-intl { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .tm-grid { grid-template-columns: 1fr; }
    .tm-grid.tm-intl { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .tm-grid.tm-intl { grid-template-columns: 1fr; }
}

/* Today's Markets — Line chart container */
.tm-chart-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    height: 280px;
    position: relative;
}
@media (max-width: 600px) {
    .tm-chart-wrap { height: 220px; }
}

/* ═══════════════════════════════════════════════
   Notification Settings (Profile Page)
   ═══════════════════════════════════════════════ */
.notify-grid {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    max-width: 520px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.notify-grid-header {
    display: contents;
}
.notify-grid-header > span {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border);
}
.notify-grid-header > span:not(:first-child) {
    text-align: center;
}
.notify-row {
    display: contents;
}
.notify-row > span,
.notify-row > label {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(42, 53, 80, 0.25);
}
.notify-row > label {
    justify-content: center;
}
.notify-event-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.notify-event-desc {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
    display: inline-block;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 11px;
    transition: 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--accent);
}

/* Notification log table */
.notify-log {
    width: 100%;
    max-width: 700px;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 12px;
}
.notify-log th {
    text-align: left;
    padding: 6px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.notify-log td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(42, 53, 80, 0.2);
    color: var(--text-secondary);
}
.notify-log .status-sent { color: var(--success); }
.notify-log .status-failed { color: var(--danger); }
.notify-log .status-suppressed { color: var(--text-muted); }

/* Notification feedback */
.notify-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    display: none;
}
.notify-feedback.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}
.notify-feedback.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* Recipient Sections */
.recipient-section {
    margin-bottom: 20px;
}
.recipient-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 4px 0;
}
.recipient-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}
.recipient-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}
.recipient-table-wrap {
    max-width: 900px;
}
.recipient-table-header,
.recipient-table-row {
    display: grid;
    grid-template-columns: 130px 180px 220px 160px;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}
.recipient-table-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(42, 53, 80, 0.4);
    padding-bottom: 8px;
    margin-bottom: 4px;
}
.recipient-table-row {
    border-bottom: 1px solid rgba(42, 53, 80, 0.2);
}
.recipient-table-row .form-input {
    font-size: 13px;
    padding: 5px 8px;
    width: 100%;
    box-sizing: border-box;
}
.rt-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}
.rt-name .form-input {
    flex: 1;
    min-width: 0;
}
.rt-sms, .rt-email {
    min-width: 0;
    overflow: hidden;
}
.rt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}
.recipient-badge-primary {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}
.recipient-add {
    margin-top: 8px;
    font-size: 12px;
}
.btn-xs {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-danger {
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: transparent;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
.notify-master-toggles {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
}
.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}
@media (max-width: 780px) {
    .recipient-table-header,
    .recipient-table-row {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .recipient-table-header { display: none; }
    .rt-name { grid-column: 1 / -1; }
    .rt-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ── Freshness Badges ── */
.freshness-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-family: 'SF Mono', Consolas, monospace;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 6px;
}
.freshness-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}
.freshness-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.freshness-stale {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ── Track Record — Public Page ── */
.tr-header-tag {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: 8px;
    padding: 2px 8px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}
.tr-disclaimer {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 10px 16px;
    background: rgba(255, 193, 7, 0.06);
    border: 1px solid rgba(255, 193, 7, 0.15);
    border-radius: var(--radius);
    text-align: center;
}
.tr-methodology {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.tr-method-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.tr-method-item h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}
.tr-method-item p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.tr-cta-section {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.tr-waitlist-form {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}
.tr-waitlist-msg {
    display: none;
    margin-top: 16px;
    color: var(--green);
    font-size: 14px;
}
@media (max-width: 480px) {
    .tr-waitlist-form {
        flex-direction: column;
        align-items: center;
    }
    .tr-waitlist-form input { max-width: 100% !important; width: 100%; }
    .tr-header-tag { display: none; }
}

/* ── Monthly Returns Heatmap ── */
.tr-heatmap {
    overflow-x: auto;
}
.tr-heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 700px;
}
.tr-heatmap-table thead th {
    text-align: center;
    padding: 8px 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.tr-heatmap-table thead th:first-child {
    text-align: left;
    padding-left: 12px;
    min-width: 56px;
}
.tr-heatmap-cell {
    text-align: center;
    padding: 8px 4px;
    font-weight: 600;
    font-size: 11px;
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: filter 0.15s;
}
.tr-heatmap-cell:hover {
    filter: brightness(1.3);
}
.tr-heatmap-year {
    text-align: left;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(42, 53, 80, 0.3);
}
.tr-heatmap-empty {
    color: var(--text-muted);
    font-weight: 400;
}
.tr-heatmap-total {
    font-weight: 700;
    border-left: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
@media (max-width: 768px) {
    .tr-heatmap-table { font-size: 11px; }
    .tr-heatmap-cell { padding: 6px 3px; font-size: 10px; }
}

/* ── Portfolio Stacking (Tier 2) ─────────────────────────────────────── */
.tr-stacking-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.tr-overlap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.tr-overlap-table thead th {
    padding: 6px 4px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    text-align: center;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    height: 90px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border, #1e293b);
}

.tr-overlap-table thead th:first-child {
    writing-mode: horizontal-tb;
    transform: none;
    height: auto;
}

.tr-overlap-row-label {
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
    text-align: right;
    border-right: 1px solid var(--border, #1e293b);
}

.tr-overlap-cell {
    padding: 6px 4px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    min-width: 36px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: opacity 0.15s;
}

.tr-overlap-cell:hover {
    opacity: 0.8;
}

.tr-overlap-diag {
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-muted, #64748b) !important;
}

@media (max-width: 768px) {
    .tr-stacking-grid {
        grid-template-columns: 1fr;
    }
    #stacking-section .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .tr-overlap-table thead th {
        height: 70px;
        font-size: 8px;
    }
    .tr-overlap-row-label {
        font-size: 9px;
    }
    .tr-overlap-cell {
        min-width: 28px;
        font-size: 9px;
    }
}

/* ── Mission Control Sub-Tabs ────────────────────────────────────────── */
.mc-tabs {
    display: flex;
    gap: 2px;
    padding: 10px 20px 0;
    background: var(--bg-surface, #0f172a);
    border-bottom: 1px solid var(--border, #1e293b);
}
.mc-tab {
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted, #64748b);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s;
    border: 1px solid transparent;
    border-bottom: none;
    position: relative;
    top: 1px;
}
.mc-tab:hover {
    color: var(--text-primary, #e2e8f0);
    background: rgba(255, 255, 255, 0.04);
}
.mc-tab.active {
    color: var(--accent, #00d4ff);
    background: var(--bg-card, #111827);
    border-color: var(--border, #1e293b);
    border-bottom-color: var(--bg-card, #111827);
}

/* ========== Discovery Dashboard ========== */
.section-header-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.section-meta { display: flex; gap: 12px; align-items: center; color: #94a3b8; font-size: 0.9rem; }

.discovery-stream-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px; margin-top: 14px;
}
.discovery-stream-card {
    background: #111827; border: 1px solid #1e293b; border-radius: 8px;
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
    transition: border-color 0.2s;
}
.discovery-stream-card.status-running { border-color: #00d4ff; box-shadow: 0 0 8px rgba(0,212,255,0.15); }
.discovery-stream-card.status-ok      { border-color: #22c55e33; }
.discovery-stream-card.status-err     { border-color: #ef4444; }

.discovery-stream-card .stream-header {
    display: flex; justify-content: space-between; align-items: start; gap: 10px;
}
.discovery-stream-card .stream-header h3 { margin: 0; font-size: 1rem; color: #e2e8f0; }
.status-pill {
    display: inline-block; padding: 2px 8px; border-radius: 11px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em;
    background: #1e293b; color: #94a3b8;
}
.status-pill.status-running { background: rgba(0,212,255,0.15); color: #00d4ff; }
.status-pill.status-ok      { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-pill.status-err     { background: rgba(239,68,68,0.15); color: #f87171; }
.status-pill.status-idle    { background: #1e293b; color: #94a3b8; }

.phase-badge {
    font-size: 0.65rem; padding: 1px 5px; border-radius: 3px;
    background: #1e293b; color: #64748b; margin-left: 6px; text-transform: uppercase;
    vertical-align: middle;
}

.discovery-stream-card .stream-meta { color: #94a3b8; font-size: 0.85rem; line-height: 1.5; }
.discovery-stream-card .stream-desc { color: #64748b; font-size: 0.8rem; margin: 0; flex-grow: 1; }
.discovery-stream-card .stream-actions { display: flex; gap: 8px; justify-content: flex-end; }
.stream-desc { white-space: pre-line; }

.discovery-inbox { margin-top: 12px; }
.discovery-inbox .inbox-entry {
    background: #111827; border: 1px solid #1e293b; border-radius: 6px;
    padding: 10px 14px; margin-bottom: 8px;
}
.inbox-entry-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inbox-date { color: #e2e8f0; font-weight: 600; font-family: ui-monospace, monospace; }
.inbox-entry-shadow { border-color: #b45309; }
.inbox-badge-shadow {
    display: inline-block; padding: 2px 7px; margin-right: 6px;
    background: #b45309; color: #fef3c7; border-radius: 3px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px;
    font-family: ui-monospace, monospace; vertical-align: middle;
}
.inbox-badge-stream {
    display: inline-block; padding: 2px 7px; margin-right: 6px;
    border-radius: 3px; font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.5px; font-family: ui-monospace, monospace;
    vertical-align: middle; background: #334155; color: #e2e8f0;
}
.inbox-badge-drift              { background: #b45309; color: #fef3c7; }
.inbox-badge-skip               { background: #1e40af; color: #dbeafe; }
.inbox-badge-enhance            { background: #15803d; color: #dcfce7; }
.inbox-badge-throttle           { background: #6d28d9; color: #ede9fe; }
.inbox-badge-rescue             { background: #0f766e; color: #ccfbf1; }
.inbox-badge-classifier-quality { background: #475569; color: #e2e8f0; }

.discovery-log-pane {
    background: #0b1220; color: #cbd5e1; border: 1px solid #1e293b; border-radius: 6px;
    padding: 12px; margin-top: 10px; max-height: 360px; overflow-y: auto;
    font-family: ui-monospace, monospace; font-size: 0.78rem; line-height: 1.45;
    white-space: pre-wrap; word-break: break-all;
}

/* Modal */
.disc-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 9000;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.disc-modal[hidden] { display: none; }
.disc-modal-inner {
    background: #0f172a; border: 1px solid #1e293b; border-radius: 10px;
    width: min(900px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.disc-modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.disc-modal-header h3 { margin: 0; color: #e2e8f0; font-family: ui-monospace, monospace; font-size: 0.95rem; }
.disc-modal-body { max-height: 40vh; overflow-y: auto; }
.inbox-markdown {
    background: #0b1220; color: #cbd5e1; padding: 12px; border-radius: 6px;
    font-family: ui-monospace, monospace; font-size: 0.82rem; line-height: 1.55;
    white-space: pre-wrap; word-break: break-word; margin: 0;
}
.inbox-candidate-picker {
    background: #0b1220; border: 1px solid #1e293b; border-radius: 6px;
    padding: 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px;
}
.inbox-candidate-picker .muted { color: #94a3b8; font-size: 0.8rem; }
.inbox-cand-btn {
    background: #1a1f2e; border: 1px solid #334155; color: #cbd5e1;
    border-radius: 5px; padding: 6px 10px; font-family: ui-monospace, monospace;
    font-size: 0.82rem; text-align: left; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.inbox-cand-btn:hover { background: #243447; border-color: #475569; }
.inbox-cand-btn[data-selected="1"] {
    background: #0c2642; border-color: #00d4ff; color: #e2e8f0;
}
.inbox-cand-btn .muted { color: #94a3b8; }
.disc-modal-footer h4 { margin: 8px 0 6px; color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.disc-chat-transcript {
    background: #0b1220; border: 1px solid #1e293b; border-radius: 6px;
    padding: 10px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 8px; min-height: 60px;
}
.chat-msg { padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
.chat-user      { background: #0c2642; border: 1px solid #134e6f; color: #cbd5e1; align-self: flex-end; max-width: 85%; }
.chat-assistant { background: #1a1f2e; border: 1px solid #1e293b; color: #e2e8f0; align-self: flex-start; max-width: 85%; }

.disc-chat-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.disc-chat-input-row textarea {
    flex: 1; background: #0b1220; border: 1px solid #1e293b; color: #e2e8f0;
    border-radius: 6px; padding: 8px; font-size: 0.85rem; resize: vertical;
}
.disc-action-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid #1e293b; }

/* ========== Discovery Dashboard — Tabbed ========== */
.disc-tabs {
    display: flex; gap: 4px; margin-top: 12px; margin-bottom: 0;
    border-bottom: 1px solid #1e293b;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin; scrollbar-color: #334155 transparent;
}
.disc-tabs::-webkit-scrollbar { height: 6px; }
.disc-tabs::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.disc-tab {
    background: transparent; border: 1px solid transparent; border-bottom: none;
    color: #94a3b8; padding: 8px 14px; font-size: 0.88rem; cursor: pointer;
    border-radius: 6px 6px 0 0; display: flex; align-items: center; gap: 6px;
    font-family: inherit; transition: background 0.15s, color 0.15s;
    flex-shrink: 0; white-space: nowrap;
}
.disc-tab:hover { background: rgba(255,255,255,0.04); color: #e2e8f0; }
.disc-tab.active {
    background: #111827; border-color: #1e293b; border-bottom-color: #111827;
    color: #00d4ff; margin-bottom: -1px;
}
.disc-tab.tab-disabled { opacity: 0.55; }
.disc-tab.tab-disabled .tab-label { text-decoration: line-through; }

.tab-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-idle    { background: #475569; }
.dot-ok      { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.4); }
.dot-err     { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.4); }
.dot-running { background: #00d4ff; box-shadow: 0 0 6px rgba(0,212,255,0.6); animation: discPulse 1.5s ease-in-out infinite; }
@keyframes discPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.tab-phase {
    font-size: 0.62rem; padding: 1px 5px; border-radius: 3px;
    background: #1e293b; color: #64748b; letter-spacing: 0.05em;
}
.tab-pass {
    font-size: 0.7rem; padding: 1px 6px; border-radius: 8px;
    background: rgba(74,222,128,0.15); color: #4ade80; font-weight: 700;
}

.disc-tab-panel {
    background: #111827; border: 1px solid #1e293b; border-top: none;
    border-radius: 0 6px 6px 6px; padding: 18px; min-height: 280px;
}
.stream-panel.status-running { box-shadow: inset 0 2px 0 #00d4ff; }
.stream-panel.status-ok      { box-shadow: inset 0 2px 0 #4ade80; }
.stream-panel.status-err     { box-shadow: inset 0 2px 0 #f87171; }

.stream-panel-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; }
.stream-panel-head h3 { margin: 0 0 6px; color: #e2e8f0; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stream-panel-head .stream-desc { color: #94a3b8; font-size: 0.88rem; margin: 0; max-width: 600px; }
.stream-panel-actions { flex-shrink: 0; }

.stream-panel-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
    padding: 14px; background: #0b1220; border-radius: 6px; margin-bottom: 16px;
    font-size: 0.88rem;
}
.kv-row { padding: 3px 0; color: #cbd5e1; }
.kv-row .muted { color: #64748b; margin-right: 6px; }
.tiny-list { margin: 6px 0 0; padding-left: 18px; color: #cbd5e1; }
.tiny-list li { padding: 2px 0; }
.tiny-list code { font-size: 0.82rem; color: #00d4ff; background: #0b1220; padding: 1px 4px; border-radius: 3px; }

.last-run-block .muted:first-child { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; margin-bottom: 4px; display: block; color: #64748b; }
.lr-row { padding: 3px 0; color: #cbd5e1; line-height: 1.5; }
.lr-row .muted { color: #64748b; margin-right: 4px; }
.lr-row strong { color: #e2e8f0; }
.lr-ok   { color: #4ade80; font-weight: 600; }
.lr-err  { color: #f87171; font-weight: 600; }
.lr-pass { color: #4ade80; }

.sub-title {
    font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: #94a3b8; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid #1e293b;
}

.history-list { max-height: 420px; overflow-y: auto; }
.history-table { font-size: 0.82rem; width: 100%; }
.history-table th, .history-table td { padding: 6px 10px; border-bottom: 1px solid #1e293b; text-align: left; vertical-align: middle; }
.history-table th { color: #64748b; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; font-weight: 600; background: #0b1220; position: sticky; top: 0; }
.history-table td.mono { font-family: ui-monospace, monospace; color: #e2e8f0; }
.history-table td.summary-cell { color: #94a3b8; font-size: 0.78rem; }

/* ========== Discovery Dashboard — Pulse + Activity ========== */
.disc-pulse {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px; margin: 12px 0 10px;
    background: #0b1220; border: 1px solid #1e293b; border-radius: 6px; padding: 12px 14px;
}
.pulse-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pulse-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: #64748b; font-weight: 600;
}
.pulse-val {
    font-size: 0.95rem; color: #e2e8f0; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pulse-val.pulse-running { color: #00d4ff; }
.pulse-val.pulse-ok      { color: #4ade80; }
.pulse-val.pulse-warn    { color: #fbbf24; }
.pulse-val.pulse-err     { color: #f87171; }
.pulse-val.pulse-muted   { color: #64748b; font-weight: 500; }

.disc-activity-strip {
    background: #0b1220; border: 1px solid #1e293b; border-radius: 6px;
    padding: 8px 12px 10px; margin-bottom: 14px;
}
.activity-head {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; margin-bottom: 6px;
}
.disc-activity-feed {
    margin: 0; padding: 0; max-height: 180px; overflow-y: auto;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.8rem; line-height: 1.55;
    color: #cbd5e1;
}
.activity-line {
    display: grid; grid-template-columns: 80px 130px 1fr;
    column-gap: 12px; align-items: baseline;
    padding: 3px 4px; border-radius: 3px;
    cursor: default;
}
.activity-line:hover { background: rgba(255,255,255,0.03); }
.act-time {
    font-family: ui-monospace, monospace; font-size: 0.72rem;
    color: #64748b; text-align: right; white-space: nowrap;
}
.act-stream {
    font-family: ui-monospace, monospace; font-size: 0.72rem;
    color: #94a3b8;
    background: rgba(148,163,184,0.08);
    padding: 1px 6px; border-radius: 3px;
    text-align: center; white-space: nowrap;
    justify-self: start;
}
.act-msg { color: inherit; }
.activity-line.line-pass  { color: #4ade80; }
.activity-line.line-pass  .act-stream { color: #4ade80; background: rgba(74,222,128,0.10); }
.activity-line.line-fail  { color: #f87171; }
.activity-line.line-fail  .act-stream { color: #f87171; background: rgba(248,113,113,0.10); }
.activity-line.line-warn  { color: #fbbf24; }
.activity-line.line-warn  .act-stream { color: #fbbf24; background: rgba(251,191,36,0.10); }
.activity-line.line-start { color: #00d4ff; }
.activity-line.line-start .act-stream { color: #00d4ff; background: rgba(0,212,255,0.10); }
.activity-line.line-muted { color: #94a3b8; }

/* ========== Discovery Dashboard — Collapsible ========== */
details.disc-collapsible {
    border: 1px solid #1e293b; border-radius: 6px; background: #0b1220;
    margin-top: 10px;
}
details.disc-collapsible > summary {
    cursor: pointer; padding: 8px 12px; list-style: none;
    color: #e2e8f0; font-size: 0.85rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px; user-select: none;
    border-radius: 6px;
}
details.disc-collapsible > summary::-webkit-details-marker { display: none; }
details.disc-collapsible > summary::before {
    content: "▸"; color: #64748b; font-size: 0.8rem; transition: transform 0.15s;
    display: inline-block; width: 12px;
}
details.disc-collapsible[open] > summary::before { transform: rotate(90deg); }
details.disc-collapsible > summary:hover { background: rgba(255,255,255,0.03); }
details.disc-collapsible[open] > summary {
    border-bottom: 1px solid #1e293b; border-radius: 6px 6px 0 0;
}
.disc-sum-count, .disc-sum-state {
    font-weight: 500; font-size: 0.78rem; color: #64748b; margin-left: 4px;
}
.disc-sum-state.state-running { color: #00d4ff; }
.disc-sum-state.state-idle    { color: #64748b; }
details.disc-collapsible > .disc-collapsible-body { padding: 10px 12px; }
details.disc-collapsible > .history-list { padding: 0 8px 8px; }
details.disc-collapsible > .discovery-log-pane {
    margin-top: 0; border: none; border-radius: 0 0 6px 6px; max-height: 320px;
}

/* ============================================================
 * Discovery Dashboard — Pipeline Funnel + Top Candidates + Modal
 * (inserted 2026-04-21; new UI v1)
 * ============================================================ */

/* --- Pipeline Funnel --- */
.disc-funnel {
    display: flex; align-items: stretch; flex-wrap: wrap;
    gap: 0; padding: 12px 16px;
    background: #0f172a; border: 1px solid #1e293b; border-radius: 6px;
    margin: 10px 0 12px;
}
.funnel-cell {
    flex: 1 1 0; min-width: 110px;
    display: flex; flex-direction: column; justify-content: center;
    padding: 6px 10px;
    border-radius: 4px;
}
.funnel-cell:hover { background: rgba(255,255,255,0.02); }
.funnel-label {
    font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase;
    color: #64748b; margin-bottom: 2px;
}
.funnel-val {
    font-size: 1.55rem; font-weight: 700; color: #e2e8f0; line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.funnel-delta {
    font-size: 0.72rem; color: #64748b; margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.funnel-delta.up   { color: #4ade80; }
.funnel-delta.down { color: #f87171; }
.funnel-arrow {
    color: #334155; font-size: 1.4em; align-self: center;
    padding: 0 10px; user-select: none;
}
.funnel-cell.funnel-pass   .funnel-val { color: #00d4ff; }
.funnel-cell.funnel-shadow .funnel-val { color: #fbbf24; }
.funnel-cell.funnel-live   .funnel-val { color: #4ade80; }

/* --- Top-Candidates table --- */
.disc-top-controls {
    display: flex; gap: 8px; padding: 10px 12px 6px;
    flex-wrap: wrap;
}
.disc-top-select {
    background: #0b1220; color: #e2e8f0;
    border: 1px solid #1e293b; border-radius: 4px;
    padding: 5px 8px; font-size: 0.82rem;
    font-family: inherit;
}
.disc-top-select:focus { outline: 1px solid #00d4ff; border-color: #00d4ff; }
.disc-top-table-wrap { padding: 0 8px 8px; overflow-x: auto; }
.disc-top-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.disc-top-table thead th {
    text-align: left; padding: 6px 8px; color: #94a3b8; font-weight: 600;
    border-bottom: 1px solid #1e293b; background: #0b1220;
    position: sticky; top: 0; z-index: 1;
}
.disc-top-table th.num, .disc-top-table td.num {
    text-align: right; font-variant-numeric: tabular-nums;
}
.disc-top-table tbody td {
    padding: 6px 8px; border-bottom: 1px solid #111827;
    vertical-align: middle;
}
.disc-top-table tbody tr.disc-top-row { cursor: pointer; transition: background 0.08s; }
.disc-top-table tbody tr.disc-top-row:hover { background: #111b2f; }
.disc-top-table .slug-cell {
    max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.disc-top-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* --- Verdict badges --- */
.verdict-badge {
    display: inline-block; padding: 2px 7px;
    border-radius: 10px; font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
    line-height: 1.4;
}
.verdict-badge.verdict-pass { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.verdict-badge.verdict-fail { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.verdict-badge.verdict-none { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

/* --- Status chips --- */
.status-chip {
    display: inline-block; padding: 2px 7px;
    border-radius: 3px; font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
    line-height: 1.4; white-space: nowrap;
}
.status-chip.status-live      { background: rgba(74, 222, 128, 0.18); color: #4ade80; }
.status-chip.status-paper     { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }
.status-chip.status-frozen    { background: rgba(147, 197, 253, 0.18); color: #93c5fd; }
.status-chip.status-ensemble  { background: rgba(167, 139, 250, 0.18); color: #a78bfa; }
.status-chip.status-shelved   { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.status-chip.status-debunked  { background: rgba(248, 113, 113, 0.22); color: #fca5a5; }
.status-chip.status-untested  { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.status-chip.status-other     { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

/* --- Source-family chips (9-slot palette) --- */
.stream-chip {
    display: inline-block; padding: 2px 7px;
    border-radius: 3px; font-size: 0.7rem; font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.02em; line-height: 1.4; white-space: nowrap;
}
.stream-chip-0 { background: rgba(0, 212, 255, 0.15);   color: #00d4ff; }
.stream-chip-1 { background: rgba(74, 222, 128, 0.15);  color: #4ade80; }
.stream-chip-2 { background: rgba(251, 191, 36, 0.15);  color: #fbbf24; }
.stream-chip-3 { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.stream-chip-4 { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.stream-chip-5 { background: rgba(244, 114, 182, 0.15); color: #f472b6; }
.stream-chip-6 { background: rgba(52, 211, 153, 0.15);  color: #34d399; }
.stream-chip-7 { background: rgba(147, 197, 253, 0.15); color: #93c5fd; }
.stream-chip-8 { background: rgba(251, 146, 60, 0.15);  color: #fb923c; }

/* --- Candidate detail modal --- */
.candidate-live-warn {
    padding: 8px 12px; border-radius: 4px;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5; margin-bottom: 12px;
}
.candidate-header { margin-bottom: 12px; }
.candidate-title-row {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.candidate-slug {
    font-size: 1.0rem; color: #e2e8f0; word-break: break-all;
}
.candidate-instside { color: #94a3b8; font-size: 0.85rem; }
.candidate-block { margin-top: 14px; }
.candidate-block h4 {
    font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: #94a3b8; margin: 0 0 6px; font-weight: 600;
}
.candidate-best-run { margin-top: 10px; }
.best-run-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px; padding: 8px; background: #0b1220; border-radius: 4px;
}
.bre-cell {
    display: flex; flex-direction: column; padding: 6px 8px;
}
.bre-label {
    font-size: 0.68rem; color: #64748b; text-transform: uppercase;
    letter-spacing: 0.04em; margin-bottom: 2px;
}
.bre-val {
    font-size: 1.0rem; color: #e2e8f0; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.candidate-gates {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.gate {
    display: inline-block; padding: 2px 8px; border-radius: 3px;
    font-size: 0.74rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.gate.gate-pass { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.gate.gate-fail { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.candidate-rationale {
    padding: 8px 10px; background: #0b1220; border-radius: 4px;
    color: #cbd5e1; font-size: 0.86rem; line-height: 1.5;
}
.candidate-runs { font-size: 0.8rem; }
.candidate-siblings { margin-top: 14px; }
.candidate-siblings summary {
    font-size: 0.82rem; color: #94a3b8; cursor: pointer; padding: 6px 0;
}
.candidate-newton { margin-top: 6px; }
.candidate-newton summary {
    font-size: 0.82rem; color: #94a3b8; cursor: pointer; padding: 6px 0;
}
.candidate-newton-empty {
    padding: 8px 10px; background: #0b1220; border-radius: 4px;
    font-size: 0.82rem;
}

/* ============================================================
 * Discovery Glossary panel
 * ============================================================ */
.glossary-body {
    padding: 8px 14px 14px;
}
.gloss-h {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 12px 0 6px;
    font-weight: 600;
}
.gloss-h:first-child { margin-top: 2px; }
.glossary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 4px;
}
.glossary-table thead th {
    text-align: left;
    padding: 5px 8px;
    color: #64748b;
    font-weight: 500;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #1e293b;
    background: transparent;
}
.glossary-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #111827;
    vertical-align: top;
    color: #cbd5e1;
    line-height: 1.45;
}
.glossary-table tbody tr:last-child td { border-bottom: none; }
.glossary-table tbody td:first-child {
    white-space: nowrap;
    width: 1%;
    padding-right: 14px;
}
.glossary-table code {
    background: #0b1220;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82em;
    color: #94a3b8;
}
.glossary-note {
    margin: 6px 0 0;
    padding: 10px 12px;
    background: #0b1220;
    border-left: 3px solid #00d4ff;
    border-radius: 0 4px 4px 0;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #cbd5e1;
}
.glossary-note code {
    background: #111827;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82em;
    color: #94a3b8;
}

/* ---- Discovery system-health panel (worker + healer cron) ---- */
.disc-health {
    background: #0b1220; border: 1px solid #1e293b; border-radius: 6px;
    padding: 10px 14px; margin: 0 0 14px;
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
}
.health-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.health-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 14px;
    font-size: 0.82rem; font-weight: 500;
    border: 1px solid transparent;
}
.health-badge strong { font-weight: 700; }
.health-badge.health-healthy  { background: rgba(34,197,94,0.12);  color: #4ade80; border-color: rgba(34,197,94,0.25); }
.health-badge.health-running  { background: rgba(0,212,255,0.12);  color: #00d4ff; border-color: rgba(0,212,255,0.25); }
.health-badge.health-retrying { background: rgba(251,191,36,0.12); color: #fbbf24; border-color: rgba(251,191,36,0.28); }
.health-badge.health-failed   { background: rgba(239,68,68,0.12);  color: #f87171; border-color: rgba(239,68,68,0.28); }
.health-badge.health-dim      { opacity: 0.45; }
.health-notes { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 auto; justify-content: flex-end; }
.health-note { font-size: 0.78rem; padding: 2px 8px; border-radius: 4px; }
.health-note.health-note-warn  { background: rgba(251,191,36,0.12); color: #fbbf24; }
.health-note.health-note-muted { color: #64748b; }

/* ---- AH (after-hours) sidecar badge — same shape as .id-badge, yellow ---- */
.ah-badge {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* ---- Active Trades: entry date/time line beneath strategy name ---- */
.at-entry-when {
    font-size: 0.65rem; opacity: 0.6; margin-top: 2px;
    font-family: 'SF Mono', Menlo, monospace; letter-spacing: 0.02em;
}
.tmw-event {
    color: #fbbf24; font-style: italic; font-size: 0.85rem;
}

/* ---- Stream panel retry state + heal action row ---- */
.stream-panel.status-retrying { box-shadow: inset 0 2px 0 #fbbf24; }
.stream-panel-heal-row {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 8px 10px; margin: 0 0 12px;
    background: rgba(251,191,36,0.06);
    border: 1px dashed rgba(251,191,36,0.25);
    border-radius: 4px;
}
.disc-heal-btn { min-width: 110px; }

/* ── Discovery Sub-Tabs (Night 1 v3) ─────────────────────────────────── */
.disc-subtabs {
    display: flex; gap: 2px;
    margin: 0 0 18px; padding: 0 0 0 0;
    border-bottom: 1px solid #1e293b;
    flex-wrap: wrap;
}
.disc-subtab {
    background: transparent; border: 1px solid transparent; border-bottom: none;
    color: #64748b; font: inherit; font-size: 0.85rem; font-weight: 600;
    letter-spacing: 0.02em; padding: 8px 14px; cursor: pointer;
    border-radius: 6px 6px 0 0; position: relative; top: 1px;
    transition: color 0.15s, background 0.15s;
}
.disc-subtab:hover { color: #e2e8f0; background: rgba(255,255,255,0.04); }
.disc-subtab.is-active {
    color: #00d4ff; background: #111827;
    border-color: #1e293b; border-bottom-color: #111827;
}
.disc-subtab-placeholder {
    padding: 24px; background: #111827; border: 1px dashed #1e293b;
    border-radius: 6px; text-align: center;
}
.disc-subtab-placeholder p { color: #94a3b8; margin: 0; }

/* ── Kill Book histogram (Night 1 v3) ────────────────────────────────── */
.kill-book-section {
    background: #111827; border: 1px solid #1e293b; border-radius: 8px;
    padding: 16px; margin: 14px 0;
}
.kill-book-summary { color: #94a3b8; font-size: 0.85rem; margin: 0 0 10px; }
.kill-book-summary strong { color: #e2e8f0; }
.kill-book-chart {
    display: flex; flex-direction: column; gap: 4px;
}
.kill-book-row {
    display: grid;
    grid-template-columns: 200px 1fr 50px 1fr;
    align-items: center; gap: 10px;
    font-size: 0.8rem;
}
.kill-book-label { color: #cbd5e1; font-weight: 500; }
.kill-book-bar-wrap {
    background: #0f172a; border-radius: 3px; height: 18px; position: relative;
    overflow: hidden;
}
.kill-book-bar {
    height: 100%; background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    border-radius: 3px; transition: width 0.4s ease-out;
}
.kill-book-count { color: #f87171; font-weight: 600; text-align: right; }
.kill-book-sample {
    color: #64748b; font-size: 0.7rem; font-family: ui-monospace, monospace;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 720px) {
    .kill-book-row {
        grid-template-columns: 1fr 50px;
        grid-template-areas: "label count" "bar bar" "sample sample";
    }
    .kill-book-label { grid-area: label; }
    .kill-book-count { grid-area: count; }
    .kill-book-bar-wrap { grid-area: bar; }
    .kill-book-sample { grid-area: sample; }
}

/* ── HSI Map summary (Night 1 v3) ────────────────────────────────────── */
.hsi-summary {
    background: #111827; border: 1px solid #1e293b; border-radius: 8px;
    padding: 16px; margin: 14px 0;
}
.hsi-summary-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px; margin: 10px 0;
}
.hsi-stat { background: #0f172a; padding: 10px 12px; border-radius: 6px; }
.hsi-stat-label { color: #64748b; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.hsi-stat-value { color: #00d4ff; font-size: 1.4rem; font-weight: 700; margin-top: 2px; }
.hsi-meta { color: #64748b; font-size: 0.75rem; margin-top: 8px; }

/* ─── Morning Off-Day Briefing (forecast oracle) ─────────────────────── */
.briefing-row {
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid #1f2937;
    border-radius: 6px;
    margin-bottom: 6px;
}
.briefing-row:last-child { margin-bottom: 0; }
.briefing-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.briefing-confidence-high   { color: #1fd286; font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #1fd28618; border: 1px solid #1fd28660; }
.briefing-confidence-medium { color: #ffb14e; font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #ffb14e18; border: 1px solid #ffb14e60; }
.briefing-confidence-low    { color: #8892a4; font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #1a1f2e;   border: 1px solid #2a3142; }
.briefing-confidence-none   { color: #4a5263; font-weight: 600; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #1a1f2e;   border: 1px solid #2a3142; }

/* ─── Plan 2.5 §13 Long-Then-Flip 2-Leg Sentinel ─────────────────────── */
.lfsf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 900px) {
    .lfsf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .lfsf-grid { grid-template-columns: 1fr; }
}
.lfsf-cell {
    padding: 10px 12px;
    background: #0f172a;
    border: 1px solid #1f2937;
    border-radius: 6px;
}
.lfsf-cell.lfsf-empty { opacity: 0.55; }
.lfsf-cell-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
    color: #cbd5e1;
}
.lfsf-cell-body { display: flex; flex-direction: column; gap: 4px; }
.lfsf-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
}
.lfsf-lbl { color: #8892a4; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.lfsf-val { color: #e2e8f0; font-weight: 600; }
.lfsf-bar {
    height: 4px;
    background: #1a1f2e;
    border-radius: 2px;
    overflow: hidden;
    margin: 2px 0 4px 0;
}
.lfsf-bar-fill {
    height: 100%;
    background: #00d4ff;
    transition: width 0.3s ease;
}
.lfsf-foot {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #1f2937;
    color: #64748b;
    font-size: 11px;
    line-height: 1.4;
    font-style: italic;
}

/* ============================================================
   Active Trades V2 — LIVE/PAPER split table + daily totals
   Namespaced .at2-* so they don't collide with existing
   .badge / .section / table styles elsewhere in the file.
   ============================================================ */

.at2-daily-bar {
    display: flex;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 18px;
    margin-bottom: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.at2-daily-date {
    font-weight: 600;
    color: var(--accent);
    min-width: 180px;
    line-height: 1.3;
}
.at2-daily-stat {
    display: flex;
    flex-direction: column;
    min-width: 90px;
}
.at2-daily-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.at2-daily-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.at2-daily-value.green { color: var(--green); }
.at2-daily-value.amber { color: #ffa500; }
.at2-daily-value.red   { color: var(--red); }
.at2-daily-value-mini  { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-top: 2px; font-variant-numeric: tabular-nums; }
.at2-daily-value-mini.green { color: var(--green); }
.at2-daily-value-mini.amber { color: #ffa500; }
.at2-daily-value-mini.red   { color: var(--red); }

/* Risk Room column on Tomorrow's Possible Trades — worst-of color across budget/cluster/loss-breaker. */
.at2-risk-cell  { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.at2-risk-green { color: var(--green); }
.at2-risk-amber { color: #ffa500; }
.at2-risk-red   { color: var(--red); }

/* Pecking-order rank + Status pill on Tomorrow's Possible Trades. */
.at2-rank-cell { font-weight: 700; color: var(--text-muted); width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.at2-status-pill { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; white-space: nowrap; }
.at2-status-approved { background: rgba(46,213,115,0.18); color: #2ed573; border: 1px solid rgba(46,213,115,0.40); }
.at2-status-skipped  { background: rgba(255,71,87,0.18); color: #ff4757; border: 1px solid rgba(255,71,87,0.40); }
.at2-status-pruned   { background: rgba(255,165,0,0.18); color: #ffa500; border: 1px solid rgba(255,165,0,0.40); }
.at2-status-blocked  { background: rgba(255,71,87,0.28); color: #ff4757; border: 1px solid rgba(255,71,87,0.55); }
.at2-status-pending  { background: rgba(150,150,150,0.18); color: var(--text-muted); border: 1px solid rgba(150,150,150,0.40); }
.at2-status-reason   { font-size: 10px; color: var(--text-muted); margin-left: 6px; }

.at2-section-title {
    margin: 0 0 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.at2-section-title small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 10.5px;
    letter-spacing: 0.3px;
}
.at2-section-title.live   { border-bottom-color: var(--green); }
.at2-section-title.paper  { border-bottom-color: var(--blue); }

.at2-table th.at2-num,
.at2-table td.at2-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Hermes column — live 5-tier sentiment for next-day slate row (wired v1.1). */
.at2-hermes-col { white-space: nowrap; }

/* Hermes 5-tier badges (mirrors hybrid_sentiment_check). */
.hermes-tier {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border: 1px solid transparent;
    line-height: 1.4;
}
.hermes-tier-strong-confirm  { background: rgba(46, 213, 115, 0.22); color: #2ed573; border-color: rgba(46, 213, 115, 0.45); }
.hermes-tier-confirm         { background: rgba(46, 213, 115, 0.10); color: #6dd996; border-color: rgba(46, 213, 115, 0.25); }
.hermes-tier-neutral         { background: rgba(150, 150, 160, 0.14); color: #9aa0aa; border-color: rgba(150, 150, 160, 0.30); }
.hermes-tier-conflict        { background: rgba(255, 165, 0, 0.14);   color: #ffa500; border-color: rgba(255, 165, 0, 0.35); }
.hermes-tier-strong-conflict { background: rgba(255, 71, 87, 0.22);   color: #ff4757; border-color: rgba(255, 71, 87, 0.45); }
.hermes-tier-unknown,
.hermes-tier-na              { background: rgba(80, 80, 90, 0.18);   color: #777e8a; border-color: rgba(80, 80, 90, 0.30); }

/* Skip-Mechanisms composite cell. */
.sm-cell { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sm-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid transparent;
    line-height: 1.4;
}
.sm-boost    { background: rgba(46, 213, 115, 0.18);  color: #2ed573; border-color: rgba(46, 213, 115, 0.40); }
.sm-skip     { background: rgba(255, 71, 87, 0.18);   color: #ff4757; border-color: rgba(255, 71, 87, 0.40); }
.sm-throttle { background: rgba(255, 165, 0, 0.18);   color: #ffa500; border-color: rgba(255, 165, 0, 0.40); }
.sm-warn     { background: rgba(255, 165, 0, 0.10);   color: #ffb84d; border-color: rgba(255, 165, 0, 0.25); }
.sm-stale    { background: rgba(255, 215, 0, 0.15);   color: #ffd700; border-color: rgba(255, 215, 0, 0.35); }
.sm-clear    { background: rgba(110, 120, 140, 0.14); color: #8a92a0; border-color: rgba(110, 120, 140, 0.30); }
.sm-na       { background: transparent; color: var(--text-muted); border-color: rgba(110, 120, 140, 0.20); }

tr.dim td { opacity: 0.62; }
tr.dim:hover td { opacity: 0.92; }

.pnl-zero { color: var(--text-muted); }

/* --- Status badges (LIVE / PAPER / PRUNED / SKIPPED / THROTTLED) --- */
.at2-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid transparent;
    vertical-align: middle;
    line-height: 1.3;
}
.at2-live    { background: var(--green-dim);  color: var(--green);  border-color: rgba(0, 230, 118, 0.35); }
.at2-paper   { background: var(--blue-dim);   color: #6fb6ff;       border-color: rgba(33, 150, 243, 0.35); }
.at2-pruned  { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(255, 193, 7, 0.40); }
.at2-skipped { background: var(--red-dim);    color: #ff8a95;       border-color: rgba(255, 71, 87, 0.35); }
.at2-thrott  { background: rgba(156, 39, 176, 0.18); color: #ce93f4; border-color: rgba(156, 39, 176, 0.40); }
.at2-na      { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); border-color: rgba(107, 114, 128, 0.30); }

/* --- PMF cell (PASS / FAIL / SKIP / N/A) --- */
.at2-pmf-pass { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(0, 230, 118, 0.35); }
.at2-pmf-fail { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 193, 7, 0.40); }
.at2-pmf-skip { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; background: var(--red-dim);    color: #ff8a95;       border: 1px solid rgba(255, 71, 87, 0.35); }
.at2-pmf-na   { color: var(--text-muted); font-size: 11px; }

/* --- Confirmation Lever cell (BOOST / THROTTLE / none) --- */
.at2-cl-boost { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; background: var(--green-dim);          color: var(--green); border: 1px solid rgba(0, 230, 118, 0.35); }
.at2-cl-throt { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; background: rgba(156, 39, 176, 0.18); color: #ce93f4;      border: 1px solid rgba(156, 39, 176, 0.40); }
.at2-cl-none  { color: var(--text-muted); font-size: 11px; }

/* --- DIP cell (paper_isolated_dip waiting / filled / N/A) --- */
.at2-dip-waiting { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.3px; background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 193, 7, 0.40); font-family: var(--font-mono, monospace); }
.at2-dip-waiting em { font-style: normal; opacity: 0.75; font-weight: 500; margin-left: 3px; }
.at2-dip-filled  { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.3px; background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(0, 230, 118, 0.35); font-family: var(--font-mono, monospace); }
.at2-dip-na      { color: var(--text-muted); font-size: 11px; }

/* --- Tomorrow's Possible Trades (next-day forecast oracle) --- */
.at2-tomorrow {
    border: 1px solid rgba(255, 193, 7, 0.30);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.04) 0%, rgba(255, 193, 7, 0.01) 100%);
}
.at2-tomorrow-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.at2-tomorrow-header .section-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}
.at2-tomorrow-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
}
.at2-tomorrow-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(107, 114, 128, 0.18);
    color: var(--text-muted);
    border: 1px solid rgba(107, 114, 128, 0.35);
}
.at2-tomorrow-status.status-ok          { background: var(--green-dim);  color: var(--green);  border-color: rgba(0, 230, 118, 0.35); }
.at2-tomorrow-status.status-no-data     { background: rgba(107, 114, 128, 0.18); color: var(--text-muted); border-color: rgba(107, 114, 128, 0.35); }
.at2-tomorrow-status.status-error       { background: var(--red-dim);    color: #ff8a95;       border-color: rgba(255, 71, 87, 0.35); }
.at2-tomorrow-status.status-kill-switch { background: var(--red-dim);    color: #ff8a95;       border-color: rgba(255, 71, 87, 0.35); }
.at2-tomorrow-age {
    color: var(--text-muted);
}
.at2-tomorrow-age.stale {
    color: var(--yellow);
    font-weight: 600;
}

/* --- Forecast row status badge --- */
.at2-status-predicted     { background: rgba(255, 193, 7, 0.18); color: var(--yellow); border: 1px solid rgba(255, 193, 7, 0.40); }
.at2-status-event-pending { background: rgba(255, 193, 7, 0.10); color: var(--yellow); border: 1px dashed rgba(255, 193, 7, 0.55); }
.at2-status-not-projected { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); border: 1px solid rgba(107, 114, 128, 0.30); }
.at2-status-unknown       { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); border: 1px solid rgba(107, 114, 128, 0.30); }

/* --- Confidence badge (HIGH / MEDIUM / LOW / NONE) --- */
.conf-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.at2-confidence-high   { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(0, 230, 118, 0.35); }
.at2-confidence-medium { background: var(--blue-dim);   color: #6fb6ff;       border: 1px solid rgba(33, 150, 243, 0.35); }
.at2-confidence-low    { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255, 193, 7, 0.40); }
.at2-confidence-none   { background: rgba(107, 114, 128, 0.12); color: var(--text-muted); border: 1px solid rgba(107, 114, 128, 0.30); }

/* ==========================================================================
   === MOBILE: dashboard.php (Live Signals) — appended 2026-05-17 ===
   Append-only block. Targets the current table IDs:
     #tomorrow-predicted-table, #active-trades-live, #active-trades-paper,
     .signal-table, #trades-table. Existing rules at lines 1277-1333 target
     a stale #active-trades-table ID and no longer fire — we explicitly
     re-target the live IDs here. Do NOT modify earlier rules (IR6 — sibling
     pages share selectors).
   ========================================================================== */

/* Always-on toggle button — visible on desktop too so the section is
   collapsible at any width (per user request). */
.at2-collapse-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    margin-right: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
.at2-collapse-toggle:hover { background: var(--surface2); }
.at2-collapse-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.at2-caret {
    display: inline-block;
    font-size: 14px;
    line-height: 1;
    transition: transform 0.18s ease;
}
#tomorrow-forecast-section.collapsed .at2-caret { transform: rotate(-90deg); }
#tomorrow-forecast-section.collapsed #tomorrow-trades-body { display: none; }
#live-signals-section.collapsed .at2-caret { transform: rotate(-90deg); }
#live-signals-section.collapsed #live-signals-body { display: none; }
#trade-history-section.collapsed .at2-caret { transform: rotate(-90deg); }
#trade-history-section.collapsed #trade-history-body { display: none; }

.at2-count-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    vertical-align: middle;
}
.at2-count-badge:empty { display: none; }

@media (max-width: 768px) {
    /* --- Daily Stats Bar: horizontal scroll-snap carousel ---
       Preserves all 8 stats instead of stacking them vertically. */
    .at2-daily-bar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
    }
    .at2-daily-bar .at2-daily-stat,
    .at2-daily-bar .at2-daily-date {
        flex-shrink: 0;
        scroll-snap-align: start;
        min-width: 110px;
    }

    /* --- Card-layout for stacked tables: Signal Table, Tomorrow, LIVE, PAPER ---
       Each <tr> becomes a card; each <td> stacks its data-label + value. */
    .signal-table,
    #tomorrow-predicted-table,
    #active-trades-live,
    #active-trades-paper {
        border: 0;
    }
    .signal-table thead,
    #tomorrow-predicted-table thead,
    #active-trades-live thead,
    #active-trades-paper thead {
        position: absolute;
        left: -10000px;
        top: auto;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    .signal-table tbody tr,
    #tomorrow-predicted-table tbody tr,
    #active-trades-live tbody tr,
    #active-trades-paper tbody tr {
        display: block;
        margin: 0 0 10px 0;
        padding: 10px;
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 6px;
    }
    .signal-table tbody td,
    #tomorrow-predicted-table tbody td,
    #active-trades-live tbody td,
    #active-trades-paper tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border: 0;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
        text-align: right;
        min-height: 28px;
    }
    .signal-table tbody td:last-child,
    #tomorrow-predicted-table tbody td:last-child,
    #active-trades-live tbody td:last-child,
    #active-trades-paper tbody td:last-child { border-bottom: 0; }
    .signal-table tbody td::before,
    #tomorrow-predicted-table tbody td::before,
    #active-trades-live tbody td::before,
    #active-trades-paper tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        text-align: left;
        flex: 0 0 auto;
    }
    /* Empty/loading rows: full-width, no flex split */
    .signal-table tbody td.loading-placeholder,
    #tomorrow-predicted-table tbody td.empty-state,
    #active-trades-live tbody td.empty-state,
    #active-trades-paper tbody td.empty-state {
        display: block;
        text-align: center;
    }
    .signal-table tbody td.loading-placeholder::before,
    #tomorrow-predicted-table tbody td.empty-state::before,
    #active-trades-live tbody td.empty-state::before,
    #active-trades-paper tbody td.empty-state::before { content: none; }

    /* Hide noisy Description column on Signal Table at this width */
    .signal-table tbody td[data-label="Description"] { display: none; }

    /* --- Trade History: keep as a real table; release fixed colgroup widths;
       hide low-value Exit Reason column (already truncated on desktop). --- */
    #trades-table {
        table-layout: auto !important;
        font-size: 12px;
    }
    #trades-table colgroup { display: none; }
    #trades-table th:nth-child(9),
    #trades-table td:nth-child(9) { display: none; }

    /* --- Badge / chip tap targets (32px standard, fintech tradeoff vs WCAG 44px) --- */
    .status-badge,
    .at2-confidence-badge,
    .sig-pmf-cell .pmf-chip,
    .signal-table .badge {
        padding: 5px 9px;
        min-height: 28px;
        display: inline-flex;
        align-items: center;
    }

    /* --- Collapse toggle: bump tap target on mobile --- */
    .at2-collapse-toggle {
        width: 32px;
        height: 32px;
    }

    /* --- Strategy Replay modal — beat inline styles with !important --- */
    #strategyReplayModal .ytd-modal-card {
        padding: 0 !important;
    }
    #strategyReplayModal .ytd-modal-body {
        padding: 0 8px 4px !important;
        overflow-y: auto;
        max-height: calc(100vh - 56px);
    }
    /* Controls row: stack vertically so selects/inputs aren't hidden under each other */
    #strategyReplayModal .ytd-modal-body > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        padding: 8px 0 !important;
    }
    #strategyReplayModal .ytd-modal-body label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        font-size: 12px;
    }
    #strategyReplayModal .ytd-modal-body select,
    #strategyReplayModal .ytd-modal-body input {
        width: 60% !important;
        min-width: 0 !important;
        padding: 6px 8px !important;
        font-size: 14px !important;
    }
    /* Legend swatches: wrap below controls instead of pushing right */
    #strategyReplayModal .ytd-modal-body > div:first-child > span {
        margin-left: 0 !important;
        font-size: 10px !important;
    }
    /* Canvas: reserve room for stacked controls */
    #strategyReplayModal .ytd-modal-body > div[style*="height:calc"] {
        height: calc(100vh - 420px) !important;
        min-height: 240px;
    }
    /* Close button: enlarge tap target */
    #strategyReplayModal .ytd-modal-close,
    #ytdTradesModal .ytd-modal-close {
        font-size: 28px;
        line-height: 1;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    /* Tighter card padding at phone-width */
    .signal-table tbody tr,
    #tomorrow-predicted-table tbody tr,
    #active-trades-live tbody tr,
    #active-trades-paper tbody tr {
        padding: 8px;
        margin-bottom: 8px;
    }
    /* Daily Stats: narrower stat width */
    .at2-daily-bar .at2-daily-stat,
    .at2-daily-bar .at2-daily-date {
        min-width: 95px;
    }
    /* LIVE / PAPER tables: hide Notes column entirely on phones */
    #active-trades-live tbody td[data-label="Notes"],
    #active-trades-paper tbody td[data-label="Notes"] { display: none; }
    /* Trade History: also hide Entry + Exit prices to fit on phone */
    #trades-table th:nth-child(6),
    #trades-table td:nth-child(6),
    #trades-table th:nth-child(7),
    #trades-table td:nth-child(7) { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   HERMES SIGNALS — mobile-friendly tables (card-flow pattern,
   parallels #active-trades-table at lines ~1310-1367)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .hs-table thead { display: none; }
    .hs-table,
    .hs-table tbody,
    .hs-table tr { display: block; width: 100%; }

    .hs-table colgroup { display: none; }

    .hs-table tr.th-trade-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto auto auto;
        gap: 2px 8px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border, rgba(255,255,255,0.10));
    }
    .hs-table tr.th-trade-row td { border: none; padding: 0; }
    .hs-table tr.th-trade-row .hs-col-date    { grid-column: 1; grid-row: 1; font-size: 12px; color: var(--text-muted, #9aa3b0); }
    .hs-table tr.th-trade-row .hs-col-side    { grid-column: 2; grid-row: 1; text-align: right; }
    .hs-table tr.th-trade-row .hs-col-strategy{ grid-column: 1 / -1; grid-row: 2; font-size: 13px; padding: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .hs-table tr.th-trade-row .hs-col-entry-px{ grid-column: 1; grid-row: 3; padding: 4px 0 0; font-size: 12px; }
    .hs-table tr.th-trade-row .hs-col-entry-px::before { content: 'Entry '; color: var(--text-muted, #9aa3b0); font-size: 10px; }
    .hs-table tr.th-trade-row .hs-col-entry-et{ grid-column: 2; grid-row: 3; padding: 4px 0 0; text-align: right; font-size: 11px; color: var(--text-muted, #9aa3b0); }
    .hs-table tr.th-trade-row .hs-col-exit-px { grid-column: 1; grid-row: 4; font-size: 12px; }
    .hs-table tr.th-trade-row .hs-col-exit-px::before  { content: 'Exit ';  color: var(--text-muted, #9aa3b0); font-size: 10px; }
    .hs-table tr.th-trade-row .hs-col-exit-et { grid-column: 2; grid-row: 4; text-align: right; font-size: 11px; color: var(--text-muted, #9aa3b0); }
    .hs-table tr.th-trade-row .hs-col-pnl     { grid-column: 1 / -1; grid-row: 5; text-align: right; font-size: 14px; font-weight: 700; padding-top: 4px; }
    .hs-table tr.th-trade-row .hs-col-ticker,
    .hs-table tr.th-trade-row .hs-col-dpp { display: none; }

    /* Beat the `.hs-table tr.th-trade-row { display: grid; }` specificity (0,2,1) so
       `.th-hidden { display: none; }` (0,1,0) actually hides collapsed-day detail rows. */
    .hs-table tr.th-trade-row.th-hidden { display: none; }

    .hs-table tr.th-day-header {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 4px 8px;
        padding: 12px;
        background: rgba(255,255,255,0.04);
        border-top: 1px solid rgba(255,255,255,0.10);
    }
    .hs-table tr.th-day-header td { border: none; padding: 0; }
    .hs-table tr.th-day-header .hs-col-date    { grid-column: 1; grid-row: 1; font-size: 14px; font-weight: 600; }
    .hs-table tr.th-day-header .hs-col-pnl     { grid-column: 2; grid-row: 1; text-align: right; font-size: 14px; font-weight: 700; }
    .hs-table tr.th-day-header .hs-col-entry-et,
    .hs-table tr.th-day-header .hs-col-strategy { grid-column: 1 / -1; grid-row: 2; font-size: 11px; color: var(--text-muted, #9aa3b0); white-space: normal; }
    .hs-table tr.th-day-header .hs-col-ticker,
    .hs-table tr.th-day-header .hs-col-exit-et,
    .hs-table tr.th-day-header .hs-col-entry-px,
    .hs-table tr.th-day-header .hs-col-exit-px,
    .hs-table tr.th-day-header .hs-col-side    { display: none; }

    /* Mobile chevron — readable cyan accent + bumped size so it's visible
       against the faint header background. Desktop chevron at apollo.css:638
       (10px muted) stays unchanged. */
    .hs-table tr.th-day-header .hs-col-date::before {
        content: '\25BE';
        color: var(--accent, #00d4ff);
        font-size: 14px;
        margin-right: 6px;
        display: inline-block;
    }
    .hs-table tr.th-day-header.th-collapsed .hs-col-date::before {
        content: '\25B8';
    }

    .hs-table tr.hs-empty-row { display: block; padding: 12px; text-align: center; }
    .hs-table tr.hs-empty-row td { border: none; padding: 0; }

    .hs-stats-strip { gap: 12px !important; font-size: 0.82rem !important; }
}

@media (max-width: 480px) {
    .hs-stats-strip { flex-direction: column !important; gap: 4px !important; }
}

