/* 家庭账本 H5：现代简约蓝色主题（移动端优先，容器 max-width 480px，C 端消费级交互） */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* 颜色（清新简约蓝，UI 视觉重设计变更） */
  --primary: #3B7BF6;
  --primary-light: #6AA3FA;
  --primary-bg: #EDF3FE;
  --success: #22B573;
  --danger: #F0564A;
  --warn: #F5A623;
  --income: #22B573;
  --expense: #F0564A;
  --bg: #F6F8FB;
  --card: #ffffff;
  --text: #1C2434;
  --text-light: #8A94A6;
  --border: #E6EAF2;
  --tab-height: 60px;
  /* 字号层级（规范 §7.1） */
  --fs-caption: 12px;
  --fs-hint: 13px;
  --fs-body: 15px;
  --fs-title: 16px;
  --fs-headline: 18px;
  --fs-page: 20px;
  /* 间距体系（规范 §7.2，基数 4px） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  /* 圆角（规范 §7.3，卡片加大到 18px） */
  --radius-s: 10px;
  --radius-m: 12px;
  --radius-l: 18px;
  --radius-xl: 22px;
  --radius-pill: 999px;
  /* 阴影（整体减淡，更轻盈） */
  --shadow-card: 0 2px 8px rgba(20, 40, 80, 0.06);
  --shadow-sheet: 0 -8px 24px rgba(20, 40, 80, 0.12);
  --shadow-fab: 0 8px 24px rgba(59, 123, 246, 0.35);
  --shadow: 0 2px 8px rgba(20, 40, 80, 0.06);
  /* 动效（规范 §7.4） */
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-sheet-in: 280ms;
  --dur-sheet-out: 240ms;
  --dur-mask: 200ms;
  --dur-tap: 120ms;
  --dur-item: 200ms;
  --dur-shake: 300ms;
  --dur-skeleton: 1.2s;
  /* Toast 定位变量（JS 按 Tab 栏可见性切换） */
  --toast-bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 24px);
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/*
 * iOS Safari 记一笔：键盘弹出时会平移 visual viewport，把顶部金额框「滚」到键盘上方，
 * 整页看起来下移并在顶部留出空白。把 body 钉在 visual viewport 矩形内，
 * 并用 transform 让 position:fixed 提交栏相对该框定位（而不是键盘下方）。
 */
html.add-lock,
html.add-lock body {
  overflow: hidden;
  overscroll-behavior: none;
}

html.add-lock body {
  position: fixed;
  left: 0;
  width: 100%;
  top: var(--vv-top, 0px);
  height: var(--vv-height, 100%);
  transform: translateZ(0);
}

html.add-lock .app {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html.add-lock .add-page {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

[v-cloak] {
  display: none !important;
}

/* ===== 容器 ===== */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  position: relative;
}

/* tabbar 为 fixed 定位，由文档流内的 .tabbar-spacer 占位防遮挡 */

/* 二级页与记一笔页无 Tab 栏，Toast 距底 40px（规范 §4.6） */
.app:not(.has-tabbar) {
  --toast-bottom: 40px;
}

.page {
  padding: var(--sp-4) var(--sp-4) var(--sp-6);
}

/* ===== 页面过渡动画（仅 opacity，避免 transform 破坏 fixed 子元素定位） ===== */
.page-fade-in {
  animation: pageFadeIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.page-slide-up {
  animation: pageSlideUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pageSlideUp {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-title {
  font-size: var(--fs-page);
  font-weight: 600;
  padding: 10px 2px 14px;
  letter-spacing: 0.2px;
}

/* ===== 轻提示（底部，Tab 栏上方；§4.6） ===== */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--toast-bottom);
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-m);
  z-index: 999;
  font-size: 14px;
  max-width: 82%;
  text-align: center;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.18);
  animation: toast-in var(--dur-item) ease-out;
}

.toast .toast-ok {
  color: #4ADE80;
  font-weight: 700;
  margin-right: 4px;
}

.toast .toast-err {
  color: #F87171;
  font-weight: 700;
  margin-right: 4px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== 底部 Tab（仅四个主页面显示；§3.4） ===== */
/* tabbar 固定视口底部；内容防遮挡由文档流内的 .tabbar-spacer 实体占位保证 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--tab-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid #EDF0F5;
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.04);
}

/* Tab 栏占位块：文档流内实体元素，高度与 tabbar 一致，滚动到底时内容位于其上方不被遮挡 */
.tabbar-spacer {
  height: calc(var(--tab-height) + env(safe-area-inset-bottom));
}

.tab-item {
  flex: 1;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: var(--fs-caption);
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  transition: color var(--dur-tap) ease;
}

.tab-item .tab-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-item .tab-icon svg {
  width: 22px;
  height: 22px;
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
  position: relative;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-pill);
}

/* ===== 悬浮「记一笔」按钮（仅明细页；底部居中） ===== */
.fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 18px);
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  z-index: 99;
  transition: transform 0.1s ease;
}

.fab svg {
  width: 24px;
  height: 24px;
}

/* ===== SVG 图标基础样式（UI 视觉重设计） ===== */
.ic {
  display: block;
}

/* 未命中图标注册表的历史值：文本兜底 */
.ic-text {
  font-size: 0.7em;
  line-height: 1;
  word-break: break-all;
  max-width: 2.4em;
  text-align: center;
}

