
<?php
    $tono = $salud['tono'];

    // Un solo sitio donde se decide el color del veredicto: tres tonos, no cinco
    // veredictos con su propio color cada uno.
    $tonos = [
        'ok'    => ['dot' => 'var(--success-500)', 'texto' => 'var(--success-500)', 'borde' => 'var(--border-subtle)', 'fondo' => 'var(--surface-alt)'],
        'aviso' => ['dot' => 'var(--warning-500)', 'texto' => 'var(--warning-500)', 'borde' => 'var(--warning-500)', 'fondo' => 'var(--warning-50)'],
        'malo'  => ['dot' => 'var(--danger-500)',  'texto' => 'var(--danger-500)',  'borde' => 'var(--danger-500)',  'fondo' => 'var(--danger-50)'],
    ][$tono];

    // El mismo código de color de `env` que el listado: un `pro` y un `local` no pueden
    // leerse igual. **Y ahora es literalmente el mismo**: esto era una lista aparte que
    // pintaba `pro` en naranja y metía `develop` en el `default`, así que el comentario
    // decía una cosa y el código otra.
    [$envFg, $envBg] = \App\Models\Environments\Environment::colorDeEnv($environment->env);

    $etiquetasDeSeveridad = \App\Services\Api\Severidad::ETIQUETAS;
    $coloresDeSeveridad = [
        'ok' => 'var(--success-500)',
        'error' => 'var(--danger-500)',
        'sin_contenido' => 'var(--text-muted)',
        'negocio' => 'var(--info-500)',
    ];
