<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } ?> <table class="data-table"> <thead> <tr><th>User</th><th>Device Token</th><th>IP Address</th><th>User Agent</th><th>First Seen</th><th>Last Seen</th><th>Action</th></tr> </thead> <tbody><?php if (empty($devices)): ?> <tr><td colspan="7" style="text-align:center;padding:30px;color:var(--text-dim)">No device bindings found.</td></tr><?php else: foreach ($devices as $d): $lastSeen = strtotime($d['last_seen'] ?? ''); $isStale = $lastSeen && ($now - $lastSeen) > 86400 * 7; ?> <tr> <td style="font-weight:700"><?= UI::e($d['username'] ?? 'User #' . ($d['user_id'] ?? '')) ?></td> <td style="font-family:var(--font-mono);font-size:10px;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"><?= UI::e(substr($d['device_token'] ?? '', 0, 16) . '...') ?></td> <td style="font-family:var(--font-mono);font-size:11px"><?= UI::e($d['ip_address'] ?? '') ?></td> <td style="font-size:10px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-dim)"><?= UI::e($d['user_agent'] ?? '') ?></td> <td style="font-size:11px;color:var(--text-dim)"><?= UI::e($d['created_at'] ?? '') ?></td> <td><span class="badge badge-<?= $isStale ? 'warning' : 'success' ?>"><?= UI::e($d['last_seen'] ?? '') ?></span></td> <td> <form method="POST" style="display:inline" data-confirm="Revoke this device binding?"><?= CSRF::field() ?> <input type="hidden" name="action" value="revoke_device"> <input type="hidden" name="device_id" value="<?= (int)$d['id'] ?>"> <button type="submit" class="btn btn-danger btn-sm">Revoke</button> </form> </td> </tr><?php endforeach; endif; ?> </tbody> </table>