// bu/v4.jsx — v3の骨格を維持しつつ「見た目の訴求力」を戻す2案
//  案A ソフトトーン：状態に連動した淡い色面＋スコアリング（円形ゲージ）＋塗りスパークライン
//  案B コントラスト：ダークヘッダーで主役を強く、下は白いシートで静かに
// 共通ルール：階層は v3 と同じ（1枚シート＋ヘアライン）。装飾は「判断レイヤー」だけに集中投下し、根拠レイヤーは静かなまま。
const { AppFrame, PageBar, Face, Icon } = window;

const P = {
  ink: '#1b1e24', ink2: '#3f444d', muted: '#71767f', faint: '#9aa1ab', ghost: '#b8bdc6',
  line: '#eceef1', lineSoft: '#f3f4f6',
  paper: '#ffffff', inset: '#f7f8fa',
  navy: '#1d2434', navySoft: '#2a3349',
  up: '#1f7a4d', down: '#bd3a54', warn: '#9a7018',
  upBg: '#ecf5f0', downBg: '#faeef1', warnBg: '#f8f2e2',
  upLine: '#d4e7dc', downLine: '#f0d5dc', warnLine: '#ecdfba',
};
const PFONT = "'Inter','Noto Sans JP','Hiragino Kaku Gothic ProN',Meiryo,sans-serif";

if (typeof document !== 'undefined' && !document.getElementById('v4-styles')) {
  const s = document.createElement('style');
  s.id = 'v4-styles';
  s.textContent = `
  .v4 details > summary::-webkit-details-marker{display:none}
  .v4 details > summary{list-style:none}
  .v4 .act{cursor:pointer;font-family:${PFONT};border:none;background:${P.ink};color:#fff;border-radius:10px;font-weight:700;transition:background .15s,transform .05s}
  .v4 .act:hover{background:#33383f}.v4 .act:active{transform:translateY(.5px)}
  .v4 .actw{cursor:pointer;font-family:${PFONT};border:none;background:#fff;color:${P.ink};border-radius:10px;font-weight:700;transition:opacity .15s,transform .05s}
  .v4 .actw:hover{opacity:.88}.v4 .actw:active{transform:translateY(.5px)}
  .v4 .quiet{cursor:pointer;font-family:${PFONT};background:transparent;border:1px solid ${P.line};color:${P.ink2};border-radius:10px;font-weight:600;transition:border-color .15s,background .15s}
  .v4 .quiet:hover{border-color:#d8dce2;background:${P.inset}}
  .v4 .rec-btn{cursor:pointer;font-family:${PFONT};background:#e8f8fd;border:1px solid #a5e2f3;color:#007fa8;border-radius:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:7px;transition:background .15s,border-color .15s}
  .v4 .rec-btn:hover{background:#d5f3fb;border-color:#0ab1e8}
  .v4 .quietw{cursor:pointer;font-family:${PFONT};background:transparent;border:1px solid rgba(255,255,255,.28);color:#fff;border-radius:10px;font-weight:600;transition:background .15s}
  .v4 .quietw:hover{background:rgba(255,255,255,.1)}
  .v4 .tlnk{cursor:pointer;border:none;background:none;font-family:${PFONT};color:${P.muted};font-weight:600;padding:0;text-decoration:underline;text-underline-offset:3px;text-decoration-color:${P.ghost};transition:color .15s}
  .v4 .tlnk:hover{color:${P.ink}}
  .v4 .fin{font-family:${PFONT};font-size:13.5px;color:${P.ink};background:${P.inset};border:1.5px solid transparent;border-radius:10px;outline:none;width:100%;padding:11px 14px;transition:background .15s,border-color .15s}
  .v4 .fin:focus{background:#fff;border-color:${P.ink}}
  .v4 .fin::placeholder{color:${P.ghost}}
  `;
  document.head.appendChild(s);
}

