    :root {
      --bg: #f5f6f8; --card: #ffffff; --text: #1a1a1a;
      --text-secondary: #666666; --text-tertiary: #999999; --border: #e8e8e8;
      --green: #00a060; --red: #d93025;       --blue: #1e6fdb; --shadow: 0 2px 12px rgba(0,0,0,0.06);
      /* --blue-fg 是 --blue-bg 上的文字色：--blue 本身只有 4.24:1，达不到 WCAG AA 的 4.5 */
      --blue-bg: #e8f1fd; --blue-bd: #b6d2f7; --blue-fg: #1759b0;
      --btn-ghost-bg: #f0f0f0; --btn-ghost-fg: #333333;
      --tab-active-bg: #eef4fd; --table-stripe: #fafbfc;
      --warn-bg: #fff7e6; --warn-fg: #a35b00; --warn-bar: #f0a020;
      --danger-bg: #fdecea; --danger-fg: #b3261e;
      --chart-axis: #666666; --chart-line: #e8e8e8; --chart-split: #f2f2f2; --chart-label: #bbbbbb;
    }
    body.dark {
      --bg: #101216; --card: #1a1d23; --text: #e6e8ea;
      --text-secondary: #a2a8b0; --text-tertiary: #6e747d; --border: #2a2f37;
      --green: #2ec27e; --red: #ff6b5e; --blue: #4d9cf6; --shadow: 0 2px 12px rgba(0,0,0,0.35);
      --blue-bg: #17293d; --blue-bd: #2f5a8d; --blue-fg: #4d9cf6;
      --btn-ghost-bg: #262b33; --btn-ghost-fg: #d5d9de;
      --tab-active-bg: #1e3247; --table-stripe: #1e222a;
      --warn-bg: #3a2f14; --warn-fg: #f0b866; --warn-bar: #d9962a;
      --danger-bg: #3d1f1c; --danger-fg: #ff8b80;
      --chart-axis: #8b9199; --chart-line: #2a2f37; --chart-split: #232830; --chart-label: #6e747d;
    }
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    /* ===== 字号比例尺：全局 7 档，卡片内所有文本取自此处 ===== */
    :root {
      --fs-cap: 11px;        /* 脚注 · 辅助说明 */
      --fs-label: 11.5px;    /* 指标标签 */
      --fs-alert: 12px;      /* 预警文案 */
      --fs-body: 12.5px;     /* 卡片标题 · 正文 */
      --fs-val: 15px;        /* 次要数值 */
      --fs-val-lg: 17px;     /* 卡片主数值 */
      --fs-hero: 32px;       /* 净清算（唯一的超大字号） */
    }
    body {
      margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
      background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.4; padding-bottom: 12px; /* 底部导航已隐藏，无需再留 80px */
    }
    .container { max-width: 480px; margin: 0 auto; padding: 12px; }

    /* Header */
    .app-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 12px; }
    .app-header h1 { font-size: 18px; margin: 0; font-weight: 600; }
    .header-right { display: flex; align-items: center; gap: 8px; }
    .icon-btn {
      width: 34px; height: 34px; border: none; border-radius: 50%; background: var(--card);
      box-shadow: var(--shadow); font-size: 18px; color: var(--blue); cursor: pointer; display: flex;
      align-items: center; justify-content: center; transition: transform .2s;
    }
    .icon-btn:active { transform: rotate(180deg); }
    #updateStatus { font-size: 10px; color: var(--text-tertiary); min-width: 42px; text-align: right; }
    /* 多行状态（如「腾讯行情 14:54 / 60s 后再刷」）：右对齐紧凑排列，且不二次折行 */
    #updateStatus.multi-line { line-height: 1.35; white-space: nowrap; }
    .account-chip {
      display: flex; align-items: center; gap: 6px; background: var(--card); padding: 5px 10px;
      border-radius: 16px; box-shadow: var(--shadow); font-size: 12px; color: var(--text-secondary);
    }
    .account-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }

    /* Cards */
    .card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
    .value-display { text-align: center; }
    /* 「净清算价值」与「持仓数据更新于」同排：左标题右时间，省掉一整行高度 */
    .value-display .label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
    /* 与「风控预警」「融资成本」等卡片的 .card-title 保持同一标题样式（字号/字重/颜色/行高） */
    .value-display .label { font-size: var(--fs-body); font-weight: 600; color: var(--text-secondary); line-height: 1.35; }
    .value-display .data-updated { font-size: var(--fs-cap); color: var(--text-tertiary); white-space: nowrap; }
    .value-display .amount { font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
    /* 当日盈亏 / 未实现盈亏 两行共用同一个 grid，金额列与百分比列各自右对齐；
       tabular-nums 保证数字等宽，否则右对齐仍会参差 */
    .chg-grid {
      /* 三列均按内容宽度（auto），整块通过 justify-content 居中，与上方大数字同一中轴；
         第 2、3 列右对齐，保证金额与百分比两行各自对齐。
         注意：不要用 1fr 撑满整行，否则数字被推到最右、中间留大片空白。 */
      display: grid; grid-template-columns: auto auto auto; align-items: baseline;
      gap: 3px 8px; justify-content: center; margin-top: 6px;
    }
    .chg-grid .chg-tag { font-size: var(--fs-label); color: var(--text-secondary); text-align: left; }
    .chg-grid .chg-val, .chg-grid .chg-pct {
      font-size: var(--fs-val); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums;
    }
    .green { color: var(--green); } .red { color: var(--red); }

    /* ===== 行情陈旧警示 =====
       行情拉取失败时页面仍会显示上一次的价格，若不提示，用户会以为数字是实时的。
       这里把数字调灰 + 时间戳转警示色 + 持仓表顶部加横幅，三重提示。 */
    .stale-value { opacity: .45; }
    .value-display .data-updated.stale-text { color: var(--warn-bar); font-weight: 600; }
    .stale-banner {
      padding: 9px 12px; margin-bottom: 10px; border-radius: 10px;
      font-size: var(--fs-cap); line-height: 1.5; color: var(--warn-fg);
      background: var(--warn-bg); border: 1px solid var(--warn-bar);
    }
    .stale-banner b { font-weight: 700; }
    /* 部分陈旧（如 8 只成功、2 只被限流）用蓝色信息条：语义比「全部没取到」轻一级，
       避免和真正的故障警告混为一谈 */
    .stale-banner.partial {
      color: var(--blue-fg); background: var(--blue-bg); border-color: var(--blue-bd);
    }
    /* 未取到最新价的标的：数值调灰，但保留代码与操作按钮清晰可读 */
    .stale-row td { opacity: .45; }
    .stale-row td[data-col="symbol"], .stale-row td[data-col="action"] { opacity: 1; }
    .position-card.stale-row .last,
    .position-card.stale-row .change { opacity: .45; }

    /* Metric grid */
    .metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .metric-item { text-align: center; }
    .metric-item .value { font-size: var(--fs-val); font-weight: 600; font-variant-numeric: tabular-nums; }
    .metric-item .label { font-size: var(--fs-label); color: var(--text-secondary); margin-top: 3px; }

    /* Tabs */
    .tabs {
      display: flex; background: var(--card); border-radius: 12px; padding: 4px;
      box-shadow: var(--shadow); margin-bottom: 12px; position: sticky; top: 8px; z-index: 10;
    }
    .tab { flex: 1; text-align: center; padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--text-secondary); border-radius: 10px; cursor: pointer; transition: all .2s; }
    .tab.active { background: var(--tab-active-bg); color: var(--blue); }

    /* Panels */
    .panel { display: none; } .panel.active { display: block; }

    /* Position cards */
    .position-card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
    .position-header { display: flex; justify-content: space-between; align-items: center; }
    .symbol { font-size: 17px; font-weight: 700; }
    .symbol .exchange { font-size: 10px; color: var(--text-tertiary); font-weight: 400; margin-left: 4px; }
    /* 「投资产品」列下方的产品名小字：单行截断，完整名称见 title，避免撑宽表格或卡片 */
    .prod-name {
      font-size: 11px; font-weight: 400; line-height: 1.25; margin-top: 1px;
      color: var(--text-secondary);
      max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .edit-btn { font-size: 11px; color: var(--blue); background: var(--tab-active-bg); border: none; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
    .position-price { text-align: right; }
    .position-price .last { font-size: 16px; font-weight: 600; }
    .position-price .change { font-size: 12px; }
    .position-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
    .position-row span:last-child { color: var(--text); font-weight: 500; }
    .position-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
    .tag { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: var(--btn-ghost-bg); color: var(--text-secondary); }
    /* 移动端卡片折叠：次要指标默认收起，点「展开」查看 */
    .mobile-more { display: none; flex-direction: column; gap: 10px; }
    .position-card.open .mobile-more { display: flex; }
    .mobile-toggle { font-size: 11px; color: var(--blue); cursor: pointer; text-align: center; padding: 6px 0 0; border-top: 1px solid var(--border); margin-top: 2px; user-select: none; }
    .position-card:not(.open) .mobile-toggle::after { content: ' 展开更多 ▾'; }
    .position-card.open .mobile-toggle::after { content: ' 收起 ▴'; }

    /* Chart */
    .chart-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
    .chart { width: 100%; height: 220px; }
    /* chart-lg 现仅用于资产分析「资金流」瀑布图（侧边栏收益走势卡已移除） */
    .chart-lg { height: 130px; }
    .card.chart-card { padding: 16px 10px 10px; }
    @media (min-width: 768px) {
      .chart-lg { height: 135px; }
      .card.chart-card { padding: 18px 12px 12px; }
    }
    @media (min-width: 1200px) {
      /* 注意：必须带 .panel.active，否则 ID 选择器会盖过 .panel{display:none}，导致该面板常显 */
      /* 2 列网格，minmax(0,1fr) 防止窄列表格 min-content 撑爆列宽 */
      #analysis.panel.active { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; align-content: start; }
      #analysis .card { margin-bottom: 0; min-width: 0; }
      /* 卡片1（资金流）、卡片2（资金流水明细）：固定 300px 高，瀑布图放大填满 */
      #analysis > .card:nth-child(1), #analysis > .card:nth-child(2) { height: 300px; }
      #analysis > .card:nth-child(2) { overflow-y: auto; }   /* 明细行防溢出兜底 */
      #analysis #waterfallChart { height: 240px; }            /* 填满 300px 卡片剩余空间 */
      /* 卡片5（股息现金流）、卡片6（总回报盈亏）：固定 300px 高，内部超出可滚动 */
      #analysis > .card:nth-child(5), #analysis > .card:nth-child(6) { height: 300px; overflow-y: auto; }
    }

    /* Analysis */
    .analysis-list { }
    .analysis-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
    .analysis-item:last-child { border-bottom: none; }
    .analysis-item .name { font-size: 13px; color: var(--text-secondary); }
    .analysis-item .value { font-size: 14px; font-weight: 600; }
    /* 「净清算驱动源」标注：与名称同排的小徽章，不撑高行高（账户菜单行高由 balanceMenuHeight 精确校准） */
    .src-badge {
      display: inline-block; margin-left: 6px; padding: 0 6px;
      font-size: 10px; font-weight: 600; line-height: 16px; height: 16px;
      color: var(--blue); background: var(--blue-bg);
      border: 1px solid var(--blue-bd); border-radius: 999px;
      white-space: nowrap; vertical-align: 1px; letter-spacing: .2px;
    }
    .analysis-item.total .name, .analysis-item.total .value { font-size: 15px; font-weight: 700; color: var(--text); }
    /* 资产分析：明细卡片更紧凑（仅作用于该面板，不影响账户菜单） */
    #analysis .card:not(.chart-card) { padding: 12px 14px; }
    #analysis .analysis-item { padding: 3px 0; }
    #analysis .analysis-item .name { font-size: 12.5px; }
    #analysis .analysis-item .value { font-size: 13px; }
    #analysis .analysis-item.total .name, #analysis .analysis-item.total .value { font-size: 14px; }
    /* 账户菜单：动态调整行高，使右侧两张卡总高与左侧边栏卡片总高对齐（覆盖内联 padding:16px） */
    #menu { --menu-item-pad: 11.75px; }
    #menu .analysis-item { padding: var(--menu-item-pad) 16px !important; }
    /* 资产分析：可折叠卡片（压力测试 / 穿透集中度） */
    .collapsible-head {
      display: flex; justify-content: space-between; align-items: center; cursor: pointer;
      padding: 2px 0; user-select: none;
    }
    .collapsible-head .arrow { transition: transform .2s; color: var(--text-tertiary); font-size: 12px; }
    .collapsible.open .collapsible-head .arrow { transform: rotate(90deg); }
    .collapsible-body { display: none; margin-top: 10px; }
    .collapsible.open .collapsible-body { display: block; }
    .clickable { cursor: pointer; }
    .metric-item.clickable { border-radius: 10px; transition: background .15s; }
    .metric-item.clickable:active { background: var(--tab-active-bg); }

    /* Bottom nav：顶部已有「持仓/资产分析/账户」三个真实 Tab，底部导航仅占位且不可点，
       故全尺寸隐藏（保留 HTML，待接入 IBKR 真实交易功能后再启用） */
    .bottom-nav {
      position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border);
      display: none; justify-content: space-around; padding: 8px 0 12px; max-width: 480px; margin: 0 auto; left: 50%; transform: translateX(-50%);
    }
    .nav-item { text-align: center; color: var(--text-tertiary); font-size: 11px; }
    .nav-item.active { color: var(--blue); }
    .nav-item svg { display: block; margin: 0 auto 4px; }

    /* Table */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1400px; line-height: 1.3; }
    /* 年初至今三列：默认显示（用户可用「隐藏年初至今」开关关闭） */
    .ytd-col { display: table-cell; }
    body.hide-ytd .ytd-col { display: none !important; }
    body.hide-ytd table { min-width: 1400px; }
    table.show-ytd-width { min-width: 1660px; }
    th { text-align: right; padding: 6px 8px; color: var(--text-secondary); font-weight: 500; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); }
    th[data-key] { cursor: pointer; user-select: none; white-space: nowrap; }
    th[data-key]:hover { color: var(--blue); }
    th:first-child { text-align: left; }
    td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--border); }
    td:first-child { text-align: left; font-weight: 600; }
    tr:last-child td { border-bottom: none; }

    .hidden-desktop { display: block; } .hidden-mobile { display: none; }
    @media (min-width: 768px) {
      html, body { height: 100%; }
      body { overflow: hidden; padding-bottom: 0; }
      .hidden-desktop { display: none; } .hidden-mobile { display: block; }
      .container { display: flex; align-items: stretch; gap: 16px; max-width: 1200px; height: 100vh; padding: 16px; }
      .sidebar { width: 340px; flex: 0 0 340px; overflow-y: auto; padding-right: 4px; }
      .content { flex: 1 1 auto; overflow-y: auto; padding-right: 4px; scrollbar-width: none; -ms-overflow-style: none; }
      .content::-webkit-scrollbar { width: 0; height: 0; display: none; }
      .bottom-nav { display: none; }
      .metric-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
      .tabs { position: sticky; top: 0; z-index: 10; background: var(--bg); margin-bottom: 12px; }
    }

    /* ===== 侧边栏：统一卡片内边距、标题、脚注与数字对齐 =====
       字号变量定义在 .sidebar 内部作用域（而不是 :root），避免污染 .content 的全局样式。
       设计锚点：桌面栏宽 340px。用 --sc 缩放因子随栏宽微调（手机/桌面视口两档），
       默认缩放 1.0 对应设计宽，桌面窄栏略缩、手机全宽略放。 */
    .sidebar {
      --sc: 1.0;
      --fs-body: calc(12.5px * var(--sc));   /* 卡片标题 · 正文 */
      --fs-label: calc(11.5px * var(--sc));  /* 指标标签 */
      --fs-val: calc(15px * var(--sc));      /* 次要数值 */
      --fs-val-lg: calc(17px * var(--sc));   /* 卡片主数值 */
      --fs-cap: calc(11px * var(--sc));      /* 脚注 */
      --fs-hero: calc(32px * var(--sc));     /* 净清算 */
      --fs-alert: calc(12px * var(--sc));    /* 预警 */
      --fs-muted: calc(12.5px * var(--sc));  /* 占位弱提示 */
    }
    /* 桌面窄栏：340px 时缩放 1.0，略偏小以获得与右侧内容区的对比层次 */
    @media (min-width: 768px) { .sidebar { --sc: 1.0; } }
    /* 手机全宽：栏更宽，放大到易读 */
    @media (max-width: 767.9px) { .sidebar { --sc: 1.04; } }
    .sidebar > .card { padding: 14px 16px; }
    .sidebar > .card > *:last-child { margin-bottom: 0; }
    .card-title {
      font-size: var(--fs-body); font-weight: 600; color: var(--text-secondary);
      margin: 0 0 8px; line-height: 1.35;
    }
    .sidebar .chart-title { font-size: var(--fs-body); font-weight: 600; color: var(--text-secondary); line-height: 1.35; }
    .hint-mini { font-size: var(--fs-cap); line-height: 1.65; color: var(--text-tertiary); }
    .hint-mini b { color: var(--text-secondary); font-weight: 600; }
    .tag-mini {
      font-size: var(--fs-cap); font-weight: 400; padding: 1px 6px; border-radius: 4px;
      background: var(--btn-ghost-bg); color: var(--text-tertiary); margin-left: 7px; white-space: nowrap;
    }
    /* 占位文本：必须是弱提示，不能比标签更抢眼 */
    .val-muted { font-size: var(--fs-muted, var(--fs-body)); font-weight: 400; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
    .perf-val.val-muted { font-size: var(--fs-muted, var(--fs-body)); font-weight: 400; color: var(--text-tertiary); }
    .sidebar b, .sidebar .value, .sidebar .val { font-variant-numeric: tabular-nums; }
    .perf-val { font-size: var(--fs-val); font-weight: 700; font-variant-numeric: tabular-nums; }
    /* 侧边栏图表：按栏宽定高，避免手机过扁 / 桌面过高 */
    .sidebar .chart { height: 168px; }
    @media (min-width: 768px) { .sidebar .chart { height: 192px; } }

    .alert { font-size: var(--fs-alert); line-height: 1.6; padding: 7px 10px; border-radius: 8px; margin-bottom: 6px; }
    .alert:last-child { margin-bottom: 0; }
    .alert.warn { background: var(--warn-bg); color: var(--warn-fg); border-left: 3px solid var(--warn-bar); }
    .alert.danger { background: var(--danger-bg); color: var(--danger-fg); border-left: 3px solid var(--red); }
    td.warn-cell { background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
    td.danger-cell { background: var(--danger-bg); color: var(--danger-fg); font-weight: 600; }

    /* ===== 追保安全垫（顶部常显） ===== */
    .buffer-card { padding: 14px 16px; }
    .buffer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
    .buffer-head .lbl { font-size: var(--fs-body); font-weight: 600; color: var(--text-secondary); }
    .buffer-head .val { font-size: var(--fs-val-lg); font-weight: 700; white-space: nowrap; }
    .buffer-track { height: 8px; border-radius: 4px; background: var(--btn-ghost-bg); overflow: hidden; position: relative; }
    .buffer-fill { height: 100%; border-radius: 4px; transition: width .4s, background .4s; }
    .buffer-foot {
      display: flex; justify-content: space-between; gap: 6px; font-size: var(--fs-cap);
      color: var(--text-tertiary); margin-top: 7px; line-height: 1.5;
    }
    .buffer-foot b { color: var(--text); font-weight: 600; }

    /* ===== 压力测试 ===== */
    .stress-wrap { overflow-x: auto; }
    .stress-table { width: 100%; border-collapse: collapse; font-size: 11.5px; min-width: 300px; }
    .stress-table th { text-align: right; padding: 5px 6px; font-size: 11px; color: var(--text-secondary); font-weight: 500; border-bottom: 1px solid var(--border); position: static; background: transparent; }
    .stress-table th:first-child { text-align: left; }
    .stress-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
    .stress-table td:first-child { text-align: left; font-weight: 600; color: var(--text-secondary); }
    .stress-table tr:last-child td { border-bottom: none; }
    .stress-table tr.crit td { background: var(--danger-bg); color: var(--danger-fg); font-weight: 700; }
    .stress-table tr.tight td { background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
    .crit-line { font-size: 11.5px; line-height: 1.6; padding: 8px 10px; border-radius: 8px; margin-top: 10px; background: var(--danger-bg); color: var(--danger-fg); }
    .crit-line.safe { background: var(--warn-bg); color: var(--warn-fg); }

    /* ===== 穿透集中度 ===== */
    .lt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
    .lt-row:last-child { margin-bottom: 0; }
    .lt-name { width: 52px; flex: none; font-size: 12px; font-weight: 600; }
    .lt-bar-wrap { flex: 1; height: 16px; background: var(--btn-ghost-bg); border-radius: 4px; overflow: hidden; position: relative; }
    .lt-bar { height: 100%; border-radius: 4px; background: var(--blue); }
    .lt-bar.direct { background: var(--blue); }
    .lt-bar.overlap { background: var(--warn-bar); }
    .lt-bar.other { background: var(--text-tertiary); opacity: .55; }

    /* 快照 / 对比 */
    .snap-list { max-height: 160px; overflow-y: auto; margin: 8px 0 12px; }
    .snap-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
    .snap-item:last-child { border-bottom: none; }
    .snap-item button { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: none; background: var(--btn-ghost-bg); color: var(--text-secondary); cursor: pointer; }
    .compare-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 8px; }
    .compare-table th, .compare-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
    .compare-table th:first-child, .compare-table td:first-child { text-align: left; }
    .compare-table tr:last-child td { border-bottom: none; }
    .paste-area { width: 100%; min-height: 120px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 12px; line-height: 1.5; resize: vertical; box-sizing: border-box; background: var(--card); color: var(--text); font-family: inherit; }
    .mode-row { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-secondary); margin: 10px 0; }
    .lt-pct { width: 52px; flex: none; text-align: right; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
    .lt-note { font-size: 11px; line-height: 1.6; color: var(--text-secondary); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
    .lt-note b { color: var(--text); }
    .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
    .seg button { border: none; background: transparent; color: var(--text-secondary); font-size: 11px; padding: 4px 10px; cursor: pointer; }
    .seg button.on { background: var(--tab-active-bg); color: var(--blue); font-weight: 600; }

    /* Modal */
    .modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
    /* 弹窗超高时可滚动，避免内容被裁切导致按钮点不到 */
    .modal-box { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 340px;
      max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
      overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
    .modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
    .modal-input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; margin: 8px 0; box-sizing: border-box; }
    /* 底部操作按钮吸底常驻，长弹窗滚动时始终可点 */
    .modal-actions { display: flex; gap: 10px; margin-top: 14px; position: sticky; bottom: -20px;
      margin-bottom: -20px; padding-bottom: 20px; background: var(--card); z-index: 1; }
    .btn { flex: 1; padding: 10px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
    .btn-primary { background: var(--blue); color: #fff; } .btn-ghost { background: var(--btn-ghost-bg); color: var(--btn-ghost-fg); }
    .modal-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
    .modal-hint a { color: var(--blue); }
    /* 编辑现金弹窗：净清算驱动关系的实时演算块 */
    .modal-preview {
      margin: 4px 0 2px; padding: 10px 12px; border-radius: 10px;
      background: var(--blue-bg); border: 1px solid var(--blue-bd);
    }
    .modal-preview .pv-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); line-height: 1.9; }
    .modal-preview .pv-row b { font-size: 14px; font-weight: 600; color: var(--text); }
    .modal-preview .pv-total { border-top: 1px solid var(--blue-bd); margin-top: 4px; padding-top: 4px; }
    .modal-preview .pv-total span { color: var(--blue); font-weight: 600; }
    .modal-preview .pv-total b { font-size: 15px; font-weight: 700; color: var(--blue); }
    .modal-preview .pv-note { margin-top: 5px; font-size: 11px; color: var(--text-tertiary); text-align: right; }
    .src-opt { display: flex; align-items: center; gap: 9px; padding: 11px 12px; margin: 7px 0; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; }
    .src-opt input { accent-color: var(--blue); width: 17px; height: 17px; flex: none; }
    .src-opt i { font-style: normal; font-size: 11px; color: var(--text-tertiary); margin-left: 6px; }
