/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f1ea;
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

.hidden { display: none !important; }

/* ── App shell ────────────────────────────────────────────── */
.app-shell {
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 48px;
}

/* ── App header ───────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 10px;
}

.app-icon-wrap {
  width: 46px;
  height: 46px;
  background: #2d5a3d;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.app-name {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.app-tagline {
  display: block;
  font-size: 13px;
  color: #333;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 28px 24px 32px;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  background: white;
  border: 1px solid #e8e4dc;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  color: #444;
  margin-bottom: 22px;
}

.hero-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  color: #1a1a1a;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero-sub {
  font-size: 15px;
  color: #333;
  line-height: 1.65;
  margin-bottom: 26px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.hero-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-chip {
  background: white;
  border: 1px solid #e8e4dc;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-icon { flex-shrink: 0; vertical-align: middle; }

.section-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ── Form card ────────────────────────────────────────────── */
.form-card {
  background: white;
  border-radius: 24px;
  padding: 28px 22px 32px;
  margin: 0 14px;
}

/* ── Form sections ────────────────────────────────────────── */
.form-section {
  margin-bottom: 36px;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-icon {
  font-size: 20px;
  line-height: 1;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

/* ── Stepper rows ─────────────────────────────────────────── */
.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0ece4;
}

.stepper-label {
  font-size: 15px;
  color: #1a1a1a;
  font-weight: 400;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 18px;
}

.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid #e0dbd2;
  background: #f9f7f3;
  font-size: 20px;
  font-weight: 300;
  color: #2d5a3d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

.stepper-btn:hover {
  background: #eae6de;
  border-color: #c8c0b4;
}

.stepper-val {
  font-size: 18px;
  font-weight: 600;
  min-width: 28px;
  text-align: center;
  color: #1a1a1a;
}

/* ── Field groups & inputs ────────────────────────────────── */
.field-group {
  margin-bottom: 16px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #444;
  margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 13px 16px;
  background: #e2ebe5;
  border: 1.5px solid #c4d9cb;
  border-radius: 12px;
  font-size: 15px;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: #2d5a3d;
  background: white;
}

input::placeholder { color: #999; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* ── Portion size selector ────────────────────────────────── */
.size-selector {
  display: flex;
  gap: 8px;
}

.size-btn {
  flex: 1;
  padding: 11px 8px;
  background: #e2ebe5;
  border: 1.5px solid #c4d9cb;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.15s;
  width: auto;
  margin: 0;
  text-align: center;
}

.size-btn:hover {
  background: #f0ece4;
  border-color: #c8c0b4;
}

.size-btn.active {
  background: #2d5a3d;
  color: white;
  border-color: #2d5a3d;
}

/* ── Store toggle grid ────────────────────────────────────── */
.store-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.store-toggle {
  padding: 11px 8px;
  background: #e2ebe5;
  border: 1.5px solid #c4d9cb;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  user-select: none;
}

.store-toggle:hover {
  background: #f0ece4;
  border-color: #c8c0b4;
}

.store-toggle.active {
  background: #2d5a3d;
  color: white;
  border-color: #2d5a3d;
}

.store-hint {
  font-size: 13px;
  color: #333;
  margin: 0;
  line-height: 1.5;
}

/* ── iOS toggle switch ────────────────────────────────────── */
.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid #f0ece4;
  cursor: pointer;
  user-select: none;
  gap: 16px;
  -webkit-tap-highlight-color: transparent;
}

.toggle-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.toggle-item-text {
  flex: 1;
  min-width: 0;
}

.toggle-item-title {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
}

.toggle-item-desc {
  display: block;
  font-size: 13px;
  color: #333;
  margin-top: 3px;
  line-height: 1.4;
}

.toggle-track {
  width: 50px;
  height: 30px;
  background: #ddd;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-thumb {
  width: 26px;
  height: 26px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
}

.toggle-item.active .toggle-track {
  background: #2d5a3d;
}

.toggle-item.active .toggle-thumb {
  transform: translateX(20px);
}

.toggle-item.toggle-soon {
  opacity: 0.42;
  cursor: default;
}

/* ── CTA button ───────────────────────────────────────────── */
.cta-btn {
  width: 100%;
  padding: 18px;
  background: #2d5a3d;
  color: white;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

.cta-btn:hover  { background: #245032; }
.cta-btn:active { transform: scale(0.98); }

.cta-icon { font-size: 20px; }

.cta-sub {
  text-align: center;
  font-size: 13px;
  color: #444;
  margin-top: 10px;
}

/* ── Results area ─────────────────────────────────────────── */
.results-area {
  padding: 20px 14px 0;
}

/* ── Error banner ─────────────────────────────────────────── */
.error-banner {
  background: #fff0f0;
  border: 1px solid #fcc;
  border-radius: 14px;
  padding: 14px 16px;
  color: #c00;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ── Loading ──────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 48px 20px;
  background: white;
  border-radius: 20px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e8e4dc;
  border-top-color: #2d5a3d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-message {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 13px;
  color: #333;
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: #e8f0eb;
  color: #2d5a3d;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Deal cards ───────────────────────────────────────────── */
.deal {
  background: white;
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 12px;
}

.deal h3 {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.deal p {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
}

.cost-note {
  font-size: 13px;
  color: #7a9a6a;
  margin-top: 4px;
  font-weight: 400;
}

.budget-warning {
  font-size: 14px;
  color: #b85c38;
  font-weight: 500;
  margin-top: 4px;
}

/* ── Meal cards ───────────────────────────────────────────── */
.meal {
  background: white;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
  border-top: 3px solid #2d5a3d;
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.meal-day {
  font-size: 12px;
  font-weight: 700;
  color: #2d5a3d;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.match-score {
  font-size: 12px;
  font-weight: 600;
  color: #2d5a3d;
  background: #e8f0eb;
  padding: 3px 10px;
  border-radius: 999px;
}

.meal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
  line-height: 1.25;
}

.meal-meta {
  font-size: 13px;
  color: #333;
  margin-bottom: 12px;
}

.meal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.meal-tag {
  font-size: 12px;
  font-weight: 600;
  background: #e8f0eb;
  color: #2d5a3d;
  padding: 4px 10px;
  border-radius: 999px;
}

.meal h4 {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  margin-top: 14px;
}

.meal ul {
  list-style: none;
  padding: 0;
}

.meal ul li {
  font-size: 14px;
  color: #444;
  padding: 5px 0;
  border-bottom: 1px solid #f5f1ea;
  line-height: 1.4;
}

.meal ul li:last-child { border-bottom: none; }

.small {
  font-size: 14px;
  color: #444;
  line-height: 1.6;
}

/* ── Swap button ──────────────────────────────────────────── */
.swap-btn {
  width: auto;
  margin-top: 16px;
  padding: 9px 18px;
  background: #e2ebe5;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.swap-btn:hover { background: #d4e2da; color: #333; }

/* ── Shopping section ─────────────────────────────────────── */
.shopping {
  background: white;
  border-radius: 20px;
  padding: 20px;
  margin-top: 14px;
}

.shopping h3 {
  font-size: 17px;
  font-weight: 700;
  color: #2d5a3d;
  margin-bottom: 6px;
}

.shopping-hint {
  font-size: 13px;
  color: #333;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Copy / share list button ─────────────────────────────── */
.copy-btn {
  width: auto;
  margin: 0 0 16px;
  padding: 9px 18px;
  background: #2d5a3d;
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.copy-btn:hover { background: #245032; }

/* ── Shopping list groups ─────────────────────────────────── */
.shopping-group {
  margin-bottom: 18px;
}

.shopping-group-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2d5a3d;
}

.shopping-item {
  background: #e2ebe5;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
  font-size: 15px;
}

.shopping-item span { color: #1a1a1a; }
.shopping-item strong { color: #1a1a1a; font-weight: 600; }

.shopping-item.checked {
  opacity: 0.38;
  text-decoration: line-through;
}

/* ── Shopping item right side ─────────────────────────────── */
.shopping-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.item-price {
  font-size: 12px;
  color: #2d5a3d;
  font-weight: 600;
}

.package-hint {
  font-size: 11px;
  color: #7a9a6a;
  font-weight: normal;
}

/* ── Matsmart section ─────────────────────────────────────── */
.matsmart-section {
  background: white;
  border-radius: 20px;
  padding: 20px;
  margin-top: 14px;
}

.matsmart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.matsmart-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.matsmart-count {
  font-size: 12px;
  font-weight: 600;
  background: #e8f0eb;
  color: #2d5a3d;
  padding: 4px 10px;
  border-radius: 999px;
}

.matsmart-count.matsmart-soon {
  background: #f0ece4;
  color: #999;
}

.matsmart-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: #999;
  font-size: 14px;
}

.matsmart-error { color: #c00; font-size: 14px; }

.matsmart-product {
  padding: 12px 0;
  border-bottom: 1px solid #f5f1ea;
}

.matsmart-product:last-child { border-bottom: none; }

.matsmart-product-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.matsmart-name {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  flex: 1;
  margin-right: 10px;
}

.matsmart-badge {
  font-size: 12px;
  font-weight: 700;
  background: #e8f0eb;
  color: #2d5a3d;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.matsmart-product-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matsmart-price {
  font-size: 15px;
  font-weight: 700;
  color: #2d5a3d;
}

.matsmart-orig {
  font-size: 13px;
  color: #bbb;
  text-decoration: line-through;
}

.matsmart-link {
  font-size: 13px;
  color: #2d5a3d;
  text-decoration: none;
  margin-left: auto;
}

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

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 36px 16px;
  color: #999;
  font-size: 13px;
}

/* ── Responsive — wider screens ───────────────────────────── */
@media (min-width: 600px) {
  .hero-title { font-size: 40px; }
  .form-card  { padding: 36px 32px 40px; }
}
