:root {
  /* Chef Mike logo — orange #F78E1E, brown #462B21 */
  --brand-brown: #462b21;
  --brand-brown-soft: #6b4a3a;
  --brand-orange: #f78e1e;
  --brand-orange-dark: #e07a0f;
  --brand-orange-deep: #c86a08;
  --brand-orange-light: #fff4e6;
  --brand-orange-mid: #f5c48a;
  --cream: #fffaf5;
  --warm-white: #ffffff;
  --amber: #f78e1e;
  --amber-light: #fff4e6;
  --coral: #d94a3a;
  --text: var(--brand-brown);
  --text-muted: #7a5c4a;
  --border: #f0e0d0;
  --shadow: 0 4px 24px rgba(70, 43, 33, 0.08);
  --shadow-lg: 0 12px 48px rgba(70, 43, 33, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Nunito", "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(247, 142, 30, 0.2);
}

.bg-pattern {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(620px circle at 12% 16%, rgba(247, 142, 30, 0.18) 0%, transparent 55%),
    radial-gradient(540px circle at 88% 24%, rgba(217, 74, 58, 0.1) 0%, transparent 55%),
    radial-gradient(700px circle at 78% 86%, rgba(70, 43, 33, 0.08) 0%, transparent 50%),
    radial-gradient(460px circle at 18% 88%, rgba(247, 142, 30, 0.1) 0%, transparent 55%),
    linear-gradient(160deg, #fffaf5 0%, #fff2e2 45%, #ffeeda 100%);
  pointer-events: none;
  z-index: 0;
  animation: bgDrift 24s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 40px 30px, -36px 24px, -30px -40px, 28px -24px, 0 0; }
}

.site-header, .container, .footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(255, 250, 245, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 20px rgba(70, 43, 33, 0.06);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 4rem;
  padding: 0.65rem max(1.25rem, env(safe-area-inset-right))
    0.65rem max(1.25rem, env(safe-area-inset-left));
  padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.logo:active {
  opacity: 0.85;
}

.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(70, 43, 33, 0.12));
}

.logo-text {
  min-width: 0;
  line-height: 1.2;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-brown);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tagline {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.header-status:empty {
  display: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-sync-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-orange-light);
  color: var(--brand-brown);
  border: 1px solid var(--brand-orange-mid);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.header-sync-badge.hidden {
  display: none !important;
}

.header-auth {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-auth.is-signed-in #signInBtn {
  display: none !important;
}

.header-auth:not(.is-signed-in) #headerUser {
  display: none !important;
}

.btn-google-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(70, 43, 33, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--brand-brown);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(70, 43, 33, 0.08);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn-google-signin:hover {
  background: #fff;
  box-shadow: 0 4px 14px rgba(70, 43, 33, 0.12);
}

.btn-google-signin:active {
  transform: scale(0.98);
}

.btn-google-signin[hidden] {
  display: none !important;
}

.btn-google-signin-lg {
  min-height: 48px;
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  margin-top: 0.5rem;
}

.btn-google-icon {
  flex-shrink: 0;
}

.header-user {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-avatar-btn {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.header-avatar-btn:hover {
  transform: scale(1.05);
}

.header-avatar-btn:active {
  transform: scale(0.95);
}

.header-user-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(70, 43, 33, 0.18);
}

.header-user-avatar[hidden] {
  display: none !important;
}

.header-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-orange-dark), var(--brand-orange));
  color: white;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(70, 43, 33, 0.18);
}

.header-avatar-fallback[hidden] {
  display: none !important;
}

.user-menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 60;
  width: min(19rem, calc(100vw - 2rem));
  padding: 0.85rem;
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 14px 40px rgba(70, 43, 33, 0.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  animation: viewIn 0.18s ease;
}

.user-menu-account {
  padding: 0.25rem 0.35rem 0.5rem;
}

.user-menu-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--brand-brown);
  margin: 0;
}

.user-menu-email {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.1rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
}

.user-menu-section {
  padding: 0.25rem 0.35rem;
}

.user-menu-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.45rem;
}

.user-menu-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.user-menu-members {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.user-menu-member {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-menu-member-photo,
.user-menu-member-initial {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.user-menu-member-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-orange-light);
  color: var(--brand-brown);
  font-size: 0.78rem;
  font-weight: 700;
}

.user-menu-member-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-brown);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-you {
  font-weight: 500;
  color: var(--text-muted);
}

.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.45rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-brown-soft);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-menu-item:hover {
  background: rgba(224, 122, 15, 0.1);
  color: var(--brand-orange-deep);
}

.user-menu-signout {
  color: #b91c1c;
}

.user-menu-signout:hover {
  background: #fee2e2;
  color: #991b1b;
}

