// EXECUTIVE STRATEGY / WAR ROOM v2 — 18 opportunity components + 5 hubs
(function () {
  const T = window.ArbiterTokens;
  const wr = window.wr;

  // ── Shared helpers ──
  const useCross = () => {
    const [, force] = React.useReducer(x => x + 1, 0);
    React.useEffect(() => {
      const store = window.ExecStrategyStore;
      if (!store) return;
      const off = store.bus.on('*', () => force());
      return off;
    }, []);
  };

  const Flash = ({ msg, onClose }) => {
    if (!msg) return null;
    return (
      <div style={{ position: 'sticky', top: 8, zIndex: 20, display: 'flex', justifyContent: 'center', marginBottom: 10 }}>
        <div style={{ background: wr.ink, color: 'white', padding: '10px 18px', borderRadius: 6, boxShadow: '0 8px 18px rgba(15,23,42,0.22)', fontSize: 13, fontWeight: 600, letterSpacing: '0.02em', display: 'flex', alignItems: 'center', gap: 12 }}>
          {msg}
          <button onClick={onClose} style={{ background: 'transparent', color: wr.goldSoft, border: 'none', cursor: 'pointer', fontSize: 14, fontWeight: 700 }}><Icons.X size={11}/></button>
        </div>
      </div>
    );
  };

  const SubTabs = ({ tabs, active, onChange }) => (
    <div style={{ display: 'flex', gap: 2, borderBottom: `1px solid ${T.color.border.light}`, marginBottom: 20, overflowX: 'auto' }}>
      {tabs.map(t => (
        <button key={t.id} onClick={() => onChange(t.id)}
          style={{
            padding: '10px 18px', border: 'none', background: 'transparent',
            fontSize: 12, fontWeight: 600, letterSpacing: '0.06em', textTransform: 'uppercase',
            color: active === t.id ? wr.violetDeep : T.color.text.tertiary,
            borderBottom: `2px solid ${active === t.id ? wr.violet : 'transparent'}`,
            cursor: 'pointer', whiteSpace: 'nowrap',
          }}>
          {t.label}
        </button>
      ))}
    </div>
  );

  const TH = ({ children, style }) => <th style={{ padding: '10px 12px', textAlign: 'left', fontSize: 10, fontWeight: 700, letterSpacing: '0.08em', textTransform: 'uppercase', color: T.color.text.tertiary, borderBottom: `1px solid ${T.color.border.default}`, ...style }}>{children}</th>;
  const TD = ({ children, style, mono }) => <td style={{ padding: '11px 12px', fontSize: 13, color: wr.ink, borderBottom: `1px solid ${T.color.border.light}`, fontFamily: mono ? T.font.mono : T.font.base, ...style }}>{children}</td>;
  const Pill = ({ children, tone }) => {
    const palette = {
      green:   { bg: wr.greenBg, fg: wr.green, bd: 'rgba(4,120,87,0.26)' },
      amber:   { bg: wr.amberBg, fg: wr.amber, bd: 'rgba(180,83,9,0.28)' },
      crimson: { bg: wr.crimsonBg, fg: wr.crimson, bd: 'rgba(185,28,28,0.26)' },
      violet:  { bg: wr.violetBg, fg: wr.violetDeep, bd: wr.violetBorder },
      gold:    { bg: wr.goldBg, fg: wr.gold, bd: wr.goldBorder },
      neutral: { bg: T.color.bg.secondary, fg: T.color.text.secondary, bd: T.color.border.default },
    }[tone || 'neutral'];
    return <span style={{ display: 'inline-block', padding: '3px 9px', fontSize: 10.5, fontWeight: 700, letterSpacing: '0.05em', textTransform: 'uppercase', borderRadius: 999, background: palette.bg, color: palette.fg, border: `1px solid ${palette.bd}` }}>{children}</span>;
  };
  const KpiCard = ({ label, value, tone, sub }) => {
    const fg = tone === 'crimson' ? wr.crimson : tone === 'amber' ? wr.amber : tone === 'green' ? wr.green : tone === 'gold' ? wr.gold : wr.violetDeep;
    const bg = tone === 'crimson' ? wr.crimsonBg : tone === 'amber' ? wr.amberBg : tone === 'green' ? wr.greenBg : tone === 'gold' ? wr.goldBg : wr.violetBg;
    return (
      <div style={{ flex: 1, minWidth: 150, padding: '14px 16px', background: bg, border: `1px solid ${T.color.border.light}`, borderLeft: `3px solid ${fg}`, borderRadius: 6 }}>
        <div style={{ fontSize: 9.5, fontWeight: 700, letterSpacing: '0.1em', textTransform: 'uppercase', color: T.color.text.tertiary, marginBottom: 6 }}>{label}</div>
        <div style={{ fontSize: 20, fontWeight: 700, color: fg, fontFamily: T.font.mono, lineHeight: 1 }}>{value}</div>
        {sub && <div style={{ fontSize: 11, color: T.color.text.secondary, marginTop: 6 }}>{sub}</div>}
      </div>
    );
  };
  const Panel = ({ title, subtitle, children, accent }) => (
    <div style={{ background: 'white', border: `1px solid ${T.color.border.default}`, borderLeft: accent ? `3px solid ${accent}` : `1px solid ${T.color.border.default}`, borderRadius: 6, marginBottom: 20, overflow: 'hidden' }}>
      <div style={{ padding: '14px 18px', borderBottom: `1px solid ${T.color.border.light}`, background: T.color.bg.secondary }}>
        <div style={{ fontSize: 14, fontWeight: 700, color: wr.ink }}>{title}</div>
        {subtitle && <div style={{ fontSize: 12, color: T.color.text.tertiary, marginTop: 3 }}>{subtitle}</div>}
      </div>
      <div style={{ padding: 18 }}>{children}</div>
    </div>
  );
  const BtnPrimary = ({ children, onClick, disabled }) => (
    <button onClick={onClick} disabled={disabled} style={{ padding: '7px 14px', fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: 'white', background: disabled ? T.color.text.disabled : wr.violetDeep, border: 'none', borderRadius: 4, cursor: disabled ? 'not-allowed' : 'pointer' }}>{children}</button>
  );
  const BtnGhost = ({ children, onClick, tone }) => {
    const fg = tone === 'gold' ? wr.gold : tone === 'crimson' ? wr.crimson : wr.violetDeep;
    return <button onClick={onClick} style={{ padding: '6px 12px', fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: fg, background: 'transparent', border: `1px solid ${fg}`, borderRadius: 4, cursor: 'pointer' }}>{children}</button>;
  };
  const Sparkline = ({ values, width = 90, height = 26, color }) => {
    if (!values || values.length < 2) return null;
    const min = Math.min(...values), max = Math.max(...values);
    const range = max - min || 1;
    const pts = values.map((v, i) => `${(i / (values.length - 1)) * width},${height - ((v - min) / range) * height}`).join(' ');
    return (
      <svg width={width} height={height} style={{ display: 'block' }}>
        <polyline points={pts} fill="none" stroke={color || wr.violet} strokeWidth="1.6" />
      </svg>
    );
  };
  const Bar = ({ value, max, color, width = 120, height = 10 }) => (
    <div style={{ width, height, background: T.color.bg.secondary, borderRadius: 2, overflow: 'hidden' }}>
      <div style={{ width: `${Math.max(0, Math.min(100, (value / max) * 100))}%`, height: '100%', background: color || wr.violet }} />
    </div>
  );

  // ═══════════════════════════════════════════════════════════════
  // WR1. Lateral Team Acquisition Modeler
  // ═══════════════════════════════════════════════════════════════
  const WR1Lateral = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [selected, setSelected] = React.useState(store.state.lateralProposals[0]?.id);
    const [port, setPort] = React.useState(null);
    const [ret, setRet] = React.useState(90);
    const [flash, setFlash] = React.useState('');
    const active = store.state.lateralProposals.find(p => p.id === selected);
    React.useEffect(() => { if (active) setPort(active.portabilityPct); }, [selected]);

    const doSensitivity = () => {
      store.runLateralSensitivity(active.id, port, ret, 'Exec Cmte');
      setFlash(`Sensitivity run: ${port}% portability × ${ret}% retention`);
      setTimeout(() => setFlash(''), 3200);
    };
    const advance = (next) => {
      store.advanceLateral(active.id, next, 'Exec Cmte');
      setFlash(`${active.teamName} moved to ${next.toUpperCase()}`);
      setTimeout(() => setFlash(''), 3200);
    };
    const toCalendar = () => {
      store.pushLateralToCalendar({ lateralId: active.id, milestone: 'Committee decision', dueDate: '2026-05-15' });
      setFlash('Milestone pushed to Calendar');
      setTimeout(() => setFlash(''), 3000);
    };

    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Active Proposals" value={store.activeLaterals().length} tone="violet" />
          <KpiCard label="Combined 5-Yr NPV" value={wr.money(store.totalLateralNpv())} tone="gold" />
          <KpiCard label="Avg IRR" value={`${(store.activeLaterals().reduce((s, p) => s + p.irr, 0) / Math.max(1, store.activeLaterals().length)).toFixed(1)}%`} tone="green" />
          <KpiCard label="Committee-Ready" value={store.state.lateralProposals.filter(p => p.status === 'committee-review').length} tone="amber" />
        </div>

        <Panel title="Active Lateral Proposals" subtitle="DCF · portability · conflict waterfall · integration">
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Team</TH><TH>Source</TH><TH>Partners</TH><TH>Book</TH><TH>Portable</TH><TH>5-Yr NPV</TH><TH>IRR</TH><TH>Culture</TH><TH>Status</TH><TH></TH></tr></thead>
            <tbody>
              {store.state.lateralProposals.map(p => (
                <tr key={p.id} onClick={() => setSelected(p.id)} style={{ cursor: 'pointer', background: selected === p.id ? wr.violetBg : 'transparent' }}>
                  <TD><strong>{p.teamName}</strong></TD>
                  <TD>{p.sourceFirm}</TD>
                  <TD mono>{p.partners}P / {p.counsel}C / {p.associates}A</TD>
                  <TD mono>{wr.money(p.reportedBook)}</TD>
                  <TD mono>{wr.money(p.portableBook)} <span style={{ color: T.color.text.tertiary }}>({p.portabilityPct}%)</span></TD>
                  <TD mono style={{ color: p.fiveYrNPV > 20000000 ? wr.green : p.fiveYrNPV > 0 ? wr.amber : wr.crimson, fontWeight: 700 }}>{wr.money(p.fiveYrNPV)}</TD>
                  <TD mono style={{ fontWeight: 700, color: p.irr > 20 ? wr.green : p.irr > 10 ? wr.amber : wr.crimson }}>{p.irr.toFixed(1)}%</TD>
                  <TD mono>{p.cultureFit}</TD>
                  <TD><Pill tone={p.status === 'red-flag' ? 'crimson' : p.status === 'committee-review' ? 'gold' : 'violet'}>{p.status}</Pill></TD>
                  <TD><span style={{ color: wr.violet, fontSize: 16 }}>→</span></TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>

        {active && (
          <Panel title={`Sensitivity · ${active.teamName}`} subtitle={`Baseline NPV ${wr.money(active.fiveYrNPV)} · Break-even ${active.breakEvenQuarter}`} accent={wr.gold}>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20, marginBottom: 18 }}>
              <div>
                <label style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, display: 'block', marginBottom: 6 }}>Book Portability ({port}%)</label>
                <input type="range" min="30" max="95" value={port || 0} onChange={e => setPort(+e.target.value)} style={{ width: '100%' }} />
              </div>
              <div>
                <label style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, display: 'block', marginBottom: 6 }}>5-Yr Retention ({ret}%)</label>
                <input type="range" min="50" max="100" value={ret} onChange={e => setRet(+e.target.value)} style={{ width: '100%' }} />
              </div>
            </div>
            {active.sensitivityResult && (
              <div style={{ padding: 14, background: wr.goldBg, border: `1px solid ${wr.goldBorder}`, borderRadius: 6, marginBottom: 14 }}>
                <div style={{ fontSize: 11, fontWeight: 700, color: wr.gold, letterSpacing: '0.06em', textTransform: 'uppercase', marginBottom: 6 }}>Modeled 5-Yr NPV</div>
                <div style={{ fontSize: 24, fontWeight: 700, color: wr.ink, fontFamily: T.font.mono }}>{wr.money(active.sensitivityResult.adjustedNpv)}</div>
                <div style={{ fontSize: 12, color: T.color.text.secondary, marginTop: 4 }}>Δ vs baseline: {wr.money(active.sensitivityResult.adjustedNpv - active.fiveYrNPV)}</div>
              </div>
            )}
            <div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
              <BtnPrimary onClick={doSensitivity}>Run Sensitivity</BtnPrimary>
              <BtnGhost onClick={() => advance('diligence')}>Advance → Diligence</BtnGhost>
              <BtnGhost onClick={() => advance('committee-review')}>Send to Committee</BtnGhost>
              <BtnGhost tone="gold" onClick={toCalendar}>Push Milestone to Calendar</BtnGhost>
              <BtnGhost tone="crimson" onClick={() => advance('rejected')}>Reject</BtnGhost>
            </div>
          </Panel>
        )}
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR2. M&A / Practice Group Acquisition
  // ═══════════════════════════════════════════════════════════════
  const WR2MA = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const advance = (id, next) => {
      const t = store.advanceMaTarget(id, next, 'Exec Cmte');
      if (t) { setFlash(`${t.target}: advanced to ${next.toUpperCase()}`); setTimeout(() => setFlash(''), 3000); }
    };

    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Active Targets" value={store.state.maTargets.length} tone="violet" />
          <KpiCard label="Combined Proposed Price" value={wr.money(store.state.maTargets.reduce((s, t) => s + t.proposedPrice, 0))} tone="gold" />
          <KpiCard label="Blended 5-Yr Accretion" value={`+${(store.state.maTargets.reduce((s, t) => s + t.accretionYr5, 0) / store.state.maTargets.length).toFixed(1)}%`} tone="green" />
        </div>

        {store.state.maTargets.map(t => (
          <Panel key={t.id} title={t.target} subtitle={t.description} accent={t.riskScore === 'low' ? wr.green : wr.amber}>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 12, marginBottom: 16 }}>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Target Revenue</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4 }}>{wr.money(t.targetRevenue)}</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>EBITDA</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4 }}>{wr.money(t.targetEBITDA)}</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Multiple</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4 }}>{t.proposedMultiple}×</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Proposed Price</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.gold }}>{wr.money(t.proposedPrice)}</div></div>
            </div>
            <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 12, marginBottom: 16 }}>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Yr 1 Accretion</div><div style={{ fontSize: 14, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: t.accretionYr1 < 0 ? wr.crimson : wr.green }}>{t.accretionYr1 > 0 ? '+' : ''}{t.accretionYr1}%</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Yr 3</div><div style={{ fontSize: 14, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.green }}>+{t.accretionYr3}%</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Yr 5</div><div style={{ fontSize: 14, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.green }}>+{t.accretionYr5}%</div></div>
              <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Culture Fit</div><div style={{ fontSize: 14, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4 }}>{t.cultureFitScore}/100</div></div>
            </div>
            <div style={{ display: 'flex', gap: 12, marginBottom: 16, alignItems: 'center' }}>
              <Pill tone={t.riskScore === 'low' ? 'green' : 'amber'}>{t.riskScore} risk</Pill>
              <Pill tone="violet">{t.status}</Pill>
              <span style={{ fontSize: 12, color: T.color.text.secondary }}>Client overlap: {t.clientOverlapPct}% · Practice overlap: {t.practiceOverlapPct}%</span>
            </div>
            <div style={{ display: 'flex', gap: 8 }}>
              <BtnPrimary onClick={() => advance(t.id, 'diligence')}>Advance to Diligence</BtnPrimary>
              <BtnGhost onClick={() => advance(t.id, 'loi-stage')}>Issue LOI</BtnGhost>
              <BtnGhost tone="crimson" onClick={() => advance(t.id, 'declined')}>Decline</BtnGhost>
            </div>
          </Panel>
        ))}
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR3. Strategic Plan Tracker
  // ═══════════════════════════════════════════════════════════════
  const WR3Plan = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const inits = store.state.strategicInitiatives;
    const themes = [...new Set(inits.map(i => i.theme))];
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Total Committed" value={wr.money(store.totalCommitted())} tone="violet" />
          <KpiCard label="Deployed" value={wr.money(store.totalDeployed())} tone="gold" sub={`${((store.totalDeployed() / store.totalCommitted()) * 100).toFixed(0)}% of plan`} />
          <KpiCard label="Returns Booked" value={wr.money(inits.reduce((s, i) => s + (i.returns || 0), 0))} tone="green" />
          <KpiCard label="Behind Schedule" value={store.plansBehindSchedule()} tone={store.plansBehindSchedule() > 0 ? 'crimson' : 'green'} />
        </div>

        {themes.map(theme => (
          <Panel key={theme} title={`${theme} Investments`} accent={wr.violet}>
            <table style={{ width: '100%', borderCollapse: 'collapse' }}>
              <thead><tr><TH>Initiative</TH><TH>Owner</TH><TH>Committed</TH><TH>Deployed</TH><TH>Returns</TH><TH>Progress</TH><TH>Status</TH></tr></thead>
              <tbody>
                {inits.filter(i => i.theme === theme).map(i => (
                  <tr key={i.id}>
                    <TD><strong>{i.initiative}</strong></TD>
                    <TD>{i.owner}</TD>
                    <TD mono>{wr.money(i.committed)}</TD>
                    <TD mono>{wr.money(i.deployed)}</TD>
                    <TD mono style={{ color: i.returns ? wr.green : T.color.text.tertiary }}>{i.returns ? wr.money(i.returns) : '—'}</TD>
                    <TD><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Bar value={i.pctComplete} max={100} color={i.status === 'behind' ? wr.crimson : i.status === 'ahead' ? wr.green : wr.violet} width={90} /><span style={{ fontSize: 11, fontFamily: T.font.mono, fontWeight: 700 }}>{i.pctComplete}%</span></div></TD>
                    <TD><Pill tone={i.status === 'ahead' || i.status === 'complete' ? 'green' : i.status === 'behind' ? 'crimson' : 'violet'}>{i.status}</Pill></TD>
                  </tr>
                ))}
              </tbody>
            </table>
          </Panel>
        ))}
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR4. Scenario / Stress Test
  // ═══════════════════════════════════════════════════════════════
  const WR4Stress = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [selected, setSelected] = React.useState(store.state.stressScenarios[0].id);
    const [flash, setFlash] = React.useState('');
    const s = store.state.stressScenarios.find(x => x.id === selected);
    const activate = () => {
      store.activateScenario(s.id, 'Exec Cmte');
      setFlash(`Scenario modeled: ${s.name}`);
      setTimeout(() => setFlash(''), 3000);
    };
    const expectedLoss = store.state.stressScenarios.reduce((sum, sc) => sum + (sc.revenueDelta * sc.probability / 100), 0);
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Scenarios Modeled" value={store.state.stressScenarios.length} tone="violet" />
          <KpiCard label="Probability-Weighted Revenue Loss" value={wr.money(expectedLoss)} tone="crimson" />
          <KpiCard label="Worst-Case PPP Drop" value={`${Math.min(...store.state.stressScenarios.map(x => x.pppDelta))}%`} tone="amber" />
        </div>

        <Panel title="Stress Scenarios" accent={wr.crimson}>
          <div style={{ display: 'flex', gap: 8, marginBottom: 16, flexWrap: 'wrap' }}>
            {store.state.stressScenarios.map(sc => (
              <button key={sc.id} onClick={() => setSelected(sc.id)} style={{ padding: '10px 14px', fontSize: 12, fontWeight: 600, color: selected === sc.id ? 'white' : wr.ink, background: selected === sc.id ? wr.violetDeep : T.color.bg.secondary, border: `1px solid ${selected === sc.id ? wr.violetDeep : T.color.border.default}`, borderRadius: 4, cursor: 'pointer' }}>{sc.name}</button>
            ))}
          </div>
          {s && (
            <div>
              <div style={{ fontSize: 13, color: T.color.text.secondary, marginBottom: 14 }}>{s.description}</div>
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: 12, marginBottom: 16 }}>
                <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Revenue Δ</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.crimson }}>{wr.money(s.revenueDelta)}</div></div>
                <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>PPP Δ</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.crimson }}>{s.pppDelta}%</div></div>
                <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Cash Shortfall</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4, color: wr.crimson }}>{wr.money(s.cashShortfall)}</div></div>
                <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Comp Action</div><div style={{ fontSize: 14, fontWeight: 700, marginTop: 4 }}>{s.comp}</div></div>
                <div><div style={{ fontSize: 10, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Layoffs</div><div style={{ fontSize: 16, fontFamily: T.font.mono, fontWeight: 700, marginTop: 4 }}>{s.layoffs}</div></div>
              </div>
              <div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 14 }}>
                <span style={{ fontSize: 11, color: T.color.text.tertiary, letterSpacing: '0.06em', textTransform: 'uppercase', fontWeight: 700 }}>Probability</span>
                <Bar value={s.probability} max={100} color={wr.gold} width={200} height={8} />
                <span style={{ fontSize: 13, fontWeight: 700, fontFamily: T.font.mono }}>{s.probability}%</span>
              </div>
              <div style={{ marginBottom: 14 }}>
                <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, marginBottom: 6 }}>Mitigations</div>
                <ul style={{ margin: 0, paddingLeft: 18, fontSize: 13 }}>
                  {s.mitigations.map((m, i) => <li key={i} style={{ marginBottom: 4 }}>{m}</li>)}
                </ul>
              </div>
              <BtnPrimary onClick={activate}>Activate Scenario</BtnPrimary>
            </div>
          )}
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR5. Partner Comp Committee Cockpit
  // ═══════════════════════════════════════════════════════════════
  const WR5Comp = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [selected, setSelected] = React.useState(null);
    const [proposed, setProposed] = React.useState(0);
    const [flash, setFlash] = React.useState('');
    const select = (id) => {
      const p = store.state.partners.find(x => x.id === id);
      setSelected(id); setProposed(p.currentComp);
    };
    const model = () => {
      store.modelComp(selected, proposed, 'Comp Cmte');
      setFlash('Proposed comp modeled');
      setTimeout(() => setFlash(''), 2500);
    };
    const p = store.state.partners.find(x => x.id === selected);
    const totalComp = store.state.partners.reduce((s, x) => s + x.currentComp, 0);

    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Active Partners" value={store.state.partners.length} tone="violet" />
          <KpiCard label="Total Comp Pool" value={wr.money(totalComp)} tone="gold" />
          <KpiCard label="Top Decile Comp" value={wr.money(store.state.partners.filter(x => x.decile === 1).reduce((s, x) => s + x.currentComp, 0))} tone="green" />
        </div>

        <Panel title="Partner Compensation Review — LOCKED, COMMITTEE ACCESS ONLY" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Partner</TH><TH>Tier</TH><TH>Practice</TH><TH>Origination</TH><TH>Working</TH><TH>Realization</TH><TH>Book Trend</TH><TH>Leverage</TH><TH>Citizenship</TH><TH>DEI</TH><TH>Decile</TH><TH>Current</TH></tr></thead>
            <tbody>
              {store.state.partners.sort((a, b) => a.decile - b.decile).map(p => (
                <tr key={p.id} onClick={() => select(p.id)} style={{ cursor: 'pointer', background: selected === p.id ? wr.violetBg : 'transparent' }}>
                  <TD><strong>{p.name}</strong></TD>
                  <TD><Pill tone={p.tier === 'Sr Equity' ? 'gold' : p.tier === 'Equity' ? 'violet' : 'neutral'}>{p.tier}</Pill></TD>
                  <TD>{p.practice}</TD>
                  <TD mono>{wr.money(p.origination)}</TD>
                  <TD mono>{wr.money(p.working)}</TD>
                  <TD mono>{p.realization}%</TD>
                  <TD mono style={{ color: p.bookTrend >= 0 ? wr.green : wr.crimson, fontWeight: 700 }}>{p.bookTrend > 0 ? '+' : ''}{p.bookTrend}%</TD>
                  <TD mono>{p.leverageRatio}</TD>
                  <TD mono>{p.citizenship}</TD>
                  <TD mono>{p.dei}</TD>
                  <TD><Pill tone={p.decile <= 2 ? 'gold' : p.decile <= 4 ? 'violet' : 'neutral'}>{p.decile}</Pill></TD>
                  <TD mono style={{ fontWeight: 700 }}>{wr.money(p.currentComp)}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>

        {p && (
          <Panel title={`Comp Modeling · ${p.name}`} subtitle="Adjust proposed comp and model impact on pool" accent={wr.gold}>
            <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20 }}>
              <div>
                <label style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, display: 'block', marginBottom: 6 }}>Proposed Comp</label>
                <input type="number" value={proposed} onChange={e => setProposed(+e.target.value)} step="50000" style={{ width: '100%', padding: 10, fontSize: 14, fontFamily: T.font.mono, border: `1px solid ${T.color.border.default}`, borderRadius: 4 }} />
                <div style={{ fontSize: 12, color: T.color.text.secondary, marginTop: 6 }}>
                  Δ from current: {wr.money(proposed - p.currentComp)} ({(((proposed - p.currentComp) / p.currentComp) * 100).toFixed(1)}%)
                </div>
              </div>
              <div>
                <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, marginBottom: 6 }}>Peer Benchmark (est)</div>
                <div style={{ fontSize: 13, color: T.color.text.secondary }}>Kirkland {p.tier}: {wr.money(p.currentComp * 1.12)}</div>
                <div style={{ fontSize: 13, color: T.color.text.secondary }}>Latham {p.tier}: {wr.money(p.currentComp * 1.04)}</div>
                <div style={{ fontSize: 13, color: T.color.text.secondary }}>Wachtell {p.tier}: {wr.money(p.currentComp * 1.32)}</div>
              </div>
            </div>
            <div style={{ marginTop: 16 }}>
              <BtnPrimary onClick={model}>Save Modeled Comp</BtnPrimary>
            </div>
          </Panel>
        )}
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR6. Succession & Retirement Cliff
  // ═══════════════════════════════════════════════════════════════
  const WR6Succession = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const openPlan = (id) => {
      const r = store.openSuccessionPlan(id, 'Mgmt Cmte');
      if (r) { setFlash(`Succession plan opened for ${r.name}`); setTimeout(() => setFlash(''), 3000); }
    };
    const years = [...new Set(store.state.retirements.map(r => r.retirementYear))].sort();
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Partners Retiring ≤5Yrs" value={store.state.retirements.length} tone="violet" />
          <KpiCard label="Total Book At-Risk" value={wr.money(store.state.retirements.reduce((s, r) => s + r.bookAtRisk, 0))} tone="gold" />
          <KpiCard label="Transfer-Risk $" value={wr.money(store.totalRetentionRisk())} tone="crimson" />
          <KpiCard label="Without Plan" value={store.state.retirements.filter(r => r.readiness === 'none').length} tone={store.state.retirements.filter(r => r.readiness === 'none').length > 0 ? 'crimson' : 'green'} />
        </div>

        <Panel title="Retirement Timeline" accent={wr.violet}>
          <div style={{ display: 'grid', gridTemplateColumns: `repeat(${years.length}, 1fr)`, gap: 14 }}>
            {years.map(y => (
              <div key={y} style={{ padding: 14, background: wr.violetBg, border: `1px solid ${wr.violetBorder}`, borderRadius: 6 }}>
                <div style={{ fontSize: 20, fontWeight: 700, color: wr.violetDeep, fontFamily: T.font.mono, marginBottom: 8 }}>{y}</div>
                {store.state.retirements.filter(r => r.retirementYear === y).map(r => (
                  <div key={r.partnerId} style={{ marginBottom: 8, padding: 8, background: 'white', borderRadius: 4, fontSize: 12 }}>
                    <div style={{ fontWeight: 700 }}>{r.name}</div>
                    <div style={{ color: T.color.text.secondary }}>{wr.money(r.bookAtRisk)} book · {r.portablePct}% portable</div>
                    <div style={{ marginTop: 4 }}><Pill tone={r.readiness === 'advanced' ? 'green' : r.readiness === 'formal-plan' ? 'violet' : r.readiness === 'none' ? 'crimson' : 'amber'}>{r.readiness}</Pill></div>
                  </div>
                ))}
              </div>
            ))}
          </div>
        </Panel>

        <Panel title="Succession Plans — Book Transferability" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Partner</TH><TH>Retires</TH><TH>Book</TH><TH>Portable %</TH><TH>Transfer Risk</TH><TH>Successors</TH><TH>Readiness</TH><TH></TH></tr></thead>
            <tbody>
              {store.state.retirements.map(r => (
                <tr key={r.partnerId}>
                  <TD><strong>{r.name}</strong></TD>
                  <TD mono>{r.retirementYear}</TD>
                  <TD mono>{wr.money(r.bookAtRisk)}</TD>
                  <TD mono>{r.portablePct}%</TD>
                  <TD mono style={{ color: wr.crimson, fontWeight: 700 }}>{wr.money(r.transferRisk)}</TD>
                  <TD>{r.successors.length ? r.successors.join(', ') : <span style={{ color: wr.crimson }}>NONE DESIGNATED</span>}</TD>
                  <TD><Pill tone={r.readiness === 'advanced' ? 'green' : r.readiness === 'formal-plan' ? 'violet' : r.readiness === 'none' ? 'crimson' : 'amber'}>{r.readiness}</Pill></TD>
                  <TD>{r.readiness !== 'advanced' && <BtnGhost onClick={() => openPlan(r.partnerId)}>Open Plan</BtnGhost>}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR7. Equity Partner Performance Decile
  // ═══════════════════════════════════════════════════════════════
  const WR7Decile = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const score = (p) => {
      // Composite: origination 40%, working 15%, realization 15%, bookTrend 10%, citizenship 10%, dei 10%
      return (p.origination / 20000000) * 40 + (p.working / 6000000) * 15 + (p.realization / 100) * 15 + ((p.bookTrend + 25) / 50) * 10 + (p.citizenship / 10) * 10 + (p.dei / 10) * 10;
    };
    const sorted = [...store.state.partners].map(p => ({ ...p, compositeScore: score(p) })).sort((a, b) => b.compositeScore - a.compositeScore);
    const max = sorted[0].compositeScore;
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Force-Ranked" value={sorted.length} tone="violet" />
          <KpiCard label="Top Decile" value={sorted.filter(p => p.decile === 1).length} tone="gold" />
          <KpiCard label="Bottom Decile Review" value={sorted.filter(p => p.decile >= 5).length} tone="amber" />
        </div>
        <Panel title="Partner Performance — Composite Score" subtitle="Origination 40% · Working 15% · Realization 15% · Trend 10% · Citizenship 10% · DEI 10%" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Rank</TH><TH>Partner</TH><TH>Decile</TH><TH>Composite</TH><TH>Origination</TH><TH>Realization</TH><TH>Trend</TH><TH>Citizenship</TH><TH>DEI</TH></tr></thead>
            <tbody>
              {sorted.map((p, i) => (
                <tr key={p.id}>
                  <TD mono style={{ fontWeight: 700 }}>{i + 1}</TD>
                  <TD><strong>{p.name}</strong> <span style={{ color: T.color.text.tertiary, fontSize: 11 }}>· {p.practice}</span></TD>
                  <TD><Pill tone={p.decile <= 2 ? 'gold' : p.decile <= 4 ? 'violet' : 'neutral'}>D{p.decile}</Pill></TD>
                  <TD><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Bar value={p.compositeScore} max={max} color={wr.gold} width={100} /><span style={{ fontSize: 11, fontFamily: T.font.mono, fontWeight: 700 }}>{p.compositeScore.toFixed(1)}</span></div></TD>
                  <TD mono>{wr.money(p.origination)}</TD>
                  <TD mono>{p.realization}%</TD>
                  <TD mono style={{ color: p.bookTrend >= 0 ? wr.green : wr.crimson, fontWeight: 700 }}>{p.bookTrend > 0 ? '+' : ''}{p.bookTrend}%</TD>
                  <TD mono>{p.citizenship}</TD>
                  <TD mono>{p.dei}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR8. Associate Attrition Predictor
  // ═══════════════════════════════════════════════════════════════
  const WR8Attrition = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const trigger = (id, play) => {
      const a = store.triggerRetentionPlay(id, play, 'People Ops');
      if (a) { setFlash(`${a.name}: ${play.toUpperCase()} triggered`); setTimeout(() => setFlash(''), 3000); }
    };
    const sorted = [...store.state.associates].sort((a, b) => b.departureRisk - a.departureRisk);
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Active Associates" value={store.state.associates.length} tone="violet" />
          <KpiCard label="High-Risk (>50%)" value={store.highAttritionCount()} tone="crimson" />
          <KpiCard label="Cost-of-Loss at Risk" value={wr.money(store.associateCostAtRisk())} tone="gold" />
          <KpiCard label="Avg Risk" value={`${((store.state.associates.reduce((s, a) => s + a.departureRisk, 0) / store.state.associates.length) * 100).toFixed(0)}%`} tone="amber" />
        </div>
        <Panel title="180-Day Departure Risk — ML-Scored" subtitle="Inputs: hours volatility · review · comp percentile · mentorship · Glassdoor sentiment" accent={wr.crimson}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Associate</TH><TH>Class</TH><TH>Practice</TH><TH>Hours YTD</TH><TH>Volatility</TH><TH>Review</TH><TH>Comp %ile</TH><TH>Mentorship</TH><TH>Risk</TH><TH>Time-to-Loss</TH><TH>Cost</TH><TH></TH></tr></thead>
            <tbody>
              {sorted.map(a => (
                <tr key={a.id}>
                  <TD><strong>{a.name}</strong></TD>
                  <TD>{a.class}</TD>
                  <TD>{a.practice}</TD>
                  <TD mono>{a.hoursYtd.toLocaleString()}</TD>
                  <TD mono style={{ color: a.hoursVolatility > 0.5 ? wr.crimson : a.hoursVolatility > 0.35 ? wr.amber : wr.green }}>{a.hoursVolatility.toFixed(2)}</TD>
                  <TD mono>{a.reviewScore}</TD>
                  <TD mono>{a.compPercentile}%</TD>
                  <TD mono>{a.mentorshipTouches}</TD>
                  <TD><div style={{ display: 'flex', alignItems: 'center', gap: 6 }}><Bar value={a.departureRisk * 100} max={100} color={a.departureRisk > 0.5 ? wr.crimson : a.departureRisk > 0.25 ? wr.amber : wr.green} width={70} /><span style={{ fontSize: 11, fontFamily: T.font.mono, fontWeight: 700, color: a.departureRisk > 0.5 ? wr.crimson : wr.ink }}>{(a.departureRisk * 100).toFixed(0)}%</span></div></TD>
                  <TD mono>{a.timeToLoss ? `${a.timeToLoss}d` : '—'}</TD>
                  <TD mono>{wr.money(a.costOfLoss)}</TD>
                  <TD>{a.departureRisk >= 0.5 && !a.retentionPlay && (<div style={{ display: 'flex', gap: 4 }}><BtnGhost onClick={() => trigger(a.id, 'retention-bonus')}>BONUS</BtnGhost><BtnGhost tone="gold" onClick={() => trigger(a.id, 'mentor-match')}>MENTOR</BtnGhost></div>)}{a.retentionPlay && <Pill tone="green">{a.retentionPlay.play}</Pill>}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR9. Promotion Pipeline & Dilution Model
  // ═══════════════════════════════════════════════════════════════
  const WR9Pipeline = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [selected, setSelected] = React.useState(6);
    const [flash, setFlash] = React.useState('');
    const pp = store.state.promotionPipeline;
    const selectSc = (c) => {
      setSelected(c);
      store.selectPromotionScenario(c, 'Exec Cmte');
      setFlash(`Modeled ${c} new equity partners`);
      setTimeout(() => setFlash(''), 2500);
    };
    const sc = pp.scenarios.find(x => x.promotedThisYear === selected);
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Current PPP" value={wr.money(pp.currentPPP)} tone="gold" />
          <KpiCard label="Equity Shares" value={pp.equityShares} tone="violet" />
          <KpiCard label="Pipeline Total" value={pp.stages.reduce((s, x) => s + x.count, 0)} tone="green" />
        </div>

        <Panel title="Promotion Pipeline — Funnel" accent={wr.violet}>
          <div style={{ display: 'flex', gap: 8, alignItems: 'flex-end' }}>
            {pp.stages.map((s, i) => {
              const pct = (s.count / pp.stages[0].count) * 100;
              return (
                <div key={i} style={{ flex: 1, textAlign: 'center' }}>
                  <div style={{ height: `${pct * 1.4}px`, minHeight: 40, background: `linear-gradient(180deg, ${wr.violet} 0%, ${wr.violetDeep} 100%)`, borderRadius: 4, display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'white', fontWeight: 700, fontSize: 20, fontFamily: T.font.mono }}>{s.count}</div>
                  <div style={{ fontSize: 11, marginTop: 8, color: T.color.text.secondary, fontWeight: 600 }}>{s.stage}</div>
                  {s.yearOneConv && <div style={{ fontSize: 11, color: T.color.text.tertiary, marginTop: 2, fontFamily: T.font.mono }}>{(s.yearOneConv * 100).toFixed(0)}% conv</div>}
                </div>
              );
            })}
          </div>
        </Panel>

        <Panel title="Equity Dilution Scenarios" subtitle={`Current PPP: ${wr.money(pp.currentPPP)}`} accent={wr.gold}>
          <div style={{ display: 'flex', gap: 10, marginBottom: 16 }}>
            {pp.scenarios.map(x => (
              <button key={x.promotedThisYear} onClick={() => selectSc(x.promotedThisYear)}
                style={{ flex: 1, padding: 14, background: selected === x.promotedThisYear ? wr.goldBg : T.color.bg.secondary, border: `1px solid ${selected === x.promotedThisYear ? wr.goldBorder : T.color.border.default}`, borderRadius: 6, cursor: 'pointer', textAlign: 'left' }}>
                <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary }}>Promote {x.promotedThisYear}</div>
                <div style={{ fontSize: 18, fontWeight: 700, fontFamily: T.font.mono, marginTop: 6 }}>{wr.money(x.newPPP)}</div>
                <div style={{ fontSize: 11, color: wr.crimson, fontWeight: 600, marginTop: 3 }}>{x.dilutionPct.toFixed(2)}% dilution</div>
              </button>
            ))}
          </div>
          {sc && (
            <div style={{ padding: 14, background: wr.goldBg, border: `1px solid ${wr.goldBorder}`, borderRadius: 6 }}>
              <div style={{ fontSize: 13, color: wr.ink, marginBottom: 6 }}>Promoting {sc.promotedThisYear} new equity partners requires capital call of <strong style={{ fontFamily: T.font.mono }}>{wr.money(sc.totalCapitalCall)}</strong> ({wr.money(sc.capitalCallPerNew)} per new partner). PPP compresses by <strong>{Math.abs(sc.dilutionPct).toFixed(2)}%</strong> in year one.</div>
            </div>
          )}
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR10. Client Lifetime Value
  // ═══════════════════════════════════════════════════════════════
  const WR10CLV = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const sorted = [...store.state.clients].sort((a, b) => b.clv - a.clv);
    const maxClv = sorted[0].clv;
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Clients Tracked" value={store.state.clients.length} tone="violet" />
          <KpiCard label="Total CLV" value={wr.money(store.state.clients.reduce((s, c) => s + c.clv, 0))} tone="gold" />
          <KpiCard label="Top-5 CLV" value={wr.money(sorted.slice(0, 5).reduce((s, c) => s + c.clv, 0))} tone="green" />
        </div>
        <Panel title="Client Lifetime Value — Ranked NPV" subtitle="NPV of full relationship: revenue × realization × retention − account overhead − concessions" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Rank</TH><TH>Client</TH><TH>Current Rev</TH><TH>Realization</TH><TH>Concessions</TH><TH>CLV</TH><TH>CLV vs Rev</TH></tr></thead>
            <tbody>
              {sorted.map((c, i) => (
                <tr key={c.id}>
                  <TD mono style={{ fontWeight: 700 }}>{i + 1}</TD>
                  <TD><strong>{c.name}</strong></TD>
                  <TD mono>{wr.money(c.revenue)}</TD>
                  <TD mono style={{ color: c.realization > 90 ? wr.green : c.realization > 82 ? wr.amber : wr.crimson }}>{c.realization}%</TD>
                  <TD mono style={{ color: c.concessionsPct > 20 ? wr.crimson : c.concessionsPct > 10 ? wr.amber : wr.green }}>{c.concessionsPct}%</TD>
                  <TD><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Bar value={c.clv} max={maxClv} color={wr.gold} width={110} /><span style={{ fontSize: 12, fontFamily: T.font.mono, fontWeight: 700 }}>{wr.money(c.clv)}</span></div></TD>
                  <TD mono>{(c.clv / c.revenue).toFixed(1)}×</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR11. White-Space / Cross-Sell Intelligence
  // ═══════════════════════════════════════════════════════════════
  const WR11WhiteSpace = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const pursue = (clientId, practice) => {
      const c = store.pursueWhiteSpace(clientId, practice, 'BD Team');
      if (c) { setFlash(`${c.name}: ${practice} pursuit opened`); setTimeout(() => setFlash(''), 2500); }
    };
    const subset = store.state.practices.slice(0, 12);
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Total White-Space" value={wr.money(store.totalWhiteSpace())} tone="gold" sub="Untapped revenue opportunity" />
          <KpiCard label="Clients Mapped" value={store.state.clients.length} tone="violet" />
          <KpiCard label="Practices Tracked" value={store.state.practices.length} tone="green" />
        </div>
        <Panel title="Client × Practice Matrix — Click empty cell to open pursuit" subtitle="Blue = active · Empty = cross-sell opportunity" accent={wr.violet}>
          <div style={{ overflowX: 'auto' }}>
            <table style={{ borderCollapse: 'collapse', fontSize: 11 }}>
              <thead>
                <tr>
                  <TH style={{ position: 'sticky', left: 0, background: T.color.bg.secondary }}>Client</TH>
                  {subset.map(p => <TH key={p} style={{ minWidth: 70 }}>{p}</TH>)}
                  <TH>White-Space $</TH>
                </tr>
              </thead>
              <tbody>
                {store.state.clients.map(c => {
                  const used = store.state.clientPracticeMatrix[c.id] || [];
                  return (
                    <tr key={c.id}>
                      <TD style={{ position: 'sticky', left: 0, background: 'white', fontWeight: 600 }}>{c.name}</TD>
                      {subset.map(p => {
                        const active = used.includes(p);
                        return (
                          <TD key={p} style={{ textAlign: 'center', padding: 4, cursor: active ? 'default' : 'pointer' }} onClick={() => !active && pursue(c.id, p)}>
                            {active ? <div style={{ width: 22, height: 22, background: wr.violet, borderRadius: 3, margin: '0 auto' }} /> : <div style={{ width: 22, height: 22, background: 'transparent', border: `1px dashed ${T.color.border.default}`, borderRadius: 3, margin: '0 auto', color: T.color.text.tertiary, fontSize: 12, lineHeight: '20px' }}>+</div>}
                          </TD>
                        );
                      })}
                      <TD mono style={{ color: wr.gold, fontWeight: 700 }}>{wr.money(c.whiteSpace)}</TD>
                    </tr>
                  );
                })}
              </tbody>
            </table>
          </div>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR12. Panel / Convergence Risk
  // ═══════════════════════════════════════════════════════════════
  const WR12Panel = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const submit = (id) => {
      const e = store.submitPanelResponse(id, 'innovation proposal', 'Client Ops');
      if (e) { setFlash(`${e.client}: response submitted`); setTimeout(() => setFlash(''), 2500); }
    };
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Active Panel Events" value={store.state.panelEvents.length} tone="violet" />
          <KpiCard label="Revenue At Risk" value={wr.money(store.convergenceAtRisk())} tone="crimson" />
          <KpiCard label="At-Risk Clients" value={store.state.panelEvents.filter(e => e.ourPosition === 'at-risk').length} tone="amber" />
        </div>
        <Panel title="Active Panel Reviews / Convergence Events" accent={wr.crimson}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Client</TH><TH>Type</TH><TH>Status</TH><TH>Deadline</TH><TH>Est Impact</TH><TH>Our Position</TH><TH>Next Action</TH><TH></TH></tr></thead>
            <tbody>
              {store.state.panelEvents.map(e => (
                <tr key={e.id}>
                  <TD><strong>{e.client}</strong></TD>
                  <TD>{e.type}</TD>
                  <TD><Pill tone={e.status === 'rfp-issued' || e.status === 'in-progress' ? 'amber' : 'violet'}>{e.status}</Pill></TD>
                  <TD mono>{e.deadline}</TD>
                  <TD mono style={{ color: wr.crimson, fontWeight: 700 }}>{wr.money(e.estImpact)}</TD>
                  <TD><Pill tone={e.ourPosition === 'incumbent' ? 'green' : e.ourPosition === 'at-risk' ? 'crimson' : 'amber'}>{e.ourPosition}</Pill></TD>
                  <TD style={{ fontSize: 12 }}>{e.nextAction}</TD>
                  <TD>{!e.responseSubmitted ? <BtnGhost onClick={() => submit(e.id)}>Submit Response</BtnGhost> : <Pill tone="green">Submitted</Pill>}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR13. GC Turnover Watcher
  // ═══════════════════════════════════════════════════════════════
  const WR13GC = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const run = (client) => {
      const g = store.runGcPlaybook(client, 'Client Ops');
      if (g) { setFlash(`Playbook active: ${client}`); setTimeout(() => setFlash(''), 2500); }
    };
    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="GC Changes Detected" value={store.gcsChanged()} tone="amber" />
          <KpiCard label="Book At-Risk" value={wr.money(store.gcBookAtRisk())} tone="crimson" />
          <KpiCard label="Playbooks Active" value={store.state.gcSignals.filter(g => g.playbookStatus !== 'new').length} tone="violet" />
        </div>
        <Panel title="General Counsel Transitions — Top-100 Clients" subtitle="Auto-detected from LinkedIn · SEC filings · press" accent={wr.amber}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Client</TH><TH>Prior GC</TH><TH>New GC</TH><TH>Source</TH><TH>Detected</TH><TH>New GC Prior Firm</TH><TH>Rel Score</TH><TH>Book At Risk</TH><TH>Playbook</TH></tr></thead>
            <tbody>
              {store.state.gcSignals.map((g, i) => (
                <tr key={i}>
                  <TD><strong>{g.client}</strong></TD>
                  <TD>{g.priorGc}</TD>
                  <TD>{g.newGc}</TD>
                  <TD>{g.source}</TD>
                  <TD mono>{g.detectedOn}</TD>
                  <TD style={{ color: wr.crimson, fontWeight: 600 }}>{g.newGcPriorFirm}</TD>
                  <TD mono style={{ color: g.relationshipScore < 3 ? wr.crimson : g.relationshipScore < 5 ? wr.amber : wr.green, fontWeight: 700 }}>{g.relationshipScore.toFixed(1)}/10</TD>
                  <TD mono style={{ fontWeight: 700 }}>{wr.money(g.bookAtRisk)}</TD>
                  <TD>{g.playbookStatus === 'new' ? <BtnGhost onClick={() => run(g.client)}>Run Playbook</BtnGhost> : <Pill tone={g.playbookStatus === 'triggered' ? 'gold' : 'green'}>{g.playbookStatus}</Pill>}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR14. Client Concentration / HHI
  // ═══════════════════════════════════════════════════════════════
  const WR14Concentration = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const c = store.state.concentration;
    const hhiRisk = c.hhi >= c.hhiThreshold;
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="HHI (Client)" value={c.hhi.toFixed(3)} tone={hhiRisk ? 'crimson' : 'green'} sub={`Threshold ${c.hhiThreshold.toFixed(3)}`} />
          <KpiCard label="Top-5 Clients" value={`${c.top5ClientsPct}%`} tone="violet" />
          <KpiCard label="Top-10 Clients" value={`${c.top10ClientsPct}%`} tone="gold" />
          <KpiCard label="Top-20 Clients" value={`${c.top20ClientsPct}%`} tone="amber" />
        </div>

        <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 20 }}>
          <Panel title="Industry Mix" accent={wr.violet}>
            {c.industryMix.map(m => (
              <div key={m.industry} style={{ marginBottom: 10 }}>
                <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12, marginBottom: 3 }}><span>{m.industry}</span><span style={{ fontFamily: T.font.mono, fontWeight: 700 }}>{m.pct.toFixed(1)}%</span></div>
                <Bar value={m.pct} max={c.industryMix[0].pct} color={wr.violet} width={'100%'} height={8} />
              </div>
            ))}
          </Panel>
          <Panel title="Practice Mix" accent={wr.gold}>
            {c.practiceMix.map(m => (
              <div key={m.practice} style={{ marginBottom: 10 }}>
                <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12, marginBottom: 3 }}><span>{m.practice}</span><span style={{ fontFamily: T.font.mono, fontWeight: 700 }}>{m.pct.toFixed(1)}%</span></div>
                <Bar value={m.pct} max={c.practiceMix[0].pct} color={wr.gold} width={'100%'} height={8} />
              </div>
            ))}
          </Panel>
        </div>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR15. Peer Rate Card Intelligence
  // ═══════════════════════════════════════════════════════════════
  const WR15PeerRates = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const totalGap = store.state.peerRates.reduce((s, r) => s + (r.variance * (r.practice === 'Associate' ? 1 : 1)), 0);
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Rate Benchmarks" value={store.state.peerRates.length} tone="violet" />
          <KpiCard label="Avg Gap to Peer Avg" value={`$${(totalGap / store.state.peerRates.length).toFixed(0)}`} tone="crimson" />
          <KpiCard label="Below Peer Avg" value={store.state.peerRates.filter(r => r.variance < 0).length} tone="amber" />
        </div>
        <Panel title="Peer Rate Card Intelligence" subtitle="Sourced from bankruptcy fee applications · Real Rate Report · TyMetrix" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Practice</TH><TH>Level</TH><TH>Our Rate</TH><TH>Cravath</TH><TH>Latham</TH><TH>Kirkland</TH><TH>Skadden</TH><TH>Peer Avg</TH><TH>Variance</TH><TH>Source</TH></tr></thead>
            <tbody>
              {store.state.peerRates.map((r, i) => (
                <tr key={i}>
                  <TD><strong>{r.practice}</strong></TD>
                  <TD>{r.level}</TD>
                  <TD mono style={{ fontWeight: 700 }}>${r.ourRate}</TD>
                  <TD mono>{r.cravath ? `$${r.cravath}` : '—'}</TD>
                  <TD mono>{r.latham ? `$${r.latham}` : '—'}</TD>
                  <TD mono>{r.kirkland ? `$${r.kirkland}` : '—'}</TD>
                  <TD mono>{r.skadden ? `$${r.skadden}` : '—'}</TD>
                  <TD mono style={{ fontWeight: 700 }}>${r.peerAvg}</TD>
                  <TD mono style={{ color: r.variance < 0 ? wr.crimson : wr.green, fontWeight: 700 }}>{r.variance > 0 ? '+' : ''}${r.variance}</TD>
                  <TD style={{ fontSize: 11, color: T.color.text.tertiary }}>{r.source}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR16. Lateral Market Intelligence
  // ═══════════════════════════════════════════════════════════════
  const WR16Market = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const flows = store.state.lateralMarketSummary.netFirmFlows;
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Moves Tracked (90d)" value={store.state.lateralMoves.length} tone="violet" />
          <KpiCard label="Total Book In Motion" value={wr.money(store.state.lateralMoves.reduce((s, m) => s + m.reportedBook, 0))} tone="gold" />
          <KpiCard label="Our Net Flow" value={`+${flows.find(f => f.firm === 'Our Firm').netIn - flows.find(f => f.firm === 'Our Firm').netOut}`} tone="green" />
        </div>

        <Panel title="AmLaw 200 Net Lateral Flow — Last 12 Mo" accent={wr.violet}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Firm</TH><TH>Net In</TH><TH>Net Out</TH><TH>Net P&L</TH><TH>Visual</TH></tr></thead>
            <tbody>
              {flows.sort((a, b) => (b.netIn - b.netOut) - (a.netIn - a.netOut)).map(f => {
                const net = f.netIn - f.netOut;
                return (
                  <tr key={f.firm} style={{ background: f.firm === 'Our Firm' ? wr.goldBg : 'transparent' }}>
                    <TD><strong>{f.firm}</strong></TD>
                    <TD mono style={{ color: wr.green, fontWeight: 700 }}>+{f.netIn}</TD>
                    <TD mono style={{ color: wr.crimson, fontWeight: 700 }}>−{f.netOut}</TD>
                    <TD mono style={{ color: net > 0 ? wr.green : wr.crimson, fontWeight: 700 }}>{net > 0 ? '+' : ''}{net}</TD>
                    <TD><Bar value={Math.abs(net)} max={15} color={net > 0 ? wr.green : wr.crimson} width={140} /></TD>
                  </tr>
                );
              })}
            </tbody>
          </table>
        </Panel>

        <Panel title="Recent Partner-Level Laterals" subtitle="Chambers · legal press · LinkedIn" accent={wr.gold}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Date</TH><TH>Partner</TH><TH>Practice</TH><TH>From</TH><TH>→ To</TH><TH>Book</TH><TH>Reported Comp</TH><TH>Note</TH></tr></thead>
            <tbody>
              {store.state.lateralMoves.map((m, i) => (
                <tr key={i}>
                  <TD mono>{m.date}</TD>
                  <TD><strong>{m.partner}</strong></TD>
                  <TD>{m.practice}</TD>
                  <TD>{m.from}</TD>
                  <TD style={{ color: wr.violetDeep, fontWeight: 600 }}>{m.to}</TD>
                  <TD mono>{wr.money(m.reportedBook)}</TD>
                  <TD mono>{m.reportedComp ? wr.money(m.reportedComp) : '—'}</TD>
                  <TD style={{ fontSize: 12 }}>{m.note}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR17. AI / GenAI Productivity ROI
  // ═══════════════════════════════════════════════════════════════
  const WR17AI = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const r = store.state.aiRoiSummary;
    return (
      <div>
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="Total Subscription" value={wr.money(r.totalSubscription)} tone="violet" />
          <KpiCard label="Hours Deflected" value={r.totalHoursDeflected.toLocaleString()} tone="gold" />
          <KpiCard label="Net Margin ROI" value={wr.money(r.totalNetRoi - r.totalSubscription)} tone="green" sub={`${((r.totalNetRoi - r.totalSubscription) / r.totalSubscription * 100).toFixed(0)}% return`} />
          <KpiCard label="Cannibalized Hours" value={r.cannibalizedHours.toLocaleString()} tone="amber" />
        </div>

        <Panel title="AI Tool ROI Matrix" subtitle="Hours deflected · realization impact · adoption — per tool" accent={wr.violet}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Tool</TH><TH>Category</TH><TH>Subscription</TH><TH>Licensed</TH><TH>Active</TH><TH>Adoption</TH><TH>Hours Deflected</TH><TH>Realization Δ</TH><TH>Net ROI</TH></tr></thead>
            <tbody>
              {store.state.aiTools.map(t => (
                <tr key={t.id}>
                  <TD><strong>{t.tool}</strong></TD>
                  <TD>{t.category}</TD>
                  <TD mono>{wr.money(t.subscription)}</TD>
                  <TD mono>{t.licensedUsers}</TD>
                  <TD mono>{t.activeUsers}</TD>
                  <TD><div style={{ display: 'flex', alignItems: 'center', gap: 6 }}><Bar value={t.adoption * 100} max={100} color={t.adoption > 0.75 ? wr.green : wr.amber} width={80} /><span style={{ fontSize: 11, fontFamily: T.font.mono, fontWeight: 700 }}>{(t.adoption * 100).toFixed(0)}%</span></div></TD>
                  <TD mono>{t.hoursDeflected.toLocaleString()}</TD>
                  <TD mono style={{ color: wr.green, fontWeight: 700 }}>+{t.realizationDelta}%</TD>
                  <TD mono style={{ color: wr.gold, fontWeight: 700 }}>{wr.money(t.netRoi - t.subscription)}</TD>
                </tr>
              ))}
            </tbody>
          </table>
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // WR18. Conflicts Revenue-at-Risk
  // ═══════════════════════════════════════════════════════════════
  const WR18Conflicts = () => {
    useCross();
    const store = window.ExecStrategyStore;
    const [flash, setFlash] = React.useState('');
    const [reasonFor, setReasonFor] = React.useState(null);
    const [reason, setReason] = React.useState('');
    const submit = (id) => {
      store.requestConflictOverride(id, reason || 'Value exceeds adverse risk', 'Mgmt Cmte');
      setFlash('Override request submitted');
      setReasonFor(null); setReason('');
      setTimeout(() => setFlash(''), 2500);
    };

    const byCause = {};
    store.state.conflictsDeclined.forEach(c => {
      byCause[c.declinedFor] = (byCause[c.declinedFor] || 0) + c.estLifetimeValue;
    });
    const causes = Object.entries(byCause).sort((a, b) => b[1] - a[1]);

    return (
      <div>
        <Flash msg={flash} onClose={() => setFlash('')} />
        <div style={{ display: 'flex', gap: 10, marginBottom: 18, flexWrap: 'wrap' }}>
          <KpiCard label="RAR YTD 2026" value={wr.money(store.conflictsRarYtd())} tone="crimson" />
          <KpiCard label="Declined Engagements" value={store.state.conflictsDeclined.filter(c => c.year === 2026).length} tone="amber" />
          <KpiCard label="Top Cause" value={causes[0][0].split(' ')[0]} tone="gold" sub={wr.money(causes[0][1])} />
        </div>

        <Panel title="Revenue-at-Risk by Cause" subtitle="Conflict roots as P&L line items — not just compliance" accent={wr.crimson}>
          {causes.map(([cause, total]) => (
            <div key={cause} style={{ marginBottom: 10 }}>
              <div style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12, marginBottom: 3 }}><span style={{ fontWeight: 600 }}>{cause}</span><span style={{ fontFamily: T.font.mono, fontWeight: 700, color: wr.crimson }}>{wr.money(total)}</span></div>
              <Bar value={total} max={causes[0][1]} color={wr.crimson} width={'100%'} height={10} />
            </div>
          ))}
        </Panel>

        <Panel title="Declined Engagements" accent={wr.crimson}>
          <table style={{ width: '100%', borderCollapse: 'collapse' }}>
            <thead><tr><TH>Date</TH><TH>Matter</TH><TH>Declined For</TH><TH>Practice</TH><TH>Partner</TH><TH>1-Yr Rev</TH><TH>Lifetime Value</TH><TH></TH></tr></thead>
            <tbody>
              {store.state.conflictsDeclined.sort((a, b) => b.estLifetimeValue - a.estLifetimeValue).map(c => (
                <tr key={c.id}>
                  <TD mono>{c.date}</TD>
                  <TD><strong>{c.matter}</strong></TD>
                  <TD style={{ color: wr.crimson }}>{c.declinedFor}</TD>
                  <TD>{c.practice}</TD>
                  <TD>{c.partnerLost}</TD>
                  <TD mono>{wr.money(c.expectedRev1yr)}</TD>
                  <TD mono style={{ color: wr.crimson, fontWeight: 700 }}>{wr.money(c.estLifetimeValue)}</TD>
                  <TD>{!c.overrideRequest ? <BtnGhost onClick={() => setReasonFor(c.id)}>Request Override</BtnGhost> : <Pill tone="violet">{c.overrideRequest.status}</Pill>}</TD>
                </tr>
              ))}
            </tbody>
          </table>
          {reasonFor && (
            <div style={{ marginTop: 14, padding: 14, background: wr.violetBg, border: `1px solid ${wr.violetBorder}`, borderRadius: 6 }}>
              <div style={{ fontSize: 11, fontWeight: 700, letterSpacing: '0.06em', textTransform: 'uppercase', color: T.color.text.tertiary, marginBottom: 6 }}>Override Rationale</div>
              <textarea value={reason} onChange={e => setReason(e.target.value)} rows={2} style={{ width: '100%', padding: 8, fontSize: 12, border: `1px solid ${T.color.border.default}`, borderRadius: 4, marginBottom: 8 }} />
              <div style={{ display: 'flex', gap: 8 }}>
                <BtnPrimary onClick={() => submit(reasonFor)}>Submit</BtnPrimary>
                <BtnGhost onClick={() => { setReasonFor(null); setReason(''); }}>Cancel</BtnGhost>
              </div>
            </div>
          )}
        </Panel>
      </div>
    );
  };

  // ═══════════════════════════════════════════════════════════════
  // HUBS — 5 hubs grouping the 18 opportunities
  // ═══════════════════════════════════════════════════════════════
  const HubShell = ({ title, subtitle, tabs, active, onChange, children }) => (
    <div>
      <div style={{ padding: '18px 20px', background: wr.execGradient, borderRadius: 8, marginBottom: 18, color: 'white' }}>
        <div style={{ fontSize: 10, fontWeight: 700, letterSpacing: '0.14em', textTransform: 'uppercase', opacity: 0.8 }}>Executive Strategy</div>
        <div style={{ fontSize: 22, fontWeight: 700, marginTop: 4 }}>{title}</div>
        <div style={{ fontSize: 13, opacity: 0.9, marginTop: 4 }}>{subtitle}</div>
      </div>
      <SubTabs tabs={tabs} active={active} onChange={onChange} />
      {children}
    </div>
  );

  const DealRoomHub = () => {
    const [active, setActive] = React.useState('lateral');
    const tabs = [
      { id: 'lateral', label: 'Lateral Acquisition' },
      { id: 'ma',      label: 'M&A / Group Acquisition' },
      { id: 'plan',    label: 'Strategic Plan' },
      { id: 'stress',  label: 'Scenario / Stress Test' },
    ];
    return (
      <HubShell title="Deal Room" subtitle="Lateral acquisition modeling · M&A scenarios · strategic plan tracking · stress testing" tabs={tabs} active={active} onChange={setActive}>
        {active === 'lateral' && <WR1Lateral />}
        {active === 'ma'      && <WR2MA />}
        {active === 'plan'    && <WR3Plan />}
        {active === 'stress'  && <WR4Stress />}
      </HubShell>
    );
  };

  const PartnerCapitalHub = () => {
    const [active, setActive] = React.useState('comp');
    const tabs = [
      { id: 'comp',      label: 'Comp Committee' },
      { id: 'succession',label: 'Succession' },
      { id: 'decile',    label: 'Performance Decile' },
      { id: 'attrition', label: 'Associate Attrition' },
      { id: 'pipeline',  label: 'Promotion Pipeline' },
    ];
    return (
      <HubShell title="Partner Capital" subtitle="Compensation · succession · performance · talent retention · equity dilution" tabs={tabs} active={active} onChange={setActive}>
        {active === 'comp'       && <WR5Comp />}
        {active === 'succession' && <WR6Succession />}
        {active === 'decile'     && <WR7Decile />}
        {active === 'attrition'  && <WR8Attrition />}
        {active === 'pipeline'   && <WR9Pipeline />}
      </HubShell>
    );
  };

  const ClientIntelHub = () => {
    const [active, setActive] = React.useState('clv');
    const tabs = [
      { id: 'clv',           label: 'Lifetime Value' },
      { id: 'whitespace',    label: 'White-Space' },
      { id: 'panel',         label: 'Panel / Convergence' },
      { id: 'gc',            label: 'GC Turnover' },
      { id: 'concentration', label: 'Concentration / HHI' },
    ];
    return (
      <HubShell title="Client Intelligence" subtitle="Lifetime value · cross-sell · panel risk · GC watch · concentration" tabs={tabs} active={active} onChange={setActive}>
        {active === 'clv'           && <WR10CLV />}
        {active === 'whitespace'    && <WR11WhiteSpace />}
        {active === 'panel'         && <WR12Panel />}
        {active === 'gc'            && <WR13GC />}
        {active === 'concentration' && <WR14Concentration />}
      </HubShell>
    );
  };

  const MarketIntelHub = () => {
    const [active, setActive] = React.useState('peer');
    const tabs = [
      { id: 'peer',    label: 'Peer Rate Card' },
      { id: 'lateral', label: 'Lateral Market' },
      { id: 'ai',      label: 'AI/GenAI ROI' },
    ];
    return (
      <HubShell title="Market Intelligence" subtitle="Peer benchmarking · lateral market flows · AI productivity ROI" tabs={tabs} active={active} onChange={setActive}>
        {active === 'peer'    && <WR15PeerRates />}
        {active === 'lateral' && <WR16Market />}
        {active === 'ai'      && <WR17AI />}
      </HubShell>
    );
  };

  const FranchiseRiskHub = () => {
    const [active, setActive] = React.useState('conflicts');
    const tabs = [
      { id: 'conflicts', label: 'Conflicts Revenue-at-Risk' },
    ];
    return (
      <HubShell title="Franchise Risk" subtitle="Revenue protected by not taking — the hidden P&L of representations we decline" tabs={tabs} active={active} onChange={setActive}>
        {active === 'conflicts' && <WR18Conflicts />}
      </HubShell>
    );
  };

  // ── Expose all to window ──
  Object.assign(window, {
    WR1Lateral, WR2MA, WR3Plan, WR4Stress,
    WR5Comp, WR6Succession, WR7Decile, WR8Attrition, WR9Pipeline,
    WR10CLV, WR11WhiteSpace, WR12Panel, WR13GC, WR14Concentration,
    WR15PeerRates, WR16Market, WR17AI,
    WR18Conflicts,
    DealRoomHub, PartnerCapitalHub, ClientIntelHub, MarketIntelHub, FranchiseRiskHub,
  });
})();