.fab:active {
  transform: translateX(-50%) scale(0.95);
}

/* ===== 通用组件 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-l);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-m);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  background: #EEF1F6;
  color: var(--text);
  transition: background var(--dur-tap) ease, transform 0.1s ease, opacity var(--dur-tap) ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 123, 246, 0.25);
  height: 48px;
}

.btn-primary:active {
  background: #2F6AE0;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:active {
  background: #B91C1C;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled,
.btn.loading {
  opacity: 0.6;
  box-shadow: none;
  pointer-events: none;
}

/* 校验失败按钮抖动（§4.2） */
.shake {
  animation: shake-x var(--dur-shake) ease;
}

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

input,
textarea {
  width: 100%;
  height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  font-size: 16px; /* iOS Safari: >= 16px 防止键盘弹出自动缩放 */
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 123, 246, 0.14);
}

.form-row {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin-bottom: 6px;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.muted {
  color: var(--text-light);
  font-size: var(--fs-hint);
}

.error-tip {
  color: var(--danger);
  font-size: var(--fs-hint);
  min-height: 18px;
  padding: 4px 2px;
  word-break: break-all;
}

/* 浅红错误提示条（出现才渲染；§5.1） */
.error-banner {
  background: #FEF2F2;
  color: var(--danger);
  font-size: var(--fs-hint);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  margin-bottom: var(--sp-3);
  word-break: break-all;
}

.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: var(--fs-body);
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  cursor: pointer;
}

.link-btn:active {
  opacity: 0.6;
}

.text-link {
  border: none;
  background: none;
  color: var(--primary);
  font-size: var(--fs-hint);
  cursor: pointer;
  padding: 4px 0;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--primary-bg);
  color: var(--primary);
  margin-left: 6px;
}

.tag.gray {
  background: #F1F4F9;
  color: var(--text-light);
}

/* ===== 胶囊选择器（§4.9） ===== */
.capsule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.capsule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  max-width: 62%;
  transition: background var(--dur-tap) ease;
}

.capsule:active {
  background: var(--primary-bg);
}

.capsule .cap-ic {
  display: inline-flex;
  color: var(--primary);
}

.capsule .cap-ic svg {
  width: 16px;
  height: 16px;
}

.capsule .cap-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.capsule .cap-arrow {
  color: var(--text-light);
  display: inline-flex;
}

.capsule .cap-arrow svg {
  width: 12px;
  height: 12px;
}

/* ===== 搜索框（明细页） ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: var(--radius-m);
  padding: 0 12px;
  height: 44px;
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}

.search-icon {
  display: inline-flex;
  color: var(--text-light);
  flex-shrink: 0;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: var(--fs-body);
  color: var(--text);
  padding: 0;
  height: 100%;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-light);
  font-size: var(--fs-hint);
}

.search-clear {
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #E5E7EB;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 芯片（§4.9） ===== */
.chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px;
  margin-bottom: var(--sp-3);
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: #F1F4F9;
  color: var(--text);
  font-size: var(--fs-hint);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-tap) ease;
}

.chip.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 芯片内小图标 */
.chip-ic {
  display: inline-flex;
  align-items: center;
}

.chip-ic svg {
  width: 16px;
  height: 16px;
}

.chip-soft.selected {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.chip-grid .chip {
  justify-content: center;
  height: 44px;
}

/* ===== 底部抽屉 Sheet（§4.2） ===== */
.sheet-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 24, 39, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-mask) ease;
  z-index: 300;
}

.sheet-mask.on {
  opacity: 1;
  pointer-events: auto;
}

.sheet-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 480px;
  transform: translate(-50%, 105%);
  background: var(--card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  z-index: 301;
  max-height: 85vh;
  overflow-y: auto;
  padding: 10px var(--sp-5) calc(16px + env(safe-area-inset-bottom));
  transition: transform var(--dur-sheet-out) var(--ease-sheet);
  touch-action: pan-y;
}

.sheet-panel.open {
  transform: translate(-50%, 0);
  transition-duration: var(--dur-sheet-in);
}

.sheet-bar {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: #DCE1EA;
  margin: 0 auto var(--sp-3);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.sheet-title {
  font-size: var(--fs-title);
  font-weight: 600;
}

.sheet-close {
  border: none;
  background: none;
  color: var(--primary);
  font-size: var(--fs-body);
  min-width: 44px;
  min-height: 44px;
  margin-right: -12px;
  cursor: pointer;
}

.sheet-note {
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin: -6px 0 var(--sp-4);
}

.sheet-danger-link {
  width: 100%;
  margin-top: var(--sp-3);
  min-height: 44px;
  border: none;
  background: none;
  color: var(--danger);
  font-size: var(--fs-body);
  cursor: pointer;
}

/* 日期范围选择表单 */
.wealth-range-form {
  padding: 0 var(--sp-4) var(--sp-4);
}

.range-field {
  margin-bottom: var(--sp-4);
}

.range-field .form-label {
  font-size: var(--fs-caption);
  color: var(--text-light);
  margin-bottom: var(--sp-1);
}

.range-field .form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  font-size: var(--fs-body);
  background: var(--card);
  color: var(--text);
  transition: border-color var(--dur-tap) ease;
}

.range-field .form-input:focus {
  border-color: var(--primary);
  outline: none;
}

