/* ========================================
   杉本歯科 予約システム - 共通スタイル
======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1976D2;
  --primary-light: #42A5F5;
  --primary-dark: #1565C0;
  --primary-bg: #E3F2FD;
  --accent: #00897B;
  --danger: #E53935;
  --warning: #F9A825;
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-400: #BDBDBD;
  --gray-600: #757575;
  --gray-800: #424242;
  --text: #212121;
  --white: #FFFFFF;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  font-family: 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--gray-100);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   ヘッダー
======================================== */
.site-header {
  background: var(--primary);
  color: white;
  padding: 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  font-size: 24px;
}

.header-title h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.header-title p {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.header-nav {
  margin-left: auto;
}

.header-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.header-nav a:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

/* ========================================
   フッター
======================================== */
.site-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
  margin-top: 60px;
}

.site-footer p {
  margin: 4px 0;
}

/* ========================================
   メインコンテンツ
======================================== */
.main-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ========================================
   カード
======================================== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   ステップインジケーター
======================================== */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 60%;
  right: -40%;
  height: 2px;
  background: var(--gray-200);
}

.step-item.completed:not(:last-child)::after {
  background: var(--primary);
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}

.step-item.active .step-circle {
  background: var(--primary);
  color: white;
}

.step-item.completed .step-circle {
  background: var(--success);
  color: white;
}

.step-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 6px;
  text-align: center;
}

.step-item.active .step-label {
  color: var(--primary);
  font-weight: 600;
}

/* ========================================
   カレンダー
======================================== */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-month {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.btn-nav {
  background: none;
  border: 2px solid var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  color: var(--primary);
  font-size: 16px;
  transition: all 0.2s;
}

.btn-nav:hover {
  background: var(--primary-bg);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
}

.calendar-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 0;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  box-sizing: border-box;
}

.calendar-day-blank {
  border: 1px solid transparent;
  box-sizing: border-box;
}

.calendar-day-header.sun { color: var(--danger); }
.calendar-day-header.sat { color: var(--primary); }

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--gray-200);
  position: relative;
  box-sizing: border-box;
  text-align: center;
  gap: 2px;
  padding: 4px 2px;
}

.calendar-day:hover:not(.disabled):not(.past) {
  background: var(--primary-bg);
  border-color: var(--primary-light);
}

.calendar-day.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
}

.calendar-day.today {
  font-weight: 700;
  border: 2px solid var(--danger);
  color: var(--danger);
}

.calendar-day.today.selected {
  border: 2px solid var(--danger);
  color: white;
}

.calendar-day.disabled,
.calendar-day.past {
  color: var(--gray-400);
  cursor: not-allowed;
  background: none;
}

.calendar-day.sun:not(.disabled):not(.past) { color: var(--danger); }
.calendar-day.sat:not(.disabled):not(.past) { color: var(--primary); }

/* ========================================
   時間スロット
======================================== */
.slots-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 12px;
  padding-top: 8px;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.slot-btn {
  padding: 12px 8px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.slot-btn.available:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.slot-btn.available.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.slot-btn.unavailable {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
  border-color: var(--gray-200);
  text-decoration: line-through;
}

.slots-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 2px solid;
}

.legend-dot.available { border-color: var(--gray-400); background: white; }
.legend-dot.unavailable { border-color: var(--gray-200); background: var(--gray-100); }
.legend-dot.selected { border-color: var(--primary); background: var(--primary); }

/* ========================================
   フォーム
======================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-800);
}

.form-label .required {
  color: var(--danger);
  margin-left: 4px;
  font-size: 12px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.form-control.error {
  border-color: var(--danger);
}

.form-hint {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}

select.form-control {
  cursor: pointer;
}

/* ========================================
   ボタン
======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #c62828;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #1b5e20;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-bg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

/* ========================================
   確認・完了画面
======================================== */
.confirmation-box {
  background: var(--success-light);
  border: 2px solid #4CAF50;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.confirmation-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.confirmation-box h2 {
  color: var(--success);
  font-size: 22px;
  margin-bottom: 8px;
}

.reservation-number-display {
  background: white;
  border: 2px solid #4CAF50;
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  margin: 20px auto;
  max-width: 300px;
}

.reservation-number-display .label {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.reservation-number-display .number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.1em;
}

.apt-summary {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px auto;
  max-width: 400px;
  text-align: left;
}

.apt-summary table {
  width: 100%;
  border-collapse: collapse;
}

.apt-summary td {
  padding: 6px 8px;
  font-size: 14px;
}

