/* ==========================================================================
   Design system (2026-10 rev 2)
   --------------------------------------------------------------------------
   全站唯一的视觉层，替换此前逐页叠加的样式：
   - 一套表面语言：中性画布 + 白色表面 + 发丝分割线。
   - 一个强调色：品牌蓝。不再出现青蓝渐变、卡片顶部装饰光线。
   - 每个内容组只保留一层边框：嵌套卡片自动压平，消除"框套框"。

   该文件在 webapp.css 中最后导入，对旧的 legacy / market-terminal /
   page-layout 层具有最终决定性。
   ========================================================================== */

:root {
  --ds-canvas: #f5f7fa;
  --ds-surface: #ffffff;
  --ds-surface-soft: #f7f9fc;
  --ds-line: #e9edf3;
  --ds-line-soft: #f1f4f9;
  --ds-ink: #101828;
  --ds-text: #3d4b60;
  --ds-muted: #6b7a90;
  --ds-subtle: #8b97a8;
  --ds-accent: #2563eb;
  --ds-accent-deep: #1d4ed8;
  --ds-accent-soft: #f2f6ff;
  /* 涨跌语义色：跟随 A 股习惯，红涨绿跌。 */
  --ds-up: #c8332b;
  --ds-down: #1a8a5a;
  --ds-radius: 14px;
  --ds-radius-sm: 10px;
  --ds-radius-xs: 8px;
  --ds-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --ds-shadow-lift: 0 1px 2px rgba(16, 24, 40, 0.04),
                   0 18px 40px -34px rgba(16, 24, 40, 0.4);
  --ds-gap: 16px;
  --ds-pad-x: 16px;
  --ds-heading-h: 46px;

  /* 同步旧样式层的变量，让尚未改写的组件也落在同一套配色上。 */
  --ui-border: var(--ds-line);
  --ui-border-strong: #dde3ec;
  --ui-page: var(--ds-canvas);
  --ui-ink: var(--ds-ink);
  --ui-text: var(--ds-text);
  --ui-muted: var(--ds-muted);
  --ui-subtle: var(--ds-subtle);
  --ui-accent: var(--ds-accent);
  --ui-accent-deep: var(--ds-accent-deep);
  --ui-accent-soft: var(--ds-accent-soft);
  --page-bg: var(--ds-canvas);
  --surface: var(--ds-surface);
  --surface-strong: var(--ds-surface);
  --surface-muted: var(--ds-surface-soft);
  --surface-border: var(--ds-line);
  --surface-border-strong: #dde3ec;
  --surface-shadow: var(--ds-shadow);
  --surface-shadow-soft: var(--ds-shadow);
}

html[data-theme="dark"] {
  --ds-canvas: #080c14;
  --ds-surface: #0f1622;
  --ds-surface-soft: #121a28;
  --ds-line: rgba(148, 163, 184, 0.16);
  --ds-line-soft: rgba(148, 163, 184, 0.09);
  --ds-ink: #e9eef9;
  --ds-text: #c3cfe0;
  --ds-muted: #8b9bb4;
  --ds-subtle: #6f8099;
  --ds-accent: #60a5fa;
  --ds-accent-deep: #93c5fd;
  --ds-accent-soft: rgba(59, 130, 246, 0.14);
  --ds-up: #ff8f86;
  --ds-down: #5fd39c;
  --ds-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  --ds-shadow-lift: 0 22px 44px -36px rgba(0, 0, 0, 0.9);

  --ui-border-strong: rgba(148, 163, 184, 0.26);
}

/* ---------- 画布与排版 ---------- */

html body {
  color: var(--ds-ink);
  background: var(--ds-canvas);
  background-image: none;
  font-family: var(--ui-font-sans);
  -webkit-font-smoothing: antialiased;
}

html body .app-main {
  /* 页头标题已取消，首屏留白由主区自己给（Bootstrap 的 py-1 带 !important）。 */
  padding-top: 16px !important;
  padding-bottom: 40px !important;
}

html body .app-shell {
  max-width: 1480px;
}

/* 块间距统一：只用一个值，不再混用 .mb-3 与 page-section。 */
html body .page-section + .page-section,
html body .page-section + .stack-grid,
html body .stack-grid + .page-section {
  margin-top: var(--ds-gap);
}

html body .page-section > .card + .card,
html body .page-section > .card + .row,
html body .page-section > .row + .card {
  margin-top: var(--ds-gap);
}

/* ---------- 顶部导航：纯色表面，不用渐变 ---------- */

