<!DOCTYPE html>
<html lang="pt-BR" translate="no" class="notranslate">
  <head>
    <meta charset="UTF-8" />
    <meta name="google" content="notranslate" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>OrçamentoX - Plataforma de Orçamentos</title>
    <meta name="description" content="Conecte-se com profissionais qualificados e solicite orçamentos de forma rápida e fácil na OrçamentoX">
    <meta name="author" content="OrçamentoX" />
    <meta name="keywords" content="orçamento, profissionais, serviços, reformas, construção, manutenção" />
    
    <!-- Favicon -->
    <link rel="icon" type="image/png" href="/favicon32.png">
    <link rel="icon" type="image/png" sizes="192x192" href="/icons/app-icon-192.png">
    <link rel="apple-touch-icon" href="/icons/app-icon-192.png">
    <link rel="shortcut icon" href="/favicon32.png" type="image/png">
    <!-- Ensure browsers that force /favicon.ico get the new image -->
    <link rel="icon" href="/favicon.ico" type="image/png">
    
    <!-- PWA Meta Tags -->
    <meta name="theme-color" content="#3B82F6">
    <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="default">
    <meta name="apple-mobile-web-app-title" content="OrçamentoX">
    <link rel="manifest" href="/manifest.json">

    <!-- Open Graph / Facebook -->
    
    
    <meta property="og:type" content="website" />
    <meta property="og:image" content="https://storage.googleapis.com/gpt-engineer-file-uploads/4uf3J2pPQjeh7MMd1Ev23bZRxeQ2/social-images/social-1772632615664-imagem_2026-03-04_105655620.webp">
    <meta property="og:site_name" content="OrçamentoX" />

    <!-- Twitter -->
    <meta name="twitter:card" content="summary_large_image" />
    
    
    <meta name="twitter:image" content="https://storage.googleapis.com/gpt-engineer-file-uploads/4uf3J2pPQjeh7MMd1Ev23bZRxeQ2/social-images/social-1772632615664-imagem_2026-03-04_105655620.webp">
    <meta property="og:title" content="OrçamentoX - Plataforma de Orçamentos">

    <!-- Google Ads — Global Site Tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-1696141962"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'AW-1696141962');
    </script>
  <meta name="twitter:title" content="OrçamentoX - Plataforma de Orçamentos">
  <meta property="og:description" content="Conecte-se com profissionais qualificados e solicite orçamentos de forma rápida e fácil na OrçamentoX">
  <meta name="twitter:description" content="Conecte-se com profissionais qualificados e solicite orçamentos de forma rápida e fácil na OrçamentoX">
  <script type="module" crossorigin src="/assets/index-Cd-xYBWT.js"></script>
  <link rel="stylesheet" crossorigin href="/assets/index-DYtYy7kd.css">
