/* INLINE SIGN-UP, 16 October 2026. Pricing Calculator recwheqRWgTXJUy09 (FREELANCER #47 @4:49-12:39 and
   @16:57-19:09), portal half GoGorilla Portal rec1dqTa9RdZscPmy, rulings Open Decisions Register
   rec9xmDuWgalUbdvb, mockup approved by Nicole 16 Oct 17:30: https://claude.ai/artifact/Hpqay8Yc5rQkzBMRwRdVo7

   WHAT IT IS. Sign-up stops opening the portal's /join page in a new tab. The visitor stays on
   app.gogorilla.com, gives an email where they are, and the portal emails the sign-in link straight away.
   Then "one last step" asks first name (required), last name and company (optional), with Skip. The address
   changes to portal.gogorilla.com only when the emailed link is clicked.

   FOUR PLACES USE IT (the variant prop): 'about' under the client cards on About you, 'page' on
   app.gogorilla.com/sign-up, 'lock' on the padlocked rail pages, 'strip' in the partners' Free proposals
   strip. A signed-in visitor (the portal's gg_signed_in hint cookie on .gogorilla.com) sees Open your portal
   instead, with no automatic redirect (ruling Q8).

   OFF UNLESS window.GG_FEATURE_INLINE_SIGNUP (index.html), and it renders nothing inside the portal embed or
   with a hand-off token, where the visitor is already signed in.

   THE CONTRACT WITH THE PORTAL (comment of 16 Oct on rec1dqTa9RdZscPmy):
     POST {PLATFORM_API_BASE}/api/v1/auth/magic-link
       { email, intent:'login', persona:'founders'|'investors'|'partners', source:'calculator',
         context:{ quoteSessionId } }            -> 200 { signupToken?, waitlist? } (bare or under data)
     POST {PLATFORM_API_BASE}/api/v1/auth/signup-details
       { signupToken, firstName, lastName?, company? } -> 200
   FAIL-SAFE. If the first call fails (portal flag off, CORS closed, offline), the visitor gets a real link to
   today's /join page in a new tab. Not window.open after the await: a browser blocks a pop-up that does not
   come straight from a click. */
