// Template detail page — CONTROL ROOM (dark operator console)

const CR_DET = {
  bg:     '#0a0c0d',
  bg2:    '#11141a',
  bg3:    '#181c24',
  line:   '#232830',
  line2:  '#2e353f',
  fg:     '#d7dde6',
  fgDim:  '#8b95a3',
  fgFaint:'#3a424e',
  phos:   'oklch(0.82 0.20 145)',
  amber:  'oklch(0.82 0.17 75)',
  tomato: 'oklch(0.68 0.20 30)',
  cyan:   'oklch(0.80 0.13 200)',
  mono:   'IBM Plex Mono, ui-monospace, monospace',
  sans:   'IBM Plex Sans, system-ui, sans-serif',
};
const C = CR_DET;
const led = (color, glow = true) => ({ width: 7, height: 7, borderRadius: '50%', background: color, display: 'inline-block', boxShadow: glow ? `0 0 6px ${color}` : 'none' });

// ── component previews ─────────────────────────────────────
function CRC01_Shell() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono }}>
      <div style={{ display: 'flex', alignItems: 'center', gap: 14, padding: '6px 12px', height: 24, background: C.bg2, borderBottom: '1px solid ' + C.line, fontSize: 9.5, overflow: 'hidden' }}>
        <span style={{ color: C.phos, letterSpacing: '0.1em' }}>● LIVE</span>
        <span style={{ color: C.fgDim }}>18:37 packet generated · 18:21 waiver expired · 18:14 released</span>
      </div>
      <div style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 14px', borderBottom: '1px solid ' + C.line }}>
        <div>
          <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.12em' }}>// DRAWREQUEST · LENDER CONSOLE</div>
          <div style={{ fontFamily: C.sans, fontSize: 18, fontWeight: 600, marginTop: 2, letterSpacing: '-0.01em', textTransform: 'uppercase' }}>CORNERSTONE CAPITAL</div>
        </div>
        <div style={{ display: 'flex', gap: 4, alignItems: 'center', fontSize: 9 }}>
          <span style={{ padding: '2px 6px', border: '1px solid ' + C.line2, color: C.phos }}><span style={led(C.phos)} /> ONLINE</span>
          <span style={{ padding: '2px 6px', border: '1px solid ' + C.line2 }}>⇧A</span>
        </div>
      </div>
      <div style={{ display: 'flex', borderBottom: '1px solid ' + C.line, height: 32 }}>
        {['ADMIN','LOAN','GC','SUB','INSP','OWNER','FIN','AUD'].map((r, i) => (
          <div key={r} style={{ flex: 1, padding: '5px 6px', borderRight: i === 7 ? 0 : '1px solid ' + C.line, background: i === 0 ? `color-mix(in oklab, ${C.phos} 10%, ${C.bg2})` : 'transparent', borderTop: i === 0 ? `2px solid ${C.phos}` : '2px solid transparent', display: 'flex', flexDirection: 'column' }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
              <span style={led(i === 0 ? C.phos : (i % 3 === 1 ? C.amber : C.fgFaint), i < 3)} />
              <span style={{ fontSize: 9, fontWeight: 600, color: i === 0 ? C.phos : C.fg }}>{r}</span>
            </div>
            <span style={{ fontSize: 9, color: C.phos, marginTop: 1 }}>0{[5,3,2,1,4,2,1,0][i]}</span>
          </div>
        ))}
      </div>
      <div style={{ position: 'absolute', bottom: 6, left: 12, fontSize: 8, color: C.fgFaint, letterSpacing: '0.06em' }}>// TICKER · TITLE · ACTOR STRIP · STATUS PILLS</div>
    </div>
  );
}
function CRC02_Signin() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <div style={{ width: 230, padding: 14, border: '1px solid ' + C.line2, background: C.bg2 }}>
        <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.12em' }}>// SECURE ACCESS · TLS 1.3</div>
        <div style={{ fontFamily: C.sans, fontSize: 15, fontWeight: 600, marginTop: 6, letterSpacing: '-0.005em' }}>DRAWREQUEST.OS</div>
        <div style={{ fontSize: 9.5, color: C.fgDim, marginTop: 6 }}>$ identify --magic-link</div>
        <div style={{ marginTop: 8, padding: '6px 8px', border: '1px solid ' + C.line2, background: C.bg3, fontSize: 10, color: C.phos }}>marcus@cornerstone.cap<span style={{ borderRight: '1.5px solid ' + C.phos, marginLeft: 1 }} /></div>
        <div style={{ marginTop: 8, padding: '7px 8px', background: C.phos, color: C.bg, textAlign: 'center', fontSize: 10, fontWeight: 700, letterSpacing: '0.12em' }}>REQUEST KEY →</div>
      </div>
    </div>
  );
}
function CRC03_Actors() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10 }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.12em' }}>// OPERATORS · 8 · ACTIVE: ADMIN</div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 4, marginTop: 6 }}>
        {TPL_SAMPLE.actors.map((a, i) => {
          const isActive = i === 0;
          const q = [5,3,2,1,4,2,1,0][i];
          return (
            <div key={i} style={{
              padding: '6px 5px', border: '1px solid ' + (isActive ? C.phos : C.line2),
              background: isActive ? `color-mix(in oklab, ${C.phos} 12%, ${C.bg2})` : C.bg2,
              boxShadow: isActive ? `0 0 12px color-mix(in oklab, ${C.phos} 30%, transparent), inset 0 0 8px color-mix(in oklab, ${C.phos} 20%, transparent)` : 'none',
            }}>
              <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                <span style={led(isActive ? C.phos : (q > 2 ? C.amber : (q > 0 ? C.phos : C.fgFaint)), isActive)} />
                <span style={{ fontSize: 9.5, color: isActive ? C.phos : C.fg, fontWeight: 700 }}>{a[0]}</span>
              </div>
              <div style={{ fontSize: 8, color: C.fgDim, marginTop: 2 }}>{a[2].toUpperCase().slice(0,7)}</div>
              <div style={{ fontSize: 11, color: q > 0 ? C.phos : C.fgFaint, marginTop: 1 }}>{String(q).padStart(2, '0')}</div>
            </div>
          );
        })}
      </div>
    </div>
  );
}
function CRC04_Home() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 12, backgroundImage: 'linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px)', backgroundSize: '14px 14px' }}>
      <div style={{ fontSize: 9, color: C.fgDim, letterSpacing: '0.1em' }}>// PORTFOLIO · EXPOSURE</div>
      <div style={{ fontSize: 44, color: C.phos, textShadow: `0 0 14px ${C.phos}`, letterSpacing: '-0.04em', marginTop: 2, fontWeight: 600 }}>$62.6M</div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 8, marginTop: 12 }}>
        {[['RELEASED','$127.8K'],['HELD','$255.6K'],['FLAGS','01']].map(([l,v], i) => (
          <div key={i}>
            <div style={{ fontSize: 8, color: C.fgDim, letterSpacing: '0.1em' }}>{l}</div>
            <div style={{ fontSize: 18, color: i === 2 ? C.amber : C.fg, fontWeight: 500, marginTop: 2 }}>{v}</div>
          </div>
        ))}
      </div>
    </div>
  );
}
function CRC05_List() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono }}>
      <div style={{ padding: '8px 12px', borderBottom: '1px solid ' + C.line, fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// DRAWS · 08 IN FLIGHT</div>
      <table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 10.5 }}>
        <thead><tr style={{ borderBottom: '1px solid ' + C.line }}>{['DRAW','PROJECT','AMT','ST'].map(h => (<th key={h} style={{ padding: '4px 10px', textAlign: 'left', fontSize: 8.5, fontWeight: 600, color: C.fgDim, letterSpacing: '0.08em' }}>{h}</th>))}</tr></thead>
        <tbody>
          {TPL_SAMPLE.draws.map((d, i) => (
            <tr key={d[0]} style={{ borderBottom: '1px solid ' + C.line }}>
              <td style={{ padding: '5px 10px', color: C.phos }}>{d[0]}</td>
              <td style={{ padding: '5px 10px' }}>{d[1]}</td>
              <td style={{ padding: '5px 10px', textAlign: 'right' }}>{d[2]}</td>
              <td style={{ padding: '5px 10px' }}>
                <span style={{ padding: '1px 5px', border: '1px solid ' + (d[3] === 'correction' ? C.tomato : C.line2), color: d[3] === 'correction' ? C.tomato : C.fgDim, fontSize: 8.5, letterSpacing: '0.04em', textTransform: 'uppercase' }}>{d[3].slice(0,5)}</span>
              </td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  );
}
function CRC06_Detail() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 12 }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// OBJECT · DRAW-2031</div>
      <div style={{ fontFamily: C.sans, fontSize: 16, fontWeight: 600, marginTop: 2 }}>RIVERLINE PLAZA</div>
      <div style={{ fontSize: 28, color: C.phos, textShadow: `0 0 10px ${C.phos}`, marginTop: 6, letterSpacing: '-0.02em' }}>$142,000</div>
      <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 6, marginTop: 8, borderTop: '1px solid ' + C.line, paddingTop: 6 }}>
        {[['CONTRACT','$2,377K'],['EARNED','$1,585K'],['NET','$127,800'],['WAIVERS','5/5']].map(([l,v], i) => (
          <div key={i}>
            <div style={{ fontSize: 8, color: C.fgDim, letterSpacing: '0.08em' }}>{l}</div>
            <div style={{ fontSize: 12, marginTop: 1, color: i === 2 ? C.phos : C.fg }}>{v}</div>
          </div>
        ))}
      </div>
    </div>
  );
}
function CRC07_Form() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 12 }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// SUBMIT · STAGE 03/05 · SCHEDULE OF VALUES</div>
      <div style={{ marginTop: 8, display: 'flex', gap: 4 }}>
        {['PROJ','GC','SOV','WVR','SUB'].map((s, i) => (
          <span key={s} style={{ flex: 1, padding: '3px 4px', textAlign: 'center', fontSize: 8.5, border: '1px solid ' + (i < 3 ? C.phos : C.line2), color: i < 3 ? C.phos : C.fgDim, background: i === 2 ? `color-mix(in oklab, ${C.phos} 10%, transparent)` : 'transparent', letterSpacing: '0.06em' }}>{i < 3 ? '✓ ' : `0${i+1} `}{s}</span>
        ))}
      </div>
      <div style={{ marginTop: 10, padding: 6, background: C.bg2, border: '1px solid ' + C.line2 }}>
        {[['03','CONCRETE','410,000'],['04','MASONRY','165,000'],['05','STEEL','540,000']].map((r, i) => (
          <div key={i} style={{ display: 'grid', gridTemplateColumns: '24px 1fr 80px', gap: 4, padding: '3px 0', borderBottom: i === 2 ? 'none' : '1px dotted ' + C.line, fontSize: 10 }}>
            <span style={{ color: C.fgDim }}>{r[0]}</span><span>{r[1]}</span><span style={{ textAlign: 'right', color: C.phos }}>{r[2]}</span>
          </div>
        ))}
      </div>
      <div style={{ position: 'absolute', bottom: 8, right: 12, padding: '4px 10px', background: C.phos, color: C.bg, fontSize: 9.5, fontWeight: 700, letterSpacing: '0.1em' }}>NEXT →</div>
    </div>
  );
}
function CRC08_Workflow() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 12 }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// HANDOFF CHAIN · DRAW-2031</div>
      <div style={{ marginTop: 12, display: 'flex', alignItems: 'center', gap: 2 }}>
        {['GC','INSP','LOAN','OWN','FIN'].map((s, i) => (
          <React.Fragment key={i}>
            <span style={{
              padding: '4px 8px',
              border: '1px solid ' + (i < 2 ? C.phos : C.line2),
              background: i < 2 ? `color-mix(in oklab, ${C.phos} 15%, ${C.bg2})` : C.bg2,
              color: i < 2 ? C.phos : C.fgDim,
              fontSize: 10, fontWeight: 700,
              boxShadow: i === 1 ? `0 0 8px color-mix(in oklab, ${C.phos} 50%, transparent)` : 'none',
            }}>{s}</span>
            {i < 4 && <span style={{ color: i < 1 ? C.phos : C.fgFaint, fontSize: 11 }}>→</span>}
          </React.Fragment>
        ))}
      </div>
      <div style={{ marginTop: 14, padding: 8, border: '1px solid ' + C.line2, background: C.bg2 }}>
        <div style={{ fontSize: 9, color: C.fgDim }}>STATE: <span style={{ color: C.phos }}>INSPECTING</span> · NEXT: LOAN</div>
        <div style={{ fontSize: 9, color: C.fgDim, marginTop: 4 }}>SLA: <span style={{ color: C.amber }}>04:22:18</span> · STEP 03 / 05</div>
      </div>
    </div>
  );
}
function CRC09_Audit() {
  const log = [
    ['2026-05-15 18:37','packet_generated  ','m.sterling'],
    ['2026-05-14 18:21','waiver_expired    ','northwind  ← 65d'],
    ['2026-05-14 18:14','draw_released     ','p.alvarez'],
    ['2026-05-14 18:14','payment_released  ','$127,800 net'],
    ['2026-05-13 18:37','approval_granted  ','s.kim (owner)'],
    ['2026-05-13 11:08','approval_granted  ','a.patel (loan)'],
    ['2026-05-12 16:32','inspection_done   ','h.mendez'],
  ];
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10, overflow: 'hidden' }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// tail -f audit.log</div>
      <div style={{ marginTop: 6, fontSize: 9.5, lineHeight: 1.55 }}>
        {log.map((l, i) => (
          <div key={i} style={{ color: i === 1 ? C.amber : C.fgDim }}>
            <span style={{ color: C.fgFaint }}>{l[0]}</span>{' '}
            <span style={{ color: i === 1 ? C.amber : C.fg }}>{l[1]}</span>{' '}
            <span style={{ color: C.fgDim }}>{l[2]}</span>
          </div>
        ))}
      </div>
    </div>
  );
}
function CRC10_Output() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10, backgroundImage: 'repeating-linear-gradient(180deg, transparent 0 2px, rgba(255,255,255,0.012) 2px 3px)' }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// G702 PACKET · GENERATED · 142ms</div>
      <div style={{ marginTop: 6, padding: 8, background: C.bg2, border: '1px solid ' + C.line2 }}>
        <div style={{ fontSize: 8, color: C.fgDim }}>G702 · APP 07 · RIVERLINE</div>
        <div style={{ fontFamily: C.sans, fontSize: 13, fontWeight: 600, marginTop: 2 }}>$142,000</div>
        <div style={{ marginTop: 8, display: 'flex', flexDirection: 'column', gap: 2 }}>
          {[100, 92, 78, 85, 64, 55].map((p, i) => (
            <div key={i} style={{ display: 'flex', alignItems: 'center', gap: 4, fontSize: 9 }}>
              <span style={{ color: C.fgFaint, width: 16 }}>0{i+1}</span>
              <div style={{ flex: 1, height: 4, background: C.bg3, position: 'relative' }}>
                <div style={{ position: 'absolute', inset: 0, width: p + '%', background: p === 100 ? C.fgFaint : C.phos, boxShadow: p === 100 ? 'none' : `0 0 4px ${C.phos}` }} />
              </div>
              <span style={{ color: p === 100 ? C.fgFaint : C.phos, width: 30, textAlign: 'right' }}>{p}%</span>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}
function CRC11_Settings() {
  const roles = ['ADMIN','LOAN','GC','SUB','INSP','OWNER'];
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10 }}>
      <div style={{ fontSize: 9, color: C.phos, letterSpacing: '0.1em' }}>// PERMISSIONS · APPROVAL MATRIX</div>
      <div style={{ marginTop: 6, background: C.bg2, border: '1px solid ' + C.line2 }}>
        <div style={{ display: 'grid', gridTemplateColumns: '80px repeat(4, 1fr)', borderBottom: '1px solid ' + C.line, fontSize: 8, padding: '4px 6px', color: C.fgDim, letterSpacing: '0.08em' }}>
          <span>ROLE</span><span style={{ textAlign: 'center' }}>READ</span><span style={{ textAlign: 'center' }}>SUBMIT</span><span style={{ textAlign: 'center' }}>APPROVE</span><span style={{ textAlign: 'center' }}>RELEASE</span>
        </div>
        {roles.map((r, i) => (
          <div key={r} style={{ display: 'grid', gridTemplateColumns: '80px repeat(4, 1fr)', padding: '3px 6px', borderBottom: i === 5 ? 'none' : '1px solid ' + C.line, fontSize: 9, alignItems: 'center' }}>
            <span>{r}</span>
            {[0,1,2,3].map(j => {
              const g = (i === 0) || (j === 0) || (i < 3 && j < 3) || (i === 5 && j === 3);
              return <span key={j} style={led(g ? C.phos : C.fgFaint, g)} title={g ? 'on' : 'off'} />;
            }).map((el, j) => <span key={j} style={{ textAlign: 'center' }}>{el}</span>)}
          </div>
        ))}
      </div>
    </div>
  );
}
function CRC12_Empty() {
  return (
    <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: 16, textAlign: 'center' }}>
      <div style={{ width: 140, height: 70, border: '1px dashed ' + C.line2, padding: 8, fontSize: 9.5, color: C.fgFaint, textAlign: 'left' }}>
        $ ls draws/<br/>
        <span style={{ color: C.fgFaint }}>0 results</span>
        <span style={{ borderRight: '1.5px solid ' + C.phos, marginLeft: 3 }} />
      </div>
      <div style={{ fontFamily: C.sans, fontSize: 14, fontWeight: 600, color: C.phos, marginTop: 14, letterSpacing: '0.04em', textShadow: `0 0 8px ${C.phos}` }}>NO SIGNAL</div>
      <div style={{ fontSize: 10.5, color: C.fgDim, marginTop: 4 }}>$ invite --role=gc --email=…</div>
      <span style={{ marginTop: 10, padding: '5px 12px', background: C.phos, color: C.bg, fontSize: 10, fontWeight: 700, letterSpacing: '0.12em' }}>+ INVITE GC</span>
    </div>
  );
}

