{{define "content"}} {{$d := .}}

{{$d.T.Get "dashboard.title"}}

{{if $d.Email}}{{$d.Email}}{{end}}
{{if $d.Alerts}}
{{range $d.Alerts}}
{{if eq .Level "danger"}}🔴{{else if eq .Level "warn"}}⚠{{else}}ℹ{{end}} {{.Message}}
{{end}}
{{end}}
{{$d.T.Get "dashboard.waterfall.title"}}
{{if $d.IncomeCats}}
{{else}}
{{$d.T.Get "dashboard.waterfall.income"}} +€{{cents $d.WaterfallIncome}}
{{end}} {{if $d.LivingCats}}
{{else if gt $d.WaterfallLiving 0}}
{{$d.T.Get "dashboard.waterfall.living"}} −€{{cents $d.WaterfallLiving}}
{{end}} {{if gt $d.WaterfallGoals 0}}
{{if $d.DashGoals}} {{else}}
{{$d.T.Get "dashboard.waterfall.goals"}} {{$d.T.Get "dashboard.waterfall.goals_link"}} −€{{cents $d.WaterfallGoals}}
{{end}}
{{end}}
{{$d.T.Get "dashboard.waterfall.free_cash"}}?
Free CashWhat's left after paying for life and funding your goals. Positive means you have room to save or spend more.Income − Living expenses − Goal contributions
€0
{{$d.T.Get "dashboard.waterfall.month_progress"}} {{$d.MonthProgressPct}}%
{{if $d.DashGoals}}
{{$d.T.Get "dashboard.waterfall.what_now"}}
{{range $d.DashGoals}} {{if .Committed}} {{$funded := index $d.GoalFundedThisMonth .ID}} {{$needed := .MonthlyCents}} {{if lt $funded $needed}} {{$shortfall := sub $needed $funded}}
{{.Name}} −€{{cents $shortfall}} {{$d.T.Get "dashboard.waterfall.fund_link"}} →
{{end}} {{end}} {{end}}
{{end}}

{{$d.T.Get "dashboard.cards.savings_rate"}}?
Savings RateThe share of your income you're keeping. Above 20% is healthy; below 0% means you spent more than you earned.(Income − Expenses) ÷ Income × 100

{{$d.SavingsRatePct}}%
{{if $d.LastMonthSavingsRatePct}}

{{if gt $d.SavingsRatePct $d.LastMonthSavingsRatePct}}↑{{else}}↓{{end}} {{$d.T.Get "dashboard.alerts.vs_last_month_up"}} ({{$d.LastMonthSavingsRatePct}}%)

{{end}}

{{$d.T.Get "dashboard.cards.net_worth"}}?
Net WorthEverything you own minus everything you owe. Tracking this monthly is the single best measure of financial health.Cash + Investments + Property equity − Debts

€0.00

{{$d.T.Get "dashboard.cards.net_worth_link"}}

{{$d.T.Get "dashboard.cards.portfolio_today"}}

{{if $d.PortfolioHoldings}}
€0.00
{{if $d.PortfolioPricesAvailable}}

{{if ge $d.PortfolioPCLCents 0}}+{{else}}−{{end}}€{{cents (centsAbs $d.PortfolioPCLCents)}} total P&L

{{else}}

{{$d.T.Get "dashboard.cards.portfolio_cost_basis"}}

{{end}} {{else}}
{{$d.T.Get "dashboard.cards.portfolio_no_trades"}}

{{$d.T.Get "dashboard.cards.portfolio_import_link"}}

{{end}}

{{$d.T.Get "dashboard.stocks.section_title"}}

