:root {
  color-scheme: light;
  --canvas: #f7f4ed;
  --paper: #fffcf7;
  --ink: #292321;
  --muted: #675b55;
  --line: #e2d8ce;
  --accent: #9a3634;
  --accent-dark: #7d2927;
  --accent-light: #f2e1d9;
  --orange: #b75a33;
  --blue: #285fa6;
  --shadow: 0 12px 30px -22px #532e265e;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: var(--accent-dark); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}
img { max-width: 100%; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 10; padding: .6rem 1rem; background: var(--paper); }

.app-body { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; gap: 2rem;
  padding: 1.7rem 1rem 1rem; height: 100vh; border-right: 1px solid var(--line); background: var(--paper);
}
.brand { display: block; width: 10rem; max-width: 100%; margin: 0 auto; }
.brand img { display: block; width: 100%; height: auto; }
.navigation { display: grid; gap: .4rem; }
.navigation button {
  position: relative; display: flex; align-items: center; gap: .75rem;
  width: 100%; border: 0; background: transparent; text-align: left; min-height: 2.85rem;
  border-radius: .65rem; padding: .6rem .75rem; color: var(--muted); font-size: .91rem; font-weight: 680;
}
.navigation button:hover, .profile-button:hover, .logout-button:hover { background: #f3ebe2; color: var(--ink); }
.navigation button[aria-current="page"] { color: var(--accent-dark); background: var(--accent-light); }
.nav-icon { display: inline-block; width: 1rem; height: .92rem; flex: 0 0 1rem; position: relative; }
.icon-calendar { border: 1.5px solid currentColor; border-radius: 3px; }
.icon-calendar::before { content: ""; position: absolute; top: 2px; left: 0; right: 0; border-top: 1.5px solid; }
.icon-book { border: 1.5px solid; border-radius: 2px 3px 3px 1px; }
.icon-book::before { content: ""; position: absolute; top: 0; left: 2px; height: 100%; border-left: 1px solid; }
.icon-catalog { border: 1.5px solid; border-radius: 3px; }
.icon-catalog::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
}
.icon-store { border: 1.5px solid currentColor; border-radius: 2px; height: .68rem; margin-top: .23rem; }
.icon-store::before { content: ""; position: absolute; left: -2px; right: -2px; top: -.28rem; height: .3rem; border: 1.5px solid currentColor; border-radius: 6px 6px 2px 2px; background: inherit; }
.icon-store::after { content: ""; position: absolute; left: 40%; bottom: 0; height: .4rem; border-left: 1.5px solid currentColor; }
.icon-box { border: 1.5px solid; border-radius: 3px; }
.icon-box::before { content: ""; position: absolute; top: 3px; left: 3px; width: .4rem; border-top: 1.5px solid; }
.icon-list { border-left: 2px dotted; padding-left: 3px; }
.icon-list::before { content: ""; position: absolute; top: 2px; right: 0; width: .65rem; height: .54rem; border-top: 1px solid; border-bottom: 1px solid; }
.icon-bars { border-bottom: 1.5px solid; background: linear-gradient(to top, currentColor, currentColor) left bottom / 3px 42% no-repeat,
  linear-gradient(to top, currentColor, currentColor) center bottom / 3px 68% no-repeat,
  linear-gradient(to top, currentColor, currentColor) right bottom / 3px 100% no-repeat; }
.sidebar-bottom { display: grid; gap: .25rem; margin-top: auto; }
.profile-button, .logout-button {
  width: 100%; border: 0; border-radius: .65rem; background: transparent; text-align: left;
  color: var(--muted); padding: .55rem .55rem; font-size: .82rem; font-weight: 650;
}
.profile-button { display: flex; align-items: center; gap: .55rem; min-height: 3.15rem; }
.profile-button small { display: block; font-size: .72rem; font-weight: 500; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent-light); color: var(--accent-dark); }

