@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --accent: #0c7d5f;
  /* derived from --accent so ANY custom accent works */
  --accent-light: color-mix(in srgb, var(--accent) 13%, #ffffff);
  --grad-a: color-mix(in srgb, var(--accent) 82%, #ffffff);
  --grad-b: color-mix(in srgb, var(--accent) 86%, #000000);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --expired-bg: #fee2e2;
  --expired-text: #991b1b;
  --freezer-tint: #38bdf8;
  --pantry-tint: #f59e0b;
  --radius: 16px;
  --heading-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* dark mode (body.dark set by JS: manual choice or OS auto) */
body.dark {
  --bg: #0b1220;
  --card: #16202f;
  --text: #e2e8f0;
  --muted: #8fa3b8;
  --border: #26344a;
  --accent-light: color-mix(in srgb, var(--accent) 28%, #16202f);
  --warn-bg: #3a2e10;
  --warn-text: #fcd34d;
  --expired-bg: #3f1d1d;
  --expired-text: #fca5a5;
}
body.dark .auth-card,
body.dark .sheet { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
body.dark .pantry-row.need { background: #2e2609; border-color: #7c5e0b; }
body.dark .home-urgent { background: #2e2609; border-color: #7c5e0b; }
body.dark .urgent-list li { border-bottom-color: #4a3d12; }
body.dark .pill.thaw { background: #172d54; color: #93c5fd; }
body.dark .pill.ok { background: #12351f; color: #86efac; }
body.dark .pantry-btn.stocked { color: #86efac; }
body.dark .auth-info { background: #12351f; color: #86efac; }
body.dark #auth-screen { background: linear-gradient(160deg, var(--grad-a) 0%, var(--grad-b) 40%, var(--bg) 40.01%); }

h1, h2, h3 { font-family: var(--heading-font); }

* { box-sizing: border-box; }

/* Always reserve the vertical scrollbar's space so the layout doesn't jump
   left↔right when moving between screens that scroll and ones that don't.
   overflow-x:hidden is a belt-and-suspenders guard against stray wide elements. */
html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
}

/* the hidden attribute always wins, even over display:flex rules */
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- auth / landing ---------- */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 40px;
  background: linear-gradient(160deg, var(--grad-a) 0%, var(--grad-b) 40%, var(--bg) 40.01%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
  padding: 28px 24px calc(env(safe-area-inset-bottom) + 24px);
  text-align: center;
}
.auth-logo { font-size: 3rem; line-height: 1; }
.auth-card h1 { margin: 8px 0 4px; font-size: 1.6rem; }
.auth-card h2 { margin: 0 0 10px; font-size: 1.15rem; }
.auth-pitch { color: var(--muted); font-size: 0.92rem; margin: 0 0 20px; }
.auth-video { margin: -8px 0 18px; }
.auth-video a { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 0.92rem; }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.auth-form input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.auth-submit { width: 100%; padding: 12px; font-size: 1rem; }
.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 6px 0 0;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}
.auth-alt { display: flex; flex-direction: column; gap: 8px; }
.tos-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem !important;
  font-weight: 400 !important;
}
.tos-check input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }
.auth-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--expired-bg);
  color: var(--expired-text);
  font-size: 0.88rem;
}
.auth-info {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.88rem;
}

/* ---------- push banner ---------- */
.offline-banner {
  background: #b45309; color: #fff; text-align: center;
  font-size: 0.8rem; font-weight: 600; padding: 8px 12px; line-height: 1.35;
}
.push-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 10px 12px;
  background: var(--accent-light);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.push-banner span:first-child { flex: 1; }
.push-banner .btn { padding: 7px 14px; }
.push-banner .icon-btn { font-size: 0.9rem; color: var(--muted); }

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--h-teal-tint);
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--h-teal-line);
  overflow: hidden;
}
/* green header with yellow + mint corner circles, matching the Home greeting card */
.topbar::before {
  content: "";
  position: absolute;
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--h-yellow);
  right: -30px; top: -42px; opacity: 0.85;
  pointer-events: none;
}
.topbar::after {
  content: "";
  position: absolute;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--h-mint);
  right: 46px; top: -54px; opacity: 0.6;
  pointer-events: none;
}
body.dark .topbar::after { background: color-mix(in srgb, var(--h-c2), #000000 55%); }
.topbar-row, .topbar .search-wrap, .topbar .chips { position: relative; z-index: 1; }
.topbar .icon-btn {
  position: relative; z-index: 1;
  width: 38px; height: 38px; padding: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.45);
  color: #4a3800;
}
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.72); }
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { margin: 0 0 10px; font-size: 1.25rem; color: var(--text); }
.icon-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}
.search-wrap { position: relative; }
#search {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
/* hide the browser's native search cancel so we only show our own ✕ */
#search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 0;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  font-weight: 700;
}
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- items ---------- */
.item-list { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
/* freezer vs pantry color coding */
.card.loc-freezer { border-left: 4px solid var(--freezer-tint); }
.card.loc-pantry { border-left: 4px solid var(--pantry-tint); }
.home-loc.loc-freezer {
  border-left: 4px solid var(--freezer-tint);
  background: color-mix(in srgb, var(--freezer-tint) 9%, var(--bg));
}
.home-loc.loc-pantry {
  border-left: 4px solid var(--pantry-tint);
  background: color-mix(in srgb, var(--pantry-tint) 10%, var(--bg));
}
.thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.card-body { flex: 1; min-width: 0; }
.card-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sub { color: var(--muted); font-size: 0.82rem; margin: 0; }
.card-note {
  margin: 3px 0 0; font-size: 0.76rem; color: var(--muted); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-badges { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
}
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.staple-pill { background: var(--accent-light); color: var(--accent); }
.card.staple-card { border-style: dashed; }
.storage-group-head {
  margin: 16px 4px 6px; font-size: 0.76rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.storage-group-head:first-child { margin-top: 4px; }
.pill.expired { background: var(--expired-bg); color: var(--expired-text); }

/* global "search everything" results */
.search-view { padding: 12px; }
.gs-group { margin-bottom: 18px; }
.gs-head {
  margin: 0 0 8px 2px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.gs-row {
  display: flex; align-items: stretch; margin-bottom: 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.gs-main {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  text-align: left; padding: 11px 12px; background: none; border: 0;
  color: var(--text); font: inherit; cursor: pointer;
}
.gs-main:active { background: var(--bg); }
.gs-actions { display: flex; align-items: stretch; flex-shrink: 0; }
.gs-act {
  border: 0; border-left: 1px solid var(--border); background: none;
  padding: 0 15px; font-size: 1.1rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; min-width: 48px;
}
.gs-act:active { background: var(--accent-light); }
.gs-act.gs-add { color: var(--accent); }
.gs-ic { font-size: 20px; flex-shrink: 0; line-height: 1; }
.gs-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gs-title { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-empty { text-align: center; color: var(--muted); padding: 44px 20px; }

.status-btn {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 56px;
  height: 52px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.status-btn small { font-size: 0.6rem; color: var(--muted); font-weight: 600; }

.pill.thaw { background: #dbeafe; color: #1d4ed8; }
.pill.ok { background: #dcfce7; color: #166534; }

.status-options { display: flex; flex-direction: column; gap: 8px; }
.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.status-option.current { border-color: var(--accent); background: var(--accent-light); }
.status-option.shop-option { margin-top: 10px; border-style: dashed; }
.status-emoji { font-size: 1.2rem; }
.status-note { margin-left: auto; font-size: 0.72rem; font-weight: 400; color: var(--muted); }

.empty { text-align: center; color: var(--muted); margin-top: 48px; padding: 0 24px; }

/* ---------- fab ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 18px color-mix(in srgb, var(--grad-b) 45%, transparent);
  z-index: 15;
  transition: transform 0.1s ease;
}
.fab:active { transform: scale(0.94); }

/* ---------- sheets ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 20;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
  z-index: 21;
}
.sheet h2 { margin: 0 0 14px; font-size: 1.15rem; }
.sheet form { display: flex; flex-direction: column; gap: 12px; }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.hint { color: var(--muted); font-weight: 400; }
.sheet input:not([type="file"]):not([type="checkbox"]):not([type="color"]), .sheet select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.photo-row { display: flex; align-items: center; gap: 12px; }
#f-photo-preview, .photo-preview {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}
/* default (matched food/gap) image: show whole item on white, not cropped */
.photo-preview.default-preview { object-fit: contain; background: #fff; padding: 3px; }
.photo-btns { display: flex; gap: 10px; align-items: center; flex: 1; flex-wrap: wrap; }
/* combined "smart photo" control: camera tile with a magic-scan sparkle + blurb */
.scan-cta { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.scan-tile { position: relative; flex-shrink: 0; }
.tile-spark { position: absolute; top: 4px; right: 6px; font-size: 0.95rem; line-height: 1; }
.scan-desc { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.35; min-width: 0; }
.scan-desc strong { display: block; font-size: 0.95rem; color: var(--text); margin-bottom: 1px; }
img.zoomable { cursor: zoom-in; }

/* tap-a-photo-to-enlarge lightbox */
.img-lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0, 0, 0, 0.86); cursor: zoom-out;
  animation: lb-fade 0.12s ease-out;
}
.img-lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 12px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.icon-tile {
  width: 76px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  cursor: pointer;
  padding: 0;
}
.icon-tile:active { background: var(--accent-light); }
.tile-emoji { font-size: 2rem; line-height: 1; }
.tile-barcode { width: 46px; height: 30px; color: var(--text); display: block; }

.btn {
  padding: 11px 18px;
  border-radius: 14px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--expired-bg); color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: default; }

.sheet-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.copyright { text-align: center; color: var(--muted); font-size: 0.72rem; margin: 16px 0 4px; }
.spacer { flex: 1; }

/* ---------- bottom section nav (pantry feature) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  justify-content: space-evenly;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bnav {
  position: relative;
  flex: 1 1 0;
  max-width: 180px; /* pills stay pill-shaped even with only 2 tabs */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 6px 5px;
  padding: 6px 0 7px;
  background: none;
  border: none;
  border-radius: 14px;
  font-size: 1.15rem;
  color: var(--muted);
  cursor: pointer;
}
/* the text label (every tab), excluding the count badge — nowrap also stops
   mobile text-auto-inflation so long labels like "Shopping Lists" stay 1 line */
.bnav span:not(.bnav-badge) { font-size: 0.68rem; font-weight: 600; white-space: nowrap; }
.bnav.active {
  color: #fff;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--grad-b) 40%, transparent);
}
.bnav.active span:not(.bnav-badge) { color: #fff; }
.bnav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 24px);
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem !important;
  font-weight: 700;
}
/* --nav-h is measured by JS (large accessibility text makes the nav taller
   than any hard-coded guess) */
:root { --nav-h: 64px; }
body.has-bottom-nav { padding-bottom: calc(var(--nav-h) + 110px); }
body.has-bottom-nav .fab { bottom: calc(var(--nav-h) + 16px); }

/* ---------- pantry & shopping list ---------- */
.pantry-list { padding: 12px 12px 0; }
.pantry-cat { margin: 14px 4px 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.store-head { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text); }
.store-head-name { flex: 1; }
.weekly-ad-link { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.weekly-ad-banner {
  display: block;
  text-align: center;
  margin: 8px 0 4px;
  padding: 10px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}
.store-logo { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; background: #fff; border: 1px solid var(--border); }
.pantry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.pantry-row.need { border-color: #fbbf24; background: #fffbeb; }
.pantry-row { cursor: pointer; }
.pantry-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
/* matched food photos have their own white bg — show the whole item, not cropped */
img.thumb.food-icon, img.pantry-thumb.food-icon {
  object-fit: contain;
  background: #fff;
  padding: 2px;
}
.pantry-body { flex: 1; min-width: 0; }
.pantry-name { font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pantry-sub { margin: 0; font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pantry-sub.pantry-low { color: var(--expired-text); font-weight: 600; }
.form-section-head {
  margin: 16px 0 2px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.pantry-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pantry-btn.stocked { color: #166534; }
.pantry-btn.need { color: var(--warn-text); background: var(--warn-bg); border-color: #fbbf24; }
.pantry-del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
}
/* ---------- shopping-list switcher ---------- */
.list-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 2px;
  -webkit-overflow-scrolling: touch;
}
.list-chip {
  flex-shrink: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.list-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.list-chip-add {
  color: var(--accent);
  border-style: dashed;
  font-weight: 700;
}

.shop-actions { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.shop-actions .btn { width: 100%; }
.shop-actions-row { display: flex; gap: 10px; }
.shop-actions-row #push-list { flex: 2; width: auto; }
.shop-actions-row #print-list-btn { flex: 1; width: auto; }
.shop-store-btn { font-weight: 700; }

/* shop by store */
.storepick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; max-height: 60vh; overflow-y: auto; }
.store-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.store-pick-name { flex: 1; font-weight: 700; font-size: 1rem; color: var(--text); }
.store-pick-count { font-size: 0.78rem; color: var(--muted); }
#shopstore-title { display: flex; align-items: center; gap: 8px; }
.shopstore-list { max-height: 52vh; overflow-y: auto; margin: 10px 0; }
.shopstore-add { width: 100%; margin-bottom: 6px; }

/* ---------- printable shopping list ---------- */
#print-area { display: none; }
@media print {
  body.printing #app-root,
  body.printing #auth-screen,
  body.printing #ad-bar { display: none !important; }
  body.printing #print-area {
    display: block !important;
    font-family: Georgia, "Times New Roman", serif;
    color: #000;
    padding: 8px;
  }
  #print-area h1 { font-size: 20pt; margin: 0 0 2px; font-family: Arial, sans-serif; }
  #print-area .print-date { font-size: 10pt; color: #444; margin: 0 0 14px; }
  #print-area h2 {
    font-size: 12pt;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1.5px solid #000;
    padding-bottom: 2px;
    margin: 14px 0 6px;
  }
  #print-area ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 28px; }
  #print-area li { font-size: 12pt; padding: 3px 0; break-inside: avoid; }
  #print-area .pbox {
    display: inline-block;
    width: 11pt;
    height: 11pt;
    border: 1.5px solid #000;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: -2px;
  }
  #print-area .pstore { color: #555; font-size: 10pt; }
}

/* ---------- drag item card onto a location chip ---------- */
.card { touch-action: pan-y; } /* vertical scroll stays native until long-press */
/* long-press must start a drag, not the OS text-selection/copy callout */
.card, .card *, .pantry-row, .pantry-row *, .drag-ghost {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.card.drag-src { opacity: 0.35; }
.drag-grip {
  order: -1; /* left edge, before the thumbnail */
  align-self: stretch;
  display: flex;
  align-items: center;
  margin: -10px 0 -10px -6px;
  padding: 0 3px 0 5px;
  color: var(--muted);
  opacity: 0.6;
  cursor: grab;
  touch-action: none; /* dragging from the grip never scrolls */
}
body.item-dragging .drag-grip { cursor: grabbing; }
.drag-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  transform: translate(-50%, -130%);
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.item-dragging .chips .chip {
  outline: 2px dashed rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}
body.item-dragging .chips .chip.drop-hover {
  background: #fff;
  color: var(--accent);
  transform: scale(1.15);
  outline-style: solid;
}

/* ---------- ghost (library) staples ---------- */
.pantry-row.ghost {
  border-style: dashed;
  background: transparent;
}
.pantry-row.ghost .pantry-thumb { opacity: 0.45; background: var(--bg); }
.pantry-row.ghost .pantry-name { font-weight: 500; color: var(--muted); }

/* ---------- staples picker ---------- */
#staples-sheet[hidden] { display: none; }
#staples-sheet { display: flex; flex-direction: column; }
.staples-groups { flex: 1; overflow-y: auto; margin: 10px 0; min-height: 120px; max-height: 48vh; }
.staples-cat { margin: 12px 2px 6px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.staple-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.staple-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  padding: 7px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.staple-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.staple-chip.in-pantry { opacity: 0.4; text-decoration: line-through; pointer-events: none; }
.staple-chip.add-chip {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  background: transparent;
}
#custom-cat {
  max-width: 130px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}
#staples-sheet form { flex-direction: row; margin-top: 4px; }

/* ---------- count stepper (restaurant feature) ---------- */
.qty-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.qty-btn {
  width: 40px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.qty-val { font-weight: 700; min-width: 56px; text-align: center; }
.check-label .check-line { display: flex; align-items: center; gap: 8px; padding: 12px 2px; }
.check-label input[type="checkbox"] { width: 20px; height: 20px; }

/* ---------- barcode scanner ---------- */
#scan-overlay[hidden] { display: none; }
#scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
}
#scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-hint {
  position: relative;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  margin: 0;
}
#scan-cancel { position: relative; }

/* ---------- settings: freezers, members, invite ---------- */
.loc-list { list-style: none; margin: 0 0 12px; padding: 0; }
.loc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.loc-count { color: var(--muted); font-size: 0.8rem; margin-left: 8px; }
.loc-del {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
}
.loc-add { display: flex; gap: 8px; }
.loc-add input { flex: 1; }

.invite-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.invite-code {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 8px;
}
.invite-row .btn { padding: 7px 12px; font-size: 0.82rem; }

.feature-toggles { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.feature-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  font-size: 0.9rem !important;
}
.feature-toggle input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- home page ---------- */
.home-view { padding: 14px 14px 0; display: flex; flex-direction: column; gap: 12px; }
.home-hello h2 { margin: 4px 0 2px; font-size: 1.35rem; }
.home-hello p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.home-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.home-card h3 { margin: 0 0 10px; font-size: 0.95rem; }
.home-urgent { border-color: #fbbf24; background: #fffbeb; }
.urgent-list { list-style: none; margin: 0; padding: 0; }
.urgent-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #fde68a;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.urgent-list li:last-child { border-bottom: none; }
.home-locs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-loc {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.home-loc-emoji { font-size: 1.5rem; }
.home-loc-name { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.home-loc-sub { font-size: 0.78rem; color: var(--muted); }

/* "Your storage" + "Shopping lists": full-width rows stacked vertically
   (short + wide), emoji on the left, name over its count on the right */
#home-locs, #home-lists-box { display: flex; flex-direction: column; }
#home-locs .home-loc,
#home-lists-box .home-loc {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "emoji name" "emoji sub";
  align-items: center;
  column-gap: 12px;
  row-gap: 1px;
  padding: 12px 14px;
}
#home-locs .home-loc-emoji,
#home-lists-box .home-loc-emoji { grid-area: emoji; font-size: 1.7rem; }
#home-locs .home-loc-name,
#home-lists-box .home-loc-name { grid-area: name; }
#home-locs .home-loc-sub,
#home-lists-box .home-loc-sub { grid-area: sub; }
.home-loc-current {
  border-color: var(--accent);
  background: var(--accent-light);
}
.home-loc-add {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.home-loc-add .home-loc-emoji,
.home-loc-add .home-loc-name { color: var(--accent); }
/* home accordions */
.home-acc {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 10px;
}
.home-acc > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; font-size: 1rem; font-weight: 700;
  cursor: pointer; list-style: none; color: var(--text);
  font-family: var(--heading-font);
}
.home-acc > summary::-webkit-details-marker { display: none; }
.home-acc > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: 0.9rem; }
.home-acc[open] > summary::after { content: "▴"; }
.acc-count {
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
  font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
}
.acc-soon {
  font-size: 0.66rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.home-acc-soon > summary { color: var(--muted); }
.home-acc-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.home-acc-body .saved-list { max-height: none; }
.acc-cta, .acc-open { width: 100%; }
.home-refer-btn { width: 100%; margin: 2px 0 12px; }
.home-actions { display: flex; gap: 10px; }
.home-actions .btn { flex: 1; padding: 13px 10px; }
.home-tip { background: var(--accent-light); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.home-tip p { margin: 0; font-size: 0.9rem; line-height: 1.45; }

/* ============================================================
   HOME — "calm teal" restyle (design #4).
   Scoped to .home-view so no other screen (or the global
   --accent) is affected. Includes body.dark overrides where
   an existing dark rule would otherwise win on specificity.
   ============================================================ */
:root {
  /* EDITABLE decoration base — the theme studio sets these per-user */
  --h-tint: #e7f7f1;   /* header / greeting background */
  --h-c1: #ffd54a;     /* corner circle 1 */
  --h-c2: #b9e8db;     /* corner circle 2 */
  /* derived tokens used across the app */
  --h-teal: var(--accent);
  --h-teal-deep: var(--accent);
  --h-teal-tint: var(--h-tint);
  --h-teal-line: color-mix(in srgb, var(--h-tint), #000000 9%);
  --h-yellow: var(--h-c1);
  --h-yellow-deep: color-mix(in srgb, var(--h-c1), #000000 12%);
  --h-yellow-ink: #5a4900;
  --h-mint: var(--h-c2);
  --h-card: #ffffff;
}
body.dark {
  --h-teal-deep: color-mix(in srgb, var(--accent) 55%, #ffffff);
  --h-teal-tint: color-mix(in srgb, var(--h-tint) 22%, #16202f);
  --h-teal-line: color-mix(in srgb, var(--h-tint) 34%, #26344a);
  --h-card: var(--card);
}

/* greeting header — soft teal card with corner blobs */
.home-view .home-hello {
  position: relative;
  overflow: hidden;
  background: var(--h-teal-tint);
  border: 1px solid var(--h-teal-line);
  border-radius: 20px;
  padding: 18px 20px 20px;
}
.home-view .home-hello::before {
  content: "";
  position: absolute;
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--h-yellow);
  right: -42px; top: -46px; opacity: 0.85;
}
.home-view .home-hello::after {
  content: "";
  position: absolute;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--h-mint);
  right: 40px; top: -58px; opacity: 0.6;
}
body.dark .home-view .home-hello::after {
  background: color-mix(in srgb, var(--h-c2), #000000 55%);
}
.home-view .home-hello h2 { position: relative; z-index: 1; color: var(--text); margin: 2px 0 12px; }
.home-view .home-hello p  { position: relative; z-index: 1; }
.home-view .home-hello .hello-eyebrow {
  position: relative; z-index: 1; display: block;
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
}
.home-view .home-search {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  background: #ffffff;
  border: 1px solid var(--h-teal-line);
  border-radius: 14px;
  padding: 11px 14px;
}
body.dark .home-view .home-search { background: var(--card); }
.home-view .home-search .hs-ic { font-size: 0.95rem; line-height: 1; }
.home-view .home-search input {
  flex: 1; min-width: 0;
  border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 0.95rem; color: var(--text);
}
.home-view .home-search input::placeholder { color: #9aaaa2; }
.home-view .home-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
/* settings gear seated inside the yellow corner blob */
.home-view .home-settings {
  position: absolute; z-index: 2; top: 12px; right: 14px;
  width: 38px; height: 38px; padding: 0;
  border: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.45); color: #4a3800;
  -webkit-tap-highlight-color: transparent;
}
.home-view .home-settings:hover { background: rgba(255, 255, 255, 0.72); }
/* yellow "Plan tonight's dinner" CTA above Needs attention */
.home-view .home-plan-btn {
  width: 100%;
  border: none; border-radius: 16px; cursor: pointer;
  padding: 15px; font-family: inherit; font-size: 1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--h-yellow); color: var(--h-yellow-ink);
  box-shadow: 0 8px 18px -10px rgba(210, 170, 0, 0.7);
  -webkit-tap-highlight-color: transparent;
}
.home-view .home-plan-btn:hover { background: var(--h-yellow-deep); }
.home-view .home-scan-btn {
  margin-top: 10px; background: var(--accent); color: #fff;
  box-shadow: 0 8px 18px -10px rgba(15, 118, 110, 0.7);
}
.home-view .home-scan-btn:hover { background: var(--grad-b); }

/* needs attention — white card with a teal header bar */
.home-view .home-urgent {
  background: var(--h-card);
  border: 1.5px solid var(--h-teal-line);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
}
.home-view .home-urgent h3 {
  margin: 0;
  background: var(--h-teal);
  color: #ffffff;
  padding: 11px 16px;
  font-size: 0.9rem;
}
.home-view .urgent-list { padding: 6px 8px; }
.home-view .urgent-list li { border-bottom: 1px solid var(--h-teal-tint); padding: 10px; }
body.dark .home-view .home-urgent { background: var(--h-card); border-color: var(--h-teal-line); }
body.dark .home-view .urgent-list li { border-bottom-color: var(--h-teal-tint); }

/* accordions — calm teal cards, yellow count badge */
.home-view .home-acc {
  border: 1.5px solid var(--h-teal-line);
  border-radius: 18px;
  background: var(--h-teal-tint);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.home-view .home-acc > summary { padding: 15px 16px; }
.home-view .home-acc[open] { border-color: var(--h-teal); }
.home-view .home-acc[open] > summary { color: var(--h-teal-deep); }
.home-view .home-acc[open] > summary::after { color: var(--h-teal-deep); }
.home-view .acc-count { background: var(--h-yellow); color: var(--h-yellow-ink); }

/* content sitting inside an open (teal-tinted) accordion reads as white tiles */
.home-view .home-acc[open] .saved-row { background: var(--h-card); border-radius: 12px; padding: 8px; }
.home-view .home-loc {
  background: var(--h-card);
  border: 1px solid var(--h-teal-line);
  border-radius: 14px;
}
.home-view .home-loc.loc-freezer { border-left: 4px solid var(--freezer-tint); background: var(--h-card); }
.home-view .home-loc.loc-pantry  { border-left: 4px solid var(--pantry-tint); background: var(--h-card); }
.home-view .home-loc-current { border-color: var(--h-teal); background: var(--h-teal-tint); }
.home-view .home-loc-add { border-style: dashed; border-color: var(--h-teal); background: transparent; }
.home-view .home-loc-add .home-loc-emoji,
.home-view .home-loc-add .home-loc-name { color: var(--h-teal-deep); }

/* primary in-accordion actions become the yellow CTA */
.home-view button.acc-cta {
  background: var(--h-yellow);
  color: var(--h-yellow-ink);
  border: none;
  box-shadow: 0 8px 18px -10px rgba(210, 170, 0, 0.7);
}
.home-view button.acc-cta:hover { background: var(--h-yellow-deep); }

/* tip card in the teal family */
.home-view .home-tip { background: var(--h-teal-tint); border-color: var(--h-teal-line); }

/* ============================================================
   TEMPLATES — decoration variants (set via body[data-template])
   "blob" (default) = tinted header + circles; "default" = flat.
   ============================================================ */
body[data-template="default"] {
  /* clean, accent-driven — no green tint, no yellow, no circles */
  --h-teal-tint: var(--card);
  --h-teal-line: var(--border);
  --h-yellow: var(--accent);
  --h-yellow-deep: color-mix(in srgb, var(--accent), #000000 12%);
  --h-yellow-ink: #ffffff;
}
body[data-template="default"] .topbar::before,
body[data-template="default"] .topbar::after,
body[data-template="default"] .home-view .home-hello::before,
body[data-template="default"] .home-view .home-hello::after { display: none; }
body[data-template="default"] .topbar {
  background: var(--card);
  border-bottom-color: var(--border);
}
body[data-template="default"] .topbar .icon-btn { background: none; color: var(--text); }
body[data-template="default"] .topbar .icon-btn:hover { background: color-mix(in srgb, var(--muted) 18%, transparent); }
body[data-template="default"] .home-view .home-hello {
  background: var(--card);
  border-color: var(--border);
}
body[data-template="default"] .home-view .home-hello .hello-eyebrow { color: var(--muted); }

/* Bold — solid accent header, white text, chunky shadowed cards, yellow pop */
body[data-template="bold"] {
  --radius: 20px;
  --h-teal-tint: var(--card);
  --h-teal-line: var(--border);
  --h-yellow: var(--h-c1);
  --h-yellow-deep: color-mix(in srgb, var(--h-c1), #000000 12%);
  --h-yellow-ink: #4a3800;
}
body[data-template="bold"] .topbar::before,
body[data-template="bold"] .topbar::after,
body[data-template="bold"] .home-view .home-hello::before,
body[data-template="bold"] .home-view .home-hello::after { display: none; }
body[data-template="bold"] .topbar,
body[data-template="bold"] .home-view .home-hello {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
}
body[data-template="bold"] .topbar h1,
body[data-template="bold"] .home-view .home-hello h2 { color: #ffffff; }
body[data-template="bold"] .home-view .home-hello .hello-eyebrow { color: rgba(255, 255, 255, 0.85); }
body[data-template="bold"] .topbar .icon-btn { background: rgba(255, 255, 255, 0.22); color: #ffffff; }
body[data-template="bold"] .home-view .home-acc {
  border-width: 0;
  box-shadow: 0 8px 20px -10px rgba(20, 30, 90, 0.28);
}
body[data-template="bold"] .home-view .home-acc[open] { box-shadow: 0 10px 26px -10px rgba(20, 30, 90, 0.36); }

/* Calm — soft tint header, one big gentle circle, extra rounding, airy */
body[data-template="calm"] { --radius: 20px; }
body[data-template="calm"] .topbar::after,
body[data-template="calm"] .home-view .home-hello::after { display: none; }
body[data-template="calm"] .topbar::before,
body[data-template="calm"] .home-view .home-hello::before {
  background: var(--h-c1);
  width: 150px; height: 150px;
  right: -44px; top: -66px; opacity: 0.55;
}
body[data-template="calm"] .topbar .icon-btn { background: rgba(255, 255, 255, 0.5); }

/* Simple — the original/classic look: gradient header, white text, clean cards */
body[data-template="simple"] {
  --h-teal-tint: var(--card);
  --h-teal-line: var(--border);
  --h-yellow: var(--accent);
  --h-yellow-deep: color-mix(in srgb, var(--accent), #000000 12%);
  --h-yellow-ink: #ffffff;
}
body[data-template="simple"] .topbar::before,
body[data-template="simple"] .topbar::after,
body[data-template="simple"] .home-view .home-hello::before,
body[data-template="simple"] .home-view .home-hello::after { display: none; }
body[data-template="simple"] .topbar,
body[data-template="simple"] .home-view .home-hello {
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b));
  border-color: transparent;
  color: #ffffff;
}
body[data-template="simple"] .topbar h1,
body[data-template="simple"] .home-view .home-hello h2 { color: #ffffff; }
body[data-template="simple"] .home-view .home-hello .hello-eyebrow { color: rgba(255, 255, 255, 0.85); }
body[data-template="simple"] .topbar .icon-btn,
body[data-template="simple"] .home-view .home-settings { background: rgba(255, 255, 255, 0.22); color: #ffffff; }

/* ============================================================
   THEME STUDIO (Settings › Appearance)
   ============================================================ */
.tpl-gallery { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.tpl-card {
  flex: 1 1 130px; border: 2px solid var(--border); border-radius: 14px;
  padding: 0; overflow: hidden; cursor: pointer; background: var(--card);
  text-align: left; font-family: inherit;
}
.tpl-card.active { border-color: var(--accent); }
.tpl-thumb { height: 54px; position: relative; overflow: hidden; background: var(--card); }
.tpl-thumb .t-bar {
  position: absolute; inset: 0 0 auto 0; height: 30px;
  display: flex; align-items: center; padding: 0 9px;
  font-size: 0.72rem; font-weight: 800; color: var(--text);
}
.tpl-thumb .t-dot { position: absolute; left: 9px; bottom: 8px; width: 34px; height: 10px; border-radius: 999px; }
.tpl-thumb .t-c { position: absolute; border-radius: 50%; }
.tpl-body { padding: 7px 10px 9px; display: flex; align-items: center; justify-content: space-between; }
.tpl-body b { font-size: 0.85rem; }
.tpl-body .chk { color: var(--accent); font-weight: 800; opacity: 0; }
.tpl-card.active .tpl-body .chk { opacity: 1; }

.color-slots { display: flex; flex-direction: column; gap: 15px; margin: 12px 0 4px; }
.slot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.slot-swatch {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
  padding: 0; cursor: pointer; background: none;
}
.slot-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.slot-swatch::-webkit-color-swatch { border: none; border-radius: 6px; }
.slot-head label { font-size: 0.88rem; font-weight: 700; }
.slot-hex { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.03em; }
.slot-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.slot-preset { width: 27px; height: 27px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.slot-preset.active { border-color: var(--text); }
.studio-actions { display: flex; gap: 10px; margin: 14px 0 4px; }
.studio-actions .btn { flex: 1; }

.studio-label { display: block; font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 8px; }
.avatar-row { display: flex; flex-direction: column; gap: 10px; }
.avatar-upload-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.avatar-upload-preview { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-opt {
  width: 40px; height: 40px; border-radius: 50%; padding: 0;
  border: 2px solid var(--border); background: var(--bg);
  font-size: 21px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; overflow: hidden;
}
.avatar-opt.active { border-color: var(--accent); }
.avatar-opt img { width: 100%; height: 100%; object-fit: cover; }

/* avatar in the topbar app title */
.title-avatar { width: 1.5em; height: 1.5em; border-radius: 50%; object-fit: cover; vertical-align: -0.35em; }

/* avatar on the home greeting card */
.home-view .home-hello .hello-row { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.home-view .home-hello .hello-txt { min-width: 0; }
.home-view .home-hello .hello-txt h2 { margin: 2px 0 0; }
.home-view .hello-avatar {
  width: 50px; height: 50px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 27px; line-height: 1;
  background: rgba(255, 255, 255, 0.55); overflow: hidden;
}
.home-view .hello-avatar img { width: 100%; height: 100%; object-fit: cover; }
.home-view .home-hello .home-search { margin-top: 14px; }

/* ---------- what's for dinner ---------- */
.dinner-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.dinner-chips::-webkit-scrollbar { display: none; }
.dinner-chip {
  flex-shrink: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.dinner-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.dinner-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sheet-head h2 { flex: 1; }
.sheet-x {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
#chef-ideas { margin-bottom: 12px; }
.chef-head { margin: 0 0 8px; font-weight: 700; font-size: 0.9rem; }
.chef-card {
  background: var(--accent-light);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.chef-title { margin: 0 0 4px; font-weight: 700; font-size: 0.95rem; }
.chef-desc { margin: 0; font-size: 0.85rem; line-height: 1.4; }
.chef-uses { margin: 6px 0 0; font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.chef-card { cursor: pointer; }
.chef-hint { margin: 6px 0 0; font-size: 0.72rem; color: var(--muted); }
.chef-full { margin-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); padding-top: 10px; }
.chef-full h4 { margin: 0 0 6px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.chef-full ul, .chef-full ol { margin: 0 0 10px; padding-left: 20px; }
.chef-full li { font-size: 0.85rem; padding: 2px 0; }
.chef-thinking { animation: chefpulse 1.2s ease-in-out infinite; }
@keyframes chefpulse { 50% { opacity: 0.45; } }

/* animated chef while Grok cooks up ideas */
.chef-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0 14px;
}
.chef-cook {
  display: inline-block;
  font-size: 2.6rem;
  line-height: 1;
  animation: chefcook 0.9s ease-in-out infinite;
  transform-origin: 50% 90%;
}
.chef-cook-sm { font-size: 1.1rem; animation-duration: 0.8s; }
@keyframes chefcook {
  0%, 100% { transform: rotate(-10deg); }
  25% { transform: rotate(0deg) translateY(-4px); }
  50% { transform: rotate(10deg); }
  75% { transform: rotate(0deg) translateY(-4px); }
}
.chef-status {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  animation: chefpulse 1.4s ease-in-out infinite;
}
.dinner-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  text-decoration: none;
  color: var(--text);
}
.dinner-card img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--accent-light);
}
.dinner-card { cursor: pointer; }
.dinner-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dinner-title { font-weight: 700; font-size: 0.95rem; }
.dinner-have { font-size: 0.78rem; color: var(--accent); font-weight: 600; }
.dinner-go { color: var(--muted); font-size: 1.4rem; flex-shrink: 0; padding-right: 4px; }
.dinner-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-slim { padding: 6px 12px; font-size: 0.82rem; width: auto; flex-shrink: 0; }
.recipe-search-row { display: flex; gap: 8px; align-items: center; margin: 6px 0 10px; }
.recipe-search-wrap { flex: 1; }
#recipe-search {
  width: 100%; padding: 10px 40px 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; outline: none; background: var(--bg); color: var(--text);
}
#recipe-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.recipe-scan-btn { flex-shrink: 0; width: auto; padding: 9px 14px; white-space: nowrap; }
.recipe-import-row { display: flex; gap: 8px; margin: 0 0 10px; }
.recipe-import-row .btn { flex: 1; width: auto; padding: 9px 8px; white-space: nowrap; }
.import-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 6px; }
.import-row input { flex: 1; min-width: 0; }
.import-row .btn { flex-shrink: 0; width: auto; padding: 10px 16px; }
.scan-pages { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.scan-page { position: relative; width: 84px; height: 84px; }
.scan-page img {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
}
.scan-page-n {
  position: absolute; top: 3px; left: 3px; min-width: 18px; height: 18px;
  padding: 0 4px; border-radius: 9px; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 0.72rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.scan-page-del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: 0.7rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.scan-add { width: 100%; }

/* ---------- recipe detail sheet ---------- */
.recipe-body { max-height: 60vh; overflow-y: auto; }
.recipe-thumb {
  width: 100%; max-height: 190px; object-fit: cover;
  border-radius: 12px; background: var(--accent-light);
}
.recipe-meta { margin: 8px 0 0; color: var(--muted); }
.recipe-body h4 { margin: 16px 0 6px; font-size: 0.95rem; }
.recipe-ings, .recipe-steps { margin: 0; padding-left: 20px; }
.recipe-ings li, .recipe-steps li { margin-bottom: 4px; font-size: 0.9rem; line-height: 1.4; }

/* read-aloud button */
.app-version { font-size: 0.72rem; font-weight: 600; color: var(--muted); vertical-align: middle; letter-spacing: 0.02em; }
.readaloud-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.recipe-readaloud { width: auto; margin: 0; flex: 0 0 auto; white-space: nowrap; }
.readaloud-progress { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rap-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.rap-fill { height: 100%; background: var(--accent); border-radius: 999px; width: 0; transition: width 0.3s ease; }
.rap-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* spoken-question prompt with tappable answers (voice cook assistant) */
.voice-prompt { background: var(--h-teal-tint); border: 1px solid var(--h-teal-line); border-radius: 14px; padding: 14px; margin: 0 0 14px; }
.voice-prompt-text { margin: 0 0 10px; font-weight: 700; font-size: 0.98rem; line-height: 1.4; }
.voice-prompt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-prompt-actions .btn { flex: 1 1 auto; min-width: 40%; }

/* interactive step-by-step instructions */
.recipe-steps { counter-reset: rstep; list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.recipe-steps .step {
  display: flex; align-items: flex-start; gap: 11px; margin-bottom: 0;
  padding: 10px 12px; border-radius: 12px; transition: background 0.15s ease;
}
.recipe-steps .step.current { background: color-mix(in srgb, var(--muted) 16%, transparent); }
.recipe-steps .step-check { width: 22px; height: 22px; flex: none; margin: 1px 0 0; cursor: pointer; accent-color: var(--accent); }
.recipe-steps .step-text { flex: 1; line-height: 1.5; cursor: pointer; }
.recipe-steps .step-text::before { counter-increment: rstep; content: counter(rstep) ". "; font-weight: 700; color: var(--muted); }
.recipe-steps .step.done .step-text { text-decoration: line-through; color: var(--muted); }
.recipe-notes {
  margin: 14px 0 4px; padding: 10px 12px; border-radius: 12px;
  background: var(--accent-light); color: var(--text); font-size: 0.9rem;
  line-height: 1.4; white-space: pre-wrap;
}
.recipe-orig { margin: 14px 0 0; font-size: 0.85rem; }
.recipe-orig a { color: var(--accent); font-weight: 600; text-decoration: none; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.recipe-actions .btn { flex: 1 1 auto; min-width: 44%; padding: 11px 8px; }
.recipe-sharedby { margin: 12px 0 0; font-weight: 600; }
/* Per-feature accordions in the recipe Manage panel */
.recipe-manage { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.rmg-sec {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
  overflow: hidden;
}
.rmg-sec > summary {
  padding: 12px 14px; font-size: 0.92rem; font-weight: 700;
  cursor: pointer; list-style: none; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rmg-sec > summary::-webkit-details-marker { display: none; }
.rmg-sec > summary::after { content: "▾"; color: var(--muted); font-size: 0.9em; }
.rmg-sec[open] > summary::after { content: "▴"; }
.rmg-sec[open] > summary { border-bottom: 1px solid var(--border); }
.rmg-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rmg-body .btn { width: 100%; }
.edit-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.edit-input, .edit-area {
  width: 100%; margin-top: 4px; padding: 9px 11px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit;
}
.edit-area { resize: vertical; min-height: 78px; line-height: 1.45; }
.rmg-body:empty { display: none; }
.tts-voice-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.tts-voice-select { width: 100%; }
.recipe-photo-btn { width: 100%; }
.recipe-share-controls { margin-top: 2px; }
.recipe-share-head {
  margin: 0 0 4px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.recipe-check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.recipe-check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.recipe-check span { display: flex; flex-direction: column; gap: 2px; }
.recipe-check small { font-size: 0.72rem; font-weight: 500; color: var(--muted); line-height: 1.3; }

.recipe-link-box {
  margin: 2px 0 6px 28px; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--accent-light); border-radius: 12px;
}
.recipe-link-url {
  width: 100%; font-size: 0.82rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.recipe-link-btns { display: flex; gap: 8px; }
.recipe-link-btns .btn { flex: 1; padding: 8px; font-size: 0.85rem; }

/* ---------- recipes hub ---------- */
.recipes-view { padding: 12px; }
.recipes-view .saved-list { max-height: none; }
.recipes-add-btn { width: 100%; margin-bottom: 12px; }

/* segmented control */
.recipes-seg {
  display: flex; gap: 4px; margin-bottom: 12px; padding: 4px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  border-radius: 12px;
}
.seg-btn {
  flex: 1; padding: 8px 6px; border: none; background: none;
  border-radius: 9px; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg-btn.active {
  background: var(--card); color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.rp-panel { display: flex; flex-direction: column; }

/* add-a-recipe chooser */
.addrecipe-opts { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.addrecipe-opt {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); cursor: pointer;
}
.addrecipe-emoji { font-size: 1.6rem; flex-shrink: 0; }
.addrecipe-txt { display: flex; flex-direction: column; gap: 2px; }
.addrecipe-txt b { font-size: 0.98rem; }
.addrecipe-txt small { color: var(--muted); font-size: 0.8rem; }

/* ---------- wine ---------- */
.home-wine {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; cursor: pointer; font-family: inherit;
  border-left: 4px solid #7c1d3f;
}
.home-wine-emoji { font-size: 1.7rem; flex-shrink: 0; }
.home-wine-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.home-wine-txt b { font-size: 0.98rem; color: var(--text); }
.home-wine-txt small { color: var(--muted); font-size: 0.8rem; }
.home-wine-go { color: var(--muted); font-size: 1.4rem; }

.wine-glass { font-size: 1.4rem; flex-shrink: 0; width: 34px; text-align: center; }
.wine-qty { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.wine-badge {
  flex-shrink: 0; align-self: center; font-size: 0.7rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.wine-badge.soon { background: #fef3c7; color: #b45309; }
.wine-badge.past { background: #fee2e2; color: #b91c1c; }

.wine-row2 { display: flex; gap: 10px; }
.wine-row2 > label { flex: 1; min-width: 0; }
.wine-photo-row { display: flex; align-items: center; gap: 12px; }
/* multi-photo wine gallery */
.w-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 6px; }
.w-gphoto { position: relative; width: 66px; height: 82px; }
.w-gphoto img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; cursor: zoom-in;
}
.w-gdel {
  position: absolute; top: -7px; right: -7px; width: 21px; height: 21px;
  border-radius: 50%; border: 2px solid var(--card); background: var(--expired-text);
  color: #fff; font-size: 0.68rem; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.w-gcover {
  position: absolute; bottom: 0; left: 0; right: 0; text-align: center;
  font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 0 0 8px 8px; padding: 1px 0;
}

/* scan-a-shelf */
.scan-shelf-btn { display: block; width: calc(100% - 24px); margin: 0 12px 10px; }
.shelfscan-photo { width: 100%; margin-bottom: 8px; }
.shelfscan-status { margin: 0 0 8px; }
.scan-bar { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 0 0 12px; }
.scan-bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.shelfscan-results { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; }
.shelfscan-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 2px;
  border-bottom: 1px solid var(--border); cursor: default;
}
.shelfscan-row.off { opacity: 0.42; }
.shelfscan-row input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); flex-shrink: 0; }
.shelfscan-name {
  flex: 1; min-width: 0; padding: 7px 9px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  color: var(--text); font: inherit;
}
.shelfscan-cat { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; max-width: 28%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelfscan-foot { margin-top: 12px; }
.shelfscan-loc { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; }
.shelfscan-loc select { flex: 1; }
.wine-photo-preview {
  width: 60px; height: 76px; object-fit: contain; border-radius: 8px;
  background: #fff; border: 1px solid var(--border); flex-shrink: 0;
}
.wine-scan-btn { width: auto; flex: 1; }
.wine-scan-status { margin: 0; font-size: 0.82rem; }
.scan-status { margin: 0 0 8px; font-size: 0.82rem; }
.wine-thumb {
  width: 34px; height: 44px; object-fit: contain; border-radius: 5px;
  background: #fff; flex-shrink: 0;
}

.guide-list { display: flex; flex-direction: column; gap: 10px; }
.guide-card {
  border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: 12px; padding: 12px; background: var(--bg);
}
.guide-card.red { border-left-color: #7c1d3f; }
.guide-card.white { border-left-color: #b59410; }
.guide-card.rosé { border-left-color: #db2777; }
.guide-card.sparkling { border-left-color: #0891b2; }
.guide-card.dessert { border-left-color: #92400e; }
.guide-head { display: flex; align-items: center; gap: 8px; }
.guide-head b { font-size: 1rem; }
.guide-kind {
  margin-left: auto; font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.guide-profile { margin: 8px 0 6px; font-size: 0.88rem; line-height: 1.4; }
.guide-pairs { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.guide-pairs b { color: var(--text); }
.guide-add {
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: none; color: var(--accent); font-weight: 700;
  padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 0.85rem;
}

.pair-result { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pair-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.pair-item b { font-size: 0.95rem; }
.pair-item p { margin: 4px 0 0; font-size: 0.86rem; color: var(--muted); line-height: 1.4; }
.pair-tip {
  margin: 4px 0 0; padding: 10px 12px; font-size: 0.85rem; line-height: 1.4;
  background: var(--accent-light); border-radius: 10px;
}
/* pairing result layers over the recipe sheet — sit above it + its backdrop */
#winepair-sheet { z-index: 24; }
.pair-have {
  display: inline-block; margin-top: 6px; font-size: 0.76rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: #dcfce7; color: #15803d;
}

/* ---------- saved recipes ---------- */
.saved-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.saved-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px;
}
.saved-row img, .saved-noimg {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover;
  flex-shrink: 0; background: var(--accent-light);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}
.saved-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; cursor: pointer; }
.saved-name { font-weight: 700; font-size: 0.95rem; }
.saved-src { font-size: 0.74rem; color: var(--muted); }
.saved-del {
  border: none; background: none; color: var(--muted);
  font-size: 1rem; cursor: pointer; padding: 6px 8px; flex-shrink: 0;
}

/* ---------- list chooser ---------- */
.sheet-sm { max-height: 70vh; }
.listpick-options { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.listpick-opt {
  text-align: left; padding: 13px 14px; font-size: 0.95rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); cursor: pointer;
}
.listpick-new { border-style: dashed; color: var(--accent); }

/* ---------- admin dashboard ---------- */
.admin-totals { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-stat {
  flex: 1;
  min-width: 70px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}
.admin-stat b { display: block; font-size: 1.2rem; color: var(--accent); }
.admin-stat span { font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; width: 100%; font-size: 0.78rem; }
.admin-table th, .admin-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.admin-table th { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; }
.admin-fb {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.admin-fb p { margin: 0; font-size: 0.88rem; }
.admin-fb-meta { color: var(--muted); font-size: 0.72rem !important; margin-bottom: 4px !important; }

/* ---------- ad bar ---------- */
.ad-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--nav-h); /* above bottom nav (nav height includes safe area) */
  z-index: 11;
  background: var(--card);
  border-top: 1px solid var(--border);
  min-height: 50px;
  max-height: 100px;
  overflow: hidden;
}
body.has-ads.has-bottom-nav { padding-bottom: calc(var(--nav-h) + 210px); }
body.has-ads .fab { bottom: calc(var(--nav-h) + 118px); }

/* ---------- referral + feedback ---------- */
.feedback-form { display: flex; flex-direction: column; gap: 8px; }
.feedback-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  resize: vertical;
}
.feedback-form .btn { align-self: flex-start; }

/* ---------- settings accordion ---------- */
.set-sec { border-bottom: 1px solid var(--border); }
.set-sec summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 2px;
  font-family: var(--heading-font);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.set-sec summary::-webkit-details-marker { display: none; }
.set-sec summary::after {
  content: "\25BE"; /* ▾ */
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.set-sec:not([open]) summary::after { transform: rotate(-90deg); }
.set-sec .sec-body { padding: 2px 2px 16px; }

/* ---------- manage account ---------- */
.acct-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.acct-input {
  width: 100%; margin-top: 4px; padding: 9px 11px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  color: var(--text); font: inherit;
}
.acct-btn { margin-bottom: 4px; }
.acct-email { margin: 2px 0 14px; }
.acct-subhead {
  margin: 16px 0 8px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.acct-status { margin: 8px 0 0; font-weight: 600; }

/* ---------- appearance (accent swatches + mode) ---------- */
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.swatch.active {
  border-color: var(--text);
  transform: scale(1.1);
}
.mode-seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; width: fit-content; }
.mode-seg button {
  border: none;
  background: var(--bg);
  color: var(--muted);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.mode-seg button.active { background: var(--accent); color: #fff; }

/* ---------- reminder setting ---------- */
.settings-h2 { margin-top: 20px; }
.reminder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.reminder-row input.app-name-input {
  flex: 1;
  width: auto;
  text-align: left;
}
.sound-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}
.reminder-row input {
  width: 64px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--bg);
  text-align: center;
}
