body {
  font-family: "Segoe UI", "Hiragino Sans", sans-serif;
  margin: 0;
  background: #f5f7fa;
  font-size: 120%;
  color: #333;
}

.page-header {
  text-align: center;
  background: linear-gradient(120deg, #0078d4, #00a3e0);
  color: #fff;
  padding: 1.5rem 1rem;
}

.page-header h1 { margin: 0; font-size: 1.8em; }
.page-header .subtext { font-size: 0.9em; opacity: 0.9; }

.current-filters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  background: #fff;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}
#filterSummary {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  align-items: center;
}
.badge {
  display: inline-block;
  padding: 0.4em 0.8em;
  border-radius: 999px;
  font-size: 0.9em;
  font-weight: 600;
  color: #fff;
  user-select: none;
}

.badge-course {
  background: #0077cc;
}

.badge-test {
  background: #2ba84a;
}

.badge-none {
  background: #ccc;
  color: #333;
}

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.badge-hidden {
  display: none !important;
}

#openSettings {
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 1em;
}
#openSettings:hover { background: #005fa3; }

.month-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border-bottom: 1px solid #ccc;
  padding: 10px;
}
.month-nav button {
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 1em;
}
.month-nav button:disabled { opacity: 0.5; cursor: default; }

.month-label {
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 1em;
  min-width: 60px;
  text-align: center;
}
.month-label:hover { background: #e5f1fb; }
.month-label.active {
  background: #0078d4 !important;
  color: #fff;
  font-weight: bold;
}

/* 月ステータス色 */
.month-label.status-good { background-color: #c5e1a5; }
.month-label.status-mid { background-color: #fff59d; }
.month-label.status-bad { background-color: #ef9a9a; }

.calendar-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow-x: auto;
}
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f0f2f5;
  border-bottom: 2px solid #ccc;
  text-align: center;
  font-weight: bold;
}
.calendar-day { padding: 8px 0; }
.calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.calendar-cell {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  padding: 6px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}
.calendar-cell-header {
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
}
/* 空セル（日曜調整のため） */
.calendar-cell.empty-day {
  background: #f0f0f0;
  color: #999;
}

/* スロット共通デザインを固定サイズ化（empty含む） */
.slot,
.empty-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  margin: 4px 0;
  padding: 6px;
  font-weight: bold;
  min-height: 52px; /* 高さ統一 */
  width: 100%;      /* 幅統一 */
  box-sizing: border-box;
}

.empty-slot {
  background-color: #f0f0f0;
  color: #888;
  border: 1px solid #ddd;
}

/* 空セル */
.calendar-cell.empty-day {
  background: #f0f0f0;
  color: #999;
}

.slot:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.slot-label { font-size: 0.85em; opacity: 0.8; }
.slot-value { font-size: 1.2em; }
.available-high { background-color: #b2d8b2; }
.available-low { background-color: #ffe49c; }
.unavailable { background-color: #f5a9a9; }
.empty-day {
  background: #f0f0f0;
  color: #999;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-slot {
  background-color: #f0f0f0;
  color: #888;
  border: 1px solid #ddd;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}
.modal.hidden { display: none; }
.modal-content {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  min-width: 500px;
  max-width: 1200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  position: relative;
}
.close-button,
.close-settings {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 28px;
  color: #aaa;
  cursor: pointer;
}
.close-button:hover, .close-settings:hover { color: #000; }

/* --- モーダル検査項目設定 --- */
#modalTestFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  padding: 8px 0;
}

#courseOptions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: none;
  margin: 0;
  padding: 8px 0;
}

#courseOptions legend {
  font-weight: bold;
  margin-bottom: 6px;
}

/* --- ベースボタン --- */
#courseOptions label {
  display: inline-block;
  position: relative;
  cursor: pointer;
  border: none;
}

#courseOptions label span {
  display: inline-block;
  padding: 10px 18px;
  border: 2px solid #0077cc;
  border-radius: 8px;
  font-size: 16px;
  color: #0077cc;
  background-color: #fff;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  min-width: 90px;
  text-align: center;
  line-height: 1.3;
  user-select: none;
}

/* --- モーダルコース選択設定 --- */
#courseOptions input[type="radio"] {
  display: none;
}

