* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #2f4f46;
  --green-dark: #243d36;
  --gold: #d4c4a0;
  --bg: #f5f5f2;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #8a8a8a;
  --line: #ececea;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
  font-size: 15px;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100%;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 100;
  height: calc(44px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--bg);
}

.nav-back {
  position: absolute;
  left: 8px;
  bottom: 0;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  font-size: 28px;
  line-height: 44px;
  color: var(--green);
  cursor: pointer;
}

.nav-back.hidden { display: none; }

.nav-title {
  font-size: 17px;
  font-weight: 600;
}

.view { display: none; padding: 0 16px 20px; }
.view.active { display: block; }

/* 问候 */
.hub-greet { padding: 4px 2px 14px; }

.hub-hello {
  font-size: 20px;
  font-weight: 600;
  color: #222;
}

.hub-date {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* 结余卡片 */
.summary-card {
  position: relative;
  background: var(--green);
  border-radius: 14px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  overflow: hidden;
  color: #fff;
}

.summary-deco {
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 110px;
  height: 110px;
  opacity: 0.12;
  background: radial-gradient(circle, #fff 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.summary-deco::after {
  content: "¥";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 300;
  color: #fff;
}

.summary-top {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.summary-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.eye-btn {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.65);
  padding: 0;
  cursor: pointer;
  display: flex;
}

.summary-balance {
  position: relative;
  z-index: 1;
  font-size: 40px;
  font-weight: 400;
  color: var(--gold);
  margin: 10px 0 18px;
  letter-spacing: 0.5px;
  font-family: Georgia, "Times New Roman", serif;
}

.summary-balance.hidden-amt {
  letter-spacing: 4px;
  font-family: inherit;
}

.budget-bar-wrap {
  position: relative;
  z-index: 1;
}

.budget-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 8px;
}

.budget-bar {
  height: 3px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.budget-bar.lg {
  height: 6px;
  background: var(--line);
}

.budget-bar.light { background: rgba(255, 255, 255, 0.25); }

.budget-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.55);
  width: 0;
  border-radius: 2px;
  transition: width 0.3s;
}

.budget-fill.page { background: var(--green); }
.budget-fill.warn { background: #b8860b; }
.budget-fill.over { background: #c0392b; }
.budget-fill.gold { background: var(--green); }

/* 功能宫格 */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
}

.feature-item {
  border: none;
  background: var(--card);
  padding: 16px 6px 14px;
  cursor: pointer;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-item:nth-child(4n) { border-right: none; }
.feature-item:nth-child(n+5) { border-bottom: none; }

.fi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  color: var(--green);
}

.fi-icon svg {
  width: 26px;
  height: 26px;
}

.fi-icon.filled {
  background: var(--green);
  border-radius: 10px;
  color: #fff;
}

.fi-icon.filled svg { width: 22px; height: 22px; }

.fi-name {
  font-size: 11px;
  color: #444;
}

/* 小部件行 */
.hub-widgets { margin-bottom: 16px; }

.widget-row {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
}

.widget-ico {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f0f2f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  flex-shrink: 0;
  margin-right: 12px;
}

.widget-ico svg { width: 22px; height: 22px; }

.widget-body { flex: 1; min-width: 0; }

.widget-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin-bottom: 4px;
}

