/* ========================================
   糖果财务日记 - 样式表
   移动端优先 · 可爱风格
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  --pink: #FF8FA3;
  --pink-dark: #F08090;
  --pink-light: #FFB5C2;
  --pink-bg: #FFF0F3;
  --mint: #7EC8A0;
  --mint-dark: #6AB88E;
  --mint-light: #B5EAD7;
  --mint-bg: #E8F8F0;
  --lavender: #A9B5E0;
  --lavender-dark: #959FD0;
  --lavender-light: #C7CEEA;
  --lavender-bg: #F0F2FA;
  --peach: #FFDAC1;
  --peach-light: #FFE8D6;
  --yellow: #FFF5D6;
  --yellow-light: #FFFBE8;
  --white: #FFFFFF;
  --text: #4A3F5C;
  --text-light: #8B7A9E;
  --text-lighter: #B0A3C0;
  --shadow-sm: 0 2px 8px rgba(74, 63, 92, 0.08);
  --shadow-md: 0 4px 16px rgba(74, 63, 92, 0.10);
  --shadow-lg: 0 8px 30px rgba(74, 63, 92, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --nav-height: 65px;
  --header-height: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== 全局重置 ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #FFF0F3 0%, #F0F2FA 50%, #E8F8F0 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ===== App 容器 ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

/* ===== 顶部标题栏 ===== */
#top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(196, 180, 210, 0.15);
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-emoji {
  font-size: 22px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.header-right {
  padding: 4px 14px;
  background: var(--pink-bg);
  border-radius: 20px;
  font-size: 12px;
  color: var(--pink-dark);
  font-weight: 600;
}

/* ===== 页面容器 ===== */
#page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 8px;
  scroll-behavior: smooth;
}

/* ===== 页面通用 ===== */
.page {
  display: none;
  padding: 12px 0 16px;
  animation: pageIn 0.35s ease-out;
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  margin-bottom: 18px;
  padding: 4px 0;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 400;
}

/* ===== 表单样式 ===== */
.cute-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group:focus-within {
  border-color: var(--pink-light);
  box-shadow: 0 0 0 3px rgba(255, 143, 163, 0.12);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 10px;
}

/* ===== 日期下拉框 ===== */
.date-selects {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-sep {
  color: var(--text-lighter);
  font-size: 14px;
  margin: 0 1px;
}

.cute-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--pink-bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  min-width: 0;
  flex: 1;
  text-align: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238B7A9E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.cute-select:focus {
  background-color: #FFE4E9;
}

.year-select {
  flex: 1.5;
}

.month-select,
.day-select {
  flex: 1;
}

.btn-today {
  margin-top: 8px;
  padding: 6px 16px;
  background: var(--yellow-light);
  border: 1.5px solid #F5E6C8;
  border-radius: 20px;
  font-size: 12px;
  color: #B8976A;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-today:active {
  transform: scale(0.96);
  background: var(--yellow);
}

/* ===== 金额输入 ===== */
.amount-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--pink-bg);
  border-radius: var(--radius-sm);
  padding: 0 14px;
}

.amount-prefix {
  font-size: 20px;
  font-weight: 700;
  color: var(--pink-dark);
  margin-right: 4px;
}

.cute-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.cute-input::placeholder {
  color: var(--text-lighter);
  font-weight: 400;
  font-size: 18px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== 文本框 ===== */
.cute-textarea {
  width: 100%;
  border: none;
  background: var(--pink-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
}

.cute-textarea::placeholder {
  color: var(--text-lighter);
}

.cute-textarea:focus {
  background: #FFE4E9;
}

/* ===== 提交按钮 ===== */
.btn-submit {
  width: 100%;
  border: none;
  border-radius: var(--radius-xl);
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn-submit:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

.btn-pink {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: white;
}

.btn-mint {
  background: linear-gradient(135deg, var(--mint) 0%, var(--mint-dark) 100%);
  color: white;
}

.btn-lavender {
  background: linear-gradient(135deg, var(--lavender) 0%, var(--lavender-dark) 100%);
  color: white;
}

/* ===== 底部导航栏 ===== */
#bottom-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(196, 180, 210, 0.15);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  z-index: 10;
  height: calc(var(--nav-height) + var(--safe-bottom));
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px 2px;
  transition: all 0.2s;
  position: relative;
}

.nav-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--pink);
  transition: width 0.25s ease;
}

