:root {
  --bg: #f1e7d8;
  --bg-2: #e9ddcc;
  --paper: #fff8f1;
  --ink: #2b1b12;
  --ink-soft: #6d5648;
  --ink-faint: #9a8474;
  --line: #e2d2c0;
  --terra: #b44122;
  --terra-deep: #8c2f16;
  --terra-soft: #f6d7c8;
  --olive: #55663b;
  --olive-soft: #e4ebd4;
  --gold: #c4921a;
  --poppy: #e05648;
  --good: #3f7a4a;
  --shadow: 0 8px 28px rgba(43, 27, 18, 0.08);
  --on-soft: #2d371c;
  --radius: 18px;
  --font-ui: "Figtree", "Helvetica Neue", sans-serif;
  --font-display: "Fraunces", "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
}
body { margin: 0; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

#phone {
  width: 100%;
  max-width: 480px;
  height: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.status-bar { display: none; }
#app { padding-top: env(safe-area-inset-top, 0px); }
#phone.dark { background: #241811; }
#phone.immersive #app { padding-top: 0; }
#phone.immersive .hero .overlay-bar { padding-top: env(safe-area-inset-top, 12px); }
#phone.immersive .cook-top { padding-top: env(safe-area-inset-top, 12px); }
#overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 90;
}
#overlays .toast,
#overlays .modal-backdrop {
  pointer-events: auto;
}
.status-time { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.status-icons { display: flex; gap: 6px; align-items: center; }
#app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---- typography ---- */
h1, h2, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--terra);
}

/* ---- chrome ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 16px 8px;
  gap: 10px;
  min-height: 44px;
}
.topbar.home-topbar { display: none; }
.home-topbar + .scroll .week-head { padding-top: 10px; }
.brand {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.icon-btn:active { background: var(--bg-2); }
.back-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}
.back-row .icon-btn { margin-left: 2px; }

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 18px;
}
.scroll.with-nav { padding-bottom: 88px; }
.scroll.with-nav.send { padding-bottom: 150px; }
.scroll.with-cta { padding-bottom: 96px; }

/* ---- bottom nav ---- */
.tab-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92px;
  background: linear-gradient(to bottom, transparent 0%, var(--bg) 36%);
  pointer-events: none;
  z-index: 28;
}
.tabbar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 62px;
  background: rgba(255, 248, 241, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: flex;
  box-shadow: var(--shadow);
  z-index: 30;
}
.tabbar button {
  flex: 1;
  min-width: 0;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-faint);
}
.tabbar button.active { color: var(--terra-deep); }
.tabbar svg { width: 22px; height: 22px; }

/* ---- week ---- */
.week-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 16px 8px;
}
.week-tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: 999px; }
.week-tabs button {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.week-tabs button.on {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(43, 27, 18, 0.08);
}
.week-label { font-size: 12px; color: var(--ink-soft); font-weight: 500; padding-bottom: 6px; }

.day-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 16px 6px;
  margin: -6px 0 -2px;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 96px;
  width: 96px;
  text-align: left;
  color: inherit;
}
.day-card .thumb {
  width: 96px;
  height: 112px;
  min-width: 96px;
  min-height: 112px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
  box-shadow: 0 2px 0 rgba(43, 27, 18, 0.04);
}
.day-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.day-card .day {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.day-card .name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 1px;
  overflow-wrap: anywhere;
}
.day-card.today .day { color: var(--terra); }
.day-card.today .thumb { outline: 2px solid var(--terra); outline-offset: 2px; }
.day-card .thumb { position: relative; }
.thumb .heart {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
}
.heart {
  position: absolute;
  top: 6px;
  right: 6px;
}

/* ---- search & chips ---- */
.search-wrap { padding: 14px 16px 8px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
}
.search input {
  border: 0;
  outline: 0;
  background: none;
  width: 100%;
  font-size: 15px;
}
.search input::placeholder { color: var(--ink-faint); }
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip.poppy.on, .chip.poppy {
  /* default looks like others */
}
.chip.poppy.on {
  background: var(--poppy);
  border-color: var(--poppy);
  color: #fff;
}

/* ---- shelves & grid ---- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 8px;
  gap: 8px;
}
.section-head h2 { font-size: 20px; }
.section-head .sub { font-size: 12px; color: var(--ink-soft); margin-right: auto; margin-left: 8px; }

.to-try-panel {
  --panel-inset: 8px;
  margin: 8px var(--panel-inset) 4px;
  padding: 14px var(--panel-inset) 12px;
  border-radius: 20px;
  background: #f6d9c8;
  box-shadow: inset 0 0 0 1px #e8c4ae;
}
.to-try-panel-head {
  padding: 0 2px 12px;
}
.to-try-panel-head h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.to-try-hint {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.3;
}
.to-try-panel .grid {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}
.home-divider {
  height: 1px;
  margin: 16px 16px 10px;
  background: var(--line);
  border: 0;
}
html[data-theme="dark"] .to-try-panel {
  background: #332c28;
  box-shadow: inset 0 0 0 1px #534b45, 0 8px 24px rgba(0, 0, 0, 0.35);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 10px;
  padding: 0 16px 8px;
}
.recipe-card { position: relative; text-align: left; color: inherit; }
.recipe-card .card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(43, 27, 18, 0.82);
  color: #fff8f1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  pointer-events: none;
}
html[data-theme="dark"] .recipe-card .card-badge {
  background: rgba(64, 59, 56, 0.92);
  color: #f6eee4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.recipe-card .thumb {
  height: 124px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
}
.recipe-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-card .meta { padding: 7px 2px 0; }
.recipe-card .cuisine {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.recipe-card .name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 2px;
}

.ph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  background:
    radial-gradient(80% 80% at 20% 10%, rgba(255,255,255,.28), transparent 50%),
    linear-gradient(160deg, #c96a3c 0%, #8d3a1e 55%, #5c2a16 100%);
  color: #fff8f1;
}
.ph.alt { background: linear-gradient(160deg, #7a8a4e 0%, #44512c 100%); }
.ph.alt2 { background: linear-gradient(160deg, #c4923a 0%, #8a5a14 100%); }
.ph.alt3 { background: linear-gradient(160deg, #6a4a3a 0%, #3a241c 100%); }
.ph .ph-k { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: .85; }
.ph .ph-t { font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.15; }

.heart {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 248, 241, 0.92);
  display: grid;
  place-items: center;
  color: var(--poppy);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.heart svg { width: 12px; height: 12px; }

/* ---- recipe page ---- */
.hero {
  height: 248px;
  position: relative;
  background: var(--bg-2);
}
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .overlay-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
}
.hero-back, .hero-ghost {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,248,241,.92);
  display: grid; place-items: center;
  margin-top: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.recipe-body { padding: 16px 18px 0; }
.recipe-body h1 { font-size: 28px; margin: 0 0 8px; }
.recipe-facts {
  display: flex;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 14px;
}
.recipe-facts span { display: flex; align-items: center; gap: 5px; }

.recipe-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}
.recipe-meta > :last-child { margin-bottom: 0; }
.recipe-head-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.recipe-head-actions .btn-add-to-week {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
}

@media (min-width: 600px) {
  .recipe-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
  }
  .recipe-meta {
    flex: 1 1 auto;
    min-width: 0;
  }
  .recipe-head-actions {
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-end;
  }
  .recipe-head-actions .btn-add-to-week {
    flex: 0 0 auto;
    width: auto;
    height: 48px;
    padding: 0 20px;
    font-size: 16px;
  }
}

.type-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
}
.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.type-pill-edit {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 650;
  cursor: pointer;
}
.type-pill-edit svg { width: 12px; height: 12px; }
.type-pill-edit:active { background: var(--bg-2); }

.type-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.type-add-chip {
  border-style: dashed;
}
.type-add-form {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}
.type-add-form input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  outline: none;
}
.type-add-form input:focus {
  outline: 2px solid var(--terra);
  outline-offset: 1px;
}
.type-add-form .type-add-go,
.type-add-form .type-add-save {
  width: auto;
  min-width: 88px;
  height: 44px;
  padding: 0 16px;
  flex: 0 0 auto;
}
.type-sheet-actions { margin-top: 4px; }

@media (max-width: 1023px) {
  .modal-backdrop.type-sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal.type-sheet {
    max-width: none;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
}
@media (min-width: 1024px) {
  .modal.type-sheet { max-width: 420px; }
}

.servings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 5px;
  margin-bottom: 14px;
}
.serv-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}
.serv-btn:disabled { opacity: .35; }
.serv-copy { flex: 0 0 auto; }
.serv-copy strong { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; padding: 0 6px; }

.leftover {
  background: var(--olive-soft);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--on-soft);
}
.leftover .kicker { color: var(--olive); margin-bottom: 3px; }
.leftover p { font-size: 14px; line-height: 1.4; font-weight: 500; }

