{t('nutrition_title', lang)} — Fitness {#snippet microPanel()}
{#each microSections as section}

{section.title}

{#each section.rows as row}
{row.label}
{fmt(row.value)} {row.unit} {row.pct}%
{/each}
{/each}
{/snippet}
{#if !isToday} {/if}
{#each mealTypes as meal, mi} {@const mealEntries = grouped[meal]} {@const mealCal = mealEntries.reduce((s, e) => s + entryCalories(e), 0)} {@const meta = mealMeta[meal]} {@const MealSectionIcon = meta.icon}

{t(meal, lang)}

{#if mealEntries.length > 0} {fmtCal(mealCal)} {t('kcal', lang)} {/if}
{#each mealEntries as entry} {@const imgUrl = entry.source === 'recipe' && entry.sourceId ? recipeImages[entry.sourceId] : null}
{#if imgUrl} {entry.name} {:else}
{/if}
{#if entry.source === 'bls' || entry.source === 'usda'} {entry.name} {:else} {entry.name} {/if} {#if editingEntryId === entry._id}
{ e.preventDefault(); saveEditEntry(); }}> g
{:else} {entry.amountGrams}g · {fmtCal(entryCalories(entry))} kcal {/if} {fmt(entryNutrient(entry, 'protein'))}g P · {fmt(entryNutrient(entry, 'fat'))}g F · {fmt(entryNutrient(entry, 'carbs'))}g C
{/each}
{#if addingMeal === meal}
{#if inlineTab === 'search'} {:else}
{#if customMeals.length === 0}

{t('no_custom_meals', lang)}

{/if} {#each customMeals as cm}
{cm.name} {cm.ingredients.length} {t('ingredients', lang)} · {fmtCal(mealTotalCal(cm))} kcal
{/each} {isEn ? 'Manage meals' : 'Mahlzeiten verwalten'}
{/if}
{:else} {/if}
{/each}
{#if showFabModal}
e.key === 'Escape' && closeFabModal()}>
e.stopPropagation()} onkeydown={(e) => e.stopPropagation()}>

{t('add_food', lang)}

{#each mealTypes as meal} {@const meta = mealMeta[meal]} {@const MealIcon = meta.icon} {/each}
{#if fabTab === 'search'} {:else}
{#if customMeals.length === 0}

{t('no_custom_meals', lang)}

{/if} {#each customMeals as meal}
{meal.name} {meal.ingredients.length} {t('ingredients', lang)} · {fmtCal(mealTotalCal(meal))} kcal
{/each} {isEn ? 'Manage meals' : 'Mahlzeiten verwalten'}
{/if}
{/if}