/* global React, Glyph, SourceChip */
// reo-privacy.jsx — Privacy block variants + shared visuals (tenant diagram,
// scope selector). Exported to window for use in reo-page.jsx and reo-app.jsx.

const { useState: useStateP } = React;

/* ----------------------------------------------------------- ScopeSelector
 * Tiny gesture-of-a-product-screenshot showing the historical + forward
 * scope controls. Interactive on the marketing page (you can flip values),
 * but the real control lives in Settings.
 */
function ScopeSelector({ compact = false }) {
  const [historical, setHistorical] = useStateP("90d");
  const [forward, setForward] = useStateP({
    sentToMe: true,
    replied: true,
    sent: true,
    cc: false,
    bcc: false,
    contacts: false,
    labels: false,
    all: false
  });

  const histOptions = [
    { id: "none", label: "None" },
    { id: "30d",  label: "30 d" },
    { id: "90d",  label: "90 d", note: "default" },
    { id: "6mo",  label: "6 mo" },
    { id: "1y",   label: "1 y" },
    { id: "2y",   label: "2 y" },
    { id: "all",  label: "All time" }
  ];

  const fwdOptions = [
    { id: "sentToMe", label: "Sent directly to me" },
    { id: "replied",  label: "Threads I've replied to" },
    { id: "sent",     label: "My sent mail" },
    { id: "cc",       label: "Where I'm on CC" },
    { id: "bcc",      label: "Where I'm on BCC" },
    { id: "contacts", label: "From prior contacts" },
    { id: "labels",   label: "Labels I specify" },
    { id: "all",      label: "All incoming",
      sub: "(advanced — not recommended)" }
  ];

  return (
    <div style={{
      background: "var(--paper)",
      border: "1px solid var(--rule-2)",
      borderRadius: 6,
      padding: compact ? "16px 18px" : "20px 22px",
      display: "flex", flexDirection: "column", gap: 16,
      position: "relative"
    }}>
      {/* Window-chrome row */}
      <div style={{
        display: "flex", alignItems: "center", justifyContent: "space-between",
        gap: 12, paddingBottom: 12,
        borderBottom: "1px dashed var(--rule-2)"
      }}>
        <div style={{
          display: "inline-flex", alignItems: "center", gap: 8,
          fontFamily: "var(--font-mono)", fontSize: 10.5,
          color: "var(--ink-3)", letterSpacing: "0.06em",
          textTransform: "uppercase"
        }}>
          <span style={{
            width: 14, height: 14, borderRadius: 3,
            background: "var(--accent-tint)",
            border: "1px solid var(--accent-tint-2)",
            color: "var(--accent)",
            display: "inline-flex", alignItems: "center", justifyContent: "center"
          }}><Glyph name="eye-off" size={9} stroke={1.6}/></span>
          Scope · onboarding step 02
        </div>
        <span style={{
          fontFamily: "var(--font-mono)", fontSize: 10,
          color: "var(--ink-4)", letterSpacing: "0.06em"
        }}>EDITABLE ANY TIME · SETTINGS → SCOPE</span>
      </div>

      {/* Historical row */}
      <div>
        <div style={{
          display: "flex", justifyContent: "space-between", alignItems: "baseline",
          marginBottom: 10
        }}>
          <span style={{
            fontFamily: "var(--font-mono)", fontSize: 10.5,
            color: "var(--ink-3)", letterSpacing: "0.06em",
            textTransform: "uppercase"
          }}>Historical scope</span>
          <span style={{ fontSize: 12, color: "var(--ink-4)" }}>
            How far back may Reo read?
          </span>
        </div>
        <div style={{ display: "flex", flexWrap: "wrap", gap: 6 }}>
          {histOptions.map(o => {
            const active = historical === o.id;
            return (
              <button key={o.id}
                onClick={() => setHistorical(o.id)}
                style={{
                  background: active ? "var(--ink)" : "var(--paper-2)",
                  color: active ? "var(--paper)" : "var(--ink-2)",
                  border: `1px solid ${active ? "var(--ink)" : "var(--rule-2)"}`,
                  borderRadius: 4, padding: "6px 12px",
                  fontFamily: "var(--font-sans)", fontSize: 12,
                  cursor: "pointer", letterSpacing: "-0.005em",
                  display: "inline-flex", alignItems: "center", gap: 6,
                  whiteSpace: "nowrap"
                }}>
                {o.label}
                {o.note && (
                  <span style={{
                    fontFamily: "var(--font-mono)", fontSize: 9,
                    opacity: 0.65, letterSpacing: "0.04em"
                  }}>· {o.note}</span>
                )}
              </button>
            );
          })}
        </div>
      </div>

      {/* Forward row */}
      <div>
        <div style={{
          display: "flex", justifyContent: "space-between", alignItems: "baseline",
          marginBottom: 10
        }}>
          <span style={{
            fontFamily: "var(--font-mono)", fontSize: 10.5,
            color: "var(--ink-3)", letterSpacing: "0.06em",
            textTransform: "uppercase"
          }}>Forward scope</span>
          <span style={{ fontSize: 12, color: "var(--ink-4)" }}>
            Which threads may Reo watch?
          </span>
        </div>
        <div style={{
          display: "grid",
          gridTemplateColumns: "repeat(2, 1fr)",
          gap: 6
        }}>
          {fwdOptions.map(o => {
            const on = forward[o.id];
            return (
              <button key={o.id}
                onClick={() => setForward(f => ({ ...f, [o.id]: !f[o.id] }))}
                style={{
                  background: on ? "var(--accent-tint)" : "var(--paper-2)",
                  border: `1px solid ${on ? "var(--accent-tint-2)" : "var(--rule-2)"}`,
                  borderRadius: 4, padding: "8px 12px",
                  fontFamily: "var(--font-sans)", fontSize: 12.5,
                  color: on ? "var(--accent)" : "var(--ink-3)",
                  cursor: "pointer", textAlign: "left",
                  letterSpacing: "-0.005em",
                  display: "flex", alignItems: "center", gap: 8
                }}>
                <span style={{
                  width: 14, height: 14, borderRadius: 3,
                  background: on ? "var(--accent)" : "var(--paper)",
                  border: `1px solid ${on ? "var(--accent)" : "var(--rule-strong)"}`,
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  flexShrink: 0
                }}>
                  {on && (
                    <svg width="9" height="9" viewBox="0 0 10 10">
                      <path d="M2 5l2 2 4-4" stroke="var(--paper)" strokeWidth="1.6"
                            strokeLinecap="round" strokeLinejoin="round" fill="none"/>
                    </svg>
                  )}
                </span>
                <span style={{ display: "flex", flexDirection: "column", gap: 1, minWidth: 0 }}>
                  <span style={{ overflow: "hidden", textOverflow: "ellipsis" }}>{o.label}</span>
                  {o.sub && (
                    <span style={{
                      fontFamily: "var(--font-mono)", fontSize: 9.5,
                      color: "var(--ink-4)", letterSpacing: "0.02em"
                    }}>{o.sub}</span>
                  )}
                </span>
              </button>
            );
          })}
        </div>
      </div>

      {/* footer caption */}
      <div style={{
        paddingTop: 12, borderTop: "1px dashed var(--rule-2)",
        display: "flex", alignItems: "center", justifyContent: "space-between",
        fontFamily: "var(--font-mono)", fontSize: 10.5,
        color: "var(--ink-3)", letterSpacing: "0.04em"
      }}>
        <span>
          Conservative defaults · advanced reachable, never pushed
        </span>
        <span style={{ color: "var(--ink-4)" }}>
          ~{Math.min(15, 4 + Object.values(forward).filter(Boolean).length * 2)}% of inbox eligible
        </span>
      </div>
    </div>
  );
}

