/* パラレル・テキスト メーカー — English Hub デザインシステム準拠（docs/design-system.md）
 * 画面・印刷（A4）・投影の3つをこのファイルにまとめる。 */
:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface-alt: #f0ede8;
  --line: #e2ddd8;
  --ink: #1a1714;
  --muted: #6b645c;
  --accent: #2d6a4f;
  --accent-hover: #1f5238;
  --accent-light: #52b788;
  --accent-dim: #d8f3dc;
  --tag: #edf6f0;
  --warn: #8a5a0d;
  --warn-bg: #fff4dc;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-en: "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "SF Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.65; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ヘッダー（ポータルへ戻る導線） */
.app-header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo-mark { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; }
.crumb-sep { color: var(--line); }
.crumb { color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap; }
.crumb-app { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.page-title { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 800; margin: 4px 0 8px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--accent); }
.lead { color: var(--muted); max-width: 820px; margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.foot { margin-top: 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.step { padding: 16px 20px; margin-bottom: 16px; }
.step > summary { cursor: pointer; font-size: 1.08rem; font-weight: 700; display: flex; align-items: center; gap: 10px; list-style: none; }
.step > summary::-webkit-details-marker { display: none; }
.step > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: 14px; }
.step:not([open]) > summary::after { content: "▸"; }
.step-body { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; flex-shrink: 0; }
.step-state:empty { display: none; }
.step-state { font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 999px; background: var(--accent-dim); color: var(--accent-hover); }
.step-state.todo { background: var(--surface-alt); color: var(--muted); }
.sub-h { font-size: 15px; font-weight: 700; margin-top: 6px; }
details.sub { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: #fbfaf8; }
details.sub > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.sub[open] > * + * { margin-top: 10px; }
.howto { margin: 0; padding-left: 20px; font-size: 14px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.nowrap { flex-wrap: nowrap; }
.row.end { justify-content: flex-end; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid-num { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf8; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.req, .opt { margin-left: 6px; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; }
.req { background: var(--danger-bg); color: var(--danger); }
.opt { background: var(--surface-alt); color: var(--muted); }
.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; font-size: 15px; }
.input:focus { outline: none; border-color: var(--accent-light); box-shadow: 0 0 0 3px rgba(82,183,136,.18); }
textarea.input { resize: vertical; }
.mono { font-family: var(--mono); font-size: 13px; }
.row .input { width: auto; min-width: 64px; flex: 1 1 64px; }
.hint { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.hint.strong { color: var(--accent-hover); font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; text-align: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: #fff; border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-light); color: var(--accent); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.file-btn input { display: none; }

.notice { padding: 10px 12px; border-radius: 8px; font-size: 14px; background: var(--tag); color: var(--accent-hover); margin-bottom: 12px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.error { background: var(--danger-bg); color: var(--danger); }
.step-body .notice { margin-bottom: 0; }
.summary { display: flex; flex-direction: column; gap: 6px; }
.summary:empty { display: none; }

.stats { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; padding: 8px 12px; background: var(--tag); border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; font-family: var(--font-en); }
.chip:hover { border-color: var(--accent-light); color: var(--accent); }
.chip.used { background: var(--accent-dim); border-color: var(--accent-light); cursor: default; }
.chip .n { color: var(--muted); font-size: 11px; margin-left: 4px; }

.checklist { display: flex; flex-direction: column; gap: 6px; }
.checklist .item { display: flex; gap: 8px; font-size: 13.5px; align-items: baseline; }
.checklist .mark { font-weight: 800; width: 1.2em; flex-shrink: 0; }
.checklist .ok .mark { color: var(--accent); }
.checklist .ng { color: var(--danger); }
.checklist .fix { display: block; color: var(--ink); font-size: 12.5px; }

.prompt-view { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; background: #fbfaf8; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; margin: 0; }
.prompt-view .hit { background: var(--danger-bg); color: var(--danger); outline: 1px solid var(--danger); font-weight: 700; }
.prompt-view .pn { text-decoration: underline wavy var(--warn); }
.guard:empty { display: none; }
.guard { font-size: 13px; }

/* 点検 */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; align-items: center; }
.mk-target { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--accent); }
.mk-outside { text-decoration: underline wavy var(--danger); text-underline-offset: 3px; }
.mk-infl { text-decoration: underline dotted var(--muted); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.mk-match { background: #e6e1f5; box-shadow: 0 0 0 1px #c9bfe8; }
.mk-target.mk-outside { text-decoration: underline; }
.lv { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.lv-pass { background: var(--accent-dim); color: var(--accent-hover); }
.lv-fail { background: var(--danger-bg); color: var(--danger); }
.lv-warn { background: var(--warn-bg); color: var(--warn); }
.lv-skip { background: var(--surface-alt); color: var(--muted); }
.lv-exc { background: var(--warn-bg); color: var(--danger); }
.set-checks { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.set-checks .line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { background: #fbfaf8; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; color: var(--muted); }
.table th small { display: block; font-weight: 400; font-size: 10.5px; }
.table td { padding: 6px 8px; border-bottom: 1px solid #f0ede8; vertical-align: top; }
.table td.rid, .table td.rst { font-weight: 800; white-space: nowrap; }
.added-known:empty { display: none; }
.added-known { font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.text-cards { display: flex; flex-direction: column; gap: 14px; }
.tcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tcard.st-adopted { border-color: var(--accent-light); box-shadow: inset 4px 0 0 var(--accent-light); }
.tcard.st-rejected { opacity: .65; }
.tcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tcard-head .tid { font-weight: 800; font-size: 16px; }
.tcard-head .ttitle { font-weight: 700; font-family: var(--font-en); }
.tcard-head .meta { font-size: 12px; color: var(--muted); }
.tcard-head .grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 12px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { color: var(--muted); cursor: not-allowed; background: #f7f6f3; }
.body-view { white-space: pre-wrap; font-family: var(--font-en); font-size: 15px; line-height: 1.9; padding: 10px 12px; background: #fbfaf8; border-radius: 8px; border: 1px solid var(--line); }
.qs { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.qs .q { padding: 6px 10px; border-left: 3px solid var(--line); }
.qs .q.bad { border-left-color: var(--danger); }
.qs .q b { font-family: var(--font); }
.qs .en { font-family: var(--font-en); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; font-size: 12.5px; }
.facts > div { background: #fbfaf8; border-radius: 8px; padding: 8px 10px; }
.facts b { display: block; font-size: 12px; color: var(--muted); }
.exc { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 8px; background: var(--warn-bg); font-size: 13px; }
.card-inner { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: #fff; }

/* 承認 */
.tts-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf8; align-items: end; }
.tts-panel .hint { grid-column: 1 / -1; }
.approval-cards { display: flex; flex-direction: column; gap: 14px; }
.acard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.acard.done { border-color: var(--accent-light); box-shadow: inset 4px 0 0 var(--accent-light); }
.sent { border-radius: 4px; transition: background .15s; }
.sent.now { background: #fff3b0; box-shadow: 0 0 0 2px #fff3b0; }
.approve-items { display: flex; flex-direction: column; gap: 6px; }
.approve-items .check { align-items: flex-start; }
.approve-items .check input { margin-top: 3px; flex-shrink: 0; }
.approve-who { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }

/* 出力 */
.usage-list { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.usage-list .u { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 6px 10px; background: #fbfaf8; border-radius: 8px; }
.usage-list .u input[type=date] { width: auto; min-height: 32px; padding: 2px 8px; }
#output-summary ul { margin: 4px 0 0; padding-left: 20px; font-size: 13.5px; }

/* 手修正 */
.editor { width: min(860px, 96vw); max-height: 92vh; border: 1px solid var(--line); border-radius: 12px; padding: 0; }
.editor::backdrop { background: rgba(26,23,20,.45); }
.editor form { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.editor h2 { font-size: 17px; }
.ed-q { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; margin-bottom: 8px; }

.toast { position: fixed; right: 16px; bottom: 16px; z-index: 200; padding: 12px 16px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; max-width: min(440px, calc(100vw - 32px)); }
.toast.error { background: var(--danger); }

/* ================= 投影・聞き読みモード ================= */
.projector { position: fixed; inset: 0; z-index: 300; background: #fff; color: #111; display: flex; flex-direction: column; }
.proj-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; background: #f3f1ed; border-bottom: 1px solid var(--line); font-size: 13px; }
.pbtn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.pbtn:hover { border-color: var(--accent-light); }
.pj-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.pj-label { font-weight: 700; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-rate select { padding: 2px 4px; }
.proj-stage { flex: 1; overflow: auto; padding: 4vh 6vw; }
.proj-text { font-family: var(--font-en); font-size: var(--pj-fs, 32px); line-height: 1.75; max-width: 1400px; margin: 0 auto; }
.proj-text h2 { font-size: 1.1em; margin-bottom: .6em; }
.proj-text p { margin: 0 0 .8em; }
.proj-text .pj-q { font-size: .8em; margin-top: 1em; border-top: 2px solid #ddd; padding-top: .6em; }

/* ================= 印刷（A4） ================= */
.print-area { display: none; }
.sheet { width: 210mm; min-height: 297mm; padding: 15mm 16mm 14mm; background: #fff; color: #000; font-size: 10.5pt; line-height: 1.5; }
.sheet [lang="en"], .sheet .en { font-family: var(--font-en); }
.s-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; border-bottom: 0.6mm solid #000; padding-bottom: 2mm; margin-bottom: 5mm; }
.s-head .brand { font-size: 8pt; font-weight: 700; letter-spacing: .08em; }
.s-head h1 { font-size: 15pt; font-weight: 800; line-height: 1.25; }
.idline { font-size: 10pt; white-space: nowrap; }
.idline span { display: inline-block; border-bottom: 0.3mm solid #000; min-width: 14mm; margin: 0 1mm; }
.idline span.name { min-width: 45mm; }
.passage { break-inside: avoid; page-break-inside: avoid; font-size: 12pt; line-height: 1.85; }
.passage .para { display: grid; grid-template-columns: 8mm 1fr; margin-bottom: 2.5mm; }
.passage .pno { font-weight: 700; font-size: 10pt; padding-top: 0.6mm; }
.passage p { text-align: left; }
.questions { margin-top: 6mm; display: flex; flex-direction: column; gap: 4mm; break-inside: avoid; }
.questions .sq { break-inside: avoid; }
.questions .sq-text { font-size: 11pt; }
.questions .line { height: 8mm; border-bottom: 0.25mm solid #000; }
.t-sheet { font-size: 9.5pt; line-height: 1.5; }
.t-meta { font-size: 8.5pt; display: flex; flex-wrap: wrap; gap: 2mm 6mm; margin-bottom: 3mm; }
.t-sec { margin-top: 3.5mm; break-inside: avoid; }
.t-sec h2 { font-size: 10.5pt; border-bottom: 0.3mm solid #000; margin-bottom: 1.5mm; }
.t-body .para { margin-bottom: 1.5mm; }
.t-body .sno { white-space: nowrap; font-size: 7.5pt; font-weight: 700; vertical-align: super; margin: 0 0.6mm 0 1.2mm; }
.t-body .pno { font-weight: 800; margin-right: 1.5mm; }
.t-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.t-table td, .t-table th { border: 0.2mm solid #000; padding: 0.8mm 1.5mm; text-align: left; vertical-align: top; }
.t-q { margin-bottom: 2mm; }
.t-q .ev { font-style: italic; }

@media (max-width: 640px) {
  .app-header { padding: 0 12px; }
  .crumb, .crumb-sep:nth-of-type(2) { display: none; }
  .step { padding: 14px 14px; }
  .grid-form, .grid-num { grid-template-columns: 1fr; }
  .row.nowrap { flex-wrap: wrap; }
  .tcard, .acard, .card-inner { padding: 12px; }
  .proj-text { font-size: var(--pj-fs, 26px); }
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff; }
  .no-print, .app-header, .wrap, .toast, .projector, .editor { display: none !important; }
  .print-area { display: block; }
  .sheet { margin: 0; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .sheet, .sheet * { color: #000 !important; background: transparent !important; box-shadow: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