.range-submit {
  width: 100%;
  margin-top: var(--sp-5);
  height: 48px;
  font-size: var(--fs-title);
}

/* ===== ActionSheet（§4.3） ===== */
.as-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 480px;
  transform: translate(-50%, 105%);
  z-index: 301;
  padding: 0 var(--sp-2) calc(12px + env(safe-area-inset-bottom));
  transition: transform var(--dur-sheet-out) var(--ease-sheet);
  touch-action: pan-y;
}

.as-panel.open {
  transform: translate(-50%, 0);
  transition-duration: var(--dur-sheet-in);
}

.as-block {
  background: var(--card);
  border-radius: var(--radius-l);
  overflow: hidden;
  margin-bottom: var(--sp-2);
  box-shadow: var(--shadow-sheet);
}

.as-head {
  padding: 14px var(--sp-4) 4px;
  text-align: center;
}

.as-title {
  font-size: var(--fs-title);
  font-weight: 600;
}

.as-msg {
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin-top: var(--sp-1);
}

.as-action {
  width: 100%;
  height: 54px;
  border: none;
  background: none;
  font-size: var(--fs-title);
  color: var(--text);
  cursor: pointer;
  border-top: 1px solid #F0F3F8;
  transition: background var(--dur-tap) ease;
}

.as-head + .as-action {
  border-top: none;
}

.as-action:active {
  background: var(--primary-bg);
}

.as-action.danger {
  color: var(--danger);
  font-weight: 500;
}

.as-cancel {
  font-weight: 600;
}

/* ===== 骨架屏（§4.7） ===== */
.sk {
  position: relative;
  overflow: hidden;
  background: #EDF1F7;
  border-radius: var(--radius-s);
}

.sk::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: shimmer var(--dur-skeleton) linear infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.sk-card {
  background: var(--card);
  border-radius: var(--radius-l);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.sk-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
}

.sk-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== 空态与错误态（§4.7） ===== */
.empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 16px;
}

.empty-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--sp-3);
}

.empty-icon svg {
  width: 34px;
  height: 34px;
}

.empty-text {
  font-size: var(--fs-body);
  color: var(--text-light);
  margin-bottom: var(--sp-4);
}

.empty-box .btn {
  min-width: 160px;
}

.error-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 16px;
}

.error-box .eb-icon {
  font-size: 40px;
  color: var(--warn);
  margin-bottom: var(--sp-3);
}

.error-box .eb-icon svg {
  width: 38px;
  height: 38px;
}

.error-box .eb-msg {
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin-bottom: var(--sp-3);
  word-break: break-all;
}

/* ===== 登录/注册（§5.1，清新简约：白底品牌区） ===== */
.auth-head {
  text-align: center;
  padding: 56px 16px 30px;
  color: var(--text);
}

.auth-head .logo {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 22px;
  background: linear-gradient(135deg, #4E8CF7 0%, #7FB0FB 50%, #4E8CF7 100%);
  background-size: 200% 200%;
  animation: logo-gradient 3s ease infinite;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(59, 123, 246, 0.35);
}

@keyframes logo-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.auth-head .logo svg {
  width: 38px;
  height: 38px;
}

.auth-head h1 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 14px;
  letter-spacing: 1px;
  color: var(--text);
}

.auth-head .muted {
  color: var(--text-light);
  margin-top: 6px;
  font-size: 14px;
}

.auth-card {
  border-radius: var(--radius-l);
  padding: var(--sp-5);
  box-shadow: 0 4px 20px rgba(20, 40, 80, 0.08);
}

.auth-tabs {
  display: flex;
  margin-bottom: 18px;
  background: #F1F4F9;
  border-radius: var(--radius-m);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  min-height: 44px;
  background: none;
  border: none;
  border-radius: 9px;
  font-size: var(--fs-body);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.auth-tab.active {
  color: var(--primary);
  font-weight: 600;
  background: #fff;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.1);
  transform: scale(1.02);
}

.auth-beian {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
  margin-top: var(--sp-6);
  padding-bottom: env(safe-area-inset-bottom);
}

.auth-beian a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-caption);
  color: var(--text-light);
  text-decoration: none;
  white-space: nowrap;
}

.auth-beian img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-beian a:active {
  color: var(--primary);
}

/* ===== 明细页（§5.2、§6.1） ===== */
.summary-card {
  display: flex;
  text-align: center;
  padding: var(--sp-4);
}

.summary-cell {
  flex: 1;
}

.summary-cell .lab {
  font-size: var(--fs-caption);
  color: var(--text-light);
}

.summary-cell .num {
  font-size: var(--fs-page);
  font-weight: 700;
  margin-top: 6px;
}

.summary-cell .num.income {
  color: var(--income);
}

.summary-cell .num.expense {
  color: var(--expense);
}

.day-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(246, 248, 251, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-hint);
  color: var(--text-light);
  padding: 0 2px;
}

.day-head .dh-sum.neg {
  color: var(--expense);
}

.day-head .dh-sum.pos {
  color: var(--income);
}

.tx-item {
  animation: item-in var(--dur-item) ease-out;
}

@keyframes item-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tx-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--card);
  border-radius: var(--radius-l);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background var(--dur-tap) ease, transform 0.15s ease;
}

.tx-row:active {
  background: var(--primary-bg);
  transform: scale(0.98);
}

