@php $money = fn ($minor) => config('care.billing.currency').' '.number_format($minor / 100, 2); @endphp
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{{ $bill->invoice_number }}</title>
    <style>body{font-family:system-ui,sans-serif;max-width:720px;margin:2rem auto;color:#111}table{width:100%;border-collapse:collapse}th,td{padding:.5rem;text-align:left;border-bottom:1px solid #eee}h1{margin:0}</style>
</head>
<body onload="window.print()">
    <header>
        <h1>{{ $organization->name }}</h1>
        <p>Invoice {{ $bill->invoice_number }} · {{ $bill->created_at->format('d M Y') }}</p>
        <p>{{ $bill->patient->fullName() }} ({{ $bill->patient->patient_number }})</p>
    </header>
    <table class="mt-6">
        <thead><tr><th>Description</th><th>Qty</th><th>Amount</th></tr></thead>
        <tbody>
            @foreach ($bill->lineItems as $item)
                <tr><td>{{ $item->description }}</td><td>{{ $item->quantity }}</td><td>{{ $money($item->total_minor) }}</td></tr>
            @endforeach
        </tbody>
    </table>
    <p class="mt-4"><strong>Total:</strong> {{ $money($bill->total_minor) }} · <strong>Paid:</strong> {{ $money($bill->amount_paid_minor) }} · <strong>Balance:</strong> {{ $money($bill->balance_minor) }}</p>
</body>
</html>