{{$d.T.Get "dashboard.stocks.portfolio_link"}}
{{if $d.PortfolioHoldings}}
{{range $d.PortfolioHoldings}}
{{.Name}}
{{printf "%.4f" .SharesOwned}} {{$d.T.Get "dashboard.stocks.shares_label"}}
{{if $d.PortfolioPricesAvailable}}
€{{cents .CurrentValueCents}}
{{pctSign .UnrealizedPCLPct}}{{printf "%.1f" .UnrealizedPCLPct}}%
{{else}}
€{{cents .TotalCostCents}}
{{$d.T.Get "dashboard.stocks.cost_basis"}}
{{end}}
{{end}}
{{$d.T.Get "dashboard.stocks.total_label"}}{{if not $d.PortfolioPricesAvailable}} {{$d.T.Get "dashboard.stocks.total_invested"}}{{end}} €0.00
{{else}}

{{$d.T.Get "dashboard.stocks.no_holdings_msg"}}
{{$d.T.Get "dashboard.stocks.import_link"}}

{{end}}
{{if $d.CategoryBudgets}}

{{$d.T.Get "dashboard.budget_health.section_title"}}

{{$d.T.Get "dashboard.budget_health.categories_link"}}
{{range $cat, $budget := $d.CategoryBudgets}} {{$spent := index $d.ThisMonth.ByCategory $cat}} {{$spentAbs := centsAbs $spent}} {{$color := index $d.CategoryColors $cat}} {{$over := isOver $spentAbs $budget}} {{$pct := clampPct $spentAbs $budget}}
{{if $color}}{{end}} {{$cat}} {{$pct}}%{{if $over}} ⚠{{end}}
{{end}}
{{end}}

{{$d.T.Get "dashboard.recent.section_title"}}

{{$d.T.Get "dashboard.recent.all_txns_link"}}
{{if $d.RecentTxns}}
{{range $d.RecentTxns}} {{$color := index $d.CategoryColors .Category}}
{{.Description}}
{{dateShort .Date}}
{{if lt .AmountCents 0}}−{{else}}+{{end}}€{{cents (centsAbs .AmountCents)}}
{{end}}
{{else}}
{{$d.T.Get "dashboard.recent.no_txns_msg"}} {{$d.T.Get "dashboard.recent.import_link"}}
{{end}}
{{if $d.DashGoals}}

{{$d.T.Get "dashboard.goals.section_title"}}

{{$d.T.Get "dashboard.goals.all_goals_link"}}
{{range $d.DashGoals}} {{$funded := index $d.GoalFundedThisMonth .ID}} {{$needed := .MonthlyCents}} {{$met := ge $funded $needed}} {{$partial := and (gt $funded 0) (not $met)}} {{$monthPct := 0}} {{if gt $needed 0}}{{$monthPct = clampPct $funded $needed}}{{end}}
{{if eq .Type "once"}}🎯{{else if eq .Type "deposit"}}🏠{{else if eq .Type "emergency"}}🛡️{{else}}📈{{end}} {{.Name}}
{{.MonthsLeft}}{{$d.T.Get "dashboard.goals.months_left"}} {{.ProgressPct}}%
€{{cents .SavedCents}} {{$d.T.Get "dashboard.goals.of"}} €{{cents .TargetCents}}
{{if gt $needed 0}}
{{$d.T.Get "dashboard.goals.this_month"}} {{if $met}} ✓ {{$d.T.Get "dashboard.goals.funded"}} {{else if $partial}} {{$d.T.Get "dashboard.goals.fund_link"}} → {{else}} {{$d.T.Get "dashboard.goals.fund_link"}} → {{end}}
{{if $met}} €{{cents $funded}} {{$d.T.Get "dashboard.goals.of"}} €{{cents $needed}} {{$d.T.Get "dashboard.goals.needed"}} {{else if $partial}} €{{cents $funded}} {{$d.T.Get "dashboard.goals.of"}} €{{cents $needed}} — €{{cents (sub $needed $funded)}} {{$d.T.Get "dashboard.goals.left_to_fund"}} {{else}} €{{cents $needed}} {{$d.T.Get "dashboard.goals.needed_this_month"}} {{end}}
{{end}}
{{end}}
{{end}} {{end}}