</head>

  <body>
    <div id="root"></div>
    <script>
      (function(){
        try {
          var hash = window.location.hash || '';
          if (hash.indexOf('access_token') !== -1) {
            var params = new URLSearchParams(hash.slice(1));
            var type = (params.get('type') || '').toLowerCase();
            var target = '/login';
            if (type === 'signup') target = '/confirmacao-email';
            else if (type === 'recovery') target = '/redefinir-senha';
            if (window.location.pathname !== target) {
              window.location.replace(target + hash);
              return;
            }
          }
          if (hash.indexOf('error=') !== -1) {
            if (!/\/login$/.test(window.location.pathname)) {
              window.location.replace('/login' + hash);
              return;
            }
          }
        } catch(e) {}
      })();
    </script>
    <script>
      (function(){
        /* ── Shared update banner (used by build check, SW, and chunk errors) ── */
        window.__oxShowUpdateBanner = function() {
          if (document.getElementById('ox-update-banner')) return;
          var bar = document.createElement('div');
          bar.id = 'ox-update-banner';
          bar.style.cssText = 'position:fixed;top:0;left:0;right:0;z-index:100001;display:flex;align-items:center;justify-content:center;gap:12px;padding:10px 16px;background:#1e40af;color:#fff;font:600 14px/1 Inter,system-ui,-apple-system,Segoe UI,sans-serif;box-shadow:0 4px 20px rgba(0,0,0,.25)';
          var span = document.createElement('span');
          span.textContent = 'Nova versão disponível';
          var btn = document.createElement('button');
          btn.textContent = 'Atualizar';
          btn.style.cssText = 'padding:6px 16px;border:0;border-radius:9999px;background:#fff;color:#1e40af;font:700 13px/1 Inter,system-ui,sans-serif;cursor:pointer';
          btn.onclick = function(){ location.reload(); };
          bar.appendChild(span);
          bar.appendChild(btn);
          document.body.appendChild(bar);
        };
        window.addEventListener('ox-update-needed', window.__oxShowUpdateBanner);
      })();
    </script>
    <script>
      (function(){
        var isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1';
        if (isLocalhost) return;
        var STORAGE_KEY = 'ox_build';

        var checkBuild = function(showBanner) {
          try {
            fetch('/build.json', { cache: 'no-store' })
              .then(function(r){ return r && r.ok ? r.json() : null; })
              .then(function(j){
                var build = j && j.build ? String(j.build) : '';
                if (!build) return;
                var current = '';
                try { current = localStorage.getItem(STORAGE_KEY) || ''; } catch (e) {}
                if (!current || current !== build) {
                  try { localStorage.setItem(STORAGE_KEY, build); } catch (e) {}
                  if (showBanner && current) {
                    window.__oxShowUpdateBanner && window.__oxShowUpdateBanner();
                  }
                }
              })
              .catch(function(){});
          } catch (e) {}
        };

        checkBuild(false);

        var bgCheck = function(){ checkBuild(true); };
        setInterval(bgCheck, 30 * 60 * 1000);
        window.addEventListener('focus', bgCheck);
        document.addEventListener('visibilitychange', function(){
          if (document.visibilityState === 'visible') bgCheck();
        });
      })();
    </script>
    
    <!-- Service Worker Registration -->
    <script>
      (function(){
        var isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1';
        if ('serviceWorker' in navigator && !isLocalhost) {
          var init = function() {
            // Marca se já existia um controller no momento do load.
            // Se NÃO existia, é a primeira visita/instalação do SW — não mostrar banner.
            var hadControllerAtLoad = !!navigator.serviceWorker.controller;

            navigator.serviceWorker.register('/sw.js').then(function(registration) {

              registration.addEventListener('updatefound', function() {
                var newWorker = registration.installing;
                if (!newWorker) return;
                newWorker.addEventListener('statechange', function() {
                  if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
                    newWorker.postMessage({ type: 'SKIP_WAITING' });
                  }
                });
              });

              navigator.serviceWorker.addEventListener('controllerchange', function() {
                // Só mostra o banner se a página já estava sendo controlada por um SW
                // antes desta troca. Em primeira instalação (aba nova/anônima),
                // hadControllerAtLoad é false e não há motivo para avisar.
                if (!hadControllerAtLoad) return;
                window.__oxShowUpdateBanner && window.__oxShowUpdateBanner();
              });

              if (registration.waiting && navigator.serviceWorker.controller) {
                registration.waiting.postMessage({ type: 'SKIP_WAITING' });
              }

              var safeUpdate = function() { try { registration.update(); } catch (e) {} };
              safeUpdate();
              setInterval(safeUpdate, 30 * 60 * 1000);
              window.addEventListener('focus', safeUpdate);
              window.addEventListener('pageshow', safeUpdate);
              document.addEventListener('visibilitychange', function() {
                if (document.visibilityState === 'visible') safeUpdate();
              });
            }).catch(function(){});
          };
          if (document.readyState === 'complete') init();
          else window.addEventListener('load', init);
        } else if ('serviceWorker' in navigator && isLocalhost) {
          navigator.serviceWorker.getRegistrations().then(function(registrations) {
            registrations.forEach(function(reg) { reg.unregister(); });
          });
        }
      })();
    </script>

    <script>
      (function(){
        var isStandalone = false;
        try {
          isStandalone = (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches) || (window.navigator && window.navigator.standalone);
        } catch (e) {}
        if (isStandalone) return;

        var isNativeApp = false;
        try { isNativeApp = window.Capacitor && window.Capacitor.isNativePlatform && window.Capacitor.isNativePlatform(); } catch(e){}
        if (isNativeApp) return;

        var deferredPrompt = null;
        var btn = null;
        var overlay = null;

        var isMobileDevice = function() {
          try {
            if (navigator.userAgentData && typeof navigator.userAgentData.mobile === 'boolean') {
              if (navigator.userAgentData.mobile) return true;
            }
            var ua = navigator.userAgent || '';
            if (/Android|iPhone|iPod/i.test(ua)) return true;
            // iPadOS 13+ reports as Macintosh; distinguish by touch points
            if (/iPad/i.test(ua)) return true;
            if (/Macintosh/i.test(ua) && (navigator.maxTouchPoints || 0) > 1) return true;
          } catch (e) {}
          return false;
        };

        // Bloqueia instalação em desktop: só Android/iOS podem instalar o PWA.
        if (!isMobileDevice()) {
          window.addEventListener('beforeinstallprompt', function(e) {
            try { e.preventDefault(); } catch (_) {}
          });
          return;
        }

        var hideOverlay = function() {
          try { if (overlay && overlay.parentNode) overlay.parentNode.removeChild(overlay); } catch (e) {}
          overlay = null;
        };

        var showHelp = function() {
          if (overlay) return;
          overlay = document.createElement('div');
          overlay.style.position = 'fixed';
          overlay.style.left = '0';
          overlay.style.top = '0';
          overlay.style.right = '0';
          overlay.style.bottom = '0';
          overlay.style.zIndex = '100000';
          overlay.style.background = 'rgba(0,0,0,.45)';
          overlay.addEventListener('click', hideOverlay);

          var box = document.createElement('div');
          box.style.position = 'absolute';
          box.style.left = '50%';
          box.style.top = '50%';
          box.style.transform = 'translate(-50%, -50%)';
          box.style.maxWidth = '320px';
          box.style.width = 'calc(100% - 32px)';
          box.style.background = '#fff';
          box.style.borderRadius = '16px';
          box.style.padding = '14px 14px';
          box.style.boxShadow = '0 20px 50px rgba(0,0,0,.35)';
          box.addEventListener('click', function(e){ try { e.stopPropagation(); } catch(_) {} });

          var title = document.createElement('div');
          title.textContent = 'Como instalar';
          title.style.font = '800 16px Inter, system-ui, -apple-system, Segoe UI, sans-serif';
          title.style.marginBottom = '8px';

          var txt = document.createElement('div');
          txt.style.font = '500 14px/1.4 Inter, system-ui, -apple-system, Segoe UI, sans-serif';
          txt.style.color = '#0f172a';
          var ua = (navigator.userAgent || '').toLowerCase();
          var isIOS = /iphone|ipad|ipod/.test(ua);
          if (isIOS) {
            txt.innerHTML = 'No iPhone/iPad: toque em <b>Compartilhar</b> e depois em <b>Adicionar à Tela de Início</b>.';
          } else {
            txt.innerHTML = 'No Android (Chrome): toque no menu <b>⋮</b> e depois em <b>Instalar app</b> / <b>Adicionar à tela inicial</b>.';
          }

          var close = document.createElement('button');
          close.type = 'button';
          close.textContent = 'Fechar';
          close.style.marginTop = '12px';
          close.style.width = '100%';
          close.style.padding = '10px 12px';
          close.style.borderRadius = '12px';
          close.style.border = '1px solid #e2e8f0';
          close.style.background = '#fff';
          close.style.font = '700 14px Inter, system-ui, -apple-system, Segoe UI, sans-serif';
          close.addEventListener('click', hideOverlay);

          box.appendChild(title);
          box.appendChild(txt);
          box.appendChild(close);
          overlay.appendChild(box);
          document.body.appendChild(overlay);
        };

        var INSTALL_KEY = 'ox_pwa_installed';

        var isAlreadyInstalled = function() {
          try { return localStorage.getItem(INSTALL_KEY) === '1'; } catch(e) { return false; }
        };

        var showBtn = function() {
          if (btn) return;
          if (!isMobileDevice()) return;
          if (isAlreadyInstalled()) return;
          btn = document.createElement('button');
          btn.id = 'ox-install';
          btn.type = 'button';
          btn.textContent = 'Instalar app';
          btn.style.position = 'fixed';
          btn.style.left = '50%';
          btn.style.bottom = '18px';
          btn.style.transform = 'translateX(-50%)';
          btn.style.zIndex = '99999';
          btn.style.padding = '12px 16px';
          btn.style.borderRadius = '9999px';
          btn.style.border = '0';
          btn.style.background = '#2563eb';
          btn.style.color = '#fff';
          btn.style.font = '700 14px Inter, system-ui, -apple-system, Segoe UI, sans-serif';
          btn.style.boxShadow = '0 10px 30px rgba(0,0,0,.25)';
          btn.addEventListener('click', function() {
            try {
              if (!deferredPrompt) {
                showHelp();
                return;
              }
              btn.disabled = true;
              deferredPrompt.prompt();
              deferredPrompt.userChoice.then(function() {
                try { deferredPrompt = null; } catch (e) {}
                try { if (btn && btn.parentNode) btn.parentNode.removeChild(btn); } catch (e) {}
                btn = null;
              });
            } catch (e) {}
          });
          document.body.appendChild(btn);
        };

        window.addEventListener('beforeinstallprompt', function(e) {
          try {
            e.preventDefault();
            deferredPrompt = e;
            showBtn();
          } catch (err) {}
        });

        window.addEventListener('appinstalled', function() {
          try { localStorage.setItem(INSTALL_KEY, '1'); } catch (e) {}
          try { deferredPrompt = null; } catch (e) {}
          try { if (btn && btn.parentNode) btn.parentNode.removeChild(btn); } catch (e) {}
          btn = null;
        });

        var initInstall = function() {
          if (isAlreadyInstalled()) return;
          if (navigator.getInstalledRelatedApps) {
            navigator.getInstalledRelatedApps().then(function(apps) {
              if (apps && apps.length > 0) {
                try { localStorage.setItem(INSTALL_KEY, '1'); } catch(e) {}
                return;
              }
              showBtn();
            }).catch(function() { showBtn(); });
          } else {
            showBtn();
          }
        };

        if (document.readyState === 'complete') initInstall();
        else window.addEventListener('load', initInstall);
      })();
    </script>
  </body>
</html>
