/* ═══════════════════════════════════════════════════════════════
   月相主题 · 白 / 浅金 / 绯红
   只做视觉覆盖，不改任何布局逻辑与交互路径。
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ink: #241d1a;
  --muted: #7a6d63;
  --paper: #fbf7f0;
  --panel: #fffdf9;
  --line: #ece0cc;
  --teal: #a8802f;
  --teal-deep: #8a6427;
  --lime: #d9be86;
  --amber: #c9a227;
  --red: #9c1f26;
  --shadow: 0 1px 2px rgba(74, 46, 32, .045), 0 14px 34px rgba(74, 46, 32, .05);

  --gold-line: rgba(200, 164, 92, .38);
  --gold-wash: #f7eeda;
  --seal: #9c1f26;
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "STSong", serif;
  --radius-card: 14px;
  --radius-btn: 12px;
}

body { background-color: var(--paper); }

/* ── 纸纹：全局极细噪点 ─────────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

/* ── 月晕：右上角同心圆 ─────────────────────────────────────── */
body::after {
  content: "";
  position: fixed;
  top: -280px;
  right: -220px;
  width: 720px;
  height: 720px;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  background:
    radial-gradient(circle, transparent 0 118px, rgba(200, 164, 92, .07) 118px 119px, transparent 119px),
    radial-gradient(circle, transparent 0 168px, rgba(200, 164, 92, .06) 168px 169px, transparent 169px),
    radial-gradient(circle, transparent 0 218px, rgba(200, 164, 92, .05) 218px 219px, transparent 219px),
    radial-gradient(circle, rgba(247, 238, 218, .55) 0, transparent 62%);
}

.app-shell { position: relative; z-index: 1; }

/* ── 账簿横线与装订线（仅在桌面内容区）─────────────────────── */
@media (min-width: 701px) {
  .main-content {
    position: relative;
    background-image: repeating-linear-gradient(180deg, transparent 0 33px, rgba(200, 164, 92, .055) 33px 34px);
  }
  .main-content::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 26px;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(156, 31, 38, .16) 12%, rgba(156, 31, 38, .16) 88%, transparent);
  }
  .main-content::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 31px;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(200, 164, 92, .22) 12%, rgba(200, 164, 92, .22) 88%, transparent);
  }
}

/* ── 排版：标题衬线，数字保持无衬线 ─────────────────────────── */
h1, h2, h3, .section-head h2, .planning-panel h3, .modal h2,
.holding-card-title strong, .feature-card h3, .dca-head h3, .overview-calendar-head h2 {
  font-family: var(--serif);
  letter-spacing: .02em;
  font-weight: 600;
}
.topbar h1 { font-size: 30px; letter-spacing: .04em; }
.section-head h2 { position: relative; padding-left: 13px; }
.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: .28em;
  width: 3px;
  height: 1.02em;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--seal), rgba(156, 31, 38, .55));
}
.section-kicker, .eyebrow {
  letter-spacing: .18em;
  color: var(--teal);
  font-size: 10px;
}
.holding-value > strong, .metric-card strong, .net-worth-value, .dca-summary strong,
.holding-summary-item > strong, .planning-stats strong {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ── 卡片：双线框 + 印张感 ─────────────────────────────────── */
.holding-card, .holding-distribution, .dca-panel, .overview-calendar,
.planning-panel, .table-panel, .settings-panel, .transfer-panel, .metric-card,
.net-worth-panel, .insight-panel, .feature-card {
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow:
    inset 0 0 0 4px var(--panel),
    inset 0 0 0 4.5px rgba(200, 164, 92, .26),
    0 1px 2px rgba(74, 46, 32, .04);
}
/* 角饰只给每屏主要的两个区块，避免呆板 */
.holding-distribution, .overview-calendar { position: relative; }
.holding-distribution::before, .overview-calendar::before,
.holding-distribution::after, .overview-calendar::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: .8;
}
.holding-distribution::before, .overview-calendar::before {
  left: -1px; top: -1px;
  border-left: 1px solid var(--seal);
  border-top: 1px solid var(--seal);
}
.holding-distribution::after, .overview-calendar::after {
  right: -1px; bottom: -1px;
  border-right: 1px solid var(--seal);
  border-bottom: 1px solid var(--seal);
}