.tx-main {
  flex: 1;
  min-width: 0;
}

.tx-title {
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-sub {
  font-size: var(--fs-caption);
  color: var(--text-light);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-amount {
  font-size: var(--fs-title);
  font-weight: 600;
  white-space: nowrap;
}

.tx-amount.income {
  color: var(--income);
}

.tx-amount.expense {
  color: var(--expense);
}

.tx-amount.transfer {
  color: var(--text-light);
}

.icon-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.icon-badge svg {
  width: 20px;
  height: 20px;
}

.icon-badge.sm {
  width: 36px;
  height: 36px;
  font-size: 18px;
}

.icon-badge.sm svg {
  width: 18px;
  height: 18px;
}

.load-more {
  text-align: center;
  font-size: var(--fs-hint);
  color: var(--text-light);
  padding: 14px 0 8px;
}



/* ===== 左滑手势（§4.8） ===== */
.swipe {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-l);
  margin-bottom: 10px;
}

/* 卡内行（分类/成员）不额外占间距 */
.card .swipe {
  margin-bottom: 0;
  border-radius: 0;
}

.card .swipe-action {
  border-radius: 0;
}

.swipe-inner {
  position: relative;
  z-index: 1;
  transition: transform 0.2s ease;
  margin-bottom: 0;
}

.swipe-inner.open {
  transform: translateX(-80px);
}

.swipe .swipe-inner.tx-row,
.swipe .swipe-inner.card {
  margin-bottom: 0;
}

.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  border: none;
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-body);
  cursor: pointer;
  border-radius: 0 var(--radius-l) var(--radius-l) 0;
}

/* ===== 记一笔（§5.3） ===== */
.add-page {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  background: #fff;
  min-height: 100svh;
}

.add-topbar {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-2);
}

.add-close {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-close svg {
  width: 20px;
  height: 20px;
}

.add-title {
  flex: 1;
  text-align: center;
  font-size: var(--fs-headline);
  font-weight: 600;
}

.add-ledger {
  font-size: var(--fs-hint);
  color: var(--text-light);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}

.type-tabs {
  display: flex;
  background: #F1F4F9;
  border-radius: 14px;
  padding: 5px;
  margin: 0 var(--sp-4) 12px;
}

.type-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-s);
  background: none;
  font-size: var(--fs-body);
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.type-tab.active-expense {
  background: var(--expense);
  color: #fff;
  font-weight: 600;
}

.type-tab.active-income {
  background: var(--income);
  color: #fff;
  font-weight: 600;
}

.type-tab.active-transfer {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.amount-box {
  padding: 28px 16px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px solid var(--border);
  transition: border-color 0.2s ease;
}

.amount-box:focus-within {
  border-bottom-color: var(--primary);
}

.amount-box .currency {
  font-size: 26px;
  font-weight: 700;
  margin-right: 8px;
  color: var(--primary);
}

.amount-box input {
  border: none;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 700;
  padding: 4px 0;
  text-align: center;
  min-height: 44px;
  height: auto;
}

.amount-box input:focus {
  border: none;
  box-shadow: none;
}

.add-section {
  padding: var(--sp-4);
}

.add-section .form-label {
  margin-bottom: 10px;
}

.add-section-cats {
  padding: 8px 0 0;
  min-height: 170px;
}

.cat-empty {
  padding: 8px var(--sp-4) 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  overflow: hidden;
}

.category-cell {
  height: 56px;
  min-height: 56px;
  border: none;
  border-radius: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  font-size: var(--fs-caption);
  color: var(--text);
}

.category-cell .cat-icon {
  font-size: 16px;
  line-height: 1;
  color: var(--primary);
  display: inline-flex;
}

.category-cell .cat-icon svg {
  width: 16px;
  height: 16px;
}

.category-cell.selected {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.category-cell.cat-more {
  background: var(--primary-bg);
  color: var(--primary);
}

.swap-btn {
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn svg {
  width: 18px;
  height: 18px;
}

.date-hidden {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  left: -9999px;
  pointer-events: none;
}

.add-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid #EDF0F5;
  padding: 12px var(--sp-4) calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: var(--sp-3);
  z-index: 90;
}

.add-bar .btn-primary {
  flex: 1;
}

.add-del-link {
  border: none;
  background: none;
  color: var(--danger);
  font-size: var(--fs-body);
  min-width: 60px;
  cursor: pointer;
}

/* ===== 报表页（§5.4） ===== */
.report-summary {
  display: flex;
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
  background: linear-gradient(135deg, #F8FAFD 0%, #fff 100%);
}

.report-summary .num {
  font-size: var(--fs-page);
  font-weight: 700;
  margin-top: 6px;
}

.report-summary .num.income {
  color: var(--income);
}

.report-summary .num.expense {
  color: var(--expense);
}

/* 总资产卡：右上角大数字 + 口径说明 */
.wealth-num {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--primary);
}

.wealth-tip {
  font-size: var(--fs-small, 12px);
  color: var(--text-light);
  margin-top: 4px;
}

.budget-guide {
  background: var(--primary-bg);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-hint);
  color: var(--primary);
  cursor: pointer;
}

.budget-bar-wrap {
  height: 10px;
  border-radius: var(--radius-pill);
  background: #EDF0F6;
  overflow: hidden;
  margin: 10px 0 6px;
}

.budget-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  transition: width 0.6s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
}

