:root {
  --bg: #f4f8f2;
  --surface: #ffffff;
  --surface-soft: #edf4ea;
  --text: #173028;
  --muted: #66756f;
  --border: #d8e3d5;
  --primary: #2c6e49;
  --primary-dark: #1d5134;
  --primary-soft: #dff0e4;
  --accent: #f0b95b;
  --danger: #ad3f38;
  --warning: #9b6514;
  --shadow: 0 18px 45px rgba(36, 71, 51, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  height: 78px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 21px;
  box-shadow: 0 8px 18px rgba(44, 110, 73, 0.22);
}
.brand strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }

.app-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 78px); }
.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--border);
  background: #f9fbf8;
  position: sticky;
  top: 78px;
  height: calc(100vh - 78px);
  overflow-y: auto;
}
.nav-list { display: grid; gap: 8px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 13px 14px;
  border-radius: 13px;
  color: #52615b;
  background: transparent;
  font-weight: 700;
  text-align: left;
}
.nav-item span { width: 24px; text-align: center; font-size: 18px; }
.nav-item b {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8efea;
  font-size: 12px;
}
.nav-item:hover, .nav-item.active { color: var(--primary-dark); background: var(--primary-soft); }
.nav-item.active b { background: var(--primary); color: #fff; }
.sidebar-card {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--radius-md);
  color: #fff;
  background: linear-gradient(145deg, var(--primary), #3d8059);
  box-shadow: var(--shadow);
}
.sidebar-card small { display: block; opacity: 0.78; }
.sidebar-card strong { display: block; margin: 5px 0 13px; font-size: 25px; }
.sidebar-card p { margin: 10px 0 0; font-size: 12px; line-height: 1.45; opacity: 0.84; }
.meter { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.22); overflow: hidden; }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: #fff; transition: width .25s ease; }
.sidebar-footnote { margin: 20px 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.main-content { padding: 34px; min-width: 0; }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
  padding: 34px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% 20%, rgba(255,255,255,0.22), transparent 30%),
    linear-gradient(135deg, #245f40, #44835f);
  color: #fff;
  box-shadow: var(--shadow);
}
.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.hero-card .eyebrow { color: #cfe8d6; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.02; letter-spacing: -0.035em; }
h2 { margin: 0; font-size: 21px; letter-spacing: -0.02em; }
h3 { margin: 0; }
p { color: var(--muted); line-height: 1.6; }
.hero-card p { max-width: 680px; margin-bottom: 0; color: rgba(255,255,255,0.83); font-size: 17px; }
.hero-stat {
  min-width: 190px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.11);
  border-radius: var(--radius-md);
}
.hero-stat small, .hero-stat span { display: block; color: rgba(255,255,255,0.72); }
.hero-stat strong { display: block; margin: 5px 0; font-size: 24px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr); gap: 20px; margin-top: 22px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(35, 64, 44, 0.045);
  padding: 24px;
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.step {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
}

