  /* ===== 颜色变量：改这里就能换整套配色 ===== */
  :root {
    --bg: #F7F5F1;          /* 页面背景：柔和暖米灰 */
    --card: #FFFFFF;        /* 卡片背景：白 */
    --ink: #1E2227;         /* 主文字：深墨色 */
    --muted: #6B7280;       /* 次要文字：灰 */
    --line: #E2E5E9;        /* 分隔线、边框 */
    --income: #C03A3A;      /* 收入：红（中国传统：红=涨/收） */
    --expense: #147D5A;     /* 支出：绿（中国传统：绿=跌/支） */
    --dark: #24484F;        /* 深色卡片/主按钮：深青蓝 */
    --dark-line: #356069;   /* 深色卡片里的分隔线 */
    --mint: #79D1B5;        /* 深色卡片里的绿色 */
    --coral: #FFAA78;       /* 深色卡片里的橙色 */
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    line-height: 1.5;
    padding: 16px 16px 104px;
  }

  .app { max-width: 680px; margin: 0 auto; }
  .app.subpage-open > header { display: none; }

  /* ===== 标题 ===== */
  header { position: relative; margin-bottom: 14px; }
  header h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 0.5px;
  }
  header .subtitle {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
  }
  /* 账本切换条（顶部下拉） */
  .book-bar {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    gap: 0;
    margin-top: 0;
    align-items: center;
  }
  .book-bar .book-picker { width: 112px; }
  .book-bar .compact-picker-trigger {
    width: 112px;
    min-height: 36px;
    padding: 7px 26px 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    background: #FFFFFF;
  }
  .book-bar .compact-picker-chevron { position: absolute; right: 10px; }
  .book-bar .compact-picker-menu { right: 0; left: auto; width: max(170px, 100%); max-height: min(210px, 38vh); }
  .book-bar .compact-picker-option { font-size: 11px; }
  .book-bar .mini-btn { padding: 10px 16px; white-space: nowrap; }
  .privacy-toggle { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; margin-left: 6px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--dark); cursor: pointer; }
  .privacy-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .privacy-toggle svg circle { fill: currentColor; stroke: none; }
  .privacy-toggle svg .eye-slash { stroke: #26785E; stroke-width: 2.2; }
  .privacy-toggle[aria-pressed="true"] { background: #EAF5EF; color: #26785E; }
  .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .ui-icon {
    display: inline-flex;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
  }
  .ui-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .auth-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
  }
  .auth-bar[hidden] { display: none !important; }
  .auth-panel { margin-bottom: 20px; }
  .auth-entry-panel {
    max-width: 480px;
    margin: 28px auto 20px;
    padding: 28px 24px 24px;
  }
  .auth-entry-panel .auth-panel-head {
    display: block;
    margin-bottom: 8px;
  }
  .auth-entry-panel .auth-panel-head h2 { font-size: 22px; }
  .auth-entry-hint {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
  }
  .auth-password-hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
  }
  .auth-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .auth-panel-head h2 { margin: 0; }
  .auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
  .auth-tabs .tab { padding: 8px 14px; }

  .startup-notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #E0A63A;
    border-radius: 10px;
    background: #FFF7E6;
    color: #704B00;
    font-size: 14px;
    line-height: 1.6;
  }

  .app.auth-gate .book-bar,
  .app.auth-gate .auth-bar { display: none; }
  .app.auth-gate header { margin-bottom: 8px; }

  /* ===== 统计卡片（首页的视觉中心） ===== */
  .stats {
    background: linear-gradient(135deg, #FFF6EF 0%, #FFE8DA 100%);
    color: var(--ink);
    border: 1px solid #F1D0BE;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 14px rgba(185, 96, 58, 0.08);
  }
  .stat-balance-label {
    color: #7A665D;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .stat-balance-label .ui-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
  .stat-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    vertical-align: 1px;
  }
  .stat-dot.income { background: var(--income); }
  .stat-dot.expense { background: var(--mint); }
  .period-stat .stat-dot.income { background: var(--income); }
  .period-stat .stat-dot.expense { background: var(--expense); }
  .stat .label, .period-stat .label {
    display: flex;
    align-items: center;
  }
  .stat-balance {
    font-size: clamp(24px, 6vw, 30px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    margin: 1px 0 5px;
    font-family: "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  }
  .stat-row {
    display: flex;
    gap: 12px;
    border-top: 1px solid #EBCDBD;
    padding-top: 6px;
  }
  .stat { flex: 1; }
  .stat .label { color: #7A665D; font-size: 13px; }
  .stat .value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  }
  .value.income { color: var(--income); }
  .value.expense { color: var(--mint); }

  /* ===== 导航切换（记一笔 / 账户 / 明细） ===== */
  .tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
  }
  .tab {
    flex: 1;
    min-height: 44px;
    padding: 8px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
  }
  .tab-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }
  .tab-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .tab:hover { border-color: var(--ink); }
  .tab.active {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
  }
  @media (max-width: 380px) {
    .tabs { gap: 5px; }
    .tab { gap: 4px; font-size: 14px; }
    .tab-icon { width: 16px; height: 16px; flex-basis: 16px; }
  }

  /* ===== 首页与固定导航 ===== */
  .home-panel { display: block; }
  .home-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .home-shortcut {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #D9E8E5;
    border-radius: 13px;
    background: #FFFFFF;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .home-shortcut:hover,
  .home-shortcut:focus-visible { border-color: var(--mint); outline: none; background: #F0FBF7; }
  .home-shortcut-icon {
    display: inline-flex;
    width: 19px;
    height: 19px;
    color: var(--expense);
  }
  .home-shortcut-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .home-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 2px 2px 8px;
    font-size: 15px;
    font-weight: 700;
  }
  .text-link {
    border: 0;
    background: transparent;
    color: var(--expense);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  .text-link:hover { text-decoration: underline; }
  .home-trend-section {
    margin-top: 8px;
    padding-top: 4px;
  }
  .home-trend-chart {
    min-height: 150px;
    padding: 8px 4px 2px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FFFFFF;
  }
  .home-trend-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 10px 2px;
    color: var(--muted);
    font-size: 12px;
  }
  .home-trend-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .home-trend-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
  .home-trend-month { margin-left: auto; }
  .home-trend-svg { display: block; width: 100%; height: auto; }
  .page-head {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
  }
  .page-head h2 { margin: 0; text-align: center; }
  .page-back {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 3px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }
  .page-back:hover { color: var(--ink); }
  .page-back > span:first-child { font-size: 24px; line-height: 16px; }
  .page-head-spacer { min-width: 1px; }
  .subsection-title { margin: 18px 0 8px; font-size: 14px; }
  .placeholder-panel { min-height: 280px; }
  .budget-panel { padding-bottom: 18px; }
  .budget-month-bar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px auto;
    align-items: end;
    gap: 8px;
    margin-bottom: 12px;
  }
  .budget-month-bar > .mini-btn {
    min-height: 42px;
    padding: 6px 8px;
    font-size: 24px;
    line-height: 1;
  }
  .budget-panel .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin-top: 0;
  }
  .budget-month-picker { min-width: 0; }
  .budget-month-picker .field-label { margin-bottom: 4px; }
  .budget-month-picker input { width: 100%; min-height: 42px; }
  .budget-month-bar > .btn-ghost { min-height: 42px; white-space: nowrap; padding: 8px 10px; }
  .budget-summary {
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #CFE4DE;
    border-radius: 14px;
    background: linear-gradient(135deg, #F0FBF7, #FFFFFF 65%);
  }
  .budget-summary-head,
  .budget-summary-numbers,
  .budget-category-top,
  .budget-category-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .budget-summary-kicker { display: block; color: var(--muted); font-size: 12px; }
  .budget-summary-head strong { display: block; margin-top: 3px; font-size: 26px; font-variant-numeric: tabular-nums; }
  .budget-summary-numbers { margin: 14px 0 8px; color: var(--muted); font-size: 13px; }
  .budget-summary-numbers strong { color: var(--ink); font-variant-numeric: tabular-nums; }
  .budget-summary-numbers .over,
  .budget-category-meta .over { color: var(--income); }
  .budget-status { display: inline-flex; align-items: center; white-space: nowrap; font-size: 12px; }
  .budget-status.normal { color: var(--expense); }
  .budget-status.near { color: #A66A00; }
  .budget-status.over { color: var(--income); }
  .budget-status.unset { color: var(--muted); }
  .budget-progress { height: 8px; overflow: hidden; border-radius: 999px; background: #E8EFED; }
  .budget-progress-bar { display: block; height: 100%; border-radius: inherit; background: var(--expense); transition: width .2s ease; }
  .budget-progress-bar.near { background: #E0A63A; }
  .budget-progress-bar.over { background: var(--income); }
  .budget-progress-bar.unset { background: var(--line); }
  .budget-summary-caption { margin-top: 6px; color: var(--muted); font-size: 11px; text-align: right; }
  .budget-card { padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
  .budget-card-heading { margin-bottom: 12px; }
  .budget-card-heading h3 { margin: 0; font-size: 16px; }
  .budget-card-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
  .budget-total-form { display: grid; gap: 7px; }
  .budget-input-label { color: var(--muted); font-size: 12px; }
  .budget-input-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 7px; }
  .budget-currency { color: var(--expense); font-size: 20px; font-weight: 700; }
  .budget-input-row input { min-width: 0; min-height: 42px; font-size: 17px; font-variant-numeric: tabular-nums; }
  .budget-input-row button { min-height: 42px; padding: 8px 10px; white-space: nowrap; }
  .budget-category-form { display: grid; grid-template-columns: minmax(0, 1fr) 104px auto; gap: 6px; margin-bottom: 10px; }
  .budget-category-picker { position: relative; min-width: 0; }
  .native-budget-category-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
  .budget-category-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    min-height: 38px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #FAFBFC;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    line-height: 1.25;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
  }
  .budget-category-picker-trigger.has-value { color: var(--ink); }
  .budget-category-picker-trigger:focus,
  .budget-category-picker-trigger[aria-expanded="true"] {
    outline: none;
    border-color: var(--expense);
    background: #fff;
  }
  .budget-category-picker-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .budget-category-picker-trigger > span:last-child { flex: 0 0 auto; color: var(--muted); font-size: 16px; line-height: 1; }
  .budget-category-picker-menu {
    position: absolute;
    z-index: 60;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: min(150px, 24vh);
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #FFFFFF;
    box-shadow: 0 10px 24px rgba(30, 34, 39, .14);
  }
  .budget-category-picker-menu.open-up { top: auto; bottom: calc(100% + 5px); }
  .budget-category-picker-menu[hidden] { display: none !important; }
  .budget-category-picker-option {
    display: block;
    width: 100%;
    min-height: 30px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
  }
  .budget-category-picker-option:hover,
  .budget-category-picker-option:focus,
  .budget-category-picker-option.selected { outline: none; background: #EAF7F1; color: var(--expense); }
  .budget-category-picker-empty { padding: 8px; color: var(--muted); font-size: 12px; text-align: center; }
  .budget-category-form input { min-width: 0; min-height: 38px; padding: 6px 8px; font-size: 14px; }
  .budget-category-form button { min-height: 38px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .budget-category-list { display: grid; gap: 8px; }
  .budget-category-row { padding: 9px 0 2px; border-top: 1px solid var(--line); }
  .budget-category-top strong { font-size: 14px; }
  .budget-category-actions { display: flex; align-items: center; gap: 5px; }
  .budget-category-input { width: 92px; min-height: 34px; padding: 5px 7px; font-size: 13px; text-align: right; }
  .budget-category-actions .mini-btn { min-height: 34px; padding: 5px 7px; font-size: 12px; }
  .budget-category-meta { margin: 6px 0 4px; color: var(--muted); font-size: 11px; }
  .budget-empty { padding: 8px 0 2px; color: var(--muted); font-size: 12px; }
  .budget-footnote { margin: 4px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
  .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; }
  .empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
  }
  .empty-state strong { color: var(--ink); font-size: 15px; }
  .empty-state-icon { width: 34px; height: 34px; color: var(--expense); }
  .empty-state-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav {
    position: fixed;
    z-index: 30;
    left: 50%;
    bottom: 0;
    width: min(680px, calc(100% - 20px));
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 4px;
    margin: 0;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    background: #FFFFFF;
    box-shadow: 0 -4px 16px rgba(36, 72, 79, .08);
    overflow: visible;
  }
  .bottom-nav .tab {
    height: auto;
    min-height: 44px;
    flex: none;
    flex-direction: column;
    gap: 2px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
  }
  .bottom-nav .tab:hover { border: 0; background: #F2F8F6; }
  .bottom-nav .tab.active { background: #EAF7F1; color: var(--expense); }
  .bottom-nav .tab.bottom-record-tab { color: var(--dark); font-weight: 700; }
  .bottom-nav .tab.bottom-record-tab {
    position: relative;
    z-index: 1;
    padding-top: 22px;
  }
  .bottom-nav .tab.bottom-record-tab .bottom-plus-icon {
    position: absolute;
    top: -14px;
    left: 50%;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    background: #FFE5D3;
    color: #C96D3D;
    font-size: 35px;
    line-height: 42px;
    transform: translateX(-50%);
    margin-bottom: 0;
    box-shadow: 0 4px 10px rgba(201, 109, 61, .16);
  }
  .bottom-nav .tab.bottom-record-tab.active { background: #FFF4EA; color: #C96D3D; }
  .bottom-nav .tab-icon { width: 20px; height: 20px; flex-basis: 20px; }
  .bottom-nav .bottom-plus-icon { display: inline-flex; align-items: center; justify-content: center; }
  .bottom-nav.record-hidden { display: none; }

  /* 首页阶段 1：局部字号与间距规则，不改变其他专项页的字段密度。 */
  .app {
    --home-type-small: .75rem;
    --home-type-label: .8125rem;
    --home-type-body: .875rem;
    --home-type-heading: .9375rem;
    --home-space-small: 8px;
    --home-space-medium: 12px;
    --home-radius: 12px;
    --home-summary-surface: #EDF5EF;
    --home-summary-ink: #47645C;
    --home-muted: #626B69;
  }
  .app:not(.subpage-open):not(.auth-gate) > header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 var(--home-space-small);
    margin-bottom: var(--home-space-small);
  }
  .app:not(.subpage-open):not(.auth-gate) > header h1 {
    font-size: 1.125rem;
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .subtitle {
    color: var(--home-muted);
    grid-row: 2;
    grid-column: 1 / -1;
    font-size: var(--home-type-small);
    margin-top: 0;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .book-bar {
    position: static;
    grid-row: 1;
    grid-column: 2;
    min-width: 0;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .auth-bar { grid-column: 1 / -1; }
  .app:not(.subpage-open):not(.auth-gate) > header .book-picker,
  .app:not(.subpage-open):not(.auth-gate) > header .book-picker .compact-picker-trigger {
    width: 112px;
    max-width: 35vw;
    min-height: 44px;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .compact-picker-trigger {
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: var(--home-type-small);
    padding-left: 4px;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .privacy-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    margin-left: 8px;
    border: 0;
    background: transparent;
  }
  .app:not(.subpage-open):not(.auth-gate) > header .privacy-toggle[aria-pressed="true"] {
    background: #E2EEE5;
  }
  .app:not(.subpage-open):not(.auth-gate) > header button:focus-visible,
  .bottom-nav .tab:focus-visible {
    outline: 2px solid var(--expense);
    outline-offset: -2px;
  }
  #panelHome .stats {
    background: var(--home-summary-surface);
    border: 0;
    border-radius: var(--home-radius);
    padding: var(--home-space-medium);
    margin-bottom: var(--home-space-small);
    box-shadow: none;
  }
  #panelHome, #panelHomePeriods { --muted: var(--home-muted); }
  #panelHome .stat-balance-label,
  #panelHome .stat .label { color: var(--home-summary-ink); font-size: var(--home-type-label); }
  #panelHome .stat-balance {
    color: #213B2D;
    font-family: inherit;
    font-size: 1.875rem;
    font-weight: 650;
    line-height: 1.3;
    margin: 4px 0 var(--home-space-small);
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }
  #panelHome .stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--home-space-medium);
    padding-top: var(--home-space-small);
    border: 0;
  }
  #panelHome .stat { flex: 1 1 max-content; min-width: 0; max-width: 100%; }
  #panelHome .stat .value {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    overflow-wrap: anywhere;
  }
  #panelHome .stat-dot.expense { background: var(--expense); }
  #panelHome .stat .value.expense { color: var(--expense); }
  #panelHome .stat-networth {
    flex-wrap: wrap;
    gap: 4px var(--home-space-medium);
    margin-top: var(--home-space-small);
    padding-top: var(--home-space-small);
    border-top-color: #D6E5D9;
  }
  #panelHome .stat-networth .label { color: var(--home-summary-ink); font-size: var(--home-type-small); }
  #panelHome .stat-networth .value {
    margin-left: auto;
    min-width: 0;
    max-width: 100%;
    font-family: inherit;
    font-size: 1rem;
    overflow-wrap: anywhere;
  }
  #panelHome .home-shortcuts { gap: 4px; margin-bottom: 4px; }
  #panelHome .home-shortcut {
    min-height: 48px;
    gap: 5px;
    padding: 4px 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: var(--home-type-label);
    font-weight: 500;
    box-shadow: none;
    flex-wrap: wrap;
  }
  #panelHome .home-shortcut-icon { flex-shrink: 0; width: 18px; height: 18px; }
  #panelHome .home-shortcut[data-tab="overview"] .home-shortcut-icon { color: #357D8E; }
  #panelHome .home-shortcut[data-tab="budget"] .home-shortcut-icon { color: #97663D; }
  #panelHome .home-shortcut[data-tab="investment"] .home-shortcut-icon { color: #786097; }
  @media (hover: hover) {
    #panelHome .home-shortcut:hover { background: #EAF1E9; }
  }
  #panelHome .home-shortcut:focus-visible {
    outline: 2px solid var(--expense);
    outline-offset: -2px;
  }
  #panelHome .home-section-heading {
    font-size: var(--home-type-heading);
    font-weight: 600;
    margin: var(--home-space-medium) 2px var(--home-space-small);
  }
  #panelHome .home-overview-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
  #panelHome .home-month-label { color: var(--home-summary-ink); font-size: var(--home-type-small); }
  #panelHome .home-trend-legend { font-size: var(--home-type-small); flex-wrap: wrap; }
  #panelHome .home-section-heading h2 { margin: 0; font: inherit; }
  #panelHome .home-recent-section .home-section-heading { margin-block: 4px; }
  #panelHome .home-all-records,
  #panelHome .home-empty-record {
    min-height: 44px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dark);
    font: inherit;
    font-size: var(--home-type-label);
    cursor: pointer;
  }
  #panelHome .home-all-records { font-size: var(--home-type-small); font-weight: 500; }
  #panelHome .home-shortcut:active,
  #panelHome .home-all-records:active,
  #panelHome .home-period-entry:active { background: #EAF1E9; }
  #panelHome .home-recent-list { padding: 4px var(--home-space-medium); background: var(--card); border-radius: var(--home-radius); }
  #panelHome .home-recent-date { padding: 6px 0 0; color: var(--muted); font-size: var(--home-type-small); }
  #panelHome .home-recent-row {
    display: flex;
    align-items: center;
    gap: var(--home-space-small);
    width: 100%;
    min-height: 44px;
    padding: 4px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  #panelHome .home-recent-row:last-child { border-bottom: 0; }
  #panelHome .home-recent-icon { display: inline-flex; flex: 0 0 20px; color: #47645C; }
  #panelHome .home-recent-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  #panelHome .home-recent-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  #panelHome .home-recent-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
  #panelHome .home-recent-account { min-width: 0; font-size: var(--home-type-label); font-weight: 600; overflow-wrap: anywhere; }
  #panelHome .home-recent-category { min-width: 0; color: var(--muted); font-size: var(--home-type-small); overflow-wrap: anywhere; }
  #panelHome .home-recent-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; color: var(--muted); font-size: var(--home-type-small); }
  #panelHome .home-recent-amount {
    min-width: 0;
    max-width: 45%;
    flex-shrink: 1;
    font-size: var(--home-type-body);
    font-weight: 600;
    font-family: inherit;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  #panelHome .home-recent-empty { padding: 16px 0; text-align: center; }
  #panelHome .home-recent-empty strong { font-size: var(--home-type-body); font-weight: 600; }
  #panelHome .home-recent-empty p { margin-top: 4px; color: var(--muted); font-size: var(--home-type-label); }
  #panelHome .home-empty-record { padding-inline: 16px; margin-top: 8px; color: white; background: var(--dark); }
  #panelHome .home-period-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--home-space-small);
    width: 100%;
    min-height: 52px;
    padding: 12px;
    margin-top: var(--home-space-medium);
    border: 1px solid var(--line);
    border-radius: var(--home-radius);
    background: #FFFFFF;
    color: var(--ink);
    font: inherit;
    font-size: var(--home-type-label);
    text-align: left;
    cursor: pointer;
  }
  #panelHome .home-period-entry-caption { flex: 1; color: var(--muted); font-size: var(--home-type-small); overflow-wrap: anywhere; }
  #panelHome .home-period-entry-action { color: var(--dark); font-size: var(--home-type-small); font-weight: 600; white-space: nowrap; }
  #panelHomePeriods { padding: 0 2px 22px; }
  #panelHomePeriods .home-period-page-hint { margin: 4px 0 12px; font-size: var(--home-type-label); color: var(--muted); }
  #panelHome .home-recent-row:focus-visible,
  #panelHome .home-all-records:focus-visible,
  #panelHome .home-empty-record:focus-visible,
  #panelHome .home-period-entry:focus-visible { outline: 2px solid var(--expense); outline-offset: -2px; }
  @media (hover: hover) {
    #panelHome .home-recent-row:hover,
    #panelHome .home-all-records:hover,
    #panelHome .home-period-entry:hover { background: #EAF1E9; }
  }
  #panelHomePeriods .home-period-cards {
    gap: 0;
    margin-bottom: var(--home-space-small);
    border: 0;
    border-radius: var(--home-radius);
    background: var(--card);
  }
  #panelHomePeriods .home-period-cards .detail-period-card {
    display: flex;
    flex-wrap: wrap;
    gap: var(--home-space-small);
    min-height: 64px;
    padding: 8px var(--home-space-medium);
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  #panelHomePeriods .home-period-cards .detail-period-main { flex: 1 1 5rem; }
  #panelHomePeriods .home-period-cards .detail-period-totals { flex: 1 1 8rem; }
  #panelHomePeriods .home-period-cards .detail-period-card:first-child { border-radius: var(--home-radius) var(--home-radius) 0 0; }
  #panelHomePeriods .home-period-cards .detail-period-card:last-child { border-radius: 0 0 var(--home-radius) var(--home-radius); }
  #panelHomePeriods .home-period-cards .detail-period-name { font-size: var(--home-type-heading); font-weight: 600; }
  #panelHomePeriods .home-period-cards .detail-period-range { font-size: var(--home-type-small); overflow-wrap: anywhere; }
  #panelHomePeriods .home-period-cards .detail-period-card + .detail-period-card {
    border-top: 1px solid #EEF1EC;
  }
  #panelHomePeriods .home-period-cards .detail-period-card:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--expense);
    outline-offset: -2px;
  }
  #panelHomePeriods .home-period-cards .detail-period-card:active { background: #F4F8F4; }
  #panelHomePeriods .home-period-cards .detail-period-count {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  #panelHomePeriods .home-period-cards .detail-period-total {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
    width: 100%;
    text-align: right;
  }
  #panelHomePeriods .home-period-cards .detail-period-total-label { flex-shrink: 0; font-size: var(--home-type-small); }
  #panelHomePeriods .home-period-cards .detail-period-total strong {
    min-width: 0;
    font-size: var(--home-type-body);
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #panelHomePeriods .period-summary { margin-bottom: var(--home-space-medium); }
  #panelHomePeriods .period-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--home-space-medium);
    border: 0;
    border-radius: var(--home-radius);
    padding: 10px var(--home-space-medium);
    background: var(--card);
  }
  #panelHomePeriods .period-stat .label { font-size: var(--home-type-label); }
  #panelHomePeriods .period-stat .value {
    min-width: 0;
    font-family: inherit;
    font-size: var(--home-type-body);
    text-align: right;
    overflow-wrap: anywhere;
  }
  #panelHome .home-trend-chart { border: 0; border-radius: var(--home-radius); }

  .bottom-nav {
    width: min(680px, 100%);
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    padding-top: 6px;
  }
  nav.bottom-nav .tab { min-height: 52px; font-size: .75rem; }
  .bottom-nav .tab.bottom-record-tab { padding-top: 30px; }
  .bottom-nav .tab.bottom-record-tab .bottom-plus-icon {
    top: -20px;
    width: 54px;
    height: 54px;
    font-size: 38px;
    line-height: 1;
    box-shadow: none;
  }
  body { padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px)); }

  /* ===== 通用卡片 ===== */
  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
  }
  .card h2 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
  }

  /* ===== 首页跳转页：外层无边框，内部模块保留层次 ===== */
  .app.subpage-open > main > .card {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  /* ===== 表单字段 ===== */
  .field { margin-bottom: 16px; }
  .field-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
  }
  .field-row { display: flex; gap: 12px; }
  .field-row .field { flex: 1; }
  .detail-search-field { margin-bottom: 8px; }
  .detail-filter-toggle { margin-bottom: 8px; }
  .detail-filters {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FAFBFC;
  }
  .detail-filters[hidden] { display: none !important; }
  .detail-filters .field-row { margin-bottom: 12px; }
  .detail-filters .field { margin-bottom: 0; }
  .detail-filter-actions { display: flex; justify-content: flex-end; }
  .detail-filters .detail-filter-clear { display: block; width: auto; margin-top: 0; padding: 8px 14px; }
  .detail-filter-clear:disabled { cursor: default; opacity: 0.55; }
  .compact-picker { position: relative; min-width: 0; }
  .compact-picker-trigger {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    text-align: left;
  }
  .compact-picker-trigger .compact-picker-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .compact-picker-trigger .compact-picker-chevron { flex: 0 0 auto; color: var(--muted); font-size: 16px; line-height: 1; }
  .compact-picker-trigger.has-value { color: var(--ink); }
  .compact-picker-trigger:focus,
  .compact-picker-trigger[aria-expanded="true"] { outline: none; border-color: var(--expense); }
  .compact-picker-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: min(210px, 38vh);
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(31, 42, 39, .14);
  }
  .compact-picker-menu[hidden] { display: none !important; }
  .compact-picker-menu.open-up { top: auto; bottom: calc(100% + 4px); }
  .compact-picker-option {
    display: block;
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    text-align: left;
  }
  .compact-picker-option:hover,
  .compact-picker-option:focus,
  .compact-picker-option.selected { outline: none; background: #EAF7F1; color: var(--expense); }
  .compact-picker-empty { padding: 12px 9px; color: var(--muted); font-size: 12px; }
  .detail-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 6px; }
  .detail-list-heading #detailToggle { margin: 0; }
  .detail-period-filter { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(130px, 1fr); gap: 8px; align-items: end; margin: 10px 0 6px; }
  .detail-period-filter .field { margin: 0; }
  .detail-period-filter select, .detail-period-filter input { min-height: 40px; font-size: 13px; }
  .detail-period-picker .compact-picker-trigger,
  .detail-period-picker .compact-picker-option { font-size: 12px; }
  .detail-period-totals-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 9px 2px; margin: 2px 0 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
  .detail-period-totals-line strong { font-size: 14px; }
  .detail-period-totals-line .income { color: var(--income); }
  .detail-period-totals-line .expense { color: var(--expense); }
  /* 流水页用同一条轻分隔线组织查询控件，汇总独立成一条易扫读的信息行。 */
  #panelDetail .detail-search-field input,
  #panelDetail .detail-period-filter input,
  #panelDetail .detail-period-picker .compact-picker-trigger,
  #panelDetail .detail-filters input,
  #panelDetail .detail-filters .compact-picker-trigger {
    min-height: 44px;
    padding: 9px 2px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  #panelDetail .detail-search-field input:focus,
  #panelDetail .detail-period-filter input:focus,
  #panelDetail .detail-period-picker .compact-picker-trigger:focus-visible,
  #panelDetail .detail-period-picker .compact-picker-trigger[aria-expanded="true"],
  #panelDetail .detail-filters input:focus,
  #panelDetail .detail-filters .compact-picker-trigger:focus-visible,
  #panelDetail .detail-filters .compact-picker-trigger[aria-expanded="true"] {
    outline: none;
    border-bottom: 2px solid var(--expense);
    background: transparent;
  }
  #panelDetail .detail-period-totals-line {
    align-items: center;
    min-height: 48px;
    margin: 10px 0 2px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: #FFFFFF;
  }
  #panelDetail .detail-filter-toggle,
  #panelDetail .detail-filter-toggle:hover {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 10px 0 8px;
    padding: 10px 12px;
    border: 1px solid #C9DED3;
    border-radius: 10px;
    background: #F1F7F3;
    color: var(--dark);
    font-size: 13px;
    font-weight: 600;
  }
  #panelDetail .detail-filter-toggle:focus-visible {
    outline: 2px solid var(--expense);
    outline-offset: 2px;
  }
  #panelDetail .detail-filter-toggle[aria-expanded="true"] { border-color: #7DAE95; background: #EAF5EF; }
  .detail-filter-button-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; text-align: left; }
  .detail-filter-button-main svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .detail-filter-button-action { flex: 0 0 auto; color: #176B52; white-space: nowrap; font-size: 12px; }
  #panelDetail .detail-filters {
    padding: 10px 0 12px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  .chart-note { margin-top: 8px; color: var(--muted); font-size: 12px; }
  .fixed-income-settings { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
  .fixed-income-page .fixed-income-settings { margin-top: 8px; padding-top: 0; border-top: 0; }
  .fixed-income-settings h3 { margin: 0 0 6px; font-size: 16px; }
  .fixed-income-settings input[type="month"] { display: block; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #FAFBFC; color: var(--ink); font: inherit; font-size: 14px; }
  .fixed-income-settings select { min-height: 40px; padding: 8px 10px; font-size: 13px; }
  .fixed-income-settings #fixedIncomeAccount,
  .fixed-income-settings #fixedIncomeDay { font-size: 13px; }
  .fixed-income-settings select option { font-size: 13px; }
  .fixed-income-day-picker .compact-picker-trigger,
  .fixed-income-day-picker .compact-picker-option { font-size: 12px; }
  .fixed-income-day-picker .compact-picker-menu { max-height: min(210px, 38vh); }
  .fixed-income-enabled { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
  .fixed-income-enabled input { width: 18px; height: 18px; accent-color: var(--accent); }
  .fixed-income-actions { display: grid; gap: 8px; }
  .fixed-income-actions button { min-height: 40px; }
  .fixed-income-actions .btn-ghost { display: block; margin-top: 0; }
  .fixed-income-actions .btn-ghost:disabled { opacity: .5; cursor: default; }
  .device-lock-settings { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
  .device-lock-settings h3 { margin: 0 0 6px; font-size: 16px; }
  .device-lock-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 0; list-style: none; cursor: pointer; }
  .device-lock-toggle::-webkit-details-marker { display: none; }
  .device-lock-toggle h3 { margin: 0; font-size: .9375rem; }
  .device-lock-toggle:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; }
  .settings-disclosure-chevron { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .device-lock-settings[open] .settings-disclosure-chevron { transform: rotate(180deg); }
  .device-lock-question-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .device-lock-settings > button { margin-top: 8px; }
  .device-lock-settings > .btn-ghost { display: block; }
  .device-lock-settings > .btn-ghost[hidden],
  .device-lock-settings #deviceLockCurrentPinField[hidden],
  .device-lock-settings #deviceLockQuestionSummary[hidden] { display: none !important; }
  .device-lock-settings .btn-primary { display: block; width: 100%; margin-top: 8px; }
  .device-lock-question-summary { margin: 4px 0 8px; color: var(--muted); font-size: 12px; }
  .device-lock-question-summary[hidden] { display: none !important; }
  .app-lock-overlay { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: rgba(25, 37, 39, .96); }
  .app-lock-overlay[hidden] { display: none !important; }
  .app-lock-card { width: min(100%, 380px); padding: 24px 20px; border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(0,0,0,.25); }
  .app-lock-card h1 { margin: 0 0 6px; font-size: 22px; }
  .app-lock-card > p { margin-bottom: 16px; color: var(--muted); font-size: 14px; }
  .app-lock-card .field { margin: 10px 0; }
  .app-lock-card button { width: 100%; margin-top: 8px; }
  .app-lock-card .btn-ghost { display: block; }
  .app-lock-pin { display: block; width: 100%; min-height: 50px; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: center; letter-spacing: .55em; font-size: 20px; }
  .app-lock-remember { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; color: var(--ink); font-size: 13px; }
  .app-lock-remember input { width: 18px; height: 18px; accent-color: var(--expense); }
  .app-lock-card .form-msg { min-height: 24px; margin-top: 8px; text-align: center; }
  body.privacy-masked .stat-balance,
  body.privacy-masked #netWorth,
  body.privacy-masked .stat .value,
  body.privacy-masked .value.debt,
  body.privacy-masked .detail-period-total strong,
  body.privacy-masked .detail-period-totals-line strong,
  body.privacy-masked #reportPeriodTotals strong,
  body.privacy-masked .detail-category-total strong,
  body.privacy-masked .row-amount,
  body.privacy-masked .acc-init strong,
  body.privacy-masked .acc-balance,
  body.privacy-masked .ov-income,
  body.privacy-masked .ov-expense,
  body.privacy-masked .budget-summary strong,
  body.privacy-masked .budget-category-meta strong,
  body.privacy-masked .fund-summary strong,
  body.privacy-masked .fund-detail-numbers strong,
  body.privacy-masked .fund-project-stats b,
  body.privacy-masked .fund-project-original strong,
  body.privacy-masked .fund-detail-meta strong,
  body.privacy-masked .fund-result,
  body.privacy-masked .fund-history strong,
  body.privacy-masked #recordAmountVisualText,
  body.privacy-masked #overviewTotal .value {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    position: relative;
    user-select: none;
  }
  body.privacy-masked .stat-balance::after,
  body.privacy-masked #netWorth::after,
  body.privacy-masked .stat .value::after,
  body.privacy-masked .value.debt::after,
  body.privacy-masked .detail-period-total strong::after,
  body.privacy-masked .detail-period-totals-line strong::after,
  body.privacy-masked #reportPeriodTotals strong::after,
  body.privacy-masked .detail-category-total strong::after,
  body.privacy-masked .row-amount::after,
  body.privacy-masked .acc-init strong::after,
  body.privacy-masked .acc-balance::after,
  body.privacy-masked .ov-income::after,
  body.privacy-masked .ov-expense::after,
  body.privacy-masked .budget-summary strong::after,
  body.privacy-masked .budget-category-meta strong::after,
  body.privacy-masked .fund-summary strong::after,
  body.privacy-masked .fund-detail-numbers strong::after,
  body.privacy-masked .fund-project-stats b::after,
  body.privacy-masked .fund-project-original strong::after,
  body.privacy-masked .fund-detail-meta strong::after,
  body.privacy-masked .fund-result::after,
  body.privacy-masked .fund-history strong::after,
  body.privacy-masked #recordAmountVisualText::after,
  body.privacy-masked #overviewTotal .value::after {
    content: "******";
    position: absolute;
    inset: 0;
    color: var(--dark);
    -webkit-text-fill-color: var(--dark);
    white-space: nowrap;
    letter-spacing: .08em;
  }
  body.privacy-masked .income::after,
  body.privacy-masked .ov-income::after { color: var(--income); -webkit-text-fill-color: var(--income); }
  body.privacy-masked .expense::after,
  body.privacy-masked .ov-expense::after { color: var(--expense); -webkit-text-fill-color: var(--expense); }
  body.privacy-masked #chartBox,
  body.privacy-masked #homeTrendChart { filter: blur(6px); user-select: none; }
  .privacy-mask-input-host { position: relative; }
  .privacy-input-mask { position: absolute; z-index: 4; display: flex; align-items: center; overflow: hidden; color: var(--ink); font: inherit; letter-spacing: .08em; white-space: nowrap; pointer-events: none; }
  .detail-category-total { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 11px; text-align: right; }
  .detail-category-total[hidden] { display: none !important; }
  .detail-category-total strong { color: var(--expense); font-size: 14px; font-weight: 700; white-space: nowrap; }
  .detail-category-total strong.income { color: var(--income); }
  .row-category-button { padding: 0; border: 0; background: transparent; color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
  .row-category-button:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; border-radius: 3px; }
  .special-expense-picker .compact-picker-menu { max-height: min(230px, 40vh); }
  .pay-link-picker .compact-picker-trigger,
  .pay-link-picker .compact-picker-option { font-size: 12px; }
  .pay-link-picker .compact-picker-menu { max-height: min(210px, 36vh); }
  .deposit-picker .compact-picker-menu { max-height: min(210px, 36vh); }
  .special-expense-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
  .special-expense-option-main { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; }
  .special-expense-option-title { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .special-expense-option-meta { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .special-expense-option-amount { flex: 0 0 auto; color: var(--expense); font-size: 11px; white-space: nowrap; }
  .investment-panel { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .fund-view[hidden], .fund-weekdays[hidden], .fund-day-field[hidden],
  .fund-form .field[hidden], #fundScheduleFields[hidden], #fundEndHint[hidden], #fundOriginalCostHint[hidden],
  #fundEditHint[hidden], #fundEditButton[hidden], #fundSettingsEditIntro[hidden],
  .fund-day-menu[hidden], .fund-alert[hidden] { display: none !important; }
  .fund-intro { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
  .fund-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; border-radius: 16px; background: #EAF5EF; }
  .fund-summary > div, .fund-detail-numbers > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .fund-summary span, .fund-detail-numbers span { color: #5F706B; font-size: 11px; }
  .fund-summary strong, .fund-detail-numbers strong { color: #225E4E; font-size: clamp(16px, 4vw, 21px); }
  .fund-entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 22px; }
  .fund-entry { position: relative; display: flex; min-height: 94px; padding: 17px 13px; flex-direction: column; align-items: flex-start; gap: 6px; border: 1px solid #DBE6E1; border-radius: 15px; background: #fff; color: var(--ink); font: inherit; text-align: left; }
  .fund-entry:first-child { background: #F5FBF7; }
  .fund-entry:nth-child(2) { background: #FFF9F2; border-color: #F2E4D1; }
  .fund-entry strong { font-size: 17px; }
  .fund-entry span { color: var(--muted); font-size: 11px; }
  .fund-entry b { position: absolute; top: 15px; right: 12px; color: #7E9890; font-size: 22px; font-weight: 400; }
  .fund-section-title { margin: 20px 0 10px; font-size: 15px; }
  .fund-project-card { display: flex; width: 100%; margin-bottom: 9px; padding: 14px; flex-direction: column; gap: 7px; border: 1px solid #E1E9E5; border-radius: 13px; background: #fff; color: var(--ink); font: inherit; text-align: left; }
  .fund-project-top, .fund-project-stats { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .fund-project-top strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .fund-project-top em, .fund-type-label { color: #26785E; font-size: 11px; font-style: normal; white-space: nowrap; }
  .fund-project-platform { color: var(--muted); font-size: 11px; }
  .fund-project-original { color: #60756C; font-size: 11px; }
  .fund-project-stats { border-top: 1px solid #EDF1EF; padding-top: 9px; }
  .fund-project-stats span { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11px; }
  .fund-project-stats b { color: var(--ink); font-size: 15px; }
  .fund-alert { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: #FFF4E6; color: #805D30; font-size: 12px; line-height: 1.5; }
  .fund-empty, .fund-footnote, .fund-hint { color: var(--muted); font-size: 11px; line-height: 1.55; }
  .fund-footnote { margin-top: 18px; }
  .fund-form { max-width: 550px; }
  .fund-form .field { display: flex; min-width: 0; margin: 0 0 12px; flex-direction: column; }
  .fund-form .field-label { margin-bottom: 5px; font-size: 12px; }
  .fund-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .fund-day-trigger, .fund-picker-trigger { width: 100%; min-height: 40px; padding: 7px 10px; border: 1px solid #D5E0DB; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
  .fund-form .fund-native-select { display: none; }
  .fund-picker-field { position: relative; }
  .fund-picker-trigger { overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
  .fund-picker-menu { position: absolute; z-index: 30; top: 100%; left: 0; width: 100%; max-height: min(190px, 32vh); padding: 4px; overflow-y: auto; border: 1px solid #D5E0DB; border-radius: 9px; background: #fff; box-shadow: 0 8px 24px #1D3B3122; }
  .fund-picker-menu[hidden] { display: none !important; }
  .fund-picker-menu button { display: block; width: 100%; min-height: 35px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 12px; text-align: left; }
  .fund-picker-menu button[aria-selected="true"] { background: #EAF5EF; color: #176B57; }
  .fund-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .fund-hint { margin: -3px 0 12px; }
  .fund-weekdays { display: flex; margin: 0 0 12px; padding: 0; border: 0; gap: 5px; }
  .fund-weekdays legend { margin-bottom: 6px; font-size: 12px; }
  .fund-weekdays label { display: flex; min-width: 40px; min-height: 36px; align-items: center; justify-content: center; gap: 3px; border: 1px solid #D9E8E0; border-radius: 8px; font-size: 12px; }
  .fund-weekdays label:has(input:checked) { background: #E8F5EE; color: #19694F; border-color: #92CBB0; }
  .fund-day-field { position: relative; max-width: 170px; }
  .fund-day-trigger { text-align: left; }
  .fund-day-menu { position: absolute; z-index: 30; top: 100%; left: 0; display: grid; width: 230px; max-height: min(190px, 32vh); padding: 6px; grid-template-columns: repeat(5, 1fr); gap: 3px; overflow-y: auto; border: 1px solid #D5E0DB; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px #1D3B3122; }
  .fund-day-menu button { min-height: 33px; border: 0; border-radius: 6px; background: #F4F8F5; color: var(--ink); font-size: 11px; }
  .fund-day-menu button[aria-pressed="true"] { background: #DCEFE4; color: #176B57; font-weight: 700; }
  .fund-day-menu .fund-day-done { grid-column: 1 / -1; background: #EAF5EF; color: #176B57; font-size: 12px; }
  .fund-main-action { width: 100%; margin-top: 5px; }
  .fund-detail-hero { padding: 15px; border-radius: 14px; background: #F3F8F5; }
  .fund-detail-hero h2 { margin: 5px 0; font-size: 21px; }
  .fund-detail-hero p { margin: 4px 0; color: var(--muted); font-size: 12px; }
  .fund-detail-numbers { display: grid; margin: 14px 0; grid-template-columns: 1fr 1fr; gap: 10px; }
  .fund-detail-numbers > div { padding: 12px; border-bottom: 1px solid #DEE7E2; }
  .fund-detail-actions { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
  .fund-text-button { min-height: 42px; padding: 0 8px; border: 0; background: transparent; color: #26785E; font: inherit; }
  .fund-adjust-entry { min-height: 40px; margin: 0 0 8px; padding: 7px 12px; border: 1px solid #A9D5BC; border-radius: 9px; background: #F1FAF4; color: #176B57; font: inherit; font-size: 13px; }
  .fund-settings-name { margin: 10px 0 12px; font-size: 17px; }
  .fund-delete-button { min-height: 42px; padding: 8px 11px; border: 1px solid #D49B98; border-radius: 8px; background: #FFF7F6; color: #A33E38; font: inherit; font-size: 13px; }
  .fund-delete-button[hidden] { display: none !important; }
  .fund-result { margin: 12px 0; padding: 10px; border-radius: 9px; font-weight: 700; }
  .fund-result.gain { background: #FDEEEB; color: #AF4840; }
  .fund-result.loss { background: #EBF6F5; color: #277A78; }
  .fund-history > div { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid #EDF0EE; font-size: 12px; }
  .fund-history > div span { color: var(--muted); }
  .fund-history > div { align-items: center; }
  .fund-history > div strong { margin-left: auto; }
  .fund-record-edit { border: 0; background: transparent; color: var(--expense); padding: 8px; min-height: 44px; font-size: .8125rem; cursor: pointer; }
  .fund-correction-pause { display: flex; align-items: center; gap: 8px; font-size: .875rem; min-height: 44px; }
  .fund-correction-pause[hidden] { display: none !important; }
  .fund-correction-pause input { width: 18px; height: 18px; accent-color: var(--expense); }
  .fund-correction-log { margin-top: 20px; }
  .fund-correction-log summary { cursor: pointer; padding: 12px 0; font-size: .875rem; color: var(--muted); }
  .fund-redeem-name { margin: 4px 0 15px; font-size: 13px; }
  .fund-redeem-choice { display: flex; gap: 8px; margin-bottom: 14px; }
  .fund-redeem-choice label { flex: 1; padding: 10px 6px; border: 1px solid #DCE8E0; border-radius: 9px; font-size: 12px; text-align: center; }
  .fund-redeem-choice label:has(input:checked) { border-color: #8DC9AA; background: #EDF8F1; color: #176B57; }
  .fund-redeem-choice input { margin-right: 3px; }
  @media (max-width: 360px) {
    .home-shortcuts { gap: 5px; }
    .home-shortcut { gap: 4px; padding-right: 3px; padding-left: 3px; font-size: 11px; }
    .home-shortcut-icon { width: 16px; height: 16px; }
    .fund-entry { min-height: 88px; padding: 13px 9px; }
    .fund-entry strong { font-size: 15px; }
  }
  .detail-chart-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
  .detail-chart-toggle { margin-bottom: 8px; }
  .detail-chart-panel {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FAFBFC;
  }
  .detail-chart-panel[hidden] { display: none !important; }
  .detail-chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
  }
  .detail-chart-chip-groups { display: flex; gap: 12px; flex-wrap: wrap; }

  /* 报表分清当前账本图表与跨账本概览，不增加嵌套外框。 */
  .overview-panel { padding: 0 2px 22px; }
  .overview-panel .page-head { margin: -4px -6px 10px; }
  .overview-chart-section,
  .overview-books-section { padding: 15px 14px; border: 0; border-radius: 13px; background: #FFFFFF; }
  .overview-chart-section { margin-top: 0; padding: 0; border-radius: 0; background: transparent; }
  .overview-books-section { margin-top: 12px; }
  .overview-chart-section .detail-chart-controls { display: block; margin-bottom: 10px; }
  .overview-chart-heading h3 { font-size: .9375rem; font-weight: 700; }
  .overview-chart-scope { margin-top: 2px; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
  .overview-chart-section .detail-chart-chip-groups { display: flex; flex-wrap: wrap; gap: 7px 12px; margin-top: 12px; }
  .overview-chart-section .chips { gap: 7px; }
  .overview-chart-section .chip { min-height: 44px; padding: 6px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #66736D; font-size: .875rem; }
  .overview-chart-section .chip.selected { border-bottom-color: var(--expense); background: transparent; color: var(--ink); }
  .overview-chart-section .chip:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; }
  .overview-books-section .subsection-title { margin: 0 0 4px; font-size: 15px; }
  .overview-books-section .acc-row { align-items: flex-start; flex-wrap: wrap; }
  .overview-books-section .acc-main { flex-basis: 135px; overflow-wrap: anywhere; }
  .overview-books-section .acc-balance { max-width: 100%; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .overview-books-section .overview-total .label { display: block; margin-bottom: 4px; }
  .overview-books-section .overview-total .value { display: block; max-width: 100%; overflow-wrap: anywhere; }
  #chartBox { min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
  #chartBox > svg { display: block; max-width: none; }
  #chartBox .chart-legend-item { overflow-wrap: anywhere; }

  /* 报表独立选择时期；横向条形按类别逐行阅读，不缩放文字。 */
  .report-period-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: 8px; margin-top: 12px; }
  .report-period-controls .field, .report-range-fields .field { min-width: 0; margin: 0; }
  .report-period-controls .field-label, .report-range-fields .field-label { margin: 0 0 3px; padding: 0; font-size: .8125rem; }
  #panelOverview .report-period-controls input, #panelOverview .report-range-fields input,
  #reportPeriodPickerBtn { width: 100%; min-width: 0; min-height: 44px; padding: 8px 3px; border: 0; border-bottom: 1px solid #D8E1DB; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: .875rem; }
  #reportPeriodPickerBtn { padding-right: 24px; }
  #reportPeriodPickerMenu .compact-picker-option { min-height: 44px; font-size: .8125rem; }
  #panelOverview .report-period-controls input:focus, #panelOverview .report-range-fields input:focus,
  #reportPeriodPickerBtn:focus-visible { outline: 2px solid #6D9D82; outline-offset: 2px; }
  .report-period-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
  .report-period-actions button, #reportRangeApplyBtn { min-width: 44px; min-height: 44px; padding: 6px 12px; border: 1px solid #DBE5DD; border-radius: 8px; background: #F6F9F6; color: #176B52; font: inherit; font-size: 13px; cursor: pointer; }
  .report-period-actions button:first-child, .report-period-actions button:last-child { font-size: 20px; }
  .report-period-actions button[hidden], .report-period-controls .field[hidden], .report-range-fields[hidden] { display: none !important; }
  .report-range-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: 8px; margin-top: 8px; }
  #reportRangeApplyBtn { grid-column: 1 / -1; justify-self: end; }
  .report-period-msg { margin-top: 6px; color: var(--income); font-size: 12px; }
  .report-period-msg:empty { display: none; }
  .report-period-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 0; margin-top: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .report-period-totals > div { min-width: 0; }
  .report-period-totals span { display: block; color: var(--muted); font-size: 12px; }
  .report-period-totals strong { display: block; font-size: 16px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .report-period-totals .expense { color: var(--expense); }
  .report-period-totals .income { color: var(--income); }
  .report-bar-list { list-style: none; padding: 0; margin: 0; min-width: 0; }
  .report-bar-item { padding: 6px 0; border-bottom: 1px solid #E8ECE8; }
  .report-bar-item:last-child { border: 0; }
  .report-bar-link { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .report-bar-link:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; }
  .report-bar-link:active { opacity: .72; }
  .report-bar-link.report-bar-category { display: flex; min-height: 24px; }
  .report-bar-category { display: flex; align-items: baseline; gap: 6px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
  .report-bar-rank { flex: 0 0 18px; color: var(--muted); font-size: 12px; font-weight: 400; }
  .report-bar-figures { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 7px; margin: 3px 0; }
  .report-bar-type { font-size: 12px; }
  .report-bar-value { font-size: 15px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .report-bar-ratio { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
  .report-bar-track { display: block; position: relative; height: 7px; border-radius: 4px; background: #EFF3EF; overflow: hidden; }
  .report-bar-fill { display: block; height: 100%; border-radius: inherit; }
  .report-bar-fill.kind-expense { background: #2F8F73; }
  .report-bar-fill.kind-income { background: #C65B55; }
  .report-bar-type.kind-expense { color: var(--expense); }
  .report-bar-type.kind-income { color: var(--income); }
  .report-bar-track + .report-bar-figures { margin-top: 6px; }
  .report-bar-track.signed::after { content: ""; position: absolute; top: 0; left: 50%; height: 100%; border-left: 1px solid #64766D; }
  .report-bar-track.signed .report-bar-fill { position: absolute; left: 50%; }
  .report-bar-track.signed .report-bar-fill.negative { left: auto; right: 50%; }
  #panelOverview .report-period-actions button, #reportRangeApplyBtn { font-size: .8125rem; }
  #panelOverview .report-period-actions button:first-child, #panelOverview .report-period-actions button:last-child { font-size: 1.25rem; }
  #panelOverview .report-period-msg, #panelOverview .chart-note { font-size: .8125rem; line-height: 1.5; }
  #panelOverview .report-period-totals span { font-size: .8125rem; }
  #panelOverview .report-period-totals strong { font-size: 1rem; }
  #panelOverview .report-bar-category { font-size: .875rem; }
  #panelOverview .report-bar-rank, #panelOverview .report-bar-type, #panelOverview .report-bar-ratio { font-size: .75rem; }
  #panelOverview .report-bar-ratio { overflow-wrap: anywhere; }
  #panelOverview .report-bar-value { min-width: 0; font-size: .9375rem; }
  .report-pie-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
  .report-pie-layout > svg { justify-self: center; max-width: 100%; }
  #chartBox .chart-legend { min-width: 0; gap: 0; }
  #chartBox .chart-legend-item { align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .8125rem; line-height: 1.5; }
  #chartBox .chart-legend-item > span:last-child { min-width: 0; }
  #chartBox .chart-legend-item .dot { margin-top: 5px; }
  @media (min-width: 600px) { .report-pie-layout { grid-template-columns: 160px minmax(0, 1fr); } }
  body.privacy-masked #chartBox { filter: none; }
  body.privacy-masked #chartBox > * { display: none !important; }
  body.privacy-masked #chartBox::after { content: "金额已隐藏"; display: block; padding: 24px 0; text-align: center; color: var(--muted); font-size: .875rem; }

  /* 账户与设置保留原操作流程，使用清楚标签和轻分隔线。 */
  .account-panel, .settings-panel { padding: 0 2px 22px; }
  .account-panel .page-head, .settings-panel .page-head { margin: -4px -6px 12px; }
  .account-panel .page-head h2, .settings-panel .page-head h2 { margin: 0; }
  .account-panel .page-back, .settings-panel .page-back { min-height: 44px; align-items: center; }
  .settings-section-title { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
  .settings-section, .account-create-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
  .account-panel #accountList, .settings-panel #bookList { padding: 2px 12px; border-radius: 12px; background: #FFFFFF; }
  .account-panel #accountList:empty, .settings-panel #bookList:empty { display: none; }
  .account-panel .acc-row, .settings-panel #bookList .acc-row { flex-wrap: wrap; }
  .account-panel .acc-main, .settings-panel .acc-main { flex-basis: 85px; overflow-wrap: anywhere; }
  .account-panel .acc-name, .settings-panel .acc-name { font-size: 14px; }
  .account-panel .acc-balance { max-width: 100%; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .account-panel .acc-group-label { margin: 10px 0 0; color: #537160; }
  .account-panel .row-action-btn { min-width: 44px; min-height: 44px; }
  .account-empty { padding: 22px 14px; font-size: 13px; text-align: left; }
  .account-empty[hidden] { display: none !important; }
  .account-panel .field, .settings-panel .field { min-width: 0; }
  .account-panel .field-label, .settings-panel .field-label { margin-top: 0; padding-top: 0; font-size: 12px; }
  #panelAccount input, #panelAccount select,
  #panelBook input:not([type="file"]), #panelBook select {
    min-width: 0; min-height: 44px; padding: 9px 2px; border: 0; border-bottom: 1px solid #D8E1DB;
    border-radius: 0; background: transparent; box-shadow: none; font-size: 14px;
  }
  #panelAccount input:focus, #panelAccount select:focus,
  #panelBook input:not([type="file"]):focus, #panelBook select:focus { border-bottom-color: var(--expense); outline: 2px solid #6D9D82; outline-offset: 2px; }
  .settings-panel .backup-actions { flex-wrap: wrap; }
  .settings-panel .backup-actions .btn-ghost { flex: 1 1 112px; }
  .settings-panel .backup-desc { font-size: 12px; line-height: 1.7; }
  .settings-panel .device-lock-settings h3 { font-size: 15px; }
  .settings-panel .device-lock-question-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-panel .acc-msg:empty, .settings-panel .acc-msg:empty { min-height: 0; margin-top: 0; }

  /* 阶段五：专项页面沿用轻底线和紧凑控件，不调整资金或计划规则。 */
  #panelInvestment, #panelFixedIncome { padding: 0 2px 22px; }
  #panelInvestment .page-back, #panelFixedIncome .page-back { min-height: 44px; font-size: .8125rem; }
  #panelInvestment .field-label, #panelFixedIncome .field-label,
  #panelAccount .field-label, #panelBook .field-label { font-size: .8125rem; line-height: 1.5; }
  #panelInvestment .fund-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  #panelInvestment .fund-picker-trigger, #panelInvestment .fund-day-trigger,
  #panelFixedIncome input:not([type="checkbox"]), #panelFixedIncome select,
  #panelFixedIncome .compact-picker-trigger {
    min-width: 0; width: 100%; min-height: 44px; padding: 8px 2px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: transparent; color: var(--ink); font: inherit; font-size: .875rem; line-height: 1.5;
  }
  #panelInvestment input::placeholder, #panelFixedIncome input::placeholder { color: #66736D; }
  #panelInvestment .fund-picker-trigger, #panelInvestment .fund-day-trigger {
    position: relative; padding-right: 22px; overflow: visible; white-space: normal; overflow-wrap: anywhere; font-size: .8125rem;
  }
  #panelInvestment .fund-picker-trigger::after, #panelInvestment .fund-day-trigger::after {
    content: ""; position: absolute; right: 5px; top: calc(50% - 4px); width: 7px; height: 7px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  }
  #panelInvestment [aria-expanded="true"].fund-picker-trigger::after,
  #panelInvestment [aria-expanded="true"].fund-day-trigger::after { transform: rotate(225deg); top: calc(50% - 1px); }
  #panelInvestment input:focus-visible, #panelInvestment button:focus-visible,
  #panelFixedIncome input:focus-visible, #panelFixedIncome select:focus-visible,
  #panelFixedIncome button:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; }
  #panelInvestment .fund-form-row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
  #panelInvestment .fund-picker-menu button, #panelFixedIncome .compact-picker-option { min-height: 44px; font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
  #panelInvestment .fund-day-field { max-width: 100%; }
  #panelInvestment .fund-day-menu { width: min(260px, calc(100vw - 40px)); grid-template-columns: repeat(auto-fit, minmax(2.75rem, 1fr)); }
  #panelInvestment .fund-day-menu button { min-height: 44px; font-size: .8125rem; }
  #panelInvestment .fund-weekdays { flex-wrap: wrap; }
  #panelInvestment .fund-weekdays legend, #panelInvestment .fund-weekdays label { font-size: .8125rem; }
  #panelInvestment .fund-weekdays label { min-width: 44px; min-height: 44px; }
  #panelInvestment .fund-hint, #panelInvestment .fund-empty, #panelInvestment .fund-footnote,
  #panelInvestment .fund-intro, #panelInvestment .fund-alert,
  #panelFixedIncome .backup-desc { font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
  #panelInvestment .fund-summary, #panelInvestment .fund-detail-numbers { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
  #panelInvestment .fund-summary { padding: 12px; border-radius: 12px; }
  #panelInvestment .fund-summary span, #panelInvestment .fund-detail-numbers span { font-size: .75rem; }
  #panelInvestment .fund-summary strong, #panelInvestment .fund-detail-numbers strong { font-size: 1.25rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-entry-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 8px; margin: 12px 0 16px; }
  #panelInvestment .fund-entry { min-height: 80px; padding: 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 8px; }
  #panelInvestment .fund-entry strong { padding-right: 18px; font-size: 1rem; }
  #panelInvestment .fund-entry span { font-size: .75rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-project-card { padding: 12px 2px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
  #panelInvestment .fund-project-top, #panelInvestment .fund-project-stats { flex-wrap: wrap; }
  #panelInvestment .fund-project-top strong { min-width: 0; white-space: normal; font-size: .9375rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-project-platform, #panelInvestment .fund-project-original,
  #panelInvestment .fund-project-top em { font-size: .75rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-project-stats span { min-width: 0; flex: 1 1 8rem; font-size: .75rem; }
  #panelInvestment .fund-project-stats b { font-size: .9375rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-detail-hero { padding: 12px; border-radius: 12px; }
  #panelInvestment .fund-detail-hero h2 { font-size: 1.125rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-detail-hero p, #panelInvestment .fund-history > div { font-size: .8125rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-history > div { flex-wrap: wrap; gap: 4px 12px; }
  #panelInvestment .fund-history strong { max-width: 100%; overflow-wrap: anywhere; }
  #panelInvestment .fund-detail-actions, #panelInvestment .fund-redeem-choice { flex-wrap: wrap; gap: 8px; }
  #panelInvestment .fund-redeem-choice label { min-height: 44px; min-width: 7rem; font-size: .8125rem; }
  #panelInvestment .fund-text-button, #panelInvestment .fund-adjust-entry, #panelInvestment .fund-delete-button { min-height: 44px; font-size: .8125rem; }
  #panelInvestment .fund-settings-name { font-size: 1rem; overflow-wrap: anywhere; }
  #panelInvestment .fund-section-title, #panelFixedIncome h3 { font-size: .9375rem; }
  #panelInvestment .fund-redeem-name { font-size: .875rem; overflow-wrap: anywhere; }
  #panelFixedIncome .field-row, #panelAccount .field-row, #panelBook .field-row { flex-wrap: wrap; }
  #panelFixedIncome .field-row > .field, #panelAccount .field-row > .field, #panelBook .field-row > .field { flex: 1 1 9rem; min-width: 0; }
  #panelFixedIncome #fixedIncomeAccount, #panelFixedIncome .compact-picker-trigger { font-size: .8125rem; }
  #panelFixedIncome .fixed-income-enabled { min-height: 44px; line-height: 1.5; }
  #panelFixedIncome .fixed-income-actions button { min-height: 44px; }
  #panelAccount input, #panelAccount select, #panelBook input:not([type="file"]), #panelBook select { font-size: .875rem; }
  #panelAccount .acc-name, #panelAccount .acc-balance, #panelBook .acc-name { font-size: .875rem; }
  #panelAccount .acc-init, #panelAccount .acc-group-label, #panelBook .backup-desc { font-size: .8125rem; overflow-wrap: anywhere; }
  #panelBook .settings-section-title, #panelBook .device-lock-toggle h3 { font-size: .9375rem; }
  #panelBook .device-lock-question-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
  #panelInvestment .form-msg, #panelFixedIncome .form-msg, #panelAccount .acc-msg, #panelBook .acc-msg { min-height: 0; font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
  #panelInvestment .form-msg:empty, #panelFixedIncome .form-msg:empty, #panelAccount .acc-msg:empty, #panelBook .acc-msg:empty { display: none; }

  /* ===== 快速记账的主要操作层级 ===== */
  .record-panel,
  .detail-panel {
    padding: 0 2px 22px;
    margin-top: -6px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .record-panel .page-head,
  .detail-panel .page-head {
    margin: -4px -6px 10px;
  }
  .record-type-field { margin-bottom: 8px; }
  .record-category-field { margin-bottom: 10px; }
  .record-type-field .chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding: 2px 0 6px;
    scrollbar-width: none;
  }
  .record-type-field .chips::-webkit-scrollbar { display: none; }
  .record-type-field .chip {
    flex: 0 0 auto;
    min-width: 48px;
    min-height: 44px;
    padding: 7px 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
  }
  .record-type-field .chip-add {
    color: var(--dark);
    background: #F2F7F5;
    white-space: nowrap;
  }
  .category-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 8px 2px 9px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
  }
  .category-picker-trigger:focus-visible,
  .category-picker-trigger[aria-expanded="true"] {
    outline: none;
    border-bottom-color: var(--expense);
  }
  .category-picker-current { font-weight: 600; }
  .category-picker-placeholder { color: var(--muted); }
  .category-picker-arrow {
    margin-left: auto;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
  }
  .category-picker-trigger .category-icon {
    width: 21px;
    height: 21px;
  }
  .record-amount-expression[hidden] { display: none !important; }
  .record-amount-expression {
    min-height: 18px;
    color: #687779;
    font-size: 12px;
    line-height: 18px;
    letter-spacing: .02em;
    text-align: left;
    font-variant-numeric: tabular-nums;
  }
  .record-supporting-fields {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .record-panel .record-supporting-fields .field-row { gap: 10px; }
  .record-panel .record-supporting-fields .field-row .field-label { margin-bottom: 5px; }
  .record-supporting-fields .field:last-child,
  .record-supporting-fields .field-row:last-child { margin-bottom: 4px; }
  /* 录入页只用细分隔线组织字段，避免与类别的无边框样式割裂。 */
  #panelRecord .record-supporting-fields .account-picker-trigger,
  #panelRecord .record-supporting-fields input[type="text"],
  #panelRecord .record-supporting-fields input[type="date"] {
    min-height: 46px;
    padding: 9px 2px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  #panelRecord .record-supporting-fields .account-picker-trigger:focus-visible,
  #panelRecord .record-supporting-fields .account-picker-trigger[aria-expanded="true"],
  #panelRecord .record-supporting-fields input[type="text"]:focus,
  #panelRecord .record-supporting-fields input[type="date"]:focus {
    outline: none;
    border-bottom: 2px solid var(--expense);
    background: transparent;
  }

  /* ===== 记账类别选择弹层 ===== */
  .record-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(22, 33, 29, .38);
  }
  .record-picker-backdrop[hidden] { display: none !important; }
  .record-picker-dialog {
    width: min(680px, 100%);
    max-height: min(78vh, 680px);
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 18px 18px 0 0;
    background: var(--card);
    box-shadow: 0 -12px 36px rgba(30, 34, 39, .18);
  }
  .record-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
  }
  .record-picker-head h2 { margin: 0; font-size: 18px; }
  .record-picker-close {
    padding: 5px 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }
  .record-picker-hint {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
  }
  .category-picker-manage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    gap: 10px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid #CBE5DB;
    border-radius: 11px;
    background: #F0F8F4;
    color: #176B52;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .category-picker-manage strong,
  .category-picker-manage small { display: block; }
  .category-picker-manage strong { font-size: 14px; }
  .category-picker-manage small { margin-top: 2px; color: #5A766C; font-size: 11px; }
  .category-picker-manage > span:last-child { font-size: 23px; line-height: 1; }
  .category-picker-manage:focus-visible { outline: 2px solid #147D5A; outline-offset: 2px; }

  /* ===== 自定义类别系统：独立页面，按大类折叠管理 ===== */
  .category-system-page { min-height: 70vh; padding: 0 2px 24px; background: transparent; }
  .category-system-head { margin: 0 2px 12px; grid-template-columns: auto minmax(0, 1fr); }
  .category-system-head h2 { font-size: 1rem; overflow-wrap: anywhere; }
  .category-system-head .page-back { min-height: 44px; font-size: .8125rem; white-space: nowrap; }
  .category-system-head .page-head-spacer { display: none; }
  .category-system-intro {
    margin: 0 0 12px;
    padding: 0 2px;
    color: #52645B;
    font-size: .8125rem;
    line-height: 1.5;
  }
  .category-system-create,
  .category-system-group {
    border: 1px solid #E5E9E2;
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: 0 2px 7px rgba(37, 57, 46, .035);
    transition: border-color 180ms ease, box-shadow 180ms ease;
  }
  .category-system-create { padding: 14px; }
  .category-system-create[hidden] { display: none !important; }
  .category-system-create > label,
  .category-system-sub-label { display: block; font-size: 14px; font-weight: 700; }
  .category-system-create-row { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 8px; margin-top: 8px; }
  .category-system-create-row input,
  .category-system-sub-input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; font-size: 14px; }
  .category-system-create-row .btn-primary,
  .category-system-sub-submit { min-height: 44px; padding: 8px; font-size: 14px; }
  .category-system-choice-label { margin: 12px 0 6px; color: var(--muted); font-size: 12px; }
  .category-system-icon-choices {
    min-width: 0;
    --icon-accent: #397A6E;
    --icon-bg: #F1F8F5;
  }
  .category-system-icon-picker { --icon-accent: #397A6E; --icon-bg: #F1F8F5; }
  .category-system-icon-choices[data-icon-group="food"] { --icon-accent: #BD6046; --icon-bg: #FFF2EC; }
  .category-system-icon-choices[data-icon-group="travel"] { --icon-accent: #3672A8; --icon-bg: #EFF6FD; }
  .category-system-icon-choices[data-icon-group="living"] { --icon-accent: #916C2F; --icon-bg: #FCF7E9; }
  .category-system-icon-choices[data-icon-group="leisure"] { --icon-accent: #7658A1; --icon-bg: #F5F0FC; }
  .category-system-icon-choices[data-icon-group="money"] { --icon-accent: #237A61; --icon-bg: #EDF7F1; }
  .category-system-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
    gap: 5px;
    max-height: 214px;
    overflow-y: auto;
    padding: 2px 1px 5px;
  }
  .category-system-icon-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 58px;
    padding: 5px 2px;
    border: 1px solid #E2EAE7;
    border-radius: 10px;
    background: var(--icon-bg);
    color: var(--icon-accent);
    font: inherit;
    cursor: pointer;
  }
  .category-system-icon-choice.selected { border-color: var(--icon-accent); box-shadow: inset 0 0 0 1px var(--icon-accent); }
  .category-system-icon-group-title { grid-column: 1 / -1; padding: 4px 2px 1px; color: var(--muted); font-size: 11px; }
  .category-system-icon-name { max-width: 100%; color: inherit; font-size: .75rem; line-height: 1.3; overflow-wrap: anywhere; }
  .category-system-icon-choice:focus-visible { outline: 2px solid var(--icon-accent); outline-offset: 2px; }
  .category-system-icon-choice svg,
  .category-system-group-icon svg,
  .category-system-item-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .category-system-color-choices { display: flex; gap: 8px; }
  .category-system-color-choice {
    width: 42px;
    height: 42px;
    border: 5px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #E2EAE7;
    cursor: pointer;
  }
  .category-system-color-choice.selected { box-shadow: 0 0 0 2px #24484F; }
  .category-system-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 10px; padding-bottom: 9px; border-bottom: 1px solid #E4E9E2; }
  .category-system-side-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; margin: 2px 0 14px; border: 1px solid #E6EAE4; border-radius: 12px; background: #EDEFEA; }
  .category-system-side-button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: #68736C; font: inherit; font-size: 13px; cursor: pointer; transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease; }
  .category-system-side-button.selected { background: #FFFFFF; color: var(--dark); box-shadow: 0 1px 4px rgba(36,72,79,.10); font-weight: 650; }
  .category-system-side-button[data-category-system-side="expense"].selected { color: var(--expense); }
  .category-system-side-button[data-category-system-side="income"].selected { color: var(--income); }
  .category-system-list-head h3 { font-size: 16px; }
  .category-system-list-head span { display: block; color: var(--muted); font-size: 12px; }
  .category-system-add-toggle { min-height: 40px; padding: 8px 12px; border: 1px solid #C7DCD1; border-radius: 10px; background: #EAF3EC; color: #176B52; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: background-color 160ms ease, transform 160ms ease; }
  .category-system-add-toggle:active { transform: scale(.98); background: #DFEEE4; }
  .category-system-add-toggle { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; }
  .category-system-add-chevron { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .category-system-add-toggle[aria-expanded="true"] .category-system-add-chevron { transform: rotate(180deg); }
  .category-system-create { margin-bottom: 10px; }
  .category-system-groups { display: grid; gap: 0; }
  .category-system-group { overflow: hidden; border: 0; border-bottom: 1px solid #E3E8E0; border-radius: 0; background: transparent; box-shadow: none; }
  .category-system-group.expanded { border-color: #CCDCCF; background: var(--group-bg); box-shadow: none; }
  .category-system-group-head { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; padding: 0 8px; }
  .category-system-group-toggle {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    max-width: calc(100% - 3rem);
    min-width: 0;
    min-height: 56px;
    gap: 8px;
    padding: 7px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .category-system-group-toggle:active { background: #F7F9F6; }
  .category-system-group-icon {
    display: inline-flex;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--group-bg);
    color: var(--group-color);
  }
  .category-system-group-name { min-width: 0; font-size: .9375rem; overflow-wrap: anywhere; }
  .category-system-group-rename-inline { flex: 0 0 auto; min-height: 44px; margin-left: 3px; padding: 5px 6px; border: 0; background: transparent; color: #537160; font: inherit; font-size: .75rem; cursor: pointer; }
  .category-system-group-meta { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; min-height: 44px; margin-left: auto; padding: 0 0 0 4px; border: 0; background: transparent; color: var(--muted); font: inherit; white-space: nowrap; cursor: pointer; }
  .category-system-group-count { color: var(--muted); font-size: .75rem; white-space: nowrap; }
  .category-system-chevron { margin-left: 3px; color: var(--muted); font-size: 18px; }
  .category-system-group-rename-inline:focus-visible,
  .category-system-group-meta:focus-visible { outline: 2px solid var(--group-color); outline-offset: 1px; border-radius: 6px; }
  .category-system-group-actions { display: flex; gap: 6px; padding: 0 8px 7px; }
  .category-system-small-btn {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid #DCE8E4;
    border-radius: 9px;
    background: #F8FBFA;
    color: #365C53;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
  }
  .category-system-small-btn.danger { margin-left: auto; border-color: #F0D8D8; background: #FFF7F7; color: #A64646; }
  .category-system-small-btn:disabled { opacity: .35; cursor: default; }
  .category-system-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.75rem, 1fr)); gap: 4px 0; padding: 0 5px 8px; }
  .category-system-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  .category-system-item:active { cursor: grabbing; }
  .category-system-item-icon { display: inline-flex; width: 44px; height: 44px; flex: 0 0 44px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--group-color); cursor: pointer; }
  .category-system-item-icon svg { width: 20px; height: 20px; }
  .category-system-item-icon:focus-visible { outline: 2px solid var(--group-color); outline-offset: 0; border-radius: 8px; }
  .category-system-item-name {
    display: block;
    width: 100%;
    min-height: 0;
    font-size: .75rem;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: anywhere;
  }
  .category-system-item-actions { position: absolute; top: 1px; right: 2px; display: flex; gap: 1px; }
  .category-system-rename-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: 0 8px 7px; padding: 7px 8px; border: 0; border-radius: 8px; background: #EEF3ED; }
  .category-system-rename-label { grid-column: 1 / -1; color: #53675B; font-size: 11px; font-weight: 600; }
  .category-system-rename-input { width: 100%; min-width: 0; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font: inherit; font-size: 13px; }
  .category-system-rename-actions { display: flex; justify-content: flex-end; gap: 5px; }
  .category-system-rename-save, .category-system-rename-cancel { min-height: 36px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
  .category-system-rename-save { border-color: #BBD9CD; background: #EDF7F3; color: #176B52; }
  .category-system-remove {
    width: 23px;
    height: 23px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #A64646;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .category-system-remove:active { background: #EEF5F2; }
  .category-system-drag-source { border-color: #5AAC8C; background: #F2FAF5; opacity: .62; }
  .category-system-group.category-system-drag-source > :not(.category-system-group-head) { display: none; }
  .category-system-drag-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    width: 220px;
    min-height: 48px;
    padding: 9px 14px;
    border: 1px solid #67B496;
    border-radius: 12px;
    background: #F3FBF6;
    box-shadow: 0 10px 26px rgba(36, 72, 79, .2);
    color: #1C654D;
    font-size: 15px;
    font-weight: 700;
    pointer-events: none;
    will-change: transform;
    animation: category-sort-appear 120ms ease-out;
  }
  @keyframes category-sort-appear { from { opacity: .45; } to { opacity: 1; } }
  .category-system-drag-ghost.item {
    flex-direction: column;
    justify-content: center;
    width: 64px;
    min-height: 62px;
    gap: 3px;
    padding: 7px 3px;
    font-size: 11px;
    text-align: center;
  }
  .category-system-drag-ghost.item .category-system-item-icon { width: 24px; height: 24px; flex-basis: 24px; pointer-events: none; }
  .category-system-sub-form { padding: 10px 12px 12px; background: transparent; }
  .category-system-sub-form[hidden] { display: none !important; }
  .category-system-sub-toggle { display: flex; align-items: center; justify-content: space-between; width: calc(100% - 16px); min-height: 42px; margin: 2px 8px 6px; padding: 6px 8px; border: 0; border-top: 1px solid rgba(56, 87, 66, .16); border-radius: 0; background: transparent; color: #176B52; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
  .category-system-sub-chevron { color: #537160; font-size: 20px; line-height: 1; }
  .detail-load-more { display: block; width: min(100% - 24px, 360px); min-height: 44px; margin: 14px auto 22px; padding: 8px 12px; border: 1px solid #D9E4DD; border-radius: 10px; background: #FFFFFF; color: #176B52; font: inherit; font-size: 13px; cursor: pointer; }
  .detail-load-more[hidden] { display: none !important; }
  .category-system-sub-form-actions { display: flex; gap: 8px; margin-top: 9px; }
  .category-system-sub-form-actions button { flex: 1; min-height: 42px; }
  .category-system-sub-input { margin-top: 8px; }
  .category-system-sub-form .category-system-choice-label { margin-top: 10px; }
  .category-system-sub-submit { margin-top: 0; }
  .category-system-icon-picker .category-system-icon-choice-grid { max-height: min(38dvh, 300px); }
  .category-item-edit-backdrop[hidden] { display: none !important; }
  .category-item-edit-backdrop { position: fixed; z-index: 1100; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(22, 35, 29, .38); }
  body.category-item-editor-open { overflow: hidden; }
  body.category-item-editor-open .confirm-dialog-backdrop { z-index: 1200; }
  .category-item-edit-sheet { width: min(100%, 520px); max-height: min(88vh, 720px); max-height: min(88dvh, 720px); overflow-y: auto; padding: 16px 16px calc(8px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: #FFFFFF; box-shadow: 0 -8px 28px rgba(24, 45, 36, .16); overscroll-behavior: contain; }
  .category-item-edit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .category-item-edit-heading h2 { margin: 0; font-size: 1.125rem; }
  .category-item-edit-heading p { margin: 4px 0 0; color: var(--muted); font-size: .8125rem; }
  .category-item-edit-name-label { display: block; margin-top: 12px; color: #54665C; font-size: .8125rem; font-weight: 600; }
  #categoryItemEditNameInput { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 2px; border: 0; border-bottom: 1px solid #DDE5DC; border-radius: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1rem; }
  #categoryItemEditNameInput:focus { outline: 2px solid #6D9D82; outline-offset: 1px; border-color: #6D9D82; background: #FFFFFF; }
  .category-item-edit-close { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: #F3F5F2; color: #53635B; font-size: 23px; line-height: 1; cursor: pointer; }
  .category-item-edit-note { margin: 8px 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
  .category-item-edit-status { margin: 8px 0 0; color: #A72F3C; font-size: .8125rem; line-height: 1.5; }
  .category-item-edit-status:empty { display: none; }
  .category-item-edit-actions { position: sticky; bottom: -8px; display: flex; gap: 8px; margin-top: 8px; padding: 8px 0; background: #FFFFFF; }
  .category-item-edit-actions button { display: block; flex: 1; width: auto; min-width: 0; min-height: 44px; margin: 0; font-size: .875rem; }
  .category-item-edit-delete { display: block; width: 100%; min-height: 44px; padding: 6px; border: 0; background: transparent; color: #A72F3C; font: inherit; font-size: .8125rem; }
  .category-item-edit-sheet button:disabled { opacity: .6; cursor: wait; }
  .category-item-edit-sheet button:focus-visible { outline: 2px solid var(--expense); outline-offset: 2px; }
  .category-system-icon-choice-grid { scrollbar-gutter: stable; }
  #panelCategorySystem .category-system-side-button,
  #panelCategorySystem .category-system-add-toggle,
  #panelCategorySystem .category-system-sub-toggle { min-height: 44px; font-size: .8125rem; }
  #panelCategorySystem .category-system-sub-input,
  #panelCategorySystem .category-system-create-row input { font-size: .875rem; }
  @media (max-width: 380px) {
    .category-system-list-head { flex-wrap: wrap; }
  }
  .category-system-empty { grid-column: 1 / -1; padding: 14px; color: var(--muted); font-size: 13px; }
  .category-system-restore { display: block; margin: 16px auto 0; padding: 8px 12px; border: 0; background: transparent; color: #5F7570; font: inherit; font-size: 12px; cursor: pointer; }
  .category-system-page button:focus-visible { outline: 2px solid #147D5A; outline-offset: 2px; }
  .category-picker-section {
    margin-top: 16px;
  }
  .category-picker-section:first-child { margin-top: 0; }
  .category-picker-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }
  .category-picker-section-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--ink);
  }
  .category-picker-section-title strong { font-size: 14px; }
  .category-picker-section-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }
  .category-picker-section-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .category-picker-section-hint { color: var(--muted); font-size: 11px; }
  .category-picker-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  /* 弹层本身纵向排列分组，只有每个分组内部使用三列小项网格。 */
  #categoryPickerOptions.category-picker-options {
    display: block;
  }
  .category-picker-section.recent .category-picker-options {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .category-picker-section.recent .category-picker-options::-webkit-scrollbar { display: none; }
  .category-picker-section.recent .category-picker-option { flex: 0 0 auto; min-width: 86px; }
  .category-picker-empty {
    margin: 0;
    padding: 8px 0 2px;
    color: var(--muted);
    font-size: 12px;
  }
  .category-picker-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 50px;
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--category-bg, #FAFBFC);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
  }
  .category-picker-option:hover,
  .category-picker-option:focus-visible,
  .category-picker-option.selected {
    outline: none;
    border-color: var(--category-color, var(--expense));
    background: #FFFFFF;
  }
  .category-picker-option:active { transform: scale(.98); }
  .category-picker-option .category-icon {
    color: var(--category-color, var(--expense));
  }
  .category-picker-option .category-icon { width: 20px; height: 20px; }
  .category-picker-delete {
    position: absolute;
    top: 3px;
    right: 6px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
  }
  .category-picker-add {
    border-style: dashed;
    color: var(--category-color, var(--expense));
    background: var(--category-bg, transparent);
  }
  .category-picker-custom-action { margin-top: 16px; }
  .category-picker-custom-action .category-picker-option { width: 100%; min-height: 42px; }

  /* 兼容旧版录入页的类别网格规则，避免其它页面被新弹层样式影响。 */
  .record-category-field .chip {
    min-height: 44px;
    padding: 8px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
  }
  .category-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }
  .category-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .custom-category-icon-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
  }
  .custom-category-icon-field .category-system-icon-choices { width: 100%; }
  @media (min-width: 520px) {
    .record-type-field .chips,
    .record-category-field .chips {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }

  input[type="number"], input[type="text"], input[type="date"],
  input[type="email"], input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    color: var(--ink);
    background: #FAFBFC;
  }
  input:focus {
    outline: none;
    border-color: var(--ink);
    background: #fff;
  }
  input[type="number"] {
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
    font-variant-numeric: tabular-nums;
  }

  /* ===== 记一笔专用数字键盘 ===== */
  html { scroll-padding-bottom: var(--record-keyboard-space, 0px); }
  body.record-keyboard-open { padding-bottom: var(--record-keyboard-space, calc(380px + env(safe-area-inset-bottom))); }
  /* 记一笔没有底部导航，不再预留导航空位；金额键盘仍按实际高度避让。 */
  body.record-page-open:not(.record-keyboard-open) { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  body.record-page-open #panelRecord { padding-bottom: 0; margin-bottom: 0; }
  #panelRecord .form-msg:empty { display: none; }
  body.record-keyboard-open #panelRecord > #saveBtn,
  body.record-keyboard-open #panelRecord > #cancelBtn { display: none !important; }
  .record-keyboard[hidden] { display: none !important; }
  .record-keyboard {
    position: fixed;
    z-index: 900;
    left: 50%;
    bottom: 0;
    width: min(680px, 100%);
    transform: translateX(-50%);
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #F7FAF8;
    box-shadow: 0 -4px 16px rgba(36, 72, 79, .09);
    max-height: min(calc(100vh - 56px), var(--record-keyboard-max-height, 100vh));
    max-height: min(calc(100dvh - 56px), var(--record-keyboard-max-height, 100dvh));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .record-keyboard-toolbar {
    display: flex;
    justify-content: flex-end;
    min-height: 32px;
    padding: 0 2px;
  }
  .record-panel .record-amount-field {
    min-width: 0;
    margin: 0 0 16px;
    padding: 6px 0 8px;
    border-bottom: 1px solid #B8CFC3;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .record-panel .record-amount-field:focus-within { border-bottom-color: var(--expense); }
  .record-panel .record-amount-field .field-label {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 17px;
  }
  .record-panel .record-amount-value-line {
    position: relative;
    min-height: 44px;
    overflow: hidden;
  }
  #panelRecord .record-amount-field input,
  #panelRecord .record-amount-field input:focus {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    opacity: 0;
  }
  .record-panel .record-amount-visual {
    display: flex;
    align-items: center;
    min-height: 44px;
    overflow: hidden;
    color: var(--ink);
    font-size: clamp(24px, 6.5vw, 28px);
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    user-select: none;
  }
  .record-panel .record-amount-visual-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .record-panel .record-amount-visual.is-empty .record-amount-visual-text {
    color: #8A9597;
    font-size: 20px;
    font-weight: 500;
  }
  .record-panel .record-amount-caret {
    flex: 0 0 2px;
    height: 26px;
    margin-left: 3px;
    border-radius: 1px;
    background: #147D5A;
    animation: record-amount-caret-blink 1s step-end infinite;
  }
  .record-panel .record-amount-visual.is-empty .record-amount-caret {
    order: -1;
    margin-right: 3px;
    margin-left: 0;
  }
  @keyframes record-amount-caret-blink {
    50% { opacity: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .record-panel .record-amount-caret { animation: none; }
  }
  .record-keyboard-layout {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 64px;
    gap: 4px;
  }
  .record-keyboard-types,
  .record-keyboard-operators {
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 3px;
  }
  .record-keyboard-numbers {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }
  .record-keyboard button {
    min-height: 54px;
    border: 1px solid #E0E7E7;
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--ink);
    font: inherit;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .record-keyboard button:active { transform: scale(.97); }
  .record-keyboard .record-keyboard-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
  }
  .record-keyboard-types button {
    border: 0;
    border-right: 3px solid transparent;
    border-radius: 6px;
    background: #F0F4F4;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.25;
  }
  .record-keyboard-types button[aria-pressed="true"] {
    border-right-color: var(--expense);
    background: #EAF7F1;
    color: var(--ink);
    font-weight: 700;
  }
  .record-keyboard-types button[data-record-keyboard-type="收入"][aria-pressed="true"] {
    border-right-color: var(--income);
    background: #FBE9E8;
  }
  .record-keyboard-side-space { display: block; }
  .record-keyboard-operators button {
    background: #F0F4F4;
    font-size: 21px;
  }
  .record-keyboard-operators .record-keyboard-confirm {
    border-color: #E89B62;
    background: #F3A568;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
  }
  .record-keyboard button:focus-visible {
    outline: 3px solid rgba(20, 125, 90, .28);
    outline-offset: 1px;
  }
  @media (max-height: 650px) {
    .record-keyboard button:not(.record-keyboard-handle) { min-height: 46px; }
  }

  /* ===== 可点选的"按钮块"（类型、类别） ===== */
  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .chip {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;         /* 胶囊形 */
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    font-family: inherit;
  }
  .chip:hover { border-color: var(--ink); }
  .chip.selected {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
  }
  /* 收入和支出选中时，用红/绿强化含义 */
  .chip.selected.chip-income { background: var(--income); border-color: var(--income); }
  .chip.selected.chip-expense { background: var(--expense); border-color: var(--expense); }
  .record-type-field .chip.selected,
  .record-type-field .chip.selected:hover {
    border: 0;
    border-bottom: 2px solid var(--expense);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
  }
  .record-type-field .chip.selected.chip-income,
  .record-type-field .chip.selected.chip-income:hover {
    border-bottom-color: var(--income);
  }
  /* 记一笔阶段二：普通与专项录入共用轻分隔，不影响其他专项页面。 */
  #panelRecord .field { min-width: 0; margin-bottom: 12px; }
  #panelRecord .field-label { margin-bottom: 4px; font-size: .8125rem; line-height: 1.5; }
  #panelRecord input[type="text"]:not(#amount),
  #panelRecord input[type="date"],
  #panelRecord .compact-picker-trigger,
  #panelRecord .account-picker-trigger {
    min-width: 0;
    min-height: 44px;
    padding: 8px 2px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-size: .875rem;
    line-height: 1.5;
  }
  #panelRecord input::placeholder { color: #66736D; }
  #panelRecord .compact-picker-trigger:not(.has-value),
  #panelRecord .account-picker-trigger:not(.has-value) { color: #66736D; }
  #panelRecord .compact-picker-option,
  #panelRecord .account-picker-option { min-height: 44px; font-size: .8125rem; line-height: 1.5; }
  #panelRecord .compact-picker-menu,
  #panelRecord .account-picker-menu { max-height: min(240px, 38vh); }
  #panelRecord .record-type-field { margin-bottom: 8px; }
  #panelRecord .record-type-field .chip { font-size: .875rem; border-bottom: 2px solid transparent; }
  #panelRecord .record-type-field .chip.selected { border-bottom-color: var(--expense); }
  #panelRecord .record-type-field .chip.selected.chip-income { border-bottom-color: var(--income); }
  #panelRecord .category-picker-trigger { font-size: 1rem; min-height: 48px; }
  #panelRecord .record-amount-field { margin-bottom: 16px; }
  #panelRecord .record-amount-visual {
    overflow: visible;
    white-space: normal;
    font-size: clamp(1.5rem, 6.5vw, 1.75rem);
  }
  #panelRecord .record-amount-visual-text { min-width: 0; overflow: visible; overflow-wrap: anywhere; }
  #panelRecord .record-amount-visual.is-empty .record-amount-visual-text { color: #66736D; font-size: 1.25rem; }
  #panelRecord .record-amount-expression { font-size: .75rem; line-height: 1.5; overflow-wrap: anywhere; }
  body.privacy-masked #panelRecord .record-amount-expression { visibility: hidden; }
  #panelRecord input:focus-visible,
  #panelRecord .account-picker-trigger:focus-visible,
  #panelRecord .compact-picker-trigger:focus-visible,
  #panelRecord .category-picker-trigger:focus-visible {
    outline: 2px solid var(--expense); outline-offset: 2px;
  }
  #panelRecord [aria-invalid="true"] { border-bottom-color: #A72F3C; }
  #panelRecord .record-field-error { margin: 5px 0 0; color: #A72F3C; font-size: .8125rem; line-height: 1.5; }
  #panelRecord .record-keyboard button { font-size: 1.25rem; }
  #panelRecord .record-keyboard-types button { font-size: .875rem; }
  #panelRecord .record-keyboard-confirm { color: #3E2B1E; font-size: 1rem; }
  #panelRecord .record-keyboard button:active { transform: none; background: #E6EDE8; }
  #panelRecord .record-keyboard-confirm:active { background: #E89B62; }
  @media (max-width: 380px) {
    #panelRecord .field-row { flex-wrap: wrap; }
    #panelRecord .field-row > .field { flex: 1 1 150px; }
  }
  /* 展开/收起、自定义新增 */
  .chip-toggle { color: var(--muted); border-style: dashed; }
  .chip-add { color: var(--expense); border-style: dashed; font-weight: 600; }
  .custom-add { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
  .custom-add input { flex: 1; }
  .custom-add .mini-btn { padding: 8px 14px; white-space: nowrap; }
  .custom-side { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
  .custom-side-label { font-size: 13px; color: var(--muted); }
  .custom-side-chip { padding: 5px 12px; font-size: 13px; }
  .chip-del { margin-left: 6px; font-weight: 700; color: #B9BEC6; line-height: 1; }
  .chip-del:hover { color: var(--income); }
  .chip.selected .chip-del { color: rgba(255,255,255,0.85); }

  /* ===== 按钮 ===== */
  .btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--dark);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
  }
  .btn-primary:hover { opacity: 0.92; }
  .btn-ghost {
    display: none;               /* 默认隐藏，编辑时才出现 */
    margin-top: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
  }
  .form-msg {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    color: var(--expense);
    min-height: 20px;
  }
  .form-msg:empty {
    min-height: 0;
    padding: 0;
    border-color: transparent;
    background: transparent;
  }
  .form-msg.success { color: var(--expense); background: #E4F2EC; border-color: #BFE0CF; }
  .form-msg.local { color: #704B00; background: #FFF7E6; border-color: #F0D69A; }
  .form-msg.error, .form-msg.conflict { color: var(--income); background: #FBE9E8; border-color: #F0C7C5; }
  .form-msg.info, .form-msg.busy { color: var(--muted); background: #F4F5F6; border-color: var(--line); }

  /* ===== 应用内确认框：统一中文按钮并阻止背景继续滚动 ===== */
  body.dialog-open, body.calendar-open { overflow: hidden; }
  .compact-calendar-overlay { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgba(24, 38, 35, .3); }
  .compact-calendar-overlay[hidden] { display: none; }
  .compact-calendar { display: flex; flex-direction: column; width: min(100%, 360px); max-height: min(80vh, 520px); max-height: min(80dvh, 520px); overflow: hidden; padding: 12px; border-radius: 14px; background: #fff; color: var(--ink); }
  .compact-calendar-head, .compact-calendar-nav, .compact-calendar-actions { display: flex; align-items: center; gap: 4px; }
  .compact-calendar-head { justify-content: space-between; }
  .compact-calendar-head h2 { font-size: .875rem; margin: 0; overflow-wrap: anywhere; }
  .compact-calendar button { font-family: inherit; cursor: pointer; }
  .compact-calendar button:disabled { color: #8B9390; cursor: default; }
  .compact-calendar-head button, .compact-calendar-nav button, .compact-calendar-grid button { border: 0; background: transparent; color: var(--ink); min-height: 38px; padding: 6px 2px; font-size: .875rem; border-radius: 6px; }
  .compact-calendar-head button { padding: 6px 8px; color: var(--expense); }
  .compact-calendar-nav { margin: 4px 0 6px; }
  .compact-calendar-nav button { flex: 1; }
  .compact-calendar-nav button[data-calendar-step] { flex: 0 0 32px; }
  #compactCalendarYear { white-space: nowrap; }
  .compact-calendar-head, .compact-calendar-nav, .compact-calendar-selection, .compact-calendar-actions { flex-shrink: 0; }
  .compact-calendar-grid { display: grid; gap: 2px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
  .calendar-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .calendar-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .compact-calendar-grid button { min-width: 0; font-variant-numeric: tabular-nums; }
  .compact-calendar-grid button[aria-pressed="true"] { background: var(--expense); color: #fff; font-weight: 600; }
  .calendar-weekday { font-size: .75rem; color: var(--muted); text-align: center; padding: 4px 0; }
  .compact-calendar-selection { margin: 10px 0; color: var(--muted); font-size: .8125rem; text-align: center; }
  .compact-calendar-actions { gap: 8px; }
  .compact-calendar-actions button { flex: 1; min-height: 42px; margin: 0; font-size: .875rem; }
  .compact-calendar-actions .btn-ghost { display: block; }
  .compact-calendar button[hidden] { display: none !important; }
  .confirm-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(22, 33, 29, 0.42);
  }
  .confirm-dialog-backdrop[hidden] { display: none !important; }
  .confirm-dialog {
    width: min(100%, 420px);
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 18px 48px rgba(22, 33, 29, 0.2);
  }
  .confirm-dialog h2 { margin: 0; font-size: 18px; }
  .confirm-dialog p {
    margin: 10px 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;
  }
  .confirm-dialog-actions { display: flex; gap: 10px; }
  .confirm-dialog-actions button { display: block; flex: 1; width: auto; margin: 0; }
  .confirm-dialog-actions button[hidden] { display: none !important; }
  .confirm-dialog-actions .btn-ghost { display: block; }
  .confirm-dialog button:focus-visible {
    outline: 3px solid rgba(20, 125, 90, 0.28);
    outline-offset: 2px;
  }

  /* ===== 明细列表 ===== */
  .row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .row:last-child { border-bottom: none; }
  .row-main { flex: 1; min-width: 0; }
  .row-top { display: flex; align-items: center; gap: 8px; }
  .badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #F0F1F3;
    color: var(--muted);
  }
  .badge.income { background: #FBE9E8; color: var(--income); }
  .badge.expense { background: #E4F2EC; color: var(--expense); }
  .row-cat { font-size: 14px; font-weight: 600; }
  .row-note { font-size: 13px; color: var(--muted); }
  .row-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .date-head {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    padding: 16px 0 4px;
  }
  .date-head:first-child { padding-top: 0; }

  .detail-period-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }
  .detail-period-card {
    display: grid;
    grid-template-columns: minmax(88px, 1fr) auto minmax(144px, auto);
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FAFBFC;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .detail-period-card:hover,
  .detail-period-card:focus-visible {
    border-color: var(--expense);
    outline: none;
  }
  .detail-period-card.active {
    border-color: var(--line);
    background: #FAFBFC;
  }
  .detail-period-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .detail-period-name {
    font-size: 14px;
    font-weight: 700;
  }
  .detail-period-range {
    color: var(--muted);
    font-size: 11px;
  }
  .detail-period-count {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
  }
  .detail-period-card.active .detail-period-count {
    color: var(--muted);
    font-weight: 400;
  }
  .detail-period-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    min-width: 0;
  }
  .detail-period-total {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 3px;
    min-width: 64px;
    font-variant-numeric: tabular-nums;
  }
  .detail-period-total-label {
    color: var(--muted);
    font-size: 10px;
  }
  .detail-period-total strong {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
  }
  .detail-period-total.income strong { color: var(--income); }
  .detail-period-total.expense strong { color: var(--expense); }

  @media (max-width: 430px) {
    .detail-period-card {
      grid-template-columns: minmax(72px, 1fr) auto minmax(112px, auto);
      gap: 4px;
      padding-inline: 8px;
    }
    .detail-period-totals { gap: 1px; }
    .detail-period-total { min-width: 54px; }
    .detail-period-name { font-size: 13px; }
    .detail-period-range,
    .detail-period-count { font-size: 10px; }
    .detail-period-total-label { font-size: 9px; }
    .detail-period-total strong { font-size: 11px; }
  }

  /* ===== 明细阶段汇总 ===== */
  .period-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }
  .period-stat {
    flex: 1;
    background: #F7F8F9;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
  }
  .period-stat .label { font-size: 12px; color: var(--muted); }
  .period-stat .value {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
    margin-top: 2px;
  }
  .period-stat .value.income { color: var(--income); }
  .period-stat .value.expense { color: var(--expense); }
  .period-stat .value.debt { color: var(--ink); }

  /* ===== 统计图 ===== */
  .chart-legend { display: flex; flex-direction: column; gap: 6px; }
  .chart-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
  .chart-legend-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .row-amount {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
    white-space: nowrap;
  }
  .row-amount.income { color: var(--income); }
  .row-amount.expense { color: var(--expense); }
  .row-amount.neutral { color: var(--ink); }
  .row-actions { display: flex; gap: 6px; }
  .row-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
  }
  .row-action-btn .ui-icon { width: 15px; height: 15px; flex-basis: 15px; }
  .mini-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    color: var(--muted);
    font-family: inherit;
  }
  .mini-btn:hover { border-color: var(--ink); color: var(--ink); }
  .mini-btn.danger:hover { border-color: var(--income); color: var(--income); }

  /* 明细页提高信息密度：让一屏能看到更多账目，仍保留日期、类别和操作入口。 */
  #panelDetail .row {
    gap: 8px;
    padding: 8px 0;
  }
  #panelDetail .row-top { gap: 5px; }
  #panelDetail .row-account {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
  }
  #panelDetail .badge {
    padding: 0 6px;
    font-size: 11px;
  }
  #panelDetail .row-cat { font-size: 13px; }
  #panelDetail .row-note {
    font-size: 12px;
    line-height: 1.35;
  }
  #panelDetail .row-amount { font-size: 14px; }
  #panelDetail .row-actions { gap: 4px; }
  #panelDetail .row-action-btn {
    min-width: 34px;
    min-height: 34px;
    padding: 3px 6px;
    font-size: 11px;
  }
  #panelDetail .row-action-btn .ui-icon {
    width: 13px;
    height: 13px;
    flex-basis: 13px;
  }
  #panelDetail .date-head {
    padding: 10px 0 3px;
    font-size: 12px;
  }
  #panelDetail .date-head:first-child { padding-top: 0; }
  /* 保留普通字号的明细密度和账户主行，大字体时让名称与金额换行。 */
  #panelDetail .row { flex-wrap: wrap; }
  #panelDetail .row-main { flex-basis: 8rem; }
  #panelDetail .row-top { flex-wrap: wrap; }
  #panelDetail .row-account { font-size: .8125rem; white-space: normal; overflow-wrap: anywhere; }
  #panelDetail .row-cat { font-size: .8125rem; }
  #panelDetail .row-note, #panelDetail .date-head { font-size: .75rem; }
  #panelDetail .row-amount { max-width: 100%; font-size: .875rem; white-space: normal; overflow-wrap: anywhere; }
  #panelDetail .detail-period-filter { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
  #panelDetail .field-row { flex-wrap: wrap; }
  #panelDetail .field-row .field { min-width: 0; flex: 1 1 8rem; }
  #panelDetail .detail-period-filter .field-label, #panelDetail .detail-filters .field-label { font-size: .8125rem; }
  #panelDetail .compact-picker-trigger, #panelDetail .compact-picker-option { min-height: 44px; font-size: .8125rem; }
  #panelDetail input[type="date"], #panelDetail input[type="month"], #panelDetail input[type="number"] { font-size: .8125rem; }
  #panelDetail .detail-filter-toggle { font-size: .8125rem; }
  #panelDetail .detail-filter-button-action { font-size: .75rem; }
  #panelDetail .detail-filter-button-main { overflow-wrap: anywhere; }
  #panelDetail .detail-period-totals-line { font-size: .75rem; }
  #panelDetail .detail-period-totals-line strong { font-size: .875rem; }

  /* 特窄屏：先完整显示账户、类别和备注，再放金额及操作；普通宽度沿用原布局。 */
  @media (max-width: 350px) {
    #panelDetail .row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 4px 8px;
    }
    #panelDetail .row-main { grid-column: 1 / -1; }
    #panelDetail .row-cat { flex-shrink: 0; max-width: 50%; overflow-wrap: anywhere; }
    #panelDetail .row-amount {
      min-width: 0;
      justify-self: end;
      text-align: right;
      white-space: normal;
      overflow-wrap: anywhere;
    }
    #panelDetail .row-actions { justify-self: end; }
  }

  .empty {
    text-align: center;
    color: var(--muted);
    padding: 24px 0;
    font-size: 14px;
  }
  .empty-action {
    display: none;
    width: min(100%, 220px);
    margin: -8px auto 16px;
  }
  .empty-action[hidden] { display: none !important; }
  .empty.small { padding: 12px 0; font-size: 13px; }

  /* ===== 下拉框（账户） ===== */
  select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    color: var(--ink);
    background: #FAFBFC;
  }
  select:focus { outline: none; border-color: var(--ink); background: #fff; }

  /* 记账页账户选择：收敛 Android WebView 原生选项弹层的字号和行距，
     同时保留足够的触控高度。 */
  .record-account-field {
    margin-bottom: 12px;
  }
  .record-account-field .field-label {
    margin-bottom: 6px;
    font-size: 12px;
  }
  .record-account-field select {
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.25;
  }
  .record-account-field select option {
    font-size: 14px;
  }
  .account-picker { position: relative; }
  .native-account-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }
  .account-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FAFBFC;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
  }
  .account-picker-trigger::after {
    content: "⌄";
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
  }
  .account-picker-trigger.has-value { color: var(--ink); }
  .account-picker-trigger:focus,
  .account-picker-trigger[aria-expanded="true"] {
    outline: none;
    border-color: var(--ink);
    background: #fff;
  }
  .account-picker-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(280px, 42vh);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(30, 34, 39, 0.16);
  }
  .account-picker-menu.open-up {
    top: auto;
    bottom: calc(100% + 6px);
  }
  .account-picker-menu[hidden] { display: none !important; }
  .account-picker-group {
    padding: 5px 10px 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
  }
  .account-picker-option {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
  }
  .account-picker-option:hover,
  .account-picker-option:focus,
  .account-picker-option.selected {
    outline: none;
    background: #EAF7F1;
    color: var(--expense);
  }

  /* ===== 净资产行 ===== */
  .stat-networth {
    border-top: 1px solid var(--dark-line);
    margin-top: 6px;
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .stat-networth .label { color: #8CA39B; font-size: 11px; }
  .stat-networth .value {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
  }

  /* ===== 账户列表 ===== */
  .acc-group-label { font-size: 12px; color: var(--muted); margin: 6px 0 2px; }
  .acc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .acc-row:last-child { border-bottom: none; }
  .acc-main { flex: 1; min-width: 0; }
  .acc-name { font-size: 15px; font-weight: 600; }
  .acc-kind {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #F0F1F3;
    color: var(--muted);
  }
  .acc-kind.liab { background: #FBE9E8; color: var(--income); }
  .acc-init { font-size: 12px; color: var(--muted); margin-top: 1px; }
  .acc-balance {
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
    white-space: nowrap;
  }
  .acc-balance.neg { color: var(--income); }
  .acc-msg { margin-top: 10px; font-size: 14px; color: var(--expense); min-height: 20px; }
  .acc-msg.warn { color: var(--income); }
  .backup-desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
  .backup-actions { display: flex; gap: 8px; margin-top: 10px; }
  .backup-actions .btn-ghost { display: block; flex: 1; margin-top: 0; }
  .backup-actions .btn-ghost[hidden] { display: none !important; }
  .backup-actions .icon-button { padding-left: 8px; padding-right: 8px; }
  .external-import-entry { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
  .external-import-entry .btn-ghost { display: block; width: auto; margin-top: 10px; }
  .external-import-panel { margin-top: 12px; padding: 12px; border: 1px solid #C9E2DD; border-radius: 10px; background: #F3FAF8; }
  .external-import-fields { margin-top: 10px; }
  .external-import-counts { margin-top: 8px; font-size: 14px; font-weight: 600; }
  .external-import-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
  .external-import-ledgers { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--text); }
  .external-import-ledgers li { margin-top: 3px; }
  .external-import-issues { margin-top: 10px; font-size: 12px; }
  .external-import-issue-title { color: #8C5B00; font-weight: 600; }
  .external-import-issue { margin-top: 3px; color: #8C5B00; }
  .external-import-ok { color: var(--expense); }
  .migration-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #E0A63A;
    border-radius: 10px;
    background: #FFF9ED;
  }
  .migration-preview-title { font-size: 14px; font-weight: 700; }
  .migration-counts { margin-top: 6px; font-size: 14px; }
  .migration-totals { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; font-size: 13px; color: var(--muted); }
  .migration-book { margin-top: 10px; padding-top: 10px; border-top: 1px solid #F0D89F; }
  .migration-book-name { font-size: 14px; font-weight: 600; }
  .migration-book-meta, .migration-book-money { margin-top: 2px; font-size: 12px; color: var(--muted); }
  .migration-actions { display: flex; gap: 8px; margin-top: 12px; }
  .migration-actions button { display: block; flex: 1; width: auto; margin-top: 0; }
  .migration-actions .btn-primary { padding: 10px; font-size: 14px; }

  /* ===== 总览（跨账本） ===== */
  .ov-income { color: var(--income); }
  .ov-expense { color: var(--expense); }
  .overview-total {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .overview-total .label { color: var(--muted); font-size: 13px; }
  .overview-total .value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Cascadia Mono", Consolas, monospace;
  }

  /* ===== 手机 / 平板：可交互控件至少保留 44px 触控区域 ===== */
  @media (max-width: 768px) {
    .tab { min-height: 44px; }
    .chip, .mini-btn, .btn-ghost { min-height: 44px; }
    .mini-btn { min-width: 44px; padding: 8px 10px; }
    input[type="number"], input[type="text"], input[type="date"],
    input[type="email"], input[type="password"], select {
      min-height: 44px;
    }
  }

  /* ===== 手机端：给窄屏留出更多内容宽度 ===== */
  @media (max-width: 480px) {
    body { padding: 12px 12px max(104px, calc(7rem + env(safe-area-inset-bottom, 0px))); }
    header { margin-bottom: 16px; }
    .stats { padding: 12px; }
    .card { padding: 16px; }
    .overview-panel { padding: 0 2px 22px; }
    .overview-panel .page-head { margin: -8px -6px 8px; }
    .overview-chart-section, .overview-books-section { padding: 13px 12px; }
    .account-panel, .settings-panel { padding: 0 2px 22px; }
    .account-panel .page-head, .settings-panel .page-head { margin: -8px -6px 10px; }
    .tabs:not(.bottom-nav) { gap: 6px; margin-bottom: 16px; }
    .tab { font-size: 14px; }
    .stat-balance { font-size: clamp(24px, 8vw, 30px); }
    .stat .value { font-size: clamp(14px, 4.5vw, 18px); }
    .stat-networth, .overview-total { flex-wrap: wrap; gap: 4px 12px; }
    .stat-networth .value, .overview-total .value {
      font-size: clamp(16px, 5vw, 19px);
    }
    .row, .acc-row { gap: 8px; }
    .row-action-btn { min-width: 42px; padding-left: 7px; padding-right: 7px; }
    .row-action-btn .action-label { display: none; }
    .bottom-nav { width: 100%; padding-inline: 4px; }
    .bottom-nav .tab { font-size: 11px; }
    .home-shortcut { min-height: 46px; font-size: 13px; }
    .home-shortcut-icon { width: 19px; height: 19px; }
    .budget-input-row { grid-template-columns: auto minmax(0, 1fr); }
    .budget-input-row .btn-primary { grid-column: 1; }
    .budget-input-row .btn-ghost { grid-column: 2; }
    .budget-month-bar { grid-template-columns: 42px minmax(0, 1fr) 42px; }
    .budget-month-bar > .btn-ghost { grid-column: 1 / -1; width: 100%; }
    .budget-category-top { align-items: flex-start; flex-direction: column; }
    .budget-category-actions { width: 100%; }
    .budget-category-input { flex: 1; width: auto; }
    .budget-category-form { grid-template-columns: minmax(0, 1fr) 86px auto; gap: 5px; }
    .record-panel,
    .detail-panel {
      padding: 0 2px 22px;
      margin-top: -12px;
    }
    .record-panel .page-head,
    .detail-panel .page-head {
      margin: -8px -6px 8px;
    }
  }

  /* 320px 设备中双列表单过窄，改成单列以保证输入内容清楚可见。 */
  @media (max-width: 360px) {
    .settings-panel .device-lock-question-grid { grid-template-columns: minmax(0, 1fr); }
    .field-row { flex-direction: column; gap: 0; }
    .field-row > .field { width: 100%; margin-bottom: 12px !important; }
    #panelDetail .field-row > .field, #panelFixedIncome .field-row > .field,
    #panelAccount .field-row > .field, #panelBook .field-row > .field { flex-basis: auto; }
  }
/* 日期分组的汇总来自当前筛选的全部记录，加载更多不会改变同日合计。 */
#panelDetail .date-head { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; flex-wrap:wrap; }
.daily-totals { margin-left:auto; display:flex; flex-direction:row; flex-wrap:wrap; justify-content:flex-end; align-items:baseline; gap:2px 10px; max-width:100%; font-size:.75rem; line-height:1.45; font-weight:400; }
.daily-totals > span { white-space:nowrap; }
.daily-totals .expense { color:var(--expense); }
.daily-totals .income { color:var(--income); }
body.privacy-masked .daily-totals strong { font-size:0; }
body.privacy-masked .daily-totals strong::after { content:"******"; font-size:.75rem; }