.apt-summary td:first-child {
  color: var(--gray-600);
  width: 40%;
}

.apt-summary td:last-child {
  font-weight: 600;
}

/* ========================================
   アラート・通知
======================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-info {
  background: var(--primary-bg);
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
}

.alert-error {
  background: #FFEBEE;
  color: #B71C1C;
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: #FFF8E1;
  color: #E65100;
  border-left: 4px solid var(--warning);
}

.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-left: 4px solid #4CAF50;
}

/* ========================================
   バッジ
======================================== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: #FFEBEE; color: var(--danger); }
.badge-warning { background: #FFF8E1; color: #E65100; }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

/* ========================================
   スタッフ管理画面専用
======================================== */
.staff-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

.apt-list {
  list-style: none;
}

.apt-item {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}

.apt-item:hover {
  border-color: var(--primary-light);
}

.apt-time {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  min-width: 56px;
}

.apt-info {
  flex: 1;
}

.apt-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.apt-meta {
  font-size: 12px;
  color: var(--gray-600);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.apt-created-at {
  font-size: 11px;
  color: var(--gray-500);
  align-self: center;
}

.apt-actions {
  display: flex;
  gap: 8px;
}

/* 時間スロットグリッド（スタッフ用） */
.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.time-slot-cell {
  padding: 10px 8px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.time-slot-cell.free {
  border-color: var(--gray-200);
  background: var(--success-light);
  color: var(--success);
}

.time-slot-cell.booked {
  background: var(--primary-bg);
  border-color: var(--primary-light);
  color: var(--primary);
}

.time-slot-cell.blocked {
  background: #FFF8E1;
  border-color: var(--warning);
  color: #E65100;
}

.time-slot-cell.closed {
  background: var(--gray-100);
  border-color: var(--gray-200);
  color: var(--gray-400);
  cursor: default;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gray-200);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-600);
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--gray-100);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid var(--gray-200);
}

/* ログイン画面 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1565C0 0%, #1976D2 50%, #42A5F5 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 40px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-card .logo {
  font-size: 40px;
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 4px;
}

.login-card p {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 28px;
}

/* ブロックスロット一覧 */
.block-list {
  list-style: none;
}

.block-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.block-item:hover {
  background: var(--gray-100);
}

/* ローディング */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-600);
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--primary-bg);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   レスポンシブ
======================================== */
@media (max-width: 640px) {
  .main-container {
    padding: 20px 12px;
  }

  .card {
    padding: 20px 16px;
  }

  .staff-layout {
    grid-template-columns: 1fr;
  }

  .slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .time-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps {
    gap: 0;
  }

  .step-label {
    font-size: 10px;
  }
}

/* ========================================
   ユーティリティ
======================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-gap { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-600); }
.fw-bold { font-weight: 700; }
.divider {
  border: none;
  border-top: 2px solid var(--gray-200);
  margin: 20px 0;
}

/* ========================================
   診察内容選択カード
======================================== */
.treatment-section {
  margin-bottom: 12px;
}

.treatment-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 600;
}

.treatment-badge-dentist {
  display: inline-block;
  background: #E3F2FD;
  color: #1565C0;
  border: 2px solid #1976D2;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
}

.treatment-badge-hygienist {
  display: inline-block;
  background: #E8F5E9;
  color: #1B5E20;
  border: 2px solid #4CAF50;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
}

.treatment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.treatment-card {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.treatment-card:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25,118,210,0.15);
}

.treatment-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.treatment-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.treatment-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.treatment-duration {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
}

.treatment-note {
  font-size: 11px;
  color: var(--gray-600);
  line-height: 1.4;
}