.planner-auth-gate {
  margin-bottom: 1.25rem;
}

.planner-auth-card {
  padding: 2rem 1.75rem;
  text-align: center;
  border-top: 4px solid var(--brand-orange);
}

.planner-auth-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--brand-brown);
  margin: 0.35rem 0 0.75rem;
}

.planner-auth-copy {
  max-width: 28rem;
  margin: 0 auto 1rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.planner-auth-note {
  margin-top: 1rem;
}

.app-nav-btn.needs-auth:not(.active) {
  opacity: 0.88;
}

.app-nav-btn.needs-auth:not(.active)::after {
  content: "🔒";
  font-size: 0.72rem;
  margin-left: 0.15rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-live {
  background: var(--brand-orange-light);
  color: var(--brand-brown);
  border-color: var(--brand-orange-mid);
}

.badge-demo { background: var(--amber-light); color: #b45309; }
.badge-warn { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

@media (min-width: 768px) {
  .header-inner {
    min-height: 4.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .logo {
    gap: 0.85rem;
  }

  .logo-img {
    width: 52px;
    height: 52px;
  }

  .logo-title {
    font-size: 1.45rem;
  }

  .tagline {
    font-size: 0.8rem;
  }

  .header-status {
    gap: 0.5rem;
  }

  .badge {
    font-size: 0.7rem;
    padding: 0.4rem 0.75rem;
  }
}

.container {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

.card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow:
    0 2px 6px rgba(70, 43, 33, 0.05),
    0 16px 40px rgba(70, 43, 33, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

.hero.card {
  border-top: 4px solid var(--brand-orange);
  overflow: hidden;
}

.hero {
  padding: 2rem;
  display: grid;
  gap: 2rem;
}

.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-orange-dark);
  margin-bottom: 0.5rem;
}

.hero-points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
}

.hero-points li {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-brown-soft);
  background: var(--brand-orange-light);
  border: 1px solid var(--brand-orange-mid);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.field-budget {
  background: linear-gradient(135deg, var(--brand-orange-light), #fff);
  border: 1px solid var(--brand-orange-mid);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.service-warning,
.restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
}

.service-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.restore-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.form-submit-wrap {
  margin-top: 0.5rem;
}

.shops-note {
  margin-top: 0.5rem;
}

.btn-secondary {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-brown);
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(70, 43, 33, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease;
}

.btn-secondary:hover {
  border-color: var(--brand-orange-mid);
  background: var(--brand-orange-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(70, 43, 33, 0.12);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.45rem 0.75rem;
  min-height: 40px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.results-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--brand-brown);
  letter-spacing: -0.02em;
}

.results-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.error-box-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-message {
  flex: 1;
  margin: 0;
  line-height: 1.45;
}

.error-dismiss {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  color: #991b1b;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  touch-action: manipulation;
}

.error-dismiss:hover {
  background: rgba(185, 28, 28, 0.08);
}

.meal-type-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.meal-type-chips .chip span {
  width: 100%;
  text-align: center;
}

@media (min-width: 768px) {
  .hero {
    grid-template-columns: 1fr 1.4fr;
    align-items: start;
    padding: 2.5rem;
  }
}

.hero-text h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--brand-brown);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field-full { grid-column: 1 / -1; }

.field span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.field span em { font-weight: 400; font-style: normal; opacity: 0.7; }

.field-hint {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.field-bougie .bougie-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-brown);
  cursor: pointer;
}

.field-bougie input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand-orange);
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(247, 142, 30, 0.2);
}

.field-budget .budget-display {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.field-budget .currency {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-orange-dark);
}

.field-budget input[type="number"] {
  border: none;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-brown);
  width: 120px;
  padding: 0;
  background: transparent;
}

.field-budget input[type="number"]:focus {
  box-shadow: none;
}

.field-budget input[type="range"] {
  width: 100%;
  accent-color: var(--brand-orange);
}

.meals-fieldset,
.shops-fieldset {
  border: none;
  margin: 1.25rem 0;
}

.meals-fieldset legend,
.shops-fieldset legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.shop-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  cursor: pointer;
}

.chip input { display: none; }

