// Token masking — show masked version with reveal toggle
(function() {
    document.querySelectorAll('.token-masked').forEach(function(el) {
        var full = el.dataset.token || '';
        var masked = full.substring(0, 7) + '•••••••' + full.substring(full.length - 4);
        el.textContent = masked;
        el.title = 'Click to reveal full token';
        el.style.cursor = 'pointer';
        el.style.userSelect = 'none';
        el.addEventListener('click', function() {
            el.textContent = full;
            el.style.userSelect = 'text';
            el.title = 'Click to copy';
            el.style.cursor = 'text';
        });
    });
})();

// Insert zero-width space before @ in email addresses for clean line breaks
document.querySelectorAll('.text-trunc').forEach(function(el) {
    var text = el.textContent;
    if (text.indexOf('@') !== -1) {
        el.textContent = text.replace(/@/g, '\u200B@');
    }
});