// ── データ（v3 と同一） ──
const Q = {
  member: { name: 'B班 副班長L', role: 'L / 副班長', dept: '2部', tenure: '3年11ヶ月' },
  period: '2026/06/01 – 06/30',
  summary: { score: 3.9, delta: 0.1, trend: [3.6, 3.5, 3.7, 3.8, 3.9], deptAvg: 3.6, teamAvg: 3.7 },
  status: { label: '要確認', note: '2pt低下の項目 / 1on1未実施 39日' },
  last: { date: '2026/05/15', daysAgo: 39 },
  checkpoints: [
    { kind: 'survey', q: '仕事内容満足度', prev: 5, cur: 3, hist: [4, 4, 5, 5, 3], reason: '大きく低下' },
    { kind: 'survey', q: '自身へのマネジメント', prev: 3, cur: 5, hist: [3, 4, 3, 3, 5], reason: '大きく上昇' },
    { kind: 'signal', q: '前回1on1から1か月以上経過（39日）', reason: '1on1未実施期間' },
    { kind: 'signal', q: '日報提出率が低下（92% → 71%）', reason: '日報提出率の低下', src: 'collab' },
  ],
  survey: [
    { q: '仕事内容満足度', desc: '現在の業務内容に満足していますか？', prev: 5, cur: 3, hist: [4, 4, 5, 5, 3] },
    { q: '人事評価満足度', desc: '会社からの、あなたに対する評価に満足していますか？', prev: 3, cur: 4, hist: [3, 3, 3, 3, 4] },
    { q: '自身へのマネジメント', desc: '上司の自身に対するマネジメントに満足していますか？', prev: 3, cur: 5, hist: [3, 4, 3, 3, 5] },
    { q: 'モチベーション', desc: '現在のモチベーションは？', prev: 3, cur: 3, hist: [3, 3, 3, 3, 3] },
    { q: '現場環境満足度', desc: '現在参画している現場の環境には満足していますか？', prev: 5, cur: 5, hist: [5, 5, 5, 5, 5] },
    { q: '自己成長満足度', desc: '自身の成長を実感することができていますか？', prev: 3, cur: 3, hist: [3, 3, 3, 3, 3] },
    { q: '帰属満足度', desc: '会社に対して、帰属意識を持つことができていますか？', prev: 4, cur: 4, hist: [4, 4, 4, 4, 4] },
    { q: 'やりがい', desc: 'やりがいを感じて日々仕事に取り組んでいますか？', prev: 4, cur: 4, hist: [4, 4, 4, 4, 4] },
  ],
  comment: '6月は特に大きな課題はありません。次の目標について相談したいです。',
  commentPrev: '5月は特に大きな課題はありません。次の目標について相談したいです。',
  record: { date: '2026/05/15', method: '対面 / 個別', report: '5月の1on1で目標進捗と困りごとをヒアリング。次回までの小さな改善アクションを合意。', memo: '特記事項なし。前回から大きな変化は見られない。' },
  thread: { author: '2部 課長', time: '2026/06/18 10:20', body: '案件切り替え後の負荷は落ち着いてきているようですね。次回は優先順位の整理と、資格学習の時間確保について確認するようにしてください。' },
};

