/*
 * SAPSAS: one stylesheet, phone first. The family's kitchen board: enamel
 * white, herb green for what you tap, and each of us a color, like magnets on
 * the fridge (used only for who). The week has one bold thing: tonight.
 * Everything else stays quiet. No warnings anywhere: nothing here is red.
 */

:root {
  --enamel: #f3f6f2;
  --card: #ffffff;
  --ink: #18241d;
  --muted: #5e6b63;
  --line: #dde4dd;
  --line-soft: #e8ede8;
  --herb: #2f7d5b;
  --herb-deep: #1e5b41;
  --jade: #ddefe4;
  --jade-soft: #eef7f1;
  --sand: #f0eee6;
  --saffron: #d99a1f;
  --amber-ink: #8a5a0b;

  /* Each of us, in Person.by_name order, and all of us together. */
  --tone-1: #3f5aa8;
  --tone-1-soft: #e6eaf6;
  --tone-2: #a8670c;
  --tone-2-soft: #f6ecdc;
  --tone-3: #8d3a6c;
  --tone-3-soft: #f3e4ed;
  --tone-4: #276b7a;
  --tone-4-soft: #e0eff2;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar: 58px;

  /* Older names, still used in a few views' inline styles. */
  --paper: var(--enamel);
  --herb-dark: var(--herb-deep);
  --herb-tint: var(--jade);
  --peach: #f7dcc6;
  --peach-ink: #8a4b22;
  --sky: #e1e7f7;
  --sky-ink: #3d4a8c;
  --shadow: 0 1px 2px rgba(24, 36, 29, 0.04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--enamel);
  color: var(--ink);
  font: 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--herb-deep); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--herb); }

h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.012em; }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 0.75rem; }

/* Frame: a top bar with the name; on a phone the pages move to tabs at the bottom, in reach of a thumb. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 246, 242, 0.9);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}

.brand::before {
  content: "";
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.5rem;
  border-radius: 0.45rem;
  background: url("/icon.svg") center / cover no-repeat;
}

.brand span { color: var(--herb); }

.nav { display: flex; gap: 0.15rem; flex: 1; align-items: center; }

.nav > a, .more > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 550;
  white-space: nowrap;
}

.nav > a:hover, .more > summary:hover { color: var(--ink); }
.nav > a.active, .more[open] > summary, .more > summary.active { background: var(--jade); color: var(--herb-deep); }

.nav-icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
@media (min-width: 721px) {
  .nav .nav-icon { display: none; }
  .more summary::after { content: "▾"; font-size: 0.7em; margin-left: -0.15rem; }
}

/* More: the pages that aren't everyday, and who's signed in. */
.more { position: relative; margin-left: auto; }
.more summary { list-style: none; cursor: pointer; user-select: none; }
.more summary::-webkit-details-marker { display: none; }
.more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  min-width: 13rem;
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(24, 36, 29, 0.16);
}
.more-panel > a {
  text-decoration: none;
  color: var(--ink);
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
}
.more-panel > a.active, .more-panel > a:hover { background: var(--jade); color: var(--herb-deep); }
.more-who {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
  padding: 0.5rem 0.4rem 0.15rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}
.more-who form { display: inline; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.flash {
  max-width: 760px;
  margin: 0.75rem auto 0;
  padding: 0 1rem;
}

.flash div {
  background: var(--jade);
  color: var(--herb-deep);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-weight: 550;
}

.flash div.alert { background: var(--sand); color: var(--ink); }

@media (max-width: 720px) {
  .topbar { position: static; background: var(--enamel); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0; }
  .topbar-inner { padding: 0.75rem 1rem 0; }
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav > a, .more > summary {
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.3rem 0.1rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    min-height: 48px;
  }
  .nav > a.active, .more[open] > summary, .more > summary.active { background: transparent; color: var(--herb); }
  .nav > a.active .nav-icon, .more > summary.active .nav-icon, .more[open] > summary .nav-icon { background: var(--jade); border-radius: 999px; }
  .nav-icon { width: 2.6rem; height: 1.6rem; padding: 0.15rem 0.6rem; }
  .more { margin-left: 0; display: flex; }
  .more > summary { width: 100%; }
  .more-panel { position: fixed; top: auto; right: 0.6rem; bottom: calc(var(--tabbar) + 0.5rem + env(safe-area-inset-bottom)); }
  .page { padding: 1rem 1rem calc(var(--tabbar) + 2.5rem + env(safe-area-inset-bottom)); }
  .wide-only { display: none; }
  .narrow-cap { text-transform: capitalize; }
}

/* Building blocks */

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  margin-bottom: 0.9rem;
}