.block { margin-bottom: 20px; }
.block h2 { font-size: 20px; margin-bottom: 8px; }
.ing-group { margin: 0 0 12px; }
.ing-group h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--terra-deep);
  margin: 8px 0 6px;
}
.ing-list { list-style: none; }
.ing-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.ing-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ing-row .ing-text { flex: 1; min-width: 0; }
.ing-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.ing-icon:hover,
.ing-icon:focus-visible { background: var(--bg-2); color: var(--ink); }
.ing-edit-form {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}
.ing-draft {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
.ing-draft:focus { outline: 2px solid var(--terra); outline-offset: 1px; }
.ing-save {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 13px;
}
.ing-add {
  margin-top: 6px;
  min-height: 40px;
  padding: 0 2px;
  color: var(--terra);
  font-weight: 650;
  font-size: 14px;
}
.ing-add:hover,
.ing-add:focus-visible { text-decoration: underline; }
.method-list { list-style: none; counter-reset: step; }
.method-list li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.45;
}
.method-list li::before {
  counter-increment: step;
  content: counter(step);
  flex: 0 0 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--terra-soft);
  color: var(--terra-deep);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
}
.source {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 8px;
}
.source a { color: var(--terra-deep); }

.sticky-cta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
}
.btn-primary,
.btn-secondary,
.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.btn-primary {
  background: var(--terra);
  color: #fff8f1;
  border: 0;
  box-shadow: 0 8px 20px rgba(180, 65, 34, 0.28);
}
.btn-primary:active { background: var(--terra-deep); }
.btn-secondary {
  background: var(--bg-2);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn-secondary:active { background: var(--paper); }
.btn-danger {
  background: #a34436;
  color: #fff8f1;
  border: 0;
  box-shadow: none;
}
.btn-danger:active { background: #8a3a2a; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn-secondary,
.btn-row .btn-primary,
.btn-row .btn-danger { flex: 1; width: auto; min-width: 0; }
.btn-yes { background: var(--olive); box-shadow: 0 8px 20px rgba(63,122,74,.22); }
.btn-no { border-color: var(--line); color: var(--ink-soft); }

/* ---- cook mode ---- */
.cook {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #241811;
  color: #f6eadb;
}
.cook .status-spacer { height: 0; }
.cook-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
}
.cook-top .icon-btn { color: #f6eadb; }
.cook-progress { font-size: 13px; font-weight: 600; color: #d8c4b0; }
.cook-dots { display: flex; gap: 4px; justify-content: center; padding: 0 24px 8px; }
.cook-dots i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(246, 234, 219, 0.18);
}
.cook-dots i.on { background: #f0b089; }
.cook-step {
  flex: 1;
  min-height: 0;
  padding: 12px 22px 16px;
  display: flex;
  flex-direction: column;
}
.cook-step .step-kicker { color: #f0b089; margin-bottom: 10px; }
.cook-step p {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.28;
}
.timers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  background: rgba(246, 234, 219, 0.1);
  border: 1px solid rgba(246, 234, 219, 0.22);
  color: #f6eadb;
  font-weight: 600;
  font-size: 14px;
}
.timer.running {
  background: var(--terra);
  border-color: var(--terra);
}
.timer.done {
  background: var(--olive);
  border-color: var(--olive);
}
.cook-nav {
  display: flex;
  gap: 10px;
  padding: 8px 16px 18px;
}
.cook-nav button {
  flex: 1;
  height: 52px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
}
.cook-nav .prev {
  background: rgba(246, 234, 219, 0.1);
  color: #f6eadb;
}
.cook-nav .next {
  background: #f6eadb;
  color: #241811;
}
.cook-nav button:disabled { opacity: 0.35; }

/* ---- shopping ---- */
.shop-head { padding: 0 16px 10px; }
.shop-head h1 { font-size: 26px; margin: 2px 0 8px; }
.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--olive-soft);
  color: var(--on-soft);
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.avatars { display: flex; }
.avatars b {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: var(--olive);
  border: 1.5px solid var(--olive-soft);
  margin-right: -5px;
}
.avatars b.k { background: #3f5c8a; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(63,122,74,.15);
  margin-left: 3px;
}

.aisle { padding: 6px 16px 4px; }
.aisle h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 8px 0 4px;
}
.shop-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.shop-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.btn-shop-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--terra-deep);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(43, 27, 18, 0.06);
  white-space: nowrap;
}
.btn-shop-add svg { width: 14px; height: 14px; }
.btn-shop-add:hover,
.btn-shop-add:focus-visible,
.btn-shop-add:active { background: var(--bg-2); }
.shop-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.shop-row .shop-item {
  flex: 1;
  min-width: 0;
  width: auto;
  border-bottom: 0;
}
.shop-item-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}
.shop-item-line {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
}
.shop-item-from {
  flex: 0 0 auto;
  font-style: italic;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-faint);
  white-space: nowrap;
}
.shop-item-from::before {
  content: " \2014\00a0";
  font-style: normal;
  color: var(--ink-faint);
  opacity: 0.65;
}
.shop-edit-btn {
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-faint);
  display: grid;
  place-items: center;
  align-self: center;
}
.shop-edit-btn:hover,
.shop-edit-btn:focus-visible,
.shop-edit-btn:active {
  background: var(--bg-2);
  color: var(--ink);
}
.shop-edit-form .form-field { margin: 0 0 12px; }
.shop-edit-qty-row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
}
.shop-edit-notice {
  background: var(--olive-soft);
  color: var(--on-soft) !important;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px !important;
  font-weight: 600;
  margin: 0 0 12px !important;
}
.shop-edit-error {
  font-size: 13.5px;
  margin: -4px 0 12px !important;
  color: var(--terra) !important;
}
.shop-edit-actions { margin-top: 4px; }
.shop-edit-delete {
  margin-top: 10px;
  height: 46px;
}
.box {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 1.5px solid #c4b09c;
  display: grid;
  place-items: center;
  background: var(--paper);
}
.shop-item.ticked { color: var(--ink-faint); }
.shop-item.ticked .box {
  background: var(--olive);
  border-color: var(--olive);
  color: #fff;
}
.shop-item.ticked .shop-item-line,
.shop-item.ticked .shop-item-from { text-decoration: line-through; }
.shop-item.ticked .shop-item-from { opacity: 0.75; }

/* ---- rate ---- */
.rate { padding: 8px 20px 20px; }
.rate .eyebrow { color: var(--ink-soft); font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.rate h1 { font-size: 26px; margin-bottom: 16px; }
.stars {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.stars button {
  width: 44px;
  height: 44px;
  color: var(--line);
}
.stars button.on { color: var(--gold); }
.note-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
textarea.note {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 16px;
  padding: 12px 14px;
  resize: none;
  outline: none;
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 22px;
}
.prompt {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.prompt h2 { font-size: 18px; margin-bottom: 6px; }
.prompt p { font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---- ideas / tonight ---- */
.ideas-hero { padding: 4px 18px 10px; }
.ideas-hero h1 { font-size: 28px; margin: 4px 0 6px; }
.ideas-hero p { color: var(--ink-soft); font-size: 14.5px; }
.ing-entry {
  display: flex;
  gap: 8px;
  padding: 12px 16px 8px;
}
.ing-entry input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 10px 14px;
  outline: none;
}
.ing-entry .add {
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}
.picked {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}
.picked .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--terra-soft);
  color: var(--terra-deep);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-weight: 600;
  font-size: 14px;
}
.picked .tag button {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(140, 47, 22, 0.12);
  font-size: 13px;
  line-height: 1;
}
.match-count { padding: 4px 16px 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }


#phone.immersive:not(.dark) .status-bar { color: #fff8f1; }
#phone.immersive:not(.dark) .status-bar svg { filter: drop-shadow(0 1px 3px rgba(0,0,0,.55)); }
#phone.immersive:not(.dark) .status-time { text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.hero::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 100px;
  background: linear-gradient(to bottom, rgba(20,10,6,.42), transparent);
  pointer-events: none;
}
.hero .overlay-bar { z-index: 3; }


/* ---- store cupboard ---- */
.cup-note {
  margin: 0 16px 12px;
  background: var(--olive-soft);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--on-soft);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
}
.skip-note {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--olive);
}
.skip-note button,
.skip-note a {
  color: var(--olive);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  font-weight: 600;
}
.skip-note.freezer-note {
  font-weight: 500;
  margin-top: 6px;
}
.skip-note.freezer-note button {
  font-weight: 500;
}
.plan-freezer-note {
  font-style: italic;
  font-weight: 500;
}
.cup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cup-item .name { font-size: 15.5px; }
.cup-item .state {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 8px;
}
.cup-item.on .state { color: var(--olive); }
.toggle {
  flex: 0 0 44px;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d5c4b2;
  position: relative;
  transition: background .15s ease;
}
.toggle.on { background: var(--olive); }
.toggle i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff8f1;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .15s ease;
}
.toggle.on i { transform: translateX(18px); }
.cup-item-right { display: flex; align-items: center; }

