/* Shared family meals, using Lifeqora's existing lilac, warm coral and sage palette. */
.meal-tabs { margin-bottom: 28px; }
.meal-week-bar, .meal-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.meal-week-bar h2 { font-size: 1.875rem; margin: 5px 0 8px; letter-spacing: -.6px; }
.meal-week-bar h2 span { color: var(--muted, var(--k-fg-81788b)); font-weight: 450; }
.meal-week-bar p, .meal-section-heading p { color: var(--muted, var(--k-fg-81788b)); margin: 0; line-height: 1.5; }
.meal-week-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.meal-today-label { background: var(--k-bg-eae1f1); color: var(--k-fg-72568a); border-radius: 20px; padding: 3px 8px; font-size: 0.7188rem; }
.meal-meta { font-size: 0.8125rem; line-height: 1.65; color: var(--k-fg-81788b); }
.meal-note { white-space: pre-line; overflow-wrap: anywhere; font-size: 0.9375rem; line-height: 1.7; color: var(--k-fg-6e647b); }
.meal-calendar-note { margin-top: 22px; }
.meal-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.meal-recipe-card { display: flex; flex-direction: column; min-width: 0; }
.meal-recipe-card h3 { margin: 8px 0; font-size: 1.438rem; letter-spacing: -.45px; overflow-wrap: anywhere; }
.meal-recipe-card .eyebrow { font-size: 0.7188rem; }
.meal-card-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 22px; }
.meal-card-actions .button { font-size: 0.8125rem; padding: 11px 14px; min-height: 42px; }
.meal-card-actions .text-button { min-height: 44px; }
.meal-section-heading h2 { margin: 0 0 8px; letter-spacing: -.5px; }
.meal-empty { grid-column: 1 / -1; padding: 38px; text-align: center; }
.meal-empty p { color: var(--k-fg-81788b); line-height: 1.7; }
.meal-search { max-width: 460px; margin: 0 0 24px; }
.meal-search input { width: 100%; }
.meal-autocomplete { position: relative; }
.meal-autocomplete .field { margin-bottom: 0; }
.meal-autocomplete > .budget-help { margin: 5px 0 14px; min-height: 16px; }
.meal-dish-options { position: absolute; z-index: 20; top: 78px; left: 0; right: 0; padding: 6px; background: var(--k-bg-ffffff); border: 1px solid var(--k-border-e5ddec); border-radius: 16px; box-shadow: 0 15px 40px var(--k-shadow-352b4726); max-height: 260px; overflow-y: auto; }
.meal-dish-options button { width: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; background: transparent; border: 0; padding: 12px; border-radius: 10px; color: var(--k-fg-35303f); min-height: 44px; }
.meal-dish-options button:hover, .meal-dish-options button[aria-selected=true] { background: var(--k-bg-f1ebf7); }
.meal-dish-options small { color: var(--k-fg-81788b); line-height: 1.45; }
.meal-dashboard-list { margin-top: 8px; }
.meal-dashboard-row { display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--k-border-eee8f3); padding: 17px 0; }
.meal-dashboard-row > span { font-size: 0.8125rem; color: var(--k-fg-81788b); width: 60px; flex-shrink: 0; }
.meal-dashboard-row > div { flex: 1; min-width: 0; }
.meal-dashboard-row strong { display: block; font-size: 1rem; overflow-wrap: anywhere; }
.meal-dashboard-row small { display: block; font-size: 0.75rem; color: var(--k-fg-81788b); line-height: 1.6; margin-top: 4px; }
.meal-dashboard-row > button { flex-shrink: 0; min-height: 40px; font-size: 0.8125rem; }
.dashboard-kind-meals { background: var(--k-bg-fbfaf6); }
.meal-recipe-card[hidden], .meal-dish-options[hidden], #meal-no-matches[hidden] { display: none; }

