@php
$dn = trim((string) ($preferences['profile']['displayName'] ?? ''));
if ($dn === '') {
$dn = trim((string) (auth()->user()?->name ?? ''));
}
if ($dn === '') {
$dn = (string) __('budgets.profile_page.title');
}
$parts = array_values(array_filter(preg_split('/\s+/', $dn) ?: []));
$initials = strtoupper(
($parts[0][0] ?? 'U').($parts[1][0] ?? ($parts[0][1] ?? 'S'))
);
@endphp
{{ $initials }}