// ── 塗りつきスパークライン（訴求力の核） ──
function AreaSpark({ data, color, w = 84, h = 30, id }) {
  const pad = 3;
  const min = Math.min(...data), max = Math.max(...data), range = (max - min) || 1;
  const pts = data.map((v, i) => {
    const x = pad + (i / (data.length - 1)) * (w - 2 * pad);
    const y = (h - pad) - ((v - min) / range) * (h - 2 * pad);
    return [x, y];
  });
  const line = pts.map((p) => `${p[0].toFixed(1)},${p[1].toFixed(1)}`).join(' ');
  const area = `${pad},${h - pad} ${line} ${(w - pad).toFixed(1)},${h - pad}`;
  const last = pts[pts.length - 1];
  const gid = `as-${id}`;
  return (
    <svg width={w} height={h} viewBox={`0 0 ${w} ${h}`} style={{ display: 'block', overflow: 'visible' }}>
      <defs>
        <linearGradient id={gid} x1="0" y1="0" x2="0" y2="1">
          <stop offset="0%" stopColor={color} stopOpacity="0.22" />
          <stop offset="100%" stopColor={color} stopOpacity="0" />
        </linearGradient>
      </defs>
      <polygon points={area} fill={`url(#${gid})`} />
      <polyline points={line} fill="none" stroke={color} strokeWidth="2" strokeLinejoin="round" strokeLinecap="round" />
      <circle cx={last[0]} cy={last[1]} r="3" fill={color} />
      <circle cx={last[0]} cy={last[1]} r="5.5" fill={color} opacity="0.16" />
    </svg>
  );
}
// ── スコアリング（円形ゲージ） ──
function ScoreRing({ score, max = 5, size = 92, color = P.ink, track = P.line, dark = false }) {
  const sw = 7, r = (size - sw) / 2, c = size / 2;
  const circ = 2 * Math.PI * r;
  const frac = Math.min(1, score / max);
  return (
    <div style={{ position: 'relative', width: size, height: size, flexShrink: 0 }}>
      <svg width={size} height={size} style={{ transform: 'rotate(-90deg)' }}>
        <circle cx={c} cy={c} r={r} fill="none" stroke={track} strokeWidth={sw} />
        <circle cx={c} cy={c} r={r} fill="none" stroke={color} strokeWidth={sw} strokeLinecap="round"
          strokeDasharray={`${(circ * frac).toFixed(1)} ${circ.toFixed(1)}`} />
      </svg>
      <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
        <span className="tnum" style={{ fontSize: 25, fontWeight: 800, lineHeight: 1, color: dark ? '#fff' : P.ink }}>{score}</span>
        <span className="tnum" style={{ fontSize: 10, fontWeight: 600, color: dark ? 'rgba(255,255,255,.55)' : P.ghost, marginTop: 3 }}>/ {max}.0</span>
      </div>
    </div>
  );
}
function DeltaChip({ delta, dark = false }) {
  if (delta === 0) return <span className="tnum" style={{ fontSize: 11.5, fontWeight: 700, color: dark ? 'rgba(255,255,255,.6)' : P.ghost }}>±0</span>;
  const up = delta > 0;
  const c = up ? P.up : P.down, bg = up ? P.upBg : P.downBg;
  return (
    <span className="tnum" style={{ display: 'inline-flex', alignItems: 'center', gap: 3, fontSize: 11.5, fontWeight: 800, color: dark ? '#fff' : c, background: dark ? 'rgba(255,255,255,.14)' : bg, borderRadius: 999, padding: '3px 9px', whiteSpace: 'nowrap' }}>
      {up ? '↑' : '↓'} {up ? '+' : '−'}{Math.abs(delta)}
    </span>
  );
}
function SecLabel4({ children, right, tick = false }) {
  return (
    <div style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 12, marginBottom: 18 }}>
      <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>
        {tick && <span style={{ width: 14, height: 3, borderRadius: 2, background: P.ink, transform: 'translateY(-1px)' }} />}
        <span style={{ fontSize: 12.5, fontWeight: 700, color: P.faint, letterSpacing: '.12em' }}>{children}</span>
      </span>
      {right}
    </div>
  );
}

