/* 評価入力アプリ（タブレット向け）。画面の決まりは DESIGN.md。色・大きさは下の変数だけを使う。 */
:root {
  --primary: #1F4E9C; --primary-dark: #173B77; --primary-soft: #E6EEFA;
  --ink: #17202C; --ink-sub: #566273; --line: #D5DBE6; --surface: #FFFFFF; --canvas: #F3F5F9;
  --done: #2E7D32; --danger: #B3261E;
  --r-control: 10px; --r-card: 14px; --shadow: 0 1px 3px rgba(0,0,0,.1);
  --font: "BIZ UDPGothic", "BIZ UDPゴシック", "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 18px; line-height: 1.5; color: var(--ink); background: var(--canvas); }
button, input { font-family: inherit; }
header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--primary-dark); color: #fff; }
header .brand { font-weight: bold; font-size: 18px; }
header .who { flex: 1; text-align: right; font-size: 16px; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; }
h1 { font-size: 24px; margin: 0 0 12px; }
.stitle { font-size: 28px; margin: 8px 0 16px; }
.card { background: var(--surface); border-radius: var(--r-card); padding: 24px; box-shadow: var(--shadow); }
.narrow { max-width: 520px; margin: 32px auto; }
.field { display: block; margin: 16px 0; font-weight: bold; }
.field input { display: block; width: 100%; margin-top: 8px; padding: 12px; min-height: 56px; font-size: 20px;
  border: 2px solid var(--line); border-radius: var(--r-control); }
.btn { min-height: 52px; padding: 12px 24px; font-size: 18px; border-radius: var(--r-control); border: 2px solid var(--primary);
  background: var(--surface); color: var(--primary); cursor: pointer; }
.btn.primary { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; font-weight: bold; }
.btn.ghost { border-color: transparent; background: transparent; }
header .btn.ghost { color: #fff; border-color: #fff; min-height: 48px; }
.btn.small { min-height: 48px; padding: 8px 16px; font-size: 16px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn.grow { flex: 1; }
.btn:disabled { opacity: .5; }
.msg { margin: 12px 0 0; padding: 12px; border-radius: 8px; background: var(--primary-soft); }
.msg.warn { background: #FBE9E7; color: var(--danger); }
.note { color: var(--ink-sub); font-size: 15px; }
.note.foot { margin-top: 24px; text-align: center; }
.empty { padding: 32px; text-align: center; color: var(--ink-sub); }

/* ① 分野のカード */
.cats { display: grid; gap: 16px; }
.catcard { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 112px; padding: 16px 24px; text-align: left;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow);
  color: inherit; cursor: pointer; }
.catcard:active { background: var(--primary-soft); border-color: var(--primary); }
.catname { font-size: 24px; font-weight: bold; line-height: 1.3; }
.catsub { margin-top: 4px; font-size: 15px; line-height: 1.4; color: var(--ink-sub); }

/* ② 人の一覧 */
.search { display: block; width: 100%; min-height: 56px; padding: 12px 16px; font-size: 18px; border: 2px solid var(--line);
  border-radius: var(--r-control); background: var(--surface); }
.seg { display: flex; margin: 12px 0 16px; border: 2px solid var(--line); border-radius: var(--r-control); overflow: hidden;
  background: var(--surface); }
.segb { flex: 1; min-height: 48px; padding: 8px; font-size: 16px; border: 0; border-right: 1px solid var(--line);
  background: var(--surface); color: var(--ink-sub); cursor: pointer; }
.segb:last-child { border-right: 0; }
.segb.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: bold; }
.rows { background: var(--surface); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); }
.rows:empty { display: none; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 12px 16px; text-align: left;
  background: var(--surface); border: 0; border-bottom: 1px solid var(--line); font-size: 18px; color: inherit; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--primary-soft); }
