/* ============================================================
   app.css — 总览终端通用样式（左侧菜单 shell + 总览组件）
   颜色由 skins.css 决定；本文件只用变量，皮肤无关。
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.mono, td.num, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
}
::selection { background: var(--accent-weak); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: var(--r-sm); }

/* ============================================================
   App shell：左侧菜单 + 主区
   ============================================================ */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; z-index: var(--z-sticky);
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border-strong);
  padding: var(--sp-4) 0;
}
.side__brand {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}
.side__logo {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; font-family: var(--font-mono);
  flex: none;
}
.side__brand-text { font-weight: 700; font-size: var(--fs-title); color: var(--ink-strong); white-space: nowrap; }
.side__brand-sub { font-size: var(--fs-micro); color: var(--muted); }

.side__group { padding: 0 var(--sp-3); margin-bottom: var(--sp-4); }
.side__group-label {
  font-size: var(--fs-micro); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0 var(--sp-2) var(--sp-2);
}
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__link {
  position: relative; display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  font-size: var(--fs-title); font-weight: 600; color: var(--muted);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.side__link:hover { color: var(--ink); background: var(--surface-2); }
.side__link[aria-current="page"] { color: var(--ink-strong); background: var(--accent-weak); }
.side__link[aria-current="page"]::before {
  content: ""; position: absolute; left: -3px; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}
.side__link svg { width: 16px; height: 16px; flex: none; }
.side__ico { width: 16px; height: 16px; display: inline-grid; place-items: center; color: currentColor; }

.side__foot { margin-top: auto; padding: var(--sp-3) var(--sp-4) 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--sp-2); }
.side__stat { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-micro); color: var(--muted); }

/* 模式徽章 sim/real */
.mode-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: var(--r-sm); text-transform: uppercase;
}
.mode-badge--sim { background: transparent; color: var(--muted); border: 1px solid var(--border-strong); }
.mode-badge--real { background: var(--accent); color: var(--accent-ink); border: 1px solid transparent; }

/* 状态点 */
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--ok { background: var(--success); }
.dot--warn { background: var(--warning); }
.dot--down { background: var(--danger); }
.dot--pulse { animation: dot-pulse 2s var(--ease-out) infinite; }
@keyframes dot-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ============================================================
   主区 / 页面骨架
   ============================================================ */
.main { min-width: 0; }
.page { max-width: 1640px; margin: 0 auto; padding: var(--sp-5) var(--sp-6) var(--sp-10); }
.page__head { display: flex; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page__title { font-size: var(--fs-page); font-weight: 700; letter-spacing: -0.01em; color: var(--ink-strong); }
.page__subtitle { font-size: var(--fs-label); color: var(--muted); font-family: var(--font-mono); }

.section { margin-bottom: var(--sp-6); }
.section__head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.section__title { font-size: var(--fs-section); font-weight: 700; color: var(--ink-strong); }
.section__note { font-size: var(--fs-micro); color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.panel__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md);
}
.panel__title { font-size: var(--fs-title); font-weight: 700; color: var(--ink-strong); }

/* ============================================================
   KPI 摘要带：全局持仓 + 各钱包今日
   ============================================================ */
