/* Kitchen: the pass of a restaurant kitchen. Steel counter, white paper tickets with a torn edge,
 * one condensed grotesque (Archivo, its width axis does display and text), ticket red for what
 * is on tonight. The week is seven tickets on the rail; a recipe is the ticket you cook from;
 * shopping is one long receipt. Phone first; from 900px the week and the receipt sit side by side. */

:root {
  --ground: #F1F2F0;      /* the steel counter, wiped down: light and a touch warm */
  --paper: #FFFFFF;       /* tickets */
  --card: #FFFFFF;
  --ink: #2A2E33;         /* soft graphite, not black */
  --muted: #565C62;
  --muted2: #62686E;      /* small text: 5:1 on the counter */
  --faint: #868D95;       /* lines and boxes: 3:1 on paper */
  --rule: #DADDE0;
  --row: #EBEDEE;
  --dash: #CDD1D4;
  --seg: #E3E6E8;
  --steel: #4A5157;
  --steel-ink: #62686E;
  --tomato: #D23A2F;      /* ticket red, a little warmer */
  --tomato-bg: #FCEAE6;
  --tomato-ink: #9A3A2E;
  --tomato-line: #F0C2BB;
  --today: #D23A2F;
  --basil: #2F6B3A;
  --basil-bg: #E2EEE3;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --narrow: 75%;          /* the condensed cut, for heads and numbers */
  --semi: 87.5%;
  --zz: 10px;             /* the torn edge's tooth */
  --torn: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--zz) 100%;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--tomato-bg); color: var(--tomato-ink); }
input, textarea { caret-color: var(--tomato); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--basil); }
a:hover { color: #1F4A27; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Paper tears at the bottom: tickets, the recipe, the receipt, the dough sheet. The mask also
 * clips a shadow, so the tickets' shadow is a drop-shadow on the rail's grid that holds them. */
.day, .rcard, .shop-list, .dough-rows { -webkit-mask: var(--torn); mask: var(--torn); }

/* ---------- No code ---------- */
.nocode { max-width: 420px; margin: 0 auto; padding: calc(80px + var(--safe-t)) 24px; font-size: 17px; line-height: 1.5; color: var(--muted); }
.nocode-title { margin: 0 0 8px; font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 44px; color: var(--ink); }

/* ---------- Frame ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.top { display: none; }
.main { padding: calc(22px + var(--safe-t)) 18px calc(110px + var(--safe-b)); }
.view { display: none; flex-direction: column; gap: 16px; }
.view.on { display: flex; }
.plan { display: contents; }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.label { font-size: 12px; font-weight: 700; font-stretch: var(--semi); letter-spacing: .1em; text-transform: uppercase; color: var(--steel-ink); }
.titles .label { font-size: 13px; letter-spacing: .06em; color: var(--muted2); }
.h1 { margin: 0; font-weight: 800; font-stretch: var(--narrow); font-size: 46px; line-height: .92; letter-spacing: -.005em; text-transform: uppercase; }
.arrows { display: flex; gap: 6px; flex-shrink: 0; }
.round {
  width: 44px; height: 44px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); color: var(--ink);
  font-size: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.card { display: flex; flex-direction: column; background: var(--paper); border-radius: 4px; overflow: hidden; }
.only-wide { display: none; }
.quiet { align-self: flex-start; min-height: 44px; border: 0; background: none; padding: 0; color: var(--muted); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.pillv { align-self: flex-start; font-size: 11px; font-weight: 700; font-stretch: var(--semi); letter-spacing: .06em; text-transform: uppercase; color: var(--basil); border: 1.5px solid currentColor; border-radius: 3px; padding: 0 5px; white-space: nowrap; }

/* ---------- Bottom tabs (phone) ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 8px calc(8px + max(14px, var(--safe-b)));
  background: #F4F5F6; border-top: 1px solid var(--rule);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 4px; border: 0; background: none;
  font-size: 12px; font-weight: 600; color: var(--muted2);
}
.tab svg, .ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; flex-shrink: 0; }
.tab.on { color: var(--ink); font-weight: 800; }
.tab.on::before { content: ''; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--tomato); }

/* ---------- Week: tickets on the rail ---------- */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 4px; background: var(--tomato-bg); color: var(--tomato-ink); font-size: 15px; line-height: 1.35; }
.banner .ico { color: var(--tomato); }
.banner b { font-weight: 800; font-stretch: var(--semi); text-transform: uppercase; letter-spacing: .03em; color: var(--tomato); }
.seg.who { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.seg .dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 999px; background: var(--tomato); vertical-align: middle; }
.seg.meals { margin: 0; }