@media (max-width: 1050px) {
  .meal-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .meal-week-bar, .meal-section-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  .meal-week-controls { width: 100%; justify-content: space-between; }
  .meal-card-actions .button { flex: 1; }
  .meal-tabs { display: flex; width: 100%; gap: 3px; }
  .meal-tabs button { flex: 1; padding: 11px 8px; font-size: 0.8125rem; }
  .meal-dashboard-row { gap: 9px; }
  .meal-dashboard-row > span { width: 48px; font-size: 0.75rem; }
}

/* Meal details and dashboard links. */
.meal-dashboard-open:focus-visible { outline: 2px solid var(--k-fg-9474b0); outline-offset: 3px; }
.meal-dashboard-open { border: 0; padding: 0; background: none; color: var(--k-fg-685078); text-align: left; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; min-height: 34px; }
.meal-dashboard-open:hover { text-decoration: underline; }
.meal-read-view .meal-meta { font-size: 0.9375rem; }
.meal-read-view h3 { margin-top: 24px; font-size: 0.9375rem; }
/* Reusable ingredients and a shared, deliberately simple shopping list. */
.recipe-editor, .recipe-read, .recipe-empty { margin-top:24px; padding-top:20px; border-top:1px solid var(--k-border-e5ddec); }
.recipe-editor h3, .recipe-read h3 { margin:0 0 6px; }
.recipe-editor .meal-section-heading p, .recipe-read .meal-section-heading p { font-size:0.875rem; }
.recipe-edit-row { display:grid; grid-template-columns:minmax(0,2fr) minmax(85px,1fr) minmax(85px,1fr) auto; gap:10px; align-items:end; margin-bottom:14px; padding:14px; background:var(--k-bg-f6f3f9); border-radius:16px; }
.recipe-edit-row .field { margin:0; min-width:0; font-size:0.8125rem; }
.recipe-edit-row input, .recipe-edit-row select { width:100%; min-width:0; }
.recipe-edit-row .button { min-height:44px; }
.recipe-ingredient { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:16px 0; border-bottom:1px solid var(--k-border-eee8f3); }
.recipe-ingredient > div { display:flex; flex-direction:column; gap:5px; min-width:0; overflow-wrap:anywhere; }
.recipe-ingredient span { color:var(--k-fg-81788b); }
.recipe-ingredient .button { flex-shrink:0; }
.recipe-portions { max-width:180px; margin-top:20px; }
.shopping-hero { display:flex; justify-content:space-between; gap:30px; align-items:center; padding:32px; border:1px solid var(--k-border-dbd1e5); border-radius:24px; background:var(--k-bg-f0eaf6); margin-bottom:28px; }
.shopping-hero h2 { font-size:2rem; margin:6px 0 12px; letter-spacing:-.7px; }
.shopping-hero p { color:var(--k-fg-756580); line-height:1.6; margin:0; max-width:580px; }
.shopping-hero > div:last-child { display:flex; flex-direction:column; align-items:center; flex-shrink:0; gap:6px; }
.shopping-hero strong { font-size:2.5rem; line-height:1; color:var(--k-fg-72568a); }
.shopping-hero span { color:var(--k-fg-756580); font-size:0.8125rem; }
.shopping-list { display:grid; gap:12px; }
.shopping-item { display:flex; align-items:center; gap:18px; padding:20px 24px; background:var(--k-bg-ffffff); border:1px solid var(--k-border-e6e0eb); border-radius:20px; }
.shopping-check { display:grid; place-items:center; width:46px; height:46px; min-width:46px; border:1.5px solid var(--k-border-bcaec9); border-radius:50%; background:var(--k-bg-f8f5fb); font:inherit; color:var(--k-fg-397c64); cursor:pointer; }
.shopping-check span { width:18px; height:18px; border:1.5px solid var(--k-border-bcaec9); border-radius:5px; }
.shopping-check:hover { background:var(--k-bg-eae1f1); }
.shopping-item-copy { flex:1; min-width:0; overflow-wrap:anywhere; }
.shopping-item h3 { font-size:1.062rem; margin:0 0 6px; }
.shopping-item p { margin:0; color:var(--k-fg-756580); font-size:1rem; font-variant-numeric:tabular-nums; }
.shopping-item-actions { display:flex; gap:10px; }
.shopping-purchased { margin-top:34px; display:grid; gap:12px; }
.shopping-purchased .meal-section-heading { margin-bottom:4px; }
.shopping-item.is-purchased { background:var(--k-bg-edf6f0); border-color:var(--k-border-cfe4d8); }
.is-purchased h3, .is-purchased p { color:var(--k-fg-397c64); }
.is-purchased .shopping-check { border-color:var(--k-border-68a18d); background:var(--k-bg-daeddf); font-size:1.375rem; }
@media(max-width:680px) {
 .recipe-edit-row { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
 .recipe-edit-row .field:first-child { grid-column:1 / -1; }
 .recipe-edit-row > .button { grid-column:1 / -1; }
 .recipe-read .meal-section-heading { align-items:stretch; flex-direction:column; }
 .recipe-ingredient { flex-direction:column; align-items:stretch; gap:12px; }
 .recipe-ingredient > div { flex-direction:row; justify-content:space-between; gap:16px; }
 .shopping-hero { padding:24px; gap:16px; }
 .shopping-hero h2 { font-size:1.625rem; }
 .shopping-hero p { font-size:0.875rem; }
 .shopping-item { padding:18px; gap:12px; flex-wrap:wrap; }
 .shopping-item-actions { margin-left:58px; width:calc(100% - 58px); flex-wrap:wrap; }
 .shopping-item-actions .button { flex:1; min-height:44px; }
}

/* Keep meal forms inside the viewport, including Safari's native date fields. */
#dialog:has(#meal-ingredients-editor) {
  max-width: calc(100vw - 30px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
}
#dialog:has(#meal-ingredients-editor) #modal-form,
#dialog:has(#meal-ingredients-editor) #modal-fields,
#dialog:has(#meal-ingredients-editor) .field {
  min-width: 0;
  max-width: 100%;
}
#dialog:has(#meal-ingredients-editor) .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#dialog:has(#meal-ingredients-editor) input,
#dialog:has(#meal-ingredients-editor) select,
#dialog:has(#meal-ingredients-editor) textarea {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 580px) {
  #dialog:has(#meal-ingredients-editor) .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
  #dialog:has(#meal-ingredients-editor) .modal-heading > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body:has(#dialog[open] #meal-ingredients-editor) {
    overflow: hidden;
  }
}
#dialog:has(#meal-ingredients-editor) .modal-heading {
  align-items: flex-start;
  gap: 12px;
}
#dialog:has(#meal-ingredients-editor) .modal-heading > div {
  flex: 1;
  min-width: 0;
}
#dialog:has(#meal-ingredients-editor) .modal-heading > button {
  flex-shrink: 0;
}