/* ---- v1 additions: gate, sent, toast, share ---- */
.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
}
.gate .brand { font-size: 40px; margin-bottom: 6px; }
.gate p { color: var(--ink-soft); margin: 0 0 22px; }
.gate input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 18px;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}
.gate .err { color: var(--terra); font-weight: 600; min-height: 1.2em; margin: 0 0 10px; font-size: 14px; }
.sent-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--olive-soft);
  color: var(--olive);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  margin: 10px 0 4px;
}
.shop-week-switch { margin-bottom: 8px; }
.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: auto;
  max-width: none;
  margin: 0;
  transform: none;
  background: #2b1b12;
  color: #fff8f1;
  padding: 12px 16px;
  border-radius: 14px;
  text-align: center;
  font-weight: 600;
  white-space: normal;
  z-index: 90;
  box-shadow: 0 8px 28px rgba(43, 27, 18, 0.22);
}
.poppy-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
  color: var(--poppy);
  font-weight: 650;
}
.poppy-toggle.off { color: var(--ink-soft); }
.link-only-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terra);
  background: var(--terra-soft);
  border-radius: 999px;
  padding: 3px 8px;
  margin-left: 6px;
}

/* ---- responsive: keep the phone layout below 600px ---- */
@media (min-width: 600px) {
  html, body {
    background: #e4d5c3;
  }
  #phone {
    max-width: none;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    margin: 0 auto;
  }

  /* Top nav in the header flow (never overlaid on the topbar) */
  .tab-dock { display: none; }
  #app:has(.tabbar) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
  }
  #app:has(.tabbar) .topbar {
    grid-column: 1;
    grid-row: 1;
    min-height: 56px;
    padding: 8px 6px 8px 16px;
    gap: 6px;
    align-self: center;
  }
  #app:has(.tabbar) .topbar .brand {
    font-size: 20px;
    min-width: 0;
  }
  #app:has(.tabbar) .topbar .btn-add-recipe-nav {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
    flex-shrink: 0;
  }
  #app:has(.tabbar) .topbar.home-topbar {
    display: flex;
    justify-content: flex-end;
  }
  .home-topbar + .scroll .week-head { padding-top: 0; }
  #app:has(.tabbar) .tabbar {
    grid-column: 2;
    grid-row: 1;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    height: 44px;
    width: auto;
    min-width: 0;
    margin: 8px 12px 8px 4px;
    padding: 0 4px;
    border-radius: 16px;
    align-self: center;
    flex-shrink: 0;
  }
  #app:has(.tabbar) .scroll {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 0;
  }
  .tabbar button {
    flex-direction: row;
    gap: 4px;
    padding: 0 6px;
    font-size: 12px;
    flex: 0 0 auto;
  }
  .tabbar svg { width: 16px; height: 16px; }
  .topbar {
    min-height: 56px;
    padding: 8px 16px;
  }
  .scroll.with-nav { padding-bottom: 36px; }
  .scroll.with-nav.send,
  .scroll.with-cta { padding-bottom: 120px; }
  .sticky-cta {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    margin: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    padding: 24px 28px 22px;
    background: linear-gradient(to top, var(--bg) 64%, transparent);
  }
  .sticky-cta .btn-primary {
    width: auto;
    min-width: 240px;
    padding: 0 28px;
  }
  .sticky-cta p { margin: 0 !important; }
  .toast {
    left: 24px;
    right: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .week-head,
  .search-wrap,
  .section-head { padding-left: 24px; padding-right: 24px; }
  .chips { padding-left: 24px; padding-right: 24px; flex-wrap: wrap; overflow: visible; }
  .day-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 6px 24px 8px;
    margin: -6px 0 0;
  }
  .day-card { flex: none; width: auto; }
  .day-card .thumb { width: 100%; min-width: 0; height: 100px; min-height: 100px; }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
    padding: 0 24px 16px;
  }
  .recipe-card .thumb { height: 160px; }
  .to-try-panel {
    --panel-inset: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding-top: 18px;
    padding-bottom: 16px;
  }
  .to-try-panel-head { padding-bottom: 14px; }
  .to-try-panel-head h2 { font-size: 26px; }
  .home-divider { margin: 20px 24px 12px; }

  /* Shopping list and cupboard in masonry columns */
  .aisle-columns {
    columns: 2;
    column-gap: 28px;
  }
  .aisle-columns > .aisle {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    vertical-align: top;
    margin-bottom: 12px;
  }
  .cup-tools { padding-left: 8px; padding-right: 8px; }
  .aisle { padding-left: 24px; padding-right: 24px; }
  .shop-head { padding-left: 24px; padding-right: 24px; }
  .cup-note { margin-left: 24px; margin-right: 24px; }

  .hero { height: 320px; }
  .recipe-body { padding: 20px 24px 0; }
  .gate { max-width: 420px; margin: 0 auto; }
}

@media (min-width: 768px) {
  #app:has(.tabbar) .topbar {
    padding: 8px 16px;
    gap: 10px;
  }
  #app:has(.tabbar) .topbar .brand { font-size: 26px; }
  #app:has(.tabbar) .topbar .btn-add-recipe-nav {
    height: 40px;
    padding: 0 14px;
    font-size: 13.5px;
    gap: 6px;
  }
  #app:has(.tabbar) .tabbar {
    height: 48px;
    margin: 8px 16px 8px 8px;
    padding: 0 6px;
  }
  .tabbar button {
    gap: 6px;
    padding: 0 10px;
    font-size: 13px;
  }
  .tabbar svg { width: 18px; height: 18px; }
  .day-strip { gap: 12px; }
  .day-card .thumb { height: 132px; min-height: 132px; }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px 16px;
  }
}

@media (min-width: 1024px) {
  #phone {
    max-width: 1800px;
    box-shadow: 0 0 0 1px rgba(43, 27, 18, 0.05), 0 20px 60px rgba(43, 27, 18, 0.08);
  }

  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 18px;
    padding: 0 28px 20px;
  }
  .recipe-card .thumb { height: 170px; }
  .to-try-panel {
    --panel-inset: 14px;
    margin-top: 8px;
    margin-bottom: 10px;
    padding-top: 20px;
    padding-bottom: 18px;
  }
  .home-divider { margin: 24px 28px 14px; }
  .day-strip,
  .week-head,
  .search-wrap,
  .section-head,
  .chips { padding-left: 28px; padding-right: 28px; }
  .topbar { padding-left: 28px; }
  #app:has(.tabbar) .topbar { padding-left: 28px; }
  #app:has(.tabbar) .tabbar { margin-right: 28px; }
  .tabbar button { padding: 0 14px; }


  .aisle-columns {
    columns: 3;
    column-gap: 24px;
  }
  .aisle,
  .shop-head { padding-left: 28px; padding-right: 28px; }
  .cup-note { margin-left: 28px; margin-right: 28px; }

  /* Recipe: ingredients and method side by side */
  .recipe-cols {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
    gap: 12px 48px;
    align-items: start;
  }
  .hero { height: 360px; }
  .recipe-body { padding: 24px 28px 0; }
  .recipe-body h1 { font-size: 36px; }
  .cook { max-width: 720px; margin: 0 auto; width: 100%; }
}

@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .recipe-card .thumb { height: 164px; }
  .day-strip { gap: 14px; }
  .day-card .thumb { height: 140px; min-height: 140px; }
  .recipe-body { max-width: 1280px; margin: 0 auto; }
  .rate { max-width: 680px; margin: 0 auto; }
}

@media (min-width: 1600px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 24px 20px;
    padding: 0 32px 24px;
  }
  .recipe-card .thumb { height: 168px; }
  .to-try-panel { --panel-inset: 16px; }
  .home-divider { margin: 24px 32px 14px; }
  .day-strip,
  .week-head,
  .search-wrap,
  .section-head,
  .chips { padding-left: 32px; padding-right: 32px; }
  .day-strip { gap: 16px; }
  .day-card .thumb { height: 152px; min-height: 152px; }
  .topbar,
  #app:has(.tabbar) .topbar { padding-left: 32px; }
  #app:has(.tabbar) .tabbar { margin-right: 32px; }
  .aisle-columns {
    columns: 4;
    column-gap: 28px;
  }
  .aisle,
  .shop-head { padding-left: 32px; padding-right: 32px; }
  .cup-note { margin-left: 32px; margin-right: 32px; }
}