.card-quiet {
  background: var(--sand);
  border-color: transparent;
}

.stack > * + * { margin-top: 0.75rem; }

.row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.row-between { justify-content: space-between; }

.grow { flex: 1; min-width: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.tiny { font-size: 0.8rem; }

.lede {
  font-size: 1rem;
  color: var(--muted);
  margin: -0.15rem 0 1.1rem;
  max-width: 36rem;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
hr.divider { margin: 2rem 0 1.5rem; }

/* Buttons: one green thing to tap per card; the rest are white. */

.btn, button, input[type="submit"] {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  line-height: 1.2;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover, button:hover { border-color: var(--herb); color: var(--ink); }

.btn-primary, button.btn-primary, input[type="submit"].btn-primary {
  background: var(--herb);
  border-color: var(--herb);
  color: #fff;
  font-weight: 650;
}

.btn-primary:hover, button.btn-primary:hover { background: var(--herb-deep); border-color: var(--herb-deep); color: #fff; }

button:disabled, input[type="submit"]:disabled { opacity: 0.45; cursor: default; }

.btn-big { padding: 0.8rem 1.4rem; font-size: 1.02rem; min-height: 50px; }

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  min-height: 36px;
}

.btn-quiet:hover { color: var(--herb-deep); border-color: transparent; background: var(--jade-soft); }

.btn-on {
  background: var(--jade);
  border-color: var(--herb);
  color: var(--herb-deep);
  font-weight: 650;
}

.btn-small { padding: 0.35rem 0.8rem; min-height: 36px; font-size: 0.88rem; }

.button_to { display: inline; }

/* Forms */

label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="search"],
input[type="url"], input[type="tel"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.1rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235e6b63' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.8rem center / 0.7rem;
  cursor: pointer;
}

textarea { min-height: 7rem; resize: vertical; line-height: 1.45; }

input[type="file"] { font: inherit; font-size: 0.9rem; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 0.5rem 1rem; margin-right: 0.6rem; font: inherit; font-weight: 600; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--herb); }

input::placeholder, textarea::placeholder { color: #8b958f; }

input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--herb);
  outline-offset: 2px;
}

.field { margin-bottom: 1rem; }

.hint { font-size: 0.86rem; color: var(--muted); margin-top: 0.3rem; }

.inline-form { display: inline-flex; gap: 0.45rem; align-items: center; }
.inline-form input[type="text"], .inline-form input[type="search"] { width: auto; min-width: 0; flex: 1; }
.inline-form input[type="number"] { width: 4.5rem; flex: 0 0 4.5rem; }
.inline-form select { width: auto; flex: 0 0 auto; }
/* On a phone the kind and Add go to a second line rather than off the card. */
.food-add { display: flex; flex-wrap: wrap; width: 100%; }
.food-add input[type="text"] { flex: 1 1 10rem; }

/* Chips and tags */

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
}

