:root {
  --bg: #04070b;
  --bg-soft: #070c12;
  --panel: #0a1017;
  --panel-2: #0c141d;
  --line: #1a2733;
  --line-soft: rgba(117, 170, 188, 0.13);
  --text: #dbe7ed;
  --muted: #718793;
  --dim: #4d606b;
  --mint: #57e4bf;
  --mint-strong: #8cf5d8;
  --mint-soft: rgba(87, 228, 191, 0.12);
  --red: #ff6675;
  --red-soft: rgba(255, 102, 117, 0.12);
  --amber: #f2b85b;
  --blue: #71a8ff;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --sans: "Bahnschrift", "Segoe UI", "Microsoft YaHei", sans-serif;
  --display: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 20% 0%, rgba(44, 108, 108, 0.06), transparent 34%),
    radial-gradient(circle at 90% 12%, rgba(42, 70, 120, 0.08), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 1px solid var(--mint); outline-offset: 2px; }
.hidden { display: none !important; }
::selection { background: rgba(87, 228, 191, 0.25); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e303b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2b4653; }

#app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================= top bar ============================= */
.topbar {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 13, 0.92);
  position: relative;
  z-index: 5;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(87, 228, 191, 0.35) 16%, transparent 52%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 185px; }
.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(87, 228, 191, 0.5);
  color: var(--mint);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, rgba(87, 228, 191, 0.14), transparent 66%);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
}
.brand-mark span { color: #3f756d; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-family: var(--display); font-size: 15px; letter-spacing: 0.1em; }
.brand-copy small { color: var(--dim); font-family: var(--mono); font-size: 7px; letter-spacing: 0.2em; margin-top: 4px; }
.top-divider { width: 1px; height: 26px; background: var(--line); }
.market-source {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px rgba(87, 228, 191, 0.9);
}
.market-source.sim .status-dot { background: var(--amber); box-shadow: 0 0 8px rgba(242, 184, 91, 0.8); }
.market-source.off .status-dot { background: var(--red); box-shadow: 0 0 8px rgba(255, 102, 117, 0.8); }
.market-source b { color: var(--text); font-weight: 500; }
.market-source.sim b { color: var(--amber); }
.top-spacer { flex: 1; }
.top-link {
  color: var(--mint);
  border: 1px solid rgba(87, 228, 191, 0.28);
  background: rgba(87, 228, 191, 0.05);
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
}
.top-link:hover { border-color: rgba(87, 228, 191, 0.6); background: rgba(87, 228, 191, 0.1); }
.top-meta { display: flex; align-items: center; gap: 13px; }
.top-meta-label {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  color: var(--dim);
  padding-right: 13px;
  border-right: 1px solid var(--line);
}
.clock { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.08em; }
.mode-chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.mode-chip.paper { color: var(--mint); border-color: rgba(87, 228, 191, 0.3); background: var(--mint-soft); }
.mode-chip.testnet { color: var(--amber); border-color: rgba(242, 184, 91, 0.3); background: rgba(242, 184, 91, 0.08); }
.mode-chip.live { color: var(--red); border-color: rgba(255, 102, 117, 0.4); background: var(--red-soft); }

/* ============================= layout ============================= */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}
.main-column, .side-column {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.main-column { display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.side-column { display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(19, 31, 40, 0.34), transparent 45%),
    var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.015);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 1px;
  background: linear-gradient(90deg, var(--mint), transparent);
  opacity: 0.55;
  pointer-events: none;
}
.card-head {
  padding: 16px 18px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-head.compact { padding: 15px 16px 11px; }
.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  color: #59717c;
  text-transform: uppercase;
}
h2 {
  margin: 5px 0 0;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: #e3eef2;
}
h1 { margin: 0; }