@media (min-width: 1920px) {
  .grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 24px 18px;
  }
  .recipe-card .thumb { height: 164px; }
}


/* ---- recipe photo, delete, cupboard editing ---- */
.recipe-photo {
  margin: 0 0 16px;
  max-width: 280px;
}
.recipe-photo img,
.recipe-photo .ph {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 16px;
  display: block;
}
.recipe-photo .ph {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px 14px;
  box-sizing: border-box;
}
.recipe-actions { margin: 20px 0 8px; }
.to-try-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 16px;
}
.to-try-decide {
  display: flex;
  gap: 10px;
  min-width: 0;
}
.to-try-decide .btn-primary,
.to-try-decide .btn-danger {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-add-to-week {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 999px;
  box-sizing: border-box;
  box-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-delete {
  color: #8a3a2a;
  font-weight: 650;
  background: transparent;
  border: 0;
  padding: 8px 0 16px;
  min-height: 44px;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 27, 18, 0.5);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  appearance: none;
  background-color: #fff8f1;
  color: #2b1b12;
  border: 1px solid #e2d2c0;
  border-radius: 20px;
  padding: 22px 20px 18px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(43, 27, 18, 0.22);
  color-scheme: light;
}
.modal h2 { font-size: 22px; margin: 0 0 8px; color: #2b1b12; }
.modal p { color: #6d5648; font-size: 14.5px; margin: 0 0 16px; line-height: 1.45; }
.modal .btn-row { display: flex; gap: 10px; }
.modal .btn-row > * { flex: 1; }

.toast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.toast-undo {
  color: #fff8f1;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: transparent;
  border: 0;
  padding: 6px 8px;
  min-height: 44px;
}

.ing-entry { flex-wrap: wrap; }
.ing-entry input { min-width: 140px; }
.ing-entry select {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 10px 12px;
  outline: none;
  max-width: 46%;
  font: inherit;
  color: var(--ink);
}
.cup-tools { display: flex; flex-direction: column; }
.cup-group-form { padding-top: 0; }
.aisle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 2px;
}
.aisle-head h2 { padding: 8px 0 4px; margin: 0; }
.aisle-move { display: flex; gap: 4px; flex-shrink: 0; }
.aisle-move button {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.aisle-move button:disabled { opacity: 0.35; }
.cup-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.cup-row .cup-item { flex: 1; min-width: 0; }
.cup-row-cooked {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.cup-row-cooked .cup-row-main {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.cup-row-cooked .cup-item {
  border-bottom: 0;
  padding-bottom: 4px;
}
.cup-row-sub {
  display: flex;
  align-items: center;
  padding: 2px 44px 0 0;
  min-width: 0;
}
.cup-link-btn {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cup-link-btn.linked {
  background: var(--olive-soft);
  border-color: transparent;
  color: var(--on-soft);
}
.cup-link-btn:active,
.cup-link-btn:hover {
  filter: brightness(0.96);
}
.settings-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--olive);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.cooked-link-modal {
  max-width: 440px;
  max-height: min(88dvh, 760px);
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
}
.cooked-link-head {
  flex-shrink: 0;
  margin-bottom: 12px;
}
.cooked-link-head h2 { margin-bottom: 2px; }
.cooked-link-sub {
  margin: 0 !important;
  font-weight: 600;
}
.cooked-link-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}
.cooked-link-recipe-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.cooked-link-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6d5648;
}
.cooked-link-recipe-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d5c4b2;
  background: #ffffff;
  color: #2b1b12;
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.cooked-link-recipe-btn.has-recipe .cooked-link-recipe-name { font-weight: 650; }
.cooked-link-recipe-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cooked-link-recipe-action {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--terra);
}
.cooked-link-section {
  margin-bottom: 14px;
}
.cooked-link-heading {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #2b1b12;
}
.cooked-link-ings {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid #e2d2c0;
  border-radius: 14px;
  padding: 6px 10px;
  background: #ffffff;
}
.cooked-link-ing-group {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6d5648;
  padding: 8px 0 2px;
}
.cooked-link-ing {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 2px;
  font-size: 14.5px;
  line-height: 1.35;
  color: #2b1b12;
  cursor: pointer;
}
.cooked-link-ing + .cooked-link-ing {
  border-top: 1px solid rgba(43, 27, 18, 0.08);
}
.cooked-link-ing input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--olive);
}
.cooked-link-empty {
  font-size: 13.5px !important;
  margin: 0 !important;
}
.cooked-link-extras-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.cooked-link-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 12px;
  border: 1px solid #e2d2c0;
  background: #ffffff;
  font-size: 14.5px;
  color: #2b1b12;
}
.cooked-link-extra-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.cooked-link-extra-del {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6d5648;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cooked-link-extra-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cooked-link-extra-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #d5c4b2;
  background: #ffffff;
  color: #2b1b12;
  padding: 0 12px;
  font: inherit;
  font-size: 14.5px;
}
.cooked-link-extra-add {
  flex: 0 0 auto;
  height: 42px;
  padding: 0 14px;
  width: auto;
}
.cooked-link-footer {
  flex-shrink: 0;
  padding-top: 10px;
}
.cooked-link-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}
.cooked-link-unlink {
  margin-top: 10px;
  height: 44px;
  width: 100%;
}
.cup-del {
  width: 44px;
  min-width: 44px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.cup-empty {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 6px 0 10px;
}

@media (min-width: 600px) {
  .recipe-photo {
    max-width: 100%;
  }
  .recipe-photo img,
  .recipe-photo .ph { height: 180px; }
}
@media (min-width: 1024px) {
  .recipe-ings .recipe-photo { max-width: 100%; }
  .recipe-photo img,
  .recipe-photo .ph { height: 200px; }
}


/* ---- recipe title edit + in-column actions ---- */
.recipe-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 8px;
}
.recipe-title-row h1 { margin: 0; flex: 1; min-width: 0; }
.title-edit-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  border-radius: 12px;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}
.title-edit-btn:hover,
.title-edit-btn:focus-visible { background: var(--bg-2); color: var(--ink); }
.title-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  align-items: center;
  margin: 0 0 8px;
}
.title-edit input {
  flex: 1 1 200px;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
}
.title-edit input:focus { outline: 2px solid var(--terra); outline-offset: 1px; }
.title-save,
.title-cancel {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 700;
}
.title-save { background: var(--ink); color: var(--paper); }
.title-cancel { border: 1.5px solid var(--line); color: var(--ink-soft); background: var(--paper); }

.method-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
  align-items: center;
}
.method-actions .btn-primary,
.method-actions .btn-secondary {
  width: auto;
  flex: 1 1 140px;
  min-width: 140px;
  height: 48px;
  padding: 0 20px;
  box-shadow: none;
}

/* ---- dark mode switch & settings ---- */
.settings-page {
  padding: 8px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.settings-section h2 {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 4px 8px;
}
.settings-list {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.settings-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  color: var(--ink);
}
.settings-row + .settings-row {
  border-top: 1px solid var(--line);
}
.settings-menu-row {
  justify-content: flex-start;
  gap: 14px;
  min-height: 60px;
  text-align: left;
  cursor: pointer;
  background: transparent;
  transition: background 0.12s ease;
}
.settings-menu-row:hover,
.settings-menu-row:active {
  background: var(--bg-2);
}
.settings-menu-row:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: -2px;
}
.settings-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.settings-menu-icon svg {
  width: 19px;
  height: 19px;
}
.settings-menu-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-menu-summary {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-menu-chev {
  flex: 0 0 auto;
  color: var(--ink-faint);
  display: grid;
  place-items: center;
}
.settings-about {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-about h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  padding: 0;
}
.settings-about p {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.settings-row-label {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}
.settings-hint {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  padding: 0 4px 12px;
}
.settings-list + .settings-hint {
  padding-top: 8px;
}
.settings-group + .settings-group {
  margin-top: 14px;
}
.settings-group-title {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 0 4px 6px;
}
.settings-row.restock-row {
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 16px;
}
.restock-name {
  flex: 1 1 130px;
  min-width: 0;
  overflow-wrap: break-word;
}
.restock-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
}
.restock-qty,
.restock-unit {
  height: 42px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 12px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  min-width: 0;
}
.restock-qty {
  width: 68px;
  text-align: center;
}
.restock-unit {
  width: 116px;
}
.restock-qty::placeholder,
.restock-unit::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}
.restock-qty:focus,
.restock-unit:focus {
  border-color: var(--terra);
  outline: 2px solid var(--terra);
  outline-offset: 1px;
}
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
  padding: 4px 0;
}