.kpi { display: flex; flex-direction: column; gap: var(--sp-4); margin-bottom: var(--sp-5); }
/* 整个系统：整齐 5 列网格（10 项 = 5×2），发丝分隔成仪表格 */
.kpi-system__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.kpi-system__grid .kpi-stat { background: var(--surface); padding: var(--sp-3) var(--sp-4); }
@media (max-width: 1080px) { .kpi-system__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-stat { display: flex; flex-direction: column; gap: 4px; }
.kpi-stat__k { font-size: var(--fs-micro); color: var(--muted); text-transform: var(--label-tt); letter-spacing: var(--label-ls); }
.kpi-stat__v { font-size: 1.125rem; font-weight: 600; font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; color: var(--ink-strong); line-height: 1.2; }
.kpi-stat__v .pnl { font-size: inherit; }
.kpi-stat__sub { font-size: var(--fs-micro); color: var(--muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.kpi-spark { height: 34px; width: 150px; margin-top: 2px; }
.kpi__wallets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); }
.kpi-wallet { background: var(--surface); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.kpi-wallet__name { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: 2px; }
.kpi-wallet__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.kpi-wallet__k { font-size: var(--fs-micro); color: var(--muted); }
.kpi-wallet__row .u-mono { font-size: var(--fs-data); }
@media (max-width: 760px) { .kpi__wallets { grid-template-columns: 1fr; } }

/* ============================================================
   侧栏系统状态：点「扫描运行中」展开/收起详情
   ============================================================ */
.side-health { display: flex; flex-direction: column; }
.side-health__summary {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  background: transparent; border: none; cursor: pointer; font-family: inherit;
  font-size: var(--fs-micro); color: var(--muted); padding: var(--sp-1) 0;
  transition: color var(--dur-fast) var(--ease-out);
}
.side-health__summary:hover { color: var(--ink); }
.side-health__summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: var(--r-sm); }
.side-health__chev { margin-left: auto; font-size: 0.8em; }
.side-health__detail {
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.side-health__detail[hidden] { display: none; }
.side-health__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-micro); }
.side-health__k { color: var(--muted); white-space: nowrap; }

/* 持仓 + 决策流 并排 */
.ov-cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(340px, 1fr); gap: var(--sp-4); align-items: stretch; margin-bottom: var(--sp-6); }
.ov-cols > .section { margin-bottom: 0; display: flex; }
.ov-cols > .section > .panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ov-cols > .section > .panel > .table-scroll, .ov-cols > .section > .panel > .feed { flex: 1; }

/* ============================================================
   数据表（策略战况 / 当前持仓）
   ============================================================ */
.table-scroll { border-radius: var(--r-md); }
.section table.dt--strategy thead th, .section table.dt--positions thead th { position: static; top: auto; background: var(--surface-2); }
.row-spark { height: 24px; width: 100px; margin-left: auto; }
.pnl__pct { font-size: var(--fs-micro); color: var(--muted); margin-left: 5px; }
.dt tfoot .dt-total td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border-strong); border-bottom: none; cursor: default; }
.dt tfoot .dt-total:hover td { background: var(--surface-2); }

table.dt { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.dt thead th {
  background: var(--surface-2); color: var(--muted);
  font-size: var(--fs-label); font-weight: 600; letter-spacing: var(--label-ls); text-transform: var(--label-tt);
  text-align: left; padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-strong); white-space: nowrap; user-select: none;
}
table.dt thead th.num { text-align: right; }
table.dt tbody td { height: var(--row-h); padding: 0 var(--sp-3); border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--ink); position: relative; }
table.dt tbody td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; font-weight: var(--data-weight); }
table.dt tbody tr { cursor: default; transition: background var(--dur-fast) var(--ease-out); }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt tbody tr:hover .tk__sym { color: var(--ink-strong); }
table.dt tbody tr[aria-selected="true"] { background: var(--accent-weak); }
table.dt tbody tr:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

.tk { display: inline-flex; align-items: center; gap: var(--sp-2); }
.tk__sym { font-weight: 700; color: var(--ink-strong); }
.tk__name { color: var(--muted); font-size: var(--fs-micro); }
.tk__ca { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); }

/* 盈亏数值：颜色 + 符号 + 箭头 */
.pnl { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; font-weight: var(--data-weight); white-space: nowrap; }
.pnl--up { color: var(--up); }
.pnl--down { color: var(--down); }
.pnl--flat { color: var(--muted); }
.pnl__arrow { font-size: 0.85em; }
.cell-up { background: var(--up-weak); }
.cell-down { background: var(--down-weak); }

/* ============================================================
   近期决策流
   ============================================================ */
.feed { display: flex; flex-direction: column; }
.feed-row {
  position: relative; display: grid; grid-template-columns: 56px 56px auto auto 1fr; gap: var(--sp-2) var(--sp-3);
  align-items: baseline; padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border); transition: background var(--dur-fast) var(--ease-out);
}
.feed-row:first-child { border-top: none; }
.feed-row:hover { background: var(--surface-2); }
.feed-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.feed-row__time { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); white-space: nowrap; }
.feed-row__mod { font-size: var(--fs-micro); color: var(--muted); white-space: nowrap; }
.feed-row__sym { font-size: var(--fs-body); white-space: nowrap; }
.feed-row__detail { font-size: var(--fs-micro); color: var(--muted); min-width: 0; }
.feed-row__detail .mono { color: var(--ink); }

