:root {
  --bg: #F7F9F8;
  --card: #FFFFFF;
  --primary: #0FB981;
  --primary-soft: #E8FBF2;
  --text: #1F2937;
  --muted: #9CA3AF;
  --border: #F3F4F6;
  --warn: #F59E0B;
  --danger: #DC2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 90px;
}

.page { padding: 16px 14px 40px; }
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.primary { color: var(--primary); }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.flex1 { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 24px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-top: 10px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: #FEE2E2; color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.input, .select {
  width: 100%;
  border: none;
  background: #F3F4F6;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
.label { font-size: 13px; color: #6B7280; margin: 12px 0 6px; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tab {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
}
.tab .icon { font-size: 20px; display: block; margin-bottom: 2px; }
.tab.active { color: var(--primary); font-weight: 600; }

.disclaimer {
  background: #FFFBEB;
  color: #B45309;
  border-radius: 10px;
  font-size: 12px;
  padding: 10px 12px;
  margin-top: 12px;
}

.hero-date { color: var(--muted); font-size: 13px; }
.hero-title { font-size: 26px; font-weight: 800; margin: 2px 0 8px; }
.tip { background: #EFF6FF; color: #1D4ED8; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }

.big-num { font-size: 52px; font-weight: 800; line-height: 1.1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-box { text-align: center; background: #fff; border-radius: 12px; padding: 12px 4px; }
.stat-box .v { font-size: 20px; font-weight: 800; }

.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.quick { background: #fff; border-radius: 14px; padding: 12px 0; text-align: center; font-size: 12px; cursor: pointer; }
.quick .q-icon { font-size: 24px; display: block; margin-bottom: 4px; }

.bar-track { height: 8px; background: #EFF6F4; border-radius: 6px; overflow: hidden; margin: 6px 0; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s; }

.meal-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.food { display: flex; justify-content: space-between; background: #F9FAFB; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.food .sub { font-size: 12px; color: var(--muted); }
.del { color: var(--danger); cursor: pointer; margin-left: 12px; }
.add-link { color: var(--primary); font-size: 14px; cursor: pointer; margin-top: 6px; display: inline-block; }
.empty { text-align: center; color: #D1D5DB; padding: 20px 0; }

.ai-good { background: #ECFDF5; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ai-improve { background: #FFFBEB; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ai-tip { background: #EFF6FF; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.ai-block-title { font-weight: 700; margin-bottom: 6px; }
.ai-item { font-size: 14px; color: #4B5563; }

.menu-item { display: flex; justify-content: space-between; padding: 15px 2px; font-size: 15px; border-bottom: 1px solid var(--border); cursor: pointer; }
.menu-item:last-child { border-bottom: none; }

.range-row { display: flex; background: #fff; border-radius: 12px; padding: 5px; margin-bottom: 14px; }
.range { flex: 1; text-align: center; padding: 8px 0; font-size: 14px; color: var(--muted); cursor: pointer; border-radius: 9px; }
.range.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.toast {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  max-width: 80%;
}
.toast.show { opacity: 1; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 88%;
  max-width: 420px;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }

canvas.chart { width: 100%; }
.pie-wrap { display: flex; align-items: center; gap: 18px; }
.legend-item { display: flex; align-items: center; font-size: 14px; margin: 6px 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; }
.score-badge { background: var(--primary); color: #fff; border-radius: 20px; padding: 3px 14px; font-weight: 700; }
