/* global React, Icons, Pill, Btn, Avatar, StatusBar */
/* Video reference frames — 14 frames (Frame A + Frame B for each of 7 videos).
   Each frame component renders the contents of a phone screen (everything
   below the StatusBar). The Stage wrapper handles the 9:16 backdrop. */

const { useState: useStateVF } = React;

// ────────────────────────────────────────────────────────────────
// SHARED PIECES
// ────────────────────────────────────────────────────────────────

// A monospaced uppercase eyebrow for inside the phone
function Eyebrow({ children, tone = "ink-3", style = {} }) {
  return (
    <div style={{
      fontFamily: "var(--mono)", fontSize: 10.5, letterSpacing: 2.4,
      textTransform: "uppercase", color: `var(--${tone})`, ...style,
    }}>{children}</div>
  );
}

// Mock top app bar (V glyph + wordmark on left, optional actions on right)
function MiniTopBar({ right, title }) {
  return (
    <div style={{ padding: "10px 20px 0 20px", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
      <div style={{ display: "flex", alignItems: "center", gap: 9 }}>
        <img src="logo-glyph.png" alt="" width={24} height={24} style={{ display: "block" }} />
        <span style={{ fontFamily: "var(--serif)", fontSize: 17, fontWeight: 500, color: "var(--ink)", letterSpacing: -0.4 }}>VakeelOS</span>
      </div>
      {right && <div style={{ display: "flex", gap: 4, alignItems: "center" }}>{right}</div>}
    </div>
  );
}

const headerBtn = {
  width: 34, height: 34, borderRadius: 999, background: "transparent", border: "none",
  color: "var(--ink-2)", cursor: "pointer", display: "inline-flex", alignItems: "center", justifyContent: "center",
  position: "relative",
};

// Bottom tab bar — simplified
function MiniTabBar({ active = "today" }) {
  const tabs = [
    { id: "today",     label: "Today",     icon: Icons.home },
    { id: "cases",     label: "Cases",     icon: Icons.cases },
    { id: "ai",        label: "",          icon: Icons.ai, ai: true },
    { id: "causelist", label: "Causelist", icon: Icons.causelist },
    { id: "more",      label: "More",      icon: Icons.more },
  ];
  return (
    <div style={{
      position: "absolute", left: 0, right: 0, bottom: 0,
      padding: "10px 12px 22px 12px",
      background: "color-mix(in oklab, var(--paper) 90%, transparent)",
      backdropFilter: "blur(20px)",
      borderTop: "1px solid var(--rule-soft)",
      display: "flex", justifyContent: "space-around", alignItems: "center",
    }}>
      {tabs.map(t => {
        const T = t.icon;
        const isActive = t.id === active;
        if (t.ai) {
          return (
            <div key={t.id} style={{
              width: 46, height: 46, borderRadius: 999, background: "var(--ink)", color: "var(--paper)",
              display: "inline-flex", alignItems: "center", justifyContent: "center",
              boxShadow: "0 6px 14px -6px rgba(0,0,0,0.4)",
            }}>
              <T size={20} />
            </div>
          );
        }
        return (
          <div key={t.id} style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 3, color: isActive ? "var(--ink)" : "var(--ink-3)" }}>
            <T size={20} sw={isActive ? 2 : 1.7} />
            <span style={{ fontSize: 9.5, fontFamily: "var(--sans)", letterSpacing: 0.3, fontWeight: isActive ? 600 : 400 }}>{t.label}</span>
          </div>
        );
      })}
    </div>
  );
}

// Used wherever a section header is needed inside a phone screen
function SH({ children, right }) {
  return (
    <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 10 }}>
      <h2 style={{ fontFamily: "var(--sans)", fontSize: 12, fontWeight: 600, color: "var(--ink-2)", margin: 0, letterSpacing: 0.5, textTransform: "uppercase" }}>{children}</h2>
      {right}
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V01 · HERO
// ────────────────────────────────────────────────────────────────

// V01 · Frame A — Cold open
function V01A() {
  return (
    <div style={{ flex: 1, background: "#0a0a0c", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "0 28px", position: "relative" }}>
      <div style={{ position: "absolute", top: 0, right: 0, width: 220, height: 220, background: "radial-gradient(circle at 80% 20%, oklch(0.55 0.10 70 / 0.18), transparent 60%)", pointerEvents: "none" }} />
      <div style={{ width: "100%", maxWidth: 320 }}>
        <div style={{ fontFamily: "var(--mono)", fontSize: 11, letterSpacing: 2.6, textTransform: "uppercase", color: "rgba(255,255,255,0.55)" }}>
          VAKEELOS · TUE 12 MAY · 06:30 IST
        </div>
        <div style={{ marginTop: 14, fontFamily: "var(--serif)", fontSize: 26, fontWeight: 400, letterSpacing: -0.6, color: "#f3eee2", lineHeight: 1.25 }}>
          Causelist <span style={{ color: "oklch(0.86 0.095 75)" }}>ready</span>
          <span style={{ display: "inline-block", width: 2, height: 22, background: "oklch(0.86 0.095 75)", marginLeft: 4, verticalAlign: "-3px", animation: "vfBlink 1.1s steps(2) infinite" }} />
        </div>
        <div style={{ marginTop: 8, fontFamily: "var(--mono)", fontSize: 12.5, color: "rgba(255,255,255,0.5)" }}>
          11 matters · 3 conflicts · 1 priority
        </div>
      </div>
    </div>
  );
}