/* ============================================================
   图表（资金曲线）
   ============================================================ */
.chart-wrap { padding: var(--sp-4); }
.chart-toolbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.chart-legend { display: flex; align-items: center; gap: var(--sp-4); margin-left: auto; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-micro); color: var(--muted); cursor: pointer; user-select: none; }
.legend-item.is-off { opacity: 0.4; }
.legend-swatch { width: 12px; height: 2.5px; border-radius: 2px; }
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.chart .series-line { fill: none; stroke-width: 1.75; vector-effect: non-scaling-stroke; }
.chart .series-area { opacity: 0.07; }
.chart .cursor-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .cursor-dot { stroke: var(--bg); stroke-width: 1.5; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: none; background: transparent; color: var(--muted); font-size: var(--fs-micro); font-weight: 600; padding: 3px 10px; border-radius: 2px; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink-strong); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }

.chart-tooltip {
  position: fixed; z-index: var(--z-tooltip); pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-popover); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-micro);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); min-width: 140px;
}
.chart-tooltip.is-on { opacity: 1; }
.chart-tooltip__time { color: var(--muted); margin-bottom: 4px; font-family: var(--font-mono); }
.chart-tooltip__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.chart-tooltip__row .k { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.chart-tooltip__row .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.chart-mini__title { font-size: var(--fs-micro); color: var(--muted); margin-bottom: var(--sp-1); display: flex; align-items: center; gap: 6px; }
.chart-endpoint { stroke: var(--surface); stroke-width: 1.5; }

/* ============================================================
   徽章
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0.01em; padding: 2px 7px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }
.badge--info { background: var(--info-weak); color: var(--info); border-color: transparent; }
.badge--warn { background: var(--warning-weak); color: var(--warning); border-color: transparent; }
.badge--ok { background: var(--success-weak); color: var(--success); border-color: transparent; }
.badge--danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }
.badge.mono { font-family: var(--font-mono); }

/* ============================================================
   工具类 / 空态 / 骨架
   ============================================================ */
.u-muted { color: var(--muted); }
.u-strong { color: var(--ink-strong); }
.u-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; }
.u-flex { display: flex; align-items: center; gap: var(--sp-2); }
.empty { padding: var(--sp-10) var(--sp-4); text-align: center; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r-sm); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   到达 / 绘入动效
   ============================================================ */
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { animation: rise-in var(--dur-enter) var(--ease-out-expo) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.chart .series-line { stroke-dasharray: 1; stroke-dashoffset: 0; }
.chart--draw .series-line { animation: draw-line var(--dur-enter) var(--ease-out-expo) backwards; }
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.chart--draw .chart-endpoint { animation: pt-in var(--dur-fast) var(--ease-out) backwards; animation-delay: calc(var(--dur-enter) - 50ms); }
@keyframes pt-in { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   Live 实时层（数值跳动闪标 / 新事件到达）
   ============================================================ */
.flash-up, .flash-down { position: relative; }
.flash-up::after, .flash-down::after { content: ""; position: absolute; inset: -1px -4px; border-radius: 3px; pointer-events: none; animation: cell-flash 0.75s var(--ease-out) forwards; }
td.flash-up::after, td.flash-down::after { inset: 0; border-radius: 0; }
.flash-up::after { background: var(--up); }
.flash-down::after { background: var(--down); }
@keyframes cell-flash { 0% { opacity: 0.26; } 100% { opacity: 0; } }

@keyframes feed-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.feed-row--new { animation: feed-in 0.4s var(--ease-out); }
.feed-row--new::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--accent); animation: feed-wash 1.1s var(--ease-out) forwards; }
@keyframes feed-wash { 0% { opacity: 0.16; } 100% { opacity: 0; } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } .ov-cols { grid-template-columns: 1fr; gap: var(--sp-4); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border-strong); }
  .side__brand { border: none; margin: 0; padding: 0; }
  .side__brand-sub { display: none; }
  .side__group { margin: 0; padding: 0; }
  .side__group-label { display: none; }
  .side__nav { flex-direction: row; }
  .side__link-tag { display: none; }
  .side__link[aria-current="page"]::before { display: none; }
  .side__foot { margin: 0 0 0 auto; padding: 0; border: none; flex-direction: row; }
  .page { padding: var(--sp-4) var(--sp-3) var(--sp-8); }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.dt { min-width: 720px; }
  .feed-row { grid-template-columns: 52px auto 1fr; }
  .feed-row__mod { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .dot--pulse { animation: none; }
  .flash-up::after, .flash-down::after, .feed-row--new::after { display: none; }
}

