/* =====================================================================
   アセスメント様式編集（assessments#sheet_edit）— 画面用の読みやすさ上書き
   JIS X 8341-3（WCAG 2.0 レベルAA相当）対応 / 2026-08-16

   ■ なぜ assessment_sheet.css を直接書き換えず、別ファイルに分けているか
     assessment_sheet.css は
       ・画面   … assessments#sheet_edit
       ・印刷   … clients#print_all / assessments#print_guideline
     の**両方**から読み込まれている。
     しかも print_all の HTML には
       <link href="/assets/assessment_sheet-<ダイジェスト>.css">
     というファイル内容のハッシュ入り URL が焼き込まれるため、
     **assessment_sheet.css を1バイトでも触ると印刷帳票の HTML が変わる**。
     （print_all_pdf_dump_test の MD5 が変化してしまう）

     そこで「画面だけを読みやすくする上書き」は本ファイルに閉じ込め、
     sheet_edit のビューからのみ読み込む。印刷側は一切読み込まない。

   ■ ファイル全体を @media screen で包んでいる理由
     sheet_edit の画面をブラウザの印刷機能で刷ることもできるため、
     その場合でも従来の帳票レイアウト（210mm・小さめの字）に戻るようにする。
     ＝「画面の文字を大きくしても、紙に出るものは変えない」を構造で担保する。

   ■ 前提
     assessment_sheet.css の後に読み込むこと（同じ詳細度なら後勝ちで上書きする）。
   ===================================================================== */

