/* SCS評価制度 自己評価確認ツール */
:root {
  --ink: #1b2433;
  --muted: #5d6b7e;
  --line: #d9e1ea;
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --navy: #1b4f78;
  --navy-dark: #123854;
  --navy-soft: #e7f0f7;
  --cyan: #16a6b6;
  /* オレンジの網掛け = 記入部分(Excelと同じ色合い) */
  --input-bg: #fbe5d6;
  --input-line: #f0a875;
  --input-focus: #ed7d31;
  /* チェック結果の色 */
  --ok: #1f8a4c;      --ok-bg: #dcf3e4;
  --warn: #9a7400;    --warn-bg: #fff2b8;  --warn-line: #e5b800;
  --ng: #b8500c;      --ng-bg: #ffd9b8;    --ng-line: #ed7d31;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo UI", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #1b6fd1; outline-offset: 2px; }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
small { font-size: 0.85em; }

/* ---------- ヘッダー ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 10px 24px; background: var(--navy-dark); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 8px; background: var(--cyan); color: #04323a; font-weight: 800; letter-spacing: 0.06em; }
.brand-mark.big { min-width: 64px; height: 64px; font-size: 1.3rem; border-radius: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text span { font-size: 0.8rem; opacity: 0.8; }
.org { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.org-name { font-weight: 700; overflow-wrap: anywhere; }
.org-fy { font-size: 0.85rem; opacity: 0.85; }
.updated { margin-left: auto; font-size: 0.88rem; opacity: 0.95; }
.head-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.app-header .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.app-header .btn:hover { background: rgba(255, 255, 255, 0.14); }
.app-header .btn.primary { background: var(--cyan); border-color: var(--cyan); color: #04323a; }
.app-header .btn.primary:hover { background: #22bccd; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 6px 16px;
  border: 1px solid #9fb2c6; border-radius: 8px; background: #fff; color: var(--ink);
  font-weight: 600; text-decoration: none; line-height: 1.3;
}
.btn:hover:not(:disabled) { background: var(--navy-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.small { min-height: 34px; padding: 3px 12px; font-size: 0.88rem; }
.btn.large { min-height: 52px; padding: 10px 28px; font-size: 1.05rem; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #256a9f; }
.btn.accent { background: #fff7e8; border-color: var(--input-focus); color: #7a3a07; }
.btn.accent:hover:not(:disabled) { background: #ffe9c9; }
.btn.ghost { background: transparent; }
.btn.danger { color: #a3202c; border-color: #d99aa1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- レイアウト ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 20px 120px; }
.wrap.narrow { max-width: 720px; padding-top: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.page-title { margin-bottom: 16px; }
.page-title h1 { font-size: 1.6rem; line-height: 1.4; margin: 4px 0 6px; }
.chip { display: inline-block; padding: 1px 12px; border-radius: 999px; background: var(--navy-soft); color: var(--navy); font-weight: 700; font-size: 0.85rem; }
.eyebrow { color: var(--muted); font-weight: 700; font-size: 0.9rem; }

/* ---------- スタート ---------- */
.start-card h1 { font-size: 1.9rem; line-height: 1.3; }
.start-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.lead { color: var(--muted); margin-bottom: 20px; }
.foot-note { color: var(--muted); font-size: 0.85rem; text-align: center; margin-top: 20px; }
.resume-card h2 { font-size: 1.15rem; margin-bottom: 6px; }
.resume-info { margin-bottom: 4px; }
.form-error { color: #a3202c; font-weight: 700; min-height: 1.6em; }
.req-mark { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #fde4e4; color: #a3202c; font-size: 0.72rem; font-weight: 700; vertical-align: 1px; }

/* ---------- 入力欄(オレンジの網掛け) ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 4px; font-weight: 700; font-size: 0.95rem; }
.field label small { font-weight: 400; color: var(--muted); }
.field small { display: block; color: var(--muted); }
input.orange, textarea.orange, select.orange {
  display: block; width: 100%; padding: 9px 12px;
  background: var(--input-bg); border: 2px solid var(--input-line); border-radius: 8px;
}
textarea.orange { resize: vertical; line-height: 1.6; }
input.orange:focus, textarea.orange:focus, select.orange:focus { border-color: var(--input-focus); background: #fff3ea; }
input.orange:disabled, textarea.orange:disabled, select.orange:disabled { background: #f1ece8; border-color: #ddd2ca; color: #5b5651; cursor: not-allowed; }
.check-label { display: flex !important; align-items: center; gap: 8px; cursor: pointer; }
.check-label input { width: 22px; height: 22px; accent-color: var(--input-focus); }

/* ---------- チェック結果の色 ---------- */
.lv-ok textarea.orange, .lv-ok select.orange, .field.lv-ok textarea.orange { border-color: var(--ok); background: var(--ok-bg); }
.lv-warn textarea.orange, .lv-warn select.orange { border-color: var(--warn-line); background: var(--warn-bg); }
.lv-ng textarea.orange, .lv-ng select.orange { border-color: var(--ng-line); background: var(--ng-bg); border-width: 3px; }
.row-card.lv-ok { border-left: 6px solid var(--ok); }
.row-card.lv-warn { border-left: 6px solid var(--warn-line); }
.row-card.lv-ng { border-left: 6px solid var(--ng-line); }
.level-chip { display: inline-block; padding: 1px 12px; border-radius: 999px; font-weight: 800; font-size: 0.85rem; border: 2px solid; white-space: nowrap; }
.level-chip.level-ok { background: var(--ok-bg); border-color: var(--ok); color: #0f5a2f; }
.level-chip.level-warn { background: var(--warn-bg); border-color: var(--warn-line); color: #6b4f00; }
.level-chip.level-ng { background: var(--ng-bg); border-color: var(--ng-line); color: #8a3b00; }
.check-result { margin-top: 8px; padding: 10px 14px; border-radius: 8px; border: 1px solid; }
.check-result.level-ok { background: #effaf3; border-color: #9bd6b0; }
.check-result.level-warn { background: #fffbe3; border-color: #ecd36a; }
.check-result.level-ng { background: #fff0e0; border-color: #f2b27c; }
.check-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.check-result ul { margin: 0; padding: 0; list-style: none; }
.check-result li { display: flex; gap: 8px; padding: 3px 0; font-size: 0.93rem; }
.sev-icon { flex: none; width: 1.4em; text-align: center; font-weight: 800; }
.sev-err .sev-icon { color: #b8500c; }
.sev-warn .sev-icon { color: #9a7400; }
.sev-info .sev-icon { color: #3a6ea5; }
.sev-ok .sev-icon { color: var(--ok); }
.stale { color: #a3202c; font-weight: 700; font-size: 0.85rem; }
.stale-live { display: none; }
body.check-stale .stale-live { display: inline; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; margin-bottom: 14px; border-radius: 8px; border: 1px solid; font-weight: 600; }
.banner.level-ok { background: #effaf3; border-color: #9bd6b0; }
.banner.level-warn { background: #fffbe3; border-color: #ecd36a; }
.banner.level-ng { background: #fff0e0; border-color: #f2b27c; }
.state-line { margin-bottom: 12px; color: var(--muted); }
.saved-chip, .editing-chip { display: inline-block; padding: 0 10px; border-radius: 999px; font-weight: 700; font-size: 0.82rem; }
.saved-chip { background: #dcebfa; color: #124a82; }
.editing-chip { background: var(--input-bg); color: #8a3b00; }

/* ---------- 共通質問 ---------- */
.qcard.na { opacity: 0.7; }
.qhead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.qno { flex: none; min-width: 64px; padding: 0 10px; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 700; text-align: center; }
.qtext { font-weight: 700; }
.guide { margin: 6px 0 12px; border: 1px dashed var(--line); border-radius: 8px; padding: 6px 12px; background: #fafcfe; }
.guide summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.guide p { margin-top: 6px; font-size: 0.93rem; color: #38465a; }

/* ---------- コース選択 ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.course-card h2 { font-size: 1.3rem; margin-bottom: 4px; }
.big-count { margin: 12px 0 6px; } .big-count span { font-size: 2.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
progress { width: 100%; height: 12px; accent-color: var(--navy); }
progress.wide { height: 16px; margin: 8px 0 10px; }
.course-card .btn { margin-top: 14px; width: 100%; }

/* ---------- 評価基準ページ ---------- */
.page-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 14px; }
.page-nav progress { flex: 1 1 140px; max-width: 320px; }
.page-count { font-size: 1.1rem; }
.jump select { min-height: 38px; padding: 4px 10px; border: 1px solid #9fb2c6; border-radius: 8px; background: #fff; max-width: 220px; }
.crit-head { border-top: 5px solid var(--navy); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--muted); font-size: 0.9rem; }
.crumbs b { color: var(--navy); }
.crumbs .sep { color: #9fb2c6; }
.req { margin: 8px 0 12px; }
.crit-main { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--navy-soft); border-radius: 8px; }
.stage { flex: none; padding: 0 12px; border-radius: 6px; font-weight: 800; color: #fff; }
.stage-3 { background: #2a7d8c; } .stage-4 { background: #6f3ca6; }
.crit-no { flex: none; font-weight: 800; color: var(--navy); }
.crit-text { font-weight: 600; }
.crit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.tag { display: inline-block; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 0.85rem; }
.part-title { font-size: 1.05rem; margin: 22px 0 10px; padding-left: 10px; border-left: 5px solid var(--input-focus); }
.row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.block h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 2px; }
.block.q { margin: 6px 0 8px; padding: 10px 14px; background: #f3f8fc; border-left: 4px solid var(--cyan); border-radius: 6px; }
.block.q h3 { color: #0f6672; }
.inputs { display: grid; grid-template-columns: 1.1fr 1.6fr 1fr; gap: 14px; align-items: start; padding-top: 10px; border-top: 1px dashed var(--line); }
.noq { margin-bottom: 8px; }
.evi-card h3 { font-size: 1rem; margin-bottom: 6px; }
.cat-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.cat-badge { display: inline-block; padding: 1px 12px; border-radius: 6px; font-weight: 700; font-size: 0.9rem; color: #fff; }
.cat-1 { background: #1b4f78; } .cat-2 { background: #2a7d8c; } .cat-3 { background: #6f3ca6; }
.cat-4 { background: #a8620a; } .cat-5 { background: #8a3a55; } .cat-6 { background: #5d6b7e; }
.qual { display: inline-block; padding: 0 10px; border-radius: 6px; background: #fff2b8; color: #6b4f00; font-weight: 700; font-size: 0.88rem; }
.evi-guide { margin-bottom: 10px; padding: 8px 12px; background: #f6f8fa; border-radius: 6px; font-size: 0.93rem; }

/* ---------- 操作バー ---------- */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(20, 40, 70, 0.08); backdrop-filter: blur(4px); }
.action-inner { max-width: 1040px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.spacer { flex: 1 1 auto; }
.file-note { font-size: 0.8rem; color: var(--muted); line-height: 1.4; max-width: 100%; }
.file-note code { overflow-wrap: anywhere; }

/* ---------- 解説ダイアログ ---------- */
dialog { max-width: min(760px, 94vw); width: 100%; padding: 0; border: none; border-radius: 12px; box-shadow: 0 18px 60px rgba(10, 20, 40, 0.4); }
dialog::backdrop { background: rgba(14, 26, 44, 0.55); }
.dlg-box { padding: 20px 24px 24px; max-height: 84vh; overflow: auto; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.dlg-head h2 { font-size: 1.2rem; }
.dlg-body h4 { margin: 14px 0 4px; padding-left: 8px; border-left: 4px solid var(--cyan); font-size: 0.98rem; }
.dlg-body p { margin: 2px 0; font-size: 0.94rem; overflow-wrap: anywhere; }
.dlg-body p.sub { padding-left: 1.2em; }

/* ---------- 最終ページ ---------- */
.tabs { display: flex; gap: 6px; margin-top: 8px; }
.tab { padding: 6px 20px; border: 1px solid #9fb2c6; border-radius: 8px 8px 0 0; background: #fff; font-weight: 700; }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.score { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.score-num { font-size: 3.2rem; font-weight: 800; color: var(--ok); line-height: 1; }
.score-den { font-size: 1.6rem; font-weight: 700; }
.score-label { color: var(--muted); }
.stat-list { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 0; padding: 0; list-style: none; }
.small-note { margin-top: 10px; font-size: 0.82rem; }
.status-chip { display: inline-block; padding: 0 10px; border-radius: 999px; font-weight: 700; font-size: 0.82rem; border: 1px solid; white-space: nowrap; }
.st-ok { background: var(--ok-bg); border-color: var(--ok); color: #0f5a2f; }
.st-ng { background: var(--ng-bg); border-color: var(--ng-line); color: #8a3b00; }
.st-taigai { background: #e8ebef; border-color: #aab3bf; color: #3d4756; }
.st-partial { background: #e2eefb; border-color: #8fb4de; color: #1b4f78; }
.st-empty { background: #fff; border-color: #c4ccd6; color: #5d6b7e; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chipbtn { padding: 3px 14px; border: 1px solid #9fb2c6; border-radius: 999px; background: #fff; font-size: 0.88rem; font-weight: 600; }
.chipbtn.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.list th, .list td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.list th { background: #f0f4f8; position: sticky; top: 0; white-space: nowrap; }
.list td.no, .list td.key { white-space: nowrap; font-weight: 700; color: var(--navy); }
.list td.crit { min-width: 240px; }
.decl summary { cursor: pointer; }
.decl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 18px; margin-top: 14px; }

/* ---------- トースト ---------- */
.toast { position: fixed; left: 50%; bottom: 84px; z-index: 60; transform: translate(-50%, 20px); max-width: 90vw; padding: 10px 20px; border-radius: 8px; background: #1b2433; color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #14633a; } .toast.err, .toast.ng { background: #a3202c; } .toast.warn { background: #7a5c00; }

@media (max-width: 900px) { .app-header { position: static; } }
@media (max-width: 760px) {
  .app-header { padding: 8px 12px; }
  .updated { margin-left: 0; }
  .wrap { padding: 16px 12px 130px; }
  .row-grid, .inputs { grid-template-columns: 1fr; }
  .crit-main { flex-wrap: wrap; }
  .action-inner { padding: 8px 12px; }
  .btn.large { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .toast { transition: none; } }
@media print { .app-header, .action-bar, .toast { display: none; } .wrap { padding-bottom: 0; } }