/* ============================================================
   图表参考线（评分曲线阈值等）
   ============================================================ */
.chart .hline { stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.85; }
.chart .hline-text { font-family: var(--font-mono); font-size: 10px; }

/* ============================================================
   按钮（DESIGN.md button-* 三态）
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: var(--fs-label); font-weight: 600; font-family: inherit;
  padding: 7px 14px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--primary:active:not(:disabled) { background: var(--accent-active); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn--ghost:hover:not(:disabled) { color: var(--ink-strong); background: var(--surface); }
.btn--danger { background: var(--danger); color: oklch(0.985 0.003 250); }
.btn--danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn--sm { padding: 4px 9px; font-size: var(--fs-micro); }
.btn svg { width: 14px; height: 14px; }

/* 行内文字按钮（表格内「评分历史」等） */
.row-action {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--muted); font-size: var(--fs-micro); font-weight: 600; font-family: inherit;
  padding: 3px 8px; cursor: pointer; transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.row-action:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }
.row-action svg { width: 12px; height: 12px; }

/* ============================================================
   Tabs（买入记录 / 配置）
   ============================================================ */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border-strong); margin-bottom: var(--sp-5); }
.tab {
  position: relative; padding: var(--sp-2) var(--sp-4); margin-bottom: -1px;
  background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: inherit; font-size: var(--fs-title); font-weight: 600; color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink-strong); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: var(--r-sm); }
.tab__count { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); margin-left: 6px; }
.tabpanel[hidden] { display: none; }

/* 记录区工具条 */
.rec-bar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.rec-bar__note { font-size: var(--fs-micro); color: var(--muted); }
.rec-bar__note .pnl { font-size: var(--fs-micro); }

/* 可排序表头 */
table.dt thead th.sortable { cursor: pointer; }
table.dt thead th.sortable:hover { color: var(--ink); }
table.dt thead th .sort-ind { color: var(--accent); font-size: 0.85em; margin-left: 3px; }
.dt--records td.col-act { text-align: right; }
.score-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600;
  padding: 1px 6px; border-radius: var(--r-sm); font-size: var(--fs-micro);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--border);
}
.score-pill--pass { background: var(--accent-weak); color: var(--accent); border-color: transparent; }

/* ============================================================
   抽屉（右滑覆盖）：代币详情 / 评分历史 共用外壳
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; background: var(--overlay-scrim); z-index: var(--z-drawer-backdrop);
  opacity: 0; transition: opacity var(--dur-drawer) var(--ease-out);
}
.drawer-backdrop[hidden] { display: none; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(620px, 94vw);
  display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--border-strong); box-shadow: var(--sh-drawer);
  z-index: var(--z-drawer); transform: translateX(100%);
  transition: transform var(--dur-drawer) var(--ease-out);
}
.drawer.is-open { transform: none; }
.drawer__head {
  display: flex; align-items: flex-start; gap: var(--sp-3); flex: none;
  padding: var(--sp-4); border-bottom: 1px solid var(--border-strong); background: var(--surface-2);
}
.drawer__titlewrap { min-width: 0; }
.drawer__eyebrow { font-size: var(--fs-micro); color: var(--muted); margin-bottom: 3px; }
.drawer__title { display: flex; align-items: baseline; gap: var(--sp-2); font-size: var(--fs-section); font-weight: 700; color: var(--ink-strong); }
.drawer__title .tk__ca { font-size: var(--fs-label); }
.drawer__close {
  margin-left: auto; flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--muted); cursor: pointer; transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.drawer__close:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.drawer__close svg { width: 16px; height: 16px; }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.drawer__section { margin-bottom: var(--sp-5); }
.drawer__section-h {
  display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3);
  font-size: var(--fs-title); font-weight: 700; color: var(--ink-strong);
}
.drawer__section-h .section__note { margin-left: auto; font-weight: 400; }

/* 抽屉顶部汇总栅格 */
.sum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.sum-cell { background: var(--surface); padding: var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: 3px; }
.sum-cell__k { font-size: var(--fs-micro); color: var(--muted); }
.sum-cell__v { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; font-size: var(--fs-data); font-weight: 600; color: var(--ink-strong); }
.sum-cell__v .pnl { font-size: var(--fs-data); }