html body .navbar {
  background: var(--ds-surface) !important;
  border-bottom: 1px solid var(--ds-line);
  box-shadow: none;
  backdrop-filter: saturate(140%) blur(8px);
}

html body .navbar-brand {
  color: var(--ds-ink) !important;
  font-weight: 700;
  letter-spacing: 0;
  font-size: 0.98rem;
}

html body .navbar .nav-link {
  min-height: 34px;
  padding-inline: 11px;
  border-radius: var(--ds-radius-xs);
  color: var(--ds-text);
  font-size: 0.83rem;
  font-weight: 500;
}

html body .navbar .nav-link:hover,
html body .navbar .nav-link:focus-visible {
  background: var(--ds-surface-soft);
  color: var(--ds-ink);
}

html body .navbar .nav-link.active,
html body .navbar .nav-link.active:hover {
  background: var(--ds-accent-soft) !important;
  color: var(--ds-accent-deep) !important;
  font-weight: 600;
  box-shadow: none;
}

/* 旧的底部短横线已由浅色胶囊取代，避免两种选中态叠加。 */
html body .navbar-compact .nav-link::after {
  display: none;
}

html[data-theme="dark"] body .navbar {
  background: var(--ds-surface) !important;
  border-bottom-color: var(--ds-line);
  box-shadow: none;
}

html[data-theme="dark"] body .market-statusbar-wrap {
  background: var(--ds-surface);
  border-bottom-color: var(--ds-line);
}

html[data-theme="dark"] body .page-hero,
html[data-theme="dark"] body .page-hero--tight {
  border: 0;
  border-bottom: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html[data-theme="dark"] body .page-hero::after {
  display: none;
}

html[data-theme="dark"] body .navbar .nav-link {
  color: var(--ds-text);
}

html[data-theme="dark"] body .navbar .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ds-ink);
}

html[data-theme="dark"] body .navbar .nav-link.active,
html[data-theme="dark"] body .navbar .nav-link.active:hover {
  background: var(--ds-accent-soft) !important;
  color: var(--ds-accent-deep) !important;
}

html body .market-statusbar-wrap {
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
}

html body .market-statusbar {
  padding: 0.42rem 0;
  color: var(--ds-muted);
  font-size: 0.71rem;
  letter-spacing: 0.02em;
}

