// Vault wallet screens — original design, dark + light themes
// Three screens per theme: Wallet Home · Send Confirm · Card Detail

// ─────────────────────────────────────────────────────────────
// Theme tokens
// ─────────────────────────────────────────────────────────────
const VAULT_DARK = {
  name: 'dark',
  bg: 'oklch(0.16 0.005 250)',         // deep neutral
  surface1: 'oklch(0.20 0.006 250)',   // card
  surface2: 'oklch(0.235 0.007 250)',  // elevated
  surface3: 'oklch(0.275 0.008 250)',  // hover / quick action
  hairline: 'oklch(1 0 0 / 0.07)',
  hairlineStrong: 'oklch(1 0 0 / 0.12)',
  text1: 'oklch(0.97 0.003 80)',
  text2: 'oklch(0.72 0.005 80)',
  text3: 'oklch(0.52 0.006 80)',
  accent: 'oklch(0.82 0.07 82)',       // champagne
  accentInk: 'oklch(0.20 0.02 82)',    // text on accent
  accentMuted: 'oklch(0.82 0.07 82 / 0.14)',
  pos: 'oklch(0.78 0.13 155)',         // incoming
  neg: 'oklch(0.78 0.04 80)',          // outgoing — neutral on dark
  warn: 'oklch(0.82 0.12 75)',
  err: 'oklch(0.68 0.16 25)',
  // Card visual
  cardA: 'oklch(0.22 0.008 250)',
  cardB: 'oklch(0.30 0.012 250)',
  cardEdge: 'oklch(1 0 0 / 0.10)',
};

const VAULT_LIGHT = {
  name: 'light',
  bg: 'oklch(0.985 0.003 80)',         // warm off-white
  surface1: 'oklch(1 0 0)',
  surface2: 'oklch(0.975 0.004 80)',
  surface3: 'oklch(0.955 0.005 80)',
  hairline: 'oklch(0.20 0.01 250 / 0.08)',
  hairlineStrong: 'oklch(0.20 0.01 250 / 0.14)',
  text1: 'oklch(0.18 0.01 250)',       // graphite
  text2: 'oklch(0.42 0.008 250)',
  text3: 'oklch(0.60 0.006 250)',
  accent: 'oklch(0.50 0.06 200)',      // muted teal
  accentInk: 'oklch(0.99 0 0)',
  accentMuted: 'oklch(0.50 0.06 200 / 0.10)',
  pos: 'oklch(0.55 0.14 155)',
  neg: 'oklch(0.30 0.01 250)',
  warn: 'oklch(0.62 0.14 75)',
  err: 'oklch(0.55 0.18 25)',
  cardA: 'oklch(0.22 0.01 250)',
  cardB: 'oklch(0.34 0.012 250)',
  cardEdge: 'oklch(1 0 0 / 0.12)',
};

