{# Math explainer fragment for the Total Return KPI tile.
Receives `b: TotalReturnBreakdown`. Loaded via HTMX from
/portfolio/explain/total-return and swapped into a div under the tile. #}
Total Return — {{ b.period_label }}
Ending value
${{ "{:,.2f}".format(b.ending_value|float) }}
− Starting value
−${{ "{:,.2f}".format(b.starting_value|float) }}{% if not b.is_lifetime %} (account value at period start){% endif %}
− Contributions
−${{ "{:,.2f}".format(b.contributions|float) }} (deposits − withdrawals this period)
Δ Unrealized is computed as a residual (Total Return − Realized) — it differs from the standalone Unrealized P/L tile, which always shows current open unrealized regardless of period.
⚠ This is informational only. Consult a tax professional before filing.