.chip span {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.chip input:checked + span {
  background: var(--brand-orange-dark);
  border-color: var(--brand-orange-dark);
  color: white;
}

.chip-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chip-disabled span {
  text-decoration: line-through;
}

.btn-primary {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--brand-orange-dark), var(--brand-orange));
  color: white;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 4px 16px rgba(224, 122, 15, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 8px 28px rgba(224, 122, 15, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.85;
  cursor: wait;
}

.btn-primary.is-loading {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 1rem 1.25rem 1.1rem;
}

.btn-progress {
  width: 100%;
  text-align: left;
}

.btn-progress-label {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.btn-progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.btn-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.btn-progress-hint {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.85;
  line-height: 1.3;
}

.hidden { display: none !important; }

.results { margin-top: 2rem; }

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 639px) {
  .form-grid { grid-template-columns: 1fr; }
}

.summary-card {
  padding: 1.25rem;
  text-align: center;
}

.summary-card.highlight {
  background: linear-gradient(135deg, var(--brand-orange-light), var(--warm-white));
  border-color: var(--brand-orange-mid);
}

.summary-card.over-budget {
  background: linear-gradient(135deg, #fef2f2, var(--warm-white));
  border-color: #fca5a5;
}

.summary-card.under-budget {
  background: linear-gradient(135deg, #ecfdf5, var(--warm-white));
  border-color: #6ee7b7;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.summary-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brand-brown);
  margin-top: 0.25rem;
}

.over-budget .summary-value { color: var(--coral); }
.under-budget .summary-value { color: #059669; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.tab.active {
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
}

.tab-panel { animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.day-group {
  margin-bottom: 1.5rem;
}

.day-group h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--brand-brown);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--brand-orange-mid);
}

.meal-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .meal-grid { grid-template-columns: repeat(3, 1fr); }
}

.meal-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.meal-card:hover {
  border-color: var(--brand-orange-mid);
  box-shadow: 0 4px 14px rgba(70, 43, 33, 0.1);
  transform: translateY(-2px);
}

.meal-card:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

.meal-card-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--brand-orange-dark);
  font-weight: 600;
}

.meal-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.meal-card-hint {
  min-width: 0;
}

.meal-dislike-btn {
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.meal-dislike-btn:hover:not(:disabled) {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}

.meal-dislike-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.meal-fav-btn {
  margin-left: auto;
  border: 1.5px solid var(--brand-orange-mid);
  background: white;
  color: var(--brand-brown);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.meal-fav-btn.is-favourite,
.meal-fav-btn[aria-pressed="true"] {
  background: var(--brand-orange-light);
  border-color: var(--brand-orange-dark);
  color: var(--brand-orange-deep);
}

.meal-fav-btn:hover {
  border-color: var(--brand-orange-dark);
}

.meal-fav-card-btn {
  border: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  color: var(--text-muted);
  touch-action: manipulation;
}

.meal-fav-card-btn.is-favourite {
  color: var(--brand-orange-dark);
}

.favourites-section {
  padding: 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 244, 230, 0.35);
}

.favourites-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-brown);
  margin-bottom: 0.25rem;
}

.favourite-add {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.favourite-add-row {
  display: flex;
  gap: 0.5rem;
}

.favourite-add-title {
  flex: 1;
  min-width: 0;
}

.favourite-add-title,
.favourite-add-ingredients,
.favourite-add-type {
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: white;
  color: var(--brand-brown);
}

.favourite-add-type {
  flex-shrink: 0;
  max-width: 7.5rem;
}

.favourite-add .btn-secondary {
  flex-shrink: 0;
}

.favourite-add-title:focus,
.favourite-add-ingredients:focus,
.favourite-add-type:focus {
  outline: none;
  border-color: var(--brand-orange-dark);
}

#favAddError {
  margin-top: 0;
  color: #b91c1c;
  font-weight: 600;
}

.favourites-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.favourite-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.favourite-row.is-addon {
  border-color: var(--brand-orange-dark);
  background: var(--brand-orange-light);
}

.favourite-addon-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.favourite-addon-toggle input {
  flex-shrink: 0;
  accent-color: var(--brand-orange);
  width: 1.1rem;
  height: 1.1rem;
}

.favourite-info {
  min-width: 0;
}

