:root {
  --bg: #0b0e11;
  --panel: rgba(24, 29, 36, 0.92);
  --panel-2: rgba(14, 18, 23, 0.92);
  --line: rgba(240, 185, 11, 0.2);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f5f7fa;
  --muted: #a1a8b3;
  --gold: #f0b90b;
  --gold-2: #fcd535;
  --green: #0ecb81;
  --red: #f6465d;
  font-family: "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(240, 185, 11, 0.2), transparent 26%),
    radial-gradient(circle at 86% 16%, rgba(14, 203, 129, 0.1), transparent 28%),
    linear-gradient(180deg, #0b0e11 0%, #101419 54%, #0b0e11 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.quant2-shell {
  width: min(1440px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.quant2-topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(24, 29, 36, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.quant2-brand {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.binance-mark {
  width: 38px;
  height: 38px;
  position: relative;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
}

.binance-mark i {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #0b0e11;
  transform: rotate(45deg);
}

.binance-mark i:nth-child(1) { top: 7px; left: 15px; }
.binance-mark i:nth-child(2) { top: 15px; left: 7px; }
.binance-mark i:nth-child(3) { top: 15px; left: 15px; }
.binance-mark i:nth-child(4) { top: 15px; right: 7px; }
.binance-mark i:nth-child(5) { bottom: 7px; left: 15px; }

.quant2-brand b {
  display: block;
  font-size: 17px;
  font-weight: 900;
}

.quant2-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-status {
  min-width: 78px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(252, 213, 53, 0.22);
  border-radius: 999px;
  color: var(--gold-2);
  font-size: 13px;
  font-weight: 900;
  background: rgba(240, 185, 11, 0.08);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  margin-top: 16px;
}

.hero-panel > div,
.panel,
.formula-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.hero-panel > div:first-child {
  min-height: 130px;
  padding: 20px 22px;
  background:
    linear-gradient(135deg, rgba(240, 185, 11, 0.16), rgba(24, 29, 36, 0.86) 52%),
    var(--panel);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(28px, 3.3vw, 46px);
  line-height: 1.06;
  font-weight: 900;
}

.hero-panel p:not(.eyebrow) {
  max-width: 880px;
  margin: 10px 0 0;
  color: #d8dee6;
  font-size: 15px;
  line-height: 1.55;
}

.hero-panel small {
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.formula-card {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(252, 213, 53, 0.12), rgba(24, 29, 36, 0.84)),
    var(--panel);
}

.formula-card span,
.panel-head span,
.metric-grid span,
.param-list span,
.backtest-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.formula-card strong,
.signal-value {
  font-family: "JetBrains Mono", monospace;
}

.formula-card strong {
  color: var(--gold-2);
  font-size: clamp(22px, 2.5vw, 34px);
  word-break: break-word;
}

.formula-card small {
  color: var(--muted);
}

.run-controls {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.risk-panel .run-controls {
  grid-template-columns: minmax(130px, 1fr) minmax(190px, 1fr);
  align-items: end;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(252, 213, 53, 0.18);
  border-radius: 12px;
  background: rgba(11, 14, 17, 0.42);
}

.api-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(252, 213, 53, 0.18);
  border-radius: 12px;
  background: rgba(11, 14, 17, 0.42);
}

.api-select-btn {
  min-height: 38px;
  border: 1px solid rgba(252, 213, 53, 0.46);
  border-radius: 9px;
  color: var(--gold-2);
  background: rgba(240, 185, 11, 0.08);
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.api-select-btn:hover {
  border-color: var(--gold-2);
}

.api-select-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.api-identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.api-identity > span,
.api-identity small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.api-identity > strong {
  color: var(--gold-2);
  font-size: 14px;
}

.api-control.configured .api-identity > strong {
  color: var(--green);
}

.api-control.is-locked .api-identity > strong {
  color: #ffcf73;
}

.api-identity small {
  display: flex;
  min-width: 0;
  gap: 10px;
}

.api-identity small b {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-identity small em {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-style: normal;
  white-space: nowrap;
}

.cooldown-status {
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(252, 213, 53, 0.22);
  border-radius: 12px;
  color: #ffcf73;
  background: rgba(240, 185, 11, 0.08);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.cooldown-status.is-cooling {
  border-color: rgba(252, 213, 53, 0.44);
  color: var(--gold-2);
  background: rgba(240, 185, 11, 0.14);
}

.cooldown-status.is-ready {
  border-color: rgba(14, 203, 129, 0.26);
  color: #7cf7c2;
  background: rgba(14, 203, 129, 0.08);
}

.run-controls label {
  display: grid;
  gap: 7px;
}

.run-controls label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.run-controls input {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(252, 213, 53, 0.26);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(11, 14, 17, 0.72);
  font: 800 18px "JetBrains Mono", monospace;
  outline: none;
}

.run-controls input:focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(252, 213, 53, 0.12);
}

.run-buttons {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 10px;
}

.run-buttons button {
  height: 44px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 140ms ease, opacity 140ms ease;
}

.run-buttons button:hover {
  transform: translateY(-1px);
}

.run-buttons button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.primary-run {
  color: #0b0e11;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
}

.stop-run {
  color: #ffffff;
  background: linear-gradient(135deg, #6b111f, var(--red));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr 0.9fr;
  gap: 16px;
  margin-top: 16px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-height: 220px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head b {
  color: var(--gold-2);
  font-size: 14px;
}

.signal-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.signal-refresh-btn {
  min-height: 32px;
  border: 1px solid rgba(252, 213, 53, 0.4);
  border-radius: 999px;
  padding: 0 12px;
  color: #0b0e11;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.signal-refresh-btn:hover {
  filter: brightness(1.06);
}

.signal-refresh-btn:disabled {
  cursor: wait;
  filter: none;
  opacity: 0.62;
}

.log-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.log-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.log-filter select {
  min-width: 92px;
  height: 34px;
  border: 1px solid rgba(252, 213, 53, 0.28);
  border-radius: 999px;
  padding: 0 30px 0 12px;
  color: var(--gold-2);
  background: #0b0e11;
  font: 900 13px "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  outline: none;
}

.log-filter select:focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(252, 213, 53, 0.12);
}

.signal-panel {
  background:
    radial-gradient(circle at 80% 0%, rgba(252, 213, 53, 0.18), transparent 34%),
    var(--panel);
}

.signal-value {
  margin: 16px 0 10px;
  color: var(--gold-2);
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 900;
  line-height: 1;
}

.signal-formula-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.signal-formula-note b {
  color: #d8dee6;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.signal-action {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 9px;
  color: #0b0e11;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  font-weight: 900;
}

.signal-panel[data-direction="long"] .signal-action,
.signal-panel[data-direction="watch-long"] .signal-action {
  background: linear-gradient(135deg, #0ecb81, #7cf7c2);
}

.signal-panel[data-direction="short"] .signal-action,
.signal-panel[data-direction="watch-short"] .signal-action {
  background: linear-gradient(135deg, #f6465d, #ff9aa8);
}

.trigger-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.trigger-card {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.trigger-card span,
.trigger-card small,
.trigger-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.trigger-card strong {
  font: 900 28px/1 "JetBrains Mono", monospace;
}

.trigger-long {
  border-color: rgba(14, 203, 129, 0.28);
  box-shadow: inset 0 0 0 1px rgba(14, 203, 129, 0.06);
}

.trigger-long strong,
.trigger-long em {
  color: var(--green);
}

.trigger-short {
  border-color: rgba(246, 70, 93, 0.3);
  box-shadow: inset 0 0 0 1px rgba(246, 70, 93, 0.06);
}

.trigger-short strong,
.trigger-short em {
  color: var(--red);
}

.metric-grid,
.backtest-grid,
.money-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.metric-grid div,
.param-list div,
.backtest-grid div,
.money-grid div {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.metric-grid b,
.param-list b,
.backtest-grid b,
.money-grid b {
  font-size: 16px;
}

.money-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.money-grid b {
  color: var(--gold-2);
  font-family: "JetBrains Mono", monospace;
}

.money-grid b.up,
.position-pnl.up {
  color: var(--green);
}

.money-grid b.down,
.position-pnl.down {
  color: var(--red);
}

.param-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.step-list {
  display: grid;
  gap: 10px;
}

.step-list div {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.step-list i {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #0b0e11;
  background: var(--gold-2);
  font-style: normal;
  font-weight: 900;
}

.step-list span,
.risk-note {
  color: #d8dee6;
  font-size: 13px;
  line-height: 1.55;
}

.risk-note {
  margin: 14px 0 0;
  color: #ffcf73;
}

.active-strategy-panel {
  min-height: 0;
  margin-top: 16px;
}

.pnl-history-panel {
  min-height: 0;
  margin-top: 16px;
}

.pnl-history-list {
  display: grid;
  gap: 10px;
}

.history-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.history-head-actions b {
  color: var(--gold-2);
  font-size: 14px;
}

.history-toggle,
.history-more-row {
  border: 1px solid rgba(252, 213, 53, 0.34);
  border-radius: 999px;
  color: var(--gold-2);
  background: rgba(240, 185, 11, 0.08);
  cursor: pointer;
  font-weight: 900;
}

.history-toggle {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.history-more-row {
  min-height: 42px;
  width: 100%;
  font-size: 13px;
}

.history-toggle:hover,
.history-more-row:hover {
  border-color: var(--gold-2);
  background: rgba(240, 185, 11, 0.14);
}

.pnl-history-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.pnl-history-row.up {
  border-color: rgba(14, 203, 129, 0.26);
  box-shadow: inset 3px 0 0 var(--green);
}

.pnl-history-row.down {
  border-color: rgba(246, 70, 93, 0.3);
  box-shadow: inset 3px 0 0 var(--red);
}

.pnl-history-main,
.pnl-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pnl-history-main strong {
  font-size: 18px;
}

.pnl-history-row.up .pnl-history-main strong {
  color: var(--green);
}

.pnl-history-row.down .pnl-history-main strong {
  color: var(--red);
}

.pnl-history-main span,
.pnl-history-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pnl-history-meta {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.pnl-history-meta b {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-weight: 900;
}

.active-strategy-summary {
  margin: -6px 0 14px;
  color: #d8dee6;
  font-size: 14px;
  line-height: 1.55;
}

.active-strategy-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.active-strategy-item {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.active-strategy-item span,
.active-strategy-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.active-strategy-item b {
  color: var(--text);
  font: 900 20px/1.1 "JetBrains Mono", monospace;
  word-break: break-word;
}

.active-strategy-item.gold b {
  color: var(--gold-2);
}

.active-strategy-item.up b {
  color: var(--green);
}

.active-strategy-item.down b {
  color: var(--red);
}

.active-strategy-item.warn b {
  color: #ffcf73;
}

.active-strategy-item.muted b {
  color: var(--muted);
}

.chart-panel {
  min-height: 360px;
}

#ratioChart {
  width: 100%;
  height: 280px;
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    #0d1116;
  background-size: 100% 56px;
}

.backtest-panel {
  min-height: 360px;
}

.backtest-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backtest-grid b {
  color: var(--gold-2);
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
}

.timeframe-panel {
  min-height: 0;
  margin-top: 16px;
}

.timeframe-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.timeframe-actions button {
  min-height: 32px;
  border: 1px solid rgba(252, 213, 53, 0.32);
  border-radius: 999px;
  padding: 0 12px;
  color: #0b0e11;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  cursor: pointer;
  font-weight: 900;
}

.timeframe-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.timeframe-note {
  margin: -6px 0 12px;
  color: #ffcf73;
  font-size: 13px;
}

.timeframe-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.timeframe-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-2);
}

.timeframe-card.is-best {
  border-color: rgba(252, 213, 53, 0.48);
  box-shadow: inset 0 0 0 1px rgba(252, 213, 53, 0.1);
}

.timeframe-title,
.timeframe-signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.timeframe-title strong,
.timeframe-return,
.timeframe-signal b {
  font-family: "JetBrains Mono", monospace;
}

.timeframe-title strong {
  color: var(--gold-2);
  font-size: 19px;
}

.timeframe-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeframe-return {
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.timeframe-return.up {
  color: var(--green);
}

.timeframe-return.down {
  color: var(--red);
}

.timeframe-stats,
.timeframe-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.timeframe-stats span,
.timeframe-meta span,
.timeframe-signal span,
.timeframe-error {
  color: var(--muted);
  font-size: 12px;
}

.timeframe-stats b {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
}

.timeframe-signal {
  min-height: 34px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.timeframe-signal b {
  color: var(--gold-2);
}

.timeframe-error {
  margin: 0;
  color: #ff9aa8;
}

.second-row {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
}

.position-panel,
.log-panel {
  min-height: 260px;
}

.position-list,
.quant-log-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.position-list {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.quant-log-list {
  max-height: 360px;
}

.position-row,
.log-row,
.empty-row {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-2);
}

.log-row.log-trade {
  border-color: rgba(252, 213, 53, 0.32);
  box-shadow: inset 3px 0 0 var(--gold-2);
}

.log-row.log-system {
  opacity: 0.92;
}

.position-row {
  border-radius: 14px;
}

.position-row-head,
.log-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.position-row strong {
  font-size: 22px;
  letter-spacing: 0.01em;
}

.position-side,
.log-level {
  min-width: 66px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #0b0e11;
  background: var(--gold-2);
  font-size: 14px;
  font-weight: 900;
}

.position-side.short,
.log-level.error {
  color: #ffffff;
  background: var(--red);
}

.log-level.warn,
.log-level.warning {
  color: #0b0e11;
  background: var(--gold-2);
}

.position-side.long,
.log-level.success {
  color: #0b0e11;
  background: var(--green);
}

.position-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.position-stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.position-stat small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.position-stat b {
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  word-break: break-word;
}

.position-pnl.up b {
  color: var(--green);
}

.position-pnl.down b {
  color: var(--red);
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
}

.empty-row {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .hero-panel,
  .dashboard-grid,
  .active-strategy-grid,
  .timeframe-grid,
  .lower-grid,
  .second-row {
    grid-template-columns: 1fr;
  }

  .top-status {
    order: 2;
    margin-left: auto;
  }
}

@media (max-width: 980px) {
  .active-strategy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .active-strategy-grid,
  .pnl-history-main,
  .position-meta {
    grid-template-columns: 1fr;
  }

  .pnl-history-main {
    display: grid;
    align-items: start;
  }

  .position-row strong {
    font-size: 20px;
  }
}

@media (max-width: 720px) {
  .quant2-shell {
    width: min(100% - 18px, 1440px);
  }

  .quant2-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-status {
    margin-left: 0;
  }

  .hero-panel > div:first-child,
  .formula-card,
  .panel {
    padding: 14px;
  }

  .metric-grid,
  .param-list,
  .backtest-grid,
  .money-grid,
  .api-control,
  .trigger-board,
  .run-buttons {
    grid-template-columns: 1fr;
  }
}

/* 手机端优先显示状态、信号和资金，设置项放在后面。 */
@media (max-width: 720px) {
  body {
    overflow-x: hidden;
  }

  .quant2-shell {
    width: 100%;
    padding: 8px 8px 24px;
  }

  .quant2-topbar {
    width: 100%;
    min-width: 0;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
  }

  .quant2-brand {
    min-width: 0;
  }

  .quant2-topbar .ba-subnav {
    width: 100%;
    max-width: 100%;
  }

  .quant2-brand b {
    font-size: 16px;
  }

  .quant2-brand small {
    font-size: 10px;
  }

  .top-status {
    align-self: flex-start;
    min-height: 32px;
    font-size: 12px;
  }

  .hero-panel {
    margin-top: 10px;
  }

  .hero-panel > div:first-child {
    min-height: 0;
    padding: 16px;
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 10px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.15;
  }

  .hero-panel p:not(.eyebrow) {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
  }

  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .signal-panel {
    order: 1;
  }

  .risk-panel {
    order: 2;
  }

  .param-panel {
    order: 3;
  }

  .panel {
    border-radius: 8px;
    padding: 14px;
  }

  .signal-value {
    font-size: 38px;
  }

  .signal-refresh-btn,
  .primary-run,
  .stop-run,
  .api-select-btn {
    min-height: 42px;
  }

  .money-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .money-grid div {
    min-width: 0;
    padding: 10px;
  }

  .money-grid div:last-child {
    grid-column: 1 / -1;
  }

  .money-grid b {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .active-strategy-panel,
  .pnl-history-panel,
  .lower-grid {
    margin-top: 10px;
  }

  .quant-log-list {
    max-height: none;
    overflow: visible;
  }
}