/* ----------------------------------------------------------- TenantDiagram
 * SVG. Shows your tenant as an opaque walled vault; ghosted neighbour
 * tenants beside; a horizontal "Reo platform" line beneath all of them with
 * NO arrows crossing between vaults. The point is the absence of arrows.
 */
function TenantDiagram({ height = 280 }) {
  return (
    <svg viewBox="0 0 600 320" style={{ width: "100%", height: "auto", display: "block" }}>
      <defs>
        <pattern id="ghost-hatch" patternUnits="userSpaceOnUse" width="6" height="6" patternTransform="rotate(45)">
          <line x1="0" y1="0" x2="0" y2="6" stroke="oklch(0.72 0.005 85)" strokeWidth="0.7"/>
        </pattern>
      </defs>

      {/* Eyebrow labels for tenants */}
      <text x="80" y="38" textAnchor="middle"
        fontFamily="Geist Mono, monospace" fontSize="9" letterSpacing="1.5"
        fill="oklch(0.58 0.006 270)">TENANT — JANE</text>
      <text x="300" y="38" textAnchor="middle"
        fontFamily="Geist Mono, monospace" fontSize="9" letterSpacing="1.5"
        fill="oklch(0.32 0.15 268)">TENANT — YOU</text>
      <text x="520" y="38" textAnchor="middle"
        fontFamily="Geist Mono, monospace" fontSize="9" letterSpacing="1.5"
        fill="oklch(0.58 0.006 270)">TENANT — DAVID</text>

      {/* ghost tenant left */}
      <g opacity="0.55">
        <rect x="20" y="50" width="120" height="180" rx="4"
          fill="url(#ghost-hatch)" stroke="oklch(0.72 0.005 85)" strokeWidth="1" strokeDasharray="3 3"/>
        <rect x="36" y="68" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="36" y="90" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="36" y="112" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="36" y="134" width="60" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <text x="80" y="200" textAnchor="middle"
          fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.58 0.006 270)" letterSpacing="0.08em">SEALED</text>
      </g>

      {/* your tenant (focal) */}
      <g>
        <rect x="220" y="50" width="160" height="180" rx="4"
          fill="oklch(0.985 0.002 90)" stroke="oklch(0.32 0.15 268)" strokeWidth="1.5"/>
        {/* the storage rows */}
        <rect x="240" y="68" width="120" height="16" rx="2" fill="oklch(0.95 0.025 268)"/>
        <text x="248" y="79" fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.32 0.15 268)" letterSpacing="0.06em">YOUR-EMAIL.STORE</text>
        <rect x="240" y="92" width="120" height="16" rx="2" fill="oklch(0.95 0.025 268)"/>
        <text x="248" y="103" fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.32 0.15 268)" letterSpacing="0.06em">YOUR-EMBEDDINGS</text>
        <rect x="240" y="116" width="120" height="16" rx="2" fill="oklch(0.95 0.025 268)"/>
        <text x="248" y="127" fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.32 0.15 268)" letterSpacing="0.06em">YOUR-SKILLS</text>
        <rect x="240" y="140" width="120" height="16" rx="2" fill="oklch(0.95 0.025 268)"/>
        <text x="248" y="151" fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.32 0.15 268)" letterSpacing="0.06em">YOUR-DIGEST.LOG</text>

        {/* vault label */}
        <text x="300" y="200" textAnchor="middle"
          fontFamily="Geist, sans-serif" fontSize="13" fontWeight="500"
          fill="oklch(0.32 0.15 268)">Scoped to you alone</text>
        <text x="300" y="216" textAnchor="middle"
          fontFamily="Geist Mono, monospace" fontSize="9.5"
          fill="oklch(0.45 0.008 270)" letterSpacing="0.06em">NO SHARED INDEX</text>
      </g>

      {/* ghost tenant right */}
      <g opacity="0.55">
        <rect x="460" y="50" width="120" height="180" rx="4"
          fill="url(#ghost-hatch)" stroke="oklch(0.72 0.005 85)" strokeWidth="1" strokeDasharray="3 3"/>
        <rect x="476" y="68" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="476" y="90" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="476" y="112" width="88" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <rect x="476" y="134" width="74" height="14" rx="2" fill="oklch(0.92 0.004 85)"/>
        <text x="520" y="200" textAnchor="middle"
          fontFamily="Geist Mono, monospace" fontSize="9"
          fill="oklch(0.58 0.006 270)" letterSpacing="0.08em">SEALED</text>
      </g>

      {/* no-arrows annotation between tenants */}
      <g>
        <line x1="146" y1="140" x2="216" y2="140"
          stroke="oklch(0.72 0.005 85)" strokeWidth="1" strokeDasharray="2 4"/>
        <circle cx="181" cy="140" r="10" fill="oklch(0.985 0.002 90)" stroke="oklch(0.58 0.006 270)" strokeWidth="1"/>
        <line x1="176" y1="135" x2="186" y2="145" stroke="oklch(0.58 0.006 270)" strokeWidth="1.2"/>
        <line x1="186" y1="135" x2="176" y2="145" stroke="oklch(0.58 0.006 270)" strokeWidth="1.2"/>

        <line x1="384" y1="140" x2="454" y2="140"
          stroke="oklch(0.72 0.005 85)" strokeWidth="1" strokeDasharray="2 4"/>
        <circle cx="419" cy="140" r="10" fill="oklch(0.985 0.002 90)" stroke="oklch(0.58 0.006 270)" strokeWidth="1"/>
        <line x1="414" y1="135" x2="424" y2="145" stroke="oklch(0.58 0.006 270)" strokeWidth="1.2"/>
        <line x1="424" y1="135" x2="414" y2="145" stroke="oklch(0.58 0.006 270)" strokeWidth="1.2"/>
      </g>

      {/* platform line */}
      <line x1="20" y1="260" x2="580" y2="260"
        stroke="oklch(0.72 0.005 85)" strokeWidth="0.5"/>
      <text x="300" y="278" textAnchor="middle"
        fontFamily="Geist Mono, monospace" fontSize="9.5"
        fill="oklch(0.45 0.008 270)" letterSpacing="0.06em">
        REO PLATFORM · NO CROSS-TENANT INDEX · NO SHARED MODEL TRAINED ON YOU
      </text>
      <text x="300" y="296" textAnchor="middle"
        fontFamily="Geist Mono, monospace" fontSize="9.5"
        fill="oklch(0.45 0.008 270)" letterSpacing="0.06em">
        NO REO ENGINEER CAN READ ACROSS TENANTS
      </text>
    </svg>
  );
}

