.meals-page { width: min(100%, 66rem); margin-inline: auto; }
.meals-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-block-end: 1rem;
}
.meals-nav a {
  display: flex;
  align-items: center;
  min-height: 2.85rem;
  padding-inline: 1rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--white);
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
}
.meals-nav a:hover { border-color: #80a686; }
.meals-nav a[aria-current] { border-color: var(--green); background: var(--green); color: var(--white); }
.meal-today, .meal-week, .meal-library {
  padding: clamp(.8rem, 2.7vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 1.18rem;
  background: var(--white);
  box-shadow: var(--shadow);
}
.meal-today { background: #edf4eb; border-color: #dce8da; }
.meal-week { margin-block-start: 1.15rem; }
.meal-section-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  margin-block-end: .9rem;
}
.meal-section-top h2 { font-size: clamp(1.24rem, 2.2vw, 1.64rem); line-height: 1.25; }
.meal-section-top time { display: block; margin-block-start: .2rem; color: var(--muted); font-weight: 600; }
.meal-title-button, .meal-day-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  text-align: start;
}
.meal-title-button, .meal-day-link > span:first-child { display: flex; align-items: center; gap: .3rem; }
.meal-title-button .icon, .meal-day-link .icon { width: .97rem; height: .97rem; }
.meal-title-button { min-height: 2.75rem; }
.meal-title-button:hover:not(:disabled), .meal-day-link:hover:not(:disabled) > span:first-child {
  text-decoration: underline;
  text-underline-offset: .18em;
}
.meal-day-link { width: 100%; min-height: 2.75rem; }
.meal-day-link:disabled { color: var(--muted); }
.meal-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 2.75rem;
  padding-inline: .7rem;
  border: 1px solid #c7dbc8;
  border-radius: .66rem;
  background: var(--white);
  color: var(--green-dark);
  font-weight: 600;
  white-space: nowrap;
}
.meal-secondary:hover:not(:disabled) { background: var(--sage); }
.meal-secondary:disabled { opacity: .55; }
.meal-secondary .icon { width: 1.02rem; height: 1.02rem; }
.meal-load-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-block-end: .85rem;
  padding: .55rem .7rem;
  border: 1px solid #edd0c9;
  border-radius: .7rem;
  background: #fbefeb;
  color: #87342b;
}
.meal-today-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.meal-today-period {
  min-width: 0;
  padding: .8rem;
  border: 1px solid #dce6d9;
  border-radius: .85rem;
  background: var(--white);
}
.meal-today-period.is-current { border-color: #6b9f79; }
.meal-period-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; }
.meal-period-heading h3 { font-size: 1.17rem; line-height: 1.28; }
.meal-current, .meal-week-today {
  width: fit-content;
  padding: .16rem .5rem;
  border-radius: 2rem;
  background: #deedde;
  color: var(--green-dark);
  font-size: .82rem;
  font-weight: 600;
}
.meal-period-empty { padding-block: .48rem .12rem; color: var(--muted); font-size: .94rem; }
.meal-planned-dishes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
  gap: .42rem;
  margin: .58rem 0 0;
  padding: 0;
  list-style: none;
}
.meal-planned-dishes li { min-width: 0; }
.meal-planned-dish {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 3.5rem;
  min-width: 0;
  gap: .4rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: .57rem;
  background: var(--surface);
  font-weight: 600;
  line-height: 1.24;
  overflow-wrap: anywhere;
  text-align: start;
}
.meal-planned-dish:hover { border-color: #9bbda0; background: var(--sage); }
.meal-planned-dish > .icon { width: .8rem; height: .8rem; color: var(--green); }
.meal-planned-dishes img {
  flex: 0 0 auto;
  width: 3.65rem;
  height: 2.8rem;
  object-fit: contain;
  border-radius: .38rem;
  background: var(--white);
}
.meal-week-picker { min-width: min(100%, 16.5rem); grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; }
.meal-week-picker .icon-button { width: 2.75rem; height: 2.75rem; }
.meal-return-week {
  min-height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: .89rem;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.meal-week-table { border: 1px solid var(--line); border-radius: .82rem; overflow: hidden; }
.meal-week-table table { width: 100%; border-spacing: 0; table-layout: fixed; text-align: start; }
.meal-week-table th, .meal-week-table td { padding: .42rem .55rem; text-align: start; }
.meal-week-table thead { background: #f2f5ef; }
.meal-week-table thead th:first-child { width: 26%; }
.meal-week-table tbody :is(th, td) { border-block-start: 1px solid var(--line); }
.meal-week-table tbody th { text-align: start; font-weight: 700; }
.meal-week-table th time { display: block; color: var(--muted); font-size: .83rem; font-weight: 400; }
.meal-day-current { background: #f8faf6; }
.meal-week-today { display: block; margin-block-start: .2rem; }
.meal-slot {
  display: grid;
  align-content: center;
  justify-items: start;
  width: 100%;
  min-height: 3.25rem;
  gap: .07rem;
  padding: .32rem .68rem;
  border: 1px dashed #d4ddd1;
  border-radius: .63rem;
  background: var(--white);
  color: var(--muted);
  font-size: .91rem;
  text-align: start;
}
.meal-slot.has-plan { border-style: solid; border-color: #c7ddc7; background: #edf5ec; color: var(--green-dark); }
.meal-slot:hover:not(:disabled) { border-color: #7ba987; background: #e8f2e7; color: var(--green-dark); }
.meal-slot:disabled { opacity: .65; }
.meal-slot-label { font-weight: 600; }
.meal-slot-count { font-size: .82rem; }
.meal-dialog { width: min(100% - 2rem, 59rem); max-width: none; }
.meal-picker-tools {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  margin-block-end: .65rem;
}
.meal-categories { display: flex; flex-wrap: wrap; gap: .36rem; }
.meal-categories .category-filter { min-height: 2.75rem; }
.meal-search { width: min(100%, 17rem); }
.meal-choices { min-height: 0; padding: .25rem .25rem .55rem; overflow: auto; overscroll-behavior: contain; }
.meal-photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .62rem; }
.meal-choice {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .32rem;
  padding: .34rem;
  border: 1px solid var(--line);
  border-radius: .73rem;
  background: var(--white);
  text-align: start;
}
.meal-choice:hover { border-color: #a6c4aa; }
.meal-choice[aria-pressed="true"] { border-color: #50815f; background: #edf5ec; box-shadow: inset 0 0 0 1px #50815f; }
.meal-choice-photo {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1.49;
  border-radius: .48rem;
  background: var(--surface);
}
.meal-choice-photo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.meal-dish-check {
  display: grid;
  position: absolute;
  inset: .27rem .27rem auto auto;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #c0d1c0;
  background: rgb(255 255 255 / 93%);
  color: transparent;
}
.meal-choice[aria-pressed="true"] .meal-dish-check { border-color: var(--green); background: var(--green); color: var(--white); }
.meal-dish-check .icon { width: .94rem; height: .94rem; }
.meal-choice-name { padding: .1rem .15rem .22rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.meal-sides-title { margin-block: .92rem .55rem; font-size: 1.05rem; }
.meal-no-dishes { padding: 1rem .45rem; color: var(--muted); }
.meal-dialog-footer {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding-block-start: .65rem;
  border-block-start: 1px solid var(--line);
}
.meal-dialog-footer > p { color: var(--muted); font-weight: 600; font-size: .88rem; }
.meal-dialog-footer .editor-actions { margin: 0; }
.meal-dialog-footer .editor-actions button { white-space: nowrap; }
.meal-form .editor-error { margin-block: .34rem; }
.meal-library-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: start;
  min-width: 0;
  gap: .44rem;
  padding: .44rem;
  border: 1px solid var(--line);
  border-radius: .74rem;
  background: var(--white);
}
.meal-library-card:hover { border-color: #9bbda0; }
.meal-library-dish {
  display: grid;
  gap: .42rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  overflow-wrap: anywhere;
}
.meal-library-dish strong { padding-inline: .2rem; }
.meal-library-card .edit-product { z-index: 1; }
.meal-library-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .85rem;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.recipe-link { width: fit-content; max-width: 100%; text-decoration: none; white-space: normal; }
.meal-library-card .recipe-link { margin-block-start: auto; font-size: .85rem; }
.meal-details-body { overflow: auto; min-height: 0; padding: .16rem .24rem .45rem; overscroll-behavior: contain; }
.meal-detail-period + .meal-detail-period { margin-block-start: 1.15rem; padding-block-start: 1rem; border-block-start: 1px solid var(--line); }
.meal-detail-period-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem; margin-block-end: .62rem; }
.meal-detail-period-top h3 { font-size: 1.3rem; }
.meal-dish-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: .82rem;
}
.meal-dish-detail + .meal-dish-detail { margin-block-start: .65rem; }
.meal-detail-photo { display: grid; place-items: center; min-width: 0; border-radius: .65rem; background: var(--surface); overflow: hidden; }
.meal-detail-photo img { display: block; width: 100%; height: clamp(13rem, 31vw, 23rem); object-fit: contain; }
.meal-detail-copy { display: grid; justify-items: start; gap: .65rem; min-width: 0; padding: .12rem; overflow-wrap: anywhere; }
.meal-detail-copy h4 { font-size: 1.35rem; line-height: 1.2; }
.meal-recipe-text { min-width: 0; }
.meal-recipe-text p { margin-block-start: .18rem; white-space: pre-wrap; }
.dish-editor { width: min(100% - 2rem, 36rem); max-width: none; }
.dish-editor-fields { margin: 0; border: 0; min-width: 0; }
.dish-editor .editor-error { margin-block-start: .42rem; }
.dish-editor-fields textarea {
  width: 100%;
  min-height: 4.75rem;
  padding: .45rem .65rem;
  border: 1px solid #cfdcd1;
  border-radius: .62rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  resize: vertical;
}
.dish-image-preview { width: min(100%, 12rem); max-height: 8rem; object-fit: contain; border-radius: .55rem; background: var(--surface); }
@media (max-width: 740px) {
  .meal-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .meal-today-grid { grid-template-columns: 1fr; }
  .meal-secondary { font-size: .89rem; }
  .meal-week-picker { min-width: min(100%, 14rem); }
  .meal-week-table th, .meal-week-table td { padding-inline: .25rem; }
  .meal-week-table tbody th { padding-inline-start: .42rem; font-size: .9rem; }
  .meal-slot { padding-inline: .37rem; font-size: .85rem; }
  .meal-dialog { width: 100%; }
  .dish-editor { width: 100%; }
  .meal-dish-detail { grid-template-columns: 1fr; gap: .6rem; padding: .53rem; }
  .meal-detail-photo img { height: clamp(12rem, 65vw, 18rem); }
  .meal-day-link .icon { width: .76rem; height: .76rem; }
  .meal-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meal-categories { gap: .26rem; }
  .meal-categories .category-filter { padding-inline: .56rem; }
  .meal-search { width: 100%; }
}
