:root {
  --bg: #f8f4ee;
  --surface: #ffffff;
  --surface-2: #f2ece3;
  --text: #24201c;
  --muted: #6c6359;
  --border: #e8dfd2;
  --accent: #b5562f;
  --accent-text: #ffffff;
  --accent-soft: #f6e3d8;
  --good: #2f7d4f;
  --good-soft: #def0e4;
  --warn: #9a6a00;
  --warn-soft: #fbefcf;
  --info: #2f5f9a;
  --info-soft: #dfe9f6;
  --purple: #6b4a9a;
  --purple-soft: #ebe3f6;
  --danger: #b3261e;
  --del: #fbe0de;
  --ins: #dcf0e2;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 6px 24px rgba(60, 40, 20, .07);
  --shadow-lg: 0 2px 6px rgba(60, 40, 20, .08), 0 18px 48px rgba(60, 40, 20, .16);
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --nav-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181613; --surface: #221f1b; --surface-2: #2c2823; --text: #efe9e1; --muted: #a99f93;
    --border: #3a352e; --accent: #e07a4f; --accent-text: #1b1916; --accent-soft: #3d2a20;
    --good: #7cc896; --good-soft: #1f3327; --warn: #e6bb55; --warn-soft: #3a2f14;
    --info: #8ab4ea; --info-soft: #1e2a3a; --purple: #b9a0e0; --purple-soft: #2d2540;
    --danger: #f2867e; --del: #4a2523; --ins: #1f3a28;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 18px 48px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #181613; --surface: #221f1b; --surface-2: #2c2823; --text: #efe9e1; --muted: #a99f93;
  --border: #3a352e; --accent: #e07a4f; --accent-text: #1b1916; --accent-soft: #3d2a20;
  --good: #7cc896; --good-soft: #1f3327; --warn: #e6bb55; --warn-soft: #3a2f14;
  --info: #8ab4ea; --info-soft: #1e2a3a; --purple: #b9a0e0; --purple-soft: #2d2540;
  --danger: #f2867e; --del: #4a2523; --ins: #1f3a28;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 18px 48px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }

.topbar {
  position: sticky; top: 0; z-index: 40; padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none;
  font-family: var(--serif); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.brand img { border-radius: 9px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 72px; outline: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn.tiny { min-height: 30px; padding: 3px 10px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 16px; }

/* ---- List ---- */
.list-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.search { flex: 1 1 260px; max-width: 420px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile .t { padding: 10px 10px 12px; } .tile .t strong { font-size: .98rem; } }
.tile { display: block; text-decoration: none; color: inherit; background: var(--surface); height: 100%;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile .img { overflow: hidden; background: var(--surface-2); }
.tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); transition: transform .4s ease; }
.tile:hover img { transform: scale(1.04); }
.tile .t { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.tile .t strong { display: block; font-family: var(--serif); font-size: 1.08rem; line-height: 1.25; }
.tile .t .muted { font-size: .86rem; }
.empty { text-align: center; padding: 60px 16px; }
.empty .big { font-size: 3rem; }

/* ---- Forms ---- */
label.field { display: block; }
label.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=search], input[type=url], input[type=email], input[type=number], input[type=date],
input[type=tel], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-height: 44px;
}
input[type=url] { font-size: 1.05rem; padding: 14px 16px; min-height: 56px; }
input[type=file] { font: inherit; max-width: 100%; }
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); }

.ing-row { display: grid; grid-template-columns: 70px 80px 1fr 1fr 36px; gap: 6px; margin-bottom: 6px; align-items: start; }
.step-row { display: grid; grid-template-columns: 28px 1fr 36px; gap: 6px; margin-bottom: 8px; align-items: start; }
.step-row .n { font-weight: 700; padding-top: 10px; text-align: right; color: var(--muted); }
.x { min-height: 40px; width: 36px; padding: 0; border-radius: 10px; }
@media (max-width: 600px) {
  .ing-row { grid-template-columns: 1fr 1fr 36px; }
  .ing-row .ing-item, .ing-row .ing-note { grid-column: span 2; }
  .ing-row .x { grid-column: 3; grid-row: 1; }
  .ing-row { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
}
.changed { background: var(--ins) !important; }
.guess { background: var(--warn-soft) !important; border-color: var(--warn) !important; }
.unreadable { background: var(--del) !important; border-color: var(--danger) !important; }

/* ---- Scan ---- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.photo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.photo-card .img { background: var(--surface-2); }
.photo-card img { width: 100%; }
.photo-card .body { padding: 12px; }
.pick { display: grid; place-items: center; text-align: center; gap: 10px; min-height: 200px; padding: 20px;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.note { font-size: .88rem; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 50px 16px; }
.error { background: var(--del); color: var(--danger); padding: 12px 14px; border-radius: 10px; }

/* Corner editor */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal .panel { max-width: 900px; width: 100%; max-height: 100%; overflow: auto; }
.corner-wrap { position: relative; touch-action: none; user-select: none; margin: 12px 0; }
.corner-wrap img { width: 100%; pointer-events: none; }
.corner-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.handle { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: rgba(255,255,255,.85); border: 3px solid var(--accent); cursor: grab; touch-action: none; }

/* ---- Review ---- */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
@media (max-width: 860px) {
  .review { grid-template-columns: 1fr; }
  .review .orig { display: contents; }           /* changes first, then the form, then the original */
  .review .orig > :first-child { order: 0; }
  .review > .panel { order: 1; }
  .review .orig > details { order: 2; }
}
.changes { list-style: none; padding: 0; margin: 0; }
.change { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.change.undone { opacity: .55; }
.change.undone .diff ins { text-decoration: line-through; }
.change .top { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.diff { margin: 6px 0 2px; font-size: .95rem; word-break: break-word; }
.diff del { background: var(--del); text-decoration: line-through; padding: 0 3px; border-radius: 4px; }
.diff ins { background: var(--ins); text-decoration: none; padding: 0 3px; border-radius: 4px; }
.reason { font-size: .85rem; color: var(--muted); }
.badge { display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; }
.b-spelling { background: var(--info-soft); color: var(--info); }
.b-format { background: var(--purple-soft); color: var(--purple); }
.b-filled_in { background: var(--warn-soft); color: var(--warn); }
.b-unit { background: var(--good-soft); color: var(--good); }
.fieldname { font-size: .8rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.orig-recipe ul, .orig-recipe ol, .recipe-text ul, .recipe-text ol { padding-left: 1.3em; }
mark.q { background: var(--del); color: var(--danger); padding: 0 2px; border-radius: 3px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs img { width: 100%; max-width: 320px; border-radius: 8px; border: 1px solid var(--border); }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%); }

/* ---- Recipe view ---- */
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.tabs button { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted);
  padding: 7px 16px; border-radius: 999px; cursor: pointer; min-height: 36px; }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cardimgs { display: grid; gap: 14px; margin-top: 14px; }
.cardimgs img { width: 100%; max-width: 900px; border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.15); }
.recipe-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .recipe-layout { grid-template-columns: 1fr; } }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .92rem; margin-bottom: 12px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); z-index: 60;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; transition: transform .25s ease;
  max-width: calc(100% - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Sections nav (in the header on wide screens, a bottom tab bar on phones) ---- */
.tabs-nav { display: flex; gap: 4px; margin: 0 auto; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.tabs-nav a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; white-space: nowrap; min-height: 40px;
  transition: background .15s ease, color .15s ease; }
.tabs-nav a:hover { color: var(--text); }
.tabs-nav a[aria-current=page] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs-nav svg, .icon-btn svg, .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-dot { position: absolute; top: 6px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface-2); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.icon-btn:hover { border-color: var(--muted); }
.icon-btn:active { transform: scale(.95); }
.icon-btn[aria-current=page], .icon-btn[aria-expanded=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
a.icon-btn[data-nav=settings] svg { transition: transform .5s ease; }
a.icon-btn[data-nav=settings]:hover svg { transform: rotate(60deg); }
.bell-count { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  /* A blurred header would trap the fixed bottom bar inside it, so on phones the header is solid. */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .topbar-inner { min-height: 56px; padding: 8px 12px; gap: 8px; }
  .brand { font-size: 1.1rem; } .brand img { width: 28px; height: 28px; }
  .tabs-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; border-radius: 0; gap: 0; padding: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .tabs-nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .72rem; min-height: 52px; justify-content: center; }
  .tabs-nav a[aria-current=page] { background: transparent; box-shadow: none; color: var(--accent); }
  .tabs-nav svg { width: 23px; height: 23px; }
  .nav-dot { top: 4px; right: calc(50% - 18px); box-shadow: 0 0 0 2px var(--surface); }
  .icon-btn { width: 40px; height: 40px; }
  .sticky-actions { bottom: var(--nav-h); }
  .shop-bar { bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(var(--nav-h) + 16px); }
}
@media (max-width: 340px) { .brand .wm-label { display: none; } }
.badge-count { background: var(--danger); color: #fff; font-size: .72rem; border-radius: 999px; padding: 1px 7px; }
.banner { max-width: 1100px; margin: 10px auto 0; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft);
  color: var(--warn); font-weight: 600; width: calc(100% - 32px); }
.banner a { color: inherit; }
select { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }

/* ---- Recipe tiles: Shop checkbox ---- */
.tile-wrap { position: relative; }
.shop-pick { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); font-weight: 600; font-size: .88rem; cursor: pointer; }
.shop-pick input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
/* Same height whether or not you're selecting, so the recipes below never move. */
.select-row { display: flex; align-items: center; gap: 10px; height: 44px; margin: -4px 0 14px; }
.select-row > .btn { min-width: 190px; flex: none; }
.menu-wrap { position: relative; flex: none; }
.menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 280px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.menu a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.menu .menu-file { display: block; padding: 10px 12px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.menu .menu-file:hover, .menu .menu-file:focus-within { background: var(--accent-soft); }
.menu .menu-file small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.menu a small { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.menu a:hover, .menu a:focus { background: var(--accent-soft); outline: none; }
@media (max-width: 480px) {
  .select-row > .btn { min-width: 0; }
  .select-hint { display: none; }
}
.select-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: .92rem; }
.tile-wrap.selecting .tile { outline: 2px dashed var(--border); outline-offset: -2px; }
.tile-wrap.picked .tile { outline: 3px solid var(--accent); outline-offset: -3px; }
.shop-bar { position: sticky; bottom: calc(17px + env(safe-area-inset-bottom)); margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between; padding: 10px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow);
  border: 1px solid var(--border); }

/* ---- Prompts ---- */
.prompt-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin-bottom: 16px; border-left: 4px solid var(--accent); }

