@php
    $columnSpan = 1 + (empty($columnPeriods) ? 1 : count($columnPeriods) + 1);
@endphp
<tr class="section-header">
    <td colspan="{{ $columnSpan }}">{{ strtoupper($group['label']) }}</td>
</tr>
@if(!empty($group['tree']))
    @include('reports.profit-loss._pdf-account-tree', ['nodes' => $group['tree'], 'level' => 0])
@else
    <tr>
        <td style="padding-left: 8px;">No accounts</td>
        @if(!empty($columnPeriods))
            @foreach($columnPeriods as $period)
                <td class="amount">—</td>
            @endforeach
            <td class="amount">—</td>
        @else
            <td class="amount">—</td>
        @endif
    </tr>
@endif
<tr class="total-row">
    <td class="total-label">Total {{ $group['label'] }}</td>
    @include('reports.profit-loss._pdf-period-amount-cells', [
        'amounts' => !empty($columnPeriods) ? ($group['period_totals'] ?? []) : $group['total'],
        'total' => $group['total'],
    ])
</tr>