a.chip:hover { border-color: var(--herb); color: var(--ink); }
.chip-on, a.chip-on { background: var(--ink); border-color: var(--ink); color: #fff; }
a.chip-on:hover { color: #fff; }

.chip form { display: inline; }

.chip button {
  border: 0;
  background: transparent;
  min-height: 0;
  padding: 0 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 650;
  background: var(--sand);
  color: var(--muted);
  white-space: nowrap;
}

.tag-new { background: var(--tone-2-soft); color: var(--amber-ink); }
.tag-classic { background: var(--tone-1-soft); color: var(--tone-1); }
.tag-onhand { background: var(--jade); color: var(--herb-deep); }
.tag-request { background: var(--tone-3-soft); color: var(--tone-3); }
.tag-estimate { background: transparent; color: var(--muted); font-weight: 400; padding: 0; }

/* Each of us, like a magnet on the fridge: initials, whose night, who's cooking. */
.initials {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 750;
  background: var(--herb);
  color: #fff;
  box-shadow: 0 0 0 2px var(--card);
}

.initials.not { background: var(--sand); color: var(--muted); text-decoration: line-through; box-shadow: none; }

.tone-1 { --tone: var(--tone-1); --tone-soft: var(--tone-1-soft); }
.tone-2 { --tone: var(--tone-2); --tone-soft: var(--tone-2-soft); }
.tone-3 { --tone: var(--tone-3); --tone-soft: var(--tone-3-soft); }
.tone-4 { --tone: var(--tone-4); --tone-soft: var(--tone-4-soft); }
.tone-all { --tone: var(--herb-deep); --tone-soft: var(--jade); }
.initials[class*="tone-"] { background: var(--tone); }
.who { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--tone, var(--muted)); font-weight: 650; }
.who::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.tag.who { background: var(--tone-soft, var(--sand)); color: var(--tone, var(--muted)); }
.chip.who { color: var(--tone, var(--ink)); }
.chip.who.chip-on { background: var(--tone, var(--ink)); border-color: var(--tone, var(--ink)); color: #fff; }
.tag.who::before { width: 0.45rem; height: 0.45rem; }

/* Dinners */

.slot { margin-bottom: 1rem; }

.slot-head {
  padding: 0.55rem 1rem;
  background: var(--sand);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  border-radius: var(--radius);
}

.option-title { font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.25; letter-spacing: -0.005em; }
.option-title a { color: var(--ink); text-decoration: none; }
.option-title a:hover { color: var(--herb-deep); }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.85rem;
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0.25rem 0 0.4rem;
}

.facts .rating { color: var(--ink); }
.facts .rating::first-letter { color: var(--saffron); }

.plate-note {
  font-size: 0.88rem;
  background: var(--tone-2-soft);
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  margin: 0.4rem 0;
}

.hint-early { font-size: 0.85rem; color: var(--muted); }
.hint-early::before { content: "◷ "; color: var(--herb); }

.marks { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }

.macro-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.9rem;
}

.macro-line strong { font-weight: 700; }

/* A dinner on the week: a card that opens its recipe. Tonight's is the big one. */

.dinner {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.dinner > .photo-banner { width: 100%; max-width: none; margin: 0; border-radius: 0; aspect-ratio: 16 / 9; max-height: 15rem; }
.dinner-body { padding: 0.85rem 0.95rem 0.95rem; }
.dinner-text { min-width: 0; }
.dinner-when {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.dinner-when { flex-wrap: wrap; }
.dinner-when > span:first-child { white-space: nowrap; }
.dinner-when .today { color: var(--herb); }

.dinner-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-top: 0.75rem; }
.dinner-actions form { margin: 0; }
.dinner:not(.dinner-hero) .dinner-actions :is(.btn, button) { padding-left: 0.85rem; padding-right: 0.85rem; }

.dinner-made > .photo { filter: saturate(0.55); opacity: 0.85; }
.dinner-made .option-title a { color: var(--muted); }

.dinner-hero {
  border: 0;
  box-shadow: 0 18px 40px -22px rgba(24, 36, 29, 0.45);
  margin-bottom: 1.5rem;
}
.dinner-hero .photo-hero { width: 100%; aspect-ratio: 16 / 10; display: block; object-fit: cover; background: var(--jade); }
.dinner-hero .dinner-body { padding: 1rem 1.1rem 1.15rem; }
.dinner-hero .dinner-when { color: var(--herb); font-size: 1rem; }
.dinner-hero .option-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.015em; }
.dinner-hero .dinner-actions > a.btn-primary, .dinner-hero .dinner-actions > form:first-child { flex: 1 1 8rem; }
@media (max-width: 480px) { .dinner-hero .dinner-actions > a.btn-primary, .dinner-hero .dinner-actions > form:first-child { flex-basis: 100%; } }
.dinner-hero .dinner-actions > a.btn-primary, .dinner-hero .dinner-actions > form:first-child button { width: 100%; min-height: 50px; font-size: 1.02rem; }

/* The rest of a dinner's choices: move, who's cooking, not making it. */
.dinner-more { position: relative; }
.dinner-more > summary {
  list-style: none;
  min-width: 42px;
  padding: 0.55rem 0.8rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--muted);
}
.dinner-more > summary::-webkit-details-marker { display: none; }
.dinner-more[open] > summary { background: var(--jade); border-color: var(--herb); color: var(--herb-deep); }
.dinner-more-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.7rem;
  background: var(--enamel);
  border-radius: var(--radius);
}
.dinner-more[open] { flex-basis: 100%; display: flex; flex-wrap: wrap; }
.dinner-more-panel .place-form select { min-height: 40px; }

