/* 業務システム標準スタイル: 白・グレー基調 + アクセント1色(#1a56a0) */
* { box-sizing: border-box; }
body {
  margin: 0; background: #f4f4f4; color: #222;
  /* 外部フォント（Google Fonts）は使わない。院内ネットワークで取得できないと、印刷画面が開くまで
     ブラウザが読み込みの時間切れ（約1分）を待つため。端末に入っている日本語フォントを使う */
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 13px; line-height: 1.6;
}
main { padding: 14px 20px 50px; max-width: 1560px; margin: 0 auto; }
h1 { font-size: 18px; margin: 6px 0 12px; font-weight: 700; }
h2 { font-size: 15px; margin: 10px 0 8px; }
a { color: #1a56a0; }

/* ヘッダー */
.topnav {
  display: flex; align-items: center; gap: 4px; padding: 0 16px;
  background: #fff; border-bottom: 1px solid #ccc; height: 42px;
}
.topnav .brand { font-weight: 700; margin-right: 18px; font-size: 13.5px; }
.topnav a {
  color: #333; text-decoration: none; padding: 0 10px; height: 42px;
  display: inline-flex; align-items: center; border-bottom: 2px solid transparent;
}
.topnav a:hover { background: #f0f0f0; }
.topnav a.navtab { font-weight: 500; }
.topnav a.active {
  border-bottom-color: #1a56a0; color: #1a56a0; font-weight: 700;
}
.topnav .navgroup {
  color: #888; font-size: 11px; margin-left: 10px; padding-left: 10px;
  border-left: 1px solid #ddd; align-self: center; line-height: 1.1;
}
.topnav .spacer { flex: 1; }
.topnav .whoami { color: #666; margin-right: 4px; }

.flash {
  background: #eef6ee; border: 1px solid #9dc49d; color: #1f5220;
  padding: 6px 12px; border-radius: 4px; margin-bottom: 10px;
}
.notice {
  background: #fff8e6; border: 1px solid #d9c27a; color: #6b5416;
  padding: 8px 12px; border-radius: 4px; margin-bottom: 10px;
}

/* ページ見出し・操作列 */
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.ym { color: #555; font-size: 14px; font-weight: 400; }
input, select, button {
  font-family: inherit; font-size: 13px;
}
input[type="text"], input[type="date"], input[type="month"], input[type="password"],
input:not([type]) {
  padding: 4px 8px; border: 1px solid #bbb; border-radius: 4px; background: #fff;
}
button, .btn-sm {
  padding: 4px 12px; border: 1px solid #bbb; border-radius: 4px;
  background: #fff; color: #222; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
button:hover, .btn-sm:hover { background: #f0f0f0; }
.btn-primary {
  background: #1a56a0; border-color: #1a56a0; color: #fff;
  padding: 6px 24px; font-weight: 500;
}
.btn-primary:hover { background: #14477f; }
.btn-danger-sm {
  padding: 2px 8px; border: 1px solid #c99; color: #a33; background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 12px;
}

/* タブ（部署ページ） */
.sheet-tabs { display: flex; border-bottom: 1px solid #ccc; margin-bottom: 10px; }
.sheet-tabs a {
  padding: 6px 18px; color: #444; text-decoration: none;
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
.sheet-tabs a.active {
  background: #fff; border-color: #ccc; border-bottom: 1px solid #fff;
  font-weight: 700; color: #1a56a0;
}
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar .right { margin-left: auto; }

/* ダッシュボード統計行 */
.stats { margin: 4px 0 10px; color: #333; }
.stats strong { font-size: 15px; }
.stats .overdue { color: #b3261e; font-weight: 700; }

/* 汎用テーブル */
table.list { border-collapse: collapse; background: #fff; width: 100%; }
table.list th {
  background: #f0f0f0; border: 1px solid #ccc; padding: 5px 8px; text-align: left;
  font-weight: 600;
}
table.list td { border: 1px solid #ddd; padding: 4px 8px; }
table.list.fit { width: auto; }
table.list.fit td, table.list.fit th { white-space: nowrap; }
.num-cell { text-align: center; }
.nowrap { white-space: nowrap; }
/* 状態の色: 赤＝締切超過など要対処／オレンジ＝締切間近・承認待ち・入力中／青＝操作対象／
   緑＝完了／グレー＝未着手（締切前）・対象外 */
.bar { display: inline-block; background: #e6e6e6; height: 8px; width: 120px; border-radius: 4px;
  overflow: hidden; vertical-align: middle; }
.bar .fill { display: block; height: 100%; }
.fill.ok { background: #2e7d32; }
.fill.wip { background: #d97706; }
.fill.todo { background: #9e9e9e; }
.fill.ng { background: #b3261e; }
.progress { display: flex; align-items: center; gap: 6px; justify-content: center; }
.progress .pct { min-width: 34px; text-align: right; font-weight: 600; }
.status-ok { color: #2e7d32; font-weight: 600; }
.status-wip { color: #b45309; font-weight: 600; }
.status-todo { color: #777; }
.status-ng { color: #b3261e; font-weight: 700; }
tr.st-ng td { background: #fdf3f3; }

/* 進捗画面の概要カード */
.stat-cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.stat-card {
  flex: 1 1 150px; max-width: 220px; background: #fff; border: 1px solid #ddd;
  border-left: 5px solid #9e9e9e; border-radius: 4px; padding: 8px 12px;
  color: inherit; text-decoration: none;
}
a.stat-card[href]:hover { background: #fafafa; }
.stat-label { font-size: 12px; color: #666; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.3; }
.stat-value small { font-size: 13px; font-weight: 400; color: #555; }
.stat-sub { font-size: 12px; color: #555; min-height: 18px; }
.stat-card.c-red { border-left-color: #b3261e; }
.stat-card.c-red .stat-value, .stat-card.c-red .stat-sub { color: #b3261e; }
.stat-card.c-orange { border-left-color: #d97706; }
.stat-card.c-orange .stat-value { color: #b45309; }
.stat-card.c-blue { border-left-color: #1a56a0; }
.stat-card.c-green { border-left-color: #2e7d32; }
.stat-card.c-green .stat-value { color: #2e7d32; }
.stat-card.c-gray .stat-value { color: #555; }
.old { color: #a33; }
.new { color: #276b2f; }

.two-col { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.panel { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 12px 16px; }
.panel label { display: block; margin: 8px 0 3px; font-weight: 600; }
.panel input { width: 100%; }
.radio-row { display: block; margin: 6px 0; font-weight: 400 !important; }
.radio-row input { width: auto !important; margin-right: 6px; }

/* ログイン */
.login-wrap { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 36px; justify-content: center; }
.login-box { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 22px 26px; min-width: 320px; }
.login-box h1 { margin-top: 0; font-size: 17px; }
.login-box .sub { color: #666; font-size: 12px; }
.login-box label { display: block; margin: 10px 0 3px; font-weight: 600; }
.login-box input, .login-box select {
  display: block; width: 100%; padding: 6px 8px; border: 1px solid #bbb; border-radius: 4px;
  margin-top: 3px; font-weight: normal; background: #fff;
}
.login-box button {
  margin-top: 14px; width: 100%; padding: 8px; border: 0; border-radius: 4px;
  background: #1a56a0; color: #fff; font-size: 14px; cursor: pointer;
}
.login-box .error { background: #fdecec; border: 1px solid #d99; padding: 6px 8px; border-radius: 4px; }
.demo-accounts { max-height: 460px; overflow-y: auto; }
table.mini { border-collapse: collapse; font-size: 12px; }
table.mini th, table.mini td { border: 1px solid #ddd; padding: 2px 8px; }
table.mini .dim { color: #777; background: #f5f5f5; }

/* 入力・出力グリッド（幅は内容に合わせる） */
.table-scroll {
  overflow-x: auto; background: #fff; border: 1px solid #ccc;
  display: inline-block; max-width: 100%; vertical-align: top;
}
table.grid { border-collapse: collapse; font-size: 12.5px; }
table.grid th {
  background: #f0f0f0; border: 1px solid #ccc; padding: 4px 5px;
  position: sticky; top: 0; font-weight: 600;
}
table.grid td { border: 1px solid #ddd; padding: 2px 4px; white-space: nowrap; }
table.grid .datecol { font-weight: 700; white-space: nowrap; }
tr.sat td { background: #eef3f9; }
tr.sun td { background: #faeff0; }
.tokyo { color: #b3261e; font-weight: 700; }
.period { text-align: center; }
.pcell { display: flex; align-items: center; gap: 3px; margin: 1px 0; }
.plabel { font-size: 10.5px; color: #555; white-space: nowrap; min-width: 34px; }
table.grid select {
  min-width: 88px; padding: 2px 3px; border: 1px solid #bbb; border-radius: 3px;
  background: #fff;
}
.fixed-person { color: #444; }
.na { color: #bbb; }
.save-bar {
  position: sticky; bottom: 0; background: #fff; border: 1px solid #ccc;
  border-top: 2px solid #1a56a0; padding: 8px 14px; margin-top: 8px;
  display: flex; align-items: center; gap: 14px; z-index: 10;
}
.hint { color: #666; font-size: 12px; margin-top: 8px; }

.unsaved-note { color: #b45309; font-weight: 700; }
.saved-note { color: #2e7d32; font-weight: 600; }
.empty-note { color: #555; }
.empty-note strong { color: #b45309; }
.empty-note .all-filled { color: #2e7d32; }
table.grid select.jump-target { outline: 3px solid #d97706; outline-offset: 1px; }

/* 入力画面: ページをスクロールしても見出し行（画面上端）と日付列（画面左端）を固定する
   （31日分を下にスクロールしても何の枠か、横にスクロールしても何日かが分かるように）。
   固定は「はみ出しを隠す・スクロールする」親要素があると効かないため、この表だけは枠内スクロールにしない
   （列が多く画面幅を超える場合はページ全体が横にスクロールする） */
.input-scroll { overflow: visible; max-width: none; }
.input-scroll table.grid th { z-index: 2; }
.input-scroll table.grid th.datecol,
.input-scroll table.grid td.datecol { position: sticky; left: 0; z-index: 3; background: #fafafa; }
.input-scroll table.grid th.datecol { z-index: 4; background: #f0f0f0; }
.input-scroll tr.sat td.datecol { background: #e7eef8; }
.input-scroll tr.sun td.datecol { background: #f7e9ea; }

/* 帳票（月間宿日直表・オンコール表）: ページをスクロールしても見出し行（2段の見出しはまとめて）を画面上端に固定する。
   固定は枠内スクロールの親要素があると効かないため、横幅が画面を超える場合はページ全体が横にスクロールする */
.sticky-head { overflow: visible; max-width: none; }
.sticky-head thead { position: sticky; top: 0; z-index: 2; }
.sticky-head thead th { position: static; box-shadow: inset 0 -1px 0 #ccc; }
.sticky-head tbody td.datecol { position: sticky; left: 0; z-index: 1; background: #fafafa; }
.sticky-head tr.sat td.datecol { background: #e7eef8; }
.sticky-head tr.sun td.datecol { background: #f7e9ea; }

/* 一括入力 */
.bulk-box { background: #fff; border: 1px solid #ccc; padding: 8px 12px; margin-bottom: 8px; }
.bulk-box form, .bulk-box .bulk-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 3px 0;
}
.bulk-box .slot-name { min-width: 160px; font-weight: 600; }

.plabel-h { font-weight: 400; color: #555; font-size: 10px; }

/* 月間表 */
table.monthly { font-size: 11px; }
table.monthly th.gh {
  padding: 2px 2px; font-size: 10.5px; white-space: normal;
  max-width: 72px; line-height: 1.25; vertical-align: middle;
}
table.monthly th.subh {
  padding: 1px 2px; font-size: 9.5px; white-space: normal; max-width: 60px;
  background: #f7f7f7; line-height: 1.2;
}
table.monthly td { padding: 1px 3px; }
table.output td { height: 22px; }

/* カレンダー */
table.cal {
  border-collapse: collapse; background: #fff; width: 100%;
  border: 1px solid #ccc; table-layout: fixed;
}
table.cal th { border: 1px solid #ccc; background: #f0f0f0; padding: 4px; }
table.cal th.cal-sun { color: #b3261e; }
table.cal th.cal-sat { color: #1a56a0; }
table.cal td {
  border: 1px solid #ddd; vertical-align: top; padding: 4px 6px;
  height: 108px; font-size: 12px;
}
table.cal td.sun { background: #faeff0; }
table.cal td.sat { background: #eef3f9; }
table.cal td.cal-empty { background: #f4f4f4; }
.cal-day { font-weight: 700; margin-bottom: 3px; }
.cal-item {
  margin: 3px 0; line-height: 1.35;
  display: flex; align-items: baseline; justify-content: center; gap: 4px;
}
.cal-item .cal-slot { color: #666; font-size: 10.5px; }
.cal-item .cal-period { color: #666; font-size: 11px; flex: none; }
.cal-item .cal-person { font-size: 16px; font-weight: 600; }
.cal-item.c-duty { border-left: 3px solid #1a56a0; }
.cal-item.c-oc { border-left: 3px solid #2e7d55; }

/* 宿日直者一覧表（原本再現・帳票なので独自スタイル） */
.paper {
  background: #fff; max-width: 860px; margin: 0 auto; padding: 30px 38px 18px;
  border: 1px solid #ccc;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
  color: #000;
}
.paper-title {
  text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 6px;
  margin-bottom: 12px;
}
table.ichiran { border-collapse: collapse; margin: 0 auto; width: 100%; border: 2px solid #000; }
table.ichiran th, table.ichiran td { border: 1px solid #000; }
.datehead {
  font-size: 19px; font-weight: 700; padding: 5px 10px; letter-spacing: 2px;
  border-bottom: 1px dashed #000 !important;
}
.shukuhead { font-size: 13px; font-weight: 600; padding: 2px; letter-spacing: 8px; }
td.rowlabel {
  padding: 7px 16px; width: 195px; white-space: nowrap;
  font-size: 16px; font-weight: 600;
}
/* 職種名は端から端まで均等割付け */
.labwrap { display: flex; align-items: baseline; gap: 10px; }
.labwrap .jobname {
  flex: 1; text-align: justify; text-align-last: justify;
}
.labwrap .extnum { font-size: 17px; font-weight: 700; }
tr.trainee-row td.rowlabel { font-size: 13.5px; font-weight: 400; }
tr.trainee-row .labwrap .jobname { text-align-last: justify; }
td.person {
  font-size: 21px; padding: 7px 10px; min-width: 175px; letter-spacing: 2px;
  text-align: center; font-weight: 600;
}
td.person.senior { background: #d9d9d9; }
/* PHS番号は右揃えの固定列にして縦に揃える */
td.person .pline {
  display: grid; grid-template-columns: 42% 58%; column-gap: 14px;
  align-items: baseline;
}
td.person .pnum { text-align: right; font-size: 21px; letter-spacing: 1px; }
td.person .pname { text-align: left; }
/* PHS未登録の医師は氏名をセル中央に大きく */
td.person .pcenter { text-align: center; }
tr.trainee-row td.person { font-size: 17px; padding: 4px 10px; }
tr.trainee-row td.person .pnum { font-size: 17px; }
/* 診療科は氏名の下の行に小さく中央表示 */
td.person .spec {
  display: block; font-size: 11px; margin-top: 0; font-weight: 400;
  letter-spacing: 0; text-align: center; color: #333; line-height: 1.2;
}
td.person .late { font-size: 12px; text-align: center; font-weight: 400; }
/* 医師行と研修医行の間は罫線なし（ひと組に見せる） */
table.ichiran tr.pair-top td { border-bottom: none; }
table.ichiran tr.trainee-row td { border-top: none; }
.ichiran-notes { margin-top: 12px; font-size: 10.5px; line-height: 1.8; letter-spacing: .3px; }

/* 土日祝を含む2日分（3〜4枠）は詰めて1枚に収める */
table.ichiran.compact td.rowlabel { width: 148px; font-size: 14px; padding: 6px 8px; }
table.ichiran.compact .labwrap .extnum { font-size: 15px; }
table.ichiran.compact td.person {
  min-width: 0; font-size: 17px; letter-spacing: 0; padding: 5px 4px;
}
table.ichiran.compact td.person .pnum { font-size: 17px; }
table.ichiran.compact td.person .pline { grid-template-columns: 44% 56%; column-gap: 6px; }
table.ichiran.compact tr.trainee-row td.person { font-size: 14px; padding: 3px 4px; }
table.ichiran.compact tr.trainee-row td.person .pnum { font-size: 14px; }
table.ichiran.compact .datehead { font-size: 16px; letter-spacing: 1px; padding: 4px 6px; }
table.ichiran.compact .shukuhead { letter-spacing: 4px; }
table.ichiran.compact td.person .spec { font-size: 9.5px; }
.stamp { text-align: right; font-size: 11px; color: #444; margin-top: 8px; }

@media print {
  .no-print, .topnav { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .table-scroll, .paper { border: none; overflow: visible; display: block; }
  .sticky-head thead, .sticky-head tbody td.datecol { position: static; }
  /* 宿日直者一覧表も余白を詰めてA4横1枚に（フォントは fitTableForPrint が最大化） */
  .paper { max-width: none; margin: 0; padding: 0; }
  .paper-title { font-size: 18px; letter-spacing: 4px; margin-bottom: 4px; }
  .ichiran-notes { font-size: 9px; line-height: 1.25; }
  .stamp { font-size: 9px; }
  table.grid { font-size: 9.5px; }
  h1 { font-size: 13px; margin: 0 0 4px; }
  .ym { font-size: 12px; }

  /* 月間表・オンコール表はA4横1枚に収める（@pageは各ページのheadで landscape 指定）。
     基本は1行表示。長い列だけ fitTableForPrint() が #printfont で折り返し指定を注入する。
     フォントも同関数が「幅・高さとも用紙に収まる最大」を実測して設定。 */
  table.grid.monthly, table.grid.output {
    width: 100%; table-layout: auto;
  }
  table.grid.monthly th, table.grid.monthly td,
  table.grid.output th, table.grid.output td {
    padding: 1px 3px; line-height: 1.2; vertical-align: middle; white-space: nowrap;
  }
  table.grid.monthly th.gh, table.grid.monthly th.subh { white-space: normal; }
  /* 月間表: 見出しの文字を本文と一緒に縮める（固定pxのままだと見出しが列幅を決めてしまう）。
     セルの左右余白も詰めて、その分フォントを大きくする */
  table.grid.monthly th.gh { font-size: 1em; max-width: 7em; }
  table.grid.monthly th.subh { font-size: 0.9em; max-width: 6em; }
  table.grid.monthly th, table.grid.monthly td { padding: 1px 2px; }
  table.output td { height: auto; }
  /* オンコール表: 見出しは折り返し可、区分ラベル（日直帯/当直帯・AM/PM）は本文に合わせて縮める。
     1セルに複数人入る列は上下2段に積み、列幅を抑えて文字を大きくできるようにする */
  table.grid.output th { white-space: normal; }
  .plabel-h { font-size: 0.8em; }
  table.grid.output .pv { display: block; }
  table.grid.output .pvsep { display: none; }
  /* カレンダー: A4横1枚。行の高さは週数（--cal-rows）で割り付ける */
  table.cal { font-size: 11px; }
  table.cal th { padding: 2px; }
  table.cal td {
    /* 高さの9割に収める（ブラウザ・プリンターの余白差で2枚目に回らないよう） */
    height: calc((200mm - 24mm) * 0.9 / var(--cal-rows, 6)); padding: 2px 4px;
  }
  table.cal td.sun, table.cal td.sat {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  /* 印刷時は行の途中でのページ分割を防ぐ */
  table.grid tr { page-break-inside: avoid; }
  .hint { font-size: 8px; }
}

/* 印刷フォント自動計算のための画面外・測定用クローン（@media printの体裁を再現）。
   基本nowrap。折り返し上限は測定側が js で個別に付与する。 */
table.print-measure { width: auto; table-layout: auto; border-collapse: collapse; }
table.print-measure th, table.print-measure td {
  padding: 1px 3px; line-height: 1.2; vertical-align: middle;
  white-space: nowrap; border: 1px solid #000;
}
table.print-measure th.gh, table.print-measure th.subh { white-space: normal; }
/* 縮尺で合わせる帳票（宿日直者一覧表）の測定用複製: @media print と同じ体裁を再現 */
.print-measure-block.paper { max-width: none; margin: 0; padding: 0; border: none; }
.print-measure-block .paper-title { font-size: 18px; letter-spacing: 4px; margin-bottom: 4px; }
.print-measure-block .ichiran-notes { font-size: 9px; line-height: 1.25; }
.print-measure-block .stamp { font-size: 9px; }

/* 画面用の行の高さ（22px固定）を測定に持ち込まない。オンコール表の印刷時の体裁も再現 */
table.print-measure td { height: auto; }
table.print-measure.monthly th.gh { font-size: 1em; max-width: 7em; }
table.print-measure.monthly th.subh { font-size: 0.9em; max-width: 6em; }
table.print-measure.monthly th, table.print-measure.monthly td { padding: 1px 2px; }
table.print-measure.output th { white-space: normal; }
table.print-measure .plabel-h { font-size: 0.8em; }
table.print-measure .pv { display: block; }
table.print-measure .pvsep { display: none; }

/* 月次確定（ロック）と承認待ち */
.lock-banner {
  background: #fdf0f0; border: 1px solid #d9a0a0; color: #7a1f1f;
  padding: 8px 12px; border-radius: 4px; margin-bottom: 10px;
}
.lock-tag {
  display: inline-block; font-size: 12px; font-weight: 700; color: #b3261e;
  border: 1px solid #b3261e; border-radius: 3px; padding: 0 8px;
  margin-left: 8px; vertical-align: 2px;
}
.lock-panel {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid #ccc; border-radius: 4px;
  padding: 8px 12px; margin-bottom: 10px;
}
.lock-panel .spacer { flex: 1; }
.pending-box {
  background: #fff8e6; border: 1px solid #d9a94f; border-radius: 4px;
  padding: 10px 12px; margin-bottom: 10px;
}
.pending-box .pending-head { margin-bottom: 6px; color: #6b4e0a; }
.pending-box .pending-head strong { color: #b45309; font-size: 15px; }
.status-na { color: #888; }

/* ============================================================ スマホ対応
   部署責任者がスマホから入力する場面を想定（入力画面中心の最適化）。
   出力帳票（月間表・一覧表・オンコール表）は横長のためPC/印刷前提のまま。 */
@media (max-width: 700px) {
  main { padding: 10px 8px 80px; }
  .topnav {
    height: auto; min-height: 42px; flex-wrap: wrap; padding: 2px 8px;
  }
  .topnav .brand { margin-right: 8px; }
  .topnav .whoami { display: none; }
  .toolbar .right { margin-left: 0; width: 100%; }

  /* フォーム部品はタップしやすく（16px未満だとiOSがフォーカス時に拡大する） */
  input, select, button, .btn-sm { font-size: 16px; }
  input[type="month"], input[type="date"] { padding: 6px 8px; }
  table.grid { font-size: 13px; }
  table.grid select { min-width: 112px; min-height: 38px; padding: 4px 6px; }
  table.grid td { padding: 3px 4px; }

  /* 横スクロール時も日付列を左に固定して迷子を防ぐ */
  table.grid th { z-index: 2; }
  table.grid:not(.monthly) th.datecol,
  table.grid:not(.monthly) td.datecol {
    position: sticky; left: 0; z-index: 3; background: #fafafa;
  }
  table.grid:not(.monthly) th.datecol { z-index: 4; }
  tr.sat td.datecol { background: #e7eef8; }
  tr.sun td.datecol { background: #f7e9ea; }

  .save-bar { padding: 10px; flex-wrap: wrap; gap: 8px; }
  .save-bar .btn-primary { padding: 10px 28px; font-size: 16px; }
  .save-bar .hint { display: none; }   /* スマホでは省スペース化 */
  .bulk-box .slot-name { min-width: 0; width: 100%; }
  .login-wrap { padding-top: 16px; }
  .login-box { min-width: 0; width: 100%; }
}

/* 名簿の区切り行（非常勤（外勤）医師など） */
table.list tr.group-head td {
  background: #f1f1f1; color: #555; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-top: 2px solid #ddd;
}

/* 退職者（名簿に残し、プルダウンからは退職日の翌日以降に外す） */
tr.retired-row td { color: #999; background: #f6f6f6; }
tr.retired-row td input, tr.retired-row td select { color: #999; background: #f0f0f0; }
tr.retired-row td .btn-sm, tr.retired-row td button { opacity: .65; }
.retired-tag { font-size: 11px; color: #a33; white-space: nowrap; }

/* タブの入力状況バッジ・未入力の案内 */
.tab-badge {
  font-size: 10.5px; margin-left: 6px; padding: 1px 6px; border-radius: 9px;
  border: 1px solid transparent; font-weight: 500; vertical-align: 1px;
}
.tab-badge.todo { background: #fdecec; color: #a33; border-color: #e3b3b3; }
.tab-badge.partial { background: #fff5e0; color: #8a6100; border-color: #e6cf9a; }
.tab-badge.done { background: #eef6ee; color: #1f5220; border-color: #a8c9a8; }
.todo-notice { border-left: 4px solid #d08a8a; }

/* テスト環境の帯（toban-hyo-test.pages.dev のときだけ表示） */
.test-env-banner {
  background: #b3261e; color: #fff; text-align: center; font-weight: 700;
  font-size: 13px; padding: 6px 12px; letter-spacing: .5px;
}

/* 表の貼り付け取り込み */
.paste-box {
  border: 1px solid #ccc; border-radius: 6px; background: #fbfbfb;
  padding: 10px 12px; margin-bottom: 10px;
}
.paste-box textarea {
  width: 100%; font-family: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid #bbb; border-radius: 4px; box-sizing: border-box;
}
.paste-box .toolbar { margin-top: 6px; }
.paste-preview { margin-top: 8px; max-height: 320px; overflow: auto; }
.paste-preview td.ng, .paste-preview th.ng { color: #a33; }
.paste-warn { color: #a33; font-size: 12px; margin-top: 6px; }

/* パスワード再発行の結果表示 */
.pw-result {
  border: 2px solid #1a56a0; background: #eef4fb; border-radius: 6px;
  padding: 12px 16px; margin: 12px 0; max-width: 560px;
}
.pw-value {
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 28px; letter-spacing: 3px; margin: 8px 0; user-select: all;
}

/* 担当者の絞り込み入力（入力画面） */
.picker {
  position: absolute; z-index: 50; width: 200px; background: #fff; border: 1px solid #888;
  border-radius: 4px; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 4px;
}
.picker input { width: 100%; box-sizing: border-box; font-size: 14px; padding: 4px 6px; }
.picker ul { list-style: none; margin: 4px 0 0; padding: 0; position: relative; max-height: 260px; overflow-y: auto; }
.picker li { padding: 4px 8px; cursor: pointer; border-radius: 3px; font-size: 14px; }
.picker li:hover { background: #eef3fb; }
.picker li.active { background: #1f5fbf; color: #fff; }
.picker li.clear { color: #777; }
.picker li.clear.active { color: #fff; }
.picker li.none { color: #999; cursor: default; }

/* 進捗画面: 担当者のPHS（名簿から自動表示） */
.phs-auto { font-weight: 600; letter-spacing: .5px; }