.pass { display: flex; flex-direction: column; }
/* The ticket rail: a steel bar the first row of tickets tucks under. */
.rail { position: relative; z-index: 2; height: 10px; margin: 0 -8px; border-radius: 3px; background: #A9AFB5; border-bottom: 2px solid #7D848B; }
.tickets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; margin-top: -5px; filter: drop-shadow(0 1px 1px rgba(42, 46, 51, .12)) drop-shadow(0 3px 8px rgba(42, 46, 51, .06)); }
.day {
  position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 128px;
  padding: 16px 12px calc(12px + var(--zz) / 2); border: 0; background: var(--paper); text-align: left;
}
.day-when {
  display: flex; align-items: baseline; gap: 5px; padding-bottom: 7px; border-bottom: 1.5px dashed var(--dash);
  font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; letter-spacing: .03em; line-height: 1;
}
.day-when b { font-size: 18px; font-weight: 800; }
.day-when span { font-size: 18px; color: var(--muted2); }
.day.today .day-when b { color: var(--today); }
.day-when .tk-flag { margin-left: auto; align-self: center; padding: 3px 5px 2px; border-radius: 3px; background: var(--tomato); color: #fff; font-size: 11px; letter-spacing: .08em; }
.day-what { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex-grow: 1; }
/* One line per meal: the meal's name over what it is, servings on the right. */
.meal { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
.meal-name { grid-column: 1 / -1; font-size: 11px; font-weight: 700; font-stretch: var(--semi); letter-spacing: .08em; text-transform: uppercase; color: var(--muted2); }
.meal-what { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.day-title { font-size: 19px; font-weight: 700; font-stretch: var(--semi); line-height: 1.12; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
/* A narrow phone: the name gets the whole ticket, servings go under it. */
@media (max-width: 359px) { .day-title { font-size: 17px; } .h1 { font-size: 40px; } .meal { grid-template-columns: minmax(0, 1fr); } .day-side { justify-self: start; } }
.meal:not(.meal-dinner) .day-title { font-size: 15px; font-weight: 600; color: var(--muted); }
.day-title.empty { color: var(--muted2); font-weight: 600; }
.day-title.pizza { color: var(--tomato); font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 22px; letter-spacing: .01em; }
.day-title.gone { color: var(--muted2); font-style: italic; font-weight: 500; }
.day-side { font-size: 14px; font-weight: 700; font-stretch: var(--narrow); color: var(--muted2); white-space: nowrap; }
.away { align-self: flex-start; font-size: 11px; font-weight: 800; font-stretch: var(--semi); letter-spacing: .06em; text-transform: uppercase; color: var(--tomato); border: 1.5px solid currentColor; border-radius: 3px; padding: 0 5px; white-space: nowrap; }
/* An empty day is an empty clip on the rail: no paper yet. */
.day.empty { background: transparent; border: 2px dashed #BCC1C6; -webkit-mask: none; mask: none; }
.day.empty .day-when { border-bottom-color: transparent; }
.day.empty .day-title::before { content: '+ '; }
/* The eighth slot: the week's total, a dark check that opens Shopping. */
.tk-total {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 128px; padding: 14px 12px;
  border: 0; border-radius: 4px; background: var(--tomato-bg); color: var(--tomato-ink); text-align: left;
}
.tk-total b { font-size: 38px; font-weight: 800; font-stretch: var(--narrow); line-height: .9; color: var(--tomato); }
.tk-total small { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tomato-ink); }
.tk-go { font-size: 15px; font-weight: 600; }
.tk-go { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Shopping: one long receipt ---------- */
.shop-head { flex-wrap: wrap; row-gap: 14px; }
.shop-side { display: flex; align-items: center; gap: 10px; }
/* The receipt says how many to buy; the phone header keeps only the week arrows. */
.shop-side .left { display: none; }
.left { font-size: 15px; font-weight: 700; font-stretch: var(--semi); color: var(--muted); white-space: nowrap; }
.add {
  flex-basis: 100%; display: flex; gap: 8px; align-items: center; padding: 4px 4px 4px 14px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; margin-top: -2px;
}
.add input { flex-grow: 1; min-width: 0; min-height: 40px; border: 0; background: none; font-size: 16px; padding: 8px 0; outline: none; }
.add input::placeholder { color: var(--muted2); }
.add-btn { width: 44px; height: 44px; border: 0; border-radius: 9px; background: var(--tomato); color: #fff; font-size: 24px; line-height: 1; padding: 0; flex-shrink: 0; }
.shop-list { display: flex; flex-direction: column; gap: 14px; padding: 18px 16px calc(22px + var(--zz) / 2); background: var(--paper); }
.shop-list:has(> .empty-note:only-child) { background: transparent; padding: 0; -webkit-mask: none; mask: none; }
.aisle { display: flex; flex-direction: column; }
.aisle > .label { padding: 6px 0 4px; }
.srow { display: flex; align-items: center; border-bottom: 1.5px dashed var(--row); }
.stick {
  flex-grow: 1; min-width: 0; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  min-height: 50px; padding: 0; border: 0; background: none; text-align: left; font-size: 16px;
}
.box {
  width: 22px; height: 22px; border-radius: 4px; border: 2px solid #7A8087; background: transparent;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 800;
}
.stick[aria-checked="true"] .box { border-color: var(--basil); background: var(--basil); }
.stick[aria-checked="true"] .sname { color: var(--faint); text-decoration: line-through; }
.sname { overflow-wrap: anywhere; font-weight: 500; }
.sqty { font-size: 15px; font-weight: 700; font-stretch: var(--semi); color: var(--muted); text-align: right; }
.sdel { width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: var(--muted2); font-size: 22px; padding: 0; flex-shrink: 0; }
.always { min-height: 44px; padding: 0 0 0 12px; border: 0; background: none; flex-shrink: 0; white-space: nowrap; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.empty-note { margin: 0; padding: 18px 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.sname small.sfor { display: block; margin-top: 1px; font-size: 13px; font-weight: 400; color: var(--muted2); }
.stick[aria-checked="true"] .sfor { text-decoration: none; color: var(--faint); }
/* The receipt's head: what the order is for. */
.shop-sum { margin: 0 0 2px; padding: 0 0 14px; border-bottom: 2px dashed var(--dash); font-size: 15px; line-height: 1.45; color: var(--muted); }
.shop-sum b { font-weight: 700; color: var(--ink); }
.sum-n { display: block; font-size: 22px; font-weight: 800; font-stretch: var(--narrow); letter-spacing: .01em; text-transform: uppercase; color: var(--ink); margin-bottom: 2px; }
.sec { display: flex; flex-direction: column; gap: 14px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 -6px; font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 26px; line-height: 1; color: var(--ink); }
.sec-n { font-size: 16px; font-weight: 800; color: var(--tomato); }
.sec-check { padding-top: 8px; border-top: 2px dashed var(--dash); }
.sec-check > summary { list-style: none; cursor: pointer; min-height: 44px; align-items: center; margin: 0; }
.sec-check > summary::-webkit-details-marker { display: none; }
.sec-check > summary::after, .method summary::after { content: ''; width: 22px; height: 22px; margin-left: auto; background: var(--muted2); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 5.5L16 12l-6.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 5.5L16 12l-6.5 6.5'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform 220ms cubic-bezier(.2, .8, .2, 1); }
.sec-check[open] > summary::after, .method[open] summary::after { transform: rotate(90deg); }
.sec-check[open] { gap: 14px; }
.sec-note { margin: -6px 0 6px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.staples { display: flex; flex-direction: column; }
.staples > .label { padding: 6px 0 4px; }
.staple { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-bottom: 1.5px dashed var(--row); font-size: 16px; color: var(--muted); }
.staple .quiet { font-size: 14px; }

/* ---------- Buttons ---------- */
.btn { min-height: 50px; padding: 0 22px; border-radius: 12px; font-size: 16px; font-weight: 700; border: 0; }
.btn-red { background: var(--tomato); color: #fff; }
.btn-ink { background: var(--steel); color: #fff; }
.btn-line { background: var(--paper); border: 1px solid var(--rule); color: var(--ink); font-weight: 600; }
.btn-soft { background: var(--paper); border: 1.5px solid var(--tomato); color: var(--tomato-ink); }
.btn-small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn-mid { min-height: 44px; padding: 0 14px; font-size: 15px; }
.grow { flex-grow: 1; }
.actions { display: flex; gap: 10px; }
.link-red { align-self: flex-start; min-height: 44px; margin-top: 4px; border: 0; background: none; padding: 0; color: var(--tomato-ink); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--tomato-line); }

/* ---------- Recipes ---------- */
#recipesHome { display: flex; flex-direction: column; gap: 16px; }
.round-ink { background: var(--tomato); color: #fff; border-color: var(--tomato); }
.round-ink .ico, .search .ico { stroke-width: 2; }
/* The day sheet's recipe picker keeps .find; this is the Recipes tab's own search. */
.find { flex-grow: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); font-size: 16px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; color: var(--muted2);
}
.search:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.search-input { flex-grow: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font-size: 16px; color: var(--ink); outline: none; }
.search-input::placeholder { color: var(--muted); }
/* The list is an index: a big condensed letter over its own strip of tickets, with a thumb
 * index down the right edge. */
.book { display: grid; grid-template-columns: minmax(0, 1fr) 34px; column-gap: 6px; margin-right: -14px; }
.pages { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.idx { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.idx-letter { margin: 0; padding-left: 2px; font-weight: 800; font-stretch: var(--narrow); font-size: 34px; line-height: .9; color: var(--tomato); }
.found-n { margin: 0; }
.idx > .card { border-radius: 0; padding-bottom: calc(var(--zz) / 2); -webkit-mask: var(--torn); mask: var(--torn); }
.entry {
  position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  min-height: 54px; padding: 10px 14px; border: 0; background: var(--paper); text-align: left;
}
.entry + .entry::before { content: ''; position: absolute; top: 0; left: 14px; right: 14px; border-top: 1.5px dashed var(--row); }
.e-title { min-width: 0; font-size: 17px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.leaf { display: inline-block; margin-left: 7px; vertical-align: -1px; fill: none; stroke: var(--basil); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.e-time { flex-shrink: 0; font-size: 14px; font-weight: 700; font-stretch: var(--semi); color: var(--muted2); white-space: nowrap; }
.entry:focus-visible { outline-offset: -3px; border-radius: 4px; }

/* The thumb index stays in view while a long page scrolls. */
.thumbs {
  position: sticky; top: calc(var(--safe-t) + 10px); align-self: start;
  display: flex; flex-direction: column; height: min(600px, calc(100dvh - var(--safe-t) - var(--safe-b) - 280px)); min-height: 300px;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.thumb {
  flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 0 0 3px; border: 0;
  border-radius: 6px 0 0 6px; background: none; font-size: 13px; font-weight: 800; font-stretch: var(--narrow); line-height: 1; color: var(--ink);
}
.thumb.on { background: var(--tomato); color: #fff; }
.thumb.empty { color: var(--faint); font-weight: 500; }
.thumb:focus-visible { outline-offset: -2px; }
.thumb-bubble {
  position: fixed; z-index: 30; width: 64px; height: 64px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--tomato); color: #fff; font-size: 38px; font-weight: 800; font-stretch: var(--narrow); box-shadow: 0 6px 18px rgba(20, 21, 24, .25); pointer-events: none;
}
.thumb-bubble.dim { opacity: .55; }
.day:focus-visible, .pick:focus-visible, .planday:focus-visible, .tk-total:focus-visible { outline-offset: -3px; }

/* A recipe is the ticket you cook from: read at arm's length, amounts in one hard column. */
.detail { display: flex; flex-direction: column; gap: 16px; }
.day-bar { display: flex; align-items: center; gap: 12px; }
.day-bar-what { flex-grow: 1; min-width: 0; font-size: 16px; font-weight: 800; font-stretch: var(--semi); text-transform: uppercase; letter-spacing: .03em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcard { display: flex; flex-direction: column; gap: 10px; padding: 22px 18px calc(26px + var(--zz) / 2); background: var(--paper); }
.rcard h1 { margin: 0 0 4px; font-weight: 800; font-stretch: var(--narrow); font-size: 40px; line-height: .95; text-transform: uppercase; overflow-wrap: anywhere; }
.h1-sub { margin: -6px 0 4px; font-size: 16px; font-weight: 600; color: var(--muted); }
.rmeta-row { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 2px dashed var(--dash); font-size: 15px; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--seg); border-radius: 12px; padding: 1px; flex-shrink: 0; }
.stepper button { width: 42px; height: 42px; border: 0; border-radius: 11px; background: none; font-size: 22px; color: var(--ink); padding: 0; }
.stepper span { min-width: 24px; text-align: center; font-size: 18px; font-weight: 800; font-stretch: var(--narrow); color: var(--ink); }
.settings .stepper span { min-width: 40px; }
.rcard .label { margin-top: 12px; }
.ings { margin: 0; padding: 0; list-style: none; }
.ings li { display: grid; grid-template-columns: 5.6em minmax(0, 1fr); gap: 14px; padding: 10px 0; border-bottom: 1.5px dashed var(--row); font-size: 17px; line-height: 1.3; }
.ings .q { text-align: right; font-weight: 800; font-stretch: var(--semi); color: var(--ink); }
.ing-sub { margin: 16px 0 0; font-size: 13px; font-weight: 800; font-stretch: var(--semi); letter-spacing: .08em; text-transform: uppercase; color: var(--tomato-ink); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; font-size: 17px; line-height: 1.5; }
.steps .n { font-weight: 800; font-stretch: var(--narrow); font-size: 24px; line-height: 1.05; color: var(--tomato); }
.notes { margin: 0; font-size: 16px; line-height: 1.5; white-space: pre-line; color: var(--muted); }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 4px; background: var(--tomato-bg); color: var(--tomato-ink); font-size: 15px; line-height: 1.4; }
.confirm .actions .btn { min-height: 44px; }

/* Cook: one step fills the screen, swipe up for the next; the screen stays awake. */
.cook { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--ground); }
.cook-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; }
.cook-title { flex-grow: 1; min-width: 0; font-size: 16px; font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-at { font-size: 15px; font-weight: 800; font-stretch: var(--narrow); color: var(--tomato-ink); white-space: nowrap; }
.cook-pages { flex-grow: 1; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; }
.cook-page {
  min-height: calc(100% - 24px); margin: 0 12px 24px; scroll-snap-align: start; scroll-snap-stop: always; scroll-margin-top: 0;
  display: flex; flex-direction: column; gap: 18px; padding: 26px 20px calc(30px + var(--zz) / 2 + var(--safe-b));
  background: var(--paper); -webkit-mask: var(--torn); mask: var(--torn);
}
.cook-n { padding-bottom: 14px; border-bottom: 2px dashed var(--dash); font-weight: 800; font-stretch: var(--narrow); font-size: 96px; line-height: .8; color: var(--tomato); }
.cook-text { margin: 0; font-size: 27px; font-weight: 500; line-height: 1.35; }
.cook-page .ings li { font-size: 20px; }
.cook-next { margin-top: auto; font-size: 14px; font-weight: 700; color: var(--muted2); }
.cook-done { margin-top: 8px; }

/* ---------- Recipe form ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-card { padding: 18px 16px; gap: 14px; overflow: visible; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field input, .field textarea, .ing input, .ing select {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #C3C8CD; border-radius: 10px; background: #fff; font-size: 16px;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder, .ing input::placeholder, .find::placeholder, .write input::placeholder { color: var(--muted2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; font-size: 16px; }
.check-row input { width: 24px; height: 24px; accent-color: var(--ink); margin: 0; }
.ing-rows { display: flex; flex-direction: column; gap: 10px; margin-top: -6px; }
.ing { display: grid; grid-template-columns: 52px 82px minmax(0, 1fr) 40px; gap: 6px; padding-bottom: 10px; border-bottom: 1.5px dashed var(--row); }
.ing input { padding: 9px 8px; }
.ing select { grid-column: 1 / span 3; min-height: 40px; padding: 6px 8px; font-size: 14px; color: var(--muted); background: var(--ground); }
.ing-sec { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; margin-top: 8px; }
.ing-sec input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #C3C8CD; border-radius: 10px; background: var(--ground); font-size: 16px; font-weight: 700; color: var(--tomato-ink); }
.ing-sec input::placeholder { color: var(--muted2); }
.ing-adds { display: flex; flex-wrap: wrap; gap: 8px; }
.ing-del { width: 40px; height: 44px; border: 0; background: none; color: var(--muted2); font-size: 22px; padding: 0; }
.form-error { margin: 0; color: var(--tomato-ink); font-size: 15px; font-weight: 600; }

/* ---------- Dough ---------- */
.dough-grid, .dough-a, .dough-b { display: flex; flex-direction: column; gap: 16px; }
.settings { padding: 4px 16px; overflow: visible; }
.set-row { display: flex; justify-content: space-between; align-items: center; min-height: 58px; border-bottom: 1.5px dashed var(--row); font-size: 16px; font-weight: 600; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 12px 0; background: var(--seg); border-radius: 12px; padding: 3px; }
.seg button { min-height: 42px; border: 0; border-radius: 9px; background: none; font-size: 15px; font-weight: 600; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--paper); font-weight: 800; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 21, 24, .18); }
.bigs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.big { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--paper); border-radius: 4px; }
.big-red { background: var(--tomato); color: #fff; }
.big-label { font-size: 12px; font-weight: 700; font-stretch: var(--semi); letter-spacing: .08em; text-transform: uppercase; color: var(--steel-ink); }
.big-red .big-label { color: #fff; }
.big-num { font-weight: 800; font-stretch: var(--narrow); font-size: 52px; line-height: .9; }
.dough-rows { margin: 0; padding: 4px 16px calc(8px + var(--zz) / 2); list-style: none; background: var(--paper); }
.drow { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1.5px dashed var(--row); font-size: 16px; }
.drow:last-child { border-bottom: 0; }
.drow b { font-weight: 800; font-stretch: var(--semi); font-size: 17px; }
/* A small number with a big hit area: the padding is taken back by the margin. */
.pct { justify-self: end; border: 0; background: none; padding: 12px 8px; margin: -12px -8px; font-size: 14px; font-weight: 600; color: var(--muted2); text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
.pct.fixed { text-decoration: none; cursor: default; }
.pct.tweaked { color: var(--tomato); font-weight: 800; }
.tweak { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 12px; border-bottom: 1.5px dashed var(--row); font-size: 14px; color: var(--muted); }
.tweak .stepper span { min-width: 56px; }
.night { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--paper); border-radius: 4px; color: var(--muted); }
.night-label { font-size: 12px; font-weight: 800; font-stretch: var(--semi); letter-spacing: .1em; text-transform: uppercase; color: var(--tomato-ink); }
.night-title { font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 30px; line-height: .95; color: var(--ink); }
.night-body { font-size: 15px; line-height: 1.45; }
.night-date { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.night-date input { min-height: 44px; padding: 6px 10px; border: 1px solid #C3C8CD; border-radius: 10px; background: var(--paper); font-size: 16px; }
.night-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.toppings { padding: 14px 16px 16px; gap: 10px; overflow: visible; }
.top-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.top-head .seg { grid-template-columns: repeat(2, auto); margin: 0; }
.top-head .seg button { padding: 0 14px; }
.top-note { margin: 0; font-size: 14px; color: var(--muted); }
.top-list { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1.5px dashed var(--row); font-size: 16px; }
.tname { flex-grow: 1; min-width: 0; overflow-wrap: anywhere; }
.tqty { font-size: 15px; font-weight: 700; font-stretch: var(--semi); color: var(--muted); }
.top-empty { padding: 6px 0; }
.toppings .add { margin-top: 4px; background: var(--ground); border-color: transparent; }
.bake { margin: 0; padding: 12px 14px; border-radius: 4px; background: var(--tomato-bg); font-size: 15px; line-height: 1.5; color: var(--ink); }
.bake b { font-weight: 800; color: var(--tomato-ink); }
.method summary { list-style: none; display: flex; align-items: center; min-height: 44px; cursor: pointer; font-size: 13px; font-weight: 800; font-stretch: var(--semi); letter-spacing: .1em; text-transform: uppercase; color: var(--steel-ink); }
.method summary::-webkit-details-marker { display: none; }
.method .steps { margin-top: 10px; }

/* ---------- Sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: rgba(42, 46, 51, .32); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; overflow: auto;
  background: var(--paper); border-radius: 16px 16px 0 0; padding: 20px 18px calc(20px + var(--safe-b));
  display: flex; flex-direction: column; box-shadow: 0 -8px 30px rgba(20, 21, 24, .18); outline: none;
}
#sheetBody { display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { margin: 0; font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 34px; line-height: .95; }
.sheet .set-row { min-height: 52px; }
.write { display: flex; gap: 8px; align-items: center; padding: 4px 4px 4px 14px; background: #fff; border: 1px solid #C3C8CD; border-radius: 12px; }
.write input { flex-grow: 1; min-width: 0; border: 0; background: none; font-size: 16px; padding: 8px 0; outline: none; }
.write .btn { min-height: 42px; padding: 0 16px; font-size: 15px; border-radius: 9px; }
.picks { max-height: 38vh; overflow: auto; border: 1px solid var(--rule); border-radius: 12px; }
.pick {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 14px;
  border: 0; border-bottom: 1.5px dashed var(--row); background: var(--paper); text-align: left; font-size: 16px; font-weight: 500;
}
.pick:last-child { border-bottom: 0; }
.pick.cur { background: var(--tomato-bg); font-weight: 700; }
.pick .pillv { align-self: center; }
.pick small { font-size: 13px; font-weight: 700; font-stretch: var(--semi); color: var(--muted2); white-space: nowrap; }
.pick-all { color: var(--ink); font-weight: 800; }
.pick-all .ico { color: var(--tomato); }
.quick { align-self: flex-start; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-actions .btn { min-height: 46px; }
.planday { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; min-height: 54px; padding: 8px 14px; border: 0; border-bottom: 1.5px dashed var(--row); background: var(--paper); text-align: left; }
.planday:last-child { border-bottom: 0; }
.planday .day-when { padding: 0; border: 0; }
.planday .day-when b, .planday .day-when span { font-size: 17px; }
.planday.today { background: var(--tomato-bg); }
.planday.today .day-when b { color: var(--today); }
.planday .now { font-size: 15px; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.planday .now.empty { color: var(--muted2); font-weight: 500; }

/* ---------- Toast and sync ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 12px 16px;
  background: var(--ink); color: #fff; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 20px rgba(20, 21, 24, .25);
}
.toast button { min-height: 32px; border: 0; background: none; padding: 0; color: #FF8A7E; font-weight: 800; font-size: 15px; }
.sync {
  position: fixed; top: calc(8px + var(--safe-t)); right: 12px; z-index: 30; border: 1px solid var(--rule); background: var(--paper);
  color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600;
}
.sync.bad { color: var(--tomato-ink); background: var(--tomato-bg); border-color: var(--tomato-line); }

/* ---------- Laptop ---------- */
@media (min-width: 900px) {
  .main { padding: 0; }
  .app { max-width: 1280px; margin: 0 auto; padding: 32px 56px 48px; display: flex; flex-direction: column; gap: 28px; }
  .top { display: flex; justify-content: space-between; align-items: center; }
  .brand { font-weight: 800; font-stretch: var(--narrow); text-transform: uppercase; font-size: 34px; letter-spacing: .01em; }
  .pills { display: flex; gap: 4px; background: var(--seg); border-radius: 12px; padding: 4px; }
  .pill-tab { min-height: 40px; padding: 0 18px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 15px; font-weight: 600; }
  .pill-tab.on { background: var(--paper); color: var(--ink); font-weight: 800; box-shadow: 0 1px 2px rgba(20, 21, 24, .18); }
  .tabs { display: none; }
  .only-phone { display: none !important; }
  .only-wide { display: inline; }

  .plan.on { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; align-items: start; }
  .plan:not(.on) { display: none; }
  .plan .view { display: flex; gap: 16px; }
  .plan .h1 { font-size: 42px; }
  .plan .round { width: 40px; height: 40px; }
  .tk-total { display: none; }
  .tickets { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .shop-head { flex-wrap: nowrap; }
  .add { flex-basis: auto; width: 260px; margin: 0; }
  .shop-list { display: block; columns: 2; column-gap: 28px; }
  .aisle { break-inside: avoid; margin-bottom: 8px; }
  .aisle > .label { padding: 8px 0 2px; }
  .stick { min-height: 44px; font-size: 15px; }
  .shop-list .empty-note { column-span: all; }

  .view.narrow { max-width: 760px; width: 100%; margin: 0 auto; }
  .dough-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  #v-dough { max-width: 1000px; width: 100%; margin: 0 auto; }

  .sheet-wrap { display: flex; align-items: center; justify-content: center; }
  .sheet { position: relative; width: 480px; max-height: 84vh; border-radius: 16px; padding: 26px 24px 24px; }
  .picks { max-height: 320px; }
  .toast { bottom: 32px; }
  .cook-page { max-width: 760px; margin: 0 auto; width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
  @keyframes rise { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
  /* A ticket being put on the rail drops in from under it. */
  .tickets.drop > * { animation: hang .34s cubic-bezier(.16, 1, .3, 1) both; }
  .tickets.drop > :nth-child(2) { animation-delay: .03s; } .tickets.drop > :nth-child(3) { animation-delay: .06s; }
  .tickets.drop > :nth-child(4) { animation-delay: .09s; } .tickets.drop > :nth-child(5) { animation-delay: .12s; }
  .tickets.drop > :nth-child(6) { animation-delay: .15s; } .tickets.drop > :nth-child(7) { animation-delay: .18s; }
  .tickets.drop > :nth-child(8) { animation-delay: .21s; }
  @keyframes hang { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 900px) {
  .sheet { animation: pop .16s ease-out; }
  @keyframes pop { from { transform: scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
}
