/*
 * カラートークン（2026-08-04 整理）
 * ブランド4色 Navy / Teal / Orange / White に、白背景で本文4.5:1を満たす
 * 濃色版を1つずつ足しただけの構成にする。用途は下のコメントを守ること。
 *   --teal / --orange   … 図形専用（バー・マーカー・スウォッチ）。文字色に使わない
 *   --teal-ink / --orange-ink … 文字、および白文字を乗せる塗り。いずれも4.5:1以上
 */
:root {
  --navy: #1f2645;
  --teal: #00a699;
  --teal-ink: #06776e;
  --orange: #f27300;
  --orange-ink: #c2410c;
  --ink: #101828;
  --strong: #344054;
  --muted: #5b6472;
  --line: #e4e9f1;
  --soft: #f5f8fb;
  --white: #fff;
  --shadow: 0 8px 24px rgba(31, 38, 69, .07);
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

/* ブランド色のフォーカスリング。UA既定の青より視認性が高く、配色とも揃う */
:focus-visible {
  outline: 3px solid var(--teal-ink);
  outline-offset: 2px;
}

button, input, select, textarea { font: inherit; }

button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--teal-ink);
  color: var(--white);
  padding: 11px 20px;
  cursor: pointer;
  font-weight: 800;
  transition: background .18s ease;
}

button:hover:not(:disabled) {
  background: var(--navy);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/*
 * 「まだ進めない」状態。disabled とは別物なので注意。
 *
 * disabled にすると click が発火せず、なぜ進めないのかを伝える経路ごと消える
 * （2026-08-04 検証で、確認ステップの「どこが未回答か」が永久に出ない死にコード
 *  になっていたのを検出）。押せる状態のまま見た目だけ控えめにして、
 * 押されたら validateCurrentStep(true) が理由を出す。
 */
button.not-ready {
  opacity: .55;
}

button.secondary {
  background: var(--soft);
  color: var(--strong);
  border-color: var(--line);
}

button.secondary:hover:not(:disabled) {
  background: var(--line);
  color: var(--navy);
}

button.ghost {
  background: var(--white);
  color: var(--navy);
  border-color: var(--line);
}

button.ghost:hover:not(:disabled) {
  background: var(--soft);
  color: var(--navy);
}

button.small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}

a.header-link {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  padding: 8px 14px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.hidden { display: none !important; }

.site-header {
  background: var(--navy);
  color: var(--white);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--teal);
  color: var(--navy);
  font-weight: 900;
}

.brand strong, .brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 2px;
  color: #c8d0e0;
  font-size: 11px;
}

/* 回答ステップ中は事務局向けの但し書きを出さない。
   21問に答えている最中ずっと「選定されている」と表示され続けるのを避ける。 */
body[data-screen="wizard"] .brand span {
  display: none;
}

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 20px 56px;
}

.intro-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  align-items: start;
}

.intro-copy, .intro-panel, .wizard-card, .stepper, .result-hero, .result-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.intro-copy {
  padding: 44px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1, h2, h3, p { letter-spacing: 0; }

.intro-copy h1 {
  max-width: 760px;
  margin: 0;
  color: var(--navy);
  font-size: 42px;
  line-height: 1.16;
}

.lead {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.intro-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.resume-note {
  margin: 14px 0 0;
  color: var(--teal-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.intro-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.time-card {
  padding: 20px;
  color: var(--white);
  background: var(--navy);
  border-radius: var(--radius);
}

.time-card span {
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.time-card strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
}

.time-card p {
  margin: 6px 0 0;
  color: var(--white);
  font-size: 13px;
  line-height: 1.6;
}

.axis-list {
  display: grid;
  gap: 8px;
}

.axis-list div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--soft);
  border-radius: var(--radius);
}

.axis-list b {
  display: grid;
  flex: none;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--teal-ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
}

.axis-list span {
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
}

.wizard-screen {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 20px;
}

.stepper {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 18px;
}

.step-status span {
  color: var(--teal-ink);
  font-size: 12px;
  font-weight: 900;
}

.step-status strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 18px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  margin: 14px 0;
  background: var(--line);
  border-radius: 999px;
}

.progress-track div {
  width: 0;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
  transition: width .25s ease;
}

#steps {
  display: grid;
  gap: 2px;
}