.shopping-category { display:grid; gap:10px; margin-bottom:18px; min-width:0; }
.shopping-category > header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 4px; border-bottom:1px solid var(--k-border-e3dbe9); }
.shopping-category > header h3 { margin:0; font-size:1rem; color:var(--k-fg-65516f); }
.shopping-category > header > span { font-size:0.8125rem; color:var(--k-fg-8b7d94); white-space:nowrap; }
.shopping-category-hint { margin-top:0; }

/* Full-size meal actions and a date picker that stays inside small screens. */
#dialog:has(.meal-read-view) .modal-extra-actions { display:flex; flex-wrap:wrap; gap:10px; }
#dialog:has(.meal-swap) { max-width:calc(100vw - 30px); overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y pinch-zoom; }
body:has(#dialog[open] .meal-swap) { overflow:hidden; }
.meal-swap, .meal-swap .field { min-width:0; max-width:100%; }
.meal-swap input { min-width:0; width:100%; max-width:100%; }
@media(max-width:580px) {
  #dialog:has(.meal-read-view) .modal-extra-actions .button { flex-basis:100%; white-space:normal; }
}

.meal-period-setting { display:flex; align-items:center; flex-wrap:wrap; gap:14px; margin-bottom:24px; }
.meal-period-options { display:flex; gap:7px; }
.meal-plan-list { border:1px solid var(--k-border-e9e2ef); border-radius:22px; background:var(--k-bg-ffffff); overflow:hidden; }
.meal-list-row { display:grid; grid-template-columns:155px minmax(0,1fr) auto; align-items:center; gap:22px; padding:20px 24px; border-bottom:1px solid var(--k-border-eee8f3); }
.meal-list-row:last-child { border-bottom:0; }
.meal-list-row.is-today { background:var(--k-bg-f5f0fa); }
.meal-list-date { display:flex; align-items:flex-start; flex-direction:column; gap:5px; }
.meal-list-date strong, .meal-swap-choice>span:first-child strong { text-transform:capitalize; }
.meal-list-date span { font-size:0.8125rem; color:var(--k-fg-81788b); }
.meal-list-dish { display:flex; flex-direction:column; align-items:flex-start; gap:5px; text-align:left; border:0; background:transparent; padding:10px 0; min-width:0; min-height:48px; }
.meal-list-dish>strong { font-size:1.062rem; overflow-wrap:anywhere; }
.meal-list-dish:hover>strong { color:var(--k-fg-80639a); }
.meal-list-empty { color:var(--k-fg-9b91a4); font-size:0.875rem; }
.meal-swap-navigation { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:20px 0 12px; }
.meal-swap-navigation>strong { text-transform:capitalize; }
.meal-swap-list { border:1px solid var(--k-border-e9e2ef); border-radius:16px; overflow:hidden; }
.meal-swap-choice { display:grid; grid-template-columns:110px minmax(0,1fr); width:100%; gap:14px; padding:15px; text-align:left; border:0; border-bottom:1px solid var(--k-border-eee8f3); background:var(--k-bg-ffffff); min-height:72px; }
.meal-swap-choice:last-child { border-bottom:0; }
.meal-swap-choice>span { display:flex; min-width:0; flex-direction:column; gap:5px; overflow-wrap:anywhere; }
.meal-swap-choice small { color:var(--k-fg-81788b); font-size:0.8125rem; }
.meal-swap-choice:hover:not(:disabled), .meal-swap-choice.is-saving { background:var(--k-bg-f1eaf7); }
.meal-swap-choice[aria-current] { background:var(--k-bg-f5f4f8); }
@media(max-width:580px) {
 .meal-list-row { grid-template-columns:95px minmax(0,1fr); gap:12px; padding:17px 15px; }
 .meal-list-row>.button { grid-column:2; justify-self:start; }
 .meal-list-dish>strong { font-size:1rem; }
 .meal-week-controls { flex-wrap:wrap; }
 .meal-swap-choice { grid-template-columns:95px minmax(0,1fr); padding:12px; gap:10px; }
}

@media(max-width:580px) { .meal-card-grid { grid-template-columns:minmax(0,1fr); gap:14px; } }

/* Ugens varer -> indkøbsliste */
.meal-week-shop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; }
.meal-week-shop-row .budget-help { margin: 0; }
.meal-shop-list { display: grid; gap: 8px; margin-top: 12px; }
.meal-shop-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.meal-shop-row.is-disabled { opacity: .6; cursor: default; }
.meal-shop-row input { margin-top: 2px; flex: none; }
.meal-shop-row span { display: grid; gap: 3px; min-width: 0; }
.meal-shop-row strong { font-weight: 600; overflow-wrap: anywhere; }
.meal-shop-row small { color: var(--muted); font-size: 0.75rem; line-height: 1.5; }