.favourite-info strong {
  display: block;
  font-size: 0.85rem;
  color: var(--brand-brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favourite-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.favourite-remove-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem;
  touch-action: manipulation;
}

.favourite-remove-btn:hover {
  color: #b91c1c;
}

.favourites-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.pick-item {
  position: relative;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 2px rgba(70, 43, 33, 0.04), 0 6px 16px rgba(70, 43, 33, 0.06);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

/* reserve a clear strip at the bottom so the toggle never overlaps text
   and stays in the exact same spot whether showing + or − */
.pick-item.has-more {
  padding-bottom: 3.1rem;
}

.pick-item:hover {
  border-color: var(--brand-orange-mid);
  box-shadow: 0 2px 4px rgba(70, 43, 33, 0.05), 0 10px 26px rgba(70, 43, 33, 0.08);
}

.shop-list .pick-item + .pick-item {
  margin-top: 0.6rem;
}

.meal-modal-ingredients .pick-item {
  background: linear-gradient(180deg, #ffffff, #fff8ef);
}

/* Shop accent highlights — Asda green, Aldi blue */
.pick-item.pick-shop-asda {
  border-left: 4px solid #6ab023;
  background: linear-gradient(100deg, #f4fbec 0%, #ffffff 28%);
}

.pick-item.pick-shop-asda:hover {
  border-color: #cfe9b0;
  border-left-color: #6ab023;
}

.pick-item.pick-shop-aldi {
  border-left: 4px solid #1f70c1;
  background: linear-gradient(100deg, #eef5fc 0%, #ffffff 28%);
}

.pick-item.pick-shop-aldi:hover {
  border-color: #bcd9f3;
  border-left-color: #1f70c1;
}

.pick-shop-asda .pick-brand {
  background: #eef7e3;
  color: #4e8a16;
  border-color: #cfe9b0;
}

.pick-shop-asda .pick-brand::before {
  background: #6ab023;
}

.pick-shop-aldi .pick-brand {
  background: #e8f1fb;
  color: #1f70c1;
  border-color: #bcd9f3;
}

.pick-shop-aldi .pick-brand::before {
  background: #1f70c1;
}

.pick-item-body {
  min-width: 0;
}

.pick-row-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
}

.pick-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--brand-brown);
  min-width: 0;
  text-transform: capitalize;
}

.pick-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-orange-light);
  color: var(--brand-orange-deep);
  border: 1px solid var(--brand-orange-mid);
}

.pick-brand::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--brand-orange);
}

.pick-brand-sm {
  font-size: 0.58rem;
  padding: 0.15rem 0.45rem;
}

.pick-brand-sm::before {
  display: none;
}

.pick-price {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--brand-brown);
  white-space: nowrap;
}

.pick-line {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
  word-break: break-word;
}

.pick-line-muted {
  font-style: italic;
}

.pick-brandname {
  display: inline-block;
  margin-right: 0.35rem;
  font-weight: 800;
  color: var(--brand-brown);
}

.pick-brandname::after {
  content: "·";
  margin-left: 0.35rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pick-product {
  color: var(--brand-brown-soft);
  font-weight: 600;
}

.pick-shop {
  font-weight: 600;
  color: var(--brand-orange-dark);
}

.pick-item-price {
  font-weight: 600;
  color: var(--brand-brown);
}

.pick-qty {
  color: var(--text-muted);
}

.pick-more {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.pick-more[open] {
  margin-top: 0.5rem;
}

/* the toggle button is pinned to the bottom-right strip and stays put
   in the same place for both the + (open) and − (close) states */
.pick-more summary {
  position: absolute;
  bottom: 0.7rem;
  right: 0.8rem;
  list-style: none;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--brand-orange-mid);
  border-radius: 999px;
  background: var(--warm-white);
  box-shadow: 0 2px 8px rgba(70, 43, 33, 0.16);
  touch-action: manipulation;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease;
}

.pick-more summary:hover {
  background: var(--brand-orange-light);
  box-shadow: 0 4px 12px rgba(70, 43, 33, 0.22);
}

.pick-more summary:active {
  transform: scale(0.92);
}

.pick-more summary::-webkit-details-marker,
.pick-more summary::marker {
  display: none;
  content: "";
}

/* +/− icon drawn with pseudo-elements so it can animate to a minus */
.pick-more-icon {
  position: relative;
  width: 0.85rem;
  height: 0.85rem;
}

.pick-more-icon::before,
.pick-more-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--brand-orange-deep);
  border-radius: 2px;
  transition: transform 0.2s ease, background 0.18s ease;
}

.pick-more-icon::before {
  width: 0.85rem;
  height: 2px;
  transform: translate(-50%, -50%);
}

.pick-more-icon::after {
  width: 2px;
  height: 0.85rem;
  transform: translate(-50%, -50%);
}

.pick-more[open] summary {
  background: var(--brand-orange);
  border-color: var(--brand-orange-dark);
}

.pick-more[open] .pick-more-icon::before,
.pick-more[open] .pick-more-icon::after {
  background: #fff;
}

/* rotate + collapse the vertical bar so the icon becomes a minus */
.pick-more[open] .pick-more-icon::after {
  transform: translate(-50%, -50%) scaleY(0);
}

.pick-more-body {
  padding: 0.85rem 0 0.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-top: 1px solid var(--border);
  margin-top: 0.65rem;
  animation: pickReveal 0.22s ease;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@keyframes pickReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.pick-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pick-meta-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--brand-brown-soft);
}

.pick-alt-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-brown-soft);
  margin: 0 0 0.4rem;
}