/* ============================================================
   决策时间线
   ============================================================ */
.tl-toolbar { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.tl { display: flex; flex-direction: column; }
.tl-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sp-3); padding: 0 0 var(--sp-4) var(--sp-5); }
.tl-row::before { content: ""; position: absolute; left: 4px; top: 13px; bottom: -2px; width: 1px; background: var(--border); }
.tl-row:last-child::before { display: none; }
.tl-node { position: absolute; left: 0; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--surface); }
.tl-node--life { background: var(--info); }
.tl-node--buy { background: var(--up); }
.tl-node--sell { background: var(--down); }
.tl-node--decision { background: var(--warning); }
.tl-row__label { font-size: var(--fs-body); font-weight: 600; color: var(--ink-strong); }
.tl-row__time { grid-column: 2; grid-row: 1; font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); white-space: nowrap; }
.tl-row__detail { grid-column: 1 / -1; font-size: var(--fs-micro); color: var(--muted); line-height: 1.5; }
.tl-row__detail .mono { color: var(--ink); font-family: var(--font-mono); }

/* ============================================================
   评分历史抽屉：8 维明细
   ============================================================ */
.score-chart { padding: var(--sp-2) 0 var(--sp-4); }
.snap-list { display: flex; flex-direction: column; }
.snap {
  border-top: 1px solid var(--border);
}
.snap:first-child { border-top: none; }
.snap__sum {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-2) 0; background: transparent; border: none; cursor: pointer;
  font-family: inherit; color: var(--ink); text-align: left;
}
.snap__sum:hover { color: var(--ink-strong); }
.snap__time { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); }
.snap__total { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-data); font-weight: 600; }
.snap__chev { color: var(--muted); font-size: 0.8em; transition: transform var(--dur-fast) var(--ease-out); }
.snap.is-open .snap__chev { transform: rotate(180deg); }
.snap__detail { padding: var(--sp-2) 0 var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.snap__detail[hidden] { display: none; }
.dim { display: grid; grid-template-columns: 84px 1fr 70px; align-items: center; gap: var(--sp-3); }
.dim__k { font-size: var(--fs-micro); color: var(--ink); }
.dim__track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.dim__fill { height: 100%; background: var(--accent); border-radius: 3px; }
.dim__v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-micro); color: var(--muted); text-align: right; }
.dim__v b { color: var(--ink-strong); font-weight: 600; }

/* ============================================================
   配置 tab：只读分组 + 修改入口
   ============================================================ */
.cfg { display: flex; flex-direction: column; gap: var(--sp-5); }
.cfg__group .panel__head .btn { margin-left: auto; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1px; background: var(--border); }
.kv__item { background: var(--surface); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv__k { font-size: var(--fs-micro); color: var(--muted); }
.kv__v { font-family: var(--font-mono); font-variant-numeric: tabular-nums slashed-zero; font-size: var(--fs-data); color: var(--ink-strong); word-break: break-word; }
.kv__v--badge { font-family: var(--font-ui); }
.cfg-sub { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.cfg-sub__h { font-size: var(--fs-label); font-weight: 600; color: var(--ink); margin-bottom: var(--sp-2); }
.cfg-flags { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ============================================================
   Modal（修改弹窗）+ 表单 + 二次确认
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay-scrim); z-index: var(--z-modal-backdrop);
  display: grid; place-items: center; padding: var(--sp-4);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-out);
}
.modal-backdrop[hidden] { display: none; }
.modal-backdrop.is-open { opacity: 1; }
.modal {
  width: min(580px, 96vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--sh-modal); transform: translateY(10px);
  transition: transform var(--dur-fast) var(--ease-out);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal__head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4); border-bottom: 1px solid var(--border-strong); }
