<tr id="token-row-{{ $token->id }}" class="{{ !$token->is_active ? 'bg-red-50' : '' }}">
    <td class="px-6 py-4 whitespace-nowrap">
        <div class="text-sm font-medium {{ !$token->is_active ? 'text-gray-500' : 'text-gray-900' }}">{{ $token->user?->name ?? '-' }}</div>
        <div class="text-sm text-gray-500">{{ $token->user?->email ?? '-' }}</div>
    </td>
    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ $token->tenant?->company_name ?? '-' }}</td>
    <td class="px-6 py-4 whitespace-nowrap">
        <span class="px-2 py-1 text-xs rounded-full
            @if($token->platform === 'android') bg-green-100 text-green-800
            @elseif($token->platform === 'ios') bg-blue-100 text-blue-800
            @else bg-purple-100 text-purple-800
            @endif">
            {{ $token->platform }}
        </span>
    </td>
    <td class="px-6 py-4 whitespace-nowrap">
        <div class="text-sm text-gray-900" title="{{ $token->device_name }}">{{ $token->parsed_device_name }}</div>
        <div class="text-xs text-gray-500">
            @if($token->parsed_os_version)
                {{ $token->parsed_os_version }}
            @endif
            @if($token->app_version)
                @if($token->parsed_os_version) · @endif
                App v{{ $token->app_version }}
            @endif
        </div>
    </td>
    <td class="px-6 py-4 whitespace-nowrap">
        <div class="text-xs text-gray-500 font-mono truncate max-w-[150px]" title="{{ $token->token }}">
            {{ Str::limit($token->token, 30) }}
        </div>
    </td>
    <td class="px-6 py-4 whitespace-nowrap">
        @if($token->is_active)
            <span class="px-2 py-1 text-xs rounded-full bg-green-100 text-green-800">활성</span>
        @else
            <span class="px-2 py-1 text-xs rounded-full bg-red-100 text-red-800">비활성</span>
        @endif
        @if($token->last_error)
            <div class="text-xs text-red-500 mt-1">{{ $token->last_error }}</div>
        @endif
    </td>
    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
        {{ $token->created_at?->format('Y-m-d H:i') ?? '-' }}
    </td>
    <td class="px-6 py-4 whitespace-nowrap text-sm">
        <button hx-post="{{ route('fcm.tokens.toggle', $token->id) }}"
                hx-target="#token-row-{{ $token->id }}"
                hx-swap="outerHTML"
                class="text-blue-600 hover:text-blue-900 mr-3">
            {{ $token->is_active ? '비활성화' : '활성화' }}
        </button>
        <button hx-delete="{{ route('fcm.tokens.delete', $token->id) }}"
                hx-target="#token-row-{{ $token->id }}"
                hx-swap="outerHTML swap:1s"
                hx-confirm="토큰을 삭제하시겠습니까?"
                class="text-red-600 hover:text-red-900">
            삭제
        </button>
    </td>
</tr>
