// Realistic system screen mocks — higher fidelity, production-grade density.
// viewBox 560x380; preserveAspectRatio default so it scales to fit the container.

const CaseMock = ({ kind }) => {
  // Realistic browser chrome with tabs + address bar
  const Chrome = ({ url, title = "", brandColor = "#2563eb", favicon = "A" }) => (
    <g>
      {/* window bar */}
      <rect x="0" y="0" width="560" height="36" fill="#e5e7eb"/>
      <circle cx="16" cy="18" r="5.5" fill="#ef4444"/>
      <circle cx="34" cy="18" r="5.5" fill="#f59e0b"/>
      <circle cx="52" cy="18" r="5.5" fill="#10b981"/>
      {/* tab */}
      <path d="M 74,36 L 80,8 Q 82,4 86,4 L 224,4 Q 228,4 230,8 L 236,36 Z" fill="#fff"/>
      <circle cx="92" cy="20" r="6" fill={brandColor}/>
      <text x="92" y="23" fontSize="8" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff" textAnchor="middle">{favicon}</text>
      <text x="104" y="23" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="500" fill="#0f172a">{title}</text>
      <text x="222" y="20" fontSize="12" fill="#9ca3af" textAnchor="end">×</text>
      {/* address bar */}
      <rect x="0" y="36" width="560" height="32" fill="#f3f4f6"/>
      <rect x="100" y="44" width="360" height="18" fill="#fff" stroke="#d1d5db" strokeWidth="0.5" rx="9"/>
      <g transform="translate(108,49)"><path d="M 2,5 L 2,3 Q 2,0 5,0 Q 8,0 8,3 L 8,5 M 0,5 L 10,5 L 10,10 L 0,10 Z" fill="none" stroke="#10b981" strokeWidth="1"/></g>
      <text x="124" y="56" fontSize="10" fontFamily="'SF Mono', 'JetBrains Mono', monospace" fill="#374151">{url}</text>
      {/* nav arrows */}
      <g fill="#6b7280">
        <path d="M 22,52 L 16,47 L 16,57 Z"/>
        <path d="M 42,47 L 48,52 L 42,57 Z"/>
        <circle cx="70" cy="52" r="6" fill="none" stroke="#6b7280" strokeWidth="1.3"/>
        <path d="M 66,48 Q 70,46 74,50 M 74,50 L 74,46 M 74,50 L 70,50" fill="none" stroke="#6b7280" strokeWidth="1.2"/>
      </g>
      {/* extensions */}
      <circle cx="478" cy="52" r="6" fill="#ddd6fe"/>
      <circle cx="498" cy="52" r="6" fill="#fde68a"/>
      <circle cx="518" cy="52" r="6" fill={brandColor}/>
      <text x="518" y="56" fontSize="8" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff" textAnchor="middle">S</text>
      <circle cx="542" cy="52" r="7" fill="#0f172a"/>
      <text x="542" y="56" fontSize="8" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff" textAnchor="middle">TK</text>
      <line x1="0" y1="68" x2="560" y2="68" stroke="#d1d5db" strokeWidth="0.5"/>
    </g>
  );

  if (kind === "manufacturing") {
    return (
      <svg viewBox="0 0 560 380" style={{ width: "100%", height: "100%", display: "block" }}>
        <rect width="560" height="380" fill="#f1f5f9"/>
        <Chrome url="https://mfg.algoviax.co.jp/dashboard/line-a" title="生産管理 · Algoviax MFG" brandColor="#0ea5e9" favicon="M"/>

        {/* Dark sidebar */}
        <rect x="0" y="68" width="64" height="312" fill="#0f172a"/>
        <rect x="12" y="84" width="40" height="40" fill="#0ea5e9" rx="10"/>
        <text x="32" y="110" fontSize="16" fontFamily="'Inter', sans-serif" fontWeight="800" fill="#fff" textAnchor="middle">A</text>
        {[{y:140, icon:"□"},{y:180, icon:"▤"},{y:220, icon:"◔"},{y:260, icon:"⚙"},{y:300, icon:"?"}].map((s,i)=>(
          <g key={i}>
            <rect x="12" y={s.y} width="40" height="36" fill={i===0?"#1e293b":"transparent"} rx="8"/>
            <text x="32" y={s.y+23} fontSize="14" fontFamily="'Inter', sans-serif" fill={i===0?"#fff":"#64748b"} textAnchor="middle">{s.icon}</text>
          </g>
        ))}
        <circle cx="32" cy="350" r="14" fill="#334155"/>
        <text x="32" y="354" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#fff" textAnchor="middle">YT</text>

        {/* Top bar with breadcrumbs */}
        <rect x="64" y="68" width="496" height="50" fill="#fff"/>
        <line x1="64" y1="118" x2="560" y2="118" stroke="#e5e7eb" strokeWidth="1"/>
        <text x="80" y="88" fontSize="10" fontFamily="'Inter', sans-serif" fill="#94a3b8">ダッシュボード</text>
        <text x="144" y="88" fontSize="10" fontFamily="'Inter', sans-serif" fill="#94a3b8">/</text>
        <text x="154" y="88" fontSize="10" fontFamily="'Inter', sans-serif" fill="#94a3b8">Line A</text>
        <text x="80" y="108" fontSize="16" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">生産工程ダッシュボード</text>
        {/* Top bar right controls */}
        <g transform="translate(356,80)">
          <rect width="80" height="28" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="6"/>
          <text x="10" y="18" fontSize="10" fontFamily="'Inter', sans-serif" fill="#374151">今週</text>
          <path d="M 62,12 L 66,16 L 70,12" fill="none" stroke="#6b7280" strokeWidth="1.3"/>
        </g>
        <g transform="translate(444,80)">
          <rect width="32" height="28" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="6"/>
          <text x="16" y="19" fontSize="12" fill="#6b7280" textAnchor="middle">⟳</text>
        </g>
        <g transform="translate(484,80)">
          <rect width="60" height="28" fill="#0ea5e9" rx="6"/>
          <text x="30" y="19" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#fff" textAnchor="middle">エクスポート</text>
        </g>

        {/* KPI cards — 4 columns */}
        <g transform="translate(80,134)">
          {[
            {l:"業務工数", v:"-72", u:"%", sub:"前年同期比", trend:"up", c:"#0ea5e9"},
            {l:"歩留まり", v:"98.4", u:"%", sub:"目標 95%達成", trend:"up", c:"#10b981"},
            {l:"月間生産数", v:"12,840", u:"台", sub:"目標比 107%", trend:"up", c:"#6366f1"},
            {l:"不良率", v:"0.42", u:"%", sub:"過去最低水準", trend:"down", c:"#f59e0b"},
          ].map((k,i)=>(
            <g key={i} transform={`translate(${i*118},0)`}>
              <rect width="110" height="82" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="10"/>
              <rect x="10" y="12" width="20" height="20" fill={k.c+"22"} rx="5"/>
              <circle cx="20" cy="22" r="4" fill={k.c}/>
              <text x="38" y="26" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="500" fill="#64748b">{k.l}</text>
              <text x="10" y="56" fontSize="22" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">{k.v}<tspan fontSize="12" fill="#64748b">{k.u}</tspan></text>
              <g transform="translate(10,68)">
                <path d={k.trend==="up"?"M 0,4 L 3,0 L 6,4 Z":"M 0,0 L 6,0 L 3,4 Z"} fill={k.trend==="up"?"#10b981":"#ef4444"}/>
                <text x="10" y="5" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="500" fill={k.trend==="up"?"#10b981":"#ef4444"}>{k.sub}</text>
              </g>
            </g>
          ))}
        </g>

        {/* Main chart */}
        <g transform="translate(80,230)">
          <rect width="346" height="138" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="10"/>
          <text x="16" y="26" fontSize="12" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">週次生産トレンド</text>
          <text x="16" y="40" fontSize="9" fontFamily="'Inter', sans-serif" fill="#94a3b8">過去7週間 · 単位: 台/日</text>
          {/* legend */}
          <g transform="translate(230,20)">
            <rect width="10" height="3" fill="#0ea5e9"/>
            <text x="14" y="4" fontSize="8" fontFamily="'Inter', sans-serif" fill="#64748b">実績</text>
            <line x1="50" y1="2" x2="60" y2="2" stroke="#f59e0b" strokeDasharray="2 2" strokeWidth="1.5"/>
            <text x="64" y="4" fontSize="8" fontFamily="'Inter', sans-serif" fill="#64748b">目標</text>
            <line x1="94" y1="2" x2="104" y2="2" stroke="#94a3b8" strokeWidth="1"/>
            <text x="108" y="4" fontSize="8" fontFamily="'Inter', sans-serif" fill="#64748b">前年</text>
          </g>
          {/* y axis labels */}
          {["2.0k","1.5k","1.0k","0.5k","0"].map((l,i)=>(
            <text key={i} x="14" y={58+i*18} fontSize="8" fontFamily="'Inter', sans-serif" fill="#94a3b8">{l}</text>
          ))}
          {/* grid */}
          {[0,1,2,3,4].map(i=><line key={i} x1="36" x2="330" y1={56+i*18} y2={56+i*18} stroke="#f1f5f9" strokeWidth="1"/>)}
          {/* bars */}
          {[52, 68, 60, 82, 74, 98, 110].map((h,i)=>(
            <g key={i}>
              <rect x={50 + i*40} y={144-h} width="22" height={h} fill="#0ea5e9" rx="3" opacity="0.9"/>
              <rect x={74 + i*40} y={144-(h*0.7)} width="4" height={h*0.7} fill="#0ea5e9" opacity="0.35" rx="1"/>
            </g>
          ))}
          {/* target dashed */}
          <line x1="50" y1="78" x2="330" y2="78" stroke="#f59e0b" strokeWidth="1.5" strokeDasharray="4 3"/>
          {/* prev year line */}
          <path d="M 61,120 L 101,110 L 141,114 L 181,102 L 221,108 L 261,92 L 301,88" stroke="#94a3b8" strokeWidth="1.3" fill="none"/>
          {[61,101,141,181,221,261,301].map((x,i)=><circle key={i} cx={x} cy={[120,110,114,102,108,92,88][i]} r="2" fill="#94a3b8"/>)}
          {/* x labels */}
          {["W14","W15","W16","W17","W18","W19","W20"].map((l,i)=>(
            <text key={i} x={61+i*40} y="158" fontSize="8" fontFamily="'Inter', sans-serif" fill="#94a3b8" textAnchor="middle">{l}</text>
          ))}
          {/* tooltip */}
          <g transform="translate(261,36)">
            <rect width="70" height="32" fill="#0f172a" rx="4"/>
            <text x="8" y="13" fontSize="8" fontFamily="'Inter', sans-serif" fill="#94a3b8">W19 (04/08)</text>
            <text x="8" y="26" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff">1,862 台</text>
            <path d="M 20,32 L 24,36 L 28,32 Z" fill="#0f172a"/>
          </g>
        </g>

        {/* Right panel: process status */}
        <g transform="translate(434,230)">
          <rect width="110" height="138" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="10"/>
          <text x="12" y="24" fontSize="11" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">工程ステータス</text>
          <circle cx="95" cy="20" r="3" fill="#10b981"/>
          {[
            {t:"部品投入", p:100, d:"15:02"},
            {t:"組立", p:100, d:"15:18"},
            {t:"検査", p:78, d:"進行中"},
            {t:"梱包", p:24, d:"待機"},
            {t:"出荷", p:0, d:"予定 16:30"},
          ].map((r,i)=>(
            <g key={i} transform={`translate(12,${36 + i*20})`}>
              <circle cx="3" cy="6" r="3" fill={r.p===100?"#10b981":r.p>0?"#0ea5e9":"#e5e7eb"}/>
              {r.p===100 && <path d="M 1,6 l 1.5,1.5 l 3,-3" stroke="#fff" strokeWidth="1" fill="none" strokeLinecap="round"/>}
              <text x="12" y="8" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#0f172a">{r.t}</text>
              <text x="76" y="8" fontSize="8" fontFamily="'Inter', sans-serif" fill="#94a3b8" textAnchor="end">{r.d}</text>
              <rect x="12" y="12" width="74" height="3" fill="#f1f5f9" rx="1.5"/>
              <rect x="12" y="12" width={0.74*r.p} height="3" fill={r.p===100?"#10b981":r.p>0?"#0ea5e9":"#e5e7eb"} rx="1.5"/>
            </g>
          ))}
        </g>
      </svg>
    );
  }

  if (kind === "finance") {
    return (
      <svg viewBox="0 0 560 380" style={{ width: "100%", height: "100%", display: "block" }}>
        <rect width="560" height="380" fill="#f8fafc"/>
        <Chrome url="https://credit-ai.algoviax.co.jp/applications/A-20260418-0042" title="Credit AI Platform" brandColor="#4f46e5" favicon="C"/>

        {/* Top app bar */}
        <rect x="0" y="68" width="560" height="52" fill="#fff"/>
        <line x1="0" y1="120" x2="560" y2="120" stroke="#e5e7eb" strokeWidth="1"/>
        <rect x="20" y="84" width="28" height="28" fill="#4f46e5" rx="7"/>
        <text x="34" y="104" fontSize="13" fontFamily="'Inter', sans-serif" fontWeight="800" fill="#fff" textAnchor="middle">C</text>
        <text x="56" y="103" fontSize="13" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">Credit AI</text>
        {/* nav tabs */}
        {["審査","履歴","モデル","設定","API"].map((t,i)=>(
          <g key={i}>
            <text x={150 + i*58} y="103" fontSize="11" fontFamily="'Inter', sans-serif" fontWeight={i===0?"600":"500"} fill={i===0?"#4f46e5":"#64748b"}>{t}</text>
          </g>
        ))}
        <rect x="146" y="116" width="32" height="2" fill="#4f46e5"/>
        {/* right: search + avatar */}
        <g transform="translate(408,86)">
          <rect width="96" height="24" fill="#f3f4f6" rx="12"/>
          <circle cx="12" cy="12" r="4" fill="none" stroke="#9ca3af" strokeWidth="1.3"/>
          <line x1="15" y1="15" x2="18" y2="18" stroke="#9ca3af" strokeWidth="1.3"/>
          <text x="22" y="16" fontSize="10" fontFamily="'Inter', sans-serif" fill="#9ca3af">検索</text>
        </g>
        <circle cx="518" cy="98" r="6" fill="#ef4444"/>
        <text x="518" y="101" fontSize="7" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff" textAnchor="middle">3</text>
        <circle cx="540" cy="98" r="12" fill="#e0e7ff"/>
        <text x="540" y="102" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#4f46e5" textAnchor="middle">SK</text>

        {/* Page header */}
        <g transform="translate(20,134)">
          <text x="0" y="0" fontSize="10" fontFamily="'Inter', sans-serif" fill="#94a3b8">審査一覧 / #A-20260418-0042</text>
          <text x="0" y="20" fontSize="18" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">田中 太郎 さんの申込</text>
          <g transform="translate(180,4)">
            <rect width="62" height="20" fill="#eef2ff" rx="10"/>
            <circle cx="10" cy="10" r="3" fill="#4f46e5"/>
            <text x="18" y="14" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#4f46e5">AI処理済</text>
          </g>
          <text x="0" y="38" fontSize="10" fontFamily="'Inter', sans-serif" fill="#64748b">申込 2026/04/18 10:24 · 担当 中村 · 処理時間 0.42秒</text>
          <g transform="translate(390,12)">
            <rect width="60" height="28" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="6"/>
            <text x="30" y="18" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="500" fill="#374151" textAnchor="middle">差戻し</text>
            <rect x="68" width="60" height="28" fill="#fee2e2" rx="6"/>
            <text x="98" y="18" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#b91c1c" textAnchor="middle">否決</text>
            <rect x="136" width="60" height="28" fill="#4f46e5" rx="6"/>
            <text x="166" y="18" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#fff" textAnchor="middle">承認</text>
          </g>
        </g>

        {/* Score card */}
        <g transform="translate(20,192)">
          <rect width="216" height="170" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="12"/>
          <text x="16" y="24" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#64748b">AI SCORE</text>
          <text x="198" y="24" fontSize="9" fontFamily="'Inter', sans-serif" fill="#94a3b8" textAnchor="end">v2.4.1</text>
          <g transform="translate(108,94)">
            <circle r="52" fill="none" stroke="#eef2ff" strokeWidth="10"/>
            <circle r="52" fill="none" stroke="#4f46e5" strokeWidth="10" strokeDasharray="273 326" transform="rotate(-90)" strokeLinecap="round"/>
            <circle r="44" fill="#faf9ff"/>
            <text y="4" fontSize="32" fontFamily="'Inter', sans-serif" fontWeight="800" fill="#0f172a" textAnchor="middle">842</text>
            <text y="20" fontSize="9" fontFamily="'Inter', sans-serif" fill="#64748b" textAnchor="middle">/ 1000</text>
          </g>
          <g transform="translate(16,152)">
            <rect width="184" height="0.5" fill="#e5e7eb"/>
          </g>
          <rect x="16" y="136" width="184" height="20" fill="#ecfdf5" rx="4"/>
          <circle cx="28" cy="146" r="5" fill="#10b981"/>
          <path d="M 25.2,146 l 1.8,1.8 l 3.5,-3.5" stroke="#fff" strokeWidth="1.4" fill="none" strokeLinecap="round"/>
          <text x="38" y="150" fontSize="11" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#065f46">承認推奨</text>
          <text x="120" y="150" fontSize="10" fontFamily="'Inter', sans-serif" fill="#065f46">信頼度 96.2%</text>
        </g>

        {/* Factor breakdown */}
        <g transform="translate(244,192)">
          <rect width="296" height="170" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="12"/>
          <text x="16" y="24" fontSize="11" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">評価要因の寄与度</text>
          <text x="16" y="38" fontSize="9" fontFamily="'Inter', sans-serif" fill="#94a3b8">SHAP値によるモデル解釈</text>
          <g transform="translate(218,14)">
            <rect width="60" height="20" fill="#f3f4f6" rx="4"/>
            <text x="30" y="14" fontSize="9" fontFamily="'Inter', sans-serif" fill="#374151" textAnchor="middle">詳細 →</text>
          </g>
          {[
            {n:"支払履歴", v:0.92, c:"#10b981", d:"+48pt"},
            {n:"債務比率", v:0.78, c:"#10b981", d:"+32pt"},
            {n:"雇用安定性", v:0.84, c:"#10b981", d:"+28pt"},
            {n:"信用利用率", v:0.62, c:"#f59e0b", d:"-6pt"},
            {n:"照会頻度", v:0.48, c:"#ef4444", d:"-14pt"},
          ].map((f,i)=>(
            <g key={i} transform={`translate(16,${54 + i*22})`}>
              <text x="0" y="10" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="500" fill="#0f172a">{f.n}</text>
              <rect x="90" y="2" width="140" height="10" fill="#f1f5f9" rx="5"/>
              <rect x="90" y="2" width={140*f.v} height="10" fill={f.c} rx="5"/>
              <text x="238" y="10" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#0f172a">{Math.round(f.v*100)}%</text>
              <text x="264" y="10" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill={f.c}>{f.d}</text>
            </g>
          ))}
        </g>
      </svg>
    );
  }

  if (kind === "retail") {
    return (
      <svg viewBox="0 0 560 380" style={{ width: "100%", height: "100%", display: "block" }}>
        <rect width="560" height="380" fill="#f9fafb"/>
        <Chrome url="https://stock.algoviax.co.jp/inventory/warehouse-03" title="在庫管理 · Algoviax Stock" brandColor="#16a34a" favicon="S"/>

        {/* Sidebar */}
        <rect x="0" y="68" width="68" height="312" fill="#fff"/>
        <line x1="68" y1="68" x2="68" y2="380" stroke="#e5e7eb" strokeWidth="1"/>
        <rect x="14" y="86" width="40" height="36" fill="#f0fdf4" rx="8"/>
        <rect x="14" y="86" width="3" height="36" fill="#16a34a" rx="1.5"/>
        <rect x="24" y="98" width="20" height="12" fill="none" stroke="#16a34a" strokeWidth="1.5" rx="2"/>
        {[{y:132, c:"#94a3b8"},{y:174, c:"#94a3b8"},{y:216, c:"#94a3b8"},{y:258, c:"#94a3b8"}].map((s,i)=>(
          <rect key={i} x="24" y={s.y+12} width="20" height="12" fill="none" stroke={s.c} strokeWidth="1.3" rx="2"/>
        ))}
        <circle cx="34" cy="350" r="14" fill="#dcfce7"/>
        <text x="34" y="354" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#16a34a" textAnchor="middle">YT</text>

        {/* Top bar */}
        <rect x="68" y="68" width="492" height="52" fill="#fff"/>
        <line x1="68" y1="120" x2="560" y2="120" stroke="#e5e7eb" strokeWidth="1"/>
        <text x="84" y="92" fontSize="10" fontFamily="'Inter', sans-serif" fill="#94a3b8">在庫 / 倉庫03</text>
        <text x="84" y="110" fontSize="15" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">在庫管理ダッシュボード</text>
        <g transform="translate(400,82)">
          <rect width="100" height="26" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="6"/>
          <circle cx="14" cy="13" r="4.5" fill="none" stroke="#9ca3af" strokeWidth="1.3"/>
          <line x1="17.5" y1="16.5" x2="21" y2="20" stroke="#9ca3af" strokeWidth="1.3"/>
          <text x="26" y="17" fontSize="10" fontFamily="'Inter', sans-serif" fill="#9ca3af">SKU検索</text>
        </g>
        <g transform="translate(508,82)">
          <rect width="40" height="26" fill="#16a34a" rx="6"/>
          <text x="10" y="19" fontSize="14" fontFamily="'Inter', sans-serif" fill="#fff">+</text>
          <text x="20" y="17" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#fff">新規</text>
        </g>

        {/* Alert banner */}
        <g transform="translate(84,134)">
          <rect width="458" height="32" fill="#fef3c7" stroke="#fde68a" strokeWidth="1" rx="6"/>
          <circle cx="18" cy="16" r="8" fill="#f59e0b"/>
          <text x="18" y="20" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#fff" textAnchor="middle">!</text>
          <text x="36" y="15" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#92400e">18 SKUが欠品状態です</text>
          <text x="36" y="26" fontSize="9" fontFamily="'Inter', sans-serif" fill="#92400e">AIが自動発注を提案しています · 最終実行 5分前</text>
          <text x="444" y="20" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#92400e" textAnchor="end">詳細 →</text>
        </g>

        {/* KPI strip */}
        <g transform="translate(84,178)">
          {[
            {l:"在庫あり", v:"1,204", c:"#16a34a", bg:"#f0fdf4", d:"+12 今日"},
            {l:"低在庫", v:"62", c:"#f59e0b", bg:"#fffbeb", d:"要注意"},
            {l:"欠品", v:"18", c:"#ef4444", bg:"#fef2f2", d:"自動発注中"},
            {l:"自動発注", v:"+34", c:"#2563eb", bg:"#eff6ff", d:"今週"},
          ].map((k,i)=>(
            <g key={i} transform={`translate(${i*116},0)`}>
              <rect width="108" height="62" fill={k.bg} stroke="#e5e7eb" strokeWidth="1" rx="8"/>
              <rect x="0" y="0" width="3" height="62" fill={k.c} rx="1.5"/>
              <text x="14" y="20" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#64748b">{k.l}</text>
              <text x="14" y="44" fontSize="22" fontFamily="'Inter', sans-serif" fontWeight="800" fill="#0f172a">{k.v}</text>
              <text x="14" y="56" fontSize="8" fontFamily="'Inter', sans-serif" fontWeight="500" fill={k.c}>{k.d}</text>
            </g>
          ))}
        </g>

        {/* Table */}
        <g transform="translate(84,252)">
          <rect width="340" height="118" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="10"/>
          <rect width="340" height="28" fill="#f9fafb" rx="10"/>
          <rect y="18" width="340" height="10" fill="#f9fafb"/>
          <line x1="0" y1="28" x2="340" y2="28" stroke="#e5e7eb" strokeWidth="1"/>
          {[
            {x:14, t:"SKU"},{x:80, t:"商品名"},{x:208, t:"在庫"},{x:248, t:"ステータス"},{x:310, t:"..."},
          ].map((h,i)=>(
            <text key={i} x={h.x} y="18" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#64748b">{h.t}</text>
          ))}
          {[
            {s:"SK-001", n:"プレミアムコーヒー 500g", q:284, st:"在庫あり", c:"#16a34a", bg:"#dcfce7"},
            {s:"SK-002", n:"ドリップフィルター 100枚", q:42, st:"低在庫", c:"#f59e0b", bg:"#fef3c7"},
            {s:"SK-003", n:"限定春ブレンド 200g", q:0, st:"欠品", c:"#ef4444", bg:"#fee2e2"},
            {s:"SK-004", n:"オリジナルマグ", q:128, st:"在庫あり", c:"#16a34a", bg:"#dcfce7"},
          ].map((r,i)=>(
            <g key={i} transform={`translate(0,${28 + i*22})`}>
              <line x1="0" y1="22" x2="340" y2="22" stroke="#f3f4f6" strokeWidth="1"/>
              <rect x="14" y="4" width="56" height="14" fill="#f3f4f6" rx="3"/>
              <text x="42" y="14" fontSize="9" fontFamily="'SF Mono', 'JetBrains Mono', monospace" fill="#6b7280" textAnchor="middle">{r.s}</text>
              <text x="80" y="15" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="500" fill="#0f172a">{r.n}</text>
              <text x="208" y="15" fontSize="11" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">{r.q}</text>
              <rect x="246" y="5" width="56" height="14" fill={r.bg} rx="7"/>
              <circle cx="254" cy="12" r="2" fill={r.c}/>
              <text x="260" y="15" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill={r.c}>{r.st}</text>
              <text x="316" y="16" fontSize="12" fill="#9ca3af">⋯</text>
            </g>
          ))}
        </g>

        {/* Reorder card */}
        <g transform="translate(432,252)">
          <rect width="110" height="118" fill="#fff" stroke="#e5e7eb" strokeWidth="1" rx="10"/>
          <text x="12" y="20" fontSize="10" fontFamily="'Inter', sans-serif" fontWeight="700" fill="#0f172a">次回自動発注</text>
          <g transform="translate(55,60)">
            <circle r="26" fill="none" stroke="#f0fdf4" strokeWidth="7"/>
            <circle r="26" fill="none" stroke="#16a34a" strokeWidth="7" strokeDasharray="121 42" transform="rotate(-90)" strokeLinecap="round"/>
            <text y="2" fontSize="14" fontFamily="'Inter', sans-serif" fontWeight="800" fill="#0f172a" textAnchor="middle">74%</text>
            <text y="14" fontSize="7" fontFamily="'Inter', sans-serif" fill="#64748b" textAnchor="middle">コスト削減</text>
          </g>
          <line x1="12" y1="96" x2="98" y2="96" stroke="#f1f5f9" strokeWidth="1"/>
          <text x="12" y="108" fontSize="9" fontFamily="'Inter', sans-serif" fontWeight="600" fill="#0f172a">SK-002 · 300個</text>
          <text x="12" y="114.5" fontSize="8" fontFamily="'Inter', sans-serif" fill="#64748b">04/22 09:00 着</text>
        </g>
      </svg>
    );
  }

  return null;
};

window.CaseMock = CaseMock;