/* ============================= market ============================= */
.market-card { flex: 0 0 auto; }
.market-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 15px 18px 10px;
}
.pair-line { display: flex; align-items: center; gap: 9px; }
.pair-line h1 {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.04em;
  font-weight: 650;
}
.pair-tag {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 4px;
}
.sim-tag {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.11em;
  color: var(--amber);
  border: 1px solid rgba(242, 184, 91, 0.3);
  background: rgba(242, 184, 91, 0.07);
  padding: 2px 4px;
}
.price-line { display: flex; align-items: baseline; gap: 10px; margin-top: 5px; }
.price-line strong {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.015em;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.change-pill {
  font-family: var(--mono);
  font-size: 9px;
  padding: 3px 6px;
  color: var(--mint);
  background: var(--mint-soft);
}
.change-pill.down { color: var(--red); background: var(--red-soft); }
.ohlc-grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 4px 22px;
  padding-top: 2px;
}
.ohlc-grid span, .ohlc-grid b {
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.ohlc-grid span { color: var(--dim); }
.ohlc-grid b { color: var(--muted); font-weight: 400; margin-top: 4px; }
.chart-toolbar {
  height: 30px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 0 12px;
  gap: 16px;
}
.timeframes { display: flex; gap: 2px; }
.timeframes button {
  border: 0;
  background: transparent;
  color: var(--dim);
  height: 22px;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.timeframes button:hover { color: var(--text); }
.timeframes button.active { color: var(--mint); background: rgba(87, 228, 191, 0.07); }
.chart-legend { display: flex; gap: 12px; margin-left: 2px; }
.chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
}
.chart-legend i { display: block; width: 12px; height: 1px; }
.line-buy { background: var(--mint); border-top: 1px dashed var(--mint); }
.line-sell { background: var(--red); border-top: 1px dashed var(--red); }
.line-fill { background: var(--amber); }
.chart-source {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.chart-wrap {
  position: relative;
  height: 324px;
  min-height: 260px;
  overflow: hidden;
  background: #060b10;
}
#priceChart { width: 100%; height: 100%; display: block; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  padding: 7px 9px;
  background: rgba(6, 13, 18, 0.94);
  border: 1px solid #2a4650;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  color: var(--muted);
  z-index: 3;
  white-space: nowrap;
}
.chart-tip b { color: var(--text); font-weight: 500; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

/* ============================= signal ============================= */
.signal-card { flex: 0 0 auto; }
.signal-updated { font-family: var(--mono); font-size: 8px; color: var(--dim); padding-top: 5px; }
.signal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
  padding: 0 18px;
}
.signal-main { min-width: 0; }
.signal-action {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.action-kicker {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid rgba(87, 228, 191, 0.32);
  background: var(--mint-soft);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}
.signal-action strong {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.signal-action.tone-good strong { color: var(--mint-strong); }
.signal-action.tone-warm strong { color: var(--amber); }
.signal-action.tone-danger strong { color: var(--red); }
.signal-action.tone-neutral strong { color: var(--text); }
.signal-score {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.signal-detail {
  min-height: 34px;
  margin: 10px 0 9px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 560px;
}
.score-meter { display: flex; align-items: center; gap: 8px; }
.meter-label { font-family: var(--mono); font-size: 7px; color: var(--dim); }
.meter-track {
  position: relative;
  height: 4px;
  flex: 1;
  background: linear-gradient(90deg, rgba(255, 102, 117, 0.2), rgba(115, 136, 141, 0.12) 50%, rgba(87, 228, 191, 0.2));
}
.meter-track i {
  position: absolute;
  top: -2px;
  height: 8px;
  left: 50%;
  width: 2px;
  background: var(--mint);
  box-shadow: 0 0 6px rgba(87, 228, 191, 0.55);
  transition: left 0.3s, background 0.3s;
}
.meter-center { position: absolute; left: 50%; top: -3px; width: 1px; height: 10px; background: rgba(255, 255, 255, 0.18); }
.target-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); align-self: stretch; }
.target { background: #081018; padding: 9px 9px 8px; min-width: 0; }
.target span {
  display: block;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--dim);
  white-space: nowrap;
}
.target strong {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.target.entry strong { color: var(--mint); }
.target.take strong { color: var(--amber); }
.target.stop strong { color: var(--red); }
.target small {
  display: block;
  margin-top: 4px;
  color: #435761;
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checklist {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin: 14px 18px 0;
  background: var(--line);
  border: 1px solid var(--line);
}
.check-item { padding: 8px 9px; background: #070d13; min-width: 0; }
.check-item .check-top { display: flex; align-items: center; gap: 5px; }
.check-item .check-icon {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 5px rgba(242, 184, 91, 0.4);
}
.check-item.ok .check-icon { background: var(--mint); box-shadow: 0 0 5px rgba(87, 228, 191, 0.6); }
.check-item.no .check-icon { background: var(--red); box-shadow: 0 0 5px rgba(255, 102, 117, 0.6); }
.check-item span { font-size: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-item b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--text); font-weight: 500; }
.check-item small { display: block; margin-top: 3px; color: #40535d; font-family: var(--mono); font-size: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check-item.loading { grid-column: 1 / -1; color: var(--dim); font-family: var(--mono); font-size: 8px; }
.signal-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 12px;
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 7px;
  color: var(--dim);
}
.signal-foot span:first-child { color: var(--muted); }

/* ============================= stats ============================= */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex: 0 0 auto; }
.mini-stat { padding: 12px 13px; min-width: 0; }
.mini-stat span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.mini-stat abbr {
  text-decoration: none;
  cursor: help;
  width: 10px;
  height: 10px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #32434c;
  border-radius: 50%;
  color: var(--dim);
  font-size: 7px;
}
.mini-stat strong {
  display: block;
  margin-top: 7px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mini-stat strong.pos { color: var(--mint); }
.mini-stat strong.neg { color: var(--red); }
.mini-stat small { display: block; margin-top: 6px; color: #435761; font-family: var(--mono); font-size: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================= activity ============================= */
.activity-card { flex: 1 1 auto; min-height: 224px; display: flex; flex-direction: column; }
.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  min-height: 38px;
  flex: 0 0 auto;
}
.tabs { display: flex; gap: 2px; }
.tabs button {
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  height: 37px;
  padding: 0 9px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--mint); border-bottom-color: var(--mint); }
.tabs button b {
  margin-left: 4px;
  padding: 1px 4px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 7px;
  font-weight: 400;
}
.activity-hint { font-family: var(--mono); font-size: 7px; color: var(--dim); white-space: nowrap; }
.table-area { flex: 1; min-height: 0; overflow-y: auto; }
.empty-table {
  height: 120px;
  display: grid;
  place-items: center;
  color: #40535d;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 8px; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0a1118;
  color: var(--dim);
  font-weight: 400;
  text-align: left;
  letter-spacing: 0.08em;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 1px solid rgba(117, 170, 188, 0.055); color: var(--muted); white-space: nowrap; }
tr:hover td { background: rgba(255, 255, 255, 0.017); }
td.num, th.num { text-align: right; }
td.buy { color: var(--mint); }
td.sell { color: var(--red); }
td.pos { color: var(--mint); }
td.neg { color: var(--red); }
td b { color: var(--text); font-weight: 500; }
.log-list { padding: 4px 0; }
.log-row {
  display: grid;
  grid-template-columns: 58px 54px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(117, 170, 188, 0.05);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
}
.log-time { color: #40535d; }
.log-level { color: var(--dim); text-transform: uppercase; }
.log-msg { color: var(--muted); overflow-wrap: anywhere; }
.log-row.fill .log-level { color: var(--mint); }
.log-row.fill .log-msg { color: #b7d9d1; }
.log-row.warn .log-level { color: var(--amber); }
.log-row.error .log-level, .log-row.critical .log-level { color: var(--red); }
.log-row.critical .log-msg { color: #ffb8bf; }
.history-block { padding: 10px; display: grid; gap: 6px; }
.history-run {
  border: 1px solid var(--line-soft);
  background: #070d13;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
}
.history-run .h-date { color: var(--dim); font-family: var(--mono); font-size: 7px; }
.history-run .h-main { color: var(--muted); font-size: 9px; }
.history-run .h-main b { color: var(--text); font-family: var(--mono); font-weight: 500; }
.history-run .h-pnl { font-family: var(--mono); font-size: 10px; }
.history-note { color: var(--dim); font-family: var(--mono); font-size: 7px; padding: 6px 2px; }

/* ============================= side: control ============================= */
.control-card { flex: 0 0 auto; }
.run-indicator { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 7px; color: var(--dim); white-space: nowrap; }
.run-indicator i { width: 5px; height: 5px; border-radius: 50%; background: #3d4b53; }
.run-indicator.running { color: var(--mint); }
.run-indicator.running i { background: var(--mint); box-shadow: 0 0 8px rgba(87, 228, 191, 0.9); animation: pulse 1.4s ease-in-out infinite; }
.run-indicator.danger { color: var(--red); }
.run-indicator.danger i { background: var(--red); box-shadow: 0 0 8px rgba(255, 102, 117, 0.8); }
@keyframes pulse { 50% { opacity: 0.35; } }

.field-label {
  padding: 0 16px;
  margin: 4px 0 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
}
.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 16px; }
.mode-switch button {
  height: 27px;
  border: 1px solid var(--line);
  background: #080e14;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-switch button:hover:not(:disabled) { color: var(--text); border-color: #2a3e49; }
.mode-switch button.active { color: var(--mint); border-color: rgba(87, 228, 191, 0.45); background: rgba(87, 228, 191, 0.07); }
.mode-switch button[data-mode="live"].active { color: var(--red); border-color: rgba(255, 102, 117, 0.5); background: var(--red-soft); }
.mode-switch button:disabled { opacity: 0.3; cursor: not-allowed; }
.mode-note { padding: 6px 16px 12px; font-family: var(--mono); font-size: 7px; color: #4c626d; line-height: 1.5; }

form { padding: 0 16px 15px; }
.form-row { display: grid; gap: 7px; margin-bottom: 9px; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child { color: #657b86; font-family: var(--mono); font-size: 7px; letter-spacing: 0.05em; }
.field input {
  width: 100%;
  height: 30px;
  border: 1px solid #20303b;
  background: #060c11;
  color: var(--text);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s;
}
.field input:hover { border-color: #2c4350; }
.field input:focus { border-color: rgba(87, 228, 191, 0.55); outline: none; }
.field input:disabled, .field input[readonly] { color: var(--muted); opacity: 0.72; }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type="number"] { -moz-appearance: textfield; }
.input-suffix { position: relative; display: block; }
.input-suffix input { padding-right: 20px; }
.input-suffix i {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  font-style: normal;
  font-family: var(--mono);
  font-size: 7px;
  pointer-events: none;
}
.range-visual { margin: 0 0 12px; }
.range-label { display: flex; justify-content: space-between; color: #40535d; font-family: var(--mono); font-size: 6px; letter-spacing: 0.08em; }
.range-label span:nth-child(2) { color: var(--muted); }
.range-track { position: relative; height: 3px; margin-top: 6px; background: #17242c; }
.range-track i { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(87, 228, 191, 0.35), rgba(242, 184, 91, 0.35) 50%, rgba(255, 102, 117, 0.35)); }
.range-track b {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 9px;
  background: var(--text);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.55);
  transform: translateX(-50%);
}
.range-track b.out { background: var(--red); }
.advanced { margin: 3px 0 10px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.advanced summary {
  height: 30px;
  display: flex;
  align-items: center;
  color: #536a75;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.07em;
  cursor: pointer;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "+"; color: var(--mint); margin-right: 6px; }
.advanced[open] summary::before { content: "−"; }
.advanced .form-row { margin-top: 2px; }
.field-note { margin: 0 0 7px; font-family: var(--mono); font-size: 6px; line-height: 1.5; color: #40535d; }
.form-warning {
  margin: 0 0 9px;
  padding: 7px 8px;
  border-left: 2px solid var(--red);
  background: rgba(255, 102, 117, 0.06);
  color: #f29da6;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.5;
}
.btn-start {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(87, 228, 191, 0.65);
  background: linear-gradient(100deg, #6df0cd, #9ef8dd);
  color: #03231c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: filter 0.15s, transform 0.12s;
}
.btn-start span { display: flex; flex-direction: column; align-items: flex-start; font-family: var(--display); font-size: 15px; font-weight: 650; line-height: 1.05; letter-spacing: 0.05em; }
.btn-start small { font-family: var(--mono); font-size: 6px; font-weight: 500; letter-spacing: 0.16em; opacity: 0.55; margin-bottom: 3px; }
.btn-start i { font-style: normal; font-size: 22px; font-weight: 300; }
.btn-start:hover:not(:disabled) { filter: brightness(1.08); }
.btn-start:active:not(:disabled) { transform: translateY(1px); }
.btn-start:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-start.running { background: #163d34; border-color: rgba(87, 228, 191, 0.28); color: var(--mint); }
.stop-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.idle-flatten {
  width: 100%;
  height: 30px;
  margin-top: 6px;
  border: 1px solid rgba(242, 184, 91, 0.32);
  background: rgba(242, 184, 91, 0.06);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}
.idle-flatten:hover { border-color: rgba(242, 184, 91, 0.6); background: rgba(242, 184, 91, 0.11); }
.btn-stop, .btn-danger-ghost {
  height: 30px;
  border: 1px solid #2b3c46;
  background: #080e14;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}
.btn-stop:hover:not(:disabled) { color: var(--text); border-color: #3b5664; }
.btn-danger-ghost { color: #c9757d; border-color: rgba(255, 102, 117, 0.2); }
.btn-danger-ghost:hover:not(:disabled) { color: var(--red); border-color: rgba(255, 102, 117, 0.5); background: var(--red-soft); }
.btn-stop:disabled, .btn-danger-ghost:disabled { opacity: 0.3; cursor: not-allowed; }
.panic-btn {
  width: 100%;
  height: 28px;
  margin-top: 6px;
  border: 1px solid rgba(255, 102, 117, 0.2);
  background: transparent;
  color: #8d5860;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.panic-btn:hover:not(:disabled) { color: var(--red); border-color: rgba(255, 102, 117, 0.55); background: rgba(255, 102, 117, 0.07); }
.panic-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================= account / risk ============================= */
.account-card, .risk-card { flex: 0 0 auto; }
.run-chip {
  padding: 3px 6px;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
}
.run-chip.running { color: var(--mint); border-color: rgba(87, 228, 191, 0.3); }
.equity-line { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 16px 10px; }
.equity-line span { display: block; color: var(--dim); font-family: var(--mono); font-size: 7px; margin-bottom: 4px; }
.equity-line strong { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.pnl-line { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: right; white-space: nowrap; }
.pnl-line.pos { color: var(--mint); }
.pnl-line.neg { color: var(--red); }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); margin: 0 16px; border: 1px solid var(--line); }
.account-grid div { background: #070d13; padding: 7px 8px; min-width: 0; }
.account-grid span { display: block; color: var(--dim); font-family: var(--mono); font-size: 6px; white-space: nowrap; }
.account-grid b { display: block; margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-foot {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px 12px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
}
.account-foot b { color: var(--muted); font-weight: 400; margin-left: 4px; }
.risk-grade {
  padding: 3px 6px;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
}
.risk-grade.low { color: var(--mint); border-color: rgba(87, 228, 191, 0.3); }
.risk-grade.mid { color: var(--amber); border-color: rgba(242, 184, 91, 0.3); }
.risk-grade.high { color: var(--red); border-color: rgba(255, 102, 117, 0.4); }
.risk-list { padding: 0 16px; }
.risk-list div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(117, 170, 188, 0.06); }
.risk-list span { color: var(--dim); font-family: var(--mono); font-size: 7px; }
.risk-list b { color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 400; white-space: nowrap; }
.risk-list b.danger-text { color: var(--red); }
.risk-bar { margin: 10px 16px 0; height: 3px; background: #17242c; position: relative; }
.risk-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--mint), var(--amber), var(--red)); transition: width 0.25s; }
.risk-bar span { display: block; margin-top: 6px; color: var(--dim); font-family: var(--mono); font-size: 6px; }
.risk-note { margin: 8px 16px 13px; color: #40535d; font-family: var(--mono); font-size: 6px; line-height: 1.6; }
.legal-note {
  border-left: 1px solid #2b3c43;
  padding: 1px 0 1px 10px;
  color: #47705f;
}
.legal-note strong { display: block; font-family: var(--mono); font-size: 7px; letter-spacing: 0.05em; color: #5b8c79; }
.legal-note p { margin: 6px 0 0; color: #41535b; font-family: var(--mono); font-size: 6px; line-height: 1.7; }
.legal-note code { color: #6f9b8b; }

/* ============================= toast / modal ============================= */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 36px));
}
.toast {
  background: rgba(8, 16, 22, 0.96);
  border: 1px solid #2b4650;
  border-left: 2px solid var(--mint);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.6;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.22s ease-out;
  pointer-events: auto;
}
.toast.error { border-left-color: var(--red); color: #ffd3d7; }
.toast.warn { border-left-color: var(--amber); color: #ffe1b3; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(2, 5, 8, 0.78);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal {
  width: min(500px, 100%);
  background: #0a1118;
  border: 1px solid #27404b;
  padding: 20px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.65);
  position: relative;
  animation: modal-in 0.2s ease-out;
}
.modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--mint), transparent);
}
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-close { border: 0; background: transparent; color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.modal-close:hover { color: var(--text); }
.modal h2 { font-size: 24px; margin-top: 8px; }
.modal-body { margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.75; }
.modal-body strong { color: var(--text); }
.modal-body .danger { color: var(--red); }
.modal-body ul { margin: 8px 0 0; padding-left: 18px; }
.modal-body li { margin: 4px 0; }
.modal-body .confirm-input {
  width: 100%;
  height: 36px;
  margin-top: 12px;
  border: 1px solid #2e4854;
  background: #050a0e;
  color: var(--text);
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
}
.modal-body .confirm-input:focus { outline: none; border-color: var(--red); }
.modal-error {
  margin-top: 10px;
  padding: 8px 9px;
  border-left: 2px solid var(--red);
  background: rgba(255, 102, 117, 0.07);
  color: #f19aa3;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
}
.modal-actions { display: flex; gap: 7px; margin-top: 18px; }
.btn-secondary, .btn-confirm {
  flex: 1;
  height: 36px;
  border: 1px solid #2a414d;
  background: #080e14;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  cursor: pointer;
}
.btn-secondary:hover { color: var(--text); border-color: #3c5966; }
.btn-confirm { background: var(--mint); border-color: var(--mint); color: #03211a; font-weight: 600; }
.btn-confirm:hover { filter: brightness(1.07); }
.btn-confirm.danger { background: var(--red); border-color: var(--red); color: #2a0307; }
.modal-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================= responsive ============================= */
@media (max-width: 1260px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 342px; }
  .signal-grid { grid-template-columns: 1fr; }
  .target-grid { margin-top: 2px; }
  .chart-wrap { height: 300px; }
  .ohlc-grid { gap: 4px 13px; }
}
@media (max-width: 1040px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; overflow: visible; }
  .workspace { display: flex; flex-direction: column; overflow: visible; padding: 10px; }
  .main-column, .side-column { overflow: visible; padding-right: 0; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 10px; }
  .side-column .control-card { grid-row: span 2; }
  .side-column .legal-note { grid-column: 1 / -1; }
  .market-head { flex-wrap: wrap; }
  .ohlc-grid { width: 100%; grid-template-columns: repeat(4, 1fr); gap: 4px 10px; }
  .activity-card { min-height: 300px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 11px; gap: 10px; height: 52px; flex-basis: 52px; }
  .brand { min-width: 0; }
  .brand-copy small, .top-meta-label, .top-divider, .top-link { display: none; }
  .top-meta { gap: 8px; }
  .workspace { padding: 7px; gap: 7px; }
  .main-column, .side-column { gap: 7px; }
  .side-column { display: flex; flex-direction: column; }
  .market-head { padding: 12px; }
  .pair-line h1 { font-size: 18px; }
  .price-line strong { font-size: 28px; }
  .chart-wrap { height: 250px; }
  .chart-legend { display: none; }
  .chart-toolbar { gap: 5px; padding: 0 8px; }
  .chart-source { font-size: 6px; }
  .signal-grid { padding: 0 12px; gap: 12px; }
  .checklist { grid-template-columns: 1fr 1fr; margin-left: 12px; margin-right: 12px; }
  .signal-foot { padding-left: 12px; padding-right: 12px; font-size: 6px; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 7px; }
  .card-head, .card-head.compact { padding-left: 12px; padding-right: 12px; }
  .account-grid, .risk-list { margin-left: 12px; margin-right: 12px; padding-left: 0; padding-right: 0; }
  .equity-line { padding-left: 12px; padding-right: 12px; }
  .account-foot { padding-left: 12px; padding-right: 12px; }
  .risk-bar, .risk-note { margin-left: 12px; margin-right: 12px; }
  .activity-head { padding: 0 7px; }
  .tabs button { padding: 0 6px; font-size: 7px; }
  .activity-hint { display: none; }
  .log-row { grid-template-columns: 48px 44px minmax(0, 1fr); padding: 5px 8px; font-size: 7px; }
  .toast-stack { right: 10px; bottom: 10px; }
}
@media (max-width: 420px) {
  .mode-switch { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr 1fr; }
  .target-grid { grid-template-columns: 1fr; }
}
