:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e6e8ec;
  --line-strong: #d6dae1;
  --text: #1b1f27;
  --text-2: #5b616e;
  --text-3: #8d94a3;
  --up: #d92b2b;
  --down: #12a05c;
  --accent: #185fa5;
  --accent-soft: #e8f1fa;
  --warn: #b4761b;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: #c3c9d3; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #13538f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #a93226; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 登录 ---------------- */
.auth-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 20% -10%, #e9f0f9 0%, transparent 60%),
    radial-gradient(800px 400px at 110% 110%, #eef6f1 0%, transparent 60%),
    var(--bg);
}
.auth-card {
  width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 18px;
}
.logo.sm { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; }
.auth-brand h1 { font-size: 17px; margin: 0 0 2px; font-weight: 600; }
.auth-brand p { margin: 0; font-size: 12px; }

.tabs-line { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  border: 0; background: none; padding: 8px 12px; cursor: pointer;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.market-dot { margin-left: auto; font-size: 11px; color: var(--text-3); }

.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; font-size: 12px; color: var(--text-2); }
.auth-form input,
.add-account input,
.search,
#account-select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus,
.add-account input:focus,
.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hint { margin: 0; font-size: 12px; color: var(--danger); min-height: 16px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand-mini { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.brand-mini strong { font-weight: 600; }

.session-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 20px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2);
}
.session-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #bbb; }
.session-pill .dot.on { background: var(--down); box-shadow: 0 0 0 3px rgba(18,160,92,.15); }
.session-pill .dot.off { background: var(--up); }
.session-pill .sep { width: 1px; height: 12px; background: var(--line-strong); }

.topstats { display: flex; gap: 22px; margin-left: auto; }
.topstats .stat { display: grid; gap: 1px; }
.topstats .stat span { font-size: 11px; color: var(--text-3); }
.topstats .stat b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
#account-select { min-width: 130px; padding: 6px 9px; font-size: 12px; }

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

