<!doctype html>
<html lang="en" class="theme-purple">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script>
      (function () {
        try {
          var custom = localStorage.getItem("custom-theme");
          var mode = localStorage.getItem("theme");
          var root = document.documentElement;
          root.classList.remove("theme-indigo", "theme-purple", "theme-enterprise");
          if (custom === "indigo") root.classList.add("theme-indigo");
          else if (custom === "enterprise") root.classList.add("theme-enterprise");
          else if (custom === "purple") root.classList.add("theme-purple");
          else if (mode === "dark") {
            /* respect explicit dark choice */
          } else if (mode === "light") {
            /* plain light — no custom palette class */
          } else {
            root.classList.add("theme-purple");
            localStorage.setItem("custom-theme", "purple");
            localStorage.setItem("theme", "light");
            root.classList.remove("dark");
          }
        } catch (e) {
          document.documentElement.classList.add("theme-purple");
        }
      })();
    </script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
    <title>EzzyERP - Easy Billing, Smart Business</title>
    <meta name="description" content="EzzyERP - Easy Billing, Smart Business" />
    <meta name="author" content="EzzyERP" />
    
    <!-- DNS Prefetch for critical domains -->
    <link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
    
    <!-- Preload self-hosted Inter font to eliminate chain -->
    <link rel="preload" href="/fonts/inter-latin.woff2" as="font" type="font/woff2" crossorigin />
    
    <!-- PWA Meta Tags -->
    <meta name="theme-color" content="#1e40af" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="Ezzy ERP" />
    <meta name="application-name" content="Ezzy ERP" />
    <meta name="msapplication-TileColor" content="#1e40af" />
    <meta name="msapplication-tap-highlight" content="no" />
    
    <!-- PWA Icons -->
    <link rel="icon" type="image/png" href="/favicon.png" />
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
    <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon.png" />
    <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
    <link rel="manifest" href="/manifest.webmanifest" />
    
    <!-- Self-hosted Inter font -->
    <style>
      @font-face {
        font-family: 'Inter';
        font-style: normal;
        font-weight: 300 800;
        font-display: swap;
        src: url('/fonts/inter-latin.woff2') format('woff2');
        unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
      }
    </style>
    
    <!-- Non-critical fonts - loaded after page render -->
    <link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700;800&family=Sora:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;500;600&family=Playfair+Display:wght@400;700&family=Merriweather:wght@400;700&family=Lora:wght@400;700&family=Montserrat:wght@400;600;700&family=Open+Sans:wght@400;600;700&family=Raleway:wght@400;600;700&family=Poppins:wght@400;600;700&display=swap" onload="this.onload=null;this.rel='stylesheet'" />
    <noscript><link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700;800&family=Sora:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;500;600&family=Playfair+Display:wght@400;700&family=Merriweather:wght@400;700&family=Lora:wght@400;700&family=Montserrat:wght@400;600;700&family=Open+Sans:wght@400;600;700&family=Raleway:wght@400;600;700&family=Poppins:wght@400;600;700&display=swap" rel="stylesheet" /></noscript>

    <!-- Open Graph -->
    <meta property="og:title" content="EzzyERP" />
    <meta property="og:description" content="Easy Billing, Smart Business" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://app.inventoryshop.in" />
    <meta property="og:image" content="/icon-512.png" />

    <!-- Twitter -->
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:image" content="/icon-512.png" />
    <script type="module" crossorigin src="/assets/index-Z5SSi12e.js"></script>
    <link rel="modulepreload" crossorigin href="/assets/react-vendor-B72s-by0.js">
    <link rel="modulepreload" crossorigin href="/assets/pdf-vendor-ArRXecsU.js">
    <link rel="modulepreload" crossorigin href="/assets/chart-vendor-BqLBgNQT.js">
    <link rel="modulepreload" crossorigin href="/assets/ui-vendor-8n_DpqmZ.js">
    <link rel="modulepreload" crossorigin href="/assets/query-vendor-DNcAOtYW.js">
    <link rel="modulepreload" crossorigin href="/assets/supabase-vendor-CHaPRnMF.js">
    <link rel="modulepreload" crossorigin href="/assets/xlsx-vendor-CWc3kuOC.js">
    <link rel="stylesheet" crossorigin href="/assets/index-DzdtQDC5.css">
  <link rel="manifest" href="/manifest.webmanifest"></head>

  <body>
    <!-- Outside #root so React mount does not remove splash before login is ready -->
    <div id="splash-screen" style="position:fixed;inset:0;z-index:99999;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;font-family:'Segoe UI',system-ui,-apple-system,sans-serif;background:#F5F7FA;">
        <!-- Logo Container -->
        <div style="display:flex;flex-direction:column;align-items:center;gap:24px;">
          <!-- Icon -->
          <div style="width:80px;height:80px;background:#2563EB;border-radius:16px;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(37,99,235,0.25);">
            <span style="color:white;font-size:40px;font-weight:600;letter-spacing:-2px;">E</span>
          </div>
          <!-- Brand Name -->
          <div style="text-align:center;">
            <div style="font-size:28px;font-weight:600;color:#0f172a;letter-spacing:-0.5px;">Ezzy ERP</div>
            <div style="font-size:14px;color:#64748b;margin-top:6px;font-weight:400;">Smart Inventory & Billing</div>
          </div>
          <!-- Loading Indicator -->
          <div style="margin-top:32px;display:flex;align-items:center;gap:8px;">
            <div style="width:6px;height:6px;background:#2563EB;border-radius:50%;animation:pulse 1.2s ease-in-out infinite;"></div>
            <div style="width:6px;height:6px;background:#2563EB;border-radius:50%;animation:pulse 1.2s ease-in-out 0.2s infinite;"></div>
            <div style="width:6px;height:6px;background:#2563EB;border-radius:50%;animation:pulse 1.2s ease-in-out 0.4s infinite;"></div>
          </div>
        </div>
        <!-- Footer -->
        <div style="position:absolute;bottom:32px;text-align:center;">
          <div style="font-size:11px;color:#94a3b8;">© 2025 Adtech ERP Solutions</div>
        </div>
      </div>
      <style>
        @keyframes pulse {
          0%, 100% { opacity: 0.3; transform: scale(0.8); }
          50% { opacity: 1; transform: scale(1); }
        }
        @media (prefers-color-scheme: dark) {
          #splash-screen {
            background: #0f172a !important;
          }
          #splash-screen > div > div:nth-child(2) > div:first-child {
            color: #f1f5f9 !important;
          }
          #splash-screen > div > div:nth-child(2) > div:last-child {
            color: #94a3b8 !important;
          }
        }
      </style>
      <script>
        // Dismiss splash if React mounted but auth never called hideAppBootSplash (Windows Electron).
        setTimeout(function() {
          var splash = document.getElementById('splash-screen');
          if (!splash || splash.dataset.hiding === '1') return;
          var root = document.getElementById('root');
          if (root && root.childNodes.length > 0) {
            splash.dataset.hiding = '1';
            splash.style.transition = 'opacity 0.25s ease-out';
            splash.style.opacity = '0';
            setTimeout(function() { splash.remove(); }, 280);
            return;
          }
          splash.innerHTML =
            '<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;padding:32px;text-align:center;font-family:system-ui,sans-serif;">' +
            '<div style="font-size:22px;font-weight:700;color:#1e293b;margin-bottom:8px;">EzzyERP</div>' +
            '<p style="color:#64748b;font-size:14px;max-width:320px;margin-bottom:20px;">The app is taking longer than expected to load. This can happen after an update or a brief network issue.</p>' +
            '<button type="button" onclick="location.reload()" style="padding:10px 24px;font-size:14px;font-weight:600;background:#2563eb;color:#fff;border:none;border-radius:8px;cursor:pointer;">Reload</button>' +
            '</div>';
          splash.style.display = 'flex';
          splash.style.opacity = '1';
        }, 20000);
      </script>
    </div>
    <div id="root"></div>
    <script>
      // Defensive cleanup: some hosted / service-worker-cached HTML variants
      // intermittently leak an injected inline "no-flash" theme script as a
      // BARE TEXT NODE at the top of <body> (it paints as raw JS above the app
      // and clears on refresh). Strip any stray non-whitespace text that is a
      // direct child of <body>. This only removes bare text nodes — it never
      // touches #root, the splash screen, <noscript>, or any real element.
      (function () {
        function stripStrayBodyText() {
          var body = document.body;
          if (!body) return;
          for (var node = body.firstChild; node; ) {
            var next = node.nextSibling;
            if (node.nodeType === 3 && node.nodeValue && node.nodeValue.trim() !== "") {
              body.removeChild(node);
            }
            node = next;
          }
          // The leak can also land inside #root (or its first wrapper) after an
          // in-app navigation, where the body-level sweep above never sees it.
          var scopes = [document.getElementById("root")];
          var rootEl = scopes[0];
          if (rootEl && rootEl.firstElementChild) scopes.push(rootEl.firstElementChild);
          for (var s = 0; s < scopes.length; s++) {
            var scope = scopes[s];
            if (!scope) continue;
            for (var n = scope.firstChild; n; ) {
              var nx = n.nextSibling;
              var txt = n.nodeType === 3 && n.nodeValue ? n.nodeValue.trim() : "";
              // Only strip text that is clearly leaked script source, never
              // legitimate app text rendered by React.
              if (txt && /^[!(]?function\s*\(|^\(function|documentElement/.test(txt)) {
                scope.removeChild(n);
              }
              n = nx;
            }
          }
        }
        stripStrayBodyText();
        document.addEventListener("DOMContentLoaded", stripStrayBodyText);
        // Catch the service-worker race where the leaked node appears late.
        // Kept alive for the whole session: the leak can (re)appear after in-app
        // navigation (e.g. on the POS screen) well past the old 8s window. This
        // only reacts to DIRECT <body> child changes and removes bare text nodes
        // (nodeType 3) — portals/dialogs/toasts (element nodes) are untouched, so
        // the cost is negligible.
        try {
          var observer = new MutationObserver(stripStrayBodyText);
          observer.observe(document.body, { childList: true });
          var rootNode = document.getElementById("root");
          if (rootNode) observer.observe(rootNode, { childList: true });
        } catch (e) {}
      })();
    </script>
    <noscript>
      <div style="padding:40px;text-align:center;font-family:Arial,sans-serif;background:#0f172a;color:#f1f5f9;min-height:100vh;display:flex;align-items:center;justify-content:center;">
        <div>
          <h2 style="margin-bottom:16px;">JavaScript Required</h2>
          <p style="color:#94a3b8;">Please enable JavaScript or update your browser to use this application.</p>
          <p style="margin-top:16px;font-size:14px;color:#64748b;">Recommended: Chrome 80+, Firefox 75+, Edge 80+, Safari 13+</p>
        </div>
      </div>
    </noscript>
  </body>
</html>