@media screen {
  /* ---- 用紙の見た目をやめ、画面向けのカードにする ---- */
  .asx-sheet {
    width: auto;
    max-width: 62rem;
    padding: 1.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    /* 明朝 → 本文と同じゴシック。小さい字の明朝は画面で最も読みにくい組み合わせ */
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    line-height: 1.7;
  }

  .asx-group {
    border: 1.5px solid var(--gray-300);
    border-radius: 12px;
    overflow: hidden;
  }

  .asx-group-head {
    background: var(--navy);
    border-bottom: none;
    color: #fff;
    font-size: 19px;
    padding: 0.8rem 1.1rem;
    letter-spacing: 0.02em;
  }

  .asx-subhead {
    background: var(--gray-100);
    color: var(--gray-900);
    font-size: 16px;
    font-weight: 800;
    padding: 0.7rem 1.1rem;
    border-top: 1.5px solid var(--gray-300);
    border-bottom: none;
  }

  /* ---- 認定調査項目: 表 → 1項目1カード ---- */
  .asx-item-block {
    border-bottom: 1.5px solid var(--gray-200);
    padding: 1.1rem;
  }

  .asx-item-block:last-child {
    border-bottom: none;
  }

  .asx-item-top {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
  }

  /* 項目番号（1-1 等）。旧 .asx-code は 10.5px だった */
  .asx-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.2rem 0.5rem;
    background: var(--navy);
    color: var(--gold-light);
    font-weight: 800;
    font-size: 14px;
    border-radius: 6px;
  }

  .asx-item-label {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
  }

  .asx-item-hint {
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 600;
  }

  /* ---- 選択肢（旧 10.5px・丸囲み15px） ---- */
  .asx-choices {
    gap: 0.55rem;
  }

  .asx-choice {
    font-size: 15px;
    font-weight: 600;
    min-height: 44px;
    border: 1.5px solid var(--gray-400);
    border-radius: 999px;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    background: #fff;
    color: var(--gray-800);
  }

  .asx-choice:hover {
    background: var(--gray-50);
    border-color: var(--navy);
  }

  .asx-choice .num {
    width: 1.9rem;
    height: 1.9rem;
    min-width: 1.9rem;
    margin-right: 0.6rem;
    border: 2px solid var(--gray-500);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-700);
    background: #fff;
    flex-shrink: 0;
    position: relative;
  }

  /* 未選択のあいだはチェックマークを隠し、番号を出す */
  .asx-choice .asx-choice-check {
    display: none;
    width: 1.1rem;
    height: 1.1rem;
  }

  /* 選択中: 色の変化に加えてチェックマークでも示す（色覚に依存させない） */
  .asx-choice.is-checked,
  .asx-choice:has(input:checked) {
    background: var(--purple-bg, #f3ecff);
    border-color: var(--asx-purple);
    border-width: 2px;
    color: var(--gray-900);
    font-weight: 700;
  }

  .asx-choice.is-checked .num,
  .asx-choice:has(input:checked) .num {
    border-color: var(--asx-purple);
    background: var(--asx-purple);
    color: #fff;
  }

  .asx-choice.is-checked .asx-choice-check,
  .asx-choice:has(input:checked) .asx-choice-check {
    display: block;
  }

  .asx-choice.is-checked .asx-choice-num,
  .asx-choice:has(input:checked) .asx-choice-num {
    display: none;
  }

  /* input は視覚的に隠してあるので、フォーカスはラベル側の枠で示す */
  .asx-choice:focus-within {
    outline: 3px solid var(--focus, #0b5fff);
    outline-offset: 2px;
  }

  .asx-choice-clear {
    border: 1.5px solid var(--gray-400);
    background: #fff;
    color: var(--gray-700);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    padding: 0.4rem 0.9rem;
    min-height: 38px;
  }

  .asx-choice-clear:hover {
    background: #fef2f2;
    color: var(--red-ink);
    border-color: #fecaca;
  }

  /* ---- 援助の現状・希望・計画（旧: 8px 見出しの5列テーブル） ---- */
  .asx-care-row-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--asx-purple);
    letter-spacing: 0.04em;
    margin: 1rem 0 0.5rem;
  }

  .asx-care-chips {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
  }

  .asx-care-chip {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .asx-care-chip label {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
  }

  .asx-care-chip .asx-sel {
    min-width: 8rem;
  }

  /* ---- セレクト（旧 13px・高さ不足） ---- */
  .asx-sel {
    border: 2px solid var(--gray-500);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    font-size: 15px;
    font-weight: 600;
    min-height: 44px;
    background: var(--asx-edit-bg);
    color: var(--gray-900);
    font-family: 'Noto Sans JP', sans-serif;
  }

  .asx-sel:focus {
    outline: 3px solid var(--focus, #0b5fff);
    outline-offset: 1px;
    border-color: var(--asx-purple);
  }

  /* ---- 援助内容の表（care_sections）は表のまま。字だけ大きくする ---- */
  .asx-care-cols th,
  .asx-care-cols td {
    border: 1px solid var(--gray-300);
    padding: 0.65rem 0.6rem;
    font-size: 15px;
  }

  .asx-care-cols thead th {
    background: var(--gray-200);
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-900);
    font-family: 'Noto Sans JP', sans-serif;
  }

  .asx-care-cols tbody tr:nth-child(even) td {
    background: var(--gray-50);
  }

  .asx-care-label {
    text-align: left;
    font-weight: 700;
    font-size: 15px;
    color: var(--gray-900);
    background: transparent;
  }

  .asx-care-cols .asx-sel {
    min-width: 5.5rem;
  }

  /* ---- 特記・解決すべき課題（旧: 9.5px の薄いグレー見出し + 明朝 11.5px） ---- */
  .asx-note-cell {
    padding: 1.1rem;
    border-top: 2px solid var(--gray-300);
    background: var(--gray-50);
  }

  .asx-note-label {
    display: block;
    font-size: 15px;
    font-weight: 800;
    /* 旧 #8a8a8a は白背景に対して 3.5:1 で AA 未達だった */
    color: var(--gray-800);
    padding: 0;
    margin-bottom: 0.5rem;
    font-family: 'Noto Sans JP', sans-serif;
  }

  .asx-ta {
    border: 2px solid var(--gray-400);
    border-radius: 10px;
    background: #fff;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--gray-900);
    padding: 0.8rem 1rem;
    min-height: 4.5em;
  }

  .asx-ta:hover {
    border-color: var(--asx-purple);
    background: #fff;
  }

  .asx-ta:focus {
    background: #fff;
    outline: 3px solid var(--focus, #0b5fff);
    outline-offset: 1px;
    border-color: var(--asx-purple);
  }

  .asx-ta::placeholder {
    color: var(--gray-700);
  }

  /* ---- extra ブロック（コミュニケーション・排泄用具・食事・医療） ---- */
  .asx-extra {
    padding: 1.1rem;
    border-top: 2px dashed var(--gray-300);
  }

  .asx-extra-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
    margin: 0 0 0.8rem;
    font-family: 'Noto Sans JP', sans-serif;
  }

  .asx-field-row {
    gap: 0.6rem;
    margin-bottom: 0.9rem;
  }

  .asx-field-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    min-width: 12rem;
  }

  .asx-pill {
    font-size: 15px;
    font-weight: 600;
    padding: 0.5rem 1rem;
    min-height: 40px;
    border: 1.5px solid var(--gray-400);
    background: #fff;
    color: var(--gray-800);
  }

  .asx-pill:has(input:checked) {
    background: var(--purple-bg, #f3ecff);
    border-color: var(--asx-purple);
    border-width: 2px;
    color: var(--gray-900);
  }

  .asx-pill:focus-within {
    outline: 3px solid var(--focus, #0b5fff);
    outline-offset: 2px;
  }

  .asx-inline-note {
    font-size: 15px;
    font-family: 'Noto Sans JP', sans-serif;
    border-bottom: 2px solid var(--gray-400);
    min-height: 36px;
    color: var(--gray-900);
  }

  .asx-2axis th,
  .asx-2axis td {
    font-size: 15px;
    padding: 0.5rem 0.6rem;
    border-color: var(--gray-300);
  }

  .asx-2axis thead th {
    background: var(--gray-200);
    color: var(--gray-900);
    font-family: 'Noto Sans JP', sans-serif;
  }

  .asx-2axis input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  /* ---- 上部バー・凡例・目次 ---- */
  .asx-topbar {
    padding: 1rem 1.1rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .asx-topbar-title h1 {
    font-size: 22px;
  }

  .asx-topbar-title p {
    font-size: 15px;
    color: var(--gray-700);
    font-weight: 500;
  }

  .asx-completeness-label {
    font-size: 14px;
    color: var(--gray-800);
    font-weight: 700;
  }

  .asx-completeness-pct {
    font-size: 17px;
  }

  .asx-completeness-bar {
    height: 0.7rem;
    background: var(--gray-300);
  }

  .asx-completeness-fill {
    /* 旧グラデーションは薄く、進捗の端が背景と見分けにくかった */
    background: linear-gradient(90deg, #C0A062, #8a6a2a);
  }

  .asx-btn {
    font-size: 15px;
    font-weight: 700;
    padding: 0.65rem 1.1rem;
    min-height: 44px;
  }

  .asx-btn-ghost {
    color: var(--gray-800);
    border-color: var(--gray-400);
  }

  .asx-btn-lg {
    font-size: 17px;
    padding: 0.9rem 1.8rem;
    min-height: 52px;
  }

  .asx-btn:focus-visible {
    outline: 3px solid var(--focus, #0b5fff);
    outline-offset: 2px;
  }

  .asx-lg-title {
    font-size: 15px;
    font-weight: 800;
  }

  .asx-legend-item {
    font-size: 14px;
    color: var(--gray-800);
    font-weight: 600;
  }

  .asx-swatch {
    width: 1.4rem;
    height: 1.1rem;
    border: 1.5px solid var(--gray-400);
  }

  .asx-toc a {
    font-size: 14px;
    font-weight: 700;
    padding: 0.55rem 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--gray-400);
    color: var(--gray-800);
  }

  .asx-toc a:hover {
    background: var(--gold-bg);
    border-color: var(--gold-ink);
    color: var(--gold-ink);
  }

  .asx-page-label {
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 600;
    padding: 0.5rem 1.1rem;
  }

  /* ---- 疾患別ケアの選択 ---- */
  .asx-tekicare-note {
    font-size: 15px;
    color: var(--gray-800);
  }

  .asx-tekicare-hint {
    color: var(--amber-ink);
    font-weight: 700;
  }

  .asx-tekicare-choices .asx-choice {
    font-size: 15px;
    padding: 0.6rem 1rem 0.6rem 0.8rem;
    min-height: 44px;
    border: 1.5px solid var(--gray-400);
  }

  .asx-tekicare-choices .asx-choice .lbl::before {
    width: 1.3rem;
    height: 1.3rem;
    margin-right: 0.6rem;
    border: 2px solid var(--gray-500);
  }

  /* ---- AIまとめカード ---- */
  .asx-ai-card h3 {
    font-size: 18px;
  }

  .asx-ai-card p {
    font-size: 15px;
    color: var(--gray-800);
    line-height: 1.7;
  }

  /* ---- 狭い画面 ---- */
  @media (max-width: 640px) {
    .asx-sheet {
      padding: 0.8rem;
    }

    .asx-item-block {
      padding: 0.9rem 0.7rem;
    }

    /* セレクトを全幅にして、指でも押しやすくする */
    .asx-care-chips {
      gap: 0.6rem;
    }

    .asx-care-chip {
      flex: 1 1 8.5rem;
    }

    .asx-care-chip .asx-sel {
      min-width: 100%;
      width: 100%;
    }

    .asx-field-label {
      min-width: 100%;
    }
  }
}
