<?php $headerStyle = in_array($selectedModel, ['template2', 'template3'], true) ? 'background:' . q_e($theme['base']) . '; color:#fff;' : 'background:#f3f4f6; color:#111827;'; ?>
<table class="quote-table">
    <thead>
    <tr style="<?php echo $headerStyle; ?>">
        <th>Serviço</th>
        <th>Qtd</th>
        <th>Unitário</th>
        <th>Subtotal</th>
    </tr>
    </thead>
    <tbody>
    <?php if (!$services): ?>
        <tr>
            <td colspan="4" class="empty-row">Nenhum serviço adicionado.</td>
        </tr>
    <?php endif; ?>
    <?php foreach ($services as $index => $item): ?>
        <tr style="background: <?php echo $index % 2 === 0 ? '#ffffff' : q_e($theme['soft']); ?>;">
            <td>
                <strong><?php echo q_e($item['name'] ?: 'Serviço'); ?></strong>
                <?php if (!empty($item['description'])): ?><small><?php echo nl2br(q_e($item['description'])); ?></small><?php endif; ?>
            </td>
            <td><?php echo rtrim(rtrim(number_format((float) $item['quantity'], 2, ',', '.'), '0'), ','); ?></td>
            <td><?php echo q_money((float) $item['unit_price']); ?></td>
            <td><?php echo q_money((float) $item['subtotal']); ?></td>
        </tr>
    <?php endforeach; ?>
    </tbody>
</table>

<?php if (!in_array($selectedModel, ['template3'], true)): ?>
    <div class="quote-total-bar" style="background: <?php echo $selectedModel === 'template1' ? '#f3f4f6' : q_e($theme['soft']); ?>; color: <?php echo q_e($theme['base']); ?>; border-color: <?php echo q_e($theme['light']); ?>;">
        <span>Total Geral</span>
        <strong><?php echo q_money((float) $total); ?></strong>
    </div>
<?php endif; ?>
