<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 960 280" xmlns="http://www.w3.org/2000/svg"
     font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif">

  <defs>
    <marker id="arr" markerWidth="8" markerHeight="8" refX="6" refY="3" orient="auto">
      <path d="M0,0 L0,6 L8,3 Z" fill="#94A3B8"/>
    </marker>
  </defs>

  <!-- Background -->
  <rect width="960" height="280" fill="#F8FAFC" rx="10"/>

  <!-- Title -->
  <text x="480" y="28" text-anchor="middle" font-size="13" font-weight="700" fill="#1E293B">Inverter Control Architecture</text>
  <line x1="20" y1="36" x2="940" y2="36" stroke="#E2E8F0" stroke-width="1"/>

  <!-- ════════════════════════════════════
       SOURCE: HA Entity Write
       ════════════════════════════════════ -->
  <rect x="370" y="48" width="220" height="44" rx="7" fill="#F1F5F9" stroke="#475569" stroke-width="1.5"/>
  <text x="480" y="65" text-anchor="middle" font-size="11" font-weight="700" fill="#0F172A">HA Select / Number Entity</text>
  <text x="480" y="82" text-anchor="middle" font-size="10" fill="#475569">User changes setting in Home Assistant</text>

  <!-- Arrow left to Persistent -->
  <line x1="420" y1="92" x2="260" y2="131" stroke="#94A3B8" stroke-width="1.5" marker-end="url(#arr)"/>
  <text x="310" y="106" text-anchor="middle" font-size="9" fill="#64748B">SPH · SPF · MOD</text>

  <!-- Arrow right to VPP -->
  <line x1="540" y1="92" x2="700" y2="131" stroke="#94A3B8" stroke-width="1.5" marker-end="url(#arr)"/>
  <text x="650" y="106" text-anchor="middle" font-size="9" fill="#64748B">WIT</text>

  <!-- ════════════════════════════════════
       LEFT: Persistent Register Write
       ════════════════════════════════════ -->
  <rect x="60" y="133" width="300" height="100" rx="7" fill="#F0FDF4" stroke="#16A34A" stroke-width="1.5"/>
  <text x="210" y="152" text-anchor="middle" font-size="11" font-weight="700" fill="#15803D">Persistent Register Write</text>
  <line x1="65" y1="158" x2="355" y2="158" stroke="#BBF7D0" stroke-width="1"/>
  <text x="210" y="173" text-anchor="middle" font-size="10" fill="#166534">Holding registers 1000–3999</text>
  <text x="210" y="187" text-anchor="middle" font-size="10" fill="#166534">Takes effect immediately</text>
  <text x="210" y="201" text-anchor="middle" font-size="10" fill="#166534">Survives inverter restart</text>
  <text x="210" y="222" text-anchor="middle" font-size="9" fill="#15803D" font-style="italic">Set once and forget</text>

  <!-- ════════════════════════════════════
       RIGHT: VPP Time-Limited Override
       ════════════════════════════════════ -->
  <rect x="600" y="133" width="300" height="100" rx="7" fill="#EFF6FF" stroke="#3B82F6" stroke-width="1.5"/>
  <text x="750" y="152" text-anchor="middle" font-size="11" font-weight="700" fill="#1D4ED8">VPP Time-Limited Override</text>
  <line x1="605" y1="158" x2="895" y2="158" stroke="#BFDBFE" stroke-width="1"/>
  <text x="750" y="173" text-anchor="middle" font-size="10" fill="#1E40AF">VPP registers 30xxx range</text>
  <text x="750" y="187" text-anchor="middle" font-size="10" fill="#1E40AF">Activates timed override</text>
  <text x="750" y="201" text-anchor="middle" font-size="10" fill="#1E40AF">Expires on duration or HA restart</text>
  <text x="750" y="222" text-anchor="middle" font-size="9" fill="#1D4ED8" font-style="italic">Inverter returns to TOU schedule</text>

  <!-- Arrow down from both to Verification -->
  <line x1="210" y1="233" x2="420" y2="255" stroke="#94A3B8" stroke-width="1.5" marker-end="url(#arr)"/>
  <line x1="750" y1="233" x2="540" y2="255" stroke="#94A3B8" stroke-width="1.5" marker-end="url(#arr)"/>

  <!-- ════════════════════════════════════
       BOTTOM: Read-back Verification
       ════════════════════════════════════ -->
  <rect x="350" y="256" width="260" height="16" rx="5" fill="#F1F5F9" stroke="#CBD5E1" stroke-width="1"/>
  <text x="480" y="268" text-anchor="middle" font-size="9" fill="#475569" font-weight="600">Read-back verification after every write</text>

</svg>