.rmain { flex: 1; min-width: 0; }
.rname { font-size: 20px; font-weight: bold; line-height: 1.3; }
.rsub { margin-top: 4px; line-height: 1.3; font-size: 15px; color: var(--ink-sub); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.rcount { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: bold;
  font-size: 16px; }
.rdone { flex: none; color: var(--done); font-size: 16px; font-weight: bold; }
.chev { flex: none; font-size: 24px; color: var(--ink-sub); }
.row.isdone .rname { font-weight: normal; color: var(--ink-sub); }
.back { min-height: 48px; padding: 8px 12px 8px 0; font-size: 18px; border: 0; background: transparent; color: var(--primary);
  cursor: pointer; }

/* ③ 入力（1つの検査） */
.ehead { margin: 4px 0 8px; }
.ename { font-size: 20px; font-weight: bold; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.step { min-height: 48px; padding: 8px 16px; font-size: 16px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer; }
.step.done { color: var(--done); }
.step.on { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; font-weight: bold; }
.etitle { margin: 0 0 4px; font-size: 28px; }
#eNote { margin: 0 0 12px; }
#eBody { margin-top: 12px; }
.irow { padding: 16px 0; border-top: 1px solid var(--line); }
.irow:first-child { border-top: 0; padding-top: 0; }
.ilab { margin-bottom: 12px; font-size: 20px; font-weight: bold; }
.irow.sub .ilab { font-size: 16px; font-weight: normal; color: var(--ink-sub); margin-bottom: 8px; }
.irow.sub .opt { min-height: 48px; font-size: 16px; }
.cur { font-size: 15px; color: var(--ink-sub); margin: -4px 0 8px; }
.life { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 16px; background: var(--primary-soft);
  padding: 12px; border-radius: 8px; margin: 0 0 12px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-height: 56px; min-width: 96px; padding: 12px 16px; font-size: 18px; border: 2px solid var(--line); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; }
.opt.on { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; font-weight: bold; }
.ctl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.num { width: 9em; min-height: 60px; padding: 12px; font-size: 26px; text-align: right; border: 2px solid var(--line);
  border-radius: var(--r-control); }
.txt { width: 100%; max-width: 30em; min-height: 56px; padding: 12px; font-size: 18px; border: 2px solid var(--line);
  border-radius: var(--r-control); }
.num:focus, .txt:focus, .search:focus, .field input:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
.unit { font-size: 20px; }
.vrow { display: flex; gap: 12px; padding: 8px 0; font-size: 16px; }
.vlab { min-width: 9em; color: var(--ink-sub); }
.sppb { margin-top: 16px; padding: 16px; background: var(--primary-soft); border-radius: var(--r-control); font-size: 18px;
  font-weight: bold; }
.ebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 12px; justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.ebar .btn { min-height: 60px; font-size: 20px; max-width: 828px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 12px 24px; border-radius: var(--r-control);
  background: var(--done); color: #fff; font-size: 18px; z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--danger); }

@media (max-width: 480px) {
  .opts { flex-direction: column; }
  .opt { width: 100%; }
}

/* 何月分・利用日の絞り込み */
.plabel { padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--primary-dark); font-size: 16px;
  font-weight: bold; }
.plabel:empty { display: none; }
.period { margin: 8px 0 0; font-size: 20px; font-weight: bold; color: var(--primary); }
.chips { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; }
.chiplab { flex: none; width: 4em; font-size: 15px; color: var(--ink-sub); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; min-width: 56px; padding: 8px 16px; font-size: 18px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer; }
.chip.on { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; font-weight: bold; }
.opt.was { border-color: var(--primary); background: var(--primary-soft); font-weight: bold; }

/* 人をえらぶ画面：分野名の右に、利用日・時間帯の札を置く（2026-11-27 櫻井指示） */
.lhead { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; }
.lhead .stitle { flex: none; margin: 0; }
.lfilters { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }
.lfilters .chips { margin: 0; }
.lfilters .chiprow { justify-content: flex-end; gap: 4px; }
.lfilters .chip { min-width: 48px; padding: 8px 12px; font-size: 16px; }
@media (max-width: 640px) {
  .lhead { flex-direction: column; align-items: flex-start; }
  .lfilters { margin-left: 0; align-items: flex-start; }
  .lfilters .chiprow { justify-content: flex-start; }
}

/* 入力画面の上：氏名の右に印刷のボタン */
.ehead { display: flex; align-items: center; gap: 12px; }
.ehead .ename { flex: 1; }
.txt { max-width: 100%; }

/* 人ごとの記録（印刷・PDF）。A4 縦。色は使わず、線と文字だけにする */
.pbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet { background: var(--surface); padding: 24px; border-radius: var(--r-card); box-shadow: var(--shadow); font-size: 15px; }
.shead { border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 12px; }
.stt { font-size: 15px; color: var(--ink-sub); }
.sname { font-size: 24px; font-weight: bold; }
.smeta { font-size: 15px; color: var(--ink-sub); }
.scat { margin: 16px 0 4px; font-size: 18px; border-left: 6px solid var(--primary-dark); padding-left: 8px; }
.stable { width: 100%; border-collapse: collapse; margin: 8px 0 12px; break-inside: avoid; }
.stable caption { text-align: left; font-weight: bold; padding: 4px 0; }
.stable th, .stable td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; font-weight: normal; }
.stable th { width: 38%; background: var(--canvas); }
.stable td.src { width: 24%; color: var(--ink-sub); font-size: 13px; }
.stable td.blank { color: var(--ink-sub); }
@page { size: A4 portrait; margin: 12mm; }
@media print {
  header, .noprint, .toast, .ebar { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0; border-radius: 0; font-size: 10pt; }
  .stable td.src { font-size: 8pt; }
  .stable th { background: #f0f0f0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.copyb { margin: 0 0 8px; }

/* LIFE 取込 CSV */
.sec { margin: 24px 0 8px; font-size: 16px; color: var(--ink-sub); }
.catcard.slim { min-height: 80px; }
.catcard.slim .catname { font-size: 20px; }
.lead { margin: 4px 0 16px; font-size: 18px; }
.btn.dl { display: inline-flex; align-items: center; justify-content: center; min-height: 60px; font-size: 20px; text-decoration: none; }
.notes { margin: 16px 0; padding-left: 24px; color: var(--ink-sub); font-size: 15px; }
.row.static { cursor: default; }
.lifeform { max-width: 520px; }
.lifeform .field { margin-top: 0; }

/* まとめて印刷：1人1ページ */
.catcard.slim + .catcard.slim { margin-top: 12px; }
.listfoot { margin: 16px 0 0; text-align: right; }
.onesheet + .onesheet { margin-top: 32px; padding-top: 24px; border-top: 2px dashed var(--line); }
@media print {
  .onesheet { break-after: page; page-break-after: always; }
  .onesheet:last-child { break-after: auto; page-break-after: auto; }
  .onesheet + .onesheet { margin-top: 0; padding-top: 0; border-top: 0; }
}
