#scheduleSurface {
  --schedule-line: #e0e8f6;
  --schedule-blue: #1455ed;
  --schedule-ink: #101939;
  --schedule-muted: #485d8b;
  --schedule-hour: 88px;
  --schedule-gutter: 60px;
  color: var(--schedule-ink);
}
#scheduleSurface [hidden] { display: none !important; }
.schedule-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding-block-start: clamp(24px, 3vw, 42px);
  padding-inline-end: 48px;
}
#scheduleSurface #calendarToday { display: inline-flex !important; }
.schedule-heading, .schedule-controls { display: flex; align-items: center; gap: 8px; }
.schedule-heading { margin-inline-end: auto; }
.schedule-controls { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.schedule-header h1 { font-size: clamp(26px, 2.7vw, 36px); line-height: 1.15; margin: 0; }
#scheduleSurface #scheduleMenuToggle {
  gap: 14px;
  padding-inline: 18px;
  border: 0;
  border-radius: 999px;
  background: #dfeafd;
  color: #080f31;
  font-size: 14px;
  font-weight: 750;
}
#scheduleSurface #scheduleMenuToggle:hover { background: #d5e3fc; }
#scheduleMenuToggle svg { flex: none; width: 19px; height: 19px; }

.schedule-header button, .schedule-date,
.schedule-dialog footer button, .schedule-detail-actions a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--schedule-line);
  border-radius: 10px;
  background: #fff;
  color: var(--schedule-ink);
  font: inherit;
  white-space: nowrap;
}
.schedule-header button.primary, .schedule-dialog button.primary {
  background: var(--schedule-blue);
  border-color: var(--schedule-blue);
  color: white;
}
.schedule-navigation { display: flex; min-width: 0; align-items: stretch; gap: 5px; }
.schedule-navigation > button { min-width: 34px; font-size: 22px; line-height: 1; }
.schedule-date { position: relative; min-width: 0; max-width: 100%; text-align: center; font-weight: 700; font-size: 14px; }
.schedule-date span { white-space: normal; }
.schedule-date:focus-within { outline: 2px solid var(--schedule-blue); }
#schedulePeriod { margin: 18px 0 14px; font-size: clamp(16px, 2vw, 21px); }
#scheduleDays { overflow-x: auto; padding-bottom: 4px; }
.schedule-timeline { border: 1px solid var(--schedule-line); border-radius: 14px; background: white; overflow: hidden; }
.schedule-week { min-width: 810px; }
.schedule-day-head, .schedule-hours, .schedule-all-day {
  display: grid;
  grid-template-columns: var(--schedule-gutter) repeat(var(--days), minmax(0, 1fr));
}
.schedule-day-head button {
  display: grid; gap: 3px; padding: 10px 3px;
  background: #fff; border: 0; border-inline-start: 1px solid var(--schedule-line); color: var(--schedule-ink);
}
.schedule-day-head span, .schedule-all-day > span { color: var(--schedule-muted); font-size: 12px; }
.schedule-day-head .is-today { box-shadow: inset 0 3px var(--schedule-blue); background: #edf3ff; }
.schedule-all-day { border-top: 1px solid var(--schedule-line); }
.schedule-all-day > * { padding: 4px; border-inline-start: 1px solid var(--schedule-line); min-width: 0; }
.schedule-all-day .schedule-card { container-type: inline-size; width: 100%; margin-bottom: 3px; }
.schedule-scroll { max-height: min(690px, 72dvh); overflow-y: auto; scrollbar-width: none; }
.schedule-column { position: relative; border-inline-start: 1px solid var(--schedule-line); }
.schedule-week .schedule-column.is-today { background: #f0f5ff; }
.schedule-slot, .schedule-hour-labels time {
  display: block; width: 100%; height: var(--schedule-hour); border: 0;
  border-top: 1px solid var(--schedule-line); background: transparent;
}
.schedule-slot:hover, .schedule-slot:focus-visible { background: #e9f2ff; }
.schedule-slot:focus-visible { outline-offset: -2px; }
.schedule-hour-labels time { padding: 9px 4px; text-align: center; color: var(--schedule-muted); font-size: 13px; }
.schedule-card {
  display: block;
  min-width: 0;
  padding: 3px 6px 3px 8px;
  text-align: start;
  overflow: hidden;
  background: #f7f5ff;
  border: 1px solid #e5dff6;
  border-radius: 9px;
  color: var(--schedule-ink);
  line-height: 1.15;
}
.schedule-card[data-kind="work"] { background: #f1f6ff; border-color: #dce7fa; }
.schedule-card:hover { border-color: #aabfe8; }
.schedule-card:focus-visible { outline: 2px solid var(--schedule-blue); outline-offset: -2px; }
.schedule-card > * { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.schedule-card b { font-size: 13px; }
.schedule-card small { font-size: 11px; color: var(--schedule-muted); margin-block-start: 3px; }
.schedule-card .schedule-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-block-start: 5px; font-size: 11px; color: var(--schedule-muted); }
.schedule-card-meta span { overflow: hidden; text-overflow: ellipsis; border-radius: 5px; padding: 2px 4px; background: #e5edfc; }
.schedule-card-meta time { flex: none; margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.schedule-column .schedule-card {
  position: absolute;
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 5px 8px;
  top: calc(var(--start) * var(--schedule-hour) + 3px);
  height: max(30px, calc(var(--duration) * var(--schedule-hour) - 6px));
  max-height: calc((24 - var(--start)) * var(--schedule-hour) - 3px);
  inset-inline-start: calc(var(--lane) * 100% / var(--lanes) + 3px);
  width: calc(100% / var(--lanes) - 6px);
  z-index: 1;
}
.schedule-column .schedule-card-meta { margin-block-start: auto; }
@container (max-width: 124px) {
  .schedule-card-meta:has(time) span { display: none; }
}
@container (max-height: 48px) {
  .schedule-column .schedule-card small { display: none; }
}
@container (max-height: 27px) {
  .schedule-column .schedule-card-meta { display: none; }
}
.schedule-now {
  position: absolute; inset-inline: 0; top: calc(var(--now) * var(--schedule-hour));
  border-top: 1px solid #ed3a43; pointer-events: none; z-index: 2;
}
.schedule-now::before { content: ''; position: absolute; inset: -4px auto auto -3px; width: 7px; height: 7px; background: #ed3a43; border-radius: 50%; }
.schedule-month { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); border: 1px solid var(--schedule-line); border-radius: 14px; overflow: hidden; background: white; }
.schedule-month > b { text-align: center; padding: 8px 0; font-size: 12px; }
.schedule-month-day { min-width: 0; min-height: 84px; padding: 3px; border: solid var(--schedule-line); border-width: 1px 1px 0 0; }
.schedule-month-day.outside { background: #f5f7fb; }
.schedule-month-day > button:not(.schedule-card) { border: 0; border-radius: 6px; background: transparent; color: inherit; min-width: 23px; min-height: 22px; }
.schedule-month-day > button[aria-current] { background: var(--schedule-blue); color: white; }
.schedule-month-day .schedule-card { width: 100%; margin-top: 3px; }
.schedule-month-day .schedule-card small, .schedule-month-day .schedule-card-meta { display: none; }

.schedule-dialog {
  width: min(460px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #d4def0;
  border-radius: 18px;
  background: #fff;
  color: var(--schedule-ink);
  box-shadow: 0 14px 40px #172b5433;
  overflow: hidden;
}
.schedule-dialog::backdrop { background: #14254845; }
.schedule-dialog form, .schedule-details[open] { display: flex; flex-direction: column; max-height: inherit; min-height: 0; }
.schedule-dialog header, .schedule-dialog footer { padding: 15px 20px; display: flex; align-items: center; gap: 8px; flex: none; }
.schedule-dialog header { justify-content: space-between; }
.schedule-dialog footer { justify-content: flex-end; border-top: 1px solid var(--schedule-line); flex-wrap: wrap; }
.schedule-dialog h2 { font-size: 24px; margin: 0; overflow-wrap: anywhere; }
.schedule-dialog header button { border: 0; background: transparent; color: inherit; font-size: 23px; line-height: 1; width: 36px; height: 36px; }
.schedule-fields, .schedule-detail-copy { padding: 0 20px 16px; overflow-y: auto; min-height: 0; }
.schedule-fields { display: grid; gap: 12px; }
.schedule-fields label { display: grid; min-width: 0; gap: 4px; font-size: 14px; font-weight: 650; }
.schedule-fields :is(input,select,textarea):not([type=checkbox]) {
  width: 100%; min-width: 0; font: inherit; font-weight: 400; color: inherit;
  border: 1px solid #c9d7ee; border-radius: 9px; padding: 8px 10px; min-height: 40px; background: white;
}
.schedule-fields textarea { resize: vertical; }
.schedule-times { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.schedule-fields .schedule-check { display: flex; align-items: center; gap: 8px; }
.schedule-fields input[type=checkbox] { accent-color: var(--schedule-blue); width: 17px; height: 17px; }
.schedule-error { margin: 0; color: #bd2239; }
.schedule-details { position: fixed; margin: 0; width: min(330px,calc(100% - 24px)); }
.schedule-details h2 { font-size: 20px; }
.schedule-detail-copy time { color: var(--schedule-muted); font-size: 13px; }
.schedule-detail-copy p { white-space: pre-wrap; overflow-wrap: anywhere; }
.schedule-detail-copy h3 { font-size: 14px; margin-block: 12px 6px; }
.schedule-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.schedule-detail-actions a { color: var(--schedule-blue); text-decoration: none; }
@media (max-width: 720px) {
  #scheduleSurface { --schedule-gutter: 53px; --schedule-hour: 66px; }
  .schedule-header { padding-block-start: 16px; padding-inline-end: 0; gap: 7px; }
  .schedule-heading, .schedule-controls { flex-basis: 100%; }
  .schedule-controls { gap: 7px; }
  .schedule-navigation { flex: 1 1 175px; }
  .schedule-date { flex: 1; padding-inline: 4px; font-size: 12px; }
  .schedule-header button { padding-inline: 7px; font-size: 13px; }
  .schedule-navigation > button { min-width: 30px; font-size: 21px; }
  .schedule-scroll { max-height: 70dvh; }
  .schedule-timeline:not(.schedule-week) .schedule-scroll { touch-action: pan-y; }
  .schedule-details { inset: auto 12px max(12px,env(safe-area-inset-bottom)); width: auto; }
  .schedule-dialog header, .schedule-dialog footer { padding: 12px 16px; }
  .schedule-fields, .schedule-detail-copy { padding-inline: 16px; }
  .schedule-fields :is(input,select,textarea):not([type=checkbox]) { font-size: 16px; }
  .schedule-month-day { min-height: 58px; }
}

#scheduleSurface #scheduleMenuToggle { display: none; }
@media (min-width: 901px) {
  #scheduleSurface #scheduleMenuToggle { display: inline-flex; }
  body:not(.auth-locked):has(:is(#calendarView,#homeView).active > #scheduleSurface.schedule-menu-collapsed) > .sidebar { display: none !important; }
  body:not(.auth-locked):has(:is(#calendarView,#homeView).active > #scheduleSurface.schedule-menu-collapsed) > main { margin-left: 0 !important; }
}

.schedule-card b { font-size: 12.5px; }
.schedule-card .schedule-card-meta { gap: 4px; font-size: 10px; }
.schedule-card-meta time { display: inline-flex; align-items: center; gap: 3px; line-height: 1; }
.schedule-card-meta svg { flex: none; width: 12px; height: 12px; }
.schedule-card .schedule-badge, .schedule-details footer .schedule-badge {
  padding: 2px 5px;
  border: 1px solid #c9d9f5;
  border-radius: 7px;
  background: #f4f8ff;
  color: #365684;
  font-weight: 600;
}
:is(.schedule-card, .schedule-details footer) .schedule-badge[data-state="past"] { background: #f4f5f8; border-color: #d9dee8; color: #4d5a71; }
:is(.schedule-card, .schedule-details footer) .schedule-badge[data-state="done"] { background: #edf8f2; border-color: #bcdcca; color: #23644c; }
:is(.schedule-card, .schedule-details footer) .schedule-badge[data-state="not_done"] { background: #fff2f3; border-color: #ecc9d0; color: #9a3648; }
.schedule-details footer .schedule-badge { min-height: 32px; font-size: 12px; }
.schedule-details footer .schedule-badge[aria-pressed="true"] { box-shadow: inset 0 0 0 1px currentColor; }
@container (max-width: 84px) {
  .schedule-card-meta svg { display: none; }
}


#homeView > #scheduleSurface ~ .exam-dashboard { display: none !important; }
#homeView > #scheduleSurface { margin-bottom: 24px; }

.schedule-details {
  --detail-padding: clamp(16px, 3vw, 24px);
  background: linear-gradient(90deg, #d8adf8 0 7px, #fff 7px);
  box-shadow: 0 15px 36px #18356530;
}
@media (min-width: 721px) {
  .schedule-details { width: min(410px, calc(100% - 24px)); }
}
.schedule-details header,
.schedule-details .schedule-detail-copy,
.schedule-details footer { padding-inline: var(--detail-padding); }
.schedule-details header { padding-block: 18px 8px; }
.schedule-details header h2 { font-size: clamp(19px, 3vw, 24px); line-height: 1.2; }
.schedule-details header button { flex: 0 0 36px; border-radius: 8px; }
.schedule-details .schedule-detail-copy time { font-size: 15px; }
.schedule-details .schedule-detail-copy h3 { margin-block: 16px 8px; font-size: 16px; }
.schedule-details .schedule-material-link {
  min-height: 42px;
  padding-inline: 16px;
  border: 0;
  border-radius: 999px;
  background: #dfeafd;
  color: #080f31;
  font-weight: 750;
}
.schedule-details .schedule-material-link:hover { background: #d5e3fc; }
.schedule-details footer {
  display: grid;
  justify-content: stretch;
  gap: 10px;
  padding-block: 14px;
}
.schedule-status-row,
.schedule-edit-row { display: grid; gap: 6px; }
.schedule-status-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.schedule-details footer .schedule-badge {
  min-width: 0;
  min-height: 38px;
  padding: 6px 4px;
  line-height: 1.2;
  white-space: normal;
}
.schedule-edit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.schedule-details .schedule-edit-row button { border: none; background: transparent; font-weight: 650; color: var(--schedule-muted); }
.schedule-details .schedule-edit-row [data-delete] { color: #ab2440; }
.schedule-details .schedule-edit-row button:hover { background: #f3f6fb; }


#scheduleSurface {
  margin-block-start: clamp(12px, 2.5vw, 26px);
  padding: clamp(14px, 2.15vw, 28px);
  border: 1px solid #dce6f7;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 9px #16366518;
}
.schedule-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 12px;
  padding: 0;
}
.schedule-heading { gap: clamp(14px, 2.5vw, 28px); margin: 0; }
.schedule-heading h1 { font-size: clamp(27px, 3vw, 42px); font-weight: 800; }

.schedule-controls {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}
.schedule-navigation { gap: 10px; }
.schedule-navigation > button { min-width: 42px; }
.schedule-date { gap: 10px; padding-inline: 13px; }
.schedule-date::after, .schedule-mode-picker::after {
  content: '';
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}
.schedule-mode-picker { position: relative; margin-inline-start: auto; color: var(--schedule-ink); }
.schedule-mode-picker::after { position: absolute; inset-inline-end: 14px; top: 46%; }
#scheduleMode {
  appearance: none;
  min-height: 40px;
  padding: 6px 32px 6px 13px;
  border: 1px solid var(--schedule-line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 700;
}
#scheduleSurface[data-schedule-mode="month"] #schedulePeriod {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
#scheduleSurface[data-schedule-mode="month"] #scheduleDays { margin-block-start: 12px; }
.schedule-month {
  grid-template-rows: auto repeat(6, minmax(clamp(72px, calc((100dvh - 235px) / 6), 140px), 1fr));
}
.schedule-month > b { padding-block: 10px; }
.schedule-month-day { padding: 8px 10px; }
.schedule-month-day > button:not(.schedule-card) { font-weight: 650; }
@media (max-width: 720px) {
  #scheduleSurface { margin-block-start: 10px; }

  .schedule-navigation { gap: 4px; }
  .schedule-navigation > button { min-width: 28px; }
  .schedule-date { padding-inline: 6px; gap: 5px; }
  .schedule-month { grid-template-rows: auto repeat(6, minmax(64px, 1fr)); }
  .schedule-month-day { padding-inline: 3px; }
}

.schedule-header .schedule-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
#scheduleSurface .schedule-actions #scheduleAdd {
  min-height: 40px;
  gap: 8px;
  padding-inline: 16px;
  border: 0;
  border-radius: 999px;
  background: #dfeafd;
  color: #080f31;
  font-weight: 750;
}
#scheduleSurface .schedule-actions #scheduleAdd:hover { background: #d5e3fc; }
#scheduleAdd svg { flex: none; width: 18px; height: 18px; }
@media (min-width: 721px) {
  #scheduleSurface .schedule-header :is(.schedule-navigation > button, .schedule-date, #calendarToday, #scheduleMode) { min-height: 44px; }
  #scheduleSurface #schedulePeriod { margin-block: 20px 16px; }
}
body:not(.auth-locked) #scheduleSurface .schedule-actions .utility-bar {
  position: relative !important;
  inset: auto !important;
  margin: 0 !important;
}
#scheduleSurface .schedule-actions #themeToggle { display: none !important; }
#scheduleSurface .schedule-actions #notificationToggle {
  width: 44px !important;
  height: 44px !important;
  min-height: 44px;
  box-shadow: none !important;
}


#scheduleSurface .schedule-header .schedule-date { font-size: 14px; font-weight: 700; }
#scheduleSurface .schedule-date[aria-expanded="true"] {
  border-color: var(--schedule-blue);
  box-shadow: 0 0 0 1px var(--schedule-blue);
}
#scheduleDatePicker {
  position: fixed;
  inset: auto;
  box-sizing: border-box;
  width: min(290px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--schedule-line);
  border-radius: 15px;
  background: #fff;
  color: var(--schedule-ink);
  box-shadow: 0 8px 22px #162b5924;
  overflow: auto;
}
.schedule-picker-head { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; text-align: center; }
.schedule-picker-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); justify-items: center; margin-top: 5px; }
.schedule-picker-grid span { display: grid; place-items: center; height: 32px; font-size: 12px; font-weight: 650; }
#scheduleDatePicker button {
  min-height: 32px;
  min-width: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}
#scheduleDatePicker .schedule-picker-head button { font-size: 21px; }
#scheduleDatePicker button.outside { color: #647492; }
#scheduleDatePicker button:hover { background: #edf3ff; }
#scheduleDatePicker button[aria-pressed="true"] { border-radius: 50%; color: white; background: var(--schedule-blue); }
#scheduleDatePicker .schedule-picker-today {
  width: 100%;
  margin-top: 6px;
  border-top: 1px solid var(--schedule-line);
  border-radius: 0;
  color: var(--schedule-blue);
}

.schedule-card[data-movable] { cursor: grab; touch-action: none; user-select: none; }
.schedule-card.schedule-dragging { opacity: .45; cursor: grabbing; }
#scheduleDays .schedule-drop-target { background: #dfeaff; box-shadow: inset 0 0 0 2px var(--schedule-blue); }

.schedule-details .schedule-detail-actions{margin-top:20px;gap:10px}
.schedule-details .schedule-material-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:12px 20px;line-height:1.25;text-align:center}