/* ---------------- 行情表 ---------------- */
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.search { width: 180px; padding: 6px 10px; border-radius: 8px; font-size: 12px; }
.sort-chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 16px;
  padding: 4px 11px; font-size: 12px; color: var(--text-2); cursor: pointer;
}
.chip.active { background: var(--accent-soft); border-color: #b9d3ea; color: var(--accent); font-weight: 500; }
.switch { margin-left: auto; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; cursor: pointer; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }
.dim { color: var(--text-3); }




.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 10px 0; }
.kv-grid .kv { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; border-bottom: 1px dashed #eef0f4; }
.kv-grid .kv span { color: var(--text-3); }
.kv-grid .kv b { font-weight: 500; font-variant-numeric: tabular-nums; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: #eef0f4; color: var(--text-2); }
.tag.warn { background: #fdf3e2; color: var(--warn); }
.tag.ok { background: #e9f7f0; color: var(--down); }
.order-sum { font-size: 12px; color: var(--text-2); margin: 10px 0; }
.order-sum b { color: var(--text); font-variant-numeric: tabular-nums; }

.empty-row { color: var(--text-3); padding: 18px 0; text-align: center; font-size: 12px; }
table.mini { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12px; }
table.mini th { text-align: left; font-weight: 500; color: var(--text-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.mini td { padding: 6px 8px; border-bottom: 1px solid #f4f5f8; }
table.mini .num { text-align: right; }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .35);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal-card {
  width: min(520px, 100%); max-height: 84vh; overflow: auto;
  background: var(--panel); border-radius: 14px; padding: 20px;
  box-shadow: 0 24px 60px rgba(16,24,40,.18);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.account-list { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
.account-list li {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
.account-list .acc-main { flex: 1; display: grid; gap: 2px; }
.account-list .acc-main b { font-weight: 500; }
.account-list .acc-main span { font-size: 11.5px; color: var(--text-3); }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; }
.badge.online { background: #e9f7f0; color: var(--down); }
.badge.error { background: #fdecec; color: var(--up); }
.badge.new { background: #eef0f4; color: var(--text-2); }
.add-account { display: grid; gap: 8px; border-top: 1px dashed var(--line); padding-top: 14px; }
.add-account .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-account input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-strong); }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1b1f27; color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 12.5px; z-index: 80; max-width: 70vw;
}

@media (max-width: 1100px) {
  .topstats { display: none; }
}

.star { color: #e0a33e; margin-right: 4px; font-size: 11px; }

.auth-note {
  margin: 0 0 14px;
  padding: 9px 11px;
  background: #f3f7fc;
  border: 1px solid #dce8f5;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #46536a;
}
.auth-note strong { color: var(--accent); font-weight: 500; }

.auth-title { padding: 8px 0; font-weight: 600; }
.add-account select {
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff;
}

/* ---------------- 设备绑定面板 ---------------- */
.account-list li { flex-wrap: wrap; }
.account-list .acc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge.device_unbound { background: #fff4e5; color: #b26a00; }
.device-panel {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 8px 0 4px; background: var(--panel-2);
  display: grid; gap: 8px;
}
.device-panel[hidden] { display: none; }
.device-panel-head { display: flex; align-items: center; gap: 8px; }
.device-panel-head b { font-size: 13px; font-weight: 600; }
.device-panel-head .muted { flex: 1; }
.device-panel .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.device-panel input {
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff;
}
.device-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.device-panel .btn { white-space: nowrap; }
.device-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.device-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12px;
}
.device-list li .dev-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-list li .dev-key { color: var(--text-3); font-size: 11px; font-family: ui-monospace, monospace; }
.device-list li .dev-at { font-size: 11px; white-space: nowrap; }
.device-list-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line);
}

/* 机器指纹状态条（系统管理 → 设备） */
.machine-note {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px; background: #fff;
}
.machine-note > b:first-child { display: block; margin-bottom: 4px; font-size: 13px; }
.machine-note p b { color: #b3261e; }
.machine-note p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text-2); }
.machine-note code { font-family: ui-monospace, monospace; font-size: 11px; background: rgba(0,0,0,.05); padding: 1px 4px; border-radius: 4px; }
.machine-note.ok { border-color: var(--line); }
.machine-note.ok b { color: var(--text-2); }
.machine-note.warn { border-color: #d9a300; background: #fffbea; }
.machine-note.warn b { color: #8a6a00; }
.machine-note.danger { border-color: #e0483d; background: #fff5f4; }
.machine-note.danger b { color: #c03028; }
.machine-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.machine-actions .btn { white-space: nowrap; }
@media (max-width: 620px) {
  .device-list li { flex-wrap: wrap; }
  .device-list li .dev-at { order: 3; }
}
.acc-toolbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 -4px; }
.acc-toolbar .muted { flex: 1; }

.asset-grid { grid-template-columns: repeat(4, 1fr); gap: 10px 18px; margin: 4px 0; }
.asset-grid .kv { display: flex; flex-direction: column; gap: 2px; }
.asset-grid .kv span { font-size: 11px; color: var(--text-3); }
.asset-grid .kv b { font-size: 15px; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .asset-grid { grid-template-columns: repeat(2, 1fr); } }

/* ==================== 视图与交易台 ==================== */
#app-view { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.view { flex: 1; min-height: 0; }
#view-desk {
  overflow: auto; padding: 14px 16px 28px;
  display: flex; flex-direction: column; gap: 12px;
}
#view-market { display: flex; flex-direction: column; padding: 12px; }

/* 顶栏视图切换：做成有存在感的分段控件，一眼看出当前在哪一页 */
.view-switch {
  display: flex; gap: 4px; padding: 4px;
  background: linear-gradient(180deg, #f2f5fa, #e9eef6);
  border: 1px solid #dde4ee; border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06);
}
.vsw {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: transparent; border-radius: 9px;
  padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--text-2);
  cursor: pointer;
  transition: color .15s, background .18s, box-shadow .18s, transform .1s;
}
.vsw svg {
  width: 15px; height: 15px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .8;
}
.vsw:hover { color: var(--text); background: rgba(255, 255, 255, .7); }
.vsw:active { transform: translateY(1px); }
.vsw.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(180deg, #2f7ec4, var(--accent));
  box-shadow: 0 2px 6px rgba(24, 95, 165, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.vsw.active svg { opacity: 1; }

/* 交易台标题条 */
.desk-bar { display: flex; align-items: center; gap: 12px; }
.desk-title { font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.desk-title .muted { font-weight: 400; }
.desk-actions { margin-left: auto; display: flex; gap: 8px; }

/* 账号卡片 */
.acc-cards {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}
.acc-card {
  position: relative; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.acc-card:hover { border-color: #c3c9d3; }
.acc-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}
.acc-card.active::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.card-top { display: flex; align-items: center; gap: 8px; }
.card-alias { font-size: 14px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-phone { font-size: 11.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 10px 0 8px; }
.card-nums div { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.card-nums span { font-size: 11px; color: var(--text-3); }
.card-nums b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 8px; }
/* 4 个按钮会挤爆一行：状态文字独占一行，按钮整体靠右 */
.card-err { font-size: 11px; color: var(--text-3); flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-btns { display: flex; gap: 5px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.mini-btn {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px;
  padding: 2px 8px; font-size: 11.5px; cursor: pointer; color: var(--text-2);
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.mini-btn.warn { border-color: #eed6a8; background: #fdf7ec; color: var(--warn); }
.mini-btn.danger { border-color: transparent; background: transparent; color: var(--text-3); }
.mini-btn.danger:hover { border-color: #f0c9c4; background: #fdecec; color: var(--danger); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #a93226; border-color: #a93226; }
.acc-card.add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-style: dashed; background: transparent; box-shadow: none; min-height: 118px;
  color: var(--text-3);
}
.acc-card.add-card span { font-size: 20px; line-height: 1; }
.acc-card.add-card em { font-style: normal; font-size: 12px; }
.acc-card.add-card:hover { color: var(--accent); border-color: var(--accent); background: #fbfdff; }

/* 添加账号内联表单 */
.add-account.inline-add {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow);
}
.add-account.inline-add .row {
  display: flex; gap: 8px; align-items: center;
}
.add-account.inline-add input { flex: 1; min-width: 0; }
.add-account.inline-add .btn { flex: none; }

/* 账号面板 */
.acc-panel { overflow: hidden; }
.acc-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.acc-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acc-id b { font-size: 14px; }
.acc-tabs { display: flex; gap: 2px; }
.acc-tabs .tab { padding: 6px 12px; font-size: 12.5px; }
.acc-ops { margin-left: auto; display: flex; gap: 6px; }
.acc-metrics {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 16px; padding: 12px 14px; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.acc-metrics div { display: flex; flex-direction: column; gap: 2px; }
.acc-metrics span { font-size: 11px; color: var(--text-3); }
.acc-metrics b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-body { flex: 1; overflow: auto; padding: 6px 14px 12px; min-height: 120px; max-height: 46vh; }
.acc-body table.mini { font-size: 12.5px; }
@media (max-width: 900px) {
  .acc-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .add-account.inline-add .row { flex-wrap: wrap; }
}
/* 手机：账户面板的持仓表 6 列挤成一团，表头被截成「现 / 市」半个字。
 * 市值列（= 持仓数 × 现价，可自己算）直接隐藏，其余列收紧间距；
 * 再给表格一个最小宽度兜底，极端窄屏宁可横向滑也不许文字压字。 */
@media (max-width: 560px) {
  .acc-head { padding: 10px 12px; gap: 8px; }
  .acc-tabs { order: 3; width: 100%; border-top: 1px dashed var(--line); padding-top: 6px; }
  .acc-ops { margin-left: auto; }
  .acc-ops .btn { padding: 5px 9px; }
  .acc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 12px; }
  .acc-body { padding: 4px 10px 12px; }
  .acc-body table.mini { font-size: 11.5px; min-width: 320px; }
  .acc-body table.mini th, .acc-body table.mini td { padding: 6px 5px; white-space: nowrap; }
  .acc-body table.mini td:first-child { white-space: normal; word-break: break-word; }
  .acc-body table.mini .col-mv { display: none; }
}

/* 下单账号提示 */
.order-account {
  margin-left: auto; margin-right: 8px;
  font-size: 11px; color: var(--text-3);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.order-account.warn-text { color: var(--warn); }

/* 卡片金额层级 + 面板撑满 */
.card-main { display: flex; align-items: baseline; justify-content: space-between; margin-top: 10px; }
.card-main span { font-size: 11px; color: var(--text-3); }
.card-main b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card-nums { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; margin: 6px 0 8px; }
.card-nums div { flex-direction: column; align-items: flex-start; gap: 1px; }
.card-nums b { font-size: 12.5px; }
.acc-panel { flex: 1; min-height: 260px; }
.acc-body { max-height: none; }

select.order-account {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px;
  padding: 2px 6px; font-size: 11px; color: var(--text-2); max-width: 170px;
  cursor: pointer;
}
select.order-account:focus { border-color: var(--accent); outline: none; }

/* 下单控件不得溢出（input 默认宽度会撑破网格） */

/* ==================== 行情 / 交易（交易优先） ==================== */
/* 行情页改成整页滚动：列表 → 点进交易 → 返回，不做左右分栏 */
#view-market { display: block; overflow: auto; padding: 0; }

.mkt-list { max-width: 1080px; margin: 0 auto; padding: 0 14px 20px; }
.mkt-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; position: sticky; top: var(--strip-h, 88px); z-index: 5;
  background: linear-gradient(var(--bg) 78%, rgba(245,246,248,.85));
  backdrop-filter: blur(2px);
}
.mkt-bar .search { flex: 0 0 200px; }
.mkt-rows { display: grid; gap: 6px; }

.mkt-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1.7fr) 88px 108px 84px 14px;
  align-items: center; gap: 10px;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.mkt-row:hover { border-color: #c3d4e6; box-shadow: var(--shadow); background: #fff; }
.mkt-row:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mkt-row.selected { border-color: var(--accent); background: var(--accent-soft); }
/* 自选置顶：左侧金线 + 微暖底色，和普通行区分开 */
.mkt-row.pinned {
  box-shadow: inset 3px 0 0 #e2b264;
  background: linear-gradient(90deg, #fffdf6 0%, #fff 42%);
}
.mkt-row.pinned.selected { background: var(--accent-soft); }
.mkt-sect {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 3px 1px; font-size: 11px; color: var(--text-3);
}
.mkt-sect span { font-weight: 600; letter-spacing: .04em; color: var(--text-2); }
.mkt-sect i { font-style: normal; }
.mkt-empty {
  padding: 34px 12px; text-align: center; font-size: 12px; color: var(--text-3);
  border: 1px dashed var(--line-strong); border-radius: 10px; background: rgba(255, 255, 255, .6);
}
.r-star {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 15px; line-height: 1; color: #aeb6c4;
  transition: color .15s, transform .12s;
}
.r-star:hover { color: #e0a33e; transform: scale(1.18); }
.r-star.on { color: #e6a93c; }
.r-id { display: grid; gap: 1px; min-width: 0; }
.r-id b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-quote { display: grid; justify-items: end; gap: 1px; font-variant-numeric: tabular-nums; }
.r-quote b { font-size: 15px; font-weight: 600; }
.r-quote span { font-size: 11.5px; }
.r-book { display: grid; gap: 1px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-book b { font-weight: 500; }
.r-extra { text-align: right; white-space: nowrap; }
.r-go { color: var(--text-3); text-align: right; font-size: 15px; }

/* ---------- 交易视图 ---------- */
.trade-view { max-width: 1080px; margin: 0 auto; padding: 0 14px 28px; }
.trade-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; position: sticky; top: 0; z-index: 6;
  background: linear-gradient(var(--bg) 80%, rgba(245,246,248,.85));
  backdrop-filter: blur(2px);
}
.trade-back {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 9px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--text-2); font-size: 19px; line-height: 1; cursor: pointer;
}
.trade-back:hover { background: var(--panel-2); }
.trade-id { display: grid; gap: 1px; min-width: 0; flex: 1; }
.trade-id b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-quote { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.trade-quote b { font-size: 21px; font-weight: 600; }
.trade-quote span { font-size: 11.5px; }
/* 「加自选」原来透明底 + 浅边框，压在吸顶渐变头部上几乎看不见，改成浅蓝实底 */
#btn-watch.btn.ghost { background: var(--accent-soft); border-color: #cfe0f1; color: var(--accent); font-weight: 500; }
#btn-watch.btn.ghost:hover { background: #dcebf8; border-color: #b6d2ea; color: var(--accent); }
/* 已在自选里时 class 会同时有 ghost + primary，必须把底色一起改掉，否则白字压浅底看不见 */
#btn-watch.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500;
}
#btn-watch.btn.primary:hover { background: #13538f; border-color: #13538f; color: #fff; }

.trade-body { display: grid; gap: 10px; }
.trade-side { display: grid; gap: 10px; }
@media (min-width: 880px) {
  .trade-body { grid-template-columns: 350px minmax(0, 1fr); align-items: start; }
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.card-head .dim { margin-left: auto; }

/* 五档盘口 */
.book { list-style: none; margin: 0; padding: 0; }
.book-row {
  position: relative; display: grid; grid-template-columns: 34px 1fr 84px;
  align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  cursor: pointer; overflow: hidden; font-variant-numeric: tabular-nums;
}
.book-row:hover { background: #f6f8fb; }
.book-row .bar {
  position: absolute; right: 0; top: 2px; bottom: 2px; width: 0;
  border-radius: 4px; z-index: 0; pointer-events: none;
}
.book-row.ask .bar { background: rgba(18, 160, 92, .10); }
.book-row.bid .bar { background: rgba(217, 43, 43, .10); }
.book-row > span { position: relative; z-index: 1; }
.book-row .lv { font-size: 11px; color: var(--text-3); }
.book-row .px { text-align: right; font-size: 13.5px; font-weight: 600; }
.book-row .qty { text-align: right; font-size: 12px; color: var(--text-2); }
.book-row.ask .px { color: var(--down); }
.book-row.bid .px { color: var(--up); }
.book-row.empty { cursor: default; }
.book-row.empty .px { color: var(--text-3); }
.book-mid {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 6px 8px; margin: 4px 0;
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
}
.book-mid span { font-size: 11px; color: var(--text-3); }
.book-mid b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.book-foot { display: flex; gap: 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-3); }
.book-foot b { font-variant-numeric: tabular-nums; }

/* 席位标记：和「自己的账号」标签刻意做成两种形状 —— 账号是实心方块（你是谁），
   席位是空心小胶囊加一个色点（别人是谁，且只有一个短码）。 */
.seat-tag {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 3px; padding: 0 4px; height: 15px;
  font-size: 9.5px; font-style: normal; line-height: 15px; letter-spacing: .3px;
  color: var(--text-3); background: #fff;
  border: 1px solid color-mix(in srgb, var(--sc) 45%, #fff);
  border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.seat-tag::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--sc);
}
.book-row.seat-hit { background: color-mix(in srgb, var(--sc, #888) 8%, #f6f8fb); }
.book-row.seat-hit .px { text-decoration: underline dotted; }

/* 活跃席位条：盘口下面的「今天谁在这个品种挂过单」 */
.seat-strip { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.seat-strip-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11px; color: var(--text-3); margin-bottom: 6px;
}
.seat-strip-head span { font-weight: 600; color: var(--text-2); }
.seat-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.seat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px 2px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff;
  font-size: 10.5px; color: var(--text-2);
}
.seat-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--sc); }
.seat-chip b { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.seat-chip span { color: var(--text-3); }
.seat-chip:hover { border-color: var(--line-strong); }
.seat-chip.on { background: #eef4ff; border-color: #b9cdf5; color: var(--text); }

/* 下单 */
.acct-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; min-width: 0; }
.acct-pick .order-account {
  margin: 0; max-width: 190px; flex: 0 0 auto;
  padding: 6px 9px; font-size: 12px; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.acct-line { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-switch {
  display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 10px;
  border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden;
}
.side-btn { padding: 9px 0; border: 0; background: #fff; cursor: pointer; font-size: 13px; color: var(--text-2); }
.side-btn:hover { background: var(--panel-2); }
.side-btn.buy.active { background: var(--up); color: #fff; font-weight: 500; }
.side-btn.sell.active { background: var(--down); color: #fff; font-weight: 500; }

.order-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 11px; color: var(--text-3); }
.stepper {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px;
  border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff;
}
.stepper button { border: 0; background: var(--panel-2); cursor: pointer; font-size: 15px; color: var(--text-2); }
.stepper button:hover { background: #eef1f5; }
.stepper input {
  width: 100%; min-width: 0; border: 0; padding: 8px 4px;
  text-align: center; font-variant-numeric: tabular-nums; background: transparent;
}
.stepper input:focus { outline: none; }

.qty-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.qty-chips button {
  padding: 6px 0; font-size: 12px; color: var(--text-2);
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; cursor: pointer;
}
.qty-chips button:hover { border-color: #b9c9dc; background: var(--panel-2); }

.order-sum {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--text-2); margin: 8px 0 10px;
}
.order-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.btn-trade { padding: 11px 0; font-size: 14px; font-weight: 600; border: 0; border-radius: 9px; color: #fff; }
.btn-trade.buy { background: var(--up); }
.btn-trade.sell { background: var(--down); }
.btn-trade:hover { filter: brightness(.96); }
.btn-trade:disabled { opacity: .45; }

/* 基础信息 chips */
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.book-chips { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); gap: 5px; }
.book-chips .chip-info { padding: 3px 8px; font-size: 11px; background: transparent; }
.chip-info {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 4px 9px; border-radius: 20px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 11.5px;
}
.chip-info i { font-style: normal; color: var(--text-3); }
.chip-info b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* 持仓 */
.pos-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pos-grid > div { background: var(--panel-2); border-radius: 8px; padding: 7px 9px; }
.pos-grid span { display: block; font-size: 11px; color: var(--text-3); }
.pos-grid b { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------------- 策略：刷量 / 拖单 / 吸筹 / 挂单 ---------------- */
/* 每种策略一个强调色（徽章 + 左侧色条共用），色值取自全局变量体系，不另造彩虹色 */
.strat-item[data-type="pair"],
.strat-empty li[data-type="pair"] { --st-c: #5a6acf; --st-bg: #eef0fc; }
.strat-item[data-type="shield"],
.strat-empty li[data-type="shield"] { --st-c: var(--warn); --st-bg: #fdf4e6; }
.strat-item[data-type="eat"],
.strat-empty li[data-type="eat"] { --st-c: #c0392b; --st-bg: #fdeeeb; }
.strat-item[data-type="ladder"],
.strat-empty li[data-type="ladder"] { --st-c: var(--accent); --st-bg: var(--accent-soft); }

.strat-list { display: grid; gap: 8px; }
.strat-scope-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--text-3); }

.strat-item {
  display: grid;
  gap: 3px;
  padding: 9px 10px 8px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--st-c, var(--accent));
  border-radius: var(--radius);
  background: var(--panel-2);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.strat-item[data-state="running"] {
  background: var(--panel);
  box-shadow: inset 0 0 0 1px rgba(18, 160, 92, .16);
}
.strat-item[data-state="done"] { opacity: .68; }
.strat-item[data-state="done"]:hover { opacity: 1; }

.strat-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.strat-title b {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.strat-badge {
  flex: 0 0 auto; font-style: normal; font-size: 10px; font-weight: 600;
  line-height: 1.6; padding: 1px 7px; border-radius: 999px;
  color: var(--st-c, var(--accent)); background: var(--st-bg, var(--accent-soft));
}
.strat-dot {
  flex: 0 0 auto; width: 6px; height: 6px; margin-left: 2px;
  border-radius: 50%; background: #c9ced8;
}
.strat-item[data-state="running"] .strat-dot {
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(18, 160, 92, .14);
  animation: strat-pulse 2s ease-in-out infinite;
}
.strat-item[data-state="done"] .strat-dot { background: var(--text-3); }
@keyframes strat-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  .strat-item[data-state="running"] .strat-dot { animation: none; }
}

.strat-params,
.strat-metrics,
.strat-last { margin: 0; font-size: 11px; line-height: 1.55; }
.strat-params { color: var(--text-3); }
.strat-metrics { color: var(--text-2); font-variant-numeric: tabular-nums; }
.strat-last { margin-top: 1px; color: var(--text-3); }
.strat-last.bad { color: var(--danger); }

/* 操作放脚注行：和卡片自身的 .card-foot 用同一语言，正文也不会被按钮挤窄 */
.strat-ops {
  display: flex; gap: 6px; justify-content: flex-end;
  margin-top: 4px; padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.st-btn {
  border: 1px solid var(--line-strong); background: var(--panel);
  border-radius: 6px; padding: 3px 8px;
  font-size: 10.5px; line-height: 1.5; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.st-btn:hover { border-color: var(--accent); color: var(--accent); }
.st-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-btn.primary:hover { background: #13538f; border-color: #13538f; color: #fff; }
.st-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.st-btn:focus-visible,
.strat-type:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.st-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 空态：四种策略的一句话说明，比一整段文字更好扫读 */
.strat-empty {
  display: grid; gap: 3px;
  padding: 13px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.strat-empty b { margin-bottom: 4px; font-size: 12px; color: var(--text-2); }
.strat-empty ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.strat-empty li {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 11px; line-height: 1.5; color: var(--text-3);
}
.strat-empty li i {
  flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%;
  background: var(--st-c, var(--text-3)); transform: translateY(-2px);
}
.strat-empty li em { font-style: normal; font-weight: 600; color: var(--text-2); }

/* ---- 新建 / 编辑表单（已放进弹窗，页面只留列表） ---- */
.modal-card.modal-lg { width: min(620px, 100%); }
.modal-card .strat-types { margin: 10px 0 8px; }
.modal-card .strat-type-desc { margin-bottom: 2px; }
.modal-card .strat-fields { margin-top: 10px; }
.modal-card .strat-preview { margin-top: 10px; }
.modal-card .modal-ops { margin-top: 14px; }
.confirm-text { margin: 10px 0 4px; font-size: 12.5px; line-height: 1.7; color: var(--text-2); white-space: pre-line; }
.strat-note { margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: var(--text-3); }

/* 分段控件：灰底 + 白色滑块，比四个方块按钮更轻 */
.strat-types { display: flex; gap: 2px; padding: 2px; background: #eef0f4; border-radius: 8px; }
.strat-type {
  flex: 1; padding: 5px 4px;
  border: 0; border-radius: 6px; background: transparent;
  font-size: 12px; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.strat-type:hover { color: var(--text); }
.strat-type.active {
  background: var(--panel); color: var(--accent); font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

.strat-type-desc { margin: 0; font-size: 11px; line-height: 1.6; color: var(--text-3); }
.strat-fields { display: grid; gap: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }

.sf-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-2);
}
.sf-label { line-height: 1.35; min-width: 0; word-break: break-word; }
.sf-row select,
.sf-row input[type="number"],
.sf-row input[type="text"] {
  width: 100%; padding: 5px 8px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--panel); color: var(--text);
  font-size: 12px; font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.sf-row select:focus,
.sf-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sf-row input::placeholder { color: #b3b9c4; }

.sf-check { grid-template-columns: auto minmax(0, 1fr); justify-content: start; }
.sf-check input { width: 14px; height: 14px; accent-color: var(--accent); }
.sf-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 5px; }
.sf-range i { font-style: normal; font-size: 11px; color: var(--text-3); }
/* 定时：日期 + 时间 + 秒 三段（手机原生选择器只给到时/分，秒必须单独给一个框） */
.sf-dt { display: grid; grid-template-columns: 1fr 0.92fr 62px; gap: 5px; align-items: center; width: 100%; }
.sf-dt input { width: 100%; min-width: 0; }
.sf-dt-sec { display: flex; align-items: center; gap: 3px; }
/* 注意：.sf-row input[type="number"] 的优先级是 (0,2,1)，会把秒框撑满整行、
   把「秒」字挤到边缘，所以这里必须写到同等级别以上 */
.sf-dt .sf-dt-sec input[type="number"] {
  width: 44px; padding-left: 2px; padding-right: 2px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.sf-dt-sec i { font-style: normal; font-size: 10px; color: var(--text-3); }
/* 窄屏：日期和时间并排，秒单独一行，避免三段挤在一起点不准 */
@media (max-width: 620px) {
  .sf-dt { grid-template-columns: 1fr 1fr; row-gap: 6px; }
  .sf-dt-sec { grid-column: 1 / -1; }
  .sf-dt .sf-dt-sec input[type="number"] { width: 64px; }
}
.sf-hint { grid-column: 1 / -1; margin-top: -2px; font-size: 10.5px; line-height: 1.5; color: var(--text-3); }

/* 数字框 + 「−/+」步进按钮
 * 手机浏览器的 number 框没有上下箭头（iOS 完全不显示），价格/张数/撤单比例
 * 这类要微调的字段只能整段删了重输。按钮高度按 34px 起，拇指点得准。 */
.sf-num { display: flex; align-items: stretch; gap: 4px; min-width: 0; }
.sf-num input[type="number"] { flex: 1 1 auto; min-width: 0; text-align: center; }
.sf-step {
  flex: 0 0 34px; width: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--panel-2); color: var(--text-2);
  font-size: 16px; line-height: 1; cursor: pointer;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation; /* 长按连续加减时不要触发双击缩放 */
  transition: border-color .15s, color .15s, background .15s;
}
.sf-step:hover { border-color: var(--accent); color: var(--accent); }
.sf-step:active { background: var(--accent-soft); color: var(--accent); transform: scale(.96); }
.sf-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 720px) {
  .sf-step { flex-basis: 40px; width: 40px; font-size: 18px; }
}

.strat-preview {
  margin: 0; padding: 7px 9px;
  border-left: 2px solid var(--accent); border-radius: 0 7px 7px 0;
  background: var(--accent-soft); color: var(--text-2);
  font-size: 11px; line-height: 1.6;
}
.strat-preview.warn { border-left-color: var(--warn); background: #fdf4e6; color: #8a5a12; }

.strat-add { margin-top: 6px; }

/* 往期策略：已完成的策略收进折叠区，不再占列表主体的位置，但随时能翻出来复盘 */
.strat-past {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--line); padding-top: 5px; margin-top: 2px;
}
.strat-past summary {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 2px; cursor: pointer; list-style: none;
  font-size: 11.5px; color: var(--text-3);
}
.strat-past summary::-webkit-details-marker { display: none; }
.strat-past summary::before {
  content: '▸'; font-size: 10px; color: var(--text-3);
  transition: transform .15s;
}
.strat-past[open] summary::before { content: '▾'; }
.strat-past summary:hover { color: var(--text-2); }
.strat-past summary i {
  font-style: normal; font-size: 10.5px;
  background: #eef1f5; border-radius: 8px; padding: 0 6px;
}
.strat-past-list { display: grid; gap: 8px; margin-top: 6px; }
@media (min-width: 1180px) { .strat-past-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.strat-past-list .strat-item { opacity: .92; }
.strat-all-done { margin: 4px 2px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); }

/* 策略详情弹窗 */
.sd-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11.5px; color: var(--text-3); }
.sd-meta b { margin-left: 4px; color: var(--text); font-weight: 600; }
.sd-h { margin: 14px 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
.sd-grid > div {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  background: var(--panel-2);
}
.sd-grid span { font-size: 10.5px; color: var(--text-3); }
.sd-grid b { font-size: 12.5px; font-weight: 600; word-break: break-word; }
.sd-state { margin: 0; font-size: 12px; line-height: 1.6; color: var(--text-2); }
.sd-last { margin: 4px 0 0; font-size: 11.5px; color: var(--text-3); }
.sd-last.bad { color: var(--danger); }
.sd-orders {
  max-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
.sd-orders table.mini { font-size: 11.5px; }
.sd-orders thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }

/* 策略多时列表限高滚动：卡片本身不再把整页拉长 */
@media (min-width: 880px) {
  .strat-list { max-height: 320px; overflow-y: auto; padding-right: 2px; }
  .strat-list::-webkit-scrollbar { width: 6px; }
  .strat-list::-webkit-scrollbar-thumb { background: #d7dbe3; border-radius: 3px; }
}
/* 宽屏右栏够宽时排两列，一屏能看到更多策略 */
@media (min-width: 1180px) {
  .strat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 300px; }
}

/* 窄屏：操作按钮换到下一行，右对齐，别把标题挤扁 */
@media (max-width: 720px) {
  .strat-ops { justify-content: stretch; }
  .st-btn { flex: 1; padding: 5px 8px; text-align: center; }
  /* 手机上的弹窗：贴边、标签与输入框改上下排列，避免横向溢出 */
  .modal { padding: 10px; }
  .modal-card { padding: 14px; max-height: 88vh; border-radius: 12px; }
  .sf-row { grid-template-columns: 1fr; gap: 4px; }
  .sf-check { grid-template-columns: auto minmax(0, 1fr); }
  .sf-hint { margin-top: 0; }
  .modal-card .modal-ops { flex-wrap: wrap; }
  .modal-card .modal-ops .btn { flex: 1; }
  /* 策略表单字段多：操作按钮吸在弹窗底部，不用滚到底才能提交。
   * 负 margin 把吸底条铺到弹窗内边距上，内容从按钮底下滚过时不会露出来。 */
  #strat-modal .modal-ops {
    position: sticky; bottom: 0;
    margin: 10px -14px -14px; padding: 10px 14px 14px;
    background: var(--panel); border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .mkt-row { grid-template-columns: 18px minmax(0, 1.6fr) 82px 96px 12px; }
  .r-extra { display: none; }
  .mkt-bar { flex-wrap: wrap; }
  .mkt-bar .search { flex: 1 1 140px; }
  .mkt-bar .switch { margin-left: 0; }
  .trade-quote b { font-size: 18px; }
}

/* ---------- 手机端：顶栏压缩成一行，绝不竖排 ---------- */
@media (max-width: 720px) {
  .topbar {
    height: auto; min-height: 46px; gap: 8px; padding: 6px 10px;
    flex-wrap: nowrap; overflow: hidden;
  }
  .topbar .brand-mini { display: none; }        /* 手机上没有横向空间放品牌名 */
  .topbar .session-pill {
    order: 3; flex: 0 0 auto;
    padding: 3px 8px; font-size: 11px; white-space: nowrap;
  }
  .topbar .session-pill .sep,
  .topbar .session-pill #open-text { display: none; }
  .topbar .view-switch { order: 1; flex: 0 0 auto; padding: 3px; gap: 3px; }
  .topbar .vsw { padding: 6px 10px; font-size: 12px; gap: 5px; white-space: nowrap; }
  .topbar .vsw svg { width: 13px; height: 13px; }
  .topbar .top-actions { order: 4; margin-left: auto; gap: 6px; }
  .topbar .top-actions .btn { padding: 4px 8px; font-size: 11.5px; }
  .view-switch { white-space: nowrap; }

  /* 交易页在手机上：盘口更紧凑，下单按钮固定在拇指区 */
  .trade-view { padding: 0 10px 18px; }
  /* 底部浮动买卖条是 fixed 定位，滚动容器必须自己留出这段高度，
     否则最下面的策略区会被盖住，「＋ 新建策略」点不到 */
  #view-market { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .card { padding: 10px; }
  .book-row { padding: 7px 6px; grid-template-columns: 30px 1fr 74px; }
  .book-row .px { font-size: 14px; }
  .mkt-list { padding: 0 10px 16px; }
  .mkt-row { padding: 8px 10px; grid-template-columns: 18px minmax(0, 1.6fr) 80px 92px 10px; }
  .mkt-sect { padding-top: 6px; }
}

/* ---------- 手机端常驻下单条 ---------- */
.mobile-bar { display: none; }
/* 任何弹窗打开时把常驻下单条收起来：避免和弹窗底部按钮争位置 */
body:has(.modal:not([hidden])) .mobile-bar { display: none; }

@media (max-width: 720px) {
  .mobile-bar {
    display: grid; grid-template-columns: 96px 1fr 1fr; gap: 8px; align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -6px 18px rgba(16, 24, 40, .07);
    backdrop-filter: blur(6px);
  }
  body { padding-bottom: 72px; }
  .mb-qty {
    display: grid; grid-template-columns: 28px 1fr 28px; align-items: center;
    border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: #fff;
  }
  .mb-qty b { text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
  .mb-step { border: 0; background: var(--panel-2); padding: 8px 0; font-size: 15px; color: var(--text-2); cursor: pointer; }
  .mb-btn {
    display: grid; gap: 1px; justify-items: center;
    padding: 7px 0; border: 0; border-radius: 9px; color: #fff; cursor: pointer;
    font-size: 14px; font-weight: 600;
  }
  .mb-btn i { font-style: normal; font-size: 11px; font-weight: 400; opacity: .9; }
  .mb-btn.buy { background: var(--up); }
  .mb-btn.sell { background: var(--down); }
  .mb-btn:disabled { opacity: .45; }
  /* 盘口挤一点，让下单表单更靠近首屏 */
  .book-row { padding: 5px 6px; }
  .book-row.empty { padding: 2px 6px; }
  .book-row.empty .lv { opacity: .4; }
}

.order-hint { display: none; }

@media (max-width: 720px) {
  /* 手机上真正的下单按钮在底部条，卡片内那个只留桌面用，避免两个按钮打架 */
  .order-card #btn-order { display: none; }
  .order-hint {
    display: block; margin: 0; text-align: center;
    font-size: 11px; color: var(--text-3);
  }
}

/* ---------- 桌面端：左栏放盘口 + 持仓，右栏放下单 + 信息 + 策略 ---------- */
/* 两栏各自纵向排列，互不牵制。桌面：左=盘口+持仓，右=下单+信息+策略 */
.trade-left, .trade-right { display: grid; gap: 10px; align-content: start; }
@media (min-width: 880px) {
  .trade-body { grid-template-columns: 372px minmax(0, 1fr); align-items: start; }
}
/* 手机：拍平成单列，顺序固定为 盘口 → 下单 → 信息 → 持仓 → 策略 */
@media (max-width: 879px) {
  .trade-body { display: flex; flex-direction: column; gap: 10px; }
  .trade-left, .trade-right { display: contents; }
  .book-card { order: 1; }
  .order-card { order: 2; }
  .info-card { order: 3; }
  .pos-card { order: 4; }
  .entrust-card { order: 5; }
  .strat-card { order: 6; }
}

/* ================= 账号条 × 行情融合 ================= */

/* 行情/交易页自己滚动，账号条才有地方吸顶（贴在顶栏下方） */
#view-market { overflow-y: auto; }

/* 账号条常驻在行情/交易页顶部：换号不用跳页，一眼看到每个账号的钱和挂单 */
.desk-strip {
  position: sticky; top: 0; z-index: 20;
  background:
    radial-gradient(130% 200% at 8% 0%, #ffffff 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(135deg, #e3edfa 0%, #f5fafe 48%, #dde9f7 100%);
  border-bottom: 1px solid #d3dfee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 8px 20px -18px rgba(24, 95, 165, .8);
}
/* 内容宽度跟行情列表对齐（列表是 1080 居中 + 14px 内边距） */
.strip-inner {
  display: flex; align-items: stretch; gap: 12px;
  max-width: 1080px; margin: 0 auto; padding: 10px 14px;
}
.strip-lead {
  flex: 0 0 auto; display: grid; gap: 4px; align-content: center;
  min-width: 156px; padding-right: 12px;
  border-right: 1px dashed #c6d6ea;
}
.strip-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: #46658a;
}
.strip-label::before {
  content: ''; width: 3px; height: 10px; border-radius: 2px;
  background: linear-gradient(180deg, #3a8ad0, var(--accent));
}
.strip-hint { font-size: 10.5px; line-height: 1.55; color: #7189a3; }
.strip-hint b { font-weight: 600; color: #35506e; font-variant-numeric: tabular-nums; }
.strip-hint b { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.strip-hint em { font-style: normal; color: var(--warn); }
.strip-cards {
  display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0;
  scrollbar-width: thin; padding: 1px 2px 3px;
}
.strip-empty { color: var(--text-3); font-size: 12px; padding: 10px 4px; align-self: center; }
/* 空态：说明 + 一键绑定 / 去账户管理 */
.strip-empty.bind-empty {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .75); border: 1px dashed var(--line-strong);
}
.bind-empty .be-text { display: grid; gap: 2px; min-width: 0; }
.bind-empty .be-text b { font-size: 12.5px; color: var(--text-2); }
.bind-empty .be-text span { font-size: 11.5px; color: var(--text-3); }
.bind-empty .be-ops { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.mini-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mini-btn.primary:hover { background: #13538f; border-color: #13538f; color: #fff; }
.mini-btn:disabled { opacity: .5; cursor: not-allowed; }
.strip-manage { align-self: center; flex: 0 0 auto; background: rgba(255, 255, 255, .8); }

.acc-chip {
  position: relative; overflow: hidden;
  flex: 0 0 auto; min-width: 158px; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 11px 8px 12px; border-radius: 11px; text-align: left; cursor: pointer;
  border: 1px solid #e0e8f2; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .15s, box-shadow .15s, transform .12s, background .15s;
}
.acc-chip:hover {
  border-color: #b6cde7; transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(24, 95, 165, .45);
}
.acc-chip.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #ffffff 0%, #eff6fd 100%);
  box-shadow: 0 0 0 3px rgba(24, 95, 165, .12), 0 8px 18px -12px rgba(24, 95, 165, .8);
}
.acc-chip.active::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #3a8ad0, var(--accent));
}
.acc-chip.bad { border-style: dashed; opacity: .82; }
.acc-chip .ac-top { display: flex; align-items: center; gap: 5px; font-size: 12.5px; }
.acc-chip .ac-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 108px; }
.acc-chip .ac-flag {
  margin-left: auto; flex: 0 0 auto;
  padding: 1px 5px; border-radius: 6px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .02em;
  color: #fff; background: linear-gradient(180deg, #3a8ad0, var(--accent));
}
.acc-chip .ac-mid {
  display: flex; align-items: baseline; gap: 5px;
  font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text); letter-spacing: -.01em;
}
.acc-chip .ac-mid i { font-style: normal; font-size: 10px; font-weight: 400; color: var(--text-3); }
/* 持仓明细：品种名 + 数量，超出省略 */
.acc-chip .ac-hold { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 1px; }
.acc-chip .ac-hold > span {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  font-size: 10.5px; line-height: 1.35; color: var(--text-2); max-width: 168px;
}
.acc-chip .ac-hold b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-chip .ac-hold i { font-style: normal; color: var(--text-3); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.acc-chip .ac-hold .ac-none { color: var(--text-3); justify-content: flex-start; }
.acc-chip .ac-hold .ac-more b { color: var(--text-3); font-weight: 400; }
.acc-chip .ac-bot { margin-top: 1px; font-size: 10.5px; color: var(--text-3); }
.acc-chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.acc-chip .dot.on { background: var(--down); }
.acc-chip .dot.off { background: var(--warn); }
/* 拖动排序：纵向滚动保留，横向拖给卡片自己用 */
.acc-chip { touch-action: pan-y; cursor: grab; }
.acc-chip.dragging { opacity: .55; cursor: grabbing; box-shadow: var(--shadow); }

/* ---------------- 总资产报表 ---------------- */
/* #view-desk 是定高 flex 列，面板必须禁止收缩，否则小屏会被压成一条线 */
.asset-report { margin: 0 0 14px; flex: 0 0 auto; padding: 14px 16px 12px; }

.ar-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ar-head-left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ar-head-left b { font-size: 13px; }
.ar-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-spark { margin-left: auto; line-height: 0; opacity: .9; flex: 0 0 auto; }

/* 主区：左边大号总资产，右边三个指标 */
.ar-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 22px;
  row-gap: 10px;
  align-items: end;
}
.ar-main { min-width: 0; }
.ar-label { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1; margin-bottom: 8px; }
.ar-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ar-value b {
  font-size: 27px; line-height: 1.1; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px; white-space: nowrap;
}
.ar-chip {
  font-style: normal; font-size: 11.5px; font-weight: 500; line-height: 1.5;
  padding: 1px 6px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap;
}
.ar-chip.up { color: var(--up); background: #fdf1f1; border-color: #f6dede; }
.ar-chip.down { color: var(--down); background: #eef8f2; border-color: #d9eee3; }
.ar-chip.flat { color: var(--text-3); }
.ar-wait { margin: 0; font-size: 12px; color: var(--text-3); }

.ar-cells { display: flex; gap: 22px; }
.ar-cell { display: grid; gap: 3px; min-width: 0; }
.ar-cell > span { font-size: 11.5px; color: var(--text-3); line-height: 1; }
.ar-cell > b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ar-delta { font-style: normal; font-size: 11px; line-height: 1; }
.ar-delta.up { color: var(--up); }
.ar-delta.down { color: var(--down); }
.ar-delta.flat { color: var(--text-3); }

/* 现金 / 持仓比例：细条 + 百分比，比原来那条满宽粗条干净 */
.ar-mix {
  grid-column: 1 / -1;
  display: flex; height: 6px; border-radius: 3px; overflow: hidden;
  background: #eef1f5;
}
.ar-mix .seg { display: block; height: 100%; }
.ar-mix .seg.cash { background: #4a90d9; }
.ar-mix .seg.mv { background: #86b7e8; }
.ar-legend {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-2);
}
.ar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ar-legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ar-legend-note { margin-left: auto; color: var(--text-3); }
.lg-dot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.lg-dot.cash { background: #4a90d9; }
.lg-dot.mv { background: #86b7e8; }

/* 逐日明细：默认折叠，点开看 */
.ar-detail { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 8px; }
.ar-detail summary {
  cursor: pointer; font-size: 12.5px; color: var(--text-2);
  user-select: none; list-style: none; display: flex; align-items: center; gap: 4px;
}
.ar-detail summary::before { content: '▸'; font-size: 10px; transition: transform .15s; }
.ar-detail[open] summary::before { transform: rotate(90deg); }
.ar-detail .ar-table-wrap { margin-top: 8px; }
.ar-table-wrap { overflow-x: auto; }
.ar-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ar-table th, .ar-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ar-table th:first-child, .ar-table td:first-child { text-align: left; }
.ar-table th { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.ar-table td.up { color: var(--up); }
.ar-table td.down { color: var(--down); }
.ar-table td.flat { color: var(--text-3); }
.ar-table td.ar-col-total { font-weight: 600; }
.ar-table tr.ar-today-row td { background: #fbfcfe; }
.ar-today-tag {
  font-style: normal; font-size: 10px; line-height: 1.4; margin-left: 6px; padding: 0 4px;
  border-radius: 4px; color: var(--accent); background: var(--accent-soft); border: 1px solid #d5e5f5;
}

/* 窄屏：大数字和指标竖排，避免挤在一行 */
@media (max-width: 760px) {
  .ar-hero { grid-template-columns: minmax(0, 1fr); }
  .ar-value b { font-size: 23px; }
  .ar-cells { gap: 18px; flex-wrap: wrap; }
  .ar-legend { gap: 12px; }
  .ar-legend-note { margin-left: 0; flex-basis: 100%; }
}

/* ---------------- 账号卡片：品种绑定标签 / 改名 / 一键撤单 ---------------- */
.card-binds { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 8px; }
.bind-tag {
  font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 4px;
  background: #eef4fb; color: #3d7fc4; border: 1px solid #d5e5f5; white-space: nowrap;
}
.bind-tag.all { background: transparent; color: var(--text-3); border-color: var(--line); }
.bind-tag.none { background: #fdf7ec; color: var(--warn); border-color: #eed6a8; }
.ent-cancel-all { margin-left: auto; }

/* ---------------- 绑定品种弹窗 ---------------- */
/* 搜索：品种几十个的时候肉眼翻不动，先按名称/代码过滤再勾 */
.bindgoods-search { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.bindgoods-search .search { flex: 1; min-width: 0; }
.bindgoods-search span { white-space: nowrap; flex: 0 0 auto; }
.bindgoods-list {  display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0 2px;
}
.bindgoods-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer;
}
.bindgoods-item[hidden] { display: none; }
.bindgoods-item:hover { background: #f5f8fc; }
.bindgoods-item input { accent-color: var(--accent); }
.bindgoods-item b { font-size: 13px; }
.bindgoods-item i { font-style: normal; font-size: 11.5px; color: var(--text-3); margin-left: auto; }

/* 改名弹窗输入框：跟其他表单一致（原生 input 在深色/窄屏下太丑） */
#rename-input {
  width: 100%; box-sizing: border-box; margin: 0 0 4px;
  padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff;
}
#rename-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------------- 策略资金风控（用户管理弹窗内） ---------------- */
.risk-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; background: var(--panel-2); }
.risk-panel .risk-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.risk-panel .row { display: flex; gap: 8px; }
.risk-panel input { flex: 1; }
.risk-panel .hint { margin: 6px 0 0; }

/* ---------- 盘口归属 ---------- */

/* 四列：档位 / 价格 / 数量 / 归属标签 */
.book-row { grid-template-columns: 34px 1fr 84px auto; }
.book-row .bks { display: flex; gap: 2px; justify-content: flex-end; min-width: 18px; }
.bk-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  color: #fff; font-size: 10px; font-style: normal; line-height: 1;
  flex: 0 0 auto;
}
.book-row.has-mine { background: rgba(180, 118, 27, .07); }
.book-row.has-mine:hover { background: rgba(180, 118, 27, .12); }
.book-row.open { background: #eef4fb; }

.book-detail { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 6px; }
.bd-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-2); padding: 0 4px 4px; }
.bd-close { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 11.5px; padding: 0; }
.bd-list { list-style: none; margin: 0; padding: 0; max-height: 190px; overflow: auto; }
.bd-list li { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 6px; font-size: 11.5px; }
.bd-list li:hover { background: #f6f8fb; }
.bd-qty { font-variant-numeric: tabular-nums; min-width: 56px; color: var(--text-2); }
.bd-list .mine { color: var(--warn); font-weight: 600; }
.bd-flag.warn { color: var(--warn); font-size: 10.5px; margin-left: auto; }
.bd-take {
  margin-left: auto; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 6px; padding: 2px 10px; font-size: 11px; cursor: pointer; color: var(--accent);
}
.bd-take:hover { background: var(--accent-soft); border-color: var(--accent); }
.bd-note { margin: 6px 4px 0; font-size: 11px; color: var(--warn); }

/* ---------- 我的挂单 ---------- */

.entrust-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.entrust-list .empty-row { color: var(--text-3); font-size: 12px; padding: 10px 0; }
.ent-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 4px;
  border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.ent-row:hover { background: #f6f8fb; }
.ent-side { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); }
.ent-side.up { color: var(--up); border-color: rgba(217, 43, 43, .28); }
.ent-side.down { color: var(--down); border-color: rgba(18, 160, 92, .28); }
.ent-px { font-weight: 600; min-width: 48px; }
.ent-qty { color: var(--text-2); min-width: 38px; }
.ent-alias { display: none; }
.ent-ops { margin-left: auto; display: flex; gap: 4px; }
.ent-btn {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px;
  padding: 2px 6px; font-size: 10.5px; cursor: pointer; white-space: nowrap;
}
.ent-btn:hover { background: var(--panel-2); }
.ent-btn.take { color: var(--accent); border-color: var(--accent); }
.ent-btn.take:hover { background: var(--accent-soft); }
.ent-btn:disabled { opacity: .4; cursor: not-allowed; }

.desk-note { margin: -4px 0 0; line-height: 1.6; }

/* ---------- 执行方式切换 ---------- */

/* 系统自动判定这一单怎么走：立即成交 / 成交一部分 + 挂单 / 挂单排队 */
.order-mode {
  margin: 8px 0 6px; padding: 6px 9px; border-radius: 7px;
  font-size: 11.5px; line-height: 1.5;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-3);
}
.order-mode.take { background: rgba(214, 69, 69, .07); border-color: rgba(214, 69, 69, .28); color: var(--up); }
.order-mode.queue { background: rgba(35, 120, 210, .07); border-color: rgba(35, 120, 210, .26); color: #2361b8; }
.order-mode.bad { background: rgba(200, 140, 30, .1); border-color: rgba(200, 140, 30, .3); color: #9a6a06; }

@media (max-width: 720px) {
  .strip-inner { padding: 8px 10px; gap: 8px; }
  .strip-lead { display: none; }
  .acc-chip { min-width: 146px; padding: 7px 9px; }
  .acc-chip .ac-hold > span { max-width: 140px; font-size: 10px; }
  .acc-chip .ac-top b { max-width: 76px; }
  .acc-chip .ac-mid { font-size: 13px; }
  .book-row { grid-template-columns: 26px 1fr 66px auto; }
  .bd-list { max-height: 150px; }
}

/* ---------- 极窄屏：导航只留文字，保证两个入口都在一行 ---------- */
@media (max-width: 400px) {
  .topbar .vsw svg { display: none; }
  .topbar .vsw { padding: 6px 9px; }
}

/* ---------- 改密弹窗 ---------- */
.modal-sm { width: 400px; }
.modal-ops { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.field-line {
  display: grid; gap: 6px; margin-top: 12px;
  font-size: 12px; color: var(--text-2);
}
.field-line input {
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 9px 11px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-line input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#pwd-note { margin: 2px 0 4px; line-height: 1.6; }
#pwd-hint { margin-top: 8px; }

/* 手机上把连接状态收成一个圆点，给导航和按钮腾地方（文字挂在 title 上） */
@media (max-width: 520px) {
  .topbar .session-pill { padding: 5px 7px; gap: 0; }
  .topbar #conn-text { display: none; }
}

/* ---------- 用户管理列表 ---------- */
.user-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  background: #fff;
}
.user-row .u-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.user-row .u-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.user-row .u-name b {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-row .u-meta {
  font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-row .u-ops { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.badge.owner { background: #eaf2fb; color: var(--accent); }
.btn.accent { color: var(--accent); border-color: #b9d3ea; background: #f6fbff; }
.btn.accent:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn.danger-text { color: var(--danger); border-color: transparent; }
.btn.danger-text:hover { background: #fdecec; border-color: #f0c9c4; }

/* 成员名下绑定的华夏账号（管理员视角的权限划分展示） */
.u-accs { display: grid; gap: 4px; margin-top: 2px; }
.u-acc {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-2);
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 8px;
}
.u-acc b { font-size: 12px; color: var(--text-1); }
.u-acc i { font-style: normal; color: var(--text-3); }
.u-acc.none { color: var(--text-3); border-style: dashed; background: transparent; }
.u-acc .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.u-acc .dot.on { background: #2fa463; }
.u-acc .dot.off { background: #c4ccd6; }

/* 归属徽标：管理员看到成员的账号/挂单/策略时，标出归属用户 */
.owner-badge {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 600; line-height: 1;
  color: #7c5cbf; background: #f1ecfb;
  border: 1px solid #ddd2f2; border-radius: 999px;
  padding: 2px 7px; white-space: nowrap;
}
.ac-owner { flex: 0 0 auto; }
.ent-user { flex: 0 0 auto; }
.strat-owner { flex: 0 0 auto; }

@media (max-width: 560px) {
  .user-row { flex-wrap: wrap; }
  .user-row .u-ops { width: 100%; justify-content: flex-end; }
}

/* ==================== 系统管理（仅管理员） ==================== */
.admin-view {
  overflow: auto; padding: 14px 16px 28px;
  display: flex; flex-direction: column; gap: 12px;
}
.admin-head { display: flex; align-items: center; gap: 12px; }
.admin-title { display: flex; align-items: baseline; gap: 8px; }
.admin-title b { font-size: 15px; font-weight: 600; }
.admin-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* KPI：6 格，窄屏自动折行 */
.adm-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 1px;
  box-shadow: var(--shadow); min-width: 0;
}
.kpi span { font-size: 11.5px; color: var(--text-3); }
.kpi b {
  font-size: 17px; font-weight: 600; letter-spacing: -.2px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.kpi i {
  font-style: normal; font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 分页签 */
.adm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.adm-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 12px; font-size: 13px; color: var(--text-2);
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.adm-tab:hover { color: var(--text); }
.adm-tab i {
  font-style: normal; font-size: 10.5px; color: var(--text-3);
  background: #eef1f5; border-radius: 9px; padding: 1px 6px;
}
.adm-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.adm-tab.active i { background: var(--accent-soft); color: var(--accent); }

.adm-pane { display: flex; flex-direction: column; gap: 10px; }
.adm-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-bar .search { min-width: 220px; }

/* 表格 */
.adm-table-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: auto; box-shadow: var(--shadow);
}
.adm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.adm-table th {
  text-align: left; font-weight: 500; color: var(--text-3); font-size: 11.5px;
  padding: 9px 12px; background: var(--panel-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.adm-table td { padding: 9px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; white-space: nowrap; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr:hover { background: #fbfcfe; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table.sm th, .adm-table.sm td { padding: 6px 10px; font-size: 12px; }
.adm-empty { color: var(--text-3); text-align: center; padding: 22px 0 !important; }

.adm-two { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.adm-two b { font-weight: 600; }
.adm-two span { font-size: 11px; color: var(--text-3); }
.adm-ops { white-space: nowrap; }
.adm-ops .mini-btn { margin-left: 4px; }
.adm-ops .mini-btn:first-child { margin-left: 0; }
/* 品种列：一个账号能绑多个品种，标签必须允许换行。
 * 之前被 .adm-table td 的 nowrap 罩住、标签又不换行，多品种时标签直接横着溢出到
 * 「现金」列上面，看起来就是数字被品种名压住。这里用 td.adm-goods 提优先级破解 nowrap。 */
.adm-table td.adm-goods {
  max-width: 190px; white-space: normal; line-height: 1.9;
}
.mini-tag {
  display: inline-block; font-size: 10.5px; line-height: 1.6;
  padding: 0 6px; margin: 1px 3px 1px 0; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.mini-tag.warn { background: #fdf3e2; color: var(--warn); }
.warn-text { color: var(--warn); }
.adm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; background: #f4f6f9; border-radius: 5px; padding: 1px 5px;
}
.adm-detail { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-table td.adm-error-cell { white-space: normal; }
.adm-note { margin: 0; font-size: 11.5px; color: var(--text-3); }

/* 可以点进去看明细的 KPI（今日成交额 → 交易明细） */
.kpi.kpi-link { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi.kpi-link:hover { border-color: var(--accent); box-shadow: 0 3px 10px rgba(20, 90, 160, .12); }
.kpi.kpi-link:active { transform: translateY(1px); }

/* 交易明细：筛选条 + 汇总行 */
.adm-date, .adm-select {
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 5px 8px; font-size: 12px; color: var(--text); background: var(--panel);
  font-variant-numeric: tabular-nums;
}
.adm-select { max-width: 200px; }
.adm-date:focus, .adm-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.adm-sum {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); box-shadow: var(--shadow);
  font-size: 12px; color: var(--text-3);
}
.adm-sum b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.adm-sum b.up { color: var(--up); }
.adm-sum b.down { color: var(--down); }

/* 设备槽 */
.adm-callout {
  background: #f8fbff; border: 1px solid #dbe9f7; border-radius: 12px;
  padding: 12px 14px; font-size: 12px; color: var(--text-2); line-height: 1.7;
}
.adm-callout b { color: var(--text); }
.adm-callout p { margin: 4px 0 0; }
.adm-callout b:first-child { display: inline-block; margin-bottom: 2px; }

/* 行情与请求节拍诊断 */
.feed-diag {
  background: linear-gradient(180deg, #fbfdff, #fff);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.fd-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.fd-head b { font-size: 13px; }
.fd-grid { display: grid; gap: 9px; grid-template-columns: repeat(4, 1fr); }
.fd-cell {
  display: flex; flex-direction: column; gap: 2px;
  background: #f6f9fd; border-radius: 9px; padding: 8px 10px;
}
.fd-cell span { font-size: 11px; color: var(--text-3); }
.fd-cell b { font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.fd-cell i { font-style: normal; font-size: 10.5px; color: var(--text-3); line-height: 1.45; }
.fd-note { margin: 9px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
@media (max-width: 900px) { .fd-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .fd-grid { grid-template-columns: 1fr; } }
.slot-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.slot-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow);
}
.slot-card.local { border-color: #b9d3ea; background: linear-gradient(180deg, #fbfdff, #fff); }
.slot-head { display: flex; align-items: center; gap: 8px; }
.slot-head b { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-id { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-3); }
.slot-nums { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-3); margin: 2px 0; }
.slot-nums b { color: var(--text); font-variant-numeric: tabular-nums; }
.slot-foot { display: flex; align-items: center; gap: 6px; border-top: 1px dashed var(--line); padding-top: 7px; margin-top: 2px; }
.slot-foot > span { flex: 1; font-size: 11px; color: var(--text-3); }
.slot-note { margin: 0; font-size: 11px; color: var(--text-3); }

.adm-sub-head { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.adm-sub-head b { font-size: 13px; font-weight: 600; }

/* 表单 */
.adm-form {
  background: var(--panel); border: 1px dashed var(--line-strong); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 6px;
}
.adm-form-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.adm-form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-2); }
.adm-form-row input, .adm-form-row select {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 12.5px; min-width: 160px;
}
.adm-form-row input:focus, .adm-form-row select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 账号详情弹窗 */
.adm-detail-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px; margin: 10px 0 4px;
}
.adm-detail-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-detail-grid span { font-size: 11px; color: var(--text-3); }
.adm-detail-grid b { font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-sec { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.adm-sec-head { display: flex; align-items: baseline; gap: 8px; }
.adm-sec-head b { font-size: 13px; font-weight: 600; }
.adm-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-inline select {
  padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line-strong);
  font-size: 12px; background: #fff;
}
.adm-error {
  margin: 6px 0 0; font-size: 11.5px; color: var(--danger);
  background: #fdecec; border: 1px solid #f6d5d1; border-radius: 8px; padding: 6px 9px;
}
#adm-acc-body .device-list { max-height: 180px; overflow: auto; }

/* 未选择下单账号的提示 */
#strip-hint .need-pick {
  font-style: normal; color: var(--warn); font-weight: 600;
  background: #fdf7ec; border: 1px solid #f0dcb6; border-radius: 6px;
  padding: 1px 7px; display: inline-block; margin-bottom: 3px;
}

@media (max-width: 1200px) {
  .adm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-view { padding: 10px 10px 24px; }
}
@media (max-width: 560px) {
  .adm-kpis { grid-template-columns: 1fr; }
  .adm-detail-grid { grid-template-columns: 1fr; }
  .adm-form-row input, .adm-form-row select { min-width: 0; width: 100%; }
  .adm-form-row label { width: 100%; }
}

/* 系统管理：窄屏适配（表格改为横向滚动，别把「交易辅助-莎莎」压成竖排） */
@media (max-width: 900px) {
  .adm-table-wrap { -webkit-overflow-scrolling: touch; }
  .adm-table { min-width: 980px; }
  .adm-table.sm { min-width: 560px; }
  .admin-head { flex-wrap: wrap; gap: 4px 12px; }
  .admin-title { flex-wrap: wrap; }
  .admin-actions { margin-left: 0; }
}

/* 窄屏：账号总览 / 交易明细改成「一行一卡」重排。
 * 横向滚动要「先滑再读」，而且品种列的长名字会横着溢出、压到现金列上，
 * 干脆把每行拆成「标签在左、值在右」的卡片，谁也盖不住谁。 */
@media (max-width: 700px) {
  .resp-wrap {
    overflow: visible; background: transparent; border: 0; box-shadow: none; border-radius: 0;
  }
  .adm-table.resp { min-width: 0; display: block; }
  .adm-table.resp thead { display: none; }
  .adm-table.resp tbody { display: block; }
  .adm-table.resp tbody tr {
    display: block; margin-bottom: 8px; padding: 9px 12px 10px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow);
  }
  .adm-table.resp tbody tr:last-child { margin-bottom: 0; }
  .adm-table.resp tbody tr:hover { background: var(--panel); }
  .adm-table.resp td {
    display: flex; align-items: baseline; gap: 8px;
    padding: 3px 0; border: 0; white-space: normal; text-align: left;
  }
  .adm-table.resp td::before {
    content: attr(data-label);
    flex: 0 0 58px; font-size: 11px; color: var(--text-3);
  }
  .adm-table.resp td.num { text-align: left; }
  .adm-table.resp td.adm-goods { max-width: none; }
  /* 账号行自身就是标题，不需要「账号：」前缀，别名的字号放大一档 */
  .adm-table.resp td[data-label="账号"] { font-size: 13.5px; margin-bottom: 3px; }
  .adm-table.resp td[data-label="账号"]::before { display: none; }
  .adm-table.resp td[data-label="账号"] .adm-two { flex-direction: row; align-items: baseline; gap: 8px; }
  .adm-table.resp td.adm-ops { flex-wrap: wrap; padding-top: 8px; gap: 6px; }
  .adm-table.resp td.adm-ops::before { display: none; }
  .adm-table.resp td.adm-ops .mini-btn { margin-left: 0; }
  /* 空态行不参与卡片化 */
  .adm-table.resp td.adm-empty { display: block; }
  .adm-table.resp td.adm-empty::before { display: none; }
  .adm-table.resp td.adm-empty { text-align: center; padding: 18px 0; }
  /* 筛选条在窄屏上允许换行铺开，搜索框占满一行 */
  .adm-bar { gap: 6px 8px; }
  .adm-bar .search { min-width: 0; flex: 1 1 100%; }
  .adm-select { max-width: none; flex: 1 1 46%; }
  .adm-date { flex: 1 1 40%; }
}
@media (max-width: 700px) {
  .admin-title .muted { display: none; }
  .admin-actions .muted { display: none; }
}
@media (max-width: 560px) {
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 15px; }
  .adm-tab { padding: 7px 8px; font-size: 12px; }
  .adm-tab i { display: none; }
}

/* ============================================================
   多商城适配：由 /api/shop 决定，在 <body> 上加 class
   —— 页面结构只有一份，商城差异只体现在这两个开关上
   ============================================================ */

/* 没有「设备」概念的商城（如钱库）：绑设备、设备列表、设备槽管理全部不出现 */
body.no-device .device-only,
body.no-device #device-bind,
body.no-device #device-list-panel {
  display: none !important;
}

/* 轮询型商城没有推送，状态栏要说明「多久刷一次」而不是「是否在线」 */
body.poll-mode .session-pill .dot {
  /* 轮询时不用呼吸灯表达在线，避免误以为断了 */
  animation: none;
}
body.poll-mode .poll-hint {
  display: inline-flex;
}
.poll-hint {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted, #7e8d80);
  white-space: nowrap;
}
.poll-hint b {
  font-weight: 600;
  color: var(--text, #1d2b21);
}

/* ---------------- 行情分类（板块 / 专区） ----------------
 * 每个商城的分组含义不同：华夏是板块（邮票/钱币），钱库是专区（人气/甄选）。
 * 样式只管形状，名字全由后端给；商城没给分类时整行 hidden，不占位。 */
.cat-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px 10px;
}
.cat-chips[hidden] { display: none; }
.cat-chips .chip.cat { display: inline-flex; align-items: center; gap: 5px; }
.cat-chips .chip.cat i {
  font-style: normal; font-size: 11px; color: var(--text-3);
  background: #f2f4f7; border-radius: 8px; padding: 0 5px; line-height: 16px;
}
.cat-chips .chip.cat.active i { background: rgba(255, 255, 255, .7); color: var(--accent); }