.pick-alt-list {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.pick-alt-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.pick-alt-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.pick-alt-name {
  font-size: 0.78rem;
  color: var(--brand-brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pick-alt-price {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--brand-brown);
}

.pick-link {
  font-size: 0.72rem;
  color: var(--brand-orange-dark);
  font-weight: 700;
  text-decoration: none;
}

.pick-link:hover {
  text-decoration: underline;
}

.pick-alt {
  margin-top: 0.25rem;
}

.meal-type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-orange);
  margin-bottom: 0.35rem;
}

.meal-tag-bougie {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.4rem;
  background: linear-gradient(135deg, var(--brand-brown), #5c3828);
  color: #fff;
  border-radius: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.meal-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.meal-card-desc {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meal-meta .cost {
  font-weight: 700;
  color: var(--brand-orange-dark);
}

.shop-list { display: grid; gap: 0.65rem; }

.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  align-items: center;
}

@media (min-width: 640px) {
  .shop-item { grid-template-columns: 2fr 1fr 1fr auto; }
}

.shop-item .ingredient {
  font-weight: 600;
}

.shop-item .qty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.shop-item .product {
  font-size: 0.85rem;
}

.shop-item .shop-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  background: var(--brand-orange-light);
  color: var(--brand-orange-dark);
  border-radius: 999px;
}

.shop-item .price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand-brown);
  text-align: right;
}

.meal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}

.meal-modal.hidden {
  display: none;
}

.meal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.meal-modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 1.25rem;
  margin: 0;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 640px) {
  .meal-modal { align-items: center; }
}

.meal-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: var(--brand-orange-light);
  color: var(--brand-brown);
  border-radius: 999px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.meal-modal-meta {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-orange-dark);
  margin-bottom: 0.35rem;
}

.meal-modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--brand-brown);
  margin-bottom: 0.5rem;
  padding-right: 2rem;
}

.meal-modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.meal-modal-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-brown);
  margin-bottom: 1.25rem;
}

.meal-card-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.meal-modal-section {
  margin-bottom: 1.25rem;
}

.meal-modal-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--brand-brown);
  margin-bottom: 0.65rem;
}

.meal-modal-ingredients {
  display: grid;
  gap: 0.5rem;
}

.meal-modal-method-intro {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -0.35rem 0 0.75rem;
}

.meal-modal-tutorial {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.meal-modal-tutorial li {
  font-size: 0.9rem;
  line-height: 1.55;
  line-height: 1.45;
  padding-left: 0.25rem;
}

.tips-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.tips-list li {
  padding: 1rem 1rem 1rem 2.5rem;
  background: var(--amber-light);
  border-radius: var(--radius-sm);
  position: relative;
  font-size: 0.95rem;
}

.tips-list li::before {
  content: "💡";
  position: absolute;
  left: 0.85rem;
  top: 1rem;
}

.error-box {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: #991b1b;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.08);
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 250, 245, 0.6) 0%, rgba(255, 244, 230, 0.95) 100%);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.footer-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(70, 43, 33, 0.1));
}

.footer-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