/* ---- Pantry ---- */
.pantry-group + .pantry-group { margin-top: 16px; }
.pantry-items { list-style: none; margin: 0; padding: 0; }
.pantry-item { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.pantry-item:first-child { border-top: 0; }
.pi-main { flex: 1 1 200px; }
.pi-actions { gap: 6px; }
.exp { font-size: .8rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.exp-soon { background: var(--warn-soft); color: var(--warn); }
.exp-expired { background: var(--del); color: var(--danger); }
.receipt-row { display: grid; grid-template-columns: 24px 2fr 70px 90px 110px 150px; gap: 6px; align-items: center; margin-bottom: 6px; }
.receipt-row.off input:not([type=checkbox]), .receipt-row.off select { opacity: .45; }
.receipt-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
@media (max-width: 700px) {
  .receipt-row { grid-template-columns: 24px 1fr 1fr; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .receipt-row > :nth-child(2) { grid-column: 2 / 4; }
  .receipt-row > :nth-child(n+3) { grid-column: auto; }
  .receipt-row > :nth-child(3) { grid-column: 2; }
}
.use-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border); }
.use-controls { display: flex; gap: 12px; align-items: flex-end; }
.use-controls .field input { width: 90px; }

/* ---- Shopping ---- */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.status { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.s-sent { background: var(--info-soft); color: var(--info); }
.s-shopped { background: var(--good-soft); color: var(--good); }
.pick-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); }
.pick-row:first-child { border-top: 0; }
.stepper { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.store-pick { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.store-pick button { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 8px 18px;
  border-radius: 999px; cursor: pointer; min-height: 40px; }
.store-pick button[aria-checked=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.aisle h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-family: inherit; }
.shop-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.aisle h2 + .shop-item { border-top: 0; }
.shop-item > input[type=checkbox] { width: 22px; height: 22px; margin-top: 6px; accent-color: var(--accent); flex: none; }
.si-main { flex: 1; min-width: 0; }
.si-name { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 600; color: var(--text); text-align: left; cursor: pointer; }
.si-amount { max-width: 220px; padding: 5px 9px !important; font-size: .95rem !important; margin: 2px 0 4px; }
.si-sub { font-size: .82rem; }
.shop-item.off .si-name, .shop-item.off .si-amount { opacity: .5; }
.shop-item.done .si-name { text-decoration: line-through; color: var(--muted); }
.pantry-note { margin-top: 6px; font-size: .86rem; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.add-item { display: flex; gap: 8px; flex-wrap: wrap; }
.add-item input[name=name] { flex: 1 1 200px; }
.add-item .suggest-wrap { flex: 1 1 200px; }
.kr-head { margin-bottom: 8px; }
.kr-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.kr-opt { display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.kr-opt[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); }
.kr-opt img, .kr-noimg { width: 56px; height: 56px; object-fit: contain; flex: none; background: #fff; border-radius: 8px; display: grid; place-items: center; }
.kr-text { display: flex; flex-direction: column; gap: 2px; }
.kr-row { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; }
.kr-qty input { width: 70px; margin-left: 6px; }
.kr-store { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.kr-store:hover { border-color: var(--accent); }
.setup-steps li { margin-bottom: 6px; }
.suggest-wrap { position: relative; flex: 1 1 200px; min-width: 0; }
.suggest-wrap > input { width: 100%; }
.suggest-box { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.suggest-box li { padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.suggest-box li:hover, .suggest-box li[aria-selected=true] { background: var(--accent-soft); }
.suggest-box strong { font-weight: 700; }
.exp-input { display: flex; gap: 6px; align-items: center; }
.exp-input input { flex: 1; min-width: 0; }
.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.reading-line { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -4px 0 14px; font-size: .9rem; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.usage-grid div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.usage-grid strong { display: block; font-size: 1.3rem; }
.usage-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.usage-table th, .usage-table td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--border); }
.usage-table td:not(:first-child), .usage-table th:not(:first-child) { text-align: right; }
.list-row .list-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.star { border: 0; background: none; cursor: pointer; font-size: 1.6rem; line-height: 1; color: var(--muted);
  min-width: 44px; min-height: 44px; border-radius: 10px; flex: none; }
.star:hover { background: var(--surface-2); }
.star.on { color: #e0a100; }
.title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tab-link { display: inline-flex; align-items: center; text-decoration: none; font-weight: 600; color: var(--muted);
  padding: 7px 16px; border-radius: 999px; min-height: 36px; }
.tab-link[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
/* Hover preview of the recipe card (doesn't catch the mouse, so the recipe underneath stays hovered) */
.card-peek { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; pointer-events: none;
  background: rgba(20, 14, 8, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s ease; }
.card-peek.show { opacity: 1; }
/* Sized by the picture itself, so the shadow hugs the card instead of a bigger invisible box */
.card-peek img { width: auto; height: auto; max-width: min(1100px, 90vw); max-height: 86vh; border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5); transform: scale(.97); transition: transform .18s ease; }
.card-peek.show img { transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .card-peek, .card-peek img { transition: none; } }

/* Cover picture */
.cover-preview { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.cover-preview img { width: 160px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; flex: none; }
.recipe-cover { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; margin-bottom: 6px; }
.cover-credit { font-size: .8rem; margin: 0 0 6px; }
.cover-redo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; margin-bottom: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.units-note { font-size: .88rem; margin: 0 0 10px; }
.store-pick { flex-wrap: wrap; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }

.print-area { display: none; }
@media print {
  @page { size: 6in 4in; margin: 0; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .print-area img { width: 6in; height: 4in; object-fit: contain; page-break-after: always; break-after: page; }
}

/* Video import */
.progress { height: 8px; max-width: 320px; margin: 12px auto 8px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s ease; }
.tips { margin: 10px 0 0; padding-left: 20px; font-size: .92rem; }
.tips li { margin-bottom: 6px; }
.transcript { margin: 12px 0 0; font-size: .92rem; line-height: 1.55; color: var(--muted); white-space: pre-wrap; }

/* ---- Ask AI button ---- */
.ai-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700;
  font-size: .92rem; cursor: pointer; transition: border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.ai-btn:hover { border-color: var(--muted); color: var(--text); }
.ai-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); }
.ai-icon .ico { width: 16px; height: 16px; }
.ai-btn.connected { color: var(--text);
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(135deg, #e0a15c, #b5562f 45%, #7b5cc7) border-box;
  border: 1.5px solid transparent; box-shadow: 0 2px 12px rgba(181, 86, 47, .18); }
.ai-btn.connected .ai-icon { background: none; }
.ai-mark { display: inline-grid; place-items: center; border-radius: 50%; background: var(--ai); color: #fff; font-weight: 800;
  letter-spacing: -.02em; flex: none; line-height: 1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.ai-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.ai-choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left; font: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.ai-choice:hover { border-color: var(--muted); }
.ai-choice > span:nth-child(2) { flex: 1; min-width: 0; }
.ai-choice small { display: block; color: var(--muted); font-size: .82rem; }
.ai-choice-state { font-size: .8rem; font-weight: 700; color: var(--accent); }
.ai-choice[aria-pressed=true] { border-color: var(--good); background: var(--good-soft); }
.ai-choice[aria-pressed=true] .ai-choice-state { color: var(--good); }
.preview-note { margin: 14px 0 0; font-size: .82rem; color: var(--muted); padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.sheet-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 12px;
  background: var(--surface-2); color: var(--muted); }
.sheet-icon .ico { width: 28px; height: 28px; }
.ask-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-right: 44px; }
.ask-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ask-box { display: flex; gap: 8px; }
.ask-box input { flex: 1; min-width: 0; }
.ask-box .ico { width: 18px; height: 18px; }

/* ---- Pop-up sheet ---- */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 14, 8, 0); transition: background .2s ease; }
.sheet-wrap.show { background: rgba(20, 14, 8, .5); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 24px;
  transform: translateY(16px) scale(.98); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.sheet.wide { max-width: 760px; }
.sheet-wrap.show .sheet { transform: none; opacity: 1; }
.sheet-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; }
.sheet-close .ico { width: 18px; height: 18px; }
.sheet h2 { padding-right: 40px; }
body.no-scroll { overflow: hidden; }
@media (max-width: 760px) {
  .sheet-wrap { place-items: end stretch; padding: 0; }
  .sheet { max-width: none; border-radius: 24px 24px 0 0; max-height: 88dvh; padding: 22px 18px;
    padding-bottom: max(22px, env(safe-area-inset-bottom)); transform: translateY(40px); }
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-wrap { transition: none; } }

/* ---- Notifications ---- */
.notif-panel { position: fixed; z-index: 60; top: calc(env(safe-area-inset-top) + 70px); right: max(16px, calc((100vw - 1180px) / 2 + 16px));
  width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 8px; }
@media (max-width: 760px) { .notif-panel { top: calc(env(safe-area-inset-top) + 60px); right: 12px; } }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 6px; }
.notif-group + .notif-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.notif-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px 4px; }
.notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; text-decoration: none; color: var(--text); }
a.notif-item:hover { background: var(--surface-2); }
.notif-ico { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); font-weight: 800; }
.notif-ico.warn { background: var(--warn-soft); color: var(--warn); }
.notif-ico.bad { background: var(--del); color: var(--danger); }
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-text small { color: var(--muted); font-size: .84rem; }
.notif-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 28px 18px; }

/* ---- Recipes: sections, favorites, tags ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.chip:hover:not(:disabled) { border-color: var(--muted); }
.chip:disabled { cursor: default; opacity: .8; }
.chip span { color: var(--muted); font-weight: 700; font-size: .8rem; }
.section-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 8px; scrollbar-width: none; }
.section-chips::-webkit-scrollbar { display: none; }
.meal-section { margin-top: 26px; scroll-margin-top: 84px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; margin-bottom: 14px; }
.section-title .count { font-family: inherit; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border-radius: 999px; padding: 2px 9px; }
.fav-btn { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 1.2rem; line-height: 1; color: #fff;
  background: rgba(20, 14, 8, .38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .15s ease; }
.fav-btn:hover { transform: scale(1.08); }
.fav-btn.on { color: #ffc531; background: rgba(20, 14, 8, .5); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.t-high-protein { background: var(--info-soft); color: var(--info); }
.t-low-carb, .t-low-sugar { background: var(--purple-soft); color: var(--purple); }
.t-low-calorie, .t-low-fat, .t-low-sodium { background: var(--warn-soft); color: var(--warn); }
.t-high-fiber, .t-vegan, .t-vegetarian { background: var(--good-soft); color: var(--good); }
.t-gluten-free, .t-dairy-free { background: var(--accent-soft); color: var(--accent); }

/* ---- Recipe page ---- */
.recipe-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.fav-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; font: inherit;
  font-weight: 700; font-size: .9rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.fav-pill.on { background: #fff6d8; border-color: #f0d272; color: #8a6400; }
.meal-pick select { width: auto; min-height: 40px; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nutrition { margin-top: 18px; }
.nut-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
.nut-main { display: flex; gap: 18px; align-items: center; }
.nut-cal { display: grid; place-items: center; align-content: center; width: 104px; height: 104px; border-radius: 50%; flex: none;
  background: var(--accent); position: relative; }
.nut-cal::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.nut-cal strong, .nut-cal span { position: relative; }
.nut-cal strong { font-size: 1.6rem; line-height: 1; font-family: var(--serif); }
.nut-cal span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.nut-bars { flex: 1; display: grid; gap: 10px; min-width: 0; }
.nut-bar { display: grid; grid-template-columns: 62px 1fr 48px; gap: 10px; align-items: center; font-size: .9rem; }
.nut-label { font-weight: 600; }
.nut-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.nut-fill { display: block; height: 100%; border-radius: 999px; min-width: 4px; }
.nut-fill.p { background: #3d7fd9; } .nut-fill.c { background: #e0a43a; } .nut-fill.f { background: #c2603a; }
.nut-g { text-align: right; font-weight: 700; }
.nut-small { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: .88rem; color: var(--muted); }
.nut-small strong { color: var(--text); }
.nut-note { font-size: .8rem; margin: 12px 0 0; }
@media (max-width: 420px) { .nut-cal { width: 88px; height: 88px; } .nut-main { gap: 12px; } .nut-bar { grid-template-columns: 52px 1fr 42px; gap: 6px; } }

/* ---- Meal planner ---- */
.week-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.week-title { flex: 1; text-align: center; display: flex; flex-direction: column; }
.week-title strong { font-family: var(--serif); font-size: 1.2rem; }
.week-title .muted { font-size: .85rem; }
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; scroll-margin-top: 84px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.day.past { opacity: .72; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.day-name { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; margin-right: 6px; }
.day.today .day-name::after { content: "Today"; font-family: system-ui, sans-serif; font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent-text); background: var(--accent); border-radius: 999px; padding: 2px 8px; margin-left: 8px; vertical-align: 3px; }
.day-date { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.day-tot { font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.slot { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
.slot-name { font-size: .82rem; font-weight: 700; color: var(--muted); padding-top: 6px; white-space: nowrap; }
.slot-items { display: grid; gap: 6px; min-width: 0; }
.slot-add { justify-self: start; border: 1px dashed var(--border); background: none; color: var(--muted); font: inherit; font-size: .82rem;
  font-weight: 600; border-radius: 999px; padding: 4px 12px; min-height: 32px; cursor: pointer; }
.slot-add:hover { border-color: var(--accent); color: var(--accent); }
.plan-item { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.plan-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.plan-link img, .plan-noimg { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface);
  display: grid; place-items: center; }
.plan-link strong { display: block; font-size: .9rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-link small { color: var(--muted); font-size: .78rem; }
.plan-link > span:last-child { min-width: 0; }
.plan-x { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 1.3rem; border-radius: 8px; cursor: pointer; flex: none; }
.plan-x:hover { background: var(--surface); color: var(--danger); }
.pick-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 6px; }
.pick-list { max-height: 46dvh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.pick-recipe { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: none; border: 0; border-radius: 12px; padding: 8px; cursor: pointer; }
.pick-recipe:hover { background: var(--surface-2); }
.pick-recipe img, .pick-recipe .plan-noimg { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.pick-recipe > span:nth-child(2) { flex: 1; min-width: 0; }
.pick-recipe small { display: block; color: var(--muted); font-size: .82rem; }
.pick-star { color: #e0a100; }
.note-add { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.note-add input { flex: 1; min-width: 0; }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.day-chip { display: flex; flex-direction: column; align-items: center; min-width: 54px; padding: 8px 6px; border-radius: 14px; font: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.day-chip small { font-size: .72rem; color: var(--muted); font-weight: 600; }
.day-chip strong { font-size: 1.1rem; }
.day-chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day-chip[aria-pressed=true] small { color: inherit; }

/* ---- Recipe filters ---- */
.tabs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.filter-btn .ico { width: 18px; height: 18px; }
.filter-btn[aria-expanded=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text);
  font-size: .72rem; font-weight: 800; display: inline-grid; place-items: center; }
.filter-panel { margin-bottom: 14px; display: grid; gap: 4px; }
.filter-group .pick-label { margin-top: 4px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.on, .filter-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on span { color: inherit; opacity: .7; }
.filter-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.active-filters:empty { display: none; }

/* ---- Allergies ---- */
.allergy-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; background: var(--del); color: var(--danger); white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; }
.allergy-tag { display: inline-block; font-size: .76rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--del); color: var(--danger); margin: 2px 0; vertical-align: 1px; }
.allergy-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0 0 14px; border-radius: 14px;
  background: var(--del); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.allergy-banner .ab-icon { font-size: 1.3rem; line-height: 1.2; }
.allergy-banner strong { display: block; }
.allergy-banner span:not(.ab-icon) { font-size: .88rem; color: var(--text); opacity: .85; }
li.ing-allergy { color: var(--danger); font-weight: 600; }
li.ing-allergy::marker { color: var(--danger); }
.contains-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .86rem; margin: 12px 0 0; }
.contains-line span { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.contains-line span.mine { background: var(--del); color: var(--danger); }
.allergy-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.allergy-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; font: inherit;
  font-weight: 600; font-size: .92rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.allergy-chip:hover { border-color: var(--muted); }
.allergy-chip[aria-pressed=true] { background: var(--del); border-color: var(--danger); color: var(--danger); }
.allergy-chip[aria-pressed=true]::after { content: "✓"; font-weight: 800; }
.plan-link .allergy-badge { margin-top: 2px; }
.pick-recipe .allergy-badge { flex: none; }

/* Foods to avoid (Settings) */
.avoid-box { display: grid; gap: 10px; }
.avoid-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Pantry: items grouped by expiration date ---- */
.pantry-group h2 { display: flex; align-items: center; gap: 8px; }
.pantry-group h2 .count { font-family: inherit; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2);
  border-radius: 999px; padding: 2px 9px; }
.exp-group { margin-top: 12px; border-radius: 14px; background: var(--surface-2); padding: 4px 12px 2px; }
.exp-group:first-of-type { margin-top: 6px; }
.eg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 0 6px; font-size: .92rem; }
.eg-head .muted { font-size: .85rem; }
.eg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex: none; }
.eg-count { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--muted); }
.eg-soon { background: var(--warn-soft); }
.eg-soon .eg-dot { background: var(--warn); }
.eg-soon .eg-head strong { color: var(--warn); }
.eg-expired { background: var(--del); }
.eg-expired .eg-dot { background: var(--danger); }
.eg-expired .eg-head strong { color: var(--danger); }
.eg-none .eg-dot { background: var(--border); }
.exp-group .pantry-item { border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); padding: 8px 0; }
.exp-group .pantry-item:first-child { border-top: 0; }
.est { font-size: .7rem; font-weight: 700; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
  margin-left: 4px; vertical-align: 1px; cursor: help; }
.exp-group .pantry-item { flex-wrap: nowrap; align-items: center; gap: 10px; }
.exp-group .pi-main { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.exp-group .pi-actions { display: flex; gap: 6px; flex: none; }
.pi-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 34px; min-width: 34px; padding: 0 9px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); background: var(--surface); color: var(--text);
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.pi-btn .ico { width: 16px; height: 16px; }
.pi-btn:hover { border-color: var(--muted); }
.pi-btn.used:hover { background: var(--good-soft); color: var(--good); border-color: var(--good); }
@media (max-width: 400px) { .pi-btn.used span { display: none; } }

/* One line per expiration date; tap to open */
.exp-group { padding: 0; margin-top: 8px; }
.exp-group:first-of-type { margin-top: 4px; }
.eg-line { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px; border: 0;
  background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; border-radius: 14px; }
.eg-date { display: flex; flex-direction: column; flex: none; width: 92px; line-height: 1.2; }
.eg-date strong { font-size: .9rem; }
.eg-date small { font-size: .74rem; color: var(--muted); }
.eg-soon .eg-date strong { color: var(--warn); }
.eg-expired .eg-date strong { color: var(--danger); }
.eg-names { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.eg-count { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  font-size: .74rem; font-weight: 800; color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, transparent); margin: 0; }
.eg-chev { width: 18px; height: 18px; flex: none; color: var(--muted); transition: transform .18s ease; }
.exp-group.open .eg-chev { transform: rotate(180deg); }
.exp-group.open .eg-names { white-space: normal; }
.exp-group .pantry-items { padding: 0 12px 4px; }
.exp-group .pantry-items .pantry-item:first-child { border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.eg-date { width: 104px; }
.eg-names { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.exp-group.open .eg-names { -webkit-line-clamp: unset; }
@media (max-width: 400px) { .eg-date { width: 86px; } .eg-names { font-size: .88rem; } .eg-line { gap: 8px; padding: 8px 10px; } }

/* Claude setup */
.code-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 8px 0;
  font: .82rem/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.setup-steps { padding-left: 1.3em; margin: 10px 0; } .setup-steps li { margin-bottom: 6px; }
.ai-btn.preview .ai-icon { opacity: .75; }

/* Ask Claude box */
.ask-form { display: grid; gap: 10px; margin-bottom: 6px; }
.ask-form textarea { min-height: 84px; font-size: 1rem; }
.ask-form .ico { width: 18px; height: 18px; }
.ask-ideas .chip { white-space: normal; text-align: left; line-height: 1.3; max-width: 100%; }

/* Rename a shopping list */
.title-edit { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 6px; margin: 0 -6px;
  font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 10px; }
.title-edit .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.title-edit:hover { background: var(--surface-2); }
.rename-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rename-form input { flex: 1 1 220px; min-width: 0; font-family: var(--serif); font-size: 1.4rem; font-weight: 700; }
.title-row h1 { flex: 1; min-width: 0; }

/* Create a recipe */
.head-tools { display: flex; gap: 10px; align-items: center; flex: 1 1 320px; justify-content: flex-end; min-width: 0; }
.head-tools .search { flex: 1 1 200px; min-width: 0; }
.create-btn { flex: none; white-space: nowrap; }
@media (max-width: 520px) { .head-tools { flex-basis: 100%; } }
.cover-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 6px; }
.cover-pick img { width: 120px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.editor-legend { font-size: .85rem; margin: 18px 0 0; line-height: 2; }
#coverPreview:empty { display: none; }
.ing-row .suggest-wrap { flex: none; min-width: 0; }
.ing-row .suggest-box { min-width: 200px; }

/* Recipe page: tools row (favorite, meal, Edit, ⋯) and action tiles */
.recipe-tools .spacer { flex: 1 1 auto; }
.tool-btn { min-height: 40px; }
.more-btn { width: 40px; padding: 0; font-size: 1.3rem; line-height: 1; letter-spacing: .05em; }
.menu.menu-right { left: auto; right: 0; }
.menu a.danger { color: var(--danger); }
.menu a.danger:hover, .menu a.danger:focus { background: var(--del); }
.action-tiles { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.tile-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px;
  padding: 10px 6px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: .86rem; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, border-color .15s ease, background .15s ease; -webkit-tap-highlight-color: transparent; }
.tile-btn .ti { font-size: 1.5rem; line-height: 1; }
.tile-btn:hover { border-color: var(--muted); background: var(--surface); }
.tile-btn:active { transform: scale(.96); }
.tile-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.tile-btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
@media (max-width: 400px) { .tile-btn { min-height: 70px; font-size: .8rem; } .action-tiles { gap: 8px; } }
.menu { max-width: calc(100vw - 24px); }
.tile-btn span:last-child { white-space: nowrap; }
.recipe-tools .tool-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.fav-pill[aria-pressed=false] { color: var(--muted); }
@media (max-width: 480px) { .tool-label { display: none; } .tool-btn:not(.more-btn) { width: 40px; padding: 0; } }
@media (max-width: 480px) {
  .recipe-tools { gap: 6px; }
  .recipe-tools .tool-right { gap: 6px; }
  .fav-pill { padding: 6px 11px; font-size: .86rem; }
  .meal-pick select { padding: 6px 8px; font-size: .86rem; }
}
@media (max-width: 480px) { .meal-pick select { max-width: 110px; text-overflow: ellipsis; } }

/* Recipe tile without a cover picture */
.tile-ph { aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--ph) 30%, var(--surface)) 0%, var(--surface-2) 70%); }
.tile-ph::after { content: ""; position: absolute; inset: 10px; border: 1.5px dashed color-mix(in srgb, var(--ph) 35%, transparent);
  border-radius: 12px; pointer-events: none; }
.ph-icon { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.12)); }
.ph-title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.2; color: var(--text); opacity: .75;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 90%; }
.ph-breakfast { --ph: #f2b84b; } .ph-lunch { --ph: #7fb069; } .ph-dinner { --ph: #c4683f; }
.ph-snack { --ph: #d69b5a; } .ph-dessert { --ph: #d977a6; } .ph-none { --ph: #a39383; }
.tile:hover .tile-ph .ph-icon { transform: scale(1.06); transition: transform .3s ease; }
@media (max-width: 520px) { .ph-icon { font-size: 2.1rem; } .ph-title { font-size: .92rem; } }
.ph-icon { font-size: 3.4rem; }
@media (max-width: 520px) { .ph-icon { font-size: 2.6rem; } }

/* Cover photo picker */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } }
.photo-choice { position: relative; display: block; padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); cursor: pointer; aspect-ratio: 4 / 3; transition: transform .12s ease, border-color .12s ease; }
.photo-choice img { width: 100%; height: 100%; object-fit: cover; }
.photo-choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.photo-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-choice:disabled { cursor: default; opacity: .55; transform: none; }
.photo-choice.picking { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pc-src { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 2px 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; color: #fff; background: rgba(20, 14, 8, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.own-photo { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* Photo picker: header, scrolling grid, footer that stays put (iPhone friendly) */
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.picker { display: flex; flex-direction: column; gap: 12px; }
.picker-head { padding-right: 40px; }
.photo-grid-wrap { min-height: 200px; }
.photo-choice.skel { cursor: default; border: 0; background: linear-gradient(100deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .photo-choice.skel { animation: none; } }
.picker-foot { position: sticky; bottom: -24px; margin: 0 -24px -24px; padding: 12px 24px max(14px, env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); display: grid; gap: 8px; }
.picker-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.picker-actions .btn { width: 100%; min-height: 44px; }
.share-check { padding: 0; font-size: .88rem; color: var(--muted); align-items: center; }
.share-check input { margin-top: 0; }
.photo-choice { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.photo-choice:active { transform: scale(.97); }
@media (hover: none) { .photo-choice:hover { transform: none; border-color: transparent; } }
@media (max-width: 760px) {
  .picker-foot { bottom: calc(-1 * max(22px, env(safe-area-inset-bottom))); margin: 0 -18px calc(-1 * max(22px, env(safe-area-inset-bottom)));
    padding: 12px 18px max(14px, env(safe-area-inset-bottom)); }
}

/* Recipe page: toolbar above the cover, one cover button, pill selects with line icons */
.recipe-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin: -4px 0 12px; }
.recipe-toolbar .tool-btn { gap: 6px; }
.tool-btn .ico, .fav-pill .ico, .pick-pill .ico, .menu .ico, .picker-actions .ico, .cover-change .ico { width: 18px; height: 18px; flex: none; }
.more-btn .ico { width: 20px; height: 20px; }
.menu a .ico { vertical-align: -3px; margin-right: 4px; color: var(--muted); }
.menu a.danger .ico { color: var(--danger); }
.cover-wrap { position: relative; margin-bottom: 6px; }
.cover-wrap .recipe-cover { margin-bottom: 0; }
.cover-empty { aspect-ratio: 16 / 7; border-radius: 12px; border: 1.5px dashed var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.cover-empty .ico { width: 30px; height: 30px; }
.cover-change { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
  padding: 6px 14px; border-radius: 999px; border: 0; font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
  color: #fff; background: rgba(20, 14, 8, .58); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cover-change:hover { background: rgba(20, 14, 8, .75); }
.cover-wrap.empty .cover-change { color: var(--accent-text); background: var(--accent); backdrop-filter: none; -webkit-backdrop-filter: none; }
.fav-pill { gap: 6px; }
.fav-pill .ico.filled { fill: #e0a100; stroke: #e0a100; }
.pick-pill { position: relative; display: inline-flex; align-items: center; }
.pick-pill .ico { position: absolute; left: 12px; pointer-events: none; color: var(--muted); }
.pick-pill select { width: auto; min-height: 40px; padding: 6px 28px 6px 36px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.remove-cover { justify-self: start; font-size: .86rem; color: var(--danger); }
.tile-btn .ti .ico { width: 26px; height: 26px; }
.tile-btn .ti { display: grid; place-items: center; }
@media (max-width: 480px) {
  .recipe-tools { gap: 6px; }
  .pick-pill select { padding: 6px 22px 6px 32px; font-size: .85rem; }
  .pick-pill .ico { left: 10px; }
  .fav-pill span { display: none; }
  .fav-pill { padding: 6px 10px; }
  .recipe-toolbar .tool-label { display: none; }
}
.units-note .ico, .cover-pick .ico { width: 16px; height: 16px; vertical-align: -3px; }

/* Back link at the top of pages */
.back-link { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 12px -6px; padding: 6px 12px 6px 6px; min-height: 36px;
  border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--muted); max-width: 100%; }
.back-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-link .ico { width: 20px; height: 20px; flex: none; }
.back-link:hover { color: var(--text); background: var(--surface-2); }
@media (max-width: 480px) { .pick-pill select { max-width: 124px; text-overflow: ellipsis; } }

/* Favorite in the toolbar; measurements on the Ingredients heading */
.recipe-toolbar { align-items: center; }
.recipe-toolbar .spacer { flex: 1 1 auto; }
.recipe-toolbar .fav-pill { min-height: 40px; }
.ing-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.ing-head strong { font-size: 1.05rem; }
.units-pill select { min-height: 36px; font-size: .85rem; padding-top: 4px; padding-bottom: 4px; }
@media (max-width: 480px) { .recipe-toolbar .fav-pill { padding: 6px 10px; width: auto; } }

/* Breathing room under the photo; measurements right beside the Ingredients title */
.recipe-text .action-tiles { margin-top: 16px; }
.ing-head { justify-content: flex-start; gap: 12px; }

/* Card slider (2+ cards): one at a time, arrows on the card */
.slider { position: relative; outline: none; border-radius: 8px; }
.slider:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.slides img { width: 100%; max-width: 900px; border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.15); }
.slide-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(20, 14, 8, .55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .15s ease, background .15s ease; }
.slide-arrow:hover { background: rgba(20, 14, 8, .75); }
.slide-arrow:disabled { opacity: 0; pointer-events: none; }
.slide-arrow .ico { width: 22px; height: 22px; }
.slide-arrow.prev { left: 10px; }
.slide-arrow.next { right: 10px; }
.slide-arrow.next .ico { transform: scaleX(-1); }
.slide-count { position: absolute; right: 10px; bottom: 10px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  color: #fff; background: rgba(20, 14, 8, .55); }
@media (max-width: 480px) { .slide-arrow { width: 38px; height: 38px; } .slide-arrow.prev { left: 6px; } .slide-arrow.next { right: 6px; } }

/* No cover photo: the whole recipe card, centered on a warm "table", never cropped */
.card-ph { aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 9% 8%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 10%, var(--surface)) 0%, var(--surface-2) 75%); }
.tile .card-ph img, .card-ph img { width: auto; height: auto; max-width: 100%; max-height: 100%; aspect-ratio: auto; object-fit: contain;
  border-radius: 4px; background: #fffdf8; box-shadow: 0 1px 2px rgba(60,40,20,.12), 0 8px 22px rgba(60,40,20,.18);
  transform: rotate(-1.2deg); transition: transform .3s ease; }
.tile:hover .card-ph img { transform: rotate(0deg) scale(1.03); }
@media (prefers-reduced-motion: reduce) { .card-ph img, .tile:hover .card-ph img { transition: none; transform: none; } }
.card-ph { display: flex; align-items: center; justify-content: center; }
.card-ph img { min-height: 0; min-width: 0; }
.tile .card-ph img, .card-ph img { transform: rotate(var(--tilt, -1.2deg)); }

/* Pinned card: sized from its spot (container units), so the pin sits exactly on the card's top edge */
.card-ph { container-type: size; padding: 0; }
.card-ph .pinned { position: relative; display: block; line-height: 0; transform: rotate(var(--tilt, -1.2deg));
  transition: transform .3s ease; }
.tile .card-ph .pinned img, .card-ph .pinned img { display: block; width: auto; height: auto; max-width: 82cqw; max-height: 74cqh;
  transform: none; border-radius: 3px; }
.tile:hover .card-ph .pinned { transform: rotate(0deg) scale(1.03); }
.tile:hover .card-ph .pinned img { transform: none; }
.tack { position: absolute; top: -7px; left: 50%; width: 15px; height: 15px; margin-left: -7.5px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.85) 0 16%, transparent 30%),
              radial-gradient(circle at 50% 50%, var(--pin, #c8432f) 0 62%, color-mix(in srgb, var(--pin, #c8432f) 70%, #000) 100%);
  box-shadow: 0 2px 2px rgba(0,0,0,.25), 2px 4px 5px rgba(0,0,0,.2); }
.tack::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 4px; margin-left: -1px;
  background: rgba(0,0,0,.18); border-radius: 1px; }
@media (prefers-reduced-motion: reduce) { .card-ph .pinned, .tile:hover .card-ph .pinned { transition: none; } }

/* Recipe page without a cover photo: just a slim dashed button (the card already shows on the left) */
.cover-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 4px 0 0;
  border: 1.5px dashed var(--border); border-radius: 14px; background: var(--surface-2); color: var(--muted);
  font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.cover-add .ico { width: 18px; height: 18px; }
.cover-add:hover, .cover-add:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.ph-shake { --ph: #6fb3c7; }

/* ---- Nav with the big Cookbooks tab ----
   Same on computer and phone: Recipes · Plan · (Cookbooks circle) · Shopping · Pantry.
   Computer: one pill in the header with a raised round Cookbooks button in the middle.
   Phone: the bottom bar, with the same raised round button. */
.nav-stack { display: flex; align-items: center; gap: 4px; margin: 0 auto; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.nav-stack .tabs-nav { display: contents; }
.nav-stack .tabs-nav a[data-nav=recipes] { order: 1; }
.nav-stack .tabs-nav a[data-nav=plan] { order: 2; }
.nav-stack .cookbooks-tab { order: 3; }
.nav-stack .tabs-nav a[data-nav=shopping] { order: 4; }
.nav-stack .tabs-nav a[data-nav=pantry] { order: 5; }
.cookbooks-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 76px; align-self: stretch; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .72rem; }
.cookbooks-tab .cb-ico { display: grid; place-items: center; width: 60px; height: 60px; margin: -12px 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 0 0 4px var(--bg), 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .15s ease, box-shadow .15s ease; }
.cookbooks-tab .cb-ico svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* Just the round badge: the word stays for screen readers and as the hover tip. */
.cookbooks-tab > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cookbooks-tab:hover .cb-ico { transform: translateY(-2px) scale(1.04); }
.cookbooks-tab[aria-current=page] { color: var(--accent); }
.cookbooks-tab[aria-current=page] .cb-ico { box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent),
  0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.topbar-inner { min-height: 88px; }
@media (max-width: 760px) {
  .topbar-inner { min-height: 56px; }
  .nav-stack { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; align-items: flex-end; gap: 0; border-radius: 0;
    padding: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .nav-stack .tabs-nav a { flex: 1; }
  .cookbooks-tab { flex: 1; width: auto; align-self: auto; gap: 2px; min-height: 52px; padding: 0 2px; justify-content: center; }
  .cookbooks-tab .cb-ico { width: 56px; height: 56px; margin: -22px 0 0; box-shadow: 0 0 0 4px var(--surface), 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
  .cookbooks-tab .cb-ico svg { width: 26px; height: 26px; }
  .cookbooks-tab:hover .cb-ico { transform: none; }
  .cookbooks-tab[aria-current=page] .cb-ico { transform: scale(1.05); box-shadow: 0 0 0 4px var(--surface), 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
}

/* ---- Cookbooks ---- */
.book { display: flex; flex-direction: column; gap: 8px; }
.book-cover { position: relative; aspect-ratio: 3 / 4; border-radius: 4px 10px 10px 4px; overflow: hidden;
  background: color-mix(in srgb, var(--accent) calc(12% + var(--tint, 0) * 6%), var(--surface-2));
  box-shadow: inset 6px 0 0 rgba(0,0,0,.12), inset 8px 0 6px -4px rgba(0,0,0,.18), 0 2px 4px rgba(60,40,20,.12), 0 10px 24px rgba(60,40,20,.16); }
.book-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.18), transparent 12%, transparent 88%, rgba(0,0,0,.06)); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-blank { display: grid; place-items: center; height: 100%; color: var(--muted); }
.book-blank .ico { width: 36px; height: 36px; }
.book-label { display: flex; flex-direction: column; line-height: 1.25; }
.book-label strong { font-family: var(--serif); font-size: 1rem; }
.book-label small { color: var(--muted); font-size: .8rem; }
.my-cookbook { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; }
.mc-cover { text-decoration: none; color: inherit; }
.mc-cover .book-label { display: none; }
.mc-info { display: grid; gap: 8px; justify-items: start; }
.mc-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mc-title h2 { font-size: 1.5rem; }
.mc-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--muted); }
.mc-stats strong { color: var(--text); }
.mc-stats .ico { width: 14px; height: 14px; vertical-align: -2px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; }
.shelf-item { text-decoration: none; color: inherit; transition: transform .15s ease; }
.shelf-item:hover { transform: translateY(-3px); }
.new-chapter { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 3 / 4;
  border: 2px dashed var(--border); border-radius: 4px 10px 10px 4px; background: var(--surface); color: var(--muted);
  font: inherit; font-weight: 700; cursor: pointer; }
.new-chapter:hover { border-color: var(--accent); color: var(--accent); }
.nc-plus { font-size: 2rem; line-height: 1; }
.locked-browse { display: flex; gap: 16px; align-items: center; margin-top: 28px; background: var(--surface-2); border-style: dashed; }
.lb-icon { font-size: 1.8rem; }
.note-card { font-size: .9rem; line-height: 1.5; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin: 10px 0 6px; color: var(--muted); }
.note-card strong { color: var(--text); }
.cb-tile { position: relative; }
.vis-chip { position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  color: #fff; background: rgba(20, 14, 8, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.vis-chip.public { background: color-mix(in srgb, var(--good) 85%, #000); }
.cb-remove { position: absolute; top: 54px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  font-size: 1.2rem; color: #fff; background: rgba(20, 14, 8, .5); }
.cb-remove:hover { background: var(--danger); }
.chapter-checks { display: grid; gap: 2px; }
.check-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
@media (max-width: 520px) {
  .my-cookbook { grid-template-columns: 96px 1fr; gap: 14px; }
  .mc-title h2 { font-size: 1.2rem; }
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

/* In-between window sizes: keep the header on one line (the four tabs show just their icons;
   the words stay for screen readers). */
@media (min-width: 761px) and (max-width: 900px) {
  .nav-stack .tabs-nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-stack .tabs-nav a { padding: 8px 14px; }
}

/* ---- Ask AI: a floating button that always stays in the bottom-right corner ---- */
.ai-fab { position: fixed; z-index: 42; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  height: 52px; padding: 0 20px 0 12px; font-size: .95rem; color: var(--text);
  box-shadow: 0 2px 6px rgba(60,40,20,.10), 0 10px 28px rgba(60,40,20,.20); }
.ai-fab .ai-icon { width: 30px; height: 30px; }
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab:active { transform: scale(.97); }
.ai-fab.connected { box-shadow: 0 2px 6px rgba(60,40,20,.10), 0 10px 28px rgba(181, 86, 47, .28); }
.ai-btn { transition: border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease, bottom .2s ease; }
body.no-scroll .ai-fab { visibility: hidden; }            /* out of the way while a pop-up is open */
/* Lift it above Save bars so it never covers their buttons. (The Select bar stops short of it instead.) */
body:has(.sticky-actions) .ai-fab { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (max-width: 760px) {
  /* Phones: a round button just above the bottom tabs (and above any Save bar). */
  .ai-fab { right: 14px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); width: 54px; height: 54px; padding: 0; justify-content: center; }
  .ai-fab .ai-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ai-fab .ai-icon { width: 32px; height: 32px; }
  body:has(.sticky-actions) .ai-fab { display: none; }   /* form pages already have a Save bar here */
  main { padding-bottom: calc(var(--nav-h) + 90px); }
}

/* ---- Recipes toolbar: All/Favorites, the orange + (Add recipe), then Select and Filter on the right ---- */
.tabs-row { justify-content: flex-start; }
.list-tools { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.select-btn .ico { width: 18px; height: 18px; }
.select-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.select-hint { margin: -6px 0 12px; font-size: .92rem; white-space: normal; }
.add-btn { display: inline-flex; align-items: center; height: 40px; min-width: 40px; max-width: 40px; padding: 0 10px; gap: 0;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 700; font-size: .92rem;
  cursor: pointer; overflow: hidden; white-space: nowrap; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: max-width .25s ease, gap .25s ease, padding .25s ease, transform .12s ease; }
.add-btn .ico { width: 20px; height: 20px; stroke-width: 2.4; }
.add-label { opacity: 0; transition: opacity .15s ease; }
.add-btn:hover, .add-btn:focus-visible, .add-btn[aria-expanded=true] { max-width: 160px; gap: 6px; padding: 0 16px 0 10px; }
.add-btn:hover .add-label, .add-btn:focus-visible .add-label, .add-btn[aria-expanded=true] .add-label { opacity: 1; }
.add-btn:active { transform: scale(.96); }
.add-menu { min-width: 300px; max-width: calc(100vw - 16px); }
.add-menu a { position: relative; }
.add-menu .chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); }
.add-menu .add-back { font-weight: 700; color: var(--muted); }
/* Touch screens and phones: no hover, so it stays a round + (and nothing shifts when the menu opens). */
@media (hover: none), (max-width: 520px) { .add-btn.add-btn { max-width: 40px; gap: 0; padding: 0 10px; } .add-btn.add-btn .add-label { opacity: 0; } }

/* The picked count keeps the same width as it changes (1 recipe → 12 recipes), so the buttons beside it never move. */
.pick-count { min-width: 9.2em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Meal section icons sit on a soft tile in that meal's color. */
.sec-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; font-size: 1.25rem; line-height: 1;
  background: color-mix(in srgb, var(--ph, var(--accent)) 32%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ph, var(--accent)) 35%, transparent); }
@media (max-width: 520px) { .sec-ico { width: 34px; height: 34px; border-radius: 10px; font-size: 1.05rem; } }

/* Brand wordmark: a little recipe card, tilted, with a red top edge. On it: M with "e" and "e's" stacked
   on its right (Me Me's) and "recipes" handwritten underneath. The card is always paper-colored, even in dark mode. */
.wordmark { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; padding: 6px 12px 3px;
  background: #fffdf8; color: #2a2420; border: 1px solid #e3d9cc; border-top: 3px solid #c8432f; border-radius: 4px;
  transform: rotate(-2deg); box-shadow: 0 1px 2px rgba(60,40,20,.10), 0 4px 10px rgba(60,40,20,.10);
  transition: transform .2s ease; }
.brand:hover .wordmark { transform: rotate(0deg); }
.wm-top { display: flex; align-items: stretch; }
.wm-m { font-family: var(--serif); font-size: 1.75rem; font-weight: 800; line-height: .78; letter-spacing: -.02em; }
.wm-es { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; margin-left: 3px;
  font-family: var(--serif); font-size: .68rem; font-weight: 800; line-height: .8; color: #b5562f; }
.wm-apos { font-size: .85em; letter-spacing: -.02em; }
.wm-sub { margin-top: 1px; font-family: Caveat, "Segoe Print", "Bradley Hand", cursive; font-size: 1rem; font-weight: 700; color: #6b5f55; }
@media (max-width: 760px) {
  .wordmark { padding: 4px 9px 2px; border-top-width: 2.5px; }
  .wm-m { font-size: 1.4rem; } .wm-es { font-size: .58rem; } .wm-sub { font-size: .85rem; }
}

/* Phones: the Select bar sits just above the bottom tabs, beside the round Ask AI button, as a compact grid. */
@media (max-width: 760px) {
  .shop-bar { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; padding: 8px; border-radius: 18px; }
  .shop-bar .pick-count { grid-column: 1 / -1; min-width: 0; padding: 0 4px; font-size: .9rem; }
  .shop-bar .btn { width: 100%; justify-content: center; padding-left: 6px; padding-right: 6px; font-size: .82rem; white-space: nowrap; }
}

/* The Select bar is pinned to the bottom of the screen (not to the end of the list), so it always lines up with
   the floating Ask AI button, even when scrolled all the way down. fitShopBar() sets its right edge. */
.shop-bar { position: fixed; z-index: 41; margin: 0; left: max(16px, calc((100vw - 1180px) / 2 + 16px));
  right: max(16px, calc((100vw - 1180px) / 2 + 16px)); bottom: calc(17px + env(safe-area-inset-bottom)); }
body:has(.shop-bar:not([hidden])) main { padding-bottom: 110px; }
@media (max-width: 760px) {
  .shop-bar { left: 16px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); }
  body:has(.shop-bar:not([hidden])) main { padding-bottom: calc(var(--nav-h) + 150px); }
}

/* Every page lines up the same: the scrollbar's space is always kept (so short pages don't shift sideways),
   every page title row is the same height, and meal plan days shrink to fit narrow screens. */
html { scrollbar-gutter: stable; }
.list-head > h1 { min-height: 48px; display: flex; align-items: center; }
.week { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }

/* Orange chip (e.g. "＋ Create chapter" in the recipe filter when there are no chapters yet). */
.chip.chip-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.chip.chip-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: color-mix(in srgb, var(--accent) 88%, #000); }

/* Phones: All/Favorites, the orange +, and Select/Filter all on one row; Select and Filter become round icon buttons
   (their words stay for screen readers) with the filter count as a small badge. */
.list-tools .btn { gap: 6px; }
@media (max-width: 520px) {
  .tabs-row { flex-wrap: nowrap; gap: 6px; }
  .tabs-row .tabs { flex: none; }
  .tabs-row .tab-link { padding: 7px 10px; font-size: .88rem; white-space: nowrap; }
  .list-tools { gap: 6px; }
  .list-tools .btn { position: relative; width: 38px; height: 38px; min-height: 38px; padding: 0; justify-content: center; border-radius: 50%; flex: none; }
  .list-tools .tool-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .list-tools .filter-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; font-size: .66rem;
    box-shadow: 0 0 0 2px var(--bg); }
}
@media (max-width: 350px) { .tabs-row .tab-link { padding: 7px 7px; font-size: .82rem; } .tabs-row .add-btn { min-width: 36px; max-width: 36px; height: 36px; padding: 0 8px; } }

/* ---- Ask AI chat (inside the app) ---- */
.chat-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent); }
.chat-badge .ico { width: 24px; height: 24px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 180px; max-height: min(52vh, 460px); overflow-y: auto;
  padding: 4px 2px 8px; overscroll-behavior: contain; }
.chat-empty { margin: auto 0 0; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: .96rem; overflow-wrap: anywhere; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 4px 0 6px; padding-left: 20px; } .msg li { margin-bottom: 3px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg.ai a { font-weight: 700; }
.msg.err { background: var(--warn-soft); }
.msg-note { align-self: center; font-size: .82rem; color: var(--muted); text-align: center; max-width: 90%; }
.msg-approve { align-self: stretch; border: 1.5px solid var(--accent); border-radius: 16px; padding: 12px 14px; background: var(--surface); }
.msg-approve ul { margin: 6px 0 10px; padding-left: 20px; }
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-form textarea { flex: 1; min-width: 0; resize: none; min-height: 46px; max-height: 140px; border-radius: 22px; padding: 12px 16px;
  font: inherit; line-height: 1.35; }
.chat-send { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; justify-content: center; flex: none; }
.chat-send .ico { width: 20px; height: 20px; }
.chat-foot { font-size: .8rem; margin: 10px 0 0; line-height: 1.5; }

/* Meal planner: meals always fit inside the day card; long names wrap to two lines instead of running off the edge. */
.slot-items { grid-template-columns: minmax(0, 1fr); }
.plan-item { min-width: 0; }
.plan-link strong { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }

/* ---- Servings control on the recipe page (shown size only; the saved recipe never changes) ---- */
.serves-pill { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); padding: 2px; font-size: .88rem; white-space: nowrap; }
.serves-pill button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer; line-height: 1; }
.serves-pill button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.serves-pill button:disabled { opacity: .35; cursor: default; }
.serves-pill span { padding: 0 8px; }
.scale-note { margin: 4px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); font-size: .9rem; line-height: 1.45; }
.scale-note p { margin: 0; }
.scale-note ul { margin: 6px 0 0; padding-left: 4px; list-style: none; }
.scale-note li { margin-top: 3px; }
.nut-per { font-size: .85rem; color: var(--muted); }
.nut-per strong { color: var(--text); }
.ing-head { flex-wrap: wrap; row-gap: 8px; }

/* ---- Meal planner: Cooking for, leftovers ---- */
.plan-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cf-label { padding: 0 6px 0 10px; color: var(--text); font-weight: 700; }
.plan-edit .ico { width: 18px; height: 18px; }
.entry-rows { display: grid; gap: 10px; margin-top: 8px; }
.entry-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.meal-nums { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.meal-nums label { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.meal-nums input { width: 58px; padding: 4px 6px; min-height: 30px; font: inherit; font-size: .9rem; }
.meal-left { display: block; margin-top: 6px; color: var(--accent) !important; font-weight: 600; }

/* Smooth servings changes: the text dims a moment while it updates, the card fades over. */
#recipeBody { transition: opacity .15s ease; }
#recipeBody.updating { opacity: .55; }
.card-swap img { animation: cardIn .3s ease; }
@keyframes cardIn { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #recipeBody { transition: none; } .card-swap img { animation: none; } }

/* Changing servings never shifts the text around the numbers (8 -> 12 -> 1). */
.nut-n { display: inline-block; min-width: 2ch; text-align: left; font-variant-numeric: tabular-nums; }
#servesNum { display: inline-block; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
#servesWord { display: inline-block; min-width: 4.9em; text-align: left; }
.meta-n { display: inline-block; min-width: 2ch; font-variant-numeric: tabular-nums; }

/* ---- Ingredients header: Servings and Measurements side by side, matching pills ---- */
.ing-tools { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.units-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.units-btn:hover, .units-btn[aria-expanded=true] { border-color: var(--accent); }
.units-btn .ico { width: 17px; height: 17px; color: var(--muted); }
.units-btn .chev { width: 16px; height: 16px; transition: transform .15s ease; }
.units-btn[aria-expanded=true] .chev { transform: rotate(180deg); }
.serves-pill { height: 36px; }
.units-menu { min-width: 230px; }
.units-menu a { display: flex; align-items: flex-start; gap: 8px; }
.units-menu .um-check { width: 16px; flex: none; color: var(--accent); font-weight: 800; }
.units-menu a[aria-checked=true] { background: var(--accent-soft); }
@media (max-width: 420px) { .units-btn > span { display: none; } .units-btn { padding: 0 8px 0 10px; } }

/* ---- "Making 5 of 8 servings" box under Nutrition ---- */
.scale-box { margin-top: 16px; }
.sb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sb-head h2 { font-size: 1.1rem; }
.sb-head .muted { display: block; font-size: .88rem; margin-top: 4px; line-height: 1.4; }
.sb-head .btn { flex: none; }
.sb-label { margin: 14px 0 6px; font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sb-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2);
  font-size: .9rem; line-height: 1.35; }
.sn-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent); }
.sn-ico .ico { width: 17px; height: 17px; }
@media (max-width: 520px) { .sb-head { flex-direction: column; } }

/* Measurements menu: only the current choice is marked (keyboard focus shows as an outline, not a fill). */
.units-menu a[aria-checked=true] { background: none; }
.units-menu a:focus { background: none; }
.units-menu a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.units-menu a:hover { background: var(--accent-soft); }
.units-menu a[aria-checked=true] > span:last-child { font-weight: 800; }

/* ---- Shop from a recipe: open lists ---- */
.shop-for { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.shop-for .ico { width: 22px; height: 22px; color: var(--accent); flex: none; }
.shop-for strong { display: block; }
.shop-for small { color: var(--muted); }
.open-lists { display: grid; gap: 8px; }
.open-list { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.open-list:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.open-list input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.open-list strong { display: block; }
.open-list small { color: var(--muted); font-size: .84rem; }
.ol-more { margin: 14px 0 0; font-size: .9rem; }


/* Open shopping lists: still collecting recipes until "Finish list" */
.open-banner { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); line-height: 1.45; font-size: .93rem; }
.s-draft { background: var(--accent-soft); color: var(--accent); }
.s-ready { background: var(--surface-2); color: var(--text); }

/* Shopping list item buttons: Have it and Find, matching small pills */
.si-actions { display: flex; gap: 6px; align-items: center; flex: none; margin-top: 2px; }
.si-btn { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px 0 9px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: .82rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.si-btn:hover { border-color: var(--accent); color: var(--accent); }
.si-btn .ico { width: 16px; height: 16px; color: var(--accent); }
@media (max-width: 560px) {
  .shop-item { flex-wrap: wrap; }
  .shop-item > [data-remove] { order: 2; }
  .si-main { order: 1; flex-basis: 0; }
  .si-actions { order: 3; flex-basis: 100%; padding-left: 32px; margin-top: 0; }
}

.kr-more { font-weight: 700; }

.fav-banner { background: color-mix(in srgb, #d4a017 18%, var(--surface)); }

.older-lists { margin: -6px 0 0; font-size: .88rem; }

/* ---- Meal planner: Makes N chip and the Leftovers row ---- */
.makes-chip { flex: none; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.makes-chip:hover { border-color: var(--accent); color: var(--accent); }
.left-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px; border: 0; border-radius: 12px; text-align: left;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); font: inherit; color: var(--text); cursor: pointer; min-width: 0; }
.left-item:hover { background: var(--accent-soft); }
.left-item img, .left-item .plan-noimg { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex: none; }
.left-item > span:last-child { min-width: 0; }
.left-item strong { display: block; font-size: .86rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.left-item small { color: var(--muted); font-size: .76rem; }
.week-leftovers { margin-top: 18px; }
.wl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.wl-head .muted { font-size: .88rem; }
.wl-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 8px; }

/* The Makes chip sits on its own line under the recipe name, so names keep their width. */
.plan-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px; }
.plan-item > .plan-link { grid-column: 1; grid-row: 1; }
.plan-item > .plan-x { grid-column: 2; grid-row: 1; }
.plan-item > .makes-chip { grid-column: 1 / -1; grid-row: 2; justify-self: start; height: 24px; padding: 0 9px; font-size: .74rem; margin: 2px 0 4px 54px; }

/* ---- Meal planner: the week in one sliding row ---- */
.week-wrap { position: relative; }
.week { display: flex; grid-template-columns: none; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding: 4px 2px 10px; overscroll-behavior-x: contain; }
.week::-webkit-scrollbar { display: none; }
.week.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.week > .day-col { flex: 0 0 calc((100% - 32px) / 3); scroll-snap-align: start; min-width: 0; }
.week-arrow { position: absolute; top: 40px; z-index: 5; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.week-arrow .ico { width: 22px; height: 22px; }
.week-arrow:hover { border-color: var(--accent); color: var(--accent); }
.week-arrow.prev { left: -14px; }
.week-arrow.next { right: -14px; }
.week-arrow[hidden] { display: none; }
@media (max-width: 1000px) { .week > .day-col { flex-basis: calc((100% - 16px) / 2); } }
@media (max-width: 640px) {
  .week { gap: 12px; }
  .week > .day-col { flex-basis: 86%; }
  .week-arrow { top: 12px; width: 36px; height: 36px; }
  .week-arrow.prev { left: -8px; }
  .week-arrow.next { right: -8px; }
}
/* Arrows sit in their own gutter beside the row (not over the cards); phones swipe instead. */
.week-wrap { padding: 0 26px; margin: 0 -10px; }
.week-arrow { top: 16px; width: 34px; height: 34px; }
.week-arrow .ico { width: 20px; height: 20px; }
.week-arrow.prev { left: -6px; }
.week-arrow.next { right: -6px; }
@media (max-width: 640px) {
  .week-wrap { padding: 0; margin: 0; }
  .week-arrow { display: none; }
}

/* Day arrows: slim bars the full height of the days; the chevron stays in view while you scroll a long day. */
.week-arrow { top: 4px; bottom: 10px; height: auto; width: 22px; border-radius: 11px; border: 0; box-shadow: none;
  background: var(--surface-2); color: var(--muted); display: block; padding: 0; transition: background .15s ease, color .15s ease; }
.week-arrow:hover { background: var(--accent-soft); color: var(--accent); }
.week-arrow.prev { left: 0; }
.week-arrow.next { right: 0; }
.wa-ico { position: sticky; top: calc(50vh - 11px); display: grid; place-items: center; height: 22px; margin-top: 60px; }
.week-arrow .ico { width: 20px; height: 20px; }
/* Room inside the sliding row so the cards' outline and shadow aren't clipped at its edges. */
.week { padding: 10px 10px 16px; scroll-padding-inline: 10px; }
.week-wrap { padding: 0 18px; margin: 0 -14px; }
.week-arrow { top: 10px; bottom: 16px; }
@media (max-width: 640px) { .week { padding: 8px 6px 14px; scroll-padding-inline: 6px; } .week-wrap { margin: 0 -6px; } }
/* Day bars: a shade darker, outer corners curved like the day cards, inner corners tighter so they point at the days. */
.week-arrow { width: 24px; background: color-mix(in srgb, var(--text) 9%, var(--bg)); color: color-mix(in srgb, var(--text) 70%, transparent); }
.week-arrow:hover { background: var(--accent-soft); color: var(--accent); }
.week-arrow.prev { border-radius: var(--radius) 7px 7px var(--radius); }
.week-arrow.next { border-radius: 7px var(--radius) var(--radius) 7px; }
.week-arrow .ico { stroke-width: 2.2; }

/* The arrow is placed by script in the middle of the bar's visible part (not stuck to the screen's middle). */
.week-arrow { position: absolute; }
.week-arrow .wa-ico { position: absolute; left: 0; right: 0; top: 50%; margin: 0; transition: top .08s linear; }
/* Meal planner: the meal name sits above its meals, so the meals use the day's full width (no empty column). */
.slot { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; }
.slot-name { padding-top: 0; font-size: .8rem; letter-spacing: .02em; }
.slot-items { gap: 6px; }
.slot:not(.filled) { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.slot:not(.filled) .slot-name { min-width: 84px; }

/* ---- Planned meal row: picture · title (with calories and the Makes chip under it) · ✕, all centered in one line ---- */
.plan-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 6px 4px 6px 6px; }
.pi-thumb { display: block; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--surface); }
.pi-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pi-thumb .plan-noimg { width: 100%; height: 100%; display: grid; place-items: center; }
.pi-text { min-width: 0; display: grid; gap: 3px; }
.pi-title { font-weight: 700; font-size: .9rem; line-height: 1.25; color: var(--text); text-decoration: none;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
a.pi-title:hover { color: var(--accent); }
.pi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pi-meta small { color: var(--muted); font-size: .78rem; }
.plan-item > .makes-chip, .pi-meta .makes-chip { grid-column: auto; grid-row: auto; margin: 0; height: 22px; padding: 0 8px; font-size: .72rem; }
.plan-item > .plan-x { grid-column: 3; grid-row: 1; }

/* Uniform meal rows: one-line name and one-line details, cut off with "…" (hover shows it all). */
.pi-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; }
.pi-meta { flex-wrap: nowrap; min-width: 0; }
.pi-meta small { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-meta .makes-chip { flex: none; }

.pi-text { gap: 2px; }
.pi-cal { color: var(--muted); font-size: .78rem; line-height: 1.2; }

.pi-line { color: var(--muted); font-size: .78rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .plan-item { grid-template-columns: 42px minmax(0, 1fr) auto; column-gap: 8px; padding: 6px 2px 6px 6px; }
  .pi-thumb { width: 42px; height: 42px; }
  .pi-meta { gap: 4px 6px; }
  .pi-meta .makes-chip { padding: 0 7px; }
}

/* ---- Brand: framed recipe-card label. Script "Stirshare" over spaced KITCHEN CARDS (Kaushan Script + Josefin Sans). ---- */
.wm-label { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; padding: 6px 14px 6px;
  border: 1.5px solid var(--accent); border-radius: 6px; background: #fffdf8;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 30%, var(--border)); }
.wml-script { font-family: "Kaushan Script", "Segoe Script", "Brush Script MT", cursive; font-size: 1.55rem; color: var(--accent);
  line-height: .95; letter-spacing: .01em; }
.wml-caps { margin-top: 4px; padding-left: .36em; font-family: "Josefin Sans", "Montserrat", "Segoe UI", sans-serif; font-weight: 600;
  font-size: .5rem; letter-spacing: .36em; color: #3a302a; white-space: nowrap; }
@media (max-width: 760px) {
  .wm-label { padding: 4px 10px 4px; }
  .wml-script { font-size: 1.2rem; }
  .wml-caps { font-size: .42rem; margin-top: 3px; }
}

/* ---- Settings: group labels, status pills, line icons in text ---- */
:root { --ok: #2f6f3e; --ok-soft: #e2f1e5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #8fd19e; --ok-soft: #1f3a28; } }
:root[data-theme="dark"] { --ok: #8fd19e; --ok-soft: #1f3a28; }
.set-group { margin: 14px 0 -4px 4px; font-size: .76rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stack > .set-group:first-child { margin-top: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 7px; margin-right: 6px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); font-size: .82rem; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.status-pill .ico { width: 15px; height: 15px; stroke-width: 2.6; }
.ico-inline { width: 1.05em; height: 1.05em; vertical-align: -2px; }
.allergy-chip[aria-pressed=true]::after { content: none; }
.allergy-chip .ac-check { display: none; }
.allergy-chip .ac-check .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.allergy-chip[aria-pressed=true] .ac-check { display: inline-flex; }

/* ---- Settings: Card handwriting ---- */
.font-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.font-choice-wrap { position: relative; display: grid; }
.font-choice { display: grid; grid-template-rows: 64px auto; gap: 8px; padding: 10px; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-width: 0; }
.font-choice:hover:not(:disabled) { border-color: var(--muted); }
.font-choice[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.font-choice:disabled { cursor: default; }
.fc-sample { display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: #fbf7ee; border: 1px solid #ece3d2; }
.fc-sample img { max-width: 100%; max-height: 56px; object-fit: contain; }
.fc-classic { font-family: "Segoe Print", "Bradley Hand", cursive; font-size: 1.05rem; color: #22283e; }
.fc-name { font-weight: 700; padding-right: 34px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-name small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.fc-edit { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  color: var(--muted); }
.fc-edit:hover { color: var(--accent); background: var(--accent-soft); }
.fc-edit .ico { width: 18px; height: 18px; }
.font-new { grid-template-rows: none; place-items: center; align-content: center; gap: 6px; border-style: dashed; color: var(--accent);
  font-weight: 700; min-height: 110px; text-align: center; }
.font-new .ico { width: 24px; height: 24px; }

/* ---- A handwriting font's page ---- */
.font-head { display: flex; align-items: center; gap: 8px; }
.font-head h1 { margin-right: 4px; }
.font-sample-big { overflow-x: auto; border-radius: 10px; background: #fbf7ee; border: 1px solid #ece3d2; padding: 4px 0; }
.font-sample-big img { display: block; height: 96px; max-width: none; }
.font-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.font-steps { margin: 0 0 8px; padding-left: 22px; display: grid; gap: 4px; }
.font-add-btns .btn .ico { width: 18px; height: 18px; }
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.glyph-cell { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--border);
  border-radius: 12px; min-width: 0; }
.glyph-cell.missing { opacity: .55; border-style: dashed; }
.glyph-char { font-weight: 800; font-size: 1.05rem; text-align: center; color: var(--muted); }
.glyph-versions { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; min-width: 0; padding: 7px 7px 2px 0; }
.glyph-versions small { color: var(--muted); }
.glyph-v { flex: none; display: grid; place-items: center; width: 40px; height: 48px; padding: 3px; border: 1px solid #ece3d2; border-radius: 8px;
  background: #fbf7ee; cursor: pointer; position: relative; }
.glyph-v img { max-width: 34px; max-height: 42px; object-fit: contain; }
.glyph-v:hover { border-color: var(--danger); }
.glyph-v:hover::after { content: "\00d7"; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 14px; line-height: 17px; text-align: center; font-weight: 700; }
/* letters are stored as ink masks (white = ink): shown dark on paper in both themes */
img.ink { filter: invert(1); mix-blend-mode: multiply; }
.sheet-results { padding-left: 18px; }
.sheet-results li { margin-bottom: 6px; }

/* ---- Meal planner: each day's nutrition in its own box under the day; the cards stretch to the tallest
   day so all the boxes line up ---- */
.day-col { display: flex; flex-direction: column; gap: 12px; }
.day-col > .day { flex: 1; }
.day-col.past .day-nut { opacity: .72; }
.day-nut { padding: 14px 16px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); }
.dn-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; margin-bottom: 10px; }
.dn-head .muted { font-size: .78rem; }
.day-nut .nut-main { gap: 14px; }
.day-nut .nut-cal { width: 78px; height: 78px; }
.day-nut .nut-cal::before { inset: 6px; }
.day-nut .nut-cal strong { font-size: 1.2rem; }
.day-nut .nut-cal span { font-size: .68rem; }
.day-nut .nut-bars { gap: 7px; }
.day-nut .nut-bar { grid-template-columns: 52px 1fr 46px; gap: 8px; font-size: .82rem; }
.day-nut .nut-track { height: 8px; }
.day-nut .nut-small { margin-top: 10px; font-size: .8rem; gap: 4px 14px; }
.day-nut.dn-empty { visibility: hidden; }
/* fiber / sugar / sodium as three even columns (label over number): the same height on every day, so the boxes stay lined up */
.day-nut .nut-small { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.day-nut .nut-small span { display: grid; gap: 1px; }
.day-nut .nut-small strong { white-space: nowrap; }
/* Meal planner: each meal card has a strip on its right edge: "Making N" on top, the remove × under it, one piece
   with the card (same corners, a hairline between). Long recipe names wrap; servings and calories share one line. */
.plan-item { padding-right: 0; overflow: hidden; align-items: center; }
.pi-title { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.pi-side { grid-column: 3; align-self: stretch; margin: -6px 0; display: flex; flex-direction: column; width: 76px;
  border-left: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
  background: color-mix(in srgb, var(--surface) 50%, var(--surface-2)); }
.pi-side .makes-chip { flex: 1; height: auto; min-height: 30px; margin: 0; padding: 0 6px; border: 0; border-radius: 0;
  background: transparent; color: var(--text); font-size: .74rem; font-weight: 700; white-space: nowrap; }
.pi-side .makes-chip:hover { background: var(--accent-soft); color: var(--accent); }
.pi-side .plan-x { flex: 1; width: 100%; height: auto; min-height: 30px; border-radius: 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 9%, transparent); }
.pi-side .plan-x:hover { background: var(--del); color: var(--danger); }
.pi-side-x { width: 44px; }
.pi-side-x .plan-x { border-top: 0; }
@media (max-width: 640px) { .pi-side { width: 66px; } .pi-side .makes-chip { font-size: .7rem; padding: 0 4px; } .pi-side-x { width: 40px; } }
/* Meal planner: every day's header reads the same ("Wednesday  Nov 25"); today gets a banner on top of its card
   instead of a badge. Other days keep an invisible banner so all the cards still line up. */
.day.today .day-name::after { content: none; }
.today-banner { margin-bottom: -12px; padding: 6px 10px; border-radius: var(--radius) var(--radius) 0 0; text-align: center;
  background: var(--accent); color: var(--accent-text); font-size: .74rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; box-shadow: 0 0 0 1px var(--accent); position: relative; z-index: 1; }
.today-banner.tb-empty { visibility: hidden; }
.today-banner + .day.today { border-top-left-radius: 0; border-top-right-radius: 0; }
/* Narrow day cards: day and date always on one line, the day's totals underneath (the same on every day) */
.day-head > div { white-space: nowrap; }
@media (max-width: 640px) { .day-head { flex-direction: column; align-items: flex-start; gap: 2px; } }
/* The day bars start where the cards do, below the Today banner's row */
.today-banner { box-sizing: border-box; height: 28px; line-height: 16px; }
.week-arrow { top: calc(10px + 28px); }
@media (max-width: 640px) { .week-arrow { top: calc(8px + 28px); } }
/* Making N: a quiet hover (no orange or red), just a slightly darker strip */
.pi-side .makes-chip:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
/* Meal rows are stretched (by script) so each starts at the same height on every day; their content stays at the top */
.day .slot { align-content: start; box-sizing: border-box; }
/* Notes (no "Making"): the same strip width as every meal, the whole strip is the remove × */
.pi-side.pi-side-x { width: 76px; }
.pi-side-x .plan-x { border-top: 0; }
@media (max-width: 640px) { .pi-side.pi-side-x { width: 66px; } }
/* Meal cards: picture and text both start at the top, so every recipe name starts level with the top of its picture */
.plan-item > .pi-thumb, .plan-item > .pi-text { align-self: start; }
.plan-item .pi-title { line-height: 1.2; margin-top: -1px; }
/* Dragging the week: the row stops just short of the bars (cards never slide underneath them) and the cards fade
   out softly at its edges instead of being cut off. */
@media (min-width: 641px) {
  .week-wrap { padding: 0 28px; }
  .week { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%); }
}
/* Meal planner: "Shop for" joined to a − 1 week + selector (one pill: orange button on the left) */
.plan-shop { display: inline-flex; align-items: stretch; border-radius: 999px; overflow: hidden; border: 1px solid var(--accent);
  background: var(--surface); flex: none; }
.shop-go { border: 0; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 700; font-size: .9rem;
  padding: 0 14px 0 16px; cursor: pointer; white-space: nowrap; min-height: 36px; }
.shop-go:hover { filter: brightness(1.06); }
.shop-weeks { display: flex; align-items: center; gap: 2px; padding: 0 4px; }
.shop-weeks span { min-width: 4.4em; text-align: center; font-weight: 700; font-size: .86rem; white-space: nowrap; }
.shop-weeks button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; }
.shop-weeks button:hover:not(:disabled) { background: var(--accent-soft); }
.shop-weeks button:disabled { opacity: .4; cursor: default; }
/* Header: household icon beside the bell, with how many people (2 and up) in a small neutral badge */
#houseBtn { position: relative; }
.house-count { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: .7rem; font-weight: 800; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); }
.house-count[hidden] { display: none; }
.house-pill { margin-top: 4px; }
/* − / + in every stepper: drawn as two centered lines instead of text characters (which sat a little low and
   off-center in the round buttons). The first button is always −, the last always +. */
.serves-pill button, .shop-weeks button { position: relative; font-size: 0; color: var(--text); padding: 0; }
.serves-pill button::before, .shop-weeks button::before,
.serves-pill button:last-of-type::after, .shop-weeks button:last-of-type::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px;
  border-radius: 1px; background: currentColor; }
.serves-pill button:last-of-type::after, .shop-weeks button:last-of-type::after { width: 2px; height: 12px; margin: -6px 0 0 -1px; }

/* Household profiles sheet */
.prof-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.prof-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 12px 4px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; }
.prof-tab .ico { width: 20px; height: 20px; stroke-width: 2.2; }
.prof-tab[aria-selected=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.prof-size { margin-left: auto; }
.prof-form { display: grid; gap: 12px; }
.prof-form input:not([type=radio]), .prof-form select { width: 100%; }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.prof-pair { display: flex; gap: 8px; align-items: center; }
.prof-pair label { display: flex; align-items: center; gap: 6px; flex: 1; }
.prof-pair input { min-width: 0; }
.prof-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.prof-colors button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c);
  box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.prof-colors button[aria-checked=true] { box-shadow: 0 0 0 2px var(--text); }
/* Household members in Settings */
.house-members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* Household profile: daily goals; planner: the goal line in each day's nutrition box */
.prof-goals { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 8px; }
.prof-est { font-size: .82rem; margin: 0; }
.dn-goal { display: grid; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: .8rem; }
.dg-who { font-weight: 700; color: var(--muted); font-size: .76rem; }
.dg-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 42px; gap: 8px; align-items: center; }
.dg-label { font-weight: 600; }
.dg-bar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dg-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--dg, #9aa3ad); }
.dg-over { position: absolute; left: 80%; top: 0; bottom: 0; background: color-mix(in srgb, var(--dg, #9aa3ad) 70%, #000); }
.dg-mark { position: absolute; left: 80%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; }
.dg-pct { text-align: right; font-weight: 800; color: var(--dg-text, var(--text)); }
.dg-ok { --dg: #3f9a5a; --dg-text: var(--ok); }
.dg-low { --dg: #9aa3ad; }
.dg-high { --dg: #d9952b; --dg-text: #b4741a; }

/* ---- Household profile box, polished ---- */
.prof-title { margin: 0 0 12px; }
.prof-people { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.prof-tabs { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.prof-size { margin-left: 0; }
.prof-size span { font-size: .86rem; white-space: nowrap; padding: 0 4px; }
.prof-form { gap: 16px; }
.prof-sec { display: grid; gap: 12px; }
.prof-h { margin: 0; font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.prof-form .field { display: grid; gap: 5px; }
.prof-form .field > span { margin: 0; }
.prof-form input[type=text], .prof-form select { min-height: 44px; }
.prof-body { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, .9fr); gap: 10px; align-items: end; }
.prof-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
/* a number box with its unit inside, on the right */
.unit-input { position: relative; display: block; min-width: 0; }
.unit-input input { width: 100%; min-height: 44px; padding-right: 38px; -moz-appearance: textfield; appearance: textfield; }
.unit-input input::-webkit-outer-spin-button, .unit-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-input .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem;
  font-weight: 600; pointer-events: none; }
.prof-form .store-pick { display: flex; width: 100%; }
.prof-form .store-pick button { flex: 1; padding: 8px 6px; white-space: nowrap; }
.prof-colors { gap: 10px; }
.prof-colors button { width: 32px; height: 32px; }
.prof-colors button[aria-checked=true] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.prof-goals { padding: 14px; border-radius: 16px; background: var(--surface-2); }
.prof-goals .unit-input input { background: var(--surface); }
.prof-est { font-size: .82rem; line-height: 1.45; margin: 0; }
@media (max-width: 420px) {
  .prof-body { grid-template-columns: 1fr 1fr; }
  .prof-body > .field:first-child { grid-column: 1 / -1; }
}

/* Pop-up boxes: a thin rounded scrollbar that stays inside the box's rounded corners */
.sheet::-webkit-scrollbar { width: 12px; }
.sheet::-webkit-scrollbar-track { background: transparent; margin: 22px 0; }
.sheet::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 999px;
  border: 4px solid transparent; background-clip: padding-box; }
.sheet::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 35%, transparent); }
@supports not selector(::-webkit-scrollbar) { .sheet { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 22%, transparent) transparent; } }

/* Household profile: Body grid (height + weight, then age + sex), the compact sex choice, and the 1-10 activity scale */
.prof-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.act-scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.act-scale button { height: 38px; border: 0; border-radius: 10px; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer;
  background: var(--surface-2); color: var(--muted); transition: background .15s ease, color .15s ease, transform .1s ease; }
.act-scale button:hover { color: var(--text); }
.act-scale button.on { color: #fff; background: color-mix(in srgb, var(--accent) calc(35% + var(--i, 0) * 6.5%), #f0c9a8); }
.act-scale button[aria-checked=true] { background: var(--accent); color: var(--accent-text); transform: scale(1.06);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent); }
.act-scale button:nth-child(1) { --i: 1; } .act-scale button:nth-child(2) { --i: 2; } .act-scale button:nth-child(3) { --i: 3; }
.act-scale button:nth-child(4) { --i: 4; } .act-scale button:nth-child(5) { --i: 5; } .act-scale button:nth-child(6) { --i: 6; }
.act-scale button:nth-child(7) { --i: 7; } .act-scale button:nth-child(8) { --i: 8; } .act-scale button:nth-child(9) { --i: 9; }
.act-scale button:nth-child(10) { --i: 10; }
.act-now { font-size: .9rem; margin-top: 2px; }
.act-now strong { color: var(--accent); }
.act-now span { color: var(--muted); }
@media (max-width: 420px) { .act-scale { gap: 3px; } .act-scale button { height: 34px; font-size: .8rem; border-radius: 8px; } }
@media (max-width: 420px) { .prof-body > .field:first-child { grid-column: auto; } }

/* Household profile: Sex as a box like the Age box beside it, with a small app-style menu */
.prof-sexbox { width: 100%; }
.prof-select { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 45px;
  padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.prof-select:hover { border-color: var(--muted); }
.prof-select[aria-expanded=true] { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.prof-select .chev { width: 18px; height: 18px; flex: none; color: var(--muted); transition: transform .15s ease; }
.prof-select[aria-expanded=true] .chev { transform: rotate(180deg); }
.prof-sex-menu { left: 0; right: 0; min-width: 0; }
.prof-sex-menu a { display: flex; align-items: center; gap: 8px; }
.prof-sex-menu .ps-check { width: 18px; flex: none; display: grid; place-items: center; color: var(--accent); visibility: hidden; }
.prof-sex-menu .ps-check .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.prof-sex-menu a[aria-checked=true] .ps-check { visibility: visible; }
/* the day's amount and the goal, under each goal bar */
.dg-row { row-gap: 2px; }
.dg-amt { grid-column: 2 / -1; font-size: .74rem; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-amt strong { color: var(--text); font-weight: 700; }

/* ---- Meal planner per person: Viewing switcher, meals someone isn't eating, the "Who's eating" box ---- */
.plan-view { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pv-label { font-weight: 700; font-size: .9rem; margin-right: 2px; }
.pv-chip { min-height: 36px; }
.pv-chip[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.plan-item.pi-off .pi-thumb, .plan-item.pi-off .pi-text { opacity: .45; }
.who-list { display: grid; gap: 8px; }
.who-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.who-toggle { flex: 1; min-width: 0; justify-content: flex-start; }
.who-toggle > span:not(.who-box) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-box { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--border); flex: none; }
.who-box .ico { width: 15px; height: 15px; stroke-width: 2.8; color: var(--accent-text); visibility: hidden; }
.who-toggle[aria-checked=true] { border-color: var(--accent); }
.who-toggle[aria-checked=true] .who-box { background: var(--accent); border-color: var(--accent); }
.who-toggle[aria-checked=true] .who-box .ico { visibility: visible; }
.who-row.off .serves-pill { opacity: .4; }
.who-row .serves-pill span { min-width: 6.2em; text-align: center; }
.who-total { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }
.prof-portion { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prof-portion small { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.prof-portion .serves-pill span { min-width: 6.2em; text-align: center; }

/* Meal planner: Viewing is one fixed-width selector (it doesn't grow or move as people are added) */
.pv-select { display: inline-flex; align-items: center; gap: 8px; width: 190px; height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit;
  font-weight: 700; font-size: .9rem; cursor: pointer; }
.pv-select:hover { border-color: var(--muted); }
.pv-select[aria-expanded=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pv-select > .ico:first-child { width: 20px; height: 20px; stroke-width: 2.2; flex: none; }
.pv-select #pvNow { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-select .chev { width: 16px; height: 16px; flex: none; color: var(--muted); transition: transform .15s ease; }
.pv-select[aria-expanded=true] .chev { transform: rotate(180deg); }
.pv-menu { min-width: 220px; }
.pv-menu a { display: flex; align-items: center; gap: 10px; }
.pv-menu a > .ico { width: 20px; height: 20px; stroke-width: 2.2; flex: none; }
.pv-menu a > span:not(.pv-check) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-check { display: grid; place-items: center; width: 18px; flex: none; color: var(--accent); visibility: hidden; }
.pv-check .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.pv-menu a[aria-checked=true] .pv-check { visibility: visible; }
.pv-menu a[aria-checked=true] { background: var(--accent-soft); }
/* Menus: the first item gets focus when a menu opens; only show that as a highlight when using the keyboard,
   so only the hovered or chosen item is filled */
.menu a:focus:not(:focus-visible):not(:hover) { background: transparent; }
.pv-menu a[aria-checked=true], .pv-menu a[aria-checked=true]:focus:not(:focus-visible) { background: var(--accent-soft); }
.menu a:hover:not([aria-checked=true]) { background: var(--surface-2); }

/* Pantry: an open date group's items sit in a tinted box that starts under the date text, with white to its left */
.exp-group { --eg-bg: var(--surface-2); --eg-indent: 32px; }
.exp-group.eg-soon { --eg-bg: var(--warn-soft); }
.exp-group.eg-expired { --eg-bg: var(--del); }
.exp-group, .exp-group.eg-soon, .exp-group.eg-expired { background: none; }
.exp-group .eg-line { background: var(--eg-bg); }
.exp-group.open .eg-line { border-bottom-right-radius: 0; }
.exp-group .pantry-items { margin-left: var(--eg-indent); padding: 0 12px 4px; background: var(--eg-bg); border-radius: 0 0 14px 14px; }
@media (max-width: 400px) { .exp-group { --eg-indent: 28px; } }

/* Recipe cover: the photo credit is a small frosted pill on the bottom-left corner, like "Change photo" on the right */
.cover-wrap .cover-credit { position: absolute; left: 10px; bottom: 10px; margin: 0; display: inline-flex; align-items: center; gap: 6px;
  max-width: calc(100% - 170px); min-height: 30px; padding: 4px 12px 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  color: rgba(255, 255, 255, .92); background: rgba(20, 14, 8, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; }
.cover-credit .ico { width: 14px; height: 14px; flex: none; opacity: .85; }
.cover-credit a, .cover-credit span { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cover-credit a:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.cover-credit .cc-dot { flex: none; opacity: .6; }

/* Recipe: the web page it came from, as a small card instead of a bare underlined link */
.source-link { display: flex; align-items: center; gap: 12px; max-width: 360px; margin: 16px 0 4px; padding: 10px 14px 10px 10px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color .15s ease, background .15s ease; }
.source-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.source-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sl-ico { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--surface-2);
  color: var(--accent); }
.sl-ico .ico { width: 20px; height: 20px; }
.sl-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.sl-text strong { font-size: .9rem; }
.sl-text small { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-link > .ico { width: 16px; height: 16px; flex: none; color: var(--muted); }
.source-link:hover > .ico { color: var(--accent); }

/* Recipes: meal chips are filters; the ones that are on turn orange */
.section-chips .chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.section-chips .chip[aria-pressed=true] span { color: inherit; opacity: .85; }
.section-chips .chip[aria-pressed=true]:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: color-mix(in srgb, var(--accent) 88%, #000); }
.meal-section[hidden] { display: none; }

/* Recipes: expand button (top-left of each recipe) opens its recipe card big, and it stays until closed */
.expand-btn { position: absolute; top: 10px; left: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(20, 14, 8, .38);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .15s ease, background .15s ease; }
.expand-btn .ico { width: 18px; height: 18px; stroke-width: 2.4; }
.expand-btn:hover { transform: scale(1.08); background: rgba(20, 14, 8, .55); }
.expand-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.card-view { pointer-events: auto; z-index: 60; cursor: zoom-out; }
.card-view img { cursor: default; }
.cv-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .16); }
.cv-close:hover { background: rgba(255, 255, 255, .28); }
.cv-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cv-close .ico { width: 22px; height: 22px; stroke-width: 2.4; }

/* Recipe page: the expand button sits on the card's top-left corner */
.card-stage { position: relative; max-width: 900px; }
.card-stage > .expand-btn { top: 24px; left: 10px; z-index: 2; }
/* Recipe page: on a computer, the expand button only shows while the mouse is over the card (always on touch screens) */
@media (hover: hover) and (pointer: fine) {
  .card-stage > .expand-btn { opacity: 0; transition: opacity .15s ease, transform .15s ease, background .15s ease; }
  .card-stage:hover > .expand-btn, .card-stage > .expand-btn:focus-visible { opacity: 1; }
}

/* Photo picker: "Remove photo" is a button beside the others, in red */
.picker-actions:has(.remove-cover) { grid-template-columns: 1fr 1fr auto; }
.picker-actions .btn.remove-cover { justify-self: stretch; font-size: .9rem; color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.picker-actions .btn.remove-cover:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: var(--danger); }
@media (max-width: 520px) { .picker-actions:has(.remove-cover) { grid-template-columns: 1fr 1fr; }
  .picker-actions .btn.remove-cover { grid-column: 1 / -1; } }

/* Photo picker: the share note sits right under "My own picture", in its column, in smaller type */
.picker-actions .share-check { grid-column: 1; grid-row: 2; margin: 0; padding: 0 2px; font-size: .76rem; line-height: 1.3;
  align-items: flex-start; gap: 7px; }
.picker-actions .share-check input { width: 16px; height: 16px; margin-top: 1px; }
.picker-actions { row-gap: 6px; }
@media (max-width: 520px) { .picker-actions .btn.remove-cover { grid-row: 3; margin-top: 4px; } }

/* Shop sheet with several recipes: their names, up to three lines */
.shop-for .sf-names { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.sf-wait { font-size: .85rem; margin: 10px 0 0; }

/* Meal planner: the week arrows sit right beside the dates */
.week-nav { justify-content: center; gap: 14px; }
.week-nav .week-title { flex: 0 1 auto; min-width: 0; padding: 0 4px; }

/* Making box: every row (each person, and Extra for leftovers) is a name box plus a stepper of the same width,
   so the boxes and steppers line up whatever the number says */
.who-list { display: grid; gap: 8px; }
.who-row .serves-pill { flex: none; }
.who-row .serves-pill > span { flex: none; width: 7.4em; min-width: 0; padding: 0; text-align: center; white-space: nowrap; }
.who-extra { margin-top: 8px; }
.who-label { flex: 1; min-width: 0; justify-content: flex-start; cursor: default; color: var(--muted); font-weight: 600;
  background: var(--surface-2); border-color: transparent; }
.who-label .ico { color: var(--muted); }
.who-label > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-toggle > span:not(.who-box) { text-align: left; }

/* Nutrition: the footnote is a quiet line, and "Estimate again" is a small button */
.nut-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.nut-foot .nut-note { margin: 0; flex: 1 1 220px; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.nut-redo { flex: none; gap: 6px; }
.nut-redo .ico { width: 16px; height: 16px; }

/* Cooking mode: full screen, one step at a time, big text */
body.cooking { overflow: hidden; }
.cook { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.cook-top { display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top) + 8px) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border); background: var(--surface); }
.cook-title { flex: 1; min-width: 0; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.cook-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid transparent;
  background: none; color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cook-ico:hover { background: var(--surface-2); }
.cook-ico .ico { width: 22px; height: 22px; }
.cook-ico.on { background: var(--accent); color: var(--accent-text); }
.cook-timers { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cook-timers[hidden] { display: none; }
.cook-timer { flex: none; display: flex; align-items: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.cook-timer button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; display: flex; align-items: center; }
.ct-main { gap: 6px; padding: 6px 4px 6px 12px; min-height: 40px; }
.ct-main .ico { width: 18px; height: 18px; }
.ct-time { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: left; }
.ct-label { color: var(--muted); font-size: .85rem; }
.cook-timer .ct-x { padding: 6px 10px 6px 6px; min-height: 40px; color: var(--muted); }
.ct-x .ico { width: 16px; height: 16px; }
.cook-timer.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); animation: cook-pulse 1s ease-in-out infinite; }
.cook-timer.done .ct-label, .cook-timer.done .ct-x { color: var(--accent-text); }
@keyframes cook-pulse { 50% { transform: scale(1.05); } }
.cook-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px; }
.cook-page { max-width: 760px; margin: 0 auto; padding: 24px 0 32px; }
.cook-page h1 { font-family: var(--serif); margin: 0 0 16px; font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); }
.cook-count { color: var(--accent); font-weight: 700; letter-spacing: .02em; margin-bottom: 10px; }
.cook-text { font-size: clamp(1.4rem, 1.05rem + 1.6vw, 2.1rem); line-height: 1.45; margin: 0 0 24px; }
.cook-tbtn { display: inline-flex; align-items: center; gap: .25em; font: inherit; color: var(--accent); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 10px; padding: 0 .3em; margin: 0 .05em; cursor: pointer; line-height: 1.3; }
.cook-tbtn .ico { width: .85em; height: .85em; flex: none; }
.cook-tbtn.on { background: var(--accent); color: var(--accent-text); }
.cook-sub { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 700; margin: 18px 0 8px;
  padding-top: 14px; border-top: 1px solid var(--border); }
.cook-ings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cook-ings li { font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.cook-hint { color: var(--muted); font-size: .85rem; margin: 26px 0 0; text-align: center; }
@media (hover: hover) and (pointer: fine) { .cook-hint { display: none; } }
.cook-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.cook-fact { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.cook-fact small { display: block; color: var(--muted); font-size: .8rem; }
.cook-fact strong { font-size: 1.1rem; }
.cf-ico { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.cf-ico .ico { width: 22px; height: 22px; }
.cook-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cook-ing-head { font-weight: 700; color: var(--muted); margin: 8px 0 0; }
.cook-check { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; font-size: 1.1rem; -webkit-tap-highlight-color: transparent; }
.cook-check input { position: absolute; opacity: 0; pointer-events: none; }
.cc-box { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; }
.cc-box .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.cook-check input:checked + .cc-box { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.cook-check input:checked ~ .cc-text { color: var(--muted); text-decoration: line-through; }
.cook-check input:focus-visible + .cc-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.cook-nav { display: flex; align-items: center; gap: 12px; padding: 10px max(12px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 10px) max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--border); background: var(--surface); }
.cook-nav[hidden] { display: none; }
.cook-nav .btn { min-height: 56px; font-size: 1.05rem; padding: 10px 20px; }
.cook-nav .btn .ico { width: 20px; height: 20px; }
.cook-back { flex: none; width: 120px; }
.cook-next { flex: none; width: 180px; }
.cook-back:disabled { opacity: .4; cursor: default; }
.cook-progress { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cook-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
@media (max-width: 480px) { .cook-back { width: 96px; padding: 10px 12px; } .cook-next { width: 150px; padding: 10px 12px; } .cook-nav { gap: 8px; } }
.cook-finish { text-align: center; max-width: 520px; }
.cook-done { width: 72px; height: 72px; margin: 8px auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.cook-done .ico { width: 38px; height: 38px; stroke-width: 2.4; }
.cook-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 18px; }
.cook-stars button { width: 52px; height: 52px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%; }
.cook-stars button .ico { width: 34px; height: 34px; }
.cook-stars .ico.filled { fill: #e0a100; stroke: #e0a100; }
.cook-note { text-align: left; display: block; }
.cook-note textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; }
.cook-pantry { text-align: left; }
.cook-finish .btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.cook-list ol { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.cook-list li button { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.cook-list li button.on { border-color: var(--accent); background: var(--accent-soft); }
.cl-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: .85rem; }
.cl-n .ico { width: 15px; height: 15px; }
.cook-cards { display: grid; gap: 12px; }
.cook-cards img { width: 100%; height: auto; border-radius: 12px; display: block; }
/* Cooking mode: with a mouse, the side of a step you'd tap (left 30% back, the rest next) is shaded */
.cook-main.zone-back, .cook-main.zone-next { cursor: pointer; }
.cook-main.zone-back { background: linear-gradient(to right, color-mix(in srgb, var(--text) 7%, transparent) 30%, transparent 30%); }
.cook-main.zone-next { background: linear-gradient(to right, transparent 30%, color-mix(in srgb, var(--text) 7%, transparent) 30%); }
/* Cooking mode: timers big and centered, easy to read from across the kitchen */
.cook-timers { padding: 12px 16px; gap: 10px 12px; justify-content: center; flex-wrap: wrap; overflow: visible; }
.cook-timer { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.cook-timer .ct-main { gap: 10px; padding: 8px 6px 8px 18px; min-height: 60px; }
.cook-timer .ct-main .ico { width: 28px; height: 28px; color: var(--accent); }
.cook-timer .ct-time { font-size: 2rem; line-height: 1; color: var(--accent); min-width: 2.9em; }
.cook-timer .ct-label { font-size: .95rem; }
.cook-timer .ct-x { padding: 8px 16px 8px 8px; min-height: 60px; }
.cook-timer .ct-x .ico { width: 20px; height: 20px; }
.cook-timer.done .ct-main .ico, .cook-timer.done .ct-time { color: var(--accent-text); }
@media (max-width: 480px) { .cook-timer .ct-time { font-size: 1.6rem; } .cook-timer .ct-main { padding-left: 14px; } }
/* Cooking mode: the timer's clock face fills up as time passes */
.ct-clock { width: 38px; height: 38px; flex: none; }
.ct-face { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.ct-pie { fill: none; stroke: var(--accent); stroke-width: 13; transition: stroke-dasharray 1s linear; }
.cook-timer.done .ct-face, .cook-timer.done .ct-pie { stroke: var(--accent-text); }
@media (max-width: 480px) { .ct-clock { width: 32px; height: 32px; } }
/* Cooking mode: the recipe's cover photo beside its title */
.cook-cover { flex: none; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; margin-left: 4px; border: 1px solid var(--border); }
.cook-cover + .cook-title { padding-left: 8px; }
/* Cooking mode: the timer bar slides open and closed instead of jumping */
.cook-timers { display: grid; grid-template-rows: 0fr; padding: 0; gap: 0; overflow: hidden; border-bottom-color: transparent; background-clip: padding-box;
  transition: grid-template-rows .35s ease, border-color .35s; }
.cook-timers.open { grid-template-rows: 1fr; border-bottom-color: var(--border); }
.ct-row { min-height: 0; overflow: hidden; opacity: 0; transition: opacity .25s; }   /* no padding here, so it can close all the way */
.ct-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px; padding: 12px 16px; }
.cook-timers.open .ct-row { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cook-timers, .ct-row { transition: none; } }
/* Cooking mode: room for the scroll bar is always kept, so a long step starts at the same spot as a short one */
.cook-main { scrollbar-gutter: stable both-edges; }

/* Small action pills instead of underlined links */
.week-back { align-self: center; margin-top: 4px; gap: 4px; color: var(--muted); font-weight: 600; text-decoration: none; }
.week-back .ico { width: 15px; height: 15px; }
.list-done { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; }
.btn.tiny .ico { width: 15px; height: 15px; }
/* Pantry: the expiry date keeps its width; Estimate drops below it when the box is narrow */
.exp-input { flex-wrap: wrap; }
.exp-input input { flex: 1 1 150px; min-width: 150px; }
.exp-input .btn { gap: 4px; }
/* Meal planner: each meal's name on the left and its Add button on the right, the same on every row */
.slot, .slot:not(.filled) { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 6px; }
.slot:not(.filled) .slot-name { min-width: 0; }
.slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.slot:not(.filled) .slot-items { display: none; }
.slot-add { display: inline-flex; align-items: center; gap: 4px; justify-self: auto; flex: none; }
.slot-add .ico { width: 15px; height: 15px; }
/* Phones: one whole day at a time, with a row of day pills to jump between days */
.day-pills { display: none; }
@media (max-width: 640px) {
  .week > .day-col { flex-basis: 100%; }
  .week-wrap { padding: 0; margin: 0 -6px; }
  .week-arrow, .week-arrow[hidden] { display: none; }
  .day-pills { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: -6px 0 6px; }
  .day-pills button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0; border-radius: 12px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; }
  .day-pills small { font-size: .72rem; font-weight: 600; color: var(--muted); }
  .day-pills button.is-today { border-color: var(--accent); }
  .day-pills button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
  .day-pills button.on small { color: var(--accent-text); }
}
/* Recipes tab: sort menu (like the measurements menu) and the date each recipe was added */
.sort-menu { min-width: 210px; }
.sort-menu a { display: flex; align-items: center; gap: 8px; }
.sort-menu .um-check { width: 16px; flex: none; color: var(--accent); font-weight: 800; }
.sort-menu a:hover { background: var(--accent-soft); }
.sort-menu a[aria-checked=true] > span:last-child { font-weight: 800; }
.tile .t .added { font-size: .78rem; color: var(--muted); }
/* Recipe tiles: the title always takes two lines (longer ones end in …), so calories, date and tags line up across a row */
.tile .t strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  line-height: 1.25; min-height: 2.5em; }
/* Phones: tabs, Add, Select, Sort and Filter all fit on one row */
@media (max-width: 400px) {
  .tabs-row { gap: 4px; }
  .tabs-row .tabs .tab-link { padding-left: 8px; padding-right: 8px; }
  .list-tools { gap: 4px; }
  .list-tools .btn.small { width: 34px; min-height: 34px; }
}
/* Household: Add person and Remove buttons */
.prof-add { gap: 4px; flex: none; }
.prof-add .ico, .prof-remove .ico { width: 16px; height: 16px; }
.prof-remove { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.prof-remove .btn { gap: 6px; color: var(--danger); }
.prof-remove .btn:hover { border-color: var(--danger); background: var(--del); }
/* Settings → Cookware: ticked equipment is orange (switched on), not the red allergy look */
#cookChips .allergy-chip[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* Meal planner: Clear (header menu, and a small trash button on each day that has meals) */
.plan-clear-btn { gap: 6px; }
.plan-clear-btn .ico { width: 16px; height: 16px; }
.clear-menu { min-width: 220px; }
.day-head { position: relative; padding-right: 36px; }
.day-clear { position: absolute; top: -4px; right: -4px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  border: 0; background: none; color: var(--muted); cursor: pointer; }
.day-clear .ico { width: 17px; height: 17px; }
.day-clear:hover { background: var(--del); color: var(--danger); }
/* Meal planner: leftovers eaten on a later day, and "Make full recipe" */
.pi-left { display: inline-block; margin-top: 3px; font-size: .72rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; }
.full-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; }
.full-row .btn { gap: 6px; flex: none; }
.full-row .btn .ico { width: 16px; height: 16px; }
.full-row small { flex: 1 1 200px; font-size: .8rem; }
.who-used { font-size: .85rem; margin: 4px 0 0; }
.who-over { color: var(--danger); font-weight: 700; }
.pick-tag { margin-left: auto; flex: none; font-size: .72rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 2px 8px; }
/* Meal planner: meals that aren't recipes open a box for who's eating and their nutrition */
.pi-note { display: block; text-align: left; border: 0; background: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; min-width: 0; }
.pi-note .pi-title { display: block; font-weight: 700; }
.pi-note .pi-meta { display: block; }
.pi-note:hover .pi-title { color: var(--accent); }
.pi-add-nut { color: var(--accent); font-weight: 700; }
.plan-noimg .ico { width: 22px; height: 22px; color: var(--muted); }
.nut-ways { display: flex; gap: 8px; flex-wrap: wrap; }
.nut-ways .btn { gap: 6px; }
.nut-ways .btn .ico, #nEstimate .ico { width: 16px; height: 16px; }
.nut-hint { font-size: .82rem; margin: 6px 0 0; }
#nPaste { display: grid; gap: 8px; margin-top: 10px; }
#nPaste[hidden] { display: none; }
#nPaste textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); resize: vertical; }
#nPaste .btn { justify-self: start; gap: 6px; }
.nut-what { font-size: .85rem; color: var(--muted); margin: 8px 0; min-height: 1.2em; }
.nut-fields { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
/* Meal plan → Cooking tab */
.plan-tabs { margin: 4px 0 14px; }
.cp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cp-head .muted, .cp-when { font-size: .86rem; color: var(--muted); }
.cp-when { font-weight: 700; }
.cp-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cp-day { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; border-radius: 14px; min-height: 92px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cp-day:hover { border-color: var(--accent); }
.cp-day.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cp-dn { font-weight: 800; }
.cp-dn small { color: var(--muted); font-weight: 600; }
.cp-times { display: grid; gap: 2px; font-size: .82rem; }
.cp-own { font-size: .7rem; font-weight: 700; color: var(--accent); }
@media (max-width: 760px) {
  .cp-days { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .cp-day { flex-direction: row; align-items: center; min-height: 0; padding: 10px 12px; gap: 12px; }
  .cp-dn { width: 64px; flex: none; }
  .cp-times { flex: 1; grid-auto-flow: column; justify-content: start; gap: 10px; }
}
.cp-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0;
  border-top: 1px solid var(--border); }
.cp-item:first-of-type { border-top: 0; }
.cp-text { display: grid; gap: 2px; min-width: 0; }
.cp-text small { color: var(--muted); font-size: .82rem; }
.cp-text .cp-hint { color: var(--warn); }
.cp-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cp-acts .btn { gap: 6px; }
.cp-acts .btn .ico { width: 16px; height: 16px; }
@media (max-width: 560px) {
  .cp-item { grid-template-columns: 48px minmax(0, 1fr); }
  .cp-acts { grid-column: 1 / -1; justify-content: flex-start; padding-left: 60px; }
}
.cp-window.is-today { border-color: var(--accent); }
.cp-none h2 { color: var(--warn); }
.ch-ranges { display: grid; gap: 8px; margin-bottom: 10px; }
.ch-range { display: flex; align-items: center; gap: 8px; }
.ch-range input { flex: 1; min-width: 0; }
.cp-moves { display: grid; gap: 6px; }
/* Week header (Meals and Cooking): the arrows never move, whatever the dates; the second line is always the same height */
.week-nav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px;
  width: min(100%, 520px); margin: 0 auto 16px; }
.week-nav .week-title { flex: none; padding: 0; min-width: 0; align-items: center; gap: 4px; }
.week-title strong { line-height: 1.25; }
.week-title .week-now, .week-title .week-back { height: 30px; margin: 0; box-sizing: border-box; display: inline-flex; align-items: center; }
/* Cooking times: a week calendar (like Outlook) — hours down the side, a column per day, orange blocks when you can cook */
.cg-mode button { padding: 6px 14px; font-size: .86rem; }
.cg-help { font-size: .85rem; margin: 0 0 10px; }
.cg { --row: 15px; user-select: none; -webkit-user-select: none; }
.cg-head, .cg-body { display: grid; grid-template-columns: 46px repeat(7, minmax(0, 1fr)); }
.cg-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-bottom: 4px; }
.cg-dh { position: relative; text-align: center; font-weight: 800; font-size: .85rem; padding: 4px 0; border-radius: 10px; }
.cg-dh small { color: var(--muted); font-weight: 600; }
.cg-dh.is-today { color: var(--accent); }
.cg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: 2px; }
.cg-times { display: grid; grid-template-rows: repeat(calc(var(--rows) / 2), calc(var(--row) * 2)); }
.cg-times span { font-size: .7rem; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-.55em); white-space: nowrap; }
.cg-col { display: grid; grid-template-rows: repeat(var(--rows), var(--row)); border-left: 1px solid var(--border); cursor: cell; touch-action: pan-y; }
.cg-col:last-child { border-right: 1px solid var(--border); }
.cg-col.is-today { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cg-cell { position: relative; border-top: 1px dashed color-mix(in srgb, var(--border) 60%, transparent); }
.cg-cell.hr { border-top: 1px solid var(--border); }
.cg-cell.on { background: var(--accent); border-top-color: transparent; margin: 0 3px; }
.cg-cell.on.first { border-radius: 6px 6px 0 0; }
.cg-cell.on.last { border-radius: 0 0 6px 6px; }
.cg-cell.on.first.last { border-radius: 6px; }
.cg-lbl { position: absolute; left: 4px; right: 2px; top: 1px; z-index: 1; font-size: .68rem; font-weight: 700; line-height: 1.15;
  color: var(--accent-text); overflow: hidden; white-space: normal; pointer-events: none; }
.cg-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cg-acts .btn { gap: 6px; }
.cg-acts .btn .ico { width: 16px; height: 16px; }
@media (max-width: 560px) { .cg { --row: 18px; } .cg-head, .cg-body { grid-template-columns: 34px repeat(7, minmax(0, 1fr)); }
  .cg-times span { font-size: .62rem; padding-right: 4px; } .cg-cell.on { margin: 0 1px; } .cg-lbl { font-size: .6rem; left: 2px; } }
/* Clear meals pop-up: day chips with meal counts, then the week and the month */
.clear-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.clear-days .day-chip { min-width: 0; }
.clear-days .day-chip:disabled { opacity: .4; cursor: default; }
.clear-opts { display: grid; gap: 6px; }
.clear-opts .pick-recipe:disabled { opacity: .5; cursor: default; }
.clear-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.clear-ico .ico { width: 20px; height: 20px; }
a.left-item { text-decoration: none; color: inherit; box-sizing: border-box; }
/* Cooking times calendar: the day names stay at the very top of the pop-up while you scroll (nothing peeks
   above them), and the bottom line is labeled 12 am */
.sheet .cg-head { top: -24px; padding-top: 8px; margin-top: -8px; }
.cg-times { position: relative; }
.cg-times .cg-end { position: absolute; right: 0; bottom: 0; transform: translateY(.55em); }
.cg-body { padding-bottom: 12px; }
/* Cooking times calendar: room above the first hour so its label isn't cut off */
.cg-body { padding-top: 10px; }
.cg-head { padding-bottom: 0; }
/* Cooking tab: the same day cards as Meals; each cooking time is a row like a meal, with what to cook in it */
.cp-tool { gap: 6px; }
.cp-tool .ico { width: 16px; height: 16px; }
.cook-slot .slot-name { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.cook-slot .slot-name .ico { width: 15px; height: 15px; color: var(--accent); }
.cw-used { font-size: .78rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.cook-none-day { font-size: .88rem; margin: 10px 0 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.cook-day .day-clear:hover { background: var(--accent-soft); color: var(--accent); }
.cook-item .pi-side a.makes-chip { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.cook-item .pi-side .cook-go { color: var(--accent); }
.cook-item .pi-side .cook-move .ico { width: 16px; height: 16px; }
.cook-item .pi-side .cook-move:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
/* Meals with no cooking time yet: quiet, at the bottom of their day */
.cook-later { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.cl-head { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.cl-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; padding: 4px 0; border: 0; background: none;
  font: inherit; color: var(--muted); text-align: left; cursor: pointer; }
.cl-row span { font-size: .86rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-row small { flex: none; font-size: .75rem; }
.cl-row:hover span, .cl-row:hover small { color: var(--accent); }
.cp-hint { font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
/* Meal nutrition: the description box is always there, with Photo and Send beside it (nothing opens or jumps) */
.nut-ask { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.nut-ask textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); resize: none; min-height: 84px; }
.nut-ask-btns { display: flex; flex-direction: column; gap: 6px; }
.nut-ask-btns .btn { gap: 6px; justify-content: flex-start; }
.nut-ask-btns .ico { width: 16px; height: 16px; }
@media (max-width: 420px) { .nut-ask { grid-template-columns: minmax(0, 1fr); } .nut-ask-btns { flex-direction: row; } }
/* Week title: the long form ("November 30 – December 6") on computers, the short one on phones, always one line */
.week-title .wt-short { display: none; }
@media (max-width: 480px) { .week-title .wt-long { display: none; } .week-title .wt-short { display: inline; } .week-title strong { white-space: nowrap; } }
/* Phones: the Cooking tab's two buttons stack, so its days start at the same height as on the Meals tab
   (whose Viewing / Clear / Shop for take two rows there) */
@media (max-width: 480px) { .cp-tools { flex-direction: column; align-items: flex-start; flex-basis: 100%; } }
/* Cooking tab: inside a cooking time, food cooked ahead for another day gets its own quiet section */
.cook-ahead { display: flex; align-items: center; gap: 6px; margin: 10px 0 6px; padding-top: 8px; border-top: 1px dashed var(--border);
  font-size: .74rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.cook-ahead .ico { width: 14px; height: 14px; }
.cook-slot .slot-head + .cook-ahead { border-top: 0; padding-top: 0; margin-top: 4px; }
/* Line icons in shopping buttons, the add menu and the Fridge / Freezer / Pantry picker */
.store-pick button .ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
#copyBtn, .btn[href$="/pantry"] { gap: 6px; }
.kr-noimg .ico { width: 22px; height: 22px; color: var(--muted); }
/* Star ratings in half stars (outline, with the gold copy showing over half or all of it) */
.stars { display: inline-flex; gap: 1px; vertical-align: -2px; font-size: 15px; line-height: 1; }
.rs-star { position: relative; display: inline-block; width: 1em; height: 1em; flex: none;
  color: color-mix(in srgb, var(--muted) 70%, transparent); }
.rs-star .ico, .cook-stars button .ico { width: 1em; height: 1em; display: block; }
.rs-fill { position: absolute; top: 0; left: 0; width: 0; height: 100%; overflow: hidden; }
.rs-star.s1 .rs-fill { width: 50%; }
.rs-star.s2 .rs-fill { width: 100%; }
.rs-fill .ico { fill: #e0a100; stroke: #e0a100; }
.cook-stars .rs-star { font-size: 36px; }
.cook-stars { touch-action: none; cursor: pointer; }   /* slide a finger across to rate */
.cook-stars:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.cook-rate-text { margin: -6px 0 14px; font-size: .9rem; color: var(--muted); height: 22px; line-height: 22px; }   /* fixed height: nothing shifts as it fills in */
/* Line icons where emoji used to be: sized for each place */
.chip .meal-ico, .chip .ico { width: 16px; height: 16px; vertical-align: -3px; }
.sec-ico .meal-ico { width: 20px; height: 20px; }
.ph-icon .ico { width: 44px; height: 44px; opacity: .55; }
.slot-name .meal-ico { width: 15px; height: 15px; vertical-align: -3px; margin-right: 2px; }
.plan-noimg .ico { width: 22px; height: 22px; color: var(--muted); }
.empty .big .ico, .notif-empty .big .ico, div.big > .ico { width: 44px; height: 44px; color: var(--muted); stroke-width: 1.5; }
.notif-ico .ico { width: 16px; height: 16px; }
.lb-icon .ico { width: 26px; height: 26px; }
.shop-go { display: inline-flex; align-items: center; gap: 6px; }
.shop-go .ico { width: 17px; height: 17px; }
.menu a .ico { width: 18px; height: 18px; vertical-align: -4px; margin-right: 2px; color: var(--muted); }
.ico-inline { width: 1.05em; height: 1.05em; vertical-align: -2px; }
/* After cooking: Update your pantry? (use up everything, or choose items) */
.pantry-choice { display: grid; gap: 6px; }
.pantry-busy { min-height: 1.3em; margin: 10px 0 0; font-size: .88rem; }
/* A toast with an Undo button */
#toast { display: flex; align-items: center; gap: 12px; }
.toast-undo { border: 0; background: none; color: inherit; font: inherit; font-weight: 800; padding: 4px 6px; margin: -4px -8px -4px 0;
  border-radius: 8px; cursor: pointer; color: color-mix(in srgb, var(--accent) 55%, var(--bg)); }
/* Average rating under the recipe title, and the pop-up with every rating and note */
.rate-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 30px; margin: 0 0 10px; font-size: .92rem; }
.stars.rate-avg { font-size: 18px; gap: 2px; vertical-align: 0; }
.rate-line .btn { gap: 6px; }
.rate-num { font-variant-numeric: tabular-nums; }
.rate-sum { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.rate-sum > strong { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.rate-sum > div { display: grid; gap: 4px; justify-items: start; }
.rate-list { list-style: none; margin: 8px 0 0; padding: 0; }
.rate-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.rate-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.rate-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: .9rem; }
.rate-note { display: flex; gap: 8px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rate-note > span { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
.rate-note .ico { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--muted); }
.rate-note.none { padding: 0; background: none; color: var(--muted); font-size: .9rem; }
.rate-note.none .ico { margin-top: 2px; }
/* Recipes tab: the sort button is as wide as its longest name, so nothing moves when the order changes */
.sort-label { display: inline-grid; text-align: left; white-space: nowrap; }
.sort-label > span { grid-area: 1 / 1; visibility: hidden; }
.sort-label > .on { visibility: visible; }
/* Recipe tiles: your average rating under the title (empty stars when not rated) */
.tile-rate { display: flex; align-items: center; height: 16px; }
/* Add recipe pop-up: starts at the same spot near the top, so it only grows downward; its sections have no boxes of their own */
.sheet-wrap:has(> .add-pop) { place-items: start center; padding-top: 5dvh; }
.add-pop { max-height: 90dvh; }
.add-pop .panel:not(details) { background: none; border: 0; box-shadow: none; padding: 0; }
.add-pop .review { grid-template-columns: minmax(0, 1fr); }
.add-pop .review .orig { display: contents; }
.add-pop .review .orig > :first-child { order: 0; }
.add-pop .review > .panel { order: 1; }
.add-pop .review .orig > details { order: 2; margin-top: 0; }
.add-pop .loading { padding: 24px 16px; }
.add-pop .sticky-actions { bottom: -24px; margin: 16px -24px -24px; padding: 14px 24px; background: var(--surface);
  border-top: 1px solid var(--border); z-index: 5; }
.add-pop #createErr { flex: 1 0 100%; }
.add-pop #createErr:empty { display: none; }
@media (max-width: 760px) {
  .sheet-wrap:has(> .add-pop) { place-items: end stretch; padding: 0; }
  .add-pop { height: 92dvh; max-height: 92dvh; display: flex; flex-direction: column; }   /* one height: nothing moves between steps */
  .add-pop .sheet-body { flex: 1 0 auto; display: flex; flex-direction: column; }
  .add-pop .sticky-actions { bottom: -22px; margin: auto -18px -22px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); }
}
/* Messages show over pop-ups too */
#toast { z-index: 90; }
/* New shopping list pop-ups */
.lr-list { height: 46dvh; }
.pick-recipe > .lr-name { flex: 1; min-width: 0; }
.bl-items { height: 200px; overflow: auto; margin: 14px 0; border: 1px solid var(--border); border-radius: 12px; }
.bl-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); }
.bl-item > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bl-item small { color: var(--muted); margin-left: 8px; }
/* Plan pop-up: the meals are one row of equal tiles, matching the days above them */
.meal-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.meal-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 10px 4px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit;
  font-size: .85rem; font-weight: 600; line-height: 1.15; text-align: center; cursor: pointer; }
.meal-tile .ico { width: 24px; height: 24px; flex: none; margin: 0; color: var(--muted); }
.meal-tile:hover { background: var(--surface-2); }
.meal-tile[aria-checked=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.meal-tile[aria-checked=true] .ico { color: inherit; }
/* Pick recipes for a list: search with a Filter button; the filters take the list's place */
.lr-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lr-tools input { flex: 1; min-width: 0; }
.lr-tools .filter-btn { flex: none; position: relative; min-height: 44px; }
.lr-tools .filter-count { position: absolute; top: -6px; right: -4px; }
.lr-panel { display: flex; flex-direction: column; }
.lr-groups { flex: 1; min-height: 0; overflow: auto; }
.lr-groups .filter-group + .filter-group { margin-top: 10px; }
.lr-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
/* Add to pantry pop-up: room for the estimate note, so nothing moves when it shows */
.pantry-add .exp-reason { min-height: 2.9em; }
/* Pantry: Pantry / Fridge / Freezer filters (any number on, orange like the Recipes meal filters), with the plus at the height it has on other tabs */
.place-filter { display: flex; align-items: center; gap: 8px; min-height: 46px; }
.place-filter .chip { min-height: 40px; }
.place-filter .chip .ico { width: 16px; height: 16px; flex: none; }
.place-filter .chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
@media (max-width: 760px) { .place-filter { min-height: 44px; gap: 5px; } .place-filter .chip { padding: 7px 10px; gap: 5px; font-size: .84rem; } .tabs-row:has(.place-filter) { gap: 6px; } }
/* Accounts (database mode): sign-in screens, the account page and invites */
input[type=password] { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
html.signed-out :is(.nav-stack, .top-actions, .ai-fab) { visibility: hidden; }
html.accounts .share-check { display: none; }
.account-box { max-width: 440px; margin: 24px auto 0; }
.account-box h1 { margin-top: 0; }
.account-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-error { min-height: 1.4em; margin: 8px 0 0; color: var(--danger); font-size: .92rem; }
.long-word { overflow-wrap: anywhere; min-width: 0; }
.account-page { max-width: 640px; }
.account-line, .account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-row { min-height: 60px; padding: 8px 0; }
.account-row + .account-row { border-top: 1px solid var(--border); }
.account-row small { display: block; }
.account-row .btn, .account-line .btn { flex: none; }
.turn-right { transform: rotate(90deg); }
.invite-new { display: flex; gap: 10px; }
.invite-new input { flex: 1; min-width: 0; }
.invite-new .btn { flex: none; }
.invite-row > :first-child { flex: 1; }
.invite-state { flex: none; width: 76px; font-size: .88rem; color: var(--muted); }
.invite-state.joined { color: var(--ok); font-weight: 600; }
.invite-do { flex: none; width: 84px; text-align: right; }
/* Referral code (sign up, and a new invite) */
.code-input { text-transform: uppercase; letter-spacing: .06em; }
.invite-copy + .field { margin-top: 14px; }
/* Sign-in screens: the sentence above the box */
.tagline { max-width: 440px; margin: 8px auto 0; text-align: center; text-wrap: balance; font-size: 1.1rem; }
.tagline + .account-box { margin-top: 16px; }
/* Accounts: photos kept when a daily limit was reached, and the privacy policy and terms */
.kept-again { margin-top: 12px; }
.legal-line { margin: 0 0 12px; font-size: .92rem; color: var(--muted); }
.legal { max-width: 680px; margin: 0 auto; overflow-wrap: break-word; }
.legal h1 { margin: 0 0 10px; }
.legal h2 { margin: 26px 0 8px; font-size: 1.15rem; }
.legal p, .legal ul { margin: 0 0 12px; line-height: 1.55; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 6px; }
.legal a:not(.btn) { color: var(--accent); overflow-wrap: anywhere; }
.legal-draft { display: inline-block; margin: 0 0 14px; padding: 4px 12px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); font-size: .88rem; font-weight: 600; }
.legal-fill { background: var(--surface-2); border-radius: 6px; padding: 0 5px; }
.legal-nav { padding: 0 16px 32px; }

/* With accounts: the price of a paid action on its button (cost() in app.js) */
.cost { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 5px; border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-size: .8em; font-weight: 700; line-height: 1.45; white-space: nowrap; }
.cost .ico { width: 1.1em; height: 1.1em; }
.cost b { font-variant-numeric: tabular-nums; }
.btn .cost { margin-left: 2px; }
.btn.primary .cost, .tile-btn.primary .cost { background: rgba(255, 255, 255, .22); color: inherit; }
.action-tiles:has(.cost) .tile-btn { justify-content: flex-start; }      /* icons and words stay in line */
.tile-btn .cost { margin-top: -2px; font-size: .74rem; }
.menu a .cost { margin-left: 6px; vertical-align: 1px; }
.chat-send.priced { width: auto; padding: 0 12px 0 14px; border-radius: 23px; gap: 6px; }
/* Settings, with accounts: the history of credits */
.credit-history { margin: 4px 0 12px; }
.credit-history summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; padding: 6px 0; }
.credit-lines { list-style: none; margin: 4px 0 0; padding: 0; font-size: .9rem; }
.credit-lines li { display: grid; grid-template-columns: 4.5em minmax(0, 1fr) 4.5em; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--border); }
.credit-lines .ch-day { color: var(--muted); }
.credit-lines .ch-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.credit-lines .ch-out { color: var(--muted); }

/* Connecting Claude online: what it may do (account.js), and the connection in Settings */
.connect-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.connect-list li { display: flex; align-items: flex-start; gap: 10px; }
.connect-list .ico { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.connector-row { margin-top: 12px; border-top: 1px solid var(--border); }
.connector-row small { margin-top: 4px; }