// === detail page ===
function TemplateDetailControlroom() {
  return (
    <div style={{ height: '100%', display: 'flex', flexDirection: 'column', background: '#f6f4ef', overflow: 'auto', fontFamily: 'IBM Plex Sans, system-ui', color: '#1a1814' }}>
      <TplNav />
      <TplBreadcrumb tplId="controlroom" />

      {/* HERO */}
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1.1fr', borderBottom: '1px solid #d8d4c8' }}>
        <div style={{ padding: '20px 36px 32px', borderRight: '1px solid #d8d4c8' }}>
          <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
            <span style={{ fontFamily: C.mono, fontSize: 11, letterSpacing: '0.16em', textTransform: 'uppercase', color: '#6b6557' }}>// 03 of 06 · template</span>
            <span style={{ padding: '2px 8px', borderRadius: 99, background: '#fbfaf7', border: '1px solid #d8d4c8', fontFamily: C.mono, fontSize: 10, color: C.bg, display: 'inline-flex', alignItems: 'center', gap: 5 }}><span style={led(C.phos)} /> credibility play</span>
          </div>
          <h1 style={{ font: '500 64px "IBM Plex Serif", serif', letterSpacing: '-0.025em', lineHeight: 1, marginTop: 12 }}>Control Room.</h1>
          <div style={{ font: '400 22px "IBM Plex Serif", serif', fontStyle: 'italic', color: '#6b6557', marginTop: 6, lineHeight: 1.2 }}>Operator console for businesses that ship things.</div>
          <p style={{ marginTop: 16, fontSize: 14.5, lineHeight: 1.55, color: '#3a362d', maxWidth: 540 }}>
            Control Room turns every uStack app into a <b>real-time operator console</b>: deep ink background, phosphor-green accents, 48px tabular numbers, LED status lights, scrolling event ticker, scanline overlays on marquee surfaces.
            Reads as "Bloomberg gravitas" the instant it loads — exactly what 24/7 dispatchers, lenders, and finance operators want to feel.
            Built on a single dark palette + per-vertical accent (phosphor green · hi-vis amber · tomato red · cyan · magenta).
          </p>
          <TplBestForPills items={['DispatchHQ', 'DrawRequest (alt)', 'JobShop OS (alt)', 'KitchenOps (alt · service mode)']} />
        </div>
        <div style={{ padding: '18px', display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#f0eee9' }}>
          <div style={{ width: '100%', height: 380, borderRadius: 8, overflow: 'hidden', background: C.bg, color: C.fg, fontFamily: C.mono, position: 'relative', boxShadow: '0 16px 44px rgba(28,24,16,0.20), 0 0 0 1px ' + C.line2 }}>
            <div style={{ display: 'flex', alignItems: 'center', gap: 14, padding: '0 14px', height: 24, background: C.bg2, borderBottom: '1px solid ' + C.line, fontSize: 9.5 }}>
              <span style={{ color: C.phos, letterSpacing: '0.12em' }}>● LIVE</span>
              <span style={{ color: C.fgDim }}>18:37 packet generated · m. sterling · 18:21 waiver expired · northwind · 18:14 draw released · p. alvarez</span>
            </div>
            <div style={{ padding: '14px 18px', borderBottom: '1px solid ' + C.line }}>
              <div style={{ fontSize: 10, color: C.phos, letterSpacing: '0.14em' }}>// DRAWREQUEST · LENDER CONSOLE</div>
              <div style={{ fontFamily: C.sans, fontSize: 22, fontWeight: 700, marginTop: 4, letterSpacing: '-0.01em', textTransform: 'uppercase' }}>CORNERSTONE CAPITAL</div>
            </div>
            <div style={{ padding: 18, backgroundImage: 'linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px)', backgroundSize: '16px 16px' }}>
              <div style={{ fontSize: 9.5, color: C.fgDim, letterSpacing: '0.1em' }}>// PORTFOLIO · EXPOSURE</div>
              <div style={{ fontSize: 64, color: C.phos, textShadow: `0 0 22px ${C.phos}`, letterSpacing: '-0.04em', marginTop: 4, fontWeight: 600 }}>$62.6M</div>
              <div style={{ fontSize: 10, color: C.fgDim, marginTop: 6, letterSpacing: '0.08em' }}>12 ACTIVE · ▲ $4.1M MTD</div>
              <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 18, marginTop: 22 }}>
                {[['RELEASED','$127.8K'],['HELD','$255.6K'],['OPEN','08'],['FLAGS','01', true]].map(([l,v,w], i) => (
                  <div key={i}>
                    <div style={{ fontSize: 9, color: C.fgDim, letterSpacing: '0.1em' }}>{l}</div>
                    <div style={{ fontSize: 22, color: w ? C.amber : C.fg, marginTop: 4, fontWeight: 600 }}>{v}</div>
                  </div>
                ))}
              </div>
              <div style={{ marginTop: 24, display: 'flex', gap: 5, alignItems: 'center' }}>
                {['ADMIN','LOAN','GC','SUB','INSP','OWNER','FIN','AUD'].map((r, i) => (
                  <div key={r} style={{ flex: 1, padding: '5px 6px', border: '1px solid ' + (i === 0 ? C.phos : C.line2), borderTop: i === 0 ? `2px solid ${C.phos}` : '1px solid ' + C.line2, background: i === 0 ? `color-mix(in oklab, ${C.phos} 12%, ${C.bg2})` : C.bg2 }}>
                    <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                      <span style={led(i === 0 ? C.phos : (i % 3 === 1 ? C.amber : C.fgFaint), i < 3)} />
                      <span style={{ fontSize: 9, color: i === 0 ? C.phos : C.fg, fontWeight: 700 }}>{r}</span>
                    </div>
                    <div style={{ fontSize: 12, color: C.phos, marginTop: 2 }}>{String([5,3,2,1,4,2,1,0][i]).padStart(2, '0')}</div>
                  </div>
                ))}
              </div>
            </div>
          </div>
        </div>
      </div>

      <TplWhy title="Look serious the moment it loads." reasons={[
        ['24/7 operators trust dark UIs.',           'Dispatchers, traders, and lenders have lived in dark dashboards for thirty years. Control Room speaks their dialect natively.'],
        ['Big numbers carry the story.',             '48px tabular numerals at every KPI. The shape of the dashboard is the shape of the business — readable from across the room.'],
        ['Status as physical state.',                'LEDs glow. Tickers scroll. Scanlines hint at a CRT. The interface feels like equipment, not software.'],
      ]} />

      <TplInProduction items={[
        { name: 'DispatchHQ',  industry: 'Trades dispatch', url: 'dispatchhq.ustack.ai',  actors: 7, signature: '5 techs × time × jobs · drag-to-assign · SLA timers · radio energy', accent: C.bg,
          preview: (
            <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 8 }}>
              <div style={{ fontSize: 8, color: C.amber, letterSpacing: '0.12em' }}>// NORTH STAR HVAC · DISPATCH</div>
              <div style={{ display: 'grid', gridTemplateColumns: '40px repeat(5, 1fr)', gap: 1, marginTop: 6, background: C.line }}>
                <div style={{ background: C.bg2, padding: 3, fontSize: 7, color: C.fgDim }}>TECH</div>
                {['08','10','12','14','16'].map(t => <div key={t} style={{ background: C.bg2, padding: 3, fontSize: 7, textAlign: 'center', color: C.fgDim }}>{t}</div>)}
                {['LOU','MAE','ROB','JEN'].map((tech, i) => (
                  <React.Fragment key={tech}>
                    <div style={{ background: C.bg2, padding: 3, fontSize: 8, fontWeight: 700 }}>{tech}</div>
                    {[0,1,2,3,4].map(j => {
                      const accent = (i === 2 && j === 1) ? C.tomato : (i === 0 || j === 2) ? C.amber : ((i + j) % 3 === 0 ? C.amber : null);
                      return <div key={j} style={{ background: C.bg2, padding: 3, borderLeft: accent ? `2px solid ${accent}` : '2px solid transparent' }}>{accent && <div style={{ fontSize: 6, color: accent }}>{(i === 2 && j === 1) ? 'BURST' : 'JOB'}</div>}</div>;
                    })}
                  </React.Fragment>
                ))}
              </div>
              <div style={{ position: 'absolute', bottom: 6, left: 10, fontSize: 8, color: C.fgDim }}>5 techs · 24 jobs · 1 SLA risk</div>
            </div>
          ) },
        { name: 'DrawRequest',   industry: 'Construction draws · alt', url: 'drawrequest.ustack.ai', actors: 8, signature: 'Number wall · waiver LEDs · ACH release as command', accent: C.bg,
          preview: (
            <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10 }}>
              <div style={{ fontSize: 8, color: C.phos, letterSpacing: '0.12em' }}>// LENDER · PORTFOLIO</div>
              <div style={{ fontSize: 34, color: C.phos, textShadow: `0 0 16px ${C.phos}`, marginTop: 2, fontWeight: 600 }}>$62.6M</div>
              <div style={{ display: 'flex', gap: 8, marginTop: 8 }}>
                {[['REL','$127K'],['FLG','01'],['OPN','08']].map(([l,v], i) => (
                  <div key={i}><div style={{ fontSize: 7, color: C.fgDim }}>{l}</div><div style={{ fontSize: 13, color: i === 1 ? C.amber : C.fg }}>{v}</div></div>
                ))}
              </div>
              <div style={{ marginTop: 12, display: 'flex', gap: 5 }}>{[true,true,false,true,false,true,true,false].map((on, i) => <span key={i} style={led(on ? C.phos : C.fgFaint, on)} />)}</div>
            </div>
          ) },
        { name: 'JobShop OS',  industry: 'Manufacturing · alt', url: 'jobshop.ustack.ai',   actors: 8, signature: 'Machine state · WIP queue · scrap LEDs · cycle times', accent: C.bg,
          preview: (
            <div style={{ position: 'absolute', inset: 0, background: C.bg, color: C.fg, fontFamily: C.mono, padding: 10 }}>
              <div style={{ fontSize: 8, color: C.cyan, letterSpacing: '0.12em' }}>// SHOP · MACHINE STATE</div>
              {['MILL-1','LATHE-2','WELD-3','QA-4'].map((m, i) => (
                <div key={m} style={{ display: 'grid', gridTemplateColumns: '60px 1fr 30px', gap: 4, alignItems: 'center', marginTop: 6, fontSize: 9 }}>
                  <span style={{ color: C.fgDim }}>{m}</span>
                  <div style={{ height: 5, background: C.bg3 }}><div style={{ height: '100%', width: [82, 64, 100, 38][i] + '%', background: i === 2 ? C.fgFaint : C.cyan }} /></div>
                  <span style={{ color: C.cyan, fontSize: 9 }}>{[82,64,100,38][i]}%</span>
                </div>
              ))}
              <div style={{ position: 'absolute', bottom: 6, left: 10, fontSize: 7, color: C.fgDim }}>WO-208 · 12 / 17 lines</div>
            </div>
          ) },
      ]} />

      <TplComponentsGrid title="Twelve canonical components — every one wired with status lights.">
        <TplCComp no="01" name="App shell"        sub="ticker · actor strip · pills"><CRC01_Shell /></TplCComp>
        <TplCComp no="02" name="Sign-in"          sub="terminal handshake">           <CRC02_Signin /></TplCComp>
        <TplCComp no="03" name="Persona switcher" sub="LED grid · 8 operators">       <CRC03_Actors /></TplCComp>
        <TplCComp no="04" name="Home · dashboard" sub="number wall · KPIs">            <CRC04_Home /></TplCComp>
        <TplCComp no="05" name="Object list"      sub="dense data table">              <CRC05_List /></TplCComp>
        <TplCComp no="06" name="Object detail"    sub="stats wall · monospace">        <CRC06_Detail /></TplCComp>
        <TplCComp no="07" name="Form · multi-step"sub="staged · monospace inputs">     <CRC07_Form /></TplCComp>
        <TplCComp no="08" name="Workflow chain"   sub="state machine LEDs">            <CRC08_Workflow /></TplCComp>
        <TplCComp no="09" name="Audit feed"       sub="tail -f log">                    <CRC09_Audit /></TplCComp>
        <TplCComp no="10" name="Generated output" sub="packet on phosphor">             <CRC10_Output /></TplCComp>
        <TplCComp no="11" name="Settings · admin" sub="LED permission grid">            <CRC11_Settings /></TplCComp>
        <TplCComp no="12" name="Empty state"      sub="0 results · prompt">              <CRC12_Empty /></TplCComp>
      </TplComponentsGrid>

      <TplTokens
        tokens={[
          { kind: 'TYPE',     v: 'IBM Plex Mono · 48px wall',     sub: 'tabular nums everywhere; sans reserved for titles' },
          { kind: 'COLOR',    v: 'Ink + phosphor + amber + tomato', sub: 'one base palette · accent rotates per vertical' },
          { kind: 'DENSITY',  v: 'Maximal · operator-grade',       sub: 'every pixel earns its place' },
          { kind: 'CHROME',   v: 'LEDs · ticker · scanlines',      sub: 'CRT cues; status is glow, not text' },
          { kind: 'TONE',     v: 'Bloomberg · NASA · serious',     sub: 'feels like equipment, not software' },
        ]}
        swatches={[
          ['ink',     C.bg],
          ['ink-2',   C.bg2],
          ['phosphor',C.phos],
          ['amber',   C.amber],
          ['tomato',  C.tomato],
        ]}
      />

      <TplCTA title="Build your app in Control Room, or browse the other five." ctaColor={C.bg} ctaLabel="Build in Control Room →" />
      <TplFooter text="© 2026 ustack · control room template · all 12 components live" />
    </div>
  );
}

window.TemplateDetailControlroom = TemplateDetailControlroom;