/* button 要素なので、共通ボタンの塗り・高さ・影を明示的に打ち消す */
.step-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.step-link span {
  display: grid;
  flex: none;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  font-size: 11px;
}

/*
 * `button:hover:not(:disabled) { background: var(--navy) }`（56行目）は詳細度 (0,2,1)。
 * `.step-link:hover` は (0,2,0) なので負け、ホバー中だけ navy 背景 + navy 文字＝
 * コントラスト 1.00:1 でステップ名が消えていた（2026-08-04 実測・全幅で再現）。
 * ステップナビを <a> から <button> へ変えた時に、汎用 button のホバーを拾ってしまったもの。
 * `:not(:disabled)` を付けて詳細度を (0,3,0) に上げ、確実に上書きする。
 */
.step-link:hover:not(:disabled) {
  background: var(--soft);
  color: var(--navy);
}

/* 回答済みのステップ。戻って直せることを色でも示す */
.step-link.done span {
  color: var(--white);
  background: var(--teal-ink);
}

.step-link.active {
  color: var(--navy);
  background: var(--soft);
  border-color: var(--teal);
}

.step-link.active span {
  color: var(--white);
  background: var(--teal-ink);
}

.wizard-card {
  min-height: 640px;
  padding: 28px;
}

.step-head {
  margin-bottom: 24px;
}

.step-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.2;
}

.step-head p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.fields {
  display: grid;
  gap: 16px;
}

.fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--strong);
  font-size: 13px;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
}

textarea {
  min-height: 140px;
  line-height: 1.6;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 166, 153, .14);
}

.question-list {
  display: grid;
  gap: 18px;
}

.question {
  padding: 0;
  border: 0;
}

.question-title {
  display: block;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.55;
}

/*
 * 選択肢は広い画面では横5列に置く。
 * 縦積みだと1設問で約320px、1ステップ約960px（約1.1画面）になり、
 * 7ステップ続くと設問文を読まなくなる（2026-08-04 コトハ監査 高-5 の実測）。
 * 横並びなら1設問が約110pxに収まり、3設問が1画面に入る。
 * 900px以下は横幅が足りないので従来どおり縦積みへ戻す。
 */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

/*
 * 優先順位（1〜3位）。同じ領域を2回選べないことが設問の要なので、
 * 選択済みの領域は他の順位で option[disabled] になる（app.js syncPriorityOptions）。
 */
.priority-grid {
  display: grid;
  gap: 12px;
}

.priority-slot {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.priority-rank {
  display: grid;
  place-items: center;
  padding: 8px 0;
  color: var(--white);
  background: var(--teal-ink);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 900;
}

.priority-slot select {
  min-width: 0;
  width: 100%;
}

.priority-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

/*
 * ラジオは position:absolute で隠しているが、.choice-card に位置指定が無いと
 * 包含ブロックが初期包含ブロックになり、input{width:100%} がビューポート幅で
 * 効いてページが横スクロールする（2026-08-04 致命バグ）。必ず relative を保つ。
 */
.choice-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  gap: 6px;
  align-content: start;
  padding: 10px 8px;
  min-height: 76px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

/* 「わからない」は採点対象外。他の4段階と地続きに見せない */
.choice-card.unscored {
  border-style: dashed;
  background: var(--soft);
}

.choice-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-score {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--strong);
  background: var(--soft);
  border-radius: var(--radius);
  font-weight: 900;
}