// ── 確認ポイント：淡い色面カード（訴求力の主投下先） ──
function CheckCard({ item, idx }) {
  const toneMap = { down: { c: P.down, bg: P.downBg, ln: P.downLine }, up: { c: P.up, bg: P.upBg, ln: P.upLine }, warn: { c: P.warn, bg: P.warnBg, ln: P.warnLine } };
  const tone = item.reason.includes('低下') && item.kind === 'survey' ? toneMap.down : item.reason.includes('上昇') ? toneMap.up : toneMap.warn;
  if (item.kind === 'signal') {
    return (
      <div style={{ display: 'flex', alignItems: 'center', gap: 13, background: tone.bg, border: `1px solid ${tone.ln}`, borderRadius: 13, padding: '15px 18px' }}>
        <span style={{ color: tone.c, display: 'flex', flexShrink: 0 }}>
          <svg width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round"><circle cx="10" cy="10" r="7.3" /><path d="M10 6v4.4l3 1.8" /></svg>
        </span>
        <span style={{ flex: 1, minWidth: 0, fontSize: 14.5, fontWeight: 700, color: P.ink }}>{item.q}</span>
        {item.src === 'collab' && <span style={{ fontSize: 10, fontWeight: 700, color: P.muted, background: '#fff', border: `1px solid ${tone.ln}`, borderRadius: 5, padding: '2px 7px', letterSpacing: '.04em' }}>collab連携</span>}
        <span style={{ fontSize: 11.5, fontWeight: 800, color: tone.c, letterSpacing: '.03em', whiteSpace: 'nowrap' }}>{item.reason}</span>
      </div>
    );
  }
  const delta = item.cur - item.prev;
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 18, background: tone.bg, border: `1px solid ${tone.ln}`, borderRadius: 13, padding: '16px 20px' }}>
      <div style={{ flex: 1, minWidth: 0 }}>
        <div style={{ fontSize: 15.5, fontWeight: 800, color: P.ink, letterSpacing: '.01em' }}>{item.q}</div>
        <div style={{ fontSize: 11.5, fontWeight: 800, color: tone.c, letterSpacing: '.03em', marginTop: 5 }}>{item.reason}</div>
      </div>
      <AreaSpark data={item.hist} color={tone.c} w={86} h={32} id={`cp${idx}`} />
      <div style={{ display: 'flex', alignItems: 'baseline', gap: 8, width: 106, justifyContent: 'flex-end' }}>
        <span className="tnum" style={{ fontSize: 14, color: P.faint, fontWeight: 600 }}>{item.prev}</span>
        <span style={{ color: P.faint, fontSize: 12 }}>→</span>
        <span className="tnum" style={{ fontSize: 28, fontWeight: 800, lineHeight: 1, color: tone.c }}>{item.cur}</span>
      </div>
      <div style={{ width: 56, display: 'flex', justifyContent: 'flex-end' }}><DeltaChip delta={delta} /></div>
    </div>
  );
}