.settings-row-field {
  align-items: center;
}
.settings-row-field input[type="text"],
.settings-row-field select,
.hs-add-row input[type="text"],
.hs-add-row select,
.hs-tip-fields input,
.hs-tip-fields textarea {
  height: 42px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  min-width: 0;
}
.hs-tip-fields textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  width: 100%;
}
.settings-row-field input[type="text"],
.settings-row-field select {
  flex: 0 1 180px;
  max-width: 100%;
}
.hs-row-actions,
.hs-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.hs-add-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}
.hs-add-row input,
.hs-add-row select {
  flex: 1 1 140px;
}
button.btn-secondary.hs-icon-btn {
  width: auto;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.hs-list-row {
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.hs-list-row .settings-row-label {
  flex: 1 1 auto;
  min-width: 0;
}
.restock-fields .hs-icon-btn {
  margin-left: 2px;
}
.hs-tip-row {
  align-items: flex-start;
  flex-wrap: wrap;
}
.hs-tip-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 180px;
  min-width: 0;
}
.settings-hint-inlist {
  padding: 12px 16px;
  margin: 0;
}

.settings-row.theme-switch {
  display: flex;
  padding: 12px 16px;
}
@media (min-width: 600px) {
  .settings-page {
    padding-left: 24px;
    padding-right: 24px;
    max-width: 680px;
  }
}
@media (min-width: 1024px) {
  .settings-page {
    padding-left: 28px;
    padding-right: 28px;
  }
}
@media (min-width: 1600px) {
  .settings-page {
    padding-left: 32px;
    padding-right: 32px;
  }
}
.theme-switch-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
}
.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.theme-slider {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d5c4b2;
  position: relative;
  flex-shrink: 0;
  transition: background .15s ease;
  display: block;
}
.theme-slider i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff8f1;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .15s ease;
  display: block;
}
.theme-switch input:checked + .theme-slider { background: var(--olive); }
.theme-switch input:checked + .theme-slider i { transform: translateX(18px); }
.theme-switch input:focus-visible + .theme-slider {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}

/* ---- dark theme ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1410;
  --bg-2: #2a211b;
  --paper: #261e18;
  --ink: #f6eee4;
  --ink-soft: #cbb9a8;
  --ink-faint: #9d8b7a;
  --line: #3d3229;
  --terra: #e06a4c;
  --terra-deep: #f0a080;
  --terra-soft: #3d241e;
  --olive: #8fad62;
  --olive-soft: #2a3320;
  --gold: #e0b84a;
  --poppy: #e56b5e;
  --good: #6dae6a;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --on-soft: #e8f0d8;
}
html[data-theme="light"] { color-scheme: light; }

html[data-theme="dark"] .toggle,
html[data-theme="dark"] .theme-slider { background: #5a4a3e; }
html[data-theme="dark"] .toggle i,
html[data-theme="dark"] .theme-slider i { background: #f6eee4; }
html[data-theme="dark"] .theme-switch input:checked + .theme-slider { background: var(--olive); }
html[data-theme="dark"] #phone {
  box-shadow: 0 0 0 1px rgba(255, 248, 241, 0.04), 0 20px 60px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .btn-primary {
  color: #fff8f1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .btn-delete { color: #f0a090; }
html[data-theme="dark"] .btn-danger { background: #a34436; color: #fff8f1; }
html[data-theme="dark"] .btn-danger:active { background: #8a3a2a; }
html[data-theme="dark"] .btn-secondary {
  background-color: #3a2f28;
  color: #f6eee4;
  border-color: #5a4a3e;
}
html[data-theme="dark"] .btn-secondary:active { background: #4a4038; }
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.62); }
html[data-theme="dark"] .modal {
  color-scheme: dark;
  background-color: #403b38;
  color: #f6eee4;
  border-color: #5c5753;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .modal h2 { color: #f6eee4; }
html[data-theme="dark"] .modal p { color: #cbb9a8; }
html[data-theme="dark"] .type-add-form input {
  background: #2f2b29;
  color: #f6eee4;
  border-color: #5c5753;
}
html[data-theme="dark"] .toast {
  background: #403b38;
  color: #f6eee4;
  border: 1px solid #5c5753;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .toast-undo {
  background: transparent;
  color: #f0d2b0;
}
html[data-theme="dark"] .chip.on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

@media (min-width: 1024px) {
  .title-edit input { font-size: 30px; }
  .method-actions { margin-bottom: 22px; }
}


/* ---- add recipe + photo upload ---- */
.btn-add-recipe {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--terra);
  color: #fff8f1;
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  border: 0;
}
.btn-add-recipe svg { width: 16px; height: 16px; }
.btn-add-recipe:active { background: var(--terra-deep); }
.btn-add-recipe-nav { display: none; }
/* On phones the header control is hidden (along with the home topbar) so the
   home scroll starts cleanly at This week. Keep Add recipe as a floating pill
   above the tab bar so it stays visible and tappable. */
.btn-add-recipe-home {
  display: inline-flex;
  position: absolute;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 32;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(43, 27, 18, 0.2);
}
@media (min-width: 600px) {
  .btn-add-recipe-nav { display: inline-flex; }
  .btn-add-recipe-home { display: none; }
}

.recipe-photo {
  position: relative;
}
button.recipe-photo.has-img {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
button.recipe-photo.has-img:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 3px;
  border-radius: 16px;
}
.recipe-photo .btn-add-photo {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  justify-content: center;
}
.photo-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.recipe-photo .btn-add-photo {
  position: absolute;
  width: auto;
  min-width: 0;
  padding: 0 16px;
  height: 42px;
  box-shadow: 0 2px 10px rgba(43, 27, 18, 0.25);
}
.recipe-photo .btn-photo {
  width: auto;
  flex: 1;
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
  background: rgba(255, 248, 241, 0.94);
  backdrop-filter: blur(8px);
}
.recipe-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.recipe-actions .btn-secondary:not(.btn-add-to-week) {
  width: auto;
  align-self: flex-start;
  min-height: 44px;
  padding: 0 16px;
}

@media (min-width: 1024px) {
  .to-try-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
  }
  .to-try-actions .btn-add-to-week {
    flex: 1 1 auto;
    width: auto;
  }
  .to-try-decide {
    flex: 0 1 auto;
  }
  .to-try-decide .btn-primary,
  .to-try-decide .btn-danger {
    flex: 0 1 auto;
    min-width: 108px;
    padding: 0 22px;
  }
}

.recipe-form {
  padding: 8px 16px 32px;
  max-width: 640px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
  font-weight: 650;
  font-size: 14px;
}
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
}
.form-check input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--terra);
  flex: 0 0 auto;
}
.form-check em {
  display: block;
  font-style: normal;
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 13px;
}
.form-field em { font-style: normal; font-weight: 500; color: var(--ink-soft); }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 16px;
  outline: none;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: 2px solid var(--terra);
  outline-offset: 1px;
}
.form-field textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
.form-hint, .form-photo-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.form-row-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.form-row-line input,
.form-row-line textarea {
  flex: 1;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 16px;
  outline: none;
}
.form-row-line textarea { min-height: 64px; resize: vertical; }
.form-error { color: var(--terra); font-weight: 650; margin: 0 0 12px; }
.recipe-form .btn-primary { margin-top: 8px; }

.form-import { margin: 0 0 8px; }
.form-import-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.form-import-row input { flex: 1; min-width: 0; }
.form-import-row .btn-primary {
  width: auto;
  min-width: 112px;
  height: auto;
  padding: 0 18px;
  flex-shrink: 0;
  box-shadow: none;
  white-space: nowrap;
}
.form-import-row .btn-primary:disabled { opacity: 0.65; }
.form-import-error { margin-top: -8px; }
.form-photo-preview {
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: var(--bg-2);
  margin: 0 0 10px;
}
.form-photo-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.form-photo-preview .form-photo-name { padding: 8px 12px 0; }
.form-photo-preview .btn-secondary {
  margin: 8px 12px 12px;
  height: 40px;
  font-size: 14px;
}
@media (max-width: 480px) {
  .form-import-row { flex-direction: column; }
  .form-import-row .btn-primary { width: 100%; height: 48px; }
}
html[data-theme="dark"] .form-photo-preview {
  background: #2a211b;
  border-color: #5a4638;
}


.modal-wide { max-width: 400px; }
.week-day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
}
.week-day-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
}
.week-day-pick strong { font-size: 13px; color: var(--terra-deep); }
.week-day-pick span { font-size: 14.5px; color: var(--ink); }
.week-day-pick:active { background: var(--bg-2); }

@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

