<div>
    
    <div class="flex items-start justify-between mb-6">
        <div>
            <h1 class="text-2xl font-bold text-gray-800">Gestión Prejurídica</h1>
            <p class="text-sm text-gray-500 mt-1">Casos en etapa administrativa y persuasiva</p>
        </div>
        <a href="<?php echo e(route('casos-prejuridicos.create')); ?>" wire:navigate
            class="inline-flex items-center px-4 py-2 bg-yellow-400 hover:bg-yellow-500 text-gray-900 text-sm font-semibold rounded-md shadow-sm transition">
            + Nuevo Caso
        </a>
    </div>

    
    <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-4">
        <div class="text-xs font-semibold text-gray-500 uppercase mb-3">Filtros de búsqueda</div>
        <div class="grid grid-cols-1 md:grid-cols-4 gap-3">
            <input type="text" wire:model.live.debounce.400ms="search"
                placeholder="Buscar por radicado, cédula o nombre..."
                class="border-gray-300 rounded-md text-sm focus:ring-blue-500 focus:border-blue-500" />

            <select wire:model.live="entidadFiltro"
                class="border-gray-300 rounded-md text-sm focus:ring-blue-500 focus:border-blue-500">
                <option value="">Todas las entidades</option>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $entidades; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $e): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($e->id); ?>"><?php echo e($e->nombre); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </select>

            <select wire:model.live="etapaFiltro"
                class="border-gray-300 rounded-md text-sm focus:ring-blue-500 focus:border-blue-500">
                <option value="">Todas las etapas</option>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $etapas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $slug => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($slug); ?>"><?php echo e($label); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </select>

            <button type="button" wire:click="limpiar"
                class="px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 text-sm font-medium rounded-md transition">
                Limpiar
            </button>
        </div>
    </div>

    
    <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
        <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
            <div class="text-xs text-gray-500 uppercase mb-1">Total casos</div>
            <div class="text-2xl font-bold text-gray-800"><?php echo e($totalCasos); ?></div>
        </div>
        <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
            <div class="text-xs text-gray-500 uppercase mb-1">Total deuda en gestión</div>
            <div class="text-2xl font-bold text-green-600">$<?php echo e(number_format((float)$totalDeuda, 0, ',', '.')); ?></div>
        </div>
        <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4">
            <div class="text-xs text-gray-500 uppercase mb-1">Esta página</div>
            <div class="text-2xl font-bold text-gray-800"><?php echo e($casos->count()); ?> casos</div>
        </div>
    </div>

    
    <div class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
        <table class="min-w-full divide-y divide-gray-200">
            <thead class="bg-yellow-400">
                <tr>
                    <th class="px-4 py-3 text-left text-xs font-bold text-gray-900 uppercase">Radicado</th>
                    <th class="px-4 py-3 text-left text-xs font-bold text-gray-900 uppercase">Entidad</th>
                    <th class="px-4 py-3 text-left text-xs font-bold text-gray-900 uppercase">Deudor</th>
                    <th class="px-4 py-3 text-left text-xs font-bold text-gray-900 uppercase">Identificación</th>
                    <th class="px-4 py-3 text-left text-xs font-bold text-gray-900 uppercase">Etapa</th>
                    <th class="px-4 py-3 text-right text-xs font-bold text-gray-900 uppercase">Total deuda</th>
                    <th class="px-4 py-3 text-center text-xs font-bold text-gray-900 uppercase">Acción</th>
                </tr>
            </thead>
            <tbody class="bg-white divide-y divide-gray-200">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $casos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $caso): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="hover:bg-gray-50">
                        <td class="px-4 py-3 text-sm font-mono text-blue-600"><?php echo e($caso->radicado); ?></td>
                        <td class="px-4 py-3 text-sm text-gray-700">
                            <?php echo e($caso->clienteCorporativo->nombre ?? '—'); ?>

                        </td>
                        <td class="px-4 py-3 text-sm font-medium text-gray-900">
                            <?php echo e($caso->deudor->nombre_completo ?? '—'); ?>

                        </td>
                        <td class="px-4 py-3 text-sm text-gray-600">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($caso->deudor): ?>
                                <?php echo e($caso->deudor->tipo_documento ?? 'CC'); ?> <?php echo e($caso->deudor->numero_documento ?? ''); ?>

                            <?php else: ?>
                                —
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </td>
                        <td class="px-4 py-3 text-sm">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
                                <?php echo e($caso->etapa_label); ?>

                            </span>
                        </td>
                        <td class="px-4 py-3 text-sm text-right font-semibold text-green-600">
                            $<?php echo e(number_format((float)$caso->total_deuda, 0, ',', '.')); ?>

                        </td>
                        <td class="px-4 py-3 text-sm text-center">
                            <a href="<?php echo e(route('casos-prejuridicos.show', $caso)); ?>" wire:navigate class="text-blue-600 hover:text-blue-800 font-medium">Ver</a>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="7" class="px-4 py-8 text-center text-sm text-gray-500">
                            No se encontraron casos prejurídicos con los filtros aplicados.
                        </td>
                    </tr>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </tbody>
        </table>
    </div>

    
    <div class="mt-4">
        <?php echo e($casos->links()); ?>

    </div>
</div><?php /**PATH /home/evolucionamos/public_html/yber-dev/resources/views/livewire/casos-prejuridicos/caso-prejuridico-manager.blade.php ENDPATH**/ ?>