.widget-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-arrow {
  font-size: 13px;
  color: #aaa;
  flex-shrink: 0;
  margin-left: 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.link-btn {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

/* 账单列表 */
.record-list { list-style: none; }

.record-item {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 13px 14px;
  margin-bottom: 8px;
}

.record-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
  background: #f0f2f1;
  color: var(--green);
}

.record-icon.income {
  background: var(--green);
  color: #fff;
}

.record-main { flex: 1; min-width: 0; }

.record-title {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.record-amount {
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

.record-amount.expense { color: #c0392b; }
.record-amount.income { color: var(--green); }

.record-del {
  border: none;
  background: none;
  color: #ccc;
  font-size: 18px;
  margin-left: 4px;
  padding: 4px;
  cursor: pointer;
}

.empty-box {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 36px 20px;
  text-align: center;
  list-style: none;
}

.empty-box svg {
  width: 48px;
  height: 48px;
  color: #ccc;
  margin-bottom: 12px;
}

.empty-box p {
  font-size: 13px;
  color: var(--muted);
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 28px 0;
}

.empty-tip.hidden { display: none; }

/* 按钮 */
.quick-add {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.btn-add {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.btn-add.expense {
  background: var(--card);
  color: var(--green);
  box-shadow: var(--shadow);
}

.btn-add.income {
  background: var(--green);
  color: #fff;
}

.form-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 12px;
}

.type-switch {
  display: flex;
  background: #f0f2f1;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
}

.type-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.type-btn.active {
  background: var(--card);
  color: var(--green);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fafafa;
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  margin-top: 4px;
  cursor: pointer;
}

.stats-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.stats-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.stats-list { list-style: none; }

.stats-item {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.stats-item:last-child { border-bottom: none; }

.stats-bar-wrap {
  flex: 1;
  margin: 0 12px;
  height: 5px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.stats-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

.month-bars { list-style: none; }

.month-bar-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}

.month-bar-item span:first-child {
  width: 40px;
  color: var(--muted);
}

.month-bar-item .bar-bg {
  flex: 1;
  height: 5px;
  background: #eee;
  border-radius: 3px;
  margin: 0 8px;
  overflow: hidden;
}

.month-bar-item .bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

.savings-hero {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px 18px;
  margin-bottom: 12px;
  text-align: center;
}

.savings-pct {
  font-size: 38px;
  font-weight: 600;
  color: var(--green);
  font-family: Georgia, serif;
}

.savings-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 16px;
}

.big-num {
  font-size: 26px;
  font-weight: 600;
  color: var(--green);
  margin: 6px 0 12px;
}

.hint-text { font-size: 13px; color: var(--muted); }
.hint-text.warn-text { color: #c0392b; }

.todo-add {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.todo-add input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  background: var(--card);
}

.todo-add button {
  border: none;
  background: var(--green);
  color: #fff;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.todo-list, .cd-list, .habit-list { list-style: none; }

.todo-item, .cd-item, .habit-item {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: #aaa;
}

.todo-check, .habit-check {
  width: 24px;
  height: 24px;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: #fff;
  margin-right: 12px;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--green);
}

.habit-check.on {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.todo-text, .habit-name { flex: 1; font-size: 15px; }
.habit-main { flex: 1; }

.cd-days {
  font-size: 16px;
  font-weight: 600;
  color: var(--green);
  min-width: 68px;
}

.cd-info { flex: 1; }
.cd-name { font-size: 15px; font-weight: 500; }

.about-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px 18px;
}

.about-logo {
  width: 52px;
  height: 52px;
  line-height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--green);
  color: #fff;
  border-radius: 14px;
  margin: 0 auto 14px;
}

.about-card h2 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 4px;
}

.about-ver {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}

.about-desc {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 14px;
}

.about-features {
  padding-left: 18px;
  margin-bottom: 18px;
  font-size: 14px;
  color: #444;
  line-height: 1.8;
}

.about-links {
  display: flex;
  gap: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.about-links a {
  color: var(--green);
  text-decoration: none;
  font-size: 14px;
}

.about-copy {
  font-size: 11px;
  color: #bbb;
  margin-top: 14px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.block-text {
  font-size: 14px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 10px;
}

.legal-h {
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.legal-ul {
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: #444;
}

.legal-back {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--green);
  text-decoration: none;
  font-size: 14px;
}

/* 底部 Tab */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(4px + env(safe-area-inset-bottom));
  z-index: 200;
}

.tabbar.hidden { display: none; }

.tab {
  flex: 1;
  border: none;
  background: none;
  padding: 4px 0;
  font-size: 10px;
  color: #aaa;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.tab svg {
  width: 22px;
  height: 22px;
}

.tab.active {
  color: var(--green);
  font-weight: 600;
}