/* 診察内容バナー（STEP2上部） */
.treatment-banner {
  background: var(--primary-bg);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 空きなし日（担当スタッフ不在） */
.calendar-day.no-staff {
  color: var(--gray-400);
  background: var(--gray-100);
  cursor: not-allowed;
}

/* ========================================
   歯科衛生士セレクター
======================================== */
.hygienist-selector {
  background: #FFF8E1;
  border: 2px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.hygienist-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hygienist-btn {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.hygienist-btn:hover {
  border-color: #4CAF50;
  background: #E8F5E9;
}

.hygienist-btn.selected {
  border-color: #4CAF50;
  background: #4CAF50;
  color: white;
}

/* ========================================
   スタッフ管理 タブ
======================================== */
.staff-tabs {
  display: flex;
  gap: 0;
  background: white;
  border-bottom: 2px solid var(--primary);
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.staff-tab {
  background: none;
  border: none;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: inherit;
}

.staff-tab:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

.staff-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  padding-top: 8px;
}

/* ========================================
   スタッフ管理グリッド
======================================== */
.staff-mgmt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.member-list {
  min-height: 60px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: background 0.15s;
}

.member-row:hover {
  background: var(--gray-100);
}

.member-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-name {
  font-weight: 600;
  font-size: 14px;
}

.member-name.inactive {
  color: var(--gray-400);
  text-decoration: line-through;
}

.member-actions {
  display: flex;
  gap: 6px;
}

/* ========================================
   出勤スケジュールカレンダー
======================================== */
.schedule-month-block {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.schedule-month-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}

/* スケジュール日セル */
.calendar-day.schedule-cell {
  aspect-ratio: 1;
  min-height: 32px;
  font-size: 12px;
  flex-direction: column;
  gap: 1px;
  padding: 2px;
  font-weight: 600;
}

/* ========================================
   担当別空き一覧タブ
======================================== */
.avail-header {
  margin-bottom: 20px;
}
.avail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.avail-subtitle {
  font-size: 13px;
  color: var(--gray-500);
}

.avail-staff-picker {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.avail-role-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.avail-staff-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avail-staff-btn {
  padding: 8px 20px;
  border: 2px solid var(--gray-300);
  border-radius: 20px;
  background: white;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.avail-staff-btn:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}
.avail-staff-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.avail-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.avail-period-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.avail-result-header {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray-200);
}

.avail-empty {
  text-align: center;
  color: var(--gray-400);
  padding: 40px;
  font-size: 14px;
}

.avail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.avail-row:last-child {
  border-bottom: none;
}

.avail-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding-top: 2px;
}
.avail-date-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-800);
}
.avail-date-num.sun { color: var(--danger); }
.avail-date-num.sat { color: var(--primary); }
.avail-dow {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
}
.avail-dow.sun { color: var(--danger); }
.avail-dow.sat { color: var(--primary); }
.avail-sat-badge {
  font-size: 10px;
  background: #E3F2FD;
  color: #1565C0;
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

.avail-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.avail-slot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 10px;
  background: #E8F5E9;
  border: 1.5px solid #4CAF50;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 58px;
}
.avail-slot-btn:hover {
  background: #4CAF50;
  border-color: #388E3C;
}
.avail-slot-btn:hover .avail-slot-time,
.avail-slot-btn:hover .avail-slot-end {
  color: white;
}
.avail-slot-time {
  font-size: 13px;
  font-weight: 700;
  color: #1B5E20;
  line-height: 1.2;
}
.avail-slot-end {
  font-size: 10px;
  color: #388E3C;
  line-height: 1.2;
}

/* ========================================
   レスポンシブ追加
======================================== */
@media (max-width: 640px) {
  .treatment-grid {
    grid-template-columns: 1fr;
  }

  .staff-mgmt-grid {
    grid-template-columns: 1fr;
  }

  #schedule-calendars {
    grid-template-columns: 1fr !important;
  }

  .staff-tabs {
    padding: 0 8px;
  }

  .staff-tab {
    padding: 12px 14px;
    font-size: 13px;
  }
}

/* ========================================
   予約追加モーダル（スタッフ用3ステップ）
======================================== */

/* ステップインジケーター */
.add-apt-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
}

.add-apt-step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #999;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.add-apt-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #888;
  font-size: 12px;
  font-weight: 700;
}

.add-apt-step.active {
  color: #1565C0;
  font-weight: 700;
  background: #E3F2FD;
}

.add-apt-step.active span {
  background: #1976D2;
  color: white;
}

.add-apt-step.done {
  color: #2E7D32;
}

.add-apt-step.done span {
  background: #E8F5E9;
  color: #2E7D32;
}

.add-apt-step-arrow {
  color: #ccc;
  font-size: 18px;
  flex-shrink: 0;
}

/* 選択情報バー */
.apt-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1565C0;
  color: white;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 14px;
  gap: 10px;
}

.apt-sel-clear-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.apt-sel-clear-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* 操作ガイドテキスト */
.apt-slot-guide {
  font-size: 12px;
  color: #666;
  background: #FFFDE7;
  border: 1px solid #FFF176;
  border-radius: 6px;
  padding: 7px 12px;
  margin-bottom: 10px;
}