?>

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

    <div>
        <a href="<?php echo e(route('environments.index')); ?>" wire:navigate
           class="inline-flex items-center gap-1.5 text-[13px] font-semibold"
           style="color:var(--text-link);">
            <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
            Entornos
        </a>
    </div>

    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
        <div class="rounded-lg px-4 py-2.5 text-[13px]" style="background:var(--success-50); color:var(--success-500);">
            <?php echo e(session('success')); ?>

        </div>
    <?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(session('warning')): ?>
        <div class="rounded-lg px-4 py-2.5 text-[13px]" style="background:var(--warning-50); color:var(--warning-500);">
            <?php echo e(session('warning')); ?>

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

    
    <section class="overflow-hidden rounded-xl border"
             style="background:var(--surface-card); border-color:var(--border-subtle);">
        <div class="flex flex-wrap items-start justify-between gap-6 px-6 py-5">
            <div class="min-w-0 flex-1">
                <div class="flex flex-wrap items-center gap-2.5">
                    <h1 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:22px; font-weight:700; letter-spacing:-0.02em; color:var(--text-strong); margin:0; min-width:0;">
                        <?php echo e($environment->name); ?>

                    </h1>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->env): ?>
                        <span class="flex-none rounded px-2.5 py-0.5 text-[11px] font-bold uppercase tracking-wider"
                              style="color:<?php echo e($envFg); ?>; background:<?php echo e($envBg); ?>;"><?php echo e($environment->env); ?></span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>

                <div class="mt-1.5 flex flex-wrap items-center gap-[7px] text-[12.5px]" style="color:var(--text-muted);">
                    <a href="<?php echo e($environment->enlaceDelDominio() ?? '#'); ?>" target="_blank" rel="noopener"
                       class="font-mono text-[12px] font-semibold hover:underline" style="color:var(--text-link);">
                        <?php echo e($environment->domain); ?>

                    </a>
                    
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->enlaceDeLogin()): ?>
                        <span style="color:var(--border-default);">·</span>
                        <a href="<?php echo e($environment->enlaceDeLogin()); ?>" target="_blank" rel="noopener"
                           class="font-semibold hover:underline" style="color:var(--text-link);"
                           title="<?php echo e($environment->tieneLoginPropio() ? 'Enlace propio de este sitio, puesto a mano' : 'El de siempre: /login/index.php'); ?>">
                            
                            Entrar
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->tieneLoginPropio()): ?>
                                <span class="text-[11px]" style="color:var(--text-subtle);">(propio)</span>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </a>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <span style="color:var(--border-default);">·</span>
                    
                    <span class="inline-flex items-center gap-1.5">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->type?->image_url): ?>
                            <img src="<?php echo e($environment->type->image_url); ?>" alt="<?php echo e($environment->type->name); ?>"
                                 class="h-[15px] w-[15px] flex-none object-contain" loading="lazy">
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <?php echo e($environment->type?->name ?? 'Moodle'); ?>

                    </span>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->client): ?>
                        <span style="color:var(--border-default);">·</span>
                        <a href="<?php echo e(route('clients.show', $environment->client)); ?>" wire:navigate
                           class="font-semibold hover:underline" style="color:var(--text-link);">
                            <?php echo e($environment->client->name); ?>

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

                
                <div class="mt-3 inline-flex max-w-[640px] items-start gap-2.5 rounded-[10px] border px-3.5 py-2.5"
                     style="border-color:<?php echo e($tonos['borde']); ?>; background:<?php echo e($tonos['fondo']); ?>;">
                    <span class="mt-1 h-2.5 w-2.5 flex-none rounded-full" style="background:<?php echo e($tonos['dot']); ?>;"></span>
                    <div>
                        <div class="text-[13.5px] font-bold" style="color:<?php echo e($tonos['texto']); ?>;"><?php echo e($salud['titulo']); ?></div>
                        <div class="mt-px text-[12px] leading-relaxed" style="color:var(--text-body);"><?php echo e($salud['detalle']); ?></div>
                    </div>
                </div>

                
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->review_flagged_at): ?>
                    <?php $nivelRev = \App\Support\RevisionDeEntorno::nivel($environment->review_level); ?>
                    <div class="mt-2 max-w-[640px] rounded-[10px] border px-3.5 py-2.5"
                         style="border-color:<?php echo e($nivelRev['color']); ?>; background:<?php echo e($nivelRev['fondo']); ?>;">
                        <div class="flex flex-wrap items-center gap-2">
                            <span class="rounded-full px-2 py-px text-[10.5px] font-bold"
                                  style="color:#fff; background:<?php echo e($nivelRev['color']); ?>;">
                                <?php echo e(mb_strtoupper($nivelRev['etiqueta'])); ?>

                            </span>
                            <span class="text-[12.5px] font-bold" style="color:var(--text-strong);">Pendiente de revisar</span>
                        </div>

                        <div class="mt-1 whitespace-pre-line text-[13px] leading-relaxed" style="color:var(--text-body);"><?php echo e($environment->review_note); ?></div>

                        
                        <div class="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11.5px]" style="color:var(--text-muted);">
                            <span>
                                Anotado por <?php echo e($environment->reviewFlaggedBy?->name ?? 'alguien que ya no está'); ?>

                                · <?php echo e($environment->review_flagged_at->diffForHumans()); ?>

                            </span>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.review')): ?>
                                <span style="color:var(--border-default);">·</span>
                                <button type="button" wire:click="abrirRevision"
                                        class="font-semibold" style="color:var(--text-link);">
                                    Editar o dar por revisado
                                </button>
                            <?php endif; ?>
                        </div>
                    </div>
                <?php else: ?>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.review')): ?>
                    
                    <div class="mt-2">
                        <button type="button" wire:click="abrirRevision"
                                class="text-[12px] font-semibold" style="color:var(--text-link);">
                            Marcar para revisar…
                        </button>
                    </div>
                    <?php endif; ?>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>

            <div class="flex flex-none flex-col items-end gap-2">
                <div class="flex flex-wrap justify-end gap-2">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($this->puedeSincronizar): ?>
                        <button type="button" wire:click="sincronizar"
                                wire:loading.attr="disabled" wire:target="sincronizar"
                                class="rounded-lg border-none px-4 py-2 text-[13px] font-semibold text-white disabled:opacity-60"
                                style="background:var(--orange-500);"
                                onmouseover="this.style.background='var(--orange-600)'"
                                onmouseout="this.style.background='var(--orange-500)'">
                            <span wire:loading.remove wire:target="sincronizar">Sincronizar ahora</span>
                            <span wire:loading wire:target="sincronizar">Sincronizando…</span>
                        </button>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.edit')): ?>
                        <a href="<?php echo e(route('environments.edit', $environment)); ?>" wire:navigate
                           class="rounded-lg border px-3.5 py-2 text-[13px] font-semibold"
                           style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
                            Editar
                        </a>

                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->active): ?>
                            <button type="button" wire:click="abrirCambioDeEstado"
                                    class="rounded-lg border px-3.5 py-2 text-[13px] font-semibold"
                                    style="border-color:var(--border-default); background:var(--surface-page); color:var(--danger-500);">
                                Apagar…
                            </button>
                        <?php else: ?>
                            <button type="button" wire:click="abrirCambioDeEstado"
                                    class="rounded-lg border-none px-4 py-2 text-[13px] font-semibold text-white"
                                    style="background:var(--success-500);">
                                Encender…
                            </button>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php endif; ?>

                    
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.destroy')): ?>
                        <?php $noSePuedeBorrar = $this->motivosParaNoBorrar !== []; ?>
                        <button type="button" wire:click="abrirBorrar"
                                title="<?php echo e($noSePuedeBorrar ? 'No se puede borrar: ' . implode(', ', $this->motivosParaNoBorrar) . '. Pulsa para ver qué hacer.' : 'Borrar este entorno: está limpio'); ?>"
                                class="inline-flex items-center gap-1.5 rounded-lg border px-3.5 py-2 text-[13px] font-semibold"
                                style="border-color:<?php echo e($noSePuedeBorrar ? 'var(--border-default)' : 'var(--danger-500)'); ?>;
                                       background:var(--surface-page);
                                       color:<?php echo e($noSePuedeBorrar ? 'var(--text-subtle)' : 'var(--danger-500)'); ?>;">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($noSePuedeBorrar): ?>
                                <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" class="flex-none">
                                    <rect width="18" height="11" x="3" y="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>
                                </svg>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            Borrar
                        </button>
                    <?php endif; ?>
                </div>

                
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.edit')): ?>
                    <div class="max-w-[280px] text-right text-[11.5px]" style="color:var(--text-subtle);">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(trim((string) $environment->moodletoken) !== ''): ?>
                            Token de servicios web de su Moodle guardado ·
                            <button type="button" wire:click="abrirConexionMoodle" class="font-semibold hover:underline" style="color:var(--text-link);">Reemplazar</button>
                        <?php else: ?>
                            Sin token de servicios web guardado: no se puede sincronizar desde aquí.
                            <button type="button" wire:click="abrirConexionMoodle" class="font-semibold hover:underline" style="color:var(--text-link);">Conectar token</button>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </section>

    
    <div class="grid grid-cols-1 items-start gap-3.5 lg:grid-cols-[minmax(0,1.9fr)_minmax(0,1.1fr)]">

        
        <div class="flex min-w-0 flex-col gap-3.5">

            
            <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;">Servicio</h2>
                    <div class="mt-0.5 text-[12px]" style="color:var(--text-muted);">
                        Qué tiene contratado este sitio y qué está pidiendo de verdad.
                    </div>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($licencia): ?>
                    <div class="flex flex-wrap items-center gap-3 border-t px-5 py-2.5" style="border-color:var(--divider);">
                        <div class="min-w-0 flex-1">
                            <div class="flex flex-wrap items-center gap-2">
                                <a href="<?php echo e(route('license_tokens.show', $licencia)); ?>" wire:navigate
                                   class="text-[13px] font-semibold hover:underline" style="color:var(--text-strong);">
                                    <?php echo e($licencia->name); ?>

                                </a>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($licencia->active): ?>
                                    <span class="rounded-full px-2 py-px text-[10.5px] font-semibold"
                                          style="color:var(--success-500); background:var(--success-50);">Activa</span>
                                <?php else: ?>
                                    
                                    <span class="rounded-full px-2 py-px text-[10.5px] font-semibold"
                                          style="color:var(--danger-500); background:var(--danger-50);">Desactivada</span>
                                <?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($licencia->start_at || $licencia->end_at): ?>
                                    <span class="text-[12px]" style="color:var(--text-muted);">
                                        <?php echo e($licencia->start_at?->format('d/m/Y') ?? '—'); ?> – <?php echo e($licencia->end_at?->format('d/m/Y') ?? '—'); ?>

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

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($productos->isNotEmpty()): ?>
                                <div class="mt-1.5 flex flex-wrap gap-1.5">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $productos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $producto): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <span class="rounded-full border px-2.5 py-px text-[11.5px] font-semibold"
                                              style="border-color:var(--border-default); color:var(--text-body);">
                                            <?php echo e($producto->name); ?>

                                        </span>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </div>
                            <?php else: ?>
                                <div class="mt-1.5 text-[12px]" style="color:var(--text-muted);">
                                    Su licencia no incluye ningún producto: llame lo que llame, no recibe nada.
                                </div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    </div>
                <?php else: ?>
                    <div class="flex items-center gap-3 border-t px-5 py-3.5" style="border-color:var(--divider);">
                        <div class="flex h-[34px] w-[34px] flex-none items-center justify-center rounded-full"
                             style="background:var(--warning-50);">
                            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--warning-500)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2l-2 2"/><path d="m15.5 7.5 3 3L22 7l-3-3z"/><path d="M11.39 11.61a5.5 5.5 0 1 0 1 1z"/></svg>
                        </div>
                        <div class="text-[12.5px] leading-relaxed" style="color:var(--text-body);">
                            <strong class="font-semibold">Sin licencia asociada:</strong> aunque su Moodle llame,
                            no recibirá ningún producto.
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->client): ?>
                                <a href="<?php echo e(route('license_tokens.associate-license', [$environment->client, $environment])); ?>"
                                   class="font-semibold hover:underline" style="color:var(--text-link);">Asociar una licencia</a>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                
                <div class="border-t px-5 pb-2 pt-3" style="border-color:var(--divider);">
                    <div class="text-[11px] font-semibold uppercase tracking-[0.06em]" style="color:var(--text-muted);">
                        Lo que dice el registro de la API
                    </div>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($peticiones->isNotEmpty()): ?>
                    
                    <div class="grid grid-cols-[minmax(0,0.9fr)_minmax(0,0.8fr)_minmax(0,1.5fr)_minmax(0,1.1fr)] gap-3 px-5 pb-1.5 pt-1 text-[10.5px] font-semibold uppercase tracking-[0.05em]"
                         style="color:var(--text-subtle);">
                        <span>Acción</span><span>Última</span><span>Cómo fue</span><span>Registradas</span>
                    </div>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $peticiones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fila): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="grid grid-cols-[minmax(0,0.9fr)_minmax(0,0.8fr)_minmax(0,1.5fr)_minmax(0,1.1fr)] items-center gap-3 border-t px-5 py-[7px] text-[12.5px]"
                             style="border-color:var(--divider);">
                            <span class="truncate font-mono text-[12px] font-semibold" style="color:var(--text-strong);"
                                  <?php if($fila['plugin']): ?> title="La pide <?php echo e($fila['plugin']); ?>" <?php endif; ?>>
                                <?php echo e($fila['accion']); ?>

                            </span>
                            <span class="text-[12px]" style="color:var(--text-muted);"
                                  title="<?php echo e($fila['cuando']?->format('d/m/Y H:i:s')); ?>">
                                <?php echo e($fila['cuando']?->diffForHumans() ?? '—'); ?>

                            </span>
                            <span class="min-w-0">
                                <span class="inline-block h-[7px] w-[7px] flex-none rounded-full align-middle"
                                      style="background:<?php echo e($coloresDeSeveridad[$fila['severidad']] ?? 'var(--text-muted)'); ?>;"></span>
                                <span class="text-[12px] <?php echo e($fila['severidad'] === 'error' ? 'font-semibold' : ''); ?>"
                                      style="color:<?php echo e($fila['severidad'] === 'error' ? 'var(--danger-500)' : 'var(--text-body)'); ?>;"
                                      <?php if($fila['explicacion']): ?> title="<?php echo e($fila['explicacion']); ?>" <?php endif; ?>>
                                    <?php echo e($etiquetasDeSeveridad[$fila['severidad']] ?? $fila['severidad']); ?>

                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($fila['severidad'] === 'ok'): ?>
                                        · <?php echo e($fila['duracion']); ?> ms
                                    <?php elseif($fila['codigo'] !== 0): ?>
                                        · <?php echo e($fila['codigo']); ?>

                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </span>
                            </span>
                            
                            <span class="text-[11.5px]" style="color:var(--text-subtle);">
                                <?php echo e($fila['total']); ?>

                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($fila['erroresPendientes'] > 0): ?>
                                    · <span class="font-semibold" style="color:var(--danger-500);"><?php echo e($fila['erroresPendientes']); ?> con error</span>
                                <?php elseif($fila['desglose']['error'] > 0): ?>
                                    
                                    · <span style="color:var(--text-subtle);"><?php echo e($fila['desglose']['error']); ?> con error, vista(s)</span>
                                <?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($fila['desglose']['sin_contenido'] > 0): ?>
                                    · <?php echo e($fila['desglose']['sin_contenido']); ?> sin contenido
                                <?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($fila['desglose']['negocio'] > 0): ?>
                                    · <?php echo e($fila['desglose']['negocio']); ?> no contratado
                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            </span>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <div class="flex flex-wrap items-center justify-between gap-3 border-t px-5 py-2.5 text-[12px]"
                         style="border-color:var(--divider); color:var(--text-subtle);">
                        <span>
                            <?php echo e($resumenApi['total']); ?> petición(es) en <?php echo e($resumenApi['dias']); ?> días ·
                            <?php echo e($resumenApi['error']); ?> con error
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($resumenApi['error'] > 0 && $resumenApi['ultimoError']): ?>
                                , el último <?php echo e(\Illuminate\Support\Carbon::parse($resumenApi['ultimoError'])->diffForHumans()); ?>

                            <?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($resumenApi['sinContenido'] > 0): ?>
                                · <?php echo e($resumenApi['sinContenido']); ?> sin contenido publicado (no es un fallo)
                            <?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($resumenApi['negocio'] > 0): ?>
                                · <?php echo e($resumenApi['negocio']); ?> no contratado
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </span>
                        
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.api-logs.index')): ?>
                            <a href="<?php echo e(route('api-logs.index', ['environmentId' => $environment->id])); ?>" wire:navigate
                               class="font-semibold hover:underline" style="color:var(--text-link);">Ver todas en el visor →</a>
                        <?php endif; ?>
                    </div>
                <?php else: ?>
                    <div class="px-5 pb-4 pt-1.5 text-[12.5px] leading-relaxed" style="color:var(--text-muted);">
                        Su Moodle no ha llamado nunca. Comprueba que el plugin está
                        <strong class="font-semibold">instalado y configurado</strong> con el dominio exacto
                        <span class="font-mono text-[11.5px]"><?php echo e($environment->domain); ?></span>
                        y con el token de su licencia.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </section>

            
            <section class="overflow-hidden rounded-xl border"
                     style="background:var(--surface-card); border-color:var(--border-subtle);">
                <div class="flex items-baseline justify-between gap-4 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;">Su Moodle por dentro</h2>
                    <div class="flex flex-none items-baseline gap-3">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($datos?->updated_at): ?>
                            
                            <span class="text-[11.5px]" style="color:var(--text-subtle);"
                                  title="Último envío recibido: <?php echo e($datos->updated_at->format('d/m/Y H:i')); ?>">
                                foto del <?php echo e($datos->updated_at->format('d/m/Y')); ?>

                            </span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.datas.environment')): ?>
                            <a href="<?php echo e(route('environments.uso', $environment)); ?>" wire:navigate
                               class="text-[12.5px] font-semibold hover:underline" style="color:var(--text-link);">Uso y evolución →</a>
                        <?php endif; ?>
                    </div>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($datos): ?>
                    <div class="grid grid-cols-2 border-t sm:grid-cols-4" style="border-color:var(--divider);">
                        <div class="border-r px-5 py-3" style="border-color:var(--divider);">
                            <div class="text-[11px] font-semibold uppercase tracking-[0.05em]" style="color:var(--text-muted);">Usuarios</div>
                            <div class="mt-0.5" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700; color:var(--text-strong);">
                                <?php echo e(number_format((int) $datos->users, 0, ',', '.')); ?>

                            </div>
                            <div class="text-[11px]" style="color:var(--text-subtle);">
                                <?php echo e(number_format((int) $datos->activeusers, 0, ',', '.')); ?> activos
                            </div>
                        </div>
                        <div class="border-r px-5 py-3" style="border-color:var(--divider);">
                            <div class="text-[11px] font-semibold uppercase tracking-[0.05em]" style="color:var(--text-muted);">Cursos</div>
                            <div class="mt-0.5" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700; color:var(--text-strong);">
                                <?php echo e(number_format((int) $datos->courses, 0, ',', '.')); ?>

                            </div>
                            <div class="text-[11px]" style="color:var(--text-subtle);">
                                <?php echo e(number_format((float) $datos->participantnumberaverage, 0, ',', '.')); ?> participantes/curso
                            </div>
                        </div>
                        <div class="border-r px-5 py-3" style="border-color:var(--divider);">
                            <div class="text-[11px] font-semibold uppercase tracking-[0.05em]" style="color:var(--text-muted);">Matrículas</div>
                            <div class="mt-0.5" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700; color:var(--text-strong);">
                                <?php echo e(number_format((int) $datos->enrolments, 0, ',', '.')); ?>

                            </div>
                            <div class="text-[11px]" style="color:var(--text-subtle);">del último sync</div>
                        </div>
                        
                        <div class="px-5 py-3">
                            <div class="text-[11px] font-semibold uppercase tracking-[0.05em]" style="color:var(--text-muted);">App móvil</div>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(in_array('mobileservicesenabled', $clavesDelUltimoEnvio, true)): ?>
                                <div class="mt-0.5" style="font-family:'Plus Jakarta Sans',sans-serif; font-size:20px; font-weight:700; color:var(--text-strong);">
                                    <?php echo e($datos->mobileservicesenabled ? 'Sí' : 'No'); ?>

                                </div>
                                <div class="text-[11px]" style="color:var(--text-subtle);">
                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(in_array('registereduserdevices', $clavesDelUltimoEnvio, true)): ?>
                                        <?php echo e(number_format((int) $datos->registereduserdevices, 0, ',', '.')); ?> dispositivos
                                    <?php else: ?>
                                        no manda los dispositivos
                                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                </div>
                            <?php else: ?>
                                <div class="mt-0.5 text-[13px] font-semibold" style="color:var(--text-muted);">No lo dice</div>
                                <div class="text-[11px]" style="color:var(--text-subtle);">no viene en su envío</div>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    </div>

                    
                    
                    <div class="flex flex-wrap items-center justify-between gap-4 border-t px-5 py-2.5 text-[12px]"
                         style="border-color:var(--divider); color:var(--text-muted);">
                        
                        <span>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($contactoDelSitio['nombre']): ?>
                                Admin del sitio:
                                <strong class="font-semibold" style="color:var(--text-body);"><?php echo e($contactoDelSitio['nombre']); ?></strong>
                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($contactoDelSitio['email']): ?>
                                    · <a href="mailto:<?php echo e($contactoDelSitio['email']); ?>" class="hover:underline" style="color:var(--text-link);"><?php echo e($contactoDelSitio['email']); ?></a>
                                <?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($contactoDelSitio['telefono']): ?>
                                    · <?php echo e($contactoDelSitio['telefono']); ?>

                                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                            <?php elseif($contactoDelSitio['email']): ?>
                                
                                Contacto del sitio:
                                <a href="mailto:<?php echo e($contactoDelSitio['email']); ?>" class="font-semibold hover:underline" style="color:var(--text-link);"><?php echo e($contactoDelSitio['email']); ?></a>
                                <span style="color:var(--text-subtle);">— sin nombre en el registro del sitio</span>
                            <?php else: ?>
                                <span title="Los datos de contacto salen del registro del sitio de Moodle, y solo existen si el administrador registró el sitio">
                                    Su Moodle no rellena el contacto de su administrador
                                    <span style="color:var(--text-subtle);">(está vacío en el registro del sitio)</span>
                                </span>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </span>
                        <span>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($ajustesDelSitio !== []): ?>
                                <?php echo e(implode(' · ', $ajustesDelSitio)); ?>

                            <?php else: ?>
                                <span style="color:var(--text-subtle);">su envío diario solo trae métricas de volumen</span>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </span>
                    </div>
                <?php else: ?>
                    <div class="border-t px-5 pb-4 pt-3 text-[12.5px] leading-relaxed"
                         style="border-color:var(--divider); color:var(--text-muted);">
                        Todavía no hay datos del sitio: llegan con la primera sincronización
                        —tamaño, contacto del administrador y ajustes—.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </section>
        </div>

        
        <div class="flex min-w-0 flex-col gap-3.5">

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

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($version['release'] !== null): ?>
                    <div class="mt-2 flex items-baseline gap-2">
                        <span style="font-family:'Plus Jakarta Sans',sans-serif; font-size:26px; font-weight:700; color:var(--text-strong);"><?php echo e($version['release']); ?></span>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($version['conParches']): ?>
                            <span class="text-[15px] font-bold" style="color:var(--orange-600);"
                                  title="El sitio lleva parches por encima de la etiqueta">+</span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                    <div class="mt-2 flex flex-col gap-[3px] text-[11.5px]" style="color:var(--text-subtle);">
                        <span>versiondb <span class="font-mono" style="color:var(--text-muted);"><?php echo e($version['versiondb'] ?? 'aún no ha llegado'); ?></span></span>
                        <span>build <span class="font-mono" style="color:var(--text-muted);"><?php echo e($version['build'] ?? '—'); ?></span></span>
                    </div>
                <?php elseif($version['versiondb'] !== null): ?>
                    
                    <div class="mt-2 text-[13px] font-semibold" style="color:var(--text-muted);">No se sabe la release</div>
                    <div class="mt-1 text-[12px] leading-relaxed" style="color:var(--text-subtle);">
                        Lo único guardado es un versiondb (<span class="font-mono"><?php echo e($version['versiondb']); ?></span>),
                        que es lo que dejó el Manager antiguo. La release llegará con el próximo sync.
                    </div>
                <?php else: ?>
                    <div class="mt-2 text-[13px] font-semibold" style="color:var(--text-muted);">Versión desconocida</div>
                    <div class="mt-1 text-[12px] leading-relaxed" style="color:var(--text-subtle);">
                        No hay ni release ni versiondb guardados: los dos llegan en el sync.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                
                <?php
                    $estadoComprobacion = $datos?->availableupdatesstatus;
                    $ultimaComprobacionBuena = (int) ($datos?->availableupdatesfetch ?? 0) > 0
                        ? \Carbon\Carbon::createFromTimestamp((int) $datos->availableupdatesfetch)
                        : null;
                ?>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(in_array($estadoComprobacion, ['failed', 'disabled'], true)): ?>
                    <div class="mt-3 rounded-lg border px-3 py-2 text-[12px] leading-relaxed"
                         style="border-color:var(--warning-500); color:var(--text-body);">
                        <div class="font-semibold">
                            Comprobación de actualizaciones: <?php echo e($estadoComprobacion === 'failed' ? 'fallida' : 'desactivada'); ?>

                        </div>
                        <div class="mt-0.5" style="color:var(--text-subtle);">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($ultimaComprobacionBuena): ?>
                                Último resultado correcto: <?php echo e($ultimaComprobacionBuena->format('d/m/Y H:i')); ?>.
                                Las versiones disponibles son de esa fecha.
                            <?php else: ?>
                                No consta ningún resultado correcto: no se sabe qué versiones tiene disponibles.
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </section>

            
            <section class="rounded-xl border px-5 pb-4 pt-3.5"
                     style="background:var(--surface-card); border-color:var(--border-subtle);">
                <div class="flex items-baseline justify-between gap-3">
                    <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">Soporte</h2>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.environments.supports.index')): ?>
                        <a href="<?php echo e(route('environments.supports.index', $environment)); ?>" wire:navigate
                           class="flex-none text-[12px] font-semibold hover:underline" style="color:var(--text-link);">Ver periodos</a>
                    <?php endif; ?>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($soporte && $soporte->end_at): ?>
                    <?php $vigente = $soporte->end_at->isFuture(); ?>
                    <div class="mt-2 flex items-center gap-2">
                        <span class="h-2 w-2 flex-none rounded-full"
                              style="background:<?php echo e($vigente ? 'var(--success-500)' : 'var(--danger-500)'); ?>;"></span>
                        <span class="text-[13px] font-semibold" style="color:var(--text-strong);">
                            <?php echo e($vigente ? 'En vigor hasta el' : 'Caducó el'); ?> <?php echo e($soporte->end_at->format('d/m/Y')); ?>

                        </span>
                    </div>
                    <div class="mt-1 text-[11.5px]" style="color:var(--text-subtle);">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($vigente): ?>
                            Quedan <?php echo e((int) now()->diffInDays($soporte->end_at)); ?> días
                        <?php else: ?>
                            Terminó hace <?php echo e((int) $soporte->end_at->diffInDays(now())); ?> días
                        <?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($periodosDeSoporte > 1): ?>
                            · <?php echo e($periodosDeSoporte - 1); ?> periodo(s) anterior(es)
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                <?php else: ?>
                    <div class="mt-2 text-[12.5px] leading-relaxed" style="color:var(--text-muted);">
                        Sin soporte contratado. Si el cliente lo contrata, aquí se ve el periodo
                        en vigor y cuándo acaba.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </section>

            
            <section class="rounded-xl border px-5 pb-4 pt-3.5"
                     style="background:var(--surface-card); border-color:var(--border-subtle);">
                <div class="flex items-baseline justify-between gap-3">
                    <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">Plugins</h2>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.plugins.environment')): ?>
                        <a href="<?php echo e(route('environments.plugins.index', $environment)); ?>" wire:navigate
                           class="flex-none text-[12px] font-semibold hover:underline" style="color:var(--text-link);">Ver inventario →</a>
                    <?php endif; ?>
                </div>

                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($plugins['total'] > 0): ?>
                    <div class="mt-2 flex items-baseline gap-2">
                        <span style="font-family:'Plus Jakarta Sans',sans-serif; font-size:26px; font-weight:700; color:var(--text-strong);">
                            <?php echo e(number_format($plugins['total'], 0, ',', '.')); ?>

                        </span>
                        <span class="text-[12px]" style="color:var(--text-muted);">instalados</span>
                    </div>
                    
                    
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(($plugins['ausentes'] ?? 0) > 0): ?>
                        <a href="<?php echo e(route('environments.plugins.index', $environment)); ?>" wire:navigate
                           class="mt-1.5 inline-flex items-center gap-[7px] rounded-full px-2.5 py-0.5 text-[12px] font-semibold hover:underline"
                           style="color:var(--danger-500); background:var(--danger-50);">
                            <?php echo e($plugins['ausentes']); ?>

                            <?php echo e($plugins['ausentes'] === 1 ? 'ausente del disco' : 'ausentes del disco'); ?>

                        </a>
                    <?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($plugins['conActualizacion'] > 0): ?>
                        <div class="mt-1.5 inline-flex items-center gap-[7px] rounded-full px-2.5 py-0.5 text-[12px] font-semibold"
                             style="color:var(--warning-500); background:var(--warning-50);">
                            <?php echo e($plugins['conActualizacion']); ?> requiere(n) acción
                        </div>
                    <?php elseif(($plugins['ausentes'] ?? 0) === 0): ?>
                        <div class="mt-1.5 text-[12px]" style="color:var(--text-muted);">Ninguno requiere acción</div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <?php else: ?>
                    <div class="mt-2 text-[12.5px] leading-relaxed" style="color:var(--text-muted);">
                        Sin inventario: llega con la sincronización, y solo lo mandan las
                        versiones del plugin que lo envían.
                    </div>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </section>

            
            <section class="rounded-xl border px-5 pb-4 pt-3.5"
                     style="background:var(--surface-card); border-color:var(--border-subtle);">
                <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">Identidad técnica</h2>
                <div class="mt-2.5 flex flex-col gap-[7px] text-[12px]">
                    <div class="flex justify-between gap-3">
                        <span style="color:var(--text-muted);">key</span>
                        <span class="truncate font-mono" style="color:var(--text-body);"><?php echo e($environment->key ?: '—'); ?></span>
                    </div>
                    <div class="flex justify-between gap-3">
                        <span style="color:var(--text-muted);" title="El identificador que manda su plugin en cada petición; el último que llegó">projectid</span>
                        <span class="truncate font-mono" style="color:var(--text-body);"><?php echo e($projectid ?: '—'); ?></span>
                    </div>
                    <div class="flex justify-between gap-3">
                        <span class="cursor-help" style="color:var(--text-muted); border-bottom:1px dashed var(--border-default);"
                              title="La llave con la que la API encuentra el entorno: cambiarlo corta el servicio de este sitio hasta que su Moodle responda en el nuevo">
                            dominio (llave de la API)
                        </span>
                        <span class="truncate font-mono" style="color:var(--text-body);"><?php echo e($environment->domain); ?></span>
                    </div>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($environment->description): ?>
                        <div class="mt-1 border-t pt-2 leading-relaxed" style="border-color:var(--divider); color:var(--text-muted);">
                            <?php echo e($environment->description); ?>

                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
            </section>
        </div>
    </div>
</div><?php /**PATH /var/www/html/resources/views/livewire/environments/show.blade.php ENDPATH**/ ?>