/* The student-facing reschedule flow intentionally has its own bounded dialog.
   Shared viewer dialogs otherwise clip the form, explanation and submit button. */
.reschedule-dialog {
  width: min(1000px, calc(100vw - 32px));
  max-width: 1000px;
  height: fit-content !important;
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 28px;
  background: var(--paper, #f9f8f3);
  color: var(--ink, #161616);
  box-shadow: 0 32px 95px rgba(9, 19, 38, .29);
}
.reschedule-dialog::backdrop {
  background: rgba(7, 19, 45, .55);
  backdrop-filter: blur(7px);
}
.reschedule-dialog :is(button, input, textarea):focus-visible {
  outline: 3px solid var(--blue, #054ff0);
  outline-offset: 3px;
}
.reschedule-dialog__topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line, #d9d8d2);
  background: var(--paper, #f9f8f3);
}
.reschedule-dialog__brand {
  color: var(--blue, #054ff0);
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: -.025em;
}
.reschedule-dialog__close {
  min-width: 84px;
  min-height: 40px;
  padding: 8px 15px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink, #161616);
  font: 700 .85rem HelveticaM, Helvetica, Arial, sans-serif;
}
.reschedule-dialog__close:hover { border-color: var(--blue, #054ff0); }
.reschedule-dialog__intro {
  padding: 34px 36px 27px;
  background: var(--green, #dcfc73);
  color: #161616;
}
.reschedule-dialog__eyebrow, .reschedule-original__step, .student-picker-kicker {
  display: block;
  margin: 0 0 8px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.reschedule-dialog__intro h2 {
  max-width: 720px;
  margin: 0 0 10px;
  font-family: "De Fonte Plus", HelveticaM, sans-serif;
  font-size: clamp(2.4rem, 5vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -.04em;
}
.reschedule-dialog__intro > p:last-child {
  max-width: 700px;
  margin: 0;
  font-size: .92rem;
  line-height: 1.6;
}
.reschedule-original {
  margin: 24px 28px 0;
  padding: 24px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 22px;
  background: var(--res-card, #fff);
}
.reschedule-original__header { margin-bottom: 16px; }
.reschedule-original__step, .student-picker-kicker { color: var(--blue, #054ff0); }
.reschedule-original h3, .student-picker-confirmation h3 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.1;
  font-family: "De Fonte Plus", HelveticaM, sans-serif;
}
.reschedule-original__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}
.reschedule-original__field { display: grid; gap: 8px; min-width: 0; }
.reschedule-original__field label, .student-picker-reason-label {
  display: block;
  font-size: .86rem;
  font-weight: 700;
}
.reschedule-original input, .student-picker-confirmation textarea {
  width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 13px;
  background: var(--res-field, #f9f8f3);
  color: var(--ink, #161616);
  font: inherit;
}
.reschedule-original input { min-height: 48px; }
.reschedule-original__help, .student-picker-help {
  margin: 0;
  color: var(--muted, #66666d);
  font-size: .76rem;
  line-height: 1.5;
}
.reschedule-original__button, .student-picker-submit {
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--blue, #054ff0);
  border-radius: 999px;
  background: var(--blue, #054ff0);
  color: #fff;
  font: 700 .9rem HelveticaM, Helvetica, Arial, sans-serif;
  white-space: nowrap;
}
.reschedule-original__button:hover:not(:disabled), .student-picker-submit:hover:not(:disabled) {
  background: #003ccc;
  border-color: #003ccc;
}
.reschedule-dialog button:disabled { cursor: not-allowed; opacity: .45; }
.reschedule-original__status {
  min-height: 1em;
  margin: 12px 0 0;
  color: var(--muted, #66666d);
  font-size: .8rem;
}
.reschedule-picker-shell { margin: 20px 28px 0; }
.reschedule-picker-shell[hidden] { display: none !important; }
.student-slot-picker {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, .8fr);
  grid-template-areas:
    "heading heading"
    "note note"
    "toolbar toolbar"
    "slots confirmation"
    "status confirmation";
  column-gap: 16px;
  align-items: start;
  padding: 24px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 22px;
  background: var(--res-card, #fff);
}
.student-picker-title {
  grid-area: heading;
  margin: 0;
  font-family: "De Fonte Plus", HelveticaM, sans-serif;
  font-size: 1.9rem;
  line-height: 1.1;
}
.student-picker-note {
  grid-area: note;
  max-width: 680px;
  margin: 8px 0 18px;
  color: var(--muted, #66666d);
  font-size: .86rem;
  line-height: 1.55;
}
.student-picker-toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 0 17px;
  border-top: 1px solid var(--line, #d9d8d2);
}
.student-picker-range {
  margin: 0;
  font-size: .84rem;
  font-weight: 700;
}
.student-picker-toolbar-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.student-picker-week-button, .student-picker-reload {
  padding: 8px 11px;
  min-height: 36px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink, #161616);
  font-size: .75rem;
  font-weight: 700;
}
.student-picker-week-button:hover:not(:disabled), .student-picker-reload:hover:not(:disabled) {
  border-color: var(--blue, #054ff0);
  color: var(--blue, #054ff0);
}
.student-slot-list { grid-area: slots; display: grid; gap: 14px; min-width: 0; }
.student-slot-day {
  padding: 14px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 16px;
  background: var(--res-subtle, #f9f8f3);
}
.student-slot-day-title {
  margin: 0 0 12px;
  font-family: HelveticaM, Helvetica, Arial, sans-serif;
  font-size: .8rem;
  font-weight: 700;
}
.student-slot-day-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reschedule-dialog .student-slot-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: 100%;
  padding: 9px 7px;
  margin: 0;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 11px;
  background: var(--res-card, #fff);
  color: var(--ink, #161616);
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.student-slot-time { font-size: .78rem; font-weight: 700; line-height: 1.3; }
.reschedule-dialog .student-slot-option:hover:not(:disabled) {
  border-color: var(--blue, #054ff0);
  box-shadow: 0 0 0 1px var(--blue, #054ff0);
}
.reschedule-dialog .student-slot-option[aria-pressed="true"] {
  border-color: var(--blue, #054ff0);
  background: var(--blue, #054ff0);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--blue, #054ff0);
}
.reschedule-dialog .student-slot-option[aria-pressed="true"] .student-slot-time::before {
  content: "✓";
  margin-right: 6px;
  font-weight: 900;
}
.student-picker-confirmation {
  grid-area: confirmation;
  position: sticky;
  top: 84px;
  min-width: 0;
  padding: 19px;
  border-radius: 17px;
  background: var(--res-subtle, #f9f8f3);
  border: 1px solid var(--line, #d9d8d2);
}
.student-picker-confirmation h3 { font-size: 1.3rem; }
.student-picker-selected {
  margin: 15px 0 0;
  padding: 12px;
  border: 1px dashed var(--line, #d9d8d2);
  border-radius: 12px;
  background: var(--res-card, #fff);
  font-size: .84rem;
  line-height: 1.45;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.student-picker-selected.is-chosen { border: 1px solid var(--blue, #054ff0); color: var(--blue, #054ff0); }
.student-picker-selected-hint {
  margin: 7px 0 18px;
  color: var(--muted, #66666d);
  font-size: .76rem;
  line-height: 1.45;
}
.student-picker-reason-label { margin-bottom: 8px; }
.student-picker-confirmation textarea { display: block; resize: vertical; min-height: 92px; margin-bottom: 7px; }
.student-picker-submit { width: 100%; margin-top: 18px; }
.student-picker-submit-help { min-height: 1.5em; margin: 8px 0 0; color: var(--muted, #66666d); font-size: .75rem; line-height: 1.5; }
.student-picker-status {
  grid-area: status;
  margin: 13px 0 0;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--res-subtle, #f9f8f3);
  color: var(--ink, #161616);
  font-size: .8rem;
  line-height: 1.5;
}
.student-picker-status:empty { display: none; }
.student-picker-status[data-kind="success"] { background: var(--green, #dcfc73); color: #161616; }
.student-picker-status[data-kind="error"] { background: #fff0eb; color: #9b311c; }
.reschedule-history {
  margin: 20px 28px 28px;
  padding: 16px 20px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 17px;
  background: var(--res-card, #fff);
}
.reschedule-history summary { cursor: pointer; font-size: .85rem; font-weight: 700; }
.reschedule-history__body { padding-top: 10px; }
.reschedule-history__body > h3 { margin: 8px 0; font-size: 1.1rem; }
.reschedule-history__body article {
  margin: 8px 0;
  padding: 14px;
  border: 1px solid var(--line, #d9d8d2);
  border-radius: 12px;
  background: var(--res-subtle, #f9f8f3);
}
.reschedule-history__body article p { margin: 3px 0; font-size: .78rem; line-height: 1.5; }
.reschedule-history__body button { padding: 9px 13px; border: 1px solid var(--blue, #054ff0); border-radius: 999px; background: transparent; color: var(--blue, #054ff0); }
@media (max-width: 760px) {
  .reschedule-dialog { width: calc(100vw - 18px); max-height: calc(100dvh - 18px); border-radius: 21px; }
  .reschedule-dialog__topbar { padding: 12px 18px; }
  .reschedule-dialog__intro { padding: 28px 21px; }
  .reschedule-original, .reschedule-picker-shell { margin: 14px 12px 0; }
  .reschedule-original { padding: 18px; }
  .reschedule-original__row { grid-template-columns: 1fr; }
  .reschedule-original__button { width: 100%; }
  .student-slot-picker {
    padding: 17px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "note" "toolbar" "slots" "status" "confirmation";
  }
  .student-picker-confirmation { position: static; margin-top: 16px; }
  .reschedule-history { margin: 15px 12px 18px; }
}
@media (max-width: 400px) {
  .student-slot-day-grid { grid-template-columns: 1fr; }
  .student-picker-toolbar-actions { width: 100%; }
  .student-picker-week-button { flex: 1; }
  .student-picker-reload { width: 100%; }
}
html[data-appearance="dark"] .reschedule-dialog {
  --res-card: #242326;
  --res-subtle: #302e33;
  --res-field: #302e33;
}
html[data-appearance="dark"] .student-picker-status[data-kind="error"] { background: #512922; color: #ffc3b7; }
@media (prefers-reduced-motion: reduce) {
  .reschedule-dialog .student-slot-option { transition: none; }
}
