{#if isToday}Today{:else}{formatDate(selectedDate)}{/if}

{#if !isToday} {/if}
{#if loading}
{:else} {#if queueCount > 0}
{queueCount} food{queueCount > 1 ? 's' : ''} need review
Tap to resolve
{/if} {@const g = goal}
{Math.round(totals.total_calories)}
Calories
{#if g}
{Math.round(Math.max(g.calories - totals.total_calories, 0))} left of {Math.round(g.calories)}
{/if}
{Math.round(totals.total_protein)}g
Protein
{#if g}
{Math.round(Math.max(g.protein - totals.total_protein, 0))}g left of {Math.round(g.protein)}g
{/if}
{Math.round(totals.total_carbs)}g
Carbs
{#if g}
{Math.round(Math.max(g.carbs - totals.total_carbs, 0))}g left of {Math.round(g.carbs)}g
{/if}
{Math.round(totals.total_fat)}g
Fat
{#if g}
{Math.round(Math.max(g.fat - totals.total_fat, 0))}g left of {Math.round(g.fat)}g
{/if}
{#if !g}
Set goals to see progress bars
{/if} {#each MEAL_TYPES as meal} {@const mealEntries = entriesByMeal(meal)} {@const mCal = mealCalories(meal)} {@const mPro = mealProtein(meal)} {@const expanded = expandedMeals.has(meal)}
{#if expanded}
{#if mealEntries.length > 0} {#each mealEntries as entry}
{#if entry.food_image_path}
{entry.snapshot_food_name}
{entry.serving_description || `${entry.quantity} ${entry.unit}`} {#if entry.entry_method === 'ai_plate' || entry.entry_method === 'ai_label'} AI {/if}
{#if entry.note}
{entry.note}
{/if}
{Math.round(entry.snapshot_calories)}
cal
{:else}
{entry.snapshot_food_name}
{entry.serving_description || `${entry.quantity} ${entry.unit}`} {#if entry.entry_method === 'ai_plate' || entry.entry_method === 'ai_label'} AI {/if} {#if entry.entry_method === 'quick_add'} quick {/if}
{#if entry.note}
{entry.note}
{/if}
{Math.round(entry.snapshot_calories)}
cal
{/if}
{/each} {:else}
No entries
{/if}
{/if}
{/each} {/if}
{#if showAddModal} { showAddModal = false; loadDay(); }} onClose={() => showAddModal = false} /> {/if}