.budget-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: budget-shimmer 2s infinite;
}

@keyframes budget-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.budget-bar.over {
  background: linear-gradient(90deg, #F87171, var(--danger));
}

.budget-bar.over::after {
  animation: none;
}

.budget-text.over {
  color: var(--danger);
  font-weight: 600;
  animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 明细页预算卡：分类预算展开行 */
.budget-cat-summary-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 0;
  margin-top: 10px;
  border-top: 1px solid #F0F3F8;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
}

.budget-cat-summary {
  padding-top: 6px;
}

.budget-cat-summary .budget-cat-row {
  padding: 6px 0;
}

.budget-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F0F3F8;
}

.budget-cat-row:last-child {
  border-bottom: none;
}

.bc-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bc-name {
  font-weight: 500;
  color: var(--text);
}

.bc-progress {
  font-size: 13px;
  color: var(--text-light);
}

.bc-none {
  font-size: 13px;
  color: var(--text-light);
}

.bc-actions {
  display: flex;
  gap: 10px;
}

.bc-actions .text-link {
  font-size: 13px;
  padding: 0;
}

.bc-actions .text-link.danger {
  color: var(--danger);
}

/* ===== 预算管理抽屉（重设计） ===== */
.budget-member-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
}

.budget-member-row::-webkit-scrollbar {
  display: none;
}

.budget-total-card {
  background: linear-gradient(135deg, #EDF3FE 0%, #F6F8FB 100%);
  border-radius: var(--radius-l);
  padding: 16px;
  margin-bottom: 12px;
}

.btc-label {
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin-bottom: 4px;
}

.btc-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.btc-currency {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.btc-input {
  border: none;
  background: none;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  padding: 0;
  min-height: 40px;
  width: 120px;
  outline: none;
}

.btc-input::placeholder {
  color: var(--border);
}

.btc-detail {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

.budget-quick-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
}

.budget-quick-row::-webkit-scrollbar {
  display: none;
}

.budget-quick-row .chip {
  flex: 0 0 auto;
}

/* 分类预算折叠区 */
.budget-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-top: 1px solid #F0F3F8;
}

.budget-section-arrow {
  display: inline-flex;
  color: var(--text-light);
  transition: transform 0.2s ease;
}

.budget-section-arrow.expanded {
  transform: rotate(180deg);
}

.budget-section-arrow svg {
  width: 16px;
  height: 16px;
}

.budget-cat-list {
  margin-bottom: 12px;
}

.budget-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #F0F3F8;
  cursor: pointer;
}

.budget-cat-item:last-child {
  border-bottom: none;
}

.budget-cat-item:active {
  background: var(--primary-bg);
  margin: 0 -16px;
  padding: 11px 16px;
  border-radius: var(--radius-s);
}

.budget-cat-item .bc-icon {
  display: inline-flex;
  color: var(--primary);
}

.budget-cat-item .bc-icon svg {
  width: 18px;
  height: 18px;
}

.budget-cat-item .bc-name {
  flex: 1;
  font-size: var(--fs-body);
}

.budget-cat-item .bc-progress {
  font-size: 12px;
  color: var(--text-light);
}

.budget-cat-item .bc-none {
  font-size: 12px;
  color: var(--text-light);
}

.budget-cat-item .bc-arrow {
  display: inline-flex;
  color: var(--text-light);
  transition: transform 0.2s ease;
}

.budget-cat-item .bc-arrow.expanded {
  transform: rotate(180deg);
}

.budget-cat-item .bc-arrow svg {
  width: 14px;
  height: 14px;
}

/* 二级分类缩进 */
.budget-cat-sub {
  padding-left: 32px;
}

.budget-cat-sub .bc-sub-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

/* 行内编辑 */
.bc-edit-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.bc-edit-currency {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.bc-edit-input {
  flex: 1;
  border: none;
  background: #F6F8FB;
  border-radius: var(--radius-s);
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  min-height: 36px;
  width: 80px;
}

.bc-edit-input::placeholder {
  color: var(--border);
}

.bc-edit-save {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-s);
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bc-edit-cancel {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-s);
  background: #F1F4F9;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bc-del-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #FEE2E2;
  color: #EF4444;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 4px;
}

.bc-del-btn:active {
  background: #FECACA;
}

/* 分类预算编辑浮层 */
.budget-edit-panel {
  border-top: 1px solid #F0F3F8;
  padding-top: 14px;
  margin-top: 8px;
}

.budget-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.budget-edit-title {
  font-size: var(--fs-title);
  font-weight: 600;
}

.budget-edit-cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 12px;
}

.budget-edit-cats::-webkit-scrollbar {
  display: none;
}

.budget-edit-cats .chip {
  flex: 0 0 auto;
}

