/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Noto Sans CJK SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f5f5f7;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea { font-family: inherit; outline: none; }

/* ========== 黑金深色主题（首页/登录/设置） ========== */
.dark-theme {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
  color: #f5f5f5;
  min-height: 100vh;
}
.dark-theme .logo { color: #d4af37; letter-spacing: 4px; font-weight: 300; }
.dark-theme .subtitle { color: rgba(255,255,255,0.5); font-size: 12px; letter-spacing: 2px; }
.dark-theme .card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}
.dark-theme .card:hover {
  border-color: rgba(212,175,55,0.4);
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
}
.dark-theme .card-title { color: #d4af37; font-size: 18px; font-weight: 500; }
.dark-theme .card-value { font-size: 36px; font-weight: 200; color: #fff; }
.dark-theme .card-desc { color: rgba(255,255,255,0.4); font-size: 12px; margin-top: 8px; }
.dark-theme .icon-circle {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(212,175,55,0.1);
  color: #d4af37; font-size: 22px;
}

/* ========== 浅色模块主题 ========== */
.light-theme { background: #f5f5f7; min-height: 100vh; padding-bottom: 100px; }
.light-theme .page-header {
  background: #fff; padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #eee;
  position: sticky; top: 0; z-index: 100;
}
.light-theme .back-btn {
  font-size: 20px; color: #333; background: none; padding: 8px;
}
.light-theme .page-title { font-size: 18px; font-weight: 600; flex: 1; text-align: center; }
.light-theme .more-btn {
  font-size: 18px; color: #333; background: none; padding: 8px;
}

/* Tab 栏 */
.tab-bar {
  display: flex; background: #fff; border-bottom: 1px solid #eee;
  overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  flex: 0 0 auto; padding: 12px 20px; font-size: 14px;
  color: #666; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-item.active { font-weight: 600; border-bottom-color: var(--theme-color, #d4af37); color: var(--theme-color, #d4af37); }
.tab-item:hover { color: var(--theme-color, #d4af37); }

/* 内容区 */
.content { padding: 16px; max-width: 1200px; margin: 0 auto; }

/* 列表项 */
.list-item {
  background: #fff; border-radius: 12px; padding: 16px;
  margin-bottom: 10px; display: flex; align-items: flex-start; gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.list-item .item-icon {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #ddd; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; margin-top: 2px;
}
.list-item.completed .item-icon { background: var(--theme-color, #d4af37); border-color: var(--theme-color, #d4af37); color: #fff; }
.list-item.cancelled .item-icon { background: #ddd; border-color: #ddd; color: #fff; }
.list-item.completed .item-content { text-decoration: line-through; color: #999; }
.list-item.cancelled .item-content { text-decoration: line-through; color: #bbb; }
.list-item .item-content { flex: 1; color: #333; font-size: 15px; word-break: break-word; }
.list-item .item-meta { font-size: 12px; color: #999; margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.list-item .item-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; background: var(--theme-bg, #fef7e6); color: var(--theme-color, #d4af37);
}
.list-item .item-actions { display: flex; gap: 8px; opacity: 0; transition: opacity 0.2s; }
.list-item:hover .item-actions { opacity: 1; }
.list-item .item-actions button {
  background: none; color: #999; font-size: 13px; padding: 4px 8px;
}
.list-item .item-actions button:hover { color: var(--theme-color, #d4af37); }
.realized-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; background: #ecfdf5; color: #10b981; margin-left: 8px;
}

/* 筛选栏 */
.filter-bar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 16px; border-radius: 20px; font-size: 13px;
  background: #fff; color: #666; border: 1px solid #eee;
  transition: all 0.2s;
}
.filter-btn.active {
  background: var(--theme-color, #d4af37);
  color: #fff; border-color: var(--theme-color, #d4af37);
}

/* 统计卡片 */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stats-card {
  background: #fff; border-radius: 12px; padding: 16px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-card .stats-value { font-size: 28px; font-weight: 300; color: var(--theme-color, #d4af37); }
.stats-card .stats-label { font-size: 12px; color: #999; margin-top: 4px; }
.stats-card.income .stats-value { color: #10b981; }

/* 分类进度条 */
.category-list { margin-top: 12px; }
.category-item {
  display: flex; align-items: center; padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.category-item:last-child { border-bottom: none; }
.category-item .cat-name { width: 60px; font-size: 13px; color: #666; flex-shrink: 0; }
.category-item .cat-bar {
  flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; margin: 0 12px;
  overflow: hidden;
}
.category-item .cat-fill {
  height: 100%; background: var(--theme-color, #d4af37); border-radius: 4px;
  transition: width 0.5s ease;
}
.category-item .cat-amount { width: 80px; text-align: right; font-size: 13px; color: #333; }

/* ========== 底部输入栏 ========== */
.input-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #eee;
  padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  z-index: 200;
}
.dark-theme .input-bar {
  background: rgba(20,20,20,0.95); border-top-color: rgba(212,175,55,0.15);
}
.input-bar input {
  flex: 1; padding: 12px 16px; border-radius: 24px;
  border: 2px solid #eee; background: #f9f9f9;
  font-size: 14px; transition: border-color 0.2s;
}
.dark-theme .input-bar input {
  background: rgba(255,255,255,0.06); border-color: rgba(212,175,55,0.2); color: #fff;
}
.dark-theme .input-bar input::placeholder { color: rgba(255,255,255,0.3); }
.input-bar input:focus { border-color: var(--theme-color, #d4af37); }
.dark-theme .input-bar input:focus { border-color: #d4af37; }
.input-bar .mic-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--theme-bg, #fef7e6);
  color: var(--theme-color, #d4af37);
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.dark-theme .input-bar .mic-btn {
  background: rgba(212,175,55,0.15); color: #d4af37;
}
.input-bar .mic-btn:hover { transform: scale(1.05); }
.input-bar .mic-btn.recording {
  background: #ef4444; color: #fff;
  animation: pulse 1s infinite;
}
.dark-theme .input-bar .mic-btn.recording { background: #ef4444; color: #fff; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.input-bar .send-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--theme-color, #d4af37); color: #fff;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.dark-theme .input-bar .send-btn { background: #d4af37; color: #0a0a0a; }
.input-bar .send-btn:hover { opacity: 0.9; }

/* ========== Toast 提示 ========== */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,0.85); color: #fff; padding: 12px 20px;
  border-radius: 10px; font-size: 13px; z-index: 1000;
  opacity: 0; transition: all 0.3s; max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .undo-btn {
  margin-left: 12px; color: #d4af37; text-decoration: underline;
  background: none; font-size: 12px;
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 20px;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0d0d0d 100%);
}
.login-page .logo {
  font-size: 48px; color: #d4af37; letter-spacing: 8px;
  font-weight: 200; margin-bottom: 8px;
}
.login-page .slogan {
  color: rgba(255,255,255,0.4); font-size: 13px;
  letter-spacing: 4px; margin-bottom: 60px;
}
.login-form {
  width: 100%; max-width: 360px; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(212,175,55,0.15); border-radius: 20px;
  padding: 32px; backdrop-filter: blur(10px);
}
.login-form input {
  width: 100%; padding: 14px 18px; margin-bottom: 16px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(212,175,55,0.2);
  border-radius: 12px; color: #fff; font-size: 14px;
}
.login-form input::placeholder { color: rgba(255,255,255,0.3); }
.login-form input:focus { border-color: #d4af37; }
.login-form .login-btn {
  width: 100%; padding: 14px; margin-top: 8px;
  background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
  color: #0a0a0a; border-radius: 12px; font-size: 15px; font-weight: 600;
  letter-spacing: 2px; transition: all 0.3s;
}
.login-form .login-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(212,175,55,0.3); }
.login-form .error-msg { color: #ef4444; font-size: 12px; margin-bottom: 12px; min-height: 18px; }
.login-page .bottom-icons {
  margin-top: 60px; display: flex; gap: 32px;
  color: rgba(255,255,255,0.2); font-size: 24px;
}

/* ========== 首页 Dashboard ========== */
.home-page {
  min-height: 100vh; padding: 40px 20px 120px;
  max-width: 1200px; margin: 0 auto;
}
.home-page .header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
}
.home-page .settings-btn {
  background: none; color: rgba(255,255,255,0.5);
  font-size: 22px; padding: 8px;
}
.home-page .settings-btn:hover { color: #d4af37; }
.home-page .welcome { margin-bottom: 40px; }
.home-page .welcome h1 {
  font-size: 28px; font-weight: 300; color: #fff; margin-bottom: 8px;
}
.home-page .welcome p { color: rgba(255,255,255,0.5); font-size: 13px; }

/* 首页卡片 - 桌面横排 */
.home-cards {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.home-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: 20px; padding: 28px;
  cursor: pointer; transition: all 0.3s;
  display: flex; flex-direction: column; gap: 12px;
}
.home-card:hover {
  border-color: rgba(212,175,55,0.4);
  background: rgba(255,255,255,0.06);
  transform: translateY(-4px);
}
.home-card .card-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: rgba(212,175,55,0.1); color: #d4af37;
}
.home-card .card-title { font-size: 18px; color: #fff; font-weight: 500; }
.home-card .card-main { font-size: 42px; font-weight: 200; color: #fff; line-height: 1.1; }
.home-card .card-sub {
  font-size: 12px; color: rgba(255,255,255,0.4);
  display: flex; justify-content: space-between; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.home-card .card-sub .highlight { color: #d4af37; }

/* ========== 设置弹窗 ========== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #1a1a1a; border: 1px solid rgba(212,175,55,0.2);
  border-radius: 20px; width: 100%; max-width: 480px;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid rgba(212,175,55,0.1);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { color: #d4af37; font-size: 18px; font-weight: 500; }
.modal-header .close-btn { background: none; color: rgba(255,255,255,0.5); font-size: 20px; }
.modal-body { padding: 20px 24px; color: #e0e0e0; }
.modal-tabs {
  display: flex; gap: 24px; border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 20px;
}
.modal-tab {
  padding: 10px 0; font-size: 14px; color: rgba(255,255,255,0.5);
  cursor: pointer; border-bottom: 2px solid transparent;
}
.modal-tab.active { color: #d4af37; border-bottom-color: #d4af37; }
.settings-form label {
  display: block; font-size: 12px; color: rgba(255,255,255,0.5);
  margin-bottom: 6px; margin-top: 14px;
}
.settings-form input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(212,175,55,0.15);
  border-radius: 8px; color: #fff; font-size: 13px;
}
.settings-form input:focus { border-color: #d4af37; }
.settings-form .save-btn {
  width: 100%; padding: 12px; margin-top: 20px;
  background: #d4af37; color: #0a0a0a; border-radius: 10px;
  font-size: 14px; font-weight: 600;
}
.category-manage-item {
  display: flex; align-items: center; padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.category-manage-item .cat-name { flex: 1; color: #e0e0e0; font-size: 13px; }
.category-manage-item .cat-actions button {
  background: none; color: rgba(255,255,255,0.4); font-size: 12px;
  margin-left: 12px;
}
.add-cat-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.add-cat-row input {
  flex: 1; padding: 8px 12px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(212,175,55,0.15);
  border-radius: 8px; color: #fff; font-size: 13px;
}
.add-cat-row button {
  padding: 8px 16px; background: #d4af37; color: #0a0a0a;
  border-radius: 8px; font-size: 13px; font-weight: 600;
}
.logout-btn {
  width: 100%; padding: 12px; margin-top: 20px;
  background: transparent; color: #ef4444; border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px; font-size: 14px;
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center; padding: 60px 20px; color: #999;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 14px; margin-bottom: 8px; }
.empty-state .empty-hint { font-size: 12px; color: #bbb; }

/* ========== 桌面端右侧栏 ========== */
@media (min-width: 1024px) {
  .two-col {
    display: grid; grid-template-columns: 1fr 320px; gap: 20px;
  }
  .sidebar-card {
    background: #fff; border-radius: 12px; padding: 16px;
    margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .sidebar-card h4 {
    font-size: 14px; color: #333; margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 1px solid #f5f5f5;
  }
}

/* ========== 平板适配 ========== */
@media (max-width: 1023px) {
  .home-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 手机适配 ========== */
@media (max-width: 600px) {
  .home-cards { grid-template-columns: 1fr; gap: 14px; }
  .home-card { padding: 20px; }
  .home-card .card-main { font-size: 32px; }
  .home-page { padding: 24px 16px 120px; }
  .home-page .welcome h1 { font-size: 22px; }
  .login-page .logo { font-size: 36px; letter-spacing: 6px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .list-item .item-actions { opacity: 1; }
}

/* ========== 复盘页面 ========== */
.period-switch {
  display: flex; background: #fff; border-radius: 12px;
  padding: 4px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.period-switch button {
  flex: 1; padding: 10px; border-radius: 8px;
  background: none; color: #666; font-size: 13px;
  transition: all 0.2s;
}
.period-switch button.active {
  background: var(--theme-color, #d4af37); color: #fff;
}
.review-section {
  background: #fff; border-radius: 12px; padding: 20px;
  margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.review-section h3 {
  font-size: 16px; color: #333; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.review-section h3 .section-icon { color: var(--theme-color, #d4af37); }
.review-summary-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 16px; text-align: center;
}
.review-summary-row .num { font-size: 24px; font-weight: 300; color: var(--theme-color, #d4af37); }
.review-summary-row .label { font-size: 11px; color: #999; margin-top: 2px; }
.review-list-item {
  padding: 10px 0; border-bottom: 1px solid #f5f5f5;
  font-size: 13px; color: #555;
}
.review-list-item:last-child { border-bottom: none; }
.note-editor {
  width: 100%; min-height: 80px; padding: 12px;
  border: 1px solid #eee; border-radius: 8px;
  font-size: 13px; resize: vertical;
}
.note-editor:focus { border-color: var(--theme-color, #d4af37); }
.save-note-btn {
  margin-top: 8px; padding: 8px 20px;
  background: var(--theme-color, #d4af37); color: #fff;
  border-radius: 8px; font-size: 13px;
}

/* 收支页切换 */
.bill-type-switch {
  display: flex; background: #fff; border-radius: 12px;
  padding: 4px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bill-type-switch button {
  flex: 1; padding: 10px; border-radius: 8px;
  background: none; color: #666; font-size: 13px;
}
.bill-type-switch button.active.expense {
  background: var(--theme-color, #d4af37); color: #fff;
}
.bill-type-switch button.active.income {
  background: #10b981; color: #fff;
}

/* 编辑弹窗 */
.edit-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 600;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.edit-modal.show { display: flex; }
.edit-form {
  background: #fff; border-radius: 16px; width: 100%; max-width: 400px;
  padding: 24px;
}
.edit-form h3 { font-size: 16px; color: #333; margin-bottom: 16px; }
.edit-form label {
  display: block; font-size: 12px; color: #999;
  margin-bottom: 6px; margin-top: 12px;
}
.edit-form input, .edit-form select, .edit-form textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #eee; border-radius: 8px;
  font-size: 13px;
}
.edit-form input:focus, .edit-form select:focus, .edit-form textarea:focus {
  border-color: var(--theme-color, #d4af37);
}
.edit-form .btn-row {
  display: flex; gap: 12px; margin-top: 20px;
}
.edit-form .btn-row button {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 13px;
}
.edit-form .btn-cancel { background: #f5f5f5; color: #666; }
.edit-form .btn-save { background: var(--theme-color, #d4af37); color: #fff; }
.edit-form .btn-delete { background: #ef4444; color: #fff; }
