:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-dark: #115e59;
  --up: #d93025;
  --down: #0f9d58;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }
/* 键盘导航焦点态：所有可交互元素统一可见焦点环 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* 输入宽度语义类：避免行内样式覆盖手机端响应式宽度 */
input.w-date { width: 148px; }
input.w-short { width: 72px; }
input.w-medium { width: 120px; }
@media (max-width: 700px) {
  input.w-date { width: 100%; min-width: 0; }
  input.w-short, input.w-medium { width: 100%; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 18px; letter-spacing: .2px; }
h2 { font-size: 14px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0ea5a4);
  color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.subtitle { margin: 2px 0 0; color: var(--text-muted); font-size: 12px; }
.status-area { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.badge {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); padding: 4px 10px; border-radius: 999px; font-size: 12px;
}
.badge-ok { color: var(--accent-dark); background: var(--accent-soft); border-color: #99f6e4; }
.badge-error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; font-weight: 600; cursor: pointer; }
.badge-error:hover { background: #fee2e2; }
.link-badge { text-decoration: none; cursor: pointer; }
.link-badge:hover { opacity: 0.8; }

.control-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label, .filters label, .adapter-config label { color: var(--text-muted); font-size: 11px; }
input[type="number"], input[type="text"], select {
  height: 32px; padding: 0 8px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); color: var(--text); font-size: 13px;
}
input[type="number"] { width: 104px; }
input[type="text"] { min-width: 240px; }
.control-actions { display: flex; gap: 8px; margin-left: auto; }
.btn {
  height: 32px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 12px; font-weight: 600;
}
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.loading { opacity: .7; cursor: wait; }
.btn.loading::before { content: '↻'; display: inline-block; margin-right: 6px; animation: btn-spin 1s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px; padding: 16px 24px 4px;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi-label { color: var(--text-muted); font-size: 11px; }
.kpi-value { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* 页签过多时横向滚动（不换行），PC 鼠标可 Shift+滚轮/触控板左右滑动，手机触摸滑动 */
.tabs { display: flex; gap: 4px; padding: 12px 24px 0; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.tabs::-webkit-scrollbar-track { background: transparent; }
.tab { flex: 0 0 auto; white-space: nowrap; }
.tab {
  border: 1px solid transparent; background: transparent; color: var(--text-muted);
  padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 12px; font-weight: 600;
}
.tab:hover { color: var(--accent); background: #eef7f6; }
.tab.active { background: var(--surface); color: var(--accent-dark); border-color: var(--border); border-bottom-color: var(--surface); }

main { padding: 0 24px 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 0 10px 10px 10px; padding: 16px; box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* 强制隐藏：优先于任何 display 规则，避免内联样式被覆盖 */
[hidden] { display: none !important; }
/* POS 页内的昨仓校对差异区块，与持仓表之间留出间距 */
.pos-check-panel { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.pos-check-panel .panel-head { margin-bottom: 8px; }
/* 数据质量提示栏：与昨仓校对同款布局，按级别着色 */
.dq-panel { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.report-panel { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.dq-panel .panel-head { margin-bottom: 8px; }
.dq-panel .dq-error { color: var(--danger); font-weight: 600; }
.dq-panel .dq-warn { color: var(--warn); font-weight: 600; }
.dq-panel .dq-info { color: var(--accent); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; flex-wrap: wrap; }
.panel-head .hold-filter { margin-left: auto; height: 28px; padding: 0 8px; font-size: 12px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; }
.panel-head .filters { margin-left: auto; }
.panel-head:not(:first-child) { margin-top: 22px; }
.hint { color: var(--text-muted); font-size: 11px; }

.daily-report {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; color: #334155;
}
.daily-report p { margin: 5px 0; }

.table-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th {
  background: var(--surface-2); color: var(--text-muted); font-weight: 600;
  position: sticky; top: 0; z-index: 2; text-align: right;
}
th.has-tip { cursor: help; text-decoration: underline dotted var(--border); text-underline-offset: 3px; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); }
th:first-child { z-index: 3; background: var(--surface-2); }
tbody tr:hover td { background: #f1f5f9; }
tbody tr:hover td:first-child { background: #f1f5f9; }
tbody tr.total-row td { font-weight: 700; background: #eef7f6; border-top: 2px solid var(--accent); }
/* 实际到期日 < 1 的期权行：浅色背景提示即将/已经到期 */
tbody tr.expiring-row td { background: #fff7ed; }
tbody tr.expiring-row td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tbody tr.total-row td:first-child { background: #eef7f6; }
.num { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.pos { color: var(--up); }
.neg { color: var(--down); }
.cell-heat-pos { background: rgba(217, 48, 37, .10); }
.cell-heat-neg { background: rgba(15, 157, 88, .10); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; margin-top: 20px; }
.scenario-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 10px 0 12px; }
.scenario-tools label { display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); font-size: 11px; }
.scenario-tools select { min-width: 130px; height: 30px; }
.scenario-tools input[type="number"] { width: 78px; height: 30px; }
.scenario-tools input#scenario-step { width: 52px; }  /* 步长单值，比冲击范围窄 */
.scenario-tools select:disabled { opacity: .5; cursor: not-allowed; }
.chart-box { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 8px; }
.chart-box svg { width: 100%; height: auto; display: block; }

.filters, .adapter-config { display: flex; align-items: center; gap: 8px; }
.ttype-table td, .ttype-table th { text-align: center; }
.ttype-cell { border-radius: 4px; padding: 4px 10px; display: inline-block; min-width: 42px; }
/* T 型报价：三栏独立（左看跌可横滑 | 中行权价固定 | 右看涨可横滑） */
.ttype-wrap { display: flex; align-items: stretch; gap: 0;
  height: 460px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ttype-pane { overflow: auto; flex: 1 1 0; min-width: 0;
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch; }  /* 隐藏滚动条但保留滚动；移动端惯性滚动 */
.ttype-pane::-webkit-scrollbar { display: none; }
.ttype-pane.ttype-mid { flex: 0 0 84px; border-left: 2px solid var(--border);
  border-right: 2px solid var(--border); background: var(--surface-2); }
.ttype-wrap .ttype-table { border-collapse: separate; border-spacing: 0; width: 100%; }
/* 覆盖全局 th/td:first-child 的 sticky left:0 —— T型报价所有列都要能跟随横向滑动 */
/* tbody 首列改 static；thead th 保留 sticky(top表头纵向固定) 但清掉 left(横向跟随滑动) */
.ttype-wrap td:first-child { position: static; text-align: center; }
.ttype-wrap .ttype-table thead th, .ttype-wrap .ttype-table thead th:first-child { left: auto; text-align: center; }
/* 左右栏：每列固定宽度，5列总宽超出容器时产生横向滚动（左右联动） */
.ttype-pane.ttype-put .ttype-table, .ttype-pane.ttype-call .ttype-table {
  width: auto; table-layout: fixed; min-width: 100%; }
.ttype-pane.ttype-put .ttype-table th, .ttype-pane.ttype-put .ttype-table td,
.ttype-pane.ttype-call .ttype-table th, .ttype-pane.ttype-call .ttype-table td { width: 82px; min-width: 82px; }
.ttype-wrap .ttype-table th, .ttype-wrap .ttype-table td { padding: 6px 8px; white-space: nowrap; }
/* 三栏行高严格一致：tbody td 固定 30px；ttype-cell 去掉垂直 padding（否则撑高到39px） */
.ttype-wrap .ttype-table tbody td { height: 30px; padding: 0 8px; line-height: 30px; vertical-align: middle; }
.ttype-wrap .ttype-table tbody td .ttype-cell { padding: 0 10px; line-height: 28px; min-width: 42px; }
.ttype-wrap .ttype-table thead th { position: sticky; top: 0; z-index: 4; background: var(--surface-2); }
.ttype-pane.ttype-mid thead th { color: var(--accent, #2563eb); }
.ttype-pane.ttype-mid tbody td { font-weight: 600; }
/* ATM 行高亮（三栏同步） */
.ttype-wrap tr.ttype-atm td { background: rgba(59,130,246,.12); }
.ttype-pane.ttype-mid tr.ttype-atm td { background: rgba(59,130,246,.2); }
.ttype-iv { color: var(--accent, #2563eb); font-variant-numeric: tabular-nums; }
.ttype-hint { margin: 6px 4px; font-size: 11px; color: var(--text-muted, #64748b); }
.ttype-futures-note {
  position: sticky; bottom: 0; z-index: 4; margin: 0; padding: 7px 10px;
  background: var(--surface); border-top: 1px solid var(--border);
}

.adapter-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
.adapter-box code { background: #e8edf3; padding: 1px 5px; border-radius: 4px; }
.adapter-config { margin: 14px 0 6px; }
.code-box {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; overflow: auto; max-height: 260px; font-size: 11px; color: #334155;
}
.notice {
  margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--warn);
  background: #fffbeb; color: #78350f; border-radius: 0 8px 8px 0; font-size: 12px;
}
.footer {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px 24px 20px; color: var(--text-muted); font-size: 11px;
}
/* ============ 平板 ============ */
@media (min-width: 701px) and (max-width: 1100px) {
  .topbar { padding: 12px 16px; }
  /* 缩窄窗口：用 grid 让每个筛选格等宽，避免日期/select/数字框长短不一 */
  .control-bar {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; padding: 12px 16px; align-items: end;
  }
  .control-bar .control-group { min-width: 0; }
  .control-bar .control-group input, .control-bar .control-group select { width: 100%; min-width: 0; }
  .control-bar .control-actions { margin-left: 0; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 16px 4px; }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 14px; }
  .two-col > * { min-width: 0; }
  .table-scroll { max-height: 480px; }
  .tabs { padding: 10px 16px 0; }
  main { padding: 0 16px 18px; }
  .footer { padding: 10px 16px 16px; }
}

/* ============ 手机 ============ */
@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px; }
  .brand-mark { width: 38px; height: 38px; }
  h1 { font-size: 16px; }
  .status-area { justify-content: flex-start; gap: 6px; }
  .badge { font-size: 11px; padding: 3px 8px; }

  .control-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px;
  }
  .control-group { min-width: 0; }
  .control-group input, .control-group select { width: 100%; min-width: 0; }
  .control-group label { font-size: 10px; }
  input[type="number"], select { width: 100%; }
  input[type="text"] { min-width: 0; width: 100%; }
  /* panel-head 内联筛选控件：不占满整宽，label+select 同行紧凑排列 */
  .panel-head .filters { flex-wrap: nowrap; gap: 6px; }
  .panel-head .filters select { width: 80px; min-width: 80px; height: 28px; font-size: 12px; }
  /* 数据质量提示表：手机端字号与其他表首列一致，避免说明文字视觉偏大 */
  #dq-table table.data-table { font-size: 11px; }
  .control-actions {
    grid-column: 1 / -1; margin-left: 0; display: grid;
    grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .control-actions .btn:last-child { grid-column: 1 / -1; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 4px; }
  .kpi-card { padding: 10px; }
  .kpi-value { font-size: 17px; }
  .kpi-sub { font-size: 10px; }

  .tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 10px 14px 0; gap: 2px;
  }
  .tabs::-webkit-scrollbar { height: 0; }
  .tab { flex: 0 0 auto; white-space: nowrap; padding: 7px 11px; }

  main { padding: 0 12px 16px; }
  .panel { padding: 12px; border-radius: 8px; }
  .panel-head { gap: 6px; }
  .panel-head:not(:first-child) { margin-top: 16px; }
  .hint { font-size: 10px; }
  .daily-report { padding: 10px 12px; font-size: 12px; }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
  .two-col > * { min-width: 0; }
  .table-scroll { max-width: 100%; }

  /* 窄屏统一为表格横滑：只固定首列，横向滑动查看全部列 */
  .table-scroll {
    overflow: auto; max-height: none; border: 1px solid var(--border); border-radius: 8px;
    -webkit-overflow-scrolling: touch;
  }
  table.data-table { display: table; width: auto; min-width: 100%; }
  table.data-table thead { display: table-header-group; }
  table.data-table tbody { display: table-row-group; }
  table.data-table tbody tr { display: table-row; }
  table.data-table tbody td {
    display: table-cell; white-space: nowrap; position: static;
    background: transparent; padding: 7px 10px; text-align: right;
  }
  table.data-table tbody td::before { content: none; }
  table.data-table th { position: sticky; top: 0; z-index: 2; }
  table.data-table th:first-child,
  table.data-table td:first-child {
    position: sticky; left: 0; z-index: 3; background: var(--surface);
    width: 88px; min-width: 88px; max-width: 88px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* POS 表期权合约代码较长(JD2701-C-3150)，首列单独加宽并略缩字号，其他表不受影响 */
  #pos-table table.data-table th:first-child,
  #pos-table table.data-table td:first-child {
    width: 128px; min-width: 128px; max-width: 128px;
    font-size: 11px; letter-spacing: -0.2px;
  }
  /* 历史成交汇总表首列同为合约代码，与 POS 表一致加宽 */
  #hist-table table.data-table th:first-child,
  #hist-table table.data-table td:first-child {
    width: 128px; min-width: 128px; max-width: 128px;
    font-size: 11px; letter-spacing: -0.2px;
  }
  /* 情景矩阵 PnL 数值较长，固定列加宽以完整显示 */
  #scenario-table table.data-table th:nth-child(2),
  #scenario-table table.data-table td:nth-child(2) {
    width: 104px; min-width: 104px; max-width: 104px;
  }
  table.data-table th:first-child { background: var(--surface-2); z-index: 4; }
  table.data-table tbody tr.total-row td { background: #eef7f6; }
  table.data-table tbody tr.total-row td:first-child,
  table.data-table tbody tr.total-row td:nth-child(2) { background: #eef7f6; }
  table.data-table tbody tr.expiring-row td,
  table.data-table tbody tr.expiring-row td:first-child,
  table.data-table tbody tr.expiring-row td:nth-child(2) { background: #fff7ed; }

  /* 每日盈亏明细表：只锁第一列（交易日），第二列跟随横向滚动；表头纵向固定 */
  #history-table table.data-table th:nth-child(2),
  #history-table table.data-table td:nth-child(2) {
    position: static; left: auto; right: auto;
    width: auto; min-width: 0; max-width: none;
  }
  #history-table table.data-table th:first-child,
  #history-table table.data-table td:first-child {
    width: auto; min-width: 84px; max-width: none;
  }

  /* 手机端保留可见的横向滚动条，提示表格可左右滑动 */
  .table-scroll::-webkit-scrollbar { height: 6px; width: 6px; }
  .table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
  .table-scroll::-webkit-scrollbar-track { background: transparent; }

  /* T 型三栏：手机端缩小字号 */
  .ttype-wrap { height: 420px; }
  .ttype-pane.ttype-mid { flex-basis: 64px; }
  .ttype-wrap .ttype-table { font-size: 11px; }
  .ttype-wrap .ttype-table thead th { padding: 5px 4px; }
  .ttype-wrap .ttype-table tbody td { padding: 0 4px; }
  .ttype-wrap .ttype-table tbody td .ttype-cell { padding: 0 6px; }
  .ttype-cell { min-width: 34px; padding: 0 6px; }

  .chart-box { overflow: hidden; }
  .chart-box svg { min-width: 0; width: 100%; height: auto; }
  .filters, .adapter-config { flex-wrap: wrap; }
  .code-box { max-height: 200px; font-size: 10px; }
  .notice { font-size: 11px; padding: 10px 12px; }
  .footer { flex-direction: column; gap: 4px; padding: 10px 14px 16px; }
}

/* ============ 历史收益率曲线 ============ */
input[type="date"] {
  position: relative;
  /* 去掉各浏览器原生外观（iOS Safari 会把日期居中且省略日历图标） */
  -webkit-appearance: none;
  appearance: none;
  height: 32px;
  padding: 0 34px 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px 15px;
  color: var(--text);
  font-size: 13px;
  min-width: 148px;
  max-width: 100%;
  text-align: left;
}
/* 页面级规则（如 .settle-grid input）会覆盖 padding，用更高优先级补回图标空间 */
body input[type="date"] { padding-right: 34px; }
input[type="date"]::-webkit-datetime-edit { text-align: left; }
/* 保留原生点击区域，图标由背景绘制，点为透明 */
input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute; right: 0; top: 0; width: 34px; height: 100%;
  opacity: 0; cursor: pointer;
}
.history-chart { position: relative; min-height: 260px; }
.history-chart svg { display: block; width: 100%; height: auto; }
.history-tooltip {
  position: absolute; z-index: 6; display: none; pointer-events: none;
  min-width: 176px; max-width: 260px; padding: 8px 10px; border-radius: 6px;
  background: rgba(15, 23, 42, 0.94); color: #f8fafc; font-size: 12px; line-height: 1.6;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
}
.history-tooltip .tt-date { font-weight: 600; margin-bottom: 4px; }
.history-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.history-tooltip .tt-label { color: #cbd5e1; }
.history-tooltip .tt-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-empty { padding: 48px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.history-table td.num { text-align: right; }
@media (max-width: 640px) {
  input[type="date"] { min-width: 0; width: 100%; max-width: 100%; }
  .history-chart { min-height: 200px; }
}

/* ============ 悬浮表头（克隆 thead 吸附屏幕上沿） ============ */
.sticky-head-host {
  position: fixed; top: 0; z-index: 50; min-height: 34px;
  overflow: visible; pointer-events: none; display: none;
  background: var(--surface-2); border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.sticky-head-table { border-collapse: separate; border-spacing: 0; }
.sticky-head-table thead th { background: var(--surface-2); }
/* JS 悬浮表头激活时禁用原生 sticky，避免双表头重叠 */
body.sticky-head-active .table-scroll thead th,
body.sticky-head-active .settle-scroll thead th { position: static; }

/* ============ 精简状态条（header 滚出后浮出） ============ */
.compact-status {
  position: fixed; top: 0; left: 0; right: 0; z-index: 45;
  display: none; align-items: center; gap: 6px;
  padding: 6px 16px; min-height: 28px;
  background: var(--surface); border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.compact-status.visible { display: flex; }
.compact-status.compact-error { color: var(--danger, #dc2626); }

/* ============ 页签栏左右切换箭头（溢出时显示） ============ */
.tabs-shell { position: relative; }
.tabs-arrow {
  position: absolute; top: 12px; z-index: 6; display: none;
  width: 24px; height: 30px; padding: 0; line-height: 1;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.tabs-arrow:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.tabs-arrow:disabled { opacity: 0.35; cursor: default; }
.tabs-arrow.show { display: block; }
.tabs-arrow-left { left: 4px; }
.tabs-arrow-right { right: 4px; }
.tabs-shell.has-overflow .tabs { padding-left: 32px; padding-right: 32px; }
@media (max-width: 700px) {
  .tabs-arrow { top: 10px; }
}

/* 悬浮表头内部裁剪层：复刻原表格容器，防止横滑内容露到屏幕两侧 */
.sticky-head-clip { position: relative; overflow: hidden; pointer-events: none; }

/* ---------- 主站操作反馈弹窗（居中，自动消失） ---------- */
.app-toast {
  display: none;  /* 默认隐藏，只有 showToast 调用时显示 */
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200;
  pointer-events: none;  /* 不拦截表格点击 */
  min-width: 200px; max-width: 420px; padding: 12px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15,23,42,0.24); text-align: center;
  font-size: 14px; color: var(--text); line-height: 1.6;
}
.app-toast::before {
  content: '✓'; display: inline-block; margin-right: 8px;
  color: #16a34a; font-weight: 700;
}
.app-toast.error::before { content: '!'; color: var(--danger); }
.app-toast.show { display: block; animation: app-toast-pop 0.22s ease-out; }
@keyframes app-toast-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* PnL 归因说明：填充左侧情景控件同高，使瀑布图与情景表顶部对齐 */
.attrib-notes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px;
  margin: 0 0 12px; padding: 10px 2px;
  font-size: 11px; line-height: 1.35; color: var(--text-muted);
}
.attrib-notes b { color: var(--text); font-weight: 600; }
