/* ETF 技术面筛选系统 */
:root {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --card: #1a2338;
  --card-hi: #212c46;
  --line: #2a3654;
  --text: #e7edf8;
  --text-dim: #8b99b8;
  --primary: #4f7cff;
  --primary-hi: #6b91ff;
  --buy: #ff5b6a;
  --sell: #2fd48f;
  --warn: #f7b955;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}

button { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #141c30, #1a2440);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
@media (max-width: 1240px) {
  .topbar { flex-wrap: wrap; gap: 14px; }
  .topbar-stats { margin-left: auto; }
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
}
.brand h1 { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.brand p { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* 顶栏 - 数据管理 */
.topbar-data {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 320px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}
.data-label {
  font-size: 11.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.topbar-data .progress {
  margin-top: 0;
  width: 210px;
  flex-shrink: 0;
}
.topbar-data .progress-bar { height: 5px; }
.topbar-data .progress-text {
  margin-top: 3px;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}
.data-hint {
  font-size: 10.5px;
  color: #6f7fa6;
  margin-top: 0 !important;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-stats { display: flex; gap: 26px; margin-left: auto; flex-shrink: 0; }
.stat { text-align: right; }
.stat-label { display: block; font-size: 11px; color: var(--text-dim); }
.stat-value { font-size: 19px; font-weight: 700; color: var(--primary-hi); }

/* ---------- 布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1680px;
  margin: 0 auto;
}
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } }

/* 监控页: 左栏(表单/列表)始终留在视口内, 内容超高时自身滚动, 不会被右栏拖着一起滚走 */
#page-monitor .layout { grid-template-columns: 360px 1fr; }
#page-monitor .layout > .col-left {
  align-self: start;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
@media (max-width: 1080px) {
  #page-monitor .layout { grid-template-columns: 1fr; }
  #page-monitor .layout > .col-left {
    position: static; max-height: none; overflow: visible; padding-right: 0;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-head h2::before {
  content: "";
  width: 3px; height: 14px;
  background: var(--primary);
  border-radius: 2px;
}
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  background: var(--card-hi);
  color: var(--text);
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hi); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }
.btn-danger { background: transparent; border-color: #6e2b35; color: var(--buy); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 分段控件 ---------- */
.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg-btn {
  border: 0; background: transparent;
  color: var(--text-dim);
  padding: 7px 13px; font-size: 12.5px;
  cursor: pointer;
}
.seg-btn.active { background: var(--primary); color: #fff; }

/* ---------- 策略列表 ---------- */
.strategy-list { display: flex; flex-direction: column; gap: 9px; }

/* 用法说明 */
.st-usage {
  font-size: 11.5px; line-height: 1.7; color: var(--text-dim);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 2px solid var(--primary);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 12px;
}
.st-usage b { color: var(--text); font-weight: 600; }
.st-usage .hl { color: var(--warn); font-weight: 600; }
.st-usage .c-trend { color: var(--buy); }
.st-usage .c-osc { color: var(--sell); }
.st-usage .c-regime { color: var(--primary-hi); }

/* 分类分组 */
.st-group { display: flex; flex-direction: column; gap: 7px; }
.st-group + .st-group { margin-top: 14px; }
.st-group-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 5px; border-bottom: 1px dashed var(--line);
}
.st-group-name { font-size: 12.5px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.st-group-count {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--card-hi); color: var(--text-dim);
}
.st-group-usage {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: rgba(79, 124, 255, .16); color: var(--primary-hi);
}
.st-group-hint {
  font-size: 11px; color: var(--text-dim); line-height: 1.5; margin-bottom: 2px;
}

.strategy-item {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color .15s;
}
.strategy-item:hover { border-color: var(--primary); }
.strategy-item.off { opacity: .48; }
.st-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-name { font-weight: 600; font-size: 13.5px; display: flex; gap: 7px; align-items: center; }
.tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: #2b3a5c; color: var(--text-dim); font-weight: 500;
}
.tag.custom { background: #3a2b5c; color: #b39ddb; }
.st-actions { display: flex; gap: 6px; align-items: center; }
.st-state {
  font-size: 11px; min-width: 40px; text-align: right;
  color: var(--text-dim); user-select: none;
}
.st-state.on { color: var(--primary-hi); }
.st-state.off { color: var(--text-dim); }
.st-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.5; }
.st-params { font-size: 11px; color: #6f7fa6; margin-top: 4px; font-family: Consolas, monospace; }

/* 开关 */
.switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0;
  background: #34415f; border-radius: 19px;
  cursor: pointer; transition: .2s;
}
.switch i::before {
  content: "";
  position: absolute; width: 15px; height: 15px;
  left: 2px; top: 2px;
  background: #93a3c7; border-radius: 50%;
  transition: .2s;
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::before { transform: translateX(15px); background: #fff; }

/* ---------- 进度条 ---------- */
.progress { margin-top: 10px; }
.progress-bar {
  height: 6px; background: var(--bg-soft);
  border-radius: 4px; overflow: hidden;
}
.progress-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width .3s;
}
.progress-text { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.hint { font-size: 11.5px; color: var(--text-dim); margin-top: 9px; line-height: 1.5; }

/* ---------- 扫描状态 ---------- */
.scan-status { font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.scan-status b { color: var(--primary-hi); }
/* 数据过期导致零命中时的引导文案, 需要比普通状态文字更显眼 */
.scan-status .warn-text { color: var(--warn); font-weight: 600; }
.mode-hint {
  font-size: 11.5px; line-height: 1.6; color: var(--text-dim);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; margin-top: 10px; margin-bottom: 8px;
}

/* ---------- 结果筛选栏 ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
}
.filter-label { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.filter-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-dim);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--primary); color: var(--text); }
.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.filter-chip .cnt { font-weight: 700; margin-left: 4px; }
.filter-chip.all-buy.active { background: var(--buy); border-color: var(--buy); }
.filter-chip.all-sell.active { background: var(--sell); border-color: var(--sell); color: #08131d; }
.filter-extra {
  font-size: 12px;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 5px;
}
.filter-extra input {
  width: 54px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 3px 6px;
  font-size: 12px;
  text-align: center;
  outline: none;
}
.filter-extra input:focus { border-color: var(--primary); }
.filter-count { margin-left: auto; font-size: 12px; color: var(--primary-hi); font-weight: 600; }

/* ---------- 结果表格 ---------- */
.table-wrap { overflow-x: auto; max-height: 62vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.result-table th {
  position: sticky; top: 0;
  background: var(--card-hi);
  color: var(--text-dim);
  font-size: 11.5px; font-weight: 600;
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #20294175;
  white-space: nowrap;
}

/* 可排序表头: 点一下按该列排, 再点一次反向 */
.result-table th.sortable { cursor: pointer; user-select: none; }
.result-table th.sortable:hover { color: var(--text); background: #26324f; }
.result-table th.sorted { color: var(--primary-hi); }
.result-table th .sort-ind { margin-left: 4px; font-size: 9px; vertical-align: 1px; }
/* 数值列右对齐: 价格/涨跌幅按位对齐才好上下比大小 */
.result-table th.right, .result-table td.num { text-align: right; }
.result-table tbody tr:hover { background: #1f2a45; }
.result-table .empty-row td {
  text-align: center; color: var(--text-dim);
  padding: 46px 12px; white-space: normal;
}
.code-cell { font-family: Consolas, monospace; color: var(--primary-hi); cursor: pointer; font-weight: 600; }
.code-cell:hover { text-decoration: underline; }
.name-cell { max-width: 190px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--sell); }
.neg { color: var(--buy); }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.badge.buy { background: rgba(255,91,106,.14); color: var(--buy); border: 1px solid rgba(255,91,106,.35); }
.badge.sell { background: rgba(47,212,143,.12); color: var(--sell); border: 1px solid rgba(47,212,143,.3); }
.badge.hold { background: #232d47; color: #6f7fa6; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(6,10,18,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(560px, 94vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
}
.modal-lg { width: min(940px, 96vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; }
.modal-close {
  background: none; border: 0;
  color: var(--text-dim); font-size: 24px;
  cursor: pointer; line-height: 1;
}
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}

/* 表单 */
.field { display: block; margin-bottom: 13px; }
.field span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 11px;
  font-size: 13.5px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); }
.field input[type=file] { font-size: 12.5px; color: var(--text-dim); }
.field .inline { display: flex; gap: 8px; align-items: center; }
.field small { font-size: 11px; color: #6f7fa6; }
.dim { color: var(--text-dim); font-size: 10.5px; }

.doc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 12.5px;
}
.doc summary { cursor: pointer; color: var(--primary-hi); }
.doc pre {
  font-size: 11.5px;
  overflow-x: auto;
  color: #a9b8d8;
  margin: 9px 0;
  line-height: 1.5;
}

/* 详情 */
.detail-meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-dim);
  margin-bottom: 12px;
}
.detail-meta b { color: var(--text); font-weight: 600; }
#detail-chart { width: 100%; background: var(--bg-soft); border-radius: 8px; }
.detail-signals { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.sig-chip {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12px;
}
.sig-chip .sig-name { font-weight: 600; margin-bottom: 3px; }
.sig-chip .sig-detail { color: var(--text-dim); font-size: 11.5px; line-height: 1.6; }

/* Toast */
#toast-stack {
  position: fixed; right: 18px; top: 70px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  animation: toast-in .25s ease;
  max-width: 340px;
}
.toast.ok { background: #1f9d66; }
.toast.err { background: #c43c4e; }
.toast.info { background: #3556a8; }
@keyframes toast-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2d3a5c; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 回测历史 ---------- */
.bt-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.bt-history-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color .15s;
}
.bt-history-item:hover { border-color: var(--primary); }
.bt-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.bt-history-name { font-weight: 600; font-size: 14px; }
.bt-history-date { color: var(--text-dim); font-size: 12px; }
.bt-history-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.bt-history-stats b { color: var(--text); }
.bt-history-actions {
  display: flex;
  gap: 8px;
}

/* ---------- 回测详情 ---------- */
.bt-detail-summary { margin-bottom: 16px; }
.bt-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.bt-summary-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bt-summary-item span { font-size: 12px; color: var(--text-dim); }
.bt-summary-item b { font-size: 16px; }
@media (max-width: 768px) {
  .bt-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 顶部菜单 ---------- */
.main-nav { display: flex; gap: 4px; background: var(--bg-soft); padding: 3px; border-radius: 8px; border: 1px solid var(--line); }
.nav-btn {
  background: transparent; border: 0; color: var(--text-dim);
  padding: 6px 16px; border-radius: 6px; font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 实时监控 ---------- */
.monitor-form { display: flex; flex-direction: column; gap: 9px; }
.monitor-form select,
.monitor-form input[type="text"],
.monitor-form input:not([type]) {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--text); border-radius: 7px; padding: 7px 10px; font-size: 13px;
}
/* 代码 + 周期 并排, 省一行高度 */
.field-row { display: flex; gap: 8px; }
.field-row .field { margin-bottom: 0; }
.field-row .field-code { flex: 1 1 auto; min-width: 0; }
.field-row .field-bar { flex: 0 0 96px; }

/* 技术指标: 按分组展示(日内信号体系 / 经典), 组内紧凑两列, 参数按需展开(跨两列) */
.mon-ind-list {
  display: flex; flex-direction: column; gap: 9px;
  max-height: 330px; overflow-y: auto; overflow-x: hidden;
}
.mon-ind-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mon-ind-group-head {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 3px 6px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.mon-ind-group-head:hover { border-color: var(--primary); }
.mon-ind-group-head .gfold {
  color: var(--text-dim); font-size: 10px; width: 10px; flex-shrink: 0;
}
.mon-ind-group-head b { font-size: 12px; font-weight: 600; }
.mon-ind-group-head .gcount {
  font-size: 10.5px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 6px;
}
.mon-ind-group-actions { margin-left: auto; display: flex; gap: 4px; }
.mon-ind-ga {
  background: none; color: var(--text-dim); font-family: inherit;
  font-size: 10.5px; line-height: 15px; padding: 0 6px; cursor: pointer;
  border: 1px dashed var(--line); border-radius: 999px;
}
.mon-ind-ga:hover { color: var(--primary-hi); border-color: var(--primary); }
.mon-ind-group-hint { font-size: 10.5px; color: var(--text-dim); line-height: 1.5; padding: 0 2px; }
.mon-ind-group-note {
  font-size: 10.5px; line-height: 1.5; padding: 3px 6px; border-radius: 6px;
  color: #b7791f; background: rgba(214,158,46,.12);
  border: 1px solid rgba(214,158,46,.35);
}
.mon-ind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.mon-ind-group.folded .mon-ind-group-hint,
.mon-ind-group.folded .mon-ind-grid { display: none; }
.mon-ind-group.folded .mon-ind-group-head { opacity: .72; }
.mon-ind {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 7px; padding: 4px 7px; min-width: 0;
  transition: background .15s, border-color .15s;
}
.mon-ind.on { background: rgba(79,124,255,.10); border-color: rgba(79,124,255,.5); }
.mon-ind.open { grid-column: 1 / -1; }
.mon-ind-head { display: flex; align-items: center; gap: 5px; min-width: 0; }
.mon-ind-name {
  display: flex; align-items: center; gap: 5px;
  min-width: 0; cursor: pointer; flex: 1 1 auto;
}
.mon-ind-name input[type="checkbox"] {
  accent-color: var(--primary); margin: 0; flex-shrink: 0;
}
.mon-ind-name b {
  font-size: 12.5px; font-weight: 600; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mon-ind-tune {
  flex-shrink: 0; margin-left: auto; cursor: pointer;
  background: none; color: var(--text-dim); font-family: inherit;
  font-size: 10.5px; line-height: 15px; padding: 0 6px;
  border: 1px dashed var(--line); border-radius: 999px;
  transition: color .15s, border-color .15s, background .15s;
}
.mon-ind-tune:hover { color: var(--primary-hi); border-color: var(--primary); }
.mon-ind.open .mon-ind-tune {
  color: var(--primary-hi); border-style: solid; border-color: var(--primary);
}
.mon-ind.no-param .mon-ind-tune { display: none; }
.mon-params { display: flex; flex-wrap: wrap; gap: 7px; margin: 5px 0 1px 21px; }
.mon-params[hidden] { display: none; }
.mon-param { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); }
.mon-param input {
  width: 54px; background: var(--card); border: 1px solid var(--line);
  color: var(--text); border-radius: 5px; padding: 2px 5px; font-size: 11.5px;
}

/* 折叠卡片(点「收起」后只留标题栏) */
.card > .card-body { min-width: 0; }
.card.folded > .card-body { display: none; }

/* 监控列表: 卡内滚动, 不再把整页越撑越长 */
#mon-watch-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 42vh; overflow-y: auto; padding-right: 2px;
}
#mon-watch-list .mon-watch { margin-bottom: 0; }

.mon-watch { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; }
.mon-watch.paused { opacity: .55; }
.mon-watch-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; }
.mon-sym { font-weight: 600; font-family: "SF Mono", Consolas, monospace; }
.mon-name { color: var(--text-dim); font-size: 12px; }
.mon-price { margin-left: auto; font-weight: 600; }
.mon-watch-sub { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.mon-watch-foot { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.flex-gap { flex: 1; }

.mon-status { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.mon-ev-count { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.mon-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.mon-dot.on { background: var(--sell); box-shadow: 0 0 6px var(--sell); animation: mon-pulse 1.6s infinite; }
.mon-dot.off { background: #6f7fa6; }
@keyframes mon-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.mon-err { color: var(--warn); font-size: 11px; }
.mon-table { max-height: 62vh; overflow-y: auto; }

/* 「指标值」列: 条件多时文本很长, 这里省略号截断, 完整内容走 title 悬停(每项一行) */
.ev-detail small {
  display: inline-block; max-width: 240px;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom;
}
.ev-detail[title] small { cursor: help; }
.ev-detail[title]:hover small { color: var(--text); }

/* 信号流水的「按监控分组」小标题行: 每只标的各展示最新 N 笔 */
.ev-group td {
  background: var(--bg-soft); border-top: 1px solid var(--line);
  padding: 5px 8px; font-size: 11.5px;
}
.ev-group-name { font-weight: 600; color: var(--text); margin-right: 6px; }
.ev-group small { font-size: 11px; }

/* ---------- 编辑监控弹窗(增删/调整策略条件) ---------- */
.mon-edit-conds {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 42vh; overflow-y: auto;
}
.mon-edit-cond {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
.mon-edit-cond-head { display: flex; align-items: center; gap: 7px; }
.mon-edit-cond-head b { font-size: 13px; white-space: nowrap; }
.mon-edit-ord {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mon-edit-desc {
  color: var(--text-dim); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 46%;
}
.mon-edit-cond .mon-params { margin-left: 25px; }
.mon-edit-add { display: flex; gap: 8px; align-items: center; }
.mon-edit-add select { flex: 1 1 auto; min-width: 0; }
.toast.buy { background: #c43c4e; }
.toast.sell { background: #1f9d66; }

/* ---------- 监控状态列表（信号流水页顶部，有无信号都展示） ---------- */
.mon-state-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 34vh; overflow-y: auto; }
.mon-state-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px; padding: 7px 11px;
  font-size: 12.5px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.mon-state-row:hover { background: var(--card-hi); }
.mon-state-row.none  { border-left-color: #46557d; }
.mon-state-row.hit   { border-left-color: var(--buy); background: rgba(255,91,106,.08); }
.mon-state-row.wait  { border-left-color: #6f7fa6; }
.mon-state-row.paused { border-left-color: #46557d; opacity: .6; }
.mon-state-row.err   { border-left-color: var(--warn); }
.mon-state-name { font-weight: 600; }
.mon-state-name .mon-state-body { font-weight: 400; }
.mon-state-body { color: var(--text-dim); }
.mon-state-row.hit .mon-state-body { color: var(--buy); font-weight: 600; }
.mon-state-row.err .mon-state-body { color: var(--warn); }
.mon-state-time { color: #6f7fa6; font-size: 11.5px; }
.mon-state-price { font-weight: 600; }
.mon-state-price.pos { color: var(--buy); }
.mon-state-price.neg { color: var(--sell); }
/* 醒目提示条: 双击查看分钟线 */
.mon-state-tip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text);
  background-image: linear-gradient(90deg,
    rgba(79,124,255,.26), rgba(79,124,255,.08) 58%, rgba(79,124,255,0));
  border: 1px solid rgba(79,124,255,.45);
  border-left: 3px solid var(--primary);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
}
.mon-state-tip .tip-icon { color: var(--primary-hi); flex-shrink: 0; }
.mon-state-tip .tip-text { color: var(--text-dim); }
.mon-state-tip .tip-cta {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto;
  font-weight: 600; color: var(--primary-hi); white-space: nowrap;
}
.mon-state-tip kbd {
  display: inline-block; padding: 1px 8px; border-radius: 5px;
  background: var(--primary); color: #fff;
  font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .5px;
  animation: kbd-pulse 1.9s ease-out infinite;
}
@keyframes kbd-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79,124,255,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(79,124,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(79,124,255,0); }
}
/* 切到监控页时短暂闪烁, 吸引注意 */
.mon-state-tip.flash { animation: tip-flash 1.1s ease-in-out 3; }
@keyframes tip-flash {
  0%, 100% { background-color: transparent; border-color: rgba(79,124,255,.45); }
  50%      { background-color: rgba(79,124,255,.34); border-color: var(--primary-hi); }
}
@media (prefers-reduced-motion: reduce) {
  .mon-state-tip kbd, .mon-state-tip.flash { animation: none; }
}

/* 每行右侧「双击看分钟线」提示标签 */
.mon-state-hint {
  display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0;
  font-size: 11px; color: var(--primary-hi);
  border: 1px dashed rgba(79,124,255,.5); border-radius: 20px;
  padding: 1px 8px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.mon-state-hint i { font-style: normal; font-size: 10px; }
.mon-state-row:hover {
  border-color: var(--primary); box-shadow: 0 0 0 1px rgba(79,124,255,.28);
}
.mon-state-row:hover .mon-state-hint {
  background: var(--primary); border-color: var(--primary); border-style: solid; color: #fff;
}

/* 左栏监控项内的实时状态行 */
.mon-live { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.mon-live.hit { color: var(--buy); font-weight: 600; }
.mon-live.err { color: var(--warn); }
.mon-live.wait { color: #6f7fa6; }

/* ---------- 分钟线弹窗 ---------- */
#mon-chart { width: 100%; background: var(--bg-soft); border-radius: 8px; }
.mon-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; font-size: 12px; }
.mon-legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--text-dim); }
.mon-legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.mon-legend-item small { color: #6f7fa6; }
.mon-chart-foot { margin-top: 8px; }
.mon-chart-events { max-height: 30vh; overflow-y: auto; margin-top: 10px; }

/* ---------- 常用标的（典型 ETF 备选） ---------- */
.preset-groups { display: flex; flex-direction: column; gap: 7px; }
.preset-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.preset-tab {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: 999px;
  padding: 2px 9px; font-size: 11px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.preset-tab:hover { color: var(--text); border-color: var(--primary); }
.preset-tab.active {
  background: rgba(79,124,255,.18); border-color: var(--primary);
  color: var(--primary-hi); font-weight: 600;
}
.preset-tab small { color: #6f7fa6; font-size: 10px; }
.preset-tab.active small { color: var(--primary-hi); opacity: .8; }
.preset-note { font-size: 11px; color: #6f7fa6; }
.preset-hint { font-size: 11px; color: #6f7fa6; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.preset-chip {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); border-radius: 7px;
  padding: 4px 9px; font-size: 12px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.preset-chip:hover:not(:disabled) { background: var(--card-hi); border-color: var(--primary); }
.preset-chip:active:not(:disabled) { transform: translateY(1px); }
.preset-chip.active {
  background: rgba(79,124,255,.2); border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(79,124,255,.35) inset;
}
.preset-chip b {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11.5px; color: var(--primary-hi); font-weight: 600;
}
.preset-chip span { color: var(--text-dim); font-size: 11.5px; }
.preset-chip.active span { color: var(--text); }
.preset-chip.off { opacity: .4; cursor: not-allowed; }
