/* Strategy Health page */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.health-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 16px; cursor: pointer; border-left: 4px solid var(--border-color); }
.health-card:hover { background: var(--bg-hover); }
.health-card--healthy { border-left-color: #10b981; }
.health-card--watch { border-left-color: #f59e0b; }
.health-card--degrading { border-left-color: #ef4444; }
.health-card--grey { border-left-color: #64748b; opacity: 0.85; }
.health-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.health-card-name { font-weight: 600; color: var(--text-primary); }
.health-score { font-size: 2em; font-weight: 700; line-height: 1; }
.health-score--healthy { color: #10b981; } .health-score--watch { color: #f59e0b; } .health-score--degrading { color: #ef4444; } .health-score--grey { color: #94a3b8; font-size: 1.1em; }
.health-score-wrap { text-align: right; flex: none; }
.health-low { color: #f59e0b; font-size: 0.75em; font-weight: 600; margin-top: 3px; white-space: nowrap; }   /* provisional score: < 30 live trades */
.health-line-low { color: #f59e0b; font-size: 0.7em; font-weight: 600; margin-right: 6px; }
.health-sub { color: var(--text-secondary); font-size: 0.85em; margin-top: 4px; }
.health-bars { display: grid; grid-template-columns: 70px 1fr 36px; gap: 6px 8px; align-items: center; margin-top: 10px; font-size: 0.8em; color: var(--text-secondary); }
.health-bar { height: 6px; background: rgba(148, 163, 184, 0.2); border-radius: 3px; overflow: hidden; }
.health-bar > span { display: block; height: 100%; border-radius: 3px; }
.health-bar--healthy > span { background: #10b981; } .health-bar--watch > span { background: #f59e0b; } .health-bar--degrading > span { background: #ef4444; }
.health-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.health-chip { font-size: 0.75em; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.health-chip--warn { color: #f59e0b; border-color: rgba(245, 158, 11, 0.5); }
.health-chip--info { color: #94a3b8; border-color: rgba(148, 163, 184, 0.4); }
.health-sparkline { width: 100%; height: 28px; margin-top: 8px; }
.health-empty { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.health-detail { margin-top: 8px; }
/* "What is being compared" as three side-by-side cards: Baseline · Expectation set · Measured */
.health-compare { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.health-compare .health-compare-card { margin-bottom: 0; min-width: 0; }
.health-compare--equal { grid-template-columns: 1fr 1fr 1fr; }   /* the three score cards: Edge · Tracking · Backtest decay */
.health-compare .health-field { margin-right: 8px; max-width: 100%; }
.health-compare .health-field select { max-width: 100%; min-width: 0; }
@media (max-width: 1100px) { .health-compare { grid-template-columns: 1fr; } }
.health-section { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; }
.health-section h3 { margin: 0 0 10px; font-size: 1em; color: var(--text-primary); }
.health-sentence { font-size: 1.05em; color: var(--text-primary); line-height: 1.5; }
.health-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.health-table th, .health-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); }
.health-table th { color: var(--text-primary); font-weight: 600; }
/* Scoped under .health-table so they beat the cell colour rule above (same class count, later + more specific). */
.health-gate-pass, .health-table td.health-gate-pass { color: #10b981; font-weight: 700; } .health-gate-fail, .health-table td.health-gate-fail { color: #ef4444; font-weight: 700; }
.health-pos, .health-table .health-pos { color: #10b981; } .health-neg, .health-table .health-neg { color: #ef4444; }
.health-band--healthy { color: #10b981; } .health-band--watch { color: #f59e0b; } .health-band--degrading { color: #ef4444; }
.health-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.health-three { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; }
.health-field { display: inline-flex; align-items: center; gap: 8px; margin-right: 16px; }
.health-field input, .health-field select { background: var(--input-bg); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 6px; padding: 4px 8px; }
.health-link { color: #667eea; cursor: pointer; text-decoration: underline; }
.health-chart { position: relative; height: 280px; }
details.health-how summary { cursor: pointer; color: #667eea; }
/* Header toggle (full-detail accounts only): which detail version the page renders */
.health-mode-toggle { display: inline-flex; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.health-mode-toggle button { background: transparent; border: 0; color: var(--text-secondary); font: inherit; font-size: 0.85em; padding: 6px 12px; cursor: pointer; }
.health-mode-toggle button + button { border-left: 1px solid var(--border-color); }
.health-mode-toggle button[aria-pressed="true"] { background: rgba(102, 126, 234, 0.18); color: var(--text-primary); }
/* Settings modal: one row per live account, ticked = shown on this page */
.health-settings-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin-bottom: 8px; }
.health-settings-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; color: var(--text-primary); }
.health-settings-row:hover { background: rgba(148, 163, 184, 0.08); }
.health-settings-row input { accent-color: #667eea; margin: 0; }
.health-settings-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.health-settings-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-settings-num { color: var(--text-secondary); font-size: 0.85em; }
.health-settings-links { display: flex; gap: 14px; margin-bottom: 10px; font-size: 0.85em; }
/* Portfolio picker + account head (portfolio-first revision) */
/* Portfolio picker: the dashboard's card rows (same column rule as .account-row), one equal-width card per live
   account, tinted with its dashboard colour (--acct-color / --acct-tint / --acct-wash are set inline per card). */
.health-pill-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.health-pill { --acct-color: #667eea; --acct-tint: #667eea40; --acct-wash: #667eea14; min-width: 0; border-radius: 22px; border: 1px solid var(--acct-tint); background: linear-gradient(135deg, var(--acct-wash) 0%, var(--bg-secondary) 100%); overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.health-pill:hover { border-color: var(--acct-color); box-shadow: 0 0 0 3px var(--acct-wash); }
/* Cached lines on screen while the scan rebuilds the account (stale stamp, or a localStorage snapshot after a refresh) */
.health-pill--updating .health-pill-list { opacity: 0.55; }
.health-pill-updating { color: #667eea; }
/* Loading skeleton: a card's shape (head + PICKER_LINES rows) with shimmer bars; no tint, no hover */
.health-pill--skeleton { --acct-color: var(--border-color); --acct-tint: var(--border-color); --acct-wash: transparent; pointer-events: none; }
.health-pill--skeleton .health-pill-head { cursor: default; }
.health-pill--skeleton .skeleton-line { display: block; }
.health-pill--skeleton .health-line { display: flex; justify-content: space-between; align-items: center; cursor: default; }
.health-pill-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 16px 10px 14px; border: 0; background: none; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.health-pill-head:focus-visible { outline: 2px solid var(--acct-color); outline-offset: -2px; border-radius: 22px; }
.health-pill-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.health-pill-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-pill-meta { color: var(--text-secondary); font-size: 0.8em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-pill-link { margin-top: 1px; }
.health-pill-list { list-style: none; margin: 0; padding: 4px 10px 10px; border-top: 1px solid var(--acct-tint); }
.health-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; font-size: 0.85em; cursor: pointer; }
.health-line:hover { background: var(--bg-hover); }
.health-line--muted { color: var(--text-secondary); cursor: default; }
.health-line--muted:hover { background: none; }
.health-line-name { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-line-score { font-weight: 700; flex: none; }
.health-line--filler { cursor: default; }
.health-line--filler:hover { background: none; }
.health-line--more { justify-content: center; cursor: default; padding-top: 6px; }
.health-line--more:hover { background: none; }
.health-more { background: none; border: 0; padding: 2px 8px; color: #667eea; font: inherit; font-size: 0.95em; cursor: pointer; text-decoration: underline; }
.health-more:focus-visible { outline: 2px solid var(--acct-color); outline-offset: 2px; border-radius: 6px; }
.health-line-score--healthy { color: #10b981; } .health-line-score--watch { color: #f59e0b; } .health-line-score--degrading { color: #ef4444; } .health-line-score--grey { color: #94a3b8; font-weight: 500; font-size: 0.9em; }
.health-chevron { color: var(--text-secondary); font-size: 1.2em; text-align: right; }
.health-crumb { color: var(--text-secondary); }
.health-cta { padding: 4px 0; }
.health-linkbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--text-secondary); }
.health-summary { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 0.9em; color: var(--text-secondary); margin-top: 10px; }
.health-count { font-weight: 600; }
.health-count--healthy { color: #10b981; } .health-count--watch { color: #f59e0b; } .health-count--degrading { color: #ef4444; } .health-count--grey { color: #94a3b8; }
@media (max-width: 768px) { .health-three { grid-template-columns: 1fr; } .health-two { grid-template-columns: 1fr; } .health-grid { grid-template-columns: 1fr; } .health-pill-row { grid-template-columns: 1fr; } }