.choice-card span:last-child {
  color: var(--strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* 新規テキスト要素。色は必ず ink 版（白背景で 4.5:1 以上）を使う */
.step-why {
  margin: 10px 0 0;
  padding: 12px 14px;
  color: var(--strong);
  background: var(--soft);
  border-left: 4px solid var(--teal-ink);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.7;
}

.step-note {
  margin: 0 0 18px;
  padding: 11px 14px;
  color: var(--strong);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.7;
}

.term-note {
  margin: 14px 0 0;
  color: var(--strong);
  font-size: 12px;
  line-height: 1.7;
}

.progress-detail {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-required {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  color: var(--orange-ink);
  background: rgba(242, 115, 0, .12);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.confirm-unknown {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.choice-card:hover {
  border-color: var(--teal);
  background: var(--soft);
}

.choice-card:has(input:checked) {
  border-color: var(--teal-ink);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--teal-ink);
}

.choice-card:has(input:checked) .choice-score {
  color: var(--white);
  background: var(--teal-ink);
}

/* キーボード操作時はカード自体にリングを出す（input本体は1pxで見えないため） */
.choice-card:has(input:focus-visible) {
  outline: 3px solid var(--teal-ink);
  outline-offset: 2px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.validation-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--orange-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.7;
}

/*
 * 送信中。押しても何も起きないように見えると、申込者は連打する。
 * 二重送信そのものは next() の submitting ガードで止めているが、
 * 「押した」ことが見た目に出ないと不安が残る。
 */
button.submitting {
  opacity: .7;
  cursor: progress;
}

/* 送信前の確認事項。修正できないことは、押す前に読める位置に出す（設計書 §4.2） */
.confirm-caution {
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--strong);
  font-size: 13px;
  line-height: 1.8;
}

/*
 * 自動投稿の確認欄。Managed + interaction-only なので通常は高さ0のまま。
 * 確認が必要になった時だけウィジェットが現れるので、その時に
 * 送信ボタンの近くで見えるよう、隙間だけ空けておく。
 */
.turnstile-slot:not(:empty) {
  margin-top: 20px;
}

/* 入力例を表示中であることを、送信前に必ず気づく位置で知らせる */
.sample-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--orange);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--orange-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
}

.confirm-summary {
  display: grid;
  gap: 14px;
}

.confirm-box {
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.confirm-box h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 15px;
}

.confirm-box p {
  margin: 4px 0;
  color: var(--strong);
  font-size: 13px;
  line-height: 1.55;
}

.confirm-box p strong {
  color: var(--navy);
}

.result-screen {
  display: grid;
  gap: 20px;
}

.result-hero {
  padding: 34px;
}

.result-hero h2 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  line-height: 1.2;
}

.result-hero p:last-of-type {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.result-panel {
  padding: 22px;
}

.result-panel h3 {
  margin: 0 0 14px;
  color: var(--navy);
}

.domain-bars {
  display: grid;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

ul, ol {
  margin: 0;
  padding-left: 20px;
  color: var(--strong);
  line-height: 1.75;
}

li + li { margin-top: 6px; }

.complete-card {
  max-width: 760px;
  margin: 0 auto;
}

.complete-summary {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.complete-summary div {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 8px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.complete-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.complete-summary strong {
  color: var(--navy);
  min-width: 0;
  overflow-wrap: anywhere;
}

/*
 * 受付番号。この画面が申込者にとって唯一の控えになるので、
 * スクリーンショット・印刷でも読み違えない大きさと字間で出す。
 * 見間違えやすい 0/O/1/I/L は採番側（shared/schema.js）で除いてある。
 */
.complete-summary strong.complete-receipt {
  font-family: "Inter", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .18em;
}

.complete-note {
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--strong);
  font-size: 13px;
  line-height: 1.8;
}

/*
 * 訂正の連絡先（設計書 §4.2）。
 *
 * 送信後、申込者は自分で内容を直せない。**連絡先が無いと訂正の手段が無くなる**ので、
 * 受付番号のすぐ下に、番号と結びつけて置く。
 */
.complete-contact {
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--strong);
  font-size: 13px;
  line-height: 1.8;
}

/*
 * メールアドレスは長い（30字近い）。狭い画面で枠を押し広げないよう、
 * **途中でも折り返せる**ようにする。`min-width:0` と併せて、
 * 375px でも横スクロールを出さない（2026-08-12 に数値で確認）。
 */
.contact-link {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  color: var(--navy);
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--teal);
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 20px 56px;
}

.admin-hero,
.admin-metrics article,
.submission-list-panel,
.admin-detail,
.detail-head,
.score-strip article,
.empty-state,
.empty-list {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 28px;
}

.admin-hero h1 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  line-height: 1.2;
}

