:root {
  --paper: #f1f3f1;
  --card: #ffffff;
  --ink: #17251e;
  --muted: #5e6f67;
  --rule: #d8e0db;
  --go: #1c6b48;
  --go-dark: #145237;
  --warn: #a96a05;
  --alert: #9e2b2b;
  --calm: #e6efe9;
  /* 状態表示を強めるために追加（2026-09-23）。既存の --warn 等は変更していない。
     いずれも白文字・本文とのコントラスト比 4.5:1 以上を確認済み。 */
  --warn-strong: #8a5600;
  --mild-ink: #6b5200;
  --mild-bg: #fdf6dd;
  --mild-line: #cfa61f;
  --row-alert-bg: #fdf3f3;
  --row-warn-bg: #fdf8ef;
  --shade: #f6f8f6;
  --radius: 10px;
  --pad: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  font-feature-settings: "palt";
}

h1, h2, h3 { line-height: 1.35; margin: 0; font-weight: 700; }
h1 { font-size: 19px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

/* ---------- shell ---------- */

.bar {
  background: var(--go-dark);
  color: #eef3f0;
  padding: 10px var(--pad);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.bar .who { font-weight: 700; font-size: 16px; }
.bar .sub { color: #b9cfc4; font-size: 13px; }
.bar .spacer { flex: 1 1 auto; }
.bar button {
  background: none;
  border: 1px solid #5c8f76;
  color: #dfeae4;
  border-radius: 6px;
  padding: 3px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

main { max-width: 460px; margin: 0 auto; padding: var(--pad); }
main.wide { max-width: 940px; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 14px;
}
.card > h2 { margin-bottom: 10px; }

.note { color: var(--muted); font-size: 13px; }
.tight { margin-bottom: 6px; }

/* ---------- the client hero: today's state ---------- */

.state {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 6px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px var(--pad);
  margin-bottom: 14px;
}
.state .date { color: var(--muted); font-size: 13px; }
.state .line {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 2px 0 4px;
}
.state .detail { color: var(--muted); font-size: 14px; }
.state.is-open { border-left-color: var(--go); }
.state.is-done { border-left-color: var(--go); background: var(--calm); }
.state.is-absent { border-left-color: var(--muted); }
.state.is-waiting { border-left-color: var(--warn); }

/* ---------- controls ---------- */

button, .btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  padding: 10px 14px;
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #7fb79a;
  outline-offset: 2px;
}
button[disabled] { opacity: 0.45; cursor: default; }

.big {
  display: block;
  width: 100%;
  padding: 20px 16px;
  font-size: 21px;
  font-weight: 700;
  background: var(--go);
  border-color: var(--go-dark);
  color: #fff;
  margin-bottom: 10px;
}
.big.quiet { background: var(--card); color: var(--ink); border-color: var(--rule); font-weight: 600; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline > * { flex: 1 1 140px; }
.inline > button { flex: 0 0 auto; }

/* ---------- messages ---------- */

.thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.msg { padding: 9px 12px; border-radius: 10px; max-width: 88%; white-space: pre-wrap; word-break: break-word; }
.msg .stamp { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.mine { align-self: flex-end; background: var(--calm); }
.msg.theirs { align-self: flex-start; background: var(--shade); border: 1px solid var(--rule); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* ---------- staff list ---------- */

.list { border-top: 1px solid var(--rule); }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-left: 5px solid transparent;
  border-radius: 0;
  background: var(--card);
  padding: 12px 14px;
}
.list-row:hover { background: var(--shade); }
.list-row .name { font-weight: 700; }
.list-row .meta { color: var(--muted); font-size: 13px; }
.list-row .grow { flex: 1 1 auto; min-width: 0; }
/* 要対応の行は左端の縦線を太くし、淡い背景を敷いて一目で分かるようにする。
   色だけに頼らないよう、行内の文字ラベル（未返信・未報告など）は従来どおり表示する。 */
.list-row.alert { border-left-color: var(--alert); border-left-width: 6px; background: var(--row-alert-bg); }
.list-row.warn { border-left-color: var(--warn-strong); border-left-width: 6px; background: var(--row-warn-bg); }
.list-row.mild { border-left-color: var(--mild-line); border-left-width: 6px; }
.list-row.ok { border-left-color: var(--go); }
.list-row.idle { border-left-color: var(--rule); }
.list-row.alert:hover { background: #fbe9e9; }
.list-row.warn:hover { background: #fbf1e2; }

.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); white-space: nowrap; }
/* 対応が必要な状態は塗りつぶしで強調する。完了・対象外は淡いまま残し、
   目線が「まだ終わっていない行」へ向くようにする。 */
.tag.alert { color: #ffffff; border-color: var(--alert); background: var(--alert); font-weight: 700; }
.tag.warn { color: #ffffff; border-color: var(--warn-strong); background: var(--warn-strong); font-weight: 700; }
.tag.mild { color: var(--mild-ink); border-color: var(--mild-line); background: var(--mild-bg); font-weight: 700; }
.tag.ok { color: var(--go); border-color: #bcd8c8; background: var(--calm); }
.tag.idle { color: var(--muted); background: var(--shade); }

/* 件数のカード表示。狭い画面では flex-wrap で自動的に折り返す。
   数字の色は paintCounts() が付ける。0件のときは色を付けない。 */
.counts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.count-card {
  flex: 1 1 110px;
  min-width: 96px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
  /* 押せるボタンになったので、ブラウザ既定の見た目を打ち消す。 */
  font: inherit;
  color: inherit;
  cursor: pointer;
}
/* 押して一覧を開いている間は、どのカードを開いたか分かるようにする。 */
.count-card.open {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.count-list {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 12px;
  overflow: hidden;
}
.count-list-head {
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--shade);
  border-bottom: 1px solid var(--rule);
}
.count-list .empty { padding: 10px 14px; }
.count-list .list-row:last-child { border-bottom: 0; }
.count-card .num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.count-card .num.alert { color: var(--alert); }
.count-card .num.warn { color: var(--warn-strong); }
.count-card .label { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

pre.copy {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--shade);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  max-height: 260px;
  overflow: auto;
}

.flash {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
  border: 1px solid;
}
.flash.err { background: #fbf1f1; border-color: #e2bcbc; color: #7d2222; }
.flash.ok { background: var(--calm); border-color: #bcd8c8; color: var(--go-dark); }
.hidden { display: none; }

.banner {
  background: #fdf7ec;
  border: 1px solid #e6d2a8;
  color: #7a4d04;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.checkline { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; font-size: 14px; }
.checkline input { width: auto; flex: 0 0 auto; margin-top: 4px; }

.fold {
  border-top: 1px solid var(--rule);
  margin-top: 14px;
  padding-top: 10px;
}
.fold > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  list-style: none;
  padding: 4px 0;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: '＋　'; color: var(--muted); font-weight: 400; }
.fold[open] > summary::before { content: '−　'; }

.denied {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 6px solid var(--alert);
  border-radius: var(--radius);
  padding: 24px var(--pad);
  max-width: 460px;
  margin: 0 auto;
}
.denied h1 { margin-bottom: 8px; }
.denied .big { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- 週の振り返り（週モニ） ---------- */

/* 設問。ラベル・補足文・入力欄を1組にする。 */
.q { margin-bottom: 18px; }
.q-label { display: block; font-weight: 700; margin-bottom: 4px; }
.q-note { color: var(--muted); font-size: 13px; margin: 0 0 6px; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: flex-start; gap: 10px; }
/* 共通指定の「input { width: 100% }」がラジオボタンにも効いてしまい、
   丸ボタンが行幅いっぱいに広がって選択肢の文字が押し出されていた。
   ラジオボタンだけ共通指定から外す。 */
.choice input[type="radio"] {
  width: auto;
  flex: 0 0 auto;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
/* 選択肢の文字。共通の label（13px・グレー・block）は設問名用なので上書きする。 */
.choice label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.5;
  cursor: pointer;
}
.other-input { width: 100%; margin-top: 10px; }

/* 自己採点。数字を併記し、色や形だけに頼らない。 */
.stars { display: flex; flex-wrap: wrap; gap: 8px; position: relative; }
.stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.star {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  background: var(--card);
  font-size: 15px;
}
.stars input:checked + .star {
  background: var(--go);
  border-color: var(--go-dark);
  color: #ffffff;
  font-weight: 700;
}
.stars input:focus-visible + .star { outline: 2px solid var(--go-dark); outline-offset: 2px; }

/* 支援員が読む回答。 */
.q-answer { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.q-answer .q-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.q-answer .q-value { white-space: pre-wrap; }
/* 項目9「困ったこと」は常に強調する。警告色は使わない。
   毎回の回答に赤や橙を付けると、本当に急ぐ赤が埋もれるため。 */
.q-answer.emphasis {
  background: var(--shade);
  border-left: 4px solid var(--ink);
  padding: 10px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.q-answer.emphasis .q-value { font-size: 16px; }

/* 推移（モニタリング材料）。 */
.card-inner { margin-top: 16px; }
.trend-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.trend-label { flex: 0 0 68px; color: var(--muted); }
.trend-track { flex: 1 1 auto; height: 12px; background: var(--shade); border-radius: 999px; overflow: hidden; }
.trend-fill { display: block; height: 100%; background: var(--go); }
.trend-fill.warn { background: var(--warn-strong); }
.trend-fill.alert { background: var(--alert); }
.trend-value { flex: 0 0 24px; text-align: right; font-weight: 700; }

/* 本人の履歴。 */
.wk-item { border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--card); }
.wk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.wk-score { color: var(--muted); font-size: 13px; }
.wk-comment { margin-top: 8px; padding: 8px 10px; background: var(--calm); border-radius: var(--radius); }

/* ---------- 成果報酬 ---------- */
/* 画像は2枠を横並びにするが、狭い画面では自然に1列へ落とす。 */
.reward-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.reward-slot {
  flex: 1 1 200px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card);
}
.reward-slot h3 { margin: 0 0 8px; font-size: 15px; }
.reward-slot .empty { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

/* サムネイル。縦長の写真でカードが伸びすぎないよう高さを抑える。 */
.reward-thumb {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--shade);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

/* ファイル選択は隠さずそのまま出す。見た目より、押す場所が分かることを優先。 */
.reward-pick { display: block; font-weight: 700; margin-bottom: 6px; }
.reward-slot input[type="file"] { width: 100%; font-size: 14px; }

/* 定型文。スレッドの吹き出し（.thread / .msg）は既存のものをそのまま使う。 */
.phrases { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.phrase {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--shade);
  color: var(--ink);
  cursor: pointer;
}
.phrase:hover { background: var(--calm); }

/* 成果報酬のやり取り欄。カード内の区切りを分かるようにする。 */
#rewardTalk, #rwTalk { margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 12px; }
#rewardTalk h3, #rwTalk h3 { margin: 0 0 8px; font-size: 15px; }

/* ---------- 添付画像（開始・終了・週モニ） ---------- */
/* サムネイルの見た目は成果報酬（.reward-thumb）を流用し、並べ方だけ足す。 */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.thumbs .empty { color: var(--muted); font-size: 13px; margin: 0; }
.thumb { flex: 0 1 200px; }
.thumb .reward-thumb { margin-bottom: 4px; }
.thumb-del {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--alert);
  cursor: pointer;
}
.thumb-del:hover { background: var(--row-alert-bg); }

/* ---------- チャット ---------- */
/* 写真は復号が終わってから入れる。読み込み中と失敗が分かるようにする。 */
.img-slot { display: inline-block; }
.img-loading, .img-failed {
  display: inline-block; padding: 8px 10px; font-size: 12px;
  color: var(--muted); background: var(--shade);
  border: 1px solid var(--rule); border-radius: 8px;
}
.img-failed { color: var(--alert); }
.msg-shots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg-shot { max-width: 150px; max-height: 260px; border-radius: 8px;
            border: 1px solid var(--rule); display: block; }

/* 上部バーの「困ったとき」。どの画面からも1タップで開けるようにする。 */
.bar .btn.help { background: #fff; color: var(--go-dark); font-weight: 700; }

/* ---------- 写真を選ぶ（チャット） ---------- */
/* 主な利用者はスマホでスクリーンショットを送る。実機で確かめて、
   押す場所を大きくし、貼り付けは補助に回した。 */
.pick-photo {
  display: block; width: 100%;
  min-height: 64px; padding: 18px 16px;
  font-size: 17px; font-weight: 700;
  border: 2px dashed var(--go); border-radius: var(--radius);
  background: var(--calm); color: var(--go-dark);
  text-align: center; cursor: pointer;
}
.pick-photo:disabled { opacity: .55; border-style: solid; cursor: default; }
.pick-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; text-align: center; }

/* 送信前のサムネイル。<canvas> をそのまま置く。
   アプリのCSPは img-src 'self' なので、data: も blob: も <img> では出せない
   （iPhone実機で両方とも遮断されることを確認済み）。 */
.shots { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.shot { position: relative; flex: 0 0 calc(33.333% - 6px); }
.shot canvas, .shot img {
  width: 100%; aspect-ratio: 3 / 5; object-fit: cover;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--shade);
  display: block;
}
.shot .drop {
  position: absolute; top: 4px; right: 4px;
  width: 30px; height: 30px; line-height: 1;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,.66); color: #fff; font-size: 17px; cursor: pointer;
}
.shot .size { display: block; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- 日次報告の追加項目 ---------- */
/* スマホでも押しやすいよう、プルダウンを大きくする。
   iOSで文字が自動拡大されないよう16px以上にしてある。 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
select.big-select {
  display: block; width: 100%;
  min-height: 56px; padding: 12px 14px;
  font-size: 17px; line-height: 1.4;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
}
select.big-select:invalid { color: var(--muted); }
input.big-text {
  display: block; width: 100%;
  min-height: 52px; padding: 12px 14px;
  font-size: 17px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
}

/* 支援記録用の文章は13行あり、既存の pre.copy（260px）では収まらない。
   この枠だけ高さを広げる（ノービー転記の枠は従来どおり）。 */
#geminiText { max-height: 440px; font-size: 14px; }

/* 職員考察は長文を貼り付けるので、入力欄を高めにする。 */
textarea.tall { min-height: 180px; }

/* ---------- プッシュ通知の設定 ---------- */
.push-steps { margin: 8px 0 0; padding-left: 1.3em; color: var(--muted); font-size: 13px; }
.push-steps li { margin-bottom: 3px; }
.device-row {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--rule); padding: 8px 0; font-size: 13px;
}
.device-row .grow { flex: 1 1 auto; }
.device-row .meta { color: var(--muted); font-size: 12px; }

/* ---------- 通知のベルと一覧 ---------- */
.bell {
  position: relative;
  background: none; border: 1px solid #5c8f76; color: #dfeae4;
  border-radius: 6px; padding: 3px 10px; font-size: 15px; cursor: pointer;
}
.bell .badge {
  position: absolute; top: -8px; right: -8px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--alert); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.notice-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--rule); border-left: 5px solid transparent;
  border-radius: 0; background: var(--card); padding: 12px 14px;
}
.notice-row:hover { background: var(--shade); }
.notice-row.unseen { border-left-color: var(--alert); background: var(--row-alert-bg); }
.notice-row .grow { flex: 1 1 auto; min-width: 0; }
.notice-row .who { font-weight: 700; }
.notice-row .meta { color: var(--muted); font-size: 12px; }
.filter-chip {
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card); cursor: pointer;
}
.filter-chip.on { background: var(--go); border-color: var(--go-dark); color: #fff; font-weight: 700; }

/* --- アコーディオン（職員画面） -------------------------------------
   項目のタイトルだけを帯で出し、押すと中身が開く。
   一度に開くのは1つだけ（開閉の制御は staff.js 側）。 */
.card.acc { padding: 0; overflow: hidden; }

.acc-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: 56px;          /* 指の当たる高さ。44pxより余裕を持たせる */
  padding: .9rem 1rem;
  background: none;
  border: 0;
  border-radius: inherit;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.acc-head:hover { background: rgba(0, 0, 0, .04); }
.acc-head:focus-visible { outline: 3px solid #2f6f4f; outline-offset: -3px; }

.acc-title { flex: 1 1 auto; font-size: 1.05rem; }

/* 閉じているときに出す要点のバッジ。0件のときは中身を空にして出さない */
.acc-badges { display: flex; gap: .35rem; flex: 0 0 auto; }
.acc-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #e8ebe9;
  color: #333;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.acc-badge.alert { background: #c0392b; color: #fff; }
.acc-badge.warn  { background: #e0a100; color: #332b00; }

.acc-mark { flex: 0 0 auto; font-size: .8rem; opacity: .65; }

.acc-body { display: none; padding: 0 1rem 1rem; }
.acc.open .acc-body { display: block; }
.acc.open .acc-head { border-bottom: 1px solid rgba(0, 0, 0, .08); }
/* 開いている項目はバッジを出さない（中身に同じ数字が出ているため） */
.acc.open .acc-badges { display: none; }

/* 中身の先頭が詰まらないように */
.acc-body > :first-child { margin-top: 1rem; }

@media (max-width: 480px) {
  .acc-head { padding: .9rem .75rem; gap: .4rem; }
  .acc-title { font-size: 1rem; }
  .acc-body { padding: 0 .75rem 1rem; }
  .acc-badge { font-size: .72rem; padding: .12rem .4rem; }
}

/* --- ログイン画面：パスワードの貼り付けを助ける ------------------------ */
.pw-row { display: flex; gap: .5rem; align-items: stretch; }
.pw-row input { flex: 1 1 auto; min-width: 0; }
.pw-show {
  flex: 0 0 auto;
  min-width: 4.5rem;
  min-height: 44px;
  padding: 0 .8rem;
  background: #fff;
  border: 1px solid #9aa5a0;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
.pw-show:hover { background: #f1f3f1; }
.pw-show[aria-pressed="true"] { background: #e8efe9; border-color: #2f6f4f; }

/* --- 「確認待ち」の案内文 ---------------------------------------------- */
.pending-note { display: inline-block; margin-top: .4rem; line-height: 1.6; }

/* --- 成果報酬：画像を小さくしている間の表示 ---------------------------- */
.reward-note:empty { display: none; }
.reward-note { margin-top: .4rem; }

/* ノービーIDが未設定の利用者の一覧。CSV出力の手前で出す。 */
.missing-list { margin: .4rem 0 .2rem 1.2rem; padding: 0; }
.missing-list li { margin: .2rem 0; line-height: 1.6; }

/* 絵文字ボタン。チャット欄のすぐ下に置く。記録の入力欄には出さない。 */
.emoji-row { display: flex; align-items: flex-start; gap: .5rem; flex-wrap: wrap;
             margin: .35rem 0 .2rem; }
.emoji-toggle { font-size: 1.25rem; line-height: 1; padding: .35rem .6rem;
                min-width: 2.75rem; min-height: 2.75rem; }
.emoji-palette { display: flex; flex-wrap: wrap; gap: .3rem; }
/* .hidden より後ろにあるので、ここで打ち消さないと開いたままになる。 */
.emoji-palette.hidden { display: none; }
.emoji-key { font-size: 1.35rem; line-height: 1; padding: .3rem .45rem;
             min-width: 2.75rem; min-height: 2.75rem; }

/* 報告の自動入力。本人が書いたものと見分けられるようにする。 */
.msg.auto { border-left: 4px solid #145237; white-space: pre-wrap; }
/* 本文の中のURL。文字の色だけで分からせず、下線も必ず残す。 */
.msg-link { color: inherit; text-decoration: underline; word-break: break-all; }
/* 取り消した1通。色だけに頼らず「取り消しました」の文字も出す。 */
.retracted { color: var(--muted); font-style: italic; }
.msg.retracted-msg { opacity: .72; }
.tag.retracted { background: var(--shade); color: var(--muted); }
/* 共有パソコンへの注意。見落とされないよう、ふつうの note より強く出す。 */
.warn-note { color: var(--warn-strong); }
/* チャットに付けたPDF。押すとダウンロードされる。 */
.msg-files { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.file-link { display: block; color: inherit; text-decoration: underline;
  word-break: break-all; }
/* 大きさは名前のすぐ後ろに続ける。別の行に落ちると何の数字か分からなくなる。 */
.file-size { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.file-pick { margin-top: 6px; }
/* 週モニのバッジ。体調の気がかりと、確認の状態を並べて出す。 */
.wk-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
/* 成果報酬。いいね・投稿を別の枠にし、各3枚まで並べる。 */
.reward-shots { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
/* 3枚を横に並べる。スマホでも1列に収まるよう、幅を枠の1/3までにする。 */
.reward-shot { display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 0 1 calc((100% - 16px) / 3); min-width: 0; }
.reward-shot .reward-thumb { width: 100%; height: auto; max-height: 220px;
  object-fit: contain; }
.reward-slot h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reward-waiting { border: 1px dashed var(--rule); border-radius: var(--radius);
  padding: 8px 10px; margin: 6px 0; }
.reward-waiting div { display: flex; align-items: center; gap: 8px; }
.file-chosen { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.file-chosen div { display: flex; align-items: baseline; gap: 8px; }
.tag.auto { background: #e7f0ea; color: #145237; }

/* チャットの写真。押すと大きくなる。 */
.shot-zoom { padding: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; }
.shot-zoom.big { cursor: zoom-out; }
.shot-zoom.big .msg-shot { max-width: 100%; max-height: none; }

/* --- 下タブ（職員画面） ---------------------------------------------
   画面を5つに分け、下の帯でだけ行き来する。一度に開くのは1つ。
   帯は画面下に貼り付けるので、本文の下にその分の余白を足している。 */
main.tabbed { padding-bottom: 86px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative;
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  /* 指で押す場所。小さすぎると隣を押してしまう。 */
  min-height: 56px; padding: 6px 2px;
  border: 0; border-radius: 0;
  background: none; color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.tab-mark { font-size: 19px; line-height: 1; }
.tab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; }
/* 選んでいるタブ。色だけに頼らず、上端の線と太字でも分かるようにする。 */
.tab.on { color: var(--go-dark); font-weight: 700; }
.tab.on::before {
  content: ''; position: absolute; top: 0; left: 12%; right: 12%; height: 3px;
  background: var(--go);
}
/* タブの数字。未返信・要対応の件数をそのまま出す。 */
.tab-badge {
  display: block; position: absolute; top: 4px; left: 50%; margin-left: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px;
  background: var(--alert); color: #ffffff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tab-badge.hidden { display: none; }

/* --- トーク一覧（職員画面のチャット） -------------------------------- */
.talk-tools { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; }
.talk-tools > div { flex: 0 1 auto; }
.talk-tools #spSearch { flex: 1 1 180px; min-width: 140px; margin: 0; }
.talk-tools .checkline { margin: 0 0 6px; white-space: nowrap; }
.talk-list { border-top: 1px solid var(--rule); }
.talk-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: var(--card);
  padding: 10px 6px;
  cursor: pointer;
}
.talk-row:hover { background: var(--shade); }
/* 名前の1文字を丸で出す。写真は預からない決まりなので、文字だけにしている。 */
.talk-face {
  flex: 0 0 auto;
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--calm); color: var(--go-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.talk-grow { flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 2px; }
/* 名前と施設は同じ行。長い名前は「…」で切り、施設名は残す。 */
.talk-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.talk-name { flex: 0 1 auto; min-width: 0;
  font-weight: 700; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.talk-where { flex: 0 0 auto;
  color: var(--muted); font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
/* 最後の1通。1行だけ出し、あふれる分は「…」にする。 */
.talk-last { display: block; color: var(--muted); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 最後の1通が取り消し済みのときの印。本文はこれまでどおり続けて出す。 */
.talk-retracted { display: inline-block; margin-right: 6px;
  padding: 0 6px; border-radius: 4px; font-size: 11px; font-style: normal;
  vertical-align: middle; }
.talk-side { flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; justify-content: space-between;
  align-self: stretch; gap: 6px; min-height: 44px; }
.talk-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
/* 未返信の数。右下に赤い丸で出す。 */
.talk-badge {
  display: block;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: var(--alert); color: #ffffff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}

/* --- やり取りの全画面（職員画面） ------------------------------------
   1行を押したら、その人とのやり取りだけを画面いっぱいに出す。
   戻る矢印で一覧に戻る。開いている間は下タブを隠す。 */
.chat-full {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--paper);
}
.chat-full.hidden { display: none; }
body.chat-open { overflow: hidden; }
body.chat-open .tabbar { display: none; }
.chat-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px var(--pad);
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--go-dark); color: #eef3f0;
}
.chat-back {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border: 1px solid #5c8f76; border-radius: 999px;
  background: none; color: #dfeae4;
  font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
}
.chat-title { min-width: 0; }
.chat-title #spDetailName { display: block; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title .note { color: #b9cfc4; }
/* やり取りの本体だけが動く。入力欄は下に残す。 */
.chat-scroll {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: 0; padding: var(--pad);
}
.chat-compose {
  flex: 0 0 auto;
  max-height: 45vh; overflow-y: auto;
  border-top: 1px solid var(--rule);
  background: var(--card);
  padding: 10px var(--pad);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.chat-compose textarea { margin-bottom: 0; min-height: 60px; }
.chat-compose label { margin-top: 0; }
/* 全画面では3つのボタンを1行に収める。やり取りの見える範囲を広く取るため。 */
.chat-compose .row-actions { flex-wrap: nowrap; align-items: stretch; }
.chat-compose .row-actions > * { flex: 1 1 0; min-width: 0; }
.chat-compose .pick-photo { min-height: 46px; padding: 10px 8px; font-size: 14px; }

/* パソコンでは、やり取りを真ん中に寄せて読みやすい幅にする。 */
@media (min-width: 720px) {
  .chat-scroll, .chat-compose { width: 100%; max-width: 720px;
    margin-left: auto; margin-right: auto; }
  .chat-head > .chat-title { flex: 1 1 auto; }
}

/* --- タブの先頭に出す件数（職員画面） --------------------------------
   チャット・成果報酬・週モニは、開閉する帯をやめて下タブに置き換えた。
   帯の右に出していた件数は、下タブの数字と、この1行の両方に残している。
   1行に収め、入りきらないときは横に送る（折り返して縦に伸ばさない）。 */
.tab-counts {
  display: flex; flex-wrap: nowrap; gap: 10px;
  align-items: baseline;
  /* 390px でも5つ全部が1行に収まる大きさにしてある。
     端末の文字を大きくしている人のために、はみ出す場合は横に送れるようにする。 */
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 0 12px; padding-bottom: 2px;
}
.tab-counts .count-card, .tab-counts .count {
  flex: 0 0 auto; min-width: 0;
  display: flex; align-items: baseline; gap: 4px;
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  text-align: left; white-space: nowrap; cursor: default;
}
.tab-counts .count-card .num {
  display: inline; font-size: 15px; line-height: 1.3;
}
.tab-counts .count-card .label { display: inline; margin-top: 0; font-size: 12px; }
.tab-counts .count { gap: 3px; }
.tab-counts .count strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.tab-counts .count span { font-size: 12px; color: var(--muted); }

/* --- 一斉共有（お知らせ） -------------------------------------------- */
/* 取り消しの帯。10分のあいだだけ、チャットのタブの上に出る。 */
.bc-undo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--mild-line); border-radius: var(--radius);
  background: var(--mild-bg); color: var(--mild-ink);
  padding: 10px 12px; margin-bottom: 12px;
  font-weight: 700;
}
.bc-undo.hidden { display: none; }
.bc-undo button { flex: 0 0 auto; }
/* 宛先の一覧。人数が多くても画面が伸びきらないよう、枠の中で送る。 */
.bc-people { margin-top: 12px; }
.bc-people-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bc-people-head strong { flex: 1 1 auto; }
.bc-people #bcPeople {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 8px 10px; margin-top: 6px;
}
.bc-person { margin: 0; padding: 4px 0; min-height: 32px; align-items: center; }
/* 確認の画面。何人に届くかを、本文より先に大きく出す。 */
.bc-to { font-weight: 700; font-size: 16px; margin: 6px 0; }
.bc-preview {
  display: flex; flex-direction: column;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--shade);
  padding: 10px; margin-bottom: 8px;
}
.bc-preview .msg { max-width: 100%; align-self: flex-end; }
/* 付ける写真の小さなサムネイル（最大3枚）。CSPが img-src 'self' のため
   <canvas> をそのまま置く。送信・取り消しの動きには関わらない。 */
.bc-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bc-thumbs.hidden { display: none; }
.bc-thumb {
  border: 1px solid var(--rule); border-radius: 6px;
  background: var(--shade); padding: 3px; line-height: 0;
}
.bc-thumb canvas { display: block; width: auto; height: auto;
  max-width: 72px; max-height: 72px; border-radius: 4px; }
/* PDFはファイル名だけ。中身は出さない。 */
.bc-files { margin-bottom: 8px; }
.bc-files.hidden { display: none; }
.bc-file { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
