/* Page-specific aliases; shared colors and type live in site-shell.css. */
:root {
  --bg: var(--paper);
  --surface: var(--paper);
  --raised: var(--wash);
  --body: var(--ink);
  --border: var(--line);
  --rule: var(--ink);
  --accent: var(--orange);
  --accent-text: var(--orange-text);
  --up: var(--gain);
  --down: var(--loss);
  --chart-surface: var(--paper);
  --mono: "SFMono-Regular", Menlo, Consolas, "PingFang SC", monospace;
  --series-1: #2563eb;
  --series-2: #d97706;
  --series-3: #7752a7;
  --monitor-wash: #edf2fc;
  --monitor-hover: #e6edfa;
  --challenger-wash: #f8f2e9;
  --challenger-hover: #f4eadb;
  --notice-wash: #f8f1e4;
  --notice-error-wash: #f9efed;
  --log-alert-wash: #f1f7f2;
  --log-error-wash: #faf0ee;
}
:root[data-theme="dark"] {
  --body: #d5d7d8;
  --series-1: #4985ed;
  --series-2: #cb7421;
  --series-3: #9a70db;
  --monitor-wash: #1b2637;
  --monitor-hover: #25344c;
  --challenger-wash: #2d251b;
  --challenger-hover: #3b2e20;
  --notice-wash: #282317;
  --notice-error-wash: #301c1c;
  --log-alert-wash: #192921;
  --log-error-wash: #2c1d1d;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-width: 320px; font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  transform: translateY(-150%);
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { transform: none; }

.wrap { max-width: 1800px; margin: 0 auto; padding: 0 52px env(safe-area-inset-bottom); }
.terminal { min-width: 0; }
.page-header { padding: 42px 0 0; }
.header-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 19px; min-width: 0; }
.mark { flex: none; display: grid; place-items: center; width: 50px; height: 50px; background: var(--raised); color: var(--accent); font-size: 16px; font-weight: 800; }
.header-kicker { color: var(--muted); font: 600 11px/1.4 var(--mono); letter-spacing: .05em; }
h1 { margin: 4px 0 0; font-size: clamp(34px, 4vw, 56px); font-weight: 800; line-height: 1.07; letter-spacing: -.055em; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 9px; padding-bottom: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.dot { flex: none; width: 7px; height: 7px; background: var(--muted); }
.dot.on { background: var(--gain); }
.dot.warn { background: var(--warning); }
.dot.err { background: var(--loss); }
.promptline { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding: 12px 0; border-top: 2px solid var(--rule); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.cmd strong { margin-left: 8px; color: var(--ink); font-weight: 700; }
.readonly-note { white-space: nowrap; }

.notice { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; padding: 12px 14px; border-left: 3px solid var(--warning); background: var(--notice-wash); color: var(--warning); font-size: 12px; }
.notice.error { border-color: var(--loss); background: var(--notice-error-wash); color: var(--loss); }

.monitor-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 37px 0 26px; }
.event-copy { min-width: 0; }
.eyebrow { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.event-copy h2 { max-width: 960px; margin: 0; font-size: clamp(23px, 2.6vw, 37px); font-weight: 750; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.event-link { display: inline-block; margin-top: 10px; color: var(--accent-text); text-underline-offset: 3px; font-size: 12px; }
.event-link:hover { color: var(--ink); }
.mode-chip, .pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--body); font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.mode-chip { padding: 4px 9px; }
.mode-chip.armed { border-color: var(--loss); color: var(--loss); }
.pill { padding: 1px 6px; }
.pill.alert, .pill.sell { border-color: var(--loss); color: var(--loss); }
.pill.buy { border-color: var(--gain); color: var(--gain); }
.pill.info { border-color: var(--series-1); color: var(--series-1); }

.monitor-kpis, .account-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--rule); border-bottom: 1px solid var(--rule); }
.account-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { min-width: 0; padding: 15px 16px 15px 0; border-right: 1px solid var(--border); }
.kpi + .kpi { padding-left: 18px; }
.kpi:last-child { border-right: 0; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .val { min-height: 32px; margin-top: 3px; color: var(--ink); font-size: clamp(20px, 2.1vw, 28px); font-weight: 750; line-height: 1.28; letter-spacing: -.035em; overflow-wrap: anywhere; }
.kpi .hero-value { font-size: clamp(30px, 3vw, 43px); line-height: 1.12; }
.kpi .unit { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.kpi .hint { margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.val.up { color: var(--gain); }
.val.down { color: var(--loss); }

.filterbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--border); background: var(--paper); }
.filter-label { color: var(--muted); font-size: 12px; }
.segmented { display: inline-flex; gap: 4px; }
.segmented button { min-height: 32px; padding: 5px 12px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.segmented button:hover { color: var(--ink); background: var(--raised); }
.segmented button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 700; }

.content { padding: 0 0 54px; transition: opacity .18s ease; }
.content.loading { opacity: .6; }
.content > section { margin-top: 47px; }
.content > section:first-child { margin-top: 33px; }
.sec-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.sec-h h2, .sec-h h3 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.sec-h p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.sec-h > span { flex: none; color: var(--muted); font-size: 12px; }
.sec-h.compact { align-items: center; margin-bottom: 10px; }
.sec-h.compact h3 { font-size: 15px; }
.view-toggle { min-height: 32px; padding: 5px 10px; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; white-space: nowrap; }
.view-toggle:hover { color: var(--paper); background: var(--ink); }

.chart-shell { padding: 13px 16px 10px; border: 1px solid var(--border); }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; min-height: 28px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--body); font-size: 12px; }
.legend-line { width: 18px; height: 2px; background: var(--series-color); }
.chart-stage { position: relative; min-height: 340px; }
.history-chart { display: block; width: 100%; height: auto; min-height: 340px; touch-action: pan-y; }
.history-chart .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart .axis { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart .axis-label { fill: var(--muted); font: 11px var(--font); }
.history-chart .series-line { fill: none; stroke: var(--series-color); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.history-chart .series-dot, .history-chart .focus-dot { fill: var(--series-color); stroke: var(--chart-surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-chart .crosshair { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.history-chart .hit-layer { fill: transparent; cursor: crosshair; }
.chart-tooltip { position: absolute; z-index: 3; min-width: 190px; max-width: min(310px, calc(100vw - 50px)); padding: 10px 12px; pointer-events: none; border: 1px solid var(--rule); background: var(--surface); color: var(--body); font-size: 12px; }
.tooltip-time { margin-bottom: 7px; color: var(--muted); }
.tooltip-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 5px; }
.tooltip-key { height: 2px; background: var(--series-color); }
.tooltip-series { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.tooltip-value { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-help { margin: 2px 4px 0; color: var(--muted); font-size: 11px; }
.chart-empty { border-top: 1px solid var(--border); }

.table-wrap { overflow: auto; overscroll-behavior-inline: contain; border-top: 1px solid var(--rule); }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 1; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; }
td { color: var(--body); font-size: 12px; }
tbody tr:hover td { background: var(--raised); }
tr.monitored td { background: var(--monitor-wash); }
tr.challenger td { background: var(--challenger-wash); }
tr.monitored:hover td { background: var(--monitor-hover); }
tr.challenger:hover td { background: var(--challenger-hover); }
.num { text-align: right !important; }
.inst { max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 700; }
.meta { max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; }
.empty { padding: 27px 16px; text-align: center; color: var(--muted); font-size: 12px; }
.history-table { margin-top: 12px; }

.timeline { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.timeline-item { position: relative; display: grid; grid-template-columns: 132px 10px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.timeline-mark { width: 6px; height: 6px; margin-top: 6px; background: var(--series-1); }
.timeline-item.alert .timeline-mark { background: var(--loss); }
.source-timeline .timeline-item { grid-template-columns: 160px 10px minmax(0, 1fr); }
.source-timeline .timeline-mark { background: var(--accent); }
.timeline-copy { min-width: 0; }
.timeline-title { color: var(--ink); font-size: 12px; }
.timeline-detail { margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.log-tools { flex: none; display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.log-tools span { font-variant-numeric: tabular-nums; }
.logpane { max-height: 300px; overflow: auto; overscroll-behavior: contain; padding: 7px 0; border: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; }
.log-line { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 3px 12px; color: var(--body); font: 11px/1.5 var(--mono); }
.log-line:hover { background: var(--raised); }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-line.warn .log-text { color: var(--warning); }
.log-line.alert .log-text { color: var(--gain); }
.log-line.error .log-text { color: var(--loss); }
.log-line.alert { background: var(--log-alert-wash); }
.log-line.error { background: var(--log-error-wash); }

.account-section { padding-top: 33px; border-top: 2px solid var(--rule); }
.account-heading { align-items: center; }
.account-state { display: inline-flex; align-items: center; gap: 5px; }
.account-state.stale { color: var(--warning); }
.account-state.live { color: var(--gain); }
.subsection { margin-top: 26px; }
.activity-toggle { display: block; width: 100%; margin-top: 12px; text-align: center; }
noscript { display: block; margin: 20px; color: var(--loss); text-align: center; }

@media (max-width: 1000px) {
  .wrap { padding-inline: 32px; }
  .account-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-kpis .kpi:nth-child(3) { border-right: 0; }
  .account-kpis .kpi:nth-child(n+4) { border-top: 1px solid var(--border); }
  .account-kpis .kpi:nth-child(4) { padding-left: 0; }
}
@media (max-width: 720px) {
  .wrap { padding-inline: 20px; }
  .page-header { padding-top: 30px; }
  .header-top { align-items: flex-start; flex-direction: column; gap: 13px; }
  .status { padding: 0; white-space: normal; }
  .monitor-hero { align-items: flex-start; flex-direction: column; gap: 13px; padding-block: 29px 24px; }
  .monitor-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-kpis .kpi:nth-child(2) { border-right: 0; }
  .monitor-kpis .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .monitor-kpis .kpi:nth-child(3) { padding-left: 0; }
  .content > section { margin-top: 39px; }
  .sec-h { align-items: flex-start; }
  .chart-shell { padding: 11px 7px 9px; }
  .chart-stage, .history-chart { min-height: 280px; }
  .log-tools { flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 480px) {
  .wrap { padding-inline: 16px; }
  .mark { width: 40px; height: 40px; font-size: 13px; }
  .brand { align-items: flex-start; gap: 12px; }
  h1 { font-size: 36px; }
  .sub { font-size: 12px; }
  .promptline { margin-top: 22px; gap: 6px; flex-wrap: wrap; }
  .readonly-note { font-size: 11px; }
  .kpi, .kpi + .kpi { padding: 12px 9px; }
  .monitor-kpis .kpi:nth-child(odd), .account-kpis .kpi:nth-child(3n+1) { padding-left: 0; }
  .kpi .val { font-size: 20px; }
  .kpi .hero-value { font-size: 29px; }
  .account-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-kpis .kpi:nth-child(3) { border-right: 1px solid var(--border); }
  .account-kpis .kpi:nth-child(even) { border-right: 0; }
  .account-kpis .kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
  .account-kpis .kpi:nth-child(4) { padding-left: 9px; }
  .account-kpis .kpi:nth-child(5) { padding-left: 0; }
  .filterbar { align-items: flex-start; flex-direction: column; gap: 7px; padding: 12px 0; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding-inline: 3px; }
  .sec-h { flex-wrap: wrap; gap: 10px; }
  .sec-h p { font-size: 11px; }
  .log-tools { width: 100%; justify-content: space-between; }
  .logpane { max-height: 260px; }
  .log-line { grid-template-columns: 57px minmax(0, 1fr); gap: 6px; padding-inline: 7px; font-size: 10px; }
  .timeline-item, .source-timeline .timeline-item { grid-template-columns: 8px minmax(0, 1fr); gap: 8px; }
  .timeline-time { grid-column: 2; grid-row: 2; }
  .timeline-mark { grid-column: 1; grid-row: 1 / span 2; }
  .timeline-copy { grid-column: 2; grid-row: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
@media (forced-colors: active) {
  .history-chart .series-line:nth-of-type(2n) { stroke-dasharray: 7 4; }
  .history-chart .series-line:nth-of-type(3n) { stroke-dasharray: 2 4; }
  .timeline-mark, .dot { border: 1px solid currentColor; }
}

/* Account overview leads; the range control starts the historical data that follows. */
.content > .account-section { margin-top: 33px; padding-top: 0; border-top: 0; }
.content > .filterbar { margin-top: 31px; border-top: 1px solid var(--border); }

/* A paired data-and-activity row echoes the reference page's two-column market view. */
@media (min-width: 1100px) {
  .content { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; column-gap: 40px; }
  .content > section { grid-column: 1 / -1; }
  .content > .filterbar { grid-column: 1 / -1; }
  .content > .history-section { grid-column: 1; margin-top: 33px; }
  .content > .log-section { grid-column: 2; margin-top: 33px; }
  .chart-stage, .history-chart { min-height: 250px; }
  .logpane { height: 290px; max-height: 290px; }
  .log-section .sec-h { min-height: 50px; }
  .log-section .log-tools { justify-content: flex-end; flex-wrap: wrap; }
}

/* Keep the ranking table readable even when placed beside the activity feed. */
@media (min-width: 1100px) {
  .history-table table { min-width: 720px; }
}

/* On narrow screens the chart uses a matching SVG viewBox, not a scaled-down desktop chart. */
@media (max-width: 720px) {
  .chart-stage { min-height: 290px; }
  .history-chart { min-height: 0; }
}
