<style>
    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8pt;
    }
    th, td {
        border: 1px solid #000;
        padding: 4px;
        text-align: center;
    }
    th {
        background-color: #eee;
    }
    .print-title {
        text-align: center;
        font-size: 14pt;
        margin-bottom: 10px;
    }
    .print-date {
        text-align: right;
        font-size: 8pt;
        margin-bottom: 10px;
    }
    .text-danger {
        color: red;
    }
    .text-success {
        color: green;
    }
</style>

<div class="print-title">Condominio IBIZA-Cto Sierra Morena 152 - Reporte de Balance General</div>
<div class="print-date">Fecha de generación: <?= date('d/m/Y H:i') ?></div>

<table>
    <thead>
        <tr style="background-color: #d4edda;">
            <th colspan="2">Resumen Financiero</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td style="text-align: left;">Total Ingresos (Conceptos):</td>
            <td class="text-end text-success">$<?= number_format($balance['total_incomes'], 2) ?></td>
        </tr>
        <?php if (!Auth::isLector()): ?>
        <tr>
            <td style="text-align: left;">Total Egresos:</td>
            <td class="text-end text-danger">$<?= number_format($balance['total_expenses'], 2) ?></td>
        </tr>
        <tr style="background-color: #343a40; color: #fff;">
            <td style="text-align: left; font-weight: bold;">Balance Neto:</td>
            <td class="text-end fw-bold <?= $balance['balance'] >= 0 ? 'text-success' : 'text-danger' ?>">
                $<?= number_format($balance['balance'], 2) ?>
            </td>
        </tr>
        <?php endif; ?>
    </tbody>
</table>
