/** * Generate a unique ID using the browser's crypto API. * Falls back to a timestamp-based ID if crypto is unavailable. */ export function generateId() { if (typeof crypto !== 'undefined' && crypto.randomUUID) { return crypto.randomUUID(); } return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`; }