// ── アンケート詳細行（v3 と同じ静かなトーン） ──
function SurveyRow4({ s, last, idx }) {
  const delta = s.cur - s.prev;
  const changed = delta !== 0;
  const c = delta < 0 ? P.down : P.up;
  return (
    <div style={{ display: 'grid', gridTemplateColumns: '1fr 90px 96px 60px', gap: 16, alignItems: 'center', padding: '13px 0', borderBottom: last ? 'none' : `1px solid ${P.lineSoft}` }}>
      <div style={{ minWidth: 0 }}>
        <div style={{ fontSize: 13.5, fontWeight: changed ? 700 : 600, color: P.ink }}>{s.q}</div>
        <div style={{ fontSize: 11, color: P.ghost, marginTop: 2, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{s.desc}</div>
      </div>
      <span style={{ display: 'flex', justifyContent: 'center' }}>
        {changed ? <AreaSpark data={s.hist} color={c} w={72} h={22} id={`sv${idx}`} /> : <window.Sparkline data={s.hist} color={P.ghost} w={72} h={20} dot={false} />}
      </span>
      <span style={{ display: 'flex', alignItems: 'baseline', justifyContent: 'flex-end', gap: 7 }}>
        <span className="tnum" style={{ fontSize: 12, color: P.ghost }}>{s.prev}</span>
        <span style={{ color: P.ghost, fontSize: 11 }}>→</span>
        <span className="tnum" style={{ fontSize: 16, fontWeight: 800, color: changed ? P.ink : P.muted }}>{s.cur}</span>
      </span>
      <span style={{ display: 'flex', justifyContent: 'flex-end' }}><DeltaChip delta={delta} /></span>
    </div>
  );
}

// ── 下部（根拠レイヤー）：両案共通 ──
function LowerSections() {
  const changed = Q.survey.filter((s) => s.cur !== s.prev);
  const flat = Q.survey.filter((s) => s.cur === s.prev);
  return (
    <>
      <div style={{ padding: '28px 36px' }}>
        <SecLabel4 tick>本人コメント</SecLabel4>
        <p style={{ margin: 0, fontSize: 15.5, lineHeight: 1.9, color: P.ink, letterSpacing: '.01em' }}>{Q.comment}</p>
        <details style={{ marginTop: 14 }}>
          <summary className="tlnk" style={{ fontSize: 12.5, display: 'inline-block' }}>前回のコメントを見る</summary>
          <p style={{ margin: '12px 0 0', fontSize: 13, lineHeight: 1.8, color: P.muted }}>{Q.commentPrev}</p>
        </details>
      </div>
      <div style={{ padding: '0 36px' }}><div style={{ height: 1, background: P.line }} /></div>
      <div style={{ padding: '28px 36px' }}>
        <SecLabel4 tick right={<span className="tnum" style={{ fontSize: 12, color: P.ghost }}>{Q.record.date} ・ {Q.record.method}</span>}>前回1on1記録</SecLabel4>
        <p style={{ margin: 0, fontSize: 13.5, lineHeight: 1.8, color: P.ink2 }}>{Q.record.report}</p>
        <div style={{ display: 'flex', gap: 12, marginTop: 16, paddingTop: 14, borderTop: `1px dashed ${P.line}` }}>
          <span style={{ display: 'inline-flex', alignItems: 'center', gap: 5, fontSize: 11.5, fontWeight: 700, color: P.faint, flexShrink: 0 }}><Icon.lock width="12" height="12" /> 自分用メモ</span>
          <p style={{ margin: 0, fontSize: 13, lineHeight: 1.75, color: P.muted }}>{Q.record.memo}</p>
        </div>
      </div>
      <div style={{ padding: '0 36px' }}><div style={{ height: 1, background: P.line }} /></div>
      <div style={{ padding: '28px 36px' }}>
        <SecLabel4 tick right={<button className="tlnk" style={{ fontSize: 12 }}>過去回答一覧</button>}>アンケート詳細</SecLabel4>
        <div style={{ fontSize: 11.5, fontWeight: 700, color: P.muted, marginBottom: 2 }}>変化あり <span className="tnum" style={{ color: P.ghost, fontWeight: 600 }}>{changed.length}</span></div>
        {changed.map((s, i) => <SurveyRow4 key={i} s={s} idx={i} last={i === changed.length - 1} />)}
        <details style={{ marginTop: 16 }}>
          <summary className="tlnk" style={{ fontSize: 12, display: 'inline-block' }}>変化なし {flat.length}件を表示</summary>
          <div style={{ marginTop: 6 }}>
            {flat.map((s, i) => <SurveyRow4 key={i} s={s} idx={`f${i}`} last={i === flat.length - 1} />)}
          </div>
        </details>
      </div>
      <div style={{ padding: '0 36px' }}><div style={{ height: 1, background: P.line }} /></div>
      <div style={{ padding: '28px 36px 32px' }}>
        <SecLabel4 tick>コメント・共有</SecLabel4>
        <div style={{ display: 'flex', gap: 12 }}>
          <Face size={34} />
          <div style={{ flex: 1, minWidth: 0 }}>
            <div style={{ display: 'flex', alignItems: 'baseline', gap: 10 }}>
              <span style={{ fontSize: 13.5, fontWeight: 700, color: P.ink }}>{Q.thread.author}</span>
              <span className="tnum" style={{ fontSize: 11.5, color: P.ghost }}>{Q.thread.time}</span>
            </div>
            <p style={{ margin: '6px 0 0', fontSize: 13.5, lineHeight: 1.8, color: P.ink2 }}>{Q.thread.body}</p>
          </div>
        </div>
        <div style={{ display: 'flex', gap: 10, marginTop: 20 }}>
          <input className="fin" placeholder="コメントを入力..." />
          <button className="act" style={{ padding: '0 22px', fontSize: 13, flexShrink: 0 }}>投稿</button>
        </div>
      </div>
    </>
  );
}
function FootLinks() {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 20, padding: '16px 6px 0' }}>
      <button className="tlnk" style={{ fontSize: 12 }}>業務情報を見る</button>
      <button className="tlnk" style={{ fontSize: 12 }}>資格情報を見る</button>
      <span style={{ marginLeft: 'auto', fontSize: 11, color: P.ghost }}>「collab連携」の項目は会社設定でON時のみ表示</span>
    </div>
  );
}
function CheckSection({ inset = true }) {
  return (
    <div style={{ background: inset ? P.inset : 'transparent', borderTop: `1px solid ${P.line}`, borderBottom: `1px solid ${P.line}`, padding: '24px 36px 26px' }}>
      <SecLabel4 right={<span style={{ fontSize: 11, color: P.ghost }}>ルールベースで自動抽出</span>}>今回の確認ポイント</SecLabel4>
      <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
        {Q.checkpoints.map((c, i) => <CheckCard key={i} item={c} idx={i} />)}
      </div>
    </div>
  );
}

