.app-navigation {
  position: sticky;
  top: 0;
  z-index: 15;
  color: var(--ink);
  background: #000000;
  border-bottom: 1px solid var(--line);
}

.navigation-inner {
  display: flex;
  align-items: center;
  width: calc(100% - clamp(16px, 2vw, 32px));
  min-height: 48px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #3a3a3a;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.08em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.primary-menu {
  display: flex;
  align-self: stretch;
  margin-left: clamp(18px, 3vw, 44px);
}

.primary-menu a,
.primary-menu button {
  position: relative;
  display: flex;
  min-width: 92px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.primary-menu svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.primary-menu a::after,
.primary-menu button::after {
  position: absolute;
  right: 13px;
  bottom: -1px;
  left: 13px;
  height: 2px;
  background: transparent;
  content: "";
}

.primary-menu a:hover,
.primary-menu button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
}

.primary-menu a[aria-current="page"],
.primary-menu button[aria-current="page"] {
  color: var(--ink);
}

.primary-menu a[aria-current="page"]::after,
.primary-menu button[aria-current="page"]::after {
  background: var(--green);
}

.brand-copy small,
.header-clock {
  color: #999999;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.color-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 3px 7px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid #2b2b2b;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
}

.color-mode-toggle:hover {
  color: var(--ink);
  border-color: #3a3a3a;
}

.color-mode-swatch {
  display: inline-flex;
  width: 16px;
  height: 8px;
  overflow: hidden;
}

.color-mode-swatch i {
  flex: 1;
  background: var(--price-up);
}

.color-mode-swatch i:last-child {
  background: var(--price-down);
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  padding: 5px 8px;
  border: 1px solid #2b2b2b;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.connection-pill i {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(217, 221, 225, 0.1);
}

.connection-pill.is-live i {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 192, 135, 0.14);
  animation: signal-pulse 2.2s ease-out infinite;
}

.connection-pill.is-offline i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(240, 79, 95, 0.14);
}

.terminal-shell {
  display: grid;
  width: calc(100% - clamp(16px, 2vw, 32px));
  min-height: 682px;
  height: calc(100vh - 82px);
  height: calc(100dvh - 82px);
  grid-template-rows: auto minmax(600px, 1fr);
  gap: 12px;
  margin: 0 auto;
  padding: 8px 0 8px;
  animation: terminal-arrive 500ms ease-out both;
}

#account-overview,
#market-overview,
#market-chart,
#market-tape {
  scroll-margin-top: 60px;
}

.market-symbol-strip {
  display: flex;
  height: 36px;
  min-width: 0;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.section-index {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.instrument-block {
  position: relative;
}

.instrument-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.market-environment-badge {
  padding: 3px 6px;
  color: #b8b8b8;
  background: #1b1b1b;
  border: 1px solid #333333;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.market-environment-badge.is-demo {
  color: #ffb547;
  background: rgba(255, 181, 71, 0.1);
  border-color: rgba(255, 181, 71, 0.36);
}

.instrument-trigger {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.instrument-trigger:hover {
  background: #191919;
}

.instrument-trigger > i {
  width: 7px;
  height: 7px;
  border-right: 1px solid #737373;
  border-bottom: 1px solid #737373;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease, border-color 140ms ease;
}

.instrument-trigger[aria-expanded="true"] > i {
  border-color: var(--ink);
  transform: translateY(2px) rotate(225deg);
}

.instrument-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}

.instrument-title > strong {
  font-weight: 500;
}

.instrument-title > span {
  color: var(--ink-soft);
  font-weight: 400;
}

.instrument-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 32;
  width: min(390px, calc(100vw - 40px));
  padding: 10px;
  background: #121212;
  border: 1px solid #333333;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.56);
  font-family: var(--font-mono);
}

.instrument-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
}

.instrument-menu-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.instrument-menu input {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  color: var(--ink);
  background: #080808;
  border: 1px solid var(--line);
  outline: none;
  font-family: var(--font-mono);
  font-size: 12px;
}

.instrument-menu input:focus {
  border-color: #555555;
}

