:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0369a1;
  --brand-dark: #075985;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --gray: #6b7280;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
  --radius: 12px;
  /* 文字は6段階だけ（7.57）。13pxより小さい文字は作らない */
  --fs-display: 1.75rem;    /* 28px 集計タイルの数字 */
  --fs-title: 1.25rem;      /* 20px カードの見出し */
  --fs-heading: 1.0625rem;  /* 17px 小見出し・群の見出し */
  --fs-body: .9375rem;      /* 15px 本文・表のセル・報告の文 */
  --fs-dense: .875rem;      /* 14px 詰まった列・時刻 */
  --fs-label: .8125rem;     /* 13px バッジ・チップ・列見出し */
  /* 意味に固定した色の別名（既存の --red などはそのまま残す） */
  --danger: var(--red); --danger-ink: #b91c1c; --danger-soft: #fef2f2; --danger-line: #fecaca;
  --warn: var(--yellow); --warn-ink: #92400e; --warn-soft: #fffbeb; --warn-line: #fde68a;
  --ok: var(--green); --ok-ink: #166534; --ok-soft: #f0fdf4; --ok-line: #a7f3d0;
  --idle: var(--gray); --idle-soft: #f3f4f6;
  --mgr: #7c3aed; --mgr-soft: #faf5ff; --mgr-line: #ddd6fe;
  --brand-soft: #eff6ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }

/* ===== ヘッダ ===== */
.appbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}
.appbar .title { font-weight: 700; font-size: 1.0625rem; white-space: nowrap; }
.appbar .title small { display:block; font-weight: 400; font-size: .8125rem; opacity: .85; }
.appbar .spacer { flex: 1; }
.appbar .badge {
  background: rgba(255,255,255,.18); border-radius: 999px;
  padding: 4px 12px; font-size: .8125rem; font-weight: 600;
}
.appbar a.badge { text-decoration: none; color: #fff; }
/* チーム（7.62）：どのチームの画面を見ているかを取り違えないための印 */
.appbar .badge.room-badge { background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.45); }
.appbar .badge.room-badge:hover { background: rgba(255,255,255,.4); }
.appbar .badge.alert { background: var(--red); }
.appbar .badge.train { background: #ea580c; }
.appbar a.btn-ghost {
  color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.5);
  padding: 6px 12px; border-radius: 8px; font-size: .875rem;
}
.appbar a.btn-ghost:hover { background: rgba(255,255,255,.15); }
.home-badge { color: #fff; font-size: .8125rem; font-weight: 600; background: rgba(255,255,255,.16); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.home-badge a { color: #fff; text-decoration: underline; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
/* 一覧が主役の画面（本部・共有ボード・管理室）は画面幅いっぱいまで使う */
body.wide .wrap { max-width: min(2200px, calc(100vw - 24px)); }
@media (max-width: 900px) { body.wide .wrap { max-width: none; padding: 14px 8px 50px; } }
.narrow { max-width: 780px; }

/* ===== 共通パーツ ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.25rem; }
.card h3 { margin: 0 0 8px; font-size: .9375rem; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.notice {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 10px 14px; font-size: .875rem; margin-bottom: 16px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 11px 18px;
  font-size: .9375rem; font-weight: 600; cursor: pointer;
  background: var(--brand); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: default; }
/* hidden 属性は必ず隠す（.btn の display:inline-flex が UA の [hidden] を上書きしてしまうため） */
[hidden] { display: none !important; }
/* 補助的なボタン（削除の×など）。色を持たせず、周りの入力欄を邪魔しない */
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid #d1d5db; font-weight: 500; }
.btn.ghost:hover { background: #f1f5f9; color: var(--danger); border-color: #cbd5e1; }
.btn.secondary { background: #e2e8f0; color: var(--ink); }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: var(--red); }
.btn.small { padding: 7px 12px; font-size: .8125rem; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 5px; }
input[type=text], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: .9375rem; font-family: inherit; background: #fff;
}
textarea { min-height: 76px; resize: vertical; }

/* ===== ステータス色 ===== */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.lv-green  { color: var(--green); }
.lv-yellow { color: var(--yellow); }
.lv-red    { color: var(--red); }
.bg-green  { background: var(--green); }
.bg-yellow { background: var(--yellow); }
.bg-red    { background: var(--red); }
.bg-gray   { background: var(--gray); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px;
  border-radius: 999px; font-size: .8125rem; font-weight: 700; color: #fff;
}

/* ===== 部署選択（ログイン） ===== */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dept-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform .1s, border-color .1s;
  font-size: .9375rem; color: var(--ink);
}
.dept-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.dept-card .nm { font-weight: 700; }
.dept-card.current { border-color: var(--brand); outline: 2px solid var(--brand); }
.dept-group-sec { margin-bottom: 16px; }
.dept-group-h { margin: 0 0 8px; font-size: .9375rem; color: var(--brand-dark); border-left: 4px solid var(--brand); padding-left: 8px; }
.dept-card.hq { background: #0c4a6e; color: #fff; border-color: #0c4a6e; grid-column: 1 / -1; }
.dept-card.hq .sub { color: #bae6fd; }
.dept-card .sub { font-size: .8125rem; color: var(--muted); }

/* ===== 部署ビュー：フェーズ ===== */
.phasebar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.phasebar button {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: .875rem; font-weight: 600;
}
.phasebar button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.phasebar button.current::after { content: " ●"; color: var(--red); }

.action-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}
.action-item:last-child { border-bottom: none; }
.action-item input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; cursor: pointer; }
.action-item label { cursor: pointer; flex: 1; }
.action-item .act-main { flex: 1; min-width: 0; }
.action-item .act-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.action-item .act-text { flex: 0 1 auto; cursor: pointer; }
.action-item .act-main.has-help .act-text { text-decoration: underline dotted #93c5fd; text-underline-offset: 3px; }
.action-item .act-main.has-help:hover .act-text { color: var(--brand); }
.act-more { flex-shrink: 0; color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 999px; padding: 0 8px; font-size: .8125rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.act-more:hover, .act-more.on { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.act-help-link { margin-top: 6px; }
.act-help-link a { font-size: .8125rem; }
.act-help { margin-top: 6px; padding: 8px 10px; background: #eff6ff; border-left: 3px solid #60a5fa; border-radius: 6px; font-size: .875rem; line-height: 1.55; color: #1e3a8a; white-space: pre-wrap; }
.action-item.done .act-help { color: var(--muted); text-decoration: none; }
.action-item .act-text:hover { color: var(--brand); text-decoration: underline dotted; }
.action-item.done .act-text, .action-item.done label { color: var(--muted); text-decoration: line-through; }

/* 状況報告の色分け（危険・不可・被害あり／注意・一部・確認中／正常・可） */
#reportForm select.sel-red { background: #fef2f2; border-color: #dc2626; color: #991b1b; font-weight: 700; }
#reportForm select.sel-yellow { background: #fffbeb; border-color: #f59e0b; color: #92400e; font-weight: 700; }
#reportForm select.sel-green { background: #f0fdf4; border-color: #16a34a; color: #166534; }

/* 時間帯（目標時間）の見出しと、完了アクションの再表示 */
.due-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.due-head .due-t { flex: 0 1 auto; }
.due-head .due-n { font-size: .8125rem; font-weight: 700; color: #166534; background: #dcfce7; border-radius: 999px; padding: 1px 8px; }
.due-head .due-toggle { margin-left: auto; font-weight: 600; }
.due-head .due-cont { font-size: .8125rem; font-weight: 700; color: #1e40af; background: #dbeafe; border-radius: 999px; padding: 1px 8px; }
.due-head .due-cont ~ .due-toggle, .due-head .due-n ~ .due-toggle { margin-left: auto; }
.due-group.all-done { opacity: .7; }
.done-bar { margin: 10px 0 0; }

/* 完了したアクション・回答済みの指示は1行に畳む（クリックで開き直せる） */
.action-item.folded { padding: 6px 4px; opacity: .72; }
.action-item.folded .act-line { flex-wrap: nowrap; }
.action-item.folded .act-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.action-item.instruction.folded { padding: 7px 4px; background: #f8fafc; }
.ins-folded { display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0; cursor: pointer; }
.ins-folded .ins-fold-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); text-decoration: line-through; }
.ins-folded .ins-fold-t { flex-shrink: 0; font-size: .8125rem; color: var(--muted); }
.ins-folded .ins-answered { flex-shrink: 0; margin: 0; font-size: .8125rem; }
.ins-folded .ins-more { flex-shrink: 0; color: #1d4ed8; font-size: .8125rem; font-weight: 700; }
.inst-open-n { margin-left: 8px; font-size: .8125rem; font-weight: 700; color: #b91c1c; }
.inst-open-n.done { color: #16a34a; }
.ins-meta .ins-fold-btn { margin-left: 8px; }

/* 訓練履歴：却下した推奨 */
.hist-dis { margin: 6px 0; font-size: .875rem; }
.hist-dis summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.dis-list { margin: 6px 0 0; padding-left: 20px; }
.dis-list li { margin: 3px 0; }

/* 却下の理由を選ぶダイアログ */
.dz-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dz-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.dz-box h3 { margin: 0 0 4px; }
.dz-title { font-weight: 700; font-size: .9375rem; margin: 0 0 8px; color: var(--brand-dark); }
.dz-reasons { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.dz-r { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: .875rem; font-weight: 600; font-family: inherit; }
.dz-r small { display: block; font-weight: 400; font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.dz-r:hover { border-color: var(--brand); }
.dz-r.on { background: #eff6ff; border-color: var(--brand); color: var(--brand-dark); }
.dz-fb { margin: 8px 0 0; padding: 6px 8px; border-radius: 6px; background: #f1f5f9; border: 1px solid #e2e8f0; line-height: 1.5; }
.dz-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
@media (prefers-color-scheme: dark) { .dz-r { background: transparent; } }

/* 本部画面の左右分割：開閉とドラッグでの幅変更 */
.split { align-items: flex-start; gap: 0; }
.split .split-pane { min-width: 0; }
.split .split-bar {
  flex: 0 0 10px; align-self: stretch; min-height: 200px; margin: 0 2px; cursor: col-resize;
  background: linear-gradient(to right, transparent 3px, var(--line) 3px, var(--line) 7px, transparent 7px);
  border-radius: 4px;
}
.split .split-bar:hover { background: linear-gradient(to right, transparent 2px, var(--brand) 2px, var(--brand) 8px, transparent 8px); }
body.splitting { cursor: col-resize; user-select: none; }
.split .split-pane.pane-closed { flex: 0 0 auto !important; min-width: 0; padding: 8px 10px; }
.split .split-pane.pane-closed > *:not(.row):not(.pane-head) { display: none; }
.split .split-pane.pane-closed .row > *:not(.pane-toggle), .split .split-pane.pane-closed .pane-head > *:not(.pane-toggle) { display: none; }
.pane-toggle { white-space: nowrap; }
@media (max-width: 900px) {
  .split { flex-direction: column; }
  .split .split-bar { display: none; }
  .split .split-pane { width: 100%; flex: 1 1 auto !important; }
}

/* ヘッダー：メニューの折りたたみ */
.appbar .hdr-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.appbar .hdr-links.hidden { display: none; }
.appbar .hdr-menu-btn { background: transparent; cursor: pointer; font-family: inherit; }

/* 部署一覧：AI／人の一括切替 */
.ai-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border: 1px solid #fed7aa; border-radius: 8px; background: #fff7ed; }
.ai-bulk-t { font-size: .875rem; font-weight: 700; color: #9a3412; }
.dept-group-h .sec-ai { margin-left: 10px; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.dept-group-h .sec-ai .btn { font-weight: 600; }

/* 実行案：全部署への照会 */
.ug-plan .ug-bc { font-size: .8125rem; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 8px; }
.grp-head .grp-ai { font-weight: 600; }

/* 指示への回答に添えるコメント */
.ins-resp .rv-note { width: 100%; margin-bottom: 6px; font-size: .875rem; }
.ins-note { margin-top: 4px; font-size: .875rem; color: #1e3a8a; background: #eff6ff; border-left: 3px solid #60a5fa; border-radius: 4px; padding: 4px 8px; white-space: pre-wrap; }
.rsp-note { margin-top: 3px; font-size: .8125rem; color: #1e3a8a; background: #eff6ff; border-left: 3px solid #60a5fa; border-radius: 4px; padding: 3px 8px; white-space: pre-wrap; }
.il-line1 .il-note { flex-shrink: 0; font-size: .8125rem; font-weight: 700; color: #1d4ed8; }

/* 指示を出した「報告内容からの判断」は畳む（見出しクリックで開く） */
.ug-doneitem { border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; padding: 6px 8px; background: #f8fafc; }
.ug-doneitem.folded { opacity: .85; }
.ug-done-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; font-size: .875rem; }
.ug-done-line .ug-done-t { flex: 1 1 auto; min-width: 0; font-weight: 600; color: var(--muted); }
.ug-doneitem .req-done-inst { margin-top: 2px; }

/* 要請の「指示済み」チェックと、作成中の指示の紐づけ表示 */
.ug-req-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ug-req-line .ug-req-text { flex: 1 1 14em; min-width: 12em; }
.req-cb { flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; padding-top: 1px; }
.req-cb input { width: 16px; height: 16px; cursor: pointer; }
li.req-done .req-cb { color: #166534; }
.inst-ref { margin: 0 0 8px; padding: 7px 10px; border: 1px solid #93c5fd; border-radius: 8px; background: #eff6ff; color: #1e3a8a; font-size: var(--fs-label); display: block; }
/* 指示案・要請との紐づけ（7.64）。行ごとに「解除」を置く */
.inst-ref .ir-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.inst-ref .ir-note { margin: 2px 0 0; color: #1e40af; }

/* 報告を送ったあとの「送信した要請・報告事項」 */
.sent-reqs { margin-top: 8px; padding: 8px 10px; border: 1px solid #bbf7d0; border-radius: 8px; background: #f0fdf4; }
.sent-req-head { font-size: .8125rem; font-weight: 700; color: #166534; margin-bottom: 4px; }
.sent-req-list { margin: 0 0 6px; padding-left: 18px; font-size: .875rem; color: #374151; }
.sent-req-list li { margin: 2px 0; }

/* EMIS転記シート：転記を記録した欄は畳む */
.emis-sec.folded { background: #f8fafc; }
.emis-sec h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.emis-state .emis-done { font-size: .8125rem; font-weight: 700; color: #166534; background: #dcfce7; border-radius: 999px; padding: 1px 8px; }
.emis-fold { margin-left: auto; }

/* アクションから該当報告項目を強調 */
#reportForm .hl { background: #fff7cc; outline: 2px solid #f59e0b; outline-offset: 1px; border-radius: 8px; transition: background .3s, outline-color .3s; }
.equip-row.hl { padding: 4px 6px; }

/* ===== 本部ダッシュボード ===== */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat .n { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: .8125rem; color: var(--muted); }
.stat .st-done { margin-top: 4px; font-size: .8125rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; display: inline-block; }
.stat .st-done.st-all { color: #166534; background: #dcfce7; }
.stat .st-done.st-left { color: #b45309; background: #fef3c7; }
.stat.stat-btn { cursor: pointer; transition: transform .1s, border-color .1s; }
.stat.stat-btn:hover { transform: translateY(-2px); border-color: var(--brand); }
.stat.stat-btn.active { border-color: var(--brand); outline: 2px solid var(--brand); background: #eff6ff; }

table.hq { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.hq th, table.hq td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: .875rem; vertical-align: top; }
table.hq th { background: #f8fafc; font-size: .8125rem; color: var(--muted); }
/* 一覧表を自前のスクロール領域にし、見出しをその上端に固定（ヘッダー高さに依存しない） */
.table-scroll { overflow: auto; max-height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); }
/* 横スクロールバーを常に見えるようにする（下端までスクロールしないと出ない問題の対策） */
.table-scroll { scrollbar-gutter: stable; }
.table-scroll::-webkit-scrollbar { height: 12px; width: 12px; }
.table-scroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
.table-scroll::-webkit-scrollbar-track { background: #e2e8f0; }
/* 表の上にも横スクロールバーを置く（本部画面。hq.js が幅を同期） */
.scroll-mirror { overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 2px; }
.scroll-mirror div { height: 1px; }
.scroll-mirror::-webkit-scrollbar { height: 12px; }
.scroll-mirror::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
.scroll-mirror::-webkit-scrollbar-track { background: #e2e8f0; }
.table-scroll table.hq { box-shadow: none; border-radius: 0; }
.table-scroll table.hq th { position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 var(--line); }
table.hq tr.red-row { background: #fef2f2; }
table.hq tr.yellow-row { background: #fffbeb; }
table.hq .ll { display: inline-flex; gap: 3px; }
table.hq .ll .dot { width: 10px; height: 10px; }
.grp-row > td { background: #eef2ff; padding: 6px 8px !important; border-top: 2px solid #c7d2fe; }
.grp-row.grp-red > td { background: #fef2f2; border-top-color: #fecaca; }
.grp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agg-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.agg-tile { min-width: 96px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; text-align: center; }
.agg-tile .n { font-size: 1.25rem; font-weight: 700; }
.agg-tile .l { font-size: .8125rem; color: var(--muted); }
.agg-line { margin-top: 6px; font-size: .875rem; }
.agg-req { margin-top: 8px; }
.grp-mgr { font-size: .8125rem; color: #1e3a8a; background: #e0e7ff; border-radius: 6px; padding: 1px 8px; }
.dept-card.mgr { border-color: #6366f1; background: #eef2ff; }
.grp-n { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: .8125rem; font-weight: 700; color: #fff; }
.lv-red-bg { background: var(--red); } .lv-yellow-bg { background: var(--yellow); } .lv-green-bg { background: var(--green); } .lv-gray-bg { background: #6b7280; } .lv-brand-bg { background: var(--brand); }
.req-text { white-space: pre-wrap; min-width: 190px; }
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { padding: 2px 0 2px 0; border-bottom: 1px dashed #fecaca; font-size: .875rem; line-height: 1.4; }
.req-list li:last-child { border-bottom: none; }
.req-no { display: inline-block; min-width: 1.4em; height: 1.4em; line-height: 1.4em; text-align: center; border-radius: 50%; background: #dc2626; color: #fff; font-size: .8125rem; font-weight: 700; margin-right: 4px; }
.ug-sec { font-weight: 700; margin: 8px 0 4px; color: #1e3a8a; }
.ug-reqs { margin: 0 0 6px 0; padding-left: 0; list-style: none; counter-reset: ugreq; }
.ug-reqs > li { counter-increment: ugreq; margin-bottom: 8px; padding-left: 10px; border-left: 3px solid #dc2626; }
.ug-req-text { font-weight: 700; margin-bottom: 4px; }
.ug-req-text::before { content: counter(ugreq); display: inline-block; min-width: 1.5em; height: 1.5em; line-height: 1.5em; text-align: center; border-radius: 50%; background: #dc2626; color: #fff; font-size: .8125rem; margin-right: 6px; }

.timeline-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.timeline-item .t { color: var(--muted); font-size: .8125rem; }

/* タイムラインの絞り込みバー */
.tl-filter { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; font-size: .8125rem; }
.tl-filter label { display: inline-flex; align-items: center; gap: 3px; }
.tl-filter .tl-sel { width: auto; padding: 5px 7px; font-size: .8125rem; }

/* 統合タイムライン */
.tl-item { padding: 7px 0 7px 10px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--line); margin-bottom: 2px; }
.tl-item.tl-event { border-left-color: #7c3aed; background: #faf5ff; }
.tl-item.tl-report { border-left-color: #64748b; }
.tl-item.tl-instruction { border-left-color: #0369a1; background: #f0f9ff; }
.tl-item.tl-response { border-left-color: #16a34a; }
.tl-time { font-size: .8125rem; color: var(--muted); }
.tl-body { font-size: .875rem; margin-top: 1px; }
.tl-badge { display: inline-block; font-size: .8125rem; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 6px; margin-right: 4px; vertical-align: middle; }

.inst-item { padding: 9px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); margin-bottom: 8px; font-size: .875rem; }
.inst-item.high { background: #fef2f2; border-color: #fecaca; }
.inst-item .t { color: var(--muted); font-size: .8125rem; }
.inst-item .to { font-weight: 700; }

.tabbtns { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabbtns button { border: 1px solid var(--line); background: #fff; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .875rem; }
.tabbtns button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabbtns button .tab-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: .8125rem; line-height: 18px; text-align: center; vertical-align: 1px; }
.tabbtns button.active .tab-badge { background: #fff; color: #dc2626; }
.gd-dropped { margin: 8px 0 2px; }
.gd-droplist { margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fafafa; }
.gd-drop-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.gd-drop-item:last-of-type { border-bottom: none; }
.gd-drop-t { font-weight: 600; font-size: .875rem; text-decoration: line-through; color: #6b7280; }
.gd-btns .gd-drop, .ug-btns .ug-drop { color: #b91c1c; border-color: #fecaca; }
@media (prefers-color-scheme: dark) { .gd-droplist { background: transparent; } }
.inst-done { margin-top: 10px; padding: 8px 10px; border: 1px solid #16a34a; border-radius: 8px; background: #f0fdf4; color: #166534; font-size: .875rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== 部署ビュー：前提・進捗・アクション ===== */
.context { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .875rem; }
.context > div { margin: 2px 0; }
.context b { color: var(--brand-dark); }

.progress-bar { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .3s; }

.due-group { margin-top: 10px; }
.due-head {
  font-weight: 700; font-size: .8125rem; color: var(--brand-dark);
  background: #eff6ff; border-left: 3px solid var(--brand); padding: 4px 10px; border-radius: 4px; margin-bottom: 4px;
}
.action-item .who {
  display: inline-block; font-size: .8125rem; font-weight: 700; color: #fff; background: var(--gray);
  border-radius: 4px; padding: 1px 6px; margin-right: 6px; vertical-align: middle;
}

/* ===== 設備チェックリスト（報告フォーム） ===== */
.equip-list { display: flex; flex-direction: column; gap: 6px; }
.equip-row { display: grid; grid-template-columns: 1fr 88px; gap: 6px; align-items: center; }
.equip-row .equip-name { font-size: .875rem; }
.equip-row select { padding: 6px 8px; font-size: .875rem; }
.equip-row input[type=text] { grid-column: 1 / -1; padding: 6px 8px; font-size: .8125rem; }

/* ===== 訓練モード・AI ===== */
/* ヘッダー内の運用モード操作 */
.mode-controls { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mode-controls .mode-div { width: 1px; height: 22px; background: rgba(255,255,255,.35); }
.hdr-select { width: auto; padding: 6px 8px; font-size: .8125rem; border-radius: 8px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.15); color: #fff; }
.hdr-select option { color: var(--ink); }
.hdr-chk { display: inline-flex; align-items: center; gap: 5px; color: #fff; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.hdr-chk input { accent-color: #fff; }
label.inline { font-size: .875rem; display: inline-flex; align-items: center; gap: 4px; }
label.inline select { width: auto; padding: 6px 8px; }

.role-banner { border-radius: 10px; padding: 10px 14px; font-size: .875rem; margin-bottom: 16px; }
.ai-banner {
  background: #fff7ed; border: 1px solid #fdba74; color: #9a3412;
  border-radius: 10px; padding: 10px 14px; font-size: .875rem; margin-bottom: 16px;
}
.human-banner { background: #eff6ff; border: 1px solid #bfdbfe; color: #075985; }

/* 本部：部署詳細モーダル */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal-box { background: var(--card); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.3); width: 100%; max-width: 860px; padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dm-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .875rem; }
.dm-timeline { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: .8125rem; margin: 2px 2px 0 0; }
.dept-open { font-weight: 700; color: var(--brand-dark); text-decoration: none; cursor: pointer; }
.dept-open:hover { text-decoration: underline; }
.ai-tag { font-size: .8125rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.ai-tag.is-ai { background: #ede9fe; color: #6d28d9; }
.ai-tag.is-human { background: #e0f2fe; color: #075985; }
.ai-toggle { padding: 4px 8px; font-size: .8125rem; }

/* ===== 指示：複数宛先 ===== */
.tgt-all { display: block; font-weight: 700; font-size: .875rem; margin-bottom: 6px; }
.tgt-list { max-height: 168px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.tgt-item { display: block; font-size: .875rem; padding: 3px 0; }
.tgt-item input { margin-right: 6px; }

/* 指示の回答選択肢エディタ */
.opt-row { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.opt-row .opt-in { flex: 1; padding: 7px 9px; }
.opt-row .opt-del { padding: 4px 9px; line-height: 1; }
#respOptAdd { margin-top: 2px; }

/* ===== 本部からの指示（アクションカード内）＋回答 ===== */
.inst-head { background: #fff7ed; border-left-color: #ea580c; color: #9a3412; }
.action-item.instruction { flex-direction: column; align-items: stretch; gap: 4px; background: #fffdfa; border-left: 3px solid #fdba74; padding-left: 8px; }
.action-item.instruction.high { border-left-color: var(--red); background: #fef2f2; }
.ins-meta { font-size: .8125rem; color: var(--muted); }
.ins-text { font-weight: 600; font-size: .9375rem; }
.ins-resp { margin-top: 4px; }
.ins-form { display: flex; gap: 6px; align-items: flex-start; }
.ins-form .rv { flex: 1; }
.ins-form textarea.rv { min-height: 40px; }
.rv-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; flex: 1; }
.rv-checks label { font-size: .875rem; }
.ins-ack { font-size: .875rem; display: inline-flex; align-items: center; gap: 6px; }
.ins-answered { font-size: .8125rem; color: var(--green); margin-top: 4px; }

/* HQ側の指示ログの回答 */
.ins-responses { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 5px; }
.ins-responses .rsp { font-size: .8125rem; padding: 1px 0; }
.ins-resp-count { color: var(--brand); }
.inst-item.has-unanswered { border-left: 4px solid var(--red); }
.ins-unanswered { margin-top: 5px; font-size: .8125rem; font-weight: 700; color: #b91c1c; background: #fef2f2; border-radius: 6px; padding: 4px 8px; }
.ins-allanswered { margin-top: 5px; font-size: .8125rem; color: var(--green); font-weight: 600; }

/* 被害状況（HQ表） */
.harm-detail { color: var(--red); font-size: .8125rem; background: #fef2f2; border-radius: 4px; padding: 1px 5px; margin-top: 2px; }

/* 追加報告項目（設定の行 / 部署フォーム / HQ表示） */
.field-row { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fafbfc; }
.cf-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cf-checks label { font-size: .875rem; }
.cf-hq { font-size: .8125rem; color: var(--brand-dark); margin-top: 3px; }

/* 病院全体の報告状況（種別ごと一覧） */
.rs-cat { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.rs-cat-head { background: #f1f5f9; font-weight: 700; font-size: .875rem; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.rs-tbl { width: 100%; border-collapse: collapse; }
.rs-tbl td { padding: 5px 10px; font-size: .8125rem; vertical-align: top; border-bottom: 1px solid #f1f5f9; }
.rs-tbl tr:last-child td { border-bottom: none; }
.rs-d { width: 40%; font-weight: 600; white-space: nowrap; }
.rs-v { color: #374151; }
.rs-v.rs-bad { color: var(--red); font-weight: 600; }
.rs-note { color: var(--red); font-size: .8125rem; margin-top: 1px; }
.rs-empty { color: #9ca3af; font-size: .8125rem; padding: 6px 10px; margin: 0; }
.rs-tag { display: inline-block; font-size: .8125rem; padding: 0 5px; border-radius: 4px; margin-left: 4px; }
.rs-tag.rs-bad { background: #fef2f2; color: var(--red); }
.rs-tag.rs-warn { background: #fffbeb; color: #b45309; }
/* 報告一覧：種別ボタン切替＋行クリック */
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rs-chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 10px; font-size: .8125rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.rs-chip:hover { border-color: var(--brand); }
.rs-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.rs-chip.rs-dim { opacity: .5; }
.rs-count { display: inline-block; min-width: 18px; text-align: center; background: #eef2f7; color: #475569; border-radius: 10px; font-size: .8125rem; padding: 0 5px; }
.rs-chip.active .rs-count { background: rgba(255,255,255,.28); color: #fff; }
.rs-row { cursor: pointer; }
.rs-row:hover { background: #f0f7ff; }
.rs-go { width: 16px; text-align: center; color: #9ca3af; font-weight: 700; }
.rs-cmt { width: 44px; text-align: right; white-space: nowrap; }
/* コメント */
.cmt-badge { font-size: .8125rem; color: var(--brand-dark); background: #eef2ff; border-radius: 10px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }
.dm-comments { margin-top: 4px; }
.cmt-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; max-height: 240px; overflow-y: auto; }
.cmt { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fbfdff; }
.cmt-head { font-size: .8125rem; margin-bottom: 2px; }
.cmt-by { color: var(--brand-dark); }
.cmt-text { font-size: .875rem; white-space: pre-wrap; word-break: break-word; }
.cmt-form { display: flex; flex-direction: column; gap: 6px; }
.cmt-input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; resize: vertical; }
.cmt-form .cmt-send { align-self: flex-end; }
.tl-cmt { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0 7px; font-size: .8125rem; cursor: pointer; margin-left: 4px; color: var(--brand-dark); }
.tl-cmt:hover { border-color: var(--brand); }
.comment-notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 異常報告パネル（アクションカード上部） */
.issue-panel { border: 1px solid #fecaca; background: #fef6f6; border-left: 5px solid var(--red); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.issue-head { font-weight: 700; color: #991b1b; font-size: .9375rem; margin-bottom: 8px; }
.issue-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid #f3d6d6; flex-wrap: wrap; }
.issue-item:first-of-type { border-top: none; }
.issue-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.issue-dot.bad { background: var(--red); }
.issue-dot.warn { background: var(--yellow); }
.issue-main { flex: 1; min-width: 150px; font-size: .9375rem; word-break: break-word; }
.issue-btns { display: flex; gap: 6px; flex: none; }
.issue-note { margin: 8px 0 0; }
/* 部署一覧カードのAI/人 切替 */
.dc-toggle { display: inline-block; margin-top: 8px; align-self: flex-start; border: 1px solid var(--line); background: #fff; color: var(--brand-dark); border-radius: 8px; padding: 3px 9px; font-size: .8125rem; font-weight: 600; cursor: pointer; }
.dc-toggle:hover { border-color: var(--brand); background: #f0f7ff; }
/* 写真：報告フォームのプレビュー＆詳細の表示 */
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-thumb { position: relative; display: inline-block; }
.photo-thumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-del { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--red); color: #fff; font-size: .875rem; line-height: 1; cursor: pointer; }
.rep-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rep-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
/* 設備ごとの写真（部署詳細モーダル・報告一覧） */
.eq-item { display: inline-block; vertical-align: top; margin: 0 8px 8px 0; }
.eq-item .rep-photo, .rs-v .rep-photo { width: 72px; height: 72px; }
/* ログイン方法の選択 */
.login-choose { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.login-choose .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 14px 18px; font-size: 1.0625rem; text-align: left; }
.login-choose .btn small { font-weight: 400; font-size: .8125rem; opacity: .9; }
/* ひとり練習モード（この端末だけ）の帯 */
.practice-bar { position: sticky; top: 0; z-index: 200; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 14px; background: #7c3aed; color: #fff; font-size: .875rem; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.practice-bar .pb-t { flex: 1; min-width: 200px; }
.practice-bar .pb-link { color: #ede9fe; text-decoration: underline; white-space: nowrap; }
.practice-bar .btn { background: #fff; color: #5b21b6; border-color: #fff; white-space: nowrap; }
@media print { .practice-bar { display: none; } }
/* 状況が変わった指示（7.46） */
.follow-card { border-left: 5px solid #f97316; background: #fff7ed; }
.fu-item { background: #fff; border: 1px solid var(--line); border-left: 5px solid #f97316; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.fu-must { border-left-color: #dc2626; background: #fff5f5; }
.fu-should { border-left-color: #f97316; }
.fu-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; font-size: .9375rem; }
.fu-line { font-size: .875rem; line-height: 1.6; margin: 2px 0; }
.fu-l { display: inline-block; min-width: 6.5em; color: #64748b; font-size: .8125rem; margin-right: 6px; }
.fu-ch { color: #9a3412; font-weight: 600; }
.fu-prev { white-space: pre-wrap; background: #f8fafc; border: 1px dashed var(--line); border-radius: 6px; padding: 6px 8px; margin: 6px 0; font-size: .875rem; line-height: 1.6; }
/* 通信断・データ破損・バックアップ催促の帯（7.45） */
.link-bar { position: sticky; top: 0; z-index: 240; padding: 8px 14px; background: #b91c1c; color: #fff; font-size: .875rem; line-height: 1.6; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.link-bar-btn { margin-left: 10px; background: #fff; color: #b91c1c; border: 1px solid #fff; border-radius: 6px; padding: 2px 10px; font-size: .875rem; cursor: pointer; font-weight: 700; }
.warn-bar { border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-size: .9375rem; line-height: 1.7; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.warn-bar .grow { flex: 1; min-width: 240px; }
.warn-lost { background: #fef2f2; border: 2px solid #dc2626; color: #7f1d1d; }
.warn-bak { background: #fffbeb; border: 2px solid #f59e0b; color: #78350f; }
.warn-backup { background: #eff6ff; border: 2px solid #2563eb; color: #1e3a8a; }
@media print { .link-bar, .warn-bar { display: none; } }
/* 部署別 状況一覧：行ごとの判断ガイド */
.ug-row > td { background: #f8fafc; padding: 0 !important; }
.ug-wrap { padding: 10px 12px; border-left: 4px solid var(--brand); }
.ug-title { font-weight: 700; margin-bottom: 6px; }
.ug-item { background: #fff; border: 1px solid var(--line); border-left: 5px solid #94a3b8; border-radius: 8px; padding: 7px 10px; margin-bottom: 6px; }
.ug-must { border-left-color: #dc2626; background: #fff5f5; } .ug-should { border-left-color: #f97316; } .ug-consider { border-left-color: #0369a1; } .ug-ok { border-left-color: #16a34a; }
.ug-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ug-must .gd-grade { background: #dc2626; color: #fff; } .ug-should .gd-grade { background: #f97316; color: #fff; } .ug-consider .gd-grade { background: #0369a1; color: #fff; } .ug-ok .gd-grade { background: #16a34a; color: #fff; }
.ug-line, .ug-basis, .ug-act { font-size: .8125rem; margin-top: 2px; } .ug-line, .ug-basis { color: #475569; } .ug-act { font-weight: 600; }
.ug-btns { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; }
.ug-toggle { white-space: nowrap; }
.ug-plan { margin-top: 6px; padding: 7px 10px; background: #f0f9ff; border: 1px dashed #7dd3fc; border-radius: 8px; font-size: .875rem; }
.ug-plan-t { font-weight: 700; color: #0c4a6e; }
.ug-cands { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; }
.ug-cand { display: inline-flex; align-items: center; gap: 4px; }
.ug-unreg { opacity: .75; }
.ug-plan-btns { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ug-plan-btns .ug-n { width: 4.5em; padding: 2px 4px; }
.ug-plan-prev { margin-top: 6px; }
.ug-prev-b { margin-top: 5px; padding: 5px 8px; border-left: 3px solid #bae6fd; background: #fff; border-radius: 0 6px 6px 0; }
.ug-prev-l { display: block; font-size: .8125rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.ug-prev-t { display: block; font-size: .8125rem; white-space: pre-wrap; line-height: 1.55; }
.ug-plan-decide { color: #7c2d12; }
/* 何に対する提案なのか（推奨度の上に大きく出す） */
.ug-for { margin: 0 0 6px; padding: 5px 9px; border-left: 4px solid #0ea5e9; background: #f0f9ff; border-radius: 0 7px 7px 0; }
.ug-for-l { display: block; font-size: .8125rem; font-weight: 700; color: #0369a1; }
.ug-for-t { display: block; font-size: 1.0625rem; font-weight: 700; line-height: 1.45; }
/* 本部：判断ガイド */
.guide-q { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 10px; }
.gq { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); background: #f8fafc; }
.gq-red { background: #fef2f2; border-color: #fca5a5; } .gq-yellow { background: #fffbeb; border-color: #fcd34d; } .gq-green { background: #f0fdf4; border-color: #86efac; }
.gq-l { font-size: .8125rem; color: var(--muted); } .gq-v { font-weight: 800; font-size: 1.0625rem; } .gq-t { font-size: .8125rem; margin-top: 2px; }
.guide-stage { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.guide-stage .gs-rec { font-weight: 800; font-size: 1.0625rem; }
.guide-stage .gs-reasons { flex-basis: 100%; font-size: .8125rem; color: #475569; }
.gd { border-left: 5px solid #94a3b8; background: #fff; border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.gd-must { border-left-color: #dc2626; background: #fff5f5; } .gd-should { border-left-color: #f97316; } .gd-consider { border-left-color: #0369a1; }
.gd-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.gd-grade { display: inline-block; font-size: .8125rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #e2e8f0; white-space: nowrap; }
.gd-must .gd-grade, .gs-must { background: #dc2626; color: #fff; } .gd-should .gd-grade, .gs-should { background: #f97316; color: #fff; } .gd-consider .gd-grade, .gs-consider { background: #0369a1; color: #fff; } .gs-ok { background: #16a34a; color: #fff; }
.gs-badge { display: inline-block; font-size: .8125rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.gd-line, .gd-basis, .gd-act { font-size: .8125rem; margin-top: 2px; } .gd-line { color: #475569; } .gd-act { font-weight: 600; }
.gd-btns { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; } .gd-done { font-size: var(--fs-label); color: var(--green); }
/* 指示は出したが、根拠になった報告が変わった＝もう一度みる（7.64）。色だけに頼らず文字でも書く */
.gd-stale { font-size: var(--fs-label); color: var(--warn-ink, #92400e); background: var(--warn-soft, #fffbeb); border: 1px solid var(--warn-line, #fde68a); border-radius: 999px; padding: 1px 8px; }
.guide-tbl { width: 100%; border-collapse: collapse; font-size: .8125rem; margin-bottom: 10px; } .guide-tbl th, .guide-tbl td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; } .guide-tbl th { background: #f1f5f9; }
.lv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; } .lv-dot.red { background: #dc2626; } .lv-dot.yellow { background: #f59e0b; } .lv-dot.green { background: #16a34a; } .lv-dot.none { background: #cbd5e1; }
/* ログイン：名称の選択（病棟・外来・事務部門など） */
.dept-card .unit-used { display: inline-block; font-size: .8125rem; font-weight: 700; color: #fff; background: var(--green, #16a34a); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
#wardOther > summary { cursor: pointer; color: var(--brand); font-weight: 600; }
/* トップ画面：管理・平時のメニュー（大きなボタン） */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tool-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line, #cbd5e1); border-radius: 10px; background: #f8fafc; color: inherit; text-decoration: none; transition: transform .08s, border-color .08s; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--brand); text-decoration: none; }
.tool-card .ic { font-size: 1.4rem; line-height: 1.2; }
.tool-card .nm { font-weight: 700; }
.tool-card .sub { font-size: .8125rem; color: var(--muted); }
@media (max-width: 600px) { .tool-grid { grid-template-columns: 1fr 1fr; } .tool-card { padding: 10px; } .tool-card .sub { display: none; } }
/* トップ画面：通信なしで見るアクションカード（7.69・7.70） */
.oc-home-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oc-home-btns .btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 44px; text-align: left; white-space: normal; text-decoration: none; }
.oc-home-btns .btn small { font-size: .8125rem; font-weight: 400; opacity: .9; }
.oc-field-h { font-weight: 600; font-size: .875rem; margin-bottom: 2px; }
.oc-hz-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.oc-hz-pick { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: .9375rem; }
.oc-hz-pick input { width: 20px; height: 20px; }
@media (max-width: 600px) { .oc-home-btns { grid-template-columns: 1fr; } }
/* 本部からの一斉通知（掲示板） */
.ann-bar { margin-bottom: 12px; }
.ann-latest { display: flex; align-items: flex-start; gap: 10px; background: #fff7ed; border: 1px solid #fdba74; border-left: 5px solid #f97316; border-radius: 10px; padding: 10px 12px; }
.ann-icon { font-size: 1.2rem; line-height: 1.3; }
.ann-main { flex: 1; min-width: 0; }
.ann-meta { font-size: .8125rem; color: #9a3412; margin-bottom: 2px; }
.ann-text { font-size: .9375rem; font-weight: 600; color: #7c2d12; white-space: pre-wrap; word-break: break-word; }
.ann-hist-btn { align-self: center; border: 1px solid #fdba74; background: #fff; color: #c2410c; border-radius: 8px; padding: 5px 10px; font-size: .8125rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ann-hist-btn:hover { background: #ffedd5; }
.ann-board { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: 300px; overflow-y: auto; }
.ann-item { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
.ann-item:last-child { border-bottom: none; }
.ann-item .ann-text { font-weight: 500; font-size: .875rem; color: #334155; }
.ann-compose { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.ann-compose-label { font-weight: 700; font-size: .875rem; color: #c2410c; white-space: nowrap; }
.ann-compose input { flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }

/* ===== ステージ・ハザード表示バー（ヘッダー直下・全画面共通） ===== */
.stage-bar { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--gray); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.stage-bar.s1 { border-left-color: var(--green); } .stage-bar.s2 { border-left-color: var(--yellow); } .stage-bar.s3 { border-left-color: #ea580c; } .stage-bar.s4 { border-left-color: var(--red); }
.sb-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.sb-row + .sb-row { margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--line); }
.sb-stage { display: inline-block; font-weight: 800; font-size: .9375rem; color: #fff; border-radius: 6px; padding: 2px 10px; background: var(--gray); }
.sb-stage.sb-s1 { background: var(--green); } .sb-stage.sb-s2 { background: var(--yellow); } .sb-stage.sb-s3 { background: #ea580c; } .sb-stage.sb-s4 { background: var(--red); }
.sb-title { font-weight: 700; font-size: .9375rem; }
.sb-note { font-size: .8125rem; color: var(--muted); }
.sb-haz { font-size: .875rem; background: #f1f5f9; border-radius: 6px; padding: 2px 8px; }
.sb-haz b { color: var(--brand-dark); }
.sb-btn { margin-left: auto; }
/* アクションカード：ハザード見出しとフェーズの「今ここ」 */
.haz-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; font-weight: 800; font-size: .9375rem; color: var(--ink); }
.haz-head .haz-kind { font-size: .8125rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.haz-head .haz-now { font-size: .8125rem; font-weight: 600; color: var(--brand-dark); background: #eff6ff; border-radius: 6px; padding: 1px 8px; }
.due-group.is-current .due-head { background: #fef3c7; border-left-color: #f59e0b; color: #92400e; }
.due-group.is-current .due-head::before { content: "▶ 今ここ　"; }
.due-group.is-past .due-head { opacity: .75; }
/* 業務継続（BIA）パネル */
.svc-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; background: #fbfdff; }
.svc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: .9375rem; margin-bottom: 6px; }
.svc-note { font-size: .8125rem; color: var(--muted); margin: 0 0 6px; }
.svc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0; border-top: 1px solid #eef2f7; }
.svc-row:first-of-type { border-top: none; }
.svc-name { font-size: .875rem; }
.svc-name .svc-pri { font-size: .8125rem; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-right: 6px; vertical-align: middle; color: #fff; background: var(--gray); }
.svc-pri.core { background: var(--brand); } .svc-pri.reduce { background: var(--yellow); } .svc-pri.suspend { background: var(--gray); }
.svc-alt { font-size: .8125rem; color: var(--muted); grid-column: 1 / -1; }
.svc-plan { font-size: .8125rem; white-space: nowrap; }
.svc-pol { display: inline-block; font-size: .8125rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.svc-pol.continue { background: #dcfce7; color: #166534; } .svc-pol.reduce { background: #fef3c7; color: #92400e; } .svc-pol.stop { background: #fee2e2; color: #991b1b; }
.svc-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.svc-seg button { border: none; background: #fff; padding: 4px 9px; font-size: .8125rem; cursor: pointer; color: var(--muted); }
.svc-seg button + button { border-left: 1px solid var(--line); }
.svc-seg button.on.continue { background: #16a34a; color: #fff; } .svc-seg button.on.reduce { background: #d97706; color: #fff; } .svc-seg button.on.stop { background: #dc2626; color: #fff; }
.svc-seg button.diff { box-shadow: inset 0 0 0 2px #f59e0b; }
.svc-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.svc-summary { font-size: .8125rem; color: var(--muted); }

/* 事態（ハザード）選択モーダル・ステージ宣言モーダル */
.haz-list { display: grid; gap: 6px; }
.haz-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.haz-item.on { border-color: var(--brand); background: #f0f7ff; }
.haz-item .haz-lbl { font-weight: 600; font-size: .9375rem; }
.haz-item .haz-sub { font-size: .8125rem; color: var(--muted); }
.haz-item select { width: auto; padding: 4px 6px; font-size: .8125rem; }
.stage-list { display: grid; gap: 6px; }
.stage-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.stage-item.on { border-color: var(--brand); background: #f0f7ff; }
.stage-item.cur { box-shadow: inset 0 0 0 2px #f59e0b; }
.stage-item .st-title { font-weight: 700; font-size: .9375rem; }
.stage-item .st-crit { font-size: .8125rem; color: var(--muted); grid-column: 2; }
.stage-item .st-crit b { color: var(--ink); font-weight: 600; }
/* クロノロ */
.ch-form { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.ch-form input { padding: 7px 9px; font-size: .875rem; }
.ch-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.ch-table th, .ch-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.ch-table th { background: #f8fafc; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.ch-table .ch-t { white-space: nowrap; color: var(--muted); font-size: .8125rem; }
.ch-kind { display: inline-block; font-size: .8125rem; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.ch-kind.report { background: #64748b; } .ch-kind.instruction { background: #0369a1; } .ch-kind.response { background: #16a34a; } .ch-kind.stage { background: #b45309; } .ch-kind.phase { background: #7c3aed; } .ch-kind.announcement { background: #ea580c; } .ch-kind.manual { background: #0f766e; } .ch-kind.system { background: #94a3b8; }
.ch-act { color: var(--brand-dark); font-size: .8125rem; }
.ch-act .ch-edit { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 0 6px; font-size: .8125rem; cursor: pointer; color: var(--muted); }
.ch-act .ch-edit:hover { border-color: var(--brand); color: var(--brand); }
.ch-scroll { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* ===== 設定画面 ===== */
.schema-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 12px; }
.schema-grid h3 { margin: 0 0 6px; font-size: .9375rem; }
.schema-ed { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.schema-row { display: grid; grid-template-columns: 40px 1fr auto 30px; gap: 6px; align-items: center; }
.schema-row .s-color { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; }
.schema-row .s-label { padding: 6px 8px; font-size: .875rem; }
.schema-row .s-value { font-size: .8125rem; color: var(--muted); font-family: monospace; }
.schema-row .s-del { padding: 4px 8px; line-height: 1; }
.dept-edit { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.dept-edit-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: #f8fafc; }
.dept-edit-head .collapse-btn { border: none; background: none; cursor: pointer; font-size: .9375rem; color: var(--muted); }
.dept-edit-body { padding: 12px; border-top: 1px solid var(--line); }
.act-row { display: grid; grid-template-columns: 150px 150px 110px 1fr 120px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.act-row select, .act-row input { padding: 6px 8px; font-size: .875rem; }
.act-row .act-del { padding: 4px 8px; line-height: 1; }
.act-row .act-copy { color: var(--muted); }
.act-row .act-help { grid-column: 1 / -1; color: #1e3a8a; background: #f5f9ff; }
.add-act { margin-top: 4px; }
/* 業務（BIA）行・ハザード・ステージ編集 */
.svc-edit-row { display: grid; grid-template-columns: 1fr 130px 1.4fr 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.svc-edit-row select, .svc-edit-row input { padding: 6px 8px; font-size: .875rem; }
.svc-edit-row .svc-del { padding: 4px 8px; line-height: 1; }
.haz-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.haz-edit-grid textarea { min-height: 96px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8125rem; }
.stage-edit-row { display: grid; grid-template-columns: 90px 1fr 70px; gap: 6px 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.stage-edit-row:first-child { border-top: none; }
.stage-edit-row input, .stage-edit-row textarea { padding: 6px 8px; font-size: .875rem; }
.stage-edit-row .st-sub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }

@media (max-width: 760px) {
  .act-row { grid-template-columns: 1fr 1fr; }
  .act-row .act-text { grid-column: 1 / -1; }
  .svc-edit-row { grid-template-columns: 1fr 1fr; }
  .haz-edit-grid { grid-template-columns: 1fr; }
  .stage-edit-row { grid-template-columns: 1fr; }
  .stage-edit-row .st-sub { grid-template-columns: 1fr; }
}

/* ===== 講評レポート ===== */
.report-head h1 { margin: 0 0 8px; font-size: 1.3rem; }
.report-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .875rem; color: var(--muted); }
.report-meta b { color: var(--ink); }
.review-list { margin: 6px 0; padding-left: 20px; }
.review-list li { margin: 3px 0; font-size: .9375rem; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .appbar { position: static; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .wrap { max-width: none; padding: 0; }
  a[href]:after { content: ''; }
}

.hidden { display: none !important; }
.updated-flash { animation: flash 1s; }
@keyframes flash { from { background: #dbeafe; } to { background: transparent; } }

/* ライブ更新インジケータ */
.live { display: inline-flex; align-items: center; gap: 6px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

@media (max-width: 640px) {
  .appbar .title { font-size: .9375rem; flex: 1 1 100%; white-space: normal; }
  .appbar .spacer { display: none; }
  .wrap { padding: 14px 10px 50px; }
}

/* ===== Phase 2：本部ツール（受援・EMIS・資源） ===== */
.tool-tabs button { position: relative; }
.tool-badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: .8125rem; line-height: 18px; margin-left: 4px; }
.tool-badge:empty { display: none; }
.tool-badge.warn { background: var(--red); }
.team-form { display: grid; grid-template-columns: 1.1fr 2fr .6fr 1.2fr 1.1fr 1fr 1.4fr auto auto; gap: 6px; align-items: center; margin: 6px 0 10px; }
.team-form input, .team-form select { padding: 6px 8px; font-size: .875rem; }
.team-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.team-table th, .team-table td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: top; }
.team-table th { background: #f3f4f6; font-weight: 600; }
.team-table input, .team-table select { padding: 3px 5px; font-size: .8125rem; }
.team-table tr.left { opacity: .55; }
.tm-status { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: .8125rem; color: #fff; background: var(--gray); }
.tm-status.active { background: var(--green); } .tm-status.expected { background: var(--yellow); color: #222; }
.support-plan { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .875rem; }
.support-plan h4 { margin: 0 0 6px; font-size: .9375rem; }
.support-plan dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.support-plan dt { color: var(--muted); white-space: nowrap; } .support-plan dd { margin: 0; }
.emis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.emis-sec { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.emis-sec h4 { margin: 0 0 8px; font-size: .9375rem; }
.emis-row { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; align-items: start; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .875rem; }
.emis-row .er-l { font-weight: 600; }
.emis-row .er-l small { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; }
.emis-row .er-v input, .emis-row .er-v select, .emis-row .er-v textarea { padding: 4px 6px; font-size: .875rem; width: 100%; box-sizing: border-box; }
.emis-row .er-reason { grid-column: 2; font-size: .8125rem; color: var(--muted); }
.emis-row .er-reason.auto::before { content: '自動 '; color: var(--brand); font-weight: 600; }
.emis-row .er-v .seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.emis-row .er-v .seg button { padding: 3px 9px; font-size: .8125rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.emis-row .er-v .seg button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.emis-row .er-v .seg button.on.bad { background: var(--red); border-color: var(--red); }
.emis-row .er-v .seg button.on.mid { background: var(--yellow); border-color: var(--yellow); color: #222; }
.emis-row .er-v .num { width: 90px !important; display: inline-block; }
.emis-bld { display: grid; grid-template-columns: auto repeat(3, auto); gap: 2px 10px; font-size: .8125rem; align-items: center; }
.stock-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.stock-table th, .stock-table td { border-bottom: 1px solid var(--line); padding: 5px 6px; text-align: left; vertical-align: middle; }
.stock-table th { background: #f3f4f6; font-weight: 600; }
.stock-table input { width: 90px; padding: 3px 5px; font-size: .875rem; text-align: right; }
.stock-table tr.crit td { background: #fee2e2; } .stock-table tr.warn td { background: #fef3c7; }
.days-bar { display: inline-block; width: 96px; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.days-bar span { display: block; height: 100%; background: var(--green); }
.days-bar span.warn { background: var(--yellow); } .days-bar span.crit { background: var(--red); }
.stock-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.stock-panel h3 { margin: 0 0 6px; font-size: .9375rem; }
@media (max-width: 900px) {
  .team-form { grid-template-columns: 1fr 1fr; }
  .emis-grid { grid-template-columns: 1fr; }
  .emis-row { grid-template-columns: 1fr; } .emis-row .er-reason { grid-column: 1; }
}
/* ===== 平時点検（readiness.html） ===== */
.rd-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.rd-progress .progress-bar { flex: 1; }
.rd-group { margin: 14px 0 6px; }
.rd-group h3 { margin: 0; font-size: .9375rem; }
.rd-group p { margin: 2px 0 6px; font-size: .8125rem; color: var(--muted); }
.rd-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.rd-table th, .rd-table td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
.rd-table th { background: #f3f4f6; font-weight: 600; }
.rd-table .rd-no { white-space: nowrap; color: var(--muted); }
.rd-table input[type=text] { width: 100%; box-sizing: border-box; padding: 4px 6px; font-size: .8125rem; }
.rd-seg { display: inline-flex; gap: 3px; white-space: nowrap; }
.rd-seg button { padding: 3px 8px; font-size: .8125rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.rd-seg button.on.done { background: var(--green); color: #fff; border-color: var(--green); }
.rd-seg button.on.partial { background: var(--yellow); color: #222; border-color: var(--yellow); }
.rd-seg button.on.todo { background: var(--red); color: #fff; border-color: var(--red); }
.rd-table tr.done td { background: #f0fdf4; }
@media print { .rd-seg button:not(.on) { display: none; } .rd-table input[type=text] { border: none; } }

/* 設定：備蓄マスター・シナリオ */
.stock-edit-row { display: grid; grid-template-columns: 2.2fr 1fr .8fr .6fr .8fr 1.4fr 1.2fr 1.1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.stock-edit-row.head { font-size: .8125rem; color: var(--muted); font-weight: 600; margin-top: 4px; }
.stock-edit-row input, .stock-edit-row select { padding: 5px 7px; font-size: .875rem; min-width: 0; }
.sc-haz { display: flex; flex-wrap: wrap; gap: 4px 14px; }
@media (max-width: 900px) { .stock-edit-row { grid-template-columns: 1fr 1fr 1fr; } .stock-edit-row.head { display: none; } }

/* ===== Phase 3：患者・職員・対応チェック・連絡先 ===== */
.triage-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tri { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; font-size: .8125rem; background: #f8fafc; }
.tri input { width: 100%; box-sizing: border-box; text-align: center; padding: 4px; font-size: .9375rem; }
.tri.red { background: #fee2e2; } .tri.yellow { background: #fef3c7; } .tri.green { background: #dcfce7; } .tri.black { background: #e5e7eb; }
.transfer-form { grid-template-columns: .8fr 1fr .9fr 1.1fr 1.6fr 1.3fr .8fr 1fr auto; }
.tr-status { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: .8125rem; background: var(--gray); color: #fff; }
.tr-status.s2 { background: var(--yellow); color: #222; } .tr-status.s3 { background: var(--brand); } .tr-status.s4 { background: var(--green); } .tr-status.s5 { background: #9ca3af; }
.tr-checks label { display: inline-block; margin-right: 6px; font-size: .8125rem; white-space: nowrap; }
.chk-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; background: #fff; }
.chk-group h4 { margin: 0 0 6px; font-size: .9375rem; display: flex; align-items: center; gap: 8px; }
.chk-group h4 .prog { font-weight: 400; font-size: .8125rem; color: var(--muted); }
.chk-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: .875rem; }
.chk-item:last-child { border-bottom: none; }
.chk-item input { margin-top: 3px; }
.chk-item.done { color: var(--muted); text-decoration: line-through; }
.chk-item .chk-meta { margin-left: auto; font-size: .8125rem; color: var(--muted); white-space: nowrap; text-decoration: none; }
.contact-table tr { cursor: pointer; } .contact-table tr:hover td { background: #f1f5f9; }
.stat-mini { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.stat-mini .sm { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: .8125rem; }
.stat-mini .sm b { font-size: 1.0625rem; margin-right: 3px; }
.stat-mini .sm.bad { background: #fee2e2; border-color: #fca5a5; } .stat-mini .sm.warn { background: #fef3c7; border-color: #fcd34d; }
.muster-banner { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 8px 12px; font-size: .875rem; margin: 6px 0; }
.dept-num-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.dept-num-panel h3 { margin: 0 0 6px; font-size: .9375rem; }
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.num-grid label { display: flex; flex-direction: column; font-size: .8125rem; color: var(--muted); }
.num-grid input { padding: 5px 6px; font-size: .9375rem; }
@media (max-width: 900px) { .triage-grid { grid-template-columns: repeat(3, 1fr); } .transfer-form { grid-template-columns: 1fr 1fr; } }

.contact-edit-row { grid-template-columns: 1.2fr 2fr 1fr .9fr 2fr auto; }
.print-only { display: none; } @media print { .print-only { display: inline; } }

.att-edit-row { grid-template-columns: 2fr .8fr 1.2fr 1fr auto; }

/* 本部への要請・報告（1件ずつ＋分類は必須） */
/* 要請の1行：本文／分類／削除 を1段目、よくある要請のチップを2段目に置く（位置は明示する） */
.req-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: start; margin-bottom: 10px; }
.req-row .req-text { min-height: 48px; grid-column: 1; grid-row: 1; }
.req-row .req-cat-wrap { grid-column: 2; grid-row: 1; }
.req-row .req-del { grid-column: 3; grid-row: 1; }
.req-row .req-chips { grid-column: 1 / -1; grid-row: 2; }
.req-cat-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 210px; }
.req-cat-wrap select { font-size: .875rem; padding: 7px 8px; }
.req-guess { color: #fff; border: none; font-size: .8125rem; padding: 4px 8px; white-space: nowrap; }
.req-row .req-del { align-self: start; padding: 7px 10px; }
.req-row.req-need .req-cat { border-color: var(--danger); background: #fef2f2; }
.req-row.req-need::after { content: '分類を選んでください'; grid-column: 1 / -1; color: var(--danger); font-size: .8125rem; }
@media (max-width: 820px) {
  .req-row { grid-template-columns: 1fr auto; }
  .req-row .req-del { grid-column: 2; grid-row: 1; }
  .req-row .req-cat-wrap { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .req-row .req-chips { grid-column: 1 / -1; grid-row: 3; }
}

/* 一覧の「状況・要請」セル（分類バッジつき）と分類チップ */
.req-text .si { display: flex; gap: 6px; align-items: flex-start; padding: 3px 0; border-bottom: 1px dashed #e5e7eb; font-size: .875rem; line-height: 1.45; }
.req-text .si:last-child { border-bottom: none; }
.req-text .si-urgent { font-weight: 600; }
.cat-badge { flex: 0 0 auto; display: inline-block; min-width: 2.6em; text-align: center; padding: 1px 5px; border-radius: 4px; color: #fff; font-size: .8125rem; font-weight: 700; line-height: 1.5; }
/* 報告1件ごとの「レベル（危険／注意／要請／情報）」と「指示済みかどうか」（7.37） */
.lv-badge { flex: 0 0 auto; display: inline-block; min-width: 2.6em; text-align: center; padding: 1px 5px; border-radius: 4px; color: #fff; font-size: .8125rem; font-weight: 700; line-height: 1.5; }
.si-done, .si-todo { flex: 0 0 auto; margin-left: auto; padding: 0 5px; border-radius: 4px; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.si-done { color: #15803d; background: #dcfce7; }
/* 要請の「本部に何を求めるか」（指示要／対応中／報告のみ）。7.38 */
.req-cat-wrap .req-need { flex: 0 0 auto; max-width: 15em; border-width: 2px; }
.req-need-sel { flex: 0 0 auto; width: auto; max-width: 11em; border-width: 2px; font-size: .8125rem; padding: 1px 4px; }
.si-todo { color: #b45309; background: #fef3c7; }
.rs-v .si-done, .rs-v .si-todo { margin-left: 6px; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.cat-chip { border: 2px solid var(--cc); background: #fff; color: #111827; border-radius: 999px; padding: 3px 10px; font-size: .8125rem; cursor: pointer; }
.cat-chip b { color: var(--cc); margin-left: 2px; }
.cat-chip.active { background: var(--cc); color: #fff; }
.cat-chip.active b { color: #fff; }
.cat-chip .cc-u { margin-left: 5px; background: var(--red); color: #fff; border-radius: 999px; padding: 0 5px; font-size: .8125rem; }
@media (max-width: 820px) { .req-text { min-width: 0; } }

/* 判断ガイド：分類ごとにまとめたカード */
.gdg { border: 2px solid var(--cc); border-radius: 10px; padding: 8px 10px 4px; margin-bottom: 10px; background: #fff; }
.gdg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .9375rem; }
.gdg-head b { color: #111827; }
.gdg-n { margin-left: auto; font-size: .8125rem; color: var(--muted); }
.gdg .gd { border-left: none; margin-bottom: 6px; }
.gd-demote { font-size: .8125rem; background: #e5e7eb; color: #374151; border-radius: 4px; padding: 1px 5px; margin-left: 6px; }

/* 一覧表：列がつぶれないように最低幅を確保し、足りなければ横スクロールさせる */
.table-scroll table.hq { min-width: 1040px; }
table.hq .safety-cell { min-width: 96px; }
.req-text { min-width: 280px; max-width: 460px; }
@media (max-width: 820px) { .table-scroll table.hq { min-width: 0; } .req-text { min-width: 0; max-width: none; } }
@media (max-width: 1100px) {
  table.hq th, table.hq td { padding: 7px 6px; font-size: .8125rem; }
  .table-scroll table.hq { min-width: 900px; }
  .req-text { min-width: 200px; max-width: 320px; }
}
@media (max-width: 700px) {
  .table-scroll { max-height: none; }
  .table-scroll table.hq { min-width: 680px; }
  .grp-head { font-size: .8125rem; }
  .ug-wrap { font-size: .875rem; }
  .ug-plan-btns { flex-wrap: wrap; }
}

/* 送信済みの指示：1件1行（クリックで詳細） */
.inst-item .il-head { cursor: pointer; padding: 5px 4px; font-size: .875rem; }
.inst-item .il-head:hover { background: #f1f5f9; }
.inst-item .il-line1 { display: flex; gap: 8px; align-items: center; }
.inst-item .il-t { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.inst-item .il-to { flex: 1; font-weight: 700; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst-item .il-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.inst-item.open .il-text { display: none; }
.inst-item .il-high { color: var(--red); }
.inst-item .il-resp { font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.inst-item .il-resp.ng { color: var(--red); font-weight: 700; }
.inst-item .il-resp.ok { color: var(--green); }
.inst-item .il-more { color: var(--muted); font-size: .8125rem; }
.inst-item.open .il-body { padding: 6px 4px 8px; border-top: 1px dashed var(--line); }
.inst-item .il-full { white-space: pre-wrap; margin-bottom: 4px; }
.inst-item .il-refreq { font-size: .8125rem; color: #0369a1; background: #eff6ff; border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; }
.inst-item .il-refguide { font-size: var(--fs-label); color: #0369a1; background: #eff6ff; border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inst-item .il-refguide select { width: auto; max-width: 20em; }

/* 判断ガイド：指示済みの要請は畳む */
.ug-reqs li.req-done > .ug-req-text { cursor: pointer; }
.ug-reqs li.req-done > .ug-req-text::before { background: var(--green); }
.req-done-mark { background: var(--green); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: .8125rem; margin-right: 6px; }
.req-more { margin-left: 8px; font-size: .8125rem; color: var(--muted); }
.req-done-inst { font-size: .8125rem; color: var(--muted); margin: 2px 0 6px 0; padding-left: 2px; }
.ug-done-n { color: var(--green); font-weight: 700; font-size: .8125rem; }
.ug-reqs li.folded { opacity: .78; }

/* ── 要請台帳（案件）：部署の「出した要請」パネルと一覧の対応状況 ───────── */
.myreq-panel { margin: 10px 0; padding: 10px 12px; border: 1px solid #fcd34d; border-radius: 10px; background: #fffbeb; }
.myreq-head { font-weight: 600; font-size: .9375rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.myreq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.myreq-done-list { opacity: .7; margin-top: 6px; }
.myreq { border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 8px; background: #fff; }
.myreq-resolved { background: #f0fdf4; border-color: #bbf7d0; }
.myreq-working { background: #fefce8; }
.myreq-top { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
.myreq-text { font-size: .9375rem; flex: 1; min-width: 160px; }
.myreq-st { color: #fff; border-radius: 4px; padding: 1px 6px; font-size: .8125rem; white-space: nowrap; }
.myreq-meta { font-size: .8125rem; color: var(--muted); margin-top: 3px; }
.myreq-inst { color: var(--green); }
.myreq-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.myreq-note { flex: 1; min-width: 120px; font-size: .8125rem; padding: 3px 6px; border: 1px solid #d1d5db; border-radius: 6px; }
.req-st { border-radius: 4px; padding: 0 5px; font-size: .8125rem; margin-right: 4px; color: #fff; }
.req-st-working { background: #b8860b; }
.req-st-sel { flex: 0 0 auto; width: auto; max-width: 9em; font-size: .8125rem; padding: 1px 4px; border: 1px solid #d1d5db; border-radius: 5px; margin-right: 6px; }
.ug-solved-n { color: var(--green); font-size: .8125rem; }
.ug-solved { font-size: .8125rem; color: var(--muted); margin: 4px 0 2px; }
.dm-reqs { margin: 4px 0 0; padding-left: 18px; font-size: .875rem; }
.dm-req-resolved { color: var(--muted); text-decoration: line-through; }

/* ── 指示の回答期限 ───────────────────────────────────────────── */
.il-due { border-radius: 4px; padding: 1px 6px; font-size: .8125rem; background: #fef3c7; color: #92400e; white-space: nowrap; }
.il-due.over { background: var(--red); color: #fff; }
#sentBadge.over { animation: none; }
.overdue-bar { margin: 0 0 8px; padding: 7px 10px; border: 1px solid #fecaca; border-radius: 8px; background: #fef2f2; color: #991b1b; font-size: .875rem; }
.ins-due { color: #92400e; }
.ins-due.over { color: var(--red); }
.action-item.instruction.overdue { border-left: 4px solid var(--red); background: #fff5f5; }
.inst-over-n { background: var(--red); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: .8125rem; margin-left: 6px; }

/* ── 要請入力のチップ（よくある要請をワンタップ） ───────────────── */
.req-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 2px 0; min-width: 0; }
.req-chips.hidden { display: none; }
.req-chip-lbl { font-size: .8125rem; color: var(--muted); }
.req-chip { font-size: .8125rem; padding: 2px 8px; border: 1px solid #cbd5e1; border-left-width: 4px; border-radius: 12px; background: #fff; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.req-chip:hover { background: #f1f5f9; }

/* ── 外部手配の台帳 ───────────────────────────────────────────── */
.order-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.ord-sum { font-size: .875rem; margin-bottom: 6px; }
.ord-tbl input { width: 100%; font-size: .875rem; padding: 2px 5px; border: 1px solid #d1d5db; border-radius: 5px; }
.ord-tbl input.wide { min-width: 160px; }
.ord-tbl tr.ord-done { background: #f0fdf4; }
.ord-tbl tr.ord-ng { background: #fef2f2; }

/* ── 訓練シナリオの指示案（お手本） ───────────────────────────── */
.playbook-card { border: 1px solid #c7d2fe; background: #f5f7ff; }
.pb-item { border: 1px solid #e5e7eb; border-left-width: 4px; border-radius: 8px; background: #fff; padding: 8px 10px; margin-bottom: 8px; }
.pb-must { border-left-color: var(--red); }
.pb-should { border-left-color: var(--yellow); }
.pb-consider { border-left-color: #94a3b8; }
.pb-done { opacity: .72; background: #f0fdf4; border-left-color: var(--green); }
.pb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9375rem; }
.pb-t { font-size: .8125rem; color: #fff; background: #475569; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.pb-ok { font-size: .8125rem; color: var(--green); }
.pb-why, .pb-stage, .pb-act, .pb-to { font-size: .8125rem; color: var(--muted); margin-top: 3px; }
.pb-act { color: #92400e; }
.pb-instruct { font-size: .875rem; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px; padding: 6px 8px; margin-top: 4px; white-space: pre-wrap; }
.pb-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ── シナリオ編集画面 ─────────────────────────────────────────── */
.sc-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sc-row input[type=text], .sc-row input[type=number], .sc-row select { padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 6px; font-size: .875rem; }
.sc-pb { border: 1px solid #e5e7eb; border-left: 4px solid #6366f1; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #fff; }
.sc-pb textarea, .sc-pb > input[type=text] { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 6px; font-size: .875rem; font-family: inherit; }
.haz-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.haz-pick-item { border: 1px solid #d1d5db; border-radius: 16px; padding: 3px 10px; font-size: .875rem; cursor: pointer; background: #fff; }
.sc-inj { border: 1px solid #e5e7eb; border-left: 4px solid #0ea5e9; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; background: #fff; }
.sc-inj > input[type=text] { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 6px; font-size: .875rem; }
.sc-inj > textarea { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 6px; font-size: .875rem; font-family: inherit; }
.sc-inj .inj-sit { border-left: 3px solid #d97706; background: #fffbeb; }

/* 状況（何が起きたか）— 報告のいちばん上に置く事実の欄 */
#sitField.sit-required { border-left: 4px solid var(--danger); padding-left: 10px; background: #fff7f7; border-radius: 6px; }
.sit-need { color: var(--danger); font-weight: 700; font-size: .8125rem; margin-left: 8px; }
.req-text .si-situation { background: #fffbeb; border-left: 3px solid #d97706; padding-left: 6px; margin: 2px 0; }
.req-text .si-situation.si-urgent { background: #fef2f2; border-left-color: var(--danger); }

/* ===== 診察の依頼・院内班（7.39） ===== */
.exam-form { margin-top: 8px; padding: 10px 12px; border: 2px solid #f87171; border-radius: 10px; background: #fef2f2; }
.exam-head { font-weight: 700; color: #b91c1c; margin-bottom: 4px; }
.exam-to { margin: 6px 0; padding: 6px 8px; border-radius: 6px; background: #fff; border: 1px solid #fecaca; }
.exam-now { color: #b91c1c; }
.exam-btns { display: flex; gap: 8px; margin-top: 8px; }
.req-exam { font-size: .8125rem; font-weight: 600; color: #b91c1c; background: #fee2e2; border: 1px solid #fecaca; border-radius: 6px; padding: 3px 7px; margin-bottom: 4px; display: inline-block; }
#teamField { border: 2px solid #38bdf8; border-radius: 10px; padding: 10px 12px; background: #f0f9ff; }
.team-mem { margin-bottom: 4px; }
.tm-badge { display: inline-block; font-size: .8125rem; font-weight: 700; color: #fff; border-radius: 999px; padding: 1px 7px; margin-right: 4px; }
.team-row { display: flex; gap: 8px; align-items: center; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.team-none { color: var(--muted); font-size: .875rem; }

/* ===== 時間外の在否（7.42） ===== */
.pres-btns { margin-top: 4px; display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.pres-btn { padding: 1px 6px !important; font-size: .8125rem !important; }
.pres-btn.on { background: #0369a1; color: #fff; border-color: #0369a1; }
.shift-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 12px; border-radius: 8px; background: #f0f9ff; border: 1px solid #bae6fd; font-size: .875rem; }
.shift-bar.night { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.shift-bar.night .muted { color: #94a3b8; }
.shift-tag { font-weight: 700; }
.ug-pres-warn { color: #a16207; font-size: .8125rem; font-weight: 600; }
.tgt-item .tgt-pres { color: #a16207; font-size: .8125rem; }

/* ===== 設置（管理室・院内班）7.48 ===== */
.team-row.unset { background: #f8fafc; }
.tm-kind { display: inline-block; font-size: .8125rem; font-weight: 700; color: #475569; background: #e2e8f0; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.su-box .su-nums { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.su-box .su-num { display: flex; align-items: center; gap: 4px; font-size: .875rem; }
.su-box .su-num input { width: 62px; }
.su-box .su-more { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.su-box .su-more > summary { cursor: pointer; font-size: .875rem; color: #334155; }
.su-box .su-det { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.su-box .su-det .su-d-dept { flex: 1 1 140px; min-width: 0; }
.su-box .su-det .su-d-n { width: 74px; }
.su-box .su-chk { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: .875rem; }
.action-item.act-blocked { opacity: .85; }
.action-item.act-blocked input[type=checkbox] { cursor: not-allowed; }
.act-gate { margin: 4px 0 0; font-size: .8125rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 5px 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.act-gate .muted { color: #a16207; }
@media (max-width: 640px) { .team-row { flex-wrap: wrap; } .su-box .su-det { flex-wrap: wrap; } }

/* ===== 7.50 指揮系統の切り分け（本部・管理室・現場）===== */
/* 指揮の型（本部集中／現場委譲） */
.cmd-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 12px; border-radius: 8px; font-size: .875rem; border: 1px solid; }
.cmd-bar.central { background: #fef2f2; border-color: #fecaca; }
.cmd-bar.delegated { background: #f0fdf4; border-color: #bbf7d0; }
.cmd-tag { font-weight: 700; white-space: nowrap; }
/* 患者の受入・搬送（本部の中心業務） */
.flow-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; padding: 7px 12px; border-radius: 8px; font-size: .875rem; border: 1px solid #bae6fd; background: #f0f9ff; }
.flow-bar.lv-yellow { background: #fffbeb; border-color: #fde68a; }
.flow-bar.lv-red { background: #fef2f2; border-color: #fecaca; }
.flow-tag { font-weight: 700; white-space: nowrap; }
.flow-n { white-space: nowrap; }
.flow-n b { font-size: 1.25rem; }
.flow-n.warn { color: #b91c1c; }
/* 誰が決めるか */
.duty-card .duty-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.duty-col { flex: 1; min-width: 240px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.duty-col.mine { border-color: #0ea5e9; background: #f0f9ff; }
.duty-col h3 { margin: 0 0 6px; font-size: .9375rem; }
.duty-col ul { margin: 0; padding-left: 18px; }
.duty-col li { margin: 0 0 7px; font-size: .875rem; }
.duty-why { display: block; color: #64748b; font-size: .8125rem; font-weight: 400; margin-top: 1px; }
.duty-moved { display: inline-block; margin-left: 6px; font-size: .8125rem; font-weight: 700; color: #166534; background: #dcfce7; border-radius: 4px; padding: 1px 6px; }
/* 人の需給 */
.need-tbl td, .need-tbl th { font-size: .875rem; }
.need-tbl tr.need-ng > td { background: #fef2f2; }
.need-tbl tr.need-ok > td { background: #f0fdf4; }
.need-tbl tr.need-detail > td { background: #f8fafc; padding-top: 2px; padding-bottom: 4px; }
.need-short { color: #b91c1c; }
.need-spare { color: #15803d; font-weight: 600; }
.need-move { border-top: 1px dashed var(--line); padding-top: 8px; }
@media print { .cmd-bar, .flow-bar, .need-move { display: none; } }

/* 夜間・休日だけ内容が変わるアクション（7.48） */
.act-help { white-space: pre-wrap; }
.act-help-night { background: #f8fafc; border-left: 3px solid #64748b; }
.act-night-tag { display: block; font-weight: 700; color: #334155; font-size: .8125rem; margin-bottom: 3px; }
.act-night-mark { display: inline-block; margin-left: 6px; font-size: .8125rem; font-weight: 700; color: #1e293b; background: #e2e8f0; border-radius: 4px; padding: 1px 5px; }
.act-gate-opt { background: #f8fafc; border-color: #cbd5e1; color: #334155; }
/* ヘッダーのアプリ版・施設設定の版（7.51） */
.app-ver { font-size: .8125rem; color: rgba(255,255,255,.72); white-space: nowrap; align-self: center; margin-left: 4px; letter-spacing: .01em; }
@media print { .app-ver { display: none; } }

/* ===== 7.54 管理室からの報告・要請／設置の印 ===== */
.mgr-card .card-head { display: flex; align-items: center; gap: 8px; }
.mgr-row { border-top: 1px solid var(--line); padding: 10px 0; }
.mgr-row:first-child { border-top: 0; }
.mgr-row.mgr-stale { background: #fef2f2; }
.mgr-row.mgr-unset { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #6b7280; }
.mgr-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mgr-name b { font-size: var(--fs-heading); }
.mgr-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 3px 0 0; }
.mgr-esc { margin-top: 6px; }
.mgr-esc-h { font-weight: 600; color: #7c3aed; font-size: var(--fs-dense); }
.mgr-noreq { margin-top: 2px; }
.mgr-reqs { margin: 4px 0 0; padding-left: 1.3em; }
.mgr-reqs li { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.mgr-req-text { flex: 1 1 18em; min-width: 12em; }
.mgr-act { margin-left: auto; }

/* 部署名の右の「設置済み／未設置」 */
.su-chip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  font-size: var(--fs-label); font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.su-chip.su-on { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.su-chip.su-forming { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.su-chip.su-off { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.su-chip.su-stood { background: #f3f4f6; color: #9ca3af; border-color: #e5e7eb; }
tr.mgrsec-row > td { background: #faf5ff; border-top: 2px solid #ddd6fe; }
.mgrsec-row .grp-head b { color: #6d28d9; }

/* ===== 本部画面の3ペイン（7.56）＝ 左：病院全体のサマリ／中央：部署別 状況一覧／右：本部の操作 =====
   ねらいは1つだけ：いちばん見たい「部署別 状況一覧」を1画面目に入れること。
   これまでは帯5本＋管理室カードで1画面が埋まり、一覧は 1900px 下にあった。 */
.hq-shell { display: flex; align-items: flex-start; gap: 16px; }
.hq-side {
  flex: 0 0 260px; min-width: 0;
  position: sticky; top: calc(var(--appbar-h, 56px) + 8px);
  max-height: calc(100vh - var(--appbar-h, 56px) - 20px);
  overflow-y: auto; overscroll-behavior: contain; padding-right: 2px;
}
.hq-body { flex: 1 1 0; min-width: 0; }
/* サイドバーの中では帯を細く・縦積みにする */
.hq-side .stage-bar, .hq-side .shift-bar, .hq-side .cmd-bar, .hq-side .flow-bar {
  margin: 0 0 8px; padding: 8px 10px; font-size: .875rem; line-height: 1.6;
}
.hq-side .flow-bar { gap: 4px 10px; }
.hq-side .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.hq-side .stat { padding: 8px 6px; }
.hq-side .stat .l { font-size: .8125rem; }
/* 管理室（左の要約）。行を押すと一覧の該当行へ飛び、指示の宛先になる */
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0 0 8px; }
.side-card.mgr { background: #faf5ff; border-color: #ddd6fe; }
.side-h { font-size: .8125rem; font-weight: 700; color: #6d28d9; margin-bottom: 4px; }
.side-mgr {
  display: flex; align-items: center; gap: 6px; width: 100%;
  text-align: left; background: none; border: 0; border-top: 1px solid #ede9fe;
  padding: 5px 0; cursor: pointer; font: inherit;
}
.side-mgr:first-of-type { border-top: 0; }
.side-mgr:hover { background: #f5f3ff; }
.side-mgr .nm { flex: 1 1 auto; min-width: 0; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-mgr .v { flex: 0 0 auto; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.side-mgr .v.bad { color: var(--red); }
.side-mgr .v.ok { color: var(--green); }
.side-mgr .v.off { color: var(--gray); }
/* 畳んだカードへの案内（一覧の下に置いたカードへ飛んで開く） */
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-link {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: .875rem; cursor: pointer;
}
.side-link:hover { border-color: var(--brand); background: #eff6ff; }
.side-badge { margin-left: auto; font-size: .8125rem; font-weight: 700; border-radius: 999px; padding: 1px 7px; background: #fee2e2; color: #b91c1c; white-space: nowrap; }
.side-badge.hidden { display: none; }
/* 右の「本部の操作」も画面に貼り付けて、一覧を見ながらそのまま指示を書けるようにする */
@media (min-width: 901px) {
  .hq-body #paneTabs {
    position: sticky; top: calc(var(--appbar-h, 56px) + 8px);
    max-height: calc(100vh - var(--appbar-h, 56px) - 20px); overflow-y: auto;
  }
}
/* 一覧の行を選ぶと、右の指示欄がその部署に切り替わったことが分かるようにする */
table.hq tr.row-sel > td { box-shadow: inset 3px 0 0 var(--brand); }
table.hq tr.row-sel > td:first-child { background: #eff6ff; }
@media (max-width: 1500px) { .hq-side { flex: 0 0 220px; } }
@media (max-width: 1200px) {
  .hq-shell { display: block; }
  .hq-side { position: static; max-height: none; overflow: visible; }
  .hq-side .stat-row { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-link { width: auto; }
}
/* 一覧の列幅：いちばん読む「状況・要請」を確保し、数字の列は折り返さない（7.56）。
   これをしないと「問題なし」が縦に1文字ずつ折り返して行が数百pxになる */
.hq-body table.hq th:nth-child(1), .hq-body table.hq td:nth-child(1) { min-width: 180px; }
.hq-body table.hq th:nth-child(3), .hq-body table.hq td:nth-child(3) { min-width: 420px; }
.hq-body table.hq th:nth-child(4), .hq-body table.hq td:nth-child(4) { min-width: 104px; white-space: nowrap; }
.hq-body table.hq th:nth-child(n+5), .hq-body table.hq td:nth-child(n+5) { white-space: nowrap; }
.hq-body table.hq td:nth-child(n+5) .pill, .hq-body table.hq td:nth-child(n+5) .btn { white-space: nowrap; }

/* ===== 訓練を始めるダイアログ（7.58）＝ 本部・部署・管理室で共用 ===== */
.tr-box .tr-haz { max-height: 24vh; overflow-y: auto; padding-right: 2px; }
/* 訓練の始め方の説明（シナリオ／事態の違い）7.66 */
.tr-box .tr-how { background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; margin: 0 0 12px; display: grid; gap: 4px; font-size: var(--fs-label); line-height: 1.55; }
.tr-box .tr-how-a { color: var(--brand-dark); }
.tr-box .tr-how-b { color: #6b21a8; }
/* この訓練で起きること（時間割）7.66 */
.tr-box .tr-tl { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; background: #fff; }
.tr-box .tr-tl > summary { cursor: pointer; padding: 8px 10px; font-weight: 700; font-size: var(--fs-body); list-style: none; }
.tr-box .tr-tl > summary::-webkit-details-marker { display: none; }
.tr-box .tr-tl > summary::before { content: '▸ '; }
.tr-box .tr-tl[open] > summary::before { content: '▾ '; }
.tr-box .tr-tl .tr-tl-n { color: var(--muted); font-weight: 400; font-size: var(--fs-label); }
.tr-box .tr-tl-body { max-height: 26vh; overflow-y: auto; padding: 0 10px 10px; }
.tl-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-label); }
.tl-tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 6px 4px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.tl-tbl td { padding: 3px 6px; vertical-align: top; border-bottom: 1px solid var(--bg); }
.tl-tbl .tl-at { white-space: nowrap; color: var(--ink); }
.tl-tbl .tl-rt { white-space: nowrap; color: var(--muted); }
.tl-tbl .tl-k { width: 1.6em; text-align: center; }
.tl-tbl .tl-from { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 999px;
  background: var(--bg); color: var(--muted); white-space: nowrap; }
.tl-tbl .tl-phase .tl-from { background: var(--brand); color: #fff; }
.tl-tbl .tl-inject .tl-from { background: var(--warn-soft); color: var(--warn-ink); }
.tl-tbl .tl-guide .tl-from { background: var(--mgr-soft); color: var(--mgr); }
.tl-tbl .tl-support .tl-from { background: var(--ok-soft, #ecfdf5); color: var(--ok-ink, #065f46); }
.tr-box .tr-opts { align-items: flex-end; gap: 12px; }
.tr-box .tr-opts .field { margin-bottom: 0; }
.tr-box .tr-warn {
  margin: 12px 0 0; padding: 8px 12px; border-radius: 10px;
  background: var(--warn-soft); border: 1px solid var(--warn-line);
  color: var(--warn-ink); font-size: var(--fs-dense); line-height: 1.6;
}
/* 「よくある状況」の文例がその事態にまだ無いときの案内（7.59） */
.req-chip-lbl.sit-none { color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 8px; padding: 4px 8px; line-height: 1.6; }
