/*
 * 夜勤ホームと、変化・異常・緊急の表示。
 *
 * ★新人夜勤者が、この1画面で迷わないことを最優先にする。
 *
 * 色の使い分け（REVISION-03）:
 *   未確認 … 色で警告しない（グレーの「未」）。まだ終わっていない通常業務
 *   注意   … 黄土色。普段と違う、確認した方がよい変化
 *   要確認 … 赤字・警告マーク。重要な変化・対応が必要
 *   緊急   … 赤い帯。緊急・重要イベント。★赤は本当に重要なものに限定する
 */

:root {
  --level-caution: #8a5a00;
  --level-caution-bg: #fdf4e3;
  --level-important: #a3231d;
  --level-important-bg: #fdf0ef;
  --emergency: #b3160f;
  --emergency-bg: #fde8e6;
  --pending: #4a5463;
  --pending-bg: #eceff3;
  --done: #0f6b4f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --level-caution: #d9a05b;
    --level-caution-bg: #33291a;
    --level-important: #ef8a84;
    --level-important-bg: #341f1e;
    --emergency: #ff6b62;
    --emergency-bg: #3d1a18;
    --pending: #c4cbd6;
    --pending-bg: #2b3038;
    --done: #6fd3ad;
  }
}

/* ---- 勤務単位の日付 -------------------------------------------------- */

.shift-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.shift-label { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.shift-range { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.shift-now { font-size: 13px; color: var(--text-muted); }

/* ---- 節の見出し ---------------------------------------------------- */

.home-section { margin-bottom: 24px; }

.home-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}

.home-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 14px;
  flex: 0 0 auto;
}

.home-sub { margin: 0 0 10px; font-size: 14px; color: var(--text-muted); }

