:root {
  --booking-gap: 1rem;
  --booking-soft: rgba(74, 111, 165, 0.08);
  --booking-warning: rgba(223, 169, 75, 0.16);
  --booking-danger: rgba(210, 85, 90, 0.16);
  --booking-success: rgba(45, 143, 111, 0.12);
  --booking-info: rgba(61, 127, 193, 0.12);
}

.booking-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.booking-hero {
  border: 1px solid var(--border, #E1E5EF);
  background: linear-gradient(135deg, rgba(74, 111, 165, 0.14), rgba(230, 183, 92, 0.12));
}

.booking-hero-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.booking-hero-text {
  max-width: 520px;
}

.booking-title {
  font-size: var(--heading-2-size, 1.5rem);
  font-weight: 600;
}

.booking-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.booking-help {
  border-top: 1px dashed rgba(74, 111, 165, 0.25);
}

.booking-help-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 0.9rem 1.25rem 1.1rem;
}

.booking-help-item {
  border: 1px dashed rgba(74, 111, 165, 0.25);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.7);
}

.booking-help-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.booking-help-desc {
  font-size: 0.75rem;
  color: var(--text-sub, #4B5565);
}

.booking-toolbar {
  /* ไม่ใช้ sticky แล้ว */
}

.booking-toolbar .card-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.booking-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
}

.booking-toolbar-main {
  align-items: end;
}

.booking-filter .form-label {
  font-size: 0.8rem;
  color: var(--text-sub, #4B5565);
}

.booking-date-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.booking-status-filter .btn {
  font-size: 0.75rem;
}

.booking-status-filter .btn.active {
  background: rgba(74, 111, 165, 0.12);
  border-color: rgba(74, 111, 165, 0.4);
  color: var(--color-primary, #4A6FA5);
}

.booking-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.booking-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.45rem;
  flex: 1;
}

.summary-item {
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.7);
}

.summary-label {
  font-size: 0.7rem;
  color: var(--text-sub, #4B5565);
}

.summary-value {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main, #1E2430);
}

.summary-item--success {
  border-color: rgba(45, 143, 111, 0.35);
  background: var(--booking-success);
}

.summary-item--danger {
  border-color: rgba(210, 85, 90, 0.35);
  background: var(--booking-danger);
}

.summary-item--warning {
  border-color: rgba(223, 169, 75, 0.35);
  background: var(--booking-warning);
}

.booking-summary-meta {
  margin-top: -0.3rem;
}

.booking-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.booking-toolbar-actions .btn {
  white-space: nowrap;
}

.booking-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-sub, #4B5565);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-available {
  background: var(--color-success, #2D8F6F);
}

.legend-full {
  background: var(--color-danger, #D2555A);
}

.legend-hold {
  background: #8A96AA;
}

.booking-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 2.1fr) minmax(260px, 1.1fr);
  gap: var(--booking-gap);
  align-items: start;
}