.budget-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.budget-edit-currency {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.budget-edit-input {
  flex: 1;
  border: none;
  background: #F6F8FB;
  border-radius: var(--radius-m);
  padding: 10px 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  min-height: 44px;
}

.budget-edit-input::placeholder {
  color: var(--border);
}

.chart-box {
  position: relative;
  height: 220px;
}

.seg {
  display: inline-flex;
  background: #F1F4F9;
  border-radius: var(--radius-pill);
  padding: 3px;
}

.seg-item {
  min-height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: none;
  font-size: var(--fs-hint);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.seg-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.share-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 0;
  font-size: var(--fs-hint);
}

.share-row.clickable {
  cursor: pointer;
  border-radius: var(--radius-s);
}

.share-row.clickable:active {
  background: var(--primary-bg);
}

/* 占比行分类图标 */
.share-ic {
  display: inline-flex;
  color: var(--primary);
  flex-shrink: 0;
}

.share-ic svg {
  width: 18px;
  height: 18px;
}

.share-name {
  width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.share-bar {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: #EDF0F6;
  overflow: hidden;
}

.share-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  transition: width 0.6s cubic-bezier(0.32, 0.72, 0, 1);
}

.share-amount {
  width: 76px;
  text-align: right;
  color: var(--text-light);
  flex-shrink: 0;
}

.share-groups .group-label {
  margin: 12px 0 4px;
}

.share-groups .group-label:first-child {
  margin-top: 8px;
}

.account-balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid #F0F3F8;
}

.account-balance-item:last-child {
  border-bottom: none;
}

/* ===== 账户页（§5.5） ===== */
.total-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius-l);
  padding: var(--sp-5) var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: 0 8px 24px rgba(59, 123, 246, 0.25);
  position: relative;
  overflow: hidden;
}

.total-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.total-card .tc-label {
  font-size: var(--fs-caption);
  color: rgba(255, 255, 255, 0.7);
}