/* ——— Mobile optimisation ——— */
@media (max-width: 639px) {
  .header-inner {
    min-height: 3.75rem;
    gap: 0.65rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 52px);
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  .logo-title {
    font-size: 1.1rem;
  }

  .tagline {
    display: none;
  }

  .btn-google-signin .btn-google-label {
    display: none;
  }

  .btn-google-signin {
    min-width: 36px;
    padding: 0.35rem;
  }

  .header-sync-badge {
    font-size: 0.62rem;
    padding: 0.22rem 0.45rem;
  }

  .header-avatar-btn {
    width: 38px;
    height: 38px;
  }

  .badge {
    font-size: 0.6rem;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
  }

  .container {
    padding: 2rem max(1rem, env(safe-area-inset-right)) 2.5rem max(1rem, env(safe-area-inset-left));
  }

  .hero {
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .hero-text h2 {
    font-size: 1.5rem;
  }

  .hero-text p {
    font-size: 0.95rem;
  }

  .field input[type="text"],
  .field input[type="number"],
  .field select {
    font-size: 16px;
    min-height: 48px;
    padding: 0.75rem 0.9rem;
  }

  .field-budget input[type="number"] {
    font-size: 1.75rem;
    width: 100%;
    max-width: 140px;
  }

  .field-budget input[type="range"] {
    min-height: 28px;
  }

  .chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .shop-chips {
    gap: 0.4rem;
  }

  .btn-primary {
    min-height: 52px;
    font-size: 1rem;
    touch-action: manipulation;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1.25rem;
  }

  .tab {
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    font-size: 0.875rem;
    text-align: center;
    border: 1.5px solid var(--border);
    touch-action: manipulation;
  }

  .tab.active {
    border-color: var(--brand-orange-dark);
  }

  .summary-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.35rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .summary-row::-webkit-scrollbar {
    display: none;
  }

  .summary-card {
    flex: 0 0 min(78%, 260px);
    scroll-snap-align: start;
    padding: 1rem;
  }

  .summary-value {
    font-size: 1.45rem;
  }

  .hero-points {
    display: none;
  }

  .meal-type-chips .chip span {
    font-size: 0.8rem;
    padding: 0.45rem 0.35rem;
    min-height: 42px;
  }

  .favourite-add-row {
    flex-wrap: wrap;
  }

  .favourite-add-title {
    flex: 1 1 100%;
  }

  .favourite-add-type {
    flex: 1;
    max-width: none;
  }

  .favourite-add-title,
  .favourite-add-ingredients,
  .favourite-add-type {
    font-size: 16px;
    min-height: 46px;
  }

  .form-submit-wrap {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin: 1rem -0.25rem -0.25rem;
    padding: 0.75rem 0.25rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, transparent, var(--cream) 28%);
  }

  .form-submit-wrap .btn-primary {
    box-shadow: 0 8px 28px rgba(224, 122, 15, 0.45);
  }

  .results-header {
    margin-bottom: 0.85rem;
  }

  .results-title {
    font-size: 1.2rem;
  }

  .pick-item {
    padding: 0.9rem 1rem;
  }

  .pick-price {
    font-size: 1.2rem;
  }

  .pick-more summary {
    width: 2.5rem;
    height: 2.5rem;
  }

  .pick-item.has-more {
    padding-bottom: 3.4rem;
  }

  .meal-card {
    padding: 1rem 1.05rem;
    min-height: 44px;
  }

  .meal-card:active {
    transform: scale(0.99);
  }

  .meal-modal {
    padding: 0;
    align-items: flex-end;
  }

  .meal-modal-panel {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 92vh);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem max(1rem, env(safe-area-inset-right))
      calc(1.25rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  }

  .meal-modal-close {
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    right: max(0.65rem, env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    touch-action: manipulation;
  }

  .meal-modal-title {
    font-size: 1.2rem;
    padding-right: 2.75rem;
  }

  .meal-modal-tutorial li {
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .error-box {
    font-size: 0.9rem;
    padding: 0.9rem 1rem;
  }

  .footer-inner {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

@media (max-width: 380px) {
  .logo-title {
    font-size: 1rem;
  }

  .logo-img {
    width: 36px;
    height: 36px;
  }

  .hero-text h2 br {
    display: none;
  }

  .hero-text h2 {
    font-size: 1.35rem;
  }

  .badge {
    font-size: 0.65rem;
    padding: 0.35rem 0.55rem;
  }
}

/* ============================================================
   App navigation (Fridge / Planner)
   ============================================================ */

.app-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 18px rgba(70, 43, 33, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.app-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-brown-soft);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.app-nav-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.app-nav-btn.active {
  background: linear-gradient(135deg, var(--brand-orange-dark), var(--brand-orange));
  color: white;
  box-shadow: 0 4px 16px rgba(224, 122, 15, 0.4);
}

.app-nav-btn:active {
  transform: scale(0.98);
}

.app-nav-icon {
  font-size: 1.2rem;
}

.app-view {
  animation: viewIn 0.3s ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Fridge inventory (main feature)
   ============================================================ */

.fridge-hero {
  padding: 2rem 1.75rem;
  text-align: center;
  border-top: 4px solid var(--brand-orange);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.fridge-hero h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  color: var(--brand-brown);
  line-height: 1.15;
  margin: 0.25rem 0 0.6rem;
}

.fridge-hero-sub {
  max-width: 34rem;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.fridge-hero-details {
  width: 100%;
  text-align: left;
}

.fridge-hero-details > summary {
  list-style: none;
  cursor: pointer;
}

.fridge-hero-details > summary::-webkit-details-marker,
.fridge-hero-details > summary::marker {
  display: none;
  content: "";
}

.fridge-hero-details:not(.fridge-hero-populated) .fridge-hero-summary {
  display: none;
}

.fridge-hero-details.fridge-hero-populated .fridge-hero-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.15rem 0;
  user-select: none;
  touch-action: manipulation;
}

.fridge-hero-details.fridge-hero-populated[open] .fridge-hero-summary {
  display: none;
}

.fridge-hero-details.fridge-hero-populated:not([open]) .fridge-hero-body {
  display: none;
}

.fridge-hero:has(.fridge-hero-populated:not([open])) {
  padding: 0.85rem 1.25rem;
  text-align: left;
}

.fridge-hero-summary-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand-brown);
}

.fridge-hero-summary-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.fridge-hero-details.fridge-hero-populated:not([open]) .fridge-hero-summary::after {
  content: "▾";
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--brand-orange-deep);
  line-height: 1;
}

.fridge-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.fridge-photo-hint {
  margin: 0;
  text-align: center;
  max-width: 22rem;
}

.btn-camera {
  max-width: 26rem;
  min-height: 52px;
  font-size: 0.92rem;
}

.btn-camera.is-disabled {
  pointer-events: none;
  opacity: 0.6;
}

.btn-camera-icon {
  font-size: 1.2rem;
}

.btn-lg {
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  min-height: 48px;
}

.fridge-analyzing {
  max-width: 26rem;
  margin: 1.25rem auto 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--brand-orange-mid);
  text-align: left;
  animation: viewIn 0.25s ease;
}

.fridge-analyzing .btn-progress-track {
  background: rgba(224, 122, 15, 0.15);
  margin-top: 0.6rem;
}

.fridge-analyzing .btn-progress-fill {
  background: linear-gradient(90deg, var(--brand-orange-dark), var(--brand-orange));
}

.fridge-analyzing-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fridge-analyzing-top p {
  margin: 0;
  font-weight: 600;
  color: var(--brand-brown);
  font-size: 0.95rem;
}

.spinner {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  border-radius: 999px;
  border: 3px solid rgba(224, 122, 15, 0.25);
  border-top-color: var(--brand-orange-dark);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fridge-preview {
  margin: 1.25rem auto 0;
  max-width: 22rem;
}

.fridge-preview img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 24px rgba(70, 43, 33, 0.15);
}

.fridge-ai-note {
  margin: 0.85rem auto 0;
  max-width: 28rem;
  font-size: 0.85rem;
  color: var(--brand-brown-soft);
}

/* expiring banner */

.expiring-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(254, 243, 199, 0.9), rgba(255, 237, 213, 0.75));
  border: 1.5px solid #fcd34d;
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: viewIn 0.3s ease;
}

