.scheduler-subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 2rem 0.65rem 0.75rem;
  background: var(--purple);
  color: var(--white);
}

.scheduler-subnav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.scheduler-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--white);
  text-decoration: none;
  border-radius: 4px;
}

.scheduler-back:hover {
  background: rgba(255, 255, 255, 0.12);
}

.scheduler-back svg {
  width: 1.25rem;
  height: 1.25rem;
}

.scheduler-subnav-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.scheduler-main {
  min-height: calc(100vh - 7.5rem);
  padding: 0;
  background: #d8dde3;
}

.scheduler-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 7.5rem);
}

.scheduler-identity-hint {
  margin: 0;
  padding: 0.85rem 1.25rem 0;
  color: #666;
  font-size: 0.88rem;
  font-weight: 500;
}

.scheduler-toolbar {
  padding: 0.85rem 1.25rem 0.75rem;
  background: linear-gradient(180deg, #eef1f5 0%, #e3e8ee 100%);
  border-bottom: 1px solid #c8d0d8;
}

.scheduler-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.scheduler-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.scheduler-month-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid #c8d0d8;
  border-radius: 0.2rem;
  background: #fff;
  color: #445566;
  cursor: pointer;
}

.scheduler-month-btn:hover {
  background: #f4f7fa;
}

.scheduler-month-btn svg {
  width: 1rem;
  height: 1rem;
}

.scheduler-month-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #333;
}

.scheduler-month-label svg {
  width: 1.1rem;
  height: 1.1rem;
  color: #5b8dbd;
}

.scheduler-class-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--purple);
}

.scheduler-class-select {
  min-width: 10rem;
  margin-left: 0.35rem;
  padding: 0.25rem 1.75rem 0.25rem 0.45rem;
  border: 1px solid #c8b8dc;
  border-radius: 0.2rem;
  background-color: #fff;
  color: var(--purple-dark);
  font: inherit;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b4c9a' stroke-width='2.25'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  cursor: pointer;
}

.scheduler-class-select:focus {
  border-color: var(--purple);
  outline: none;
  box-shadow: 0 0 0 2px rgba(107, 76, 154, 0.18);
}

.scheduler-class-select--modal {
  width: 100%;
  margin-left: 0;
  box-sizing: border-box;
}

.scheduler-class-label-input {
  width: min(12rem, 100%);
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 0.2rem;
  background: transparent;
  color: var(--purple);
  font: inherit;
  font-weight: 600;
}

.scheduler-class-label-input:hover,
.scheduler-class-label-input:focus {
  border-color: #c8b8dc;
  background: rgba(255, 255, 255, 0.65);
  outline: none;
}

.scheduler-calendar {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

.scheduler-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--purple);
  color: var(--white);
}

.scheduler-weekday {
  padding: 0.55rem 0.35rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
}

.scheduler-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(6.5rem, 1fr);
  gap: 1px;
  background: #c8d0d8;
}

.scheduler-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 6.5rem;
  padding: 0.35rem 0.35rem 0.45rem;
  border: none;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.scheduler-day:hover {
  background: #f7f9fb;
}

.scheduler-day:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
  z-index: 1;
}

.scheduler-day--muted {
  background: #fafbfc;
}

.scheduler-day--muted .scheduler-day-number {
  color: #99a3ad;
}

.scheduler-day--today {
  box-shadow: inset 0 0 0 2px var(--purple);
}

.scheduler-day-number {
  align-self: flex-end;
  margin-bottom: 0.25rem;
  color: #667788;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.scheduler-day-classes {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 0;
  overflow: hidden;
}

.scheduler-class-chip {
  display: block;
  width: 100%;
  padding: 0.2rem 0.35rem;
  border: none;
  border-radius: 0.15rem;
  background: #ebe3f4;
  color: var(--purple-dark);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduler-class-chip:hover {
  background: #ddd0ef;
}

.scheduler-class-chip-time {
  display: block;
  color: #6a5788;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scheduler-day-events-modal {
  width: min(30rem, calc(100vw - 2rem));
  max-height: min(28rem, calc(100vh - 2rem));
}

.scheduler-day-events-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem 1rem;
}

.scheduler-day-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scheduler-day-event {
  padding: 0.75rem 0.85rem;
  border: 1px solid #d8dce3;
  border-radius: 0.35rem;
  background: #f8f9fb;
}

.scheduler-day-event--clickable {
  width: 100%;
  border: 1px solid #d8dce3;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
}

.scheduler-day-event--clickable:hover {
  border-color: #b8afc8;
  background: #f3f0f7;
}

.scheduler-student-event-detail {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.scheduler-student-event-detail-label {
  margin: 0;
  color: #6a5788;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.scheduler-student-event-detail-value {
  margin: 0;
  color: #334455;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.scheduler-day-event-time {
  margin: 0 0 0.35rem;
  color: #6a5788;
  font-size: 0.88rem;
  font-weight: 600;
}

.scheduler-day-event-title {
  margin: 0;
  color: var(--purple-dark);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.scheduler-day-event-desc {
  margin: 0.45rem 0 0;
  color: #445566;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.scheduler-day-event-link {
  display: inline-block;
  margin-top: 0.55rem;
  color: #2f6fad;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.scheduler-day-events-empty {
  margin: 0;
  color: #667788;
  font-size: 0.95rem;
  line-height: 1.45;
}

.scheduler-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.45);
}

.scheduler-modal-backdrop[hidden] {
  display: none;
}