/* A night with nothing planned: one quiet line. */
.day-empty {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--muted);
}
.day-empty .day-when { font-family: var(--display); font-weight: 700; color: var(--ink); white-space: nowrap; }

/* Lists */

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin: 1.75rem 0 0.6rem;
}

.group-title h2 { margin: 0; }

/* Rows in one white panel, divided by hairlines, like a list on paper. */
.items {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.item:first-child { border-top: 0; }

.item-main { flex: 1; min-width: 10rem; }
.item-name { font-weight: 600; }
.item-name a { color: var(--ink); text-decoration: none; }
.item-name a:hover { color: var(--herb-deep); }
.item-name .amount { font-weight: 400; color: var(--muted); }
.store .item-name, .have-on-trip .item-name { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.store .item-name .amount, .have-on-trip .item-name .amount { white-space: nowrap; font-size: 0.9rem; }
.item-actions { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 650; font-size: 0.85rem; }

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--jade);
  border-top-color: var(--herb);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.9s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
  * { transition: none !important; }
}

.devbar {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--sand);
  border-radius: 999px;
  padding: 0.15rem 0.3rem 0.15rem 0.6rem;
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
}

.devbar button { min-height: 28px; padding: 0.1rem 0.55rem; font-size: 0.8rem; }

details summary { cursor: pointer; color: var(--muted); }

/* Stars, days, pool */

.stars { display: inline-flex; gap: 0; }
.stars form { display: inline; }
.stars .star {
  border: 0; background: transparent; min-height: 32px; padding: 0 0.1rem;
  font-size: 1.05rem; color: #c4ccc6; line-height: 1;
}
.stars .star:hover { color: var(--saffron); }
.stars.rated .star { color: var(--saffron); }

.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.6rem 0 1rem;
}

