
<div class="w-full" style="font-size:14px; display:flex; flex-direction:column; gap:14px;">

    
    <?php if (isset($component)) { $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.cabecera','data' => ['rotulo' => 'Sistema','titulo' => 'Usuarios']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('cabecera'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['rotulo' => 'Sistema','titulo' => 'Usuarios']); ?>

         <?php $__env->slot('icono', null, []); ?> 
            <?php if (isset($component)) { $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.nav-icon','data' => ['name' => 'users','tint' => 'orange']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('nav-icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'users','tint' => 'orange']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $attributes = $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $component = $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
         <?php $__env->endSlot(); ?>

        
         <?php $__env->slot('descripcion', null, []); ?> 
            Quién entra al panel y con qué permisos. Desde aquí puedes dar de alta a alguien,
            cambiarle el rol, ver lo que ha hecho o quitarle el acceso.
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($conProblema > 0): ?>
                Ahora mismo hay <strong class="font-semibold" style="color:var(--danger-500);"><?php echo e($conProblema); ?></strong>
                que no puede<?php echo e($conProblema === 1 ? '' : 'n'); ?> trabajar: sin rol, o con un rol sin permisos.
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
         <?php $__env->endSlot(); ?>

         <?php $__env->slot('acciones', null, []); ?> 
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.users.create')): ?>
                <a href="<?php echo e(route('users.create')); ?>" wire:navigate
                   class="flex flex-none items-center gap-2 rounded-lg px-4 py-2.5 text-[13.5px] font-semibold text-white"
                   style="background:var(--orange-500);"
                   onmouseover="this.style.background='var(--orange-600)'"
                   onmouseout="this.style.background='var(--orange-500)'">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
                    Nuevo usuario
                </a>
            <?php endif; ?>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $attributes = $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $component = $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = ['success' => 'success', 'error' => 'danger']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clave => $color): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session($clave)): ?>
            <div class="rounded-lg px-4 py-2.5 text-[13px]"
                 style="background:var(--<?php echo e($color); ?>-50); color:var(--<?php echo e($color); ?>-500);">
                <?php echo e(session($clave)); ?>

            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <div class="flex items-center gap-2.5 rounded-xl border px-3.5 py-2.5"
         style="background:var(--surface-card); border-color:var(--border-subtle);">
        <div class="flex flex-1 items-center gap-2 rounded-lg border px-3 py-1.5"
             style="border-color:var(--border-default); background:var(--surface-page);">
            <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="flex-none"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
            <input type="text" wire:model.live.debounce.300ms="search" placeholder="Nombre o correo"
                   class="min-w-0 flex-1 border-none bg-transparent p-0 text-[13px] focus:ring-0"
                   style="color:var(--text-body);">
        </div>
        <span class="flex-none text-[12.5px]" style="color:var(--text-muted);">
            <strong class="font-bold" style="color:var(--text-strong);"><?php echo e($personas->count()); ?></strong>
            <?php echo e($personas->count() === 1 ? 'persona' : 'personas'); ?>

        </span>
    </div>

    
    <section class="overflow-hidden rounded-xl border"
             style="background:var(--surface-card); border-color:var(--border-subtle);">
        <div class="px-5 pb-2.5 pt-3.5">
            <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">
                Personas
            </h2>
        </div>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($personas->isNotEmpty()): ?>
            <div class="usr-grid hidden border-b px-5 py-1.5 text-[11px] font-semibold uppercase tracking-[0.06em] lg:grid"
                 style="color:var(--text-muted); border-color:var(--divider);">
                <span>Usuario</span><span>Rol</span><span>¿Sigue entrando?</span><span></span>
            </div>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $personas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $persona): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $problema = $persona['sinRol'] || $persona['rolSinPermisos'];

                    // La franja dice de un vistazo qué mirar: rojo es «no puede
                    // trabajar», ámbar «¿sigue en el equipo?», azul «alta sin estrenar».
                    $franja = match (true) {
                        $problema => 'var(--danger-500)',
                        $persona['viejo'] => 'var(--warning-500)',
                        $persona['nunca'] => 'var(--info-500)',
                        default => 'transparent',
                    };
                ?>

                <div class="usr-grid items-center border-b"
                     style="border-color:var(--divider); border-left:3px solid <?php echo e($franja); ?>; padding:10px 20px 10px 17px;">

                    
                    <div class="flex min-w-0 items-center gap-2.5">
                        <span class="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full text-[12px] font-bold"
                              style="background:var(--teal-100); color:var(--teal-700);">
                            <?php echo e($persona['iniciales']); ?>

                        </span>
                        <div class="min-w-0">
                            <div class="flex items-center gap-1.5">
                                <span class="truncate text-[13.5px] font-semibold" style="color:var(--text-strong);">
                                    <?php echo e($persona['nombre']); ?>

                                </span>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($persona['protegido']): ?>
                                    
                                    <span class="flex flex-none" style="color:var(--text-subtle);"
                                          title="Administrador: no se puede borrar">
                                        <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
                                    </span>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>
                            <div class="truncate text-[11.5px]" style="color:var(--text-muted);">
                                <?php echo e($persona['correo']); ?>

                            </div>
                        </div>
                    </div>

                    
                    <div class="min-w-0">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($persona['sinRol']): ?>
                            <div class="flex items-center gap-1.5">
                                <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="var(--danger-500)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="flex-none"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
                                <span class="text-[12px] font-semibold" style="color:var(--danger-500);">
                                    Sin rol — no puede abrir ninguna pantalla
                                </span>
                            </div>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.users.edit')): ?>
                                <a href="<?php echo e(route('users.edit', $persona['id'])); ?>" wire:navigate
                                   class="mt-0.5 inline-block text-[11.5px] font-semibold" style="color:var(--text-link);">
                                    Asignar un rol
                                </a>
                            <?php endif; ?>
                        <?php else: ?>
                            <div class="flex flex-wrap items-center gap-1.5">
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.roles.index')): ?>
                                    <a href="<?php echo e(route('configurations.roles.index')); ?>" wire:navigate
                                       class="rounded-full px-2.5 py-px text-[12px] font-semibold"
                                       style="color:var(--orange-600); background:var(--surface-brand-subtle);"
                                       title="Ver el rol en Configuraciones">
                                        <?php echo e($persona['rol']); ?>

                                    </a>
                                <?php else: ?>
                                    <span class="rounded-full px-2.5 py-px text-[12px] font-semibold"
                                          style="color:var(--orange-600); background:var(--surface-brand-subtle);">
                                        <?php echo e($persona['rol']); ?>

                                    </span>
                                <?php endif; ?>

                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($persona['rolSinPermisos']): ?>
                                    
                                    <span class="rounded-full px-2 py-px text-[10.5px] font-bold"
                                          style="color:var(--danger-500); background:var(--danger-50);">
                                        0 permisos — no ve nada
                                    </span>
                                <?php else: ?>
                                    <span class="text-[11.5px]" style="color:var(--text-muted);">
                                        <?php echo e($persona['permisosDelRol']); ?> permisos
                                    </span>
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </div>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    
                    <div class="min-w-0">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($persona['sinRegistro']): ?>
                            
                            <span class="rounded-full px-2.5 py-0.5 text-[11.5px] font-semibold"
                                  style="color:var(--text-muted); background:var(--surface-sunken);">
                                Sin registro
                            </span>
                            <div class="mt-0.5 text-[11px]" style="color:var(--text-subtle);">
                                no se guardaba antes
                            </div>
                        <?php elseif($persona['nunca']): ?>
                            
                            <span class="rounded-full px-2.5 py-0.5 text-[11.5px] font-semibold"
                                  style="color:var(--info-500); background:var(--info-50);">
                                Nunca ha entrado
                            </span>
                            <div class="mt-0.5 text-[11px]" style="color:var(--text-subtle);">
                                alta sin estrenar
                            </div>
                        <?php elseif($persona['viejo']): ?>
                            <div class="flex items-center gap-1.5">
                                <span class="h-[7px] w-[7px] flex-none rounded-full" style="background:var(--warning-500);"></span>
                                <span class="text-[12.5px] font-semibold" style="color:var(--warning-500);">
                                    <?php echo e($persona['actividad']); ?>

                                </span>
                            </div>
                            <div class="mt-px text-[11px]" style="color:var(--text-subtle);">
                                ¿sigue en el equipo?
                            </div>
                        <?php else: ?>
                            <div class="flex items-center gap-1.5">
                                <span class="h-[7px] w-[7px] flex-none rounded-full" style="background:var(--success-500);"></span>
                                <span class="text-[12.5px]" style="color:var(--text-body);">
                                    <?php echo e($persona['actividad']); ?>

                                </span>
                            </div>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    
                    <div class="flex flex-wrap justify-end gap-2.5">
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.logs.index')): ?>
                            
                            <a href="<?php echo e(route('monitoring.system-log', ['usuario' => $persona['id']])); ?>" wire:navigate
                               class="whitespace-nowrap text-[12px] font-semibold" style="color:var(--text-link);"
                               title="Acciones del panel filtradas por esta persona">
                                Su actividad
                            </a>
                        <?php endif; ?>

                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.users.edit')): ?>
                            <a href="<?php echo e(route('users.edit', $persona['id'])); ?>" wire:navigate
                               class="whitespace-nowrap text-[12px] font-semibold" style="color:var(--text-muted);">
                                Editar
                            </a>
                        <?php endif; ?>

                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.users.destroy')): ?>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if (! ($persona['protegido'])): ?>
                                <button type="button" wire:click="abrirBorrado(<?php echo e($persona['id']); ?>)"
                                        class="whitespace-nowrap border-none bg-transparent p-0 text-[12px] font-semibold"
                                        style="color:var(--danger-500);">
                                    Borrar…
                                </button>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        <?php else: ?>
            <div class="border-t px-5 pb-4 pt-3.5 text-center text-[13px]"
                 style="border-color:var(--divider); color:var(--text-muted);">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($search !== ''): ?>
                    Nadie coincide con «<?php echo e($search); ?>».
                <?php else: ?>
                    Ninguna persona todavía.
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </section>

    
    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($cuentasDeServicio->isNotEmpty()): ?>
        <section class="overflow-hidden rounded-xl border"
                 style="background:var(--surface-card); border-color:var(--border-subtle);">
            <div class="px-5 pb-2.5 pt-3.5">
                <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">
                    Cuentas de servicio
                </h2>
                <div class="mt-0.5 text-[12px]" style="color:var(--text-muted);">
                    No son personas: son las credenciales con las que la API y las tareas programadas
                    operan. No se les mira la última sesión ni se les da de baja «porque se fueron».
                </div>
            </div>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $cuentasDeServicio; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cuenta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="usr-grid items-center border-t px-5 py-2.5" style="border-color:var(--divider);">
                    <div class="flex min-w-0 items-center gap-2.5">
                        <span class="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-lg"
                              style="background:var(--surface-sunken); color:var(--text-subtle);">
                            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 1v4"/><path d="M12 19v4"/><path d="m4.2 4.2 2.8 2.8"/><path d="m17 17 2.8 2.8"/><path d="M1 12h4"/><path d="M19 12h4"/><path d="m4.2 19.8 2.8-2.8"/><path d="m17 7 2.8-2.8"/></svg>
                        </span>
                        <div class="min-w-0">
                            <div class="truncate text-[13.5px] font-semibold" style="color:var(--text-strong);">
                                <?php echo e($cuenta['nombre']); ?>

                            </div>
                            <div class="truncate text-[11.5px]" style="color:var(--text-muted);">
                                <?php echo e($cuenta['correo']); ?>

                            </div>
                        </div>
                    </div>

                    <div>
                        <span class="rounded-full px-2.5 py-px text-[12px] font-semibold"
                              style="color:var(--neutral-700); background:var(--surface-sunken);">
                            <?php echo e($cuenta['rol']); ?>

                        </span>
                        <div class="mt-0.5 text-[11.5px]" style="color:var(--text-muted);">
                            Rol de API — <?php echo e($cuenta['permisosDelRol']); ?> permisos, no navega el panel
                        </div>
                    </div>

                    <span class="text-[12.5px]" style="color:var(--text-muted);">
                        Uso vía API
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.api-logs.index')): ?>
                            · <a href="<?php echo e(route('api-logs.index')); ?>" wire:navigate
                                 class="font-semibold" style="color:var(--text-link);">ver peticiones</a>
                        <?php endif; ?>
                    </span>

                    <div class="flex justify-end gap-2.5">
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.users.edit')): ?>
                            <a href="<?php echo e(route('users.edit', $cuenta['id'])); ?>" wire:navigate
                               class="text-[12px] font-semibold" style="color:var(--text-muted);">Editar</a>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </section>
    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

    
    <section class="rounded-xl border px-5 pb-4 pt-3.5"
             style="background:var(--surface-card); border-color:var(--border-subtle);">
        <?php
            $sinPermisos = collect($roles)->where('sinPermisos', true)->count();
            $sinUsuarios = collect($roles)->where('sinUsuarios', true)->count();
        ?>

        <div class="flex flex-wrap items-baseline justify-between gap-4">
            <div>
                <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">
                    Los <?php echo e(count($roles)); ?> roles, de un vistazo
                </h2>
                <div class="mt-0.5 text-[12px]" style="color:var(--text-muted);">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($sinPermisos > 0): ?>
                        <strong class="font-semibold" style="color:var(--danger-500);">
                            <?php echo e($sinPermisos); ?> <?php echo e($sinPermisos === 1 ? 'rol no tiene ningún permiso' : 'roles no tienen ningún permiso'); ?>:
                            quien lo tenga no ve nada.
                        </strong>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($sinUsuarios > 0): ?>
                        <?php echo e($sinUsuarios); ?> <?php echo e($sinUsuarios === 1 ? 'rol' : 'roles'); ?> sin ningún usuario.
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    Se editan en Configuraciones → Roles.
                </div>
            </div>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.roles.index')): ?>
                <a href="<?php echo e(route('configurations.roles.index')); ?>" wire:navigate
                   class="flex-none text-[12.5px] font-semibold" style="color:var(--text-link);">
                    Configurar roles
                </a>
            <?php endif; ?>
        </div>

        <div class="mt-3 grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rol): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="rounded-[10px] border px-3.5 py-2.5"
                     style="border-color:<?php echo e($rol['sinPermisos'] ? 'var(--danger-500)' : 'var(--border-subtle)'); ?>;
                            background:<?php echo e($rol['sinPermisos'] ? 'var(--danger-50)' : ($rol['sinUsuarios'] ? 'var(--surface-alt)' : 'var(--surface-page)')); ?>;">

                    <div class="flex items-center justify-between gap-2">
                        <span class="text-[13px] font-bold" style="color:var(--text-strong);"><?php echo e($rol['nombre']); ?></span>
                        <span class="text-[11px] font-semibold"
                              style="color:<?php echo e($rol['sinUsuarios'] ? 'var(--text-subtle)' : 'var(--text-muted)'); ?>;">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($rol['sinUsuarios']): ?>
                                Sin usuarios
                            <?php else: ?>
                                <?php echo e($rol['usuarios']); ?> <?php echo e($rol['usuarios'] === 1 ? ($rol['esDeServicio'] ? 'cuenta' : 'usuario') : ($rol['esDeServicio'] ? 'cuentas' : 'usuarios')); ?>

                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </span>
                    </div>

                    <div class="mt-1 text-[11.5px]"
                         style="color:<?php echo e($rol['sinPermisos'] ? 'var(--danger-500)' : 'var(--text-muted)'); ?>;">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($rol['sinPermisos']): ?>
                            0 permisos — quien lo tenga no ve nada
                        <?php elseif($rol['esTodo']): ?>
                            Todo el panel — <?php echo e($rol['permisos']); ?> permisos
                        <?php elseif($rol['esDeServicio']): ?>
                            Rol de API — no navega el panel (<?php echo e($rol['permisos']); ?>)
                        <?php else: ?>
                            <?php echo e($rol['permisos']); ?> permisos
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </section>
</div><?php /**PATH /var/www/html/resources/views/livewire/users/index.blade.php ENDPATH**/ ?>