/* styles.css — all colors live here as variables, so the look can be changed in one place. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2b2a27;
  --muted: #6d6a63;
  --line: #e7e1d6;
  --accent: #2f7d5b;
  --accent-soft: #e3f1ea;
  --on-accent: #ffffff;
  --warn: #8a4b07;
  --warn-soft: #fdf0d5;
  --danger: #b42318;
  --danger-soft: #fde8e6;

  --radius: 14px;
  --tap: 52px;           /* minimum height for anything you tap */
  --tabbar-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #26241f;
    --text: #f2efe9;
    --muted: #aaa499;
    --line: #3a3732;
    --accent: #63c194;
    --accent-soft: #1f3a2d;
    --on-accent: #0f2219;
    --warn: #f5c062;
    --warn-soft: #3a2d0f;
    --danger: #f88b80;
    --danger-soft: #3d1a16;
    color-scheme: dark;
  }
}

/* ---------- Basics ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom));
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}
.page-header h1 { margin: 0; font-size: 1.75rem; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
}
.icon-btn:hover { background: var(--line); }

/* ---------- Location filter (All / Pantry / Fridge / Freezer) ---------- */

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--line);
  border-radius: var(--radius);
}
.segmented button {
  min-height: 52px;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.15;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / .12);
}
.segmented .count { color: var(--muted); font-weight: 400; font-size: .8rem; }

.search {
  width: 100%;
  min-height: var(--tap);
  margin: 12px 0 4px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.banner {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}

/* ---------- Item list ---------- */

.group h2 {
  margin: 24px 4px 8px;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 0;
}
.item + .item { border-top: 1px solid var(--line); }
.item.is-out .item-name { color: var(--muted); text-decoration: line-through; }

.item-main {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}
.item-name { font-weight: 600; overflow-wrap: anywhere; }
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: .85rem;
  color: var(--muted);
}

.badge { font-weight: 600; }
.badge.soon    { color: var(--warn); }
.badge.expired { color: var(--danger); }

.stepper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.stepper button {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}
.qty {
  min-width: 64px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qty small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
.is-out .qty { color: var(--muted); font-weight: 600; }

/* ---------- Empty states ---------- */

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}
.empty p { margin: 4px 0; }
.empty strong { color: var(--text); }
.empty-icon { font-size: 3rem; }

/* ---------- Floating "Add item" button ---------- */

.fab {
  position: fixed;
  right: max(16px, calc((100vw - 720px) / 2 + 16px));
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  min-height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 28px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 4px 14px rgb(0 0 0 / .2);
}

/* ---------- Bottom tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tabbar button {
  height: var(--tabbar-h);
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: .8rem;
  color: var(--muted);
}
.tabbar button span { font-size: 1.4rem; }
.tabbar button[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* ---------- Pop-up sheet (bottom sheet on phones, centered card on bigger screens) ---------- */

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}
.sheet::backdrop { background: rgb(0 0 0 / .45); }

@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: 20px; }
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-form h2 { margin: 0; font-size: 1.4rem; }
.sheet-form p { margin: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field > span, .field legend { font-weight: 600; padding: 0; }
.field small { font-weight: 400; color: var(--muted); }

.field input, .field select, .add-row input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }
.add-row { align-items: center; }
.add-row .btn { flex: 0 0 auto; }

.hint { font-size: .9rem; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.error:empty { display: none; }

/* Pantry / Fridge / Freezer picker */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.choice > span > span { font-size: 1.5rem; }
.choice input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Alias chips */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chip {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: .95rem;
}
.chip button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  color: var(--muted);
}