(function () {
  const { useState, useEffect, useRef } = React;

  const PERSONA = { founder: 'founders', agency: 'partners', investor: 'investors' };
  const FALLBACK_URL = {
    founder: 'https://portal.gogorilla.com/join/founders',
    agency: 'https://portal.gogorilla.com/join/partners',
    investor: 'https://portal.gogorilla.com/join/investors'
  };
  const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
  /* 0377, 16 Nov 2026. FREELANCER #62 ask 4, calculator half, Pricing Calculator receodQ6zCEqZayEC, ruled on Open
     Decisions Register recagIWKDOA713GGz, mockup v2 approved by Nicole 13 Nov 2026 21:14 Manila
     (https://claude.ai/artifact/U5ouo1Hd23jCs6EZJGAcBc). A partner signing up ticks a required box confirming they will
     stay responsive. Email me my link stays off until it is ticked, and the tick goes to the portal with the
     magic-link request as responsiveConfirmed: true. Storing it is the portal lane's half (GoGorilla Portal
     recYgM5KAmsr0lwSG). Partners only: founders and investors see no box. */
  const CONFIRM_TEXT = "I confirm that I will stay responsive, even if I've got a job.";
  const CONFIRM_TIP_TITLE = 'Why we ask';
  const CONFIRM_TIP = 'We put forward partners who reply. If you go quiet, we are less likely to match you with work when you need it. Staying responsive, even whilst you are busy, keeps you at the front of the queue.';
  const TIP = 'An account saves your quote and unlocks every page of the platform. It is free, there is no password, and we email you a link to sign in.';

  function isOn() { try { return !!window.GG_FEATURE_INLINE_SIGNUP; } catch (e) { return false; } }
  function isEmbeddedOrHandedOff() {
    try {
      if (window.GG_EMBED) return true;
      const h = window.__ggHandoff;
      return !!(h && typeof h === 'object' && Object.keys(h).length > 0);
    } catch (e) { return false; }
  }
  function hasSignedInHint() { try { return /(?:^|;\s*)gg_signed_in=1(?:;|$)/.test(document.cookie || ''); } catch (e) { return false; } }
  function apiBase() { return String(window.PLATFORM_API_BASE || '').replace(/\/+$/, ''); }
  /* 2 Nov 2026: the investor booking page the portal's waiting list email links to. */
  const INVESTOR_CALL_URL = 'https://cal.com/team/gogorilla/book-a-call-investor';
  function isSignupPage() {
    try { return /^\/sign-up\/?$/i.test(window.location.pathname || ''); } catch (e) { return false; }
  }
  function unwrap(j) { return (j && typeof j === 'object' && j.data && typeof j.data === 'object') ? j.data : (j || {}); }

  async function startSignup(email, clientTypeId, responsiveConfirmed) {
    const base = apiBase();
    if (!base) return { ok: false };
    const body = { email: email, intent: 'login', persona: PERSONA[clientTypeId] || 'founders', source: 'calculator' };
    if (clientTypeId === 'agency' && responsiveConfirmed === true) body.responsiveConfirmed = true;
    const q = window.__ggAnonQuoteId;
    if (q) body.context = { quoteSessionId: String(q) };
    try {
      const r = await fetch(base + '/api/v1/auth/magic-link', {
        method: 'POST', credentials: 'omit',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body)
      });
      if (r.status === 429) return { ok: false, limited: true };
      if (!r.ok) return { ok: false };
      let j = null; try { j = await r.json(); } catch (e) {}
      const d = unwrap(j);
      return { ok: true, token: typeof d.signupToken === 'string' ? d.signupToken : null, waitlist: !!d.waitlist };
    } catch (e) { return { ok: false }; }
  }

  async function sendDetails(token, f) {
    const base = apiBase();
    if (!base || !token) return { ok: false };
    const body = { signupToken: token, firstName: f.firstName.slice(0, 60) };
    if (f.lastName) body.lastName = f.lastName.slice(0, 60);
    if (f.company) body.company = f.company.slice(0, 120);
    try {
      const r = await fetch(base + '/api/v1/auth/signup-details', {
        method: 'POST', credentials: 'omit',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body)
      });
      return { ok: r.ok };
    } catch (e) { return { ok: false }; }
  }

  // The Email quote form and the last step read these, so a sign-up here pre-fills them later.
  function cacheLead(email, f) {
    try { if (email && typeof window.ggCacheLeadEmail === 'function') window.ggCacheLeadEmail(email); } catch (e) {}
    try { if (f && typeof window.ggCacheLead === 'function') window.ggCacheLead(f.firstName || '', f.lastName || '', f.company || ''); } catch (e) {}
  }

  /* HOUSE COMPONENTS ONLY, 16 Oct 2026 (Nicole, 18:57): the first cut hand-styled its own cards, panel and badge. Every
     piece below is now an existing calculator component: the panel is the last step's glass form
     (convert-card convert-card--action checkout-form), the fields are checkout-form__field / checkout-form__input in a
     checkout-form__grid, the submit is btn btn--primary btn--block checkout-form__submit, the confirmation is
     checkout-form__success, the choice cards are the last step's call-pref cards with their tick, the Recommended pill
     is channel-tile__rec-tag. */
  function SignupPanel({ clientTypeId, variant, emailId }) {
    const [stage, setStage] = useState('email');
    const [email, setEmail] = useState('');
    const [busy, setBusy] = useState(false);
    const [err, setErr] = useState('');
    const [fallback, setFallback] = useState(false);
    const [token, setToken] = useState(null);
    const [waitlist, setWaitlist] = useState(false);
    const [f, setF] = useState({ firstName: '', lastName: '', company: '' });
    const [fErr, setFErr] = useState('');
    const needsConfirm = clientTypeId === 'agency';
    const [confirmed, setConfirmed] = useState(false);
    const bare = variant === 'lock' || variant === 'strip';
    // A plain function, not a component made inside render, so React keeps the same inputs between keystrokes.
    const panelClass = bare ? 'gg-isu__bare' : 'convert-card convert-card--action checkout-form gg-isu__panel';
    const frame = (children, onSubmit) => onSubmit
      ? <form className={panelClass} onSubmit={onSubmit} noValidate>{children}</form>
      : <div className={panelClass} role="status">{children}</div>;

    async function send(ev) {
      if (ev) ev.preventDefault();
      const em = email.trim();
      if (!EMAIL_RE.test(em)) { setErr('Enter a valid email address'); return; }
      if (needsConfirm && !confirmed) { setErr('Tick the box to confirm you will stay responsive'); return; }
      setErr(''); setBusy(true); setFallback(false);
      const res = await startSignup(em, clientTypeId, needsConfirm ? confirmed : undefined);
      setBusy(false);
      if (res.ok) {
        cacheLead(em, null);
        setToken(res.token); setWaitlist(res.waitlist); setStage('details');
        try { window.dispatchEvent(new CustomEvent('gg:inline-signup-sent', { detail: { variant: variant } })); } catch (e) {}
      } else if (res.limited) {
        setErr('We have sent a few links to this address already. Check your inbox, or try again in an hour.');
      } else {
        setFallback(true);
      }
    }
    async function save(ev) {
      if (ev) ev.preventDefault();
      const clean = { firstName: f.firstName.trim(), lastName: f.lastName.trim(), company: f.company.trim() };
      if (!clean.firstName) { setFErr('Add your first name, or press Skip'); return; }
      setFErr(''); setBusy(true);
      cacheLead(email.trim(), clean);
      await sendDetails(token, clean);
      setBusy(false); setStage('done');
    }
    const errLine = (t) => <div className="checkout-form__err checkout-form__err--block" role="alert">{t}</div>;

    if (stage === 'email') {
      const stack = variant === 'lock';
      const strip = variant === 'strip';
      const input = (
        <input
          id={emailId || undefined}
          aria-label="Work email"
          className="checkout-form__input"
          type="email" inputMode="email" autoComplete="email"
          placeholder={strip ? 'you@agency.com' : 'you@company.com'}
          value={email}
          onChange={(e) => { setEmail(e.target.value); if (err) setErr(''); }}
          aria-invalid={err ? 'true' : undefined}
        />
      );
      const label = strip ? null : <span className="checkout-form__label">Work email</span>;
      const btnText = busy ? 'Sending…' : <>Email me my link <span className="btn__arrow">›</span></>;
      const btnOff = busy || (needsConfirm && !confirmed);
      const tipBody = <><span style={{ display: 'block', fontWeight: 700, marginBottom: '0.3em' }}>{CONFIRM_TIP_TITLE}</span>{CONFIRM_TIP}</>;
      // The house tick tile (call-pref__card-check) over a real checkbox, so keyboards and screen readers get a
      // required checkbox. 0398, 16 Nov 2026 (mockup https://claude.ai/artifact/7E4Mvv4cyzHDKciPYBedef approved by Nicole
      // 22:46): the "i" follows the asterisk inside the sentence, so on a phone it no longer floats alone at the right
      // edge. IntentInfoTip cancels its own click (preventDefault), so opening the tip inside the label never ticks the box.
      // WAS: The "i" sits outside the label, so opening the tip never ticks the box.
      const confirmRow = needsConfirm ? (
        <div className="gg-isu__confirm">
          <label className="gg-isu__confirm-label">
            <input type="checkbox" className="gg-isu__confirm-input" checked={confirmed} required aria-required="true"
              onChange={(e) => { setConfirmed(!!e.target.checked); if (err) setErr(''); }} />
            <span className={'call-pref__card-check gg-isu__confirm-check' + (confirmed ? ' is-on' : '')} aria-hidden="true">
              {confirmed && window.Check ? <window.Check size={14} /> : null}
            </span>
            <span className="gg-isu__confirm-text">{CONFIRM_TEXT}<span className="checkout-form__err gg-isu__req" aria-hidden="true">*</span>{window.IntentInfoTip ? <window.IntentInfoTip body={tipBody} anchorClassName="client-card__info gg-isu__confirm-info" iconClassName="client-card__info-i" portalClassName="client-card__info-portal" /> : null}</span>
          </label>
        </div>
      ) : null;
      // The lock cards are narrow, so they keep the stacked field and full-width button. Everywhere else the field
      // and a natural-width house button share one row.
      return (
        frame(<>
          {/* 0398, 16 Nov 2026 (mockup 7E4Mvv4cyzHDKciPYBedef, approved 22:46): where the field and the button stack, the
              box sits between them, so a visitor reads why the button is off before reaching it. The padlocked cards
              always stack. The strip carries the box inside its row, and inline-signup.css puts it under the row on a
              wide screen and between the field and the button once the row stacks. About you and the sign-up page keep
              the box after the row. WAS: {confirmRow} after the row for every variant. */}
          {stack ? (
            <div className="checkout-form__grid">
              <label className="checkout-form__field checkout-form__field--full">{label}{input}</label>
              {confirmRow}
              <button type="submit" className="btn btn--primary btn--block checkout-form__submit gg-sos__cta" disabled={btnOff}>{btnText}</button>
            </div>
          ) : (
            <div className="gg-isu__row">
              <label className="checkout-form__field">{label}{input}</label>
              {strip ? confirmRow : null}
              <button type="submit" className="btn btn--primary" disabled={btnOff}>{btnText}</button>
            </div>
          )}
          {stack || strip ? null : confirmRow}
          {err ? errLine(err) : null}
          {fallback ? (
            <div className="checkout-form__err checkout-form__err--block" role="alert">
              We could not send it from here.{' '}
              <a href={FALLBACK_URL[clientTypeId] || FALLBACK_URL.founder} target="_blank" rel="noopener noreferrer">Open the sign-up page ›</a>
            </div>
          ) : null}
        </>, send)
      );
    }

    if (stage === 'details') {
      const em = email.trim();
      return (
        frame(<>
          <div className="checkout-form__success">
            {window.Check ? <window.Check size={18} /> : null}
            <div>
            <div className="checkout-form__success-title">{waitlist ? 'You are on the investor waiting list' : 'Your link is on its way to ' + em}</div>
            <div className="checkout-form__success-body">{waitlist
              ? 'We have emailed ' + em + '. One last step, so we know who to look out for.'
              : 'One last step, so we know who to look out for. Open the link whenever you are ready, your quote is saved.'}
              {' '}Wrong email? <button type="button" className="svc__talent-wl-link" onClick={() => { setStage('email'); setToken(null); }}><span className="svc__talent-wl-link__text">Change it</span></button>.
              {' '}If it does not arrive in a few minutes, <button type="button" className="svc__talent-wl-link" onClick={() => { setStage('email'); setTimeout(() => send(), 0); }}><span className="svc__talent-wl-link__text">send it again</span></button>.</div>
            </div>
          </div>
          <div className="checkout-form__grid">
            <label className="checkout-form__field">
              <span className="checkout-form__label">First name</span>
              <input className="checkout-form__input" autoComplete="given-name" value={f.firstName} maxLength={60}
                onChange={(e) => { setF({ ...f, firstName: e.target.value }); if (fErr) setFErr(''); }} aria-invalid={fErr ? 'true' : undefined} />
            </label>
            <label className="checkout-form__field">
              <span className="checkout-form__label">Last name <span className="checkout-form__optional">(Optional)</span></span>
              <input className="checkout-form__input" autoComplete="family-name" value={f.lastName} maxLength={60}
                onChange={(e) => setF({ ...f, lastName: e.target.value })} />
            </label>
            <label className="checkout-form__field checkout-form__field--full">
              <span className="checkout-form__label">Company <span className="checkout-form__optional">(Optional)</span></span>
              <input className="checkout-form__input" autoComplete="organization" value={f.company} maxLength={120}
                onChange={(e) => setF({ ...f, company: e.target.value })} />
            </label>
          </div>
          {fErr ? errLine(fErr) : null}
          <div className={variant === 'lock' ? '' : 'gg-isu__actions'}>
            <button type="button" className={'btn btn--ghost' + (variant === 'lock' ? ' btn--block' : '')} onClick={() => setStage('done')} disabled={busy}>Skip</button>
            <button type="submit" className={'btn btn--primary' + (variant === 'lock' ? ' btn--block checkout-form__submit' : '')} disabled={busy}>
              {busy ? 'Saving…' : <>Save my details <span className="btn__arrow">›</span></>}
            </button>
          </div>
        </>, save)
      );
    }

    return (
      frame(<>
        <div className="checkout-form__success">
            {window.Check ? <window.Check size={18} /> : null}
            <div>
          {/* 2 Nov 2026, Pricing Calculator recwheqRWgTXJUy09, mockup https://claude.ai/artifact/AQU8zi7TfmnHB3TCh8dmKc
             Option 1 approved by Nicole: an investor the portal puts on the waiting list is sent the waiting list email,
             not a sign-in link, so this box says so and offers the investor booking page that email also offers.
             WAS, for everyone: Thanks, <name>. Check your inbox / Open the link we sent to <email> to get into your portal.
             Your quote is saved there. Founders and partners keep it. */}
          {waitlist ? <>
          <div className="checkout-form__success-title">{f.firstName.trim() ? 'Thanks, ' + f.firstName.trim() + '. You are on the waiting list' : 'Thanks. You are on the waiting list'}</div>
          <div className="checkout-form__success-body">We will email {email.trim()} as soon as the investors portal opens. Until then, our team is happy to talk you through what is coming. <a className="svc__talent-wl-link gg-isu-waitlist-call" href={INVESTOR_CALL_URL} target="_blank" rel="noopener noreferrer"><span className="svc__talent-wl-link__text">Book a call</span></a>.</div>
          </> : <>
          <div className="checkout-form__success-title">{f.firstName.trim() ? 'Thanks, ' + f.firstName.trim() + '. Check your inbox' : 'Thanks. Check your inbox'}</div>
          <div className="checkout-form__success-body">Open the link we sent to {email.trim()} to get into your portal. Your quote is saved there.</div>
          </>}
            </div>
        </div>
      </>)
    );
  }

  function ChoiceCard({ on, onPick, title, desc, rec }) {
    return (
      <button type="button" role="radio" aria-checked={on}
        className={'call-pref__card thin-glass-frame' + (on ? ' call-pref__card--on' : '')}
        onClick={onPick}>
        <span className={'call-pref__card-check' + (on ? ' is-on' : '')} aria-hidden="true">
          {on && window.Check ? <window.Check size={16} /> : null}
        </span>
        <div className="call-pref__card-body">
          <div className="call-pref__card-title">
            {title}
            {rec ? <span className="channel-tile__rec-tag" style={{ marginBottom: 0, marginLeft: '6px', verticalAlign: 'middle' }}>Recommended</span> : null}
          </div>
          <div className="call-pref__card-desc">{desc}</div>
        </div>
      </button>
    );
  }

  /* 26 Oct 2026, Pricing Calculator recwheqRWgTXJUy09 (FREELANCER #47 ask 10, @9:38-10:26). Mockup approved by Nicole
     26 Oct 2026, 19:09 Manila, option 1 (https://claude.ai/artifact/78A4JuGMduAhYnVvn8ZCMQ): while Continue as a guest is
     ticked, an optional email box. Save my quote is a lead only: the email_capture action on /api/send-quote (logged for
     the CRM, no email sent), the address kept for Email quote (gg.leadEmail) and for the autosave (__leadEmail), so the
     quote is saved under it once it has a price. No account and nothing emailed. Left empty, nothing happens. */
  function GuestEmailPanel() {
    const [email, setEmail] = useState(() => { try { return String((window.localStorage && window.localStorage.getItem('gg.leadEmail')) || window.__leadEmail || ''); } catch (e) { return ''; } });
    const [err, setErr] = useState('');
    const [busy, setBusy] = useState(false);
    const [saved, setSaved] = useState('');
    async function save(ev) {
      if (ev) ev.preventDefault();
      const em = email.trim();
      if (!EMAIL_RE.test(em)) { setErr('Enter a valid email address'); return; }
      setErr(''); setBusy(true);
      try { window.__leadEmail = em; } catch (e) {}
      try { if (window.localStorage) window.localStorage.setItem('gg.leadEmail', em); } catch (e) {}
      try {
        const tok = (typeof window.ggCaptchaToken === 'function') ? await window.ggCaptchaToken() : '';
        const body = (typeof window.buildSendQuoteBody === 'function') ? window.buildSendQuoteBody('email_capture', em) : { action: 'email_capture', email: em };
        body.captchaToken = tok;
        fetch((window.ggCalcApi ? window.ggCalcApi('/api/send-quote') : '/api/send-quote'), {
          method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), keepalive: true,
        }).catch(() => {});
      } catch (e) {}
      setBusy(false); setSaved(em);
    }
    if (saved) {
      return (
        <div className="convert-card convert-card--action checkout-form gg-isu__panel gg-isu__guest" role="status">
          <div className="checkout-form__success">
            {window.Check ? <window.Check size={18} /> : null}
            <div>
              <div className="checkout-form__success-title">{'Saved under ' + saved}</div>
              <div className="checkout-form__success-body">Carry on building. Email quote will use this address.</div>
            </div>
          </div>
        </div>
      );
    }
    return (
      <form className="convert-card convert-card--action checkout-form gg-isu__panel gg-isu__guest" onSubmit={save} noValidate>
        <div className="gg-isu__row">
          <label className="checkout-form__field">
            <span className="checkout-form__label">Email <span className="gg-isu__opt">(optional)</span></span>
            <input id="gg-isu-guest-email" aria-label="Email (optional)" className="checkout-form__input" type="email" inputMode="email" autoComplete="email"
              placeholder="you@company.com" value={email} aria-invalid={err ? 'true' : undefined}
              onChange={(e) => { setEmail(e.target.value); if (err) setErr(''); }} />
          </label>
          <button type="submit" className="btn btn--primary" disabled={busy}>Save my quote <span className="btn__arrow">›</span></button>
        </div>
        {err ? <div className="checkout-form__err checkout-form__err--block" role="alert">{err}</div> : null}
        <p className="call-pref__card-desc gg-isu__note">We keep your quote under this email and our team can follow up. No account, and nothing is emailed.</p>
      </form>
    );
  }

  function InlineSignup({ clientTypeId, variant = 'about' }) {
    const startChoice = (variant === 'page' || isSignupPage()) ? 'signup' : 'guest';
    const [choice, setChoice] = useState(startChoice);
    const ctype = clientTypeId || 'founder';

    // C7: a Sign up control elsewhere (the rail tips) sends people here with the email box focused.
    useEffect(() => {
      if (variant !== 'about' && variant !== 'page') return undefined;
      function onFocusAsk() {
        try { window.__ggIsuWantSignup = false; } catch (e) {}
        setChoice('signup');
        setTimeout(() => {
          try {
            const el = document.getElementById('gg-isu-email');
            if (el) { el.scrollIntoView({ behavior: 'smooth', block: 'center' }); el.focus({ preventScroll: true }); }
          } catch (e) {}
        }, 120);
      }
      window.addEventListener('gg:inline-signup-focus', onFocusAsk);
      /* 26 Oct 2026 (recwheqRWgTXJUy09, FREELANCER #47 @9:25-9:38): pressed on another step, the ask arrives
         before this box is drawn, so app.v2.jsx leaves it pending and the box takes it up when it mounts. */
      if (window.__ggIsuWantSignup) onFocusAsk();
      return () => window.removeEventListener('gg:inline-signup-focus', onFocusAsk);
    }, [variant]);

    if (!isOn() || isEmbeddedOrHandedOff()) return null;

    if (hasSignedInHint()) {
      if (variant === 'strip') return null;
      return (
        <div className={'gg-isu gg-isu--' + variant}>
          <div className={variant === 'lock' ? '' : 'gg-isu__actions'}>
          <a className={'btn btn--primary' + (variant === 'lock' ? ' btn--block checkout-form__submit gg-sos__cta' : '')} href={(apiBase() || 'https://portal.gogorilla.com') + '/account'}>
            Open your portal <span className="btn__arrow">›</span>
          </a>
          </div>
        </div>
      );
    }

    if (variant === 'lock' || variant === 'strip') {
      return (
        <div className={'gg-isu gg-isu--' + variant}>
          <SignupPanel clientTypeId={ctype} variant={variant} />
        </div>
      );
    }

    const pick = (c) => { setChoice(c); };
    const onSignupPage = isSignupPage();
    // The same "i" as the client cards directly above (IntentInfoTip with the client-card__info classes).
    const tip = window.IntentInfoTip ? <window.IntentInfoTip body={TIP} anchorClassName="client-card__info" iconClassName="client-card__info-i" portalClassName="client-card__info-portal" /> : null;
    return (
      <div className={'gg-isu gg-isu--' + variant}>
        <div className="call-pref" role="radiogroup" aria-label="How would you like to continue?">
          <div className="intent-grid intent-grid--cols-2">
            <ChoiceCard on={choice === 'guest'} title="Continue as a guest"
              desc={onSignupPage ? 'Go straight to the pricing calculator.' : 'Build your quote now. You can add your email at any point to save it.'}
              onPick={() => { if (onSignupPage) { try { window.location.assign('/'); } catch (e) {} return; } pick('guest'); }} />
            <ChoiceCard on={choice === 'signup'} rec
              title={<>Sign up to access the full platform{tip}</>}
              desc="Save your quote, unlock every page, and get your own portal. Free, no card needed."
              onPick={() => pick('signup')} />
          </div>
        </div>
        {choice === 'signup' ? <SignupPanel clientTypeId={ctype} variant={variant} emailId="gg-isu-email" /> : null}
        {/* 26 Oct 2026, approved by Nicole 19:29 Manila: not for Partners, whose FREE strip on About you already has
            its own email box, so the page never shows two. Was: {choice === 'guest' && !onSignupPage ? <GuestEmailPanel /> : null} */}
        {choice === 'guest' && !onSignupPage && ctype !== 'agency' ? <GuestEmailPanel /> : null}
      </div>
    );
  }

  // 16 Oct 2026: the hand-drawn three-step bar for /sign-up was removed with the rest of the invented styling.

  /* 21 Oct 2026, Pricing Calculator recwheqRWgTXJUy09 (FREELANCER #47 @17:59 to 18:43, watched muted at 18:02 and 18:31):
     the /sign-up landing keeps the /join page's 1, 2, 3 step bar and loses only the sidebar. Mockup approved by Nicole
     21 Oct 2026, 15:11 Manila (https://claude.ai/artifact/1URgZzMm6MnrqTspRq9gBG). Drawn with the calculator's own step
     bar classes (StepIndicator in sections.v2.jsx), not a look-alike, which is why the 16 Oct bar above was removed.
     Lit the way the portal's /join bar is (app/login/page.tsx): a client type is always picked here, so About you is
     done and Get your magic link is current; signed in, Open your portal is current. The steps show progress only,
     so they are not buttons. Mounted above the panel in ClientTypeSection. */
  const STEP_BAR = [
    { label: 'About you', icon: 'icons/step-client.webp' },
    { label: 'Get your magic link', icon: 'icons/email.webp' },
    { label: 'Open your portal', icon: 'icons/plane-portal.webp' },
  ];
  function SignupStepBar() {
    if (!isOn() || !isSignupPage() || isEmbeddedOrHandedOff()) return null;
    const at = hasSignedInHint() ? 2 : 1;
    const src = (p) => (window.ggAsset ? window.ggAsset(p) : 'assets/' + p);
    const items = [];
    STEP_BAR.forEach((s, i) => {
      if (i > 0) items.push(<li key={'c' + i} className={'step-indicator__connector step-indicator__connector--' + (i <= at ? 'complete' : 'upcoming')} aria-hidden="true"></li>);
      const st = i < at ? 'complete' : (i === at ? 'current' : 'upcoming');
      items.push(
        <li key={s.label} className={'step-indicator__item step-indicator__item--' + st}>
          <span className="step-indicator__btn" aria-current={st === 'current' ? 'step' : undefined}>
            <span className="step-indicator__bubble" aria-hidden="true"><span className="step-indicator__icon-wrap"><img src={src(s.icon)} alt="" className="step-indicator__icon" /></span></span>
            <span className="step-indicator__label"><span className="step-indicator__numpre" aria-hidden="true">{i + 1}</span>{s.label}</span>
          </span>
        </li>
      );
    });
    return <nav className="step-indicator gg-isu-stepbar" aria-label="How signing up works"><ol className="step-indicator__list">{items}</ol></nav>;
  }

  window.InlineSignup = InlineSignup;
  window.GuestEmailPanel = GuestEmailPanel;
  window.SignupStepBar = SignupStepBar;
  window.ggInlineSignupOn = function () { return isOn() && !isEmbeddedOrHandedOff(); };
  /* 26 Oct 2026: true when About you draws the guest or Sign up choice (not signed in). sections.v2.jsx reads it. */
  window.ggInlineSignupChoiceShown = function () { return isOn() && !isEmbeddedOrHandedOff() && !hasSignedInHint(); };
  window.ggIsSignupPage = isSignupPage;
  // Tests reach the network helpers through here; nothing on the page calls them.
  window.__ggInlineSignup = { startSignup: startSignup, sendDetails: sendDetails, PERSONA: PERSONA, FALLBACK_URL: FALLBACK_URL, SignupPanel: SignupPanel, CONFIRM_TEXT: CONFIRM_TEXT };
})();
