/* ============================================
   SUP予約管理システム - スタイルシート
   ============================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --secondary: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-width: 240px;
  --header-height: 56px;
}

html { font-size: 14px; }

body {
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ============================================
   Login Screen
   ============================================ */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--primary-dark), #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}

.login-card {
  background: #fff; border-radius: 12px;
  padding: 40px; width: 400px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

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

.login-subtitle {
  color: var(--gray-500); font-size: 0.85rem;
  margin-bottom: 28px;
}

.error-text {
  color: var(--danger); font-size: 0.85rem;
  margin-top: 12px;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--gray-800);
  color: #fff;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-700);
  display: flex; justify-content: space-between; align-items: center;
}

.sidebar-header h2 { font-size: 1.1rem; font-weight: 600; }

.sidebar-close {
  display: none; background: none; border: none;
  color: #fff; font-size: 1.5rem; cursor: pointer;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--gray-300);
  font-size: 0.9rem; transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover { background: var(--gray-700); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-footer {
  border-top: 1px solid var(--gray-700);
  padding: 8px 0;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.header-title { flex: 1; }
.header-title h1 { font-size: 1.15rem; font-weight: 600; }
.header-date { color: var(--gray-500); font-size: 0.9rem; }

.hamburger {
  display: none; background: none; border: none;
  font-size: 1.5rem; cursor: pointer; color: var(--gray-600);
}

/* ============================================
   Views
   ============================================ */
.view-section {
  display: none;
  padding: 24px;
}

.view-section.active { display: block; }

/* ============================================
   Cards
   ============================================ */
.card {
  background: #fff; border-radius: 8px;
  padding: 20px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card h3 {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 16px; color: var(--gray-700);
}

/* Stats Cards Row */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 20px;
}

.stat-card {
  background: #fff; border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-label {
  font-size: 0.8rem; color: var(--gray-500);
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 1.8rem; font-weight: 700;
  color: var(--gray-800);
}

.stat-card .stat-sub {
  font-size: 0.8rem; color: var(--gray-400);
  margin-top: 4px;
}

.stat-card.primary { border-top: 3px solid var(--primary); }
.stat-card.success { border-top: 3px solid var(--secondary); }
.stat-card.warning { border-top: 3px solid var(--warning); }
.stat-card.danger { border-top: 3px solid var(--danger); }

/* ============================================
   Tables
   ============================================ */
.table-responsive { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  background: var(--gray-50);
  padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
}

tbody tr:hover { background: var(--gray-50); }
tbody tr { cursor: pointer; }

/* ============================================
   Badges
   ============================================ */
.badge {
  display: inline-block;
  padding: 2px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: var(--gray-200); color: var(--gray-600); }
.badge-confirming { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #d1fae5; color: #065f46; }
.badge-assigned { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-weather_cancelled { background: #fef3c7; color: #92400e; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-changed { background: var(--gray-200); color: var(--gray-600); }

.badge-jalan { background: #fce7f3; color: #9d174d; }
.badge-asoview { background: #ede9fe; color: #5b21b6; }
.badge-line { background: #d1fae5; color: #065f46; }
.badge-direct { background: #e0f2fe; color: #075985; }
.badge-web { background: #fef3c7; color: #92400e; }

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 16px; flex: 1;
}

.form-group label {
  display: block; font-size: 0.85rem;
  font-weight: 600; color: var(--gray-600);
  margin-bottom: 4px;
}

.form-control {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px; font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control { resize: vertical; }

.form-row {
  display: flex; gap: 16px;
}

.form-actions {
  display: flex; gap: 12px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  padding: 10px 20px; border-radius: 6px;
  font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

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

.btn-success { background: var(--secondary); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: 36px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================
   Filter Bar
   ============================================ */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap;
  background: #fff; padding: 16px;
  border-radius: 8px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filter-bar .form-control {
  width: auto; min-width: 140px;
}

.filter-bar span { color: var(--gray-400); }

/* ============================================
   Instructor Cards
   ============================================ */
.instructor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.instructor-card {
  background: #fff; border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.instructor-card .inst-name {
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 8px;
}

.instructor-card .inst-info {
  font-size: 0.85rem; color: var(--gray-500);
  margin-bottom: 4px;
}

.instructor-card .inst-badges {
  display: flex; gap: 6px; margin-top: 8px;
}

.badge-main-ok { background: #dbeafe; color: #1e40af; }
.badge-level { background: var(--gray-200); color: var(--gray-700); }

.instructor-account-section { margin-top: 8px; }
.instructor-account-section h3 { font-size: 1rem; color: var(--gray-700); border-bottom: 1px solid var(--gray-200); padding-bottom: 8px; }
#instructor-account-table td { vertical-align: middle; }
#instructor-account-table .inst-login-id { font-size: 0.85rem; padding: 6px 8px; width: 100%; max-width: 160px; }
#instructor-account-table .inst-role { font-size: 0.85rem; padding: 6px 8px; width: 100%; max-width: 160px; }
#instructor-account-table .inst-save-btn { min-width: 50px; }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff; border-radius: 12px;
  width: 700px; max-width: 90vw;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none; border: none;
  font-size: 1.5rem; cursor: pointer;
  color: var(--gray-400);
}

.modal-close:hover { color: var(--gray-700); }

.modal-body { padding: 24px; }

/* Modal detail rows */
.detail-row {
  display: flex; padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-label {
  width: 120px; font-weight: 600;
  color: var(--gray-500); font-size: 0.85rem;
  flex-shrink: 0;
}

.detail-value { font-size: 0.9rem; }

.detail-section {
  margin-top: 20px; padding-top: 16px;
  border-top: 2px solid var(--gray-200);
}

.detail-section h4 {
  font-size: 0.95rem; margin-bottom: 12px;
  color: var(--gray-700);
}

.detail-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* ============================================
   Toast
   ============================================ */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 20px; border-radius: 8px;
  color: #fff; font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toast-in 0.3s ease;
  max-width: 400px;
}

.toast-info { background: var(--primary); }
.toast-success { background: var(--secondary); }
.toast-warning { background: var(--warning); }
.toast-error { background: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   Loading
   ============================================ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 3000;
}

.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex; gap: 4px; justify-content: center;
  margin-top: 16px;
}

.pagination button {
  padding: 8px 14px; border: 1px solid var(--gray-300);
  background: #fff; border-radius: 4px;
  cursor: pointer; font-size: 0.85rem;
  min-height: 44px; min-width: 44px;
}

.pagination button.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}

.pagination button:hover:not(.active) {
  background: var(--gray-100);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .hamburger { display: block; }
  .main-content { margin-left: 0; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-control { width: 100%; min-width: unset; }
  .form-row { flex-direction: column; gap: 0; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
  .modal { width: 95vw; }
  .modal-body { padding: 16px; }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-label { width: auto; }
  .instructor-grid { grid-template-columns: 1fr; }
  .header { padding: 0 12px; gap: 8px; }
  .view-section { padding: 16px 12px; }
  #instructor-account-table .inst-login-id,
  #instructor-account-table .inst-role { max-width: none; }
  .setting-input { width: 100% !important; }
}

@media (max-width: 480px) {
  .stats-cards { grid-template-columns: 1fr; }
  .view-section { padding: 16px; }
}

/* ============ 表示切替トグル ============ */
.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}
.toggle-btn {
  padding: 8px 20px;
  border: 1px solid var(--gray-300);
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--gray-600);
}
.toggle-btn:first-child { border-radius: 6px 0 0 6px; }
.toggle-btn:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.toggle-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============ カレンダー ============ */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.calendar-title {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 140px;
  text-align: center;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.cal-header {
  background: var(--gray-100);
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-600);
}
.cal-header.sun { color: #dc2626; }
.cal-header.sat { color: #2563eb; }
.cal-cell {
  background: #fff;
  min-height: 90px;
  padding: 4px 6px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.cal-cell:hover { background: #f0f7ff; }
.cal-cell.other-month { background: var(--gray-50); opacity: 0.5; }
.cal-cell.today { background: #eff6ff; border: 2px solid var(--primary); }
.cal-cell.selected { background: #dbeafe; }
.cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.cal-cell.sun .cal-day-num { color: #dc2626; }
.cal-cell.sat .cal-day-num { color: #2563eb; }
.cal-dot {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin: 1px 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cal-dot.confirmed { background: #dcfce7; color: #166534; }
.cal-dot.assigned { background: #dbeafe; color: #1e40af; }
.cal-dot.pending { background: #f3f4f6; color: #374151; }
.cal-dot.completed { background: #e0e7ff; color: #3730a3; }
.cal-dot.cancelled { background: #fee2e2; color: #991b1b; }
.cal-count {
  position: absolute;
  top: 4px;
  right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .cal-cell { min-height: 50px; }
  .cal-dot { display: none; }
  .cal-count { font-size: 0.65rem; padding: 1px 5px; }
}

/* LINE API設定 */
.line-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .line-settings-grid {
    grid-template-columns: 1fr;
  }
}

.line-settings-section h4 {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  color: var(--gray-700);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

/* QRコード管理 */
.qr-drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
  background: var(--gray-50);
}

.qr-drop-zone:hover,
.qr-drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.qr-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.qr-preview img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qr-placeholder {
  color: var(--gray-400);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ============================================
   Shift Management
   ============================================ */

/* Toolbar */
.shift-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.shift-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shift-week-label {
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 140px;
  text-align: center;
  color: var(--gray-800);
}

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

/* Grid */
.shift-grid {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.shift-grid thead th {
  text-align: center;
  padding: 8px 4px;
  font-size: 0.85rem;
  background: var(--gray-50);
}

.shift-name-col {
  width: 100px;
  min-width: 80px;
}

.shift-day-col {
  min-width: 80px;
}

.shift-dow {
  font-size: 0.8rem;
  font-weight: 600;
}

.shift-date-num {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 400;
}

.shift-sat .shift-dow { color: #2563eb; }
.shift-sun .shift-dow { color: #dc2626; }
.shift-today { background: #eff6ff !important; }

/* Cells */
.shift-cell {
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  min-height: 44px;
}

.shift-cell:hover {
  filter: brightness(0.95);
  box-shadow: inset 0 0 0 2px var(--primary-light);
}

.shift-name-cell {
  padding: 10px 8px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--gray-100);
}

.shift-inst-name-short { display: none; }

.shift-cell-text {
  font-size: 0.8rem;
  font-weight: 600;
}

.shift-cell-dash {
  color: var(--gray-300);
  font-size: 0.9rem;
}

.shift-available {
  background: #dcfce7;
  color: #166534;
}

.shift-location {
  background: #dbeafe;
  color: #1e40af;
}

.shift-off {
  background: var(--gray-200);
  color: var(--gray-600);
}

.shift-empty {
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
}

.shift-today-cell {
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* Legend */
.shift-legend {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  font-size: 0.8rem;
  color: var(--gray-500);
  flex-wrap: wrap;
}

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

.shift-legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.shift-legend-color.shift-available { background: #dcfce7; }
.shift-legend-color.shift-location { background: #dbeafe; }
.shift-legend-color.shift-off { background: var(--gray-200); }
.shift-legend-color.shift-empty { background: var(--gray-50); border: 1px dashed var(--gray-300); }

/* Cell Editor Popup */
.shift-editor-popup {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid var(--gray-200);
  min-width: 200px;
}

.shift-editor-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shift-editor-btn {
  width: 100%;
  justify-content: center;
}

.shift-editor-loc-group {
  display: flex;
  gap: 4px;
}

.shift-editor-loc-group .form-control {
  font-size: 0.8rem;
  padding: 4px 8px;
}

.shift-clear-btn {
  background: #fff;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.shift-clear-btn:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: var(--danger);
}

/* Shift Editor Popup */
.shift-slot-popup {
  min-width: 260px;
  max-width: 300px;
}

.shift-slot-header {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
}

/* Slot Checklist */
.shift-slot-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.shift-slot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

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

.shift-slot-checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.shift-slot-time {
  font-weight: 600;
  color: var(--gray-800);
  min-width: 90px;
}

.shift-slot-type {
  color: var(--gray-500);
  font-size: 0.8rem;
}

/* Slot Actions */
.shift-slot-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.shift-slot-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 0.75rem;
  padding: 3px 8px;
}

/* Bottom Actions (Off / Clear) */
.shift-slot-bottom-actions {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
  margin-top: 8px;
}

.shift-slot-bottom-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Slot List Container */
.shift-slot-list-container {
  min-height: 40px;
}

/* Availability toggle buttons */
.shift-avail-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.shift-avail-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-700);
  transition: all 0.15s;
}

.shift-avail-btn:hover {
  border-color: var(--primary);
  background: var(--gray-50);
}

.shift-avail-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.shift-avail-btn.shift-avail-off.active {
  border-color: var(--gray-400);
  background: var(--gray-100);
  color: var(--gray-600);
}

.shift-avail-icon {
  font-size: 1rem;
}

.shift-avail-sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--gray-500);
  margin-left: auto;
}

/* Available cell style */
.shift-available {
  background: #dcfce7 !important;
}

.shift-available .shift-cell-text {
  color: #166534;
  font-weight: 600;
}

.shift-legend-color.shift-available {
  background: #dcfce7;
  border: 1px solid #86efac;
}

/* Notes indicator in grid cell */
.shift-cell-note {
  display: inline-block;
  color: var(--warning);
  font-weight: 700;
  font-size: 0.9rem;
  margin-left: 2px;
  vertical-align: super;
  line-height: 1;
  cursor: help;
}

/* Notes group in slot editor */
.shift-slot-notes-group {
  margin: 10px 0 8px 0;
}

.shift-slot-notes-group label {
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.shift-slot-notes {
  font-size: 0.85rem;
  padding: 6px 8px;
  resize: vertical;
  min-height: 40px;
}

/* Copy Modal */
.shift-copy-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.shift-copy-tabs .toggle-btn {
  flex: 1;
}

.shift-copy-tabs .toggle-btn:first-child { border-radius: 6px 0 0 6px; }
.shift-copy-tabs .toggle-btn:nth-child(2) { border-left: none; border-right: none; border-radius: 0; }
.shift-copy-tabs .toggle-btn:last-child { border-radius: 0 6px 6px 0; }

.shift-copy-source {
  font-weight: 600;
  color: var(--gray-700);
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .shift-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .shift-nav {
    justify-content: center;
  }

  .shift-actions {
    justify-content: center;
  }

  .shift-week-label {
    font-size: 1rem;
    min-width: auto;
  }

  .shift-name-col {
    width: 50px;
    min-width: 50px;
  }

  .shift-inst-name { display: none; }
  .shift-inst-name-short { display: inline; }

  .shift-cell-text {
    font-size: 0.7rem;
  }

  .shift-cell {
    padding: 8px 2px;
  }

  .shift-name-cell {
    padding: 8px 4px;
    font-size: 0.8rem;
  }

  .shift-day-col {
    min-width: 50px;
  }
}

@media (max-width: 480px) {
  .shift-grid {
    font-size: 0.75rem;
  }

  .shift-name-col {
    width: 40px;
    min-width: 40px;
  }

  .shift-day-col {
    min-width: 44px;
  }

  .shift-cell-text {
    font-size: 0.7rem;
  }

  .shift-dow {
    font-size: 0.75rem;
  }

  .shift-date-num {
    font-size: 0.7rem;
  }

  .stats-cards { grid-template-columns: 1fr; }
  .toast { max-width: 90vw; }
}

/* ============================================
 * 時間帯別シフト・拠点選択 追加スタイル
 * ============================================ */

/* 表示モード切替 */
.shift-view-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

/* 時間帯別セル表示 */
.shift-slot-detail {
  background: #e8f5e9;
  border-color: #66bb6a;
}

.shift-cell-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.shift-loc-tag {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.shift-slot-count {
  font-size: 0.65rem;
  color: var(--gray-600);
  margin-left: 2px;
}

.shift-legend-color.shift-slot-detail {
  background: #e8f5e9;
  border: 1px solid #66bb6a;
}

.shift-legend-separator {
  color: var(--gray-300);
  margin: 0 4px;
}

/* モードタブ */
.shift-mode-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--gray-300);
}

.shift-mode-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}

.shift-mode-tab:not(:last-child) {
  border-right: 1px solid var(--gray-300);
}

.shift-mode-tab:hover {
  background: var(--gray-200);
}

.shift-mode-tab.active {
  background: var(--primary);
  color: #fff;
}

/* 時間帯別パネル */
.shift-slot-detail-panel {
  max-height: 350px;
  overflow-y: auto;
}

.shift-slot-group {
  margin-bottom: 8px;
}

.shift-slot-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background: var(--gray-50);
  border-radius: 4px;
  margin-bottom: 4px;
}

.shift-slot-group-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.shift-slot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  font-size: 0.85rem;
}

.shift-slot-item:hover {
  background: var(--gray-50);
}

.shift-slot-item.checked {
  background: #e8f5e9;
}

.shift-slot-checkbox {
  accent-color: var(--primary);
}

.shift-slot-time {
  font-weight: 500;
  min-width: 100px;
}

.shift-slot-type-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--gray-200);
  color: var(--gray-600);
}

.shift-slot-loc-filter {
  margin-bottom: 8px;
}

.shift-help-text {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin: 4px 0 0 0;
}

.shift-location-select {
  font-size: 0.85rem;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 0.7rem;
  border-radius: 3px;
}

/* エディタポップアップ幅を拡張 */
.shift-slot-popup {
  min-width: 320px;
  max-width: 420px;
}

@media (max-width: 768px) {
  .shift-loc-tag {
    font-size: 0.55rem;
    padding: 1px 3px;
  }
  .shift-slot-count {
    font-size: 0.6rem;
  }
  .shift-view-toggle {
    justify-content: center;
  }
}

/* 紹介制度タブ */
.referral-tab {
  background: #e0e0e0;
  color: #333;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
}
.referral-tab.active {
  background: var(--primary, #1976D2);
  color: #fff;
}