// ═══ 案A ソフトトーン ═══
function ScreenV4A() {
  return (
    <div className="v4">
      <AppFrame>
        <PageBar />
        <div style={{ maxWidth: 812, margin: '0 auto' }}>
          <div style={{ background: P.paper, borderRadius: 18, border: `1px solid ${P.line}`, boxShadow: '0 1px 2px rgba(18,22,30,.04), 0 14px 34px -22px rgba(18,22,30,.18)', overflow: 'hidden' }}>
            {/* ヘッダー：状態連動の淡い色面（要確認=温かい生成り） */}
            <div style={{ background: 'linear-gradient(160deg, #faf4e3 0%, #fbf8ef 42%, #ffffff 100%)', padding: '28px 36px 26px' }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
                <Face size={52} />
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ display: 'flex', alignItems: 'center', gap: 11, flexWrap: 'wrap' }}>
                    <span style={{ fontSize: 22, fontWeight: 800, color: P.ink, letterSpacing: '.01em' }}>{Q.member.name}</span>
                    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 7, background: '#fff', border: `1px solid ${P.warnLine}`, borderRadius: 999, padding: '5px 13px', fontSize: 13, fontWeight: 800, color: P.warn }}>
                      <span style={{ width: 7, height: 7, borderRadius: 7, background: P.warn }} />{Q.status.label}
                    </span>
                  </div>
                  <div style={{ fontSize: 12.5, color: P.muted, marginTop: 5 }}>{Q.member.dept} ・ {Q.member.role} ・ 勤続 {Q.member.tenure}<span className="tnum" style={{ color: P.faint }}>　対象期間 {Q.period}</span></div>
                </div>
                <div style={{ display: 'flex', gap: 8, flexShrink: 0 }}>
                  <button className="quiet" style={{ padding: '10px 15px', fontSize: 12.5, background: '#fff' }}>プロフィール詳細</button>
                  <button className="act" style={{ padding: '10px 18px', fontSize: 13 }}>実施記録を登録</button>
                </div>
              </div>
              <div style={{ display: 'flex', alignItems: 'center', gap: 28, marginTop: 22 }}>
                <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
                  <ScoreRing score={Q.summary.score} color={P.warn} track="#efe6cc" size={86} />
                  <div>
                    <div style={{ fontSize: 11, fontWeight: 700, color: P.faint, letterSpacing: '.1em' }}>総合スコア</div>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 6 }}>
                      <DeltaChip delta={Q.summary.delta} />
                      <AreaSpark data={Q.summary.trend} color={P.warn} w={64} h={22} id="hero" />
                    </div>
                  </div>
                </div>
                <div style={{ width: 1, alignSelf: 'stretch', background: 'rgba(154,112,24,.16)' }} />
                <div>
                  <div style={{ fontSize: 11, fontWeight: 700, color: P.faint, letterSpacing: '.1em' }}>前回1on1</div>
                  <div className="tnum" style={{ fontSize: 18, fontWeight: 800, color: P.ink, marginTop: 6 }}>{Q.last.date}</div>
                  <div style={{ fontSize: 11.5, fontWeight: 700, color: P.warn, marginTop: 3 }}>{Q.last.daysAgo}日前 — 未実施期間が長め</div>
                </div>
                <div style={{ marginLeft: 'auto', alignSelf: 'flex-end', fontSize: 11.5, color: P.muted, textAlign: 'right' }}>{Q.status.note}</div>
              </div>
            </div>
            <CheckSection inset={false} />
            <LowerSections />
          </div>
          <FootLinks />
        </div>
      </AppFrame>
    </div>
  );
}