// ─────────────────────────────────────────────────────────────
// Tiny inline icons (24px stroke, currentColor)
// ─────────────────────────────────────────────────────────────
const Icon = {
  arrowUp: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M12 19V5M5 12l7-7 7 7" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"/></svg>,
  arrowDown: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M12 5v14M19 12l-7 7-7-7" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"/></svg>,
  plus: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M12 5v14M5 12h14" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg>,
  card: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><rect x="3" y="6" width="18" height="13" rx="2.5" stroke="currentColor" strokeWidth="1.6"/><path d="M3 10h18" stroke="currentColor" strokeWidth="1.6"/></svg>,
  eye: (s = 16) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z" stroke="currentColor" strokeWidth="1.6"/><circle cx="12" cy="12" r="3" stroke="currentColor" strokeWidth="1.6"/></svg>,
  eyeOff: (s = 16) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M3 3l18 18M10.6 6.2A10.5 10.5 0 0112 6c6.5 0 10 6 10 6a17 17 0 01-3.2 3.9M6.6 6.6A17 17 0 002 12s3.5 6 10 6c1.5 0 2.8-.3 4-.8" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg>,
  lock: (s = 14) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><rect x="4" y="11" width="16" height="10" rx="2" stroke="currentColor" strokeWidth="1.6"/><path d="M8 11V8a4 4 0 018 0v3" stroke="currentColor" strokeWidth="1.6"/></svg>,
  bell: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M6 8a6 6 0 1112 0c0 7 3 7 3 9H3c0-2 3-2 3-9z" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round"/><path d="M10 21a2 2 0 004 0" stroke="currentColor" strokeWidth="1.6"/></svg>,
  search: (s = 18) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><circle cx="11" cy="11" r="7" stroke="currentColor" strokeWidth="1.6"/><path d="M20 20l-3.5-3.5" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg>,
  back: (s = 22) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M15 18l-6-6 6-6" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"/></svg>,
  more: (s = 22) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><circle cx="5" cy="12" r="1.5" fill="currentColor"/><circle cx="12" cy="12" r="1.5" fill="currentColor"/><circle cx="19" cy="12" r="1.5" fill="currentColor"/></svg>,
  check: (s = 14) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M5 12.5l4.5 4.5L19 7.5" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/></svg>,
  shield: (s = 14) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><path d="M12 3l8 3v6c0 5-4 8-8 9-4-1-8-4-8-9V6l8-3z" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round"/></svg>,
  copy: (s = 14) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none"><rect x="8" y="8" width="12" height="12" rx="2" stroke="currentColor" strokeWidth="1.6"/><path d="M16 8V6a2 2 0 00-2-2H6a2 2 0 00-2 2v8a2 2 0 002 2h2" stroke="currentColor" strokeWidth="1.6"/></svg>,
  snowflake: (s = 16) => <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"><path d="M12 2v20M2 12h20M5 5l14 14M19 5L5 19"/></svg>,
};

// Small helpers
const mono = '"Geist Mono", ui-monospace, "SF Mono", Menlo, monospace';
const sans = '"Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif';

function fmtNGN(amount, { sign = '', cents = true } = {}) {
  const [whole, dec] = amount.toFixed(2).split('.');
  const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  return `${sign}₦${grouped}${cents ? `.${dec}` : ''}`;
}

