@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fff8ec;
  --surface: #fffdf7;
  --ivory: #f7eddc;
  --line: #e9dbc6;
  --ink: #252e23;
  --muted: #5c5c50;
  --green: #26614a;
  --dark: #183e32;
  --tomato: #ac362a;
  --tomato-dark: #8f2c23;
  --gold: #ffdfa0;
  --danger: #972f25;
  --shadow: 0 14px 36px #63351514;
  --display-font: "Bricolage Grotesque", system-ui, sans-serif;
  font: 100%/1.55 "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(to bottom, #fff8ec12 5rem, var(--paper) 34rem),
    repeating-linear-gradient(90deg, #b84a2510 0 20px, transparent 20px 40px),
    repeating-linear-gradient(0deg, #b84a2510 0 20px, transparent 20px 40px),
    var(--paper);
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; opacity: .56; }
a { color: var(--green); text-underline-offset: .2em; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3, .brand-name { font-family: var(--display-font); }
h1 { font-size: clamp(2.4rem, 4.3vw, 4.1rem); font-weight: 780; line-height: 1.04; letter-spacing: -.045em; }
h2 { font-size: clamp(1.65rem, 2.55vw, 2.25rem); font-weight: 740; line-height: 1.12; letter-spacing: -.036em; }
h3 { font-size: 1.17rem; font-weight: 700; line-height: 1.25; letter-spacing: -.018em; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  border: 1px solid var(--line);
  min-height: 44px;
  border-radius: 12px;
  background: var(--surface);
  padding: .58rem .9rem;
  color: var(--ink);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.25;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--ivory); }
.primary { background: var(--tomato); border-color: var(--tomato); color: white; }
.primary:hover { background: var(--tomato-dark); border-color: var(--tomato-dark); }
.quiet { border-color: transparent; background: transparent; }
.danger { color: var(--danger); }
.icon { width: 1.2rem; height: 1.2rem; vertical-align: -.22em; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.loading { margin: 2rem; }

.shell { display: grid; grid-template-columns: 215px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 1.9rem 1.05rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 2.15rem;
  overflow-y: auto;
  background: var(--dark);
  color: #faf1d9;
}
.brand { display: flex; align-items: center; gap: .62rem; padding-left: .4rem; color: var(--dark); }
.brand img { width: 42px; height: 42px; border-radius: 13px; }
.brand-name { font-size: 2rem; font-weight: 800; letter-spacing: -.07em; line-height: 1; }
.sidebar .brand { color: #fff1d2; }
.sidebar .brand img { box-shadow: 0 0 0 1px #ddedbd48; }
.nav { display: grid; gap: .42rem; }
.nav button {
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: .62rem .84rem;
}
.sidebar .nav button, .side-end button { color: #f8f0d8; }
.sidebar .nav button:hover, .side-end button:hover { background: #ffffff17; }
.sidebar .nav button[aria-current="page"] { background: var(--gold); color: var(--dark); }
.sidebar :focus-visible { outline-color: #ffedaa; }
.side-end { margin-top: auto; }
.side-end button { width: 100%; justify-content: flex-start; }
.main { min-width: 0; padding: 1.25rem clamp(1.2rem, 4.2vw, 4rem) 3rem; }
.content { max-width: 1230px; margin: 0 auto; }
.topbar {
  display: flex;
  gap: .8rem;
  align-items: center;
  justify-content: space-between;
  padding: .2rem 0 1.15rem;
}
.topbar .date { color: var(--dark); font-weight: 700; }
.topbar .actions { margin-left: auto; flex-wrap: nowrap; }
.topbar .actions > button { border-radius: 999px; }
.topbar .actions > button:last-child { width: 44px; }
.location-button {
  max-width: 13rem;
  line-height: 1.12;
  color: var(--dark);
  background: #edf2dd;
  border-color: #d6e0bf;
  padding-inline: .78rem;
}
.location-button:hover { background: #e4edcb; }
.mobile-brand { display: none; }

.heading {
  margin: .35rem 0 1.55rem;
  padding: clamp(1.25rem, 3vw, 2.15rem);
  border: 1px solid var(--heading-line, #f0d797);
  border-radius: 24px;
  background: var(--heading-wash, #ffebbb);
  color: var(--dark);
}
.heading p { margin-top: .42rem; }
[data-view="pantry"] { --heading-wash: #e9f1d5; --heading-line: #d6e2ba; }
[data-view="offers"] { --heading-wash: #faddd1; --heading-line: #f0c9b8; }
[data-view="receipts"] { --heading-wash: #e5edf7; --heading-line: #d4e0f0; }
[data-view="chat"] { --heading-wash: #eee3f5; --heading-line: #e4d3ed; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.14fr);
  min-height: 320px;
  margin-bottom: 1.9rem;
  border: 1px solid #edd398;
  border-radius: 28px;
  overflow: hidden;
  background: #ffe9b5;
  box-shadow: var(--shadow);
}
.hero-body {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1rem;
  padding: clamp(1.4rem, 3.2vw, 2.85rem);
  color: var(--dark);
}
.hero time {
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.35;
  color: #693e25;
}
.hero time::first-letter { text-transform: uppercase; }
.hero h1 {
  font-size: clamp(2.65rem, 4vw, 4.05rem);
  line-height: .99;
  text-wrap: balance;
}
.hero .primary { border-radius: 999px; padding-inline: 1.06rem; }
.hero-media { position: relative; min-width: 0; min-height: 100%; background: #e8b875; }
.hero-media img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.hero-photo-button {
  position: absolute;
  right: .9rem;
  bottom: .9rem;
  border-color: #fff6e2;
  border-radius: 999px;
  background: #fffaf0;
  box-shadow: 0 4px 12px #2f21002c;
  color: #41311c;
  padding-inline: .73rem;
  font-size: .88rem;
}
.hero-photo-button:focus-visible { outline-color: #fffaf0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .85rem; flex-wrap: wrap; margin-bottom: .88rem; }
.section-heading > div > .muted { margin-top: .27rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .54rem; }
.grid-meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .88rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.05rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
[data-slot="breakfast"] { --meal-wash: #feebbc; --meal-hue: #6b430d; --meal-edge: #efc969; }
[data-slot="lunch"] { --meal-wash: #e8efd7; --meal-hue: #30573c; --meal-edge: #bdcf9b; }
[data-slot="dinner"] { --meal-wash: #f8e0d5; --meal-hue: #802f22; --meal-edge: #ebb29b; }
[data-slot="snack"] { --meal-wash: #eee4f3; --meal-hue: #5f4271; --meal-edge: #d7bde0; }
.meal-card {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  border-top: 4px solid var(--meal-edge);
  box-shadow: 0 6px 18px #6335150b;
}
.meal-header { display: flex; flex-wrap: wrap; align-items: center; gap: .42rem .65rem; }
.meal-card .actions { margin-top: auto; padding-top: .23rem; }
.meal-card .slot, .meal-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  width: fit-content;
  color: var(--meal-hue);
  font-size: .89rem;
  font-weight: 700;
}
.meal-card .slot { padding: .21rem .58rem; border-radius: 999px; background: var(--meal-wash); }
.meal-card .slot .icon, .meal-status .icon { width: 1.04rem; height: 1.04rem; }
.meal-status { color: var(--green); }
.meal-card h3 { font-size: clamp(1.24rem, 2.05vw, 1.5rem); }
.pantry-callout { background: #eaf1db; border-color: #d6e2c0; }
.pantry-callout h3 { color: var(--dark); }
.pantry-callout h3 .icon { margin-right: .16rem; }
.secondary { margin-top: 1.65rem; }
.stack { display: grid; gap: .72rem; }
.empty { background: var(--ivory); border: 1px dashed #cdbd9e; padding: 1.2rem; border-radius: 16px; }
.empty p + .actions { margin-top: .8rem; }
.empty h3 { margin-bottom: .3rem; }
.list-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; }
.list-row + .list-row { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.list-row .description { min-width: 0; flex: 1 1 16rem; }
.list-row p { margin-top: .18rem; }
.compact { min-height: 44px; padding: .42rem .64rem; font-size: .9rem; }
.week { display: grid; gap: .75rem; }
.week-day { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 4fr); align-items: stretch; gap: .68rem; }
.week-day[data-today] { border-color: #d7a64e; }
.week-date { text-align: left; justify-content: flex-start; height: 100%; }
.week-day[data-today] .week-date { background: #ffebbb; color: #694412; }
.week-meals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); gap: .55rem; }
.week-meal {
  text-align: left;
  justify-content: flex-start;
  align-items: flex-start;
  height: 100%;
  flex-direction: column;
  gap: .2rem;
  background: var(--meal-wash);
  border-color: transparent;
}
.week-meal:hover { background: var(--meal-wash); border-color: var(--meal-edge); }
.week-meal span { color: var(--meal-hue); font-weight: 650; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 305px), 1fr)); gap: .85rem; }
.store-card { border-top: 3px solid #e8b2a3; }
.store-card .actions { align-self: end; }
.receipt-items { margin-block: .5rem 0; }
.checklist-row .check { flex: 1; min-height: 40px; }
.checklist-row.checked label > span { color: var(--muted); text-decoration: line-through; }
.fidelity { color: var(--green); font-size: .9rem; }
.tabs { display: inline-flex; gap: .2rem; border: 1px solid var(--line); padding: .18rem; border-radius: 15px; background: var(--surface); }
.tabs button { border: 0; min-height: 41px; }
.tabs button[aria-pressed="true"] { background: #ffebbb; color: #694412; }

.chat-layout { max-width: 805px; }
.chat-log { display: grid; gap: .7rem; margin-bottom: .9rem; }
.bubble { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { background: #eee3f5; border-color: #e2d3ed; margin-left: min(7vw, 90px); }
.bubble.assistant { background: #edf2df; border-color: #dce8c6; margin-right: min(7vw, 90px); }
.chat-samples { margin-top: .85rem; }
.chat-input { margin-top: .85rem; }
.chat-input .actions { justify-content: flex-end; }
.chat-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .55rem; align-items: center; }
.chat-thumbnail { display: block; width: auto; max-width: min(100%, 180px); max-height: 145px; margin-block: .2rem .4rem; }
#speech-status:empty { display: none; }
label { display: grid; gap: .38rem; font-weight: 650; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d0c3af;
  border-radius: 11px;
  padding: .54rem .68rem;
  color: var(--ink);
  background: #fffefb;
}
textarea { min-height: 92px; resize: vertical; }
input[type="checkbox"] { width: 1.16rem; min-height: 1.16rem; accent-color: var(--green); }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input[type="file"] { min-height: auto; }
input[type="date"] { max-width: 12rem; }
form { display: grid; gap: .88rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .95rem; }
dialog {
  max-width: min(94vw, 620px);
  width: 100%;
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 23px;
  padding: clamp(1rem, 4vw, 1.7rem);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 12px 36px #1713122b;
}
dialog::backdrop { background: #253425a6; }
.dialog-head { margin-bottom: 1.02rem; }
.dialog-head h2 { flex: 1; color: var(--dark); }
.dialog-foot { margin-top: .85rem; justify-content: flex-end; }
.dialog-error, .form-error { color: var(--danger); font-size: .93rem; }
.dialog-error:empty, .form-error:empty { display: none; }
.recipe-list { padding-left: 1.1rem; }
.photo-preview { width: min(100%, 330px); max-height: 210px; object-fit: contain; border-radius: 12px; }
.photo-item { display: grid; grid-template-columns: auto minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: .4rem; align-items: center; }
.login {
  display: grid;
  align-items: center;
  min-height: 100dvh;
  width: min(100% - 2rem, 510px);
  margin: 0 auto;
  padding: 2rem 0;
}
.login-card { padding: clamp(1.25rem, 5vw, 2.2rem); box-shadow: var(--shadow); border-top: 5px solid var(--tomato); }
.login-card h1 { margin: 1.18rem 0 .5rem; font-size: clamp(2.45rem, 9vw, 3.3rem); color: var(--dark); }
.login-card form { margin-top: 1.35rem; }
#feedback:not(:empty) {
  position: fixed;
  z-index: 10;
  bottom: 1.2rem;
  right: 1.2rem;
  background: var(--dark);
  color: white;
  padding: .68rem .9rem;
  border-radius: 13px;
  box-shadow: var(--shadow);
  max-width: min(88vw, 460px);
  pointer-events: none;
}
.bottom-nav { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 174px minmax(0, 1fr); }
  .sidebar { padding-inline: .7rem; }
  .main { padding-inline: 1.25rem; }
  .hero h1 { font-size: clamp(2.45rem, 5vw, 3.6rem); }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .main {
    padding: max(.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
      calc(5.3rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }
  .mobile-brand { display: flex; padding: 0; flex-shrink: 0; gap: .44rem; }
  .mobile-brand img { width: 34px; height: 34px; border-radius: 10px; }
  .mobile-brand .brand-name { font-size: clamp(1.55rem, 6vw, 1.88rem); }
  .topbar .date { display: none; }
  .topbar { gap: .35rem; padding-bottom: .72rem; }
  .topbar .actions { gap: .34rem; }
  .location-button { max-width: min(42vw, 12rem); padding-inline: .53rem; overflow-wrap: anywhere; }
  .hero { grid-template-columns: 1fr; min-height: auto; margin-bottom: 1.4rem; border-radius: 21px; }
  .hero-media { grid-row: 1; min-height: 0; height: clamp(145px, 44vw, 235px); }
  .hero-body { padding: .95rem 1.2rem 1.12rem; gap: .7rem; }
  .hero h1 { font-size: clamp(2.2rem, 9.6vw, 3.55rem); text-wrap: wrap; }
  .hero time { font-size: .87rem; }
  .hero-photo-button { right: .6rem; bottom: .6rem; }
  .heading { margin: .25rem 0 1.1rem; border-radius: 19px; }
  .section-heading { margin-bottom: .72rem; }
  .grid-meals { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .card { padding: .95rem; }
  .week-day { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .week-meals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottom-nav {
    position: fixed;
    z-index: 3;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .1rem;
    background: #fffdf6;
    border-top: 1px solid #e2d2b9;
    box-shadow: 0 -5px 22px #55392014;
    padding: .34rem max(.24rem, env(safe-area-inset-right)) calc(.34rem + env(safe-area-inset-bottom))
      max(.24rem, env(safe-area-inset-left));
  }
  .bottom-nav button {
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
    min-width: 0;
    min-height: 49px;
    padding: .32rem .02rem;
    font-size: clamp(.7rem, 3.05vw, .79rem);
    letter-spacing: -.02em;
    line-height: 1.08;
  }
  .bottom-nav button[aria-current="page"] { background: #ffe9b5; color: #582809; }
  #feedback:not(:empty) { bottom: calc(4.75rem + env(safe-area-inset-bottom)); right: .7rem; }
}
@media (max-width: 360px) {
  .bottom-nav button { font-size: .7rem; }
  .location-button { font-size: .82rem; }
}