/* ============================================================ Variant A
 * DIAGRAMMATIC — TenantDiagram dominates the section; principles are short
 * captions running underneath.
 */
function PrivacyVariantA() {
  const principles = [
    { n: "01", title: "Tenant-isolated by design",
      body: "Storage, embeddings, and Skills are scoped to your account alone. No shared index across users; no model trained on your mail." },
    { n: "02", title: "You set the scope",
      body: "During onboarding (editable any time) you pick how far back Reo may read and which threads it may watch." },
    { n: "03", title: "Sensitive content quarantined",
      body: "HR, medical, financial, legal, privileged, personal — auto-excluded by default. You opt in, never out." },
    { n: "04", title: "Audience disclosed on every action",
      body: "Before anything touches the outside world, you see who will receive it." }
  ];
  return (
    <div className="reo-page" style={{ width: 1366, padding: "72px 80px", background: "var(--paper)" }}>
      <div style={{ display: "flex", alignItems: "flex-end", justifyContent: "space-between", marginBottom: 40 }}>
        <div>
          <span className="eyebrow">A · Diagrammatic · architecture-first</span>
          <h2 style={{
            fontSize: 52, lineHeight: 1.02,
            letterSpacing: "-0.025em", fontWeight: 450,
            margin: "16px 0 0 0", textWrap: "balance", maxWidth: 780
          }}>
            Your inbox lives in its own tenant.<br/>
            <span style={{ color: "var(--ink-4)" }}>It is the architecture, not a section.</span>
          </h2>
        </div>
        <a href="#" className="reo-link" style={{ fontSize: 13 }}>
          See how Reo handles your data →
        </a>
      </div>

      <div className="dotframe" style={{ padding: 24, marginBottom: 36 }}>
        <span className="corner-bl"></span><span className="corner-br"></span>
        <span className="corner-label">TENANT ISOLATION · YOUR DATA, YOUR VAULT</span>
        <span className="corner-meta">FIG. A · ARCHITECTURE</span>
        <TenantDiagram/>
      </div>

      <div style={{
        display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 0,
        borderTop: "1px solid var(--rule)"
      }}>
        {principles.map((p, i) => (
          <div key={p.n} style={{
            padding: "26px 22px 4px",
            borderRight: i < 3 ? "1px solid var(--rule)" : "none",
            display: "flex", flexDirection: "column", gap: 10
          }}>
            <span style={{
              fontFamily: "var(--font-mono)", fontSize: 11,
              color: "var(--ink-4)", letterSpacing: "0.06em"
            }}>{p.n}</span>
            <h3 style={{
              fontSize: 17, fontWeight: 500,
              letterSpacing: "-0.012em", margin: 0,
              color: "var(--ink)", textWrap: "balance"
            }}>{p.title}</h3>
            <p style={{
              fontSize: 13.5, lineHeight: 1.55, margin: 0,
              color: "var(--ink-3)", textWrap: "pretty"
            }}>{p.body}</p>
          </div>
        ))}
      </div>
    </div>
  );
}

