:root {
  --green: #2e7d4f;
  --green-soft: #e6f2ea;
  --green-mid: #4caf7d;
  --bg: #f4f6f3;
  --card: #ffffff;
  --text: #1f2a24;
  --muted: #73817a;
  --line: #e6ebe7;
  --warn: #b97a15;
  --warn-bg: #fdf4e6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31,42,36,.07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 头部（压缩）---------- */
.app-header {
  background: linear-gradient(135deg, var(--green), var(--green-mid));
  color: #fff;
  padding: 10px 14px 9px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.title-row { display: flex; align-items: baseline; gap: 8px; }
.app-header h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.badge {
  background: rgba(255,255,255,.22); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 600;
}
.subtitle { margin: 3px 0 0; font-size: 11px; opacity: .9; }
.install-hint {
  margin-top: 7px; font-size: 11.5px; background: rgba(255,255,255,.16);
  border-radius: 8px; padding: 6px 9px;
}

/* ---------- Tab ---------- */
.tabs {
  display: flex; gap: 4px; padding: 6px 12px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; padding: 7px 4px; border-radius: 9px;
  cursor: pointer;
}
.tab.active { background: var(--green-soft); color: var(--green); }

main { padding: 9px 11px 24px; max-width: 720px; margin: 0 auto; }
.tab-panel { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.section-note { font-size: 11.5px; color: var(--muted); margin: 8px 2px 0; line-height: 1.6; }

/* ---------- 星期切换 ---------- */
.day-chips { display: flex; gap: 5px; padding-bottom: 9px; }
.day-chip {
  flex: 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: 6px 0; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer;
}
.day-chip.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ---------- 餐卡（紧凑）---------- */
.meal {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 11px 9px; margin-bottom: 7px;
  border-left: 3px solid var(--green);
}
.meal:has(.k-breakfast) { border-left-color: #e0a63a; }
.meal:has(.k-dinner) { border-left-color: #3d8bb0; }
.meal.m-breakfast { border-left-color: #e0a63a; }
.meal.m-dinner { border-left-color: #3d8bb0; }

.daysum {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  margin: 0 2px 7px; font-size: 11.5px; color: var(--muted);
}
.daysum .eq { font-size: 10.5px; opacity: .8; }

.mhead { display: flex; align-items: center; gap: 6px; }
.kind {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px;
  background: var(--green-soft); color: var(--green); flex: 0 0 auto;
}
.k-breakfast { background: #fdf3e0; color: #a8781d; }
.k-dinner { background: #e7f1f7; color: #2b7191; }
.mhow {
  font-size: 11px; color: var(--muted); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mkcal { font-size: 11.5px; font-weight: 700; color: var(--green); flex: 0 0 auto; }
.mkcal::after { content: " kcal"; font-weight: 400; color: var(--muted); font-size: 10px; }

.tbtn {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff;
  color: var(--green); border-radius: 6px; font-size: 11px; font-weight: 600;
  padding: 1px 6px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.tbtn:active { background: var(--green-soft); }

.mname {
  font-size: 14.5px; font-weight: 700; line-height: 1.35;
  margin: 3px 0 5px; letter-spacing: .1px;
}
.ings { display: flex; flex-wrap: wrap; gap: 2px 9px; }
.ings .i { font-size: 12px; color: #45534b; white-space: nowrap; }
.ings .i b { color: var(--green); font-weight: 700; margin-left: 2px; }
.ings .i i { font-style: normal; color: var(--muted); font-size: 10.5px; margin-left: 3px; }

/* ---------- 备餐计划 ---------- */
.pcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; margin-bottom: 8px;
}
.pcard-h {
  font-size: 13.5px; font-weight: 700; color: var(--green);
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px;
}
.pcard-h em { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: flex; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
.steps li:first-child { border-top: none; padding-top: 0; }
.steps li b { flex: 0 0 58px; color: var(--text); font-size: 12.5px; }
.steps li span { flex: 1; color: var(--muted); line-height: 1.5; }

.prow {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-top: 1px dashed var(--line); font-size: 12.5px;
}
.prow:first-of-type { border-top: none; }
.prow .pd {
  flex: 0 0 22px; text-align: center; font-size: 11px; font-weight: 700;
  color: var(--green); background: var(--green-soft); border-radius: 5px; padding: 1px 0;
}
.prow .pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pm { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- 采购清单 ---------- */
.shop-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.btn-ghost:active { background: var(--green-soft); }
.shop-hint { font-size: 11px; color: var(--muted); line-height: 1.4; }

.cat {
  margin: 12px 2px 5px; font-size: 12.5px; color: var(--green);
  display: flex; align-items: baseline; gap: 6px;
}
.cat:first-child { margin-top: 2px; }
.cat em { font-style: normal; font-size: 10.5px; color: var(--muted); font-weight: 400; }

.srow {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow);
  padding: 7px 10px 8px; margin-bottom: 5px;
}
.sline { display: flex; align-items: center; gap: 6px; }
.sname { flex: 1; font-size: 13.5px; font-weight: 600; }
.sname .cl {
  font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--green);
  background: var(--green-soft); border-radius: 4px; padding: 0 4px; margin-left: 4px;
  vertical-align: 1px;
}
.sneed { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.srow input[type=number] {
  width: 60px; border: 1px solid var(--line); border-radius: 7px;
  padding: 4px 6px; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums;
}
.sunit { font-size: 11px; color: var(--muted); flex: 0 0 16px; }
.slo { font-size: 11px; margin-top: 2px; line-height: 1.4; color: var(--muted); }
.slo.idle { color: var(--muted); }
.slo.ok { color: var(--green); }
.slo.extra { color: var(--warn); }
.slo.lack { color: #b23b3b; }

/* ---------- 计时浮层 ---------- */
.timer-overlay {
  position: fixed; inset: 0; background: rgba(20,30,25,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 24px;
}
.timer-overlay[hidden] { display: none !important; }
.timer-card {
  background: #fff; border-radius: 18px; padding: 22px 26px; text-align: center;
  width: 100%; max-width: 300px; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.timer-title { font-size: 13px; color: var(--muted); line-height: 1.4; }
.timer-display {
  font-size: 50px; font-weight: 800; color: var(--green); margin: 8px 0 16px;
  font-variant-numeric: tabular-nums; letter-spacing: 1px;
}
.timer-actions { display: flex; gap: 10px; justify-content: center; }
.btn {
  border: none; background: var(--green); color: #fff; border-radius: 9px;
  padding: 8px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn:active { filter: brightness(.95); }

footer { text-align: center; color: var(--muted); font-size: 10.5px; padding: 14px; }