.scheduler-modal {
  display: flex;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(20rem, calc(100vh - 2rem));
  background: #fff;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.scheduler-modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.75rem;
  background: var(--purple);
  color: #fff;
}

.scheduler-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.scheduler-modal-header-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.2rem;
}

.scheduler-modal-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.scheduler-event-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #ff6b6b;
  padding: 0.1rem;
  line-height: 0;
  cursor: pointer;
}

.scheduler-event-delete-btn:hover {
  color: #ff4747;
}

.scheduler-event-delete-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.scheduler-modal-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}

.scheduler-modal-scroll {
  display: flex;
  flex: 1;
  min-height: 0;
}

.scheduler-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  padding: 0.75rem 0.85rem 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scheduler-modal-body::-webkit-scrollbar {
  display: none;
}

.scheduler-modal-scroll-rail {
  position: relative;
  flex-shrink: 0;
  width: 0.7rem;
  background: #d7dee6;
  border-left: 1px solid #b8c5d0;
}

.scheduler-modal-scroll-thumb {
  position: absolute;
  top: 0;
  left: 2px;
  right: 2px;
  min-height: 2.5rem;
  background: #6f8498;
  border-radius: 0.35rem;
  transform: translateY(0);
  will-change: transform, height;
}

.scheduler-modal-scroll-rail--hidden {
  visibility: hidden;
}

.scheduler-field {
  display: block;
  margin-bottom: 0.65rem;
}

.scheduler-field--inline {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
}

.scheduler-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

.scheduler-field-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
}

.scheduler-field--inline .scheduler-field-label {
  margin-bottom: 0;
}

.scheduler-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid #c8d0d8;
  border-radius: 0.15rem;
  background: #fff;
  font: inherit;
  font-size: 0.92rem;
}

.scheduler-input:focus {
  border-color: #5b8dbd;
  outline: none;
  box-shadow: 0 0 0 1px rgba(91, 141, 189, 0.25);
}

.scheduler-input--fixed {
  pointer-events: none;
  cursor: default;
  user-select: none;
  background: #f4f6f8;
}

.scheduler-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: #333;
  cursor: pointer;
}

.scheduler-check--block {
  display: flex;
  margin-bottom: 0.65rem;
}

.scheduler-editor-toolbar {
  display: flex;
  gap: 0.15rem;
  margin-bottom: 0.35rem;
  padding: 0.25rem;
  border: 1px solid #c8d0d8;
  border-bottom: none;
  background: #f4f6f8;
}

.scheduler-editor-btn {
  min-width: 1.75rem;
  height: 1.75rem;
  border: 1px solid #d8dee6;
  border-radius: 0.15rem;
  background: #fff;
  color: #445566;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.scheduler-editor-btn:hover {
  background: #eef3f8;
}

.scheduler-editor {
  min-height: 3rem;
  max-height: 4.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #c8d0d8;
  background: #fff;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow: auto;
}

.scheduler-editor:focus {
  outline: none;
  border-color: #5b8dbd;
  box-shadow: 0 0 0 1px rgba(91, 141, 189, 0.25);
}

.scheduler-field--link .scheduler-link-wrap {
  position: relative;
  display: block;
}

.scheduler-link-wrap .scheduler-input {
  padding-right: 2rem;
}

.scheduler-link-icon {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  color: #5b8dbd;
  pointer-events: none;
}

.scheduler-link-icon svg {
  width: 1rem;
  height: 1rem;
}

.scheduler-reminder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.scheduler-reminder-select {
  width: auto;
  min-width: 7.5rem;
}

.scheduler-email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0;
}

.scheduler-email-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.scheduler-email-check .scheduler-check {
  margin-bottom: 0;
}

.scheduler-email-target-suffix {
  color: #555;
  font-size: 0.88rem;
}

.scheduler-class-select--email {
  min-width: 7.5rem;
  margin-left: 0;
  font-size: 0.88rem;
}

.scheduler-edit-email-btn {
  border: none;
  background: transparent;
  padding: 0;
  color: #4a90c6;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.scheduler-edit-email-btn:hover {
  color: #3d7fb0;
}

.scheduler-modal-backdrop--nested {
  z-index: 130;
}

.scheduler-email-modal {
  min-height: min(20rem, calc(100vh - 2rem));
}

.scheduler-email-modal .scheduler-modal-body {
  display: flex;
  flex-direction: column;
}

.scheduler-email-modal .scheduler-field:last-child {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.scheduler-editor--email {
  flex: 1;
  min-height: 8rem;
  max-height: none;
}

.scheduler-modal-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0;
  padding: 0.6rem 0.85rem 0.75rem;
  border-top: 1px solid #e8ecf0;
  background: #fff;
}

.scheduler-btn {
  border: none;
  border-radius: 0.15rem;
  padding: 0.5rem 1.35rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.scheduler-btn--save {
  background: #4a90c6;
  color: #fff;
}

.scheduler-btn--save:hover {
  background: #3d7fb0;
}

.scheduler-btn--delete {
  margin-left: auto;
  background: transparent;
  color: #b42318;
  text-transform: none;
  font-weight: 600;
}

.scheduler-btn--delete:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .scheduler-subnav {
    padding-right: 1rem;
  }

  .scheduler-toolbar {
    padding-inline: 0.85rem;
  }

  .scheduler-toolbar-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .scheduler-days {
    grid-auto-rows: minmax(5.5rem, 1fr);
  }

  .scheduler-day {
    min-height: 5.5rem;
  }

  .scheduler-class-chip {
    font-size: 0.62rem;
  }

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

  .scheduler-field--inline {
    grid-template-columns: 1fr;
  }
}