.total-card .tc-num {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.total-card .tc-note {
  font-size: var(--fs-caption);
  color: rgba(255, 255, 255, 0.85);
  margin-top: 10px;
}

/* 迷你趋势图 */
.mini-chart-wrap {
  height: 40px;
  margin-top: 10px;
  margin-left: -4px;
  margin-right: -4px;
}

.account-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  transition: background var(--dur-tap) ease;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.account-card:active {
  background: var(--primary-bg);
}

.account-list.sorting .account-card:active,
.cat-stack.sorting .category-row:active {
  background: var(--card);
  transform: none;
}

html.is-row-dragging,
html.is-row-dragging body {
  overscroll-behavior: none;
  touch-action: none;
}

.drag-lift {
  position: relative;
  z-index: 8;
  box-shadow: 0 10px 28px rgba(20, 40, 80, 0.18);
  transition: none;
  pointer-events: none;
  background: var(--card);
  touch-action: none;
}

.drag-peer {
  transition: transform 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}

html.is-row-drop .drag-lift,
html.is-row-drop .drag-peer,
html.is-row-drop .account-card,
html.is-row-drop .cat-block,
html.is-row-drop .category-row {
  transition: none !important;
}

.cat-stack {
  padding: 0;
  overflow: visible;
}

.cat-block {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
  background: var(--card);
}

.cat-block.drag-lift {
  border-radius: var(--radius-m);
}

.cat-block + .cat-block .category-row:first-child {
  border-top: 1px solid #F0F3F8;
}

.account-card .ac-info {
  flex: 1;
  min-width: 0;
}

.account-card .ac-name {
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card .ac-type {
  font-size: var(--fs-caption);
  color: var(--text-light);
  margin-top: 3px;
}

.account-card .ac-balance {
  font-size: var(--fs-title);
  font-weight: 600;
}

.account-card .ac-balance.neg {
  color: var(--text);
}

/* 账户卡行尾箭头（提示可进详情） */
.account-card .ac-arrow {
  color: var(--text-light);
  display: inline-flex;
  flex-shrink: 0;
}

.account-card .ac-arrow svg {
  width: 14px;
  height: 14px;
}

/* ===== 账户详情页（二级页） ===== */
.ad-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.ad-card .ad-info {
  flex: 1;
  min-width: 0;
}

.ad-card .ad-name {
  font-size: var(--fs-title);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-card .ad-type {
  font-size: var(--fs-caption);
  color: var(--text-light);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-edit {
  min-height: 44px;
  height: 44px;
  padding: 0 14px;
  gap: 4px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: var(--fs-hint);
  font-weight: 500;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.ad-edit svg {
  width: 14px;
  height: 14px;
}

.ad-balance-card {
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
}

.ad-balance-label {
  font-size: var(--fs-caption);
  color: var(--text-light);
}

.ad-balance-num {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

/* 账户详情月份切换行 */
.ad-month-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 var(--sp-3);
}

.ad-month-text {
  font-size: var(--fs-body);
  font-weight: 600;
  min-width: 96px;
  text-align: center;
}

.cd-sum-card {
  text-align: center;
  padding: var(--sp-4);
}

.cd-sum-num {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.cd-sum-num.income { color: var(--income); }
.cd-sum-num.expense { color: var(--expense); }

.tx-row-readonly {
  cursor: default;
}

.tx-row-readonly:active {
  background: transparent;
  transform: none;
}

/* ===== 吸底主按钮栏 ===== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid #EDF0F5;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
  z-index: 95;
}

/* 主 Tab 页上的吸底栏需抬到 Tab 栏上方 */
.bottom-bar.above-tab {
  bottom: calc(var(--tab-height) + env(safe-area-inset-bottom));
}

.bottom-bar .btn-primary {
  width: 100%;
}

/* 成员页吸底栏双按钮布局：等宽并排，覆盖单按钮全宽规则 */
.bottom-bar .btn-primary + .btn,
.bottom-bar .btn:first-child:not(:only-child) {
  width: auto;
}

.page.with-bar {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.app.has-tabbar .page.with-bar {
  padding-bottom: calc(84px + var(--tab-height) + env(safe-area-inset-bottom) + 12px);
}

/* ===== 我的页（§5.6，清新简约：白卡头像区） ===== */
.me-head {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-l);
  padding: var(--sp-5) var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}

.me-head .muted {
  color: var(--text-light);
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(59, 123, 246, 0.28);
}

.avatar.sm {
  width: 36px;
  height: 36px;
  font-size: 15px;
  background: var(--primary-bg);
  color: var(--primary);
}

.me-entries {
  padding: var(--sp-1) var(--sp-4);
}

.me-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: 6px 4px;
  border-bottom: 1px solid #F0F3F8;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background var(--dur-tap) ease;
}

.me-entry:last-child {
  border-bottom: none;
}

.me-entry:active {
  background: var(--primary-bg);
}

.me-entry-icon {
  font-size: 20px;
  line-height: 1;
  color: var(--primary);
  display: inline-flex;
}

.me-entry-icon svg {
  width: 20px;
  height: 20px;
}

.me-entry-title {
  flex: 1;
  font-size: var(--fs-body);
}

.me-entry-arrow {
  color: var(--text-light);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
}

.me-entry-arrow svg {
  width: 16px;
  height: 16px;
}

.logout-btn {
  width: 100%;
  background: #EEF1F6;
  color: var(--text);
}

/* ===== 二级页（§3.4） ===== */
.sub-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-3);
}

.sub-back {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-m);
  background: var(--card);
  color: var(--primary);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background var(--dur-tap) ease;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sub-back svg {
  width: 15px;
  height: 15px;
}

.sub-back:active {
  background: var(--primary-bg);
}

.sub-title {
  font-size: var(--fs-headline);
  font-weight: 600;
}

.group-label {
  font-size: var(--fs-hint);
  color: var(--text-light);
  margin: var(--sp-3) 2px var(--sp-2);
}

/* ===== 账本卡 / 成员行 / 分类行 ===== */
.ledger-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  margin-bottom: var(--sp-3);
  transition: background var(--dur-tap) ease;
}

.ledger-card:active {
  background: var(--primary-bg);
}

.ledger-card .lc-info {
  flex: 1;
  min-width: 0;
}

.ledger-card .lc-name {
  font-size: var(--fs-body);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-card .lc-sub {
  margin-top: 4px;
}

/* 账本汇总范围多选抽屉：勾选框 + 选中行轻高亮 */
.lsm-row {
  padding: 10px 8px;
  border-radius: var(--radius-s);
}

.lsm-row.on {
  background: var(--primary-bg);
}

.check-box {
  width: 22px;
  height: 22px;
  flex: none;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: var(--card);
  transition: all var(--dur-tap) ease;
}

.check-box svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}

.check-box.on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.more-btn {
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-light);
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.more-btn svg {
  width: 18px;
  height: 18px;
}

.more-btn:active {
  background: var(--primary-bg);
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 0;
  border-bottom: 1px solid #F0F3F8;
}

.member-row:last-child {
  border-bottom: none;
}

.member-row.clickable {
  cursor: pointer;
  border-radius: var(--radius-s);
  transition: background var(--dur-tap) ease;
}

.member-row.clickable:active {
  background: var(--primary-bg);
}

.member-row .mr-info {
  flex: 1;
  min-width: 0;
}

.member-row .mr-name {
  font-size: var(--fs-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-row .mr-at {
  font-size: var(--fs-caption);
  color: var(--text-light);
  margin-top: 2px;
}

/* 周期记账列表：白卡保留左右内边距，避免内容贴边 */
.recurring-list {
  padding: 6px var(--sp-4);
}

.category-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 14px;
  cursor: pointer;
  background: var(--card);
  transition: background var(--dur-tap) ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.category-row.drag-lift {
  border-radius: var(--radius-m);
}

.category-row:active {
  background: var(--primary-bg);
}

.category-row + .category-row {
  border-top: 1px solid #F0F3F8;
}

.category-row .cr-name {
  flex: 1;
  font-size: var(--fs-body);
}

/* 二级子分类行：缩进，无箭头 */
.category-row.child-row {
  padding-left: 42px;
}

/* 分类行行尾箭头 */
.category-row .cr-arrow {
  color: var(--text-light);
  display: inline-flex;
  flex-shrink: 0;
}

.category-row .cr-arrow svg {
  width: 14px;
  height: 14px;
}

.category-row .cr-arrow.expanded {
  transform: rotate(180deg);
}

.cat-picker-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}

.cat-picker-list .category-row.selected {
  background: var(--primary-bg);
  color: var(--primary);
}

.cat-picker-list .category-row.selected .cr-name {
  font-weight: 600;
}

/* 分类编辑按钮 */
.cr-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: var(--radius-s);
  transition: color var(--dur-tap) ease;
}

.cr-edit-btn svg {
  width: 16px;
  height: 16px;
}

.cr-edit-btn:active {
  color: var(--primary);
  background: var(--primary-bg);
}

/* 报表页账户卡可点 */
.card.tappable {
  cursor: pointer;
  transition: background var(--dur-tap) ease;
}

.card.tappable:active {
  background: var(--primary-bg);
}

/* ===== 分类抽屉图标选择网格（UI 视觉重设计） ===== */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.icon-cell {
  aspect-ratio: 1;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-cell svg {
  width: 20px;
  height: 20px;
}

.icon-cell:active {
  transform: scale(0.94);
}

.icon-cell.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

/* 月份切换箭头按钮 */
.month-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.month-nav svg {
  width: 16px;
  height: 16px;
}

/* 横向滚动芯片行：报表成员过滤 / 资产页视图切换 */
.chip-scroll-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 10px;
  scrollbar-width: none;
}

.chip-scroll-row::-webkit-scrollbar {
  display: none;
}

.chip-scroll-row .chip {
  flex: 0 0 auto;
}

/* 资产趋势时间范围栏 */
.wealth-range-bar {
  padding: 0 16px 12px;
}

.range-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: var(--fs-caption);
  color: var(--text-light);
}

.range-text {
  padding: 4px 10px;
  background: var(--primary-bg);
  border-radius: var(--radius-s);
  color: var(--primary);
  font-size: var(--fs-hint);
}

.range-sep {
  color: var(--text-light);
}

.capsule-sm {
  height: 28px;
  padding: 0 10px;
  font-size: var(--fs-caption);
}

/* 日期时间选择器固定高度 */
.dp-sheet {
  height: 70vh;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
  padding-bottom: 6px;
}

.dp-sheet .sheet-bar {
  display: none;
}

.dp-sheet .sheet-head {
  display: none;
}

/* ===== 日期选择抽屉（iOS Safari 兼容）紧凑版 ===== */
.dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.dp-title {
  font-size: 13px;
  cursor: pointer;
}

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.dp-wd {
  font-size: 10px;
  color: var(--text-light);
  padding: 3px 0;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 1px;
  flex: 1;
  min-height: 0;
}

.dp-day {
  border: none;
  border-radius: var(--radius-s);
  background: none;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-tap) ease;
}

