console.log('Mermaid loaded successfully');
      initMermaid();
    };
    script.onerror = function() {
      console.error('Failed to load mermaid script');
    };
    document.head.appendChild(script);
  }
  
  // Secondary initialization after a delay to catch any missed diagrams
  setTimeout(initMermaid, 1000);
});

// Backup initialization on full page load
window.addEventListener('load', function() {
  if (typeof window.mermaid !== 'undefined') {
    console.log('Window loaded, reinitializing mermai