:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --line: #d8dee4;
  --accent: #1f6feb;
  --defect: #d91f1f;
  --review: #f28c00;
  --minor: #3373e6;      /* 重要度の色は画面遷移図・画面一覧 5.3 のとおり：赤・橙・青・緑・灰 */
  --caution: #1a994d;
  --reference: #808080;
  --match: #8c59cc;      /* 一致（照合済み）。ハイライト PDF の証跡枠と同じ紫 */
  --ok: #1a994d;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif; font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top {
  display: flex; align-items: center; gap: 8px 24px; padding: 10px 20px; flex-wrap: wrap;
  background: #24292f; color: #fff;
}
header.top .brand, header.top nav a, header.top .who a, header.top .who button { white-space: nowrap; }
header.top .brand { font-weight: 700; }
header.top nav a { color: #fff; margin-right: 16px; }
header.top .who { margin-left: auto; display: flex; gap: 12px; align-items: center; }
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.muted { color: var(--muted); }
.error { color: var(--defect); }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); }
table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
table.list th { background: #eef1f4; font-weight: 600; white-space: nowrap; }
button, .button {
  display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 6px 14px; font: inherit; cursor: pointer; color: var(--text);
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=password], select, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; color: #fff; white-space: nowrap; }
.sev-不備候補 { background: var(--defect); }
.sev-要確認 { background: var(--review); }
.sev-軽微 { background: var(--minor); }
.sev-注意 { background: var(--caution); }
.sev-参考 { background: var(--reference); }
.status { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eef1f4; }
.status-done { background: #fff4e5; }
.status-completed { background: #e6f6ec; }
.status-failed { background: #fde8e8; color: var(--defect); }
.login { max-width: 360px; margin: 80px auto; }

/* S05〜S07 結果画面 */
.result { display: grid; grid-template-columns: minmax(0, 3fr) minmax(380px, 2fr); gap: 16px; }
.result iframe { width: 100%; height: calc(100vh - 210px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.findings { height: calc(100vh - 210px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.finding { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 6px; padding: 10px; cursor: pointer; }
.finding.active { outline: 2px solid var(--accent); }
.finding.decided { opacity: .7; }
.finding.sev-border-不備候補 { border-left-color: var(--defect); }
.finding.sev-border-要確認 { border-left-color: var(--review); }
.finding.sev-border-軽微 { border-left-color: var(--minor); }
.finding.sev-border-注意 { border-left-color: var(--caution); }
.finding.sev-border-参考 { border-left-color: var(--reference); }
.finding .head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.finding .values { font-size: 13px; margin: 4px 0; word-break: break-all; }
.finding .values span { color: var(--muted); }
.finding .decide { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.finding .decide label { border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 13px; }
.finding .decide input { margin-right: 4px; }
.finding textarea { margin-top: 6px; height: 2.4em; font-size: 13px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.counts span { margin-right: 10px; }
@media (max-width: 1000px) {
  .result { grid-template-columns: 1fr; }
  .result iframe, .findings { height: 60vh; }
}

/* 管理画面 */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.notice { border-color: var(--review); background: #fff8ec; margin-bottom: 12px; }
.notice-error { border-color: var(--defect); background: #fdf0f0; }
code { background: #eef1f4; padding: 1px 6px; border-radius: 4px; font-size: 15px; }

.toolbar select, .toolbar input[type=text] { width: auto; }

/* 見落としの記録 */
.missed { margin-top: 16px; }
.missed table { margin-bottom: 12px; }
.missed-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.missed-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.missed-form label.grow { flex: 1; min-width: 260px; }
.missed-form select, .missed-form input[type=text] { width: auto; }
.missed-form label.grow input { width: 100%; }

/* AI に送るページの選択（D-6） */
.page-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.page-pick { display: flex; flex-direction: column; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 6px; cursor: pointer; font-weight: normal !important; font-size: 12px; width: 140px; }
.page-pick img { max-width: 120px; max-height: 120px; border: 1px solid var(--line); background: #fff; }
.page-pick.blank { opacity: .5; cursor: not-allowed; }
/* 依頼書の入力の誤りの可能性（I-19） */
details.suspicious { margin-top: 4px; font-size: 12px; color: var(--review); }
details.suspicious summary { cursor: pointer; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

/* 指摘のまとめ表示・まとめて採否・拡大表示（I-13） */
details.group { display: flex; flex-direction: column; gap: 8px; }
details.group > summary { cursor: pointer; padding: 6px 4px; list-style-position: inside; }
details.group > .finding { margin-bottom: 8px; }
.bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 8px 4px; font-size: 13px; }
.bulk button { font-size: 12px; padding: 3px 10px; }
.finding .zoom { margin: 6px 0; }
.finding .zoom img { max-width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff; }

/* パイロットの記録（E-2・第6章） */
.pilot { margin-top: 16px; }
.pilot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.pilot-form { display: flex; flex-direction: column; gap: 6px; }
.pilot-form .row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.pilot-form .row label { display: flex; flex-direction: column; font-size: 12px; }
.pilot-form .row input[type=text] { flex: 1; min-width: 180px; width: auto; }
.pilot-form select, .finding .reject-reason, .bulk-reason { width: auto; font-size: 13px; }
.finding .reject-reason { margin-top: 6px; }

/* A05 精度レポート・判定会議 結果票 */
.tablebox { overflow-x: auto; }
table.kpi td, table.kpi th { white-space: nowrap; }
table.kpi tr.section td { background: #eef1f4; font-weight: 600; font-size: 12px; }
td.warn { background: #fde8e8; }
.ok-mark { color: #fff; background: var(--ok); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.ng-mark { color: #fff; background: var(--defect); border-radius: 8px; padding: 0 6px; font-size: 11px; }
@media print {
  header.top, footer, .no-print { display: none !important; }
  main { padding: 0; }
  .sheet { border: none; }
}

details.group.separate { border: 1px dashed var(--line); border-radius: 6px; padding: 4px 6px; background: #fafbfc; }
/* 校正回数と前の校（投入確認） */
.proof-round .row { display: flex; gap: 8px; flex-wrap: wrap; }
.proof-round select { width: auto; max-width: 100%; }
/* 前の校との比較・差し戻し（結果） */
.previous table.list td { vertical-align: top; }
.previous .context { font-family: inherit; word-break: break-all; }
.outcome-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.outcome-form textarea { min-width: 260px; min-height: 2.4em; }
.status-returned { background: #fde2d6; color: #8a2c0d; }
.previous h3 { font-size: 14px; margin: 12px 0 6px; }
.previous tr.change { cursor: pointer; }
/* ダッシュボードの件数・検索（S01） */
.counts-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.count-tile { display: flex; flex-direction: column; min-width: 110px; padding: 8px 14px; text-decoration: none; color: inherit; }
.count-tile strong { font-size: 22px; }
.count-tile.active { outline: 2px solid #2563eb; }
.count-tile.alert strong { color: #b91c1c; }
.toolbar.search { flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.toolbar.search label { display: flex; flex-direction: column; font-size: 12px; }
.toolbar.search input[type=text] { width: 220px; }
/* ファイル投入のドラッグ＆ドロップ（S03） */
.dropzone { display: flex; flex-direction: column; gap: 4px; padding: 22px; margin-bottom: 14px; border: 2px dashed #94a3b8; border-radius: 8px; text-align: center; }
.dropzone.over { border-color: #2563eb; background: #eff6ff; }
/* 画面内通知（ジョブ完了・失敗） */
.notices { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.notice-item { display: block; padding: 8px 12px; border-radius: 6px; background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; text-decoration: none; }
.notice-item.failed { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