/* --- 選択中 --- */
#courseOptions input[type="radio"]:checked + span {
  background-color: #0077cc;
  color: #fff;
  border-color: #0077cc;
  box-shadow: 0 3px 6px rgba(46,139,87,0.3);
  transform: translateY(1px);
}

/* --- タップ中（押した感） --- */
#courseOptions label:active span {
  transform: scale(0.97);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* --- 無効状態（disabled） --- */
#courseOptions input[type="radio"]:disabled + span {
  background-color: #f5f5f5;
  border-color: #ccc;
  color: #999;
  cursor: not-allowed;
  box-shadow: none;
}

#courseOptions .subtext { font-size: 0.8em; opacity: 0.9; }


/* すでにあればスキップでOK */
#calendarContainer,
.calendar-container {
  position: relative;
}

/* オーバーレイ本体 */
.calendar-overlay {
  position: absolute;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  background-color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: flex-start;   /* 上寄せ */
  justify-content: center;   /* 水平方向は中央 */
  padding-top: 16px;         /* 上に少し余白をつける */

  z-index: 10;
  pointer-events: auto;      /* 下のカレンダーへのクリックをブロック */
}

/* メッセージボックス */
.calendar-overlay-message {
  padding: 1rem 1.5rem;
  background: #fff;
  border: 2px solid #f00;
  border-radius: 4px;
  color: #333;
  font-size: 1.5rem;
  max-width: 95%;
  text-align: center;
}
/* 既に .hidden をモーダル等で使っているなら流用OK */
.calendar-overlay.hidden {
  display: none;
}


/* --- ベースボタン --- */
#modalTestFilters label {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border: none;
}

/* span をボタンとして整形 */
#modalTestFilters label span {
  display: inline-block;
  padding: 10px 18px;
  border: 2px solid #2e8b57;     /* 落ち着いた緑 */
  border-radius: 8px;
  font-size: 16px;
  color: #2e8b57;
  background-color: #fff;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  min-width: 95px;
  text-align: center;
  line-height: 1.3;
  user-select: none;
}

/* チェックボックスは非表示 */
#modalTestFilters input[type="checkbox"] {
  display: none;
}

/* --- チェック時（選択状態） --- */
#modalTestFilters input[type="checkbox"]:checked + span {
  background-color: #2e8b57;
  color: #fff;
  border-color: #2e8b57;
  box-shadow: 0 3px 6px rgba(46, 139, 87, 0.3);
  transform: translateY(1px);
}

/* --- タップ中（押した感） --- */
#modalTestFilters label:active span {
  transform: scale(0.97);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* --- 無効状態（disabled） --- */
#modalTestFilters input[type="checkbox"]:disabled + span {
  background-color: #f5f5f5;
  border-color: #ccc;
  color: #999;
  cursor: not-allowed;
  box-shadow: none;
}


/* 月ステータス色分け */
.status-good { background-color: #c5e1a5; }
.status-mid  { background-color: #fff59d; }
.status-bad  { background-color: #ef9a9a; }

#applySettings {
  background: #0078d4;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  font-size: 1.1rem
}
#applySettings:hover { background: #005fa3; }

#timeStamp {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 0.75em;
  color: #666;
  opacity: 0.9;
  pointer-events: none; /*クリック無効*/
}

/* モバイル調整 */
@media (max-width: 768px) {
  .calendar-body { grid-template-columns: repeat(3, 1fr); }
  .calendar-header { display: none; }
  .month-label { font-size: 1em; padding: 10px 14px; }
}
@media (max-width: 480px) {
  .calendar-body { grid-template-columns: repeat(2, 1fr); }
  .month-label { font-size: 0.95em; padding: 10px 12px; }
}