/* ============================================================ Variant B
 * TYPOGRAPHIC-LED — four sober declarative statements set big, with mono
 * inline asides. No diagrams; the typography carries the architecture.
 */
function PrivacyVariantB() {
  const statements = [
    { lead: "Your inbox lives in", strong: "its own tenant.",
      tail: "Storage, embeddings, and Skills are scoped to your account alone.",
      aside: "no shared index · no cross-tenant model · no engineer read access" },
    { lead: "You decide", strong: "how much Reo reads.",
      tail: "Historical scope from 30 days to all time. Forward scope across eight rule types.",
      aside: "conservative defaults · editable any time · settings → scope" },
    { lead: "Sensitive threads", strong: "are quarantined.",
      tail: "HR, medical, financial, legal, privileged, personal — auto-excluded by default.",
      aside: "you opt in, never out" },
    { lead: "Audience is", strong: "disclosed on every action.",
      tail: "Before anything touches the outside world, you see who will receive it.",
      aside: "no quiet broadcasts" }
  ];
  return (
    <div className="reo-page" style={{ width: 1366, padding: "72px 80px 80px", background: "var(--paper)" }}>
      <div style={{ display: "flex", alignItems: "flex-end", justifyContent: "space-between", marginBottom: 56 }}>
        <div>
          <span className="eyebrow">B · Typographic · sober declarations</span>
          <h2 style={{
            fontSize: 52, lineHeight: 1.02,
            letterSpacing: "-0.025em", fontWeight: 450,
            margin: "16px 0 0 0", textWrap: "balance", maxWidth: 780
          }}>
            Privacy is the architecture.<br/>
            <span style={{ color: "var(--ink-4)" }}>Read it, then click into anything that needs proof.</span>
          </h2>
        </div>
        <a href="#" className="reo-link" style={{ fontSize: 13 }}>
          See how Reo handles your data →
        </a>
      </div>

      <div style={{ borderTop: "1px solid var(--rule)" }}>
        {statements.map((s, i) => (
          <div key={i} style={{
            padding: "36px 0",
            borderBottom: "1px solid var(--rule)",
            display: "grid",
            gridTemplateColumns: "60px 1fr 280px",
            gap: 36, alignItems: "baseline"
          }}>
            <span style={{
              fontFamily: "var(--font-mono)", fontSize: 13,
              color: "var(--ink-4)", letterSpacing: "0.06em"
            }}>0{i+1} —</span>
            <h3 style={{
              fontSize: 38, lineHeight: 1.1,
              letterSpacing: "-0.02em", fontWeight: 450,
              margin: 0, color: "var(--ink)",
              textWrap: "balance"
            }}>
              <span style={{ color: "var(--ink-4)" }}>{s.lead}</span>{" "}
              <span style={{ color: "var(--ink)" }}>{s.strong}</span>
              <div style={{ fontSize: 18, lineHeight: 1.45, color: "var(--ink-3)", marginTop: 14, fontWeight: 400, textWrap: "pretty" }}>
                {s.tail}
              </div>
            </h3>
            <span style={{
              fontFamily: "var(--font-mono)", fontSize: 11.5,
              color: "var(--ink-3)", letterSpacing: "0.02em",
              textWrap: "pretty", lineHeight: 1.6
            }}>
              <span style={{
                display: "inline-block", width: 16, height: 1,
                background: "var(--accent)", verticalAlign: "middle", marginRight: 8
              }}/>
              {s.aside}
            </span>
          </div>
        ))}
      </div>
    </div>
  );
}

