:root {
  color-scheme: dark;
  --background: #0b1014;
  --sidebar: #0d1318;
  --panel: #11191f;
  --border: #26333b;
  --hairline: #212d35;
  --text: #e8eff3;
  --muted: #a5b3bd;
  --subtle: #889ba8;
  --accent: #75e4c8;
  --mono: 'Cascadia Mono', Consolas, monospace;
  font-family: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  background: var(--background);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
section[id] { scroll-margin-block-start: 68px; }
.skip { position: fixed; z-index: 5; top: 8px; left: 8px; padding: 10px; background: var(--panel); transform: translateY(-150%); }
.skip:focus { transform: none; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--hairline); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 78px; padding: 0 20px; border-bottom: 1px solid var(--hairline); }
.brand strong { display: block; font-size: 18px; font-weight: 750; letter-spacing: .08em; line-height: 1.3; }
.brand small, .side-footer small { display: block; color: var(--subtle); font-size: 11px; margin-top: 3px; }
.brand-mark { display: flex; align-items: end; justify-content: center; gap: 3px; height: 36px; width: 36px; flex: 0 0 36px; padding-bottom: 9px; background: #15312d; border: 1px solid #2a5148; border-radius: 8px; }
.brand-mark i { width: 3px; background: var(--accent); border-radius: 1px; height: 8px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 17px; }
.side-nav { display: grid; gap: 4px; padding: 18px 12px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 10px; color: var(--muted); border: 1px solid transparent; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.side-nav a:hover { background: #152026; color: var(--text); }
.side-nav a[aria-current] { color: var(--accent); background: #152722; border-color: #24413a; }
.nav-icon { width: 14px; height: 14px; flex: 0 0 auto; position: relative; display: inline-block; border: 1px solid currentColor; border-radius: 3px; opacity: .9; }
.grid-icon::before, .grid-icon::after { content: ''; position: absolute; background: currentColor; }
.grid-icon::before { width: 1px; height: 100%; left: 5px; }
.grid-icon::after { height: 1px; width: 100%; top: 5px; }
.model-icon { transform: rotate(45deg) scale(.8); }
.model-icon::after { content: ''; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 1px; }
.sentiment-icon { border-radius: 5px 5px 5px 0; }
.sentiment-icon::after, .quality-icon::after { content: ''; position: absolute; inset: 4px 3px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.history-icon { border-radius: 50%; }
.history-icon::after { content: ''; position: absolute; top: 3px; left: 5px; width: 3px; height: 3px; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.side-footer { margin: auto 19px 20px; padding: 14px 0 0; border-top: 1px solid var(--hairline); display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 12px; }
.side-footer .status-dot { margin-top: 5px; }
.status-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; background: #70cdb6; border-radius: 50%; }
.status-dot.neutral { background: #8b9ba3; }

.workspace { min-width: 0; }
.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--hairline); color: var(--subtle); font-size: 12px; }
.topbar strong { color: var(--muted); font-weight: 600; }
.slash { padding: 0 7px; color: #71828c; }
.top-status { display: flex; align-items: center; gap: 9px; font: 11px var(--mono); letter-spacing: .05em; }
.top-divider { background: var(--border); width: 1px; height: 14px; margin: 0 2px; }
.content { width: min(100%, 1536px); margin: auto; padding: 26px 32px 30px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.intro h1 { font-size: clamp(24px, 3vw, 37px); font-weight: 720; letter-spacing: -.042em; line-height: 1.1; }
.intro p { color: var(--muted); margin-top: 8px; font-size: 13px; }
.environment { color: var(--accent); font: 11px var(--mono); letter-spacing: .05em; white-space: nowrap; border: 1px solid #285148; background: #142521; padding: 7px 9px; border-radius: 5px; }
.environment span { color: #5b9a8a; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; min-width: 0; }
.market-grid { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(0, 1fr); gap: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; min-width: 0; }
.panel-head h2, .panel-head h3, .section-title h2 { font-size: 13px; font-weight: 730; letter-spacing: .04em; line-height: 1.25; }
.panel-head p { color: var(--subtle); font-size: 12px; margin-top: 3px; }
.market-head { min-height: 62px; }
.market-name, .model-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.btc-mark { display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 33px; border-radius: 50%; background: #30271c; border: 1px solid #51402b; color: #ffbf6a; font-size: 20px; font-weight: 650; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; white-space: nowrap; border: 1px solid #37454e; border-radius: 4px; color: #c5d0d7; background: #1a242b; font: 10px var(--mono); letter-spacing: .02em; }
.pill.unavailable { color: #dec49f; border-color: #594832; background: #282218; }
.pill.pass { color: var(--accent); background: #142822; border-color: #295146; }
.pill.historical { color: var(--accent); border-color: #34534f; background: #152724; }
.chart-terminal { min-width: 0; margin: 0 12px; border: 1px solid #30404a; border-radius: 6px; background: #10171d; }
.chart-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; min-height: 35px; padding: 4px 8px; border-bottom: 1px solid var(--hairline); }
.chart-intervals, .chart-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font: 11px var(--mono); }
.chart-intervals button, .chart-buttons button { min-width: 25px; min-height: 25px; padding: 1px 6px; background: #19252d; color: var(--text); border: 1px solid #354752; border-radius: 4px; cursor: pointer; }
.chart-intervals button { min-width: 32px; color: var(--muted); }
.chart-intervals button[aria-pressed='true'] { color: var(--accent); border-color: #4f9d8a; background: #17332e; }
.chart-intervals button:hover:enabled, .chart-buttons button:hover:enabled { border-color: #69bfae; color: var(--accent); }
.chart-buttons button:disabled { color: #7f929e; background: #151e25; cursor: default; }
.chart-readout { display: flex; gap: 4px 13px; align-items: center; flex-wrap: wrap; min-height: 26px; padding: 5px 8px 3px; color: #bdcbd4; font: 11px var(--mono); }
.chart-readout span:first-child { color: var(--text); }
.chart-readout .rise { color: #52d6a6; }
.chart-readout .fall { color: #f17d8b; }
.chart-stage { min-height: 215px; display: grid; align-items: center; }
.chart-stage canvas { display: block; width: 100%; height: 215px; touch-action: pan-y; cursor: crosshair; }
.chart-stage [hidden] { display: none; }
.chart-error { text-align: center; padding: 10px; color: #dec49f; font: 11px var(--mono); }
.chart-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-height: 32px; padding: 3px 8px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 10px; }
.chart-navigation label { flex: none; }
.chart-navigation input { min-width: 3.75rem; flex: 1 1 3.75rem; margin: 0; accent-color: #75e4c8; }
.chart-navigation span { min-width: 0; overflow-wrap: anywhere; font: 10px var(--mono); }
.chart-disclosure { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 9px; padding: 8px 13px 10px; color: var(--subtle); font-size: 10px; }
.chart-disclosure span { font-family: var(--mono); }
.horizon-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 2px 15px 0; }
.horizon-buttons button { min-height: 39px; border: 1px solid #33434d; border-radius: 5px; color: var(--muted); background: #151f26; cursor: pointer; font: 600 13px var(--mono); }
.horizon-buttons button:hover { background: #203039; color: var(--text); }
.horizon-buttons button[aria-pressed='true'] { background: #17332e; color: var(--accent); border-color: #4f9d8a; }
.horizon-summary { margin: 14px 15px 0; display: flex; justify-content: space-between; gap: 6px; align-items: center; padding: 11px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.horizon-summary strong { font: 650 14px var(--mono); color: var(--text); }
.horizon-summary small { font: 11px var(--mono); color: var(--subtle); }
.horizon-status { display: flex; align-items: center; gap: 7px; margin: 1px 15px 13px; color: var(--subtle); font: 10px var(--mono); }
.chart-resolution-note { margin: 0 15px 14px; color: var(--subtle); font-size: 11px; line-height: 1.45; }

.model-section { margin-top: 17px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.section-title > span { color: var(--subtle); font-size: 11px; }
.section-title strong { color: var(--accent); font: 11px var(--mono); }
.models-grid, .details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.models-grid { align-items: start; }
.candidate { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 5px; background: #1b2b34; border: 1px solid #3a505b; color: #c3d6df; font: 600 13px var(--mono); }
.model-status-card > .panel-head { align-items: flex-start; min-height: 62px; }
.model-status-card h3 { font-size: 15px; letter-spacing: 0; }
.model-horizon { flex: 0 0 auto; padding: 4px 7px; color: var(--accent); border: 1px solid #2e5049; background: #152923; border-radius: 4px; font: 600 11px var(--mono); }
.model-prediction, .model-sentiment { border-top: 1px solid var(--hairline); padding: 10px 15px 13px; }
.model-status-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 8px; color: var(--muted); font: 11px var(--mono); }
.model-status-line h4 { margin: 0; color: var(--text); font: inherit; font-weight: 650; }
.model-decision { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 8px; margin-block: 11px; padding: 9px 8px; border-radius: 5px; background: #0e171c; border: 1px solid var(--hairline); }
.model-decision > div:first-child { display: grid; gap: 4px; }
.model-decision > div:first-child span, .model-grid dt { color: var(--subtle); font-size: 11px; }
.model-decision strong, .model-grid dd { color: var(--muted); font: 11px/1.35 var(--mono); overflow-wrap: anywhere; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.model-grid > div { min-width: 0; }
.model-grid dd { margin-top: 4px; }
.model-probabilities > div { padding: 8px; border-radius: 5px; border: 1px solid var(--hairline); background: #151f25; }
.model-metadata { margin-top: 12px; }
.model-sentiment .model-grid { margin-top: 10px; }
.directions { display: flex; flex-wrap: wrap; gap: 5px; }
.directions span, .impact-classes span { padding: 4px 7px; border-radius: 4px; border: 1px solid #334049; background: #182128; color: #a4afb8; font: 10px var(--mono); white-space: nowrap; }
.directions [data-direction='LONG'].decision-active { color: #72e2ad; background: #163024; border-color: #3c795d; }
.directions [data-direction='SHORT'].decision-active { color: #ff9aa4; background: #351d26; border-color: #884853; }
.directions [data-direction='WAIT'].decision-active { color: var(--text); background: #26343e; border-color: #6d8291; }

.details-grid { margin-top: 14px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.impact-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px 12px; padding: 3px 15px 12px; }
.impact-metrics dt, .quality-facts dt { color: var(--subtle); font-size: 11px; }
.impact-metrics dd { margin-top: 4px; color: var(--muted); font: 12px var(--mono); }
.impact-classes { display: flex; flex-wrap: wrap; gap: 5px; border-top: 1px solid var(--hairline); padding: 9px 15px; }
.quality-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 9px; margin: 0 15px 8px; }
.quality-total strong { font: 650 30px/1 var(--mono); letter-spacing: -.06em; color: var(--accent); }
.quality-total span { font-size: 11px; color: var(--muted); }
.quality-facts { display: grid; gap: 5px; margin: 0 15px; }
.quality-facts > div { display: flex; justify-content: space-between; gap: 7px; align-items: baseline; }
.quality-facts dd { text-align: right; color: var(--text); font-size: 11px; }
.quality-facts dd span { color: var(--accent); font: 10px var(--mono); }
.quality-facts dd .source-kind { color: var(--subtle); margin-left: 3px; }
.quality-note { margin: 8px 15px 9px; color: var(--subtle); font-size: 10px; }
.quality-note span { color: #68858a; }

.history { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 11px; text-align: left; }
th { font-weight: 600; color: var(--muted); background: #151f26; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 8px 15px; white-space: nowrap; }
td { padding: 12px 15px; color: var(--subtle); text-align: center; }

@media (max-width: 1020px) {
  body { grid-template-columns: 185px minmax(0, 1fr); }
  .brand { padding-inline: 13px; }
  .side-nav { padding-inline: 8px; }
  .content, .topbar { padding-inline: 20px; }
  .market-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}

@media (max-width: 760px) {
  body { display: block; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .brand { min-height: 55px; padding-inline: 16px; }
  .side-nav { display: flex; flex-wrap: wrap; padding: 6px 12px; gap: 3px; }
  .side-nav a { padding: 6px; font-size: 11px; gap: 6px; }
  .nav-icon { width: 12px; height: 12px; }
  .grid-icon::before { left: 4px; }
  .grid-icon::after { top: 4px; }
  .side-footer { display: none; }
  .topbar { height: 38px; }
  .content, .topbar { padding-inline: 14px; }
  .content { padding-top: 18px; }
  section[id] { scroll-margin-block-start: 10px; }
}

@media (max-width: 560px) {
  .intro { align-items: flex-start; flex-direction: column; margin-bottom: 14px; gap: 10px; }
  .market-grid, .models-grid, .details-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .chart-navigation span { width: 100%; padding-block: 2px; }
  .section-title { margin-bottom: 7px; }
  .history th { padding-inline: 8px; }
}

.chart-disclosure[hidden] { display: none; }