/* ── 按钮：圆润、浅金渐变、红色仅主操作 ──────────────────── */
.primary-button {
  border-radius: var(--radius-btn);
  color: #fffaf4;
  border: 1px solid rgba(120, 20, 26, .35);
  background: linear-gradient(180deg, #a9282f, #8d1a22);
  box-shadow: inset 0 1px 0 rgba(255, 236, 214, .28), 0 4px 12px rgba(140, 26, 34, .16);
  transition: transform .18s ease, box-shadow .22s ease, filter .18s ease;
}
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); filter: brightness(.96); }

.secondary-button, .ghost-button, .text-button, .icon-button, .shortcut-button {
  border-radius: var(--radius-btn);
  transition: transform .18s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.secondary-button {
  color: var(--teal-deep);
  border: 1px solid var(--gold-line);
  background: linear-gradient(180deg, #fffdf8, #fbf5e8);
}
.secondary-button:hover {
  border-color: rgba(200, 164, 92, .72);
  background: linear-gradient(180deg, #fffdf8, var(--gold-wash));
}
.icon-button { border: 1px solid var(--gold-line); background: linear-gradient(180deg, #fffdf8, #fbf6ea); }
.icon-button:hover { border-color: rgba(200, 164, 92, .7); }
.text-button { color: var(--teal-deep); }
.text-button:hover { color: var(--seal); }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(201, 162, 39, .55);
  outline-offset: 2px;
}

/* ── 侧栏：纸面 + 金色细线 ───────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #fffdf8, #fbf6ec);
  border-right: 1px solid var(--line);
}
.nav-item { border-radius: 10px; color: #6f6157; }
.nav-item:hover { background: rgba(247, 238, 218, .85); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(247, 238, 218, .95), rgba(247, 238, 218, .35));
  color: var(--teal-deep);
  box-shadow: inset 2px 0 var(--seal);
}
.nav-icon { color: var(--teal); }
.brand-copy strong { font-family: var(--serif); letter-spacing: .06em; }

/* ── 表单：细线 + 暖白底 ─────────────────────────────────── */
.form-field input, .form-field select, .search-box, .ui-month-field input,
.holding-summary-tools select, .holding-category-label select {
  border-radius: var(--radius-btn);
  border-color: var(--line);
  background: #fffdf9;
}
.form-field input:focus, .form-field select:focus {
  border-color: rgba(201, 162, 39, .6);
  background: #fffefb;
}

/* ── 月相进度：预算/目标条改成液相金 ─────────────────────── */
.planning-progress, .holding-target-progress {
  background-image: radial-gradient(circle at 4px 50%, rgba(200, 164, 92, .22) 1.4px, transparent 1.5px);
  background-size: 11px 100%;
}
.planning-progress > span, .holding-target-progress > span {
  background: linear-gradient(90deg, #f0dcb0, #c9a227);
  box-shadow: 0 0 6px rgba(201, 162, 39, .28);
}

/* ── 分隔纹：章节之间一条带菱形的金线 ───────────────────── */
.holding-page-head, .section-head { border: 0; }
.holding-list-heading { position: relative; }
.holding-list-heading::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 164, 92, .45) 18%, rgba(200, 164, 92, .45) 82%, transparent);
}

/* ── 图表配色（单色阶）──────────────────────────────────── */
.holding-pie-slice { stroke: #fffdf9; stroke-width: 2.5; }
.holding-pie-slice:hover, .holding-pie-slice.is-selected { opacity: .88; }
.holding-legend-row { border-radius: 10px; }
.holding-legend-row.is-selected { background: linear-gradient(90deg, var(--gold-wash), transparent); border-color: var(--gold-line); }
.allocation-chart path, .allocation-chart circle { stroke: #fffdf9; }

/* ── 表格行：悬停金雾 + 左侧绯线 ─────────────────────────── */
.data-row { border-top: 1px solid rgba(200, 164, 92, .18); }
.data-row.transaction-row:hover {
  background: linear-gradient(90deg, rgba(247, 238, 218, .9), rgba(255, 253, 249, .9));
  box-shadow: inset 2px 0 var(--seal);
}

/* ── 手机端：保留液体玻璃，只做色调贴合 ─────────────────── */
@media (max-width: 700px) {
  body::after { opacity: .3; width: 460px; height: 460px; top: -200px; right: -160px; }
  .main-content { background-image: none; }
  .main-content::before, .main-content::after { display: none; }
  .topbar {
    background: rgba(251, 247, 240, .78);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    backdrop-filter: blur(22px) saturate(1.6);
    border-bottom: 1px solid rgba(200, 164, 92, .16);
  }
  .mobile-top-nav.glass-dock {
    background: rgba(253, 249, 241, .72);
    border: 1px solid rgba(255, 255, 255, .85);
    box-shadow: 0 10px 34px rgba(96, 62, 40, .12), inset 0 1px 2px #fffdf8;
    -webkit-backdrop-filter: blur(26px) saturate(1.7);
    backdrop-filter: blur(26px) saturate(1.7);
  }
  .dock-indicator { background: rgba(255, 253, 248, .92); box-shadow: 0 3px 12px rgba(96, 62, 40, .08), inset 0 0 9px #fffdf8; }
  .glass-dock .mobile-tab.active { color: var(--seal); }
  .mobile-more-panel {
    background: rgba(253, 249, 241, .86);
    border: 1px solid rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(26px) saturate(1.5);
    backdrop-filter: blur(26px) saturate(1.5);
  }
  .mobile-fab {
    background: linear-gradient(180deg, #a9282f, #8d1a22);
    box-shadow: 0 8px 22px rgba(140, 26, 34, .22), inset 0 1px 0 rgba(255, 236, 214, .3);
  }
  .holding-card, .holding-distribution, .dca-panel, .overview-calendar,
  .planning-panel, .table-panel, .settings-panel, .transfer-panel, .metric-card,
  .net-worth-panel, .insight-panel, .feature-card {
    box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 3.5px rgba(200, 164, 92, .22), 0 1px 2px rgba(74, 46, 32, .035);
  }
}

/* ── 动效：统一节流，尊重系统设置 ───────────────────────── */
.view.active { animation: ledger-arrive .42s cubic-bezier(.22, 1, .36, 1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── 强调卡（待还债务）：金雾底 + 绯红数字 ───────────────── */
.metric-card.accent {
  background-color: #fdf6e6;
  background-image: linear-gradient(180deg, #fdf6e6, #f8edda);
  border-color: rgba(200, 164, 92, .5);
}
.metric-card.accent .metric-label,
.metric-card.accent .metric-foot { color: #8a6a3a; }
.metric-card.accent strong { color: var(--seal); }
.metric-card.accent .overview-link-chevron { color: rgba(156, 31, 38, .55); }

/* ── 涨跌/收支语义：金棕为正，绯红为负 ───────────────────── */
.amount-income { color: #8a6427; }
.amount-expense { color: var(--seal); }
.comparison-value, .change-rate { color: #8a6427; }
.change-rate.amount-expense { color: var(--seal); }

/* ── 首页净值面板：纸面留白更足 ─────────────────────────── */
.net-worth-panel { background: linear-gradient(180deg, #fffdf9, #fdf9f1); }
.net-worth-value { letter-spacing: -.02em; }

/* ── 章节序号（罗马数字）与分隔纹 ───────────────────────── */
.view { counter-reset: sec; }
.section-head { counter-increment: sec; position: relative; }
.section-head::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 164, 92, .5) 16%, rgba(200, 164, 92, .5) 84%, transparent);
}
.section-head h2::after {
  content: counter(sec, upper-roman);
  margin-left: 11px;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .16em;
  color: rgba(168, 128, 47, .8);
  vertical-align: 2px;
}

/* ── 印章：侧栏品牌标记右下角的绯色月印 ─────────────────── */
.brand-mark { position: relative; }
.brand-mark::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(156, 31, 38, .5);
  background: radial-gradient(circle at 68% 50%, transparent 0 46%, rgba(156, 31, 38, .45) 47% 100%);
}

/* ── 空状态：月相线稿水印 ───────────────────────────────── */
.table-empty::before, .dca-empty::before, .holding-empty::before, .planning-empty::before {
  content: "";
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  opacity: .22;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 54 54'%3E%3Ccircle cx='27' cy='27' r='17' fill='none' stroke='%23a8802f' stroke-width='1'/%3E%3Cpath d='M27 10a17 17 0 0 1 0 34 21 17 0 0 0 0-34z' fill='%23a8802f' opacity='.55'/%3E%3Ccircle cx='27' cy='27' r='24' fill='none' stroke='%23a8802f' stroke-width='.5' stroke-dasharray='1 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── 进度条末端：一枚小月相 ─────────────────────────────── */
.planning-progress > span, .holding-target-progress > span { position: relative; }
.planning-progress > span::after, .holding-target-progress > span::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 70% 50%, #fffdf9 0 42%, #c9a227 43% 100%);
  box-shadow: 0 0 0 2px #fffdf9;
}

/* ── 表单页签与分段控件：金雾选中 ───────────────────────── */
.segmented { background: rgba(247, 238, 218, .7); border-radius: 999px; }
.segmented button.selected, .segmented [aria-pressed="true"] {
  background: linear-gradient(180deg, #fffdf9, #fdf6e6);
  color: var(--seal);
  box-shadow: 0 1px 3px rgba(96, 62, 40, .1);
}
@media (max-width: 700px) {
  .section-head h2::after { font-size: 10px; margin-left: 8px; }
  .table-empty::before, .dca-empty::before { width: 44px; height: 44px; }
}

/* ── 流水行操作：去掉成排的红色实心按钮 ─────────────────── */
.transaction-row .data-actions .primary-button {
  background: transparent;
  color: var(--teal-deep);
  border: 1px solid transparent;
  box-shadow: none;
  font-weight: 500;
}
.transaction-row .data-actions .primary-button:hover {
  background: var(--gold-wash);
  border-color: var(--gold-line);
  color: var(--seal);
  transform: none;
}
.search-box span { display: inline-flex; align-items: center; color: var(--teal); }

/* ── 日历格：去掉厚重的暖褐填充 ─────────────────────────── */
.calendar-day {
  background: #fffdf9;
  border: 1px solid rgba(200, 164, 92, .2);
  border-radius: 7px;
}
.calendar-day[data-heat="1"] { background: rgba(201, 162, 39, .05); }
.calendar-day[data-heat="2"] { background: rgba(201, 162, 39, .085); }
.calendar-day[data-heat="3"] { background: rgba(201, 162, 39, .12); }
.calendar-day[data-heat="4"] { background: rgba(201, 162, 39, .16); }
.calendar-day.selected {
  background: rgba(247, 238, 218, .9);
  border-color: rgba(156, 31, 38, .5);
  box-shadow: inset 0 0 0 1px rgba(156, 31, 38, .28);
}
.calendar-day.is-today > span { color: var(--seal); }
.calendar-day > small.amount-income { color: #8a6427; }
.calendar-day > small.amount-expense { color: var(--seal); }
.calendar-snapshot { background: var(--seal); opacity: .55; }

/* ── 删除按钮：默认安静，悬停才红 ───────────────────────── */
.transaction-delete {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #a08c72;
  font-weight: 500;
}
.transaction-delete:hover {
  background: rgba(156, 31, 38, .07);
  border-color: rgba(156, 31, 38, .35);
  color: var(--seal);
}

/* ── 侧栏在矮视口下滚动，避免页脚压住导航 ───────────────── */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.nav-list { flex: 0 0 auto; }
