:root {
  --ink: #1d2a24; --muted: #5d6b64; --line: #d9e2dc; --bg: #fbfcfa; --card: #fff;
  --green: #1f5d45; --green-soft: #e7f2ec; --soil: #7a5a3c;
  --ok: #1f6b47; --ok-bg: #e3f3ea; --warn: #8a5a00; --warn-bg: #fff3d6; --ng: #9b2c2c; --ng-bg: #fde8e6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.8; font-size: 16px;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 18px; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--soil); }
/* フォーカス枠は背景と3:1以上（明るい背景にはインク色、緑の帯には白） */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.site-header :focus-visible { outline-color: #fff; }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; background: #fff; color: var(--ink); padding: 8px 12px; border-radius: 6px; }

.preview-banner { background: var(--warn-bg); color: var(--warn); text-align: center; padding: 6px 12px; font-size: 14px; }
.site-header { background: var(--green); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 18px; padding-top: 12px; padding-bottom: 12px; }
.site-header a { color: #fff; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.site-header nav { display: flex; gap: 18px; font-size: 14px; }
.site-header nav a:hover { text-decoration: underline; color: #fff; }
main { padding-top: 22px; padding-bottom: 48px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 20px 0 32px; }

h1 { font-size: 26px; line-height: 1.4; margin: 10px 0 12px; }
h2 { font-size: 20px; line-height: 1.5; margin: 38px 0 12px; padding-left: 12px; border-left: 5px solid var(--green); }
.lead { font-size: 17px; }
.muted { color: var(--muted); font-size: 14px; }
.fine { color: var(--muted); font-size: 13px; margin: 8px 0; }
.crumb { font-size: 13px; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 状態の文言は長くなりうる（年度末後など）。小画面で横にはみ出さないよう折り返す。 */
.badge { display: inline-block; max-width: 100%; padding: 1px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.ng { background: var(--ng-bg); color: var(--ng); }

.status { border: 1px solid var(--line); border-left-width: 6px; border-radius: 8px; padding: 10px 16px; background: var(--card); }
.status.ok { border-left-color: var(--ok); } .status.warn { border-left-color: #d99a00; } .status.ng { border-left-color: var(--ng); }
.status p { margin: 4px 0; }

.calc { background: var(--green-soft); border-radius: 12px; padding: 18px 18px 12px; margin: 26px 0; }
.calc h2 { margin-top: 0; border: 0; padding: 0; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.calc label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; }
.calc select, .calc input { font: inherit; font-size: 16px; font-weight: 400; padding: 9px 10px; border: 1px solid #678073; border-radius: 8px; background: #fff; width: 100%; min-height: 44px; }
.calc select:disabled, .calc input:disabled { background: #eef1ef; color: var(--muted); border-style: dashed; cursor: not-allowed; }
.calc label[hidden] { display: none; }
.calc-out { margin-top: 14px; }
.result { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.result > div { background: #fff; border-radius: 10px; padding: 12px 16px; }
.result-label { display: block; font-size: 13px; color: var(--muted); }
.result-num { display: block; font-size: 30px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--green); }
.msg { border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.msg.warn { background: var(--warn-bg); color: var(--warn); } .msg.ng { background: var(--ng-bg); color: var(--ng); }

.points { padding-left: 1.2em; } .points li { margin: 6px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { display: grid; gap: 4px; justify-items: start; align-content: start; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.card-nopage { background: transparent; border-style: dashed; }
.card-nopage a { font-size: 14px; }
.calc-detail { margin: 10px 0 0; }
.calc-detail a { display: inline-block; padding: 10px 14px; border: 1px solid var(--green); border-radius: 8px; background: var(--card); font-weight: 700; }
.calc-detail a[hidden] { display: none; }
.card:hover { border-color: var(--green); color: var(--ink); }
.card-name { font-weight: 700; font-size: 17px; color: var(--green); }
.card-sub { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
table.narrow { min-width: 0; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--green-soft); white-space: nowrap; font-size: 13px; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { white-space: nowrap; }

.facts { display: grid; grid-template-columns: minmax(7em, 9em) 1fr; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.facts dt, .facts dd { margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 700; background: var(--green-soft); font-size: 14px; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.offers .ad { font-size: 12px; font-weight: 400; border: 1px solid var(--muted); color: var(--muted); border-radius: 4px; padding: 0 6px; vertical-align: middle; }
ol li, ul li { margin: 4px 0; }

@media (max-width: 520px) {
  /* 項目別の確認記録：狭い画面では3列をやめ、1項目ずつ「項目名／内容／状態」を縦に並べる。見出し行は画面から外すだけで読み上げには残す。 */
  table.records, table.records tbody { display: block; }
  table.records thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  table.records tr { display: flex; flex-direction: column; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.records tbody tr:last-child { border-bottom: 0; }
  table.records tbody th, table.records td { display: block; padding: 0; border: 0; white-space: normal; }
  table.records tbody th { font-size: 15px; }
  table.records td { font-size: 15px; }
  table.records td.rec-state { order: 3; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
  h1 { font-size: 22px; } .result-num { font-size: 26px; }
  .facts { grid-template-columns: 1fr; } .facts dt { border-bottom: 0; padding-bottom: 2px; }
}

/* 申請できるとの誤認を避け、参考額は強調表示と分ける。 */
.result-reference { display: grid; gap: .6rem; padding: 1rem; background: #f5f5f2; border: 1px solid #d9ddd5; }
.result-reference > div { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; }
.reference-num { font-size: 1rem; font-weight: 600; }
.calc-out { overflow-wrap: anywhere; }
.calc-out details { margin-block: 1rem; }
.calc-out summary { cursor: pointer; font-weight: 600; }

.visually-hidden { /* 画面には出さず、読み上げソフトには読ませる */ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
/* 段階別の「確かめること」 */
.stage { border: 1px solid var(--line); border-radius: 8px; padding: 0 16px 8px; margin: 16px 0; background: var(--card); }
.stage h3 { margin-top: 16px; }
.stage-sub { font-weight: 700; margin-bottom: 4px; }
/* 段階別の欄：開いて読む公式ページの原文 */
details.src { margin: 4px 0 2px; font-size: 14px; color: var(--muted); }
details.src summary { cursor: pointer; padding: 6px 0; }
details.src p { margin: 4px 0; overflow-wrap: anywhere; }
.stage-read, .stage-todo { margin-top: 0; padding-left: 1.4em; }
.stage-todo li { margin-bottom: 6px; }
.stage-nav-lead { margin: 12px 0 6px; font-weight: 700; }
.stage-nav ul { margin-top: 0; list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stage-nav a { display: inline-block; padding: 10px 14px; border: 1px solid var(--green); border-radius: 8px; background: var(--card); }
.guide-role { border-left: 4px solid var(--green); padding: 8px 12px; background: var(--green-soft); }

.ward-keypoints { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; background: var(--card); overflow-wrap: anywhere; }
.ward-keypoints ul { margin: 0; padding-left: 1.4em; }
.ward-keypoints li + li { margin-top: 8px; }
.ward-keypoints .fine { margin: 12px 0 0; }
