:root {
  --ink: #20342d;
  --muted: #68766f;
  --cream: #f5f0e6;
  --paper: #fffdf8;
  --orange: #d96b3b;
  --orange-dark: #bd5429;
  --green: #799b72;
  --line: #ded9cf;
  --shadow: 0 18px 50px rgba(43, 55, 48, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 16%, rgba(217,107,59,.07), transparent 24rem),
    var(--cream);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
.shell { max-width: 1280px; margin: auto; padding: 0 44px; }

.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(32,52,45,.14);
}

.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: .18em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: white; font-family: Fraunces, serif; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.saved { font-size: 12px; color: var(--muted); }
.saved span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); }
.text-button { padding: 0; border: 0; border-bottom: 1px solid rgba(32,52,45,.35); background: transparent; color: var(--ink); font-size: 11px; cursor: pointer; }
.text-button:hover { color: var(--orange); border-color: var(--orange); }
.icon-button, .close-button { border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.hero { min-height: 300px; padding: 62px 0 54px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.eyebrow, .card-label, .recipe-type { color: var(--orange); font-size: 11px; font-weight: 700; letter-spacing: .17em; margin: 0 0 13px; }
h1, h2 { font-family: Fraunces, Georgia, serif; }
h1 { max-width: 780px; margin: 0; font-size: clamp(42px, 5.5vw, 68px); line-height: 1.02; letter-spacing: -.035em; }
.intro { margin: 21px 0 0; color: var(--muted); font-size: 17px; }
.generate { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; padding: 16px 22px; border: 0; border-radius: 5px; color: white; background: var(--orange); box-shadow: 0 8px 20px rgba(217,107,59,.22); cursor: pointer; font-weight: 700; transition: transform .2s, background .2s; }
.generate:hover { transform: translateY(-2px); background: var(--orange-dark); }
.generate:active { transform: translateY(0); }
.generate svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.generate.spin svg { animation: spin .55s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

.week-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 18px 0 24px; }
.week-heading h2, .pantry h2 { margin: 0; font-size: 31px; }
.week-heading > p { color: var(--muted); font-size: 13px; }
.week-tools { display: flex; align-items: center; gap: 11px; }
.week-tools label { color: var(--muted); font-size: 12px; }
.week-tools input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit; font-size: 12px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 9px; }
.day-card { min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 18px rgba(43,55,48,.03); }
.day-card.weekend { border-color: rgba(217,107,59,.5); }
.day-head { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.day-name { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.day-date { float: right; color: #99a19d; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.meal-button { display: block; width: 100%; min-height: 168px; padding: 20px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; color: inherit; cursor: pointer; transition: background .2s; }
.meal-button:last-child { border-bottom: 0; }
.meal-button:hover { background: #faf6ed; }
.meal-button small { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--orange); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.meal-button small span:last-child { color: #9aa19e; font-size: 12px; letter-spacing: 0; transition: transform .2s; }
.meal-button:hover small span:last-child { transform: translateX(3px); }
.meal-button strong { display: block; min-height: 52px; font-family: Fraunces, serif; font-size: 16px; line-height: 1.18; }
.meal-button p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.premium-tag { display: inline-block; margin-top: 10px; padding: 3px 7px; border-radius: 20px; color: var(--orange); background: #f9e8dd; font-size: 8px; font-weight: 700; letter-spacing: .08em; }

.pantry { margin: 72px 0 42px; padding: 34px; display: grid; grid-template-columns: minmax(230px, .75fr) 1.25fr; gap: 50px; background: #253b33; color: white; border-radius: 9px; }
.pantry h2 { margin-bottom: 10px; }
.pantry > div:first-child > p:last-child { color: #b9c4bf; font-size: 13px; line-height: 1.6; }
.pantry-tags { display: flex; flex-wrap: wrap; align-content: center; gap: 8px; }
.pantry-tags span { padding: 7px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 30px; color: #dce4e0; font-size: 11px; }

footer { display: flex; justify-content: space-between; padding: 26px 0 40px; border-top: 1px solid rgba(32,52,45,.14); color: var(--muted); font-size: 11px; }

.recipe-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
.recipe-dialog::backdrop { background: rgba(24,37,32,.62); backdrop-filter: blur(3px); }
.close-button { position: absolute; z-index: 2; top: 16px; right: 18px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.72); font-size: 25px; line-height: 1; }
.recipe-hero { padding: 38px 42px 28px; background: #e7ede0; }
.recipe-hero h2 { margin: 0 0 10px; font-size: 34px; line-height: 1.1; }
.recipe-hero > p { margin: 0; color: var(--muted); }
.recipe-meta { display: flex; gap: 22px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.recipe-meta strong { color: var(--ink); font-weight: 600; }
.recipe-content { display: grid; grid-template-columns: .8fr 1.2fr; gap: 40px; padding: 32px 42px 42px; }
.recipe-content h3 { margin: 0 0 16px; font: 700 12px "DM Sans", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.recipe-content ul, .recipe-content ol { margin: 0; padding-left: 19px; color: #536159; font-size: 13px; line-height: 1.55; }
.recipe-content li { margin-bottom: 9px; padding-left: 4px; }

.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 11px 17px; border-radius: 30px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 950px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .hero { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
  .shell { padding: 0 18px; }
  .topbar { height: 68px; }
  .saved { display: none; }
  .top-actions { gap: 11px; }
  .hero { min-height: 0; padding: 42px 0; }
  h1 { font-size: 42px; }
  .generate { width: 100%; justify-content: center; }
  .week-heading { align-items: flex-start; flex-direction: column; margin-top: 50px; }
  .week-tools { width: 100%; justify-content: space-between; }
  .week-grid { grid-template-columns: 1fr; }
  .day-card { display: grid; grid-template-columns: 90px 1fr 1fr; }
  .day-head { display: grid; place-content: center; border-bottom: 0; border-right: 1px solid var(--line); }
  .day-date { float: none; display: block; margin-top: 5px; }
  .meal-button { border-bottom: 0; border-right: 1px solid var(--line); padding: 17px 13px; }
  .meal-button { min-height: 0; }
  .meal-button:last-child { border-right: 0; }
  .meal-button strong { font-size: 15px; }
  .meal-button p { display: none; }
  .pantry { grid-template-columns: 1fr; gap: 20px; margin-top: 50px; padding: 26px; }
  .recipe-content { grid-template-columns: 1fr; gap: 24px; padding: 26px; }
  .recipe-hero { padding: 32px 26px 24px; }
  .recipe-hero h2 { padding-right: 22px; font-size: 28px; }
  footer { flex-direction: column; gap: 7px; }
}

@media print {
  body { background: white; }
  .shell { max-width: none; padding: 0; }
  .top-actions, .generate, .pantry, footer, .week-heading > p { display: none; }
  .hero { min-height: 0; padding: 30px 0; }
  h1 { font-size: 38px; }
  .week-grid { grid-template-columns: repeat(4, 1fr); }
  .day-card { break-inside: avoid; box-shadow: none; }
}
