:root {
  --bg: #f6f7f5; --panel: #ffffff; --ink: #1f2933; --muted: #5b6770; --line: #cfd6d4; --line2: #e4e9e7;
  --accent: #2f6f6a; --accent-ink: #ffffff; --duty: #fff6cf; --off: #e9ecec; --group: #edf6dc;
  --chip: #e3f1ef; --chip-line: #9cc5c0; --intensive: #dceafe; --intensive-line: #86a9e0;
  --warn: #fde8e4; --warn-line: #d9735f; --ok: #d9f2df; --ng: #f3f4f4; --sel: #1d4f4b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding: 16px; background: var(--bg); color: var(--ink); font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif; font-size: 15px; line-height: 1.6; }
h1 { font-size: 20px; margin: 0; line-height: 1.4; }
h2 { font-size: 15px; margin: 0 0 6px; }
.tag { font-size: 12px; font-weight: 600; background: #fff0c2; border: 1px solid #e0c060; border-radius: 4px; padding: 1px 6px; vertical-align: middle; white-space: nowrap; }
.top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; justify-content: space-between; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button, select { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button:focus-visible, select:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { margin: 10px 0; font-size: 13px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tab { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 96px; padding: 6px 10px; line-height: 1.35; }
.tab b { font-size: 15px; } .tab span { font-size: 12px; color: var(--muted); }
.tab.on { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.badge { border-radius: 9px; padding: 0 6px; margin-top: 2px; }
.tab .badge.un { background: #fff0c2; color: #6b4e00; } .tab .badge.warn { background: var(--warn); color: #8a2c1c; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; align-items: start; }
.board-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; min-width: 760px; table-layout: fixed; }
.grid th, .grid td { border: 1px solid var(--line2); padding: 2px 3px; text-align: center; vertical-align: middle; }
.grid thead th { background: #f0f4f3; position: sticky; top: 0; z-index: 1; padding: 5px 3px; }
.grid th.time { width: 56px; font-weight: 500; font-size: 13px; color: var(--muted); background: #f0f4f3; font-variant-numeric: tabular-nums; }
.grid thead th.off { background: var(--off); } .grid thead th.group { background: var(--group); }
.sname { font-weight: 600; font-size: 14px; } .srole { font-size: 11px; color: var(--muted); min-height: 16px; }
.grid thead select { width: 100%; max-width: 86px; font-size: 12px; padding: 1px 2px; margin-top: 2px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.grid td.cell { height: 34px; }
.grid tr.gap > * { border-top: 3px double var(--line); }
.cell.duty { background: var(--duty); } .cell.off { background: repeating-linear-gradient(135deg, var(--off) 0 6px, #f5f6f6 6px 12px); } .cell.group { background: var(--group); }
.dutyl { font-size: 12px; color: var(--muted); }
.cell.ok { background: var(--ok); } .cell.ng { background: var(--ng); opacity: .55; }
.chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 7px; border: 1px solid var(--chip-line); border-radius: 5px; background: var(--chip); font-size: 14px; line-height: 1.5; cursor: grab; white-space: nowrap; user-select: none; }
.chip.intensive { background: var(--intensive); border-color: var(--intensive-line); }
.chip.locked { border-style: solid; border-width: 2px; }
.chip.warn { background: var(--warn); border-color: var(--warn-line); }
.chip.sel { box-shadow: 0 0 0 2px var(--sel); }
.mk { font-style: normal; font-size: 10px; border-radius: 3px; padding: 0 2px; background: rgba(0, 0, 0, .08); line-height: 1.5; }
.mk.w { background: var(--warn-line); color: #fff; }
.side section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.count { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.detail .dname { font-weight: 600; margin: 0 0 4px; }
.detail dl { display: grid; grid-template-columns: 64px 1fr; gap: 2px 6px; margin: 0 0 6px; font-size: 13.5px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; }
.dwarn { background: var(--warn); border: 1px solid var(--warn-line); border-radius: 5px; padding: 4px 8px; font-size: 13px; margin: 0 0 6px; }
.dbtn { display: flex; flex-wrap: wrap; gap: 6px; } .dbtn button { font-size: 13px; padding: 5px 9px; }
.absent select { width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-bottom: 6px; }
button.abs { font-size: 13px; padding: 2px 8px; background: var(--off); }
.stats { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
table.stat { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stat th, .stat td { border: 1px solid var(--line2); padding: 3px 12px; text-align: right; }
.stat th { background: #f0f4f3; font-weight: 500; text-align: center; white-space: nowrap; } .stat tbody th { text-align: left; }
.stat .sum, .stat .tot td, .stat .tot th { font-weight: 600; } .stat tr.tot:first-of-type > * { border-top: 2px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); background: #24323a; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.print-only { display: none; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } body { padding: 12px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media print {
  @page { size: A4 landscape; margin: 9mm; }
  body { background: #fff; padding: 0; font-size: 10pt; }
  .top, .note, .tabs, .layout, .stats, .toast { display: none !important; }
  .print-only { display: block; }
  .psheet { break-after: page; } .psheet:last-child { break-after: auto; }
  .psheet h2 { font-size: 12pt; margin: 0 0 2mm; }
  table.grid { min-width: 0; } .grid thead th { position: static; }
  .grid th, .grid td { padding: 0 2px; line-height: 1.2; }
  .grid thead th { padding: 1mm 1px; } .srole { min-height: 0; font-size: 7.5pt; } .offp { font-size: 8pt; font-weight: 600; }
  .grid th.time { font-size: 8.5pt; width: 13mm; }
  .grid td.cell { height: 5.5mm; } .chip { font-size: 9pt; line-height: 1.25; padding: 0 3px; border-width: 1px; } .chip.locked { border-width: 1px; } .mk { font-size: 6.5pt; line-height: 1.2; } .dutyl { font-size: 7.5pt; }
  .grid tr { break-inside: avoid; }
  .cell.duty, .cell.off, .cell.group, .chip, .grid thead th, .grid th.time { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ───── 画面の切り替え・保存の表示・入浴表・台帳 ───── */
[hidden] { display: none !important; }
.who { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.save.ok { color: #2f6f6a; } .save.ng { color: #a23a26; font-weight: 600; }
.views { display: flex; gap: 6px; margin: 12px 0 10px; border-bottom: 2px solid var(--line); }
.views button { border-radius: 6px 6px 0 0; border-bottom: 0; margin-bottom: -2px; padding: 8px 16px; font-weight: 600; background: #eef1f0; }
.views button.on { background: var(--panel); border-color: var(--line); border-bottom: 2px solid var(--panel); color: var(--accent); }
.view > .actions { margin: 0 0 10px; }
.ro .w-only { display: none !important; }
.blocked { margin: 40px auto; max-width: 520px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.dnote { background: #fff6cf; border: 1px solid #e0c060; border-radius: 5px; padding: 4px 8px; font-size: 13px; margin: 0 0 6px; }
.bath { padding: 8px 12px 12px; }
.bath h3 { font-size: 14px; margin: 10px 0 4px; color: var(--muted); }
.brow { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: stretch; border: 1px solid var(--line2); border-radius: 6px; margin-bottom: 5px; background: #fff; min-height: 40px; }
.brow.pm { background: #fbfaf3; } .brow.none { background: var(--ng); } .brow.over { outline: 2px solid var(--accent); }
.btime { display: flex; flex-direction: column; justify-content: center; padding: 3px 8px; border-right: 1px solid var(--line2); font-variant-numeric: tabular-nums; line-height: 1.35; }
.btime span { font-size: 12px; color: var(--muted); }
.bzone { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 6px; align-items: center; }
.bchip.g-m { background: #e4eefb; border-color: #9db9e3; } .bchip.g-f { background: #fbe9ee; border-color: #e3a9b8; } .bchip.g-x { background: #f1f1f1; border-color: #bbb; }
.bchip.warn { background: var(--warn); border-color: var(--warn-line); }
.bn { font-weight: 500; }
.rules ul { margin: 0 0 6px; padding-left: 18px; font-size: 13.5px; } .rules li { margin-bottom: 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.cards .card { margin-bottom: 0; }
.card ul { margin: 0; padding-left: 18px; } .card input[type=file] { max-width: 100%; font-size: 13px; }
.result { font-size: 13.5px; margin-top: 6px; min-height: 1.2em; }
.tablewrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
table.list { border-collapse: collapse; width: 100%; font-size: 14px; }
.list th, .list td { border: 1px solid var(--line2); padding: 4px 8px; text-align: left; vertical-align: top; }
.list th { background: #f0f4f3; font-weight: 500; position: sticky; top: 0; white-space: nowrap; }
.list input[type=text] { width: 160px; max-width: 100%; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
table.bprint { border-collapse: collapse; width: 100%; font-size: 9pt; }
.bprint th, .bprint td { border: 1px solid #888; padding: 1mm 1.5mm; text-align: left; vertical-align: top; }
.bprint th { background: #eee; white-space: nowrap; } .bprint td:nth-child(1), .bprint td:nth-child(2) { white-space: nowrap; }
@media print { .views, .who, .view, .tabs { display: none !important; } .bprint th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ───── 2026-11-20 施設の回答の反映：マスの色・字の色・かたより・入浴の介助の編集 ───── */
/* 業務のマスは今のExcelと同じ色（planner.js の DUTY_KINDS と同じ値。CSP で style 属性が使えないのでクラスで持つ） */
.k-group { --kc: #CCFF66; } .k-bath { --kc: #66FFFF; } .k-exam { --kc: #CC99FF; } .k-meeting { --kc: #FFC000; }
.k-other { --kc: #FFFF00; } .k-pc { --kc: #FFCCCC; } .k-rest { --kc: #E2EFDA; } .k-unknown { --kc: #CCFFEE; }
.cell.duty.kc { background: color-mix(in srgb, var(--kc) 70%, #fff); }
.cell.duty.kc .dutyl { color: #333; }
/* 字の色：赤字＝短時間帰り、青字＝追加・振替、緑字＝お試し */
.chip.m-short { color: #c00000; font-weight: 600; } .chip.m-extra { color: #0060b0; font-weight: 600; } .chip.m-trial { color: #00843a; font-weight: 600; }
dd.m-short { color: #c00000; } dd.m-extra { color: #0060b0; } dd.m-trial { color: #00843a; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 10px; border-top: 1px solid var(--line2); font-size: 12.5px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend .lg i { display: inline-block; width: 14px; height: 14px; border: 1px solid #aaa; background: var(--kc); border-radius: 2px; }
.legend .lg.m-short b { color: #c00000; } .legend .lg.m-extra b { color: #0060b0; } .legend .lg.m-trial b { color: #00843a; }
.stats h3 { font-size: 14px; margin: 14px 0 4px; }
.stat.fair th.kh { background: color-mix(in srgb, var(--kc) 55%, #fff); }
.stat.fair td.hi { background: #fde8e4; font-weight: 700; }
.beditor { display: grid; gap: 5px; margin: 4px 0 8px; }
.beditor .bf { display: grid; grid-template-columns: 76px 1fr; gap: 6px; align-items: start; font-size: 13px; }
.beditor .bf span { color: var(--muted); padding-top: 4px; }
.beditor input, .beditor textarea { width: 100%; font: inherit; font-size: 13.5px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; resize: vertical; }
.beditor .ball { font-size: 12.5px; color: var(--muted); }
.bprint .chg { font-size: 7.5pt; color: #c00000; white-space: nowrap; }
.bprint tr.blank td { height: 8mm; }
.pnote { font-size: 8.5pt; margin: 2mm 0 0; color: #333; }
@media print {
  .cell.duty.kc, .stat.fair th.kh, .chip.m-short, .chip.m-extra, .chip.m-trial, .legend .lg i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .legend { font-size: 7.5pt; padding: 1mm 0; border: 0; gap: 0 3mm; }
}
@media print {
  /* 入浴表は1日1枚（26人前後＋手書き用の空欄5行）に収める */
  table.bprint { font-size: 8.5pt; line-height: 1.25; }
  .bprint th, .bprint td { padding: .5mm 1.5mm; }
  .bprint tr.blank td { height: 5.2mm; }
  .bprint tr { break-inside: avoid; }
}