.nav-item.active::after {
  width: 24px;
}

.nav-icon {
  font-size: 22px;
  transition: transform 0.2s;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  font-size: 10px;
  color: var(--text-lighter);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-item.active .nav-label {
  color: var(--pink-dark);
  font-weight: 700;
}

/* ===== 周期切换标签 ===== */
.period-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}

.period-tab {
  flex: 1;
  min-width: 44px;
  padding: 7px 0;
  border: none;
  background: var(--white);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.period-tab.active {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 143, 163, 0.35);
}

.period-tab:active {
  transform: scale(0.95);
}

/* ===== 周期导航 ===== */
.period-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.period-nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--pink-bg);
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--pink-dark);
  font-weight: 700;
}

.period-nav-btn:active {
  transform: scale(0.9);
  background: var(--pink-light);
}

.period-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ===== 总计卡片 ===== */
.total-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.total-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.total-expense::before {
  background: linear-gradient(90deg, var(--pink), var(--pink-light));
}

.total-income::before {
  background: linear-gradient(90deg, var(--mint), var(--mint-light));
}

.total-label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.total-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.total-expense .total-amount {
  color: var(--pink-dark);
}

.total-income .total-amount {
  color: var(--mint-dark);
}

/* ===== 分类明细 ===== */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-left: 2px;
}

.category-breakdown {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(196, 180, 210, 0.12);
}

.category-item:last-child {
  border-bottom: none;
}

.category-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.category-bar-bg {
  height: 6px;
  background: var(--pink-bg);
  border-radius: 3px;
  overflow: hidden;
}

.category-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--pink), var(--pink-light));
  transition: width 0.6s ease;
  min-width: 2px;
}

.category-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
  min-width: 64px;
}

/* ===== 记录列表 ===== */
.entry-list {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 4px 0;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(196, 180, 210, 0.1);
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-icon {
  font-size: 18px;
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}

.entry-info {
  flex: 1;
  min-width: 0;
}

.entry-category {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.entry-detail {
  font-size: 11px;
  color: var(--text-lighter);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.entry-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-lighter);
  font-size: 14px;
}

.entry-empty .empty-emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

/* ===== 导出页面 ===== */
.export-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.export-date-range {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-range-sep {
  text-align: center;
  font-size: 13px;
  color: var(--text-lighter);
  font-weight: 600;
}

.export-format-options {
  display: flex;
  gap: 12px;
}

.format-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--pink-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.format-option:has(input:checked) {
  background: var(--peach-light);
  border-color: var(--peach);
}

.format-option input {
  display: none;
}

.format-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ===== 数据统计概览 ===== */
.export-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  font-size: 11px;
  color: var(--text-lighter);
  white-space: nowrap;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(74, 63, 92, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  padding: 16px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  text-align: center;
  max-width: 80%;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

/* ===== 删除按钮 ===== */
.btn-delete {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: all 0.2s;
  opacity: 0.5;
  flex-shrink: 0;
}

.btn-delete:active {
  opacity: 1;
  background: rgba(255, 0, 0, 0.08);
}

/* ===== 滚动条美化 ===== */
#page-container::-webkit-scrollbar {
  width: 3px;
}

#page-container::-webkit-scrollbar-track {
  background: transparent;
}

#page-container::-webkit-scrollbar-thumb {
  background: var(--text-lighter);
  border-radius: 2px;
}

