<style>
  /* The base theme sets svg { fill: currentColor }, which beats the icons'
     fill="none" attribute and turns every stroke icon into a solid shape. */
  .SCSV3-PartnerHub_svg { fill: none; }

  .SCSV3-PartnerHub_section { margin: 0 0 var(--sc-spacing-xlarge); }
  .SCSV3-PartnerHub_section:last-child { margin-bottom: 0; }

  .SCSV3-PartnerHub_sectionHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }
  .SCSV3-PartnerHub_sectionHead .SCSV3-AccountSection_title { margin: 0; }

  .SCSV3-PartnerHub_more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--scsv3-link);
    text-decoration: none;
  }
  .SCSV3-PartnerHub_more:hover { color: var(--scsv3-link-hover); text-decoration: none; }

  /* Icon tile shared by quick-link cards, library cards and resource groups. */
  .SCSV3-PartnerHub_icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--scsv3-brand-50);
    color: var(--scsv3-brand-600);
  }
  :root[data-theme="dark"] .SCSV3-PartnerHub_icon {
    background: rgba(96, 178, 184, 0.14);
    color: var(--scsv3-link);
  }
  .SCSV3-PartnerHub_icon-sm { width: 36px; height: 36px; }

  /* --- Quick links --- */
  .SCSV3-PartnerHub_cardTop {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .SCSV3-PartnerHub_ext { color: var(--scsv3-text-faint); display: inline-flex; }

  /* --- Library cards (Overview) --- */
  .SCSV3-PartnerHub_libraries {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
  .SCSV3-PartnerHub_library {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .SCSV3-PartnerHub_library .SCSV3-PartnerHub_icon { width: 48px; height: 48px; background: var(--scsv3-surface); }
  .SCSV3-PartnerHub_libraryBody { flex: 1 1 auto; min-width: 0; }
  .SCSV3-PartnerHub_library .SCSV3-AccountCard_badge { margin: 0; flex-shrink: 0; }
  .SCSV3-PartnerHub_library > svg { color: var(--scsv3-brand-600); flex-shrink: 0; }

  /* --- Resource groups --- */
  .SCSV3-PartnerHub_groups {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    align-items: start;
  }
  .SCSV3-PartnerHub_group {
    padding: 20px 20px 10px;
    background: var(--scsv3-surface);
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-card);
  }
  .SCSV3-PartnerHub_groupHead {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }
  .SCSV3-PartnerHub_groupTitle {
    flex: 1 1 auto;
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--scsv3-text);
  }
  .SCSV3-PartnerHub_group .SCSV3-PartnerHub_links {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .SCSV3-PartnerHub_group .SCSV3-PartnerHub_links > li { margin: 0; padding: 0; }
  .SCSV3-PartnerHub_group .SCSV3-PartnerHub_links > li + li { border-top: 1px solid var(--scsv3-border); }
  .SCSV3-PartnerHub_link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    font-size: 15px;
    font-weight: 500;
    color: var(--scsv3-text);
    text-decoration: none;
  }
  .SCSV3-PartnerHub_link:hover { color: var(--scsv3-link); text-decoration: none; }
  .SCSV3-PartnerHub_link > svg { color: var(--scsv3-text-faint); flex-shrink: 0; }
  .SCSV3-PartnerHub_linkLabel { flex: 1 1 auto; min-width: 0; }
  .SCSV3-PartnerHub_linkKind { font-size: 12px; color: var(--scsv3-text-faint); white-space: nowrap; }

  /* --- Videos --- */
  .SCSV3-PartnerHub_filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--sc-spacing-large);
  }
  .SCSV3-PartnerHub_filters[hidden] { display: none; }
  .SCSV3-PartnerHub_filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-pill);
    background: var(--scsv3-surface);
    color: var(--scsv3-text-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .SCSV3-PartnerHub_filter:hover { border-color: var(--scsv3-brand-300); color: var(--scsv3-text); }
  .SCSV3-PartnerHub_filter[aria-pressed="true"] {
    background: var(--scsv3-brand-600);
    border-color: var(--scsv3-brand-600);
    color: #fff;
  }
  .SCSV3-PartnerHub_filter:focus-visible { outline: 2px solid var(--scsv3-brand-500); outline-offset: 2px; }
  .SCSV3-PartnerHub_filterCount { font-weight: 500; opacity: 0.75; }

  .SCSV3-PartnerHub_gallery[hidden] { display: none; }

  .SCSV3-PartnerHub_videos {
    display: grid;
    gap: 24px 16px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: start;
  }
  .SCSV3-PartnerVideo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    margin: 0;
  }
  .SCSV3-PartnerVideo_title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--scsv3-text);
  }
  .SCSV3-PartnerVideo_frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--scsv3-radius-md);
    background: var(--scsv3-navy-900);
  }
  .SCSV3-PartnerVideo_frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
  }

  @media (prefers-reduced-motion: reduce) {
    .SCSV3-PartnerHub_filter { transition: none; }
  }
  /* --- Store setup --- */
  .SCSV3-PartnerSetup_lede { max-width: 70ch; color: var(--scsv3-text-muted); }
  .SCSV3-PartnerSetup_progress { margin-top: 16px; }
  .SCSV3-PartnerSetup_progress[hidden] { display: none; }
  .SCSV3-PartnerSetup_bar {
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-pill);
    background: var(--scsv3-surface-muted);
  }
  .SCSV3-PartnerSetup_fill { width: 0; height: 100%; background: var(--scsv3-brand-500); transition: width 0.25s ease; }
  .SCSV3-PartnerSetup_count { margin: 8px 0 0; font-size: 14px; color: var(--scsv3-text-muted); font-variant-numeric: tabular-nums; }

  .SCSV3-PartnerSetup_steps {
    display: grid;
    gap: 12px;
    margin: 0 0 var(--sc-spacing-xlarge);
    padding: 0;
    list-style: none;
  }
  .SCSV3-PartnerSetup_steps > li { margin: 0; }
  .SCSV3-PartnerSetup_step {
    background: var(--scsv3-surface);
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-card);
  }
  .SCSV3-PartnerSetup_step[open] { border-color: var(--scsv3-border-strong); }
  .SCSV3-PartnerSetup_step > summary {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 48px 14px 18px;
    cursor: pointer;
    list-style: none;
  }
  .SCSV3-PartnerSetup_step > summary::-webkit-details-marker { display: none; }
  .SCSV3-PartnerSetup_step > summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 20px;
    width: 9px;
    height: 9px;
    margin-top: -7px;
    border-right: 2px solid var(--scsv3-text-faint);
    border-bottom: 2px solid var(--scsv3-text-faint);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
  }
  .SCSV3-PartnerSetup_step[open] > summary::after { transform: rotate(225deg); margin-top: -2px; }
  .SCSV3-PartnerSetup_step > summary:focus-visible { outline: 2px solid var(--scsv3-brand-500); outline-offset: 2px; border-radius: var(--scsv3-radius-card); }
  .SCSV3-PartnerSetup_num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--scsv3-brand-500);
    border-radius: var(--scsv3-radius-pill);
    font-size: 14px;
    font-weight: 700;
    color: var(--scsv3-brand-600);
    font-variant-numeric: tabular-nums;
  }
  :root[data-theme="dark"] .SCSV3-PartnerSetup_num { color: var(--scsv3-link); border-color: var(--scsv3-link); }
  .SCSV3-PartnerSetup_step.is-done .SCSV3-PartnerSetup_num { background: var(--scsv3-brand-500); border-color: var(--scsv3-brand-500); color: #fff; }
  .SCSV3-PartnerSetup_title { display: flex; flex-direction: column; min-width: 0; }
  .SCSV3-PartnerSetup_title strong { font-size: 16px; font-weight: 600; color: var(--scsv3-text); }
  .SCSV3-PartnerSetup_title span { font-size: 14px; color: var(--scsv3-text-muted); }
  .SCSV3-PartnerSetup_body { display: grid; gap: 12px; justify-items: start; padding: 0 18px 18px 64px; font-size: 15px; }
  .SCSV3-PartnerSetup_body > * { margin: 0; max-width: 70ch; }
  .SCSV3-PartnerSetup_body ol,
  .SCSV3-PartnerSetup_body ul { padding-left: 20px; }
  .SCSV3-PartnerSetup_body li + li { margin-top: 6px; }
  .SCSV3-PartnerSetup_res { display: flex; flex-wrap: wrap; gap: 8px; }
  .SCSV3-PartnerSetup_res a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-pill);
    font-size: 14px;
    color: var(--scsv3-text);
    text-decoration: none;
  }
  .SCSV3-PartnerSetup_res a:hover { border-color: var(--scsv3-brand-300); color: var(--scsv3-link); text-decoration: none; }
  .SCSV3-PartnerSetup_res a > svg { flex-shrink: 0; color: var(--scsv3-text-faint); }
  .SCSV3-PartnerSetup_step.is-done .SCSV3-PartnerSetup_done { background: var(--scsv3-brand-500); border-color: var(--scsv3-brand-500); color: #fff; }

  .SCSV3-PartnerSetup_check {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px 24px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
  }
  .SCSV3-PartnerSetup_check li { margin: 0; }
  .SCSV3-PartnerSetup_check label { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; cursor: pointer; }
  .SCSV3-PartnerSetup_check input { flex-shrink: 0; width: 16px; height: 16px; margin-top: 4px; accent-color: var(--scsv3-brand-500); }

  @media (max-width: 560px) {
    .SCSV3-PartnerSetup_body { padding-left: 18px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .SCSV3-PartnerSetup_fill,
    .SCSV3-PartnerSetup_step > summary::after { transition: none; }
  }
</style>
<section class="SCSV3-Section SCSV3-Container">

<header class="SCSV3-AccountHeader">
  <p class="SCSV3-AccountHeader_eyebrow">Partner hub</p>
  <h1 class="SCSV3-AccountHeader_title">Partner resources</h1>
  <p class="SCSV3-AccountHeader_meta">Marketing materials, slide decks, logos, tutorials, documentation and support, all in one place.</p>
</header>

<nav class="SCSV3-Subnav" aria-label="Partner hub sections (locked)">
  <span class="SCSV3-Subnav_link is-current" aria-current="page">Overview</span>
  <span class="SCSV3-Subnav_link SCSV3-PhGate_tabLocked" aria-disabled="true"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Resources <span class="SCSV3-AccountSection_count">20</span></span>
  <span class="SCSV3-Subnav_link SCSV3-PhGate_tabLocked" aria-disabled="true"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Videos <span class="SCSV3-AccountSection_count">22</span></span>
</nav>

<div data-scsv3-ph-gate data-state="login" data-signed-in="false" data-submitter-uuid="" data-hub-path="/account/partner-hub" data-sign-in-path="/auth/sign_in" data-maps-key="AIzaSyA6RzlGR7-gXR8ZOIPHsYS8cY5-rl8XDF4">

  <section class="SCSV3-PhGate" data-scsv3-phg-apply aria-labelledby="scsv3-phg-title">
    <div class="SCSV3-PhGate_pitch">
      <h2 class="SCSV3-PhGate_title" id="scsv3-phg-title">Unlock the partner hub</h2>
      <p>The hub is for registered StoreConnect partners. Log in with your work email, then apply. You can get access straight away.</p>
      <ul class="SCSV3-PhGate_benefits">
        <li><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg> Sales decks, partner guides, logos and badges</li>
        <li><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg> 22 product demos, industry solutions and partner insights</li>
        <li><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg> Partner documentation, training and support</li>
        <li><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg> Your company listed on storeconnect.com/partners</li>
      </ul>
      <div class="SCSV3-PhGate_rules">
        <div class="SCSV3-PhGate_rule SCSV3-PhGate_rule-ok">
          <svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13 2L4 14h7l-1 8 9-12h-7l1-8z"/></svg>
          <div><strong>Instant access</strong>Use your work email. If its domain matches your company website (jane@acme.com and acme.com), you're registered automatically.</div>
        </div>
        <div class="SCSV3-PhGate_rule SCSV3-PhGate_rule-warn">
          <svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>
          <div><strong>Manual approval</strong>Personal addresses (Gmail, Outlook and similar) or emails on a different domain go to our partner team for review. This usually takes 1 to 2 business days.</div>
        </div>
      </div>
    </div>
    <div class="SCSV3-PhGate_login">
      <span class="SCSV3-PhGate_loginIcon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></span>
      <h3 class="SCSV3-PhGate_loginTitle">Log in to apply</h3>
      <p>Your partner access is linked to the email you log in with. To make sure it works, log in first and then apply using that same account.</p>
      <ol class="SCSV3-PhGate_loginSteps">
        <li>Log in with <strong>Google or Microsoft</strong> using your <strong>work email</strong>. If this is your first time, logging in creates your support account.</li>
        <li>Come back to the partner hub. Your name and email will already be filled in.</li>
        <li>Add your company details and apply. If your email matches your company website, you're in straight away.</li>
      </ol>
      <a class="SCSV3-Btn SCSV3-Btn-primary" href="/account/partner-hub">Log in to apply</a>
      <p class="SCSV3-PhGate_small">Already a partner? The same button logs you straight into the hub.<br>Questions? Email <a href="mailto:partners@storeconnect.com">partners@storeconnect.com</a>.</p>
    </div>
  </section><section class="SCSV3-PartnerHub_section" aria-labelledby="scsv3-phg-quick">
    <div class="SCSV3-PartnerHub_sectionHead">
      <h2 class="SCSV3-AccountSection_title" id="scsv3-phg-quick">Quick links</h2>
    </div>
    <div class="SCSV3-AccountCards">
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="5" y="3" width="14" height="18" rx="2"/><path d="M9 3v2h6V3"/><path d="M9 11h6M9 15h4"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">Partner Capability Survey</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Register your team&#39;s skills and delivery experience.</p>
      </div>
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="7.5" cy="15.5" r="5.5"/><path d="m21 2-9.6 9.6"/><path d="m15.5 7.5 3 3L22 7l-3-3"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">Free Partner Store License</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Apply for your free Partner Single-Store License, or renew it.</p>
      </div>
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M22 10 12 5 2 10l10 5 10-5z"/><path d="M6 12v5c3 2 9 2 12 0v-5"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">StoreConnect Academy</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Self-paced training and partner certification.</p>
      </div>
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z"/><path d="M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">StoreConnect AI</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Connect AI agents to your store, install the Skills and build with AI.</p>
      </div>
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">Partner Resources</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Decks, guides, logos and badges for selling StoreConnect.</p>
      </div>
      <div class="SCSV3-AccountCard SCSV3-PhGate_locked">
        <div class="SCSV3-PartnerHub_cardTop">
          <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="m10 8 6 4-6 4z"/></svg></span>
          <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> Partners</span>
        </div>
        <p class="SCSV3-AccountCard_title">How-to Videos</p>
        <p class="SCSV3-AccountCard_summary SCSV3-PhGate_blur" aria-hidden="true">Short tutorials covering everyday tasks.</p>
      </div>
    </div>
  </section>
  <section class="SCSV3-PartnerHub_section" aria-labelledby="scsv3-phg-latest">
    <div class="SCSV3-PartnerHub_sectionHead">
      <h2 class="SCSV3-AccountSection_title" id="scsv3-phg-latest">Latest Partner Insights</h2>
      <span class="SCSV3-AccountSection_count">22 videos</span>
    </div>
    <div class="SCSV3-PartnerHub_videos">
      <div class="SCSV3-PartnerVideo">
        <div class="SCSV3-PartnerVideo_frame SCSV3-PhGate_frame"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></div>
        <span class="SCSV3-PartnerVideo_title">August 2026</span>
      </div>
      <div class="SCSV3-PartnerVideo">
        <div class="SCSV3-PartnerVideo_frame SCSV3-PhGate_frame"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></div>
        <span class="SCSV3-PartnerVideo_title">June 2026</span>
      </div>
      <div class="SCSV3-PartnerVideo">
        <div class="SCSV3-PartnerVideo_frame SCSV3-PhGate_frame"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></div>
        <span class="SCSV3-PartnerVideo_title">May 2026</span>
      </div>
    </div>
  </section>

  <section class="SCSV3-PartnerHub_section" aria-labelledby="scsv3-phg-browse">
    <div class="SCSV3-PartnerHub_sectionHead">
      <h2 class="SCSV3-AccountSection_title" id="scsv3-phg-browse">Browse the libraries</h2>
    </div>
    <div class="SCSV3-PartnerHub_libraries">
      <div class="SCSV3-AccountCard SCSV3-AccountCard-feature SCSV3-PartnerHub_library SCSV3-PhGate_locked">
        <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg></span>
        <span class="SCSV3-PartnerHub_libraryBody">
          <span class="SCSV3-AccountCard_title" style="display: block">Resource library</span>
          <span class="SCSV3-AccountCard_summary" style="display: block">Decks, partner guides, logos and badges</span>
        </span>
        <span class="SCSV3-AccountCard_badge">20 items</span>
        <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></span>
      </div>
      <div class="SCSV3-AccountCard SCSV3-AccountCard-feature SCSV3-PartnerHub_library SCSV3-PhGate_locked">
        <span class="SCSV3-PartnerHub_icon"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="" height="" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 3v18M17 3v18M3 8h4M3 16h4M17 8h4M17 16h4"/></svg></span>
        <span class="SCSV3-PartnerHub_libraryBody">
          <span class="SCSV3-AccountCard_title" style="display: block">Video library</span>
          <span class="SCSV3-AccountCard_summary" style="display: block">Overviews, demos, industry solutions and insights</span>
        </span>
        <span class="SCSV3-AccountCard_badge">22 videos</span>
        <span class="SCSV3-PhGate_lockBadge"><svg class="SCSV3-PartnerHub_svg" viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg></span>
      </div>
    </div>
  </section>
</div>
</section>

<style>
  .SCSV3-PhGate_tabLocked { color: var(--scsv3-text-faint); cursor: default; display: inline-flex; align-items: center; gap: 6px; }

  .SCSV3-PhGate {
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    padding: 24px;
    margin: 0 0 var(--sc-spacing-xlarge);
    background: var(--scsv3-surface);
    border: 1px solid var(--scsv3-border);
    border-radius: var(--scsv3-radius-card);
  }
  @media (max-width: 900px) { .SCSV3-PhGate { grid-template-columns: 1fr; padding: 20px; } }
  .SCSV3-PhGate_title { margin: 0 0 8px; font-size: 22px; font-weight: 700; color: var(--scsv3-text); text-wrap: balance; }
  .SCSV3-PhGate_pitch > p { margin: 0 0 14px; color: var(--scsv3-text-muted); }
  .SCSV3-PhGate_benefits { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--scsv3-text); }
  .SCSV3-PhGate_benefits li { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
  .SCSV3-PhGate_benefits svg { flex-shrink: 0; margin-top: 2px; color: var(--scsv3-brand-500); }
  .SCSV3-PhGate_rules { display: grid; gap: 8px; margin: 0 0 16px; }
  .SCSV3-PhGate_rule { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--scsv3-radius-md); border: 1px solid; font-size: 13.5px; line-height: 1.45; }
  .SCSV3-PhGate_rule strong { display: block; font-size: 14px; }
  .SCSV3-PhGate_rule svg { flex-shrink: 0; margin-top: 1px; }
  .SCSV3-PhGate_rule-ok, .SCSV3-PhGate_domain[data-tone="ok"], .SCSV3-PhGate_result-ok { background: #e7f5ee; color: #17603f; border-color: #9fd6b9; }
  .SCSV3-PhGate_rule-warn, .SCSV3-PhGate_domain[data-tone="warn"], .SCSV3-PhGate_result-warn { background: #fdf3e2; color: #8a5300; border-color: #f0cf93; }
  :root[data-theme="dark"] .SCSV3-PhGate_rule-ok,
  :root[data-theme="dark"] .SCSV3-PhGate_domain[data-tone="ok"],
  :root[data-theme="dark"] .SCSV3-PhGate_result-ok { background: rgba(52, 168, 110, 0.14); color: #8fe0b6; border-color: rgba(52, 168, 110, 0.4); }
  :root[data-theme="dark"] .SCSV3-PhGate_rule-warn,
  :root[data-theme="dark"] .SCSV3-PhGate_domain[data-tone="warn"],
  :root[data-theme="dark"] .SCSV3-PhGate_result-warn { background: rgba(240, 170, 60, 0.13); color: #f5c77a; border-color: rgba(240, 170, 60, 0.4); }
  .SCSV3-PhGate_login { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; align-self: start; padding: 24px; background: var(--scsv3-surface-muted); border: 1px solid var(--scsv3-border); border-radius: var(--scsv3-radius-card); color: var(--scsv3-text); }
  .SCSV3-PhGate_login > p { margin: 0; color: var(--scsv3-text-muted); max-width: 60ch; }
  .SCSV3-PhGate_login .SCSV3-PhGate_small { padding-top: 14px; border-top: 1px solid var(--scsv3-border); align-self: stretch; max-width: none; }
  .SCSV3-PhGate_loginIcon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--scsv3-surface); color: var(--scsv3-brand-500); }
  .SCSV3-PhGate_loginIcon svg { width: 20px; height: 20px; }
  .SCSV3-PhGate_loginTitle { margin: 0; font-size: 19px; font-weight: 700; text-wrap: balance; }
  .SCSV3-PhGate_loginSteps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
  .SCSV3-PhGate_loginSteps li { margin: 0; padding-left: 4px; }
  .SCSV3-PhGate_loginSteps li::marker { color: var(--scsv3-brand-500); font-weight: 700; }

  .SCSV3-PhGate_domain { margin: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid; font-size: 13px; }
  .SCSV3-PhGate_domain[data-tone="idle"] { background: var(--scsv3-surface-muted); color: var(--scsv3-text-faint); border-color: var(--scsv3-border); }
  .SCSV3-PhGate_phone { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; }
  /* Inputs and selects carry an intrinsic width that overflows a grid track unless reset. */
  .SCSV3-PhGate_phone > * { min-width: 0; width: 100%; }
  .SCSV3-PhGate_terms { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--scsv3-text); }
  .SCSV3-PhGate_terms input { margin-top: 3px; flex-shrink: 0; }
  .SCSV3-PhGate_form input[readonly] { background: var(--scsv3-surface-muted); color: var(--scsv3-text-muted); }
  .SCSV3-PhGate_form .SCSV3-FormSection_title { margin: 24px 0 10px; }
  .SCSV3-PhGate_form .SCSV3-PhGate_section { margin-top: 20px; }
  .SCSV3-PhGate_form [data-scsv3-phg-addr-fields] { margin-top: 12px; }

  /* Address search (Google Places progressive enhancement), as on the license tab. */
  .SCSV3-PhGate_addrSearch { display: none; }
  .SCSV3-PhGate_addrSearch.is-active { display: flex; flex-direction: column; gap: 6px; }
  .SCSV3-PhGate_addrSearch gmp-place-autocomplete { width: 100%; }
  .SCSV3-PhGate_addrToggle { align-self: flex-start; margin: 2px 0 0; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--scsv3-brand-400); text-decoration: underline; cursor: pointer; }
  .pac-container { z-index: 1200; }

  .SCSV3-PhGate_result { display: flex; gap: 16px; align-items: flex-start; padding: 22px; margin: 0 0 var(--sc-spacing-xlarge); border: 1px solid; border-radius: var(--scsv3-radius-card); }
  .SCSV3-PhGate_result[hidden] { display: none; }
  .SCSV3-PhGate_result p { margin: 0 0 10px; color: var(--scsv3-text-muted); max-width: 65ch; }
  .SCSV3-PhGate_result .SCSV3-AccountSection_title { margin: 0 0 6px; }
  .SCSV3-PhGate_resultIcon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--scsv3-surface); }
  .SCSV3-PhGate_small { font-size: 14px; }
  .SCSV3-PhGate_steps { margin: 0 0 4px; padding-left: 20px; color: var(--scsv3-text-muted); font-size: 14px; }

  .SCSV3-PhGate_locked { cursor: default; }
  .SCSV3-PhGate_locked:hover { transform: none; box-shadow: none; }
  .SCSV3-PhGate_lockBadge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--scsv3-text-faint); flex-shrink: 0; }
  .SCSV3-PhGate_blur { filter: blur(3px); opacity: 0.6; user-select: none; }
  .SCSV3-PhGate_frame { display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.7); background: linear-gradient(135deg, var(--scsv3-brand-900), var(--scsv3-brand-500)); }
  .SCSV3-PhGate_frame svg { width: 28px; height: 28px; }