html[data-theme="dark"] .btn-add-recipe { color: #fff8f1; }
html[data-theme="dark"] .recipe-photo .btn-photo {
  background: rgba(43, 32, 24, 0.9);
  color: #f6eee4;
  border-color: #5a4638;
}
html[data-theme="dark"] .form-field input,
html[data-theme="dark"] .form-field select,
html[data-theme="dark"] .form-field textarea,
html[data-theme="dark"] .form-row-line input,
html[data-theme="dark"] .form-row-line textarea {
  background: #2a211b;
  border-color: #5a4638;
  color: #f6eee4;
}
html[data-theme="dark"] .week-day-pick {
  background: #2a211b;
  border-color: #5a4638;
}
html[data-theme="dark"] .week-day-pick span { color: #f6eee4; }
html[data-theme="dark"] .modal .week-day-pick {
  background: #2f2b29;
  border-color: #5c5753;
}
html[data-theme="dark"] .modal .week-day-pick span { color: #f6eee4; }
html[data-theme="dark"] .modal .week-day-pick strong { color: #f0a080; }
html[data-theme="dark"] .modal .form-field input,
html[data-theme="dark"] .modal .form-field select,
html[data-theme="dark"] .modal .form-field textarea {
  background: #2f2b29;
  border-color: #5c5753;
  color: #f6eee4;
}

/* ---- week planner ---- */
button.day-card {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.day-card.empty .thumb .ph,
.plan-choose .thumb .ph-plain {
  background: var(--bg-2);
  border: 1.5px dashed var(--line);
  border-radius: inherit;
  box-sizing: border-box;
  padding: 0;
}
.ph.ph-plain {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1.5px dashed var(--line);
  border-radius: inherit;
  box-sizing: border-box;
  padding: 0;
  color: var(--ink-faint);
}
.day-art-empty-svg {
  width: 24px;
  height: 24px;
  display: block;
  opacity: 0.55;
}
.day-art {
  --day-art-ink: var(--ink-soft);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--terra);
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  background: var(--bg-2);
}
.plan-choose .thumb .day-art {
  padding: 4px;
}
.day-art-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.day-art-eating-out {
  background: var(--terra-soft);
  --day-art-ink: var(--terra-deep);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--terra);
}
.day-art-takeaway {
  background: var(--bg-2);
  background: color-mix(in srgb, var(--gold) 20%, var(--paper));
  --day-art-ink: var(--ink-soft);
  --day-art-ink: color-mix(in srgb, var(--ink) 76%, var(--gold));
  --day-art-fill: var(--paper);
  --day-art-accent: var(--gold);
}
.day-art-leftovers {
  background: var(--olive-soft);
  --day-art-ink: var(--olive);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--olive);
}
.day-art-no-cooking {
  background: var(--bg-2);
  --day-art-ink: var(--ink-soft);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--gold);
}
.day-art-freezer {
  background: var(--olive-soft);
  background: color-mix(in srgb, var(--good) 14%, var(--paper));
  --day-art-ink: var(--ink-soft);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--good);
}
.day-art-custom {
  background: var(--terra-soft);
  background: color-mix(in srgb, var(--terra-soft) 48%, var(--paper));
  --day-art-ink: var(--ink-soft);
  --day-art-fill: var(--paper);
  --day-art-accent: var(--terra);
}
.day-card.off .name { font-style: italic; font-weight: 500; color: var(--ink-soft); }

.week-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-edit-plan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(43, 27, 18, 0.06);
  white-space: nowrap;
}
.btn-edit-plan svg { width: 14px; height: 14px; }
.btn-edit-plan:active { background: var(--bg-2); }

.sent-banner.sent-changed {
  background: #f3e3c8;
  color: #6a3d12;
}

