:root {
  --bg: #f5efe6;
  --card: #fffdf9;
  --ink: #1f2a26;
  --muted: #7a7468;
  --line: #e8dfd1;
  --green: #2f5d50;
  --green-soft: #e3ece7;
  --terra: #d9734e;
  --terra-soft: #f8e6dc;
  --sea: #3f7a99;
  --sea-soft: #e2eef4;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 45, 20, .05), 0 6px 18px rgba(60, 45, 20, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
h2, h3, p { margin: 0; }
#main { max-width: 560px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 16px; }
.view { display: flex; flex-direction: column; gap: 12px; }

/* Day strip */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 6px; }
.strip-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px; border-radius: 14px; background: transparent; transition: background .15s;
}
.strip-day .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.strip-day .dom { font-size: 18px; font-weight: 650; }
.strip-day.today .dom { color: var(--terra); }
.strip-day.sel { background: var(--green); color: #fff; }
.strip-day.sel .dow, .strip-day.sel.today .dom { color: rgba(255,255,255,.85); }
.dots { display: flex; gap: 3px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.dots i.f { background: var(--terra); }
.strip-day.sel .dots i { background: rgba(255,255,255,.35); }
.strip-day.sel .dots i.f { background: #fff; }

.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 2px 2px; }
.day-head h2 { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.day-head span { color: var(--muted); font-size: 14px; }

/* Meal cards */
.meal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 14px 14px 16px; transition: opacity .2s; }
.meal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.slot { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.link { color: var(--green); font-size: 14px; font-weight: 600; padding: 4px 2px; }
.meal-body { display: flex; align-items: center; gap: 14px; }
.meal-text { flex: 1; min-width: 0; }
.meal h3 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.meal p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.meal.done h3 { text-decoration: line-through; text-decoration-color: rgba(31,42,38,.35); color: var(--muted); }
.meal.done { background: #fbf8f2; box-shadow: none; outline: 1px solid var(--line); }
.pick-cta { width: 100%; padding: 12px; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin-top: 8px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--line); color: var(--muted); }
.chip.fish { background: var(--sea-soft); color: var(--sea); }
.chip.warn { background: var(--terra-soft); color: #b45632; }

/* Tick */
.tick {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--card);
  display: grid; place-items: center; transition: background .15s, border-color .15s, transform .1s;
}
.tick:active { transform: scale(.92); }
.tick svg { width: 22px; height: 22px; fill: none; stroke: transparent; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tick.on { background: var(--green); border-color: var(--green); }
.tick.on svg { stroke: #fff; }

/* Week */
.progress { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding: 0 2px; }
.bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--terra); border-radius: 99px; transition: width .3s; }
.wk-day { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 12px 8px 14px; }
.wk-day.today { outline: 2px solid var(--terra); }
.wk-head { width: 100%; display: flex; justify-content: space-between; align-items: baseline; padding: 8px 2px 4px; }
.wk-dow { font-weight: 700; font-size: 17px; }
.wk-date { color: var(--muted); font-size: 14px; }
.wk-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid #f1ebe1; }
.wk-row:first-of-type { border-top: 0; }
.wk-icon { width: 22px; text-align: center; }
.wk-name { flex: 1; font-size: 15px; padding: 6px 0; }
.wk-row.done .wk-name { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(31,42,38,.3); }
.wk-row .tick { width: 32px; height: 32px; }
.wk-row .tick svg { width: 17px; height: 17px; }

/* Got */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card h3 { font-size: 15px; font-weight: 700; }
.count { font-size: 13px; color: var(--muted); font-weight: 600; }
.buy { background: var(--sea-soft); box-shadow: none; }
.buy-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(63,122,153,.15); }
.buy-row:first-of-type { border-top: 0; }
.buy-row > div { flex: 1; }
.buy-row strong { display: block; font-weight: 600; }
.buy-row small { color: #5d7f90; font-size: 13px; }
.buy-row.got strong { text-decoration: line-through; color: #5d7f90; }
.buy .tick { border-color: rgba(63,122,153,.3); }
.buy .tick.on { background: var(--sea); border-color: var(--sea); }
.pantry { list-style: none; margin: 0; padding: 0; }
.pan { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid #f1ebe1; }
.pantry li:first-child .pan { border-top: 0; }
.pan-qty { color: var(--muted); font-size: 14px; text-align: right; }
.pan.out .pan-name { color: var(--muted); text-decoration: line-through; }
.pan.out .pan-qty { color: #b45632; font-weight: 600; }
.tip { background: var(--green-soft); box-shadow: none; }
.tip p { color: #3f5a51; font-size: 14px; margin-top: 2px; }
.reset { align-self: center; color: var(--muted); font-size: 13px; padding: 12px; }

/* Sheet */
.sheet-wrap { position: fixed; inset: 0; background: rgba(31,42,38,0); transition: background .2s; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap.open { background: rgba(31,42,38,.35); }
.sheet {
  width: 100%; max-width: 560px; max-height: 82vh; overflow: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sheet-wrap.open .sheet { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 99px; background: var(--line); margin: 2px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.sheet-head h3 { font-size: 20px; }
.sheet-head span { color: var(--muted); font-size: 14px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.opt > div { flex: 1; }
.opt strong { display: block; font-weight: 600; font-size: 16px; }
.opt small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.opt.cur { outline: 2px solid var(--green); }
.opt.used { opacity: .55; }
.opt.none { box-shadow: none; background: transparent; outline: 1.5px dashed var(--line); }
.opt.none strong { color: var(--muted); font-weight: 500; }
.cur-mark { color: var(--green); font-weight: 800; font-size: 18px; }

/* Tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(245,239,230,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabs button {
  flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 0; border-radius: 12px;
}
.tabs button span { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tabs button.sel { color: var(--green); background: var(--green-soft); }
.tabs button.sel span { filter: none; opacity: 1; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141917; --card: #1d2421; --ink: #ecebe6; --muted: #9a9a90; --line: #2f3834;
    --green: #5d9c87; --green-soft: #1f2e29; --terra: #e58a66; --terra-soft: #3a2620;
    --sea: #7fb4d1; --sea-soft: #1b2a33; --shadow: none;
    color-scheme: dark;
  }
  .meal.done { background: #181e1c; }
  .wk-row, .pan, .buy-row { border-color: #262e2b !important; }
  .tabs { background: rgba(20,25,23,.9); }
  .tip p { color: #a9c3b9; }
  .buy-row small, .buy-row.got strong { color: #8fb1c4; }
}