.modal__title { font-size: var(--fs-section); font-weight: 700; color: var(--ink-strong); }
.modal__head .drawer__close { margin-left: auto; }
.modal__body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.modal__foot { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-strong); background: var(--surface-2); border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.modal__foot .spacer { flex: 1; }
.modal__confirm-note { font-size: var(--fs-label); color: var(--warning); margin-right: auto; display: inline-flex; align-items: center; gap: 6px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: var(--fs-label); font-weight: 500; color: var(--ink); }
.field__hint { font-size: var(--fs-micro); color: var(--muted); }
.field__suffix-wrap { position: relative; display: flex; align-items: center; }
.field__suffix { position: absolute; right: 10px; font-size: var(--fs-micro); color: var(--muted); pointer-events: none; font-family: var(--font-mono); }
.input, .select {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  color: var(--ink-strong); padding: 7px 10px; font-family: var(--font-mono); font-size: var(--fs-data);
  font-variant-numeric: tabular-nums; transition: border-color var(--dur-fast) var(--ease-out);
}
.input:hover, .select:hover { border-color: var(--ink); }
.input:focus-visible, .select:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-color: transparent; }
.field__suffix-wrap .input { padding-right: 42px; }
.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; user-select: none; font-size: var(--fs-label); color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 34px; height: 18px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); flex: none; }
.switch__track::after { content: ""; position: absolute; left: 2px; top: 1px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--accent-weak); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 2px var(--accent); }

/* ============================================================
   Toast（暂存提示）
   ============================================================ */
.toast {
  position: fixed; bottom: var(--sp-6); left: 50%; z-index: var(--z-toast);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  box-shadow: var(--sh-popover); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-label); color: var(--ink-strong);
  transform: translateX(-50%) translateY(12px); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translateX(-50%); }
.toast .dot { background: var(--success); }

/* ============================================================
   响应式（模块页）
   ============================================================ */
@media (max-width: 760px) {
  .drawer { width: 100vw; }
  .sum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: 1fr; }
  .dim { grid-template-columns: 72px 1fr 62px; }
}

/* ============================================================
   评分配置：分段表编辑器 + 校验错误 + 满分合计
   ============================================================ */
.cfg-tbl-wrap { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.cfg-tbl { width: 100%; border-collapse: collapse; }
.cfg-tbl th {
  text-align: left; font-size: var(--fs-micro); font-weight: 600; color: var(--muted);
  padding: 0 var(--sp-1) var(--sp-1); white-space: nowrap;
}
.cfg-tbl td { padding: 2px var(--sp-1) 2px 0; vertical-align: middle; }
.cfg-tbl__act { width: 30px; text-align: center; }
.input--cell {
  width: 100%; min-width: 64px; height: 28px; padding: 0 var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-data);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.icon-btn:hover { color: var(--danger); border-color: var(--border); background: var(--surface-2); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.modal__errors {
  margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--danger); border-radius: var(--r-md);
  background: var(--danger-weak); display: flex; flex-direction: column; gap: 2px;
}
.modal__error { font-size: var(--fs-label); color: var(--danger); line-height: 1.5; }
.modal__errors[hidden] { display: none; } /* display:flex 会覆盖默认 [hidden]{display:none}，须显式复位 */

.cfg-total {
  margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono); font-size: var(--fs-body); font-weight: 600;
  color: var(--success); background: var(--success-weak);
  border: 1px solid var(--success); border-radius: var(--r-md);
}
.cfg-total--bad { color: var(--danger); background: var(--danger-weak); border-color: var(--danger); }

.btn.is-disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* —— 卖出规则编辑器（判别联合卡片）—— */
.rules-edit-wrap { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.rules-edit { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.rule-card { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); padding: var(--sp-3); }
.rule-card__head { display: flex; align-items: flex-end; gap: var(--sp-3); }
.rule-card__f { display: flex; flex-direction: column; gap: 2px; }
.rule-card__f--grow { flex: 1; }
.rule-card__head .icon-btn { margin-bottom: 3px; }
.rule-card__body { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border); }
.rule-card__body:empty { display: none; }
select.input { width: 100%; height: 30px; cursor: pointer; }
