:root {
  color-scheme: dark;
  --canvas: #0c1113;
  --surface: #11181a;
  --surface-raised: #182124;
  --surface-inset: #0d1315;
  --line: rgba(171, 198, 196, .13);
  --line-strong: rgba(171, 198, 196, .24);
  --text: #e8eeeb;
  --muted: #99aaa6;
  --faint: #71817e;
  --up: #69b79a;
  --down: #ce7d7d;
  --risk: #d9b579;
  --ema-slow: #8faabd;
  --accent: #b9d6cc;
  --number: "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: 13px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
button, select, input { font: inherit; }
button, select { color: var(--text); }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible, .strategy-card:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
main { width: min(100%, 1760px); margin: 0 auto; padding: 0 22px 28px; }

/* The header behaves like a product toolbar, not a landing page. */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--accent);
  background: var(--surface);
  font: 700 11px/1 var(--number);
  letter-spacing: -.08em;
}
.brand h1 { font-size: 16px; font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }
.brand .subline { margin-top: 2px; color: var(--faint); font-size: 10px; letter-spacing: .02em; }
.header-right { display: flex; align-items: center; gap: 18px; }
.environment { color: var(--muted); font: 600 10px/1 var(--number); letter-spacing: .08em; white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state.ok { color: var(--up); }
.state.bad { color: var(--down); }

/* Portfolio selector: three workspaces, one quiet rail. */
.totals { margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; }
.totals-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.totals-heading span:last-child { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.portfolio-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.strategy-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 16px;
  min-width: 0;
  padding: 14px 15px 13px;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.strategy-card:last-child { border-right: 0; }
.strategy-card:hover { background: rgba(226, 239, 233, .035); }
.strategy-card.is-active { background: #1a2425; }
.strategy-card.is-active::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); }
.strategy-card .label { min-width: 0; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.strategy-card.is-active .label { color: var(--text); }
.strategy-card .value { grid-column: 2; grid-row: 1 / span 2; color: var(--text); font: 650 20px/1.15 var(--number); letter-spacing: -.035em; white-space: nowrap; }
.strategy-card .sub { min-width: 0; color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A single continuous desk: chart takes the room, context stays beside it. */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 0; margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--surface); }
.chart-card { min-width: 0; padding: 0; }
.toolbar { border-bottom: 1px solid var(--line); }
.chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; min-height: 76px; padding: 15px 18px 12px; }
.chart-heading .label, .side .label { color: var(--faint); font: 600 10px/1.25 var(--number); letter-spacing: .075em; text-transform: uppercase; }
.market-line { display: flex; align-items: baseline; gap: 11px; margin-top: 5px; }
.chart-heading h2 { font-size: 25px; font-weight: 670; line-height: 1.1; letter-spacing: -.035em; }
.strategy-chip { color: var(--muted); font: 550 11px/1.2 var(--number); white-space: nowrap; }
.quote { display: grid; justify-items: end; gap: 2px; min-width: 120px; }
.quote span { color: var(--faint); font-size: 10px; }
.quote strong { color: var(--text); font: 650 21px/1.1 var(--number); letter-spacing: -.035em; }
.quote small { color: var(--faint); font: 550 10px/1.1 var(--number); }
.quote small.long { color: var(--up); }
.quote small.short { color: var(--down); }
.controls { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; min-height: 62px; padding: 9px 18px 11px; border-top: 1px solid var(--line); }
.control { display: grid; gap: 4px; color: var(--faint); font-size: 10px; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; }
select, button { border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-inset); }
select { min-width: 112px; height: 32px; padding: 4px 28px 4px 9px; font-size: 12px; }
#strategy { min-width: 158px; }
#asset { min-width: 98px; }
#timeframe { min-width: 95px; }
select:hover, button:hover { border-color: rgba(171, 198, 196, .4); }
.toggle { display: flex; align-items: center; gap: 6px; min-height: 32px; margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.toggle input { accent-color: var(--up); margin: 0; }
button { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.secondary-action { color: var(--muted); white-space: nowrap; }
.secondary-action:hover { background: var(--surface-raised); color: var(--text); }

.chart-wrap { position: relative; height: clamp(530px, 68vh, 790px); background: #0d1315; overflow: hidden; }
#chartHost { position: absolute; inset: 0; z-index: 1; }
.donchian-ribbon { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; opacity: .82; }
.chart-readout { position: absolute; top: 9px; left: 12px; z-index: 4; max-width: calc(100% - 24px); padding: 4px 7px; border: 1px solid var(--line); border-radius: 3px; background: rgba(12, 17, 19, .83); color: var(--muted); font: 11px/1.25 var(--number); pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 18px; background: #0d1315; color: var(--muted); text-align: center; font-size: 12px; }
.empty[hidden], .position[hidden] { display: none; }
.position { position: absolute; right: 64px; bottom: 36px; z-index: 5; width: 234px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: rgba(17, 24, 26, .96); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.position-title { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 9px; color: var(--faint); font-size: 10px; }
.position-title strong { font: 650 10px/1 var(--number); }
.position-data { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.position-data > div { min-width: 0; }
.position-data span { display: block; color: var(--faint); font-size: 9px; }
.position-data strong { display: block; margin-top: 2px; color: var(--text); font: 600 11px/1.3 var(--number); white-space: nowrap; }
.position-data small { display: block; margin-top: 2px; color: var(--faint); font-size: 9px; }
.long, .position-data strong.long { color: var(--up); }
.short, .position-data strong.short { color: var(--down); }

.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 15px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-controls { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.range-label { margin-right: 4px; color: var(--faint); font-size: 9px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.range-btn { min-width: 29px; min-height: 25px; padding: 3px 6px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font: 600 10px/1 var(--number); }
.range-btn:hover { color: var(--text); background: var(--surface-raised); }
.range-btn.is-active { color: var(--text); background: #2b3837; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 17px; min-height: 36px; padding: 8px 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { display: inline-block; flex: 0 0 auto; width: 15px; height: 2px; border-radius: 2px; }
.dot.band { height: 7px; border: 1px solid rgba(105, 183, 154, .34); background: rgba(105, 183, 154, .11); }
.dot.volume { height: 8px; background: linear-gradient(90deg, var(--up) 50%, var(--down) 50%); opacity: .55; }
.dot.e1 { background: var(--risk); }
.dot.e2 { background: var(--ema-slow); }
.signal-rail { padding: 17px 16px 18px; border-top: 1px solid var(--line); }
.signal-rail-head { display: flex; justify-content: space-between; gap: 10px; color: var(--faint); font-size: 9px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.signal-rail-head span:last-child { font-weight: 500; letter-spacing: 0; text-transform: none; }
.signal-rail-items { display: grid; gap: 2px; max-height: 320px; overflow-y: auto; margin-top: 10px; scrollbar-width: thin; }
.signal-chip { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 2px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.signal-chip.entry::before { background: var(--up); }
.signal-chip.prealert::before { background: var(--risk); }
.signal-chip.trailing::before { background: var(--ema-slow); }
.signal-chip.exit::before { background: var(--down); }
.signal-chip time { margin-left: auto; color: var(--faint); font: 10px/1 var(--number); }
.signal-empty { color: var(--faint); font-size: 10px; }

.inspector { display: grid; align-content: start; border-left: 1px solid var(--line); background: #12191b; }
.side { padding: 17px 16px 19px; border-bottom: 1px solid var(--line); }
.side h3 { margin-top: 7px; font-size: 14px; font-weight: 640; letter-spacing: -.015em; }
.side p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.ohlc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 16px; }
.ohlc > div { display: grid; justify-items: center; align-content: start; gap: 6px; min-width: 0; padding: 8px 3px; border-right: 1px solid var(--line); }
.ohlc > div:last-child { border-right: 0; }
.mini { position: relative; display: block; width: 32px; height: 80px; color: var(--up); }
.mini.short { color: var(--down); }
.mini::before { content: ""; position: absolute; left: 15px; top: 2px; bottom: 2px; width: 1px; background: currentColor; }
.mini::after { content: ""; position: absolute; left: 8px; right: 8px; top: var(--body-top, 27px); height: var(--body-height, 28px); background: currentColor; }
.ohlc time { color: var(--faint); font: 9px/1 var(--number); }
.ohlc .close { color: var(--text); font: 550 10px/1.1 var(--number); }
.ohlc .close.long { color: var(--up); }
.ohlc .close.short { color: var(--down); }
.ohlc.is-muted { display: block; margin-top: 7px; }
.anchor-muted { display: grid; justify-items: start !important; gap: 4px; min-height: 0; padding: 7px 0 !important; border: 0 !important; color: var(--faint); text-align: left; font-size: 10px; }
.anchor-muted strong { color: var(--muted); font-weight: 600; }
.health { display: grid; margin-top: 12px; }
.health > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 11px; }
.health > div:last-child { border-bottom: 0; }
.health strong { color: var(--text); font: 550 11px/1.35 var(--number); text-align: right; overflow-wrap: anywhere; }
.health strong.long { color: var(--up); }
.health strong.short { color: var(--down); }

details { margin-top: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
details:first-of-type { margin-top: 14px; }
summary { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 10px 14px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "+"; width: 12px; color: var(--faint); font: 500 15px/1 var(--number); }
details[open] summary::before { content: "−"; }
summary:hover { color: var(--text); }
.body { padding: 3px 15px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.55; }
.body p { margin-top: 10px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--faint); font-size: 9px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:hover { background: var(--surface-raised); }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 2px 0; color: var(--faint); font-size: 10px; }
.footer a { color: var(--muted); text-decoration-color: var(--line-strong); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 248px; }
  .strategy-card { grid-template-columns: 1fr; gap: 5px; }
  .strategy-card .value { grid-column: 1; grid-row: auto; font-size: 18px; }
  .toggle { margin-left: 0; }
}
@media (max-width: 830px) {
  main { padding: 0 14px 24px; }
  .workspace { grid-template-columns: 1fr; }
  .inspector { grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); }
  .side { border-bottom: 0; }
  .side:first-child { border-right: 1px solid var(--line); }
  .signal-rail { grid-column: 1 / -1; }
  .signal-rail-items { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 180px; }
  .chart-wrap { height: 590px; }
}
@media (max-width: 580px) {
  main { padding: 0 10px 20px; }
  .top { min-height: 62px; }
  .brand h1 { font-size: 14px; }
  .brand .subline { font-size: 9px; }
  .header-right { gap: 8px; }
  .environment { display: none; }
  .state { max-width: 112px; font-size: 10px; white-space: normal; line-height: 1.2; }
  .totals { margin-top: 10px; }
  .totals-heading { padding: 8px 10px; }
  .portfolio-list { grid-template-columns: 1fr; }
  .strategy-card { grid-template-columns: minmax(0, 1fr) auto; padding: 9px 11px; border-right: 0; border-bottom: 1px solid var(--line); }
  .strategy-card:last-child { border-bottom: 0; }
  .strategy-card .value { grid-column: 2; grid-row: 1 / span 2; font-size: 16px; }
  .strategy-card .sub { font-size: 9px; }
  .workspace { margin-top: 10px; }
  .chart-heading { min-height: 66px; padding: 11px 12px; }
  .chart-heading h2 { font-size: 21px; }
  .strategy-chip { font-size: 10px; }
  .quote strong { font-size: 17px; }
  .controls { gap: 7px; padding: 8px 10px; }
  .control { flex: 1 1 27%; min-width: 86px; }
  .control select { min-width: 0 !important; width: 100%; }
  .toggle { flex: 1 1 auto; }
  .chart-wrap { height: min(66vh, 600px); min-height: 400px; }
  .position { right: 8px; bottom: 30px; width: 205px; padding: 9px; }
  .chart-foot { display: grid; gap: 5px; padding: 7px 10px; }
  .meta { order: 2; font-size: 9px; }
  .range-controls { order: 1; }
  .legend { gap: 7px 12px; padding: 9px 10px; }
  .signal-rail { padding: 9px 10px 11px; }
  .signal-rail-items { grid-template-columns: 1fr; }
  .inspector { grid-template-columns: 1fr; }
  .side:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .footer { display: block; font-size: 9px; }
  .footer span + span { display: block; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Trading-desk refinement: capital, market selection, risk and event tape. */
.brand h1 { font-size: 17px; letter-spacing: -.025em; }
.brand .subline { font-size: 11px; }
.totals-heading { padding: 10px 17px; font-size: 11px; }
.strategy-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  padding: 16px 18px 15px;
  transition: background-color .15s ease;
}
.portfolio-id, .portfolio-performance { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.strategy-card .label { color: var(--faint); font: 650 10px/1.3 var(--number); letter-spacing: .06em; text-transform: uppercase; }
.portfolio-pair { color: var(--muted); font: 650 12px/1.2 var(--number); white-space: nowrap; }
.strategy-card.is-active .portfolio-pair { color: var(--accent); }
.strategy-card .value { color: var(--text); font: 650 25px/1.1 var(--number); letter-spacing: -.055em; }
.portfolio-change { color: var(--muted); font: 650 12px/1.2 var(--number); white-space: nowrap; }
.portfolio-change.long { color: var(--up); }
.portfolio-change.short { color: var(--down); }
.strategy-card .sub { font-size: 11px; }
.strategy-card.is-active { background: #1b2626; }
.strategy-card.is-active::after { height: 2px; background: var(--up); }
.workspace { grid-template-columns: minmax(0, 1fr) 304px; }
.chart-card { display: flex; flex-direction: column; }
.chart-heading { min-height: 72px; padding: 13px 18px; }
.chart-heading h2 { font-size: 27px; }
.quote strong { font-size: 25px; }
.market-tabs {
  display: flex;
  width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.market-tabs::-webkit-scrollbar { display: none; }
.market-tab {
  position: relative;
  display: flex;
  flex: 1 0 82px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-width: 0;
  min-height: 48px;
  padding: 9px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #121a1c;
  color: var(--muted);
  text-align: left;
}
.market-tab:last-child { border-right: 0; }
.market-tab:hover { background: #1b2728; color: var(--text); }
.market-tab.is-active { background: #202e2d; color: var(--text); }
.market-tab.is-active::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--up); }
.market-tab strong { font: 650 13px/1 var(--number); }
.market-tab small { color: var(--faint); font: 500 10px/1 var(--number); white-space: nowrap; }
.market-tab small.long { color: var(--up); }
.market-tab small.short { color: var(--down); }
.market-tab.is-active small { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.controls { min-height: 58px; border-top: 0; }
.control { font-size: 10px; }
.control select { min-width: 140px; }
.chart-wrap { flex: 1 1 auto; height: auto; min-height: clamp(520px, 66vh, 780px); }
.chart-readout { top: 10px; left: 13px; padding: 5px 8px; background: rgba(13, 19, 21, .9); }
.position { width: 268px; padding: 15px; border-color: var(--line-strong); border-top: 2px solid var(--risk); background: rgba(21, 31, 33, .98); box-shadow: 0 12px 36px rgba(0,0,0,.4); }
.position.long { border-top-color: var(--up); }
.position.short { border-top-color: var(--down); }
.position-title { margin-bottom: 11px; }
.position-title > div { display: grid; gap: 3px; }
.position-title span { color: var(--faint); font: 600 9px/1.2 var(--number); letter-spacing: .05em; text-transform: uppercase; }
.position-title strong { color: var(--text); font: 700 13px/1.15 var(--number); }
.position-side { padding: 4px 6px; border: 1px solid currentColor; border-radius: 3px; font: 700 10px/1 var(--number); }
.position-pnl { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.position-pnl span { color: var(--muted); font-size: 11px; }
.position-pnl strong { font: 700 17px/1.1 var(--number); }
.position-data { gap: 10px 14px; padding-top: 10px; }
.position-data span { font-size: 10px; }
.position-data strong { font-size: 12px; }
.position-data strong.risk-value { color: var(--risk); }
.legend { font-size: 11px; }
.inspector { background: #121b1d; }
.side { padding: 19px 18px 20px; }
.side h3 { font-size: 15px; }
.side p { font-size: 12px; }
.setup .health { margin-top: 9px; }
.setup .health > div { padding: 6px 0; }
.health > div { font-size: 12px; }
.health strong { font-size: 12px; }
.health strong small { display: block; margin-top: 2px; color: var(--faint); font: 500 10px/1.2 var(--number); }
.signal-rail { padding: 18px; }
.signal-rail-head { font-size: 10px; }
.signal-rail-items { gap: 0; margin-top: 10px; max-height: 340px; }
.event-row { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-icon { width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.event-row.entry .event-icon { background: var(--up); }
.event-row.prealert .event-icon { background: var(--risk); }
.event-row.trailing .event-icon { background: var(--ema-slow); }
.event-row.exit .event-icon { background: var(--down); }
.event-copy { display: grid; gap: 2px; min-width: 0; }
.event-copy strong { overflow: hidden; color: var(--text); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.event-copy strong span { color: var(--muted); font: 600 11px/1 var(--number); }
.event-copy small { color: var(--faint); font: 600 9px/1.1 var(--number); letter-spacing: .04em; }
.event-row time { color: var(--faint); font: 10px/1.1 var(--number); white-space: nowrap; }
summary { min-height: 45px; font-size: 12px; }
.body { font-size: 12px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 268px; }
  .market-tab { flex-basis: 70px; padding: 8px 10px; }
  .market-tab small { display: none; }
}
@media (max-width: 830px) {
  .workspace { grid-template-columns: 1fr; }
  .market-tab small { display: block; }
  .inspector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup { grid-column: 1 / -1; }
  .signal-rail { grid-column: 1 / -1; }
}
@media (max-width: 580px) {
  .brand h1 { font-size: 15px; }
  .brand .subline { font-size: 10px; }
  .totals-heading { padding: 8px 10px; font-size: 10px; }
  .strategy-card { gap: 5px; padding: 10px 12px; }
  .strategy-card .value { font-size: 19px; }
  .strategy-card .sub { font-size: 10px; }
  .portfolio-change { font-size: 11px; }
  .chart-heading { min-height: 66px; padding: 11px 12px; }
  .chart-heading h2 { font-size: 22px; }
  .quote strong { font-size: 19px; }
  .market-tab { flex: 1 1 0; justify-content: center; min-height: 42px; padding: 7px 5px; }
  .market-tab strong { font-size: 12px; }
  .market-tab small { display: none; }
  .market-tab.has-position::before { content: ""; position: absolute; top: 5px; right: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--risk); }
  .controls { gap: 7px; padding: 8px 10px; }
  .control { flex: 1 1 42%; }
  .chart-wrap { height: min(66vh, 600px); min-height: 420px; }
  .position { right: 8px; bottom: 28px; width: min(236px, calc(100% - 24px)); padding: 11px; }
  .inspector { grid-template-columns: 1fr; }
  .setup, .signal-rail { grid-column: auto; }
  .side { padding: 15px 12px; }
  .signal-rail { padding: 15px 12px; }
  .signal-rail-items { grid-template-columns: 1fr; }
}
