/* ==========================================================================
   家庭资产账本 — 明亮轻盈卡片风
   配色取自 dataviz 参考 palette.md 的已验证实例，按角色写成自定义属性。
   亮/暗是各自选定的 step，不是自动反色。
   ========================================================================== */

:root {
  color-scheme: light;

  /* 表面与墨色（palette.md "Chart chrome & ink"） */
  --surface-1: #fcfcfb;      /* 卡片/图表表面 */
  --page:      #f9f9f7;      /* 页面底板 */
  --ink-1:     #0b0b0b;      /* 主文字 */
  --ink-2:     #52514e;      /* 次文字 */
  --ink-muted: #898781;      /* 轴/弱化标签 */
  --grid:      #e1e0d9;      /* 1px 实线网格 */
  --baseline:  #c3c2b7;      /* 基线/轴 */
  --border:    rgba(11, 11, 11, 0.10);

  /* 分类色：固定槽位顺序，仅本页用到 slot-1（单序列条形图）。
     其余槽位保留给将来多序列，绝不循环生成第 9 色。 */
  --series-1:  #2a78d6;      /* blue — 资产/单序列 */
  --series-2:  #eb6834;      /* orange — 负债对比 */
  --series-3:  #1baf7a;
  --series-4:  #eda100;
  --series-5:  #e87ba4;
  --series-6:  #008300;
  --series-7:  #6250d6;
  --series-8:  #e34948;

  --good:      #0ca30c;
  --danger:    #d03b3b;
  --warning:   #fab219;

  /* 卡片风的柔和层次 */
  --card-shadow: 0 1px 2px rgba(11,11,11,.04), 0 8px 24px rgba(11,11,11,.045);
  --card-shadow-hover: 0 1px 2px rgba(11,11,11,.05), 0 12px 32px rgba(11,11,11,.08);
  --radius: 18px;
  --radius-sm: 10px;
  --hairline: 1px solid var(--border);

  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 深色：独立选定的 step（palette.md dark 列），不是自动反色 */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page:      #0d0d0d;
    --ink-1:     #f0efec;
    --ink-2:     #c3c2b7;
    --ink-muted: #898781;
    --grid:      #2c2c2a;
    --baseline:  #383835;
    --border:    rgba(255, 255, 255, 0.10);
    --series-1:  #3987e5;
    --series-2:  #d95926;
    --series-3:  #199e70;
    --series-4:  #c98500;
    --series-5:  #d55181;
    --series-6:  #0ca30c;
    --series-7:  #9085e9;
    --series-8:  #e66767;
    --card-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --card-shadow-hover: 0 1px 2px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page:      #0d0d0d;
  --ink-1:     #f0efec;
  --ink-2:     #c3c2b7;
  --ink-muted: #898781;
  --grid:      #2c2c2a;
  --baseline:  #383835;
  --border:    rgba(255, 255, 255, 0.10);
  --series-1:  #3987e5;
  --series-2:  #d95926;
  --series-3:  #199e70;
  --series-4:  #c98500;
  --series-5:  #d55181;
  --series-6:  #0ca30c;
  --series-7:  #9085e9;
  --series-8:  #e66767;
  --card-shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --card-shadow-hover: 0 1px 2px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

/* 组件类里的 display 会盖掉 hidden 属性，这里统一兜住 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 28px 24px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--series-1), var(--series-3));
  box-shadow: var(--card-shadow);
}
.brand h1 { font-size: 19px; font-weight: 650; margin: 0; letter-spacing: .2px; }
.brand-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-size: 13.5px; font-weight: 550;
  border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
  border: var(--hairline); background: var(--surface-1); color: var(--ink-1);
  transition: background .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn:hover { background: color-mix(in srgb, var(--ink-1) 4%, var(--surface-1)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.btn-primary {
  background: var(--series-1); color: #fff; border-color: transparent; font-weight: 600;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--series-1) 28%, transparent);
}
.btn-primary:hover { background: color-mix(in srgb, var(--series-1) 88%, #000); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-icon { padding: 8px; font-size: 14px; line-height: 1; border: none; }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; font-weight: 600; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }

/* ---------- 筛选行（图表上方单独一行，作用于下方全部内容） ---------- */
.filterbar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-1); border: var(--hairline);
  border-radius: 12px; box-shadow: var(--card-shadow);
}
.segmented button {
  font: inherit; font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 9px;
  padding: 7px 18px; cursor: pointer; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--ink-1); }
