/* 業務システム標準スタイル: 白・グレー基調 + アクセント1色(#1a56a0) */
* { box-sizing: border-box; }
body {
  margin: 0; background: #f4f4f4; color: #222;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", 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 .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 { background: #e8e8e8; height: 10px; width: 140px; }
.bar .fill { height: 100%; }
.fill.ok { background: #2e7d32; }
.fill.wip { background: #b58a00; }
.fill.ng { background: #b3261e; }
.status-ok { color: #2e7d32; }
.status-wip { color: #9a6700; }
.status-ng { color: #b3261e; font-weight: 700; }
tr.st-ng td { background: #fdf3f3; }
.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 { width: 100%; padding: 6px 8px; border: 1px solid #bbb; border-radius: 4px; }
.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;
}
.hint { color: #666; font-size: 12px; margin-top: 8px; }

/* 一括入力 */
.bulk-box { background: #fff; border: 1px solid #ccc; padding: 8px 12px; margin-bottom: 8px; }
.bulk-box form { 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; text-align: center; }
.cal-item .cal-slot { color: #666; font-size: 10.5px; }
.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: "Noto Serif JP", "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; }
  .table-scroll, .paper { border: none; overflow: visible; }
  table.grid { font-size: 9.5px; }
}
