:root {
  color-scheme: dark;
  --bg: #0e1110;
  --rail: #111513;
  --surface: #151a18;
  --line: #2b312e;
  --line-strong: #424944;
  --text: #e8ece9;
  --muted: #929b96;
  --accent: #d8a93b;
  --long: #d4635b;
  --short: #58a6a6;
  font-family: "Segoe UI Variable", "Aptos", system-ui, sans-serif;
}

* { box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select, input[type="number"], input[type="date"] {
  color: var(--text); background: #191e1b; border: 1px solid var(--line-strong); border-radius: 6px;
}
button { min-height: 40px; padding: 0 14px; cursor: pointer; }
button:hover { border-color: var(--accent); color: #f2c75f; }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .45; }
button:disabled:hover { border-color: var(--line-strong); color: var(--text); }
button:disabled:active { transform: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input[type="number"], input[type="date"] { width: 100%; min-height: 40px; padding: 8px 10px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 820px; margin-bottom: 12px; font-size: clamp(42px, 6vw, 76px); line-height: .94; letter-spacing: -.055em; font-weight: 590; }
h2 { font-size: 18px; letter-spacing: -.025em; }
h3 { font-size: 24px; letter-spacing: -.035em; }
p { color: var(--muted); line-height: 1.55; }
small { color: var(--muted); }

.loading, .startup-error { position: fixed; right: 18px; bottom: 18px; z-index: 20; max-width: min(420px, calc(100vw - 36px)); padding: 12px 14px; border: 1px solid var(--line-strong); border-left: 2px solid var(--accent); border-radius: 6px; background: var(--surface); box-shadow: 0 14px 40px rgba(4, 7, 5, .34); font: 12px ui-monospace, monospace; color: var(--muted); }
.loading::after { content: ""; display: inline-block; width: 18px; height: 1px; margin-left: 10px; vertical-align: middle; background: var(--accent); animation: load 1.2s ease-in-out infinite alternate; }
@keyframes load { to { width: 42px; } }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.control-rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 22px 20px 32px; background: var(--rail); border-right: 1px solid var(--line); }
.rail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.rail-head strong, .rail-head small { display: block; }
.rail-head strong { font-size: 14px; }
.rail-head small { margin-top: 2px; font: 10px ui-monospace, monospace; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); font: 700 13px ui-monospace, monospace; }
.control-group { padding: 20px 0; border-top: 1px solid var(--line); }
.control-group h2 { margin-bottom: 16px; font-size: 12px; color: var(--text); text-transform: uppercase; letter-spacing: .1em; }
.control-group > label, .predictor-inputs label { display: block; margin: 14px 0 7px; color: var(--muted); font-size: 12px; }
.control-group output { float: right; color: var(--accent); font-family: ui-monospace, monospace; }
fieldset { padding: 0; margin: 18px 0 0; border: 0; }
legend { margin-bottom: 9px; color: var(--muted); font-size: 12px; }
label.inline { margin-right: 14px; font-size: 12px; }
label.check { display: block; margin: 8px 0; font-size: 12px; color: var(--text); }
.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date-grid label { font-size: 11px; color: var(--muted); }
.date-grid input { margin-top: 7px; font-size: 11px; }
#csvUpload { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-button { display: grid !important; place-items: center; min-height: 40px; margin: 0 0 10px !important; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text) !important; cursor: pointer; }
.file-button:hover { border-color: var(--accent); color: #f2c75f !important; }
.access-summary { width: 100%; min-height: 62px; padding: 10px 12px; text-align: left; }
.access-summary span, .access-summary small { display: block; }
.access-summary span { margin-bottom: 5px; color: var(--text); font-size: 12px; font-weight: 650; }
.access-summary small { font: 10px/1.45 ui-monospace, "Cascadia Mono", monospace; }
.rail-note { margin: 10px 0 0; font-size: 10px; line-height: 1.45; }

main { min-width: 0; max-width: 1600px; width: 100%; margin: 0 auto; padding: 34px 42px 70px; }
.page-head { padding: 24px 0 42px; }
.page-head > p:last-child { max-width: 650px; font-size: 16px; }
.eyebrow { margin-bottom: 22px; font: 11px ui-monospace, monospace; color: var(--accent); letter-spacing: .14em; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px; }
.metrics > div { padding: 14px 0 18px; border-top: 1px solid var(--line); }
.metrics span, .metrics strong { display: block; }
.metrics span { margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.metrics strong { font: 500 clamp(22px, 2.4vw, 34px) ui-monospace, "Cascadia Mono", monospace; letter-spacing: -.05em; }
.tabs { display: flex; gap: 26px; margin: 18px 0 26px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { min-height: 46px; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: none; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; min-height: 600px; }
.tab-panel.active { display: block; }
body[data-view="rotation"] .study-control,
body[data-view="rotation"] .page-head,
body[data-view="rotation"] .study-summary,
body[data-view="predictor"] .study-control,
body[data-view="predictor"] .page-head,
body[data-view="predictor"] .study-summary { display: none; }
.chart { min-height: 330px; }
.chart-large { min-height: 590px; }
.chart-medium { min-height: 430px; }
.chart-small { min-height: 290px; }
.liquidation-terminal { overflow: hidden; border: 1px solid #292438; border-radius: 9px; background: #0b0911; box-shadow: 0 28px 70px rgba(3, 2, 8, .38); }
.heatmap-commandbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px 16px; border-bottom: 1px solid #292438; background: #100d18; }
.live-title { min-width: 0; }
.live-title .panel-kicker { margin-bottom: 6px !important; color: #b4a8d2 !important; }
.live-title h2 { margin: 0 0 8px; font-size: clamp(21px, 2vw, 30px); letter-spacing: -.04em; }
.connection-state { display: flex; align-items: center; gap: 8px; min-width: 0; font: 10px ui-monospace, "Cascadia Mono", monospace; }
.connection-state #liveStatusDetail { min-width: 0; overflow: hidden; color: #948aa9; text-overflow: ellipsis; white-space: nowrap; }
#liveStatusDot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(216, 169, 59, .1); }
#liveStatusDot.connected { background: var(--short); box-shadow: 0 0 0 3px rgba(88, 166, 166, .1); }
#liveStatusDot.error { background: var(--long); box-shadow: 0 0 0 3px rgba(212, 99, 91, .1); }
#liveStatusDot.paused { background: var(--muted); box-shadow: none; }
.map-mode-switch { display: grid; grid-template-columns: 1fr 1fr; flex: 0 0 auto; padding: 3px; border: 1px solid #373047; border-radius: 7px; background: #09070e; }
.map-mode-switch button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 4px; background: transparent; color: #8e849f; font: 10px ui-monospace, "Cascadia Mono", monospace; }
.map-mode-switch button:hover { color: #f4efff; }
.map-mode-switch button.active { background: #282038; color: #fff8d8; box-shadow: inset 0 0 0 1px #463b5e; }
.live-controls { display: grid; grid-template-columns: minmax(150px, 1.15fr) repeat(4, minmax(105px, .78fr)) auto; align-items: end; gap: 10px; padding: 14px 22px; border-bottom: 1px solid #322a41; background: #0b0911; }
.live-controls label { min-width: 0; color: #8e849f; font: 9px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.live-controls select { min-width: 0; min-height: 36px; margin-top: 6px; border-color: #373047; background: #151020; font-size: 11px; }
.live-controls button { min-height: 36px; white-space: nowrap; border-color: #4a3e61; background: #211a2f; }
#live[data-map-mode="projected"] .book-only, #live[data-map-mode="book"] .projected-only { display: none !important; }
#live[data-map-mode="projected"] .book-key, #live[data-map-mode="book"] .projected-key { display: none !important; }
.live-metrics { grid-template-columns: repeat(6, 1fr); gap: 1px; padding: 0; background: #292438; }
.live-metrics > div { min-width: 0; padding: 12px 16px 14px; border: 0; background: #100d18; }
.live-metrics span { margin-bottom: 5px; overflow: hidden; color: #857a99; font: 9px ui-monospace, "Cascadia Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.live-metrics strong { overflow: hidden; color: #f3eff7; font-size: clamp(15px, 1.35vw, 21px); text-overflow: ellipsis; white-space: nowrap; }
.projected-summary { grid-template-columns: repeat(4, 1fr); gap: 1px; padding: 0; background: #322a41; }
.projected-summary > div { min-width: 0; padding: 12px 18px 14px; border: 0; background: #15111d; }
.projected-summary span { margin-bottom: 5px; color: #8f84a0; font: 9px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .04em; }
.projected-summary strong { overflow: hidden; color: #f7f3fa; font-size: clamp(16px, 1.5vw, 23px); text-overflow: ellipsis; white-space: nowrap; }
.projected-summary > div:nth-child(2) strong { color: #5deeff; }
.projected-summary strong.positive { color: var(--short); }
.projected-summary strong.negative { color: var(--long); }
.heatmap-workspace { min-width: 0; }
.heatmap-stage { min-width: 0; }
.heatmap-stage-head { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 18px; border-bottom: 1px solid #292438; background: #0c0912; }
.heatmap-stage-head > div { min-width: 0; }
.heatmap-stage-head > div:last-child { text-align: right; }
.heatmap-stage-head span, .heatmap-stage-head strong { display: block; }
.heatmap-stage-head span { margin-bottom: 4px; color: #80748f; font: 8px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .1em; }
.heatmap-stage-head strong { overflow: hidden; color: #dcd5e7; font: 10px ui-monospace, "Cascadia Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.heatmap-shell { position: relative; min-height: 660px; margin: 0; overflow: hidden; border: 0; background: #09070d; }
.live-heatmap { min-height: 660px; }
.chart-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; min-height: 660px; padding: 24px; background: #09070d; color: #948aa9; text-align: center; }
.chart-state strong { color: var(--text); font-size: 14px; }
.chart-state span { max-width: 430px; font-size: 12px; line-height: 1.5; }
.chart-state[hidden] { display: none; }
.heatmap-key { min-height: 45px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 11px 18px; border-top: 1px solid #292438; background: #0d0a14; color: #958ba7; font: 9px ui-monospace, monospace; }
.heatmap-key span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 7px; vertical-align: middle; background: currentColor; }
.key-projected-intensity::before { width: 58px !important; height: 6px !important; border-radius: 2px; background: linear-gradient(90deg, #16130b, #4a3a15 45%, #9a7a26 78%, #e8c874) !important; }
.key-price-line { color: #5deeff !important; }
.key-price-line::before { height: 4px !important; border: 1px solid #08050d; border-radius: 4px; box-shadow: 0 0 8px rgba(93, 238, 255, .68); }
.key-long-zone { color: var(--long) !important; }
.key-short-zone { color: var(--short) !important; }
.key-bid, .key-buy { color: var(--short) !important; }
.key-ask, .key-sell { color: var(--long) !important; }
.key-liquidation { color: var(--accent) !important; }
.key-sampled { color: var(--muted) !important; }
.key-sampled::before { width: 9px !important; height: 9px !important; border: 1px solid currentColor; background: transparent !important; transform: rotate(45deg); }
.key-wall { color: var(--text) !important; }
.key-projected { color: var(--accent) !important; }
.key-buy::before, .key-sell::before { height: 7px !important; border-radius: 50%; }
.key-liquidation::before { height: 8px !important; transform: rotate(45deg); }
.key-wall::before { width: 9px !important; height: 9px !important; border: 2px solid var(--accent); background: var(--short) !important; transform: rotate(45deg); }
.key-projected::before { width: 9px !important; height: 9px !important; border: 2px solid var(--accent); background: transparent !important; transform: rotate(30deg); }
.key-intensity { margin-left: auto; }
.key-intensity::before { width: 42px !important; height: 5px !important; background: linear-gradient(90deg, var(--long), #231b19 45%, #172220 55%, var(--short)) !important; }
.wall-readout { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 0; margin: 0; padding: 0 20px; border-top: 1px solid #3a304a; background: #12101a; }
.wall-readout header { grid-column: 1 / -1; padding: 16px 0 12px; border-bottom: 1px solid #2c263a; }
.wall-readout header span, .wall-readout header strong { display: block; }
.wall-readout header span { margin-bottom: 5px; color: #8c7daa; font: 8px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .12em; }
.wall-readout header strong { color: #f1edf6; font-size: 13px; }
.wall-readout > div { min-width: 0; padding: 16px 18px 17px 0; border-bottom: 1px solid #2c263a; }
.wall-readout > div + div { padding-left: 18px; border-left: 1px solid #2c263a; }
.wall-readout span, .wall-readout small { display: block; color: #8e849f; font: 9px/1.55 ui-monospace, "Cascadia Mono", monospace; }
.wall-readout strong { display: block; margin: 6px 0 4px; overflow-wrap: anywhere; color: #f2edf7; font: 600 13px/1.4 ui-monospace, "Cascadia Mono", monospace; }
.wall-readout > div:nth-of-type(1) strong { color: var(--short); }
.wall-readout > div:nth-of-type(2) strong { color: var(--long); }
#live[data-map-mode="projected"] .wall-readout > div:nth-of-type(1) strong { color: var(--long); }
#live[data-map-mode="projected"] .wall-readout > div:nth-of-type(2) strong { color: var(--short); }
.wall-readout .projection-long strong { color: var(--long); }
.wall-readout .projection-short strong { color: var(--short); }
.wall-readout p { grid-column: 1 / -1; margin: 0; padding: 13px 0 16px; border: 0; color: #81778e; font-size: 9px; line-height: 1.6; }
body[data-view="live"] .app-shell { grid-template-columns: minmax(0, 1fr); }
body[data-view="live"] .control-rail, body[data-view="live"] .page-head, body[data-view="live"] .study-summary { display: none; }
body[data-view="live"] main { max-width: 1900px; padding: 16px 22px 64px; }
body[data-view="live"] .tabs { margin-top: 0; }
.live-lower-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 30px; }
.compact-head { min-height: 48px; margin: 0 0 12px; }
.compact-head h2 { margin-bottom: 5px; }
.compact-head p { margin-bottom: 0; font-size: 11px; }
.compact-head > strong { color: var(--accent); font: 12px ui-monospace, monospace; white-space: nowrap; }
.venue-health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: -2px 0 10px; background: var(--line); border: 1px solid var(--line); }
.venue-health span { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 7px 8px; background: var(--bg); color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; }
.venue-health strong { overflow: hidden; color: var(--accent); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.venue-health span.connected strong { color: var(--short); }
.venue-health span.error strong { color: var(--long); }
.live-table { height: 310px; }
.live-table td, .live-table th { padding: 9px 10px; }
.live-table td.buy, .live-table td.short-position { color: var(--short); }
.live-table td.sell, .live-table td.long-position { color: var(--long); }
.live-table td.liquidation { color: var(--accent); font-weight: 650; }
.compact-empty { min-height: 310px; display: grid; place-items: center; margin-top: -310px; padding: 28px; border-radius: 6px; background: var(--bg); font-size: 12px; }
.compact-empty[hidden] { display: none; }
.liquidation-archive { margin-top: 42px; padding-top: 30px; border-top: 1px solid var(--line); }
.archive-controls { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)) auto; align-items: end; gap: 10px; }
.archive-controls label { color: var(--muted); font-size: 10px; }
.archive-controls select { min-width: 0; margin-top: 7px; font-size: 11px; }
.archive-controls button { white-space: nowrap; }
.archive-metrics { grid-template-columns: repeat(4, 1fr); gap: 18px; }
.archive-metrics strong { font-size: clamp(18px, 1.65vw, 25px); }
.archive-chart-shell { position: relative; min-height: 430px; margin-top: 12px; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.archive-chart, .archive-chart-shell .history-state { min-height: 430px; }
.liquidation-history { margin-top: 42px; padding-top: 30px; border-top: 1px solid var(--line); }
.history-head { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 28px; margin-bottom: 22px; }
.history-head h2 { margin-bottom: 7px; font-size: clamp(21px, 2.1vw, 30px); letter-spacing: -.035em; }
.history-head p:not(.panel-kicker) { max-width: 670px; margin: 0; font-size: 12px; }
.history-controls { display: grid; grid-template-columns: minmax(120px, 1fr) auto; align-items: end; gap: 10px; }
.history-controls label { color: var(--muted); font-size: 10px; }
.history-controls select { min-width: 120px; margin-top: 7px; font-size: 11px; }
.history-controls button { white-space: nowrap; }
.history-metrics { grid-template-columns: repeat(4, 1fr); gap: 18px; }
.history-metrics strong { font-size: clamp(18px, 1.65vw, 25px); }
.history-chart-shell { position: relative; min-height: 390px; margin-top: 12px; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.history-chart, .history-state { min-height: 390px; }
.history-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 26px; background: var(--bg); color: var(--muted); text-align: center; }
.history-state strong { color: var(--text); font-size: 14px; }
.history-state span { max-width: 480px; font-size: 12px; line-height: 1.55; }
.history-state[hidden] { display: none; }
.history-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.panel-kicker { margin-bottom: 8px !important; color: var(--accent) !important; font: 10px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .13em; }
.rotation-toolbar { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(620px, 1.2fr); align-items: end; gap: 42px; margin: 8px 0 26px; }
.rotation-title h2 { margin-bottom: 7px; font-size: clamp(22px, 2.4vw, 34px); letter-spacing: -.04em; }
.rotation-title, .rotation-controls { min-width: 0; }
.rotation-title > p:last-child { max-width: 610px; margin-bottom: 0; overflow-wrap: anywhere; font-size: 12px; }
.rotation-controls { display: grid; grid-template-columns: .72fr 1.35fr .8fr auto; align-items: end; gap: 10px; }
.rotation-controls label { min-width: 0; color: var(--muted); font-size: 10px; }
.rotation-controls select { min-width: 0; margin-top: 7px; font-size: 11px; }
.rotation-controls button { white-space: nowrap; }
.rotation-metrics { gap: 18px; }
.rotation-metrics strong { font-size: clamp(19px, 1.8vw, 27px); }
.rotation-map-shell { position: relative; min-width: 0; min-height: 590px; overflow: hidden; margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rotation-chart, .rotation-state { min-height: 590px; }
.rotation-key { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 13px 0 4px; color: var(--muted); font: 10px ui-monospace, "Cascadia Mono", monospace; }
.rotation-key span { display: inline-flex; align-items: baseline; gap: 6px; }
.rotation-key strong { color: var(--text); font-weight: 600; }
.rotation-lower-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); gap: 34px; margin-top: 32px; }
.rotation-lower-grid > section { min-width: 0; }
.rotation-table { height: 390px; }
.rotation-table td, .rotation-table th { padding: 10px; }
.rotation-table td.bias-long { color: var(--long); }
.rotation-table td.bias-short { color: var(--short); }
.rotation-table td.bias-watch { color: var(--muted); }
.rotation-empty { min-height: 390px; margin-top: -390px; }
.rotation-workflow { padding: 2px 0 0 28px; border-left: 1px solid var(--line); }
.rotation-workflow > h2 { max-width: 360px; margin-bottom: 24px; font-size: 22px; }
.rotation-workflow ol { padding: 0; margin: 0; list-style: none; }
.rotation-workflow li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.rotation-workflow li > span { color: var(--accent); font: 10px ui-monospace, "Cascadia Mono", monospace; }
.rotation-workflow li strong { display: block; margin-bottom: 4px; font-size: 12px; }
.rotation-workflow li p { margin: 0; font-size: 10px; line-height: 1.55; }
.derivatives-panel { margin-top: 52px; padding-top: 34px; border-top: 1px solid var(--line); }
.derivatives-head { display: grid; grid-template-columns: minmax(280px, 1fr) auto; align-items: end; gap: 34px; margin-bottom: 22px; }
.derivatives-head h2 { margin-bottom: 7px; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -.04em; }
.derivatives-head > div > p:last-child { max-width: 720px; margin-bottom: 0; font-size: 12px; }
.derivatives-head button { white-space: nowrap; }
.derivatives-metrics { grid-template-columns: repeat(5, 1fr); gap: 18px; }
.derivatives-metrics strong { font-size: clamp(18px, 1.65vw, 25px); }
.derivatives-table { height: 340px; margin-top: 24px; }
.derivatives-table table { min-width: 940px; }
.derivatives-table td, .derivatives-table th { padding: 10px; }
.derivatives-table td.bias-long { color: var(--long); }
.derivatives-table td.bias-short { color: var(--short); }
.derivatives-table td.funding-positive, .derivatives-table td.funding-negative { color: var(--muted); }
.derivatives-table td.bias-watch, .derivatives-table td.funding-flat { color: var(--muted); }
.derivatives-empty { min-height: 340px; margin-top: -340px; }
.derivatives-method { max-width: 1080px; margin: 15px 0 0; font-size: 10px; line-height: 1.65; }
.validation-panel { margin-top: 54px; padding-top: 34px; border-top: 1px solid var(--line); }
.validation-head { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(480px, .9fr); align-items: end; gap: 42px; }
.validation-head h2 { margin-bottom: 7px; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -.04em; }
.validation-head > div:first-child > p:last-child { max-width: 670px; margin-bottom: 0; font-size: 12px; }
.validation-controls { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(165px, 1fr) auto; align-items: end; gap: 10px; }
.validation-controls label { min-width: 0; color: var(--muted); font-size: 10px; }
.validation-controls select { margin-top: 7px; font-size: 11px; }
.validation-controls button { white-space: nowrap; }
.validation-status { min-height: 19px; margin: 18px 0 8px; overflow-wrap: anywhere; color: var(--muted); font: 10px/1.55 ui-monospace, "Cascadia Mono", monospace; }
.validation-metrics { margin-top: 4px; gap: 18px; }
.validation-metrics strong { font-size: clamp(19px, 1.8vw, 27px); }
.validation-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 34px; align-items: start; margin-top: 24px; }
.validation-grid > * { min-width: 0; }
.validation-chart-shell { position: relative; min-height: 330px; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.validation-chart { min-height: 330px; }
.validation-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; color: var(--muted); background: var(--bg); font-size: 12px; text-align: center; }
.validation-empty[hidden] { display: none; }
.validation-table { height: 270px; }
.validation-table td, .validation-table th { padding: 10px; }
.validation-method { max-width: 980px; margin: 20px 0 0; font-size: 10px; line-height: 1.6; }
#validationReadiness { color: var(--muted); }
#validationReadiness.ready { color: var(--short); }
.split-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 28px; margin-top: 24px; }
.split-grid section { min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin: 10px 0 26px; }
.section-head p { margin-bottom: 0; }
.section-head label { min-width: 310px; color: var(--muted); font-size: 11px; }
.section-head select { margin-top: 7px; }
.detail-metrics, .prediction-metrics { grid-template-columns: repeat(5, 1fr); }
.detail-metrics strong { font-size: 22px; }
.empty { padding: 60px 20px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); text-align: center; }
.prediction-research-head { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(470px, .85fr); align-items: end; gap: 40px; margin: 10px 0 28px; }
.prediction-research-head h2 { margin: 0 0 9px; font-size: clamp(25px, 2.5vw, 38px); letter-spacing: -.045em; }
.prediction-research-head > div:first-child > p:last-child { max-width: 700px; margin: 0; font-size: 12px; }
.prediction-research-controls { display: grid; grid-template-columns: minmax(135px, .8fr) auto auto; align-items: end; gap: 10px; }
.prediction-research-controls label { min-width: 0; color: var(--muted); font-size: 10px; }
.prediction-research-controls select { margin-top: 7px; font-size: 11px; }
.prediction-research-controls button { white-space: nowrap; }
.prediction-research-metrics { grid-template-columns: repeat(4, 1fr); margin-bottom: 26px; }
.prediction-research-metrics strong { font-size: clamp(19px, 2vw, 29px); }
.prediction-research-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(430px, .88fr); gap: 34px; align-items: start; }
.prediction-research-grid > section { min-width: 0; }
.prediction-output { min-height: 430px; padding: 20px 22px 0; border: 1px solid var(--line); border-radius: 7px; background: #111513; }
.prediction-signal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.prediction-signal-head span, .prediction-signal-head > strong { color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .09em; }
.prediction-signal-head h3 { margin: 7px 0 0; font-size: clamp(20px, 2.1vw, 29px); }
.prediction-signal-head h3.signal-up { color: var(--short); }
.prediction-signal-head h3.signal-down { color: var(--long); }
.prediction-signal-head h3.signal-neutral { color: var(--accent); }
.prediction-signal-head > strong { padding-top: 2px; white-space: nowrap; }
.prediction-status { min-height: 38px; margin: 14px 0 0; font: 10px/1.55 ui-monospace, "Cascadia Mono", monospace; }
.prediction-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.prediction-panel-head h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.prediction-panel-head p { margin: 7px 0 0; font-size: 10px; }
.prediction-panel-head > span { color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .06em; white-space: nowrap; }
.prediction-evidence-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.prediction-factor-panel { padding-top: 3px; }
.prediction-factor-table { max-height: 410px; }
.prediction-factor-table td, .prediction-factor-table th { padding: 11px 10px; }
.prediction-factor-table td:first-child { color: var(--text); }
.prediction-factor-table td:nth-child(2), .prediction-factor-table td:nth-child(4) { color: var(--muted); }
.prediction-evidence-panel { margin-top: 46px; padding-top: 28px; border-top: 1px solid var(--line); }
.prediction-evidence-metrics { grid-template-columns: repeat(4, 1fr); margin-top: 13px; }
.prediction-server-panel { position: relative; margin-top: 46px; border-top-color: #50482f; }
.prediction-server-panel::before { position: absolute; top: -1px; left: 0; width: 84px; height: 1px; background: var(--accent); content: ""; }
.prediction-server-panel + .prediction-evidence-panel { margin-top: 34px; }
.prediction-server-metrics { grid-template-columns: repeat(5, 1fr); margin-top: 13px; }
.prediction-server-metrics strong { font-size: clamp(16px, 1.55vw, 23px); }
.prediction-evidence-metrics strong { font-size: clamp(17px, 1.7vw, 25px); }
.prediction-observation-table { max-height: 310px; margin-top: 14px; }
.prediction-observation-table td, .prediction-observation-table th { padding: 10px 12px; }
.prediction-observation-table .table-empty { padding-block: 24px; color: var(--muted); text-align: center; }
.prediction-observation-table td.status-hit { color: var(--short); font-weight: 700; }
.prediction-observation-table td.status-miss { color: var(--long); font-weight: 700; }
.math-spec-link { margin: 24px 0 0; font-size: 11px; }
.math-spec-link a { color: var(--text); text-underline-offset: 4px; }
.math-spec-link a:hover { color: #f2c75f; }
.notice { padding: 14px 16px; margin-top: 26px; border-left: 2px solid var(--accent); background: var(--surface); font-size: 12px; }
.notice a { color: var(--text); text-underline-offset: 3px; }
.notice a:hover { color: #f2c75f; }
.table-wrap { max-height: 610px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font: 11px ui-monospace, monospace; }
th { position: sticky; top: 0; z-index: 1; padding: 12px; background: var(--surface); color: var(--muted); text-align: left; font-weight: 500; }
td { padding: 12px; border-top: 1px solid var(--line); white-space: nowrap; }
td.long { color: var(--long); }
td.short { color: var(--short); }
.prose { max-width: 940px; padding-top: 12px; }
.prose h2 { margin-top: 34px; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 30px 0; }
.method-grid div { padding-top: 14px; border-top: 1px solid var(--line); }
.method-grid strong, .method-grid span { display: block; }
.method-grid strong { margin-bottom: 9px; color: var(--accent); font: 24px ui-monospace, monospace; }
.method-grid span { color: var(--muted); font-size: 12px; }
footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 28px; margin-top: 60px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.access-dialog {
  width: min(1080px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 32px)); padding: 0;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--text);
  box-shadow: 0 28px 90px rgba(3, 6, 4, .62);
}
.access-dialog::backdrop { background: rgba(4, 7, 5, .78); backdrop-filter: blur(5px); }
.dialog-frame { padding: 28px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0 0 8px; font-size: clamp(24px, 3.2vw, 38px); letter-spacing: -.045em; }
.dialog-head p { max-width: 700px; margin-bottom: 0; font-size: 12px; }
.dialog-kicker { margin-bottom: 9px !important; color: var(--accent) !important; font: 10px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .13em; }
.dialog-close { min-height: 36px; white-space: nowrap; }
.access-gates { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.access-gates > div { min-width: 0; padding: 16px 16px 18px 0; }
.access-gates > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.access-gates strong, .access-gates small { display: block; }
.access-gates strong { margin: 4px 0 5px; font-size: 12px; }
.access-gates small, .gate-index { color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.gate-index { color: var(--accent); }
.access-columns { display: grid; grid-template-columns: .9fr 1.1fr; gap: 34px; }
.access-section { min-width: 0; }
.access-section + .access-section { padding-left: 34px; border-left: 1px solid var(--line); }
.access-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; min-height: 72px; margin-bottom: 18px; }
.access-section-head h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.02em; }
.access-section-head p { margin: 0; font-size: 11px; line-height: 1.5; }
.state-badge { flex: 0 0 auto; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.state-badge.good { border-color: rgba(88, 166, 166, .5); color: var(--short); }
.state-badge.warn { border-color: rgba(216, 169, 59, .45); color: var(--accent); }
.access-form label, .pair-form > label { display: block; margin: 11px 0 7px; color: var(--muted); font-size: 11px; }
.access-form input, .pair-form input { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--text); background: #191e1b; border: 1px solid var(--line-strong); border-radius: 6px; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.primary-action { border-color: var(--accent); background: var(--accent); color: #17140b; font-weight: 700; }
.primary-action:hover { border-color: #f2c75f; background: #f2c75f; color: #17140b; }
.button-link { display: inline-grid; place-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text); text-decoration: none; font-size: 12px; }
.button-link:hover { border-color: var(--accent); color: #f2c75f; }
.agent-unavailable { padding: 14px 0 4px; border-top: 1px solid var(--line); }
.agent-unavailable p { margin-bottom: 13px; font-size: 11px; }
.agent-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.pair-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.pair-form input { font: 18px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .16em; }
.pair-form small { display: block; margin-top: 8px; font-size: 10px; }
.account-session dl, .device-session dl { margin: 0 0 14px; border-top: 1px solid var(--line); }
.account-session dl > div, .device-session dl > div { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.3fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.account-session dt, .device-session dt { color: var(--muted); font-size: 10px; }
.account-session dd, .device-session dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text); font: 10px ui-monospace, "Cascadia Mono", monospace; text-align: right; }
.device-session button, .account-session button { width: 100%; }
.device-session button + button { margin-top: 9px; }
.demo-account-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.demo-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.demo-account-head strong, .demo-account-head small { display: block; }
.demo-account-head strong { color: var(--text); font-size: 12px; }
.demo-account-head small { margin-top: 4px; color: var(--muted); font: 9px/1.4 ui-monospace, "Cascadia Mono", monospace; }
.demo-account-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 14px 0; border: 1px solid var(--line); background: var(--line); }
.demo-account-metrics > div { min-width: 0; padding: 10px; background: var(--surface); }
.demo-account-metrics span, .demo-account-metrics strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-account-metrics span { margin-bottom: 6px; color: var(--muted); font: 8px ui-monospace, "Cascadia Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.demo-account-metrics strong { color: var(--text); font: 600 12px ui-monospace, "Cascadia Mono", monospace; }
.demo-position-wrap { max-height: 190px; margin-bottom: 11px; overflow: auto; border: 1px solid var(--line); }
.demo-position-wrap table { min-width: 660px; font-size: 9px; }
.demo-position-wrap th, .demo-position-wrap td { padding: 8px; }
.demo-position-empty { margin: 0; padding: 17px 10px; color: var(--muted); font: 9px ui-monospace, "Cascadia Mono", monospace; text-align: center; }
.demo-position-wrap td.position-long { color: var(--long); }
.demo-position-wrap td.position-short { color: var(--short); }
.inline-message { min-height: 18px; margin: 13px 0 0; font: 10px/1.5 ui-monospace, "Cascadia Mono", monospace; }
.inline-message.good { color: var(--short); }
.inline-message.warn { color: var(--accent); }
.inline-message.error { color: var(--long); }
.verification-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.verification-checks > div { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.verification-checks span { font: 8px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; }
.verification-checks strong { font-size: 10px; font-weight: 500; }
.verification-checks .check-pass { color: var(--short); }
.verification-checks .check-exempt { color: var(--accent); }
.verification-checks .check-fail { color: var(--long); }
.verification-checks > p { grid-column: 1 / -1; margin: 10px 0 0; font-size: 10px; }
.dialog-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 28px; padding: 17px 0 0; border-top: 1px solid var(--line); }
.dialog-foot p { margin: 0; font-size: 10px; }
.dialog-foot strong { color: var(--text); }
[hidden] { display: none !important; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .control-rail { position: static; height: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 18px 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-head { grid-column: 1 / -1; margin-bottom: 0; }
  .control-group { padding: 14px 0 0; }
  main { padding: 24px 22px 60px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .split-grid, .prediction-research-head, .prediction-research-grid, .live-lower-grid, .rotation-toolbar, .rotation-lower-grid, .derivatives-head, .validation-head, .validation-grid, .history-head { grid-template-columns: 1fr; }
  .live-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projected-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rotation-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .derivatives-head button { justify-self: start; }
  .validation-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prediction-research-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rotation-workflow { padding: 28px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .live-controls button { width: 100%; }
  .wall-readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; border-top: 1px solid #292438; }
  .wall-readout header, .wall-readout p { grid-column: 1 / -1; }
  .wall-readout > div + div { padding-left: 0; border-left: 0; }
  .wall-readout p { margin-top: 0; border-top: 1px solid #2c263a; }
  .history-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .archive-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-controls button { grid-column: 1 / -1; width: 100%; }
  .access-control { grid-column: 1 / -1; }
  body[data-view="rotation"] .control-rail, body[data-view="predictor"] .control-rail { grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); align-items: center; }
  body[data-view="rotation"] .rail-head, body[data-view="predictor"] .rail-head { grid-column: auto; }
  body[data-view="rotation"] .access-control, body[data-view="predictor"] .access-control { grid-column: auto; padding-top: 0; border-top: 0; }
  .access-columns { grid-template-columns: 1fr; }
  .access-section + .access-section { padding: 28px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .demo-account-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 981px) and (max-width: 1320px) {
  .rotation-toolbar, .validation-head, .validation-grid, .prediction-research-head, .prediction-research-grid { grid-template-columns: 1fr; }
  .rotation-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .validation-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prediction-research-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .control-rail { grid-template-columns: 1fr; }
  body[data-view="rotation"] .control-rail, body[data-view="predictor"] .control-rail { grid-template-columns: 1fr; }
  body[data-view="rotation"] .access-control, body[data-view="predictor"] .access-control { display: none; }
  .metrics, .detail-metrics, .prediction-research-metrics, .prediction-evidence-metrics, .prediction-server-metrics, .method-grid { grid-template-columns: repeat(2, 1fr); }
  .live-metrics { grid-template-columns: repeat(2, 1fr); }
  .history-metrics { grid-template-columns: repeat(2, 1fr); }
  .archive-metrics { grid-template-columns: repeat(2, 1fr); }
  .venue-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heatmap-commandbar { align-items: stretch; flex-direction: column; }
  .map-mode-switch { width: 100%; }
  .live-controls { grid-template-columns: 1fr; }
  .rotation-controls { grid-template-columns: 1fr; }
  .rotation-controls button { width: 100%; }
  .derivatives-head button { width: 100%; }
  .validation-controls { grid-template-columns: 1fr; }
  .validation-controls button { width: 100%; }
  .prediction-research-controls { grid-template-columns: 1fr; }
  .prediction-research-controls button { width: 100%; }
  .prediction-signal-head, .prediction-panel-head { align-items: stretch; flex-direction: column; }
  .prediction-output { padding-inline: 14px; }
  .history-controls { grid-template-columns: 1fr; }
  .history-controls button { width: 100%; }
  .archive-controls { grid-template-columns: 1fr; }
  .archive-controls button { grid-column: 1; }
  .archive-chart-shell, .archive-chart, .archive-chart-shell .history-state { min-height: 340px; }
  .history-chart-shell, .history-chart, .history-state { min-height: 320px; }
  .key-intensity { width: 100%; margin-left: 0; }
  .heatmap-shell, .live-heatmap, .chart-state { min-height: 470px; }
  .wall-readout { display: flex; flex-direction: column; }
  .wall-readout header, .wall-readout p { grid-column: auto; }
  .wall-readout > div + div { padding: 16px 0; border-top: 0; border-left: 0; }
  .wall-readout p { border-top: 0; }
  .rotation-map-shell, .rotation-chart, .rotation-state { min-height: 480px; }
  .validation-chart-shell, .validation-chart { min-height: 290px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head label { min-width: 0; width: 100%; }
  footer { flex-direction: column; }
  .access-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .dialog-frame { padding: 20px 16px; }
  .dialog-head { align-items: stretch; flex-direction: column; gap: 16px; }
  .dialog-close { width: 100%; }
  .access-gates { grid-template-columns: 1fr 1fr; }
  .access-gates > div { border-bottom: 1px solid var(--line); }
  .access-gates > div + div { border-left: 0; }
  .access-gates > div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
  .form-actions, .dialog-foot, .verification-checks { grid-template-columns: 1fr; }
  .verification-checks > p { grid-column: 1; }
  .pair-form > div { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .loading::after { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* Front-door information architecture for the research interface.
 *
 * The Overview panel, the tab labels/order and the Hot Panel nav card are now
 * authored directly in index.html. This file holds the styles for those, plus a
 * small reusable chrome set (.tech-frame, .log-row, .stat-tile, .live-marker) that
 * the front page and — later — the Research tab share so every surface reads as one
 * system. Dark canon only: --bg / --surface / --line / --accent / --long / --short.
 */

/* --- view-scoped chrome -------------------------------------------------------- */

body[data-view="overview"] .study-control,
body[data-view="overview"] .page-head,
body[data-view="overview"] .study-summary,
body[data-view="live"] .study-control,
body[data-view="rotation"] .study-control,
body[data-view="predictor"] .study-control,
body[data-view="method"] .study-control,
body[data-view="method"] .study-summary {
  display: none;
}

body[data-view="overview"] main { max-width: 1680px; }
body[data-view="overview"] .tabs { margin-top: 0; }

.rail-utility-links {
  margin-left: auto;
  display: flex;
  gap: .55rem;
  align-items: center;
  flex-wrap: wrap;
}

.rail-utility-links a {
  font-size: .67rem !important;
  color: var(--muted) !important;
  font-weight: 550 !important;
}

.rail-utility-links a:hover { color: var(--text) !important; }

.tab[data-nav-tier="research"] { color: #8f9993; }

/* --- reusable chrome primitives --------------------------------------------- */

.tech-frame {
  position: relative;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.tech-frame::before,
.tech-frame::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--accent);
  pointer-events: none;
}

.tech-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.tech-frame::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.log-row {
  font: 11px/1.7 ui-monospace, "Cascadia Mono", monospace;
  color: var(--muted);
  white-space: nowrap;
}

.log-row.long { color: var(--long); }
.log-row.short { color: var(--short); }

.stat-tile {
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
}

.stat-tile span,
.stat-tile strong {
  display: block;
}

.stat-tile span {
  margin-bottom: 6px;
  color: var(--muted);
  font: 9px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.stat-tile strong {
  font: 500 clamp(20px, 2.2vw, 30px) ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: -.04em;
  color: var(--text);
}

.live-marker {
  color: var(--short);
  font: 9px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .1em;
}

.live-marker::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

/* --- Hot Panel nav card ------------------------------------------------------ */

.hot-panel-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 4px 0 14px;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--text);
  text-decoration: none;
}

.hot-panel-nav small,
.hot-panel-nav strong {
  display: block;
}

.hot-panel-nav small {
  margin-bottom: 3px;
  color: var(--accent);
  font: 8px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .14em;
}

.hot-panel-nav strong { font-size: 14px; }

.hot-panel-nav-detail {
  overflow: hidden;
  color: var(--muted);
  font: 10px ui-monospace, "Cascadia Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hot-panel-nav b {
  color: var(--accent);
  font: 9px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .08em;
}

.hot-panel-nav:hover { border-color: var(--accent); }

/* --- overview panel -------------------------------------------------------- */

#overview {
  min-height: auto;
  padding-bottom: 34px;
}

.overview-band {
  padding: clamp(30px, 4vw, 54px) 0;
  border-top: 1px solid var(--line);
}

.overview-band:first-child { border-top: 0; }

.overview-eyebrow,
.overview-kicker {
  font: 10px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.overview-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: center;
}

.overview-hero h1 {
  max-width: 12ch;
  margin: 14px 0 18px;
  font-size: clamp(48px, 8vw, 104px);
  line-height: .86;
  letter-spacing: -.055em;
}

.overview-hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.overview-lede {
  max-width: 60ch;
  margin: 0 0 24px;
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--muted);
}

.overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-actions .primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #17140b;
  font-weight: 700;
}

.overview-actions a.overview-jump {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}

.overview-actions a.overview-jump:hover { border-color: var(--accent); color: #f2c75f; }

/* session-log device */

.session-log {
  display: grid;
  gap: 4px;
}

.session-log .log-row .k { color: var(--muted); display: inline-block; min-width: 9ch; }
.session-log .log-row .ok { color: var(--short); }
.session-log .log-row .cmd { color: var(--accent); }
.session-log .log-row .q { color: var(--text); }
.session-log .log-row .no { color: var(--long); font-weight: 600; }

/* ticker */

.overview-ticker {
  display: flex;
  gap: 2.75rem;
  margin-top: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.overview-ticker.is-scrolling { animation: overview-ticker 46s linear infinite; }

@keyframes overview-ticker {
  to { transform: translateX(-50%); }
}

/* questions answered */

.overview-answers .answer-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 34px;
  margin: 14px 0 22px;
}

.overview-answers .answer-counts .stat-tile { min-width: 9rem; border-top: 0; padding-top: 0; }

.answer-list {
  display: grid;
  gap: 0;
  max-width: 900px;
}

.answer-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.answer-list div span:first-child { color: var(--text); }
.answer-list div span:last-child { color: var(--muted); font: 11px ui-monospace, "Cascadia Mono", monospace; white-space: nowrap; }
.answer-list div span:last-child b { color: var(--long); font-weight: 700; }

.overview-answers .answers-foot {
  max-width: 760px;
  margin: 20px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

/* live-now rail */

.overview-live-now {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.overview-live-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.overview-live-item strong { font-size: 14px; }
.overview-live-item p { grid-column: 1; margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.overview-live-item span { color: var(--accent); font: 10px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; white-space: nowrap; }
.overview-live-item:hover strong { color: #f2c75f; }

/* principles */

.overview-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.overview-principle { padding: 20px 0 0; border-top: 1px solid var(--line-strong); }
.overview-principle strong { display: block; margin-bottom: 8px; font-size: 15px; }
.overview-principle p { margin: 0; font-size: 12px; color: var(--muted); }

/* --- Liquidation Map V2: the public surface has one job ---------------------- */

#live .map-mode-switch,
#live .book-only,
#live .liquidation-history {
  display: none !important;
}

#live .heatmap-key .book-key { display: none; }

#live .live-title .panel-kicker::after {
  content: " · PROJECTED + CONFIRMED";
  color: var(--muted);
}

.secondary-market-detail {
  order: 2;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 19, 17, .52);
}

.secondary-market-detail > summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--muted);
  font: 10px ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  list-style-position: inside;
}

.secondary-market-detail > summary strong {
  margin-left: 8px;
  color: var(--text);
  font-size: 11px;
}

.secondary-market-detail > section { border-top: 1px solid var(--line); }

#live .live-lower-grid > section { order: 1; }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 1180px) {
  .overview-hero { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hot-panel-nav { grid-template-columns: 1fr auto; }
  .hot-panel-nav-detail { display: none; }
  .overview-hero h1 { font-size: clamp(40px, 13vw, 64px); }
  .overview-principles { grid-template-columns: 1fr; }
  .answer-list div,
  .overview-live-item { grid-template-columns: 1fr; }
  .answer-list div span:last-child { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .overview-ticker.is-scrolling { animation: none; overflow-x: auto; }
}

/* Horizontal application layout refresh.
 * This file intentionally overrides the legacy sidebar shell while preserving
 * the stable controls and DOM ids consumed by the existing research renderer.
 */

.app-shell {
  display: block;
  min-height: 100dvh;
}

.control-rail {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  height: auto;
  overflow: visible;
  padding: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 21, 19, .96);
  backdrop-filter: blur(14px);
}

.rail-head {
  min-height: 68px;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 12px 42px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rail-head > div:nth-child(2) {
  min-width: 170px;
}

.rail-utility-links {
  margin-left: auto;
}

.control-rail > .control-group {
  display: none;
}

main {
  max-width: 1600px;
  padding-top: 26px;
}

.workspace-controls {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 22, 20, .72);
}

.workspace-controls > summary {
  min-height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.workspace-controls > summary::-webkit-details-marker {
  display: none;
}

.workspace-controls > summary::before {
  content: "+";
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font: 13px ui-monospace, monospace;
}

.workspace-controls[open] > summary::before {
  content: "−";
  color: var(--accent);
  border-color: var(--accent);
}

.workspace-summary-copy {
  display: grid;
  gap: 2px;
}

.workspace-summary-copy strong {
  font-size: 12px;
  letter-spacing: .02em;
}

.workspace-summary-copy small {
  font-size: 10px;
}

.workspace-summary-badge {
  margin-left: auto;
  color: var(--muted);
  font: 9px ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.workspace-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr .8fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.workspace-controls-grid .control-group {
  min-width: 0;
  padding: 18px 20px 22px;
  border-top: 0;
}

.workspace-controls-grid .control-group + .control-group {
  border-left: 1px solid var(--line);
}

.workspace-controls-grid .data-control {
  align-content: start;
}

.topbar-account {
  flex: 0 0 auto;
  margin-left: 4px;
}

.topbar-account .access-summary {
  width: auto;
  min-width: 170px;
  min-height: 40px;
  padding: 7px 11px;
}

.topbar-account .access-summary span {
  margin: 0;
  font-size: 11px;
}

.topbar-account .access-summary small {
  display: none;
}

@media (max-width: 980px) {
  .control-rail {
    display: block;
    padding: 0;
  }

  .rail-head {
    padding: 10px 22px;
  }

  .workspace-controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workspace-controls-grid .data-control {
    grid-column: 1 / -1;
    border-left: 0 !important;
    border-top: 1px solid var(--line);
  }

  body[data-view="rotation"] .control-rail,
  body[data-view="predictor"] .control-rail {
    display: block;
  }
}

@media (max-width: 720px) {
  .rail-head {
    min-height: 60px;
    padding: 9px 14px;
    gap: 9px;
  }

  .rail-head > div:nth-child(2) small {
    display: none;
  }

  .rail-utility-links {
    display: none;
  }

  .topbar-account .access-summary {
    min-width: 0;
  }

  .workspace-controls-grid {
    grid-template-columns: 1fr;
  }

  .workspace-controls-grid .control-group + .control-group,
  .workspace-controls-grid .data-control {
    grid-column: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

#predictor.forward-signals-active > :not(.forward-signals-surface) { display: none !important; }
.forward-signals-surface { display: grid; gap: 1rem; }
.forward-signal-hero,.forward-current,.forward-section,.forward-disclosure { border: 1px solid var(--line, #2b312e); background: var(--surface, #151a18); }
.forward-signal-hero { display:flex; justify-content:space-between; gap:1.5rem; align-items:flex-start; padding:1.25rem; }
.forward-signal-hero h2,.forward-section h2 { margin:.2rem 0 .35rem; }
.forward-signal-intro { max-width:780px; margin:0; color:var(--muted,#929b96); line-height:1.55; }
.forward-health { min-width:190px; display:grid; grid-template-columns:auto 1fr; gap:.25rem .5rem; align-items:center; padding:.7rem .8rem; border:1px solid var(--line,#2b312e); }
.forward-health span { width:9px; height:9px; border-radius:50%; background:#929b96; }
.forward-health span[data-state="live"] { background:#58a6a6; box-shadow:0 0 0 4px rgba(88,166,166,.12); }
.forward-health span[data-state="degraded"],.forward-health span[data-state="warming"] { background:#d8a93b; }
.forward-health span[data-state="stale"],.forward-health span[data-state="error"] { background:#d4635b; }
.forward-health small { grid-column:1 / -1; color:var(--muted,#929b96); }
.forward-current { display:grid; grid-template-columns:minmax(260px,1.1fr) 2fr; gap:1rem; padding:1.25rem; }
.forward-current-signal { border-right:1px solid var(--line,#2b312e); padding-right:1.25rem; }
.forward-current-signal > span,.forward-current-meta span,.forward-count-grid span,.forward-variant-card > span { display:block; color:var(--muted,#929b96); font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; }
#forwardDirection { display:block; font-size:clamp(2.6rem,7vw,5.8rem); line-height:.9; margin:.7rem 0; letter-spacing:-.055em; }
#forwardDirection[data-direction="long"] { color:#58a6a6; }
#forwardDirection[data-direction="short"] { color:#d4635b; }
#forwardDirection[data-direction="wait"] { color:#929b96; }
.forward-current-signal p { margin:0; color:var(--muted,#929b96); }
.forward-current-meta { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.forward-current-meta div,.forward-count-grid div { border:1px solid var(--line,#2b312e); padding:.85rem; }
.forward-current-meta strong,.forward-count-grid strong { display:block; margin-top:.35rem; font-size:1.35rem; }
.forward-count-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.75rem; }
.forward-count-grid small { color:var(--muted,#929b96); }
.forward-section { padding:1.1rem; }
.forward-chart { min-height:330px; }
.forward-variant-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.8rem; }
.forward-variant-card { border:1px solid var(--line,#2b312e); padding:1rem; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.8rem; }
.forward-variant-card > span,.forward-variant-card h3,.forward-variant-card p { grid-column:1 / -1; }
.forward-variant-card h3 { margin:0; }
.forward-variant-card p { margin:0 0 .3rem; color:var(--muted,#929b96); line-height:1.45; min-height:4.2em; }
.forward-variant-card b { display:block; font-size:1.08rem; }
.forward-variant-card small { color:var(--muted,#929b96); }
.forward-table { min-width:920px; }
.forward-disclosure { margin:0; padding:.9rem 1rem; color:var(--muted,#929b96); font-size:.84rem; }
.forward-disclosure strong { color:var(--text,#e8ece9); }
@media (max-width: 900px) {
  .forward-signal-hero,.forward-current { grid-template-columns:1fr; display:grid; }
  .forward-current-signal { border-right:0; border-bottom:1px solid var(--line,#2b312e); padding-right:0; padding-bottom:1rem; }
  .forward-count-grid,.forward-variant-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .forward-count-grid,.forward-variant-grid,.forward-current-meta { grid-template-columns:1fr; }
  .forward-health { min-width:0; width:100%; }
}
