* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Nunito', 'ZCOOL XiaoWei', -apple-system, sans-serif;
  background: #f7f3ee;
  min-height: 100vh;
  color: #5a4d42;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px;
}

/* ===== 顶部标签栏 ===== */
.top-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e8e0d8;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  font-size: 0.9rem;
  color: #8a7a6a;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  font-family: 'ZCOOL XiaoWei', serif;
}
.top-tab.active {
  color: #d4824a;
  border-bottom-color: #d4824a;
}

/* ===== 内容区域 ===== */
.content { padding: 20px 16px; max-width: 600px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== 账户页顶部结余卡片 ===== */
.account-summary {
  background: linear-gradient(135deg, #e8a87c 0%, #d4824a 100%);
  border-radius: 20px;
  padding: 28px 24px;
  color: #fff;
  margin-bottom: 20px;
}
.account-summary .label {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 4px;
}
.account-summary .amount {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.account-row {
  display: flex;
  gap: 20px;
}
.account-col {
  flex: 1;
}
.account-col .label { font-size: 0.8rem; }
.account-col .amount { font-size: 1.3rem; margin-bottom: 0; }

/* ===== 时间维度卡片 ===== */
.time-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.time-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.time-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.time-card-title {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 1.05rem;
  color: #5a4d42;
}
.time-card-date {
  font-size: 0.75rem;
  color: #a09080;
}
.time-card-stats {
  display: flex;
  gap: 24px;
}
.stat-item {
  flex: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: #a09080;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}
.stat-value.income { color: #7dd48a; }
.stat-value.expense { color: #e8786a; }

/* ===== 预算进度卡片 ===== */
.budget-card { background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 12px; }
.budget-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.budget-card-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1.05rem; color: #5a4d42; }
.budget-card-meta { font-size: 0.75rem; color: #333; }
.budget-progress-bg { height: 8px; background: #f0ebe5; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.budget-progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.budget-progress-fill.safe { background: linear-gradient(90deg, #a8d8b9, #7dd48a); }
.budget-progress-fill.warn { background: linear-gradient(90deg, #e8c87c, #e8a87c); }
.budget-progress-fill.danger { background: linear-gradient(90deg, #e8a8a8, #e8786a); }
.budget-progress-text { display: flex; justify-content: space-between; font-size: 0.8rem; color: #333; }
.budget-card { cursor: pointer; }
.budget-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.budget-card-header-right { display: flex; align-items: center; gap: 6px; }
.budget-arrow { font-size: 0.7rem; color: #a09080; transition: transform 0.3s; }
.budget-arrow.open { transform: rotate(180deg); }
.budget-detail { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.budget-detail.open { max-height: 600px; }
.budget-detail-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid #f0ebe5; }
.budget-detail-item:first-child { border-top: none; }
.budget-detail-name { font-size: 0.8rem; color: #5a4d42; }
.budget-detail-val { font-size: 0.75rem; color: #333; }
.budget-detail-val.ok { color: #7dd48a; }
.budget-detail-val.over { color: #e8786a; }
.budget-l1-row { cursor: pointer; user-select: none; }
.budget-l1-arrow { display: inline-block; width: 12px; transition: transform 0.3s; margin-right: 4px; font-size: 0.7rem; color: #333; }
.budget-l1-arrow.open { transform: rotate(180deg); }
.budget-l1-name { font-size: 0.82rem; color: #4a3f35; font-weight: 500; }
.budget-l1-val { font-size: 0.75rem; color: #8a7a6a; }
.budget-l2-list { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.budget-l2-list.open { max-height: 400px; }
.budget-l2-item { padding: 6px 0 6px 16px; border-top: 1px solid #f5f0ea; display: flex; justify-content: space-between; align-items: center; }
.budget-l2-name { font-size: 0.78rem; color: #6a5d50; }
.budget-l2-val { font-size: 0.72rem; color: #333; }
.budget-l2-val.ok { color: #7dd48a; }
.budget-l2-val.over { color: #e8786a; }


/* ===== 账户余额网格 ===== */
.balance-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.balance-item { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.balance-item .b-account { font-size: 0.8rem; color: #a09080; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance-item .b-balance { font-size: 1.2rem; font-weight: 700; color: #5a4d42; margin-bottom: 2px; }
.balance-item .b-balance.plus { color: #7dd48a; }
.balance-item .b-balance.minus { color: #e8786a; }
.balance-item .b-detail { font-size: 0.7rem; color: #333; }
.balance-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-left: 8px; }

/* ===== 流水列表 ===== */
.flow-list { padding: 0 16px; }
.flow-item { background: #fff; border-radius: 14px; padding: 14px 16px; margin: 10px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer; position: relative; }
.flow-item .fi-row1 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.flow-item .fi-cat { font-size: 0.8rem; background: #f0ebe5; padding: 2px 10px; border-radius: 10px; color: #8a7a6a; font-family: 'ZCOOL XiaoWei', serif; }
.flow-item .fi-amount { font-size: 1.2rem; font-weight: 700; }
.flow-item .fi-amount.income { color: #7dd48a; }
.flow-item .fi-amount.expense { color: #e8786a; }
.flow-item .fi-row2 { display: flex; justify-content: space-between; font-size: 0.75rem; color: #333; }
.flow-item .fi-del { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: #fee; color: #e8786a; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; cursor: pointer; z-index: 2; opacity: 0; transition: opacity 0.15s; }
.flow-item:active .fi-del, .flow-item:hover .fi-del { opacity: 1; }
.flow-item.removing { opacity: 0; transform: translateX(-40px); transition: all 0.25s ease; pointer-events: none; }
.flow-loading { text-align: center; padding: 40px; color: #333; }
.flow-empty { text-align: center; padding: 60px 20px; color: #333; }

/* ===== 二级分类 ===== */
.sub-cat-wrap { margin-top: 10px; }
.sub-cat-label { font-size: 0.75rem; color: #a09080; margin-bottom: 6px; }
.sub-cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sub-cat-chip { padding: 8px 4px; border-radius: 10px; border: 1px solid #e8e0d8; background: #fff; text-align: center; cursor: pointer; font-size: 0.75rem; font-family: 'ZCOOL XiaoWei', serif; color: #5a4d42; transition: all 0.2s; }
.sub-cat-chip.active { border-color: #d4824a; background: #fff5ee; color: #d4824a; }
.selected-cat-display { text-align: center; font-size: 0.9rem; color: #d4824a; padding: 6px; font-family: 'ZCOOL XiaoWei', serif; }


/* ===== 流水月份折叠 ===== */
.month-group { margin-bottom: 4px; }
.month-header { background: #fff; padding: 14px 16px; margin: 6px 0; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.month-header .mh-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1rem; color: #5a4d42; }
.month-header .mh-summary { font-size: 0.85rem; }
.month-header .mh-arrow { transition: transform 0.3s; font-size: 0.8rem; color: #a09080; }
.month-header.open .mh-arrow { transform: rotate(180deg); }
.month-body { overflow: hidden; max-height: 0; }
.month-body.open { max-height: none; overflow: visible; }

/* ===== 账户标签页 ===== */
.accounts-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.as-card { flex: 1; background: #fff; border-radius: 16px; padding: 18px 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); text-align: center; }
.as-card.as-assets { border-left: 4px solid #7dd48a; }
.as-card.as-liabilities { border-left: 4px solid #e8786a; }
.as-label { font-size: 0.8rem; color: #a09080; margin-bottom: 4px; }
.as-value { font-size: 1.4rem; font-weight: 700; }
.as-assets .as-value { color: #7dd48a; }
.as-liabilities .as-value { color: #e8786a; }

.ac-toggle { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0 10px; flex-shrink: 0; }
.ac-toggle input { opacity: 0; width: 0; height: 0; }
.ac-toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #e0d8cf; border-radius: 24px; transition: 0.3s; }
.ac-toggle-slider:before { content: ''; position: absolute; height: 20px; width: 20px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.ac-toggle input:checked + .ac-toggle-slider { background: #a8d8b9; }
.ac-toggle input:checked + .ac-toggle-slider:before { transform: translateX(20px); }

/* ===== 设置页 ===== */
.settings-subtabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid #e8e0d8; }
.ss-tab { flex: 1; padding: 10px 4px; text-align: center; font-size: 0.85rem; color: #8a7a6a; cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; font-family: 'ZCOOL XiaoWei', serif; transition: all 0.2s; }
.ss-tab.active { color: #d4824a; border-bottom-color: #d4824a; }
.ss-panel { min-height: 200px; }
.settings-section { margin-bottom: 20px; }
.settings-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1.1rem; color: #5a4d42; margin-bottom: 14px; }
.settings-add-btn { width: 100%; padding: 12px; border: 1px dashed #e0d8cf; border-radius: 12px; background: transparent; font-size: 0.9rem; color: #d4824a; cursor: pointer; font-family: 'ZCOOL XiaoWei', serif; transition: all 0.2s; margin-top: 12px; }
.settings-add-btn:hover { background: #fff3e6; border-color: #d4824a; }
.cat-row { background: #fff; border-radius: 12px; padding: 12px 16px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.cat-row .cat-name { font-size: 0.95rem; color: #5a4d42; font-family: 'ZCOOL XiaoWei', serif; }
.cat-row .cat-subs { font-size: 0.75rem; color: #a09080; margin-top: 2px; }
.cat-row .cat-actions { display: flex; gap: 4px; flex-shrink: 0; }
.cat-row .cat-actions button { padding: 4px 10px; border: 1px solid #e8e0d8; border-radius: 8px; background: #fff; font-size: 0.75rem; color: #8a7a6a; cursor: pointer; font-family: inherit; }
.cat-row .cat-actions button:hover { background: #f7f3ee; }
.cat-row .cat-actions button.del { color: #e8786a; border-color: #f0d0d0; }
.cat-row .cat-actions button.del:hover { background: #fff0f0; }
.cat-row .cat-actions button.add { color: #7dd48a; border-color: #d0f0d0; }
.acct-row { background: #fff; border-radius: 12px; padding: 12px 16px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 8px; }
.acct-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acct-row .acct-info { flex: 1; min-width: 0; }
.acct-row .acct-name { font-size: 0.95rem; color: #5a4d42; font-family: 'ZCOOL XiaoWei', serif; }
.acct-row .acct-balance { font-size: 1rem; font-weight: 700; }
.acct-row .acct-balance.plus { color: #7dd48a; }
.acct-row .acct-balance.minus { color: #e8786a; }
.acct-row .acct-type { font-size: 0.7rem; color: #333; }
.acct-row .acct-actions { display: flex; gap: 4px; align-items: center; }
.acct-row .acct-actions button { padding: 4px 8px; border: 1px solid #e8e0d8; border-radius: 8px; background: #fff; font-size: 0.7rem; color: #8a7a6a; cursor: pointer; font-family: inherit; }
.acct-row .acct-actions button:hover { background: #f7f3ee; }
.acct-hidden-tag { display: inline-block; font-size: 0.65rem; background: #f0e0e0; color: #e8786a; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.import-type-row { display: flex; gap: 8px; margin-bottom: 16px; }
.import-type-btn { flex: 1; padding: 8px; border: 1px solid #e8e0d8; border-radius: 10px; background: #fff; font-size: 0.85rem; color: #8a7a6a; cursor: pointer; font-family: 'ZCOOL XiaoWei', serif; }
.import-type-btn.active { background: #d4824a; color: #fff; border-color: #d4824a; }
.import-row { background: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; font-size: 0.8rem; }
.import-row input[type=checkbox] { flex-shrink: 0; }
.import-row .ir-info { flex: 1; min-width: 0; }
.import-row .ir-date { color: #a09080; font-size: 0.7rem; }
.import-row .ir-merchant { color: #5a4d42; font-weight: 500; }
.import-row .ir-amount { font-weight: 700; white-space: nowrap; }
.import-row .ir-amount.expense { color: #e8786a; }
.import-row .ir-amount.income { color: #7dd48a; }
.import-row .ir-cat { margin-top: 2px; }
.import-row .ir-cat select { padding: 2px 6px; border: 1px solid #e8e0d8; border-radius: 6px; font-size: 0.7rem; color: #5a4d42; background: #fff; max-width: 100px; }

.account-group { margin-bottom: 24px; }
.account-group-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1rem; color: #8a7a6a; margin-bottom: 10px; padding-left: 4px; }
.account-card { background: #fff; border-radius: 16px; padding: 18px 20px; margin-bottom: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); display: flex; justify-content: space-between; align-items: center; transition: transform 0.15s, box-shadow 0.15s; }
.account-card:active { transform: scale(0.98); }
.account-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.account-card .ac-info { flex: 1; }
.account-card .ac-name { font-size: 1rem; color: #5a4d42; font-family: 'ZCOOL XiaoWei', serif; margin-bottom: 4px; }
.account-card .ac-detail { font-size: 0.75rem; color: #333; }
.account-card .ac-balance { font-size: 1.3rem; font-weight: 700; }
.account-card .ac-balance.plus { color: #7dd48a; }
.account-card .ac-balance.minus { color: #e8786a; }

/* 转账表单 */
.transfer-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.transfer-arrow { font-size: 1.2rem; color: #a09080; flex-shrink: 0; }
.transfer-row .form-select { flex: 1; }

/* 转账面板 */
.transfer-header { padding: 12px 16px 8px; }
.transfer-add-btn {
  width: 100%;
  padding: 12px;
  border: 1px dashed #d4824a;
  border-radius: 14px;
  background: #fff8f4;
  color: #d4824a;
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.transfer-add-btn:hover { background: #fff0e6; }
.transfer-add-btn:active { background: #ffe8d6; }
.transfer-list { padding: 0 4px; }


/* ===== 报表页 ===== */
.report-period { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.report-period select { padding: 8px 14px; border-radius: 12px; border: 1px solid #e8e0d8; background: #fff; font-size: 0.85rem; color: #5a4d42; cursor: pointer; font-family: 'ZCOOL XiaoWei', serif; }
.pie-section { margin-bottom: 28px; }
.pie-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1.1rem; color: #5a4d42; text-align: center; margin-bottom: 16px; }
.pie-chart-wrap { display: flex; flex-direction: column; align-items: center; }
.pie-chart { width: 180px; height: 180px; border-radius: 50%; position: relative; margin-bottom: 16px; }
.pie-center { width: 80px; height: 80px; background: #f7f3ee; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; flex-direction: column; }
.pie-center .total-label { font-size: 0.7rem; color: #333; }
.pie-center .total-value { font-size: 1rem; font-weight: 700; color: #5a4d42; }
.pie-legend { width: 100%; max-width: 360px; }
.pie-legend-item { display: flex; align-items: center; padding: 8px 0; }
.pie-legend-dot { width: 12px; height: 12px; border-radius: 4px; margin-right: 10px; flex-shrink: 0; }
.pie-legend-info { flex: 1; display: flex; justify-content: space-between; align-items: center; }
.pie-legend-name { font-size: 0.9rem; color: #5a4d42; font-family: 'ZCOOL XiaoWei', serif; }
.pie-legend-amount { font-size: 0.9rem; font-weight: 600; color: #5a4d42; }
.pie-legend-pct { font-size: 0.75rem; color: #a09080; margin-left: 6px; }


/* ===== 预算页 v2 ===== */
.flow-filters { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: nowrap; }
.ff-select { padding: 8px 8px; border: 1px solid #e8e0d8; border-radius: 10px; font-size: 0.80rem; color: #5a4d42; background: #fff; font-family: inherit; outline: none; flex: 1 1 auto; min-width: 0; }
.ff-select:focus { border-color: #d4824a; }
.flow-account-tag { display: inline-flex; align-items: center; gap: 4px; background: #fff3e6; border: 1px solid #e8a87c; border-radius: 12px; padding: 6px 10px; font-size: 0.8rem; color: #d4824a; cursor: pointer; white-space: nowrap; font-family: 'ZCOOL XiaoWei', serif; }
.flow-account-tag:hover { background: #ffe6cc; }

.budget-period-row { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.budget-period-row select { padding: 8px 12px; border: 1px solid #e8e0d8; border-radius: 10px; font-size: 0.85rem; color: #5a4d42; background: #fff; font-family: inherit; outline: none; }
.budget-period-row select:focus { border-color: #d4824a; }
.budget-summary { background: #fff; border-radius: 16px; padding: 18px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 16px; }
.budget-summary-row { display: flex; gap: 12px; }
.budget-summary-cell { flex: 1; text-align: center; }
.budget-summary-cell .bs-label { font-size: 0.7rem; color: #a09080; margin-bottom: 3px; }
.budget-summary-cell .bs-value { font-size: 1rem; font-weight: 700; color: #5a4d42; }
.budget-summary-cell .bs-value.danger { color: #e8786a; }
.budget-summary-cell .bs-value.safe { color: #7dd48a; }
.budget-progress-wrap { margin-top: 10px; }
.budget-progress-label { display: flex; justify-content: space-between; font-size: 0.7rem; color: #a09080; margin-bottom: 3px; }
.budget-progress-bar { height: 8px; background: #f0ebe5; border-radius: 4px; overflow: hidden; }
.budget-progress-inner { height: 100%; border-radius: 4px; transition: width 0.5s; }
.budget-progress-inner.safe { background: linear-gradient(90deg, #a8d8b9, #7dd48a); }
.budget-progress-inner.warn { background: linear-gradient(90deg, #e8c87c, #e8a87c); }
.budget-progress-inner.danger { background: linear-gradient(90deg, #e8a8a8, #e8786a); }

/* 分类预算列表（行式，点击编辑） */
.bg-cat-list { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.bg-cat-row { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid #f0ebe5; cursor: pointer; transition: background 0.15s; }
.bg-cat-row:last-child { border-bottom: none; }
.bg-cat-row:active { background: #faf6f2; }
.bg-cat-left { flex: 1; min-width: 0; }
.bg-cat-name { font-size: 0.95rem; color: #5a4d42; font-family: 'ZCOOL XiaoWei', serif; }
.bg-cat-spent { font-size: 0.75rem; color: #e8786a; margin-top: 2px; }
.bg-cat-right { text-align: right; flex-shrink: 0; margin-left: 12px; }
.bg-cat-budget { font-size: 0.95rem; font-weight: 600; color: #5a4d42; }
.bg-cat-arrow { display: inline-block; width: 14px; transition: transform 0.3s; margin-right: 4px; font-size: 0.65rem; color: #a09080; cursor: pointer; user-select: none; }
.bg-cat-arrow.open { transform: rotate(180deg); }
.bg-cat-l2-wrap { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.bg-cat-l2-wrap.open { max-height: 800px; }
.bg-cat-remain { font-size: 0.72rem; margin-top: 2px; }
.bg-cat-remain.ok { color: #333; }
.bg-cat-remain.over { color: #e8786a; }

/* 预算编辑弹窗 */
.bg-edit-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 450; display: none; align-items: flex-end; justify-content: center; }
.bg-edit-modal.active { display: flex; }
.bg-edit-panel { background: #fff; border-radius: 24px 24px 0 0; width: 100%; max-width: 600px; padding: 24px 20px 32px; transform: translateY(100%); transition: transform 0.3s; }
.bg-edit-modal.active .bg-edit-panel { transform: translateY(0); }
.bg-edit-amount { font-size: 2rem; font-weight: 700; text-align: center; padding: 16px; border: none; border-bottom: 2px solid #e8e0d8; width: 160px; outline: none; background: transparent; color: #5a4d42; display: block; margin: 0 auto 20px; }
.bg-edit-amount:focus { border-bottom-color: #d4824a; }

/* ===== 分类支出 ===== */
.section-title {
  font-family: 'ZCOOL XiaoWei', serif;
  font-size: 1.1rem;
  color: #5a4d42;
  margin-bottom: 16px;
  padding-left: 8px;
}
.category-list {
  background: #fff;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.category-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0ebe5;
}
.category-item:last-child { border-bottom: none; }
.category-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 14px; font-size: 1.2rem;
}
.category-info { flex: 1; }
.category-name { font-size: 0.95rem; color: #5a4d42; margin-bottom: 2px; }
.category-bar { height: 4px; background: #f0ebe5; border-radius: 2px; overflow: hidden; }
.category-bar-fill { height: 100%; background: linear-gradient(90deg, #e8a87c, #d4824a); border-radius: 2px; }
.category-amount { text-align: right; margin-left: 12px; }
.category-amount-value { font-size: 1rem; font-weight: 600; color: #5a4d42; }
.category-amount-percent { font-size: 0.75rem; color: #333; }

/* ===== FAB 按钮 ===== */
.fab {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8a87c 0%, #d4824a 100%);
  color: #fff;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 130, 74, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(212, 130, 74, 0.5); }
.fab:active { transform: scale(0.95); }
.fab.dragging { transition: none !important; }

/* ===== 记一笔弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 400;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-panel {
  background: #fff;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-panel { transform: translateY(0); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1.3rem; color: #5a4d42; }
.modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #f0ebe5;
  border: none;
  font-size: 1.2rem;
  color: #8a7a6a;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* 金额输入 */
.amount-input-wrap { text-align: center; margin-bottom: 20px; }
.amount-input-wrap .currency { font-size: 1.5rem; color: #5a4d42; margin-right: 4px; }
.amount-input {
  font-size: 2.5rem;
  font-weight: 700;
  color: #5a4d42;
  border: none;
  border-bottom: 2px solid #e8e0d8;
  text-align: center;
  width: 200px;
  outline: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
}
.amount-input:focus { border-bottom-color: #d4824a; }

/* 收支切换 */
.type-switch {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.type-switch button {
  padding: 10px 28px;
  border-radius: 24px;
  border: 2px solid #e8e0d8;
  background: #fff;
  font-size: 1rem;
  font-family: 'ZCOOL XiaoWei', serif;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #8a7a6a;
}
.type-switch button.active-expense {
  border-color: #e8786a;
  background: #fff0ee;
  color: #e8786a;
}
.type-switch button.active-income {
  border-color: #7dd48a;
  background: #f0fff2;
  color: #7dd48a;
}

/* 表单字段 */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 0.8rem; color: #a09080; margin-bottom: 6px; display: block; }
.form-select, .form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e8e0d8;
  border-radius: 12px;
  font-size: 1rem;
  color: #5a4d42;
  background: #fff;
  font-family: 'Nunito', 'ZCOOL XiaoWei', sans-serif;
  outline: none;
}
.form-select:focus, .form-input:focus { border-color: #d4824a; }

/* 分类选择网格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.category-chip {
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid #e8e0d8;
  background: #fff;
  text-align: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'ZCOOL XiaoWei', serif;
  color: #5a4d42;
  transition: all 0.2s ease;
}
.category-chip.active {
  border-color: #d4824a;
  background: #fff5ee;
  color: #d4824a;
}

/* 提交按钮 */
.submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #e8a87c 0%, #d4824a 100%);
  color: #fff;
  font-size: 1.1rem;
  font-family: 'ZCOOL XiaoWei', serif;
  cursor: pointer;
  margin-top: 8px;
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .content { padding: 16px 12px; }
  .account-summary { padding: 22px 18px; }
  .account-summary .amount { font-size: 1.8rem; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ===== 可展开时间统计 ===== */
.expand-section { background: #fff; border-radius: 16px; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; }
.expand-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; cursor: pointer; }
.expand-header-title { font-family: 'ZCOOL XiaoWei', serif; font-size: 1rem; color: #5a4d42; }
.expand-header-arrow { font-size: 0.8rem; color: #a09080; transition: transform 0.3s; }
.expand-header.open .expand-header-arrow { transform: rotate(180deg); }
.expand-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.expand-body.open { max-height: 800px; }
.expand-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; border-top: 1px solid #f0ebe5; }
.expand-row-label { font-size: 0.85rem; color: #5a4d42; }
.expand-row-date { font-size: 0.7rem; color: #a09080; margin-left: 6px; }
.expand-row-value { font-size: 0.9rem; font-weight: 600; }
.expand-row-value.income { color: #7dd48a; }
.expand-row-value.expense { color: #e8786a; }

/* ===== 分类预算列表 ===== */
.budget-cat-list { background: #fff; border-radius: 0 0 16px 16px; padding: 0 18px 12px; margin-top: -6px; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); display: none; }
.budget-cat-item { padding: 8px 0; border-top: 1px solid #f0ebe5; }
.budget-cat-item:first-child { border-top: none; }
.budget-cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.budget-cat-name { font-size: 0.8rem; color: #5a4d42; }
.budget-cat-num { font-size: 0.75rem; color: #333; }
.budget-cat-progress { height: 6px; background: #f0ebe5; border-radius: 3px; overflow: hidden; }
.budget-cat-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.budget-cat-fill.safe { background: linear-gradient(90deg, #a8d8b9, #7dd48a); }
.budget-cat-fill.warn { background: linear-gradient(90deg, #e8c87c, #e8a87c); }
.budget-cat-fill.danger { background: linear-gradient(90deg, #e8a8a8, #e8786a); }

/* ===== 每月收支对比 ===== */
.monthly-compare { background: #fff; border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.mc-legend { display: flex; gap: 16px; margin-bottom: 10px; font-size: 0.75rem; }
.mc-legend span { display: flex; align-items: center; gap: 4px; }
.mc-legend .dot { width: 10px; height: 10px; border-radius: 3px; }
.mc-legend .dot.inc { background: #7dd48a; }
.mc-legend .dot.exp { background: #e8786a; }
.mc-row { display: flex; align-items: center; padding: 4px 0; gap: 8px; }
.mc-month { width: 36px; font-size: 0.75rem; color: #5a4d42; font-weight: 600; flex-shrink: 0; }
.mc-bar-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mc-bar-row { display: flex; align-items: center; gap: 6px; height: 16px; }
.mc-bar-label { width: 32px; font-size: 0.65rem; color: #a09080; flex-shrink: 0; text-align: right; }
.mc-bar-track { flex: 1; height: 12px; background: #f0ebe5; border-radius: 6px; overflow: hidden; }
.mc-bar-fill { height: 100%; border-radius: 6px; }
.mc-bar-fill.inc { background: #7dd48a; }
.mc-bar-fill.exp { background: #e8786a; }
.mc-amount { width: 70px; font-size: 0.7rem; text-align: right; color: #5a4d42; flex-shrink: 0; font-weight: 500; }

/* ===== TOP5 ===== */
.top5-list { background: #fff; border-radius: 16px; padding: 12px 18px; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.top5-item { display: flex; align-items: center; padding: 8px 0; border-top: 1px solid #f0ebe5; }
.top5-item:first-child { border-top: none; }
.top5-rank { width: 22px; height: 22px; border-radius: 50%; background: #f0ebe5; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: #8a7a6a; margin-right: 10px; flex-shrink: 0; }
.top5-rank.top { background: #e8a87c; color: #fff; }
.top5-info { flex: 1; min-width: 0; }
.top5-cat { font-size: 0.8rem; color: #5a4d42; }
.top5-merchant { font-size: 0.7rem; color: #a09080; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5-amount { font-size: 0.9rem; font-weight: 600; color: #e8786a; flex-shrink: 0; }

/* ===== 每年统计表格 ===== */
.yearly-table { background: #fff; border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow-x: auto; }
.yt-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.yt-table th { text-align: left; padding: 8px 4px; color: #a09080; font-weight: normal; border-bottom: 1px solid #e8e0d8; }
.yt-table td { padding: 10px 4px; border-bottom: 1px solid #f0ebe5; }
.yt-table tr:last-child td { border-bottom: none; }
.yt-income { color: #7dd48a; }
.yt-expense { color: #e8786a; }
.yt-net { font-weight: 600; }


/* 密码验证 */
.auth-overlay { position: fixed; inset: 0; background: rgba(90,77,66,0.65); backdrop-filter: blur(6px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.auth-overlay.hidden { display: none; }
.auth-box { background: #fff; border-radius: 20px; padding: 40px 36px; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,0.18); max-width: 340px; width: 90%; }
.auth-box .auth-icon { font-size: 2.4rem; margin-bottom: 12px; }
.auth-box .auth-title { font-family: 'ZCOOL XiaoWei',serif; font-size: 1.2rem; color: #5a4d42; margin-bottom: 6px; }
.auth-box .auth-sub { font-size: 0.78rem; color: #a09080; margin-bottom: 22px; }
.auth-box input { width: 100%; padding: 12px 16px; border: 2px solid #e8e0d8; border-radius: 12px; font-size: 1.1rem; text-align: center; color: #5a4d42; outline: none; transition: border-color 0.3s; }
.auth-box input:focus { border-color: #c9a87c; }
.auth-box input.error { border-color: #e8786a; animation: shake 0.4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
.auth-box .auth-hint { font-size: 0.7rem; color: #e8786a; margin-top: 8px; min-height: 20px; }