html body .market-statusbar__label {
  color: var(--ds-subtle);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

html body .market-statusbar__value {
  color: var(--ds-text);
  font-weight: 600;
}

html body .market-statusbar__sep {
  background: var(--ds-line);
}

/* ---------- 状态栏里的页面级操作（刷新 / 批量任务等） ---------- */

/* 页面级操作固定在状态栏最右端；没有操作时整块不占位。 */
html body .market-statusbar__page {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
  padding-left: 0.85rem;
}

html body .market-statusbar__page:empty {
  display: none;
}

html body .statusbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

html body .statusbar-actions .btn {
  height: 24px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: var(--ds-radius-xs);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

html body .statusbar-actions .btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 页面状态类信息（Worker 在线、下次计划）沿用状态栏的分组排版。 */
html body .market-statusbar__group--page .market-statusbar__value {
  font-weight: 600;
}

html body .market-statusbar__group--page .market-statusbar__value.is-warn {
  color: #d97706;
}

/* ---------- 页面标题区（替代原先卡片式 hero） ---------- */

html body .page-hero,
html body .page-hero--tight {
  position: relative;
  margin: 0 0 var(--ds-gap);
  padding: 2px 0 14px;
  border: 0;
  border-bottom: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html body .page-hero::after {
  display: none;
}

html body .page-title-row {
  align-items: flex-end;
  gap: 12px;
}

html body .page-eyebrow {
  margin-bottom: 6px;
  color: var(--ds-accent);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

html body .page-title {
  color: var(--ds-ink);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

html body .page-subtitle {
  max-width: 780px;
  margin-top: 6px;
  color: var(--ds-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

html body .hero-tags {
  gap: 6px;
  margin-top: 10px;
}

html body .hero-tag,
html body .hero-tag--warn {
  min-height: 0;
  padding: 3px 9px;
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: var(--ds-surface);
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 500;
  letter-spacing: 0;
}

html body .hero-tag--warn {
  border-color: #fcd9a4;
  background: #fffaf0;
  color: #a25a06;
}

html[data-theme="dark"] body .hero-tag,
html[data-theme="dark"] body .hero-tag--warn {
  border-color: var(--ds-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ds-muted);
}

html[data-theme="dark"] body .hero-tag--warn {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

html body .page-actions,
html body .section-actions {
  gap: 8px;
}

/* ---------- 卡片：一层表面，一层边框 ---------- */

html body .card,
html body .app-card,
html body .app-panel-card,
html body .dashboard-panel-card,
html body .dashboard-shell-card {
  position: relative;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface);
  box-shadow: var(--ds-shadow);
  overflow: hidden;
}

/* 卡片边缘的装饰性光带全部移除。 */
html body .surface-accent::before,
html body .surface-accent > .card-header::before {
  display: none;
}

html body .card > .card-header,
html body .card .card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: var(--ds-heading-h);
  padding: 11px var(--ds-pad-x);
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-ink);
}

/* 表头里的说明文字单独占一行，不再被推到右端。 */
html body .card-header > .card-subtitle {
  flex: 1 0 100%;
  margin-top: 2px;
}

html body .card-header > .dashboard-updated-at {
  margin-left: auto;
}

html body .card > .card-body,
html body .card .card-body {
  padding: 14px var(--ds-pad-x);
}

html body .compact-card > .card-header {
  min-height: 44px;
  padding: 10px var(--ds-pad-x);
}

html body .compact-card > .card-body {
  padding: 12px var(--ds-pad-x);
}

/* 内容为表格的 body 直接贴到卡片边缘。 */
html body .card > .card-body.table-wrap,
html body .card > .card-body.panel-scroll,
html body .card .card-body.table-wrap {
  padding: 0 !important;
}

html body .section-heading {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 0 !important;
  color: var(--ds-ink);
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: -0.005em;
}

/* 旧的左侧竖线装饰已由浅色表头带取代，避免正文与标题左边距错位。 */
html body .section-heading::before,
html body .surface-accent .card-header .section-heading::before {
  display: none !important;
}

html body .card-subtitle {
  margin-top: 3px;
  color: var(--ds-muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
}

html body .card-header.tool-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

html body .card-header .section-actions,
html body .card-header .toolbar-row {
  margin-left: auto;
}

/* 卡片内嵌套卡片：压平为带分隔线的子区块，不再新开一层边框。 */
html body .card .card {
  margin-top: 14px;
  padding-top: 14px;
  border: 0;
  border-top: 1px solid var(--ds-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

/* 嵌套卡片上的 Bootstrap .mt-3 会叠加间距。 */
html body .card .card.mt-3 {
  margin-top: 14px !important;
}

html body .card .card > .card-header {
  min-height: 0;
  padding: 0 0 8px;
  border-bottom: 0;
  background: transparent;
}

html body .card .card > .card-body {
  padding: 0;
}

html body .card .card > .card-body.table-wrap,
html body .card .card > .card-body.panel-scroll {
  padding: 0 !important;
}

/* details/summary 形式的折叠卡片：与卡片语言保持一致。 */
html body details.card > summary.card-header {
  cursor: pointer;
  color: var(--ds-ink);
}

html body details.card > summary.card-header::after {
  content: "展开";
  margin-left: auto;
  color: var(--ds-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

html body details.card[open] > summary.card-header::after {
  content: "收起";
}

html body details.card[open] > summary.card-header {
  border-bottom: 1px solid var(--ds-line);
}

/* ---------- 卡片内的筛选工具栏 ---------- */

html body .card-toolbar {
  display: block;
  padding: 12px var(--ds-pad-x);
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-surface);
}

html body .card-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

html body .card-toolbar .form-label {
  margin-bottom: 4px;
}

/* 工具栏行尾的读数与状态，自动贴右并对齐基线。 */
html body .card-toolbar__row > .toolbar-row {
  margin-left: auto;
  align-items: center;
  gap: 10px;
}

html body .card-toolbar__row > .toolbar-field--wide {
  flex: 1 1 300px;
  max-width: 340px;
}

html body .toolbar-field {
  display: flex;
  flex-direction: column;
  min-width: 150px;
  max-width: 220px;
}

html body .toolbar-field--grow {
  flex: 1 1 260px;
  max-width: 360px;
}

/* 卡片内的补充说明（不再单独开卡片）。 */
html body .data-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ds-line-soft);
}

html body .data-meta p {
  margin: 0;
  color: var(--ds-muted);
  font-size: 0.73rem;
  line-height: 1.6;
}

html body .data-meta p + p {
  margin-top: 2px;
}

html body .card-footnote {
  padding: 10px var(--ds-pad-x) 12px;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

html body .card-footnote code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(16, 24, 40, 0.05);
  color: var(--ds-text);
  font-size: 0.94em;
}

html[data-theme="dark"] body .card-footnote code {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- 关键指标：单一表面，用发丝线分隔 ---------- */

html body .summary-strip {
  gap: 0;
  align-items: stretch;
}

html body .summary-strip__item,
html body .summary-strip__item--asset {
  min-width: 148px;
  padding: 2px 18px;
  border: 0;
  border-left: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html body .summary-strip__item:first-child {
  padding-left: 0;
  border-left: 0;
}

html body .summary-strip__label {
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

html body .summary-strip__value {
  margin-top: 7px;
  color: var(--ds-ink);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

html body .summary-strip__item--asset .summary-strip__value {
  font-size: 1.62rem;
  font-weight: 700;
}

html body .summary-strip__returns-line {
  font-size: 1.24rem;
}

/* 首页在移动端使用折叠变体：同样不加边框。 */
html body .dashboard-shell-card .summary-strip__item,
html body .dashboard-shell-card .summary-strip__item--asset {
  min-height: 0;
  padding: 2px 18px;
  border: 0;
  border-left: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html body .dashboard-shell-card .summary-strip__item:first-child {
  padding-left: 0;
  border-left: 0;
}

html body .dashboard-shell-card .summary-strip__value {
  color: var(--ds-ink);
  font-size: 1.32rem;
}

html body .dashboard-shell-card .summary-strip__item--asset .summary-strip__value {
  font-size: 1.62rem;
}

/* 去掉 KPI 标签前的小圆点：全站不统一的装饰。 */
html body .dashboard-shell-card .summary-strip__item > .summary-strip__label::before {
  display: none;
}

/* 首页指标条的桌面 / 移动两套变体：只显示其中一套。 */
@media (min-width: 992px) {
  html body .summary-strip__item--asset-mobile {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  html body .summary-strip__item--asset-desktop,
  html body .summary-strip__item--perf-week,
  html body .summary-strip__item--perf-combined,
  html body .summary-strip__item--nav-desktop {
    display: none !important;
  }

  html body .summary-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  html body .summary-strip__item,
  html body .summary-strip__item--asset {
    padding: 0;
    border-left: 0;
  }
}

html body .metric-tile {
  padding: 2px 18px;
  border: 0;
  border-left: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html body .metric-tile-grid {
  gap: 0;
}

html body .metric-tile:first-child {
  padding-left: 0;
  border-left: 0;
}

html body .metric-tile__label {
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 600;
}

html body .metric-tile__value {
  margin-top: 7px;
  color: var(--ds-ink);
  font-size: 1.36rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

html body .metric-tile__sub {
  margin-top: 6px;
  color: var(--ds-subtle);
  font-size: 0.71rem;
  font-weight: 400;
}

/* 持仓页的账户条：用分隔线，不再切成多个小框。 */
html body .positions-account-strip {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

html body .positions-account-item {
  padding: 2px 20px;
  border-right: 1px solid var(--ds-line-soft);
}

html body .positions-account-item:first-child {
  padding-left: 0;
}

html body .positions-account-item:last-child {
  border-right: 0;
}

html body .positions-account-label {
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

html body .positions-account-value {
  margin-top: 7px;
  color: var(--ds-ink);
  font-family: var(--ui-font-sans);
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* 账户盈亏沿用全站涨跌语义色，需压过上面的 ink 颜色。 */
html body .positions-account-value.kpi-positive {
  color: var(--ds-up);
}

html body .positions-account-value.kpi-negative {
  color: var(--ds-down);
}

html body .positions-account-sub {
  color: var(--ds-subtle);
  font-size: 0.7rem;
  font-weight: 500;
}

/* 数据页（历史数据 / 用户管理）通用的指标条。 */
html body .kpi-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

html body .kpi-strip__item {
  display: flex;
  flex-direction: column;
  padding: 2px 18px;
  border-left: 1px solid var(--ds-line);
}

/* 标签换行时数值仍在同一基线上。 */
html body .kpi-strip__label {
  flex: 1 1 auto;
}

html body .kpi-strip__item:first-child {
  padding-left: 0;
  border-left: 0;
}

html body .kpi-strip__label {
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

html body .kpi-strip__value {
  margin-top: 7px;
  color: var(--ds-ink);
  font-size: 1.32rem;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

html body .kpi-strip__value--text {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
}

html body .kpi-strip--secondary {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ds-line-soft);
}

html body .kpi-strip__value.is-up {
  color: var(--success-600);
}

html body .kpi-strip__value.is-down {
  color: var(--danger-600);
}

/* ---------- 当前 NAV 内的迷你周线图 + 大图弹窗 ---------- */

html body .summary-strip__item--nav-desktop {
  min-width: 220px;
}

/* 数字在左、迷你周线在右：整格高度不变，图只占剩余横向空间。
   文字块仍从顶部开始，和相邻指标行对齐；只有图在格子里垂直居中。 */
html body .nav-spark-cell {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

html body .nav-cell__text {
  min-width: 0;
}

/* 整格可点：透明按钮覆盖，避免再套一层边框。 */
html body .nav-spark-cell__hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 0;
  border: 0;
  border-radius: var(--ds-radius-xs);
  background: none;
  cursor: pointer;
}

html body .nav-spark-cell__hit:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
}

html body .nav-spark {
  flex: 1 1 64px;
  min-width: 56px;
  max-width: 120px;
  height: 44px;
  align-self: center;
}

html body .nav-spark canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

html body .nav-spark-cell:hover .nav-spark {
  opacity: 0.82;
}

/* 移动端合并卡片里的文字入口 */
html body .nav-spark-link {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ds-accent);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

html body .nav-spark-link:hover {
  color: var(--ds-accent-deep);
  text-decoration: underline;
}

/* 弹窗里的放大图 */
html body .nav-chart-large {
  height: min(62vh, 460px);
}

html body .nav-chart-year {
  margin-left: auto;
  margin-right: 8px;
}

/* 实盘推荐运行详情内的指标：一条发丝分割线的指标带，不做卡片套卡片。
   指标带不满宽铺到卡片边框上：整条带左右内缩，首格文字对齐标题区，
   竖分割线因此落在留白中间，不再贴着卡片左右边线。 */
html body .run-overview-kpis {
  gap: 0;
  margin: 0 var(--ds-pad-x) 1rem;
  padding: 14px 0;
  border-top: 1px solid var(--ds-line-soft);
  border-bottom: 1px solid var(--ds-line-soft);
}

html body .run-kpi {
  min-width: 0;
  margin: 0;
  padding: 0 18px;
  border: 0;
  border-left: 1px solid var(--ds-line);
  border-radius: 0;
  background: none;
}

/* 首格左缘对齐标题，末格右缘留白，竖线不贴边。 */
html body .run-kpi:first-child {
  padding-left: 0;
  border-left: 0;
}

html body .run-kpi:last-child {
  padding-right: 0;
}

html body .run-kpi__label {
  display: block;
  color: var(--ds-muted);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

html body .run-kpi__value {
  display: block;
  margin-top: 6px;
  color: var(--ds-ink);
  font-size: 1.38rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  /* 金额较长时换行而不是挤断其他指标 */
  overflow-wrap: anywhere;
}

html body .run-kpi__value.kpi-positive {
  color: var(--ds-up);
}

html body .run-kpi__value.kpi-negative {
  color: var(--ds-down);
}

html body .run-kpi__value.run-kpi__value--empty {
  color: var(--ds-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
}

html body .run-kpi__hint {
  display: block;
  margin-top: 5px;
  color: var(--ds-subtle);
  font-size: 0.71rem;
  line-height: 1.5;
}

html body .run-kpi__hint:empty {
  display: none;
}

@media (max-width: 991.98px) {
  html body .run-overview-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0;
  }

  html body .run-kpi {
    padding: 12px 16px;
  }

  /* 两列布局：每行首格不画竖线，第二行用横线分隔。 */
  html body .run-kpi:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  html body .run-kpi:nth-child(even) {
    padding-right: 0;
  }

  html body .run-kpi:nth-child(3) {
    padding-top: 12px;
    border-top: 1px solid var(--ds-line-soft);
  }

  html body .run-kpi:first-child {
    padding-top: 0;
  }
}

@media (max-width: 575.98px) {
  html body .run-overview-kpis {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .run-kpi {
    padding: 12px 0 0;
    border-left: 0;
  }

  html body .run-kpi:first-child {
    padding-top: 0;
  }

  html body .run-kpi + .run-kpi {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ds-line-soft);
  }

  html body .run-kpi:nth-child(3) {
    border-top: 1px solid var(--ds-line-soft);
  }

  html body .run-kpi__value {
    font-size: 1.3rem;
  }
}

/* 嵌套卡片内的指标条同样不再出现双层框。 */
html body .run-position-strip .summary-strip__item {
  min-height: 0;
  padding: 2px 16px;
  border-radius: 0;
}

/* ---------- 表格 ---------- */

/* 行内操作按钮：放在单元格里，保证表格每格仍是合法布局。 */
html body .row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

@media (max-width: 575.98px) {
  html body .row-actions {
    flex-wrap: wrap;
  }
}

html body .table-wrap {
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: none;
  overflow-x: auto;
}

/* 卡片内的表格容器：不再画第二层框（旧样式给 .dashboard-panel-card .table-wrap 加了边框）。 */
html body .card .table-wrap,
html body .card .panel-scroll,
html body .card .panel-scroll-sm {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

html body table.table {
  margin-bottom: 0;
}

html body table.table thead th {
  height: 38px;
  padding: 0 12px;
  background: var(--ds-surface-soft) !important;
  border-bottom: 1px solid var(--ds-line) !important;
  color: var(--ds-muted) !important;
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

html body table.table thead th:first-child,
html body table.table tbody td:first-child {
  padding-left: var(--ds-pad-x);
}

html body table.table thead th:last-child,
html body table.table tbody td:last-child {
  padding-right: var(--ds-pad-x);
}

html body table.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--ds-line-soft);
  background: transparent;
  color: var(--ds-text);
  font-size: 0.81rem;
  vertical-align: middle;
}

html body table.table td.nowrap,
html body table.table th.nowrap {
  white-space: nowrap;
}

/* 单元格内的次要说明只显示一行，避免行高被撑开。 */
html body .cell-clamp {
  display: block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body table.table tbody tr:hover td,
html body table.table tbody tr:nth-child(even):hover td {
  background: var(--ds-accent-soft) !important;
}

html body table.table tbody tr:last-child td {
  border-bottom: 0;
}

html body table.table tbody td.empty-row {
  padding: 0;
  border-bottom: 0;
}

html[data-theme="dark"] body table.table thead th {
  background: #0c141f !important;
  border-bottom-color: var(--ds-line) !important;
  color: var(--ds-muted) !important;
}

html[data-theme="dark"] body table.table tbody td {
  color: var(--ds-text);
  border-bottom-color: var(--ds-line-soft);
}

/* 表头在卡片内吸顶时保持不透明背景。 */
html body .table-wrap table.table thead th {
  backdrop-filter: none;
}

/* ---------- 表格底栏 / 分页 ---------- */

html body .table-paginate,
html body .table-toolbar {
  padding: 10px var(--ds-pad-x);
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface);
  color: var(--ds-muted);
  font-size: 0.74rem;
}

/* 表格卡片内的翻页工具条：与卡片内边距对齐，不再贴着卡片边缘。 */
html body .card-body.table-wrap > .toolbar-row {
  margin: 0 !important;
  padding: 10px var(--ds-pad-x);
  border-top: 1px solid var(--ds-line);
  background: var(--ds-surface);
}

html body .table-paginate__btn,
html body .table-paginate__pagesize {
  border-radius: var(--ds-radius-xs);
  border-color: var(--ds-line);
  height: 28px;
}

/* ---------- 按钮 ---------- */

html body .btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--ds-radius-xs);
  font-size: 0.81rem;
  font-weight: 550;
  letter-spacing: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 处理中（setButtonBusy）的文案会随任务阶段变长：允许在按钮内换行，
   避免全局 .btn 的 nowrap 让文字溢出按钮边界。 */
html body .btn.is-busy {
  white-space: normal;
  line-height: 1.25;
  padding-top: 5px;
  padding-bottom: 5px;
  text-align: center;
  overflow-wrap: anywhere;
}

html body .btn.is-busy > .spinner-border {
  flex: 0 0 auto;
}

html body .btn-sm {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 0.78rem;
}

/* 纯图标按钮：不能继承文字按钮的左右内边距，否则图标被压扁。 */
html body .btn-icon {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--ds-radius-xs);
  flex: 0 0 auto;
}

html body .btn-sm.btn-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

html body .btn-icon svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

html body .btn:has(> svg:only-child) {
  padding-inline: 0;
  min-width: 34px;
}

html body .btn-primary {
  border: 1px solid var(--ds-accent);
  background: var(--ds-accent);
  color: #ffffff;
  box-shadow: none;
}

html body .btn-primary:hover,
html body .btn-primary:focus-visible {
  border-color: var(--ds-accent-deep);
  background: var(--ds-accent-deep);
}

html body .btn-outline-primary,
html body .btn-outline-secondary,
html body .btn-outline-light {
  border: 1px solid var(--ds-line);
  background: var(--ds-surface);
  color: var(--ds-text);
}

html body .btn-outline-primary {
  border-color: #cfdcf8;
  color: var(--ds-accent-deep);
}

html body .btn-outline-primary:hover,
html body .btn-outline-secondary:hover,
html body .btn-outline-light:hover {
  border-color: #c3cddd;
  background: var(--ds-surface-soft);
  color: var(--ds-ink);
}

html body .btn-outline-primary:hover {
  border-color: #a9c4f5;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-deep);
}

html body .btn-outline-danger {
  border: 1px solid var(--ds-line);
  border-color: #f2c9cf;
  background: var(--ds-surface);
  color: #b42336;
}

html body .btn-outline-danger:hover {
  border-color: #e8aab4;
  background: #fff5f6;
  color: #9f1239;
}

html[data-theme="dark"] body .btn-primary {
  border-color: #3b82f6;
  background: #2563eb;
  color: #ffffff;
}

html[data-theme="dark"] body .btn-primary:hover,
html[data-theme="dark"] body .btn-primary:focus-visible {
  border-color: #60a5fa;
  background: #1d4ed8;
  color: #ffffff;
}

html[data-theme="dark"] body .btn-outline-primary,
html[data-theme="dark"] body .btn-outline-secondary,
html[data-theme="dark"] body .btn-outline-light,
html[data-theme="dark"] body .btn-outline-danger {
  border-color: var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-text);
}

html[data-theme="dark"] body .btn-outline-primary {
  color: var(--ds-accent-deep);
}

html[data-theme="dark"] body .btn-outline-danger {
  color: #fca5b5;
}

/* ---------- 表单 ---------- */

html body .form-label {
  margin-bottom: 5px;
  color: var(--ds-text);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

html body .form-control,
html body .form-select,
html body textarea.form-control {
  min-height: 34px;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-xs);
  background-color: var(--ds-surface);
  color: var(--ds-ink);
  font-size: 0.81rem;
  box-shadow: none;
}

html body .form-control:focus,
html body .form-select:focus,
html body textarea.form-control:focus {
  border-color: #a9c4f5;
  background-color: var(--ds-surface);
  color: var(--ds-ink);
  box-shadow: var(--ui-ring);
}

html body .form-note,
html body .form-text,
html body .form-hint,
html body .helper-note {
  color: var(--ds-muted);
  font-size: 0.73rem;
  line-height: 1.55;
}

html[data-theme="dark"] body .form-control,
html[data-theme="dark"] body .form-select,
html[data-theme="dark"] body textarea.form-control {
  border-color: var(--ds-line);
  background-color: var(--ds-surface-soft);
  color: var(--ds-ink);
}

html[data-theme="dark"] body .form-control:focus,
html[data-theme="dark"] body .form-select:focus {
  border-color: rgba(96, 165, 250, 0.55);
  background-color: var(--ds-surface-soft);
}

/* ---------- 标签 / 状态 ---------- */

html body .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 21px;
  padding: 1px 8px;
  border: 1px solid var(--ds-line);
  border-radius: 6px;
  background: var(--ds-surface-soft);
  color: var(--ds-text);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0;
}

html body .tag--success {
  border-color: #c7ebd8;
  background: #f1fbf6;
  color: #12784a;
}

html body .tag--danger {
  border-color: #f6cfd6;
  background: #fff5f7;
  color: #b42336;
}

html body .tag--warn {
  border-color: #f8dfb4;
  background: #fffaef;
  color: #a25a06;
}

html body .tag--info {
  border-color: #cfe0fb;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-deep);
}

html body .tag--neutral {
  border-color: var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-muted);
}

html body .tag--dot::before {
  width: 5px;
  height: 5px;
}

html[data-theme="dark"] body .tag {
  border-color: var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-text);
}

html[data-theme="dark"] body .tag--success {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}

html[data-theme="dark"] body .tag--danger {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
}

html[data-theme="dark"] body .tag--warn {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

html[data-theme="dark"] body .tag--info {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

html[data-theme="dark"] body .tag--neutral {
  border-color: var(--ds-line);
  background: var(--ds-surface-soft);
  color: var(--ds-muted);
}

/* ---------- 空状态 ---------- */

html body .empty-state-block {
  padding: 28px 20px;
  border: 0;
  background: none;
}

html body .empty-state-block__icon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  border: 0;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-surface-soft);
  color: var(--ds-subtle);
}

html body .empty-state-block__title {
  margin: 0;
  color: var(--ds-text);
  font-size: 0.86rem;
  font-weight: 600;
}

html body .empty-state-block__hint {
  margin-top: 6px;
  color: var(--ds-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

/* ---------- 提示条 ---------- */

html body .alert {
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-soft);
  color: var(--ds-text);
  font-size: 0.79rem;
}

/* 卡片内的提示条不再二次描边，直接用浅色底带区分。 */
html body .card .alert {
  border: 0;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-surface-soft);
}

html body .card .alert-warning {
  border: 0;
  background: #fffaef;
  color: #8a4c05;
}

html body .card .alert-danger {
  border: 0;
  background: #fff5f7;
  color: #a01a2f;
}

html[data-theme="dark"] body .card .alert {
  border: 0;
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] body .card .alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

html body .alert-warning {
  border-color: #f8dfb4;
  background: #fffaef;
  color: #8a4c05;
}

html body .alert-danger {
  border-color: #f6cfd6;
  background: #fff5f7;
  color: #a01a2f;
}

html[data-theme="dark"] body .alert-warning {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}

/* ---------- 弹窗 ---------- */

html body .modal-content {
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background: var(--ds-surface);
  box-shadow: var(--ds-shadow-lift);
}

html body .modal-header,
html body .modal-footer {
  padding: 12px 16px;
  border-color: var(--ds-line);
  background: var(--ds-surface);
}

/* 弹窗内的分区卡片：同样压平，只用分隔线区分小节。 */
html body .modal-content .card {
  margin: 0;
  padding-top: 14px;
  border: 0;
  border-top: 1px solid var(--ds-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html body .modal-content .card:first-child {
  padding-top: 0;
  border-top: 0;
}

html body .modal-content .card > .card-header {
  min-height: 0;
  padding: 0 0 10px;
  border-bottom: 0;
  background: transparent;
}

html body .modal-content .card > .card-body {
  padding: 0;
}

/* 弹窗顶部的装饰光带同样去掉，保持全站只有一个强调色。 */
html body .modal-content::before {
  display: none !important;
}

html body .modal-body {
  padding: 14px 16px;
}

html body .modal-title {
  font-size: 0.95rem;
  font-weight: 650;
}

/* ---------- 数字：全站统一表现 ---------- */

html body .kpi-positive,
html body .kpi-negative,
html body .num-flat {
  font-variant-numeric: tabular-nums;
}

/* 涨跌语义色：盈利/上涨用红色，亏损/下跌用绿色。
   指标卡、账户条、表格等容器各自设置了文字色，这里在屏幕端统一兜底，
   打印仍由打印样式改为黑色。 */
@media screen {
  html body .kpi-positive {
    color: var(--ds-up) !important;
  }

  html body .kpi-negative {
    color: var(--ds-down) !important;
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1199.98px) {
  html body .kpi-strip {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 0;
  }

  html body .kpi-strip__item:nth-child(3n + 1) {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 991.98px) {
  html body .app-main {
    padding-top: 12px !important;
  }

  html body .page-title {
    font-size: 1.22rem;
  }

  html body .summary-strip__item,
  html body .summary-strip__item--asset {
    padding: 2px 14px;
  }

  html body .kpi-strip {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html body .kpi-strip__item:nth-child(3n + 1) {
    padding-left: 18px;
    border-left: 1px solid var(--ds-line);
  }

  html body .kpi-strip__item:nth-child(2n + 1) {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 767.98px) {
  html body .page-hero {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  /* 状态栏操作在小屏单独占一行，仍靠右，尽量少占用横向滚动。 */
  html body .market-statusbar {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  html body .market-statusbar__page {
    flex: 1 1 100%;
    justify-content: flex-end;
    margin-left: 0;
    padding-left: 0;
    gap: 6px;
  }

  html body .statusbar-actions {
    gap: 5px;
  }

  html body .statusbar-actions .btn {
    height: 22px;
    min-height: 22px;
    padding: 0 7px;
    font-size: 0.63rem;
  }

  /* 标题区的操作按钮按内容宽度换行，不再每个都占满一行。 */
  html body .page-title-row .section-actions .btn,
  html body .page-hero .page-actions .btn {
    flex: 0 1 auto;
    width: auto;
  }

  html body .card > .card-header,
  html body .card .card-header {
    padding-inline: 13px;
  }

  html body .card > .card-body,
  html body .card .card-body {
    padding-inline: 13px;
  }

  html body table.table thead th:first-child,
  html body table.table tbody td:first-child {
    padding-left: 13px;
  }

  html body table.table thead th:last-child,
  html body table.table tbody td:last-child {
    padding-right: 13px;
  }

  html body .summary-strip__value,
  html body .kpi-strip__value {
    font-size: 1.16rem;
  }
}

/* ---------- 打印 ---------- */

@media print {
  html body .page-hero {
    border-bottom: 1px solid #ccc;
  }

  html body .card {
    box-shadow: none;
    border-color: #ccc;
  }
}