.week-tabs-modal {
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.week-tabs-modal button { flex: 1 1 auto; }

.plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 12px;
}
.plan-toolbar .btn-secondary { width: auto; padding: 8px 14px; flex-shrink: 0; }
.plan-reroll {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.plan-reroll svg { width: 13px; height: 13px; }
.plan-toolbar-note {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.plan-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px 28px;
}
.plan-slot {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 12px 12px;
  box-shadow: 0 1px 3px rgba(43, 27, 18, 0.04);
}
.plan-slot .drag-handle {
  display: none;
  color: var(--ink-faint);
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.plan-slot-main { min-width: 0; }
.plan-slot-day {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--terra-deep);
  margin: 0 0 6px;
  white-space: nowrap;
}
.plan-slot.today { outline: 2px solid var(--terra); outline-offset: 1px; }
.plan-slot.empty { background: var(--bg); }
.plan-slot.off { background: var(--bg); }
.plan-choose,
.plan-recipe-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.plan-recipe-link .thumb,
.plan-choose .thumb {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  box-sizing: border-box;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-2);
}
.plan-recipe-link .thumb img,
.plan-choose .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.plan-slot-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-slot .name { font-size: 16px; font-weight: 650; line-height: 1.25; }
.plan-slot .sub {
  font-size: 13px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.plan-slot.empty .name,
.plan-choose .name { color: var(--terra-deep); }
.plan-slot.off .name { font-style: italic; font-weight: 600; }
.plan-recipes {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.plan-recipe {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.plan-recipe:first-child {
  border-top: 0;
  padding-top: 0;
}
.plan-recipe .plan-slot-actions { margin-top: 8px; }
.plan-slot-day-actions { margin-top: 10px; }
.plan-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.plan-slot-actions button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.plan-slot-actions button:active { background: var(--paper); }
.plan-slot.is-dragging { opacity: 0.45; }
.plan-slot.drag-over { border-color: var(--terra); background: #f6eee4; }

.off-day-label { font-weight: 650; color: var(--ink) !important; margin-top: -8px !important; }
.off-chips { margin: 0 0 12px; padding: 0; }

.modal-picker {
  max-width: 560px;
  max-height: min(88dvh, 820px);
  display: flex;
  flex-direction: column;
  padding: 16px 16px 12px;
}
.picker-head { position: relative; padding-right: 36px; margin: 0 0 10px; }
.picker-head h2 { margin-bottom: 2px; }
.picker-head p { margin: 0; }
.picker-close {
  position: absolute;
  top: -4px;
  right: -4px;
}
.picker-head,
.picker-search,
.picker-tabs,
.picker-cuisines { flex-shrink: 0; }
.picker-search { margin: 0 0 8px; }
.picker-tabs,
.picker-cuisines {
  padding: 0 0 8px;
  margin: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.picker-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 120px;
  margin: 0 -4px;
  padding: 4px;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.picker-row:active,
.picker-row:hover { background: var(--bg-2); }
.picker-row .thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-2);
}
.picker-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.picker-row-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.picker-row .name { font-size: 15px; font-weight: 650; }
.picker-row .sub { font-size: 12.5px; color: var(--ink-soft); }
.picker-empty { color: var(--ink-soft); font-size: 14px; padding: 16px 8px; }

@media (max-width: 640px) {
  .modal-backdrop.picker-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-picker {
    max-width: none;
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
  }
}

@media (min-width: 600px) {
  .plan-toolbar,
  .plan-slots { padding-left: 24px; padding-right: 24px; }
  .plan-slots { max-width: 760px; }
  .plan-slot {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 0 8px;
    padding: 12px 14px 14px 8px;
  }
  .plan-slot .drag-handle { display: flex; }
  .plan-recipe-link .thumb,
  .plan-choose .thumb { width: 72px; height: 72px; min-width: 72px; min-height: 72px; }
}

@media (min-width: 1024px) {
  .plan-toolbar,
  .plan-slots { padding-left: 28px; padding-right: 28px; }
  .toast { left: 28px; right: 28px; }
}

@media (min-width: 1600px) {
  .plan-toolbar,
  .plan-slots { padding-left: 32px; padding-right: 32px; }
  .toast { left: 32px; right: 32px; }
}

html[data-theme="dark"] .btn-edit-plan,
html[data-theme="dark"] .btn-shop-add {
  background: #2a211b;
  border-color: #5a4638;
  color: #f6eee4;
}
html[data-theme="dark"] .btn-shop-add { color: #f0a080; }
html[data-theme="dark"] .modal .shop-edit-notice {
  background: #2a3320;
  color: #e8f0d8 !important;
}
html[data-theme="dark"] .day-card.empty .thumb .ph,
html[data-theme="dark"] .ph.ph-plain,
html[data-theme="dark"] .plan-choose .thumb .ph-plain {
  background: #241c17;
  border-color: #5a4638;
}
html[data-theme="dark"] .day-art-takeaway {
  background: color-mix(in srgb, var(--gold) 18%, var(--bg-2));
  --day-art-ink: color-mix(in srgb, var(--ink) 80%, var(--gold));
}
html[data-theme="dark"] .day-art-freezer {
  background: color-mix(in srgb, var(--good) 16%, var(--bg-2));
}
html[data-theme="dark"] .day-art-custom {
  background: color-mix(in srgb, var(--terra-soft) 55%, var(--bg-2));
}
html[data-theme="dark"] .sent-banner.sent-changed {
  background: #3a2a16;
  color: #f0d5a8;
}
html[data-theme="dark"] .plan-slot {
  background: #2a211b;
  border-color: #5a4638;
}
html[data-theme="dark"] .plan-slot.empty,
html[data-theme="dark"] .plan-slot.off { background: #221b16; }
html[data-theme="dark"] .plan-slot-actions button {
  background: #241c17;
  border-color: #5a4638;
  color: #f6eee4;
}
html[data-theme="dark"] .plan-slot.drag-over {
  background: #3a2a16;
  border-color: #c9893a;
}
html[data-theme="dark"] .picker-row {
  background: #2a211b;
  border-color: #5a4638;
}
html[data-theme="dark"] .picker-row:hover,
html[data-theme="dark"] .picker-row:active { background: #241c17; }
html[data-theme="dark"] .modal-picker { background-color: #403b38; }
html[data-theme="dark"] .modal .picker-row {
  background: #2f2b29;
  border-color: #5c5753;
  color: #f6eee4;
}
html[data-theme="dark"] .modal .picker-row:hover,
html[data-theme="dark"] .modal .picker-row:active { background: #4a4541; }
html[data-theme="dark"] .modal .picker-row .sub,
html[data-theme="dark"] .modal .picker-empty { color: #cbb9a8; }
html[data-theme="dark"] .cup-link-btn {
  background: #2a211b;
  border-color: #5a4638;
  color: #cbb9a8;
}
html[data-theme="dark"] .cup-link-btn.linked {
  background: #2a3320;
  border-color: transparent;
  color: #e8f0d8;
}
html[data-theme="dark"] .modal .cooked-link-label,
html[data-theme="dark"] .modal .cooked-link-ing-group,
html[data-theme="dark"] .modal .cooked-link-extra-del { color: #cbb9a8; }
html[data-theme="dark"] .modal .cooked-link-heading { color: #f6eee4; }
html[data-theme="dark"] .modal .cooked-link-recipe-btn,
html[data-theme="dark"] .modal .cooked-link-ings,
html[data-theme="dark"] .modal .cooked-link-extra-row,
html[data-theme="dark"] .modal .cooked-link-extra-form input {
  background: #2f2b29;
  border-color: #5c5753;
  color: #f6eee4;
}
html[data-theme="dark"] .modal .cooked-link-ing {
  color: #f6eee4;
}
html[data-theme="dark"] .modal .cooked-link-ing + .cooked-link-ing {
  border-top-color: rgba(246, 238, 228, 0.1);
}
html[data-theme="dark"] .modal .cooked-link-recipe-action { color: #f0a080; }


/* ---- Kitchen view (tablet cooking mode) ---- */
html.kitchen-mode,
html.kitchen-mode body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
html.kitchen-mode #phone,
html.kitchen-mode #phone.kitchen-on {
  max-width: none !important;
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  box-shadow: none;
  overflow: hidden;
}
html.kitchen-mode #app {
  padding-top: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.kitchen {
  --kitchen-fs: 22px;
  --kitchen-ing-cols: 1;
  --kitchen-method-cols: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  user-select: none;
  -webkit-user-select: none;
}
.kitchen-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.kitchen-heading {
  flex: 1;
  min-width: 0;
}
.kitchen-top h1 {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.1vw, 22px);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kitchen-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}
.kitchen-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  color: var(--ink);
  border-radius: 12px;
}
.kitchen-close:active,
.kitchen-close:focus-visible {
  background: var(--bg-2);
}
.kitchen-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.32fr) minmax(0, 0.68fr);
  gap: 0;
  overflow: hidden;
}
.kitchen.portrait .kitchen-body {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
.kitchen.wide-ings:not(.portrait) .kitchen-body {
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
}
.kitchen.compact .kitchen-top {
  min-height: 44px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.kitchen.compact .kitchen-ings,
.kitchen.compact .kitchen-method { padding-top: 6px; padding-bottom: 6px; }
.kitchen.compact .kitchen-ing { padding: 0.08em 0.2em; line-height: 1.18; }
.kitchen.compact .kitchen-step { padding: 0.12em 0.22em 0.12em 0.15em; line-height: 1.22; }
.kitchen.compact .kitchen-steps > li { margin-bottom: 0.28em; }
.kitchen.compact .kitchen-ing-group { margin-bottom: 0.3em; }

.kitchen-ings,
.kitchen-method {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 10px 14px 12px;
}
.kitchen-ings {
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.kitchen.portrait .kitchen-ings {
  border-right: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.kitchen-ings h2,
.kitchen-method h2 {
  font-size: calc(var(--kitchen-fs) * 0.72);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terra-deep);
  margin: 0 0 0.45em;
  line-height: 1.2;
}
.kitchen-ings-flow {
  columns: var(--kitchen-ing-cols);
  column-gap: 1.1em;
}
.kitchen-ing-group {
  margin-bottom: 0.55em;
}
.kitchen-ing-group h3 {
  break-after: avoid;
  -webkit-column-break-after: avoid;
}
.kitchen-ing-group h3 {
  font-size: calc(var(--kitchen-fs) * 0.78);
  font-weight: 750;
  color: var(--ink-soft);
  margin: 0 0 0.2em;
  line-height: 1.25;
}
.kitchen-ing {
  display: block;
  width: 100%;
  text-align: left;
  font-size: var(--kitchen-fs);
  line-height: 1.28;
  font-weight: 600;
  color: var(--ink);
  padding: 0.22em 0.3em;
  margin: 0 -0.3em;
  border-radius: 8px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  touch-action: manipulation;
}
.kitchen-ing:active { background: var(--terra-soft); }
.kitchen-ing.ticked {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.kitchen-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: var(--kitchen-method-cols);
  column-gap: 1.2em;
}
.kitchen-steps > li {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin: 0 0 0.45em;
}
.kitchen-step {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  width: 100%;
  text-align: left;
  font-size: var(--kitchen-fs);
  line-height: 1.32;
  font-weight: 500;
  color: var(--ink);
  padding: 0.28em 0.4em 0.28em 0.25em;
  border-radius: 10px;
  touch-action: manipulation;
}
.kitchen-step-num {
  flex: 0 0 auto;
  min-width: 1.45em;
  height: 1.45em;
  padding: 0 0.2em;
  border-radius: 999px;
  background: var(--terra);
  color: #fff8f1;
  font-weight: 800;
  font-size: 0.82em;
  line-height: 1.45em;
  text-align: center;
  margin-top: 0.05em;
}
.kitchen-step.current {
  background: var(--terra-soft);
  box-shadow: inset 3px 0 0 var(--terra);
}
.kitchen-step.current .kitchen-step-num {
  background: var(--terra-deep);
}
.kitchen-empty {
  font-size: var(--kitchen-fs);
  color: var(--ink-soft);
}
.kitchen-tips {
  margin-top: 0.6em;
  break-inside: avoid;
}
.kitchen-tips h3 {
  font-size: calc(var(--kitchen-fs) * 0.72);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.3em;
}
.kitchen-tips p {
  font-size: calc(var(--kitchen-fs) * 0.92);
  line-height: 1.3;
  color: var(--ink-soft);
  margin: 0 0 0.35em;
}
.kitchen.method-scroll .kitchen-method {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html[data-theme="dark"] .kitchen,
html[data-theme="dark"] .kitchen-top {
  background: #241811;
  color: #f6eee4;
}
html[data-theme="dark"] .kitchen-ings {
  background: #1c1511;
  border-color: #5c5753;
}
html[data-theme="dark"].kitchen-mode,
html[data-theme="dark"].kitchen-mode body,
html[data-theme="dark"].kitchen-mode #phone {
  background: #241811;
}
html[data-theme="dark"] .kitchen-top {
  border-color: #5c5753;
}
html[data-theme="dark"] .kitchen-top h1,
html[data-theme="dark"] .kitchen-close,
html[data-theme="dark"] .kitchen-ing,
html[data-theme="dark"] .kitchen-step {
  color: #f6eee4;
}
html[data-theme="dark"] .kitchen-meta,
html[data-theme="dark"] .kitchen-ing-group h3,
html[data-theme="dark"] .kitchen-tips h3,
html[data-theme="dark"] .kitchen-tips p,
html[data-theme="dark"] .kitchen-empty {
  color: #cbb9a8;
}
html[data-theme="dark"] .kitchen-ings h2,
html[data-theme="dark"] .kitchen-method h2 {
  color: #f0b089;
}
html[data-theme="dark"] .kitchen.portrait .kitchen-ings {
  border-color: #5c5753;
}
html[data-theme="dark"] .kitchen-ing:active { background: #403b38; }
html[data-theme="dark"] .kitchen-ing.ticked { color: #8f8278; }
html[data-theme="dark"] .kitchen-close:active,
html[data-theme="dark"] .kitchen-close:focus-visible { background: #403b38; }
html[data-theme="dark"] .kitchen-step.current {
  background: #403b38;
  box-shadow: inset 3px 0 0 #e08a5c;
}
html[data-theme="dark"] .kitchen-step-num { background: #c45a38; color: #fff8f1; }
html[data-theme="dark"] .kitchen-step.current .kitchen-step-num { background: #e08a5c; color: #241811; }

/* ---- offline banner ---- */
.offline-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: #f6e4c6;
  color: #4a2a12;
  border-bottom: 1px solid #dec399;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  z-index: 35;
}
.offline-banner-text {
  flex: 1 1 auto;
  min-width: 0;
}
.offline-banner-retry {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  background: #8c2f16;
  color: #fff8f1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.offline-banner-retry:active { opacity: 0.85; }
.offline-banner-retry:disabled { opacity: 0.6; cursor: default; }

html[data-theme="dark"] .offline-banner,
#phone.dark .offline-banner {
  background: #3b2a1c;
  color: #f6e4c8;
  border-bottom-color: #5c432d;
}
html[data-theme="dark"] .offline-banner-retry,
#phone.dark .offline-banner-retry {
  background: #c45a38;
  color: #fff8f1;
}

#phone.immersive .offline-banner {
  padding-top: calc(9px + env(safe-area-inset-top, 0px) + var(--android-extra-top, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px) + var(--android-extra-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px) + var(--android-extra-right, 0px));
}
#phone.immersive #app:has(.offline-banner) .cook-top {
  padding-top: 10px;
}
#app:has(.offline-banner) .kitchen {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  padding-top: 0;
}

/* ---- store cupboard group cards (#/cupboard only) ---- */
.cupboard-aisles {
  padding: 6px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cupboard-aisles > .cup-aisle {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  margin: 0;
  box-shadow: 0 2px 10px rgba(43, 27, 18, 0.045);
}
.cup-aisle.cup-tint-0 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 80%, var(--olive-soft) 20%);
  border-color: color-mix(in srgb, var(--line) 74%, var(--olive) 26%);
}
.cup-aisle.cup-tint-1 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 82%, var(--terra-soft) 18%);
  border-color: color-mix(in srgb, var(--line) 74%, var(--terra) 26%);
}
.cup-aisle.cup-tint-2 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, var(--gold) 12%);
  border-color: color-mix(in srgb, var(--line) 74%, var(--gold) 26%);
}
.cup-aisle.cup-tint-3 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 62%, var(--bg-2) 38%);
  border-color: color-mix(in srgb, var(--line) 82%, var(--ink-soft) 18%);
}
.cup-aisle.cup-tint-4 {
  background: var(--paper);
  border-color: var(--line);
}
html[data-theme="dark"] .cupboard-aisles > .cup-aisle {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
html[data-theme="dark"] .cup-aisle.cup-tint-0 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 58%, var(--olive-soft) 42%);
  border-color: color-mix(in srgb, var(--line) 68%, var(--olive) 32%);
}
html[data-theme="dark"] .cup-aisle.cup-tint-1 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 64%, var(--terra-soft) 36%);
  border-color: color-mix(in srgb, var(--line) 68%, var(--terra) 32%);
}
html[data-theme="dark"] .cup-aisle.cup-tint-2 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, var(--gold) 10%);
  border-color: color-mix(in srgb, var(--line) 72%, var(--gold) 28%);
}
html[data-theme="dark"] .cup-aisle.cup-tint-3 {
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 45%, var(--bg-2) 55%);
  border-color: color-mix(in srgb, var(--line) 75%, var(--ink-soft) 25%);
}
html[data-theme="dark"] .cup-aisle.cup-tint-4 {
  background: var(--paper);
  border-color: var(--line);
}
.cup-aisle-head {
  padding: 0 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.cup-aisle-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cup-aisle-head h2 {
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  padding: 0;
  margin: 0;
  line-height: 1.2;
}
.cup-aisle-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.25;
}
.cup-aisle-items > .cup-row:last-child .cup-item,
.cup-aisle-items > .cup-row-cooked:last-child {
  border-bottom: 0;
}
.cup-aisle-items > .cup-row-cooked:last-child {
  padding-bottom: 2px;
}
.cup-cooked-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 44px 0 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.3;
}