.admin-hero p:last-child {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions.inline {
  margin-top: 12px;
}

/* ステータス選択と、その結果（採択確定の記録）を縦に並べる */
.status-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.decide-notice {
  margin: 0;
  max-width: 320px;
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.decide-notice:empty {
  display: none;
}

.decide-notice.done {
  color: #0f766e;
}

/* 確定記録だけ失敗した状態は見逃されると監査で困る。赤で残す */
.decide-notice.error {
  color: #b91c1c;
  font-weight: 600;
}

/* 誰として見ているか。操作履歴に残る名前なので、常に視界に置く（設計書 §5.2） */
.viewer-email {
  flex-basis: 100%;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted, #64748b);
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.admin-metrics article {
  padding: 20px;
}

.admin-metrics span,
.score-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-metrics strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 34px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.submission-list-panel {
  align-self: start;
  padding: 16px;
}

.list-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.submission-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
}

.submission-item {
  display: grid;
  width: 100%;
  min-height: auto;
  justify-items: start;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

/* .step-link と同じ理由で :not(:disabled) が要る。無いと一覧カードが
   ホバー中だけ navy 一色に潰れ、法人名も判定も読めなくなる（2026-08-04 実測） */
.submission-item:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--teal);
}

.submission-item.active {
  background: var(--soft);
  border-color: var(--teal-ink);
  box-shadow: inset 0 0 0 1px var(--teal-ink);
}

.submission-item span {
  color: var(--muted);
  font-size: 11px;
}

.submission-item strong {
  min-width: 0;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.submission-item small {
  min-width: 0;
  color: var(--muted);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.admin-detail {
  min-height: 0;
  padding: 18px;
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 16px;
  align-items: center;
  padding: 20px;
  box-shadow: none;
}

.detail-head > div {
  min-width: 0;
}

.detail-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 26px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.detail-head p {
  overflow-wrap: anywhere;
}

.detail-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.detail-head select {
  width: auto;
  min-width: 150px;
  max-width: 100%;
}

.score-strip {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.score-strip article {
  padding: 18px;
  box-shadow: none;
}

.score-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 28px;
  line-height: 1.1;
}

.score-strip small {
  color: var(--muted);
  font-size: 14px;
}

.admin-panel {
  box-shadow: none;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.panel-title-row h3 {
  margin: 0;
}

.score-legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.score-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.score-legend i {
  display: inline-block;
  flex: none;
}

.score-legend .legend-current {
  width: 16px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
}

.score-legend .legend-priority {
  width: 16px;
  height: 8px;
  border-radius: 999px;
  background: var(--orange);
}

.domain-comparison {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.domain-comparison:first-child {
  border-top: 0;
  padding-top: 0;
}

/* 固定px列は使わない。桁数が変わっても列が破綻しないよう可変列にする */
.domain-comparison-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: baseline;
}

.domain-comparison-head .domain-label {
  min-width: 0;
  color: var(--strong);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.domain-figures {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-self: end;
  gap: 4px 8px;
  min-width: 0;
}

.domain-figures > * {
  white-space: nowrap;
}

.domain-figures .figure {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.domain-figures .figure-value {
  font-size: 16px;
  font-weight: 900;
}

/* バー・マーカーは --teal / --orange のまま。文字は必ず ink 版を使う（4.5:1以上） */
.figure-current .figure-value {
  color: var(--teal-ink);
}

/*
 * 優先順位バッジ。スコアバーとは別系統の情報（本人の意思）なので、
 * バーの色（teal）ではなく orange 系で、文字は必ず ink 版を使う。
 */
.priority-chip {
  padding: 3px 9px;
  color: var(--orange-ink);
  background: rgba(242, 115, 0, .12);
  border: 1px solid rgba(242, 115, 0, .38);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.priority-chip.none {
  color: var(--muted);
  background: var(--soft);
  border-color: var(--line);
  font-weight: 700;
}

/* 「わからない」は採点対象外なので、スコアの数字とは別系統の弱い表示にする */
.figure-unknown {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* 判定不能（全問わからない）の領域はバーを描かず、空トラックで見せる */
.comparison-track.unrated {
  background: repeating-linear-gradient(135deg, var(--line) 0 6px, var(--soft) 6px 12px);
}

/* 旧形式レコードだけに出る、当時の理想スコアの控え表示 */
.figure-legacy {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.comparison-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

/* 現実バーは凡例と1:1で対応させるため全領域teal単色 */
.comparison-fill {
  position: relative;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

/*
 * 回答形式に関する注意書き（旧形式・優先順位不足・読取不能）。
 * 事務局が「なぜズレが出ていないのか」を必ず読める位置に置く。
 */
.schema-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  color: var(--strong);
  background: rgba(242, 115, 0, .10);
  border: 1px solid rgba(242, 115, 0, .34);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.schema-notice.broken {
  background: var(--soft);
  border-color: var(--line);
}

/* 重複候補・入力例と同一。採点の話ではなく「人が確認すること」なので色を分ける */
.schema-notice.screening {
  background: rgba(37, 99, 235, .08);
  border-color: rgba(37, 99, 235, .30);
  font-weight: 600;
}

/* 一覧の注意バッジ */
.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0;
}

.record-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.7;
}

.record-badge.dup {
  color: #1d4ed8;
  background: rgba(37, 99, 235, .12);
}

/* 過去の回答は「最新を見てから判断する」ので、目立たせすぎない */
.record-badge.dup.past {
  color: var(--muted, #64748b);
  background: rgba(100, 116, 139, .14);
}

.record-badge.sample {
  color: #b45309;
  background: rgba(242, 115, 0, .16);
}

/* いま何を隠しているかの説明。既定で入力例を除外しているので必ず見せる */
.list-note {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted, #64748b);
}

.list-note:empty {
  display: none;
}

/* 優先順位と現実スコアのズレ */
.gap-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gap-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--strong);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.gap-item.warn { border-left-color: var(--orange-ink); }
.gap-item.info { border-left-color: var(--navy); }
.gap-item.ok { border-left-color: var(--teal-ink); }

.gap-tag {
  white-space: nowrap;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.gap-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}

/*
 * スコア帯に文字列（領域名・審査判定。いずれも最長13文字）が入る枠。
 * 数値と同じ巨大サイズだと折り返せない。
 * padding-inline-end は行末に来る全角の閉じ括弧「）」のはみ出し対策
 * （「判定不能（全問わからない）」で 1440px 時に 9px はみ出す / 2026-08-04 境界値検証）。
 */
.score-strip .strip-text {
  padding-inline-end: 10px;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}


.admin-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.result-panel p {
  color: var(--strong);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/*
 * 面談論点は <ol><li>。p と同じ折り返しが要る。
 *
 * さらに padding-inline-end が要る。行末に来た全角の閉じ括弧「）」は、
 * グリフの右半分が空白なぶんだけ Chrome が行外へはみ出させるため、
 * 520px で scrollWidth が clientWidth を 8px 超える
 * （2026-08-04 幅スイープで検出）。
 * overflow-wrap / word-break / line-break のどれでも消えない。box-sizing:border-box
 * なので、8px の内側余白を与えると、はみ出しぶんが箱の中に収まる。
 * overflow:hidden で隠すのは不可（文字が実際に切れる）。
 */
.result-panel ol,
.result-panel li {
  overflow-wrap: anywhere;
}

.result-panel li {
  padding-inline-end: 8px;
  color: var(--strong);
  line-height: 1.7;
}

.memo-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.raw-answer-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.raw-answer-grid > section {
  min-width: 0;
}

.raw-answer-grid h4 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 15px;
}

.raw-answer-list {
  display: grid;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

/* 長い法人名・メール・英数字の連続でも列を押し広げないよう min-width:0 を必ず置く。
   これが無いと1件の長文が列幅を決め、隣のカラムへ文字が重なる（2026-08-04 致命バグ） */
.raw-answer-list div,
.question-answer-list div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.raw-answer-list dt,
.question-answer-list span {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.raw-answer-list dt {
  overflow-wrap: anywhere;
}

.raw-answer-list dd {
  margin: 0;
  min-width: 0;
  color: var(--strong);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 審査では21問すべてを読む。入れ子スクロールにすると窓(560px)に3100pxが入り、
   印刷でも切れるため、ページの流れの中に展開する（2026-08-04 指摘） */
.question-answer-list {
  display: grid;
  gap: 8px;
}

.question-answer-list p {
  margin: 0 0 6px;
  min-width: 0;
  color: var(--strong);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.question-answer-list span {
  overflow-wrap: anywhere;
}

.question-answer-list strong {
  min-width: 0;
  color: var(--teal-ink);
  overflow-wrap: anywhere;
}

.empty-state,
.empty-list {
  padding: 28px;
  color: var(--muted);
  box-shadow: none;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--navy);
}

@media (max-width: 900px) {
  .app-shell { padding: 24px 12px 40px; }
  .intro-screen, .wizard-screen, .admin-layout, .admin-two-col, .score-strip, .raw-answer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  /* 「1位」ラベルを上に逃がす。横並びのままだと selectの実幅が
     280px以下になり、領域名（最長13文字）が省略される */
  .priority-slot { grid-template-columns: minmax(0, 1fr); }
  .priority-rank { justify-self: start; padding: 6px 16px; }
  .intro-copy { padding: 26px; }
  .intro-copy h1, .result-hero h2 { font-size: 30px; }
  .stepper { position: static; }
  .wizard-card { padding: 22px 16px; min-height: auto; }
  .fields.two { grid-template-columns: minmax(0, 1fr); }
  /* 横5列は幅が足りない。縦積みに戻し、番号と文言を左右に並べる */
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .choice-card {
    grid-template-rows: none;
    grid-template-columns: 32px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    min-height: 48px;
    text-align: left;
    gap: 10px;
  }
  .choice-card small { margin-top: 1px; }
  .panel-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .domain-comparison-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .domain-figures {
    justify-self: start;
  }
  .admin-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-metrics { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }
  .intro-actions, .result-actions, .wizard-actions, .admin-actions {
    flex-direction: column;
  }
  button { width: 100%; }
  .step-head h2 { font-size: 25px; }
  .choice-card { padding: 10px; }
  .detail-head select { width: 100%; }
}

@media print {
  body {
    background: var(--white);
  }
  .site-header,
  .submission-list-panel,
  .admin-actions,
  .list-tools,
  a.header-link,
  .detail-head select {
    display: none;
  }
  .admin-shell {
    max-width: none;
    padding: 0;
  }
  .admin-layout,
  .admin-two-col,
  .raw-answer-grid {
    display: block;
  }
  .admin-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0;
  }
  .score-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .score-strip article,
  .admin-metrics article {
    padding: 10px;
  }
  .score-strip strong,
  .admin-metrics strong {
    font-size: 18px;
  }
  /* 入れ子スクロールを解除しないと、21問中5問しか印刷されない（2026-08-04 指摘） */
  .question-answer-list,
  .submission-list {
    max-height: none;
    overflow: visible;
  }
  /*
   * break-inside: avoid は「1ページに収まりうる小さな塊」だけに付ける。
   * .admin-detail や .result-panel のような数千pxの箱に付けると、
   * 収まらないぶんが丸ごと次ページへ送られ、各ページに大きな空白ができる。
   */
  .domain-comparison,
  .score-strip article,
  .admin-metrics article,
  .raw-answer-list div,
  .question-answer-list div,
  .detail-head {
    break-inside: avoid;
  }
  .admin-detail,
  .result-panel,
  .admin-hero,
  .detail-head,
  .score-strip article,
  .admin-metrics article {
    box-shadow: none;
  }
  .admin-detail {
    padding: 0;
    border: 0;
  }
  .result-panel {
    padding: 12px 0;
    border-width: 1px 0 0;
    border-radius: 0;
  }
  .admin-two-col > article,
  .raw-answer-grid > section {
    margin-bottom: 10px;
  }
  h3 { break-after: avoid; }
}

/* 未保存のメモがあることの表示。再読み込みや他の操作を挟んでも消えない */
.memo-dirty {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
}

/* メモの競合。どちらを残すか決めるまで保存を止める（敵対的レビュー2巡目 P1） */
.memo-conflict {
  margin-top: 12px;
  padding: 14px;
  background: rgba(242, 115, 0, .08);
  border: 1px solid rgba(242, 115, 0, .34);
  border-radius: var(--radius);
}

.memo-conflict p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--strong);
}

.memo-conflict-label {
  font-weight: 700;
}

.memo-conflict-remote {
  max-height: 200px;
  overflow: auto;
  margin: 0 0 10px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ *
 * 基本情報の代理修正（設計書 §4.2）
 * ------------------------------------------------------------------ */

.panel-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.75;
}

.panel-note strong {
  color: var(--strong);
}

/* 2列。長い法人名・メールで列が押し広がらないよう min-width:0 を必ず置く
   （.raw-answer-list と同じ理由。2026-08-04 の致命バグの再発防止） */
.basic-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.basic-field {
  min-width: 0;
  font-size: 12px;
}

.basic-field input,
.basic-field select {
  min-height: 42px;
}

/* 触った項目を見て分かるようにする。保存前にどこを直したか目で追えないと、
   6項目のうち意図しない1つを直したことに気づけない */
.basic-field.dirty input,
.basic-field.dirty select {
  border-color: rgba(242, 115, 0, .55);
  background: rgba(242, 115, 0, .05);
}

.basic-error {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
  color: #b42318;
}

/* 文言が無い時は行ごと消す（.decide-notice と同じ扱い）。
   空の <p> が残ると、変更が無いのに余白だけ空いて見える */
.basic-error:empty,
.memo-dirty:empty {
  display: none;
}

@media (max-width: 720px) {
  .basic-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 印刷では代理修正の入力欄を出さない。審査の紙に編集フォームは要らない */
@media print {
  .basic-fields,
  .basic-error,
  .memo-dirty {
    display: none;
  }
}

/* 代理修正の競合。どちらを残すか決めるまで保存を止める（2026-08-10 codexレビュー P1） */
.basic-conflict-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.basic-conflict-list div {
  min-width: 0;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.basic-conflict-list dt {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.basic-conflict-list dd {
  margin: 0 0 4px;
  min-width: 0;
  color: var(--strong);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.basic-conflict-list dd:last-child {
  margin-bottom: 0;
}

.basic-conflict-list .memo-conflict-label {
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}

/* ------------------------------------------------------------------ *
 * ブラウザ標準の印刷（Cmd/Ctrl+P・メニュー）では中身を出さない
 * （設計書 §5.2 / 2026-08-10 敵対的レビュー high 7巡目）
 *
 * 持ち出しは「記録してから実行する」が原則。ところが標準印刷は
 * 画面の「印刷」ボタンを通らないので、`/api/disclosures` への記録も、
 * 採点ロジックの版の確認も走らない。**履歴の残らない持ち出しができる。**
 *
 * そこで、アプリ内の「印刷」ボタンから印刷する時だけ body に print-allowed を付ける。
 * 付いていない印刷は案内だけを出す。afterprint（と保険のタイマー）で外す。
 * ------------------------------------------------------------------ */
@media print {
  /*
   * **管理画面だけ。** styles.css は申込フォームと共用しているので、body で受けると
   * 申込者の完了画面（受付番号の控え。印刷できる唯一の控え）まで消える
   * （2026-08-10 codexレビュー P2）。
   */
  body.admin-page:not(.print-allowed) > * {
    display: none !important;
  }

  body.admin-page:not(.print-allowed)::after {
    content: "この画面は、画面内の「印刷」ボタンからのみ印刷できます。誰が何を持ち出したかを記録してから印刷する決まりのためです（設計書 §5.2）。お手数ですが、画面右上の「印刷」を押してください。";
    display: block;
    padding: 48px 40px;
    color: #1f2937;
    font-size: 14px;
    line-height: 2;
  }
}