label { display: grid; gap: 7px; color: #43544d; font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cad8cb;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(44,110,73,.12); }
textarea { resize: vertical; }
.input-action-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 8px; }
.primary-button, .secondary-button, .text-button, .danger-link, .icon-button {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}
.primary-button { background: var(--primary); color: #fff; padding: 12px 17px; box-shadow: 0 8px 18px rgba(44,110,73,.17); }
.primary-button:hover { background: var(--primary-dark); }
.secondary-button { background: var(--surface-soft); color: var(--primary-dark); padding: 11px 15px; border: 1px solid #d2e2d4; }
.secondary-button:hover { background: #e3eee3; }
.text-button { color: var(--primary); background: transparent; padding: 6px; }
.danger-link { color: var(--danger); background: transparent; padding: 8px; }
.icon-button { background: transparent; padding: 10px; font-size: 21px; }
button:disabled { opacity: .55; cursor: not-allowed; }

.camera-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.camera-actions span { color: var(--muted); font-size: 12px; }
.camera-box { position: relative; margin-top: 16px; border-radius: 18px; overflow: hidden; background: #12231b; aspect-ratio: 16 / 9; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-line { position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: #ffdc8c; box-shadow: 0 0 12px rgba(255,220,140,.9); animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(-65px); } to { transform: translateY(65px); } }
.camera-close { position: absolute; right: 12px; bottom: 12px; border: 0; border-radius: 10px; padding: 9px 12px; background: rgba(0,0,0,.62); color: #fff; font-weight: 700; }
.manual-entry { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--border); }
.manual-entry summary { cursor: pointer; color: var(--primary-dark); font-weight: 750; }
.manual-ai-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.manual-ai-tools > div { display: grid; gap: 3px; }
.manual-ai-tools b { color: var(--primary-dark); }
.manual-ai-tools small { color: var(--muted); line-height: 1.4; font-weight: 500; }
.manual-ai-status { display: none; margin-top: 4px; color: var(--primary); font-size: 12px; font-weight: 700; }
.manual-ai-status.visible { display: block; }
.stack-form { display: grid; gap: 16px; margin-top: 18px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.result-panel { min-height: 410px; }
.empty-state { min-height: 300px; display: grid; align-content: center; justify-items: center; text-align: center; padding: 30px; }
.empty-state p { max-width: 430px; margin-bottom: 0; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); font-size: 26px; margin-bottom: 15px; }
.product-card { display: grid; gap: 16px; }
.product-head { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.product-image { width: 76px; height: 76px; border: 1px solid var(--border); border-radius: 14px; object-fit: contain; background: #fff; }
.product-placeholder { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-soft); font-size: 26px; }
.product-head small { color: var(--muted); }
.fit-card { border-radius: 16px; padding: 16px; border: 1px solid; }
.fit-card.good { background: #eaf6ed; border-color: #b9dec2; }
.fit-card.caution { background: #fff6e6; border-color: #efd39c; }
.fit-card.high { background: #fff0ef; border-color: #e7b4b0; }
.fit-card.unknown { background: #f2f4f3; border-color: #d7deda; }
.fit-card strong { display: block; margin-bottom: 4px; }
.fit-card p { margin: 0; color: inherit; font-size: 13px; }
.nutrition-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nutrition-box { padding: 14px; border-radius: 14px; background: var(--surface-soft); }
.nutrition-box small { display: block; color: var(--muted); }
.nutrition-box strong { display: block; margin-top: 4px; font-size: 20px; }
.warning-list { margin: 0; padding-left: 18px; color: var(--warning); font-size: 13px; line-height: 1.5; }
.source-line { font-size: 11px; color: var(--muted); }

.next-panel { margin-top: 22px; }
.recommendation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.recommendation-card { padding: 17px; border: 1px solid var(--border); border-radius: 16px; background: #fbfcfa; }
.recommendation-card small { display: inline-block; margin-bottom: 7px; color: var(--primary); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.recommendation-card p { margin: 7px 0 0; font-size: 13px; }

.section-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 22px; }
.section-header h1 { font-size: clamp(34px, 4vw, 46px); }
.section-header p { max-width: 700px; margin-bottom: 0; }
.summary-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.summary-card { padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.summary-card small { display: block; color: var(--muted); }
.summary-card strong { display: block; margin-top: 6px; font-size: 24px; }
.cart-list { padding: 0; overflow: hidden; }
.cart-item { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: 0; }
.cart-item-info { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cart-thumb { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border); object-fit: contain; background: #fff; flex: 0 0 auto; }
.cart-thumb-placeholder { width: 52px; height: 52px; border-radius: 12px; background: var(--surface-soft); display: grid; place-items: center; flex: 0 0 auto; }
.cart-item-info strong, .cart-item-info small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-info small { margin-top: 4px; color: var(--muted); }
.quantity-control { display: flex; align-items: center; gap: 8px; }
.quantity-control button { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--primary-dark); font-weight: 900; }
.cart-item-actions { text-align: right; }
.cart-item-actions strong { display: block; }
.cart-item-actions button { border: 0; background: transparent; color: var(--danger); padding: 4px 0; font-size: 12px; }

.segmented { padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.segmented button { border: 0; border-radius: 9px; background: transparent; padding: 8px 13px; color: var(--muted); font-weight: 800; }
.segmented button.active { background: var(--primary); color: #fff; }
.plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.ai-status { margin-left: auto; color: var(--muted); font-size: 12px; }
.ai-status.enabled { color: var(--primary); font-weight: 750; }
.wide-empty { min-height: 360px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.day-card { padding: 20px; border-radius: 20px; background: #fff; border: 1px solid var(--border); }
.day-card h3 { margin-bottom: 12px; }
.meal-line { padding: 11px 0; border-top: 1px solid #edf1ec; }
.meal-line:first-of-type { border-top: 0; }
.meal-line small { display: block; color: var(--primary); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.meal-line span { display: block; margin-top: 4px; color: #3f5149; line-height: 1.45; }
.plan-note { margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--surface-soft); font-size: 13px; color: var(--muted); }
.missing-list { margin-top: 18px; }
.missing-list h2 { margin-bottom: 12px; }
.ai-output { white-space: pre-wrap; font-family: inherit; line-height: 1.6; overflow-wrap: anywhere; }

.pressure-grid { grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); }
.pressure-inputs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; }
.pressure-inputs span { font-size: 28px; padding-bottom: 8px; color: var(--muted); }
.pressure-alert { margin-top: 18px; padding: 15px; border-radius: 14px; border: 1px solid; }
.pressure-alert.good { background: #eaf6ed; border-color: #b9dec2; }
.pressure-alert.caution { background: #fff6e6; border-color: #efd39c; }
.pressure-alert.high, .pressure-alert.urgent { background: #fff0ef; border-color: #e7b4b0; }
.pressure-alert strong { display: block; margin-bottom: 5px; }
.pressure-alert p { margin: 0; color: inherit; font-size: 13px; }
.reading-list { display: grid; gap: 9px; }
.reading-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.reading-row:first-child { border-top: 0; }
.reading-value { font-size: 20px; font-weight: 850; }
.reading-meta small { display: block; color: var(--muted); }
.status-pill { padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--surface-soft); }
.status-pill.high, .status-pill.urgent { color: var(--danger); background: #fff0ef; }
.status-pill.caution { color: var(--warning); background: #fff6e6; }
.status-pill.good { color: var(--primary); background: #eaf6ed; }
.medical-note { margin-top: 18px; padding: 18px 20px; border-radius: 16px; background: #fff3f1; border: 1px solid #efd1cc; }
.medical-note p { margin: 6px 0 0; color: #6f4944; }

.settings-panel { max-width: 900px; }
.form-actions { display: flex; align-items: center; gap: 12px; }
#profileSaveStatus { color: var(--primary); font-size: 13px; }
.technical-panel { max-width: 900px; margin-top: 18px; }
.status-list { display: grid; gap: 12px; margin-top: 18px; }
.status-list > div { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.status-list small { color: var(--muted); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #c5ccc8; }
.status-dot.ready { background: #4e9c68; box-shadow: 0 0 0 4px rgba(78,156,104,.12); }
.status-dot.optional { background: var(--accent); box-shadow: 0 0 0 4px rgba(240,185,91,.14); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  max-width: min(380px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 13px;
  background: #173028;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #7e302b; }
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: rgba(244,248,242,.78);
  backdrop-filter: blur(4px);
  color: var(--primary-dark);
  font-weight: 800;
}
.spinner { width: 34px; height: 34px; border: 4px solid #cfe0d1; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .main-content { padding: 26px; }
  .content-grid { grid-template-columns: 1fr; }
  .recommendation-grid, .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 16px; }
  .brand small { display: none; }
  .mobile-only { display: inline-grid; }
  .app-shell { display: block; min-height: calc(100vh - 68px); }
  .sidebar {
    position: fixed;
    top: 68px;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(300px, 88vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .main-content { padding: 18px 14px 34px; }
  .hero-card { grid-template-columns: 1fr; padding: 25px 21px; gap: 22px; }
  .hero-stat { min-width: 0; }
  .panel { padding: 19px; border-radius: 20px; }
  .panel-heading, .section-header { align-items: flex-start; flex-direction: column; }
  .panel-heading > div { align-items: flex-start; }
  .text-button { align-self: flex-start; }
  .input-action-row { grid-template-columns: 1fr; }
  .input-action-row .primary-button { width: 100%; }
  .camera-actions { align-items: flex-start; flex-direction: column; }
  .two-column, .three-column, .summary-cards, .recommendation-grid, .plan-grid { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 1fr auto; }
  .quantity-control { grid-column: 1 / -1; }
  .cart-item-actions { grid-column: 2; grid-row: 1; }
  .ai-status { width: 100%; margin-left: 0; }
  .pressure-grid { grid-template-columns: 1fr; }
  .reading-row { grid-template-columns: 80px 1fr; }
  .reading-row .status-pill { grid-column: 2; justify-self: start; }
  .status-list > div { grid-template-columns: 12px 1fr; }
  .status-list small { grid-column: 2; }
}

/* Private account and authentication */
.account-area { display: flex; align-items: center; gap: 12px; }
.account-area form { margin: 0; }
.account-name { color: var(--muted); font-size: 13px; font-weight: 750; }
.privacy-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.account-panel { max-width: 900px; margin-bottom: 18px; }
.account-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.account-summary > div { padding: 15px; border-radius: 14px; background: var(--surface-soft); overflow-wrap: anywhere; }
.account-summary small { display: block; color: var(--muted); }
.account-summary strong { display: block; margin-top: 5px; }
.password-details { margin-top: 18px; }
#passwordSaveStatus { color: var(--primary); font-size: 13px; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 10%, rgba(44,110,73,.12), transparent 31%),
    radial-gradient(circle at 90% 85%, rgba(240,185,91,.16), transparent 28%),
    var(--bg);
}
.auth-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 30px;
  align-items: stretch;
}
.auth-intro {
  padding: clamp(28px, 5vw, 58px);
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 12%, rgba(255,255,255,.16), transparent 26%),
    linear-gradient(145deg, #1d5134, #3f805b);
  box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 54px; }
.auth-brand .brand-mark { background: #fff; color: var(--primary-dark); }
.auth-brand small { color: rgba(255,255,255,.72); }
.auth-intro .privacy-badge { background: rgba(255,255,255,.15); color: #fff; }
.auth-intro h1 { margin: 20px 0 14px; max-width: 600px; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -.04em; }
.auth-intro > p { max-width: 590px; color: rgba(255,255,255,.82); line-height: 1.65; }
.auth-benefits { display: grid; gap: 13px; margin: 30px 0 0; padding: 0; list-style: none; }
.auth-benefits li { position: relative; padding-left: 28px; color: rgba(255,255,255,.88); }
.auth-benefits li::before { content: "✓"; position: absolute; left: 0; font-weight: 900; }
.auth-card {
  align-self: center;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 7px 0 8px; font-size: 34px; }
.auth-card > p { color: var(--muted); line-height: 1.55; }
.auth-form { margin-top: 22px; }
.auth-form label small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.full-button { width: 100%; justify-content: center; }
.auth-error { margin: 18px 0; padding: 13px 15px; border: 1px solid #e7b4b0; border-radius: 13px; background: #fff0ef; color: #7e302b; line-height: 1.45; }
.auth-switch { margin: 22px 0 0; font-size: 13px; }
.auth-switch a { color: var(--primary); font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 820px) {
  .auth-body { padding: 14px; place-items: start center; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { padding: 28px 24px; border-radius: 24px; }
  .auth-brand { margin-bottom: 28px; }
  .auth-intro h1 { font-size: 36px; }
  .auth-benefits { margin-top: 20px; }
  .auth-card { width: 100%; border-radius: 24px; }
}

@media (max-width: 760px) {
  .account-name { display: none; }
  .account-area { margin-left: auto; margin-right: 8px; }
  .account-area .text-button { padding: 5px; font-size: 12px; }
  .account-summary { grid-template-columns: 1fr; }
}

/* Goal-based planning and pantry inventory */
.four-column { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.panel-intro { margin: -2px 0 16px; color: var(--muted); font-size: 14px; }
.workflow-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
}
.workflow-strip div { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.workflow-strip b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); }
.workflow-strip i { color: var(--primary); font-style: normal; font-weight: 900; }
.goal-sidebar-card { min-height: 150px; }
.mini-goal-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 12px; }
.mini-goal-list span { padding: 6px 8px; border-radius: 999px; background: rgba(255,255,255,.72); color: var(--primary-dark); font-size: 11px; font-weight: 800; line-height: 1.2; }
.goal-fieldset { margin: 0; padding: 0; border: 0; }
.goal-fieldset legend { font-size: 17px; font-weight: 850; color: var(--text); }
.goal-fieldset > p { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.goal-option { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); cursor: pointer; }
.goal-option:has(input:checked) { border-color: #88b99a; background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(44,110,73,.08); }
.goal-option input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.goal-option span { min-width: 0; }
.goal-option b, .goal-option small { display: block; }
.goal-option b { color: var(--text); }
.goal-option small { margin-top: 4px; color: var(--muted); line-height: 1.35; }
.target-grid { margin-top: 4px; }
.product-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.nutrition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 14px 0; }
.nutrition-grid .nutrition-box { min-width: 0; }
.goal-checks { display: grid; gap: 8px; margin: 14px 0; }
.goal-check { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.goal-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #9ba7a1; }
.goal-check.good .goal-dot { background: #4e9c68; }
.goal-check.caution .goal-dot { background: var(--accent); }
.goal-check.high .goal-dot { background: var(--danger); }
.goal-check small { display: block; color: var(--muted); }
.goal-check strong { display: block; margin-top: 1px; font-size: 14px; }
.goal-check p { margin: 3px 0 0; color: #51615a; font-size: 12px; line-height: 1.45; }
.product-head span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.pantry-item.low-stock { border-left: 4px solid var(--accent); }
.pantry-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.pantry-actions button { white-space: nowrap; }
.plan-source { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 13px 15px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-dark); }
.plan-source span { color: var(--muted); font-size: 13px; }

@media (max-width: 1050px) {
  .four-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .workflow-strip { align-items: stretch; flex-direction: column; gap: 8px; }
  .workflow-strip i { display: none; }
  .workflow-strip div { justify-content: flex-start; }
  .goal-grid, .four-column, .nutrition-grid, .product-actions { grid-template-columns: 1fr; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .header-actions .primary-button { width: 100%; }
  .pantry-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .plan-source { align-items: flex-start; flex-direction: column; }
}

/* Editable health and goal logs */
.goal-log-block { margin-bottom: 26px; }
.goal-log-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 4px 0 12px;
  padding: 0 4px;
}
.goal-log-title > div { display: flex; align-items: center; gap: 12px; }
.goal-log-title h2 { margin: 0; font-size: 23px; }
.goal-log-title p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.goal-log-title > strong { color: var(--text); text-align: right; }
.goal-log-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
}
.goal-log-block .panel h3 { margin: 0 0 15px; font-size: 18px; }
.reading-row { grid-template-columns: minmax(90px, auto) minmax(0, 1fr) auto auto; }
.compact-reading { min-width: 108px; max-width: 190px; font-size: 18px; line-height: 1.2; }
.log-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.log-row-actions button {
  border: 0;
  border-radius: 9px;
  padding: 7px 9px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.log-row-actions button:last-child { color: var(--danger); background: #fff0ef; }
.log-row-actions button:hover { filter: brightness(.97); }
.goal-reading-row { grid-template-columns: minmax(120px, auto) minmax(0, 1fr) auto; }
.goal-log-block + .goal-log-block { padding-top: 8px; border-top: 1px solid rgba(200, 214, 204, .7); }

@media (max-width: 760px) {
  .goal-log-title { align-items: flex-start; flex-direction: column; }
  .goal-log-title > strong { text-align: left; }
  .reading-row, .goal-reading-row { grid-template-columns: 92px minmax(0, 1fr); align-items: start; }
  .reading-row .status-pill { grid-column: 2; justify-self: start; }
  .log-row-actions { grid-column: 2; justify-content: flex-start; }
  .compact-reading { min-width: 0; max-width: none; }
}

/* Recipes, favorites, and food diary */
.plan-days { display: grid; gap: 24px; }
.plan-day { padding: 0; }
.plan-day-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.plan-day-title span { font-size: 22px; font-weight: 900; }
.plan-day-title small { color: var(--muted); }
.recipe-grid, .favorite-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.recipe-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 22px rgba(36, 71, 51, .05); }
.recipe-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recipe-card-head small { color: var(--primary); font-weight: 850; text-transform: capitalize; }
.recipe-card-head h3 { margin: 4px 0; font-size: 19px; line-height: 1.2; }
.recipe-card-head span { color: var(--muted); font-size: 12px; }
.recipe-star { display: grid !important; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark) !important; font-size: 17px !important; }
.recipe-goals { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.recipe-goals span { padding: 5px 8px; border-radius: 999px; background: #f3f7f1; color: var(--primary-dark); font-size: 11px; font-weight: 800; }
.recipe-nutrition { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 14px 0; }
.recipe-nutrition div { padding: 9px; border-radius: 11px; background: var(--surface-soft); min-width: 0; }
.recipe-nutrition small, .recipe-nutrition strong { display: block; }
.recipe-nutrition small { color: var(--muted); font-size: 10px; }
.recipe-nutrition strong { margin-top: 2px; font-size: 13px; }
.recipe-details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.recipe-details summary { color: var(--primary-dark); font-weight: 850; cursor: pointer; }
.recipe-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 13px; }
.recipe-detail-grid h4 { margin: 0 0 8px; }
.recipe-detail-grid ul, .recipe-detail-grid ol { margin: 0; padding-left: 20px; }
.recipe-detail-grid li { margin-bottom: 8px; color: #405249; line-height: 1.4; }
.recipe-detail-grid li small { display: block; color: var(--muted); font-size: 10px; }
.recipe-detail-grid li.available small { color: var(--primary); }
.nutrition-basis { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.recipe-actions button { flex: 1 1 140px; }
.favorites-panel { margin-top: 26px; }
.compact-empty { padding: 28px 18px; grid-column: 1 / -1; }
.diary-date-label { min-width: 160px; }
.diary-date-label input { margin-top: 6px; }
.diary-summary { margin-bottom: 18px; }
.daily-total-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.daily-total-card { padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); min-width: 0; }
.daily-total-card small, .daily-total-card strong, .daily-total-card span { display: block; }
.daily-total-card small { color: var(--muted); }
.daily-total-card strong { margin-top: 4px; font-size: 20px; }
.daily-total-card span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.mini-progress { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #e4ece2; }
.mini-progress i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.goal-coach-panel { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; margin-top: 12px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.goal-coach-panel h2, .goal-coach-panel h3 { margin: 0 0 10px; }
.goal-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid #edf1ec; }
.goal-progress-row:first-of-type { border-top: 0; }
.goal-progress-row strong, .goal-progress-row span { display: block; }
.goal-progress-row span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.goal-progress-row b { color: var(--primary-dark); }
.goal-progress-row.high b { color: var(--danger); }
.goal-coach-panel aside { padding: 14px; border-radius: 14px; background: var(--primary-soft); }
.goal-coach-panel ul { margin: 0; padding-left: 18px; }
.goal-coach-panel li { margin-bottom: 7px; color: #385044; line-height: 1.4; }
.diary-grid { align-items: start; }
.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.five-column { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.food-log-list { display: grid; gap: 8px; }
.food-log-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 15px 4px; border-bottom: 1px solid var(--border); }
.food-log-row:last-child { border-bottom: 0; }
.food-log-time strong, .food-log-time span { display: block; }
.food-log-time strong { text-transform: capitalize; color: var(--primary-dark); }
.food-log-time span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.food-log-main > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.food-log-main h3 { margin: 0; }
.food-log-main p { margin: 4px 0; color: #4d5f56; }
.food-log-main small { display: block; margin-top: 3px; color: var(--muted); }
.estimate-badge { padding: 4px 7px; border-radius: 999px; background: #fff2d8; color: var(--warning); font-size: 10px; font-weight: 900; }

@media (max-width: 1150px) {
  .daily-total-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .five-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .recipe-grid, .favorite-grid, .recipe-detail-grid, .goal-coach-panel { grid-template-columns: 1fr; }
  .daily-total-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .five-column { grid-template-columns: 1fr 1fr; }
  .plan-day-title { align-items: flex-start; flex-direction: column; }
  .food-log-row { grid-template-columns: 76px minmax(0, 1fr); }
  .food-log-row .log-row-actions { grid-column: 2; }
  .diary-date-label { width: 100%; }
}

.nutrition-coverage-note {
  margin: 12px 0 0;
  padding: 11px 13px;
  border: 1px solid #ead9a5;
  border-radius: 12px;
  background: #fffaf0;
  color: #665018;
  font-size: .9rem;
}

/* Shop Well Daily custom recipe builder */
.recipe-builder { margin-top: 26px; padding: 0; overflow: hidden; }
.recipe-builder > summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; cursor: pointer; list-style: none; }
.recipe-builder > summary::-webkit-details-marker { display: none; }
.recipe-builder > summary span:first-child { display: grid; gap: 4px; }
.recipe-builder > summary b { color: var(--primary-dark); font-size: 18px; }
.recipe-builder > summary small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.recipe-builder .summary-arrow { color: var(--primary); font-size: 24px; transition: transform .2s ease; }
.recipe-builder[open] .summary-arrow { transform: rotate(180deg); }
.recipe-builder-form { padding: 2px 22px 24px; border-top: 1px solid var(--border); }
.recipe-builder-form .panel-heading { margin-top: 18px; }
.recipe-textareas textarea { min-height: 180px; }
.recipe-builder-form label > small { display: block; margin: 3px 0 7px; color: var(--muted); font-weight: 500; }
.recipe-builder-form .check-row { align-items: flex-start; padding: 13px 14px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); }
.recipe-builder-form .check-row span { display: grid; gap: 3px; }
.recipe-plan-status { display: inline-flex; margin-top: 11px; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; }
.recipe-plan-status.included { background: var(--primary-soft); color: var(--primary-dark); }
.recipe-plan-status.excluded { background: var(--surface-soft); color: var(--muted); border: 1px solid var(--border); }

@media (max-width: 680px) {
  .recipe-builder > summary { align-items: flex-start; padding: 17px; }
  .recipe-builder-form { padding: 2px 16px 20px; }
}


/* AI recipe estimates and saved-recipe diary logging */
.recipe-nutrition-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.recipe-nutrition-tools div { display: grid; gap: 3px; }
.recipe-nutrition-tools b { color: var(--primary-dark); }
.recipe-nutrition-tools small { color: var(--muted); line-height: 1.4; font-weight: 500; }
.recipe-actions .ai-estimate-recipe { flex-basis: 100%; }
.content-grid.diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.diary-quick-add { grid-column: 1 / -1; }
.recipe-log-preview {
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid #d2e2d4;
  border-radius: 12px;
  background: var(--surface-soft);
  color: #4d5f56;
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 980px) {
  .content-grid.diary-grid { grid-template-columns: 1fr; }
  .diary-quick-add { grid-column: auto; }
}
@media (max-width: 680px) {
  .recipe-nutrition-tools { align-items: stretch; flex-direction: column; }
  .recipe-nutrition-tools button { width: 100%; }
}

@media (max-width: 680px) {
  .manual-ai-tools { align-items: stretch; flex-direction: column; }
  .manual-ai-tools button { width: 100%; }
}

/* Scalable collection search, filtering, and recipe access */
.collection-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(170px, .6fr) auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0 12px;
  padding: 16px 18px;
  border-radius: 18px;
}
#view-pantry .collection-toolbar { grid-template-columns: minmax(250px, 1.4fr) minmax(160px, .55fr) minmax(170px, .55fr) auto; }
.collection-search { min-width: 0; }
.collection-result-copy {
  align-self: center;
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.collection-load-more { display: flex; justify-content: center; padding: 14px 0 4px; }
.compact-collection-empty { min-height: 220px; }

.recipe-library-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(145px, .55fr));
  gap: 12px;
  align-items: end;
  margin: 18px 0 10px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}
.collection-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.favorites-panel .panel-intro { margin: -8px 0 0; }

.search-picker { position: relative; display: grid; gap: 8px; }
.picker-results {
  position: absolute;
  z-index: 15;
  top: 70px;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(30, 67, 44, .18);
}
.picker-results button {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.picker-results button:hover,
.picker-results button:focus { background: var(--primary-soft); outline: none; }
.picker-results strong { font-size: 13px; }
.picker-results small { color: var(--muted); line-height: 1.35; }
.picker-empty { padding: 15px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.picker-selection {
  min-height: 45px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}
.picker-selection strong { color: var(--primary-dark); font-size: 13px; }
.picker-selection span { grid-column: 1; }
.picker-selection button {
  grid-column: 2;
  grid-row: 1 / span 2;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 1050px) {
  .collection-toolbar,
  #view-pantry .collection-toolbar,
  .recipe-library-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-result-copy { justify-self: start; }
}

@media (max-width: 680px) {
  .collection-toolbar,
  #view-pantry .collection-toolbar,
  .recipe-library-toolbar { grid-template-columns: 1fr; }
  .collection-result-copy { justify-self: start; }
  .collection-summary-line { align-items: flex-start; flex-direction: column; }
  .favorites-panel .panel-heading { align-items: flex-start; flex-direction: column; }
  .favorites-panel .panel-heading button { width: 100%; }
  .picker-results { top: 70px; }
}

/* Cook from pantry */
.cook-header { align-items: flex-start; }
.cook-summary-cards { margin-bottom: 18px; }
.cook-summary-card {
  appearance: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.cook-summary-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 10px 24px rgba(36, 71, 51, .09); }
.cook-summary-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.cook-summary-card.ready { border-top: 4px solid #4f9664; }
.cook-summary-card.almost { border-top: 4px solid #d59a35; }
.cook-summary-card.shopping { border-top: 4px solid #b2675f; }
.cook-controls-panel { margin-bottom: 22px; }
.cook-toolbar { display: grid; grid-template-columns: minmax(250px, 1.4fr) minmax(150px, .55fr) minmax(190px, .65fr); gap: 14px; align-items: end; }
.pantry-staple-toggle { margin-top: 15px; align-items: flex-start; padding: 13px 14px; border-radius: 14px; background: var(--surface-soft); border: 1px solid var(--border); }
.pantry-staple-toggle span { display: grid; gap: 3px; }
.pantry-staple-toggle small { color: var(--muted); font-weight: 500; }
.cook-recipe-results { display: grid; gap: 27px; }
.cook-status-group { display: grid; gap: 12px; }
.cook-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 2px; }
.cook-group-heading > div { display: grid; gap: 2px; }
.cook-group-heading span { font-size: 22px; font-weight: 900; color: var(--text); }
.cook-group-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.cook-group-heading strong { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); }
.cook-status-group.ready .cook-group-heading strong { color: #2f6f42; background: #eaf6ed; border-color: #b9dec2; }
.cook-status-group.almost .cook-group-heading strong { color: #94620b; background: #fff6e6; border-color: #efd39c; }
.cook-status-group.shopping .cook-group-heading strong { color: #8f3e37; background: #fff0ef; border-color: #e7b4b0; }
.cook-recipe-card { position: relative; overflow: hidden; }
.cook-recipe-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.cook-recipe-card.ready::before { background: #4f9664; }
.cook-recipe-card.almost::before { background: #d59a35; }
.cook-recipe-card.shopping::before { background: #b2675f; }
.cook-status-badge { display: inline-flex !important; width: auto !important; height: auto !important; padding: 7px 9px; border-radius: 999px; font-size: 10px !important; font-weight: 900; white-space: nowrap; }
.cook-status-badge.ready { background: #eaf6ed; color: #2f6f42 !important; }
.cook-status-badge.almost { background: #fff6e6; color: #94620b !important; }
.cook-status-badge.shopping { background: #fff0ef; color: #8f3e37 !important; }
.cook-match-summary { display: grid; gap: 8px; margin: 14px 0; padding: 12px; border-radius: 14px; background: var(--surface-soft); }
.cook-match-summary > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cook-match-summary strong { color: var(--primary-dark); font-size: 18px; }
.cook-match-summary span { color: var(--muted); font-size: 12px; text-align: right; }
.cook-match-track { height: 7px; overflow: hidden; border-radius: 999px; background: #dfe8df; }
.cook-match-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.cook-needed { display: grid; gap: 7px; margin: 12px 0; }
.cook-needed > small { color: #8f3e37; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.cook-needed > div { display: flex; flex-wrap: wrap; gap: 6px; }
.cook-needed span { padding: 6px 8px; border-radius: 999px; background: #fff0ef; color: #7b3933; border: 1px solid #edc3bf; font-size: 11px; font-weight: 800; }
.cook-cart-note { margin: 11px 0; padding: 10px 12px; border-radius: 12px; background: #fff6e6; color: #6c531e; font-size: 12px; line-height: 1.45; }
.cook-ingredient-list li { padding-left: 2px; }
.cook-ingredient-list li small { font-weight: 700; }
.cook-ingredient-pantry small { color: #2f6f42 !important; }
.cook-ingredient-cart small { color: #94620b !important; }
.cook-ingredient-missing small { color: #8f3e37 !important; }
.cook-ingredient-staple small, .cook-ingredient-optional small { color: var(--muted) !important; }
.cook-help-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 26px; }
.cook-help-panel > div { display: flex; align-items: flex-start; gap: 13px; }
.cook-help-panel h2 { margin: 0 0 5px; font-size: 18px; }
.cook-help-panel p { margin: 0; max-width: 700px; color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 900px) {
  .cook-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cook-toolbar .collection-search { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .cook-toolbar { grid-template-columns: 1fr; }
  .cook-toolbar .collection-search { grid-column: auto; }
  .cook-group-heading { align-items: flex-start; }
  .cook-group-heading span { font-size: 19px; }
  .cook-status-badge { white-space: normal; text-align: center; }
  .cook-match-summary > div:first-child { align-items: flex-start; flex-direction: column; gap: 2px; }
  .cook-match-summary span { text-align: left; }
  .cook-help-panel { align-items: stretch; flex-direction: column; }
  .cook-help-panel button { width: 100%; }
}

/* Complete cooking loop */
.recipe-cook-history {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 2px;
  padding: 8px 10px;
  border-radius: 11px;
  background: #eef7ef;
  color: #315f3d;
  font-size: 11px;
}
.recipe-cook-history span { color: var(--muted); text-align: right; }
.recent-cooking-panel { margin: 0 0 20px; }
.recent-cooking-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.recent-cooking-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.recent-cooking-card > div:first-child { min-width: 0; }
.recent-cooking-card small { color: var(--muted); font-weight: 750; text-transform: capitalize; }
.recent-cooking-card h3 { margin: 3px 0 4px; font-size: 15px; }
.recent-cooking-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.recent-cooking-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.recent-cooking-actions .secondary-button { padding: 8px 10px; white-space: nowrap; }
.recent-cooking-actions .text-button { white-space: nowrap; }

body.modal-open { overflow: hidden; }
.app-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 38, 27, .58);
  backdrop-filter: blur(3px);
}
.app-modal.hidden { display: none; }
.app-modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(17, 41, 27, .3);
}
.app-modal-close {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.cook-complete-heading { padding-right: 42px; margin-bottom: 18px; }
.cook-complete-heading h2 { margin: 4px 0 6px; font-size: 25px; }
.cook-complete-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.cook-loop-toggle { align-items: flex-start; padding: 12px 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.cook-loop-toggle span { display: grid; gap: 3px; }
.cook-loop-toggle small { color: var(--muted); font-weight: 500; line-height: 1.4; }
.cook-pantry-adjustments { display: grid; gap: 9px; transition: opacity .15s ease; }
.cook-pantry-adjustments.disabled { opacity: .45; }
.cook-adjustment-heading { display: grid; gap: 3px; }
.cook-adjustment-heading b { color: var(--primary-dark); }
.cook-adjustment-heading span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.cook-adjustment-list { display: grid; gap: 7px; }
.cook-adjustment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 105px;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cook-adjustment-row > span:first-child { display: grid; gap: 2px; }
.cook-adjustment-row > span:first-child b { color: var(--text); }
.cook-adjustment-row > span:first-child small { color: var(--muted); font-weight: 500; line-height: 1.35; }
.cook-adjustment-input { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 6px; }
.cook-adjustment-input input { width: 58px; text-align: center; }
.cook-adjustment-input small { color: var(--muted); font-weight: 650; line-height: 1.1; }
.cook-adjustment-empty { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: var(--surface-soft); }
.cook-adjustment-empty span { color: var(--muted); font-size: 11px; }

@media (max-width: 820px) {
  .recent-cooking-list { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .app-modal { padding: 0; align-items: end; }
  .app-modal-card { max-height: 94vh; padding: 20px 16px; border-radius: 22px 22px 0 0; }
  .recent-cooking-card { align-items: stretch; flex-direction: column; }
  .recent-cooking-actions { justify-content: flex-start; flex-wrap: wrap; }
  .recipe-cook-history { align-items: flex-start; flex-direction: column; }
  .recipe-cook-history span { text-align: left; }
  .cook-adjustment-row { grid-template-columns: 1fr; }
  .cook-adjustment-input { grid-template-columns: 62px auto; justify-content: start; }
}

/* Package-label scanning */
.label-scan-entry {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
}
.label-scan-entry > summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 800;
}
.label-scan-body { display: grid; gap: 14px; margin-top: 16px; }
.label-scan-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.label-scan-heading > div { display: grid; gap: 4px; }
.label-scan-heading b { color: var(--primary-dark); }
.label-scan-heading small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.label-scan-barcode {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .02em;
}
.label-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.label-photo-slot {
  position: relative;
  min-width: 0;
  cursor: pointer;
  border: 1px dashed #afc7b4;
  border-radius: 15px;
  background: var(--surface-soft);
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.label-photo-slot:hover { border-color: var(--primary); background: #eef6ef; transform: translateY(-1px); }
.label-photo-slot.important { border-style: solid; border-color: #9fbea7; }
.label-photo-slot.has-photo { border-style: solid; border-color: var(--primary); background: #edf7ef; }
.label-photo-slot input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.label-photo-preview {
  min-height: 148px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 14px;
  text-align: center;
}
.label-photo-preview b { color: var(--text); font-size: 12px; }
.label-photo-preview small { color: var(--muted); font-size: 10px; font-weight: 550; line-height: 1.35; }
.label-photo-preview em {
  margin-top: 4px;
  color: var(--primary);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}
.label-photo-preview img {
  width: 100%;
  height: 94px;
  object-fit: cover;
  border-radius: 10px;
  background: #fff;
}
.label-photo-preview > span { display: grid; justify-items: center; gap: 2px; }
.label-photo-preview [data-remove-label-photo] { color: var(--danger); }
.label-scan-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.label-scan-status {
  display: none;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.label-scan-status:not(:empty) { display: block; }
.label-scan-status.working { background: #fff7e8; color: #755717; }
.label-scan-status.ready { background: #eaf6ed; color: #2e6840; }
.label-scan-status.error { background: #fff0ef; color: var(--danger); }
.label-scan-privacy { margin: -3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
#manualProductForm label.scan-uncertain,
#manualProductForm label.scan-required-review {
  padding: 8px;
  margin: -8px;
  border-radius: 11px;
}
#manualProductForm label.scan-uncertain { background: #fff7e8; color: #715417; }
#manualProductForm label.scan-required-review { background: #fff0ef; color: var(--danger); }
#manualProductForm label.scan-uncertain::after {
  content: "Check this value against the package";
  color: #8a671c;
  font-size: 9px;
  font-weight: 750;
}
#manualProductForm label.scan-required-review::after {
  content: "Required — enter this from the package";
  color: var(--danger);
  font-size: 9px;
  font-weight: 750;
}
.product-ingredients {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}
.product-ingredients summary { cursor: pointer; color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.product-ingredients p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 760px) {
  .label-photo-grid { grid-template-columns: 1fr; }
  .label-photo-preview {
    min-height: 105px;
    grid-template-columns: 90px 1fr;
    align-items: center;
    justify-items: start;
    text-align: left;
  }
  .label-photo-preview img { width: 90px; height: 76px; grid-row: 1; }
  .label-photo-preview > span { justify-items: start; text-align: left; }
  .label-scan-heading { flex-direction: column; }
}

/* Today screen */
.today-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 30px 32px;
  border: 1px solid #cfe0d1;
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255,255,255,.72), transparent 28%),
    linear-gradient(135deg, #e4f1e3, #f8fbf6 64%, #eef5e9);
  box-shadow: var(--shadow);
}
.today-hero h1 { color: var(--primary-dark); }
.today-hero p { margin: 9px 0 0; font-size: 16px; }
.today-refresh-button { flex: 0 0 auto; background: rgba(255,255,255,.78); }

.today-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.today-action-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: 0 7px 20px rgba(35,64,44,.035);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.today-action-card:hover { transform: translateY(-2px); border-color: #aac8b0; box-shadow: 0 13px 28px rgba(35,64,44,.08); }
.today-action-card > span:last-child { min-width: 0; display: grid; gap: 3px; }
.today-action-card b { color: var(--primary-dark); font-size: 13px; }
.today-action-card small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.today-action-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 900;
}

.today-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(330px, .72fr);
  gap: 20px;
}
.today-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.today-meal-panel, .today-progress-panel, .today-attention-panel, .today-log-panel { min-width: 0; }
.today-meal-suggestion { min-height: 254px; display: grid; }
.today-loading-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 220px;
  justify-content: center;
  color: var(--muted);
}
.today-loading-card > div { display: grid; gap: 3px; }
.today-loading-card b { color: var(--text); }
.today-loading-card small { font-size: 11px; }
.today-pulse { width: 20px; height: 20px; border: 3px solid #cfe0d1; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }

.today-recipe-card { display: grid; gap: 13px; align-content: start; }
.today-recipe-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; }
.today-recipe-card h3 { font-size: clamp(24px, 3vw, 34px); line-height: 1.06; letter-spacing: -.03em; }
.today-recipe-card p { margin: 0; font-size: 13px; }
.cook-status-pill { display: inline-flex; width: fit-content; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.cook-status-pill.ready { color: #2f6f42; background: #eaf6ed; }
.cook-status-pill.almost { color: #94620b; background: #fff6e6; }
.cook-status-pill.shopping { color: #8f3e37; background: #fff0ef; }
.today-recipe-nutrition {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
}
.today-recipe-nutrition.muted { color: var(--muted); font-weight: 650; }
.today-missing-line { padding: 10px 12px; border: 1px solid #ecd3a4; border-radius: 12px; background: #fff8ea; color: #735216; font-size: 11px; line-height: 1.45; }
.today-meal-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 2px; }
.today-empty-meal { display: flex; align-items: center; gap: 17px; min-height: 220px; }
.today-empty-meal > div { display: grid; gap: 8px; }
.today-empty-meal small { color: var(--muted); font-weight: 750; }
.today-empty-meal h3 { font-size: 22px; line-height: 1.15; }
.today-empty-meal p { margin: 0; font-size: 12px; }
.today-meal-symbol { flex: 0 0 auto; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); font-size: 27px; }

.today-progress-grid { display: grid; gap: 14px; }
.today-progress-item { display: grid; gap: 6px; }
.today-progress-item > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.today-progress-item span { color: var(--text); font-size: 12px; font-weight: 850; }
.today-progress-item strong { color: var(--primary-dark); font-size: 15px; }
.today-progress-item small { color: var(--muted); font-size: 10px; }
.today-progress-track { height: 8px; border-radius: 999px; background: #e7eee7; overflow: hidden; }
.today-progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.today-progress-item.caution .today-progress-track i { background: #d69a35; }
.today-progress-item.high .today-progress-track i { background: var(--danger); }
.today-progress-item.progress .today-progress-track i { background: #5d8ba0; }
.today-progress-note { margin: 17px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; line-height: 1.5; }

.today-attention-list, .today-food-list { display: grid; gap: 9px; }
.today-attention-item {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.today-attention-item:hover { border-color: #aac8b0; background: #fbfdfb; }
.today-attention-item > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-soft); color: var(--primary-dark); font-weight: 900; }
.today-attention-item > div { min-width: 0; display: grid; gap: 3px; }
.today-attention-item b { font-size: 12px; }
.today-attention-item small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.today-attention-item em { color: var(--primary); font-size: 10px; font-style: normal; font-weight: 850; white-space: nowrap; }
.today-all-clear { min-height: 170px; display: flex; align-items: center; justify-content: center; gap: 12px; text-align: left; }
.today-all-clear > span { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: #eaf6ed; color: var(--primary); font-size: 21px; font-weight: 900; }
.today-all-clear > div { display: grid; gap: 3px; }
.today-all-clear small { color: var(--muted); }

.today-food-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.today-food-row:last-child { border-bottom: 0; }
.today-food-meal { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 900; }
.today-food-row > div { min-width: 0; display: grid; gap: 3px; }
.today-food-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.today-food-row small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.today-food-row em { padding: 4px 7px; border-radius: 999px; background: #fff6e6; color: #8b6015; font-size: 8px; font-style: normal; font-weight: 850; }
.today-food-empty { min-height: 170px; display: grid; grid-template-columns: 42px 1fr; align-content: center; align-items: center; gap: 12px; }
.today-food-empty > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-soft); color: var(--primary); font-size: 19px; }
.today-food-empty > div { display: grid; gap: 3px; }
.today-food-empty small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.today-food-empty button { grid-column: 2; justify-self: start; }

@media (max-width: 1120px) {
  .today-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-main-grid { grid-template-columns: 1fr; }
  .today-progress-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .today-hero { align-items: flex-start; flex-direction: column; padding: 24px 20px; border-radius: 22px; }
  .today-refresh-button { width: 100%; }
  .today-quick-actions { grid-template-columns: 1fr; }
  .today-action-card { padding: 13px; }
  .today-lower-grid { grid-template-columns: 1fr; }
  .today-progress-grid { grid-template-columns: 1fr; }
  .today-empty-meal { align-items: flex-start; flex-direction: column; }
  .today-meal-actions { align-items: stretch; flex-direction: column; }
  .today-meal-actions .primary-button, .today-meal-actions .secondary-button { width: 100%; }
  .today-attention-item { grid-template-columns: 38px minmax(0, 1fr); }
  .today-attention-item em { grid-column: 2; }
}

/* Smart automatic suggestions */
.today-smart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 18px;
  margin-top: 18px;
}
.today-alternative-list, .today-use-soon-list { display: grid; gap: 9px; }
.today-alternative-card, .today-use-soon-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.today-alternative-card:hover, .today-use-soon-row:hover { border-color: #a8c8ae; background: #fbfdfb; }
.today-alternative-card > div, .today-use-soon-row > div { min-width: 0; display: grid; gap: 3px; }
.today-alternative-card b, .today-use-soon-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.today-alternative-card small, .today-use-soon-row small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.today-alternative-card em, .today-use-soon-row em { color: var(--primary); font-size: 9px; font-style: normal; font-weight: 850; white-space: nowrap; }
.today-use-soon-row > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #fff5de; color: #8b6015; font-weight: 900; }
.today-use-soon-row.past > span { background: #feeceb; color: var(--danger); }
.today-use-soon-row.past em { color: var(--danger); }
.today-smart-empty { min-height: 118px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.today-smart-empty > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-soft); color: var(--primary); font-size: 19px; }
.today-smart-empty > div { display: grid; gap: 3px; }
.today-smart-empty small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.today-reason-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.today-reason-chips span { padding: 5px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--primary-dark); font-size: 9px; font-weight: 850; }
.today-reason-chips span.favorite { background: #fff5d8; color: #8a6315; }
.today-reason-chips span.use_soon { background: #fff0dc; color: #8a5515; }
.today-reason-chips span.warning { background: #feeceb; color: var(--danger); }
.today-recipe-top > div { display: flex; align-items: center; gap: 8px; }
.today-favorite-button, .recipe-favorite-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: #8a6315;
  font-size: 18px;
  cursor: pointer;
}
.today-favorite-button.active, .recipe-favorite-toggle.active { border-color: #e2c56f; background: #fff8dc; }
.recipe-favorite-toggle { flex: 0 0 auto; }

/* Pantry best-by dates */
.pantry-item.use-soon { border-color: #e8c982; }
.pantry-item.past-best-by { border-color: #e2a09b; }
.pantry-best-by { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.pantry-best-by label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; font-weight: 800; }
.pantry-best-by input { min-height: 32px; width: 145px; padding: 5px 7px; border-radius: 9px; font-size: 10px; }
.pantry-best-by-status { font-size: 9px !important; font-weight: 750; }
.pantry-best-by-status.today, .pantry-best-by-status.soon, .pantry-best-by-status.week { color: #8a5d13 !important; }
.pantry-best-by-status.past { color: var(--danger) !important; }
.pantry-best-by-status.none { color: var(--muted) !important; }

@media (max-width: 900px) {
  .today-smart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .today-smart-empty { grid-template-columns: 42px minmax(0, 1fr); }
  .today-smart-empty button { grid-column: 2; justify-self: start; }
  .today-alternative-card, .today-use-soon-row { grid-template-columns: auto minmax(0, 1fr); }
  .today-alternative-card em, .today-use-soon-row em { grid-column: 2; }
  .pantry-best-by { align-items: flex-start; flex-direction: column; }
}
.pantry-summary-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .pantry-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pantry-summary-cards { grid-template-columns: 1fr; } }

/* Grocery list / store scan matching */
.grocery-match-card {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #eef7ee;
  display: grid;
  gap: 4px;
}
.grocery-match-card strong { color: var(--primary-dark); }
.grocery-match-card p { margin: 0; color: var(--text); font-weight: 800; }
.grocery-match-card small { color: var(--muted); line-height: 1.45; }
.grocery-match-card.muted { background: var(--surface-soft); }
.grocery-item .cart-thumb-placeholder { background: var(--surface-soft); }
