:root {
  --green: #2E8B57;
  --green-soft: #e6f4ec;
  --orange: #f5a623;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #222;
  --muted: #888;
  --line: #eee;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, var(--green), #3aa86b);
  color: #fff;
  padding: 18px 20px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 22px; font-weight: 700; }
.topbar-sub { font-size: 12px; opacity: .85; margin-top: 2px; }

/* 底部 tab */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tab {
  flex: 1;
  padding: 12px 0;
  border: 0;
  background: #fff;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { color: var(--green); font-weight: 600; }

.view { padding: 12px 12px 24px; }

/* 通用卡片 */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* 食谱 */
.day-tabs { display: flex; overflow-x: auto; background: #fff; border-radius: 12px; padding: 6px; margin-bottom: 12px; }
.day-tab {
  flex: 0 0 auto; padding: 8px 18px; border-radius: 20px; font-size: 14px; color: #555;
  background: #f2f2f2; margin-right: 8px; cursor: pointer; white-space: nowrap;
}
.day-tab.active { background: var(--green); color: #fff; font-weight: 600; }

.meal-period { display: flex; align-items: center; font-weight: 600; font-size: 16px; margin: 6px 2px 8px; }
.period-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-right: 8px; }
.meal-title { font-size: 15px; font-weight: 600; }
.meal-detail { font-size: 13px; color: #666; margin: 6px 0 8px; line-height: 1.5; }
.tags { display: flex; gap: 10px; }
.tag { font-size: 11px; padding: 2px 10px; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.tag.protein { color: #e6a23c; background: #fdf6ec; }

.day-summary { display: flex; justify-content: space-between; align-items: center; background: var(--green); color: #fff; }
.day-summary b { font-size: 18px; }
.day-summary .sub { font-size: 12px; opacity: .9; text-align: right; }

/* 打卡 */
.checkin-days { display: flex; background: #fff; border-radius: 12px; padding: 6px; margin-bottom: 12px; }
.checkin-day { flex: 1; text-align: center; padding: 9px 0; border-radius: 20px; font-size: 14px; cursor: pointer; }
.checkin-day.active { background: var(--green); color: #fff; }

.progress-card { display: flex; align-items: center; }
.progress-text { font-size: 13px; margin-right: 14px; white-space: nowrap; }
.progress-bar { flex: 1; height: 12px; background: #eee; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 6px; transition: width .3s; }

.meal-item { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.meal-item.done { background: #f0faf4; }
.meal-period-name { font-weight: 600; }
.meal-plan { font-size: 12px; color: #777; margin-top: 3px; }
.check-circle {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #ccc; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px;
}
.check-circle.checked { background: var(--green); border-color: var(--green); }

/* 进度 */
.weight-row { display: flex; align-items: center; gap: 10px; }
.weight-input { flex: 1; min-width: 0; border: 0; background: #f5f5f5; border-radius: 8px; padding: 10px 14px; font-size: 22px; font-weight: 700; }
.btn {
  border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer;
  background: var(--green); color: #fff;
}
.status-main { display: flex; align-items: baseline; }
.latest-val { font-size: 44px; font-weight: 800; }
.latest-unit { font-size: 14px; margin-left: 4px; }
.status-meta { text-align: right; font-size: 12px; line-height: 1.8; }
.bmi-val { font-size: 16px; font-weight: 700; }
.meta-row.good { color: #2E8B57; }
.meta-row.bad { color: #e6a23c; }
canvas { width: 100%; height: 200px; display: block; }

/* 计划 */
.wk-grid { display: flex; gap: 10px; }
.wk-cell { flex: 1; text-align: center; padding: 16px 0; border-radius: 10px; background: #f5f5f5; cursor: pointer; }
.wk-cell.done { background: var(--green-soft); }
.wk-kind { display: block; font-size: 17px; font-weight: 700; }
.wk-state { font-size: 11px; color: var(--muted); }
.wk-cell.done .wk-kind, .wk-cell.done .wk-state { color: var(--green); }
.week-plan { font-size: 12px; color: #777; margin-top: 10px; display: flex; align-items: center; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #ccc; margin-right: 8px; }

.tabs { display: flex; background: #fff; border-radius: 12px; overflow: hidden; }
.tabs .tab { background: #f5f5f5; border-radius: 0; }
.tabs .tab.active { background: var(--green); color: #fff; }

.list-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.checkbox {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #ccc; flex-shrink: 0; margin-right: 12px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px;
}
.checkbox.checked { background: var(--green); border-color: var(--green); }
.list-content { flex: 1; font-size: 14px; }
.list-content.lined { color: #aaa; text-decoration: line-through; }
.list-src { font-size: 11px; color: #bbb; margin-left: 8px; }
.del { font-size: 12px; color: #e6a23c; margin-left: 10px; width: 40px; text-align: right; }
.add-row { display: flex; gap: 10px; padding-top: 14px; }
.add-input { flex: 1; min-width: 0; border: 0; background: #f5f5f5; border-radius: 8px; padding: 10px 14px; font-size: 14px; }

.hint { font-size: 11px; color: #aaa; text-align: center; padding: 8px; }
.empty { text-align: center; color: #999; padding: 60px 0; font-size: 14px; }