/* 選択中のスロット行 */
.slot-row-selected {
  background: #1565C0 !important;
}
.slot-row-selected .slot-row-time {
  background: #0D47A1 !important;
  color: white !important;
  border-right-color: rgba(255,255,255,0.3) !important;
}
.slot-row-selected .slot-row-info {
  color: white !important;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.slot-row-selected:hover .slot-row-info {
  background: rgba(255,255,255,0.1) !important;
  cursor: pointer;
}

/* 選択ヒント（空きスロットに「← ここまで選択」を表示） */
.slot-row-available {
  transition: background 0.1s;
}
.slot-row-clickable:hover:not(.slot-row-selected) .slot-row-info.slot-row-available {
  background: #BBDEFB;
}

/* 担当スタッフ選択 */
.staff-select-group {
  background: #FAFAFA;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
}

.staff-select-role-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

.staff-select-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-select-btn {
  padding: 8px 18px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.staff-select-btn:hover {
  border-color: #90CAF9;
  background: #E3F2FD;
}

.staff-select-btn.selected {
  border-color: #1976D2;
  background: #1976D2;
  color: white;
  font-weight: 700;
}

/* 担当・日付ヘッダー */
.apt-slot-header {
  background: #E3F2FD;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: #1565C0;
  margin-bottom: 12px;
}

/* スロットセクションラベル */
.apt-slot-section-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  padding: 6px 0 4px;
  margin-top: 8px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 4px;
}

/* スロットグリッド */
.apt-slot-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

/* スロット行 */
.slot-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
}

.slot-row-clickable {
  cursor: pointer;
}

.slot-row-clickable:hover .slot-row-info {
  background: #BBDEFB;
}

.slot-row-time {
  background: #F5F5F5;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  min-width: 52px;
  text-align: center;
  border-right: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.slot-row-info {
  padding: 5px 10px;
  font-size: 13px;
  flex: 1;
  transition: background 0.12s;
}

.slot-row-available {
  background: #E8F5E9;
  color: #2E7D32;
  font-weight: 600;
}

.slot-row-booked {
  background: #E3F2FD;
  color: #1565C0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.slot-row-booked-cont {
  background: #EEF5FC;
  color: #90CAF9;
  font-size: 12px;
  text-align: center;
}

.slot-row-blocked {
  background: #FFF8E1;
  color: #E65100;
}

.slot-row-off {
  background: #F5F5F5;
  color: #BDBDBD;
}

.slot-row-closed {
  padding: 10px 12px;
  font-size: 13px;
  color: #999;
  text-align: center;
  background: #FAFAFA;
  border-radius: 4px;
}

.slot-booked-name {
  font-weight: 700;
}

.slot-booked-meta {
  font-size: 11px;
  color: #1976D2;
  opacity: 0.8;
}

/* 診察時間ボタン */
.duration-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.duration-btn {
  padding: 5px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}

.duration-btn:hover {
  border-color: #90CAF9;
  background: #E3F2FD;
}

.duration-btn.selected {
  background: #1976D2;
  border-color: #1976D2;
  color: white;
  font-weight: 700;
}

/* ========================================
   週グリッド（患者向け日時選択）
======================================== */

/* ラッパー */
.wg-wrapper {
  margin-top: 16px;
  overflow: hidden;
}

/* ---- 週ナビバー（テーブル外・常時表示） ---- */
.wg-week-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.wg-week-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #1565C0;
  white-space: nowrap;
}

.wg-week-nav-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1976D2;
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap;
}

.wg-week-nav-btn .wg-btn-label {
  font-size: 9px;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.03em;
}

.wg-week-nav-btn:hover:not(:disabled) {
  background: #1565C0;
  transform: scale(1.08);
}

.wg-week-nav-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.wg-week-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  box-shadow: none;
}

/* 次週ボタンは強調色（アクション誘導） */
.wg-week-nav-btn--next {
  background: #E53935;
}

.wg-week-nav-btn--next:hover:not(:disabled) {
  background: #C62828;
}

/* 横スクロール可能なコンテナ（スクロールヒント付き） */
.wg-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  /* スクロール可能なことをユーザーに示すグラデーション */
  background:
    linear-gradient(to right, white 30%, rgba(255,255,255,0)),
    linear-gradient(to left,  white 30%, rgba(255,255,255,0)) 100% 0,
    radial-gradient(farthest-side at 0   50%, rgba(0,0,0,.12), rgba(0,0,0,0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)) 100% 0;
  background-repeat: no-repeat;
  background-color: white;
  background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}

