* { box-sizing: border-box; margin: 0; }
:root {
  --green: #7c9a72; --green-dark: #5f7d56; --bg: #faf8f4;
  --ink: #333; --muted: #999; --card: #fff; --red: #d9534f;
}
body { font-family: "PingFang TC", sans-serif; background: var(--bg); color: var(--ink);
  padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }
#login { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 30vh; }
#login input { font-size: 24px; text-align: center; padding: 8px; border: 1px solid #ccc; border-radius: 10px; width: 180px; }
#login button { font-size: 18px; padding: 10px 40px; background: var(--green); color: #fff; border: 0; border-radius: 10px; }
.err { color: var(--red); }
main { padding: 12px; max-width: 520px; margin: 0 auto; }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #fff;
  border-top: 1px solid #eee; padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; padding: 12px 0; font-size: 15px; border: 0; background: none; color: var(--muted); }
#tabs button.active { color: var(--green-dark); font-weight: 700; }
#fab { position: fixed; right: 20px; bottom: calc(76px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; font-size: 28px; border: 0;
  background: var(--green); color: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
button.primary { background: var(--green); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-size: 16px; }
button.ghost { background: none; border: 1px solid #ccc; border-radius: 10px; padding: 10px 16px; font-size: 16px; color: var(--ink); }
input, select, textarea { font-size: 16px; padding: 8px; border: 1px solid #ccc; border-radius: 8px; }
.datenav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.datenav button { font-size: 22px; border: 0; background: none; padding: 4px 16px; }
.hero { display: flex; gap: 12px; }
.hero .big { flex: 1; text-align: center; }
.hero .num { font-size: 40px; font-weight: 800; color: var(--green-dark); }
.hero .num.over { color: var(--red); }
.ring { width: 80px; height: 80px; }
.center { position: relative; display: flex; flex-direction: column; align-items: center; }
.ringlabel { position: absolute; top: 34px; font-size: 13px; }
.sub { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.sub span { width: 48px; }
.sub .bar { flex: 1; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.sub .bar i { display: block; height: 100%; background: var(--green); }
.meal-head { display: flex; justify-content: space-between; }
.entry { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid #f2f2f2; }
.entry small { display: block; color: var(--muted); }
.entry .kcal { font-weight: 700; }
.muted { color: var(--muted); }
.ai-row { display: flex; gap: 8px; }
button.small { padding: 4px 12px; }
#search-results, #recent-list { margin-top: 8px; }
.week-chart { display: flex; gap: 6px; height: 140px; align-items: flex-end; margin: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bar-col i { display: block; width: 70%; background: var(--green); border-radius: 4px 4px 0 0; }
.bar-col i.over { background: var(--red); }
.bar-col span { font-size: 11px; color: var(--muted); }
.bar-col em { font-size: 12px; color: var(--green-dark); font-style: normal; height: 14px; }