// ═══ 案B コントラスト（ダークヘッダー） ═══
function ScreenV4B() {
  return (
    <div className="v4">
      <AppFrame>
        <PageBar />
        <div style={{ maxWidth: 812, margin: '0 auto' }}>
          <div style={{ background: P.paper, borderRadius: 18, border: `1px solid ${P.line}`, boxShadow: '0 1px 2px rgba(18,22,30,.04), 0 14px 34px -22px rgba(18,22,30,.18)', overflow: 'hidden' }}>
            {/* ダークヘッダー */}
            <div style={{ background: `linear-gradient(150deg, ${P.navySoft} 0%, ${P.navy} 55%)`, padding: '28px 36px 26px', color: '#fff' }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
                <Face size={52} />
                <div style={{ flex: 1, minWidth: 0 }}>
                  <div style={{ display: 'flex', alignItems: 'center', gap: 11, flexWrap: 'wrap' }}>
                    <span style={{ fontSize: 22, fontWeight: 800, letterSpacing: '.01em' }}>{Q.member.name}</span>
                    <span style={{ display: 'inline-flex', alignItems: 'center', gap: 7, background: 'rgba(240,200,90,.16)', border: '1px solid rgba(240,200,90,.35)', borderRadius: 999, padding: '5px 13px', fontSize: 13, fontWeight: 800, color: '#f0cf74' }}>
                      <span style={{ width: 7, height: 7, borderRadius: 7, background: '#f0cf74' }} />{Q.status.label}
                    </span>
                  </div>
                  <div style={{ fontSize: 12.5, color: 'rgba(255,255,255,.62)', marginTop: 5 }}>{Q.member.dept} ・ {Q.member.role} ・ 勤続 {Q.member.tenure}<span className="tnum" style={{ color: 'rgba(255,255,255,.42)' }}>　対象期間 {Q.period}</span></div>
                </div>
                <div style={{ display: 'flex', gap: 8, flexShrink: 0 }}>
                  <button className="quietw" style={{ padding: '10px 15px', fontSize: 12.5 }}>プロフィール詳細</button>
                  <button className="actw" style={{ padding: '10px 18px', fontSize: 13 }}>実施記録を登録</button>
                </div>
              </div>
              <div style={{ display: 'flex', alignItems: 'center', gap: 28, marginTop: 22 }}>
                <div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
                  <ScoreRing score={Q.summary.score} color="#f0cf74" track="rgba(255,255,255,.14)" size={86} dark />
                  <div>
                    <div style={{ fontSize: 11, fontWeight: 700, color: 'rgba(255,255,255,.5)', letterSpacing: '.1em' }}>総合スコア</div>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginTop: 6 }}>
                      <DeltaChip delta={Q.summary.delta} dark />
                      <AreaSpark data={Q.summary.trend} color="#f0cf74" w={64} h={22} id="herob" />
                    </div>
                  </div>
                </div>
                <div style={{ width: 1, alignSelf: 'stretch', background: 'rgba(255,255,255,.14)' }} />
                <div>
                  <div style={{ fontSize: 11, fontWeight: 700, color: 'rgba(255,255,255,.5)', letterSpacing: '.1em' }}>前回1on1</div>
                  <div className="tnum" style={{ fontSize: 18, fontWeight: 800, marginTop: 6 }}>{Q.last.date}</div>
                  <div style={{ fontSize: 11.5, fontWeight: 700, color: '#f0cf74', marginTop: 3 }}>{Q.last.daysAgo}日前 — 未実施期間が長め</div>
                </div>
                <div style={{ marginLeft: 'auto', alignSelf: 'flex-end', fontSize: 11.5, color: 'rgba(255,255,255,.55)', textAlign: 'right' }}>{Q.status.note}</div>
              </div>
            </div>
            <CheckSection inset />
            <LowerSections />
          </div>
          <FootLinks />
        </div>
      </AppFrame>
    </div>
  );
}

Object.assign(window, { ScreenV4A, ScreenV4B, V4: { P, Q, AreaSpark, ScoreRing, DeltaChip, SecLabel4, CheckCard, CheckSection, LowerSections, FootLinks } });