.workspace { width: 100%; max-width: 112rem; margin: 0 auto; padding: clamp(1.25rem, 3.2vw, 3rem); min-width: 0; }
.loading { margin: 3rem 0; color: var(--muted); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.page-heading h1 { font-size: clamp(2.4rem, 4.5vw, 3.7rem); line-height: 1.02; letter-spacing: -.075em; }
.page-heading p { margin-top: .52rem; font-size: .95rem; color: var(--muted); }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: .67rem;
  line-height: 1.2; min-height: 2.4rem; padding: .52rem .85rem;
  text-decoration: none; white-space: nowrap; font-size: .86rem; font-weight: 690;
}
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary, .icon-button { background: var(--paper); border-color: var(--line); color: var(--ink); }
.button-secondary:hover, .icon-button:hover { background: #f3ebe2; }
.button-tertiary { background: transparent; color: var(--accent-dark); padding-inline: .42rem; }
.button-tertiary:hover { color: var(--ink); background: #f3ebe2; }
.button-danger { background: #f8e6e2; color: #762724; border-color: #efd0ca; }
.button-danger:hover { background: #f1d1cb; }
.icon-button { font-size: 1.25rem; width: 2.35rem; min-width: 2.35rem; padding: 0; }
.surface, .metric, .recipe-card, .empty-state { background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); }
.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .72rem; margin-bottom: 1.25rem; }
.stats-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { min-width: 0; padding: .8rem .9rem; display: grid; gap: .24rem; align-content: start; }
.metric span, .metric small { color: var(--muted); font-size: .77rem; }
.metric strong { font-size: clamp(1.2rem, 2.5vw, 1.8rem); letter-spacing: -.055em; line-height: 1.12; font-variant-numeric: tabular-nums; }
.section-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem;
  padding: .85rem 1rem;
}
.section-bar h2 { letter-spacing: -.035em; font-size: 1.15rem; }
.week-control { display: flex; align-items: center; gap: .35rem; }
.week-control span { font-size: .8rem; color: var(--muted); text-align: center; min-width: 8rem; }
.planning-board { container-type: inline-size; }
.agenda {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: .58rem;
  padding: .18rem .8rem .8rem;
}
.agenda-day {
  min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto auto auto; background: #fbf6ef;
  border: 1px solid #e9dbce; border-radius: .85rem;
}
.day-heading {
  grid-column: 1 / -1; display: grid; align-content: start; gap: .32rem;
  padding: .58rem .6rem; background: #f3e9de; border-radius: .8rem .8rem 0 0;
}
.day-name {
  display: flex; align-items: center; justify-content: space-between; gap: .26rem;
  color: var(--ink); font-size: .79rem; font-weight: 730; text-transform: capitalize;
}
.day-name time {
  display: inline-grid; place-items: center; min-width: 1.65rem; height: 1.62rem;
  padding-inline: .22rem; border-radius: .43rem; background: var(--paper);
  font-size: .8rem; font-variant-numeric: tabular-nums;
}
.day-total {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .06rem .48rem;
  color: var(--muted); font-size: .67rem; font-variant-numeric: tabular-nums;
}
.day-total strong { color: var(--accent-dark); font-size: .74rem; font-weight: 740; }
.day-total abbr { text-decoration: none; }
.agenda-day.is-today { border-color: #d7a696; }
.is-today .day-heading { background: #f1ddd2; }
.is-today .day-name time { background: var(--accent); color: white; }
.day-today { color: var(--accent-dark); font-size: .68rem; font-weight: 690; }
.meal-slot {
  min-width: 0; min-height: 3.1rem; display: flex; flex-direction: column; gap: .34rem;
  padding: .28rem .4rem .47rem; border-top: 1px solid #ebdfd4;
}
.meal-slot:nth-of-type(even) { border-left: 1px solid #ebdfd4; }
.slot-label {
  min-height: 1.7rem; display: flex; align-items: center; justify-content: space-between; gap: .16rem;
  padding-left: .1rem; color: var(--muted); font-size: .7rem; font-weight: 680;
}
.slot-add {
  flex: 0 0 1.6rem; display: grid; place-items: center; width: 1.6rem; height: 1.6rem;
  padding: 0; border: 1px solid transparent; border-radius: .4rem;
  color: var(--accent-dark); background: #f1e4d8; font-size: 1rem; line-height: 1;
}
.slot-add:hover { border-color: #d6ae9d; background: var(--accent-light); }
.meal-card {
  width: 100%; min-width: 0; display: grid; text-align: left; padding: 0;
  color: var(--ink); background: var(--paper); border: 1px solid #e8d9cd; border-radius: .62rem;
  box-shadow: 0 3px 8px -5px #62423166;
}
.meal-card:hover { border-color: #c68974; box-shadow: 0 4px 10px -4px #62423172; }
.meal-card-photo {
  display: block; aspect-ratio: 3 / 2; overflow: hidden;
  border-radius: .56rem .56rem 0 0; background: #efe3d6;
}
.meal-card-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.meal-card-photo.is-ingredient { background: #fffefd; }
.meal-card-photo.is-ingredient img { object-fit: contain; }
.meal-card-body { display: grid; gap: .28rem; min-width: 0; padding: .43rem .44rem .48rem; }
.meal-card-body:only-child { background: #f7eee4; border-radius: .56rem; }
.meal-card-body strong { font-size: .78rem; font-weight: 720; line-height: 1.22; overflow-wrap: anywhere; }
.meal-card-body small {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .06rem .32rem;
  color: var(--muted); font-size: .68rem; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.meal-card-body small span:last-child { color: var(--accent-dark); font-weight: 680; white-space: nowrap; }
.meal-preparation { color: var(--muted); font-size: .69rem; }

@container (min-width: 34rem) {
  .agenda { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-day { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(4, auto) 1fr; }
  .meal-slot:nth-of-type(even) { border-left: 0; }
}
@container (min-width: 41rem) {
  .agenda { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (min-width: 49rem) {
  .agenda { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 64rem) {
  .agenda { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  @supports (grid-template-rows: subgrid) {
    .agenda { grid-template-rows: repeat(5, auto); }
    .agenda-day { grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; }
  }
}
.feedback {
  position: fixed; z-index: 4; bottom: 1.4rem; right: 1.4rem; max-width: min(28rem, calc(100vw - 2rem));
  color: #173c30; background: #e4eee7; border: 1px solid #a2bcae; padding: .65rem 1rem; border-radius: .7rem;
  box-shadow: var(--shadow); font-size: .9rem; font-weight: 680;
}
.feedback.is-error { color: #702522; background: #fae7e3; border-color: #e5bcb2; }

.empty-state { grid-column: 1 / -1; padding: clamp(1.45rem, 5vw, 3rem); text-align: center; }
.empty-state h2 { font-size: 1.3rem; letter-spacing: -.05em; }
.empty-state p { margin: .45rem 0 .9rem; color: var(--muted); }
.board > .empty-state { border: 0; box-shadow: none; }
.filters { display: flex; align-items: center; gap: .9rem; justify-content: space-between; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 2rem; padding: .33rem .65rem; border-radius: 3rem; border: 1px solid var(--line);
  background: var(--paper); color: var(--muted); font-size: .78rem; white-space: nowrap; font-weight: 660;
}
.chip.active { color: var(--accent-dark); border-color: #e6c6bd; background: var(--accent-light); }
.search { flex: 0 1 18rem; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(17rem, 100%),1fr)); gap: .8rem; }
.recipe-card { overflow: hidden; display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.recipe-card-art {
  position: relative; display: flex; align-items: flex-start; justify-content: space-between; padding: .65rem;
  height: 7rem; overflow: hidden; isolation: isolate; background-color: #e4b9a6;
  background-image: radial-gradient(ellipse at 66% 57%, #fbf1e7 0 16%, #f3d7be 17% 24%, #c17a60 25% 27%, #f7e0c8 28% 31%, transparent 32%);
}
.card-breakfast { background-color: #eacc91; background-image: radial-gradient(ellipse at 65% 53%, #f0bc63 0 10%, #d4884c 11% 17%, #f3d4a5 18% 25%, #faf0d7 26% 30%, transparent 31%); }
.card-dessert { background-color: #d6adb1; background-image: radial-gradient(ellipse at 63% 49%, #a96864 0 13%, #e1a899 14% 19%, #f6dfd2 20% 28%, #f8e7df 29% 33%, transparent 34%); }
.recipe-card-art img { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; z-index: -1; }
.pill { background: var(--paper); color: var(--accent-dark); padding: .28rem .46rem; border-radius: 2rem; font-size: .68rem; font-weight: 700; }
.favorite { color: var(--ink); border-color: var(--paper); }
.favorite.is-favorite { color: #803e20; }
.recipe-card-body { display: grid; gap: .44rem; padding: .8rem; align-content: start; }
.recipe-card-body h2 { letter-spacing: -.03em; font-size: 1.08rem; overflow-wrap: anywhere; }
.recipe-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: .36rem; padding: 0; margin: 0; list-style: none; }
.recipe-metrics li { color: var(--ink); padding: .28rem .46rem; background: #f5ebe1; border-radius: .35rem; font-size: .74rem; }
.recipe-metrics strong { color: var(--accent-dark); }
.muted, .table-note { color: var(--muted); font-size: .77rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .22rem; }
.table-note { padding: 0 1rem .8rem; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.board > .table-wrap { border: 0; box-shadow: none; border-top: 1px solid var(--line); border-radius: 0 0 1rem 1rem; }
.list-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
.list-table th, .list-table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.list-table thead th { color: var(--muted); background: #f5eee6; line-height: 1.2; font-size: .76rem; white-space: nowrap; }
.list-table tbody th { min-width: 9rem; }
.list-table td { white-space: nowrap; }
.list-table td.note-cell { white-space: normal; min-width: 8rem; }
.list-table tbody tr:last-child > * { border-bottom: 0; }
.stock-add-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.stock-sections { display: grid; gap: .9rem; }
.stock-sections > section { min-width: 0; }
.stock-empty { padding: 0 1rem .9rem; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: .8rem; }
.store-card { display: grid; align-content: start; justify-items: start; gap: .28rem; padding: .9rem 1rem; overflow-wrap: anywhere; }
.store-card h2 { font-size: 1.04rem; }
.store-card dl { display: grid; gap: .15rem; margin: .35rem 0; font-size: .82rem; }
.store-card dt { font-weight: 680; }
.store-card dd { margin: 0 0 .2rem; color: var(--muted); }
.store-card-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .28rem; }
.store-connections-band {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  padding: .55rem; margin-bottom: .95rem;
}
.store-connections-list {
  display: flex; flex-wrap: wrap; gap: .45rem;
  padding: 0; margin: 0; list-style: none; min-width: 0;
}
.store-connection-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .65rem;
  padding: .45rem .6rem; min-width: 0; max-width: 100%;
  font-size: .83rem; overflow-wrap: anywhere;
}
.store-connection-status {
  display: inline-block; padding: .17rem .45rem; border-radius: 1rem;
  font-size: .72rem; font-weight: 700;
}
.store-connection-status.is-connected { background: #e1eee5; color: #244a34; }
.store-connection-status.is-disconnected { background: #f5e0df; color: #7d302d; }
.store-connection-status.is-stale { background: #f7ebcb; color: #6e4c19; }
.store-connections-loading { margin: 0 0 .8rem; }
.store-lookup { display: grid; gap: .55rem; }
.store-lookup .button { justify-self: start; }
.store-lookup .field-help { line-height: 1.4; }
.store-details { display: grid; gap: .65rem; margin: 0; min-width: 0; padding: 0; border: 0; }
.store-details input[readonly] { background: #f8f3ed; }

.pack-board { container-type: inline-size; min-width: 0; }
.pack-summary {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .9rem;
  margin: 0 1rem .85rem; padding: .95rem 1.05rem; border-radius: .8rem;
  background: #f3e5db; color: var(--accent-dark);
}
.pack-summary > div { display: grid; align-content: start; gap: .24rem; min-width: 0; }
.pack-summary span { font-size: .78rem; font-weight: 700; }
.pack-summary strong { font-variant-numeric: tabular-nums; letter-spacing: -.05em; line-height: 1.1; }
.pack-total-value { font-size: clamp(1.62rem, 4vw, 2.55rem); }
.pack-summary small { color: var(--muted); font-size: .75rem; }
.pack-budget { border-left: 1px solid #dec4b6; padding-left: .95rem; }
.pack-budget strong { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }
.pack-details, .pack-prorata { border: 1px solid var(--line); border-radius: .7rem; }
.pack-details { margin: 0 1rem .68rem; background: #fbf3e9; }
.pack-prorata { margin-top: .85rem; }
.pack-details summary, .pack-prorata summary {
  cursor: pointer; padding: .63rem .8rem; color: var(--ink); border-radius: .66rem;
  font-weight: 700; font-size: .85rem;
}
.pack-details summary:focus-visible, .pack-prorata summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.pack-substitutions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .55rem; margin: 0; padding: 0 .72rem .72rem;
}
.pack-substitutions > div { padding: .55rem .6rem; background: var(--paper); border: 1px solid var(--line); border-radius: .55rem; }
.pack-substitutions dt { font-size: .72rem; color: var(--muted); }
.pack-substitutions dd { margin: .08rem 0 0; font-size: .82rem; overflow-wrap: anywhere; }
.pack-substitutions p { margin-top: .15rem; font-size: .75rem; color: var(--muted); }
.pack-notes { margin: 0; padding: 0 .9rem .8rem 1.65rem; color: var(--muted); font-size: .78rem; }
.pack-notes li + li { margin-top: .25rem; }
.pack-prorata-body { min-width: 0; padding: .4rem .8rem .75rem; }
.pack-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.pack-table caption { padding: .38rem 1rem .65rem; color: var(--muted); text-align: left; font-size: .77rem; }
.pack-table :is(th, td) { padding: .72rem .82rem; text-align: right; font-variant-numeric: tabular-nums; }
.pack-table :is(th, td):first-child { text-align: left; padding-left: 1rem; }
.pack-table :is(th, td):last-child { padding-right: 1rem; }
.pack-table thead th { background: #f6efe6; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.pack-table tbody :is(th, td) { border-bottom: 1px solid #eee3d8; vertical-align: top; }
.pack-table tbody tr:nth-child(even) { background: #fdf8f1; }
.pack-ingredient, .pack-product, .pack-format, .pack-line-note { display: block; overflow-wrap: anywhere; }
.pack-ingredient { font-size: .72rem; color: var(--muted); }
.pack-product { font-weight: 700; line-height: 1.25; margin-block: .07rem .16rem; }
a.pack-product { text-underline-offset: .13em; }
.pack-format, .pack-line-note { font-size: .75rem; font-weight: 400; color: var(--muted); }
.pack-line-note { margin-top: .13rem; }
.pack-table tbody td, .pack-table tfoot td { white-space: nowrap; }
.pack-table tfoot tr { background: #f3e5db; color: var(--accent-dark); }
.pack-table tfoot th { border-bottom-left-radius: .95rem; }
.pack-table tfoot td { border-bottom-right-radius: .95rem; }
.pack-mobile-label { display: none; }

@container (max-width: 37rem) {
  .pack-summary { margin-inline: .65rem; padding: .75rem; gap: .62rem; }
  .pack-budget { padding-left: .62rem; }
  .pack-details { margin-inline: .65rem; }
  .pack-table, .pack-table caption, .pack-table tbody, .pack-table tfoot { display: block; }
  .pack-table caption { padding-inline: .7rem; }
  .pack-table thead {
    position: absolute; clip-path: inset(50%); width: 1px; height: 1px;
    overflow: hidden; white-space: nowrap;
  }
  .pack-table tbody tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem;
    margin: 0 .65rem .48rem; padding: .55rem .62rem; border: 1px solid var(--line); border-radius: .65rem;
  }
  .pack-table tbody :is(th, td), .pack-table tbody :is(th, td):is(:first-child, :last-child) { padding: 0; border: 0; }
  .pack-table tbody th { grid-column: 1 / -1; }
  .pack-table tbody td { font-size: .81rem; text-align: left; }
  .pack-table tbody td:last-child { text-align: right; }
  .pack-mobile-label { display: block; color: var(--muted); font-size: .7rem; white-space: normal; }
  .pack-table tfoot tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-radius: 0 0 .95rem .95rem; }
}

.catalog-board { container-type: inline-size; min-width: 0; }
.catalog-toolbar { border-bottom: 1px solid var(--line); }
.catalog-toolbar > div { display: grid; gap: .18rem; }
.catalog-date, .catalog-origin, .catalog-value-note { color: var(--muted); font-size: .76rem; }
.catalog-search { flex: 0 1 19rem; }
.catalog-results { padding: clamp(1.4rem, 2.4vw, 2.25rem) 1rem clamp(1.5rem, 2.6vw, 2.5rem); }
.catalog-status { padding: .7rem 1rem; color: var(--muted); font-size: .85rem; }
.catalog-results .catalog-status { padding: 0; margin-bottom: 1rem; }
.catalog-heading-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.catalog-department:not(:last-child) { margin-bottom: clamp(2.5rem, 4.5vw, 3.6rem); }
.catalog-department h3 {
  display: flex; align-items: center; gap: .75rem; margin: 0 0 clamp(1rem, 1.6vw, 1.3rem);
  color: var(--ink); font-size: clamp(1.3rem, 1.12rem + .6vw, 1.6rem); font-weight: 770; line-height: 1.2;
}
.catalog-department h3::after { content: ""; flex: 1; border-bottom: 1px solid var(--line); }
.catalog-department-icon {
  display: grid; flex: none; place-items: center; width: 2.5rem; height: 2.5rem;
  border-radius: .7rem; background: #f5e8da;
  font: 1.4rem/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.catalog-groups {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: .55rem; list-style: none; padding: 0; margin: 0;
}
.catalog-groups li { min-width: 0; }
.catalog-groups button {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); align-items: center; gap: .55rem;
  width: 100%; height: 100%; min-height: 4.2rem; padding: .48rem;
  overflow-wrap: anywhere; text-align: left; border: 1px solid var(--line);
  border-radius: .65rem; background: #fcf5ed; color: var(--ink);
}
.catalog-groups button:hover { border-color: #d6ae9d; background: var(--accent-light); }
.catalog-tile-text { display: grid; gap: .16rem; }
.catalog-tile-text strong { font-size: .9rem; line-height: 1.2; }
.catalog-tile-text span { color: var(--muted); font-size: .73rem; }
.catalog-photo {
  display: grid; place-items: center; width: 3.2rem; height: 3.2rem;
  overflow: hidden; border: 1px solid #ede0d2; border-radius: .4rem; background: #f1e7db;
}
.catalog-photo:has(img) { background: #fff; }
.catalog-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.catalog-product { display: grid; grid-template-columns: 3.8rem minmax(0, 1fr); align-items: start; gap: .6rem; }
.catalog-product .catalog-photo { width: 3.8rem; height: 3.8rem; }
.catalog-product-text { min-width: 0; }
.catalog-address, .catalog-store-name { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; overflow-wrap: anywhere; }
.catalog-store-action { display: block; margin-top: .25rem; }
.catalog-store-action .button { min-height: 1.65rem; padding: .2rem .36rem; font-size: .72rem; text-align: left; }
.catalog-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.catalog-table :is(th, td) { padding: .65rem .57rem; text-align: left; }
.catalog-table :is(th, td):first-child { padding-left: 1rem; }
.catalog-table :is(th, td):last-child { padding-right: 1rem; }
.catalog-table thead th { background: #f5eee6; color: var(--muted); font-size: .76rem; }
.catalog-sort {
  display: inline-flex; align-items: center; gap: .25rem; padding: 0; border: 0;
  border-radius: .2rem; background: transparent; text-align: left; font-weight: inherit;
}
.catalog-sort:hover, .catalog-table th[aria-sort] .catalog-sort { color: var(--accent-dark); }
.catalog-sort span { flex-shrink: 0; }
.catalog-table tbody :is(th, td) { border-bottom: 1px solid #eee3d8; vertical-align: top; }
.catalog-table tbody tr:last-child > * { border-bottom: 0; }
.catalog-table tbody th { overflow-wrap: anywhere; }
.catalog-table tbody td { font-variant-numeric: tabular-nums; }
.catalog-table tbody a { text-underline-offset: .13em; }
.catalog-origin, .catalog-value-note { display: block; margin-top: .12rem; font-weight: 400; }
.catalog-selected { display: block; margin-top: .18rem; color: var(--accent-dark); font-size: .75rem; }
.catalog-estimate { color: var(--accent-dark); font-weight: 650; }
.catalog-availability { color: var(--muted); }
.catalog-available { color: #315742; font-weight: 680; }
.catalog-mobile-label { display: none; }

.catalog-autofill { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .65rem; }
.catalog-autofill .button { min-height: 2.42rem; }
.catalog-form-feedback { margin: -.32rem 0 0; padding: .56rem .68rem; border-radius: .48rem; background: #f5eee6; }
.catalog-sourced-field { min-width: 0; }
.catalog-source-note { display: block; margin-top: .24rem; color: var(--muted); font-size: .75rem; line-height: 1.35; }
.catalog-source-note[data-catalog-source="price"] { color: var(--accent-dark); }
.catalog-format-note { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; margin-top: -.35rem; }
#editor-fields .catalog-check { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; }
.catalog-check input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent-dark); }
.catalog-image-input { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .65rem; }
.catalog-image-input small { display: block; margin-top: .2rem; }
.catalog-image-preview .catalog-photo { width: 4.05rem; height: 4.05rem; }
.catalog-extra { padding: .62rem; border: 1px solid var(--line); border-radius: .55rem; }
.catalog-extra summary { cursor: pointer; font-size: .82rem; font-weight: 680; }
.catalog-extra > :not(summary) { margin-top: .55rem; }

@container (max-width: 40rem) {
  .catalog-search { flex: 1 0 min(100%, 14rem); }
  .catalog-groups { grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); }
  .catalog-groups button { grid-template-columns: 2.65rem minmax(0, 1fr); gap: .4rem; padding: .38rem; }
  .catalog-groups .catalog-photo { width: 2.65rem; height: 2.65rem; }
  .catalog-table, .catalog-table tbody { display: block; }
  .catalog-table tbody { padding: .65rem .7rem; }
  .catalog-table thead { display: block; padding: .55rem .7rem 0; }
  .catalog-table thead tr { display: flex; flex-wrap: wrap; gap: .25rem; }
  .catalog-table thead th, .catalog-table thead th:first-child { padding: 0; border-radius: .35rem; }
  .catalog-table thead th:last-child { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .catalog-sort { min-height: 1.9rem; padding: .2rem .38rem; }
  .catalog-table tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: .65rem .7rem; gap: .45rem .65rem; border: 1px solid var(--line);
    border-radius: .62rem; background: #fcf5ed;
  }
  .catalog-table tbody tr + tr { margin-top: .55rem; }
  .catalog-table tbody :is(th, td), .catalog-table tbody :is(th, td):is(:first-child, :last-child) { padding: 0; border: 0; }
  .catalog-table tbody th { grid-column: 1 / -1; }
  .catalog-mobile-label { display: block; color: var(--muted); font-size: .72rem; }
}

.editor {
  padding: 0; width: min(49rem, 96vw); max-width: none; max-height: 94dvh;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: .95rem;
  box-shadow: 0 24px 70px #27171155;
}
.editor::backdrop { background: #2217118b; }
.store-picker[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; max-height: min(90dvh, 43rem); overflow: hidden; }
.store-picker::backdrop { background: #22171159; }
.store-picker-hint { margin: .65rem 1rem; line-height: 1.4; }
.store-picker-results { margin: 0; padding: .16rem 1rem .75rem; display: grid; align-content: start; gap: .45rem; overflow-y: auto; list-style: none; scrollbar-gutter: stable; }
.store-picker-option {
  width: 100%; padding: .63rem .68rem; border: 1px solid var(--line); border-radius: .58rem;
  background: #fffefd; color: var(--ink); text-align: left; display: grid; align-items: start;
  grid-template-columns: minmax(0, 1fr) auto; gap: .32rem .55rem;
}
.store-picker-option:hover { border-color: var(--accent); background: #fbf4ea; }
.store-picker-name { display: grid; gap: .18rem; min-width: 0; overflow-wrap: anywhere; }
.store-picker-name strong { font-size: .88rem; }
.store-picker-name small, .store-picker-distance { color: var(--muted); font-size: .75rem; }
.store-picker-distance { text-align: right; font-variant-numeric: tabular-nums; }
.store-picker-services { display: flex; flex-wrap: wrap; gap: .24rem; grid-column: 1 / -1; }
.store-service-badge { padding: .14rem .4rem; border-radius: .8rem; background: #f1eae2; color: var(--muted); font-size: .7rem; }
.store-service-badge.is-available { background: #e1ece4; color: #2d523d; }
.store-service-badge.is-unavailable { background: #f0e7e2; color: #654a40; }
.dialog-header { padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: .7rem; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 1.3rem; letter-spacing: -.045em; }
#editor-form { padding: 0; }
#editor-fields { display: grid; gap: .8rem; padding: 1rem; }
.dialog-footer { padding: .8rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.dialog-footer .button-danger { margin-right: auto; }
input, select, textarea {
  width: 100%; display: block; padding: .52rem .63rem; min-height: 2.42rem;
  color: var(--ink); border: 1px solid #d3c5b8; background: #fffefd; border-radius: .5rem; font-size: .91rem;
}
input::placeholder, textarea::placeholder { color: #786c63; }
textarea { resize: vertical; }
#editor-fields label, .auth-form label { display: grid; gap: .28rem; font-size: .82rem; font-weight: 680; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.meal-editor-fields { display: grid; gap: .65rem; margin: 0; min-width: 0; padding: 0; border: 0; }
.meal-recipe-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.meal-editor-fields button { justify-self: start; }
.form-error { color: #7a241d; font-size: .86rem; margin: .55rem 1rem; }
.form-error ul { margin: .2rem 0; padding-left: 1.2rem; }
.ingredients-heading {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: .6rem; margin-bottom: -.45rem;
}
.ingredients-heading h3 { font-size: 1rem; }
.recipe-add-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.field-help { color: var(--muted); font-size: .77rem; }
.field-help ul { padding-left: 1.1rem; margin: .28rem 0 0; }
#ingredients-list { display: grid; gap: .5rem; min-width: 0; }
.recipe-ingredient {
  padding: .45rem; border: 1px solid var(--line); border-radius: .65rem;
  background: #f9f3ed; min-width: 0;
}
.ingredient-row-actions {
  display: flex; justify-content: space-between; align-items: center; gap: .35rem; margin-bottom: .3rem;
}
.ingredient-row-actions .button { min-height: 1.8rem; padding: .25rem .35rem; font-size: .75rem; }
.ingredient-row, .ingredient-catalog-fields { display: grid; align-items: end; gap: .4rem; }
.ingredient-row {
  grid-template-columns: minmax(7rem, 1.8fr) minmax(3.9rem,1fr) minmax(3.5rem,.8fr) repeat(4,minmax(3.5rem,.82fr));
}
.ingredient-catalog-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(4.8rem, .5fr); }
.ingredient-catalog-info { grid-column: 1 / -1; color: var(--muted); font-size: .75rem; }
.ingredient-catalog-info .button { min-height: 1.8rem; padding: .25rem .35rem; margin-left: .28rem; font-size: .75rem; }
.recipe-ingredient label { font-size: .75rem !important; line-height: 1.2; }
.recipe-ingredient input, .recipe-ingredient select { font-size: .8rem; min-height: 2rem; padding: .28rem .35rem; }
.ingredient-remove { font-size: 1rem; min-width: 1.7rem; width: 1.7rem; min-height: 2rem; }
.recipe-preview { display: block; background: var(--accent-light); color: var(--accent-dark); border-radius: .58rem; padding: .55rem .65rem; font-size: .8rem; font-weight: 680; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: max(2rem, 4vw); }
.auth-shell {
  width: min(67rem, 100%); display: grid; grid-template-columns: minmax(19rem, .89fr) minmax(0, 1.1fr);
  overflow: hidden; border-radius: 1.42rem; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -34px #57352791;
}
.auth-panel { align-self: center; padding: clamp(1.7rem, 5vw, 4.4rem); display: grid; justify-items: start; gap: .72rem; }
.auth-logo { display: block; width: 10.8rem; height: auto; margin: 0 0 1rem -.45rem; }
.auth-panel h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); font-weight: 760; line-height: 1; letter-spacing: -.085em; }
.auth-panel > p { color: var(--muted); }
.auth-form { display: grid; gap: .9rem; width: 100%; margin-top: .5rem; }
.auth-form label { margin-bottom: .27rem; }
.auth-form .button-primary { margin-top: .35rem; min-height: 2.65rem; }
.auth-form .form-error { margin: .2rem 0; }
.auth-art { min-height: 30rem; max-height: 48rem; background: #e1a586; }
.auth-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

@media (max-width: 1180px) {
  .app-body { grid-template-columns: 10.7rem minmax(0, 1fr); }
  .workspace { padding: 1.55rem; }
}
@media (max-width: 790px) {
  .app-body { display: block; }
  .sidebar {
    position: relative; display: grid; align-items: center; grid-template-columns: auto minmax(0,1fr);
    height: auto; padding: .67rem .85rem .48rem; gap: .5rem; border: 0; border-bottom: 1px solid var(--line);
  }
  .brand { grid-area: 1 / 1; width: 7.4rem; margin: 0; }
  .navigation {
    grid-column: 1 / -1; display: flex; gap: .26rem; overflow-x: auto;
    scrollbar-width: thin; padding: .25rem .08rem;
  }
  .navigation button { width: auto; min-height: 2.3rem; padding: .34rem .55rem; gap: .38rem; font-size: .76rem; white-space: nowrap; }
  .nav-icon { width: .8rem; height: .76rem; flex-basis: .8rem; }
  .sidebar-bottom { grid-area: 1 / 2; justify-self: end; display: flex; align-items: center; margin: 0; gap: .1rem; }
  .profile-button, .logout-button { font-size: .71rem; min-height: 2rem; }
  .profile-button small { display: none; }
  .avatar { flex-basis: 1.3rem; height: 1.3rem; }
  .workspace { padding: 1rem; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .48rem; }
  .metric { padding: .68rem .7rem; }
  .filters { align-items: stretch; flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .auth-body { padding: 1rem; }
  .auth-shell { grid-template-columns: minmax(0, 1fr); max-width: 28rem; }
  .auth-panel { padding: 1.7rem clamp(1rem, 6vw, 2rem); }
  .auth-art { min-height: 0; max-height: 9rem; }
}
@media (max-width: 630px) {
  .ingredient-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ingredient-row label:first-child { grid-column: span 2; }
  .ingredient-catalog-fields { grid-template-columns: minmax(0, 1fr) minmax(5.2rem, .6fr); }
  .ingredient-catalog-fields label:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
}
@media (max-width: 485px) {
  .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: .85rem; }
  .page-heading h1 { font-size: 2.3rem; }
  .page-heading p { font-size: .82rem; }
  .section-bar { align-items: flex-start; padding: .68rem .75rem; }
  .week-control { flex-wrap: wrap; gap: .24rem; }
  .week-control span { min-width: 6.8rem; font-size: .74rem; }
  .week-control .icon-button { min-width: 1.95rem; width: 1.95rem; min-height: 1.95rem; }
  .agenda { padding-inline: .45rem; }
  .brand { width: 6.6rem; }
  .profile-button { gap: .25rem; }
  .profile-button, .logout-button { padding-inline: .3rem; }
  .form-grid { gap: .44rem; }
  .dialog-footer { padding-inline: .58rem; }
  .catalog-autofill { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .catalog-autofill .button { justify-self: start; }
}