/* ============================================================ Variant C
 * IN-BETWEEN — typographic block + a quiet tenant ribbon at the top + a
 * scope-selector gesture inline. This is the version the committed page
 * uses.
 */
function PrivacyVariantC({ embed = false }) {
  const principles = [
    {
      n: "01",
      title: "Tenant-isolated by design",
      body: "Storage, embeddings, and Skills are scoped to your account alone. No shared index across users; no model trained on your mail; no Reo engineer can read across tenants.",
      proof: "tenant → you · sealed",
      diagram: <TenantRibbon/>
    },
    {
      n: "02",
      title: "You set the scope",
      body: "During onboarding (editable any time) you pick how far back Reo may read and which threads it may watch. Defaults err conservative.",
      proof: "historical · forward · editable",
      diagram: null /* shown separately below the row */
    },
    {
      n: "03",
      title: "Sensitive content quarantined",
      body: "HR, medical, financial, legal, privileged, personal — auto-excluded by default. You opt in, never out.",
      proof: "you opt in · never out"
    },
    {
      n: "04",
      title: "Audience disclosed on every action",
      body: "Before anything touches the outside world, you see who will receive it. No quiet broadcasts.",
      proof: "disclosed before send"
    }
  ];

  return (
    <div className={embed ? undefined : "reo-page"} style={{
      width: embed ? "auto" : 1366,
      padding: embed ? 0 : "72px 80px 80px",
      background: embed ? undefined : "var(--paper)"
    }}>
      {!embed && (
        <div style={{ display: "flex", alignItems: "flex-end", justifyContent: "space-between", marginBottom: 48 }}>
          <div>
            <span className="eyebrow">C · Hybrid · committed direction</span>
            <h2 style={{
              fontSize: 52, lineHeight: 1.02,
              letterSpacing: "-0.025em", fontWeight: 450,
              margin: "16px 0 0 0", textWrap: "balance", maxWidth: 780
            }}>
              Your inbox lives in its own tenant.<br/>
              <span style={{ color: "var(--ink-4)" }}>Privacy is the architecture, not a section.</span>
            </h2>
          </div>
          <a href="#" className="reo-link" style={{ fontSize: 13 }}>
            See how Reo handles your data →
          </a>
        </div>
      )}

      <div style={{
        display: "grid",
        gridTemplateColumns: "1.05fr 1fr",
        gap: 48
      }}>
        {/* left: principles */}
        <div style={{ display: "flex", flexDirection: "column" }}>
          {principles.map((p, i) => (
            <div key={p.n} style={{
              padding: "26px 0",
              borderTop: i === 0 ? "1px solid var(--rule)" : "none",
              borderBottom: "1px solid var(--rule)",
              display: "grid",
              gridTemplateColumns: "40px 1fr",
              gap: 22
            }}>
              <span style={{
                fontFamily: "var(--font-mono)", fontSize: 11,
                color: "var(--ink-4)", letterSpacing: "0.06em",
                paddingTop: 4
              }}>{p.n}</span>
              <div>
                <h3 style={{
                  fontSize: 20, fontWeight: 500,
                  letterSpacing: "-0.015em", margin: "0 0 6px 0",
                  color: "var(--ink)"
                }}>{p.title}</h3>
                <p style={{
                  fontSize: 15, lineHeight: 1.55,
                  color: "var(--ink-3)", margin: "0 0 10px 0", textWrap: "pretty"
                }}>{p.body}</p>
                <span style={{
                  fontFamily: "var(--font-mono)", fontSize: 10.5,
                  color: "var(--accent)", letterSpacing: "0.06em",
                  textTransform: "uppercase",
                  display: "inline-flex", alignItems: "center", gap: 6
                }}>
                  <span style={{ width: 10, height: 1, background: "var(--accent)" }}/>
                  {p.proof}
                </span>
                {p.diagram && <div style={{ marginTop: 14 }}>{p.diagram}</div>}
              </div>
            </div>
          ))}
        </div>

        {/* right: tenant diagram + scope selector */}
        <div style={{ display: "flex", flexDirection: "column", gap: 24 }}>
          <div className="dotframe" style={{ padding: 20 }}>
            <span className="corner-bl"></span><span className="corner-br"></span>
            <span className="corner-label">TENANT ISOLATION · YOUR DATA, YOUR VAULT</span>
            <span className="corner-meta">FIG. 02</span>
            <TenantDiagram/>
          </div>
          <div className="dotframe" style={{ padding: 20 }}>
            <span className="corner-bl"></span><span className="corner-br"></span>
            <span className="corner-label">SCOPE · USER-CONTROLLED · DEFAULT VIEW</span>
            <span className="corner-meta">FIG. 03</span>
            <ScopeSelector compact/>
          </div>
        </div>
      </div>
    </div>
  );
}

