:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-2: #1b232e;
  --line: #232c38;
  --txt: #e6edf3;
  --dim: #8b98a8;
  --up: #f6465d;
  --down: #2ebd85;
  --accent: #4c8dff;
  --warn: #f0b90b;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 13px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: var(--txt);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: .15s;
}
button:hover { border-color: #3a4757; background: #222c39; }
button:disabled { opacity: .45; cursor: not-allowed; }
input:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #3d7ae8; }
button.danger { background: #3a1b21; border-color: #5c2730; color: #ff8a9b; }
button.ghost { background: transparent; }
button.sm { padding: 3px 8px; font-size: 12px; border-radius: 4px; }

input, select {
  font: inherit;
  color: var(--txt);
  background: #0f151d;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  outline: none;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }

/* ---------- 顶栏 ---------- */
/* 弹性换行：小屏 / 缩放放大时自动折行，不再把右侧按钮和数据裁掉 */
header {
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: .3px; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--down); box-shadow: 0 0 10px var(--down);
}
.brand .dot.off { background: #6b7785; box-shadow: none; }

.mode {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  background: #1d2a3d;
  color: #8fb4ff;
  border: 1px solid #2a3d57;
}
.mode.live { background: #3a1b21; color: #ff8a9b; border-color: #5c2730; }
.mode.testnet { background: #3a3315; color: #f0b90b; border-color: #5c5220; }

/* 版本角标：重启后号码变了才说明加载到新界面 */
.build-tag {
  font-size: 10px;
  color: var(--dim);
  font-family: ui-monospace, Consolas, monospace;
  padding: 2px 6px;
  border: 1px dashed #2a3d57;
  border-radius: 4px;
  cursor: help;
  user-select: all;
}

/* 分段切换（主流币 / 全部） */
.seg {
  display: inline-flex;
  border: 1px solid #2a3d57;
  border-radius: 6px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  line-height: 1.4;
}
.seg button + button { border-left: 1px solid #2a3d57; }
.seg button:hover { color: #cfe0ff; background: #16202e; }
.seg button.on { background: #1d2a3d; color: #8fb4ff; font-weight: 600; }

/* 窄屏优先保证切换按钮和搜索框，提示文字让位 */
@media (max-width: 1180px) {
  .panel-head .hint { display: none; }
  .stats { gap: 14px; }
}

/* 中等宽度：隐藏回撤提示、缩小顶栏间距，尽量单行放得下 */
@media (max-width: 1320px) {
  .dd-hint { display: none; }
}

.stats { display: flex; gap: 22px; margin-left: 8px; }
.stat { display: flex; flex-direction: column; line-height: 1.25; }
.stat .k { font-size: 11px; color: var(--dim); }
.stat .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.spacer { flex: 1; }
.actions { display: flex; gap: 8px; }

/* ---------- 主体 ---------- */
main {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) 1fr;
  flex: 1;
  min-height: 0;
}

.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel + .panel { border-left: 1px solid var(--line); }

.panel-head {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel-head h2 { font-size: 13px; margin: 0; font-weight: 600; color: #c8d3e0; }
.panel-head .hint { font-size: 11px; color: var(--dim); }

.scroll { overflow: auto; min-height: 0; flex: 1; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: #2c3746; border-radius: 4px; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- 行情表 ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: #121821;
  color: var(--dim);
  font-weight: 500;
  font-size: 11px;
  text-align: right;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:first-child, tbody td:first-child { text-align: left; }
thead th.sorted { color: var(--accent); }
tbody td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid #1b2330;
  white-space: nowrap;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1a2230; }
tbody tr.tracked { background: #17202c; }
tbody tr.tracked td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.sym { font-weight: 600; }
.sym small { color: var(--dim); font-weight: 400; margin-left: 3px; }
.up { color: var(--up); }
.down { color: var(--down); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- 标签页 ---------- */
/* 页签允许换行：右栏较窄时 7 个页签折成两行，全部可见 */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tab {
  padding: 11px 14px;
  color: var(--dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 12.5px;
}
.tab.active { color: var(--txt); border-bottom-color: var(--accent); }
.tab .badge {
  display: inline-block; min-width: 16px; padding: 0 5px;
  background: #26313f; border-radius: 9px; font-size: 10.5px;
  color: #9fb0c4; margin-left: 5px; text-align: center;
}

.tab-body { display: none; flex-direction: column; min-height: 0; flex: 1; }
.tab-body.active { display: flex; }

/* ---------- 卡片 / 空态 ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--dim); font-size: 12px; }
.empty b { display: block; color: #b9c6d6; margin-bottom: 6px; font-size: 13px; }

.card {
  margin: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .row + .row { margin-top: 6px; }
.card .title { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.card .sub { color: var(--dim); font-size: 11.5px; margin-top: 3px; }
.card .kv { color: var(--dim); font-size: 11.5px; }
.card.off { opacity: .5; }

.pill {
  font-size: 10.5px; padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--dim);
}
.pill.buy { color: #ff9aa8; border-color: #5c2730; background: #2a161b; }
.pill.sell { color: #6fe0b0; border-color: #1f5a45; background: #12251f; }

/* ---------- 合约面板 ---------- */
.fut-top { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fut-top .stat { flex: 1; min-width: 110px; }
.fut-ctl {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 10px; border-radius: 8px;
  background: rgba(126,168,224,.06); border: 1px solid rgba(126,168,224,.18);
  font-size: 12px; color: #c8d3e0;
}
.fut-ctl-txt { color: #cfdcea; font-weight: 600; }
.fut-ctl label { display: flex; align-items: center; gap: 6px; }
.fut-ctl input[type="number"] {
  width: 58px; padding: 4px 6px; border-radius: 6px; font-size: 12px;
  background: #131c28; border: 1px solid #2a3547; color: #e8eef6;
}
.fut-card {
  margin-bottom: 10px; padding: 10px 12px; border-radius: 10px;
  background: #131c28; border: 1px solid #223043;
}
.fc-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 13px; color: #e8eef6;
}
.fc-mark { font-variant-numeric: tabular-nums; color: #aebccd; font-size: 12.5px; }
.fc-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: #9fb0c3; padding: 2px 0;
}
.fc-row .fc-k { color: #c8d3e0; }
.fc-row .fc-v { text-align: right; font-variant-numeric: tabular-nums; }
.fc-actions { display: flex; gap: 8px; margin-top: 8px; }
.pill.p-long { color: #ff9aa8; border-color: #5c2730; background: #2a161b; }
.pill.p-short { color: #6fe0b0; border-color: #1f5a45; background: #12251f; }
.pill.p-flat { color: #9fb0c3; border-color: #2a3547; background: #1a2432; }
.fut-trades { margin-top: 14px; }
.fut-trades .fc-head { margin-bottom: 6px; }
.fut-ev {
  margin: 2px 0 10px; padding: 8px 12px; border-radius: 8px; font-size: 12px;
  background: var(--panel2, rgba(255,255,255,.04)); color: #c8d3e0;
  border: 1px solid rgba(255,255,255,.08);
}
.fut-ev.warn { background: rgba(240,120,60,.09); border-color: rgba(240,120,60,.45); color: #f0b35c; }

/* ---------- 板块筛选条 ---------- */
.seg-bar { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.seg {
  padding: 5px 14px; border-radius: 14px; font-size: 12px; cursor: pointer;
  background: rgba(255,255,255,.05); color: #9fb0c3; border: 1px solid rgba(255,255,255,.1);
}
.seg.on { background: rgba(43,130,255,.18); color: #4a9eff; border-color: rgba(74,158,255,.5); }
.seg-title { font-size: 11px; color: #7c8b9e; margin: 10px 0 6px; letter-spacing: 1px; }
.seg-bar .hint-inline { font-size: 11px; color: #7c8b9e; align-self: center; margin-left: 4px; }

/* ---------- 成交 ---------- */
.trade-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid #1b2330;
  font-size: 12px;
  align-items: center;
}
.trade-row .t {
  color: var(--dim); font-size: 11px;
  display: flex; flex-direction: column; line-height: 1.35;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.trade-row .t .d { font-size: 10px; opacity: .78; }
.trade-row .note { color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.trade-row .amt { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 表单 ---------- */
.form { padding: 12px 14px; display: grid; gap: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 11.5px; color: var(--dim); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.rule-form {
  margin: 10px 12px;
  background: #111823;
  border: 1px dashed #2c3a4c;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
}
.rule-form .title { font-size: 12px; color: #b9c6d6; font-weight: 600; }
.chk { display: flex; gap: 7px; align-items: flex-start; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.chk input { margin-top: 2px; accent-color: var(--accent); }
.dca-hint {
  font-size: 11px; color: #8fa2b8; background: #0d131c;
  border: 1px solid #22303f; border-radius: 6px; padding: 7px 9px; line-height: 1.6;
}
.dca-hint b { color: #c8d3e0; font-weight: 600; }
.dca-hint .warn { color: #f0b90b; }
.ladder { display: flex; gap: 4px; margin-top: 7px; }
.ladder .bar { height: 4px; flex: 1; border-radius: 2px; background: #24303f; }
.ladder .bar.on { background: var(--accent); }
.ladder .bar.pause { background: #f0b90b; }

/* ---------- 净值图 ---------- */
.equity-wrap { padding: 10px 12px 4px; }
canvas { display: block; width: 100%; }

/* ---------- 提示条 ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50;
}
.toast {
  background: #1c2532; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 9px 13px; border-radius: 6px; font-size: 12px; max-width: 380px;
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
  animation: slide .18s ease;
}
.toast.err { border-left-color: var(--up); }
.toast.ok { border-left-color: var(--down); }
@keyframes slide { from { transform: translateY(6px); opacity: 0; } }

.hidden { display: none !important; }

.diag-line { display: flex; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid #1b2330; font-size: 12px; }
.diag-line .ok { color: var(--down); }
.diag-line .bad { color: var(--up); }

/* 窄屏（或系统缩放放大后）：上下堆叠，行情在上、账户在下 */
@media (max-width: 1100px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .panel + .panel { border-left: none; border-top: 1px solid var(--line); }
  .stats .stat:nth-child(n+3) { display: none; }
}

/* ---------- 指标悬浮说明 ---------- */
.rule-form label { position: relative; cursor: help; }
.rule-form label .tip {
  display: inline-block; margin-left: 4px; width: 13px; height: 13px; line-height: 13px;
  border-radius: 50%; background: #2a3547; color: #9fb0c3; font-size: 9px;
  text-align: center; font-style: normal; vertical-align: 1px;
}
.rule-form label[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  width: 230px; padding: 8px 10px; border-radius: 6px;
  background: #232e3f; border: 1px solid #34435c; color: #d7e1ee;
  font-size: 11px; line-height: 1.55; font-weight: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.rule-form label[data-tip]:hover::after { opacity: 1; }
.field .inline { display: flex; align-items: center; gap: 7px; }
.field .inline input[type="checkbox"] { width: auto; }
.field .inline input[type="number"] { flex: 1; }
.field .unit { font-size: 11px; color: #8b98a8; white-space: nowrap; }

/* ---------- 推荐参数条 ---------- */
.preset-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  padding: 8px 11px; border-radius: 7px; font-size: 12px;
  background: rgba(46,189,133,.08); border: 1px solid rgba(46,189,133,.35);
  color: #9fd8c0;
}
.preset-bar span { flex: 1; line-height: 1.5; }

/* ---------- 盈亏统计 ---------- */
.stats-strip { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stats-strip .ss {
  flex: 1; min-width: 90px; padding: 7px 10px; border-radius: 7px;
  background: #1a2330; border: 1px solid var(--line);
}
.stats-strip .ss .k { display: block; font-size: 10.5px; color: #8b98a8; margin-bottom: 3px; }
.stats-strip .ss .v { font-size: 14px; font-weight: 600; }
.stats-detail { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.stats-detail .sd-block { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }
.stats-detail .sd-title { font-size: 11px; color: #8b98a8; margin-right: 4px; }
.stats-detail .sd-item {
  font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: #1a2330; border: 1px solid var(--line);
}

.brand .dot.warn { background: #f0b90b; box-shadow: 0 0 6px rgba(240,185,11,.8); }

/* ---------- 利润页签 ---------- */
.pnl-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pnl-head input[type="date"] {
  background: #1a2330; border: 1px solid var(--line); color: #d7e1ee;
  border-radius: 6px; padding: 5px 8px; font-size: 12px; color-scheme: dark;
}
.pnl-days { padding: 6px 12px; border-bottom: 1px solid var(--line); }
.pnl-days .day-btn { cursor: pointer; border: 1px solid var(--line); }
.pnl-days .day-btn:hover { border-color: #4a6fa5; }
.pnl-days .day-btn small { opacity: .6; }

/* ---------- 日志页签 ---------- */
.log-line {
  display: flex; gap: 10px; padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,.03);
  font-size: 12px; line-height: 1.5;
}
.log-line .t {
  color: #6b7785; flex-shrink: 0; font-family: monospace; font-size: 10.5px;
  padding-top: 1px; display: flex; flex-direction: column;
  width: 70px; line-height: 1.35; font-variant-numeric: tabular-nums;
}
.log-line .t .d { opacity: .8; }

/* 利润页的快捷按钮选中态（今天/昨天/近 7 天） */
.pnl-head button.sm.on {
  background: #1d2a3d; color: #8fb4ff; border-color: #2c3f5c; font-weight: 600;
}

/* ---------- 按档位止盈 ---------- */
.tp-layer-box {
  margin: 8px 0 10px; padding: 9px 11px; border-radius: 8px;
  background: #1a2330; border: 1px solid var(--line);
}
.tp-layer-box .tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.tp-layer-box .tpl-head .chk { margin: 0; font-size: 12px; }
.tp-layer-box .tpl-head .chk span { display: inline-flex; align-items: center; gap: 3px; }
.tpl-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-grid.off { opacity: .4; }
.tpl-item {
  display: flex; align-items: center; gap: 3px;
  padding: 3px 6px; border-radius: 6px; background: #141c26; border: 1px solid var(--line);
}
.tpl-item .tpl-tag { font-size: 10.5px; color: #8b98a8; white-space: nowrap; }
.tpl-item input {
  width: 54px; padding: 2px 4px; border: none; background: transparent;
  color: #d7e1ee; font-size: 12px; text-align: right;
}
.tpl-item input:focus { outline: 1px solid #4a6fa5; border-radius: 4px; }
.tpl-item .tpl-unit { font-size: 10px; color: #6b7785; }
.tpl-note { margin-top: 6px; font-size: 10.5px; color: #7d8b9c; line-height: 1.5; }

/* ---------- 上一轮成绩单（MAE/MFE） ---------- */
.cycle-line { font-size: 11px; color: #8b98a8; line-height: 1.55; margin-top: 2px; }
.cycle-line b { font-weight: 600; }

/* ---------- 固定策略类型展示 ---------- */
.type-fixed {
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 10px; border-radius: 7px;
  background: #141c26; border: 1px solid var(--line);
}
.type-fixed b { font-size: 12.5px; color: #d7e1ee; font-weight: 600; }
.type-fixed span { font-size: 10.5px; color: #7d8b9c; }

/* ============ 策略表单：分区 ============ */
.rule-form { gap: 11px; }
.fsec {
  border: 1px solid #1e2836;
  border-radius: 8px;
  background: #0f1620;
  padding: 11px 12px;
  display: grid;
  gap: 9px;
}
.fsec-h {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: #cfdcea; margin: 0;
}
.fsec-h .no {
  width: 17px; height: 17px; border-radius: 50%;
  background: #1f2c3d; color: #7ea8e0;
  font-size: 10.5px; display: grid; place-items: center;
  font-weight: 700; flex: none;
}

/* ============ 开关行（一行一个，绝不会和标题错位）============ */
.sw-list { display: grid; gap: 1px; }
.sw-row {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 8px 9px; border-radius: 7px;
  transition: background .15s;
}
.sw-row:hover { background: #121b26; }
.sw {
  position: relative; flex: none;
  width: 34px; height: 19px; margin-top: 1px; cursor: pointer;
}
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track {
  position: absolute; inset: 0; border-radius: 10px;
  background: #2a3646; border: 1px solid #35455a;
  transition: .18s;
}
.sw-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #7c8b9d; transition: .18s;
}
.sw input:checked + .sw-track { background: rgba(76,141,255,.26); border-color: var(--accent); }
.sw input:checked + .sw-track::after { left: 17px; background: var(--accent); }
.sw input:focus-visible + .sw-track { outline: 2px solid rgba(76,141,255,.5); outline-offset: 2px; }
.sw-body { display: grid; gap: 2px; }
.sw-body b { font-size: 12px; color: #d6e0ea; font-weight: 600; }
.sw-body small { font-size: 11px; color: #7f8e9f; line-height: 1.55; }
.sw-body em { color: #e0a93f; font-style: normal; }

/* ============ 高级参数（折叠）============ */
details.adv { display: block; padding: 0; }
details.adv[open] { padding-bottom: 11px; }
details.adv .fsec-h { cursor: pointer; list-style: none; padding: 11px 12px; user-select: none; }
details.adv .fsec-h::-webkit-details-marker { display: none; }
details.adv .fsec-h::after {
  content: "展开"; margin-left: auto;
  font-size: 10.5px; color: #5f6f80; font-weight: 400;
}
details.adv[open] .fsec-h::after { content: "收起"; }
details.adv .grid2 { padding: 0 12px; }
details.adv .grid2 + .grid2 { margin-top: 9px; }
.adv-hint { font-size: 10.5px; color: #5f6f80; font-weight: 400; }

/* ============ 币种适合度标签 ============ */
.fit-tag {
  font-size: 10.5px; padding: 3px 7px; border-radius: 4px;
  display: inline-block; line-height: 1.45;
}
.fit-tag.good { background: rgba(46,189,133,.13); color: #4fd1a0; border: 1px solid rgba(46,189,133,.35); }
.fit-tag.mid  { background: rgba(240,185,11,.12); color: #e0b344; border: 1px solid rgba(240,185,11,.30); }
.fit-tag.bad  { background: rgba(246,70,93,.12);  color: #f08a9b; border: 1px solid rgba(246,70,93,.32); }

/* 行情表振幅列 */
td.amp { font-variant-numeric: tabular-nums; }
td.amp .amp-tag {
  font-size: 9.5px; padding: 1px 4px; border-radius: 3px; margin-left: 4px;
  vertical-align: 1px;
}
td.amp .amp-tag.good { background: rgba(46,189,133,.16); color: #4fd1a0; }
td.amp .amp-tag.mid  { background: rgba(240,185,11,.14); color: #dcb03f; }
td.amp .amp-tag.bad  { background: rgba(246,70,93,.14);  color: #ec8798; }

/* 持仓卡片里的风险等级 */
.risk-pill {
  font-size: 10px; padding: 1px 6px; border-radius: 9px;
  border: 1px solid transparent; white-space: nowrap;
}
.risk-pill.lv1 { background: rgba(240,185,11,.14); color: #e5b23c; border-color: rgba(240,185,11,.35); }
.risk-pill.lv2 { background: rgba(246,70,93,.14);  color: #f08a9b; border-color: rgba(246,70,93,.38); }
td.amp.good { color: #4fd1a0; }
td.amp.mid  { color: #dcb03f; }
td.amp.bad  { color: #74828f; }

/* ============ 每档金额 / 跌幅 表格 ============ */
.lp-box {
  border: 1px solid #1e2836; border-radius: 8px;
  overflow: hidden; background: #0d141d;
}
.lp-head, .lp-row {
  display: grid; grid-template-columns: 62px 1fr 1.1fr;
  gap: 8px; align-items: center;
}
.lp-head {
  padding: 7px 10px; background: #131c27;
  font-size: 10.5px; color: #78889a; letter-spacing: .2px;
}
.lp-row { padding: 5px 10px; border-top: 1px solid #16202c; }
.lp-row:first-child { border-top: none; }
.lp-row .lp-tag { font-size: 11px; color: #93a2b3; white-space: nowrap; }
.lp-row .lp-tag b { color: #cfe0ff; font-weight: 600; }
.lp-cell { display: flex; align-items: center; gap: 4px; }
.lp-cell input {
  width: 100%; min-width: 0; padding: 3px 6px;
  background: #141c26; border: 1px solid #253244; border-radius: 5px;
  color: #d7e1ee; font-size: 12px; text-align: right;
}
.lp-cell input:focus { outline: 1px solid #4a6fa5; border-color: #4a6fa5; }
.lp-cell input:disabled { opacity: .4; }
.lp-cell .u { font-size: 10px; color: #6b7785; flex: none; }
.lp-row.total { background: #121b26; }
.lp-row.total .lp-tag { color: #8fb4ff; }
.lp-note { padding: 6px 10px 8px; font-size: 10.5px; color: #7d8b9c; line-height: 1.55; }

/* ============ 市场温度徽章 ============ */
.phase-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid #2a3d57; background: #131c27;
  cursor: pointer; transition: .15s; flex: none;
}
.phase-badge:hover { border-color: #3a5170; background: #16202e; }
.phase-badge .ph-lv { font-size: 11px; color: #9db0c4; font-weight: 600; }
.phase-badge .ph-temp {
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.phase-badge.bull { border-color: rgba(246,70,93,.45); background: rgba(246,70,93,.10); }
.phase-badge.bull .ph-lv, .phase-badge.bull .ph-temp { color: #ff8a9b; }
.phase-badge.bear { border-color: rgba(46,189,133,.45); background: rgba(46,189,133,.10); }
.phase-badge.bear .ph-lv, .phase-badge.bear .ph-temp { color: #4fd1a0; }
.phase-badge.range .ph-lv, .phase-badge.range .ph-temp { color: #d7b25a; }

/* ============ 开新仓开关 ============ */
.pause-sw {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px; flex: none;
  border: 1px solid #2a3d57; background: #131c27;
  cursor: pointer; font-size: 11.5px; color: #9db0c4;
  transition: .15s;
}
.pause-sw:hover { border-color: #3a5170; }
.pause-sw .ps-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #2ebd85;
  box-shadow: 0 0 6px rgba(46,189,133,.6);
}
.pause-sw.paused { border-color: rgba(240,185,11,.5); background: rgba(240,185,11,.10); color: #e8c05a; }
.pause-sw.paused .ps-dot { background: #f0b90b; box-shadow: 0 0 6px rgba(240,185,11,.6); }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 7, 13, .72);
  display: grid; place-items: center;
  padding: 28px;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal-card {
  width: min(820px, 100%); max-height: 88vh;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-sub { font-size: 11px; color: #6f7e8f; }
.modal-x {
  background: transparent; border: none; color: #7f8ea0;
  font-size: 19px; line-height: 1; padding: 2px 6px; cursor: pointer;
}
.modal-x:hover { color: #cfe0ff; }
.modal-body { padding: 14px 16px 18px; overflow: auto; }

/* 温度总览 */
.ph-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 15px; border-radius: 10px;
  background: linear-gradient(90deg, #121b26, #16202e);
  border: 1px solid #1e2836; margin-bottom: 14px;
}
.ph-gauge { flex: none; width: 78px; text-align: center; }
.ph-gauge .num { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ph-gauge .unit { font-size: 10px; color: #6f7e8f; }
.ph-hero .txt { display: grid; gap: 4px; }
.ph-hero .lv { font-size: 14px; font-weight: 600; }
.ph-hero .sub { font-size: 11.5px; color: #8b98a8; line-height: 1.6; }
.ph-bar {
  height: 6px; border-radius: 4px; margin-top: 6px;
  background: linear-gradient(90deg, #2ebd85, #46586c 45%, #46586c 55%, #f6465d);
  position: relative;
}
.ph-bar i {
  position: absolute; top: -3px; width: 3px; height: 12px;
  background: #fff; border-radius: 2px; box-shadow: 0 0 6px rgba(255,255,255,.7);
}

/* 维度 */
.ph-dim { border: 1px solid #1e2836; border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.ph-dim-h {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; background: #131c27;
}
.ph-dim-h .nm { font-size: 12.5px; font-weight: 600; color: #cfdcea; }
.ph-dim-h .sc { margin-left: auto; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ph-dim-h .sc.pos { color: #ff8a9b; }
.ph-dim-h .sc.neg { color: #4fd1a0; }
.ph-dim-h .sc.zero { color: #7f8ea0; }
.ph-item { display: grid; grid-template-columns: 26px 1fr 1.15fr; gap: 8px; padding: 6px 12px; border-top: 1px solid #16202c; }
.ph-item .mk { font-size: 11px; text-align: center; font-weight: 700; }
.ph-item .mk.pos { color: #ff8a9b; }
.ph-item .mk.neg { color: #4fd1a0; }
.ph-item .mk.zero { color: #5f6f80; }
.ph-item .nm { font-size: 11.5px; color: #a8b6c6; }
.ph-item .vl { font-size: 11.5px; color: #d6e0ea; font-family: ui-monospace, Consolas, monospace; }
.ph-item .nt { grid-column: 2 / 4; font-size: 10.5px; color: #6f7e8f; line-height: 1.5; }

.ph-sec { margin: 16px 0 8px; font-size: 11px; color: #7f8ea0; letter-spacing: .3px; }
.ph-ref, .ph-mon { display: flex; gap: 10px; padding: 5px 0; font-size: 11.5px; color: #a8b6c6; border-bottom: 1px dashed #1a2330; }
.ph-ref b, .ph-mon b { color: #d6e0ea; font-weight: 600; }
.ph-mon .lv { margin-left: auto; font-weight: 600; }
.ph-mon .lv.bull { color: #ff8a9b; }
.ph-mon .lv.bear { color: #4fd1a0; }
.ph-mon .lv.range { color: #d7b25a; }
.ph-advice {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: #121b26; border-left: 3px solid var(--accent);
  font-size: 11.5px; color: #a8b6c6; line-height: 1.65;
}

/* 疑似筑底 + 判据成绩（市场温度弹窗） */
.ph-bottom { border: 1px solid #1c2734; border-radius: 8px; padding: 10px 12px 4px; background: #0d141c; }
.ph-bottom.on { border-color: #3a6b56; background: #0e1a16; }
.ph-bottom .bh { font-size: 12px; font-weight: 600; color: #d6e0ea; display: grid; gap: 4px; margin-bottom: 6px; }
.ph-bottom.on .bh { color: #6fe0b0; }
.ph-bottom .bh span { font-weight: 400; font-size: 11px; color: #8b98a8; line-height: 1.6; }
.ph-bottom .ph-item { grid-template-columns: 22px 1.25fr 1fr; border-top: 1px solid #16202c; }
.ph-bottom .ph-item .ic { font-size: 11px; text-align: center; font-weight: 700; color: #44546a; }
.ph-bottom .ph-item.ok .ic { color: #4fd1a0; }
.ph-bottom .ph-item.ok .nm { color: #cfe0d6; }
.ph-fact { display: grid; gap: 8px; }
.ph-fact > div { font-size: 11.5px; color: #93a3b4; line-height: 1.65; padding: 8px 12px; border-left: 2px solid #24303e; background: #0d141c; border-radius: 0 6px 6px 0; }
.ph-fact b { display: block; color: #d6e0ea; font-size: 11.5px; margin-bottom: 2px; }
.ph-dim-h .wt { font-style: normal; font-size: 10px; color: #6f7e8f; }
.ph-item.nodata .nm, .ph-item.nodata .vl { color: #5a6a7c; }

/* 表单里的小字说明（日线 MA200 过滤等） */
.field-hint { display: block; margin-top: 7px; font-size: 11px; line-height: 1.65; color: #6f7e8f; }

/* 回撤硬线状态行（页头，峰值回撤提示） */
.dd-hint { font-size: 12px; color: var(--dim); margin-top: 4px; }
.dd-hint.warn { color: var(--warn); font-weight: 600; }

/* ============ 事件推送弹窗 ============ */
.nt-card-wrap { width: min(920px, 100%); }
.nt-sw { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; flex-wrap: wrap; }
.nt-sw input { margin-top: 2px; }
.nt-hint { font-size: 11px; line-height: 1.6; color: #6f7e8f; }
.nt-sec { margin: 18px 0 9px; font-size: 11px; letter-spacing: .05em; color: #8595a8; }
.nt-groups { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.nt-chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.nt-chk:hover { border-color: #2c3d52; }
.nt-note {
  margin-top: 10px; padding: 9px 12px;
  border-left: 2px solid #2c3d52; background: #0e1620;
  font-size: 11.5px; line-height: 1.7; color: var(--dim);
  border-radius: 0 6px 6px 0;
}
.nt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 11px; }
.nt-card { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #0e1620; }
.nt-card.on { border-color: rgba(46,189,133,.42); background: rgba(46,189,133,.05); }
.nt-card-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 3px; }
.nt-on {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: rgba(46,189,133,.16); color: var(--down);
}
.nt-field { display: grid; gap: 4px; margin-top: 8px; }
.nt-field label { font-size: 10.5px; color: #7f8ea0; }
.nt-field input {
  width: 100%; font-size: 12px; padding: 6px 8px;
  background: #0a1119; border: 1px solid var(--line); border-radius: 6px; color: var(--txt);
}
.nt-field input:focus { outline: none; border-color: #33506f; }
.nt-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.nt-foot {
  display: flex; align-items: center; gap: 12px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.nt-err {
  margin-top: 10px; padding: 8px 11px; border-radius: 6px;
  background: rgba(246,70,93,.09); border: 1px solid rgba(246,70,93,.32);
  color: #f2788b; font-size: 11.5px; word-break: break-all;
}

/* ---------- 手动买入行内浮层（替代 prompt） ---------- */
.buy-box {
  position: absolute; z-index: 90;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: 8px;
  background: #16202e; border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.buy-box b { font-size: 12px; color: #c8d3e0; }
.buy-box input {
  width: 72px; padding: 4px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: #0e1621; color: #e8eef5;
  font-size: 12.5px;
}
.buy-box .u { font-size: 11px; color: #5b6878; }