</style>

<script>
  (function () {
    var root = document.querySelector('[data-scsv3-ph-gate]');
    if (!root || root.dataset.ready === '1') { return; }
    root.dataset.ready = '1';
    if (root.dataset.state !== 'apply') { return; }

    // Keep in step with FREE_MAIL in Scsv3PartnerApplicationInvocable.
    var FREE_MAIL = ['gmail.com', 'googlemail.com', 'outlook.com', 'hotmail.com', 'live.com', 'msn.com',
      'yahoo.com', 'ymail.com', 'icloud.com', 'me.com', 'mac.com', 'aol.com', 'proton.me',
      'protonmail.com', 'gmx.com', 'gmx.net', 'mail.com', 'zoho.com', 'yandex.com',
      'qq.com', '163.com', 'bigpond.com', 'optusnet.com.au', 'hotmail.co.uk', 'yahoo.co.uk'];
    var STORE_KEY = 'scsv3-partner-application';
    var signedIn = root.dataset.signedIn === 'true';
    var apply = root.querySelector('[data-scsv3-phg-apply]');
    var form = apply && apply.querySelector('form');

    function read() { try { return JSON.parse(sessionStorage.getItem(STORE_KEY) || 'null'); } catch (e) { return null; } }
    function save(v) { try { sessionStorage.setItem(STORE_KEY, JSON.stringify(v)); } catch (e) {} }

    function emailDomain(v) { v = (v || '').trim().toLowerCase(); var at = v.lastIndexOf('@'); return at > -1 ? v.slice(at + 1) : ''; }
    function webDomain(v) {
      v = (v || '').trim().toLowerCase();
      if (!v) { return ''; }
      return v.replace(/^[a-z]+:\/\//, '').replace(/^www\./, '').split(/[\/?#:]/)[0];
    }
    function check(email, website) {
      var e = emailDomain(email), w = webDomain(website);
      var r = { e: e, w: w, ready: !!(e && w), ok: false, reason: '' };
      if (!r.ready) { return r; }
      if (FREE_MAIL.indexOf(e) > -1) {
        r.reason = e + ' is a personal email address, so our partner team needs to confirm you work for this company.';
      } else if (e === w || e.slice(-(w.length + 1)) === '.' + w) {
        r.ok = true;
      } else {
        r.reason = e + " doesn't match " + w + ', so our partner team needs to confirm you work for this company.';
      }
      return r;
    }

    function fill(section, data) {
      section.querySelectorAll('[data-fill]').forEach(function (el) {
        var v = data[el.getAttribute('data-fill')];
        if (v) { el.textContent = v; }
      });
    }
    function showResult(kind, data) {
      if (apply) { apply.hidden = true; }
      var section = root.querySelector('[data-result="' + kind + '"]');
      if (!section) { return; }
      fill(section, data || {});
      section.hidden = false;
    }

    // A recent submission that hasn't reached this account yet.
    var recent = read();
    if (recent && Date.now() - recent.at < 10 * 60 * 1000) {
      showResult(signedIn ? 'syncing' : recent.kind, recent.data);
    }
    root.querySelectorAll('[data-scsv3-phg-reload]').forEach(function (b) {
      b.addEventListener('click', function () { window.location.reload(); });
    });

    if (!form) { return; }
    var email = form.querySelector('[data-key="email"]');
    var website = form.querySelector('[data-key="website"]');
    var hint = form.querySelector('[data-scsv3-phg-domain]');
    var errorEl = form.querySelector('[data-scsv3-phg-error]');
    var submit = form.querySelector('[data-scsv3-phg-submit]');

    function updateHint() {
      var r = check(email.value, website.value);
      if (!r.ready) {
        hint.dataset.tone = 'idle';
        hint.textContent = 'Enter your work email and company website to check for instant access.';
      } else if (r.ok) {
        hint.dataset.tone = 'ok';
        hint.textContent = r.e + ' matches ' + r.w + '. You will get instant access.';
      } else {
        hint.dataset.tone = 'warn';
        hint.textContent = FREE_MAIL.indexOf(r.e) > -1
          ? r.e + ' is a personal email, so this will need approval.' + (signedIn ? '' : ' Use your @' + r.w + ' address for instant access.')
          : r.e + " doesn't match " + r.w + ', so this will need approval (1 to 2 business days).';
      }
      return r;
    }
    email.addEventListener('input', updateHint);
    website.addEventListener('input', updateHint);
    updateHint();

    // ---- Address search: the same Google Places flow as the license tab ----
    // The manual fields are the only payload source. They stay hidden until an
    // address is picked, "enter manually" is clicked, or a submit finds them
    // empty. A test predictions request must succeed before the search box
    // accepts typing, so a rejected key falls back to manual entry at load.
    var searchWrap = form.querySelector('[data-scsv3-phg-addr-search]');
    var manualWrap = form.querySelector('[data-scsv3-phg-addr-fields]');
    var lookupInput = form.querySelector('#phg-addr-lookup');
    var manualBtn = form.querySelector('[data-scsv3-phg-addr-manual]');
    var placesBound = false, searchFailed = false, searchTouched = false;

    function addrField(key) { return form.querySelector('[data-key="' + key + '"]'); }
    function showManual() {
      manualWrap.hidden = false;
      manualWrap.style.display = '';
      if (manualBtn) { manualBtn.style.display = 'none'; }
    }
    function addressMissing() {
      return ['billing_street', 'billing_city', 'billing_country'].some(function (k) {
        return !(addrField(k).value || '').trim();
      });
    }
    function failSearch(reason) {
      if (searchFailed) { return; }
      searchFailed = true;
      if (searchTouched) {
        lookupInput.disabled = true;
        lookupInput.value = '';
        lookupInput.placeholder = 'Address search unavailable, use the fields below';
      } else {
        searchWrap.classList.remove('is-active');
      }
      showManual();
      if (reason && window.console) { console.info('[partner-application] address search disabled: ' + reason); }
    }
    function fillAddress(components) {
      var a = { street: '', city: '', state: '', postal: '', country: '' };
      components.forEach(function (c) {
        var longName = c.longText || c.long_name || '';
        var shortName = c.shortText || c.short_name || '';
        var types = c.types || [];
        if (types.indexOf('street_number') > -1) { a.street = longName; }
        if (types.indexOf('route') > -1) { a.street = (a.street ? a.street + ' ' : '') + longName; }
        if (types.indexOf('locality') > -1) { a.city = longName; }
        if (types.indexOf('administrative_area_level_1') > -1) { a.state = shortName; }
        if (types.indexOf('country') > -1) { a.country = longName; }
        if (types.indexOf('postal_code') > -1) { a.postal = longName; }
        if (!a.city && types.indexOf('sublocality_level_1') > -1) { a.city = longName; }
        if (!a.city && types.indexOf('postal_town') > -1) { a.city = longName; }
      });
      addrField('billing_street').value = a.street;
      addrField('billing_city').value = a.city;
      addrField('billing_state').value = a.state;
      addrField('billing_postal_code').value = a.postal;
      addrField('billing_country').value = a.country;
      showManual();
    }
    function searchBound() {
      placesBound = true;
      lookupInput.disabled = false;
      lookupInput.placeholder = 'Start typing your address…';
      searchWrap.classList.add('is-active');
    }
    function bindLegacy() {
      var ac = new google.maps.places.Autocomplete(lookupInput, { types: ['geocode'], fields: ['address_components'] });
      ac.addListener('place_changed', function () {
        var place = ac.getPlace();
        if (place && place.address_components) { fillAddress(place.address_components); }
      });
      searchBound();
    }
    function bindNewApi() {
      var pac = new google.maps.places.PlaceAutocompleteElement();
      pac.setAttribute('placeholder', 'Start typing your address…');
      lookupInput.hidden = true;
      lookupInput.insertAdjacentElement('beforebegin', pac);
      function pick(place) {
        if (!place) { return; }
        place.fetchFields({ fields: ['addressComponents'] }).then(function () { fillAddress(place.addressComponents || []); });
      }
      // gmp-select is the GA event; gmp-placeselect is what earlier versions fired.
      pac.addEventListener('gmp-select', function (ev) { if (ev.placePrediction) { pick(ev.placePrediction.toPlace()); } });
      pac.addEventListener('gmp-placeselect', function (ev) { pick(ev.place); });
      searchBound();
    }
    function initPlaces() {
      if (typeof google === 'undefined' || !google.maps || !google.maps.places) {
        failSearch('Google Maps loaded without the Places library');
        return;
      }
      if (google.maps.places.AutocompleteService && google.maps.places.Autocomplete) {
        try {
          new google.maps.places.AutocompleteService().getPlacePredictions({ input: '1 test street' }, function (preds, status) {
            if (searchFailed) { return; }
            if (status === 'OK' || status === 'ZERO_RESULTS') {
              try { bindLegacy(); } catch (e) { failSearch('could not bind the search box: ' + e.message); }
            } else {
              failSearch('Places test request returned ' + status);
            }
          });
          return;
        } catch (e) {}
      }
      // New-style keys have no cheap preflight: bind and rely on gm_authFailure.
      if (google.maps.places.PlaceAutocompleteElement) {
        try { bindNewApi(); return; } catch (e) {}
      }
      failSearch('no usable Places API on this key');
    }

    var mapsKey = root.dataset.mapsKey || '';
    if (manualBtn) { manualBtn.addEventListener('click', showManual); }
    // The browser validates on the button click, before the submit event, and stalls on hidden required fields.
    submit.addEventListener('click', function () { if (manualWrap.hidden && addressMissing()) { showManual(); } });
    if (!searchWrap || !lookupInput) {
      showManual();
    } else if (!mapsKey || mapsKey.indexOf('{') > -1) {
      failSearch('GOOGLE_MAPS_API_KEY store variable is empty or not synced');
    } else {
      searchWrap.classList.add('is-active');
      lookupInput.disabled = true;
      lookupInput.placeholder = 'Checking address search…';
      lookupInput.addEventListener('focus', function () { searchTouched = true; });
      lookupInput.addEventListener('input', function () { searchTouched = true; });
      lookupInput.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); } });
      // Google calls this on key/auth errors (e.g. RefererNotAllowedMapError).
      window.gm_authFailure = function () { failSearch('Google rejected the API key; check its referrer restrictions'); };
      setTimeout(function () { if (!placesBound) { failSearch('timed out loading Google Maps'); } }, 6000);
      if (typeof google !== 'undefined' && google.maps && google.maps.places) {
        initPlaces();
      } else {
        window.scsv3PhgPlacesLoaded = initPlaces;
        var s = document.createElement('script');
        s.async = true;
        s.src = 'https://maps.googleapis.com/maps/api/js?key=' + encodeURIComponent(mapsKey) + '&libraries=places&callback=scsv3PhgPlacesLoaded';
        s.onerror = function () { failSearch('the Google Maps script failed to load'); };
        document.head.appendChild(s);
      }
    }

    function collect() {
      var data = { submitter_uuid: root.dataset.submitterUuid || '' };
      form.querySelectorAll('[data-key]').forEach(function (el) {
        data[el.dataset.key] = el.type === 'checkbox' ? el.checked : (el.value || '').trim();
      });
      return data;
    }
    function readable(data) {
      var lines = [];
      form.querySelectorAll('.SCSV3-FormField').forEach(function (field) {
        var label = field.querySelector('label');
        if (!label || field.hasAttribute('data-scsv3-phg-addr-search')) { return; }
        var values = [];
        field.querySelectorAll('input, select, textarea').forEach(function (el) {
          if (el.type === 'checkbox') { values.push(el.checked ? 'Yes' : 'No'); return; }
          var v = el.tagName === 'SELECT' ? (el.value ? el.options[el.selectedIndex].text : '') : el.value.trim();
          if (v) { values.push(v); }
        });
        lines.push(label.textContent.replace(/\s+/g, ' ').trim() + '\n' + (values.length ? values.join(' ') : '—'));
      });
      lines.push('Signed in when applying\n' + (signedIn ? 'Yes' : 'No'));
      return lines.join('\n\n');
    }

    form.addEventListener('submit', function (e) {
      e.preventDefault();
      if (!form.checkValidity()) {
        errorEl.hidden = false;
        errorEl.textContent = 'Please fill in the required fields, including your company address, and accept the partner program terms.';
        form.reportValidity();
        return;
      }
      errorEl.hidden = true;
      var data = collect();
      var r = check(data.email, data.website);
      form.querySelector('[data-scsv3-phg-payload]').value = JSON.stringify(data);
      form.querySelector('[data-scsv3-phg-readable]').value = readable(data);
      submit.disabled = true;
      submit.textContent = 'Sending…';
      fetch(form.action, { method: form.method || 'POST', body: new FormData(form), credentials: 'same-origin', redirect: 'manual' })
        .then(function (res) {
          if (res.type !== 'opaqueredirect' && !res.ok) { throw new Error('HTTP ' + res.status); }
          var kind = r.ok ? 'instant' : 'pending';
          var shown = { first: data.first_name, email: data.email, domain: r.w, company: data.company, reason: r.reason };
          save({ at: Date.now(), kind: kind, data: shown });
          showResult(kind, shown);
          root.scrollIntoView({ behavior: 'smooth', block: 'start' });
        })
        .catch(function () {
          submit.disabled = false;
          submit.textContent = 'Apply and unlock the hub';
          errorEl.hidden = false;
          errorEl.textContent = "We couldn't send your application just now. Please try again, or email partners@storeconnect.com.";
        });
    });
  })();
</script>