// V01 · Frame B — Logo lockup
function V01B() {
  return (
    <div style={{ flex: 1, background: "#0a0a0c", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "0 28px" }}>
      <div style={{ position: "relative" }}>
        <div style={{ position: "absolute", inset: -60, background: "radial-gradient(circle, oklch(0.86 0.095 75 / 0.18), transparent 60%)", pointerEvents: "none" }} />
        <img src="logo-glyph.png" alt="V" width={62} height={62} style={{ display: "block", margin: "0 auto", position: "relative", filter: "drop-shadow(0 0 16px oklch(0.86 0.095 75 / 0.35))" }} />
      </div>
      <div style={{ marginTop: 22, fontFamily: "var(--serif)", fontSize: 28, color: "#f3eee2", fontWeight: 500, letterSpacing: -0.5 }}>VakeelOS</div>
      <div style={{ marginTop: 14, fontFamily: "var(--mono)", fontSize: 10, letterSpacing: 2.4, textTransform: "uppercase", color: "rgba(255,255,255,0.4)", textAlign: "center", maxWidth: 280 }}>
        Practice management<br/>for the Indian bar
      </div>
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V02 · CAUSELIST
// ────────────────────────────────────────────────────────────────

const CAUSELIST_TRACKED = [
  { time: "10:30", item: "12", num: "W.P. 1234/2026", title: "Sharma vs State", court: "APHC · Court 5", judge: "Sri J. Reddy", purpose: "Arguments", tag: "blue" },
  { time: "11:30", item: "04", num: "C.R.P. 882/2024", title: "Mehra Petroleum vs ROC", court: "APHC · Court 7", judge: "Smt. J. Iyer", purpose: "Counter", tag: "orange", conflict: true },
  { time: "14:00", item: "21", num: "W.P. 5012/2025", title: "Patel & Sons vs Union", court: "TSHC · Court 3", judge: "Sri J. Murthy", purpose: "Hearing", tag: "blue" },
];

function CauselistHeaderUI({ syncDot, dotColor = "var(--gold)", pulsing = true }) {
  return (
    <>
      {/* Top app bar */}
      <div style={{ padding: "10px 20px 4px 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ display: "flex", alignItems: "center", gap: 9 }}>
          <img src="logo-glyph.png" alt="" width={22} height={22} />
          <span style={{ fontFamily: "var(--serif)", fontSize: 16, color: "var(--ink)", fontWeight: 500 }}>Causelist</span>
        </div>
        <div style={{ display: "flex", alignItems: "center", gap: 4 }}>
          <button style={headerBtn}><Icons.refresh size={18} /></button>
          <button style={headerBtn}><Icons.filter size={18} /></button>
        </div>
      </div>

      {/* Title block */}
      <div style={{ padding: "10px 20px 0 20px" }}>
        <Eyebrow style={{ marginBottom: 5 }}>
          {syncDot && <span style={{ display: "inline-block", width: 6, height: 6, borderRadius: 999, background: dotColor, marginRight: 7, verticalAlign: "1.5px", animation: pulsing ? "vfPulse 1.6s ease-in-out infinite" : "none" }} />}
          {pulsing ? "Syncing · 06:30 IST" : "Synced · 06:30 IST"}
        </Eyebrow>
        <h1 style={{ fontFamily: "var(--serif)", fontWeight: 400, fontSize: 30, lineHeight: 1.05, letterSpacing: -0.7, color: "var(--ink)", margin: 0 }}>Causelist</h1>
        <div style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink-3)", marginTop: 4 }}>Tuesday, 12 May</div>
      </div>

      {/* Date selector */}
      <div style={{ padding: "14px 20px 0 20px" }}>
        <div style={{ display: "flex", gap: 4, background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 999, padding: 3 }}>
          {[
            { label: "Mon", date: "11" },
            { label: "Today", date: "12", active: true },
            { label: "Wed", date: "13" },
            { label: "Thu", date: "14" },
          ].map(d => (
            <div key={d.date} style={{
              flex: 1, padding: "7px", borderRadius: 999,
              background: d.active ? "var(--ink)" : "transparent",
              color: d.active ? "var(--paper)" : "var(--ink-2)",
              display: "flex", flexDirection: "column", alignItems: "center",
            }}>
              <span style={{ fontSize: 9, letterSpacing: 0.8, textTransform: "uppercase", opacity: 0.7 }}>{d.label}</span>
              <span style={{ fontFamily: "var(--mono)", fontSize: 13, fontWeight: 500 }}>{d.date}</span>
            </div>
          ))}
        </div>
        <div style={{ display: "flex", gap: 6, marginTop: 10, alignItems: "center" }}>
          {[
            { label: "APHC", count: 6 },
            { label: "TSHC", count: 3 },
            { label: "Both", count: 9, active: true },
          ].map(c => (
            <div key={c.label} style={{
              padding: "5px 10px", borderRadius: 999, fontSize: 11,
              background: c.active ? "var(--ink)" : "transparent",
              color: c.active ? "var(--paper)" : "var(--ink-2)",
              border: c.active ? "1px solid var(--ink)" : "1px solid var(--rule)",
              display: "inline-flex", alignItems: "center", gap: 5,
            }}>
              {c.label} <span style={{ fontFamily: "var(--mono)", fontSize: 9.5, opacity: 0.7 }}>{c.count}</span>
            </div>
          ))}
          <span style={{ marginLeft: "auto", fontSize: 10, color: "var(--ink-3)", fontFamily: "var(--mono)" }}>11,243 entries</span>
        </div>
      </div>
    </>
  );
}

function CauselistRow({ e }) {
  return (
    <div style={{ padding: "13px 20px", borderTop: "1px solid var(--rule-soft)", display: "flex", gap: 12 }}>
      <div style={{ flexShrink: 0, width: 44, textAlign: "right" }}>
        <div style={{ fontFamily: "var(--mono)", fontSize: 13, color: "var(--ink)", fontVariantNumeric: "tabular-nums" }}>{e.time}</div>
        <div style={{ fontFamily: "var(--mono)", fontSize: 9.5, color: "var(--ink-3)", marginTop: 2 }}>Item {e.item}</div>
      </div>
      <div style={{ width: 1, background: "var(--rule)" }} />
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ display: "flex", alignItems: "center", gap: 6, marginBottom: 2 }}>
          <span style={{ fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)" }}>{e.num}</span>
          <span style={{ color: "var(--ink-4)" }}>·</span>
          <span style={{ fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)" }}>{e.court}</span>
          {e.conflict && <Pill tone="red">Conflict</Pill>}
        </div>
        <div style={{ fontFamily: "var(--sans)", fontSize: 14.5, color: "var(--ink)", lineHeight: 1.3, fontWeight: 600, letterSpacing: -0.2 }}>{e.title}</div>
        <div style={{ fontSize: 11, color: "var(--ink-3)", marginTop: 2 }}>{e.judge}</div>
        <div style={{ marginTop: 5 }}><Pill tone={e.tag} dot>{e.purpose}</Pill></div>
      </div>
    </div>
  );
}

// V02 · Frame A — Empty causelist, syncing
function V02A() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column", overflow: "hidden" }}>
      <CauselistHeaderUI syncDot dotColor="var(--gold)" pulsing />
      <div style={{ paddingTop: 20, padding: "20px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
          <span style={{ fontFamily: "var(--sans)", fontSize: 12, color: "var(--ink-2)", fontWeight: 600, letterSpacing: 0.5, textTransform: "uppercase" }}>Tracked</span>
          <span style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink-3)" }}>0</span>
        </div>
        <span style={{ fontSize: 11, color: "var(--ink-3)" }}>your matters</span>
      </div>

      <div style={{ flex: 1, padding: "0 20px", display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center", gap: 14 }}>
        {/* Skeleton placeholders */}
        <div style={{ width: "100%", display: "flex", flexDirection: "column", gap: 12, opacity: 0.55 }}>
          {[0,1,2].map(i => (
            <div key={i} style={{ display: "flex", gap: 12, alignItems: "center", padding: "12px 0", borderTop: "1px solid var(--rule-soft)" }}>
              <div style={{ width: 36, height: 18, borderRadius: 4, background: "var(--rule-soft)" }} />
              <div style={{ flex: 1, display: "flex", flexDirection: "column", gap: 5 }}>
                <div style={{ height: 8, width: "70%", borderRadius: 4, background: "var(--rule-soft)" }} />
                <div style={{ height: 10, width: "92%", borderRadius: 4, background: "var(--rule)" }} />
                <div style={{ height: 7, width: "40%", borderRadius: 4, background: "var(--rule-soft)" }} />
              </div>
            </div>
          ))}
        </div>
        <div style={{ marginTop: 6, display: "flex", alignItems: "center", gap: 8, color: "var(--ink-3)", fontFamily: "var(--mono)", fontSize: 11 }}>
          <span style={{ width: 6, height: 6, borderRadius: 999, background: "var(--gold)", animation: "vfPulse 1.6s ease-in-out infinite" }} />
          waiting for causelist
          <span style={{ display: "inline-block", animation: "vfDots 1.4s steps(4) infinite" }}>…</span>
        </div>
      </div>

      <MiniTabBar active="causelist" />
    </div>
  );
}

// V02 · Frame B — Synced state with toast
function V02B() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", position: "relative", display: "flex", flexDirection: "column", overflow: "hidden" }}>
      {/* Toast sliding in just under status bar */}
      <div style={{
        position: "absolute", left: 14, right: 14, top: 8, zIndex: 5,
        padding: "10px 12px", background: "var(--card-elev)",
        border: "1px solid color-mix(in oklab, var(--green) 22%, var(--rule))",
        borderRadius: 12, display: "flex", alignItems: "center", gap: 10,
        boxShadow: "0 14px 24px -14px rgba(0,0,0,0.25)",
      }}>
        <div style={{ width: 22, height: 22, borderRadius: 999, background: "color-mix(in oklab, var(--green) 14%, var(--card))", color: "var(--green-ink)", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
          <Icons.check size={13} sw={2.4} />
        </div>
        <div style={{ flex: 1 }}>
          <div style={{ fontSize: 12.5, color: "var(--ink)", fontWeight: 600 }}>Causelist synced</div>
          <div style={{ fontSize: 11, color: "var(--ink-3)" }}>3 matters added · 6 untracked matches</div>
        </div>
        <span style={{ fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)", whiteSpace: "nowrap" }}>06:30</span>
      </div>

      <div style={{ paddingTop: 50 }}>
        <CauselistHeaderUI syncDot dotColor="var(--green)" pulsing={false} />
      </div>

      <div style={{ padding: "18px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ display: "flex", alignItems: "center", gap: 8 }}>
          <span style={{ fontFamily: "var(--sans)", fontSize: 12, color: "var(--ink-2)", fontWeight: 600, letterSpacing: 0.5, textTransform: "uppercase" }}>Tracked</span>
          <span style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink-3)" }}>3</span>
        </div>
        <span style={{ fontSize: 11, color: "var(--ink-3)" }}>your matters</span>
      </div>

      <div style={{ marginTop: 8 }}>
        {CAUSELIST_TRACKED.map((e, i) => <CauselistRow key={i} e={e} />)}
      </div>

      <div style={{ padding: "18px 20px 12px 20px", display: "flex", alignItems: "center", gap: 8 }}>
        <span style={{ fontFamily: "var(--sans)", fontSize: 12, color: "var(--ink-2)", fontWeight: 600, letterSpacing: 0.5, textTransform: "uppercase" }}>Matches by advocate name</span>
        <span style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink-3)" }}>3</span>
      </div>

      <div style={{ padding: "8px 20px", borderTop: "1px solid var(--rule-soft)", display: "flex", alignItems: "center", justifyContent: "center", gap: 8, color: "var(--ink-3)", marginTop: "auto", marginBottom: 80 }}>
        <span style={{ width: 5, height: 5, borderRadius: 999, background: "var(--green)" }} />
        <span style={{ fontSize: 10.5, fontFamily: "var(--mono)" }}>Last synced 06:30 IST · pull to refresh</span>
      </div>

      <MiniTabBar active="causelist" />
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V03 · DRAFTER
// ────────────────────────────────────────────────────────────────

// V03 · Frame A — Template selection bottom sheet
function V03A() {
  const templates = [
    "Legal Notice", "Bail Application",
    "Writ Petition", "Plaint",
    "Vakalatnama", "Written Statement",
    "Reply", "Custom…",
  ];
  return (
    <div style={{ flex: 1, background: "var(--paper)", position: "relative", display: "flex", flexDirection: "column" }}>
      {/* Dimmed background — case detail under scrim */}
      <div style={{ flex: 1, opacity: 0.35, filter: "blur(0.5px)" }}>
        <MiniTopBar right={<><button style={headerBtn}><Icons.share size={18} /></button><button style={headerBtn}><Icons.more size={20} /></button></>} />
        <div style={{ padding: "12px 20px 0 20px" }}>
          <Eyebrow>APHC · W.P. 1234/2026</Eyebrow>
          <div style={{ fontFamily: "var(--serif)", fontSize: 24, fontWeight: 400, letterSpacing: -0.5, color: "var(--ink)", marginTop: 4 }}>Sharma vs State of A.P.</div>
        </div>
        <div style={{ padding: "16px 20px" }}>
          <div style={{ background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 14, padding: 14, height: 140 }} />
        </div>
      </div>

      {/* Scrim */}
      <div style={{ position: "absolute", inset: 0, background: "rgba(20,18,16,0.35)", backdropFilter: "blur(2px)" }} />

      {/* Bottom sheet */}
      <div style={{
        position: "absolute", left: 0, right: 0, bottom: 0,
        background: "var(--card-elev)",
        borderTopLeftRadius: 24, borderTopRightRadius: 24,
        padding: "10px 0 22px 0",
        boxShadow: "0 -20px 40px -20px rgba(0,0,0,0.3)",
      }}>
        <div style={{ display: "flex", justifyContent: "center", paddingBottom: 8 }}>
          <span style={{ width: 36, height: 4, borderRadius: 2, background: "var(--rule)" }} />
        </div>
        <div style={{ padding: "4px 20px 0 20px" }}>
          <Eyebrow tone="ai">
            <Icons.ai size={11} style={{ verticalAlign: "-2px", marginRight: 4 }} /> Draft with VakeelBrain
          </Eyebrow>
          <div style={{ fontFamily: "var(--serif)", fontSize: 22, fontWeight: 400, letterSpacing: -0.5, color: "var(--ink)", marginTop: 6 }}>Choose a template</div>

          <div style={{ marginTop: 16, display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }}>
            {templates.map((t, i) => {
              const selected = i === 0;
              return (
                <div key={t} style={{
                  padding: "11px 14px", borderRadius: 999, fontSize: 12.5,
                  textAlign: "center", fontFamily: "var(--sans)", fontWeight: 500,
                  background: selected ? "var(--gold)" : "transparent",
                  color: selected ? "oklch(0.22 0.04 70)" : "var(--ink-2)",
                  border: selected ? "1px solid var(--gold)" : "1px solid var(--rule)",
                }}>{t}</div>
              );
            })}
          </div>

          <div style={{ marginTop: 14, padding: "10px 12px", background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 10, display: "flex", alignItems: "center", gap: 8 }}>
            <Icons.ai size={14} stroke="var(--ai)" />
            <span style={{ flex: 1, fontSize: 12, color: "var(--ink-3)" }}>Add custom instructions…</span>
          </div>

          <div style={{ marginTop: 14, display: "flex", gap: 8 }}>
            <div style={{ padding: "12px 16px", background: "transparent", color: "var(--ink-2)", borderRadius: 999, fontSize: 13, fontWeight: 500 }}>Cancel</div>
            <div style={{ flex: 1, padding: "12px 18px", background: "var(--ink)", color: "var(--paper)", borderRadius: 999, fontSize: 13.5, fontWeight: 500, textAlign: "center", display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 7 }}>
              <Icons.ai size={14} /> Generate draft
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

// V03 · Frame B — Export ready
function V03B() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column", position: "relative", overflow: "hidden" }}>
      {/* Top bar */}
      <div style={{ padding: "10px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ width: 34, height: 34, borderRadius: 999, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}>
          <Icons.chevL size={20} />
        </div>
        <Eyebrow tone="gold-ink" style={{ whiteSpace: "nowrap" }}>● Draft · saved</Eyebrow>
        <div style={{ width: 34, height: 34, borderRadius: 999, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}>
          <Icons.more size={20} />
        </div>
      </div>

      <div style={{ padding: "10px 20px 0 20px" }}>
        <div style={{ fontFamily: "var(--serif)", fontSize: 22, fontWeight: 400, letterSpacing: -0.5, color: "var(--ink)" }}>Legal Notice</div>
        <div style={{ fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--ink-3)", marginTop: 3 }}>Sharma vs State · 12 May · 412 words</div>
      </div>

      {/* Body */}
      <div style={{ padding: "14px 20px 0 20px", flex: 1, overflow: "hidden" }}>
        <p style={{ fontFamily: "var(--serif)", fontSize: 11.5, lineHeight: 1.6, color: "var(--ink)", margin: 0 }}>
          Under instructions from and on behalf of our client, Sri P. Sharma, S/o Late B. Sharma, resident of Plot 24, Madhapur, Hyderabad, we hereby serve upon you this legal notice for redressal of grievances arising from the impugned notification dated 17 March 2026.
        </p>
        <p style={{ fontFamily: "var(--serif)", fontSize: 11.5, lineHeight: 1.6, color: "var(--ink)", marginTop: 10 }}>
          That, in light of the principles laid down in <span style={{ background: "color-mix(in oklab, var(--gold) 22%, var(--card))", color: "var(--gold-ink)", padding: "1px 5px", borderRadius: 4, fontFamily: "var(--mono)", fontSize: 10 }}>[AIR 1997 SC 734]</span> and the procedural requirements under <span style={{ background: "color-mix(in oklab, var(--gold) 22%, var(--card))", color: "var(--gold-ink)", padding: "1px 5px", borderRadius: 4, fontFamily: "var(--mono)", fontSize: 10 }}>[Section 80 CPC]</span>, the said notification is liable to be set aside as ultra vires Article 14 and Article 226 of the Constitution of India.
        </p>
        <p style={{ fontFamily: "var(--serif)", fontSize: 11.5, lineHeight: 1.6, color: "var(--ink)", marginTop: 10 }}>
          You are hereby called upon to withdraw the impugned notification within thirty (30) days from receipt hereof, failing which our client shall be constrained to seek appropriate remedies before the Hon'ble High Court of Andhra Pradesh.
        </p>
      </div>

      {/* File-ready toast */}
      <div style={{
        margin: "0 14px",
        padding: "10px 12px",
        background: "var(--card-elev)",
        border: "1px solid var(--rule)",
        borderRadius: 12,
        display: "flex", alignItems: "center", gap: 10,
        boxShadow: "0 14px 24px -14px rgba(0,0,0,0.25)",
      }}>
        <div style={{ width: 26, height: 26, borderRadius: 7, background: "color-mix(in oklab, var(--blue) 14%, var(--card))", color: "var(--blue-ink)", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
          <Icons.doc size={13} />
        </div>
        <div style={{ flex: 1, minWidth: 0 }}>
          <div style={{ fontSize: 12, color: "var(--ink)", fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>legal_notice_sharma.docx</div>
          <div style={{ fontSize: 10.5, color: "var(--ink-3)" }}>Ready · 3 pages · 412 KB</div>
        </div>
        <div style={{ padding: "5px 10px", background: "var(--gold)", color: "oklch(0.22 0.04 70)", borderRadius: 999, fontSize: 11, fontWeight: 600 }}>Export</div>
      </div>

      {/* Toolbar */}
      <div style={{ padding: "12px 16px 22px 16px", display: "flex", gap: 8 }}>
        <div style={{ flex: 1, padding: "10px 12px", borderRadius: 999, border: "1px solid var(--rule)", color: "var(--ink-2)", textAlign: "center", fontSize: 13, fontFamily: "var(--sans)" }}>Edit</div>
        <div style={{ flex: 1.4, padding: "10px 14px", borderRadius: 999, background: "var(--gold)", color: "oklch(0.22 0.04 70)", textAlign: "center", fontSize: 13, fontWeight: 600, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 6 }}>
          <Icons.download size={13} /> Export .docx
        </div>
        <div style={{ width: 44, padding: "10px 0", borderRadius: 999, border: "1px solid var(--rule)", color: "var(--ink-2)", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
          <Icons.send size={15} />
        </div>
      </div>
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V04 · DASHBOARD / TODAY
// ────────────────────────────────────────────────────────────────

// V04 · Frame A — Morning greeting (minimal)
function V04A() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column" }}>
      <MiniTopBar right={null} />
      <div style={{ padding: "44px 20px 0 20px" }}>
        <Eyebrow>Tuesday, 12 May · 06:30 IST</Eyebrow>
        <h1 style={{ fontFamily: "var(--serif)", fontWeight: 400, fontSize: 36, lineHeight: 1.05, letterSpacing: -1, color: "var(--ink)", margin: "10px 0 0 0", textWrap: "balance" }}>
          Good morning, Vikky
        </h1>
        <div style={{ marginTop: 30, display: "flex", flexDirection: "column", gap: 14 }}>
          {[
            { tone: "ink",    label: "4 hearings today" },
            { tone: "orange", label: "2 invoices overdue" },
            { tone: "red",    label: "1 conflict flagged" },
          ].map((r, i) => (
            <div key={i} style={{ display: "flex", alignItems: "center", gap: 10, color: r.tone === "ink" ? "var(--ink)" : `var(--${r.tone}-ink)`, fontFamily: "var(--sans)", fontSize: 17, letterSpacing: -0.2 }}>
              <span style={{ width: 8, height: 8, borderRadius: 2, background: r.tone === "ink" ? "var(--gold)" : `var(--${r.tone})` }} />
              {r.label}
            </div>
          ))}
        </div>
      </div>
      <MiniTabBar active="today" />
    </div>
  );
}

// V04 · Frame B — Clean state — AI brief "all clear"
function V04B() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column", overflow: "hidden" }}>
      <MiniTopBar right={<>
        <button style={headerBtn}><Icons.search size={18} /></button>
        <button style={headerBtn}><Icons.bell size={18} /></button>
        <div style={{ marginLeft: 4 }}><Avatar name="Vikky Cumbamangalam" size={28} tone="ink" /></div>
      </>} />

      <div style={{ padding: "16px 20px 0 20px" }}>
        <Eyebrow style={{ marginBottom: 4 }}>Tuesday, 12 May</Eyebrow>
        <h1 style={{ fontFamily: "var(--serif)", fontWeight: 400, fontSize: 28, lineHeight: 1.1, letterSpacing: -0.7, color: "var(--ink)", margin: 0 }}>Good morning, Vikky</h1>
      </div>

      {/* VakeelBrain — all clear card */}
      <div style={{ padding: "16px 20px 0 20px" }}>
        <div style={{ background: "var(--night)", color: "var(--on-night)", borderRadius: 16, padding: 16, position: "relative", overflow: "hidden" }}>
          <div style={{ position: "absolute", top: -30, right: -30, width: 150, height: 150, background: "radial-gradient(circle, oklch(0.86 0.095 75 / 0.18), transparent 65%)", pointerEvents: "none" }} />
          <div style={{ position: "relative" }}>
            <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }}>
              <div style={{ width: 20, height: 20, borderRadius: 999, background: "rgba(245,226,175,0.18)", color: "var(--gold-soft)", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
                <Icons.ai size={12} />
              </div>
              <span style={{ fontSize: 10.5, letterSpacing: 0.7, textTransform: "uppercase", color: "rgba(245,226,175,0.8)", fontWeight: 600 }}>VakeelBrain</span>
              <div style={{ marginLeft: "auto", padding: "2px 8px", background: "rgba(255,255,255,0.06)", borderRadius: 999, fontSize: 10, color: "rgba(255,255,255,0.6)" }}>● Updated 06:30</div>
            </div>
            <div style={{ fontFamily: "var(--serif)", fontSize: 22, color: "#f3eee2", fontWeight: 400, letterSpacing: -0.4, lineHeight: 1.2 }}>
              All clear.
            </div>
            <div style={{ marginTop: 10, fontSize: 13, color: "rgba(244,239,228,0.7)", lineHeight: 1.45 }}>
              0 conflicts · 0 overdue · 4 hearings tracked · next at 10:30 before Sri J. Reddy
            </div>
            <div style={{ marginTop: 14, display: "flex", gap: 6, flexWrap: "wrap" }}>
              {["Brief me on the day", "Show calendar", "Tasks"].map((c, i) => (
                <div key={c} style={{
                  background: i === 0 ? "#f3eee2" : "transparent",
                  color: i === 0 ? "oklch(0.22 0.04 70)" : "rgba(244,239,228,0.9)",
                  border: i === 0 ? "none" : "1px solid rgba(244,239,228,0.18)",
                  padding: "6px 12px", borderRadius: 999, fontSize: 11.5, fontWeight: 500,
                }}>{c}</div>
              ))}
            </div>
          </div>
        </div>
      </div>

      {/* Up next */}
      <div style={{ padding: "20px 20px 0 20px" }}>
        <SH right={<span style={{ fontSize: 11.5, color: "var(--ink-3)" }}>in 4 hours</span>}>Up next</SH>
        <div style={{ background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 14, padding: 14 }}>
          <Pill tone="blue" dot>Arguments</Pill>
          <div style={{ fontFamily: "var(--sans)", fontSize: 17, color: "var(--ink)", marginTop: 8, fontWeight: 600, letterSpacing: -0.3 }}>Sharma vs State of A.P.</div>
          <div style={{ fontSize: 11.5, color: "var(--ink-3)", marginTop: 2 }}>Sri J. Reddy · single bench</div>
          <div style={{ marginTop: 10, paddingTop: 10, borderTop: "1px solid var(--rule-soft)", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
            <div style={{ fontSize: 11, color: "var(--ink-3)" }}>APHC · Court 5 · Item 12</div>
            <div style={{ fontFamily: "var(--mono)", fontSize: 18, color: "var(--ink)", fontWeight: 600 }}>10:30</div>
          </div>
        </div>
      </div>

      {/* Footer */}
      <div style={{ marginTop: "auto", marginBottom: 80, padding: "0 20px", textAlign: "center" }}>
        <div style={{ fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--ink-3)" }}>auto-generated 06:30 IST · 0 manual steps</div>
      </div>

      <MiniTabBar active="today" />
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V05 · INVOICING
// ────────────────────────────────────────────────────────────────

// V05 · Frame A — Time entries → Draft invoice
function V05A() {
  const entries = [
    { date: "12 May", matter: "Sharma vs State",        dur: "2.5 h" },
    { date: "10 May", matter: "Mehra Petroleum vs ROC", dur: "1.0 h" },
    { date: "08 May", matter: "Iyer mediation",         dur: "3.5 h" },
  ];
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column" }}>
      <div style={{ padding: "10px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.chevL size={20} /></div>
        <span style={{ fontFamily: "var(--sans)", fontSize: 14, color: "var(--ink)", fontWeight: 600 }}>New invoice</span>
        <div style={{ width: 34, height: 34 }} />
      </div>

      <div style={{ padding: "18px 20px 0 20px" }}>
        <Eyebrow>For client</Eyebrow>
        <div style={{ marginTop: 6, padding: "10px 12px", background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 10, display: "flex", alignItems: "center", gap: 10 }}>
          <div style={{ width: 26, height: 26, borderRadius: 999, background: "var(--gold-soft)", color: "var(--gold-ink)", display: "inline-flex", alignItems: "center", justifyContent: "center", fontFamily: "var(--mono)", fontSize: 10, fontWeight: 700 }}>MC</div>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 13, color: "var(--ink)", fontWeight: 600 }}>Mehta &amp; Co. Pvt Ltd</div>
            <div style={{ fontSize: 10.5, color: "var(--ink-3)" }}>mehta@mehtaco.in · GST 36AAACR0...</div>
          </div>
        </div>
      </div>

      <div style={{ padding: "18px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between", gap: 10 }}>
        <Eyebrow style={{ whiteSpace: "nowrap" }}>Time entries · 3 selected</Eyebrow>
        <span style={{ fontSize: 11, color: "var(--gold-ink)", fontWeight: 500, whiteSpace: "nowrap" }}>Select all</span>
      </div>

      <div style={{ padding: "8px 20px 0 20px" }}>
        {entries.map((e, i) => (
          <div key={i} style={{ padding: "12px 0", borderBottom: i < entries.length - 1 ? "1px solid var(--rule-soft)" : "none", display: "flex", alignItems: "center", gap: 10 }}>
            <div style={{ width: 18, height: 18, borderRadius: 4, background: "var(--gold)", display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0 }}>
              <Icons.check size={12} sw={2.6} stroke="oklch(0.22 0.04 70)" />
            </div>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{ fontSize: 13.5, color: "var(--ink)", fontWeight: 500 }}>{e.matter}</div>
              <div style={{ fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--ink-3)", marginTop: 2 }}>{e.date}</div>
            </div>
            <div style={{ fontFamily: "var(--sans)", fontSize: 13, color: "var(--ink)", fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap", fontWeight: 600 }}>{e.dur}</div>
          </div>
        ))}
      </div>

      <div style={{ padding: "18px 20px 0 20px" }}>
        <div style={{ padding: "12px 14px", background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 12, display: "flex", alignItems: "center", justifyContent: "space-between", gap: 10 }}>
          <div style={{ minWidth: 0 }}>
            <div style={{ fontSize: 10.5, letterSpacing: 1.2, textTransform: "uppercase", color: "var(--ink-3)", whiteSpace: "nowrap" }}>7.0 hrs · sub-total</div>
            <div style={{ fontFamily: "var(--sans)", fontSize: 26, color: "var(--ink)", fontWeight: 700, letterSpacing: -0.6, marginTop: 4, fontVariantNumeric: "tabular-nums", whiteSpace: "nowrap" }}>₹&nbsp;35,000</div>
          </div>
          <Pill tone="neutral">Edit</Pill>
        </div>
      </div>

      <div style={{ marginTop: "auto", padding: "16px 20px 22px 20px" }}>
        <div style={{ position: "relative" }}>
          <div style={{ position: "absolute", inset: -4, background: "radial-gradient(ellipse at center, oklch(0.86 0.095 75 / 0.25), transparent 70%)", pointerEvents: "none", filter: "blur(8px)" }} />
          <div style={{
            position: "relative",
            padding: "14px 18px", background: "var(--gold)", color: "oklch(0.22 0.04 70)",
            borderRadius: 999, fontSize: 14, fontWeight: 700, textAlign: "center",
            display: "inline-flex", width: "100%", alignItems: "center", justifyContent: "center", gap: 8,
            boxShadow: "0 10px 30px -10px oklch(0.72 0.10 70 / 0.5)",
            whiteSpace: "nowrap",
          }}>
            DRAFT INVOICE <Icons.chevR size={16} sw={2.4} />
          </div>
        </div>
      </div>
    </div>
  );
}

// V05 · Frame B — Paid invoice with UPI QR
function PaidQR() {
  // Generate a faux QR pattern
  const cells = 19;
  const seed = (x, y) => ((x * 31 + y * 17 + (x ^ y) * 7) % 11) > 5;
  const rows = [];
  for (let y = 0; y < cells; y++) {
    const row = [];
    for (let x = 0; x < cells; x++) {
      // corner anchors
      const corner = (x < 3 && y < 3) || (x > cells - 4 && y < 3) || (x < 3 && y > cells - 4);
      const innerCorner = (x === 1 && y === 1) || (x === cells - 2 && y === 1) || (x === 1 && y === cells - 2);
      const isOuter = (x === 0 || x === 2 || y === 0 || y === 2) && (x < 3 && y < 3);
      const isOuter2 = (x === cells - 3 || x === cells - 1 || y === 0 || y === 2) && (x > cells - 4 && y < 3);
      const isOuter3 = (x === 0 || x === 2 || y === cells - 3 || y === cells - 1) && (x < 3 && y > cells - 4);
      const filled = (corner && (isOuter || isOuter2 || isOuter3 || innerCorner)) || (!corner && seed(x, y));
      row.push(filled);
    }
    rows.push(row);
  }
  return (
    <div style={{ display: "grid", gridTemplateColumns: `repeat(${cells}, 1fr)`, gap: 0, width: 120, height: 120, padding: 6, background: "#fff", borderRadius: 6 }}>
      {rows.flatMap((row, y) => row.map((on, x) => (
        <div key={`${x}-${y}`} style={{ background: on ? "#0a0a0c" : "transparent" }} />
      )))}
    </div>
  );
}

function V05B() {
  const lines = [
    { d: "Appearance · 12 May",            amt: "25,000" },
    { d: "Drafting — Writ Petition",       amt: "12,000" },
    { d: "Filing charges · disbursement",  amt: "5,000"  },
  ];
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column", position: "relative", overflow: "hidden" }}>
      <div style={{ padding: "10px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.chevL size={20} /></div>
        <span style={{ fontFamily: "var(--sans)", fontSize: 14, color: "var(--ink)", fontWeight: 600 }}>INV-0143</span>
        <div style={{ padding: "5px 11px", background: "color-mix(in oklab, var(--gold) 14%, var(--card))", color: "var(--gold-ink)", border: "1px solid color-mix(in oklab, var(--gold) 30%, var(--rule))", borderRadius: 999, fontSize: 11, fontWeight: 700, letterSpacing: 0.4 }}>PAID</div>
      </div>

      <div style={{ padding: "16px 20px 0 20px" }}>
        <div style={{ background: "var(--card)", border: "1px solid var(--rule)", borderRadius: 16, padding: 16, position: "relative", overflow: "hidden" }}>
          {/* Particle bursts */}
          {[
            { l: "32%", t: 18, op: 0.9 },
            { l: "48%", t: 12, op: 0.7 },
            { l: "62%", t: 24, op: 0.55 },
            { l: "78%", t: 16, op: 0.85 },
          ].map((p, i) => (
            <div key={i} style={{ position: "absolute", left: p.l, top: p.t, width: 5, height: 5, borderRadius: 999, background: "var(--gold)", opacity: p.op, boxShadow: "0 0 8px var(--gold)" }} />
          ))}

          {/* Letterhead */}
          <div style={{ display: "flex", alignItems: "center", gap: 10, paddingBottom: 12, borderBottom: "1px solid var(--rule-soft)" }}>
            <div style={{ width: 32, height: 32, borderRadius: 999, background: "var(--gold-soft)", color: "var(--gold-ink)", display: "inline-flex", alignItems: "center", justifyContent: "center", fontFamily: "var(--serif)", fontSize: 17, fontWeight: 600 }}>V</div>
            <div>
              <div style={{ fontFamily: "var(--serif)", fontSize: 15, color: "var(--ink)", fontWeight: 500, letterSpacing: -0.2 }}>Vikky Cumbamangalam</div>
              <div style={{ fontFamily: "var(--mono)", fontSize: 9.5, color: "var(--ink-3)" }}>AS-12345 · Bar Council of A.P.</div>
            </div>
          </div>

          <div style={{ display: "grid", gridTemplateColumns: "auto 1fr", rowGap: 8, columnGap: 12, padding: "12px 0", borderBottom: "1px solid var(--rule-soft)", fontSize: 11.5 }}>
            <span style={{ color: "var(--ink-3)" }}>BILL TO</span><span style={{ color: "var(--ink)" }}>Mehta &amp; Co. Pvt Ltd</span>
            <span style={{ color: "var(--ink-3)" }}>MATTER</span><span style={{ color: "var(--ink)" }}>APHC W.P. 1234/2026</span>
          </div>

          <div style={{ padding: "12px 0", borderBottom: "1px solid var(--rule-soft)", display: "grid", gridTemplateColumns: "1fr auto", rowGap: 8, columnGap: 14, alignItems: "baseline" }}>
            {lines.map((l, i) => (
              <React.Fragment key={i}>
                <span style={{ color: "var(--ink-2)", fontSize: 12.5 }}>{l.d}</span>
                <span style={{ fontFamily: "var(--sans)", color: "var(--ink)", fontVariantNumeric: "tabular-nums", fontSize: 12.5, whiteSpace: "nowrap", fontWeight: 500 }}>₹&nbsp;{l.amt}</span>
              </React.Fragment>
            ))}
          </div>

          <div style={{ padding: "14px 0 6px 0", textAlign: "center" }}>
            <div style={{ fontSize: 10.5, color: "var(--ink-3)", letterSpacing: 1.2, textTransform: "uppercase" }}>Total</div>
            <div style={{ fontFamily: "var(--serif)", fontSize: 42, color: "var(--gold-ink)", fontWeight: 500, letterSpacing: -1.2, marginTop: 2, lineHeight: 1, textShadow: "0 0 24px oklch(0.72 0.10 70 / 0.45)" }}>
              ₹ 42,000
            </div>
          </div>

          <div style={{ marginTop: 14, paddingTop: 14, borderTop: "1px dashed var(--rule)", display: "flex", gap: 14, alignItems: "center" }}>
            <PaidQR />
            <div style={{ flex: 1, minWidth: 0 }}>
              <Eyebrow>Paid via UPI</Eyebrow>
              <div style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--ink)", marginTop: 4 }}>vikky@vakeelos</div>
              <div style={{ fontSize: 10.5, color: "var(--ink-3)", marginTop: 4 }}>Razorpay UPI · 12 May, 18:42</div>
              <div style={{ marginTop: 6 }}>
                <Pill tone="green" dot>Settled · T+0</Pill>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div style={{ marginTop: "auto", padding: "0 20px 22px 20px" }}>
        <div style={{ padding: "10px 14px", background: "color-mix(in oklab, var(--green) 8%, var(--card))", border: "1px solid color-mix(in oklab, var(--green) 22%, var(--rule))", borderRadius: 12, display: "flex", alignItems: "center", gap: 10 }}>
          <div style={{ width: 24, height: 24, borderRadius: 999, background: "var(--green)", color: "white", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
            <Icons.check size={13} sw={2.6} />
          </div>
          <div style={{ flex: 1 }}>
            <div style={{ fontSize: 12.5, color: "var(--ink)", fontWeight: 600 }}>Receipt sent</div>
            <div style={{ fontSize: 10.5, color: "var(--ink-3)" }}>mehta@mehtaco.in · just now</div>
          </div>
        </div>
      </div>
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// V06 · COURT ORDER VAULT
// ────────────────────────────────────────────────────────────────

// V06 · Frame A — Fetching order
function V06A() {
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column" }}>
      <div style={{ padding: "10px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.chevL size={20} /></div>
        <div style={{ textAlign: "center" }}>
          <div style={{ fontFamily: "var(--sans)", fontSize: 13.5, color: "var(--ink)", fontWeight: 600 }}>Sharma vs State</div>
          <div style={{ fontFamily: "var(--mono)", fontSize: 9.5, color: "var(--ink-3)" }}>APHC0100012025</div>
        </div>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.download size={18} /></div>
      </div>

      {/* Progress bar */}
      <div style={{ padding: "16px 20px 0 20px" }}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 8 }}>
          <Eyebrow style={{ whiteSpace: "nowrap" }}>Fetching from APHC portal</Eyebrow>
          <span style={{ fontFamily: "var(--mono)", fontSize: 11, color: "var(--gold-ink)", fontWeight: 600 }}>75%</span>
        </div>
        <div style={{ height: 4, borderRadius: 4, background: "var(--rule)", overflow: "hidden", position: "relative" }}>
          <div style={{ position: "absolute", left: 0, top: 0, bottom: 0, width: "75%", background: "var(--gold)", borderRadius: 4, boxShadow: "0 0 8px var(--gold)" }} />
        </div>
        <div style={{ fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)", marginTop: 6 }}>order_dated_02_may_2026.pdf · 412 KB</div>
      </div>

      {/* Blurred PDF preview */}
      <div style={{ padding: "20px 20px 0 20px", flex: 1 }}>
        <div style={{
          height: "100%", background: "linear-gradient(180deg, #f4eddc, #ece4d1)",
          borderRadius: 8, border: "1px solid var(--rule)", padding: "24px 20px",
          filter: "blur(2.2px) saturate(0.85)", opacity: 0.85, overflow: "hidden",
          position: "relative",
        }}>
          {/* Court header */}
          <div style={{ textAlign: "center", marginBottom: 14, opacity: 0.55 }}>
            <div style={{ height: 9, width: "60%", margin: "0 auto", background: "#7b6f56", borderRadius: 2 }} />
            <div style={{ height: 5, width: "40%", margin: "6px auto 0", background: "#9c8e72", borderRadius: 2 }} />
          </div>
          {[...Array(11)].map((_, i) => (
            <div key={i} style={{
              height: 4 + (i % 3) * 0.6, width: `${78 - (i % 4) * 7}%`,
              background: i % 4 === 3 ? "#bbac8d" : "#a9987a", marginTop: 7, borderRadius: 2, opacity: 0.5,
            }} />
          ))}
          {/* Court stamp */}
          <div style={{ position: "absolute", bottom: 22, right: 22, width: 48, height: 48, border: "2px solid #7b6f56", borderRadius: 999, opacity: 0.4 }} />
        </div>
      </div>

      <div style={{ padding: "12px 20px", textAlign: "center" }}>
        <span style={{ fontFamily: "var(--mono)", fontSize: 10.5, color: "var(--ink-3)" }}>VakeelBrain ready · will brief on arrival</span>
      </div>
    </div>
  );
}

// V06 · Frame B — Analysis complete
function V06B() {
  const bullets = [
    { k: "Result",         v: "Petition admitted" },
    { k: "Interim relief", v: "Status quo granted" },
    { k: "Directions",     v: "Respondent to file counter in 4 weeks" },
    { k: "Next date",      v: "16 Jan 2025 · APHC Room 7" },
  ];
  return (
    <div style={{ flex: 1, background: "var(--paper)", display: "flex", flexDirection: "column", position: "relative", overflow: "hidden" }}>
      <div style={{ padding: "10px 20px 0 20px", display: "flex", alignItems: "center", justifyContent: "space-between" }}>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.chevL size={20} /></div>
        <div style={{ textAlign: "center" }}>
          <div style={{ fontFamily: "var(--sans)", fontSize: 13.5, color: "var(--ink)", fontWeight: 600 }}>Sharma vs State</div>
          <div style={{ fontFamily: "var(--mono)", fontSize: 9.5, color: "var(--ink-3)" }}>APHC0100012025</div>
        </div>
        <div style={{ width: 34, height: 34, display: "inline-flex", alignItems: "center", justifyContent: "center", color: "var(--ink-2)" }}><Icons.download size={18} /></div>
      </div>

      {/* Hearing-added toast */}
      <div style={{ margin: "14px 14px 0 14px", padding: "9px 12px", background: "var(--card-elev)", border: "1px solid color-mix(in oklab, var(--gold) 22%, var(--rule))", borderRadius: 12, display: "flex", alignItems: "center", gap: 10 }}>
        <div style={{ width: 26, height: 26, borderRadius: 6, background: "color-mix(in oklab, var(--gold) 14%, var(--card))", color: "var(--gold-ink)", display: "inline-flex", alignItems: "center", justifyContent: "center", fontFamily: "var(--mono)", fontSize: 10, fontWeight: 700 }}>16</div>
        <div style={{ flex: 1 }}>
          <div style={{ fontSize: 12, color: "var(--ink)", fontWeight: 600 }}>Next hearing added</div>
          <div style={{ fontSize: 10.5, color: "var(--ink-3)" }}>16 Jan 2025 · APHC Room 7</div>
        </div>
        <span style={{ fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)", whiteSpace: "nowrap" }}>just now</span>
      </div>

      {/* Sharp PDF preview behind */}
      <div style={{ padding: "14px 20px 0 20px", flex: 1, minHeight: 0 }}>
        <div style={{
          height: 200, background: "linear-gradient(180deg, #f4eddc, #ece4d1)",
          borderRadius: 8, border: "1px solid var(--rule)", padding: "20px 18px",
          opacity: 0.6, overflow: "hidden", position: "relative",
        }}>
          <div style={{ textAlign: "center", marginBottom: 12, opacity: 0.7 }}>
            <div style={{ height: 7, width: "50%", margin: "0 auto", background: "#7b6f56", borderRadius: 2 }} />
            <div style={{ height: 4, width: "30%", margin: "5px auto 0", background: "#9c8e72", borderRadius: 2 }} />
          </div>
          {[...Array(7)].map((_, i) => (
            <div key={i} style={{ height: 3, width: `${80 - (i % 4) * 8}%`, background: "#a9987a", marginTop: 6, borderRadius: 2, opacity: 0.55 }} />
          ))}
        </div>
      </div>

      {/* Bottom sheet — VakeelBrain analysis */}
      <div style={{
        background: "var(--card-elev)",
        borderTopLeftRadius: 24, borderTopRightRadius: 24,
        padding: "10px 0 22px 0",
        boxShadow: "0 -16px 36px -16px rgba(0,0,0,0.2)",
        flexShrink: 0,
      }}>
        <div style={{ display: "flex", justifyContent: "center", paddingBottom: 8 }}>
          <span style={{ width: 36, height: 4, borderRadius: 2, background: "var(--rule)" }} />
        </div>
        <div style={{ padding: "4px 20px 0 20px" }}>
          <div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }}>
            <div style={{ width: 22, height: 22, borderRadius: 999, background: "var(--ai-tint)", color: "var(--ai)", display: "inline-flex", alignItems: "center", justifyContent: "center" }}>
              <Icons.ai size={12} />
            </div>
            <span style={{ fontSize: 10.5, letterSpacing: 0.7, textTransform: "uppercase", color: "var(--ai)", fontWeight: 700 }}>VakeelBrain</span>
            <Pill tone="green" dot>Complete</Pill>
            <span style={{ marginLeft: "auto", fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)" }}>40s</span>
          </div>

          <div style={{ display: "flex", flexDirection: "column", gap: 9 }}>
            {bullets.map((b, i) => (
              <div key={b.k} style={{ display: "flex", gap: 10, alignItems: "flex-start" }}>
                <div style={{ width: 8, height: 8, borderRadius: 2, background: "var(--gold)", marginTop: 6, flexShrink: 0 }} />
                <div style={{ flex: 1, fontSize: 13, color: "var(--ink)", lineHeight: 1.4 }}>
                  <span style={{ color: "var(--ink-3)", fontFamily: "var(--mono)", fontSize: 10.5, letterSpacing: 0.3, textTransform: "uppercase", marginRight: 6 }}>{b.k}</span>
                  <span style={{ fontWeight: 500 }}>{b.v}</span>
                </div>
              </div>
            ))}
          </div>

          <div style={{ marginTop: 14, display: "flex", gap: 6, flexWrap: "wrap" }}>
            {["Save to vault", "Add hearing 16 Jan", "Brief me"].map((c, i) => (
              <div key={c} style={{
                padding: "6px 12px", borderRadius: 999, fontSize: 11.5,
                background: i === 1 ? "color-mix(in oklab, var(--gold) 14%, var(--card))" : "transparent",
                border: i === 1 ? "1px solid color-mix(in oklab, var(--gold) 30%, var(--rule))" : "1px solid var(--rule)",
                color: i === 1 ? "var(--gold-ink)" : "var(--ink-2)",
                fontWeight: i === 1 ? 600 : 500,
              }}>{c}</div>
            ))}
          </div>

          <div style={{ marginTop: 12, fontFamily: "var(--mono)", fontSize: 10, color: "var(--ink-3)", textAlign: "center" }}>VakeelBrain · 0 manual steps</div>
        </div>
      </div>
    </div>
  );
}

// ────────────────────────────────────────────────────────────────
// FRAME REGISTRY
// ────────────────────────────────────────────────────────────────

const FRAMES = [
  // backdrop: 'cinema' (deep black) | 'paper' (warm ivory) | 'theatre' (warm dark)
  // theme: 'light' | 'dark' — for the phone's chamber/theatre tokens
  // statusBar: 'light' (dark icons on ivory) | 'dark' (light icons on black) | 'hide'
  { id: "v01-a", video: "01", letter: "A", title: "Hero · Cold open",      backdrop: "cinema", theme: "dark",  statusBar: "dark",  Comp: V01A },
  { id: "v01-b", video: "01", letter: "B", title: "Hero · Logo lockup",    backdrop: "cinema", theme: "dark",  statusBar: "hide",  Comp: V01B },

  { id: "v02-a", video: "02", letter: "A", title: "Causelist · Syncing",   backdrop: "paper",  theme: "light", statusBar: "light", Comp: V02A },
  { id: "v02-b", video: "02", letter: "B", title: "Causelist · Synced",    backdrop: "paper",  theme: "light", statusBar: "light", Comp: V02B },

  { id: "v03-a", video: "03", letter: "A", title: "Drafter · Templates",   backdrop: "paper",  theme: "light", statusBar: "light", Comp: V03A },
  { id: "v03-b", video: "03", letter: "B", title: "Drafter · Export ready",backdrop: "paper",  theme: "light", statusBar: "light", Comp: V03B },

  { id: "v04-a", video: "04", letter: "A", title: "Today · Morning",       backdrop: "paper",  theme: "light", statusBar: "light", Comp: V04A },
  { id: "v04-b", video: "04", letter: "B", title: "Today · All clear",     backdrop: "paper",  theme: "light", statusBar: "light", Comp: V04B },

  { id: "v05-a", video: "05", letter: "A", title: "Invoicing · Time entries", backdrop: "paper", theme: "light", statusBar: "light", Comp: V05A },
  { id: "v05-b", video: "05", letter: "B", title: "Invoicing · Paid · UPI",   backdrop: "paper", theme: "light", statusBar: "light", Comp: V05B },

  { id: "v06-a", video: "06", letter: "A", title: "Order Vault · Fetching",   backdrop: "paper", theme: "light", statusBar: "light", Comp: V06A },
  { id: "v06-b", video: "06", letter: "B", title: "Order Vault · Briefed",    backdrop: "paper", theme: "light", statusBar: "light", Comp: V06B },

  { id: "v07-a", video: "07", letter: "A", title: "Workflow · 06:30 sync",    backdrop: "paper", theme: "light", statusBar: "light", Comp: V02B },
  { id: "v07-e", video: "07", letter: "E", title: "Workflow · Tuesday. Done.", backdrop: "cinema", theme: "dark", statusBar: "hide", Comp: V01B },
];

Object.assign(window, { FRAMES });
