:root {
  /* 白黒グレー基調（見やすさ優先・高コントラスト） */
  --brand: #333333;        /* ヘッダー・主要ボタン・見出し帯 */
  --brand-dark: #1a1a1a;   /* 押したとき等 */
  --bg: #f2f2f2;           /* 画面背景 */
  --card: #ffffff;         /* カード背景 */
  --line: #cfcfcf;         /* 罫線（やや濃くして見やすく） */
  --text: #141414;         /* 本文（ほぼ黒） */
  --muted: #5c5c5c;        /* 補助文字（読める濃さ） */
  --soft: #ededed;         /* 見出しセル・淡い背景 */
  --soft2: #f7f7f7;        /* さらに淡い背景 */
  /* 意味を持つ色はそのまま（救急・キャンセル・今日など） */
  --danger: #c0453b;
  --warn-bg: #fff4d6;
  --warn-line: #e6c84a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
main, .card { max-width: 100%; }
.table-scroll { max-width: 100%; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* ヘッダー */
header.app-header {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
header.app-header h1 { font-size: 18px; margin: 0; font-weight: 700; }
header.app-header .user { font-size: 14px; display: flex; align-items: center; gap: 12px; }

/* モード表示バナー */
.mode-banner {
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
}
.mode-banner.demo { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: #6b5300; }
.mode-banner.cloud { background: var(--soft); border-bottom: 1px solid var(--line); color: var(--text); }

/* タブ */
nav.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.tabs button {
  flex: 1 0 auto;
  border: none;
  background: none;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
nav.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }

/* コンテンツ */
main { max-width: 920px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1 1 140px; }
.field.full { flex-basis: 100%; }
.field label { font-size: 13px; color: var(--muted); }

input, select, textarea, button {
  font-family: inherit;
  font-size: 16px;
}
input, select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
textarea { resize: vertical; min-height: 60px; }

.btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--soft); color: var(--text); }
.btn.secondary:hover { background: #e2e8e5; }
.btn.danger { background: var(--danger); }
/* 顔写真（○枠） */
.face-thumb { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); vertical-align: middle; margin-right: 6px; }
.dg-table .dg-name, .y-table .y-name, .e-namecell { }
.dg-table .dg-name .face-thumb { width: 26px; height: 26px; }
.y-table .y-name { display: flex; align-items: center; gap: 4px; }
.e-namecell { display: flex; align-items: center; }
.face-edit { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.face-frame { width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--soft2); flex: 0 0 auto; }
.face-frame img { width: 100%; height: 100%; object-fit: cover; }
.face-frame .face-ph { font-size: 12px; color: var(--muted); }
.face-btns { display: flex; gap: 8px; flex-wrap: wrap; }
/* 見出し横の件数バッジ */
.hd-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hd-count { font-size: 13px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 999px; padding: 2px 12px; }
/* 共通の確認ダイアログ */
.confirm-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.confirm-box { background: var(--card); color: var(--text); border-radius: 12px; padding: 18px; max-width: 420px; width: 100%; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.confirm-msg { font-size: 15px; line-height: 1.6; margin-bottom: 16px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions .btn { min-width: 96px; }
/* 戻るボタン（ヘッダー） */
#back-btn { flex: 0 0 auto; }
.btn.small { padding: 6px 12px; font-size: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--soft2); }
tr:hover td { background: #fafcfb; }

.toast {
  position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 12px 20px; border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 100; font-size: 15px;
}
.toast.err { background: var(--danger); }

/* ログイン画面 */
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-wrap .card { padding: 28px; }
.login-wrap h1 { text-align: center; color: var(--brand); font-size: 22px; margin: 0 0 4px; }
.login-wrap p.sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.muted { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 14px; padding: 0; }
/* 職員（記録者）の管理テーブル */
.staff-tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.staff-tbl .stf-ops { text-align: right; white-space: nowrap; }
.staff-tbl .stf-ops > * { margin-left: 10px; }
.stf-mv { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; width: 30px; height: 30px; font-size: 13px; color: var(--text); cursor: pointer; margin-left: 4px; }
.stf-mv:disabled { opacity: .35; cursor: default; }
/* 操作説明書（設定タブ・折りたたみ表示） */
.help-sec { border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; overflow: hidden; }
.help-sec > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 15px; background: var(--soft); list-style: none; }
.help-sec > summary::-webkit-details-marker { display: none; }
.help-sec > summary::before { content: "＋"; color: var(--brand); font-weight: 700; margin-right: 8px; }
.help-sec[open] > summary::before { content: "－"; }
.help-sec[open] > summary { border-bottom: 1px solid var(--line); }
.help-c { padding: 6px 16px 12px; }
.help-c ul { margin: 6px 0; padding-left: 20px; }
.help-c li { margin: 6px 0; line-height: 1.6; font-size: 14px; }
/* モニタリング（月次） */
.mon-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: var(--card, #fff); }
.mon-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mon-head > b { font-size: 16px; display: flex; align-items: center; gap: 6px; }
.mon-sub { color: var(--muted); font-size: 13px; flex: 1; }
.mon-badge { background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.mon-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; margin-bottom: 8px; }
.mon-i { display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.mon-i > span { font-size: 13px; }
.mon-i select { border: none; background: var(--soft); border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.mon-lbl { display: block; font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 8px 0 2px; }
.mon-card textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; resize: vertical; }
/* モニタリング: 1ヶ月グラフ */
.mon-charts { margin: 4px 0 8px; }
.mon-chart { margin: 8px 0; }
.mon-chart-t { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.mon-leg { font-weight: 400; font-size: 11px; margin-left: 8px; color: var(--muted); }
.mon-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 2px 0 6px; vertical-align: middle; }
.mon-svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* モニタリング: 6つの質問 */
.mon-q { margin: 4px 0 10px; }
.mon-q select.mon-f { min-width: 180px; }
.mon-fields textarea.mon-f, .mon-ed textarea.mon-f { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; resize: vertical; }
.mon-review-yes { display: none; }
/* 個別モニタリング（現在＋履歴）モーダル */
.mon-modal { max-width: 560px; width: 92vw; text-align: left; }
.mon-hist { max-height: 62vh; overflow-y: auto; }
.mon-hcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.mon-hhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mon-hhead > b { font-size: 15px; }
.mon-badge.hist { background: #999; }
.mon-hhead .mon-hprint { margin-left: 6px; }
.mon-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.mon-badge2 { font-size: 11.5px; border-radius: 6px; padding: 1px 7px; background: var(--soft); color: var(--text); }
.mon-badge2.ok { background: #d9efdd; color: #1b6b2b; }
.mon-badge2.warn { background: #fbe2c4; color: #8a5300; }
.mon-vline { font-size: 13px; line-height: 1.55; margin: 4px 0; white-space: pre-wrap; }
.mon-vline > b { display: inline-block; color: var(--muted); margin-right: 6px; }
.mon-ed textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; resize: vertical; }
.mon-hist-wrap { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.mon-hist-h { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.mon-hhead .mon-hedit { margin-left: auto; }
.mon-hhead .mon-hedit + .mon-hprint { margin-left: 6px; }
/* 本日一覧: 過去バイタル・グラフを開くボタン */
.dg-vhbtn { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; width: 38px; height: 34px; font-size: 16px; cursor: pointer; }
/* 食事・バイタル履歴の一覧表（枠内に収める） */
.vh-t { width: 100%; table-layout: fixed; }
.vh-t th, .vh-t td { text-align: center; font-size: 13px; padding: 4px 3px; word-break: break-all; }
/* 救急: 全利用者からの選択リスト */
.emg-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
/* 負担割合証の一斉更新 */
.fb-chip { flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 12px; cursor: pointer; }
.fb-chip .fb-cur { font-size: 11px; opacity: .85; }
.fb-chip input { margin-right: 4px; }
/* 利用者一覧のグループ見出し（要介護／第一号通所事業） */
.rl-sechead td { background: #e8eef6; font-weight: 700; font-size: 13px; color: #2c4a6b; padding: 6px 10px; border-top: 2px solid #9fb6cd; }
/* 誕生日一覧（画面表示） */
.bd-list { width: 100%; border-collapse: collapse; }
.bd-list th, .bd-list td { border: 1px solid var(--line); padding: 6px 8px; font-size: 14px; text-align: left; vertical-align: middle; }
.bd-list th { background: var(--soft); font-weight: 700; }
.bd-list .bd-md { font-weight: 700; text-align: center; white-space: nowrap; }
.bd-list .bd-fu { font-size: 12px; color: var(--muted); }
.bd-list .bd-mrow td { background: #e8eef6; font-weight: 700; }
/* ジェノグラム（家族構成図） */
.fs-basic-top { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.fs-basic-top .face-edit { margin-bottom: 0; }
.geno-box { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.geno-ttl { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.geno-mini { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; margin-bottom: 6px; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.geno-mini .geno-svg { width: 100%; height: 100%; max-height: 260px; }
/* 記録日を決めてから編集する */
.recdate { border: 1px solid var(--brand); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px; background: #f4f8fc; }
.recdate-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recdate-ttl { font-weight: 700; font-size: 13px; color: var(--brand); }
.recdate-input { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 15px; }
.recdate-state { font-size: 12.5px; margin-top: 6px; line-height: 1.6; color: var(--muted); }
.recdate-state.on { color: #8a5a00; }
.recdate-state.ok { color: #1e5b1e; }
.rec-warn { color: var(--danger); }
/* 記録日が決まるまでは入力できない */
.sec-locked { opacity: .45; pointer-events: none; }
/* 更新履歴の対象範囲（その他保険情報〜服薬情報）は広いので、少し薄めに */
.fsr-scope.sec-locked { opacity: .55; }
.fsr-bar { position: sticky; top: 0; z-index: 5; background: var(--card); padding-top: 6px; }
/* 更新履歴（通所固有・興味関心・写真） */
.hist-box { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--soft2); }
.hist-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-ttl { font-weight: 700; font-size: 12.5px; color: var(--muted); }
.hist-date { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 14px; }
.hist-hint { font-size: 11.5px; margin: 4px 0 6px; }
.hist-list { margin-top: 6px; }
.hist-item { border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin: 4px 0; }
.hist-item > summary { cursor: pointer; padding: 7px 10px; font-size: 13px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 6px; }
.hist-item > summary::-webkit-details-marker { display: none; }
.hist-item > summary::before { content: "＋"; color: var(--brand); }
.hist-item[open] > summary::before { content: "－"; }
.hist-item .hist-del { margin-left: auto; }
.hist-item .hist-t { margin: 0 0 6px; }
/* 履歴1件の中のセクション見出し */
.hist-item .hist-g { font-size: 11.5px; font-weight: 700; color: #fff; background: #7a8794; padding: 3px 8px; margin: 6px 0 3px; border-radius: 4px; }
.hist-item .hist-t th { width: 40%; font-size: 11.5px; }
.hist-item .hist-t td { font-size: 12.5px; }
.hist-item .np-grid { padding: 6px; }
/* 家族構成: ジェノグラムと備考を横並びで1行に */
.fam-row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.fam-row .geno-box { flex: 1 1 320px; min-width: 260px; }
.fam-note { flex: 1 1 260px; min-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.fam-note textarea { flex: 1; min-height: 200px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; resize: vertical; }
.geno-svg { width: 100%; height: auto; display: block; }
.geno-none { color: var(--muted); font-size: 12.5px; }
/* 編集画面 */
.geno-modal { max-width: 720px; width: 96vw; text-align: left; }
.geno-help { font-size: 12.5px; margin: 2px 0 8px; }
.geno-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.geno-tools .btn.on { background: #ef8b1f; color: #fff; border-color: #ef8b1f; }
.geno-canvas { border: 2px dashed var(--line); border-radius: 10px; background: #fff; touch-action: none; overflow: hidden; }
.geno-canvas .geno-svg { max-height: 46vh; }
.geno-canvas .geno-none { padding: 40px 10px; text-align: center; }
.geno-sel { stroke: #ef8b1f !important; stroke-width: 3.5 !important; }
.geno-form { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; min-height: 48px; }
.geno-chks { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
/* 質問（文章）で作るパネル */
.geno-modes { display: flex; gap: 6px; margin-bottom: 8px; }
.geno-modes .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.geno-q { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.geno-qttl { font-size: 13px; font-weight: 700; color: var(--brand); margin: 10px 0 4px; }
.geno-qttl:first-child { margin-top: 0; }
.geno-prow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.geno-prow select, .geno-prow input[type="text"] { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 14px; }
.geno-prow .gp-name, .geno-prow .gq-self-name, .geno-prow .gq-sp-name, .geno-prow .gq-fa-name, .geno-prow .gq-mo-name { flex: 1; min-width: 110px; }
.geno-prow .gp-age, .geno-prow .gq-self-age, .geno-prow .gq-sp-age { width: 72px; }
.geno-prow .fs-check { white-space: nowrap; }
.geno-prow .gp-rel { min-width: 96px; font-weight: 700; }
.geno-prow .gp-alive, .geno-prow .gp-sex { min-width: 78px; }
.geno-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.geno-quick .btn { padding: 6px 10px; }
.geno-preview { margin-top: 10px; }
.geno-preview .geno-svg { max-height: 34vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
/* フェイスシート（閲覧・印刷）の顔写真 */
.fs-faceprint { float: right; width: 90px; height: 110px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 6px 10px; }
/* 住所＋地図ボタンを横並び */
.fs-addr-row { display: flex; gap: 8px; align-items: center; }
.fs-addr-inp { flex: 1; min-width: 0; }
.fs-addr-inp input { width: 100%; }
.fs-addr-row #fs-map { white-space: nowrap; flex: 0 0 auto; }
/* 業務日誌: 勤怠連携の設定パネル */
.ns-staff-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 2px; }
.kt-status { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.kt-status.ok { color: #1e5b1e; }
.kt-status.ng { color: var(--danger); }
/* いまの設定のひと目まとめ */
.kt-now { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--soft2); }
.kt-now > b { color: var(--muted); }
/* 接続テストの内訳 */
.kt-steps { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 8px; }
.kt-step { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; padding: 2px 0; color: var(--text); }
.kt-step > b { min-width: 170px; }
.kt-ok { color: #1e5b1e; } .kt-ng { color: var(--danger); }
.kt-fix { border-left: 4px solid var(--brand); background: #f4f8fc; padding: 8px 10px; border-radius: 0 8px 8px 0;
  font-size: 12.5px; color: var(--text); line-height: 1.7; }
.kt-extra { margin-top: 8px; font-size: 12px; color: var(--text); word-break: break-all; }
.kt-extra code { background: var(--soft2); padding: 1px 4px; border-radius: 4px; }
.ns-add { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; color: #8a5a00; }
/* 職員登録に無い勤怠の名前の案内 */
.ns-unknown { border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.ns-unknown > b { font-size: 13px; color: #8a5a00; }
.ns-uk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.ns-uk-name { font-weight: 700; font-size: 14px; min-width: 100px; }
.ns-uk-sel { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 14px; max-width: 260px; }
/* 接続・設定は目立たせない（ふだん使わないので下部に置く） */
.ns-setup { background: var(--soft2); }
.ns-setup > h2 { color: var(--muted); }
/* 業務日誌 */
.ns-staff { margin-bottom: 4px; }
.ns-staff-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ns-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; background: var(--card); color: var(--text); font-family: inherit; line-height: 1.2; }
/* 出勤中はオレンジの名前チップ（名前だけ・アイコンなし） */
.ns-chip.on { background: #ef8b1f; color: #fff; border-color: #ef8b1f; font-weight: 700; }
/* 編集モードは名前だけのボタン（タップで出勤／未出勤を切替） */
button.ns-chip { cursor: pointer; }
button.ns-chip:hover { border-color: #ef8b1f; }
.ns-area { width: 100%; min-height: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; resize: vertical; }
/* 日付欄（西暦・和暦入力＋プレビュー） */
.fs-bd { flex: 1 1 0; min-width: 0; }
.fs-bd input { width: 100%; }
.fs-bd-view { margin-top: 4px; font-size: 13px; }
.fs-bd-view:empty { display: none; }
/* 認定期間（開始 〜 終了） */
.fs-period { align-items: flex-start; gap: 6px; }
.fs-period .fs-tilde { padding-top: 10px; }
/* 登録情報の閲覧のみ表示（名前クリック） */
.rl-name { font-size: 15px; text-align: left; }
.fs-readonly .fs-table td { padding: 6px 8px; }
.fs-readonly .fs-table td .pv, .fs-readonly .pv { display: block; min-height: 1.1em; white-space: pre-wrap; word-break: break-word; }
.fs-readonly .fs-inline { padding: 6px 8px; }
.fs-readonly .fs-bd { padding: 0; }
/* 認定情報の写真（介護保険証・負担割合証など） */
.np-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.np-item { position: relative; width: 150px; margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--card); }
.np-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 4px; cursor: zoom-in; display: block; }
.np-item .np-label { width: 100%; margin-top: 4px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; }
.np-item .np-del { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 14px; cursor: pointer; line-height: 1; }
.np-item.ro figcaption { margin-top: 4px; font-size: 12px; text-align: center; color: var(--muted); }
/* ---- サービス担当者会議の記録 ---- */
.sign-box.kg-box { max-width: 860px; width: 96vw; max-height: 88vh; text-align: left; }
.kg-list { display: flex; flex-direction: column; gap: 8px; }
.kg-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card); }
.kg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.kg-head .btn, .kg-head .link-btn { margin-left: 0; }
.kg-head b { margin-right: 2px; }
.kg-line { font-size: 13px; line-height: 1.55; margin-top: 4px; }
.kg-line > b { color: var(--muted); margin-right: 6px; }
.kg-sec-t { font-weight: 700; font-size: 13px; color: var(--brand); margin: 12px 0 4px; }
.kg-area { width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 14px; resize: vertical; line-height: 1.6; }
#kg-transcript { min-height: 120px; background: var(--soft2); }
.kg-q { margin-bottom: 8px; }
.kg-rec { border: 1px solid var(--brand); border-radius: 10px; padding: 10px 12px; background: #f4f8fc; margin-top: 12px; }
.kg-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; color: var(--danger); }
#kg-rec-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
/* ---- 配車表 ---- */
/* 迎え／送りの切り替え */
.hs-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.hs-mode { display: flex; align-items: baseline; gap: 5px; border: 2px solid var(--line); background: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--muted); }
.hs-mode > span { font-size: 12px; font-weight: 400; }
.hs-mode.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.hs-mode.on > span { color: #fff; }
/* 同施設内の有料老人ホームの枠（車ではない） */
.hs-home { flex: 1 1 100%; border: 3px dashed #c8a86a; border-radius: 12px; background: #fdfaf3;
  padding: 7px 10px 8px; margin-bottom: 2px; }
.hs-home.hs-over { border-color: var(--brand); background: #e6f0e6; }
.hs-home-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.hs-home-name { font-weight: 700; font-size: 16px; color: #7a5a1e; }
.hs-home-tag { font-size: 11.5px; color: #8a6a2e; background: #f3e7cd; border-radius: 999px; padding: 2px 10px; }
.hs-home-top .hs-seat { margin-left: auto; }
.hs-home-area { border: 2px dashed #ddc9a0; border-radius: 8px; padding: 6px; background: #fff; min-height: 42px; margin-top: 4px; }
/* フェイスシート: 住所欄。入居していない方は自宅住所だけを出す（🏠の帯は入居の方だけ） */
.fs-home-banner { display: none; }
.fs-addr-cell.in-home .fs-home-banner { display: block; margin-bottom: 6px; padding: 6px 10px;
  border: 1px solid #ddc9a0; border-radius: 8px; background: #fdfaf3; font-size: 13px; }
/* 入居の切替チェック（画面だけ・印刷には出ない）。住所の下に控えめに置く */
.fs-inhome { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; padding: 4px 2px;
  font-size: 12px; color: var(--muted); }
label.fs-inhome input[type="checkbox"] { width: 22px; height: 22px; flex: none; margin: 0; }
.fs-addr-cell.in-home .fs-inhome { color: var(--text); font-weight: 600; }
/* 見出し・日付・ボタンを1行にまとめる（画面をなるべく縦に使わない） */
.hs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.hs-head .hs-date { width: 168px; flex: none; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 15px; }
.hs-head .btn { min-height: 38px; }
.hs-hint { font-size: 12px; margin: 0 0 8px; }
.hs-note-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hs-note-row > label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hs-note-row > input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 14px; }
/* 便の切替と「使う車」を1本の帯にまとめる */
.hs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.hs-bar .hs-modes { margin: 0; margin-right: 6px; }
.hs-pick-t { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.hs-pick-c { border: 2px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; font-weight: 700; cursor: pointer; }
.hs-pick-c.on { border-color: #56718d; background: #e6eef6; color: #24425e; }
.hs-pick-c > span { font-size: 11px; font-weight: 400; margin-left: 4px; }
.hs-none { padding: 16px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; width: 100%; }
/* 未割当のプール */
.hs-pool { border: 2px dashed var(--line); border-radius: 10px; padding: 7px 10px; background: var(--soft2); margin-bottom: 10px; }
.hs-pool-t { font-weight: 700; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.hs-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 34px; align-content: flex-start; }
/* 未割当が多い日でも縦に伸びすぎないように（中だけスクロール） */
.hs-pool > .hs-chips { max-height: 70px; overflow-y: auto; }
.hs-empty { font-size: 12.5px; align-self: center; }
/* 名前のカード（つまんで動かす） */
.hs-chip { border: 1px solid var(--brand); background: #fff; color: var(--text); border-radius: 999px;
  padding: 7px 12px; font-size: 14px; font-weight: 700; cursor: grab; touch-action: none; user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.12); line-height: 1.2; }
.hs-chip:active { cursor: grabbing; }
.hs-chip.hs-dragging { opacity: .3; }
/* つまんで動かしている最中の影。left/top ではなく transform で動かす（画面計算が軽い） */
.hs-chip.hs-ghost { position: fixed; left: 0; top: 0; z-index: 3000; pointer-events: none; opacity: .95;
  will-change: transform; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
/* 車を真上から見た図（上＝前・下＝後ろ／屋根をくりぬいて座席が見える） */
.hs-cars { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.hs-car { flex: 1 1 300px; min-width: 280px; max-width: 460px; position: relative; margin-bottom: 2px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 7px 9px 9px; }
.hs-car.over { border-color: var(--danger); }
.hs-car-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.hs-car-name { font-weight: 700; font-size: 15px; color: #24425e; }
/* 便の順番（時間の早い順）と 何便目か */
.hs-order { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 50%; background: #56718d; color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.hs-trip { font-size: 12px; font-weight: 700; color: #7a5a1e; background: #f3e7cd;
  border: 1px solid #c8a86a; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.hs-car-ops { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.hs-car-ops .link-btn { font-size: 12px; }
.hs-car-ops .hs-del { color: var(--danger); }
.hs-seat { font-size: 12.5px; color: var(--muted); background: var(--soft2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.hs-seat.ng { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
/* 時刻（時・分を入れて「完了」で確定） */
.hs-time { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; margin: 5px 0; min-height: 34px; }
.hs-time > label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hs-time > span { font-size: 12.5px; color: var(--muted); }
.hs-time > .hs-time-val { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.hs-time.editing .btn { min-height: 40px; padding: 0 16px; }
.hs-time.editing { background: #eef4fa; border: 1px solid #9db8d0; border-radius: 10px; padding: 6px 10px; }
.hs-time .hs-th, .hs-time .hs-tm { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 6px; font-size: 18px; text-align: center; font-variant-numeric: tabular-nums; }
/* 車体（真上から） */
.hs-topview { position: relative; margin: 3px 13px 0; padding: 1px 0 3px;
  border: 3px solid #56718d; border-radius: 34px 34px 16px 16px;
  background: linear-gradient(#dbe7f2, #f4f8fc 34%, #f4f8fc); }
.hs-car.over .hs-topview { border-color: var(--danger); }
.hs-topview.hs-over, .hs-car.hs-over .hs-topview { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(46,120,60,.22); }
.hs-pool.hs-over { border-color: var(--brand); background: #e6f0e6; }
.hs-dir { text-align: center; font-size: 10.5px; color: #6b7f93; letter-spacing: 2px; line-height: 1.4; }
.hs-cabin { padding: 3px 7px 4px; display: flex; flex-direction: column; gap: 5px; }
.hs-row { display: flex; gap: 5px; justify-content: center; }
.hs-row.front { padding-bottom: 5px; border-bottom: 2px dashed #b9c9d8; }
/* 1席ぶんの枠。ここに名前を落とす */
.hs-seatbox { flex: 1 1 0; min-width: 0; min-height: 38px; border: 2px dashed #a9bed2; border-radius: 8px;
  background: #fff; display: flex; align-items: center; justify-content: center; padding: 3px; }
.hs-seatbox.taken { border-style: solid; border-color: #6f8fae; background: #eef5ec; }
.hs-seatbox.hs-over { border-color: var(--brand); background: #dcecdc; box-shadow: 0 0 0 3px rgba(46,120,60,.22); }
.hs-seatno { font-size: 11px; color: #93a7bb; }
/* 車椅子スペース（枠を大きく・紫系で区別） */
.hs-seatbox.hs-wheelchair { flex: 1.6 1 0; min-height: 50px; border-color: #9b86c4; border-style: dashed;
  background: #f6f2fb; flex-direction: column; gap: 2px; }
.hs-seatbox.hs-wheelchair.taken { border-style: solid; border-color: #7a63ad; background: #efe8f8; }
.hs-seatbox.hs-wheelchair.hs-over { border-color: var(--brand); background: #dcecdc; }
.hs-wc-mark { font-size: 17px; line-height: 1; color: #5b4a86; }
.hs-seatbox.hs-wheelchair .hs-seatno { color: #8b7ab0; }
.hs-seatbox.hs-wheelchair .hs-chip { border-color: #7a63ad; }
.hs-wc-badge { font-size: 11.5px; background: #efe8f8; color: #5b4a86; border: 1px solid #9b86c4;
  border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.hs-seatbox .hs-chip { width: 100%; padding: 6px 2px; font-size: 13.5px; text-align: center; }
/* 運転席 */
.hs-seatbox.hs-driver { border-style: solid; border-color: #56718d; background: #dfe9f3; flex-direction: column; gap: 2px; }
.hs-dr-t { font-size: 10px; color: #46617d; }
.hs-dr-sel { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px;
  font-size: 13.5px; background: #fff; text-align: center; }
.hs-dr-in { width: 100%; height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 14px; text-align: center; background: #fff; margin-top: 3px; }
.hs-dr-in.hidden { display: none; }
/* タイヤ（真上から見た形＝車体の外側に4つ） */
.hs-w { position: absolute; width: 9px; height: 30px; background: #3a3a3a; border-radius: 3px; }
.hs-w.w1 { left: -11px; top: 24px; } .hs-w.w2 { right: -11px; top: 24px; }
.hs-w.w3 { left: -11px; bottom: 18px; } .hs-w.w4 { right: -11px; bottom: 18px; }
/* 席に入りきらない人 */
.hs-spill { margin-top: 8px; border: 2px solid var(--danger); border-radius: 10px; padding: 6px 8px;
  background: #fdecea; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hs-spill > b { font-size: 12px; color: var(--danger); }
#hs-save.hs-need { background: var(--danger); border-color: var(--danger); }
.hc-cnt { text-align: center; font-size: 13px; color: var(--muted); }
/* 車の登録: 一覧と編集の行 */
.hc-ops { white-space: nowrap; text-align: center; }
.hc-ops .btn { margin-right: 6px; }
tr.hc-editing > td { background: #f4f8fc; }
tr.hc-editing input[type="text"] { width: 100%; height: 38px; border: 1px solid var(--brand); border-radius: 8px; padding: 0 8px; font-size: 15px; }
@media (max-width: 600px) {
  .hs-car { min-width: 0; flex-basis: 100%; }
  .hs-topview { margin: 4px 12px 0; }
  .hs-seatbox { min-height: 56px; }
}
/* ---- 欠席理由（本日一覧のその他／利用予定の✕） ---- */
.abs-other { text-align: left; }
.abs-other input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 16px; }
/* 理由つきの✕は右上に印を出す */
.y-cell.has-note { position: relative; }
.y-cell.has-note .y-note { position: absolute; top: 1px; right: 1px; width: 0; height: 0;
  border-top: 6px solid var(--danger); border-left: 6px solid transparent; }
/* 予定表の下にまとめる「✕の理由」 */
.y-reasons { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--soft2); }
.y-reasons-t { font-weight: 700; font-size: 13px; color: var(--brand); margin-bottom: 6px; }
.y-reasons-list { display: flex; flex-wrap: wrap; gap: 6px; }
.y-reason { font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.y-reason > b { color: var(--danger); margin-right: 4px; }
/* ---- CSV書き出し・復元 ---- */
.csv-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rs-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin: 8px 0;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--soft2); }
.rs-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.rs-item input { width: 18px; height: 18px; flex: none; }
.rs-item b { margin-left: 6px; color: var(--brand); }
.rs-mode { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.rs-mode .fs-check { align-items: flex-start; font-size: 13px; line-height: 1.6; }
/* 保存用の印刷: 1人1ページで区切る */
/* ---- 読み取りテスト（精度チェック） ---- */
.ot-steps { margin: 4px 0 10px 1.2em; padding: 0; font-size: 13px; color: var(--muted); line-height: 1.8; }
.ot-tbl { min-width: 620px; }
.ot-tbl th, .ot-tbl td { vertical-align: top; }
.ot-tbl .ot-f { white-space: nowrap; font-weight: 700; font-size: 12.5px; text-align: left; }
.ot-val { font-size: 13px; word-break: break-all; min-height: 20px; }
.ot-val.ot-empty { color: var(--muted); }
.ot-mark { display: flex; gap: 4px; margin-top: 4px; }
.ot-b { width: 34px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1; }
.ot-b.on { background: #d9efdd; border-color: #4f8a4f; color: #1b6b2b; font-weight: 700; }
.ot-b.ng { background: #f7dcd8; border-color: #b4544a; color: #8a2c22; font-weight: 700; }
.ot-score { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--soft2); }
.ot-score-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--brand); }
.ot-score-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 5px 8px; border-radius: 8px; font-size: 13.5px; }
.ot-score-row.win { background: #e6f0e6; }
.ot-score-row b { min-width: 150px; }
/* 履歴の写真は1枚ずつ削除できる（×は枠の内側に置いて切れないように） */
.np-item.nphist { padding-top: 6px; }
.np-item.nphist .np-del { top: 2px; right: 2px; width: 26px; height: 26px; font-size: 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.hist-item .np-grid { overflow: visible; }
/* 写真を1枚削除するときの確認画面 */
.phdel-box { max-width: 420px; }
.phdel-info { font-size: 13px; margin: 8px 0 6px; color: var(--text); }
.phdel-thumb { border: 1px solid var(--line); border-radius: 8px; background: var(--soft2);
  height: 190px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 8px; }
.phdel-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* 認定情報の写真: 介護保険証・負担割合証を1枚ずつ */
.ns-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.ns-card { flex: 1 1 260px; min-width: 240px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--card); }
.ns-ttl { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--brand); }
.ns-thumb { height: 150px; border: 1px dashed var(--line); border-radius: 8px; background: var(--soft2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ns-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.ns-empty { color: var(--muted); font-size: 13px; }
.ns-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* トリミング */
.crop-box { max-width: 760px; width: 96vw; }
.crop-hint { font-size: 12px; margin: 0 0 8px; }
.crop-stage { position: relative; background: #222; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  max-height: 60vh; touch-action: none; user-select: none; }
.crop-img { max-width: 100%; max-height: 60vh; display: block; pointer-events: none; }
.crop-shade { position: absolute; inset: 0; background: rgba(0,0,0,.5); pointer-events: none; }
.crop-rect { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); cursor: move; }
.crop-rect i { position: absolute; width: 26px; height: 26px; background: #fff; border: 2px solid var(--brand); border-radius: 50%; }
.crop-rect i[data-h="nw"] { left: -13px; top: -13px; cursor: nwse-resize; }
.crop-rect i[data-h="ne"] { right: -13px; top: -13px; cursor: nesw-resize; }
.crop-rect i[data-h="sw"] { left: -13px; bottom: -13px; cursor: nesw-resize; }
.crop-rect i[data-h="se"] { right: -13px; bottom: -13px; cursor: nwse-resize; }
.crop-size { font-size: 12px; margin-top: 6px; text-align: right; }
/* 閲覧画面: 項目内に表示する写真ギャラリー */
.ro-gallery { margin-top: 8px; }
.ro-gallery-title { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: var(--text); }
.img-modal { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.img-modal-inner { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.img-modal-inner img { max-width: 100%; max-height: 82vh; object-fit: contain; background: #fff; border-radius: 6px; }
.img-modal-close { background: #fff; color: #333; border: none; border-radius: 8px; padding: 10px 18px; font-size: 15px; font-weight: 700; cursor: pointer; }
/* 項目まとめて編集 */
.bulk-table { width: 100%; border-collapse: collapse; }
.bulk-table th, .bulk-table td { border: 1px solid var(--line); padding: 5px 8px; vertical-align: top; }
.bulk-table .bulk-name { white-space: nowrap; text-align: left; background: var(--soft2); font-weight: 600; min-width: 90px; }
.bulk-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; }
textarea.bulk-input { min-height: 40px; resize: vertical; overflow: hidden; display: block; }
/* 利用者一覧: 介護度の下の認定期間（小さくグレー） */
/* 編集フォームを行のすぐ下に開く */
.rl-formrow > .rl-formcell { padding: 0 !important; background: var(--soft2); border-left: 4px solid var(--brand); }
.rl-formcell #r-form-wrap { display: block; }
.rl-formcell .card { margin: 0; border-radius: 0; box-shadow: none; }
/* 保存後に戻ってきた行を少しのあいだ光らせる */
.rl-just > td { animation: rl-flash 2.2s ease-out; }
@keyframes rl-flash { 0%, 45% { background: #fff3cd; } 100% { background: transparent; } }
/* 保存ボタンは編集中いつでも画面の右下に出しておく */
.rf-actions { position: fixed; right: 14px; bottom: 14px; z-index: 40;
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: calc(100vw - 28px); }
.rf-actions .rf-who { font-weight: 700; font-size: 13px; color: var(--muted);
  max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-actions .btn { min-width: 92px; }
/* 固定した保存ボタンで最後の項目が隠れないように */
#r-form-wrap .card { padding-bottom: 78px; }
@media (max-width: 600px) {
  .rf-actions { right: 8px; bottom: 8px; padding: 7px 10px; gap: 6px; }
  .rf-actions .rf-who { display: none; }
  .rf-actions .btn { min-width: 82px; }
}
.rl-period { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rl-period.rl-none { color: #b06a00; }
/* 利用者一覧の認定アラート */
.rl-alerts { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px; }
.rl-alert { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.rl-alert.al-danger { background: #f3d9d6; color: #8a2c22; }
.rl-alert.al-warn { background: var(--warn-bg); color: #8a5a00; border: 1px solid var(--warn-line); }
.rl-alert.al-muted { background: var(--soft); color: var(--muted); }
.rl-alert.al-change { background: #dfe7f3; color: #274b8f; }
.rl-alert.al-doc { background: #efe6f5; color: #5b3785; }

/* ---- 通所固有の入力欄（タップ選択・言葉から文章作成） ---- */
.dc-g { margin-bottom: 10px; }
.dc-gt { font-weight: 700; font-size: 13.5px; padding: 4px 8px; background: var(--soft); border-left: 4px solid var(--brand); border-radius: 4px 4px 0 0; }
.dc-updated { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 6px 9px; font-size: 12.5px; margin-bottom: 8px; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fp-chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; line-height: 1.2; }
.fp-chip:hover { background: var(--soft2); }
.fp-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.fp-sel { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fp-sel select { flex: 0 1 200px; }
.fp-changed { display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px;
  background: var(--warn-bg); color: #8a5a00; border: 1px solid var(--warn-line); }
/* 「単語からAI文章作成」／「手入力」の切り替え */
.fw-modes { display: flex; gap: 6px; margin-bottom: 6px; }
.fw-modes .btn.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.fw-ai { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; background: var(--soft2); }
.fw-words { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; max-height: 190px; overflow-y: auto; }
.fw-chip { border: 1px dashed var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; line-height: 1.2; }
.fw-chip:hover { background: var(--soft2); }
.fw-chip.on { background: #e6f0e6; border-color: #4f8a4f; border-style: solid; color: #1e5b1e; font-weight: 700; }
/* 一覧に無い言葉を手入力で足す */
.fw-own { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.fw-owninp { flex: 1; min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: 13.5px; }
.fw-chip.own { border-style: solid; border-color: #8a5a00; }
.fw-chip.own::before { content: "✎ "; }
.fw-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 5px; }
.fw-hint { font-size: 11.5px; }
.fw-ai.hidden { display: none; }

/* ---- 機能訓練計画の評価（モニタリング） ---- */
.mon-kinou { border: 1px solid var(--brand); border-radius: 10px; padding: 8px 10px; background: #f4f8fc; margin-top: 10px; }
.mon-badge.kinou { background: #7a5bd0; }
.kinou-fw textarea { width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; resize: vertical; }
/* 機能訓練の評価だけを単独で保存する行 */
.kinou-save-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.kinou-save { background: #7a5bd0; white-space: nowrap; }
.kinou-save:hover { background: #63499f; }
.kinou-saved { font-size: 12px; }
.kinou-saved.ok { color: #2f7d4a; font-weight: 700; }
/* 対象者を選ぶ一覧 */
.kt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px;
  max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--soft2); }
.kt-item { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; cursor: pointer; }
.kt-item input { width: 18px; height: 18px; flex: none; }

/* ---- 身体測定 ---- */
.st-tbl { min-width: 860px; }
.st-tbl th, .st-tbl td { text-align: center; }
.st-tbl .st-name { text-align: left; white-space: nowrap; }
.st-tbl .st-in { width: 100%; min-width: 62px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; font-size: 15px; text-align: center; }
.st-tbl td:last-child .st-in { text-align: left; min-width: 150px; }
.st-hist { margin-left: 6px; font-size: 12px; }
/* 身体測定を開いている間は、本日一覧（バイタル・食事などの表）を隠す */
#tab-daily.shintai-only .d-only { display: none; }
#tab-daily.shintai-only #d-shintai-panel { border: none; padding: 0; background: none; margin: 0; }
/* 一覧表記（全員の実施状況） */
.st-sumbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft2); font-size: 13px; }
.st-sum-m { font-weight: 700; font-size: 14px; color: var(--brand); }
.st-ok { color: #1e5b1e; font-weight: 700; }
.st-todo { color: #b06a00; font-weight: 700; }
.st-mx .st-row-todo > td { background: #fdf3e3; }
.st-mx { min-width: 780px; }
.st-mx th, .st-mx td { text-align: center; font-size: 13px; white-space: nowrap; }
.st-mx .st-name { text-align: left; }
.st-mx .st-none { color: var(--muted); }
.st-mx .st-has { font-weight: 700; }
/* 一覧表記のマスに直接入力できる（表示中の項目だけ） */
.st-mx .st-mxcell { padding: 2px; }
.st-mx .stm-in { width: 100%; min-width: 58px; height: 34px; border: 1px solid var(--line); border-radius: 6px;
  padding: 0 4px; font-size: 14px; text-align: center; background: #fff; }
.st-mx .st-has .stm-in { font-weight: 700; }
.st-mx .stm-in:focus { border-color: var(--brand); outline: none; }
.st-mx .st-latest { background: var(--soft2); }
/* 履歴の「前回からの増減」 */
.st-diff { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.3; }
.st-diff.up { color: #c0453b; }
.st-diff.down { color: #2d6ca8; }
.st-diff.same { color: var(--muted); font-weight: normal; }
.st-mx .st-sum td { background: #eef2f6; font-weight: 700; font-size: 12px; }
.st-hist-t th, .st-hist-t td { font-size: 12.5px; text-align: center; }
.st-hist-t th:first-child, .st-hist-t td:first-child { white-space: nowrap; }
.st-hist-t td:last-child { text-align: left; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 600px) {
  .st-tbl { min-width: 700px; }
  .kt-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .fp-chip { padding: 9px 13px; font-size: 15px; }
  .fw-chip { padding: 7px 10px; font-size: 13.5px; }
  .fp-sel select { flex: 1 1 100%; }
}

/* ---- 書類チェック ---- */
.doc-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-stat { flex: 1 1 130px; background: var(--soft2); border-radius: 8px; padding: 8px 10px; border-left: 4px solid var(--brand, #1f3b5b); }
.doc-stat .n { font-size: 22px; font-weight: 800; line-height: 1.2; }
.doc-stat .l { font-size: 11px; color: var(--muted); }
.doc-stat.warn { border-left-color: var(--danger); }
.doc-stat.warn .n { color: var(--danger); }
.doc-stat.ok { border-left-color: #1e8449; }
.doc-stat.ok .n { color: #1e8449; }
.doc-alert { background: #fdecea; border-left: 4px solid var(--danger); padding: 8px 10px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.doc-alert.soft { background: var(--warn-bg); border-left-color: var(--warn-line); }
.doc-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-t th, .doc-t td { border-bottom: 1px solid var(--line); padding: 5px 7px; text-align: left; vertical-align: top; }
.doc-t thead th { background: var(--soft2); font-size: 12px; position: sticky; top: 0; z-index: 1; }
.doc-miss { color: var(--danger); font-weight: 700; }
.doc-chips { max-width: 420px; }
.doc-chip { display: inline-block; font-size: 11.5px; background: #fbe3e0; color: #a3302a; border-radius: 4px; padding: 1px 6px; margin: 2px 3px 2px 0; }
.doc-chip.opt { background: var(--soft); color: var(--muted); }
.pill.pill-req { background: #fbe3e0; color: #a3302a; }
/* 記録者の表示切替（本日一覧・個別一覧） */
.rec-by { color: var(--muted); font-size: 12px; }
.hide-recby .rec-by, .hide-recby .rec-col { display: none; }

@media (max-width: 600px) {
  .field { flex-basis: 100%; }
}

/* フェイスシート上部バー（写真読み取り2/3・緊急情報1/3） */
.fs-topbar { display: flex; gap: 8px; align-items: stretch; }
.fs-topbar .btn { white-space: nowrap; }
.fs-read-note { display: flex; align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }

/* 利用者管理の見出し行（タイトル＋新規登録＋復活） */
.r-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.r-head h2 { flex: 1 1 auto; }

/* 家族構成の番号セル */
.fs-table .fam-no { background: var(--soft); font-weight: 700; text-align: center; width: 44px; color: var(--text); }

/* ===== フェイスシート様式フォーム ===== */
.fs-section { margin: 0 0 18px; }
.fs-section > h3 {
  font-size: 14px; margin: 0 0 6px; padding: 6px 10px;
  background: var(--brand); color: #fff; border-radius: 6px;
}
.fs-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.fs-table th.fs-w { width: 150px; }
.fs-table th, .fs-table td { border: 1px solid var(--line); padding: 0; vertical-align: middle; }
.fs-table th {
  background: var(--soft); color: var(--text); font-weight: 600; font-size: 12.5px;
  text-align: left; padding: 6px 8px; white-space: nowrap; line-height: 1.35;
}
.fs-table td { padding: 0; }
.fs-table input[type="text"], .fs-table input[type="date"], .fs-table input[type="number"], .fs-table textarea, .fs-table select {
  border: none; border-radius: 0; width: 100%; padding: 7px 8px; background: transparent; font-size: 14px;
}
.fs-table textarea { min-height: 44px; resize: vertical; display: block; overflow: hidden; }
.fs-table input:focus, .fs-table textarea:focus, .fs-table select:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
/* 読み取り時にAIが文章を自然に直した欄（編集中は赤字、保存すると黒字に戻る） */
.fs-table textarea.ocr-corrected { color: var(--danger); }
/* 認定情報の履歴 */
.nh-table td { padding: 5px 8px; font-size: 12.5px; }
.nh-table .nh-when { white-space: nowrap; color: var(--muted); }
.nh-table .nh-del { width: 34px; text-align: center; }
.nh-table .nh-del .link-btn { font-size: 18px; text-decoration: none; }
.fs-cell-pad { padding: 6px 8px; }
.fs-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; font-size: 13px; white-space: nowrap; }
.fs-check input { width: auto; }
.fs-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 8px; }
.fs-inline .muted { font-size: 12px; }

/* 印刷時はアプリの枠を隠し、フォームだけをきれいに */
@media print {
  header.app-header, nav.tabs, .mode-banner, #ocr-box, .fs-noprint, .toast { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }
  .fs-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== 利用予定（月間表） ===== */
/* 縦横スクロールできる枠。見出し（日付・合計・入浴者数）と氏名列を固定表示 */
.y-scroll { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; }
.y-table { border-collapse: collapse; }
.y-table th, .y-table td { border: 1px solid var(--line); }
/* 見出し行（thead）を上端に固定（top位置はJSで各行に設定） */
.y-table thead th, .y-table thead td { position: sticky; z-index: 3; background: var(--soft2); }
/* 氏名列を左端に固定 */
.y-table .y-name { position: sticky; left: 0; background: var(--soft2); white-space: nowrap; padding: 6px 10px; text-align: left; z-index: 2; min-width: 96px; }
.y-table thead .y-name { z-index: 6; } /* 左上の角（日付×氏名の交差）は最前面 */
.y-table th.y-day { text-align: center; padding: 4px 2px; font-size: 11px; min-width: 26px; background: var(--soft2); }
.y-table th.y-day .wd { display: block; font-size: 10px; color: var(--muted); font-weight: normal; }
.y-table th.y-day.sat { color: #1a5fb4; }
.y-table th.y-day.sun { color: #c0453b; }
.y-table .y-cell { width: 26px; min-width: 26px; height: 40px; text-align: center; cursor: pointer; user-select: none; color: var(--brand); font-size: 13px; padding: 0; line-height: 1; }
.y-table .y-cell .y-a { display: block; height: 20px; line-height: 20px; }
.y-table .y-cell .y-b { display: block; height: 18px; line-height: 18px; font-size: 12px; color: #1466a8; }
.y-table .y-cell.on { background: #dcdcdc; color: #111; font-weight: 700; }
.y-table .y-cell.mk-x { background: #f6dcd9; color: #c0453b; font-weight: 700; }
.y-table .y-cell.mk-t { background: #fdeecf; color: #b5820a; font-weight: 700; }
.y-table .y-cell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.y-table .y-ops-col { white-space: nowrap; text-align: center; padding: 0 2px; }
.y-table .y-op { border: none; background: none; cursor: pointer; font-size: 15px; padding: 2px 3px; }
.y-table .y-total { text-align: center; min-width: 32px; font-size: 12px; color: var(--muted); }
.y-table .y-sum th, .y-table .y-sum-cell { background: var(--soft); font-weight: 700; text-align: center; font-size: 12px; color: var(--text); border-top: 2px solid #9a9a9a; }
.y-table .y-sum .y-name { position: sticky; left: 0; }
.y-table .y-sum-cell.today { background: #fff3bf; }
.y-table th.y-day.today { background: #fff3bf; }
.y-table .y-cell.today { background: #fffbe6; }
.y-table .y-cell.today.on { background: #ffe58f; }
.y-table .y-cell.today.mk-x { background: #f8d7d3; }
.y-table .y-cell.today.mk-t { background: #fbe3b8; }

/* ---- 利用予定: 名前をタップして「その行だけ」編集するモード ---- */
/* 氏名はボタン化（タップで編集の開始・終了） */
.y-table .y-namebtn { border: none; background: none; font: inherit; color: var(--text); cursor: pointer; padding: 2px 4px; border-radius: 6px; text-align: left; }
.y-table .y-namebtn:hover { background: var(--soft); }
/* 編集していない行のマスは押せない（間違って予定が変わらないように） */
.y-table.y-locked .y-cell, .y-table tbody tr:not(.y-editing) .y-cell { cursor: default; }
.y-table.y-locked .y-cell:hover, .y-table tbody tr:not(.y-editing) .y-cell:hover { outline: none; }
/* 編集中の行だけ浮き上がらせる。他の行は薄くして触っていないことを分かりやすく */
.y-table tbody tr.y-editing > th, .y-table tbody tr.y-editing > td { background: #fffdf3; border-top: 2px solid var(--brand); border-bottom: 2px solid var(--brand); }
.y-table tbody tr.y-editing .y-name { background: #fff4cc; box-shadow: -2px 0 0 var(--brand) inset; }
.y-table tbody tr.y-editing .y-namebtn { font-weight: 700; color: #8a5a00; }
.y-table tbody tr.y-editing .y-cell { cursor: pointer; }
.y-table tbody tr.y-editing .y-cell:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.y-table tbody tr.y-editing .y-cell.today { background: #fff6d5; }
/* 編集中は他の行を薄く（浮き上がって見えるように） */
.y-table:not(.y-locked) tbody tr:not(.y-editing):not(.y-dayrow) { opacity: .45; }
/* 編集中の行の真上に差し込む日付・曜日の行 */
.y-table tr.y-dayrow th { background: #fff4cc; border-top: 2px solid var(--brand); }
.y-table tr.y-dayrow .y-name { position: sticky; left: 0; background: #fff4cc; font-size: 12px; color: var(--muted); }

/* 体温の目盛り選択（スクロールして選ぶ） */
.num-temp { cursor: pointer; background: var(--card); }
.tp-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tp-box { background: var(--card); border-radius: 12px; padding: 14px; width: 220px; max-width: 100%; }
.tp-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; text-align: center; }
/* 体温の縦スクロール。36.5中心で9件（36.1〜36.9）がスクロールなしで見える高さ */
.tp-list { height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.tp-item { display: block; width: 100%; border: none; border-bottom: 1px solid var(--line); background: var(--card); height: 40px; line-height: 40px; padding: 0; font-size: 18px; cursor: pointer; color: var(--text); text-align: center; }
.tp-item.on { background: var(--brand); color: #fff; font-weight: 700; }
.tp-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }

/* 再測の備考（理由）は SpO2 の右にまとめて見やすく */
.dg-table .dg-exnote input { min-width: 150px; }
/* 本日一覧 右端の削除列 */
.dg-table .dg-op-col { text-align: center; white-space: nowrap; }
.dg-table .dg-delrow { border: none; background: none; cursor: pointer; font-size: 15px; padding: 2px 4px; }
/* 食事: 完食・空欄は黒、それ以外の摂取量は赤 */
.meal-sel { color: var(--text); }
.meal-sel.meal-low { color: var(--danger); font-weight: 700; }
/* 入浴・排便のタップ入力ボタン */
.dg-table .dg-tap { width: 100%; min-width: 48px; border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 7px 2px; font-size: 15px; cursor: pointer; color: var(--text); }
/* 欠席中の行は記録欄を触れないように（氏名欄は解除用に有効のまま） */
.dg-table tr.dg-absent > td { pointer-events: none; }
/* 注意が必要な値（体温37.0以上・血圧上180以上）は赤太字 */
.vital-alert { color: var(--danger) !important; font-weight: 700 !important; }
.dg-table input.vital-alert { border-color: var(--danger); }

/* 保存済みの再測記録を、通常の行の下に列をそろえて表示（修正・削除できる） */
.dg-table tr.dg-exrow > td, .dg-table tr.dg-exrow > th { background: #fbf7ec; }
.dg-table .dg-exname { font-size: 11px; font-weight: 700; color: #8a5a00; }
.dg-table .dg-exname .dg-exlabel { display: block; }
.dg-table .dgh-time { width: 92px; font-size: 12px; padding: 2px 4px; }
.dg-table .dgh-del { border: none; background: none; cursor: pointer; font-size: 14px; padding: 0 2px; }
/* 再測の「＋」と「履歴表示」を上下に並べる */
.dg-table .dg-remeasure { text-align: center; white-space: nowrap; }
.dg-table .dg-remeasure .dg-plus { display: block; margin: 0 auto; }
.dg-table .dg-histbtn { display: block; margin: 3px auto 0; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 2px 6px; cursor: pointer; white-space: nowrap; }
.dg-table .dg-histbtn.has-extra { border-color: var(--warn-line); background: var(--warn-bg); color: #8a5a00; }

/* アプリ内テンキー（iPadでも確実にテンキー入力できるように） */
.num-pad { cursor: pointer; background: var(--card); }
.np-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.np-box { background: var(--card); border-radius: 12px; padding: 14px; width: 280px; max-width: 100%; }
.np-title { font-weight: 700; font-size: 14px; text-align: center; margin-bottom: 6px; }
.np-disp { font-size: 30px; font-weight: 700; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 10px; background: var(--soft2); }
.np-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np-key { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 14px 0; font-size: 22px; font-weight: 700; cursor: pointer; color: var(--text); }
.np-key.np-fn { font-size: 17px; background: var(--soft); }
.np-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 12px; }
.np-actions .btn { flex: 1; }

/* 追加測定があることを分かりやすく示す */
.dg-table .dg-plus.has-extra { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #8a5a00; font-weight: 700; }

/* 第一号通所事業の区切り（同じ表の中の見出し行） */
.dg-table tr.dg-sechead > th, .dg-table tr.dg-sechead > td { background: var(--soft); font-weight: 700; font-size: 12.5px; padding: 6px 10px; text-align: left; border-top: 3px solid var(--brand); color: var(--text); }
/* 利用者名タップで当日の中止（欠席・ショート・入院中・その他） */
.dg-table .dg-namebtn { border: none; background: none; padding: 0; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.dg-table .dg-abs { display: block; font-size: 11px; font-weight: 700; color: var(--danger); }
.dg-table .dg-abs:empty { display: none; }
.dg-table tr.dg-absent > td { opacity: .5; }
.dg-table tr.dg-absent > .dg-name { background: #f8e3e0; }

/* 服薬確認のサイン */
.dg-medcell { text-align: center; }
/* 服薬確認のサイン。氏名は上段2文字・下段3文字の2行で表示するため改行を許可 */
.dg-medbtn { border: 1px dashed var(--line); background: var(--card); color: var(--muted); border-radius: 6px; padding: 4px 6px; font-size: 12px; cursor: pointer; min-width: 46px; line-height: 1.25; text-align: center; }
.dg-medbtn.signed { border: 1px solid var(--brand); background: var(--soft); color: var(--text); font-weight: 700; font-size: 13px; }
.sign-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sign-box { background: var(--card); border-radius: 12px; padding: 16px; max-width: 460px; width: 100%; max-height: 80vh; overflow: auto; }
.sign-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.sign-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sign-chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 14px; font-size: 14px; cursor: pointer; }
.sign-chip.on { border-color: var(--brand); background: var(--soft); font-weight: 700; }
.sign-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* 手入力で追加した行を浮き上がらせて個別入力しやすくする */
.y-table tbody tr.y-row-new > td, .y-table tbody tr.y-row-new > th { background: #fff3c4; }
.y-table tbody tr.y-row-new > .y-name { box-shadow: 3px 2px 8px rgba(0,0,0,.3); border-left: 3px solid var(--brand); }
.y-table tbody tr.y-row-new > .y-cell { outline: 1px solid #e6c84a; outline-offset: -1px; }

/* 利用予定タブの操作パネル（引き継ぎ・新規追加） */
.y-panel { background: var(--soft2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.y-panel h3 { margin: 0 0 8px; font-size: 14px; }

/* ===== 本日一覧・履歴（まとめて入力の表） ===== */
/* 縦横スクロールできる枠。列見出し（横軸）と利用者名を常に表示 */
.dg-scroll { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; }
.dg-table td { padding: 3px; }
.dg-table th { text-align: center; white-space: nowrap; }
.dg-table thead th { position: sticky; top: 0; z-index: 3; background: var(--soft2); }
.dg-table .dg-name { white-space: nowrap; position: sticky; left: 0; background: var(--soft2); z-index: 2; text-align: left; }
.dg-table thead .dg-name { z-index: 6; } /* 左上の角 */
.dg-table input, .dg-table select { border: 1px solid var(--line); border-radius: 6px; padding: 7px 4px; font-size: 14px; width: 100%; min-width: 54px; }
.dg-table .dg-note input { min-width: 200px; }

/* セットの区切り線（バイタル / 食事 / 排泄・入浴 / 特記） */
.dg-table .dg-gs { border-left: 3px solid #8f8f8f; }

/* 追加測定ボタン */
.dg-table .dg-remeasure { text-align: center; }
.dg-plus {
  border: 1px solid var(--brand); color: var(--brand); background: #fff;
  border-radius: 50%; width: 30px; height: 30px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.dg-plus:hover { background: var(--brand); color: #fff; }

/* 追加測定・測定履歴の段 */
.dg-history { font-size: 13.5px; line-height: 2; }
.dg-h-item { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; white-space: nowrap; display: inline-block; margin: 2px 0; }
.dg-h-item b { font-size: 15px; }

/* 表示切替ボタン（すべて/バイタル/食事/排泄・入浴/備考） */
.dg-views { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.dg-view-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.dg-view-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }

/* 分野の列だけ表示（選択外の列を隠す） */
.dg-table.view-vital .dg-c-meal, .dg-table.view-vital .dg-c-toilet, .dg-table.view-vital .dg-c-rec, .dg-table.view-vital .dg-c-note { display: none; }
.dg-table.view-meal .dg-c-vital, .dg-table.view-meal .dg-c-toilet, .dg-table.view-meal .dg-c-rec, .dg-table.view-meal .dg-c-note { display: none; }
.dg-table.view-toilet .dg-c-vital, .dg-table.view-toilet .dg-c-meal, .dg-table.view-toilet .dg-c-rec, .dg-table.view-toilet .dg-c-note { display: none; }
.dg-table.view-rec .dg-c-vital, .dg-table.view-rec .dg-c-meal, .dg-table.view-rec .dg-c-toilet, .dg-table.view-rec .dg-c-note { display: none; }
.dg-table.view-note .dg-c-vital, .dg-table.view-note .dg-c-meal, .dg-table.view-note .dg-c-toilet, .dg-table.view-note .dg-c-rec { display: none; }

/* レク列（レクを選んでから参加者を選ぶ方式） */
.dg-table .dg-reccell { text-align: left; min-width: 150px; }
.dg-recall { font-size: 10.5px; border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 2px 5px; cursor: pointer; }
#dg-recopen { font-size: 11.5px; border-color: var(--brand); color: var(--brand); font-weight: 700; padding: 3px 7px; margin-top: 2px; }
#dg-recopen:hover { background: var(--brand); color: #fff; }
.dg-recview { display: block; width: 100%; min-height: 30px; text-align: left; border: 1px dashed var(--line); background: #fff; border-radius: 6px; padding: 4px; cursor: pointer; font-size: 13px; line-height: 1.5; }
.dg-recview:hover { border-color: var(--brand); background: var(--soft); }
.dg-recchip { display: inline-block; background: var(--soft); border: 1px solid var(--brand); color: var(--text); border-radius: 999px; padding: 1px 8px; margin: 1px 2px 1px 0; font-size: 12.5px; white-space: nowrap; }
.dg-recadd { color: var(--muted); font-size: 12px; }
.dg-table .dg-recother { width: 100%; margin-top: 3px; font-size: 13px; }

/* レクを選ぶ画面（一覧） */
.rc-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.rc-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 14px; font-size: 16px; cursor: pointer; text-align: left; }
.rc-item:hover { border-color: var(--brand); background: var(--soft); }
.rc-nm { font-weight: 700; }
.rc-cnt { font-size: 13px; color: var(--muted); background: var(--soft2); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.rc-cnt.on { background: var(--brand); color: #fff; font-weight: 700; }

/* ===== 連絡帳（画面） ===== */
.rk-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: #fff; }
.rk-card-head { font-size: 16px; margin-bottom: 6px; }
.rk-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; background: var(--soft2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.rk-summary b { color: var(--text); }
.rk-cbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.rk-examples { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.rk-examples:empty { display: none; }
.rk-ex-chip { text-align: left; border: 1px solid var(--brand); background: var(--soft); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.rk-ex-chip:hover { background: var(--brand); color: #fff; }
.rk-editrow { display: block; }
.rk-editrow.has-photo { display: flex; gap: 8px; align-items: flex-start; }
.rk-comment textarea { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 8px 8px 0 0; padding: 8px; font-size: 15px; display: block; }
.rk-editrow.has-photo textarea { flex: 1 1 auto; }
.rk-photo-slot:empty { display: none; }
.rk-editrow.has-photo .rk-photo-slot { flex: 0 0 36%; max-width: 190px; }
.rk-photo-box { position: relative; }
.rk-photo-box img { width: 100%; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.25); display: block; }
.rk-photo-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 13px; cursor: pointer; }
.rk-fixed { border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px; background: #fff8e6; padding: 6px 8px; font-size: 13px; font-weight: 700; color: #6b5300; }

/* トリミング用モーダル */
.crop-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 12px; }
.crop-box { background: #fff; border-radius: 12px; padding: 16px; max-width: 92vw; max-height: 92vh; overflow: auto; }
.crop-title { font-weight: 700; margin: 0 0 4px; }
.crop-stage { position: relative; margin: 0 auto; touch-action: none; user-select: none; }
.crop-stage img { display: block; }
.crop-rect { position: absolute; border: 2px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); background: rgba(255,255,255,.05); }

/* ===== スマホ表示（内容はそのまま、狭い画面で見やすく） ===== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
  main { padding: 12px; }
  .card { padding: 12px; }

  /* 利用者一覧: 見出しの下にボタンを配置 */
  .r-head { flex-wrap: wrap; }
  .r-head h2 { flex: 1 1 100%; }

  /* ラベル｜入力 の表 → 縦積み（項目名の下に入力欄） */
  .fs-table:not(.fs-grid),
  .fs-table:not(.fs-grid) tbody,
  .fs-table:not(.fs-grid) tr,
  .fs-table:not(.fs-grid) th,
  .fs-table:not(.fs-grid) td { display: block; width: 100%; }
  .fs-table:not(.fs-grid) { border: none; }
  .fs-table:not(.fs-grid) tr { margin-bottom: 8px; }
  .fs-table:not(.fs-grid) th {
    background: transparent; border: none; color: var(--muted);
    padding: 6px 2px 2px; font-size: 12px; white-space: normal; width: 100%;
  }
  .fs-table:not(.fs-grid) th br { display: none; }
  .fs-table:not(.fs-grid) th.fs-w { width: 100%; }
  .fs-table:not(.fs-grid) td { border: 1px solid var(--line); border-radius: 8px; }
  .fs-table:not(.fs-grid) th:empty, .fs-table:not(.fs-grid) td:empty { display: none; }

  /* 家族構成・既往／現病 → 1件ずつカードに（列見出しは各欄の左に表示） */
  .fs-grid, .fs-grid tbody, .fs-grid tr, .fs-grid td { display: block; width: 100%; }
  .fs-grid { border: none; }
  .fs-grid .fs-head { display: none; }
  .fs-grid tr { border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 10px; }
  .fs-grid td { border: none; display: flex; align-items: center; gap: 8px; padding: 3px 0; }
  .fs-grid td::before { content: attr(data-label); flex: 0 0 60px; color: var(--muted); font-size: 12px; }
  .fs-grid td input[type="text"] { border: 1px solid var(--line); border-radius: 6px; flex: 1 1 auto; }

  /* 一覧など通常の表 → 横スクロールで文字が切れないように */
  .table-scroll table { min-width: 560px; }
  /* 食事・バイタルの一覧は列が短いので画面幅に収める */
  .table-scroll table.vh-t { min-width: 0; }
  .vh-t th, .vh-t td { font-size: 11px; padding: 3px 1px; }

  /* ヘッダー・タブを詰める */
  header.app-header h1 { font-size: 16px; }
  nav.tabs button { padding: 12px 12px; font-size: 14px; }
}

/* ==================================================================
   入所（グループホーム）版で足したところ
   ================================================================== */

/* 画面上の操作バー（日付・ボタンを横に並べる） */
.gh-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 6px; }
.gh-bar .field { margin: 0; }
.gh-count { font-weight: 700; font-size: 15px; padding-bottom: 10px; }

/* 名前の前に出す居室番号 */
.gh-room { display: inline-block; background: var(--soft); border: 1px solid var(--line); border-radius: 4px;
  font-size: 11px; padding: 0 4px; margin-right: 4px; color: var(--muted); vertical-align: middle; }

/* 服薬: 拒否・中止など「飲めなかった」印は赤で目立たせる */
.dg-medbtn.gh-med-ng { border-color: var(--danger); color: var(--danger); background: #fdf1f0; font-weight: 700; }
.sign-chip.gh-chip-special { border-color: var(--danger); color: var(--danger); }

/* ---------- 経過記録 ---------- */
.kk-timerow { display: flex; gap: 6px; align-items: center; }
.kk-timerow input[type="time"] { flex: 1 1 auto; }
.kk-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.kk-cat { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; }
.kk-cat.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.kk-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.kk-photo { position: relative; margin: 0; }
.kk-photo img { width: 110px; height: 110px; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }
.kk-photo-del { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

.kk-item { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
.kk-item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.kk-item-time { font-weight: 700; font-size: 16px; min-width: 54px; }
.kk-item-who { font-weight: 700; }
.kk-item-cat { border: 1px solid var(--line); background: var(--soft); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.kk-item-date { color: var(--muted); font-size: 12px; }
.kk-item-ops { margin-left: auto; white-space: nowrap; }
.kk-item-text { white-space: pre-wrap; line-height: 1.6; font-size: 15px; }
.kk-item-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kk-item-photo { width: 130px; height: 130px; object-fit: cover; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }
.kk-item-by { text-align: right; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- 巡視記録 ---------- */
.jn-rounds { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.jn-round { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 16px;
  cursor: pointer; text-align: center; line-height: 1.3; color: var(--text); }
.jn-round b { display: block; font-size: 16px; }
.jn-round span { font-size: 11px; color: var(--muted); }
.jn-round.done { border-color: var(--brand); background: var(--soft); }
.jn-round.done span { color: var(--text); font-weight: 700; }
.jn-round.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.jn-round.on span { color: #fff; }
.jn-now { font-size: 16px; padding-bottom: 2px; }
.jn-table .jn-c { min-width: 92px; }
.jn-table .jn-time input { min-width: 108px; }
.jn-table .dg-note input { min-width: 190px; }

@media (max-width: 640px) {
  .gh-bar .field { max-width: none !important; flex: 1 1 140px; }
  .gh-count { padding-bottom: 0; }
  .kk-item-ops { margin-left: 0; width: 100%; }
  .kk-photo img { width: 88px; height: 88px; }
  .kk-item-photo { width: 104px; height: 104px; }
  .jn-round { padding: 7px 12px; }
}

/* ---------- 今日の記録：列の絞り込み（入所版） ---------- */
.dg-table.gh-daily .gh-medcol { background: #fbfbfd; }
.dg-table.gh-v-vital  .dg-c-meal, .dg-table.gh-v-vital  .gh-c-bath, .dg-table.gh-v-vital  .dg-c-toilet, .dg-table.gh-v-vital  .dg-c-note { display: none; }
.dg-table.gh-v-meal   .dg-c-vital, .dg-table.gh-v-meal  .gh-c-bath, .dg-table.gh-v-meal   .dg-c-toilet, .dg-table.gh-v-meal   .dg-c-note { display: none; }
.dg-table.gh-v-bath   .dg-c-vital, .dg-table.gh-v-bath  .dg-c-meal, .dg-table.gh-v-bath   .dg-c-toilet, .dg-table.gh-v-bath   .dg-c-note { display: none; }
.dg-table.gh-v-toilet .dg-c-vital, .dg-table.gh-v-toilet .dg-c-meal, .dg-table.gh-v-toilet .gh-c-bath,  .dg-table.gh-v-toilet .dg-c-note { display: none; }
.dg-table.gh-v-note   .dg-c-vital, .dg-table.gh-v-note  .dg-c-meal, .dg-table.gh-v-note   .gh-c-bath,  .dg-table.gh-v-note   .dg-c-toilet { display: none; }

/* ---------- 経過記録：今日の記録から自動で集めた行 ---------- */
.kk-item.kk-auto { border-left-color: var(--muted); background: var(--soft2); }
.kk-item.kk-auto .kk-item-time { color: var(--muted); }
.kk-auto-tag { border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.kk-src { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
.kk-src label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; cursor: pointer; }
