:root {
  --ink: #1b2423;
  --muted: #73807c;
  --line: #dce2dd;
  --paper: #f4f6f2;
  --surface: #ffffff;
  --teal: #12736f;
  --teal-soft: #d9eeeb;
  --coral: #c85d4d;
  --coral-soft: #f7dfda;
  --amber: #b27b33;
  --shadow: 0 12px 30px rgba(25, 43, 39, 0.06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; font-size: 14px; }
button, select { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.main-content { min-width: 0; width: 100%; padding: 31px 38px 24px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 25px; }
.eyebrow, .panel-kicker { color: var(--muted); font-size: 10px; letter-spacing: .14em; font-weight: 700; }
h1 { margin: 7px 0 0; font-size: 25px; letter-spacing: -.02em; font-weight: 700; }
h2 { margin: 6px 0 0; font-size: 16px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 13px; padding-top: 5px; }
.data-status { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #53a271; display: inline-block; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; border-radius: 3px; }
.icon-button:hover { border-color: var(--teal); color: var(--teal); }
.notify-button { padding: 4px 0; }
.control-strip { display: flex; align-items: flex-end; gap: 21px; background: var(--surface); border: 1px solid var(--line); padding: 13px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.control-group { display: grid; gap: 5px; }
.control-group label { color: var(--muted); font-size: 11px; }
select { min-width: 135px; border: 1px solid var(--line); color: var(--ink); background: #fbfcfa; padding: 7px 10px; border-radius: 2px; }
.model-note { margin-left: auto; color: var(--muted); font-size: 11px; display: flex; gap: 7px; align-items: center; padding-bottom: 7px; }
.info-badge { border: 1px solid #a8b5af; color: #788a83; width: 16px; height: 16px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 10px; }
.hero-grid { display: grid; grid-template-columns: minmax(350px, 1.2fr) minmax(400px, 1fr); gap: 18px; margin-bottom: 18px; }
.status-panel, .metric-panel, .panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.status-panel { padding: 24px 26px; min-height: 202px; }
.status-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.state-pill { padding: 5px 10px; display: inline-block; font-size: 11px; font-weight: 700; border-radius: 2px; }
.state-pill.growth { color: #17685f; background: var(--teal-soft); }
.state-pill.defensive { color: #a64d40; background: var(--coral-soft); }
.state-pill.transition { color: #8b672d; background: #f6e8cb; }
.as-of { font-size: 11px; color: var(--muted); }
.status-title { font-size: 21px; line-height: 1.3; font-weight: 700; margin-top: 17px; max-width: 520px; }
.status-panel p { color: var(--muted); line-height: 1.65; max-width: 560px; margin: 8px 0 18px; }
.status-footer { border-top: 1px solid var(--line); padding-top: 11px; color: var(--muted); display: flex; align-items: center; gap: 8px; font-size: 11px; }
.status-footer strong { color: var(--ink); font-size: 13px; }
.divider { width: 1px; height: 14px; background: var(--line); margin: 0 6px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.metric-panel { padding: 19px 20px; display: flex; flex-direction: column; min-height: 92px; }
.metric-panel strong { font-size: 24px; line-height: 1.3; margin-top: 8px; }
.metric-panel span:last-child { color: var(--muted); font-size: 11px; margin-top: 3px; }
.content-grid, .lower-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .95fr); gap: 18px; margin-bottom: 18px; }
.panel { padding: 20px 21px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.chart-caption { color: var(--muted); font-size: 11px; white-space: nowrap; padding-top: 2px; }
.chart-wrap { height: 290px; margin-top: 20px; position: relative; }
.chart-wrap svg, .mini-chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-tooltip { position: absolute; z-index: 3; min-width: 132px; padding: 9px 11px; border: 1px solid #cfd8d3; border-radius: 8px; background: rgba(255,255,255,.97); box-shadow: 0 8px 20px rgba(25,43,39,.14); color: var(--ink); font-size: 11px; pointer-events: none; }
.chart-tooltip[hidden] { display: none; }
.chart-tooltip strong { display: block; margin-bottom: 6px; font-size: 11px; }
.chart-tooltip span { display: block; line-height: 1.55; white-space: pre; }
.chart-tooltip i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; }
.chart-hit-area { cursor: crosshair; }
[data-nav-section], #overviewSection { scroll-margin-top: 24px; }
.legend { display: flex; gap: 19px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 11px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-line { width: 18px; height: 2px; display: inline-block; }
.assets-panel { min-height: 368px; }
.asset-rows { margin-top: 23px; display: grid; gap: 21px; }
.asset-row { display: grid; grid-template-columns: 52px 1fr 64px; gap: 11px; align-items: center; }
.asset-symbol { font-weight: 700; font-size: 13px; }
.asset-bar { height: 7px; background: #edf0ed; position: relative; }
.asset-bar span { height: 100%; display: block; min-width: 3px; }
.asset-bar .growth { background: var(--teal); }
.asset-bar .defensive { background: var(--coral); }
.asset-bar .neutral { background: var(--amber); }
.asset-change { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.asset-change.growth { color: var(--teal); }
.asset-change.defensive { color: var(--coral); }
.asset-change.neutral { color: var(--amber); }
.asset-footnote { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 14px; color: var(--muted); font-size: 10px; line-height: 2.4; }
.line-swatch { display: inline-block; width: 15px; height: 2px; vertical-align: middle; margin: 0 5px 0 10px; }
.growth-swatch { background: var(--teal); margin-left: 0; }
.defensive-swatch { background: var(--coral); }
.timeline { margin-top: 21px; display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 88px 15px 1fr; min-height: 51px; gap: 10px; }
.timeline-date { color: var(--muted); font-size: 11px; padding-top: 2px; }
.timeline-marker { position: relative; display: flex; justify-content: center; }
.timeline-marker::before { content: ""; width: 9px; height: 9px; background: var(--teal); border: 3px solid #d4ebe7; border-radius: 50%; z-index: 1; }
.timeline-item.defensive .timeline-marker::before { background: var(--coral); border-color: var(--coral-soft); }
.timeline-marker::after { content: ""; width: 1px; background: var(--line); position: absolute; top: 10px; bottom: -3px; }
.timeline-item:last-child .timeline-marker::after { display: none; }
.timeline-detail strong { font-size: 12px; display: block; }
.timeline-detail span { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.text-button { color: var(--teal); background: transparent; border: 0; padding: 0; font-size: 11px; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.backtest-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px 20px; margin-top: 21px; }
.backtest-stat { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.backtest-stat span { color: var(--muted); font-size: 11px; }
.backtest-stat strong { font-size: 15px; }
.mini-chart-wrap { height: 93px; margin-top: 17px; position: relative; }
.footer-strip { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; padding: 4px 1px 0; }
.toast { position: fixed; right: 25px; bottom: 25px; color: #fff; background: #172321; padding: 10px 14px; font-size: 12px; opacity: 0; transform: translateY(8px); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.help-dialog { width: min(620px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); padding: 0; border: 1px solid var(--line); box-shadow: 0 22px 65px rgba(25,43,39,.24); color: var(--ink); }
.help-dialog::backdrop { background: rgba(23,35,33,.48); }
.help-dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.help-dialog-header h2 { margin-top: 5px; }
.help-dialog-header .icon-button { flex: 0 0 auto; }
.help-dialog-body { padding: 20px 22px 24px; overflow: auto; line-height: 1.7; }
.help-dialog-body p { margin: 0 0 15px; color: var(--muted); }
.help-dialog-body h3 { margin: 19px 0 5px; font-size: 13px; }
.help-dialog-body .help-note { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 22px; font-size: 11px; }
@media (max-width: 1100px) { .main-content { padding: 25px 23px; } .hero-grid, .content-grid, .lower-grid { grid-template-columns: 1fr; } .status-panel { min-height: auto; } .assets-panel { min-height: auto; } }
@media (max-width: 720px) { .app-shell { display: block; } .main-content { width: 100%; padding: 22px 14px; } .topbar { align-items: flex-end; } h1 { font-size: 20px; } .control-strip { align-items: stretch; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; } select { width: 100%; min-width: 0; font-size: 11px; padding: 7px 5px; } .model-note { grid-column: 1 / -1; margin: 0; padding: 2px 0 0; } .metric-grid { gap: 10px; } .metric-panel { padding: 14px; } .metric-panel strong { font-size: 20px; } .panel { padding: 17px 14px; } .chart-wrap { height: 230px; } .footer-strip { display: grid; } .topbar-actions { gap: 9px; flex-wrap: wrap; justify-content: flex-end; } .data-status { width: 100%; justify-content: flex-end; } }
:root { --alert-bg: #fff8e8; --alert-border: #efd49a; --alert-text: #805b19; }
.data-alert { display: flex; gap: 16px; align-items: flex-start; margin: 0 0 24px; padding: 24px; background: var(--alert-bg); border: 1px solid var(--alert-border); border-radius: 14px; color: var(--alert-text); }
.data-alert[hidden] { display: none; }
.data-alert-icon { width: 28px; height: 28px; border: 2px solid currentColor; border-radius: 50%; text-align: center; line-height: 24px; font-weight: 700; flex: 0 0 auto; }
.data-alert strong { display: block; font-size: 18px; margin: 2px 0 8px; }
.data-alert p { margin: 0; line-height: 1.7; overflow-wrap: anywhere; }
.notify-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.notify-panel strong { display: block; margin-top: 5px; font-size: 14px; }
.notify-panel p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.email-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.email-form input { width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: #fbfcfa; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.alert-retry { margin-top: 14px; padding: 8px 14px; border: 1px solid currentColor; border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.alert-retry:hover { background: rgba(128, 91, 25, 0.08); }
[data-research-content][hidden] { display: none; }
@media (max-width: 720px) {
  .notify-panel { display: block; }
  .email-form { justify-content: flex-start; margin-top: 13px; }
  .email-form input { width: min(100%, 260px); }
}

/* The dashboard is intentionally a single reading surface. Keep all sections
   in document order so the page does not need a second navigation column. */
.app-shell { display: block; }
.main-content { width: 100%; max-width: 1480px; margin: 0 auto; }
.lower-grid { grid-template-columns: 1fr; }
.timeline { max-height: 292px; overflow-y: auto; padding: 2px 12px 2px 0; scrollbar-color: #b6c5be transparent; }
.timeline::-webkit-scrollbar { width: 8px; }
.timeline::-webkit-scrollbar-thumb { background: #c7d2cd; border-radius: 10px; }
.panel-subtitle { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.absolute-guard-card { margin-top: 17px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--amber); background: #fbfcfa; display: grid; gap: 5px; }
.absolute-guard-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.guard-pill { padding: 4px 8px; border-radius: 2px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.guard-pill.active { color: #a64d40; background: var(--coral-soft); }
.guard-pill.clear { color: #17685f; background: var(--teal-soft); }
.guard-pill.pending { color: #8b672d; background: #f6e8cb; }
.absolute-guard-card strong { font-size: 13px; }
.absolute-guard-card > span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.absolute-events-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 23px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 12px; }
.absolute-events-heading span { color: var(--muted); font-size: 11px; }
.absolute-events { margin-top: 11px; display: grid; gap: 8px; max-height: 220px; overflow-y: auto; padding-right: 7px; }
.absolute-event { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 9px 10px; background: #fbfcfa; border: 1px solid var(--line); }
.absolute-event-date { color: var(--muted); font-size: 11px; }
.absolute-event-body strong { display: block; font-size: 11px; }
.absolute-event-body span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.absolute-event.triggered { border-left: 3px solid var(--coral); }
.absolute-event.recovered { border-left: 3px solid var(--teal); }
.backtest-panel { padding: 24px 26px 20px; }
.backtest-explain { margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--teal); background: #f1f8f6; color: #46635d; font-size: 12px; line-height: 1.65; }
.backtest-explain strong { color: var(--ink); }
.backtest-window { margin-top: 12px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.backtest-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-top: 25px; }
.backtest-stat { display: grid; gap: 6px; justify-content: start; padding: 12px 13px; border: 1px solid var(--line); background: #fbfcfa; }
.backtest-stat span { font-size: 11px; }
.backtest-stat strong { font-size: 19px; line-height: 1.2; }
.backtest-detail { margin-top: 13px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.backtest-chart-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 25px; color: var(--ink); font-size: 12px; }
.backtest-chart-heading span { color: var(--muted); font-size: 11px; }
.backtest-legend { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.backtest-legend .legend-item { gap: 7px; }
.backtest-legend .legend-line { height: 3px; border-radius: 3px; }
.mini-chart-wrap { height: 320px; margin-top: 8px; padding: 8px 0 0; border-top: 1px solid var(--line); overflow: hidden; }
.backtest-note { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
@media (max-width: 720px) {
  .main-content { padding: 22px 14px; }
  .backtest-panel { padding: 18px 14px 16px; }
  .backtest-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-summary .backtest-stat:last-child { grid-column: 1 / -1; }
  .mini-chart-wrap { height: 260px; }
  .timeline { max-height: 310px; }
}