/* ---- batch cooking settings & reminders ---- */
.batch-meal-row {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 12px;
}
.batch-meal-main {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.batch-meal-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.batch-meal-name {
  overflow-wrap: break-word;
}
.batch-stock-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.batch-stock-pill.on {
  background: var(--olive-soft);
  color: var(--on-soft);
}
.batch-stock-pill.out {
  background: var(--bg-2);
  color: var(--ink-faint);
}
.batch-meal-link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.batch-meal-linked-text {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-weight: 500;
}
.batch-meal-portions-note,
.batch-meal-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.35;
}
.batch-portions-field {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.batch-portions-field span {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.batch-flag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.3;
}
.batch-flag-overdue {
  background: var(--terra-soft);
  color: var(--terra-deep);
}
.batch-flag-soon {
  background: color-mix(in srgb, var(--paper) 72%, var(--gold) 28%);
  color: var(--ink);
}
html[data-theme="dark"] .batch-flag-soon {
  background: color-mix(in srgb, var(--paper) 70%, var(--gold) 30%);
  color: #f6eee4;
}

.batch-soon-panel {
  margin: 14px 16px 2px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 84%, var(--olive-soft) 16%);
  border: 1px solid var(--line);
}
.batch-soon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.batch-soon-head h2 {
  font-size: 17px;
  margin: 0;
}
.batch-soon-manage {
  font-size: 13px;
  font-weight: 650;
  color: var(--olive);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.batch-soon-list {
  display: flex;
  flex-direction: column;
}
.batch-soon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
  color: inherit;
}
.batch-soon-row:first-child {
  border-top: 0;
  padding-top: 2px;
}
.batch-soon-row:last-child {
  padding-bottom: 2px;
}
.batch-soon-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.batch-soon-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
}
.batch-soon-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.batch-soon-chev {
  flex: 0 0 auto;
  color: var(--ink-faint);
  display: grid;
  place-items: center;
}

.batch-soon-plan {
  margin: 0 16px 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 84%, var(--olive-soft) 16%);
  border: 1px solid var(--line);
}
.batch-soon-plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.batch-soon-plan-top .kicker {
  color: var(--olive);
}
.batch-soon-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.batch-soon-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.batch-soon-pill:active,
.batch-soon-pill:hover {
  background: var(--bg-2);
}

@media (min-width: 600px) {
  .cupboard-aisles {
    display: block;
    padding: 6px 24px 16px;
    column-gap: 18px;
  }
  .cupboard-aisles > .cup-aisle {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 16px;
    padding: 14px 16px 8px;
  }
  .batch-soon-panel {
    margin: 14px 24px 4px;
  }
  .batch-soon-plan {
    margin: 0 24px 12px;
    max-width: 712px;
  }
}

@media (min-width: 1024px) {
  .cupboard-aisles {
    padding: 6px 28px 20px;
    column-gap: 20px;
  }
  .cupboard-aisles > .cup-aisle {
    padding: 14px 16px 8px;
    margin-bottom: 18px;
  }
  .batch-soon-panel {
    margin: 16px 28px 4px;
  }
  .batch-soon-plan {
    margin: 0 28px 12px;
  }
}

@media (min-width: 1600px) {
  .cupboard-aisles {
    padding: 6px 32px 24px;
    column-gap: 22px;
  }
  .cupboard-aisles > .cup-aisle {
    padding: 14px 16px 8px;
    margin-bottom: 20px;
  }
  .batch-soon-panel {
    margin: 16px 32px 4px;
  }
  .batch-soon-plan {
    margin: 0 32px 12px;
  }
}

@media (min-width: 600px) {
  #app:has(.tabbar):has(.offline-banner) {
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  #app:has(.tabbar) .offline-banner {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 10px 20px;
  }
  #app:has(.tabbar):has(.offline-banner) .topbar {
    grid-row: 2;
  }
  #app:has(.tabbar):has(.offline-banner) .tabbar {
    grid-row: 2;
  }
  #app:has(.tabbar):has(.offline-banner) .scroll {
    grid-row: 3;
  }
}

/* Design-preview badge (design branch only). Subtle, does not block taps. */
#design-preview-badge {
  position: fixed;
  z-index: 4000;
  right: 12px;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(43, 27, 18, 0.08);
}
@media (min-width: 600px) {
  #design-preview-badge { bottom: 16px; }
}
html[data-theme="dark"] #design-preview-badge {
  color: #c9b8a6;
  background: color-mix(in srgb, #261e18 88%, transparent);
  border-color: #3d3229;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
