:root {
  /* Fresh + colourful: light blue brand, light green for nutrition/health. */
  --primary: #0284c7;      /* sky blue — brand, buttons, links */
  --primary-2: #0369a1;
  --primary-soft: #dcf1fc; /* light blue */
  --green: #10b981;        /* fresh green — nutrition/health accents */
  --green-2: #047857;
  --green-soft: #d9f5e7;   /* light green */
  --bg: #f0f8fc;
  --card: #ffffff;
  --ink: #17313d;          /* deep blue-slate */
  --muted: #5f7d8a;        /* blue-grey */
  --line: #d9e9f0;         /* cool hairline */
  --soft: #eaf4f8;         /* pale blue surface */
  --warn: #d97706;
  --gold: #f5a623;
  --shadow: 0 6px 22px rgba(18, 84, 118, .09), 0 1.5px 5px rgba(18, 84, 118, .05);
  --shadow-sm: 0 2px 8px rgba(18, 84, 118, .06);
  --radius: 20px;
  --radius-sm: 12px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background: linear-gradient(165deg, #e6f5fd 0%, #eef9f5 55%, #edfaf0 100%) fixed;
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .heading, .hero h1, .detail-head h1, .auth h1, .service-error h1 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

a { color: var(--primary); }

/* Accessibility: visible focus + reduced motion */
a, button, input, select, textarea, summary { transition: background-color .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  background: rgba(250, 253, 255, .84);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px; position: sticky; top: 0; z-index: 20;
}
.brand { color: var(--primary); text-decoration: none; font-size: 1.3rem; display: inline-flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.demo-badge {
  background: var(--soft); color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: .68rem; letter-spacing: .06em; font-weight: 600;
}
.topbar-right .user { color: var(--muted); font-size: .85rem; font-weight: 600; }
.user-block { display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) {
  .user-block { flex-direction: column; align-items: flex-end; gap: 3px; }
}
.linkbtn {
  background: var(--primary-soft); color: var(--primary); border: none; border-radius: 999px;
  padding: 6px 14px; font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.linkbtn:hover { background: var(--primary); color: #fff; }
.inline { display: inline; margin: 0; }
.free-tier-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.free-tier-toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
.narrow { width: 96px; }

/* ---- Auth pages ---- */
.auth { max-width: 380px; margin: 18px auto; }
.auth h1 { font-size: 1.7rem; }
.auth form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.auth label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); font-weight: 500; }
.auth .field-label { display: block; font-size: .88rem; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.auth label small { color: var(--muted); font-weight: 400; }
.auth input, .auth textarea, .auth select {
  padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--ink); background: var(--card); font-family: inherit; resize: vertical;
}
.auth input:focus, .auth textarea:focus, .auth select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.auth .btn.primary { width: 100%; margin-top: 4px; }
.auth-alt { text-align: center; color: var(--muted); margin-top: 18px; }
.auth-alt a { color: var(--primary); font-weight: 600; }

.container { max-width: 820px; margin: 0 auto; padding: 18px 16px; }
.flash {
  background: #fdf3e3; border: 1px solid #f1dcb4; color: #8a5a12;
  padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .92rem;
}

/* ---- Hero / ingredient input ---- */
.hero h1 { font-size: 2rem; margin: 10px 0 6px; line-height: 1.1; }
.sub { color: var(--muted); margin: 0 0 20px; }
.chip-input {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; display: flex; flex-wrap: wrap; gap: 6px; box-shadow: var(--shadow-sm);
}
.chip-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.chips { display: contents; }
.chip {
  background: var(--green-soft); color: var(--green-2); border-radius: 999px;
  padding: 6px 12px; font-size: .9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip button { border: none; background: none; color: var(--green-2); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }
.chip .chip-pin { font-size: .85rem; opacity: .45; }
.chip.required { background: var(--primary-soft); color: var(--primary-2); }
.chip.required .chip-pin { opacity: 1; }
#ingredient-box { border: none; outline: none; flex: 1; min-width: 140px; padding: 8px; font-size: 1rem; background: transparent; font-family: inherit; color: var(--ink); }
#query-box { border: none; outline: none; flex: 1; min-width: 140px; width: 100%; padding: 8px; font-size: 1rem; background: transparent; font-family: inherit; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 1rem; font-weight: 600; font-family: inherit; padding: 12px 20px;
  background: var(--soft); color: var(--ink);
}
.btn:hover { background: #ece2d4; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(154, 52, 18, .22); }
.btn.primary:hover { background: var(--primary-2); }
.btn.small { padding: 9px 14px; font-size: .85rem; border-radius: 10px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { background: var(--soft); }
#ingredient-form .btn.primary { width: 100%; margin-top: 14px; }

.hint { color: var(--muted); font-size: .85rem; }
.hint a { color: var(--primary); font-weight: 600; text-decoration: none; }
kbd { background: var(--soft); border-radius: 5px; padding: 1px 6px; font-size: .8rem; font-family: var(--sans); }
/* ---- Quick links (home page) ---- */
.quick-links { margin-top: 26px; }
.quick-links h3 { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.quick-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; padding: 16px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.quick-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-tile .ic { font-size: 1.9rem; line-height: 1; }
.quick-tile .label { font-size: .84rem; font-weight: 600; }
.quick-tile .note { font-size: .68rem; color: var(--muted); }

/* ---- Sort bar (results pages) ---- */
.sort-bar { margin: 4px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.sort-bar a { color: var(--primary-2); text-decoration: none; background: var(--primary-soft); padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.sort-bar a:hover { background: #cdeafb; }
.sort-bar a.on { background: var(--primary); color: #fff; }

/* ---- Search bar ---- */
.search-bar input[type=text] {
  width: 100%; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 1rem; margin-bottom: 8px; font-family: inherit;
  background: var(--card); color: var(--ink);
}
.search-bar input[type=text]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.filters { display: flex; gap: 8px; }
.filters input, .filters select { padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; font-family: inherit; background: var(--card); color: var(--ink); }
.filters input { width: 96px; }
.filters select { flex: 1; }

.heading { font-size: 1.35rem; margin: 20px 0 12px; }
.empty { color: var(--muted); padding: 34px 16px; text-align: center; }

/* ---- Recipe grid ---- */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); position: relative;
}
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { transform: translateY(-3px); }
.card-link, .card-link img { transition: transform .22s ease; }
.card-link:hover img { transform: scale(1.04); }
.card img { width: 100%; height: 168px; object-fit: cover; display: block; background: var(--soft); }
.card-body { padding: 14px 15px 16px; }
.card-body h3 { margin: 0 0 9px; font-size: 1.08rem; line-height: 1.25; font-family: var(--serif); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.kcal { background: var(--green-2); color: #fff; border-radius: 999px; padding: 4px 11px; font-size: .76rem; font-weight: 600; }
.pill { background: var(--soft); color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: .76rem; font-weight: 500; }
.pill.warn { background: #fbe9dc; color: var(--warn); }
.pill.ok { background: var(--green-soft); color: var(--green-2); font-weight: 600; }

/* ---- Strict-match toggle bar on ingredient results ---- */
.strict-bar {
  background: var(--primary-soft); border: 1px solid #bfe3f7;
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px;
  font-size: .88rem; color: var(--ink);
}
.strict-bar a { color: var(--primary); font-weight: 600; white-space: nowrap; }

.fav-btn {
  position: absolute; top: 11px; right: 11px; width: 40px; height: 40px;
  border-radius: 50%; border: none; cursor: pointer; font-size: 1.15rem;
  background: rgba(255,255,255,.92); color: #cdbfb0; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
}
.fav-btn:hover { transform: scale(1.08); }
.fav-btn.on { color: var(--gold); }
.fav-btn.big { position: static; width: 46px; height: 46px; font-size: 1.4rem; flex: 0 0 auto; }

/* ---- Recipe detail ---- */
.detail .hero-img { width: 100%; height: 260px; object-fit: cover; border-radius: var(--radius); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.detail-head h1 { font-size: 1.6rem; margin: 0; line-height: 1.15; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); margin: 12px 0; font-size: .9rem; align-items: center; }
.nutrition {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: baseline;
  background: var(--green-soft); border-radius: var(--radius); padding: 16px 18px;
  margin: 16px 0;
}
.nutrition div { display: flex; flex-direction: column; }
.nutrition strong { font-size: 1.4rem; color: var(--green-2); font-family: var(--serif); }
.nutrition span { font-size: .74rem; color: var(--muted); }
.nutrition small { margin-left: auto; color: var(--muted); }

.ib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ingredients { list-style: none; padding: 0; }
.ingredients li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ingredients label { display: flex; gap: 10px; cursor: pointer; align-items: center; }
.ingredients input { accent-color: var(--green); width: 17px; height: 17px; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 12px; line-height: 1.6; padding-left: 4px; }
.steps li::marker { color: var(--primary); font-weight: 700; }
.source { color: var(--muted); }
.source a { color: var(--primary); font-weight: 600; }

/* ---- Shopping list ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pantry-head { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.pantry-head .heading { font-size: 2rem; margin: 10px 0 6px; line-height: 1.1; }
.pantry-head .btn-row { flex-direction: row; justify-content: center; flex-wrap: wrap; }
.shopping { list-style: none; padding: 0; }
.shopping li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 13px 15px; margin-bottom: 9px; display: flex; align-items: center; gap: 10px;
}
.shopping label { display: flex; align-items: center; gap: 11px; flex: 1; cursor: pointer; }
.shopping input { accent-color: var(--green); width: 18px; height: 18px; }
.shopping .from { color: var(--muted); font-size: .74rem; }
.shopping li.done .item { text-decoration: line-through; color: var(--muted); }
.shopping .remove, .pantry-list .remove, .log-list .remove { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 4px; border-radius: 6px; }
.shopping .drag-handle { cursor: grab; color: var(--muted); font-size: 1rem; touch-action: none; }
.shopping li.dragging { opacity: .4; }
.shopping .item-qty {
  width: 56px; flex-shrink: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .82rem; font-family: inherit; text-align: center;
}
.shopping .move { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 4px; border-radius: 6px; }
.shopping .move:hover { color: var(--primary); background: var(--soft); }

#list-picker-dialog { border: none; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; max-width: 320px; width: 90vw; }
#list-picker-dialog::backdrop { background: rgba(23, 49, 61, .45); }
#list-picker-dialog h3 { margin: 0 0 12px; font-family: var(--serif); color: var(--ink); }
#list-picker-select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; font-family: inherit; margin-bottom: 12px; }
.shopping .remove:hover, .pantry-list .remove:hover, .log-list .remove:hover { color: var(--warn); background: var(--soft); }

/* ---- Guides ---- */
.guide-list { display: grid; gap: 12px; }
.guide-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; }
.guide-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.guide-card h3 { margin: 0 0 6px; color: var(--primary); font-size: 1.1rem; }
.guide-card p { margin: 0; color: var(--muted); }
.guide .back, .back { color: var(--primary); text-decoration: none; display: inline-block; margin-bottom: 12px; font-weight: 600; font-size: .9rem; }
.guide p { line-height: 1.7; }

/* ---- Friendly error page ---- */
.service-error { text-align: center; max-width: 400px; margin: 44px auto; }
.service-error .big-emoji { font-size: 3.2rem; }
.service-error h1 { font-size: 1.6rem; margin: 12px 0; }
.service-error p { color: var(--muted); line-height: 1.6; margin-bottom: 22px; }

/* ---- Bottom tab bar ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: stretch; z-index: 20;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: .6rem; flex: 1; min-width: 0; padding-top: 6px;
}
.tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; flex-shrink: 0; }
.tabbar a span { font-size: .6rem; font-weight: 500; white-space: nowrap; }
.tabbar a:hover { color: var(--ink); }
@media (max-width: 400px) {
  .tabbar a svg { width: 19px; height: 19px; }
  .tabbar a span { font-size: .54rem; }
}
.tabbar a.active { color: var(--primary); }

.toast {
  position: fixed; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; opacity: 0; transition: opacity .2s; z-index: 30; box-shadow: var(--shadow);
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; }

/* ---- Search match toggle ---- */
.match-toggle { display: flex; align-items: center; gap: 8px; font-size: .9rem; margin: 6px 0 10px; }
.match-toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
.match-toggle small { color: var(--muted); }
.search-bar .filters { margin-bottom: 8px; }

/* ---- Add-to-plan / recipe actions ---- */
.plan-add { text-decoration: none; margin-top: 8px; }
.recipe-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.log-today { cursor: pointer; }

/* ---- World foods ---- */
.world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; margin-top: 8px; }
.world-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; padding: 18px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.world-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.world-tile .flag { font-size: 2.1rem; line-height: 1; }
.world-tile .country { font-size: .86rem; font-weight: 600; text-align: center; }
.world-tile .note { font-size: .62rem; color: var(--muted); text-align: center; line-height: 1.2; }

/* ---- Dietary needs / intolerances filter ---- */
.diet-needs { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--card); }
.diet-needs summary { cursor: pointer; font-size: .9rem; color: var(--primary); font-weight: 600; }
.intol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.intol { display: flex; align-items: center; gap: 7px; font-size: .85rem; }
.intol input { accent-color: var(--green); }
@media (min-width: 480px) { .intol-grid { grid-template-columns: 1fr 1fr 1fr; } }

/* ---- Pantry ---- */
.pantry-add { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.pantry-add input, .pantry-add select { padding: 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .95rem; font-family: inherit; background: var(--card); color: var(--ink); }
.pantry-add #pantry-name { flex: 1; min-width: 140px; }
.add-item-trigger { width: 100%; margin: 4px 0 14px; }
#add-item-dialog {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(420px, 92vw); font-family: var(--sans);
}
#add-item-dialog::backdrop { background: rgba(23, 49, 61, .45); }
#add-item-dialog h3 { margin: 0 0 12px; font-family: var(--serif); color: var(--ink); }
#add-item-dialog .pantry-add { flex-direction: column; flex-wrap: nowrap; margin: 0; }
#add-item-dialog .pantry-add input { width: 100%; box-sizing: border-box; flex: none; min-width: 0; }
#add-item-dialog .pantry-add-row2 { display: flex; gap: 8px; }
#add-item-dialog .pantry-add-row2 input { flex: 1; min-width: 0; }
#add-item-dialog .btn-row { justify-content: flex-end; margin-top: 4px; }
.pantry-meta-row { display: flex; gap: 6px; margin-top: 6px; }
.food-cat-input, .expiry-input {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  font-size: .74rem; font-family: inherit; background: var(--soft); color: var(--muted);
  flex: 1 1 0; min-width: 0;
}
.scan-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.barcode-manual { display: flex; gap: 6px; flex: 1; }
.barcode-manual input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .9rem; font-family: inherit; background: var(--card); color: var(--ink); }
.scanner { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.scanner video { width: 100%; max-width: 420px; border-radius: var(--radius-sm); background: #000; }
.pantry-list { list-style: none; padding: 0; margin: 14px 0 0; }
.pantry-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 13px 15px; margin-bottom: 9px; display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; row-gap: 8px;
}
.pantry-list li .log-main { flex: 1 1 100%; }
.pantry-list li .stock-ctl { order: 2; }
.pantry-list li .remove { order: 3; margin-left: auto; }

/* ---- Meal planner calendar ---- */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-head .heading { margin: 14px 0; }
.month-nav { text-decoration: none; color: var(--primary); font-size: 1.8rem; padding: 0 10px; line-height: 1; border-radius: 8px; }
.month-nav:hover { background: var(--primary-soft); }
.add-banner {
  background: var(--primary-soft); border: 1px solid #edd3c6; border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 12px; display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap; font-size: .9rem;
}
.add-banner .btn { margin-left: auto; }
.plan-toolbar { margin-bottom: 12px; }

.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.calendar { min-width: 630px; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 5px; }
.weekdays .weekday { text-align: center; font-size: .7rem; color: var(--muted); padding: 2px 0; font-weight: 600; }
.day {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 5px; min-height: 96px;
  display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-sm);
}
.day.muted { opacity: .5; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 1.5px var(--primary); }
.day-top { display: flex; align-items: center; justify-content: space-between; }
.day-num { font-weight: 700; font-size: .78rem; }
.day-total { font-size: .58rem; color: var(--green-2); background: var(--green-soft); border-radius: 6px; padding: 1px 5px; font-weight: 600; }
.slot {
  display: flex; align-items: center; gap: 4px; font-size: .62rem;
  min-height: 16px; border-radius: 6px; background: var(--soft); padding: 3px 4px;
}
.slot.filled { background: var(--green-soft); }
.slot .mt { font-weight: 700; color: var(--muted); flex: 0 0 auto; }
.slot .dish { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.slot .dish.empty { color: #cbbfb0; text-align: center; }
.slot-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: .6rem; padding: 0 1px; }
.calendar.adding .slot { cursor: pointer; }
.calendar.adding .slot:hover { outline: 1.5px solid var(--primary); }

/* ---- Home explore tiles ---- */
.explore { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.explore-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink); padding: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
}
.explore-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.explore-tile .ic {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.explore-tile .ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.explore-tile:nth-child(2n) .ic { background: var(--green-soft); color: var(--green-2); }

/* ---- Pager ---- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 22px 0 6px; }
.pager a {
  min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-sm);
}
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager a.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- List chooser bottom sheet ---- */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(23, 49, 61, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--card); border-radius: 20px 20px 0 0; width: 100%; max-width: 480px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(18, 84, 118, .18);
  display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto;
}
.sheet h3 { margin: 0 0 6px; font-size: 1.1rem; }
.sheet-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--soft);
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: .95rem; font-weight: 600;
  color: var(--ink); cursor: pointer; font-family: inherit;
}
.sheet-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.sheet-item small { color: var(--muted); font-weight: 400; }
.sheet-item.new { background: var(--green-soft); color: var(--green-2); justify-content: center; }
.sheet-cancel {
  border: none; background: none; color: var(--muted); padding: 10px; cursor: pointer;
  font-size: .9rem; font-family: inherit;
}

/* ---- Shopping lists index ---- */
.list-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .list-cards { grid-template-columns: 1fr 1fr; } }
.list-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.list-card:hover { box-shadow: var(--shadow); }
.list-open { flex: 1; text-decoration: none; color: inherit; min-width: 0; }
.list-open h3 { margin: 0 0 3px; font-size: 1.1rem; }
.list-open small { color: var(--muted); }
.mini-bar { background: var(--soft); border-radius: 999px; height: 6px; margin-top: 8px; overflow: hidden; }
.mini-bar div { background: var(--green); height: 100%; border-radius: 999px; }
.list-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border: none; border-radius: 10px; background: none;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--soft); color: var(--primary); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.list-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.shopping .item { cursor: pointer; }
.shopping .item:hover { color: var(--primary); }

/* ---- Pantry stock counts ---- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stock-ctl {
  display: flex; align-items: center; justify-content: space-between; gap: 2px; flex: 1 1 100%;
  background: var(--soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px;
}
.stock-ctl .step {
  width: 34px; height: 34px; border: none; border-radius: 50%; background: var(--card);
  color: var(--primary); font-size: 1.05rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.stock-ctl .step:hover { background: var(--primary-soft); }
.stock-num {
  width: 40px; border: none; background: none; text-align: center;
  font-size: .95rem; font-weight: 700; color: var(--ink); font-family: inherit;
  -moz-appearance: textfield; appearance: textfield;
}
.stock-num::-webkit-outer-spin-button, .stock-num::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* ---- "Running short" panel (red = below your pantry defaults) ---- */
.short-panel {
  background: #fef1f1; border: 1px solid #f6cfcf; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px; margin-top: 26px;
}
.short-panel.all-good { background: var(--green-soft); border-color: #b9e8d2; }
.short-panel .heading { margin: 0; }
.short-list { list-style: none; padding: 0; margin: 8px 0 0; }
.short-list li {
  display: flex; align-items: baseline; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid #f3dcdc;
}
.short-list li:last-child { border-bottom: none; }
.short-name { flex: 1; font-weight: 600; color: #b91c1c; text-transform: capitalize; }
.short-count {
  background: #dc2626; color: #fff; border-radius: 999px; padding: 3px 10px;
  font-size: .75rem; font-weight: 600;
}
.short-list small { color: var(--muted); }
.ok-msg { padding: 8px 0 0; text-align: left; }
.ok-msg a { color: var(--green-2); }

/* ---- "Expiring soon" panel (amber = soon, red = past) ---- */
.expiry-panel { background: #fff8ec; border-color: #f3e0b8; }
.expiry-panel.all-good { background: var(--green-soft); border-color: #b9e8d2; }
.expiry-panel .short-name { color: #b45309; }
.expiry-panel .short-count { background: #d97706; }
.expiry-panel li.past .short-name { color: #b91c1c; }
.expiry-panel li.past .short-count { background: #dc2626; }

/* ---- Pantry defaults page ---- */
.defaults { list-style: none; padding: 0; margin: 6px 0 0; }
.defaults li {
  background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin-bottom: 8px;
}
.defaults .s-name { flex: 1; font-weight: 600; text-transform: capitalize; }
.have-note { color: var(--muted); font-size: .8rem; }
.have-note.short { color: #dc2626; font-weight: 600; }
.amount-num {
  width: 58px; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  text-align: center; font-weight: 700; font-family: inherit; color: var(--ink);
}
.stock-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.stock-dot.ok { background: var(--green); }
.stock-dot.missing { background: #dc2626; }

/* ---- Calorie tracker ---- */
.cal-summary {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.ring-total { display: flex; align-items: baseline; gap: 8px; }
.ring-total strong { font-size: 2.4rem; color: var(--ink); font-family: var(--serif); font-weight: 600; }
.ring-total span { color: var(--muted); }
.bar { background: var(--soft); border-radius: 999px; height: 13px; overflow: hidden; margin: 12px 0 8px; }
.bar-fill { background: var(--green); height: 100%; border-radius: 999px; transition: width .4s ease; }
.bar-fill.over { background: var(--warn); }
.ring-meta { font-size: .92rem; color: var(--muted); }
.ring-meta .over { color: var(--warn); font-weight: 600; }
.over { color: var(--warn); }
.goal-form { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.goal-form label { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); font-weight: 500; }
.goal-form input { width: 88px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; font-family: inherit; background: var(--card); color: var(--ink); }

.log-add { display: flex; gap: 6px; margin-bottom: 10px; }
.log-add input { padding: 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .95rem; font-family: inherit; background: var(--card); color: var(--ink); }
.log-add #log-name { flex: 1; min-width: 0; }
.log-add .narrow { width: 72px; }
.import-plan { margin-bottom: 12px; }

.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 13px 15px; margin-bottom: 9px; display: flex; align-items: center; gap: 10px;
}
.log-main { flex: 1; display: flex; flex-direction: column; }
.log-main a { color: var(--ink); text-decoration: none; font-weight: 600; }
.log-main a:hover { color: var(--primary); }
.log-main small { color: var(--muted); font-size: .78rem; }

/* ---- Reports ---- */
.report-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.report-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.report-card h3 { margin: 0 0 10px; font-size: .82rem; color: var(--muted); font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.report-card .big { font-size: 2rem; font-weight: 600; color: var(--ink); display: flex; flex-direction: column; font-family: var(--serif); }
.report-card .big small { font-size: .68rem; color: var(--muted); font-weight: 400; font-family: var(--sans); }
.report-card ul { list-style: none; padding: 0; margin: 12px 0 0; font-size: .82rem; color: var(--muted); }
.report-card li { padding: 3px 0; }

.chart-wrap { margin-top: 8px; }
.chart {
  position: relative; display: flex; align-items: flex-end; gap: 4px; height: 156px;
  background: var(--soft); border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 0 10px;
}
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; background: var(--green); border-radius: 5px 5px 0 0; min-height: 2px; }
.chart-bar.over { background: var(--warn); }
.chart-bar.empty { background: #e2d8ca; }
.goal-line { position: absolute; left: 0; right: 0; bottom: var(--goal); border-top: 2px dashed var(--primary); pointer-events: none; opacity: .6; }
.goal-line span { position: absolute; right: 6px; top: -9px; font-size: .6rem; color: var(--primary); background: var(--soft); padding: 0 4px; font-weight: 600; }
.chart-x-row { display: flex; gap: 4px; padding: 4px 10px 0; }
.chart-x { flex: 1; text-align: center; font-size: .58rem; color: var(--muted); }

/* ---- Star ratings ---- */
.rate-block {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0;
}
.rate-stars { display: flex; gap: 2px; }
.star {
  border: none; background: none; cursor: pointer; font-size: 1.5rem;
  line-height: 1; color: #d5dfe5; padding: 2px;
  transition: color .12s, transform .12s;
}
.star:hover { transform: scale(1.15); }
.star.on { color: var(--gold); }
.rate-meta { color: var(--muted); font-size: .85rem; }

/* ---- Pantry category chips ---- */
.cat-chip {
  font-style: normal; background: var(--green-soft); color: var(--green-2);
  border-radius: 999px; padding: 2px 9px; font-size: .68rem; font-weight: 700;
  margin-left: 6px; text-transform: capitalize; white-space: nowrap;
}
.cat-add {
  border: 1px dashed var(--line); background: none; color: var(--primary);
  border-radius: 999px; padding: 2px 9px; font-size: .68rem; font-weight: 600;
  margin-left: 6px; cursor: pointer; white-space: nowrap; font-family: inherit;
}
.cat-add:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ---- Blog ---- */
.blog-hero { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); margin: 10px 0; }

/* ---- Community recipe submissions (admin review queue) ---- */
.log-list li.submission-row { align-items: flex-start; flex-wrap: wrap; }
.sub-thumb { width: 100%; max-width: 220px; border-radius: var(--radius-sm); margin: 8px 0; display: block; }
.submission-row details { margin-top: 6px; font-size: .84rem; color: var(--muted); }
.submission-row summary { cursor: pointer; color: var(--primary); font-weight: 600; }

/* ---- Footer ---- */
.site-foot { margin: 32px 0 8px; text-align: center; font-size: .8rem; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--primary); }
.early-access-note { color: var(--muted); margin: 0 0 6px; }

/* ---- Free-tier gate CTA (results pages) ---- */
.gate-card {
  background: var(--primary-soft); border: 1px solid #b8e2f7; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; margin-top: 10px; text-align: center;
}
.gate-card h3 { margin: 0 0 4px; }
.gate-card p { margin: 0 0 14px; color: var(--ink); font-size: .92rem; }
.gate-card .btn-row { justify-content: center; }

/* ---- Mailing list box (home) ---- */
.mail-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; margin-top: 26px;
}
.mail-box h3 { margin: 0 0 4px; }
.mail-box p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.mail-form { display: flex; gap: 8px; }
.mail-form input {
  flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 12px; font-size: .95rem; font-family: inherit;
}

/* ---- Activity feed (reports) ---- */
.activity-feed {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 6px 14px; margin-bottom: 6px;
  max-height: 340px; overflow-y: auto;
}
.act-row {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .85rem;
}
.act-row:last-child { border-bottom: none; }
.act-who { font-weight: 700; color: var(--primary); }
.act-what { flex: 1; min-width: 200px; }
.act-what a { color: var(--ink); }
.act-row small { color: var(--muted); font-size: .72rem; }
.chart-bar.signup { background: var(--primary); }

/* ---- Reports: headline cards / users / range tabs / hour chart ---- */
.report-cards.stat-4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .report-cards.stat-4 { grid-template-columns: repeat(4, 1fr); } }

.users-table {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 6px;
}
.u-row {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr 56px; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  font-size: .84rem; align-items: baseline;
}
.u-row:last-child { border-bottom: none; }
.u-row.u-head { background: var(--soft); color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.u-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-admin {
  font-style: normal; background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: 1px 8px; font-size: .68rem; font-weight: 700; margin-left: 6px;
}
.u-row .num { text-align: right; font-weight: 700; color: var(--green-2); }
@media (max-width: 520px) {
  .u-row { grid-template-columns: 1.2fr 1fr 48px; }
  .u-row span:nth-child(2) { display: none; }  /* hide Joined on tiny screens */
}

.range-tabs { display: flex; gap: 6px; }
.range-tabs a {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); text-decoration: none;
  font-size: .8rem; font-weight: 600;
}
.range-tabs a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chart.hours { gap: 2px; }
.muted-note { color: var(--muted); font-weight: 400; font-size: .78rem; }

/* ---- Admin stats tables ---- */
.stat-tables { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 560px) { .stat-tables { grid-template-columns: 1fr 1fr; } }
.stat-table { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; }
.stat-table h3 { margin: 0 0 8px; font-size: .82rem; color: var(--muted); font-family: var(--sans); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-table ul { list-style: none; padding: 0; margin: 0; }
.stat-table li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .85rem; }
.stat-table li:last-child { border-bottom: none; }
.stat-table li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.stat-table li b { color: var(--green-2); }

/* ---- Receipt scan import (popup review dialog) ---- */
#receipt-dialog {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(560px, 92vw); max-height: 85vh; font-family: var(--sans);
}
#receipt-dialog::backdrop { background: rgba(23, 49, 61, .45); }
#receipt-dialog h3 { margin: 0 0 4px; font-family: var(--serif); color: var(--ink); }
.receipt-review-list { list-style: none; margin: 12px 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.receipt-review-list li {
  display: flex; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.receipt-review-list li:last-child { border-bottom: none; }
.receipt-review-list input[type=text] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; font-family: inherit;
}
.receipt-review-list .receipt-name { flex: 1.4; min-width: 0; }
.receipt-review-list .receipt-category { flex: 1; min-width: 0; }
.receipt-review-list input[type=date] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .85rem; font-family: inherit;
}
.receipt-review-list .receipt-price {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .85rem; font-family: inherit;
  flex: 0 0 72px; width: 72px;
}
.receipt-review-list .receipt-remove, .receipt-review-list .receipt-link {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 4px;
}
.receipt-review-list .receipt-remove:hover { color: var(--warn); }
.receipt-review-list .receipt-link:hover { color: var(--primary); }
.receipt-review-list li.receipt-linked .receipt-link { color: var(--green-2); }
.receipt-error { color: var(--warn); font-size: .88rem; margin: 0 0 10px; }


/* ---- Pantry mobile layout (<=600px) ---- */
@media (max-width: 600px) {
  .stock-num { width: 34px; font-size: 1rem; }

  .receipt-review-list li { flex-wrap: wrap; row-gap: 6px; }
  .receipt-review-list .receipt-name,
  .receipt-review-list .receipt-category,
  .receipt-review-list input[type=date],
  .receipt-review-list .receipt-price { flex: 1 1 100%; min-width: 0; width: auto; }
  .receipt-review-list .receipt-remove { margin-left: auto; }
}


/* ---- Meal-plan auto-fill preview dialog ---- */
#preview-dialog {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(560px, 92vw); max-height: 85vh; font-family: var(--sans);
}
#preview-dialog::backdrop { background: rgba(23, 49, 61, .45); }
#preview-dialog h3 { margin: 0 0 4px; font-family: var(--serif); color: var(--ink); }
#preview-days { max-height: 55vh; overflow-y: auto; margin: 12px 0; }
.preview-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 10px; }
.preview-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.preview-slot {
  display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line);
}
.preview-slot .mt {
  width: 22px; height: 22px; border-radius: 50%; background: var(--soft); color: var(--muted);
  font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.preview-dish { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.preview-meta { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.preview-existing { font-style: normal; color: var(--muted); font-size: .72rem; background: var(--soft); border-radius: 999px; padding: 2px 8px; }
.preview-swap { padding: 4px 8px; }
.preview-slot.diff-easy .preview-meta { color: var(--green-2); }
.preview-slot.diff-medium .preview-meta { color: var(--warn); }
.preview-slot.diff-hard .preview-meta { color: #b91c1c; }

/* ---- Plan toolbar date/days inputs ---- */
.plan-toolbar input[type=date] { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: inherit; }
.plan-toolbar input[type=number].narrow { width: 60px; padding: 9px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: inherit; }

/* ---- Per-day preferences grid ---- */
.day-prefs-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.day-pref-row { display: flex; align-items: center; gap: 8px; }
.day-pref-name { width: 42px; flex: 0 0 auto; font-weight: 600; color: var(--muted); font-size: .85rem; }
.day-pref-row select { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: inherit; background: var(--card); color: var(--ink); }

@media (max-width: 600px) {
  .plan-toolbar { flex-wrap: wrap; }
  .day-pref-row { flex-wrap: wrap; }
  .day-pref-row select { flex: 1 1 45%; }
}

/* ---- Brand tagline ---- */
.tagline { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .02em; }
@media (max-width: 700px) { .tagline { display: none; } }

/* ---- Home page: ingredients / query search tabs ---- */
.tabs { display: flex; gap: 6px; margin: 14px 0 10px; }
.tab {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-weight: 600; font-size: .88rem;
  font-family: inherit; cursor: pointer;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-panel[hidden] { display: none; }

/* ---- Registration promo popup ---- */
#signup-promo-dialog {
  border: none; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; width: min(420px, 92vw); font-family: var(--sans);
}
#signup-promo-dialog::backdrop { background: rgba(23, 49, 61, .45); }
#signup-promo-dialog h3 { margin: 0 0 8px; font-family: var(--serif); color: var(--ink); }
#signup-promo-dialog ul { margin: 8px 0 16px; padding-left: 20px; color: var(--muted); }
#signup-promo-dialog .btn-row { justify-content: flex-end; margin-top: 4px; }

