document.addEventListener('DOMContentLoaded',()=>{const base=window.APP_BASE||'',number=v=>Number(String(v??0).replace(/,/g,''))||0,money=value=>`£${number(value).toLocaleString(undefined,{minimumFractionDigits:2,maximumFractionDigits:2})}`;fetch(`${base}/get_dashboard_summary.php`).then(r=>r.json()).then(payload=>{if(!payload.success)return;const d=payload.data;document.getElementById('accountBalance').textContent=money(d.balance);document.getElementById('amountInvested').textContent=money(d.amountInvested);document.getElementById('totalEarnings').textContent=money(d.earnings);document.getElementById('totalDeposits').textContent=money(d.deposits);document.getElementById('totalWithdrawals').textContent=money(d.withdrawals);document.getElementById('netFunding').textContent=money(number(d.deposits)-number(d.withdrawals))}).catch(()=>{})});