<div class="card">
    <div class="card-header d-flex justify-content-between">
        <h5 class="mb-0"><i class="fas fa-desktop me-2"></i>Sessions for <?= e($targetUser['full_name_en']) ?></h5>
        <a href="/admin/users" class="btn btn-sm btn-secondary">Back</a>
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-sm table-striped">
                <thead><tr><th>Started</th><th>IP</th><th>Active</th><th>Expires</th><th>Reason</th></tr></thead>
                <tbody>
                <?php foreach ($sessions as $s): ?>
                <tr>
                    <td><?= format_datetime($s['started_at']) ?></td>
                    <td><?= e($s['ip_address']) ?></td>
                    <td><?= $s['is_active'] ? '<span class="badge bg-success">Active</span>' : '<span class="badge bg-secondary">Ended</span>' ?></td>
                    <td><?= format_datetime($s['expires_at']) ?></td>
                    <td><?= e($s['terminated_reason'] ?? '-') ?></td>
                </tr>
                <?php endforeach; ?>
                <?php if (empty($sessions)): ?><tr><td colspan="5" class="text-center text-muted">No sessions found</td></tr><?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>