/* ===== 安全区域适配 ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  #bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== iPhone 小屏适配 ===== */
@media screen and (max-width: 375px) {
  .page-title {
    font-size: 19px;
  }
  .total-amount {
    font-size: 24px;
  }
  .nav-label {
    font-size: 9px;
  }
  .nav-icon {
    font-size: 20px;
  }
  .cute-input {
    font-size: 18px;
  }
  .form-group {
    padding: 12px 14px;
  }
}

/* ===== 没有数据时的动画 ===== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.entry-empty .empty-emoji {
  animation: float 3s ease-in-out infinite;
}

/* ===== 收入分类条颜色 ===== */
.income-bar {
  background: linear-gradient(90deg, var(--mint), var(--mint-light)) !important;
}

/* ========================================
   新增：图表、可折叠列表、对比页、导出 HTML
   ======================================== */

/* ===== 图表容器 ===== */
.chart-container {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  max-width: 100%;
  max-height: 260px;
}

.small-chart canvas {
  max-height: 200px;
}

/* ===== 可折叠记录列表 ===== */
.collapsible-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 4px;
  margin-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: background 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.collapsible-title:active {
  background: var(--pink-bg);
}

.collapse-arrow {
  font-size: 12px;
  color: var(--text-lighter);
  transition: transform 0.3s ease;
  display: inline-block;
}

.collapse-arrow.open {
  transform: rotate(90deg);
}

.collapsible-content {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}

/* ===== 对比页 ===== */
.compare-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.compare-date-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-bottom: 8px;
}

.compare-date-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compare-date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  min-width: 20px;
}

.compare-to {
  text-align: center;
  font-size: 18px;
  color: var(--text-lighter);
}

.compare-quick-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.compare-summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.compare-summary-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.card-income {
  border-top: 3px solid var(--mint);
}

.card-expense {
  border-top: 3px solid var(--pink);
}

.card-net {
  border-top: 3px solid var(--lavender);
}

.cs-label {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.cs-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.card-income .cs-amount { color: var(--mint-dark); }
.card-expense .cs-amount { color: var(--pink-dark); }

/* ===== 双饼图布局 ===== */
.dual-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.dual-chart .section-title {
  font-size: 12px;
  text-align: center;
}

/* ===== 小屏适配补充 ===== */
@media screen and (max-width: 375px) {
  .compare-summary-cards {
    gap: 5px;
  }
  .compare-summary-card {
    padding: 10px 6px;
  }
  .cs-amount {
    font-size: 15px;
  }
  .dual-charts {
    gap: 6px;
  }
}

/* ===== 6个导航项适配 ===== */
.nav-item .nav-label {
  font-size: 9px;
}

/* ========================================
   编辑弹窗
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 63, 92, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 8px 20px 28px;
  box-shadow: 0 -8px 30px rgba(74, 63, 92, 0.15);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: #D8D0E0;
  border-radius: 2px;
  margin: 0 auto 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--pink-bg);
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:active {
  transform: scale(0.9);
  background: var(--pink-light);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn-submit {
  flex: 2;
}

.btn-cancel {
  flex: 1;
  border: 2px solid var(--pink-bg);
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:active {
  background: var(--pink-bg);
  transform: scale(0.97);
}

/* ===== 编辑/删除按钮 ===== */
.btn-entry-action {
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 4px;
  border-radius: 8px;
  transition: all 0.2s;
  opacity: 0.4;
  flex-shrink: 0;
  line-height: 1;
}

.btn-entry-action:active {
  opacity: 1;
  transform: scale(1.15);
}

.btn-entry-action.edit-btn {
  opacity: 0.5;
}

/* ===== 可滑动图表 ===== */
.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  justify-content: flex-start !important;
}
.chart-scroll canvas { max-width: none !important; min-height: 180px; }
.chart-scroll::-webkit-scrollbar { height: 5px; }
.chart-scroll::-webkit-scrollbar-track { background: var(--pink-bg); border-radius: 3px; }
.chart-scroll::-webkit-scrollbar-thumb { background: var(--pink-light); border-radius: 3px; }

