<?php $summary = $summary ?? []; ?>
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:15px;margin-bottom:20px;">
    <div style="background:#F0FDF4;padding:15px;border-radius:8px;text-align:center;">
        <div style="font-size:20px;font-weight:700;color:#059669;"><?= money($summary['total_paid'] ?? '0') ?></div>
        <div style="color:#6B7280;font-size:12px;">إجمالي المدفوع</div>
    </div>
    <div style="background:#FEF2F2;padding:15px;border-radius:8px;text-align:center;">
        <div style="font-size:20px;font-weight:700;color:#DC2626;"><?= money($summary['membership_outstanding'] ?? '0') ?></div>
        <div style="color:#6B7280;font-size:12px;">متبقي العضوية</div>
    </div>
    <div style="background:#EFF6FF;padding:15px;border-radius:8px;text-align:center;">
        <div style="font-size:20px;font-weight:700;color:#0284C7;"><?= (int) ($summary['payment_count'] ?? 0) ?></div>
        <div style="color:#6B7280;font-size:12px;">عدد المدفوعات</div>
    </div>
    <div style="background:#FFF7ED;padding:15px;border-radius:8px;text-align:center;">
        <div style="font-size:20px;font-weight:700;color:#D97706;"><?= money($summary['total_voided'] ?? '0') ?></div>
        <div style="color:#6B7280;font-size:12px;">ملغاة</div>
    </div>
</div>
<?php if (!empty($summary['last_payment'])): ?>
<div class="card" style="margin-bottom:20px;padding:15px;font-size:13px;color:#6B7280;">
    آخر دفعة: <?= e($summary['last_payment']['payment_date'] ?? '') ?> — إيصال: <?= e($summary['last_payment']['receipt_number'] ?? '—') ?> — <?= money($summary['last_payment']['amount'] ?? '0') ?>
</div>
<?php endif; ?>