<svg width="100%" viewBox="0 0 760 660" role="img" xmlns="http://www.w3.org/2000/svg">
  <title>SoftAP onboarding — boot to paired</title>
  <desc>A fresh Pi broadcasts its own WiFi, captures the user's home WiFi password + claim code through a captive portal, joins the home network, confirms the claim, and starts heartbeats.</desc>
  <style>
    text{font-family:"Anthropic Sans",-apple-system,system-ui,"Segoe UI",sans-serif}
    .t{font-size:14px;font-weight:500;text-anchor:middle;dominant-baseline:central}
    .s{font-size:12px;text-anchor:middle;dominant-baseline:central}
    .stp{font-size:12px;fill:#c2c0b6}
    rect{stroke-width:.5}
    .green{fill:#27500a;stroke:#97c459}   .gt{fill:#c0dd97} .gs{fill:#97c459}
    .neutral{fill:#444441;stroke:#b4b2a9} .nt{fill:#d3d1c7} .ns{fill:#b4b2a9}
    .blue{fill:#1f3b7a;stroke:#8aaef0}    .bt{fill:#cfdcf4} .bs{fill:#8aaef0}
    .arrow{fill:none;stroke:#9c9a92;stroke-width:1.5}
    .arrow-ok{fill:none;stroke:#1d9e75;stroke-width:1.5}
  </style>
  <defs>
    <marker id="a" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
      <path d="M2 1L8 5L2 9" fill="none" stroke="context-stroke" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
    </marker>
  </defs>

  <text class="stp" x="40" y="64">1</text>
  <text class="stp" x="40" y="164">2</text>
  <text class="stp" x="40" y="264">3</text>
  <text class="stp" x="40" y="364">4</text>
  <text class="stp" x="40" y="464">5</text>
  <text class="stp" x="40" y="564">6</text>

  <rect class="green" x="120" y="40" width="560" height="60" rx="8"/>
  <text class="t gt" x="400" y="64">Pi boots with no WiFi credentials</text>
  <text class="s gs" x="400" y="84">broadcasts its own SoftAP</text>

  <rect class="neutral" x="120" y="140" width="560" height="60" rx="8"/>
  <text class="t nt" x="400" y="164">User joins the Pi's WiFi from their phone</text>
  <text class="s ns" x="400" y="184">captive portal opens on :18091</text>

  <rect class="neutral" x="120" y="240" width="560" height="60" rx="8"/>
  <text class="t nt" x="400" y="264">User enters home WiFi password + claim code</text>
  <text class="s ns" x="400" y="284">claim code binds the device to their account</text>

  <rect class="green" x="120" y="340" width="560" height="60" rx="8"/>
  <text class="t gt" x="400" y="364">Pi joins the home WiFi</text>
  <text class="s gs" x="400" y="384">SoftAP shuts down</text>

  <rect class="blue" x="120" y="440" width="560" height="60" rx="8"/>
  <text class="t bt" x="400" y="464">Pi confirms the claim → /v1/claim/confirm</text>
  <text class="s bs" x="400" y="484">sudo-api mints a Device JWT (HS256, 1-year)</text>

  <rect class="green" x="120" y="540" width="560" height="80" rx="8"/>
  <text class="t gt" x="400" y="566">Paired ✅</text>
  <text class="s gs" x="400" y="586">plays the ready cue · joins room_&lt;uid&gt;</text>
  <text class="s gs" x="400" y="604">starts ~30s heartbeat that keeps the agent warm</text>

  <path class="arrow"    d="M 400 100 L 400 138" marker-end="url(#a)"/>
  <path class="arrow"    d="M 400 200 L 400 238" marker-end="url(#a)"/>
  <path class="arrow"    d="M 400 300 L 400 338" marker-end="url(#a)"/>
  <path class="arrow"    d="M 400 400 L 400 438" marker-end="url(#a)"/>
  <path class="arrow-ok" d="M 400 500 L 400 538" marker-end="url(#a)"/>
</svg>