.segmented button.is-active {
  background: var(--series-1); color: #fff;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--series-1) 30%, transparent);
}
.segmented button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.segmented.full { display: flex; width: 100%; }
.segmented.full button { flex: 1; }
.filter-hint { font-size: 12.5px; color: var(--ink-muted); }

/* 图表卡片内的维度切换（类别 / 平台），比主筛选更轻 */
.chart-controls { display: flex; align-items: center; gap: 8px; flex: none; }
.segmented.mini { padding: 3px; gap: 2px; box-shadow: none; border-radius: 10px; }
.segmented.mini button { padding: 4px 12px; font-size: 12px; border-radius: 7px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface-1); border: var(--hairline);
  border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 24px 26px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; font-weight: 620; margin: 0; letter-spacing: .2px; }
.card-sub { font-size: 12px; color: var(--ink-muted); margin: 3px 0 0; }
.eyebrow { font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; letter-spacing: .3px; }

.dashboard { display: flex; flex-direction: column; gap: 20px; transition: opacity .18s ease; }
.dashboard[aria-busy="true"] { opacity: .55; } /* 重取数保持旧渲染降透明度，不闪骨架 */

/* ---------- Hero + KPI ---------- */
.hero-card { padding: 30px 30px 26px; }
.hero-value {
  font-size: clamp(44px, 6vw, 60px); font-weight: 660; line-height: 1.08;
  letter-spacing: -.5px; color: var(--ink-1);
  /* 大数字用比例数字，不用 tabular-nums（dataviz 反模式） */
}
.hero-sub { font-size: 12.5px; color: var(--ink-muted); margin: 6px 0 0; }
.kpi-row {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--grid);
}
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12.5px; color: var(--ink-2); }
.kpi-value { font-size: 24px; font-weight: 620; color: var(--ink-1); }
.kpi-divider { width: 1px; align-self: stretch; background: var(--grid); }