// ─────────────────────────────────────────────────────────────
// 1) WALLET HOME
// ─────────────────────────────────────────────────────────────
function WalletHome({ t }) {
  const tx = [
    { id: 1, who: 'Adaeze Okonkwo', sub: 'Transfer · 14:22', amt: -45000, kind: 'out' },
    { id: 2, who: 'Salary · Spectra Labs', sub: 'Today · 09:00', amt: 1250000, kind: 'in' },
    { id: 3, who: 'Ikeja Electric', sub: 'Bill · Yesterday', amt: -18420, kind: 'out' },
    { id: 4, who: 'Tunde Bakare', sub: 'Refund · Apr 28', amt: 7500, kind: 'in' },
  ];

  return (
    <div style={{ background: t.bg, color: t.text1, minHeight: '100%', fontFamily: sans, paddingBottom: 28 }}>
      {/* header */}
      <div style={{ padding: '64px 22px 8px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
          <div style={{
            width: 36, height: 36, borderRadius: 18, background: t.surface2,
            border: `1px solid ${t.hairline}`,
            display: 'grid', placeItems: 'center', fontFamily: mono, fontWeight: 600, fontSize: 13, color: t.text1,
          }}>OA</div>
          <div style={{ lineHeight: 1.1 }}>
            <div style={{ fontSize: 11, color: t.text3, letterSpacing: 0.4, textTransform: 'uppercase' }}>Good evening</div>
            <div style={{ fontSize: 15, color: t.text1, fontWeight: 500, marginTop: 2 }}>Olumide</div>
          </div>
        </div>
        <div style={{ display: 'flex', gap: 8 }}>
          <IconBtn t={t}>{Icon.search(17)}</IconBtn>
          <IconBtn t={t} dot>{Icon.bell(17)}</IconBtn>
        </div>
      </div>

      {/* balance card */}
      <div style={{ margin: '18px 18px 0', padding: '22px 22px 20px', borderRadius: 22,
        background: t.surface1, border: `1px solid ${t.hairline}`,
        boxShadow: t.name === 'dark' ? '0 1px 0 oklch(1 0 0 / 0.04) inset' : '0 1px 2px oklch(0 0 0 / 0.03)',
      }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
          <div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 12, color: t.text3, letterSpacing: 0.3 }}>
            <span style={{ display: 'inline-flex', alignItems: 'center', gap: 5, color: t.text2 }}>
              {Icon.shield(12)} <span>Available · NGN</span>
            </span>
          </div>
          <button style={chipBtn(t)}>{Icon.eye(13)} <span>Hide</span></button>
        </div>

        <div style={{ marginTop: 14, display: 'flex', alignItems: 'baseline', gap: 4, fontFamily: mono, fontFeatureSettings: '"tnum" 1, "lnum" 1' }}>
          <span style={{ fontSize: 18, color: t.text2, fontWeight: 500 }}>₦</span>
          <span style={{ fontSize: 44, color: t.text1, fontWeight: 500, letterSpacing: -1.2, lineHeight: 1 }}>2,847,320</span>
          <span style={{ fontSize: 22, color: t.text3, fontWeight: 400, letterSpacing: -0.5 }}>.50</span>
        </div>

        <div style={{ marginTop: 12, display: 'flex', alignItems: 'center', gap: 10, fontSize: 12, color: t.text3 }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 4, color: t.pos }}>
            <span style={{ width: 6, height: 6, borderRadius: 3, background: t.pos, display: 'inline-block' }}/>
            <span style={{ fontFamily: mono }}>+₦1.25M</span>
          </span>
          <span>this month</span>
          <span style={{ marginLeft: 'auto', fontFamily: mono, color: t.text3, fontSize: 11 }}>Updated 2m ago</span>
        </div>
      </div>

      {/* quick actions */}
      <div style={{ margin: '14px 18px 0', display: 'grid', gridTemplateColumns: 'repeat(4,1fr)', gap: 8 }}>
        {[
          { l: 'Send', i: Icon.arrowUp(18), primary: true },
          { l: 'Receive', i: Icon.arrowDown(18) },
          { l: 'Top up', i: Icon.plus(18) },
          { l: 'Cards', i: Icon.card(18) },
        ].map(a => (
          <div key={a.l} style={{
            padding: '14px 8px 12px', borderRadius: 16,
            background: a.primary ? t.accent : t.surface1,
            color: a.primary ? t.accentInk : t.text1,
            border: `1px solid ${a.primary ? 'transparent' : t.hairline}`,
            display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 6,
          }}>
            <div style={{ opacity: a.primary ? 1 : 0.9 }}>{a.i}</div>
            <div style={{ fontSize: 12, fontWeight: 500 }}>{a.l}</div>
          </div>
        ))}
      </div>

      {/* insight strip */}
      <div style={{ margin: '14px 18px 0', padding: '12px 14px', borderRadius: 14,
        background: t.accentMuted, border: `1px solid ${t.hairline}`,
        display: 'flex', alignItems: 'center', gap: 10,
      }}>
        <div style={{ width: 28, height: 28, borderRadius: 8, background: t.accent, color: t.accentInk, display: 'grid', placeItems: 'center' }}>
          {Icon.shield(14)}
        </div>
        <div style={{ flex: 1, lineHeight: 1.25 }}>
          <div style={{ fontSize: 12.5, color: t.text1, fontWeight: 500 }}>Enable hardware key</div>
          <div style={{ fontSize: 11, color: t.text3, marginTop: 1 }}>Add a second factor for transfers above ₦100K</div>
        </div>
        <div style={{ fontSize: 11, color: t.text2, fontFamily: mono }}>→</div>
      </div>

      {/* transactions header */}
      <div style={{ margin: '22px 18px 8px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{ fontSize: 13, color: t.text2, fontWeight: 500, letterSpacing: 0.2 }}>Activity</div>
        <div style={{ fontSize: 12, color: t.text3, fontFamily: mono }}>This week</div>
      </div>

      {/* transactions */}
      <div style={{ margin: '0 18px', borderRadius: 16, background: t.surface1, border: `1px solid ${t.hairline}`, overflow: 'hidden' }}>
        {tx.map((r, i) => (
          <div key={r.id} style={{
            display: 'flex', alignItems: 'center', gap: 12, padding: '12px 14px',
            borderTop: i === 0 ? 'none' : `1px solid ${t.hairline}`,
          }}>
            <div style={{
              width: 34, height: 34, borderRadius: 11,
              background: r.kind === 'in' ? `${t.pos.replace(')', ' / 0.14)')}` : t.surface2,
              color: r.kind === 'in' ? t.pos : t.text2,
              border: `1px solid ${t.hairline}`,
              display: 'grid', placeItems: 'center', flexShrink: 0,
            }}>
              {r.kind === 'in' ? Icon.arrowDown(16) : Icon.arrowUp(16)}
            </div>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{ fontSize: 13.5, color: t.text1, fontWeight: 500, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{r.who}</div>
              <div style={{ fontSize: 11.5, color: t.text3, marginTop: 1 }}>{r.sub}</div>
            </div>
            <div style={{ fontFamily: mono, fontFeatureSettings: '"tnum" 1', fontSize: 13.5, fontWeight: 500,
              color: r.kind === 'in' ? t.pos : t.text1 }}>
              {r.kind === 'in' ? '+' : '−'}{fmtNGN(Math.abs(r.amt) / 1, { cents: false }).replace('₦', '₦')}
            </div>
          </div>
        ))}
      </div>

      {/* bottom tab spacer */}
      <div style={{ height: 16 }}/>
      <BottomTab t={t} active="wallet"/>
    </div>
  );
}

function IconBtn({ t, children, dot }) {
  return (
    <div style={{ position: 'relative' }}>
      <div style={{
        width: 36, height: 36, borderRadius: 12,
        background: t.surface1, border: `1px solid ${t.hairline}`,
        color: t.text2, display: 'grid', placeItems: 'center',
      }}>{children}</div>
      {dot && <div style={{
        position: 'absolute', top: 7, right: 7, width: 7, height: 7, borderRadius: 4,
        background: t.accent, border: `1.5px solid ${t.bg}`,
      }}/>}
    </div>
  );
}

function chipBtn(t) {
  return {
    display: 'inline-flex', alignItems: 'center', gap: 5,
    padding: '5px 9px', borderRadius: 999,
    background: t.surface2, color: t.text2, border: `1px solid ${t.hairline}`,
    fontSize: 11, fontFamily: sans, cursor: 'pointer',
  };
}

function BottomTab({ t, active }) {
  const items = [
    { id: 'wallet', label: 'Wallet', i: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><rect x="3" y="6" width="18" height="14" rx="3" stroke="currentColor" strokeWidth="1.6"/><path d="M3 10h18" stroke="currentColor" strokeWidth="1.6"/><circle cx="17" cy="15" r="1.4" fill="currentColor"/></svg> },
    { id: 'activity', label: 'Activity', i: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M3 12h4l3-7 4 14 3-7h4" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"/></svg> },
    { id: 'cards', label: 'Cards', i: Icon.card(20) },
    { id: 'profile', label: 'Profile', i: <svg width="20" height="20" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="8" r="4" stroke="currentColor" strokeWidth="1.6"/><path d="M4 21c1-4 4.5-6 8-6s7 2 8 6" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg> },
  ];
  return (
    <div style={{
      position: 'absolute', left: 14, right: 14, bottom: 14,
      borderRadius: 22, padding: '8px 6px',
      background: t.name === 'dark' ? 'oklch(0.20 0.006 250 / 0.85)' : 'oklch(1 0 0 / 0.85)',
      backdropFilter: 'blur(20px) saturate(160%)',
      WebkitBackdropFilter: 'blur(20px) saturate(160%)',
      border: `1px solid ${t.hairline}`,
      display: 'grid', gridTemplateColumns: 'repeat(4,1fr)',
      boxShadow: t.name === 'dark' ? '0 12px 40px oklch(0 0 0 / 0.5)' : '0 12px 40px oklch(0 0 0 / 0.10)',
    }}>
      {items.map(it => (
        <div key={it.id} style={{
          display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 3,
          padding: '6px 0',
          color: it.id === active ? t.text1 : t.text3,
        }}>
          {it.i}
          <div style={{ fontSize: 10.5, fontWeight: it.id === active ? 600 : 400 }}>{it.label}</div>
        </div>
      ))}
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// 2) SEND MONEY — confirmation
// ─────────────────────────────────────────────────────────────
function SendConfirm({ t }) {
  return (
    <div style={{ background: t.bg, color: t.text1, minHeight: '100%', fontFamily: sans, paddingBottom: 28 }}>
      {/* header */}
      <div style={{ padding: '60px 18px 8px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{
          width: 36, height: 36, borderRadius: 12, background: t.surface1,
          border: `1px solid ${t.hairline}`, color: t.text1, display: 'grid', placeItems: 'center',
        }}>{Icon.back(20)}</div>
        <div style={{ fontSize: 12, color: t.text3, letterSpacing: 0.4, textTransform: 'uppercase', fontFamily: mono }}>Step 3 of 4</div>
        <div style={{ width: 36, height: 36 }}/>
      </div>

      {/* progress */}
      <div style={{ margin: '0 18px', display: 'flex', gap: 4 }}>
        {[1, 2, 3, 4].map(n => (
          <div key={n} style={{
            flex: 1, height: 3, borderRadius: 2,
            background: n <= 3 ? t.accent : t.hairlineStrong,
          }}/>
        ))}
      </div>

      {/* title */}
      <div style={{ padding: '22px 22px 0' }}>
        <div style={{ fontSize: 11, color: t.text3, letterSpacing: 0.6, textTransform: 'uppercase', fontFamily: mono }}>Confirm transfer</div>
        <div style={{ fontSize: 22, color: t.text1, marginTop: 6, fontWeight: 500, letterSpacing: -0.4, lineHeight: 1.2 }}>
          Review the details before<br/>you send.
        </div>
      </div>

      {/* recipient */}
      <div style={{ margin: '20px 18px 0', padding: '16px 18px', borderRadius: 18,
        background: t.surface1, border: `1px solid ${t.hairline}`,
        display: 'flex', alignItems: 'center', gap: 12,
      }}>
        <div style={{
          width: 44, height: 44, borderRadius: 22,
          background: `linear-gradient(135deg, ${t.accent}, oklch(0.55 0.06 200))`,
          color: t.accentInk, display: 'grid', placeItems: 'center',
          fontFamily: mono, fontWeight: 600, fontSize: 14,
        }}>AO</div>
        <div style={{ flex: 1, lineHeight: 1.25 }}>
          <div style={{ fontSize: 14, color: t.text1, fontWeight: 500 }}>Adaeze Okonkwo</div>
          <div style={{ fontSize: 11.5, color: t.text3, fontFamily: mono, marginTop: 2 }}>GTBank · 0123456789</div>
        </div>
        <div style={{
          padding: '3px 8px', borderRadius: 999,
          background: t.pos.replace(')', ' / 0.14)'), color: t.pos,
          fontSize: 10, fontWeight: 600, letterSpacing: 0.3, textTransform: 'uppercase',
          display: 'inline-flex', alignItems: 'center', gap: 4,
        }}>
          {Icon.check(10)} Verified
        </div>
      </div>

      {/* amount block */}
      <div style={{ margin: '14px 18px 0', padding: '24px 20px 18px', borderRadius: 18,
        background: t.surface1, border: `1px solid ${t.hairline}`, textAlign: 'center',
      }}>
        <div style={{ fontSize: 11, color: t.text3, letterSpacing: 0.5, textTransform: 'uppercase', fontFamily: mono }}>You're sending</div>
        <div style={{ marginTop: 8, display: 'flex', alignItems: 'baseline', justifyContent: 'center', gap: 3, fontFamily: mono, fontFeatureSettings: '"tnum" 1, "lnum" 1' }}>
          <span style={{ fontSize: 20, color: t.text2, fontWeight: 500 }}>−₦</span>
          <span style={{ fontSize: 52, color: t.text1, fontWeight: 500, letterSpacing: -1.6, lineHeight: 1 }}>45,000</span>
          <span style={{ fontSize: 24, color: t.text3, fontWeight: 400, letterSpacing: -0.6 }}>.00</span>
        </div>
        <div style={{ marginTop: 6, fontSize: 11.5, color: t.text3 }}>Forty‑five thousand naira</div>
      </div>

      {/* breakdown */}
      <div style={{ margin: '12px 18px 0', padding: '4px 18px', borderRadius: 18,
        background: t.surface1, border: `1px solid ${t.hairline}`,
      }}>
        {[
          ['Amount', '₦45,000.00'],
          ['Transfer fee', '₦0.00'],
          ['Stamp duty', '₦50.00'],
        ].map(([k, v]) => (
          <div key={k} style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 0', borderBottom: `1px solid ${t.hairline}`, fontSize: 13 }}>
            <div style={{ color: t.text3 }}>{k}</div>
            <div style={{ color: t.text1, fontFamily: mono, fontFeatureSettings: '"tnum" 1' }}>{v}</div>
          </div>
        ))}
        <div style={{ display: 'flex', justifyContent: 'space-between', padding: '14px 0', fontSize: 14 }}>
          <div style={{ color: t.text1, fontWeight: 500 }}>Total debit</div>
          <div style={{ color: t.text1, fontFamily: mono, fontWeight: 600, fontFeatureSettings: '"tnum" 1' }}>₦45,050.00</div>
        </div>
      </div>

      {/* note */}
      <div style={{ margin: '10px 18px 0', padding: '10px 14px', borderRadius: 12,
        background: 'transparent', border: `1px dashed ${t.hairlineStrong}`,
        fontSize: 12, color: t.text2, lineHeight: 1.4,
      }}>
        <span style={{ color: t.text3, fontFamily: mono, fontSize: 10.5, letterSpacing: 0.3 }}>NOTE</span> &nbsp;
        Rent contribution — April. Transfer arrives instantly.
      </div>

      {/* slide to send */}
      <div style={{ margin: '20px 18px 0' }}>
        <div style={{
          height: 60, borderRadius: 30, position: 'relative',
          background: t.surface2, border: `1px solid ${t.hairline}`,
          display: 'flex', alignItems: 'center', overflow: 'hidden',
        }}>
          {/* fill */}
          <div style={{
            position: 'absolute', left: 0, top: 0, bottom: 0, width: '38%',
            background: `linear-gradient(90deg, ${t.accent} 0%, ${t.accent} 80%, transparent 100%)`,
            opacity: 0.18,
          }}/>
          {/* knob */}
          <div style={{
            position: 'absolute', left: 4, top: 4, width: 52, height: 52, borderRadius: 26,
            background: t.accent, color: t.accentInk,
            display: 'grid', placeItems: 'center',
            boxShadow: '0 2px 8px oklch(0 0 0 / 0.25)',
          }}>{Icon.arrowUp(20)}</div>
          <div style={{
            flex: 1, textAlign: 'center', fontSize: 14, fontWeight: 500, color: t.text2,
            letterSpacing: 0.4, paddingLeft: 50,
          }}>Slide to send</div>
        </div>
        <div style={{ marginTop: 10, display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6, fontSize: 11, color: t.text3 }}>
          {Icon.lock(11)} <span>Secured by hardware key · Face ID required</span>
        </div>
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// 3) CARD DETAIL
// ─────────────────────────────────────────────────────────────
function CardDetail({ t }) {
  const cardTx = [
    { id: 1, who: 'Spotify', sub: 'Subscription · Today', amt: -1900 },
    { id: 2, who: 'Chicken Republic', sub: 'Food · Yesterday', amt: -8400 },
    { id: 3, who: 'Bolt', sub: 'Ride · Apr 28', amt: -3250 },
  ];

  return (
    <div style={{ background: t.bg, color: t.text1, minHeight: '100%', fontFamily: sans, paddingBottom: 28 }}>
      {/* header */}
      <div style={{ padding: '60px 18px 12px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{ width: 36, height: 36, borderRadius: 12, background: t.surface1, border: `1px solid ${t.hairline}`, color: t.text1, display: 'grid', placeItems: 'center' }}>{Icon.back(20)}</div>
        <div style={{ fontSize: 14, color: t.text1, fontWeight: 500 }}>Virtual card</div>
        <div style={{ width: 36, height: 36, borderRadius: 12, background: t.surface1, border: `1px solid ${t.hairline}`, color: t.text2, display: 'grid', placeItems: 'center' }}>{Icon.more(18)}</div>
      </div>

      {/* CARD VISUAL */}
      <div style={{ margin: '12px 22px 0', perspective: 1000 }}>
        <div style={{
          aspectRatio: '1.586 / 1', borderRadius: 22, position: 'relative', overflow: 'hidden',
          background: `linear-gradient(135deg, ${t.cardA} 0%, ${t.cardB} 100%)`,
          border: `1px solid ${t.cardEdge}`,
          boxShadow: t.name === 'dark'
            ? '0 24px 48px oklch(0 0 0 / 0.55), inset 0 1px 0 oklch(1 0 0 / 0.06)'
            : '0 24px 48px oklch(0 0 0 / 0.22), inset 0 1px 0 oklch(1 0 0 / 0.08)',
          color: 'oklch(0.95 0.005 80)', padding: '20px 22px',
          display: 'flex', flexDirection: 'column', justifyContent: 'space-between',
        }}>
          {/* shimmer line */}
          <div style={{
            position: 'absolute', top: '-50%', left: '-20%', right: '-20%', height: '200%',
            background: 'linear-gradient(115deg, transparent 40%, oklch(1 0 0 / 0.06) 50%, transparent 60%)',
            transform: 'rotate(-12deg)', pointerEvents: 'none',
          }}/>
          {/* embossed grid */}
          <div style={{ position: 'absolute', inset: 0, opacity: 0.5,
            backgroundImage: `radial-gradient(circle at 20% 30%, oklch(1 0 0 / 0.04) 0%, transparent 40%),
                              radial-gradient(circle at 90% 90%, ${t.accent.replace(')', ' / 0.10)')} 0%, transparent 40%)`,
            pointerEvents: 'none',
          }}/>
          {/* top */}
          <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', position: 'relative' }}>
            <div>
              <div style={{ fontSize: 10, letterSpacing: 1.4, opacity: 0.6, textTransform: 'uppercase', fontFamily: mono }}>Vault</div>
              <div style={{ marginTop: 2, fontSize: 13, fontWeight: 500, opacity: 0.92 }}>Black · Virtual</div>
            </div>
            {/* monogram mark */}
            <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 4 }}>
              <div style={{
                width: 28, height: 28, borderRadius: 7,
                background: t.accent, color: t.accentInk,
                display: 'grid', placeItems: 'center',
                fontFamily: mono, fontWeight: 700, fontSize: 13,
              }}>V</div>
            </div>
          </div>
          {/* number */}
          <div style={{ position: 'relative' }}>
            <div style={{ fontFamily: mono, letterSpacing: 2, fontSize: 18, fontWeight: 500, fontFeatureSettings: '"tnum" 1' }}>
              4192&nbsp;&nbsp;••••&nbsp;&nbsp;••••&nbsp;&nbsp;7042
            </div>
            <div style={{ marginTop: 14, display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' }}>
              <div>
                <div style={{ fontSize: 9, letterSpacing: 0.6, opacity: 0.55, textTransform: 'uppercase', fontFamily: mono }}>Cardholder</div>
                <div style={{ fontSize: 12, marginTop: 2, fontWeight: 500 }}>OLUMIDE ADELEKE</div>
              </div>
              <div style={{ textAlign: 'right' }}>
                <div style={{ fontSize: 9, letterSpacing: 0.6, opacity: 0.55, textTransform: 'uppercase', fontFamily: mono }}>Expires</div>
                <div style={{ fontSize: 12, marginTop: 2, fontFamily: mono, fontWeight: 500 }}>09 / 28</div>
              </div>
              <div style={{ textAlign: 'right' }}>
                <div style={{ fontSize: 9, letterSpacing: 0.6, opacity: 0.55, textTransform: 'uppercase', fontFamily: mono }}>CVV</div>
                <div style={{ fontSize: 12, marginTop: 2, fontFamily: mono, fontWeight: 500, letterSpacing: 1 }}>•••</div>
              </div>
            </div>
          </div>
        </div>
      </div>

      {/* card actions */}
      <div style={{ margin: '14px 22px 0', display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 8 }}>
        {[
          { l: 'Reveal', i: Icon.eye(16) },
          { l: 'Freeze', i: Icon.snowflake(15) },
          { l: 'Copy', i: Icon.copy(14) },
        ].map(a => (
          <div key={a.l} style={{
            padding: '11px 0', borderRadius: 13,
            background: t.surface1, border: `1px solid ${t.hairline}`,
            color: t.text1, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 4,
          }}>
            <div style={{ color: t.text2 }}>{a.i}</div>
            <div style={{ fontSize: 11.5, fontWeight: 500 }}>{a.l}</div>
          </div>
        ))}
      </div>

      {/* limits row */}
      <div style={{ margin: '12px 22px 0', padding: '14px 16px', borderRadius: 14,
        background: t.surface1, border: `1px solid ${t.hairline}`,
      }}>
        <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline' }}>
          <div style={{ fontSize: 12, color: t.text3, letterSpacing: 0.3, textTransform: 'uppercase', fontFamily: mono }}>Daily limit</div>
          <div style={{ fontSize: 12, color: t.text2, fontFamily: mono, fontFeatureSettings: '"tnum" 1' }}>₦13,550 / ₦200,000</div>
        </div>
        <div style={{ marginTop: 10, height: 6, borderRadius: 3, background: t.surface3, overflow: 'hidden' }}>
          <div style={{ width: '6.78%', height: '100%', background: t.accent, borderRadius: 3 }}/>
        </div>
      </div>

      {/* card transactions */}
      <div style={{ margin: '20px 22px 8px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
        <div style={{ fontSize: 13, color: t.text2, fontWeight: 500 }}>Recent on this card</div>
        <div style={{ fontSize: 12, color: t.text3, fontFamily: mono }}>3 today</div>
      </div>
      <div style={{ margin: '0 22px', borderRadius: 14, background: t.surface1, border: `1px solid ${t.hairline}`, overflow: 'hidden' }}>
        {cardTx.map((r, i) => (
          <div key={r.id} style={{
            display: 'flex', alignItems: 'center', gap: 12, padding: '11px 14px',
            borderTop: i === 0 ? 'none' : `1px solid ${t.hairline}`,
          }}>
            <div style={{
              width: 30, height: 30, borderRadius: 9,
              background: t.surface2, border: `1px solid ${t.hairline}`,
              color: t.text2, display: 'grid', placeItems: 'center',
              fontFamily: mono, fontSize: 11, fontWeight: 600,
            }}>{r.who.slice(0,2).toUpperCase()}</div>
            <div style={{ flex: 1, minWidth: 0 }}>
              <div style={{ fontSize: 13, color: t.text1, fontWeight: 500 }}>{r.who}</div>
              <div style={{ fontSize: 11, color: t.text3, marginTop: 1 }}>{r.sub}</div>
            </div>
            <div style={{ fontFamily: mono, fontSize: 13, color: t.text1, fontFeatureSettings: '"tnum" 1' }}>
              −₦{Math.abs(r.amt).toLocaleString()}
            </div>
          </div>
        ))}
      </div>
    </div>
  );
}

// ─────────────────────────────────────────────────────────────
// Phone wrapper that strips the auto status-bar (we draw our own header padding)
// ─────────────────────────────────────────────────────────────
function VaultPhone({ t, children }) {
  return (
    <IOSDevice dark={t.name === 'dark'} width={360} height={760}>
      <div style={{ background: t.bg, height: '100%' }}>
        {children}
      </div>
    </IOSDevice>
  );
}

// Expose (incl. shared helpers so marketing screens can reuse them)
Object.assign(window, {
  VAULT_DARK, VAULT_LIGHT,
  WalletHome, SendConfirm, CardDetail, VaultPhone,
  Icon, mono, sans, fmtNGN,
});