.day {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 0.5rem 0.45rem;
  min-height: 82px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.day.filled { background: var(--jade-soft); border-color: var(--herb); }
.day-name { font-family: var(--display); font-weight: 750; color: var(--muted); font-size: 0.82rem; }
.day-dinner { font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.day form { display: inline; }
.day button { min-height: 24px; padding: 0 0.35rem; font-size: 0.72rem; align-self: flex-start; }

.place-form { display: inline-flex; gap: 0.3rem; align-items: center; }
.place-form select { width: auto; padding-top: 0.4rem; padding-bottom: 0.4rem; font-size: 0.88rem; border-radius: 999px; min-height: 36px; }

@media (max-width: 560px) {
  .days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* The list's tick boxes: a ticked line is bought; an unticked one stays put, greyed. */
.tick-form { flex: 0 0 auto; margin: 0; }
.tick {
  width: 1.7rem; height: 1.7rem; min-height: 0; padding: 0; border-radius: 50%;
  border: 2px solid var(--line); background: var(--card); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; line-height: 1; cursor: pointer; flex: 0 0 auto;
}
.tick-on { background: var(--herb); border-color: var(--herb); }
.item.left-off .item-main { opacity: 0.45; }

/* A recipe's own page; the cooking view is the same page, bigger, for reading from across the counter. */
.recipe h1 { font-size: 1.9rem; }
.recipe-facts { margin-bottom: 0.5rem; }
.recipe-ingredients, .recipe-steps { padding-left: 1.3rem; }
.recipe-ingredients li, .recipe-steps li { margin: 0.4rem 0; }
.recipe-ingredients li::marker { color: var(--herb); }
.recipe-steps li { margin: 0.8rem 0; }
.recipe-steps li::marker { font-family: var(--display); font-weight: 800; color: var(--herb); }
.recipe.cooking { font-size: 1.25rem; line-height: 1.55; }
.recipe.cooking h1 { font-size: 2rem; }
.source-text { white-space: pre-wrap; font: inherit; background: var(--card); padding: 0.75rem; border-radius: 0.5rem; }
.recipe h2, .learn h2, .together h2, .ask h2, .reflect h2 { scroll-margin-top: 4.5rem; }

/* The recipe's sections, a tap away on a long page. */
.sections {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin: 0.25rem -1rem 1rem;
  padding: 0.55rem 1rem;
  background: rgba(243, 246, 242, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.sections::-webkit-scrollbar { display: none; }
.sections a { flex: 0 0 auto; }
@media (min-width: 721px) { .sections { top: 3.6rem; } }

/* Each person's email choices on the People page. */
.email-choices .check { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.35rem 0; font-size: 0.95rem; font-weight: 400; }
.email-choices .check input { margin-top: 0.3rem; accent-color: var(--herb); }

/* Recipe photos, loaded from NYT: a small square in lists, a short banner on cards, a large one on the recipe's page. */
.photo { display: block; object-fit: cover; background: var(--jade); }
.photo-thumb { width: 3.75rem; height: 3.75rem; border-radius: 12px; flex: 0 0 auto; }
.photo-banner { width: 100%; aspect-ratio: 2 / 1; max-height: 12rem; border-radius: 14px; margin-bottom: 0.7rem; }
.photo-large { width: calc(100% + 2rem); max-width: none; aspect-ratio: 4 / 3; margin: -1rem -1rem 1rem; }
@media (min-width: 721px) { .photo-large { width: 100%; margin: 0 0 1.25rem; border-radius: var(--radius-lg); } }

/* A recipe with no photo: its first letter, on a tile. */
.photo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--jade);
  color: var(--herb-deep);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
}

/* The cooking conversation on a recipe's page. */
.ask { margin-top: 2rem; scroll-margin-top: 4.5rem; }
.chat { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.chat-question, .chat-answer { padding: 0.65rem 0.85rem; border-radius: 18px; max-width: 92%; }
.chat-question { align-self: flex-end; background: var(--herb); color: #fff; border-bottom-right-radius: 6px; }
.chat-question .chat-who { color: rgba(255, 255, 255, 0.8); }
.chat-answer { align-self: flex-start; background: var(--card); border: 1px solid var(--line-soft); border-bottom-left-radius: 6px; }
.chat-day { align-self: center; font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }
.chat-who { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.15rem; font-weight: 600; }
.chat-question p, .chat-answer p { margin: 0.35rem 0 0; }
.chat-question p:first-of-type, .chat-answer p:first-of-type { margin-top: 0; }
.ask .alert { background: var(--sand); padding: 0.5rem 0.75rem; border-radius: 0.5rem; }
.chat-form textarea { width: 100%; margin-bottom: 0.5rem; min-height: 5rem; }

/* A recipe from a photo. */
.photo-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.photo-form input[type="file"] { flex: 1 1 12rem; min-width: 0; font-size: 0.9rem; }
.notice-inline { background: var(--jade); color: var(--herb-deep); padding: 0.6rem 0.85rem; border-radius: 12px; }

/* At the store: sections of a store, things got, Kroger on the trip. */
.store { margin-bottom: 0.5rem; }
.aisle-title { font-family: var(--display); font-size: 0.92rem; font-weight: 750; color: var(--muted); margin: 1rem 0 0.4rem 0.2rem; }
.item.got .item-main { opacity: 0.45; }
.item.got .item-name { text-decoration: line-through; }
.left-off-note { margin-top: 0.5rem; }
.not-in-cart, .kroger-instead { margin: 0.25rem 0 0.5rem; }
.have-on-trip { margin: 1.25rem 0 0.5rem; }
.have-on-trip summary { padding: 0.4rem 0; }
.way { display: inline-flex; gap: 0.15rem; background: var(--sand); border-radius: 999px; padding: 0.15rem; margin: 0.15rem 0 0.4rem; }
.way-form { display: inline; margin: 0; }
.item-move form { display: inline; margin: 0; }
.item-move button {
  background: none; border: 0; padding: 0.15rem 0; min-height: 0; box-shadow: none;
  font-size: 0.8rem; color: var(--muted); text-decoration: underline; cursor: pointer;
}
.store .item-for, .item-for { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.added-note { margin: 0.4rem 0 0; color: var(--herb-deep); }
.buy-link { margin-top: 0.4rem; }

/* A whole card opens its recipe (Ben, 2026-10-17): the title's link stretches
   over the card, and the card's own buttons, pickers and links stay on top. */
.card-opens { position: relative; }
.card-opens .card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-opens :is(button, select, input, textarea, summary, a:not(.card-link), .dinner-more-panel) { position: relative; z-index: 2; }
@media (hover: hover) { .card-opens:has(.card-link:hover) { border-color: var(--herb); } }

/* Planning comes first (the walkthrough, 2026-10-17). */
.week-strip h2 { margin-bottom: 0.6rem; }
.strip-more { margin: 0.25rem 0 0.75rem; }
.strip-more > summary { padding: 0.7rem 0.9rem; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); font-size: 0.9rem; line-height: 1.45; color: var(--ink); }
.strip-more[open] > summary { margin-bottom: 0.75rem; }
.plan-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 0.5rem;
  margin: 1rem -1rem 0; padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
  .plan-bar { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: 0.65rem; }
}
.plan-bar-text { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 0.9rem; }
.plan-bar-text strong { font-family: var(--display); font-size: 1.05rem; }
.plan-bar form { margin: 0; }
.pool-here { margin: 0.75rem 0 1rem; }
.pool-here p { margin: 0 0 0.5rem; }
.store .item.card-opens .item-main { min-width: 0; }
.store .item.card-opens .card-link { color: inherit; text-decoration: none; }

/* The pool: dinners to pick from, each with its photo and a heart. */
.slot .option {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem 0.85rem;
  margin-bottom: 0.85rem;
}
.option.picked { border-color: var(--herb); box-shadow: inset 0 0 0 1px var(--herb); }
.option .photo-banner { margin: -0.75rem -0.85rem 0.75rem; width: calc(100% + 1.7rem); max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; aspect-ratio: 16 / 9; max-height: 15rem; }
.option .hints { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0.2rem; }
.option .hints > div { margin: 0; }
.hint-learn, .hint-cook, .option .hint-early {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.hint-learn { background: var(--jade); color: var(--herb-deep); margin: 0.25rem 0; }
.hint-cook { background: var(--tone-soft, var(--tone-2-soft)); color: var(--tone, var(--amber-ink)); margin: 0.25rem 0; }
.option .hint-early { background: var(--sand); color: var(--muted); }
.option .hint-early::before { content: none; }

/* The heart that picks a dinner sits on its photo. */
.pick-on-photo { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 3; margin: 0; }
.pick-on-photo button {
  min-height: 0; padding: 0.4rem 0.75rem; border: 0; font-weight: 700;
  background: rgba(255, 255, 255, 0.94); color: var(--ink); box-shadow: 0 4px 14px rgba(24, 36, 29, 0.18);
}
.pick-on-photo button.btn-on { background: var(--herb); color: #fff; }
.pick-inline { float: right; margin: 0 0 0.3rem 0.6rem; position: relative; z-index: 3; }
.pick-inline button { min-height: 36px; padding: 0.35rem 0.8rem; }
.option .reason { margin: 0.35rem 0 0; font-size: 0.88rem; line-height: 1.45; }
.redraft-form { flex-wrap: wrap; }

/* What a recipe teaches (2026-10-17). */
.learn { margin-top: 2rem; }
.lesson { background: var(--card); border: 1px solid var(--line-soft); border-left: 4px solid var(--herb); border-radius: var(--radius); padding: 0.85rem 1rem; margin: 0.65rem 0; }
.lesson h3 { margin: 0 0 0.35rem; color: var(--herb-deep); }
.lesson p { margin: 0.4rem 0 0; }
.lesson strong { font-weight: 650; }
.lesson-safety { color: var(--amber-ink); background: var(--tone-2-soft); padding: 0.35rem 0.6rem; border-radius: 8px; }
.cooked { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.25rem 0 0.75rem; }
.next-skill { background: var(--herb); color: #fff; border: 0; }
.next-skill h2 { margin-top: 0; color: #fff; }
.next-skill .muted, .next-skill p { color: rgba(255, 255, 255, 0.86); }
.next-skill a { color: #fff; }
.hint-learn a { color: inherit; }
.reflect { margin-top: 2rem; }
.reflection h2 { margin-top: 0; }
.outcome-chips { margin: 0.5rem 0 0.75rem; }
.chip-check { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.88rem; font-weight: 550; background: var(--card); cursor: pointer; margin: 0; }
.chip-check input { accent-color: var(--herb); margin: 0; }
.chip-check:has(input:checked) { background: var(--jade); border-color: var(--herb); color: var(--herb-deep); }
.reflect-form textarea { width: 100%; margin-bottom: 0.5rem; }
.reflect-form .photo-form { margin-bottom: 0.75rem; }

/* The notebook: what each of us has practiced. */
.practiced, .cooked-lately { list-style: none; padding: 0; }
.people-switch { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }

/* Cook together (2026-10-17). */
.together { margin-top: 2rem; }
.part { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0.85rem 1rem; margin: 0.65rem 0; }
.part h3 { margin: 0 0 0.45rem; }
.part-steps { margin: 0; padding-left: 1.15rem; }
.part-steps li { margin: 0.35rem 0; }
.part-at { font-weight: 700; color: var(--herb-deep); white-space: nowrap; }
.together-form { margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Whose night it is (2026-10-17). */
.day-cook { color: var(--tone, var(--amber-ink)); font-weight: 650; }
.cook-night-form { margin-top: 0.5rem; flex-wrap: wrap; }
.cook-night-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin: 0; padding: 0.45rem 0; font-weight: 600; border-top: 1px solid var(--line-soft);
}
.cook-night-pick:first-of-type { border-top: 0; }
.cook-night-pick select { width: auto; min-width: 11rem; }

/* A big screen (the Mac): the boards spread out (the week, the pool, the list,
   the library, a recipe); reading pages stay one comfortable column. */
@media (min-width: 721px) and (max-width: 1023px) {
  .page-wide .slot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
  .page-wide .slot .option { margin: 0; }
}

@media (min-width: 1024px) {
  .topbar-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
  body:has(main.page-wide) .topbar-inner { max-width: 1160px; }
  .page { padding-left: 1.5rem; padding-right: 1.5rem; }
  .page-wide { max-width: 1160px; }
  .flash { max-width: 1160px; padding: 0 1.5rem; }
  .page-wide .lede { max-width: 46rem; }
  .page-wide > .card, .page-wide > .week-strip, .page-wide > .empty { max-width: 46rem; }
  .plan-bar { margin-left: -1.5rem; margin-right: -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }

  /* The week: dinners two by two; tonight across the top, its photo beside it. */
  .week-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; align-items: start; }
  .week-grid > .dinner { margin-bottom: 1rem; }
  .week-grid > .dinner-hero { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); margin-bottom: 1.5rem; }
  .week-grid > .dinner-hero .photo-hero { aspect-ratio: auto; height: 100%; min-height: 19rem; }
  .week-grid > .dinner-hero .dinner-body { display: flex; flex-direction: column; justify-content: center; padding: 1.75rem 2rem; }
  .week-grid > .dinner-hero .option-title { font-size: 2rem; }

  /* The pool: a grid of dinners to browse. */
  .page-wide .slot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
  .page-wide .slot .option { margin: 0; }

  /* The list: a store's aisles in two columns. */
  .page-wide .aisles { columns: 2; column-gap: 1.25rem; }
  .page-wide .aisle { break-inside: avoid; padding-top: 0.1px; }
  .page-wide .aisle .items { margin-bottom: 0.25rem; }

  /* The library: cards two across. */
  .library-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .library-items > .item, .library-items > .item:first-child { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); align-items: flex-start; }

  /* A recipe: the photo beside the title, the ingredients in view beside the method. */
  .recipe-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.25rem; align-items: start; margin-bottom: 0.75rem; }
  .recipe-head-text { padding-top: 0.5rem; }
  .recipe-head .photo-large { margin: 0; }
  .recipe-head h1 { font-size: 2.4rem; }
  .sections { margin-left: -1.5rem; margin-right: -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
  .recipe-layout { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
  .recipe-side {
    position: sticky; top: 7.75rem; max-height: calc(100vh - 9rem); overflow: auto;
    background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 1rem 1.25rem;
  }
  .recipe-side h2 { margin-top: 0.25rem; }
  .recipe-main > .recipe:first-child > h2:first-child { margin-top: 0; }
}

/* Our notes on a recipe (2026-10-17): the family's own words, for next time. */
.our-notes { margin: 0.25rem 0 1.25rem; max-width: 46rem; scroll-margin-top: 4.5rem; }
.our-notes h2 { margin-bottom: 0.5rem; }
.recipe-note {
  background: var(--card); border: 1px solid var(--line-soft); border-left: 4px solid var(--saffron);
  border-radius: var(--radius); padding: 0.7rem 0.95rem; margin: 0.5rem 0;
}
.recipe-note p { margin: 0 0 0.35rem; }
.note-who { color: var(--muted); font-weight: 600; }
.note-edit { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.note-edit > summary { list-style: none; }
.note-edit > summary::-webkit-details-marker { display: none; }
.note-edit[open] { flex-basis: 100%; align-items: stretch; }
.note-edit[open] > summary { align-self: flex-end; }
.note-edit form { margin: 0; }
.note-edit textarea, .note-form textarea { min-height: 4.5rem; margin-bottom: 0.5rem; }
.note-form { margin-top: 0.6rem; }
.recipe-note-line { font-size: 0.86rem; background: var(--tone-2-soft); border-radius: 10px; padding: 0.35rem 0.65rem; margin: 0.4rem 0; }
.recipe-note-line .note-who { color: var(--amber-ink); }

/* Adding to the list (2026-10-17): a bunch typed at once, a photo of the handwritten list, the regulars. */
.add-things { margin-top: 1.5rem; scroll-margin-top: 4.5rem; max-width: 46rem; }
.add-things h2 { margin-bottom: 0.5rem; }
.add-form { display: flex; gap: 0.5rem; align-items: flex-end; }
.add-form textarea { min-height: 3.2rem; flex: 1; }
.list-photo-form { margin-top: 0.75rem; }
.list-photo-form .small { flex: 1 1 100%; color: var(--muted); }
.regulars { margin-top: 1rem; scroll-margin-top: 4.5rem; }
.regulars h3 { margin: 0; }
.regulars .chips { margin-top: 0.5rem; }
.regular-form { display: inline; margin: 0; }
.regular-add { min-height: 36px; cursor: pointer; }
.regular-on { background: var(--jade); border-color: var(--herb); color: var(--herb-deep); }
.regular-due { border-color: var(--saffron); }
.regular-due .due { color: var(--amber-ink); font-size: 0.75rem; font-weight: 700; }
.from-photo { border-color: var(--saffron); scroll-margin-top: 4.5rem; max-width: 46rem; }
.photo-lines { list-style: none; margin: 0.5rem 0 0.75rem; padding: 0; }
.photo-line { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.45rem 0; border-top: 1px solid var(--line-soft); }
.photo-line:first-child { border-top: 0; }
.photo-line input[type="checkbox"] { margin-top: 0.85rem; width: 1.2rem; height: 1.2rem; accent-color: var(--herb); flex: 0 0 auto; }
.photo-line input[type="text"] { padding: 0.5rem 0.7rem; }
.discard-photo { margin-top: 0.5rem; }

/* A sheet over the page (2026-10-17): from the bottom on a phone, in the middle on a big screen. */
dialog.sheet {
  border: 0; padding: 0; color: var(--ink); background: var(--card);
  width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(24, 36, 29, 0.25); overflow: auto;
}
dialog.sheet::backdrop { background: rgba(24, 36, 29, 0.42); }
.sheet-inner { padding: 0.9rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.4rem; }
.sheet-head h2 { margin: 0; }
.sheet-close { font-size: 1.1rem; min-width: 42px; min-height: 42px; }
.sheet-part { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.sheet-part h3 { margin-bottom: 0.25rem; }
@media (min-width: 721px) {
  dialog.sheet { width: min(34rem, 92vw); margin: auto; border-radius: 22px; box-shadow: 0 24px 60px rgba(24, 36, 29, 0.3); }
  .sheet-inner { padding: 1.25rem 1.5rem 1.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-up 0.22s ease-out; }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Back from a recipe (2026-10-17): over the photo's corner when there is one, like an app's back button. */
.recipe-head { position: relative; }
.back-link {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 40px; padding: 0.45rem 0.9rem 0.45rem 0.7rem;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font-weight: 650; font-size: 0.92rem; text-decoration: none; margin-bottom: 0.75rem;
}
.back-link span { font-size: 1.35rem; line-height: 0.8; margin-top: -0.1rem; }
.back-link:hover { border-color: var(--herb); color: var(--ink); }
.recipe-head:has(> .photo-large) > .back-link {
  position: absolute; top: 0.75rem; left: 0.75rem; z-index: 3; margin: 0;
  background: rgba(255, 255, 255, 0.92); border-color: transparent; box-shadow: 0 4px 14px rgba(24, 36, 29, 0.2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.back-bottom { margin-top: 1rem; }
/* The card a back button lands on stays clear of the sticky bar. */
[id^="dinner_"], [id^="entry_"], [id^="recipe_"] { scroll-margin-top: 5rem; }