/* ---------- 公积金卡片 ---------- */
.fund-card { padding: 22px 26px; }
.fund-metrics { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.fund-metric { display: flex; flex-direction: column; gap: 4px; }
.fund-label { font-size: 12.5px; color: var(--ink-2); }
.fund-value { font-size: 22px; font-weight: 620; color: var(--ink-1); }
.fund-value.fund-net { font-size: 24px; }
.fund-divider { width: 1px; align-self: stretch; min-height: 34px; background: var(--grid); }
.fund-empty { font-size: 12px; color: var(--ink-muted); margin: 14px 0 0; }

/* ---------- 图表区 ---------- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .charts-grid { grid-template-columns: 1fr; } }

.chart { min-height: 40px; }
.chart-empty, .table-empty {
  color: var(--ink-muted); font-size: 13px; text-align: center;
  padding: 36px 0;
}

/* 排序水平条形图：单色 slot-1，一条基线，最大在上。
   条 ≤24px 厚、数据端 4px 圆角、基线方角，行间用 2px surface gap 分隔，
   不画边框。网格用 1px 实线 recessive。 */
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row {
  display: grid; grid-template-columns: 100px 1fr auto; align-items: center;
  gap: 12px; padding: 5px 0; border-radius: 6px;
  transition: background .12s ease;
}
.bar-row:hover, .bar-row:focus-visible { background: color-mix(in srgb, var(--ink-1) 3%, transparent); outline: none; }
.bar-row:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.bar-label {
  font-size: 12.5px; color: var(--ink-2); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track {
  position: relative; height: 22px; background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / 25% 100%;
  /* 竖向网格：1px 实线、比表面深一档、弱化 */
}
.bar-fill {
  position: absolute; left: 0; top: 1px; height: 20px;
  border-radius: 0 4px 4px 0;   /* 数据端 4px 圆角，基线方角 */
  background: var(--bar-color, var(--series-1));
  min-width: 2px;
  transition: width .35s cubic-bezier(.2,.7,.3,1);
}
.bar-fill.liab { background: var(--series-2); }
.bar-value {
  font-size: 12.5px; color: var(--ink-1); font-variant-numeric: tabular-nums;
  min-width: 92px; text-align: right; font-weight: 560;
}
.bar-share { color: var(--ink-muted); font-weight: 400; }

/* ---------- 趋势折线图 ----------
   单序列（净资产），2px 线、终点 4px 圆点带 2px 表面色描边、
   终点直接标注数值（文字用 ink token，不用系列色）。 */
.trend-wrap { position: relative; }
.trend-chart { min-height: 240px; }
.trend-chart svg { display: block; width: 100%; height: 240px; }
.trend-grid { stroke: var(--grid); stroke-width: 1; }
.trend-axis-text { fill: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-area { fill: var(--series-1); fill-opacity: .10; }
.trend-dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.trend-direct {
  fill: var(--ink-1); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  /* 描边用表面色，文字压在折线上也清晰（paint-order 先描边后填充） */
  paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; stroke-linejoin: round;
}
.trend-crosshair { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--surface-1); color: var(--ink-1);
  border: var(--hairline); border-radius: 10px;
  box-shadow: var(--card-shadow-hover);
  padding: 8px 12px; font-size: 12px; line-height: 1.55;
  white-space: nowrap; transform: translate(-50%, -100%);
}
.chart-tooltip .tt-date { color: var(--ink-muted); font-size: 11px; margin-bottom: 3px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; }
.chart-tooltip .tt-row span:first-child { color: var(--ink-2); }
.chart-tooltip .tt-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 560; }

/* ---------- 平台图标：官方 App 图标；无图标的用品牌色 + 单字兜底 ---------- */
.acct-icon {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  object-fit: contain; display: block;
  /* 白底图标（如中信证券）在浅色背景上会显得比满幅图标小，加一圈极淡描边统一边界 */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink-1) 9%, transparent);
}
.acct-icon.sm { width: 18px; height: 18px; border-radius: 5px; }
.acct-icon-slot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: none; }
.acct-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  color: #fff; font-size: 12px; font-weight: 600; line-height: 1;
  background: #6b6a66;
}
.acct-badge.sm { width: 18px; height: 18px; border-radius: 6px; font-size: 10px; }
.acct-cell { display: inline-flex; align-items: center; gap: 7px; }

/* 表单里的账户/平台：徽标 + 下拉 */
.account-picker { display: flex; align-items: center; gap: 9px; }
.account-picker select { flex: 1; width: auto; min-width: 0; }