/* Buttons */
.btn {
  min-height: var(--tap);
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger  { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn.wide    { width: 100%; }
.file-btn    { cursor: pointer; }

.link-btn {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
}

.sheet-actions { display: flex; gap: 8px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .danger { flex: 0 0 auto; margin-right: auto; }

/* ---------- Toast message ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 6px 20px rgb(0 0 0 / .25);
  z-index: 20;
}
.toast button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bg);
  font-weight: 700;
  text-decoration: underline;
}

/* =====================================================================
   Recipes
   ===================================================================== */

a.fab, a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
a.btn { color: var(--text); }

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font: inherit;
  color: inherit;
  line-height: 1.5;
  resize: vertical;
}

/* Filter chips (Favorites and tags) */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.filter-chip {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .95rem;
  font-weight: 600;
}
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Recipe cards */
.recipe-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .recipe-list { grid-template-columns: 1fr 1fr; } }

.recipe-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.recipe-link {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 56px 10px 10px;
  color: inherit;
  text-decoration: none;
  min-height: 96px;
}
.thumb {
  flex: 0 0 76px;
  height: 76px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 2rem;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.recipe-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recipe-title { font-weight: 700; overflow-wrap: anywhere; }
.recipe-meta { font-size: .9rem; color: var(--muted); }
.recipe-have { font-size: .85rem; color: var(--muted); }
.recipe-have.ready, .recipe-have.swap { color: var(--accent); font-weight: 600; }
.recipe-have.missing { color: var(--warn); }

.fav-btn {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
}
.fav-btn[aria-pressed="true"] { color: #e0a100; }
.recipe-card .fav-btn { position: absolute; top: 4px; right: 4px; }

/* Recipe page */
.back-link {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: 8px; }

.hero {
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}
.recipe-heading { margin: 16px 0 4px; font-size: 1.9rem; line-height: 1.2; overflow-wrap: anywhere; }
.recipe-times { margin: 0; color: var(--muted); }

.controls {
  margin-top: 20px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}
.control-row + .control-row, .scaled-note + .control-row { border-top: 1px solid var(--line); }
.control-label { font-weight: 700; }
.scaled-note { margin: -6px 0 8px; }
.scaled-note .link-btn { display: inline; min-height: 0; margin-left: 4px; }

.segmented.two { grid-template-columns: 1fr 1fr; min-width: 200px; }

.section-title { margin: 28px 0 8px; font-size: 1.3rem; }
.have-summary { margin: 0 0 10px; font-weight: 600; color: var(--muted); }
.have-summary.ready, .have-summary.swap { color: var(--accent); }
.have-summary.missing { color: var(--warn); }

.ingredient-list, .parse-preview {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ingredient-list > li + li, .parse-preview > li + li { border-top: 1px solid var(--line); }
.ing-row, .parse-preview > li {
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}
.ing-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.ing-name { overflow-wrap: anywhere; }
.ing-name small { color: var(--muted); font-size: .9rem; }
.ing-heading {
  padding: 12px 14px 6px;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--line);
  color: var(--muted);
}
.pill.have { background: var(--accent-soft); color: var(--accent); }
.pill.out, .pill.missing { background: var(--warn-soft); color: var(--warn); }
.pill.new { background: var(--accent-soft); color: var(--accent); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 0 12px 48px;
  font-size: 1.05rem;
}
.steps li + li { border-top: 1px solid var(--line); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.btn.big { min-height: 60px; font-size: 1.1rem; }
.recipe-detail > .btn.wide { margin-top: 24px; }

/* Add / edit form */
.editor-form { display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.editor-form .field > .hint { font-weight: 400; }
.preview-title { margin: -8px 0 6px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.parse-preview > li { min-height: 48px; font-size: .95rem; }
.photo-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
}

/* =====================================================================
   Cooking mode — fills the screen, big text, one step at a time
   ===================================================================== */

body.cooking { overflow: hidden; }
body.cooking .tabbar { display: none; }

.cook {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.cook-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.cook-top .segmented.two { min-width: 180px; }
.cook-progress { height: 6px; background: var(--line); }
.cook-progress span { display: block; height: 100%; background: var(--accent); transition: width .25s; }

.cook-body {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px;
}
.cook-kicker {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
}
.cook-heading { margin: 0 0 16px; font-size: 1.8rem; }
.cook-step {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw + 1rem, 2.6rem);
  line-height: 1.35;
  font-weight: 500;
}
.cook-ingredients, .cook-used ul { list-style: none; margin: 0; padding: 0; font-size: 1.3rem; }
.cook-ingredients li, .cook-used li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cook-ingredients small { color: var(--muted); font-size: 1rem; }
.cook-ingredients .pill { margin-left: 6px; vertical-align: middle; }
.cook-used { margin-top: 32px; }

.cook-nav {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}
.cook-nav .btn { min-height: 68px; font-size: 1.25rem; }

/* =====================================================================
   What can I make, swaps, and ingredient actions
   ===================================================================== */

.make-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.make-toolbar p { margin: 0; color: var(--muted); font-size: .95rem; }
.make-toolbar .btn { flex-shrink: 0; }

.make-group .section-title { margin-bottom: 2px; }
.make-group > .hint { margin: 0 0 10px; }
.section-title .count {
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
}

.make-card .recipe-link { padding-right: 12px; }
.make-note { font-size: .88rem; line-height: 1.35; margin-top: 2px; }
.make-note.expiring { color: var(--warn); font-weight: 600; }
.make-note.swap { color: var(--accent); font-weight: 600; }
.make-note.short { color: var(--warn); }
.make-note small { font-weight: 400; color: var(--muted); }

.missing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 0 12px 12px;
}
.missing-label { font-size: .85rem; font-weight: 700; color: var(--warn); margin-right: 2px; }
.missing-chip {
  min-height: 44px;
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}

.show-more { margin-top: 24px; }

.pill.swap { background: var(--accent-soft); color: var(--accent); }
.pill.short { background: var(--warn-soft); color: var(--warn); }
.swap-note { display: block; color: var(--accent); font-size: .85rem; }

/* Checkbox with a label and explanation, e.g. "I always have this" */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--tap);
  cursor: pointer;
}
.check-row input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.check-row small { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }

.swap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.swap-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  min-height: 60px;
}
.swap-list li + li { border-top: 1px solid var(--line); }
.swap-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.swap-text small { display: block; color: var(--muted); font-size: .85rem; }
.empty-inline { color: var(--muted); text-align: center; padding: 12px 0; }

.banner a { color: inherit; font-weight: 700; }
.empty .btn { margin-top: 12px; }

/* =====================================================================
   Shopping list
   ===================================================================== */

/* Four tabs: let long labels wrap onto two short lines */
.tabbar button {
  position: relative;
  padding: 0 2px;
  font-size: .75rem;
  line-height: 1.15;
  text-align: center;
}
.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .72rem;
  font-weight: 700;
  line-height: 20px;
}