.expiring-banner-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #92400e;
  margin: 0;
}

.expiring-banner-sub {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #a16207;
  text-transform: capitalize;
}

.btn-useitup {
  width: auto;
  min-height: 52px;
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  flex-shrink: 0;
}

/* inventory list */

.fridge-inventory {
  padding: 1.5rem 1.4rem;
  margin-bottom: 1.5rem;
}

.fridge-inv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.fridge-inv-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--brand-brown);
  margin: 0;
  flex: 0 1 auto;
}

.fridge-inv-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.share-import-banner {
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(236, 253, 245, 0.95), rgba(255, 255, 255, 0.75));
  border: 1.5px solid #6ee7b7;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
  animation: viewIn 0.3s ease;
}

.share-import-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #065f46;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

.share-import-sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #047857;
}

.share-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.share-import-actions .btn-primary,
.share-import-actions .btn-secondary {
  width: auto;
  min-height: 44px;
  flex: 1 1 auto;
}

.fridge-add-row {
  display: flex;
  gap: 0.5rem;
}

.fridge-add-row input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1rem;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--brand-brown);
}

.fridge-add-row input:focus {
  outline: none;
  border-color: var(--brand-orange-dark);
}

.fridge-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.fridge-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-left: 4px solid var(--border);
  box-shadow: 0 2px 10px rgba(70, 43, 33, 0.05);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: viewIn 0.25s ease;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.fridge-item:hover {
  box-shadow: 0 6px 18px rgba(70, 43, 33, 0.1);
}

