{#if activeTab === 'log'}
{#if !isToday} {/if}
{totals.calories.toLocaleString()} / {goal.calories.toLocaleString()}
{coachMessage(caloriesRemaining, caloriesPercent)}
{#if caloriesRemaining > 0} {@const hint = bestNextMove(totals, goal, caloriesRemaining)} {#if hint} {/if} {/if}
{ if (e.key === 'Enter') submitResolve(); }} disabled={resolving} />
{#if resolveError}
{resolveError}
{/if}
{totals.protein}g Protein
{macroInstruction('protein', totals.protein, goal.protein, caloriesRemaining)}
{macroLeft(totals.protein, goal.protein)}
{totals.carbs}g Carbs
{macroInstruction('carbs', totals.carbs, goal.carbs, caloriesRemaining)}
{macroLeft(totals.carbs, goal.carbs)}
{totals.fat}g Fat
{macroInstruction('fat', totals.fat, goal.fat, caloriesRemaining)}
{macroLeft(totals.fat, goal.fat)}
Meals {totals.count} entries
{#each mealTypes as meal, i} {@const mealEntries = entriesByMeal(meal)} {@const mCal = mealCalories(meal)} {@const mPro = mealProtein(meal)} {@const expanded = expandedMeals.has(meal)} {@const weight = mealWeight(mCal, goal.calories, meal)} {@const mealPct = mCal > 0 ? Math.round((mCal / goal.calories) * 100) : 0}
{#if expanded}
{#if mealEntries.length > 0} {#each mealEntries as entry}
toggleEntry(entry.id)}>
{entry.calories} cal
{#if expandedEntry === entry.id}
{ if (e.key === 'Enter') updateEntryQty(entry.id); }} step="0.5" min="0.1" /> {entry.rawUnit}
{/if}
{/each} {/if}
{/if}
{/each} {:else if activeTab === 'foods'}
Looking for a quick option?
{#if foodSearch} {/if}
{#each filteredFoods as food (food.name)}
openFoodEdit(food)}>
{food.name} {#if food.favorite} {/if}
{food.info}
{food.calories} cal
{/each} {#if filteredFoods.length === 0}
No foods found for "{foodSearch}"
{/if}
{:else if activeTab === 'templates'}
{#if templatesLoading}Loading...{:else if templates.length === 0}No quick meals yet{:else}{templates.length} go-to meals · ranked for you{/if}
{#each rankedTemplates as tpl} {@const hint = templateHintMap.get(tpl.name) || ''}
{tpl.meal.charAt(0).toUpperCase()}
{tpl.name}
{tpl.meal} · {tpl.calories} cal
{tpl.items} items
{#if hint}
{hint}
{/if}
{/each}
{/if}
{#if fabOpen}
fabOpen = false}>
{/if} {#if editingFood}
e.stopPropagation()}>
Edit Food
Per 1 {editFoodUnit}
{/if} {#if resolvedItems.length > 0}
e.stopPropagation()}>
{resolvedItems.length === 1 ? 'Confirm entry' : `Confirm ${resolvedItems.length} items`}
{#each resolvedItems as item, idx}
0}>
{item.name}
{item.calories} cal · {item.protein}g P · {item.carbs}g C · {item.fat}g F
{#if resolvedItems.length > 1} {/if}
{item.qty} {item.unit}
{/each}
Meal
{#if resolvedItems.some(i => i.result.resolution_type === 'ai_estimated')}
Some items estimated by AI — values are approximate
{/if}
{/if}