.booking-panel {
  border: 1px solid var(--border, #E1E5EF);
}

.booking-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #f9fafc;
  border-bottom: 1px solid var(--border, #E1E5EF);
}

.booking-panel-title {
  font-weight: 600;
  font-size: 1rem;
}

.booking-count-badge {
  background: var(--booking-soft);
  color: var(--color-primary, #4A6FA5);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.team-card {
  border: 1px solid var(--border, #E1E5EF);
  background: var(--bg-card, #fff);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: var(--transition, all 0.2s ease);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.team-card.is-hidden {
  display: none;
}

.team-empty {
  border: 1px dashed var(--border, #E1E5EF);
  border-radius: 12px;
  background: var(--bg-card, #fff);
}

.team-card:hover {
  border-color: rgba(74, 111, 165, 0.35);
  box-shadow: 0 10px 18px rgba(22, 34, 56, 0.08);
}

.team-card.active {
  border-color: rgba(74, 111, 165, 0.5);
  box-shadow: 0 12px 22px rgba(22, 34, 56, 0.12);
  background: rgba(74, 111, 165, 0.05);
}

.team-card-main {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--team-color, var(--color-primary));
  margin-top: 0.3rem;
}

.team-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.team-meta {
  font-size: 0.78rem;
  color: var(--text-sub, #4B5565);
}

.team-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.team-card-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.team-next {
  font-size: 0.75rem;
  color: var(--text-muted, #6B7280);
}

.team-card-actions {
  display: inline-flex;
  gap: 0.35rem;
}

.team-action-btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
}

.booking-status-badge {
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.booking-status-badge--success {
  background: var(--booking-success);
  color: var(--color-success, #2D8F6F);
}

.booking-status-badge--warning {
  background: var(--booking-warning);
  color: #9a6a14;
}

.booking-status-badge--danger {
  background: var(--booking-danger);
  color: var(--color-danger, #D2555A);
}

.booking-schedule-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.schedule-days {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
}

.schedule-empty-state {
  margin-top: 0.5rem;
}

.schedule-day {
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 14px;
  padding: 0.8rem;
  background: var(--bg-card, #fff);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  scroll-snap-align: start;
  min-width: 240px;
}

.schedule-day.is-today {
  border-color: rgba(74, 111, 165, 0.55);
  box-shadow: 0 12px 20px rgba(22, 34, 56, 0.08);
}

.schedule-day.is-today .schedule-day-title::after {
  content: "วันนี้";
  margin-left: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-primary, #4A6FA5);
}

.schedule-day.is-muted {
  background: #f9fafc;
  color: var(--text-muted, #6B7280);
}

.schedule-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.schedule-day-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.schedule-day-meta {
  font-size: 0.75rem;
}

.schedule-slots {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.schedule-slot {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.7rem;
  align-items: start;
}

.slot-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub, #4B5565);
}

.slot-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.slot-chip {
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 12px;
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: #fff;
  transition: var(--transition, all 0.2s ease);
  cursor: pointer;
  text-align: left;
  width: 100%;
  appearance: none;
  font: inherit;
}

.slot-chip.is-muted {
  opacity: 0.35;
}

.slot-chip-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.slot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--team-color, var(--color-primary));
}

.slot-chip-meta {
  font-size: 0.72rem;
  color: var(--text-sub, #4B5565);
}

.slot-chip--available {
  background: var(--booking-success);
  border-color: rgba(45, 143, 111, 0.35);
}

.slot-chip--limited {
  background: var(--booking-warning);
  border-color: rgba(223, 169, 75, 0.45);
}

.slot-chip--full {
  background: var(--booking-danger);
  border-color: rgba(210, 85, 90, 0.4);
}

.slot-chip--off {
  background: rgba(138, 150, 170, 0.18);
  border-color: rgba(138, 150, 170, 0.35);
}

.slot-chip--off .slot-chip-meta {
  color: #7b8596;
}

.slot-chip--hold {
  background: var(--booking-info);
  border-color: rgba(61, 127, 193, 0.4);
}

.schedule-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted, #6B7280);
  border: 1px dashed var(--border, #E1E5EF);
  border-radius: 12px;
  background: #fff;
}

.schedule-day-empty {
  text-align: center;
  padding: 0.8rem 0.75rem;
  border: 1px dashed var(--border, #E1E5EF);
  border-radius: 10px;
  color: var(--text-muted, #6B7280);
  font-size: 0.75rem;
}

.schedule-empty-icon {
  font-size: 2rem;
  color: var(--text-muted, #6B7280);
  margin-bottom: 0.4rem;
}

.schedule-empty-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main, #1E2430);
}

.schedule-empty-desc {
  font-size: 0.75rem;
  margin-bottom: 0.6rem;
}

.availability-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.availability-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.availability-step {
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.72rem;
  border: 1px solid var(--border, #E1E5EF);
  color: var(--text-sub, #4B5565);
  background: #fff;
}

.availability-step.is-active,
.availability-step.is-done {
  border-color: rgba(74, 111, 165, 0.45);
  color: var(--color-primary, #4A6FA5);
  background: rgba(74, 111, 165, 0.12);
}

.availability-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--team-color, #4A6FA5), rgba(74, 111, 165, 0.4));
  flex-shrink: 0;
}

.availability-team-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.availability-team-meta {
  font-size: 0.75rem;
}

.availability-section {
  margin-bottom: 1rem;
}

.availability-section-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  color: var(--text-sub, #4B5565);
}

.daily-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.daily-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--border, #E1E5EF);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: var(--bg-card, #fff);
}

.daily-status-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main, #1E2430);
}

.daily-status-actions {
  display: inline-flex;
  gap: 0.35rem;
}

.daily-status-empty {
  border: 1px dashed var(--border, #E1E5EF);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #fff;
}

.status-btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.status-btn--ready {
  color: var(--color-success, #2D8F6F);
  border-color: rgba(45, 143, 111, 0.35);
}

.status-btn--off {
  color: var(--color-danger, #D2555A);
  border-color: rgba(210, 85, 90, 0.35);
}

.status-btn.is-active.status-btn--ready {
  background: var(--booking-success);
  color: var(--color-success, #2D8F6F);
  border-color: rgba(45, 143, 111, 0.45);
}

.status-btn.is-active.status-btn--off {
  background: var(--booking-danger);
  color: var(--color-danger, #D2555A);
  border-color: rgba(210, 85, 90, 0.5);
}

.availability-days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.day-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.day-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.day-toggle span {
  border: 1px solid var(--border, #E1E5EF);
  background: var(--bg-card, #fff);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-sub, #4B5565);
  cursor: pointer;
  transition: var(--transition, all 0.2s ease);
}

.day-toggle input:checked+span {
  border-color: rgba(74, 111, 165, 0.4);
  background: rgba(74, 111, 165, 0.12);
  color: var(--color-primary, #4A6FA5);
}

.availability-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.availability-time-ranges {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.time-range-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.time-range-sep {
  font-size: 0.75rem;
  color: var(--text-muted, #6B7280);
}

.remove-time-range {
  border-radius: 8px;
}

.availability-note {
  background: rgba(74, 111, 165, 0.08);
  border: 1px dashed rgba(74, 111, 165, 0.3);
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  font-size: 0.75rem;
  color: var(--text-sub, #4B5565);
  margin-bottom: 1rem;
}

.availability-summary {
  margin-top: -0.4rem;
  margin-bottom: 0.8rem;
}

.availability-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
}

.booking-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(74, 111, 165, 0.08);
  border: 1px dashed rgba(74, 111, 165, 0.35);
}

.booking-meta-label {
  font-size: 0.75rem;
  color: var(--text-sub, #4B5565);
}

.booking-meta-value {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main, #1E2430);
}

.modal-day-grid {
  margin-top: 0.5rem;
}

.availability-panel.is-disabled .card-body {
  pointer-events: none;
  opacity: 0.65;
}

.availability-panel.is-disabled .availability-header {
  opacity: 1;
}

@media (max-width: 1199.98px) {
  .booking-layout {
    grid-template-columns: minmax(240px, 1fr) minmax(0, 1.6fr);
  }

  .availability-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 991.98px) {
  .booking-layout {
    grid-template-columns: 1fr;
  }

  .booking-help-body {
    padding: 0.7rem 1rem 1rem;
  }

  .team-list {
    max-height: none;
  }
}

@media (max-width: 767.98px) {
  .booking-hero-body {
    align-items: flex-start;
  }

  .booking-toolbar-grid {
    grid-template-columns: 1fr;
  }

  .schedule-slot {
    grid-template-columns: 1fr;
  }

  .slot-time {
    font-size: 0.78rem;
  }

  .time-range-row {
    grid-template-columns: 1fr;
  }

  .availability-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .booking-modal-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}