.note { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.note-info { background: var(--surface-2); color: var(--text); }

/* ---- 緊急・重要イベント -------------------------------------------- */

.emergency-heading { color: var(--emergency); }

.emergency-card {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 2px solid var(--emergency);
  border-radius: 10px;
  background: var(--emergency-bg);
}

.emergency-card.status-resolved {
  border-width: 1px;
  border-color: var(--border);
  background: var(--surface);
}

.emergency-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.emergency-card-name { font-size: 17px; font-weight: 700; }
.emergency-card-time { font-size: 14px; font-weight: 700; color: var(--emergency); }
.emergency-card.status-resolved .emergency-card-time { color: var(--text-muted); }

.emergency-card-text { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.emergency-card-meta { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }

.btn-resolve {
  margin-top: 6px;
  padding: 0;
  font-weight: 700;
}

.followup-pill {
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.followup-open { background: var(--emergency); color: #ffffff; }
.followup-resolved { background: var(--surface-2); color: var(--text-muted); }

/* ---- ① 日勤からの申し送り ------------------------------------------ */

.handover {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.handover-caution { border-left-color: var(--level-caution); }
.handover-important { border-left-color: var(--level-important); background: var(--level-important-bg); }

.handover-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.handover-name { font-size: 17px; font-weight: 700; }

.handover-items { margin: 0; padding: 0; list-style: none; }

.handover-item {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
}
.handover-item:first-child { border-top: 0; }

.handover-time { flex: 0 0 auto; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.handover-text { flex: 1 1 160px; }
.handover-reason { flex: 1 1 100%; font-size: 13px; font-weight: 700; color: var(--level-important); }

/* 申し送りの確認 */
.ack-box { margin-top: 4px; }
.btn-ack {
  min-height: 52px;
  border: 2px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-size: 16px;
}
.ack-status { margin: 4px 0 8px; font-size: 15px; font-weight: 700; }
.ack-status.is-done { color: var(--done); }
.ack-status.is-new { color: var(--level-caution); }
.ack-others { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }

/* ---- ② 今夜みんなに共通して見ること（コンパクト） ------------------ */

.checkpoint-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.checkpoint-chip {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.checkpoint-details > summary {
  min-height: var(--tap-min);
  padding: 10px 2px;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
}

.checkpoint-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.checkpoint {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.checkpoint:first-child { border-top: 0; }
.checkpoint-label { font-size: 15px; font-weight: 700; }
.checkpoint-note { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ---- ③ 今回の夜勤の測定（夕 → 朝） -------------------------------- */

.measure-slot {
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.measure-slot-title { margin: 0 0 8px; font-size: 15px; }

.measure-items { display: flex; flex-wrap: wrap; gap: 8px; }

.measure-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 15px;
}
.measure-name { font-weight: 700; }
.measure-count { font-variant-numeric: tabular-nums; }

/* 未実施は色で警告しない。「未N」をグレーで添えるだけ。 */
.measure-chip.state-pending { border-style: dashed; }
.measure-remaining {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pending-bg);
  color: var(--pending);
  font-size: 13px;
  font-weight: 700;
}

.measure-special-list { margin: 10px 0 0; padding: 0; list-style: none; }
.measure-special-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0 0;
  border-top: 1px dashed var(--border);
}

/* ---- 「未」と「済」のしるし（色で警告しない） ----------------------- */

.pending-tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--pending-bg);
  color: var(--pending);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}

.done-tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--done);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}

/* ---- ④ 利用者一覧＋個別確認事項 ------------------------------------ */

.resident-card {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.resident-card.level-caution { border-left-color: var(--level-caution); }
.resident-card.level-important { border-left-color: var(--level-important); }
.resident-card.has-emergency {
  border: 2px solid var(--emergency);
  border-left-width: 6px;
  background: var(--emergency-bg);
}

.resident-head { display: flex; align-items: center; gap: 10px; }
.resident-namebox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}
.avatar-placeholder { font-size: 15px; font-weight: 700; letter-spacing: .5px; }

/* 変化・申し送り（色あり） */
.watch-list { margin: 10px 0 0; padding: 0; list-style: none; }
.watch-item { position: relative; padding: 3px 0 3px 18px; font-size: 15px; line-height: 1.5; }
.watch-item::before { content: "・"; position: absolute; left: 0; }
.watch-item.level-caution { color: var(--level-caution); font-weight: 700; }
.watch-item.level-important { color: var(--level-important); font-weight: 700; }
.watch-item.level-important::before { content: "⚠"; font-size: 13px; }
.watch-item.source-emergency { color: var(--emergency); }
.watch-item.source-emergency::before { content: "🔴"; font-size: 10px; top: 7px; }

/* 未確認（色なし） */
.pending-list { margin: 8px 0 0; padding: 0; list-style: none; }
.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 3px 0 3px 18px;
  font-size: 15px;
  position: relative;
}
.pending-item::before { content: "・"; position: absolute; left: 0; }

.watch-none { margin: 10px 0 0; font-size: 14px; color: var(--text-muted); }

.resident-measures {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.resident-measure-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.resident-measure-timing { flex: 0 0 20px; font-size: 14px; color: var(--text-muted); }

.mini-chip { padding: 2px 8px; border-radius: 999px; font-size: 13px; }
.mini-chip.is-done { background: var(--surface-2); color: var(--text-muted); }
/* ★未実施は赤くしない */
.mini-chip.is-todo {
  border: 1px dashed var(--pending);
  background: transparent;
  color: var(--pending);
  font-weight: 700;
}

.resident-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.btn-voice { min-height: 48px; padding: 0 22px; font-size: 16px; }

.resident-emergency-row { margin-top: 2px; text-align: right; }
.btn-emergency-link {
  /* 目立たせないが、緊急時に押し損じない大きさは保つ（Day10） */
  min-height: var(--tap-min);
  padding: 0 2px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: underline;
}

/* ---- バッジ -------------------------------------------------------- */

.tag-caution { background: var(--level-caution-bg); color: var(--level-caution); }
.tag-important { background: var(--level-important); color: #ffffff; }
.tag-emergency { background: var(--emergency); color: #ffffff; }
.tag-first { background: var(--surface-2); }

/* ---- タイムライン -------------------------------------------------- */

.entry.level-caution { border-left-color: var(--level-caution); }
.entry.level-important { border-left-color: var(--level-important); }

.entry-emergency {
  padding-top: 0;
  border: 2px solid var(--emergency);
  border-left-width: 6px;
  background: var(--emergency-bg);
  overflow: hidden;
}

.emergency-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 -14px 8px;
  padding: 6px 14px;
  background: var(--emergency);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}
.emergency-band .followup-open { background: #ffffff; color: var(--emergency); }
.emergency-band .followup-resolved { background: rgba(255, 255, 255, .25); color: #ffffff; }

.recorded-later { font-size: 13px; color: var(--text-muted); }

.entry-reason { margin: 8px 0 0; font-size: 14px; font-weight: 700; }
.entry-reason.level-caution { color: var(--level-caution); }
.entry-reason.level-important { color: var(--level-important); }

.entry-resolved { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: var(--done); }

/* ---- 記録する ------------------------------------------------------ */

.emergency-notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--emergency);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.voice-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
  font-size: 15px;
}
.voice-hint-icon { font-size: 28px; line-height: 1; }
.voice-hint-sub { font-size: 13px; color: var(--text-muted); }

.guide-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.guide-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.guide-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
}

.occurred-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--emergency);
  border-radius: 10px;
  background: var(--surface);
}
.occurred-label { font-size: 14px; font-weight: 700; }
.occurred-row input {
  min-height: var(--tap-min);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.occurred-note { font-size: 13px; color: var(--text-muted); }

.btn-emergency { background: var(--emergency); color: #ffffff; }

.vital-timing-note { margin: 0 0 10px; font-size: 13px; color: var(--text-muted); }

.toggle-note { margin: -2px 0 12px 32px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* 勤務開始時（最初に会った時）の様子報告（VOICE-MVP-03.1）。★小さく1行だけ */
.first-contact-chip {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.first-contact-chip.is-completed { color: var(--text-muted); }
.first-contact-chip.is-deferred { color: var(--text); font-weight: 700; }
.first-contact-chip.is-pending { color: var(--text); }

/*
 * AI主任と一緒に勤務している状態（VOICE-MVP-05B）。
 * ★画面中心にしない。ちらっと見て今どうなっているかが分かればよい。
 */
.duty-state {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eaf5ef;
  color: var(--done);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
}

.duty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.duty-actions .btn-block { flex: 1 1 100%; }

/* ★試験中であることの注意（実在利用者を話さない） */
.duty-notice {
  margin: 8px 0 0;
  color: var(--level-caution);
  background: var(--level-caution-bg);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  line-height: 1.5;
}
