<div class="row">
    <div class="col-12">
        <div class="card glass-card">
            <div class="card-header"><h5 class="card-title">Financial Report</h5></div>
            <div class="card-body">
                <?php $this->include('Reports/partials/filter_date') ?>
                <div class="row mt-3">
                    <div class="col-md-4 mb-3">
                        <div class="stats-card glass-card p-3">
                            <div class="stats-icon text-success"><i class="fas fa-arrow-up"></i></div>
                            <div class="stats-text"><h6>Total Income</h6><h3><?= currency($summary->total_income ?? 0) ?></h3></div>
                        </div>
                    </div>
                    <div class="col-md-4 mb-3">
                        <div class="stats-card glass-card p-3">
                            <div class="stats-icon text-danger"><i class="fas fa-arrow-down"></i></div>
                            <div class="stats-text"><h6>Total Expenses</h6><h3><?= currency($summary->total_expenses ?? 0) ?></h3></div>
                        </div>
                    </div>
                    <div class="col-md-4 mb-3">
                        <div class="stats-card glass-card p-3">
                            <div class="stats-icon text-gold"><i class="fas fa-chart-line"></i></div>
                            <div class="stats-text"><h6>Net Profit</h6><h3><?= currency($summary->net_profit ?? 0) ?></h3></div>
                        </div>
                    </div>
                </div>
                <?php if (!empty($data)): ?>
                <div class="table-responsive mt-3">
                    <table class="table table-hover">
                        <thead><tr><th>Month</th><th class="text-end">Income</th><th class="text-end">Expenses</th><th class="text-end">Net</th></tr></thead>
                        <tbody>
                            <?php foreach ($data as $row): ?>
                            <tr>
                                <td><?= e($row->month) ?></td>
                                <td class="text-end text-success"><?= currency($row->income) ?></td>
                                <td class="text-end text-danger"><?= currency($row->expenses) ?></td>
                                <td class="text-end fw-bold"><?= currency($row->net) ?></td>
                            </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