.fridge-item-expired { border-left-color: #dc2626; }
.fridge-item-urgent { border-left-color: #f59e0b; }
.fridge-item-soon { border-left-color: #fbbf24; }
.fridge-item-ok { border-left-color: #34d399; }
.fridge-item-none { border-left-color: var(--brand-orange-mid); }

.fridge-item-emoji {
  font-size: 1.55rem;
  flex-shrink: 0;
}

.fridge-item-info {
  flex: 1;
  min-width: 0;
}

.fridge-item-name {
  font-weight: 700;
  font-size: 0.97rem;
  color: var(--brand-brown);
  margin: 0;
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fridge-item-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.fridge-item-shop-btn {
  margin-top: 0.5rem;
  width: auto;
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
}

.fridge-chip {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.fridge-chip-expired { background: #fee2e2; color: #b91c1c; }
.fridge-chip-urgent { background: #fef3c7; color: #b45309; }
.fridge-chip-soon { background: #fef9c3; color: #a16207; }
.fridge-chip-ok { background: #d1fae5; color: #047857; }
.fridge-chip-none { background: var(--brand-orange-light); color: var(--brand-brown-soft); }

.fridge-item-date {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex-shrink: 0;
}

.fridge-item-date span {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fridge-item-date input {
  padding: 0.4rem 0.55rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--brand-brown);
  background: rgba(255, 255, 255, 0.85);
  min-height: 40px;
}

.fridge-item-date input:focus {
  outline: none;
  border-color: var(--brand-orange-dark);
}

.fridge-item-remove {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.fridge-item-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.fridge-empty {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.fridge-empty.hidden { display: none; }

.fridge-empty-emoji {
  font-size: 2.6rem;
  margin-bottom: 0.4rem;
}

/* fridge recipes */

.fridge-recipes {
  margin-bottom: 1.5rem;
}

.fridge-recipes-list {
  display: grid;
  gap: 1rem;
}

.fridge-recipe {
  padding: 1.4rem 1.4rem 1.2rem;
  animation: viewIn 0.35s ease both;
}

.fridge-recipe-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fridge-recipe-head h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--brand-brown);
}

.fridge-recipe-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-orange-dark);
  white-space: nowrap;
}

.fridge-recipe-desc {
  margin: 0.35rem 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.fridge-recipe-uses {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.fridge-recipe-uses .fridge-chip {
  text-transform: capitalize;
}

.fridge-recipe-extras {
  font-size: 0.82rem;
  color: var(--brand-brown-soft);
  margin: 0 0 0.5rem;
}

.fridge-recipe-noextras {
  color: #047857;
  font-weight: 600;
}

.fridge-recipe-actions {
  margin-top: 0.75rem;
}

.fridge-recipe-actions:empty {
  display: none;
}

.fridge-shopping {
  padding: 1.5rem 1.4rem;
  margin-bottom: 1.5rem;
}

.fridge-shopping-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.fridge-shopping-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(120, 80, 40, 0.12);
}

.fridge-shopping-item.is-checked {
  opacity: 0.55;
}

.fridge-shopping-item.is-checked .fridge-shopping-name {
  text-decoration: line-through;
}

.fridge-shopping-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.fridge-shopping-check input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand-green);
}

.fridge-shopping-emoji {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.fridge-shopping-name {
  font-weight: 600;
  color: var(--brand-brown);
  word-break: break-word;
}

.fridge-recipe-steps summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--brand-orange-dark);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--brand-orange-light);
  border: 1.5px solid var(--brand-orange-mid);
  touch-action: manipulation;
  transition: background 0.18s ease;
}

.fridge-recipe-steps summary::-webkit-details-marker { display: none; }

.fridge-recipe-steps summary:hover {
  background: var(--brand-orange-mid);
}

.fridge-recipe-steps[open] summary {
  background: var(--brand-orange);
  border-color: var(--brand-orange-dark);
  color: white;
}

.fridge-recipe-steps ol {
  margin: 0.85rem 0 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.65rem;
}

.fridge-recipe-steps li {
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--brand-brown-soft);
}

/* ============================================================
   Toasts — friendly status updates
   ============================================================ */

.toast-stack {
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: min(92vw, 26rem);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(70, 43, 33, 0.18);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--brand-brown);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-in {
  opacity: 1;
  transform: translateY(0);
}

.toast-out {
  opacity: 0;
  transform: translateY(8px);
}

.toast-success { border-left: 4px solid #34d399; }
.toast-warn { border-left: 4px solid #f59e0b; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid var(--brand-orange); }

.toast-icon { flex-shrink: 0; }
.toast-msg { min-width: 0; }

/* ============================================================
   Mobile tweaks for fridge + nav
   ============================================================ */

@media (max-width: 639px) {
  .app-nav {
    position: sticky;
    top: calc(3.5rem + env(safe-area-inset-top, 0px) + 0.5rem);
    z-index: 45;
    margin-bottom: 1.1rem;
  }

  .app-nav-btn {
    min-height: 48px;
    font-size: 0.92rem;
  }

  .fridge-hero {
    padding: 1.5rem 1.15rem;
  }

  .fridge-actions .btn-camera {
    width: 100%;
  }

  .expiring-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .fridge-item {
    flex-wrap: wrap;
    padding: 0.85rem 0.9rem;
  }

  .fridge-item-info {
    flex: 1 1 60%;
  }

  .fridge-item-date {
    order: 4;
    flex: 1 1 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
  }

  .fridge-item-date input {
    min-height: 44px;
    font-size: 16px;
  }

  .fridge-add-row input {
    font-size: 16px;
    min-height: 48px;
  }

  .toast {
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-panel,
  .meal-modal-panel,
  .meal-card,
  .btn-primary,
  .app-view,
  .fridge-item,
  .fridge-recipe,
  .expiring-banner,
  .fridge-analyzing,
  .bg-pattern,
  .spinner,
  .toast {
    animation: none;
    transition: none;
  }

  .meal-card:hover,
  .meal-card:active {
    transform: none;
  }
}
