.schedule-calendar {
  --schedule-border: #dbe2ea;
  --schedule-muted: #64748b;
  --schedule-surface: #fff;
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: #172033;
}

.schedule-calendar__toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--schedule-border);
  border-radius: 14px 14px 0 0;
  background: var(--schedule-surface);
}

.schedule-calendar__date,
.schedule-calendar__nav {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.schedule-calendar__date {
  min-width: 220px;
  font-weight: 700;
  font-size: 15px;
  text-transform: capitalize;
}

.schedule-calendar__nav {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 24px;
}

.schedule-calendar__nav:hover,
.schedule-calendar__date:hover {
  background: #f1f5f9;
}

.schedule-calendar__viewport {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--schedule-border);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: var(--schedule-surface);
}

.schedule-calendar__grid {
  position: relative;
  display: grid;
  grid-template-columns: 64px repeat(var(--schedule-columns), minmax(180px, 1fr));
  min-width: calc(64px + var(--schedule-columns) * 180px);
}

.schedule-calendar__times,
.schedule-calendar__resource {
  position: relative;
  border-right: 1px solid var(--schedule-border);
}

.schedule-calendar__resource:last-child {
  border-right: 0;
}

.schedule-calendar__column-header {
  position: sticky;
  top: 0;
  z-index: 4;
  height: var(--schedule-header-height, 70px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-bottom: 1px solid var(--schedule-border);
  background: var(--schedule-surface);
  text-align: center;
  font-weight: 700;
}

.schedule-calendar__column-header--resource {
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px;
  text-align: left;
}

.schedule-calendar__resource-avatar {
  display: inline-flex;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--schedule-resource-avatar, #eaf2ff);
  color: var(--schedule-resource-text, #114f91);
  font-size: 16px;
  font-weight: 700;
  object-fit: cover;
}

.schedule-calendar__resource-details {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.schedule-calendar__column-header--clickable { cursor: pointer; }
.schedule-calendar__column-header--clickable:hover { background: #f1f5f9; }

.schedule-calendar__resource-name {
  display: -webkit-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.schedule-calendar__resource-type {
  overflow: hidden;
  color: var(--schedule-muted);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-calendar__column-body,
.schedule-calendar__times,
.schedule-calendar__time-body {
  position: relative;
}

.schedule-calendar__column-body,
.schedule-calendar__time-body {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 60px,
    color-mix(in srgb, var(--schedule-muted) 7%, transparent) 60px,
    color-mix(in srgb, var(--schedule-muted) 7%, transparent) 120px
  );
}

.schedule-calendar__time-body {
  background:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent 60px,
      var(--schedule-border) 60px,
      var(--schedule-border) 61px,
      transparent 61px,
      transparent 75px,
      var(--schedule-border) 75px,
      var(--schedule-border) 76px,
      transparent 76px,
      transparent 90px,
      var(--schedule-border) 90px,
      var(--schedule-border) 91px,
      transparent 91px,
      transparent 105px,
      var(--schedule-border) 105px,
      var(--schedule-border) 106px,
      transparent 106px,
      transparent 120px
    ),
    repeating-linear-gradient(
      to bottom,
      #edf1f5 0,
      #edf1f5 1px,
      transparent 1px,
      transparent 15px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 60px,
      color-mix(in srgb, var(--schedule-muted) 7%, transparent) 60px,
      color-mix(in srgb, var(--schedule-muted) 7%, transparent) 120px
    );
  background-repeat: repeat-y;
  background-size: 100% 120px, auto, auto;
}

.schedule-calendar__times {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--schedule-surface);
}

.schedule-calendar__times .schedule-calendar__column-header {
  z-index: 7;
}

.schedule-calendar__time-label {
  position: absolute;
  left: 8px;
  z-index: 2;
  transform: translateY(4px);
  color: var(--schedule-muted);
  font-size: 11px;
}

.schedule-calendar__row-highlight,
.schedule-calendar__time-row-highlight {
  position: absolute;
  display: none;
  pointer-events: none;
  background: color-mix(in srgb, var(--schedule-muted) 14%, transparent);
}

.schedule-calendar__row-highlight {
  z-index: 2;
  right: 0;
  left: 64px;
}

.schedule-calendar__time-row-highlight {
  z-index: 1;
  right: 0;
  left: 0;
}

.schedule-calendar__row-highlight.is-visible,
.schedule-calendar__time-row-highlight.is-visible {
  display: block;
}

.schedule-calendar__slot {
  position: absolute;
  inset-inline: 0;
  width: 100%;
  border: 0;
  border-top: 1px solid #edf1f5;
  background: transparent;
  cursor: pointer;
}

.schedule-calendar__slot--shaded {
  border-top-color: var(--schedule-border);
}

.schedule-calendar__slot--unavailable {
  background: color-mix(in srgb, var(--schedule-muted) 12%, transparent);
  cursor: not-allowed;
}

.schedule-calendar__slot:hover {
  background: transparent;
}

.schedule-calendar__item {
  position: absolute;
  z-index: 3;
  left: 4px;
  right: 4px;
  width: calc(100% - 8px);
  overflow: hidden;
  border: 1px solid var(--schedule-resource-border, #8bc8ff);
  border-radius: 8px;
  padding: 5px 7px;
  background: var(--schedule-resource-background, #dff1ff);
  color: var(--schedule-resource-text, #0f4772);
  text-align: left;
  cursor: pointer;
}

.schedule-calendar__item strong,
.schedule-calendar__item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-calendar__item span {
  margin-top: 2px;
  font-size: 11px;
}

.schedule-calendar__item .schedule-calendar__item-time {
  margin-top: 0;
  font-weight: 500;
}

.schedule-calendar__item strong {
  margin-top: 4px;
}

.schedule-calendar__item--cancelled {
  border-color: #d9dee5;
  background: #f1f3f5;
  color: #77808c;
  text-decoration: line-through;
}

.schedule-calendar__item--pending_payment {
  border-color: #f2c96f;
  background: #fff4cf;
  color: #754f00;
}

.schedule-calendar__empty {
  padding: 48px 20px;
  border: 1px dashed var(--schedule-border);
  border-radius: 0 0 14px 14px;
  color: var(--schedule-muted);
  text-align: center;
}

.schedule-calendar__week-grid { --schedule-header-height: 42px; position: relative; display: grid; grid-template-columns: 64px repeat(7, minmax(150px, 1fr)); min-width: 1114px; }
.schedule-calendar__summary-item { display: block; width: 100%; margin: 4px 0; overflow: hidden; padding: 6px 7px; border: 1px solid #8bc8ff; border-radius: 7px; background: #dff1ff; color: #0f4772; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.schedule-calendar__day-empty { display: block; padding: 12px 4px; color: var(--schedule-muted); font-size: 12px; text-align: center; }
.schedule-calendar__month-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); min-width: 840px; }
.schedule-calendar__month-weekday { padding: 8px; border-bottom: 1px solid var(--schedule-border); color: var(--schedule-muted); text-align: center; font-size: 12px; font-weight: 700; }
.schedule-calendar__month-day { min-height: 112px; padding: 5px; border-right: 1px solid var(--schedule-border); border-bottom: 1px solid var(--schedule-border); }
.schedule-calendar__month-day:nth-child(7n) { border-right: 0; }
.schedule-calendar__month-day.is-outside { opacity: .45; }
.schedule-calendar__month-day-number { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.schedule-calendar__more { display: block; color: var(--schedule-muted); font-size: 11px; }

[data-theme="dark"] .schedule-calendar {
  --schedule-border: #344054;
  --schedule-muted: #98a2b3;
  --schedule-surface: #18202c;
  color: #f2f4f7;
}

[data-theme="dark"] .schedule-calendar__slot:hover,
[data-theme="dark"] .schedule-calendar__column-header--clickable:hover,
[data-theme="dark"] .schedule-calendar__nav:hover,
[data-theme="dark"] .schedule-calendar__date:hover {
  background: #243247;
}

[data-theme="dark"] .schedule-calendar__slot {
  border-top-color: #273548;
}

@media (max-width: 640px) {
  .schedule-calendar__toolbar {
    padding: 8px;
  }

  .schedule-calendar__date {
    min-width: 0;
    flex: 1;
  }

  .schedule-calendar__viewport {
    max-height: calc(100vh - 210px);
  }
}
