<div class="flex items-center gap-3 mb-6"><a href="?page=reports" class="text-gray-400 hover:text-gray-600"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/></svg></a><h1 class="text-2xl font-bold text-gray-900">Property Performance</h1></div>
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-x-auto">
    <table class="w-full text-sm">
        <thead class="bg-gray-50 text-left"><tr><th class="px-4 py-3 font-medium text-gray-600">Property</th><th class="px-4 py-3 font-medium text-gray-600">Units</th><th class="px-4 py-3 font-medium text-gray-600">Occupancy</th><th class="px-4 py-3 font-medium text-gray-600 text-right">Monthly Income</th><th class="px-4 py-3 font-medium text-gray-600 text-right">Monthly Expenses</th><th class="px-4 py-3 font-medium text-gray-600 text-right">Net</th><th class="px-4 py-3 font-medium text-gray-600">Open Maint.</th></tr></thead>
        <tbody class="divide-y divide-gray-100">
            <?php $tInc=0;$tExp=0; foreach ($data as $p): $rate=$p['total_units']>0?round($p['occupied']/$p['total_units']*100):0; $net=$p['monthly_income']-$p['monthly_expenses']; $tInc+=$p['monthly_income']; $tExp+=$p['monthly_expenses']; ?>
            <tr class="hover:bg-gray-50">
                <td class="px-4 py-3 font-medium text-gray-900"><a href="?page=properties&action=show&id=<?= $p['id'] ?>" class="hover:text-indigo-600"><?= htmlspecialchars($p['name']) ?></a></td>
                <td class="px-4 py-3"><?= $p['occupied'] ?>/<?= $p['total_units'] ?></td>
                <td class="px-4 py-3"><span class="inline-flex px-2 py-0.5 rounded-full text-xs font-medium <?= $rate >= 90 ? 'bg-green-50 text-green-700' : ($rate >= 70 ? 'bg-yellow-50 text-yellow-700' : 'bg-red-50 text-red-700') ?>"><?= $rate ?>%</span></td>
                <td class="px-4 py-3 text-right text-green-700 font-medium"><?= formatMoney($p['monthly_income']) ?></td>
                <td class="px-4 py-3 text-right text-red-600 font-medium"><?= formatMoney($p['monthly_expenses']) ?></td>
                <td class="px-4 py-3 text-right font-bold <?= $net >= 0 ? 'text-green-700' : 'text-red-600' ?>"><?= formatMoney($net) ?></td>
                <td class="px-4 py-3"><?php if ($p['open_maintenance'] > 0): ?><span class="inline-flex px-2 py-0.5 rounded-full text-xs font-medium bg-orange-50 text-orange-700"><?= $p['open_maintenance'] ?></span><?php else: ?><span class="text-gray-400">0</span><?php endif; ?></td>
            </tr>
            <?php endforeach; ?>
        </tbody>
        <tfoot class="bg-gray-50"><tr><td colspan="3" class="px-4 py-3 font-semibold">Portfolio Total</td><td class="px-4 py-3 text-right font-bold text-green-700"><?= formatMoney($tInc) ?></td><td class="px-4 py-3 text-right font-bold text-red-600"><?= formatMoney($tExp) ?></td><td class="px-4 py-3 text-right font-bold"><?= formatMoney($tInc-$tExp) ?></td><td></td></tr></tfoot>
    </table>
</div>