.add-bar { display: flex; gap: 8px; margin-bottom: 4px; }
.add-bar input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.shop-suggest { margin-top: 16px; }
.shop-suggest .hint { margin: 0; }
.shop-suggest .filter-chips { margin-top: 8px; }

.shop-item { display: flex; align-items: center; }
.shop-item + .shop-item { border-top: 1px solid var(--line); }
.shop-check {
  flex: 0 0 56px;
  align-self: stretch;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.shop-check input { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.shop-main {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 16px 8px 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.shop-name { overflow-wrap: anywhere; }
.shop-meta { font-size: .85rem; color: var(--muted); }
.shop-item.is-checked .shop-name { color: var(--muted); text-decoration: line-through; }

.shop-cart h2 { color: var(--accent); }
.cart-actions { display: flex; gap: 8px; margin-top: 12px; }
.cart-actions .btn { flex: 1; }
.cart-actions .btn.primary { flex: 2; }
.all-done { margin: 24px 0 0; text-align: center; font-weight: 700; color: var(--accent); }
.share-btn { margin-top: 24px; }

/* Put-away sheet */
.putaway-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.putaway-list li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.putaway-list input[type="number"], .putaway-list input[name^="unit-"] {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.choices.compact.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.choices.compact .choice > span { min-height: 48px; font-size: .85rem; text-align: center; padding: 0 2px; }

/* Shopping links on recipes and What can I make */
.shop-btn { margin: 0 0 12px; }
a.btn.wide { display: flex; }
.on-list { font-size: .85rem; font-weight: 700; color: var(--accent); }
.missing-row .link-btn { min-height: 44px; font-size: .9rem; }

/* =====================================================================
   Ingredients screen
   ===================================================================== */

button.back-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; cursor: pointer; }
.page-title { margin: 0 0 4px; font-size: 1.75rem; }

.filter-chip .count { font-weight: 400; opacity: .75; }

.manage-row {
  width: 100%;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  text-align: left;
}
.items > li + li .manage-row { border-top: 1px solid var(--line); }
.manage-name { font-weight: 600; overflow-wrap: anywhere; }
.manage-name .pill { margin-left: 6px; vertical-align: middle; }
.manage-meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.manage-meta.unused { color: var(--warn); }

.dupes { margin-top: 8px; }
.dupes .hint { margin: 0 0 8px; }
.cleanup-btn { margin-top: 16px; }

.merge-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
}
.merge-box summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}
.merge-box[open] { padding-bottom: 14px; }
.merge-box .hint { margin: 0 0 10px; }

.footer-link {
  display: block;
  margin: 24px 0 0;
  padding: 14px 0;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Settings: "Add to home screen" steps */
.install-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* "Amounts in the steps are for the original 4 servings" */
.step-note { margin: -4px 0 8px; font-style: italic; }
.cook-body .step-note { margin-top: 16px; font-size: 1rem; }

/* =====================================================================
   Barcode scanning
   ===================================================================== */

.scan-btn { font-size: 1.05rem; }

.scan-view {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The guide box to line the barcode up in */
.scan-frame {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 30%;
  bottom: 30%;
  border: 3px solid rgb(255 255 255 / .9);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgb(0 0 0 / .35);
}
.scan-frame::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 2px;
  background: #ff5a4f;
  animation: scan-line 1.6s ease-in-out infinite alternate;
}
@keyframes scan-line { from { transform: translateY(-28px); } to { transform: translateY(28px); } }
@media (prefers-reduced-motion: reduce) { .scan-frame::after { animation: none; } }

.scan-status { margin: 0; font-weight: 600; min-height: 1.4em; }

.scan-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.scan-result.not-found, .scan-result.error { background: var(--warn-soft); }
.scan-result .scan-product { margin: 0; overflow-wrap: anywhere; }
.scan-result .hint { margin: 0; color: var(--text); }
.scan-result .filter-chips { margin: 0; }
.scan-result .link-btn { min-height: 40px; font-size: .9rem; }
