/* ===== リセット・基本 ===== */
* { box-sizing: border-box; }

body {
  font-family: 'Meiryo', 'MS Gothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-size: 13px;
  background: #f5f5f5;
  margin: 0;
}

/* ===== ヘッダー ===== */
#header {
  background: #1e3a5f;
  color: white;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#header h1 {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}

/* ===== ナビゲーション ===== */
#nav {
  background: #2d4a6b;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  position: sticky;
  top: 42px;
  z-index: 99;
}

.nav-btn {
  color: #ccc;
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.nav-btn:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-btn.active { color: white; border-bottom-color: #60a5fa; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 2px;
}

/* ===== ナビグループ（関連タブをまとめて色分け） ===== */
.nav-divider {
  width: 1px;
  align-self: stretch;
  margin: 8px 4px;
  background: rgba(255,255,255,0.15);
}

.nav-group {
  display: flex;
  gap: 2px;
  border-radius: 6px;
  padding: 2px;
  margin: 4px 0;
}

.nav-group .nav-btn.active { color: white; }

.nav-group-shift { background: rgba(129,140,248,0.16); }
.nav-group-shift .nav-btn i { color: #a5b4fc; }
.nav-group-shift .nav-btn.active { border-bottom-color: #818cf8; }

.nav-group-preheat { background: rgba(251,146,60,0.16); }
.nav-group-preheat .nav-btn i { color: #fdba74; }
.nav-group-preheat .nav-btn.active { border-bottom-color: #fb923c; }

.nav-group-paidleave-request { background: rgba(250,204,21,0.16); }
.nav-group-paidleave-request .nav-btn i { color: #fde047; }
.nav-group-paidleave-request .nav-btn.active { border-bottom-color: #facc15; }

.nav-group-travel { background: rgba(45,212,191,0.16); }
.nav-group-travel .nav-btn i { color: #5eead4; }
.nav-group-travel .nav-btn.active { border-bottom-color: #2dd4bf; }

.nav-group-cleaning { background: rgba(74,222,128,0.16); }
.nav-group-cleaning .nav-btn i { color: #86efac; }
.nav-group-cleaning .nav-btn.active { border-bottom-color: #4ade80; }

/* ===== 清掃場所マップ ===== */
/* wrapを display:block + width:100% にして、画像を常に横幅いっぱいまで拡大表示する
   （inline-blockのままだと画像の実サイズ以上に広がらず、見た目が小さいままになるため） */
.cleaning-map-wrap {
  position: relative;
  display: block;
  width: 88%;
  line-height: 0;
}
.cleaning-map-wrap img { width: 100%; height: auto; display: block; border: 1px solid #d1d5db; border-radius: 4px; user-select: none; }
.cleaning-map-wrap.drawable { cursor: crosshair; }

/* マップ右上に「現在の年月」を大きく常時表示（今日の日付から自動算出、人が操作しなくても常に最新） */
.cleaning-map-current-period {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(17,24,39,0.78);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 8px;
  line-height: 1.2;
  pointer-events: none;
}

/* 清掃場所タブのメンバー名バッジ（小さめ表示でOKとのユーザー指示） */
.cleaning-member-badge { font-size: 10px; padding: 1px 6px; }

.cleaning-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #9ca3af;
  background: rgba(156,163,175,0.15);
  pointer-events: none;
}
.cleaning-box.active-now {
  border-width: 3px;
  animation: cleaning-blink 1s infinite;
  z-index: 5;
}
@keyframes cleaning-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.cleaning-box-draft {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed #3b82f6;
  background: rgba(59,130,246,0.15);
  pointer-events: none;
}

/* マップ上の「現在地」マーカー（設置したPCの物理的な位置を示す固定表示）。
   赤い点は点滅させ、「現在地」ラベルは背景無し・黒文字のみで常時はっきり見えるよう別要素にする
   （点と同じ要素にopacityアニメーションを掛けるとラベルまで点滅して見えにくくなるため分離） */
.cleaning-current-location-marker {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 6;
  pointer-events: none;
}
.cleaning-current-location-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  margin-top: -15px;
  border-radius: 50%;
  background: #dc2626;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px #dc2626, 0 2px 6px rgba(0,0,0,0.5);
  animation: cleaning-current-location-blink 1s infinite;
}
@keyframes cleaning-current-location-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}
.cleaning-current-location-label {
  position: absolute;
  left: 0;
  top: 20px;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #000;
  font-size: 18px;
  font-weight: 900;
}

/* ===== メインコンテンツ ===== */
#main {
  padding: 12px;
  overflow: hidden;
}

/* ===== ログイン画面 ===== */
#login-screen {
  max-width: 420px;
  margin: 60px auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 40px;
}

#login-screen h2 {
  text-align: center;
  font-size: 22px;
  color: #1e3a5f;
  margin-bottom: 30px;
}

.employee-select-list {
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.employee-select-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.employee-select-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.employee-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== 出勤表 ===== */
.attendance-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.period-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.period-nav h2 {
  font-size: 16px;
  font-weight: bold;
  color: #1e3a5f;
  flex: 1;
}

.period-btn {
  padding: 6px 14px;
  background: #1e3a5f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.period-btn:hover { background: #2d4a6b; }

/* ===== テーブルラッパー ===== */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  position: relative;
}

/* ===== 出勤表テーブル ===== */
#attendance-table {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: max-content;
}

#attendance-table th,
#attendance-table td {
  border: 1px solid #d1d5db;
  padding: 2px 3px;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

/* 固定列 */
.col-sticky-name {
  position: sticky;
  left: 0;
  z-index: 20;
  background: white;
  min-width: 90px;
  max-width: 90px;
  text-align: left;
  padding-left: 6px;
}

.col-sticky-total {
  position: sticky;
  right: 0;
  z-index: 15;
  background: #f9fafb;
  min-width: 40px;
  font-weight: bold;
}

/* ヘッダー行固定 */
#attendance-table thead th {
  position: sticky;
  background: white;
  z-index: 10;
}

#attendance-table thead tr:first-child th {
  top: 0;
  z-index: 25;
}

#attendance-table thead tr:nth-child(2) th {
  top: 24px;
  z-index: 24;
}

#attendance-table thead tr:nth-child(3) th {
  top: 48px;
  z-index: 23;
}

.col-sticky-name.header-sticky {
  z-index: 30 !important;
}

/* ヘッダースタイル */
.th-date {
  min-width: 38px;
  max-width: 38px;
  font-size: 12px;
  font-weight: normal;
  height: 24px;
}

.th-weekday {
  height: 24px;
  font-size: 11px;
}

/* 日付列の色（ヘッダー用） */
.col-saturday { background: #EBF5FF; }
.col-sunday   { background: #FFF0F0; }
.col-holiday  { background: #FFE4E4; }
.col-today    { outline: 2px solid #FBBF24 !important; outline-offset: -2px; }

.weekday-sat { color: #1d4ed8 !important; }
.weekday-sun { color: #dc2626 !important; }
.weekday-hol { color: #dc2626 !important; }

/* データセル */
.attendance-cell {
  min-width: 38px;
  max-width: 38px;
  height: 28px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  position: relative;
  transition: opacity 0.1s;
  overflow: hidden;
  background: #ffffff; /* デフォルト白 */
}

/* 勤務区分なし＆土日祝のセル色 */
.attendance-cell.col-saturday { background: #EBF5FF; }
.attendance-cell.col-sunday   { background: #FFF0F0; }
.attendance-cell.col-holiday  { background: #FFE4E4; }

/* 勤務区分あり（style属性が付いている）場合はインラインstyleが優先 */
/* ※ CSSの詳細度: inline style > !important なし class → 上記はそのままでOK */

.attendance-cell:hover {
  opacity: 0.85;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.3);
}

/* 今日のセル */
.cell-today-col {
  outline: 2px solid #FBBF24;
  outline-offset: -1px;
}

/* 公休・祝日に通常勤務コード(出勤/早出/遅出等)を入れて振替休日(代休)を設定したセル
   （休出①〜⑥は色自体で区別できるため対象外。outlineは今日セルと併用するためbox-shadowを使う） */
.cell-makeup-warn {
  position: relative;
  box-shadow: inset 0 0 0 2px #dc2626;
}
.cell-makeup-warn::after {
  content: '振';
  position: absolute;
  top: 0;
  right: 0;
  font-size: 7px;
  line-height: 1;
  color: #fff;
  background: #dc2626;
  padding: 1px 2px;
  border-radius: 0 0 0 3px;
  z-index: 1;
}

/* 承認済みの予熱作業があった日のセル。勤務区分の色・表示はそのまま、右下に小さな炎マークだけ付ける
   （振替休日マーク=cell-makeup-warnは右上を使うため、こちらは右下にして共存しても重ならないようにする） */
.cell-preheat-used {
  position: relative;
}
.cell-preheat-used::before {
  content: '🔥';
  position: absolute;
  bottom: -1px;
  right: -1px;
  font-size: 9px;
  line-height: 1;
  z-index: 1;
}

/* 出勤表を直接編集して「保留中（未承認）」になっているセル。
   シフト申請で承認されるまで実際のコード・色は付けず、薄いグレーで区別する。 */
.cell-pending-request {
  background: repeating-linear-gradient(45deg, #e5e7eb, #e5e7eb 6px, #f3f4f6 6px, #f3f4f6 12px) !important;
  color: #6b7280 !important;
  font-size: 10px;
  font-style: italic;
}

/* 振替日未定（makeup_pending）の休日出勤・公休出勤。承認待ち(グレー)とは別状態として
   区別できるよう、アンバー系の縞模様で表示する。 */
.cell-makeup-pending-request {
  background: repeating-linear-gradient(45deg, #fde68a, #fde68a 6px, #fef3c7 6px, #fef3c7 12px) !important;
  color: #92400e !important;
  font-size: 10px;
  font-style: italic;
}

/* 従業員名行 */
.employee-row td.col-sticky-name {
  font-weight: 500;
  font-size: 12px;
}

/* 集計行 */
.summary-row td {
  background: #f9fafb;
  font-size: 11px;
  color: #374151;
}

/* ===== ドロップダウン ===== */
#cell-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 160px;
  padding: 6px 0;
  overflow-y: auto;
  max-height: 320px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover { background: #f3f4f6; }

/* 代休①〜⑥など、休出とセットで自動付与されるため直接選択できない項目 */
.dropdown-item-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.dropdown-item-disabled:hover { background: none; }

.dropdown-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.dropdown-clear {
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 12px;
}

/* ===== ツールチップ ===== */
#tooltip {
  position: fixed;
  background: rgba(17, 24, 39, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 2000;
  white-space: pre-line;
  max-width: 200px;
  line-height: 1.5;
}

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 { font-size: 16px; font-weight: bold; color: #1e3a5f; margin: 0; }
.modal-close { cursor: pointer; color: #6b7280; font-size: 18px; padding: 4px; }
.modal-close:hover { color: #111; }

.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; justify-content: flex-end; }

/* ===== フォーム ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; color: #374151; margin-bottom: 4px; font-weight: 500; }
.form-input, .form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.form-input:focus, .form-select:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }

/* ===== ボタン ===== */
.btn { padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; }
.btn-primary { background: #1e3a5f; color: white; }
.btn-primary:hover { background: #2d4a6b; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #6b7280; color: white; }
.btn-secondary:hover { background: #4b5563; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

/* ===== テーブル（管理画面用）===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: #f3f4f6;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:hover td { background: #fafafa; }

/* 月別勤怠変更まとめ：横幅を使って2列表示＋詰めた行間にするための専用スタイル */
.comp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .comp-two-col { grid-template-columns: 1fr; }
}
.comp-table-compact th {
  padding: 4px 6px;
  font-size: 11px;
  white-space: nowrap;
}
.comp-table-compact td {
  padding: 3px 6px;
  font-size: 12px;
  white-space: nowrap;
}
.comp-badge-compact {
  font-size: 10px;
  padding: 1px 6px;
  display: inline-block;
}

/* ===== カード ===== */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 14px; font-weight: bold; color: #1e3a5f; margin: 0; }
.card-body { padding: 16px; }

/* ===== バッジ ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* ===== 有給管理カード ===== */
.paid-leave-bar {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  overflow: hidden;
}

.paid-leave-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ===== 集計テーブル ===== */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.summary-table th {
  background: #1e3a5f;
  color: white;
  padding: 6px 4px;
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
  position: sticky;
  top: 0;
}

.summary-table td {
  padding: 5px 4px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.summary-table tr:hover td { background: #f9fafb; }

/* ===== カラーピッカー ===== */
.color-preview {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  cursor: pointer;
  display: inline-block;
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* ===== 時間入力ドロップダウン ===== */
#time-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1001;
  min-width: 140px;
  padding: 6px 0;
}

.time-option {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}

.time-option:hover { background: #f3f4f6; }

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  #header h1 { font-size: 14px; }
  .nav-btn { padding: 6px 8px; font-size: 12px; }
  #main { padding: 8px; }
  .th-date { min-width: 32px; max-width: 32px; }
  .attendance-cell { min-width: 32px; max-width: 32px; font-size: 10px; }
  .col-sticky-name { min-width: 70px; max-width: 70px; font-size: 11px; }
}

/* ===== ローディング ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #1e3a5f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== トースト通知 ===== */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  max-width: 300px;
}

.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #1e3a5f; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 集計ハイライト ===== */
.count-positive { color: #1d4ed8; font-weight: bold; }
.count-warn { color: #dc2626; font-weight: bold; }

/* ===== 変更履歴 ===== */
.history-wt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.08);
}

.history-wt-empty {
  background: #f3f4f6;
  color: #9ca3af;
  font-weight: normal;
  border-color: #e5e7eb;
}

.history-emp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(0,0,0,0.08);
}

/* 予熱作業履歴：月ごとのグループ見出し */
.phh-month-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1e3a5f;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  margin-top: 4px;
}

/* ===== 従業員並び替え（ドラッグ&ドロップ）===== */
.emp-sort-row {
  transition: background 0.1s;
}
.emp-sort-row:hover .drag-handle {
  color: #1e3a5f !important;
}
.emp-sort-row.drag-dragging {
  opacity: 0.4;
  background: #e0e7ff;
}
.emp-sort-row.drag-over {
  background: #dbeafe;
  border-top: 2px solid #3b82f6;
  box-shadow: 0 -2px 0 #3b82f6;
}
/* ===== 組織図（ドラッグ&ドロップで上司-部下関係を設定）===== */
.org-chart-row {
  cursor: grab;
  transition: background 0.1s;
}
.org-chart-row:hover {
  background: #f3f4f6;
}
.org-chart-row.drag-dragging {
  opacity: 0.4;
  background: #e0e7ff;
}
.org-chart-row.drag-over {
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #3b82f6;
}
.org-chart-remove-btn {
  color: #9ca3af;
  font-size: 11px;
  margin-left: 4px;
  cursor: pointer;
  padding: 2px 4px;
}
.org-chart-remove-btn:hover {
  color: #dc2626;
}
#org-chart-root-zone.org-chart-root-zone-over {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.drag-handle {
  touch-action: none;
  user-select: none;
}

/* ===== 2ヶ月表示用クラス ===== */

/* 月ラベル行（共通） */
.month-label-th {
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 6px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* 奇数月ラベル: 濃紺 */
.month-label-odd {
  background: #1e3a5f;
  border-right: 3px solid #fff;
}

/* 偶数月ラベル: 深緑 */
.month-label-even {
  background: #2d5a1e;
  border-right: 3px solid #fff;
}

/* 月ラベル行（2ヶ月目・境界左ボーダー） */
.month-label-th2 {
  border-left: 3px solid #fff;
}

/* 2ヶ月目の先頭セルに太めの左ボーダーを付けて月の区切りを示す */
.cell-month-border {
  border-left: 3px solid #1e3a5f !important;
}

/* 2つ目の合計列（1つ目の右隣に重ねて sticky） */
.col-sticky-total2 {
  position: sticky;
  right: 41px;   /* 1つ目の合計列(40px) + 1px 隙間 */
  z-index: 15;
  background: #e8f5e3;   /* 偶数月カラーに合わせた薄緑 */
  min-width: 40px;
  font-weight: bold;
  border-left: 2px solid #8fbc8f;
}

/* ===== 奇数月・偶数月の列背景色 ===== */
/* 平日セル（勤務区分なし）への淡い色敷き */
/* 奇数月: 淡いブルー系 */
.col-month-odd {
  background-color: #f0f6ff;
}
/* 偶数月: 淡いグリーン系 */
.col-month-even {
  background-color: #f0fff4;
}

/* 土曜は奇偶月に関わらず青系（既存 col-saturday より優先させない→そのまま） */
/* 日曜・祝日は赤系（既存 col-sunday/col-holiday）→既存クラスが !important なので奇偶月は適用されない */

/* 勤務区分あり（inline style）の場合は JS の style= が最優先なので奇偶月色は見えない */

/* 月境界の2つ目の名前セル（2ヶ月目先頭に挿入） */
.col-sticky-name-2nd {
  position: sticky;
  left: 0;
  z-index: 20;
  background: white;
  min-width: 90px;
  max-width: 90px;
  text-align: left;
  padding-left: 6px;
  font-weight: 500;
  font-size: 12px;
  border-left: 3px solid #1e3a5f !important;
}

/* thead 固定時の z-index 上書き（4行 thead に対応） */
#attendance-table thead tr:nth-child(4) th {
  top: 72px;
  z-index: 22;
}

/* 月ラベル行（先頭行）は top:0 を JS で inline 指定しているが、
   CSS でも念のため thead tr:first-child を優先させる */
#attendance-table thead tr:first-child th.month-label-th {
  top: 0;
  z-index: 24;
}

/* 2ヶ月目名前列ヘッダー固定 */
#attendance-table thead th.col-sticky-name-2nd {
  position: sticky;
  z-index: 25 !important;
  background: white;
}

/* ===== 出張申請書・年次有給休暇届ドキュメント（画面プレビュー兼A4印刷レイアウト） ===== */
.doc-wrap {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  color: #111;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 14.5px;
  line-height: 1.5;
}
.doc-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.doc-header .doc-spacer { width: 160px; }
.doc-title { flex: 1; text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 0.15em; padding-top: 4px; }
.doc-meta { width: 200px; border-collapse: collapse; font-size: 12.5px; }
.doc-meta th, .doc-meta td { border: 1px solid #333; padding: 4px 6px; font-weight: 400; }
.doc-meta th { background: #f3f4f6; width: 60px; text-align: left; white-space: nowrap; }
.doc-meta td { text-align: center; }
.doc-lead { font-size: 13.5px; margin: 6px 0 8px; }

.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; table-layout: fixed; }
.doc-table th, .doc-table td { border: 1px solid #333; padding: 6px 8px; font-size: 13px; vertical-align: middle; word-break: break-word; }
.doc-table th { background: #f3f4f6; font-weight: 700; text-align: left; white-space: nowrap; }
.doc-table td { text-align: left; }

.doc-table-main th.w-label { width: 15%; }
.doc-table-main th.w-sublabel { width: 12%; }

.doc-period th { width: 13%; }
.doc-period td { width: 25%; text-align: center; }

.doc-schedule th, .doc-schedule td { text-align: center; }
.doc-schedule thead th { width: 15%; }
.doc-schedule thead th:nth-child(2) { width: 35%; }
.doc-schedule thead th:nth-child(4) { width: 35%; }
.doc-schedule tbody td { height: 22px; text-align: left; }
.doc-schedule tbody td.cell-cost { text-align: right; }
.doc-schedule tfoot td { font-weight: 700; }
.doc-schedule tfoot td.text-right { text-align: right; background: #f3f4f6; }

.doc-detail th { width: 20%; vertical-align: top; }
.doc-detail th .sub { display: block; font-size: 10.5px; font-weight: 400; color: #555; margin-top: 2px; white-space: nowrap; }
/* 文章の途中で不自然に折り返される(word-break:break-word)のを防ぎ、自然な位置（文字間・単語の区切り）でのみ改行させる */
/* 記入が少ない場合も4行分の白紙欄として最初から確保しておく（手書き追記・見た目の余白確保のため）
   ※table-cellはmin-heightが効かないブラウザがあるため、heightを使う（内容が多い時はheightは最小値として働き自動で伸びる） */
.doc-detail td { height: 92px; vertical-align: top; white-space: pre-wrap; word-break: normal; overflow-wrap: break-word; }

.doc-office th { background: #f3f4f6; font-weight: 700; }
.doc-office .office-box { height: 70px; vertical-align: top; }

/* 年次有給休暇届：注意事項（固定の案内文） */
.doc-notice th { width: 20%; vertical-align: top; }
.doc-notice td { font-size: 11.5px; line-height: 1.7; color: #333; word-break: normal; overflow-wrap: break-word; }

/* 年次有給休暇届：有給休暇付与日数等の集計欄（入社日から自動計算した値を表示） */
.doc-leave-tally th { background: #f3f4f6; font-weight: 700; text-align: center; width: 25%; }
.doc-leave-tally .office-box { height: 44px; text-align: center; vertical-align: middle; font-size: 16px; font-weight: 700; }

/* 専務・課長・総務課の印鑑欄：以前は表いっぱい(33.33%×3)に広がっていたが、
   実際の判子サイズに対して間延びして見えるため、判子1.5個分程度の幅に抑えて右寄せにする */
.doc-approval { width: auto; margin-left: auto; margin-right: 0; }
.doc-approval th, .doc-approval td { width: 90px; }
.doc-approval th { text-align: center; background: #f3f4f6; }
.doc-approval .approval-box { height: 60px; text-align: center; vertical-align: middle; font-size: 12px; color: #333; }

/* ===== 年次有給休暇届：旧来使用していた紙の様式（(新)年次有給休暇届表.xlsx）のレイアウトに合わせた専用スタイル =====
   出張申請書等の他の書類は上のdoc-*クラスを使い続けるため、このフォーム専用にpldoc-*として独立させている */
.pldoc-title { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 0.2em; margin: 4px 0 24px; }

.pldoc-field { border-collapse: collapse; margin-bottom: 14px; table-layout: fixed; }
.pldoc-field th, .pldoc-field td { border: 1px solid #333; padding: 6px 10px; font-size: 13.5px; font-weight: 700; vertical-align: middle; }
.pldoc-field td { font-weight: 400; }

.pldoc-field-request { width: 42%; }
.pldoc-field-request th { width: 30%; }

.pldoc-field-full { width: 100%; }
.pldoc-field-full th { width: 13%; }
.pldoc-field-full td { width: 37%; }

.pldoc-period th { width: 13%; text-align: center; }
.pldoc-period td { font-weight: 400; }
.pldoc-period tr td:first-child { width: 52%; }
/* 自・至の間の横線は不要なため、行の内側の境界線だけ消す（外枠は.pldoc-fieldの罫線のまま残る） */
.pldoc-period-top { border-bottom: none; }
.pldoc-period-bottom { border-top: none; }
.pldoc-days { width: 35% !important; text-align: center; font-size: 15px; }

/* 休暇事由・備考は手書き追記を想定し、最初から4行分の白紙欄を確保しておく
   （table-cellはmin-heightが効かないブラウザがあるため、heightを使う） */
.pldoc-blank-field td { height: 104px; vertical-align: top; white-space: pre-wrap; word-break: normal; overflow-wrap: break-word; }

.pldoc-notice { margin: 18px 0; display: flex; gap: 14px; }
.pldoc-notice-label { font-weight: 700; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
.pldoc-notice-body { font-size: 11.5px; line-height: 1.85; color: #222; flex: 1; }
.pldoc-notice-body p { margin: 0; }
.pldoc-notice-body p.pldoc-notice-sub { padding-left: 1.2em; }
.pldoc-notice-body p.pldoc-notice-divider { border-bottom: 1px solid #333; padding-bottom: 4px; margin-bottom: 4px; }
.pldoc-notice-body p.pldoc-notice-gap { margin-bottom: 6px; }

.pldoc-approve-date { width: 42%; margin-left: auto; margin-right: 0; margin-top: 4px; }
.pldoc-approve-date th { width: 30%; text-align: center; background: #f3f4f6; }
.pldoc-approve-date td { text-align: center; font-size: 15px; padding: 10px 8px; }

.pldoc-bottom-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; gap: 20px; }
.pldoc-tally, .pldoc-approval { border-collapse: collapse; }
.pldoc-tally { width: 48%; }
.pldoc-approval { width: 35%; }
.pldoc-tally th, .pldoc-tally td, .pldoc-approval th, .pldoc-approval td {
  border: 1px solid #333; padding: 4px 6px; text-align: center; font-size: 10.5px; font-weight: 700;
}
.pldoc-tally td { height: 32px; font-size: 14px; font-weight: 700; }
.pldoc-approval td { height: 56px; }

.stamp-mark { display: inline-block; border: 1px solid #999; border-radius: 50%; width: 18px; height: 18px; line-height: 16px; text-align: center; font-size: 10px; margin-left: 4px; color: #888; }

@media print {
  .no-print, #header, #nav { display: none !important; }
  body { background: white !important; }
  #main { padding: 0 !important; }
  /* A4の余白を詰めて印刷可能領域(210mm-左右8mm)いっぱいまで使う */
  .doc-wrap { box-shadow: none !important; max-width: 194mm; font-size: 12.5px; }
  @page { size: A4; margin: 8mm; }
}