/* テーブル本体 */
.wg-table {
  border-collapse: collapse;
  min-width: 520px;
  width: 100%;
  background: white;
}

.wg-table th,
.wg-table td {
  border: 1px solid #e0e0e0;
  text-align: center;
  vertical-align: middle;
}

/* ---- 月ナビ行 ---- */
.wg-month-row {
  background: #1976D2;
  color: white;
}

.wg-month-title-th {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 10px 4px;
}

.wg-nav-th {
  padding: 6px 8px;
  width: 72px;
  min-width: 60px;
}

/* ---- 曜日ヘッダー行 ---- */
.wg-day-row {
  background: #E3F2FD;
}

.wg-day-th {
  padding: 8px 4px;
  min-width: 50px;
  font-size: 13px;
  font-weight: 600;
}

.wg-day-th.wg-sat .wg-day-dow { color: #1565C0; }
.wg-day-th.wg-closed .wg-day-dow { color: #E53935; }
.wg-day-th.wg-past { opacity: 0.45; }

.wg-day-num {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.wg-day-dow {
  display: block;
  font-size: 12px;
  line-height: 1.2;
}

/* ---- ナビボタン ---- */
.wg-nav-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  white-space: nowrap;
  border-radius: 4px;
  transition: background 0.15s;
  width: 100%;
}

.wg-nav-btn:hover {
  background: rgba(255,255,255,0.2);
}

.wg-week-btn {
  color: #1565C0;
  background: white;
  border: 1px solid #90CAF9;
  font-size: 12px;
  padding: 4px 6px;
}

.wg-week-btn:hover {
  background: #E3F2FD;
}

/* ---- 午前/午後セクションヘッダー ---- */
.wg-section-header {
  background: #F5F5F5;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  padding: 5px 8px;
  text-align: left !important;
  border-top: 2px solid #e0e0e0 !important;
}

/* ---- 時間ラベル ---- */
.wg-time-label {
  background: #FAFAFA;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  padding: 6px 10px;
  white-space: nowrap;
  min-width: 58px;
  text-align: right !important;
  border-right: 2px solid #e0e0e0 !important;
}

/* ---- スロットセル ---- */
.wg-cell {
  padding: 5px 4px;
  min-width: 50px;
  transition: background 0.12s;
}

.wg-cell-na,
.wg-cell-booked {
  background: #F5F5F5;
  cursor: not-allowed;
}

.wg-cell-available {
  cursor: pointer;
  background: white;
}

.wg-cell-available:hover {
  background: #E3F2FD;
}

.wg-cell-available:hover .wg-circle {
  transform: scale(1.15);
}

.wg-cell-selected {
  background: #1565C0 !important;
}

.wg-cell-selected .wg-circle {
  color: white !important;
}


/* ---- アイコン ---- */
.wg-circle {
  display: inline-block;
  font-size: 20px;
  font-weight: bold;
  color: #1976D2;
  line-height: 1;
  transition: transform 0.1s;
}

.wg-x {
  display: inline-block;
  font-size: 14px;
  color: #BDBDBD;
  line-height: 1;
}

/* ---- 空メッセージ ---- */
.wg-empty-msg {
  padding: 24px 16px;
  font-size: 14px;
  color: #666;
  text-align: center !important;
  background: #FAFAFA;
}

/* ---- 凡例アイコン ---- */
.wg-legend-circle {
  display: inline-block;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
}

.wg-legend-circle.available {
  color: #1976D2;
}

.wg-legend-circle.selected {
  color: white;
  background: #1565C0;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.wg-legend-x {
  display: inline-block;
  font-size: 16px;
  color: #BDBDBD;
  line-height: 1;
}

/* ---- レスポンシブ ---- */
@media (max-width: 600px) {
  .wg-day-num {
    font-size: 14px;
  }
  .wg-day-dow {
    font-size: 11px;
  }
  .wg-circle {
    font-size: 17px;
  }
  .wg-time-label {
    font-size: 11px;
    padding: 5px 6px;
    min-width: 48px;
  }
  .wg-nav-th {
    width: 54px;
    min-width: 48px;
  }
}

/* ========================================
   トースト通知（エラー・成功ポップアップ）
======================================== */
#toast-popup {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 280px;
  max-width: 480px;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#toast-popup.show {
  opacity: 1;
  pointer-events: auto;
}
#toast-popup.toast-error   { background: #C62828; }
#toast-popup.toast-success { background: #2E7D32; }
#toast-popup.toast-info    { background: #1565C0; }