.dp-day:active:not(.empty) {
  background: var(--primary-bg);
}

.dp-day.empty {
  cursor: default;
}

.dp-day.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.dp-day.is-today:not(.selected) {
  color: var(--primary);
  font-weight: 600;
}

.dp-footer {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-shrink: 0;
}

/* 日期时间选择器 - 时间选择行 */
.dp-time-row {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* 自定义时间滚轮选择器 */
.dp-wheel-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.dp-wheel-col {
  width: 52px;
  height: 108px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.dp-wheel-col::-webkit-scrollbar {
  display: none;
}

.dp-wheel-pad {
  height: 36px;
  flex-shrink: 0;
}

.dp-wheel-item {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-light);
  scroll-snap-align: center;
  cursor: pointer;
  border-radius: var(--radius-s);
  transition: color 0.15s, font-weight 0.15s;
}

.dp-wheel-item.selected {
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
}

.dp-time-colon {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

/* 记账时间显示区域 */
.add-time-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: border-color var(--dur-tap) ease;
}

.add-time-display:active {
  border-color: var(--primary);
}

.add-time-text {
  font-size: var(--fs-body);
  color: var(--text);
  font-weight: 500;
}

.add-time-icon {
  display: inline-flex;
  color: var(--text-light);
  width: 20px;
  height: 20px;
}

.add-time-icon svg {
  width: 100%;
  height: 100%;
}

.day-picker-note {
  font-size: 12px;
  color: var(--text-light);
  margin: 0 0 12px;
  line-height: 1.4;
}

.day-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-picker-cell {
  height: 40px;
  border: none;
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  cursor: pointer;
}

.day-picker-cell.selected {
  background: var(--primary);
  color: #fff;
}

/* ===== 报表多时间维度选择器（按月 / 多月 / 按年 / 多年） ===== */
.rp-seg {
  display: flex;
  width: 100%;
  margin-bottom: 16px;
}

.rp-seg .seg-item {
  flex: 1;
  min-height: 40px;
  padding: 0 6px;
  text-align: center;
}

.rp-shortcuts {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: 12px;
}

.rp-shortcuts .chip {
  flex: 1;
  justify-content: center;
  min-height: 36px;
  font-size: var(--fs-caption);
  padding: 0 8px;
}

.rp-range-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 14px;
}

.rp-range-box {
  flex: 1;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: var(--radius-m);
  border: 1.5px solid var(--border);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rp-range-box.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.rp-range-lab {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.2;
}

.rp-range-val {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text);
  margin-top: 3px;
}

.rp-range-box.active .rp-range-val {
  color: var(--primary);
}

.rp-range-sep {
  font-size: var(--fs-hint);
  color: var(--text-light);
  flex-shrink: 0;
}

.chip-grid .chip.in-range {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: transparent;
}

.chip-grid .chip.range-end {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.ad-month-static {
  justify-content: center;
}

/* ===== 减弱动画偏好支持 ===== */
@media (prefers-reduced-motion: reduce) {
  .auth-head .logo {
    animation: none;
  }

  .budget-bar::after {
    animation: none;
  }

  .budget-text.over {
    animation: none;
  }

  .category-cell.selected {
    transform: none;
  }

  .page-fade-in {
    animation: none;
  }

  .page-slide-up {
    animation: none;
  }

  .tx-row:active {
    transform: none;
  }

  .account-card:active {
    transform: none;
  }

  .auth-tab.active {
    transform: none;
  }
}