/* 图表平台维度：图标占固定一列，平台名右对齐——图标左边缘才能连成一条竖线 */
.bar-label.with-badge {
  display: grid; grid-template-columns: 18px minmax(0, 1fr);
  align-items: center; gap: 6px;
}
.bar-label.with-badge .acct-icon,
.bar-label.with-badge .acct-badge { width: 18px; height: 18px; justify-self: start; }
.bar-label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 表格（图表 twin view + 明细表） ---------- */
/* position: relative 让表头里的 .sr-only 绝对定位锚在此容器，横向滚动时不会撑大页面 */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 明细表列多，窄屏改为横向滚动，而不是把每个字挤成竖排 */
.data-table { min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--grid); }
th {
  font-size: 11.5px; font-weight: 600; color: var(--ink-muted);
  text-transform: none; letter-spacing: .3px;
}
td { color: var(--ink-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--ink-1) 2.5%, transparent); }
.tag {
  display: inline-block; font-size: 11.5px; padding: 2px 9px; border-radius: 6px;
  background: color-mix(in srgb, var(--ink-1) 6%, transparent); color: var(--ink-2);
}
.tag.kind-liability { color: var(--series-2); background: color-mix(in srgb, var(--series-2) 12%, transparent); }
.tag.kind-asset { color: var(--series-1); background: color-mix(in srgb, var(--series-1) 10%, transparent); }
.loss-note { display: block; font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn { padding: 5px 10px; font-size: 12px; }
.note-cell { color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-badge {
  font-size: 12px; color: var(--ink-muted); background: color-mix(in srgb, var(--ink-1) 5%, transparent);
  padding: 4px 11px; border-radius: 20px;
}
.empty-state { text-align: center; color: var(--ink-muted); font-size: 13px; padding: 40px 0 20px; }

/* 资产 vs 负债对比：两条并列条形，无双轴 */
.compare { display: flex; flex-direction: column; gap: 14px; }
.compare-row { display: flex; flex-direction: column; gap: 6px; }
.compare-head { display: flex; justify-content: space-between; font-size: 12.5px; }
.compare-head span:first-child { color: var(--ink-2); }
.compare-head span:last-child { color: var(--ink-1); font-variant-numeric: tabular-nums; font-weight: 560; }
.compare-track { height: 20px; background: color-mix(in srgb, var(--ink-1) 5%, transparent); border-radius: 6px; overflow: hidden; }
.compare-fill { height: 100%; border-radius: 0 4px 4px 0; transition: width .35s cubic-bezier(.2,.7,.3,1); }
.compare-fill.assets { background: var(--series-1); }
.compare-fill.liab { background: var(--series-2); }

/* ---------- Dialog / 表单 ---------- */
.sheet {
  width: min(460px, calc(100vw - 32px));
  border: var(--hairline); border-radius: var(--radius);
  background: var(--surface-1); color: var(--ink-1);
  box-shadow: 0 20px 60px rgba(0,0,0,.24);
  padding: 26px 28px 24px;
}
.sheet::backdrop { background: rgba(11,11,11,.38); backdrop-filter: blur(2px); }
.sheet-sm { width: min(380px, calc(100vw - 32px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sheet h2 { font-size: 17px; font-weight: 650; margin: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 560; color: var(--ink-2); margin-bottom: 7px; }
.optional { color: var(--ink-muted); font-weight: 400; }
.field input, .field select {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink-1);
  background: var(--page); border: var(--hairline); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--series-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 18%, transparent); }
.field input::placeholder { color: var(--ink-muted); }
.amount-input { position: relative; }
.amount-input .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-2); font-size: 14px; pointer-events: none;
}
.amount-input input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.field-hint { font-size: 11.5px; color: var(--ink-muted); margin: 6px 0 0; }
.field-note {
  font-size: 12px; color: var(--ink-2);
  background: color-mix(in srgb, var(--series-1) 8%, transparent);
  border-left: 2px solid var(--series-1);
  padding: 7px 11px; border-radius: 6px; margin: 8px 0 0;
}
.field-note strong { color: var(--ink-1); font-weight: 600; }
.field-error, .form-error { font-size: 12px; color: var(--danger); margin: 6px 0 0; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.confirm-text { font-size: 13.5px; color: var(--ink-2); margin: 0 0 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--ink-1); color: var(--surface-1);
  font-size: 13px; padding: 11px 20px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 50;
}

/* ---------- 页脚 ---------- */
.footer { margin-top: 28px; font-size: 11.5px; color: var(--ink-muted); text-align: center; }
.footer code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

/* forced-colors：纹理/颜色失效时保证结构仍可读 */
@media (forced-colors: active) {
  .bar-fill, .compare-fill { forced-color-adjust: none; border: 1px solid CanvasText; }
  .trend-line { stroke: CanvasText; }
  .trend-area { fill: none; }
  .card, .sheet, .segmented { border: 1px solid CanvasText; }
}

@media (max-width: 620px) {
  .app { padding: 20px 16px; }
  .card { padding: 20px 18px; }
  .hero-value { font-size: 42px; }
  .bar-row { grid-template-columns: 84px 1fr; }
  .bar-label.with-badge { grid-template-columns: 16px minmax(0, 1fr); gap: 5px; }
  .bar-label .acct-icon, .bar-label .acct-badge { width: 16px; height: 16px; }
  .bar-value { grid-column: 2; text-align: left; min-width: 0; padding-top: 2px; }
  /* 4 个 KPI 在窄屏排成 2×2，分隔线改用间距表达 */
  .kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
  .kpi-divider { display: none; }
  .trend-chart, .trend-chart svg { min-height: 200px; height: 200px; }
  .card-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- 登录 / 初始化 ---------- */
.auth-screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 20px;
  background: var(--page);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px 28px;
  box-shadow: var(--card-shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.auth-brand h1 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.auth-brand .brand-sub { margin: 2px 0 0; font-size: 12.5px; }

.auth-submit { width: 100%; margin-top: 4px; padding: 11px 16px; font-size: 14px; }
.auth-submit[disabled] { opacity: .6; cursor: progress; }

.auth-text { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; line-height: 1.65; }
.auth-code {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ink-1) 5%, var(--surface-1));
  border: var(--hairline);
  font-size: 13px;
  overflow-x: auto;
}
.auth-code code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-1); }

