/* Food, recipes and anniversary pages. Deliberately scoped away from home/dialogs. */
:is(#food, #recipes, #daycards) {
  --life-ink: #16334d;
  --life-muted: #657b91;
  --life-line: #dfeaf5;
  --life-blue: #1877f2;
  --life-shadow: 0 3px 14px rgb(31 77 117 / 4%);
}
:is(#food, #recipes, #daycards) :is(button, a, input, textarea, select):focus-visible {
  outline: 3px solid #7db6ff;
  outline-offset: 3px;
}
:is(#food, #recipes, #daycards) :is(button, .secondary-button, .primary-button) {
  min-height: 44px;
  height: auto;
  white-space: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
:is(#food, #recipes, #daycards) :is(.section-intro, .panel-heading) { gap: 16px; flex-wrap: wrap; }
:is(#food, #recipes, #daycards) :is(.section-intro h1, .day-cards-hero h1) {
  color: var(--life-ink); font-family: inherit; font-size: 28px; line-height: 1.35; letter-spacing: 0;
}
:is(#food, #recipes) .panel { border: 1px solid var(--life-line); border-radius: 12px; background: #fff; box-shadow: var(--life-shadow); }
:is(#food, #recipes) .panel h2 { margin: 0; color: var(--life-ink); font-size: 19px; }
:is(#food, #recipes, #daycards) .primary-button { background: var(--life-blue); color: #fff; border-radius: 8px; padding: 10px 18px; }
:is(#food, #recipes, #daycards) .secondary-button { border-color: #d3e3f6; background: #fff; color: #286bb5; border-radius: 8px; padding: 9px 13px; }

/* The page grid keeps all four meals above the two original record panels. */
#food.active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
#food > :is(.section-intro, .helper, .meal-grid) { grid-column: 1 / -1; }
#food .section-intro { margin-bottom: 0; }
#food > .helper { margin: -8px 0 0; }
#food .date-control { display: flex; align-items: center; gap: 10px; color: var(--life-muted); font-size: 13px; max-width: 100%; }
#food #foodDate { min-height: 44px; min-width: 0; max-width: 100%; background: #fff; border: 1px solid #d4e3f4; border-radius: 8px; padding: 8px 12px; color: var(--life-ink); }
#food .meal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#food .meal-card { min-width: 0; min-height: 212px; padding: 20px; border: 1px solid var(--life-line); border-radius: 12px; background: #fff; box-shadow: var(--life-shadow); display: flex; flex-direction: column; overflow: visible; }
#food .meal-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
#food .meal-card h2 { margin: 0; color: var(--life-ink); font-size: 20px; line-height: 1.4; }
#food .meal-recorded-status { font-size: 12px; font-weight: 600; color: #17804c; padding: 5px 9px; border-radius: 8px; background: #e8f7ef; }
#food .meal-card[data-recorded="false"] .meal-recorded-status { color: #6c8094; background: #f0f4f8; }
#food .meal-body { display: flex; align-items: flex-start; gap: 16px; flex: 1; min-width: 0; }
#food .meal-thumb { display: block; flex: 0 0 138px; width: 138px; max-width: 40%; border-radius: 8px; overflow: hidden; }
#food .meal-thumb img { display: block; width: 100%; height: 112px; object-fit: cover; }
#food .meal-copy { flex: 1; min-width: 0; }
#food .meal-copy p, #food .meal-card > p { margin: 7px 0 12px; color: #3e5770; line-height: 1.75; overflow-wrap: anywhere; }
#food .meal-copy .meal-status, #food .meal-status { color: var(--life-muted); font-size: 12px; line-height: 1.6; }
#food .meal-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
#food .meal-actions > * { flex: 1 1 112px; width: auto; max-width: 100%; display: inline-flex; justify-content: center; align-items: center; text-align: center; text-decoration: none; font-size: 13px; }
#food .meal-card[data-recorded="false"] .meal-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 12px; text-align: center; color: #8093aa; }
#food .meal-empty :is(svg, img) { width: 40px; height: 40px; opacity: .7; }
#food .meal-card[data-recorded="false"] .meal-actions { justify-content: center; margin-top: 6px; }
#food .meal-card[data-recorded="false"] .meal-actions > * { flex: 0 1 auto; min-width: 128px; }
#food > .panel { width: auto; min-width: 0; margin: 0; padding: 20px; align-self: stretch; }
#food .body-panel h2 { margin-bottom: 18px; }
#food .body-panel label { display: grid; gap: 7px; min-width: 0; color: #57718b; font-size: 13px; }
#food .body-panel .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
#food .body-panel :is(input, textarea) { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; background: #fff; border: 1px solid #d6e3f1; border-radius: 8px; color: var(--life-ink); padding: 10px 12px; min-height: 44px; }
#food #foodNote { min-height: 94px; resize: vertical; }
#food #saveFoodMeta { margin-top: 14px; }
#food #foodHistory { margin-top: 14px; }
#food #foodHistory .compact-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #edf2f8; }
#food #foodHistory .compact-row > div { min-width: 0; overflow-wrap: anywhere; }
#food #foodHistory strong { font-size: 13px; color: #3b5772; }
#food #foodHistory small { display: block; margin-top: 3px; color: var(--life-muted); font-size: 12px; line-height: 1.6; }
#food #foodHistory button { flex-shrink: 0; padding: 8px 10px; }

/* Preserve whole original posters, all source text and failure/recovery actions. */
#recipes .recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
#recipes .recipe-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--life-line); border-radius: 12px; background: #fff; box-shadow: var(--life-shadow); overflow: hidden; }
#recipes .recipe-cover { height: 240px; min-height: 240px; max-height: none; aspect-ratio: auto; margin: 16px 16px 0; border-radius: 8px; background: #f6f8fb; overflow: hidden; }
#recipes .recipe-cover img { width: 100%; height: 100%; display: block; object-fit: contain; object-position: center; }
#recipes .recipe-cover-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #f0f6fd; color: #668bae; padding: 20px; text-align: center; }
#recipes .recipe-cover-empty span { font-size: 40px; font-weight: 500; }
#recipes .recipe-cover-empty small { color: #65809c; line-height: 1.6; overflow-wrap: anywhere; }
#recipes .recipe-card-body { flex: 1; min-width: 0; padding: 16px; }
#recipes .recipe-title-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 9px; }
#recipes .recipe-card h3 { flex: 1 1 150px; margin: 0; color: var(--life-ink); font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; }
#recipes .recipe-serving-chip { max-width: 100%; border-radius: 7px; padding: 5px 8px; font-size: 12px; line-height: 1.5; white-space: normal; background: #edf5ff; color: #4378b2; overflow-wrap: anywhere; }
#recipes .recipe-serving-chip.is-unknown { background: #f0f3f7; color: #63758b; }
#recipes .recipe-card-body :is(p, small) { overflow-wrap: anywhere; white-space: normal; }
#recipes .recipe-ingredients-summary { display: block; overflow: visible; -webkit-line-clamp: unset; white-space: pre-line; }
#recipes .recipe-card-body p { font-size: 13px; line-height: 1.75; color: #5b728b; margin: 12px 0 0; }
#recipes :is(.recipe-serving-note, .recipe-content-note) { display: block; margin-top: 9px; color: #76899d; line-height: 1.65; font-size: 12px; }
#recipes .recipe-generation-message.is-error { color: #a33f3f; background: #fff1f1; border-radius: 7px; padding: 9px 10px; }
#recipes .recipe-generation-message.is-busy { color: #286ba8; }
#recipes .recipe-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
#recipes .recipe-card-actions > * { flex: 1 1 calc(50% - 8px); min-width: 0; max-width: 100%; padding: 9px 10px; text-align: center; font-size: 13px; }
#recipes .recipe-card-actions .danger-action { border: 1px solid #ecdfe1; background: #fff; color: #a45252; border-radius: 8px; }
#recipes .shopping { margin-top: 20px; padding: 20px; }
#recipes .shopping-recipe-choices { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 16px 0; border-bottom: 1px solid #e7eef7; }
#recipes .shopping-choice { display: flex; align-items: center; gap: 9px; min-height: 44px; min-width: 0; max-width: 100%; font-size: 13px; color: #45607d; }
#recipes .shopping-choice strong { overflow-wrap: anywhere; }
#recipes :is(.shopping-choice, .shopping-item) input { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; accent-color: var(--life-blue); }
#recipes .shopping-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
#recipes .shopping-item { display: flex; gap: 12px; align-items: center; min-width: 0; min-height: 58px; padding: 12px 0; border-bottom: 1px solid #edf2f8; }
#recipes .shopping-item > span { min-width: 0; }
#recipes .shopping-item strong { display: block; font-size: 14px; color: #365573; overflow-wrap: anywhere; }
#recipes .shopping-item small { display: block; font-size: 12px; color: #778ca1; line-height: 1.6; overflow-wrap: anywhere; margin-top: 3px; }
#recipes .shopping-item.is-purchased strong { text-decoration: line-through; color: #8797a7; }
#recipes .shopping-list > .empty, #recipes .recipe-grid > .empty { grid-column: 1 / -1; }

/* Compact live header and soft card colors; DayCardDates owns all calculations. */
#daycards { --dc-blue: #3279b7; --dc-amber: #a87834; --dc-rose: #af5368; --dc-sage: #377f68; }
#daycards .day-cards-hero { display: block; min-height: 0; margin-bottom: 24px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
#daycards .day-cards-hero__art { display: none; }
#daycards .day-cards-hero__copy { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0; flex-wrap: wrap; }
#daycards .day-cards-hero__copy > p { display: none; }
#daycards .day-cards-hero__copy h1 { margin: 0; max-width: none; text-wrap: wrap; }
#daycards .day-cards-hero__copy > div { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#daycards .day-cards-hero__copy small { display: block; font-size: 12px; line-height: 1.65; color: var(--life-muted); }
#daycards .day-cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
#daycards .day-card { padding: 22px; min-width: 0; background: var(--wash); border: 1px solid color-mix(in srgb, var(--card) 12%, #fff); border-radius: 12px; box-shadow: var(--life-shadow); overflow: visible; }
#daycards .day-card--blue { --wash: #eaf5ff; }
#daycards .day-card--amber { --wash: #fff7e8; }
#daycards .day-card--rose { --wash: #fff0f3; }
#daycards .day-card--sage { --wash: #ecf8f2; }
#daycards .day-card::after { content: none; }
#daycards .day-card__head { gap: 10px; align-items: center; flex-wrap: wrap; }
#daycards .day-card__head h3 { color: var(--life-ink); font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
#daycards .day-card__labels { justify-content: flex-start; }
#daycards .day-card__labels > span { max-width: 100%; padding: 5px 10px; font-size: 12px; }
#daycards .day-card__count { margin-top: 24px; align-items: baseline; gap: 8px; color: var(--life-ink); flex-wrap: wrap; }
#daycards .day-card__count strong { font-family: inherit; font-size: 42px; line-height: 1.15; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 100%; }
#daycards .day-card__count span { font-size: 16px; padding: 0; }
#daycards .day-card__relation { margin: 8px 0 16px; font-size: 14px; color: #4d6c87; line-height: 1.6; }
#daycards :is(.day-card__photos, .day-card__thumbnails) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
#daycards button.day-card__photos { width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; border-radius: 7px; cursor: pointer; }
#daycards :is(.day-card__photos, .day-card__thumbnails) :is(button, a) { min-width: 0; padding: 0; border: 0; background: transparent; border-radius: 7px; }
#daycards :is(.day-card__photos, .day-card__thumbnails) img { display: block; width: 100%; height: 74px; object-fit: cover; border-radius: 7px; }
#daycards .day-card__foot { align-items: flex-start; flex-direction: column; border-top: 0; padding-top: 0; gap: 16px; }
#daycards .day-card__foot time { color: #64829e; font-size: 13px; line-height: 1.6; }
#daycards .day-card__actions { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
#daycards .day-card__actions button { flex: 1 1 64px; min-width: 0; padding: 8px 10px; border: 1px solid #d7e4ee; border-radius: 8px; color: #476b8d; background: #ffffffd9; font-size: 13px; }
#daycards .day-card__actions [data-day-card-photos] { flex: 1.6 1 100px; color: #2274c4; border-color: #9bcaff; }
#daycards .day-cards-empty { color: var(--life-muted); background: #fff; border-color: #ccddef; padding: 24px; line-height: 1.8; }
#daycards .day-cards-empty strong { font-family: inherit; color: var(--life-ink); }

@media (max-width: 1180px) {
  #recipes .recipe-grid, #daycards .day-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #food .meal-thumb { flex-basis: 104px; width: 104px; }
  #food .meal-thumb img { height: 104px; }
}
@media (max-width: 700px) {
  #food.active { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #food .meal-grid, #recipes .recipe-grid, #recipes .shopping-list, #daycards .day-cards-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  :is(#food, #recipes, #daycards) .section-intro h1, #daycards .day-cards-hero h1 { font-size: 25px; }
  #food .meal-card { min-height: 210px; padding: 18px; }
  #food .meal-thumb { flex-basis: 96px; width: 96px; }
  #food .meal-body { gap: 12px; }
  #food > .panel, #recipes .shopping { padding: 18px; }
  #recipes .recipe-cover { height: 240px; min-height: 240px; }
  #recipes .shopping-list { gap: 0; }
  #daycards .day-cards-hero__copy { align-items: flex-start; }
  #daycards .day-cards-hero__copy > div { width: 100%; align-items: flex-start; flex-direction: column; }
  #daycards .day-card { padding: 20px; }
}
@media (max-width: 360px) {
  #food .meal-card { padding: 16px; }
  #food .meal-thumb { flex-basis: 82px; width: 82px; }
  #food .meal-thumb img { height: 90px; }
  #food .body-panel .form-row { grid-template-columns: minmax(0, 1fr); }
  #recipes .recipe-card-actions > * { flex-basis: 100%; }
  #daycards .day-card { padding: 17px; }
  #daycards .day-card__count strong { font-size: 38px; }
}
