<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Cycle <?php echo e($cycle->cycle_number); ?> Report — <?php echo e($cycle->pond->name); ?></title>
    <style>
        body { font-family: DejaVu Sans, sans-serif; font-size: 11px; color: #1f2937; }
        h1 { font-size: 18px; color: #16a34a; margin-bottom: 4px; }
        h2 { font-size: 13px; border-bottom: 1px solid #e5e7eb; padding-bottom: 4px; margin-top: 16px; }
        .grid { display: flex; gap: 12px; margin-bottom: 12px; }
        .stat { flex: 1; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px; }
        .stat-label { font-size: 9px; color: #6b7280; text-transform: uppercase; }
        .stat-value { font-size: 16px; font-weight: bold; margin-top: 2px; }
        table { width: 100%; border-collapse: collapse; margin-top: 6px; }
        th { background: #f3f4f6; text-align: left; padding: 4px 8px; font-size: 9px; text-transform: uppercase; color: #6b7280; }
        td { padding: 4px 8px; border-bottom: 1px solid #f3f4f6; }
        .text-green { color: #16a34a; } .text-red { color: #dc2626; }
        .footer { margin-top: 24px; text-align: center; font-size: 9px; color: #9ca3af; }
    </style>
</head>
<body>
    <h1>FishFarm RMS</h1>
    <p><strong>Cycle Summary Report</strong> &mdash; <?php echo e($cycle->pond->name); ?>, Cycle #<?php echo e($cycle->cycle_number); ?></p>
    <p>Period: <?php echo e($cycle->start_date->format('d M Y')); ?> – <?php echo e($cycle->end_date?->format('d M Y') ?? 'Open'); ?> &nbsp;|&nbsp; Duration: <?php echo e($cycle->days_elapsed); ?> days</p>

    <h2>Financial Summary</h2>
    <div class="grid">
        <div class="stat"><div class="stat-label">Revenue</div><div class="stat-value text-green">₦<?php echo e(number_format($totalRevenue)); ?></div></div>
        <div class="stat"><div class="stat-label">Expenses</div><div class="stat-value text-red">₦<?php echo e(number_format($totalExpenses)); ?></div></div>
        <div class="stat"><div class="stat-label">Gross Profit</div><div class="stat-value <?php echo e(($totalRevenue - $totalExpenses) >= 0 ? 'text-green' : 'text-red'); ?>">₦<?php echo e(number_format($totalRevenue - $totalExpenses)); ?></div></div>
        <div class="stat"><div class="stat-label">ROI</div><div class="stat-value"><?php echo e($roi ? $roi . '%' : '—'); ?></div></div>
    </div>
    <div class="grid">
        <div class="stat"><div class="stat-label">FCR</div><div class="stat-value"><?php echo e($fcr ?? '—'); ?></div></div>
        <div class="stat"><div class="stat-label">Cost/kg</div><div class="stat-value"><?php echo e($costPerKg ? '₦'.number_format($costPerKg) : '—'); ?></div></div>
        <div class="stat"><div class="stat-label">Revenue/kg</div><div class="stat-value"><?php echo e($revenuePerKg ? '₦'.number_format($revenuePerKg) : '—'); ?></div></div>
        <div class="stat"><div class="stat-label">Harvest Weight</div><div class="stat-value"><?php echo e($cycle->harvestRecord ? number_format($cycle->harvestRecord->total_weight_kg, 1).' kg' : '—'); ?></div></div>
    </div>

    <h2>Stocking</h2>
    <table>
        <tr><th>Species</th><th>Quantity</th><th>Avg Weight</th><th>Cost</th></tr>
        <?php $__currentLoopData = $cycle->stockingRecords; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <td><?php echo e($sr->species); ?></td>
            <td><?php echo e(number_format($sr->quantity)); ?></td>
            <td><?php echo e($sr->avg_weight_g); ?>g</td>
            <td>₦<?php echo e(number_format($sr->total_cost)); ?></td>
        </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </table>

    <div class="footer">Generated by FishFarm RMS &mdash; <?php echo e(now()->format('d M Y H:i')); ?></div>
</body>
</html>
<?php /**PATH C:\laragon\www\farm\resources\views\reports\cycle-summary-pdf.blade.php ENDPATH**/ ?>