.auth-theme {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--ink-muted);
}

/* ---------- 界面图标：内联 SVG，尺寸跟随字号，颜色跟随文字 ---------- */
.ico { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }
.btn, .segmented button, .tag, .kpi-label, .fund-label, .eyebrow, .field label, .footer {
  display: inline-flex; align-items: center; gap: 6px;
}
.field label { display: flex; }
.footer { display: flex; justify-content: center; }
.btn-icon .ico, #theme-toggle .ico, .auth-theme .ico { width: 16px; height: 16px; }
[data-theme-icon] { display: inline-flex; }
.tag { gap: 4px; }
.tag .ico { width: 12px; height: 12px; }
.kpi-label .ico, .fund-label .ico { color: var(--ink-muted); }
.segmented.mini button .ico { width: 13px; height: 13px; }
.row-actions .btn { gap: 4px; }
.row-actions .btn .ico { width: 13px; height: 13px; }
.row-actions .btn-del:hover { color: var(--danger); }
.card h2 { display: flex; align-items: center; gap: 8px; }
.h-ico {
  width: 26px; height: 26px; padding: 5px; border-radius: 8px; box-sizing: border-box;
  color: var(--series-1); background: color-mix(in srgb, var(--series-1) 10%, transparent);
}
#chart-liab-title .h-ico { color: var(--series-2); background: color-mix(in srgb, var(--series-2) 12%, transparent); }
#fund-title .h-ico { color: var(--series-3); background: color-mix(in srgb, var(--series-3) 12%, transparent); }
#trend-title .h-ico { color: var(--series-7); background: color-mix(in srgb, var(--series-7) 12%, transparent); }
/* 图表类别维度：带底色的类别图标，和平台维度的图标列对齐 */
.cat-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px;
  color: var(--series-1); background: color-mix(in srgb, var(--series-1) 12%, transparent);
}
.cat-icon.liab { color: var(--series-2); background: color-mix(in srgb, var(--series-2) 12%, transparent); }
.cat-icon .ico { width: 12px; height: 12px; }
.empty-state .empty-ico { display: block; width: 36px; height: 36px; margin: 0 auto 10px; opacity: .6; }
.auth-code { display: flex; align-items: center; gap: 8px; }
.auth-code .ico { color: var(--ink-muted); }
.btn, .segmented button { justify-content: center; }

/* ---------- 构成环形图 ---------- */
.donut-body { display: grid; grid-template-columns: 180px 1fr; gap: 22px; align-items: center; }
@media (max-width: 520px) { .donut-body { grid-template-columns: 1fr; justify-items: center; } }
.donut-svg { width: 180px; height: 180px; display: block; }
.donut-seg { stroke: var(--surface-1); stroke-width: 2; transition: opacity .15s ease; cursor: default; }
.donut-seg.is-dim { opacity: .3; }
.donut-center-label { fill: var(--ink-2); font-size: 11.5px; }
.donut-center-value { fill: var(--ink-1); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; width: 100%; }
.donut-legend li {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 48px; align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 6px; font-size: 12.5px;
}
.donut-legend li.is-hover, .donut-legend li:focus-visible { background: color-mix(in srgb, var(--ink-1) 4%, transparent); outline: none; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend-name { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); overflow: hidden; white-space: nowrap; }
.legend-name .ico { width: 13px; height: 13px; color: var(--ink-muted); }
.legend-value { color: var(--ink-1); font-variant-numeric: tabular-nums; text-align: right; }
.legend-share { color: var(--ink-muted); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- 柱状图 ---------- */
.col-chart { position: relative; }
.col-svg { display: block; }
.col-zero { stroke: var(--baseline); stroke-width: 1; }
.col-hover { fill: color-mix(in srgb, var(--ink-1) 4%, transparent); }
.col-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin: -6px 0 8px; }
.col-legend span { display: inline-flex; align-items: center; gap: 6px; }