/* ===== 日历输入框 ===== */
.cute-date-input {
  appearance: none; -webkit-appearance: none;
  background: var(--pink-bg); border: none;
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 15px; color: var(--text); font-weight: 600;
  outline: none; width: 100%; font-family: inherit; min-height: 40px;
}
.cute-date-input:focus { background: #FFE4E9; }
.cute-date-input::-webkit-calendar-picker-indicator { opacity: 0.5; padding: 4px; cursor: pointer; }

/* ===== 对比页 ===== */
.compare-card { background: var(--white); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-md); }
.compare-date-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.compare-date-field { flex: 1; display: flex; align-items: center; gap: 6px; }
.compare-date-label { font-size: 13px; font-weight: 600; color: var(--text-light); flex-shrink: 0; }
.compare-to { font-size: 16px; color: var(--text-lighter); flex-shrink: 0; padding: 0 2px; }
.compare-quick-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.compare-summary-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.compare-summary-card { background: var(--white); border-radius: var(--radius-md); padding: 14px 10px; text-align: center; box-shadow: var(--shadow-sm); }
.card-income { border-top: 3px solid var(--mint); }
.card-expense { border-top: 3px solid var(--pink); }
.card-net { border-top: 3px solid var(--lavender); }
.cs-label { font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.cs-amount { font-size: 18px; font-weight: 800; color: var(--text); }
.card-income .cs-amount { color: var(--mint-dark); }
.card-expense .cs-amount { color: var(--pink-dark); }
.dual-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.dual-chart .section-title { font-size: 12px; text-align: center; }

/* ===== 编辑弹窗 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(74,63,92,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal-sheet { background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; padding: 8px 20px 28px; box-shadow: 0 -8px 30px rgba(74,63,92,0.15); animation: slideUp 0.3s ease; }
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-handle { width: 36px; height: 4px; background: #D8D0E0; border-radius: 2px; margin: 0 auto 12px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close-btn { width: 32px; height: 32px; border: none; background: var(--pink-bg); border-radius: 50%; font-size: 16px; color: var(--text-light); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.modal-close-btn:active { transform: scale(0.9); background: var(--pink-light); }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn-submit { flex: 2; }
.btn-cancel { flex: 1; border: 2px solid var(--pink-bg); background: var(--white); border-radius: var(--radius-xl); padding: 12px; font-size: 15px; font-weight: 600; color: var(--text-light); cursor: pointer; transition: all 0.2s; }
.btn-cancel:active { background: var(--pink-bg); transform: scale(0.97); }
.btn-entry-action { border: none; background: transparent; font-size: 14px; cursor: pointer; padding: 4px; border-radius: 8px; transition: all 0.2s; opacity: 0.4; flex-shrink: 0; line-height: 1; }
.btn-entry-action:active { opacity: 1; transform: scale(1.15); }

/* ===== 登录/注册页 ===== */
#auth-app { height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #FFF0F3 0%, #F0F2FA 50%, #E8F8F0 100%); padding: 24px; }
.auth-page { width: 100%; max-width: 360px; animation: pageIn 0.4s ease; }
.auth-box { background: rgba(255,255,255,0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: var(--radius-xl); padding: 36px 28px 28px; box-shadow: var(--shadow-lg); text-align: center; }
.auth-emoji { font-size: 48px; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
.auth-title { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.auth-desc { font-size: 14px; color: var(--text-light); margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-input-group { display: flex; align-items: center; background: var(--pink-bg); border-radius: var(--radius-sm); padding: 0 14px; gap: 8px; border: 2px solid transparent; transition: border-color 0.2s; }
.auth-input-group:focus-within { border-color: var(--pink-light); background: #FFE4E9; }
.auth-input-icon { font-size: 18px; flex-shrink: 0; }
.auth-input { flex: 1; border: none; background: transparent; padding: 12px 0; font-size: 15px; color: var(--text); outline: none; font-family: inherit; font-weight: 500; }
.auth-input::placeholder { color: var(--text-lighter); font-weight: 400; }
.auth-btn { width: 100%; border: none; border-radius: var(--radius-xl); padding: 13px 20px; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.2s; letter-spacing: 0.5px; font-family: inherit; }
.auth-btn:active { transform: scale(0.97); }
.auth-btn-primary { background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%); color: white; box-shadow: 0 4px 15px rgba(255,143,163,0.35); }
.auth-switch { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.auth-switch a { color: var(--pink-dark); text-decoration: none; font-weight: 600; }
.auth-switch a:active { opacity: 0.7; }

/* ===== 财富森林 ===== */
.forest-display { background: linear-gradient(180deg, #FFF5F7 0%, #FFDEE4 30%, #FFE8EC 50%, #F5E8D8 72%, #E8DCC8 100%); border-radius: var(--radius-lg); padding: 24px 12px 18px; margin-bottom: 14px; box-shadow: var(--shadow-md); position: relative; overflow: hidden; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.cloud { position: absolute; background: rgba(255,255,255,0.7); border-radius: 50px; z-index: 0; pointer-events: none; }
.cloud::before, .cloud::after { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.cloud-1 { width: 70px; height: 24px; top: 12%; left: 10%; animation: cloudDrift 8s ease-in-out infinite; }
.cloud-1::before { width: 30px; height: 30px; top: -14px; left: 10px; }
.cloud-1::after { width: 40px; height: 32px; top: -16px; left: 30px; }
.cloud-2 { width: 55px; height: 20px; top: 20%; right: 15%; animation: cloudDrift 10s ease-in-out infinite reverse; }
.cloud-2::before { width: 25px; height: 24px; top: -12px; left: 8px; }
.cloud-2::after { width: 30px; height: 26px; top: -14px; left: 25px; }
.cloud-3 { width: 45px; height: 16px; top: 8%; left: 50%; animation: cloudDrift 12s ease-in-out infinite 2s; }
.cloud-3::before { width: 20px; height: 20px; top: -10px; left: 6px; }
.cloud-3::after { width: 25px; height: 22px; top: -12px; left: 20px; }
@keyframes cloudDrift { 0%,100% { transform: translateX(0); } 50% { transform: translateX(20px); } }
.star { position: absolute; width: 6px; height: 6px; background: #FFD700; border-radius: 50%; z-index: 0; pointer-events: none; animation: sparkle 2s ease-in-out infinite; }
.star:nth-child(2) { animation-delay: 0.7s; width: 4px; height: 4px; }
.star:nth-child(3) { animation-delay: 1.4s; width: 5px; height: 5px; }
@keyframes sparkle { 0%,100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.2); } }
.tree-scene { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 100%; min-height: 230px; }
.tree-visual { font-size: 130px; line-height: 1; position: relative; z-index: 2; transition: all 0.5s ease; animation: treeSway 3s ease-in-out infinite; filter: drop-shadow(0 6px 20px rgba(255,143,163,0.35)); cursor: pointer; user-select: none; text-shadow: 0 2px 10px rgba(255,200,210,0.3); }
.tree-visual:active { animation: treeBounce 0.3s ease; }
@keyframes treeSway { 0%,100% { transform: translateY(0) rotate(0deg); } 25% { transform: translateY(-3px) rotate(0.5deg); } 50% { transform: translateY(-5px) rotate(0deg); } 75% { transform: translateY(-3px) rotate(-0.5deg); } }
@keyframes treeBounce { 0% { transform: scale(1); } 40% { transform: scale(1.2); } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
.tree-glow { position: absolute; top: 45%; left: 50%; transform: translate(-50%,-50%); width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(255,143,163,0.2) 0%, rgba(255,183,197,0.1) 40%, transparent 70%); z-index: 1; animation: glowPulse 3s ease-in-out infinite; }
@keyframes glowPulse { 0%,100% { transform: translate(-50%,-50%) scale(1); opacity: 0.4; } 50% { transform: translate(-50%,-50%) scale(1.3); opacity: 0.7; } }
.tree-ground { width: 75%; max-width: 200px; height: 14px; background: linear-gradient(180deg, #D4C5A0 0%, #C8B890 100%); border-radius: 50%; margin-top: -10px; position: relative; z-index: 3; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.grass-tuft { position: absolute; z-index: 3; font-size: 14px; bottom: 4px; pointer-events: none; }
.tree-deco { position: absolute; z-index: 2; font-size: 22px; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,0.1); line-height: 1; }
.petal-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.petal { position: absolute; font-size: 13px; animation: petalFall linear infinite; opacity: 0.5; }
@keyframes petalFall { 0% { transform: translateY(-20px) rotate(0deg) translateX(0); opacity: 0; } 10% { opacity: 0.7; } 90% { opacity: 0.3; } 100% { transform: translateY(320px) rotate(400deg) translateX(50px); opacity: 0; } }
.forest-stats-card { background: var(--white); border-radius: var(--radius-md); padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.level-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.level-badge { background: linear-gradient(135deg, var(--pink) 0%, var(--pink-dark) 100%); color: white; padding: 6px 16px; border-radius: 20px; font-size: 14px; font-weight: 700; box-shadow: 0 3px 10px rgba(255,143,163,0.3); }
.level-name { font-size: 16px; font-weight: 700; color: var(--text); }
.exp-row { margin-bottom: 8px; }
.exp-label-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
.exp-label-row b { color: var(--pink-dark); font-size: 14px; }
.exp-bar-bg { height: 10px; background: var(--pink-bg); border-radius: 5px; overflow: hidden; }
.exp-bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--pink) 0%, var(--pink-light) 100%); transition: width 0.6s ease; min-width: 0; }
.next-hint { font-size: 12px; color: var(--text-light); text-align: center; margin-top: 8px; }
.next-hint span { color: var(--pink-dark); font-weight: 700; }
.forest-today-card { background: var(--white); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.today-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-light); }
.today-row b { color: var(--text); font-size: 14px; }
.unlock-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 20px; }
.unlock-item { background: var(--white); border-radius: var(--radius-sm); padding: 12px 6px; text-align: center; box-shadow: var(--shadow-sm); transition: all 0.3s ease; }
.unlock-item.locked { opacity: 0.35; filter: grayscale(0.8); }
.unlock-item.unlocked { border: 2px solid var(--pink-light); background: var(--pink-bg); }
.unlock-icon { font-size: 24px; display: block; margin-bottom: 4px; }
.unlock-name { font-size: 10px; color: var(--text); font-weight: 600; }
.unlock-item.locked .unlock-name { color: var(--text-lighter); }
@keyframes levelUpFlash { 0% { transform: scale(1); } 30% { transform: scale(1.3); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }
.level-up .tree-visual { animation: levelUpFlash 0.6s ease; }
@media screen and (max-width: 375px) {
  .unlock-grid { gap: 4px; }
  .unlock-item { padding: 8px 4px; }
  .unlock-icon { font-size: 20px; }
  .tree-visual { font-size: 90px; }
  .forest-display { min-height: 190px; }
  .compare-summary-cards { gap: 5px; }
  .compare-summary-card { padding: 10px 6px; }
  .cs-amount { font-size: 15px; }
  .dual-charts { gap: 6px; }
}

/* ===== 存款页 ===== */
.deposit-hero-card {
  background: linear-gradient(135deg, #A9B5E0 0%, #C7CEEA 100%);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(169, 181, 224, 0.35);
  position: relative;
  overflow: hidden;
}
.deposit-hero-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.deposit-hero-card::after {
  content: '';
  position: absolute;
  bottom: -20px; left: -20px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.deposit-hero-label {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
  font-weight: 600;
}
.deposit-hero-amount {
  font-size: 36px;
  font-weight: 800;
  color: white;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.deposit-set-btn {
  margin-top: 12px;
  padding: 6px 18px;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 13px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.deposit-set-btn:active {
  background: rgba(255,255,255,0.35);
  transform: scale(0.96);
}