.instrument-list {
  max-height: 320px;
  margin: 8px -4px -4px;
  overflow-y: auto;
  scrollbar-color: #444444 transparent;
  scrollbar-width: thin;
}

.instrument-option {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  padding: 7px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  text-align: left;
}

.instrument-option:hover,
.instrument-option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.045);
}

.instrument-option[aria-selected="true"] {
  box-shadow: inset 2px 0 var(--green);
}

.instrument-option strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-option small {
  grid-row: 2;
  color: #8c8c8c;
  font-size: 12px;
}

.instrument-option em {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--green);
  font-size: 12px;
  font-style: normal;
}

.instrument-empty {
  margin: 18px 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

.live-flag {
  padding: 3px 6px;
  color: var(--ink-soft);
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.live-flag.is-live {
  color: var(--green);
  background: var(--green-soft);
}

.headline-quote {
  display: flex;
  height: 28px;
  align-items: baseline;
  gap: 7px;
  padding: 3px 9px 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-family: var(--font-mono);
  text-align: left;
}

.headline-quote strong {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
}

.headline-quote small {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.quote-delta {
  color: var(--ink-soft);
  font-size: 13px;
}

.quote-delta.is-up {
  color: var(--price-up);
}

.quote-delta.is-down {
  color: var(--price-down);
}

#last-price.is-up,
.ohlc-strip dd.is-up {
  color: var(--price-up);
}

#last-price.is-down,
.ohlc-strip dd.is-down {
  color: var(--price-down);
}

.timeframe-switcher {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.timeframe-switcher button,
.timeframe-select select {
  height: 28px;
  min-width: 44px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: background 140ms ease, color 140ms ease;
}

.timeframe-switcher button:hover,
.timeframe-select select:hover {
  color: var(--ink);
  background: #171717;
}

.timeframe-switcher button[aria-pressed="true"],
.timeframe-select select:valid {
  color: #ffffff;
  background: #242424;
  border-color: transparent;
  box-shadow: inset 0 -2px var(--green);
}

.timeframe-select {
  position: relative;
  display: inline-flex;
  min-width: 76px;
  flex: 0 0 auto;
}

.timeframe-select select {
  width: 100%;
  min-width: 76px;
  padding-right: 25px;
  appearance: none;
  outline: none;
}

.timeframe-select select:focus-visible {
  box-shadow: inset 0 0 0 1px #666666;
}

.timeframe-select option {
  color: var(--ink);
  background: #121212;
}

.timeframe-select i {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.market-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 284px;
  min-height: 480px;
  height: calc(100vh - 139px);
  max-height: 790px;
  margin-top: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.chart-stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line-strong);
}

.chart-header {
  display: block;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.chart-meta-row {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 12px;
}

.chart-header h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.ohlc-strip {
  display: flex;
  gap: clamp(8px, 1.4vw, 16px);
  margin: 0;
  font-family: var(--font-mono);
}

.ohlc-strip div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.ohlc-strip dt {
  color: var(--ink-soft);
  font-size: 12px;
}

.ohlc-strip dd {
  margin: 0;
  font-size: 12px;
}

.indicator-toolbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px;
  background: #050505;
  font-family: var(--font-mono);
}

.indicator-switcher,
.indicator-values {
  display: flex;
  align-items: center;
  gap: 5px;
}

.indicator-switcher {
  height: 36px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 3px;
  scrollbar-width: none;
}

.indicator-switcher::-webkit-scrollbar {
  display: none;
}

.indicator-toolbar-label,
.indicator-kind {
  display: inline-flex;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 7px;
  white-space: nowrap;
}

.indicator-toolbar-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.indicator-kind {
  color: var(--ink-soft);
  font-size: 12px;
}

.indicator-divider {
  width: 1px;
  height: 18px;
  flex: 0 0 1px;
  margin: 0 5px;
  background: var(--line-strong);
}

.indicator-switcher button {
  height: 28px;
  flex: 0 0 auto;
  min-width: 46px;
  padding: 0 9px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background 140ms ease, color 140ms ease;
}

.indicator-switcher button:hover {
  color: var(--ink);
  background: #191919;
}

.indicator-switcher button[aria-pressed="true"] {
  color: #ffffff;
  background: #242424;
  border-color: transparent;
  box-shadow: inset 0 -2px var(--green);
}

.indicator-switcher button.is-adaptive-indicator[aria-pressed="true"] {
  color: #ffd37a;
  box-shadow: inset 0 -2px #e5b94f;
}

.indicator-switcher small {
  height: 24px;
  margin-right: 3px;
  margin-left: auto;
  padding: 0 7px;
  color: #a0a0a0;
  background: #171717;
  border-radius: 2px;
  font-size: 12px;
  line-height: 24px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.trade-marker-toggle {
  display: inline-flex;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.trade-marker-toggle:hover {
  color: var(--ink);
  background: #191919;
}

.trade-marker-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.strategy-backtest-toggle input {
  accent-color: var(--amber, #e5b94f);
}

.strategy-backtest-amount,
.strategy-backtest-range {
  display: inline-flex;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  color: var(--ink-soft);
  background: #151515;
  border: 1px solid #2b2b2b;
  border-radius: 2px;
  font-size: 12px;
  white-space: nowrap;
}

.strategy-backtest-amount {
  flex: 0 0 auto;
  gap: 4px;
  padding-left: 6px;
}

.strategy-backtest-amount input {
  width: 82px;
  height: 24px;
  padding: 0 5px;
  color: #f0f0f0;
  background: #090909;
  border: 0;
  border-left: 1px solid #2b2b2b;
  border-radius: 0;
  font: inherit;
  text-align: right;
}

.strategy-backtest-amount b {
  color: #858585;
  font-size: 12px;
  font-weight: 500;
}

.strategy-backtest-mode {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 4px;
  padding-left: 5px;
  color: var(--ink-soft);
  background: #151515;
  border: 1px solid #2b2b2b;
  border-radius: 2px;
  font-size: 12px;
  white-space: nowrap;
}

.strategy-backtest-mode select {
  height: 24px;
  padding: 0 22px 0 6px;
  border: 0;
  border-left: 1px solid #2b2b2b;
  border-radius: 0;
  color: #e7e7e7;
  color-scheme: dark;
  background: #090909;
  font: inherit;
}

.strategy-backtest-range label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.strategy-backtest-range input {
  width: 118px;
  height: 24px;
  padding: 0 4px;
  color: #e7e7e7;
  color-scheme: dark;
  background: #090909;
  border: 0;
  border-radius: 2px;
  font: inherit;
}

.strategy-backtest-range i {
  color: #6f6f6f;
  font-style: normal;
}

.strategy-backtest-range button {
  height: 24px;
  padding: 0 9px;
  color: #eeeeee;
  background: #242424;
  border: 1px solid #383838;
  border-radius: 2px;
  font: inherit;
  cursor: pointer;
}

.strategy-backtest-range button:hover {
  background: #303030;
  border-color: #4a4a4a;
}

.strategy-backtest-range button:disabled {
  color: #777777;
  cursor: wait;
}

.indicator-values {
  justify-content: flex-end;
  min-width: 0;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.indicator-values span {
  white-space: nowrap;
}

.indicator-values [data-tone="neutral"] { color: var(--ink); }
.indicator-values [data-tone="amber"] { color: var(--amber, #e5b94f); }
.indicator-values [data-tone="blue"] { color: #4f8cff; }
.indicator-values [data-tone="magenta"] { color: #d051da; }
.indicator-values [data-tone="green"] { color: var(--green); }
.indicator-values [data-tone="red"] { color: var(--red); }
.indicator-values [data-tone="up"] { color: var(--price-up); }
.indicator-values [data-tone="down"] { color: var(--price-down); }
.indicator-values [data-tone="muted"] { color: var(--ink-soft); }

.chart-wrap {
  position: relative;
  min-height: 360px;
  flex: 1;
  background: var(--surface-solid);
}

#tradingview-chart {
  position: absolute;
  inset: 0;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.94);
  transition: opacity 220ms ease, visibility 220ms ease;
}

.chart-loading span {
  width: 38px;
  height: 38px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: chart-spin 800ms linear infinite;
}

.chart-loading p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.chart-wrap:not(.is-loading) .chart-loading {
  visibility: hidden;
  opacity: 0;
}

.chart-footer,
.terminal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  padding: 3px 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.chart-footer strong {
  color: var(--ink);
  font-weight: 500;
}

.chart-footer > .section-index {
  align-self: stretch;
  display: flex;
  align-items: center;
  margin: -3px auto -3px -12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.018);
  border-right: 1px solid var(--line);
}

.market-tape {
  display: flex;
  flex-direction: column;
  background: #080808;
}

.tape-section {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.tape-section > .section-index {
  display: flex;
  min-height: 19px;
  align-items: center;
  margin: auto -12px -10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.018);
  border-top: 1px solid var(--line);
}

.orderbook-section {
  flex: none;
}

.pipeline-section {
  flex: 1;
}

.book-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 4px 14px;
  padding: 6px 0;
  font-family: var(--font-mono);
}

.book-row > span {
  grid-row: 1 / 3;
  align-self: stretch;
  display: grid;
  place-items: center;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.book-row strong {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.book-row small {
  color: var(--ink-soft);
  font-size: 12px;
}

.ask-row > span {
  color: var(--price-down);
  background: var(--price-down-soft);
}

.ask-row strong {
  color: var(--price-down);
}

.bid-row > span {
  color: var(--price-up);
  background: var(--price-up-soft);
}

.bid-row strong {
  color: var(--price-up);
}

.spread-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  color: var(--ink-soft);
  border-block: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.spread-row strong {
  color: var(--ink);
  font-weight: 500;
}

.range-values {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
}

.range-values span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-values span:last-child {
  text-align: right;
}

.range-values small {
  color: var(--ink-soft);
  font-size: 12px;
}

.range-values strong {
  font-size: 13px;
  font-weight: 500;
}

.range-track {
  position: relative;
  height: 4px;
  margin: 10px 0 12px;
  background: var(--paper-deep);
}

.range-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--price-down), var(--accent), var(--price-up));
}

.range-track i {
  position: absolute;
  top: 50%;
  left: 0;
  width: 9px;
  height: 9px;
  background: var(--ink);
  border: 2px solid var(--surface-solid);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.metric-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.metric-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--font-mono);
}

.metric-list dt {
  color: var(--ink-soft);
  font-size: 12px;
}

.metric-list dd {
  margin: 0;
  font-size: 12px;
}

.pipeline-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-family: var(--font-mono);
}

.pipeline-dot {
  width: 7px;
  height: 7px;
  background: var(--line-strong);
  border-radius: 50%;
}

.pipeline-row.is-connected .pipeline-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 192, 135, 0.1);
}

.pipeline-row.is-error .pipeline-dot {
  background: var(--red);
}

.pipeline-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pipeline-row strong,
.pipeline-row em {
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.pipeline-row small,
.pipeline-row em {
  color: var(--ink-soft);
  font-size: 12px;
}

.terminal-footer {
  margin-top: 14px;
  padding-inline: 0;
  border-top: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  color: var(--ink);
  background: #171717;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes terminal-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes signal-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 192, 135, 0.28); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(0, 192, 135, 0); }
}

@keyframes chart-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
  .market-workspace {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .ohlc-strip {
    gap: 8px;
  }
}

@media (max-width: 800px) {
  .navigation-inner {
    width: calc(100% - 16px);
    min-height: 46px;
  }

  .primary-menu {
    margin-left: 12px;
  }

  .primary-menu a,
  .primary-menu button {
    min-width: 76px;
    padding-inline: 8px;
  }

  .primary-menu a::after,
  .primary-menu button::after {
    right: 8px;
    left: 8px;
  }

  .brand-copy small,
  .header-clock {
    display: none;
  }

  .terminal-shell {
    display: block;
    width: calc(100% - 16px);
    min-height: 0;
    height: auto;
    padding-top: 8px;
  }

  .market-symbol-strip {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 8px 10px 9px;
  }

  .headline-quote {
    justify-self: end;
    text-align: right;
  }

  .timeframe-switcher {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .market-workspace {
    display: block;
    min-height: 0;
    height: auto;
    max-height: none;
    margin-top: 8px;
  }

  .chart-stage {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .chart-wrap {
    min-height: 380px;
  }

  .market-tape {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tape-section {
    border-right: 1px solid var(--line);
  }

  .pipeline-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-copy strong {
    font-size: 12px;
  }

  .brand-copy {
    display: none;
  }

  .primary-menu {
    margin-left: 6px;
  }

  .primary-menu a,
  .primary-menu button {
    min-width: 0;
    padding-inline: 5px;
    font-size: 12px;
  }

  .primary-menu svg {
    display: none;
  }

  .header-meta {
    gap: 0;
    margin-left: auto;
  }

  .connection-pill {
    min-width: 0;
    padding: 7px;
  }

  .connection-pill > span {
    display: none;
  }

  .color-mode-toggle {
    gap: 0;
    padding: 7px 6px;
  }

  .color-mode-toggle > span:last-child {
    display: none;
  }

  .market-symbol-strip {
    padding-top: 6px;
  }

  .eyebrow {
    letter-spacing: 0.04em;
  }

  .instrument-title-row {
    align-items: flex-end;
  }

  .live-flag {
    display: none;
  }

  .headline-quote {
    column-gap: 6px;
  }

  .timeframe-switcher {
    width: 100%;
  }

  .timeframe-switcher button {
    flex: 1;
    padding-block: 6px;
  }

  .timeframe-select {
    flex: 1;
  }

  .chart-wrap {
    min-height: 330px;
  }

  .chart-meta-row {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 7px 10px;
  }

  .ohlc-strip {
    width: 100%;
    justify-content: space-between;
  }

  .indicator-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
    padding: 5px 10px;
  }

  .indicator-switcher button {
    flex: 1;
  }

  .indicator-values {
    min-height: 14px;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
  }

  .tape-section {
    padding: 8px 10px;
  }

  .tape-section > .section-index {
    margin-right: -10px;
    margin-bottom: -8px;
    margin-left: -10px;
    padding-inline: 10px;
  }

  .chart-footer {
    padding-inline: 10px;
  }

  .chart-footer > .section-index {
    margin-left: -10px;
    padding-inline: 10px;
  }

  .market-tape {
    display: block;
  }

  .tape-section {
    border-right: 0;
  }

}

/* 图表图例直接挂载在 Lightweight Charts 的原生窗格中。 */
.chart-pane-host {
  position: relative;
}

.chart-trade-marker-layer {
  position: absolute;
  z-index: 9;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.chart-strategy-backtest-line-layer {
  position: absolute;
  z-index: 7;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.chart-strategy-backtest-line-layer line {
  stroke-width: 1;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

.chart-strategy-backtest-line-layer line[data-result="profit"] {
  stroke: var(--price-up);
}

.chart-strategy-backtest-line-layer line[data-result="loss"] {
  stroke: var(--price-down);
}

.chart-strategy-backtest-line-layer line.is-pair-highlight {
  stroke-width: 2.5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 3px currentColor);
}

.chart-trade-marker {
  position: absolute;
  display: grid;
  width: 15px;
  height: 15px;
  padding: 0;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.chart-trade-marker[data-position="top"] {
  transform: translate(-50%, calc(-100% - 3px));
}

.chart-trade-marker[data-position="bottom"] {
  transform: translate(-50%, 3px);
}

.chart-trade-marker[data-position="top"].is-pair-highlight {
  transform: translate(-50%, calc(-100% - 3px)) scale(1.3);
}

.chart-trade-marker[data-position="bottom"].is-pair-highlight {
  transform: translate(-50%, 3px) scale(1.3);
}

.chart-trade-marker[data-side="buy"] {
  color: var(--price-up);
  background: var(--price-up-soft);
}

.chart-trade-marker[data-side="sell"] {
  color: var(--price-down);
  background: var(--price-down-soft);
}

.chart-trade-marker[data-kind="order"] {
  border-radius: 50%;
  background: #000000;
}

.chart-trade-marker[data-kind="strategy-backtest"] {
  width: 17px;
  height: 17px;
  border-style: dashed;
  box-shadow: 0 0 0 1px #000000;
}

.chart-trade-marker:hover,
.chart-trade-marker:focus-visible {
  filter: brightness(1.2);
  outline: 1px solid #ffffff;
  outline-offset: 1px;
}

.chart-trade-marker.is-pair-highlight {
  z-index: 11;
  filter: brightness(1.55);
  box-shadow: 0 0 0 2px #000000, 0 0 9px currentColor;
}

.chart-trade-marker.is-pair-highlight:not(.is-pair-source) {
  animation: chart-trade-pair-pulse 900ms ease-in-out infinite alternate;
}

.chart-trade-marker.is-pair-source {
  outline: 1px solid #ffffff;
  outline-offset: 2px;
}

@keyframes chart-trade-pair-pulse {
  from { filter: brightness(1.3); }
  to { filter: brightness(2); }
}

@media (prefers-reduced-motion: reduce) {
  .chart-trade-marker.is-pair-highlight:not(.is-pair-source) {
    animation: none;
  }
}

.chart-trade-marker[hidden] {
  display: none;
}

.chart-trade-tooltip {
  position: absolute;
  z-index: 12;
  top: 0;
  left: 0;
  min-width: 174px;
  max-width: 428px;
  overflow: hidden;
  color: #f3f3f3;
  background: #3b3b3d;
  border: 1px solid #4a4a4d;
  border-radius: 2px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: auto;
}

.chart-trade-tooltip.is-paired {
  z-index: 11;
  pointer-events: none;
}

.chart-trade-tooltip[hidden] {
  display: none;
}

.chart-trade-tooltip-summary {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 9px 10px 7px;
  white-space: nowrap;
}

.chart-trade-tooltip-summary span {
  color: #ffffff;
}

.chart-trade-tooltip-summary em {
  font-style: normal;
  font-weight: 600;
}

.chart-trade-tooltip-summary em[data-side="buy"] {
  color: var(--price-up);
}

.chart-trade-tooltip-summary em[data-side="sell"] {
  color: var(--price-down);
}

.chart-trade-tooltip-summary strong {
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.chart-trade-tooltip-meta {
  display: grid;
  gap: 5px 7px;
  padding: 0 10px 8px;
  color: #bdbdbd;
  overscroll-behavior: contain;
  scrollbar-color: #66666b #252527;
  scrollbar-width: thin;
}

.chart-trade-tooltip-meta[data-layout="structured"] {
  width: min(400px, calc(100vw - 54px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-trade-tooltip-meta-plain {
  grid-column: 1 / -1;
}

.chart-trade-tooltip-leg {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  background: #252527;
  border: 1px solid #505054;
  border-left: 3px solid #8a8a8e;
}

.chart-trade-tooltip-leg[data-tone="entry"] {
  border-left-color: #26a7e8;
}

.chart-trade-tooltip-leg[data-tone="exit"] {
  border-left-color: #f0a43b;
}

.chart-trade-tooltip-leg[data-tone="current"] {
  border-left-color: #a9b1bc;
}

.chart-trade-tooltip-leg strong {
  color: #f5f5f5;
  font-size: 12px;
}

.chart-trade-tooltip-leg time {
  min-width: 0;
  color: #b8b8bc;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: nowrap;
}

.chart-trade-tooltip-leg em {
  color: #ffffff;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  text-align: right;
}

.chart-trade-tooltip-leg[data-tone="entry"] em {
  color: #62c8ff;
}

.chart-trade-tooltip-leg[data-tone="exit"] em {
  color: #ffc36f;
}

.chart-trade-tooltip-metric {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 3px;
}

.chart-trade-tooltip-metric.is-wide {
  grid-column: 1 / -1;
}

.chart-trade-tooltip-metric small {
  color: #929296;
  font: inherit;
  white-space: nowrap;
}

.chart-trade-tooltip-metric b {
  min-width: 0;
  color: #dedee0;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
  white-space: normal;
}

.chart-trade-tooltip[data-constrained="true"] .chart-trade-tooltip-meta {
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.chart-trade-tooltip-metric[data-tone="profit"] b {
  color: var(--price-up);
}

.chart-trade-tooltip-metric[data-tone="loss"] b {
  color: var(--price-down);
}

@media (max-width: 520px) {
  .chart-trade-tooltip-meta[data-layout="structured"] {
    width: min(280px, calc(100vw - 54px));
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-trade-tooltip-metric.is-wide {
    grid-column: auto;
  }
}

.chart-trade-tooltip-meta[hidden] {
  display: none;
}

.chart-trade-tooltip button {
  width: 100%;
  height: 29px;
  padding: 0 10px;
  color: #ffffff;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-family: var(--font-display);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.chart-trade-tooltip button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.strategy-backtest-summary-host {
  display: block;
  min-width: 0;
  flex: 0 0 auto;
  background: #070707;
}

.strategy-backtest-summary-host:empty {
  display: none;
}

.chart-strategy-backtest-summary {
  display: grid;
  width: 100%;
  max-width: none;
  overflow: visible;
  color: #d8d8d8;
  background: #080808;
  border-bottom: 1px solid #303030;
  font-family: var(--font-mono);
  font-size: 13px;
}

.chart-strategy-backtest-summary[hidden] {
  display: none;
}

.chart-strategy-backtest-summary > div {
  display: flex;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding: 5px 10px;
  white-space: normal;
}

.chart-strategy-backtest-summary > div + div {
  border-top: 1px solid #202020;
}

.chart-strategy-backtest-summary strong {
  max-width: none;
  color: #f0f0f0;
  white-space: nowrap;
}

.chart-strategy-backtest-summary span {
  white-space: nowrap;
}

.chart-strategy-backtest-summary .strategy-backtest-period {
  color: #c9b458;
}

.chart-strategy-backtest-summary [data-result="profit"] .strategy-backtest-profit,
.chart-strategy-backtest-summary [data-result="profit"] .strategy-backtest-return {
  color: var(--price-up);
}

.chart-strategy-backtest-summary [data-result="loss"] .strategy-backtest-profit,
.chart-strategy-backtest-summary [data-result="loss"] .strategy-backtest-return,
.chart-strategy-backtest-summary .strategy-backtest-max-drawdown,
.chart-strategy-backtest-summary .strategy-backtest-current-drawdown {
  color: var(--price-down);
}

@media (max-width: 760px) {
  .chart-strategy-backtest-summary > div {
    gap: 4px 10px;
  }
}

.chart-native-legend,
.chart-pane-legend {
  position: absolute;
  top: 6px;
  left: 10px;
  z-index: 6;
  display: flex;
  max-width: calc(100% - 86px);
  align-items: center;
  gap: 10px;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 22px;
  pointer-events: none;
  white-space: nowrap;
}

.chart-native-symbol,
.chart-pane-legend > strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.chart-native-symbol span,
.chart-pane-legend > strong {
  color: #b0b0b0;
}

.chart-native-legend .ohlc-strip {
  display: flex;
  width: auto;
  gap: 8px;
  justify-content: flex-start;
  margin: 0;
}

.chart-native-legend .ohlc-strip div {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.chart-native-legend .ohlc-strip dt {
  color: #aaaaaa;
  font-size: 12px;
  font-weight: 500;
}

.chart-native-legend .ohlc-strip dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.chart-native-legend .ohlc-strip dd.is-up { color: var(--price-up); }
.chart-native-legend .ohlc-strip dd.is-down { color: var(--price-down); }

.chart-pane-legend {
  gap: 7px;
}

.chart-pane-legend span[data-tone="neutral"] { color: var(--ink); }
.chart-pane-legend span[data-tone="amber"] { color: var(--amber, #e5b94f); }
.chart-pane-legend span[data-tone="magenta"] { color: #d051da; }
.chart-pane-legend span[data-tone="cyan"] { color: #38bcaf; }
.chart-pane-legend span[data-tone="coral"] { color: #cb7554; }
.chart-pane-legend span[data-tone="lime"] { color: #9bd75a; }
.chart-pane-legend span[data-tone="up"] { color: var(--price-up); }
.chart-pane-legend span[data-tone="down"] { color: var(--price-down); }
.chart-pane-legend span[data-tone="muted"] { color: var(--ink-soft); }

.chart-pane-legend button {
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  color: #8c8c8c;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  pointer-events: auto;
}

.chart-pane-legend button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.range-section {
  flex: 1;
}

.terminal-statusbar.pipeline-section {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  height: 34px;
  min-height: 34px;
  grid-column: auto;
  align-items: stretch;
  flex: none;
  overflow-x: auto;
  overflow-y: hidden;
  color: #b3b3b3;
  background: #080808;
  border-top: 1px solid #333333;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  scrollbar-width: none;
  white-space: nowrap;
}

.terminal-statusbar::-webkit-scrollbar {
  display: none;
}

.statusbar-label,
.status-item,
.status-data {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-right: 1px solid #242424;
}

.statusbar-label {
  color: #f5f5f5;
  background: #171717;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-item b,
.status-data strong {
  color: #f5f5f5;
  font-size: inherit;
  font-weight: 500;
}

.status-item em {
  color: #aaaaaa;
  font-style: normal;
}

.status-dot,
.terminal-statusbar .account-health > i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  background: #777777;
  border-radius: 50%;
  box-shadow: none;
}

.status-item.is-connected .status-dot,
.terminal-statusbar .account-health.is-connected > i {
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 192, 135, 0.1);
}

.status-item.is-connected em {
  color: #c8c8c8;
}

.status-item.is-loading .status-dot {
  background: #d6ad4c;
}

.status-item.is-error .status-dot {
  background: var(--red);
}

.status-item.is-error em {
  color: var(--red);
}

.terminal-statusbar .connection-pill {
  min-width: max-content;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #242424;
  font-size: inherit;
  letter-spacing: inherit;
}

.terminal-statusbar .connection-pill i {
  width: 7px;
  height: 7px;
  box-shadow: none;
  animation: none;
}

.terminal-statusbar .account-health {
  display: inline-flex;
  min-width: max-content;
  padding: 0 12px;
  font-size: inherit;
}

.terminal-statusbar .account-health em {
  color: #aaaaaa;
  font-style: normal;
}

.statusbar-spacer {
  min-width: 12px;
  flex: 1;
  border-right: 1px solid #242424;
}

.status-data {
  color: #aaaaaa;
}

@media (max-width: 800px) {
  .chart-native-legend,
  .chart-pane-legend {
    max-width: calc(100% - 58px);
  }

  .terminal-statusbar.pipeline-section {
    padding: 0;
  }

  .statusbar-spacer {
    display: none;
  }
}

@media (max-width: 520px) {
  .chart-native-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
    line-height: 22px;
  }

  .chart-native-legend .ohlc-strip {
    gap: 6px;
  }

  .chart-pane-legend {
    gap: 5px;
    font-size: 12px;
  }

  .chart-pane-legend > strong {
    font-size: 12px;
  }

  .indicator-switcher small {
    display: none;
  }

  .indicator-switcher button {
    flex: 0 0 auto;
  }

  .indicator-kind {
    display: none;
  }

  .indicator-toolbar .market-symbol-strip {
    flex-wrap: wrap;
  }
}

@media (max-width: 1200px) {
  .indicator-switcher small {
    display: none;
  }
}

@media (max-width: 800px) {
  .chart-header > .indicator-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
    padding: 5px 10px;
  }

  .indicator-toolbar .market-symbol-strip {
    height: auto;
    min-height: 36px;
    width: 100%;
    flex: none;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px;
    padding: 3px;
  }

  .indicator-toolbar .indicator-switcher {
    height: 36px;
    width: 100%;
    padding: 3px;
  }
}