/* ----------------------------------------------------------- TenantRibbon
 * Quiet horizontal ribbon used inline under the "tenant-isolated" principle
 * in Variant C — three slats, only the middle one is yours.
 */
function TenantRibbon() {
  return (
    <div style={{
      display: "grid", gridTemplateColumns: "1fr 1.2fr 1fr",
      gap: 6, marginTop: 4
    }}>
      {[
        { ghost: true, label: "tenant — jane" },
        { ghost: false, label: "tenant — you" },
        { ghost: true, label: "tenant — david" }
      ].map((t, i) => (
        <div key={i} style={{
          height: 48,
          background: t.ghost
            ? "repeating-linear-gradient(45deg, var(--paper-2) 0 4px, var(--paper-3) 4px 8px)"
            : "var(--accent-tint)",
          border: `1px solid ${t.ghost ? "var(--rule-2)" : "var(--accent-tint-2)"}`,
          borderRadius: 4,
          display: "flex", alignItems: "center", justifyContent: "center",
          fontFamily: "var(--font-mono)", fontSize: 10,
          letterSpacing: "0.08em", textTransform: "uppercase",
          color: t.ghost ? "var(--ink-4)" : "var(--accent)",
          opacity: t.ghost ? 0.7 : 1
        }}>
          {t.label}
        </div>
      ))}
    </div>
  );
}

Object.assign(window, { ScopeSelector, TenantDiagram, TenantRibbon, PrivacyVariantA, PrivacyVariantB, PrivacyVariantC });
