/* ── App Shell ─────────────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-shell main { flex: 1; }

.app-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 40px 80px;
}

.app-footer {
  padding: 20px 40px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--fg-muted);
}
.footer-sep { color: var(--border); }

/* ── Nav tweaks ───────────────────────────────────────────────────────── */
.nav-tagline {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-left: auto;
}

/* ── Typography helpers ───────────────────────────────────────────────── */
.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}
.subtitle {
  font-size: 1rem;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* ── Onboarding ────────────────────────────────────────────────────────── */
.onboarding-page { padding-top: 64px; }

.onboarding-header {
  margin-bottom: 48px;
}
.onboarding-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.onboarding-form { max-width: 680px; }

.form-section { margin-bottom: 40px; }

.section-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 14px;
}

/* Household size selector */
.size-selector { display: flex; gap: 10px; }
.size-btn {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.size-btn:hover { border-color: var(--accent); color: var(--accent); }
.size-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(194,98,26,0.3);
}

/* Chip grid */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.allergy-chip.active { background: #C0392B; border-color: #C0392B; }
.allergy-active { background: #C0392B !important; border-color: #C0392B !important; }

/* Text input */
.text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: #BDB5AE; }

/* Error */
.error-msg {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(194,98,26,0.25);
  margin-top: 8px;
}
.btn-primary:hover { background: #A85218; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(194,98,26,0.3); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

/* Ghost button */
.btn-ghost {
  padding: 8px 16px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }
.btn-sm { font-size: 0.8125rem; padding: 6px 12px; }

/* Outline button */
.btn-outline {
  padding: 12px 24px;
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: var(--accent-light); }

.btn-loading { display: flex; align-items: center; gap: 8px; }
.spinner-sm {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Meal Plan ─────────────────────────────────────────────────────────── */
.mealplan-page { padding-top: 48px; }

.mealplan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
}
.mealplan-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.day-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.day-card-header {
  background: var(--accent);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-num {
  width: 24px;
  height: 24px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}
.day-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

.meal-row {
  display: grid;
  grid-template-columns: 70px 1fr 28px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}
.meal-row:last-child { border-bottom: none; }

.meal-type-label {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.75rem;
  text-transform: capitalize;
}
.meal-value { color: var(--fg-muted); line-height: 1.4; }

.regen-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--fg-muted);
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.regen-btn:hover { background: var(--accent); border-color: var(--accent); color: white; }

.mealplan-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Grocery List ─────────────────────────────────────────────────────── */
.grocery-page { padding-top: 48px; }

.grocery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.grocery-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.checked-badge {
  color: var(--accent);
  font-weight: 600;
}

.grocery-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.grocery-categories {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.grocery-category {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
}

.cat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}
.cat-icon { font-size: 1.25rem; }
.cat-count {
  margin-left: auto;
  background: var(--bg-alt);
  color: var(--fg-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
}

.grocery-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grocery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--ink);
  transition: all 0.15s;
}
.grocery-item.checked span { text-decoration: line-through; color: var(--fg-muted); }

.check-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  flex-shrink: 0;
  transition: all 0.15s;
}
.check-btn.checked {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px;
  max-width: 400px;
  width: calc(100% - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-box h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 12px;
}
.modal-box p { font-size: 0.9375rem; color: var(--fg-muted); margin-bottom: 24px; line-height: 1.6; }
.modal-box p em { color: var(--fg); font-style: italic; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn-primary { margin-top: 0; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-page { padding: 0 20px 60px; }
  .week-grid { grid-template-columns: 1fr; }
  .mealplan-actions { flex-direction: column; }
  .mealplan-actions button { width: 100%; justify-content: center; }
  .grocery-header { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
  .nav { padding: 16px 20px; }
  .onboarding-page { padding-top: 40px; }
  .size-selector { gap: 8px; }
  .size-btn { width: 44px; height: 44px; font-size: 0.875rem; }
}