:root {
  --bg: #fff8f2;
  --ink: #3d2a22;
  --paper: #ffffff;
  --line: #f2d6c9;
  --navy: #e24b3c;
  --him: #e07a3d;
  --her: #c73e54;
  --gold: #f0b429;
  --out: #b42318;
  --muted: #9a7460;
  --safe: env(safe-area-inset-bottom, 0px);
  --badge: 88px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "PingFang SC", serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, #ffe8d6 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  padding-top: calc(52px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--badge) + var(--safe));
}
.app { max-width: 430px; margin: 0 auto; padding-bottom: 24px; }
a[href*="netlify.com"][style*="position"],
a[href*="www.netlify.com"][style*="fixed"],
iframe[title*="Netlify" i],
iframe[src*="netlify.com/badge"],
#netlify-badge,
#nf-drop-badge,
.netlify-badge,
[id*="netlify-badge" i],
[class*="netlify-badge" i] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}
.side { display: none; }
.gate {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(28, 23, 18, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.gate[hidden] { display: none !important; }
.gate-card {
  background: var(--paper); max-width: 720px; width: 100%;
  border-radius: 24px; padding: 28px 24px; border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(22, 50, 79, 0.2);
}
.gate-card h1 { font-size: 32px; margin: 8px 0 10px; letter-spacing: 0.06em; }
.gate-two { display: grid; gap: 16px; margin-top: 18px; }
.gate-two > div { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #fff; }
.gate-two h3 { margin: 0 0 6px; font-size: 18px; }
.gate-two p { margin: 0 0 12px; font-family: "PingFang SC", sans-serif; font-size: 13px; color: var(--muted); }
.gate-two button { width: 100%; }
.warn-http { font-family: "PingFang SC", sans-serif; font-size: 13px; color: var(--out); background: #fdecea; padding: 10px 12px; border-radius: 10px; }
.mast {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.kicker {
  font-family: "PingFang SC", sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-transform: uppercase;
}
.mast h1 {
  font-size: 34px;
  margin: 8px 0 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.mast .lead { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.syncbar {
  margin: 12px 18px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff6e8;
  border: 1px dashed var(--gold);
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
}
.syncbar.on { background: #eaf4ee; border-style: solid; border-color: #b7d4c4; }
.syncbar b { display: block; margin-bottom: 2px; }
.page { display: none; padding: 14px 16px 48px; }
.page.active { display: block; }
.dock-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: linear-gradient(to top, var(--bg) 70%, rgba(255, 248, 242, 0));
  margin: 12px -16px 0;
  padding: 18px 16px calc(12px + var(--safe));
  padding-right: calc(16px + var(--badge));
}
.sec { margin: 18px 0 8px; font-size: 13px; letter-spacing: 0.2em; color: var(--muted); }
.tiny { font-family: "PingFang SC", sans-serif; font-size: 12px; color: var(--muted); line-height: 1.55; }
.toolbar { display: grid; gap: 10px; margin-bottom: 8px; }
.toolbar.two { grid-template-columns: 1fr 1fr; }
.add-date { margin: 8px 0 14px; }
.add-date-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.add-date-row button { white-space: nowrap; padding: 12px 14px; }
.day.empty { padding: 10px 14px; }
.day.empty h3 { margin-bottom: 4px; }
button.gold { background: #e07a3d; }
.cta {
  width: 100%; padding: 16px;
  border: 0; border-radius: 16px;
  background: var(--navy); color: #fff;
  font-size: 18px; font-weight: 700;
  font-family: "PingFang SC", sans-serif;
  letter-spacing: 0.12em;
}
.choice { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pick {
  font-family: "PingFang SC", sans-serif;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 14px; padding: 14px 8px; font-size: 15px; color: var(--ink);
}
.pick.on.him { background: var(--him); color: #fff; border-color: var(--him); }
.pick.on.her { background: var(--her); color: #fff; border-color: var(--her); }
.pick.on { background: var(--navy); color: #fff; border-color: var(--navy); }
label.f { display: block; margin: 12px 0 6px; font-size: 12px; color: var(--muted); letter-spacing: 0.12em; }
input, select, textarea {
  width: 100%; font-size: 16px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; font-family: "PingFang SC", sans-serif;
}
.ing-row {
  display: grid; grid-template-columns: 1fr 0.7fr 0.85fr auto; gap: 6px;
  margin-bottom: 6px;
}
.hint {
  margin: 12px 18px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background: #fff6e8;
  border: 1px solid var(--gold);
}
.hint.warn { background: #fdecea; border-color: #e8b4b4; }
.hint.ok { background: #eaf4ee; border-color: #b7d4c4; }
.hint b { display: block; margin-bottom: 4px; }
.meal-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.meal-picks .chip {
  font-family: "PingFang SC", sans-serif;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 99px; padding: 8px 12px; font-size: 13px; color: var(--ink);
}
.meal-picks .chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.meal-grid { display: grid; gap: 12px; }
.shop-grid { display: grid; gap: 12px; margin-top: 16px; }
.shop {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px;
}
.shop h3 { margin: 0 0 6px; font-size: 18px; }
.check {
  display: flex; align-items: flex-start; gap: 8px;
  font-family: "PingFang SC", sans-serif; font-size: 14px;
  padding: 8px 0; border-bottom: 1px solid #f6ddd3;
}
.check input { width: auto; margin-top: 3px; }
.check .sub { display: block; font-size: 12px; color: var(--muted); }
.check.done { opacity: 0.55; text-decoration: line-through; }
.ing-row button { padding: 10px 12px; }
.rowbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
button {
  font-family: "PingFang SC", sans-serif; border: 0; border-radius: 12px;
  padding: 12px; background: var(--navy); color: #fff; font-weight: 600;
}
button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
button.danger { background: var(--out); }
.err { color: var(--out); min-height: 20px; margin-top: 8px; font-family: "PingFang SC", sans-serif; font-size: 13px; }
.cards { display: grid; gap: 10px; margin-top: 8px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px;
  font-family: "PingFang SC", sans-serif;
}
.card h3 { margin: 0 0 6px; font-family: "Songti SC", serif; font-size: 20px; letter-spacing: 0.04em; }
.card .ings { margin: 0 0 10px; padding-left: 18px; color: var(--ink); font-size: 14px; line-height: 1.55; }
.card .meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.card .acts button { flex: 1; min-width: 90px; }
.who-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.who-dot.him { background: var(--him); }
.who-dot.her { background: var(--her); }
.who-dot.both { background: var(--gold); }
.empty {
  background: var(--paper); border: 1px dashed var(--line);
  border-radius: 16px; padding: 28px 16px; text-align: center;
}
.code {
  font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all;
  background: #fff; border: 1px solid var(--line); padding: 10px; border-radius: 10px;
}
.family-card { margin-top: auto; padding-top: 16px; }
.side-title { font-size: 22px; line-height: 1.35; margin: 8px 0 20px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav button { text-align: left; background: transparent; color: #f5cfc6; border: 0; padding: 10px 0; }
.side-nav button.on { color: #fff; }
.topnav {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30;
  display: flex;
  background: var(--navy);
  padding: env(safe-area-inset-top, 0px) 4px 0;
  font-family: "PingFang SC", sans-serif;
}
.topnav button {
  flex: 1; background: none; color: rgba(255, 255, 255, 0.78); border-radius: 0;
  padding: 14px 4px; font-size: 13px; letter-spacing: 0.04em;
}
.help {
  font-family: "PingFang SC", sans-serif;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 16px 28px; line-height: 1.6;
}
.help h2 { font-family: "Songti SC", serif; margin: 0 0 8px; }
.help h3 { margin: 18px 0 8px; font-size: 16px; }
.help p, .help li { font-size: 14px; color: var(--ink); }
.help ol, .help ul { padding-left: 1.2em; margin: 0 0 8px; }
.help code { font-size: 12px; word-break: break-all; }
.topnav button.on { color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.day {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.wx-tip {
  position: sticky; top: calc(52px + env(safe-area-inset-top, 0px)); z-index: 25;
  margin: 0; padding: 10px 14px;
  background: #e24b3c; color: #fffdf9;
  font-family: "PingFang SC", sans-serif; font-size: 13px; line-height: 1.45;
  text-align: center;
}
.wx-tip[hidden] { display: none !important; }
.day.today { border-color: var(--navy); }
.day.past { opacity: 0.62; filter: grayscale(0.25); }
.past-wrap {
  margin-top: 8px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 10px 12px 12px;
}
.past-wrap summary {
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 0 10px;
}
body.view-only .need-edit,
body.role-viewer .need-admin,
body.role-viewer .need-plan,
body.role-viewer .need-owner,
body.role-admin .need-owner { display: none !important; }
.day h3 { margin: 0 0 10px; font-size: 20px; }
.meal-line {
  font-family: "PingFang SC", sans-serif;
  padding: 8px 0; border-top: 1px solid #f6ddd3;
  font-size: 15px; line-height: 1.45;
}
.meal-line .slot { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; margin-right: 8px; }
.meal-line .dish { font-weight: 700; }
.meal-line .staple { color: var(--navy); }
.buy-line {
  font-family: "PingFang SC", sans-serif;
  font-size: 14px; padding: 8px 0; border-top: 1px dashed var(--line);
}
.buy-line.done { opacity: 0.55; text-decoration: line-through; }
.tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px;
  margin-right: 6px; background: #ffe9dc;
}
.tag.market { background: #ffd6d0; color: var(--her); }
.tag.duoduo { background: #ffe3c8; color: var(--him); }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.cats .chip {
  font-family: "PingFang SC", sans-serif;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 99px; padding: 6px 10px; font-size: 13px; color: var(--ink);
}
.cats .chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.quick {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  margin-top: 10px;
}
.quick input { padding: 8px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--badge) + 12px + var(--safe));
  transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 99px; display: none; z-index: 20;
  font-family: "PingFang SC", sans-serif; font-size: 13px; white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

@media (min-width: 960px) {
  body { padding-top: 0; padding-bottom: 0; }
  .topnav { display: none; }
  .dock-actions {
    position: static;
    margin: 12px 0 0;
    padding: 0;
    background: none;
  }
  .side {
    display: flex; flex-direction: column;
    width: 260px; flex-shrink: 0;
    background: #b33a2e; color: #fff6f2;
    min-height: 100dvh; padding: 28px 22px;
    position: sticky; top: 0;
  }
  .side .kicker { color: var(--gold); }
  .side .tiny { color: #f5cfc6; }
  .side .code { background: #8f2e24; color: #fff6f2; border-color: #e07a6c; }
  .side .ghost { color: #fff6f2; border-color: #f0b2a8; margin-top: 8px; }
  .shell { display: flex; max-width: 1280px; margin: 0 auto; align-items: stretch; }
  .app { max-width: none; flex: 1; padding: 8px 28px 40px; }
  .mast h1 { font-size: 42px; }
  .syncbar { margin: 16px 0 0; }
  .page { padding: 18px 0 32px; }
  .toolbar { grid-template-columns: 1fr 180px; align-items: start; }
  .toolbar.two { grid-template-columns: 1fr 1fr; }
  .cta { width: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .meal-grid { grid-template-columns: 1fr 1fr; }
  .shop-grid { grid-template-columns: 1fr 1fr; }
  .hint { margin: 16px 0 0; }
  .gate-two { grid-template-columns: 1fr 1fr; }
  .toast { bottom: 28px; }
}
