/* Timeline schedule — layout & FullCalendar overrides */
:root {
  --slot-row-height: 96px;
  --slot-row-height-min: 96px;
  --event-shadow: rgba(79, 168, 122, 0.16);
  --tl-axis-width: 88px;
  --page-gutter: 20px;
  --panel-gap: 12px;
  --panel-radius: 14px;
  --panel-bg: rgba(255, 255, 255, 0.78);
  --panel-border: 1px solid var(--line);
  --panel-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  --panel-shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.05);
}

html[data-site-theme="candy"] {
  --event-shadow: rgba(255, 92, 138, 0.18);
}
html[data-site-theme="slate"] {
  --event-shadow: rgba(74, 122, 184, 0.16);
}
html[data-site-theme="sage"] {
  --event-shadow: rgba(79, 168, 122, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  color: #333;
  display: flex;
  flex-direction: column;
}

.timeline-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: var(--panel-gap);
  padding: 10px var(--page-gutter) 0;
}

.timeline-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--panel-shadow);
}
.tb-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}
.tb-nav-group {
  flex-shrink: 0;
}
.tb-schedule-group {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 6px;
}
.tb-schedule-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.tb-schedule-actions .tbtn {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 10px;
  white-space: nowrap;
}
.tb-view-group {
  flex-shrink: 0;
}
.tb-action-group {
  margin-left: auto;
  flex-shrink: 0;
}
.timeline-toolbar .mode-nav {
  display: flex;
  gap: 4px;
}
.current-schedule-info {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 4px;
  line-height: 1.35;
}
.current-schedule-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #4a3f55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.current-schedule-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #8a7f92;
  min-height: 16px;
  flex-shrink: 0;
}
.save-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.save-status.idle {
  display: none;
}
.save-status.saving::before {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid color-mix(in srgb, var(--app-fg) 22%, transparent);
  border-top-color: var(--app-fg);
  border-radius: 50%;
  animation: save-spin 0.65s linear infinite;
}
.save-status.saved::before {
  content: "✓";
  font-size: 12px;
  font-weight: 800;
  color: #43a047;
  line-height: 1;
}
.save-status-text {
  white-space: nowrap;
}
.save-status-text.is-saving {
  color: var(--app-fg);
  font-weight: 600;
}
.save-status-text.is-saved {
  color: #5d6b63;
}
@keyframes save-spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 899px) {
  .timeline-shell .timeline-toolbar {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
  }
  .timeline-shell .timeline-toolbar .tb-group {
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
  }
  .timeline-shell .timeline-toolbar .tb-nav-group {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }
  .timeline-shell .timeline-toolbar .mode-nav {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
  }
  .timeline-shell .timeline-toolbar .mode-link {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
  }
  .timeline-shell .timeline-toolbar .tb-schedule-group {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }
  .timeline-shell .timeline-toolbar .current-schedule-info {
    width: 100%;
    min-width: 0;
  }
  .timeline-shell .timeline-toolbar .current-schedule-meta {
    min-width: 0;
  }
  .timeline-shell .timeline-toolbar .save-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
  }
  .timeline-shell .timeline-toolbar .tb-schedule-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .timeline-shell .timeline-toolbar .tb-schedule-actions .tbtn {
    width: 100%;
    min-height: 44px;
  }
  .timeline-shell .timeline-toolbar .tb-view-group {
    flex-wrap: wrap;
    gap: 8px;
  }
  .timeline-shell .timeline-toolbar .tb-view-group .tbtn,
  .timeline-shell .timeline-toolbar .tb-view-group .zbtn {
    min-height: 44px;
  }
  .timeline-shell .timeline-toolbar .tb-view-group input[type="range"] {
    flex: 1 1 120px;
    width: auto;
    min-width: 120px;
    max-width: 100%;
  }
  .timeline-shell .timeline-toolbar .tb-action-group {
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .timeline-shell .timeline-toolbar .tb-action-group .tbtn {
    min-height: 44px;
  }
  .timeline-shell .timeline-toolbar #sidebarToggle {
    min-height: 44px;
    min-width: 44px;
  }
}
.tb-view-group input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
  cursor: pointer;
}
.slot-height-value {
  min-width: 44px;
  text-align: center;
}
.tb-label { font-size: 13px; color: var(--teacher); }
.tbtn {
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 7px 14px;
  background: var(--btn);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
}
.tbtn.ghost {
  background: transparent;
  color: var(--app-fg);
  border: 1.5px solid var(--line);
}
.tbtn:hover { opacity: 0.9; }
.tbtn:disabled { opacity: 0.6; cursor: wait; }

.timeline-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: var(--panel-gap);
}

#sidebar {
  width: 252px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--panel-gap);
}
.sb-group {
  padding: 12px 14px;
  border-radius: var(--panel-radius);
  background: var(--panel-bg);
  border: var(--panel-border);
  box-shadow: var(--panel-shadow);
}
.sb-pool-group {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sb-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--app-fg);
  text-align: left;
}
.sb-group-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--teacher);
  letter-spacing: 0.02em;
}
.sidebar-btn-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.sidebar-io-group {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.sidebar-io-group .tbtn {
  flex: 1;
  padding: 5px 6px;
  font-size: 11px;
  white-space: nowrap;
}
#external-events-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

#external-events-list .pool-course {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 8px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
}
#external-events-list .pool-course.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 143, 177, 0.35);
}
#external-events-list .pool-drag-handle {
  flex: 0 0 28px;
  border: none;
  background: rgba(0,0,0,0.04);
  color: #999;
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
#external-events-list .pool-drag-handle:active { cursor: grabbing; }
#external-events-list .pool-course-body {
  flex: 1;
  min-width: 0;
  padding: 8px 4px 8px 0;
  cursor: pointer;
  text-align: center;
}
.tb-view-group .time-range-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.view-time-range-label {
  font-weight: 700;
  color: var(--app-fg);
}
.time-range-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--teacher);
}
.time-range-group input[type="time"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: #444;
  background: #fff;
}
#external-events-list .pool-course-edit,
#external-events-list .pool-course-delete {
  flex: 0 0 34px;
  border: none;
  border-left: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
#external-events-list .pool-course-edit {
  color: var(--app-fg);
}
#external-events-list .pool-course-delete {
  color: #d32f2f;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
#external-events-list .pool-course-delete:hover {
  background: #ffebee;
}
#external-events-list .pool-course-edit:hover,
#external-events-list .pool-course-body:hover {
  background: rgba(255, 240, 245, 0.7);
}
#external-events-list .course-name {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: #4a3f55;
}
#external-events-list .course-duration {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #8a7f92;
}
.pool-hint {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  line-height: 1.5;
  color: var(--teacher);
  text-align: left;
}

.calendar-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#calendar-container {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
  min-width: 0;
  min-height: 0;
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow-lg);
  overflow: hidden;
  position: relative;
}
#calendar {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.fc .fc-scrollgrid,
.fc .fc-scrollgrid-sync-table {
  width: 100% !important;
}
.fc .fc-col-header-cell:not(.fc-timegrid-axis),
.fc .fc-timegrid-col {
  min-width: 0;
}

/* Keep weekday header in document flow so drag/resize does not flash */
.fc .fc-scrollgrid-section-header > * {
  position: static !important;
  top: auto !important;
}
.fc .fc-scrollgrid-section-header .fc-col-header {
  box-shadow: none;
}

/* FullCalendar 边框统一为主题色 */
.fc-theme-standard td,
.fc-theme-standard th {
  border-color: var(--line) !important;
}
.fc-theme-standard .fc-scrollgrid {
  border-color: var(--line) !important;
}
.fc .fc-scrollgrid-section-header .fc-timegrid-axis,
.fc .fc-scrollgrid-section-header .fc-col-header-cell {
  border-color: var(--line) !important;
  border-top: none !important;
}
.fc .fc-scrollgrid-section-header .fc-timegrid-axis {
  border-right: 1px solid var(--line) !important;
}

/* Time axis column — FC6 uses axis-chunk flex layout */
.fc .fc-timegrid-axis-chunk {
  flex: 0 0 var(--tl-axis-width);
  width: var(--tl-axis-width);
  min-width: var(--tl-axis-width);
  max-width: var(--tl-axis-width);
  border-right: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.fc .fc-scrollgrid-section-header .fc-timegrid-axis {
  width: var(--tl-axis-width);
  min-width: var(--tl-axis-width);
  max-width: var(--tl-axis-width);
  border-right: 1px solid var(--line);
  background: #fff;
}
.fc .fc-scrollgrid-section-header {
  background: #fff;
}
.fc .fc-col-header {
  background: #fff;
}
.fc .fc-scrollgrid {
  border: 1px solid var(--line);
}
/* 末行补底边，避免滚动裁切后看不见下边线 */
.fc .fc-timegrid-slots table tr:last-child > td {
  border-bottom: 1px solid var(--line) !important;
}

.fc .fc-day-today { background-color: inherit !important; }
.fc .fc-col-header-cell-cushion,
.fc .fc-timegrid-slot-label-cushion {
  font-size: 13px;
}
.fc .fc-col-header-cell-cushion {
  text-align: center;
  padding: 6px 4px;
}
.fc .fc-timegrid-axis-cushion,
.fc .fc-timegrid-slot-label-cushion {
  padding: 0 8px;
}
.fc .fc-timegrid-slot-label-cushion {
  text-align: right;
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc .fc-timegrid-axis-frame,
.fc .fc-timegrid-slot-label-frame {
  width: 100%;
  max-width: var(--tl-axis-width);
}
.fc .fc-timegrid-col,
.fc .fc-timegrid-col-events {
  overflow: visible !important;
}
.fc-timegrid-event.tl-calendar-event {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  position: relative;
}
.fc-timegrid-event-harness {
  overflow: hidden;
}
.tl-event-card {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 8px 4px 10px;
  border-radius: 10px;
  background: var(--tl-event-bg, var(--accent));
  color: var(--tl-event-fg, #333);
  box-shadow: 0 2px 8px var(--event-shadow);
  box-sizing: border-box;
}
.fc-timegrid-event.tl-event-dragging .tl-event-card,
.fc-event-mirror .tl-event-card {
  height: 100%;
  transition: none;
}
.tl-event-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 10px 0 0 10px;
  background: var(--tl-event-accent, var(--accent));
}
.tl-event-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 4;
  width: clamp(18px, 22%, 26px);
  height: clamp(18px, 55%, 26px);
  min-width: 18px;
  min-height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #d32f2f;
  font-size: clamp(12px, 3vw, 15px);
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  touch-action: manipulation;
}
.tl-event-delete:hover {
  background: #ffebee;
}
.fc-timegrid-event .fc-event-main-frame {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.fc-timegrid-event .fc-event-main {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: visible;
  position: relative;
}
.tl-event-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  flex: 1;
  min-height: 0;
  gap: 1px;
  overflow: visible;
}
.tl-event-title {
  font-size: clamp(10px, 2.6vw, 14px);
  line-height: 1.25;
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.tl-event-time {
  font-size: clamp(9px, 2.2vw, 11px);
  line-height: 1.15;
  font-weight: 600;
  opacity: 0.85;
  white-space: nowrap;
}
.fc-timegrid-event.tl-event-compact .tl-event-card {
  padding: 2px 5px 2px 7px;
}
.fc-timegrid-event.tl-event-compact .tl-event-title {
  font-size: 11px;
  line-height: 1.1;
}
.fc-timegrid-event.tl-event-compact .tl-event-time {
  font-size: 9px;
  line-height: 1.05;
}
.fc-timegrid-event.tl-event-tiny .tl-event-card {
  padding: 1px 4px 1px 6px;
}
.fc-timegrid-event.tl-event-tiny .tl-event-title {
  font-size: 10px;
  line-height: 1.05;
}
.fc-timegrid-event.tl-event-tiny .tl-event-time {
  font-size: 8px;
  line-height: 1;
}
.fc-timegrid-event.tl-event-short .tl-event-card {
  padding: 3px 6px 3px 8px;
}
.fc-timegrid-event.tl-event-short .tl-event-title {
  font-size: 12px;
  line-height: 1.15;
}
.fc-timegrid-event.tl-event-short .tl-event-time {
  font-size: 10px;
  line-height: 1.1;
}
.fc-timegrid-event.tl-event-medium .tl-event-title {
  font-size: 13px;
}
.fc-timegrid-event.tl-event-medium .tl-event-time {
  font-size: 10px;
}
.fc-timegrid-event .fc-event-title,
.fc-timegrid-event .fc-event-time {
  display: none;
}
.fc .fc-timegrid-slot-label,
.fc .fc-timegrid-slot-lane {
  height: var(--slot-row-height) !important;
  min-height: var(--slot-row-height);
}
.fc-timegrid-event-harness .fc-timegrid-event {
  min-height: 0;
  box-sizing: border-box;
}
.fc-timegrid-event-harness .fc-timegrid-event.tl-calendar-event {
  height: 100%;
  box-sizing: border-box;
}
.fc-timegrid-event .fc-event-main,
.fc-timegrid-event .fc-event-main-frame,
.tl-event-card {
  pointer-events: none;
}
.tl-event-delete {
  pointer-events: auto;
}

body.exporting .fc .fc-timegrid-slot-label,
body.exporting .fc .fc-timegrid-slot-lane {
  transition: none !important;
}
body.exporting .timeline-shell {
  padding: 0;
}
body.exporting .timeline-toolbar,
body.exporting #sidebar,
body.exporting .site-footer {
  display: none !important;
}
body.exporting .timeline-layout {
  display: block;
  height: auto;
  overflow: visible;
}
body.exporting .calendar-stage {
  display: block;
  height: auto;
  overflow: visible;
}
body.exporting #calendar {
  height: auto !important;
}
body.exporting #calendar-container {
  padding: 0;
  margin: 0 auto;
  overflow: visible !important;
  background: #fff;
  box-sizing: border-box;
  border: none !important;
  border-radius: 0;
  box-shadow: none;
  width: var(--export-container-width) !important;
  height: auto !important;
  max-width: none !important;
}
body.exporting .export-capture-host {
  width: auto !important;
  max-width: none !important;
  overflow: visible !important;
}
body.exporting .fc .fc-scrollgrid {
  border-left: 1px solid var(--line) !important;
  border-bottom: 1px solid var(--line) !important;
  border-right: 1px solid var(--line) !important;
  border-top: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  margin: 0;
  overflow: visible !important;
}
body.exporting .fc .fc-scrollgrid-sync-table,
body.exporting .fc .fc-scrollgrid-section,
body.exporting .fc .fc-scrollgrid-section > td {
  border: none !important;
}
body.exporting .fc .fc-scrollgrid-section-header .fc-timegrid-axis,
body.exporting .fc .fc-scrollgrid-section-header .fc-col-header-cell {
  border-top: 1px solid var(--line) !important;
  border-bottom: 1px solid var(--line) !important;
}
body.exporting .fc .fc-scrollgrid-section-header,
body.exporting .fc .fc-scrollgrid-section-header > th,
body.exporting .fc .fc-col-header {
  background: transparent !important;
}
body.exporting .fc .fc-scrollgrid-section-header > th,
body.exporting .fc .fc-scrollgrid-section-body > td {
  border-right: none !important;
}
body.exporting .fc .fc-scrollgrid-section-header table,
body.exporting .fc .fc-scrollgrid-section-body table {
  border-top: none !important;
}
body.exporting .fc .fc-scrollgrid-section-header .fc-col-header-cell:last-child,
body.exporting .fc .fc-timegrid-cols .fc-timegrid-col:last-child {
  border-right: none !important;
}
body.exporting .fc .fc-col-header-cell:not(.fc-timegrid-axis):not(:last-child),
body.exporting .fc .fc-timegrid-col:not(:last-child) {
  width: var(--tl-export-day-width, 90px) !important;
  min-width: var(--tl-export-day-width, 90px) !important;
  max-width: var(--tl-export-day-width, 90px) !important;
}
body.exporting .fc .fc-col-header-cell:not(.fc-timegrid-axis):last-child,
body.exporting .fc .fc-timegrid-col:last-child {
  width: var(--tl-export-last-day-width, var(--tl-export-day-width, 90px)) !important;
  min-width: var(--tl-export-last-day-width, var(--tl-export-day-width, 90px)) !important;
  max-width: var(--tl-export-last-day-width, var(--tl-export-day-width, 90px)) !important;
}
body.exporting .fc .fc-timegrid-col:last-child .fc-timegrid-col-frame,
body.exporting .fc .fc-timegrid-col:last-child .fc-timegrid-col-bg,
body.exporting .fc .fc-timegrid-col:last-child .fc-timegrid-col-events {
  border-right: none !important;
}
body.exporting .fc .fc-timegrid-slots table tr:first-child > td,
body.exporting .fc .fc-scrollgrid-section-body tr:first-child > td,
body.exporting .fc .fc-timegrid-axis-chunk .fc-timegrid-slot:first-child {
  border-top: none !important;
}
body.exporting .fc .fc-timegrid-slots table tr:last-child > td {
  border-bottom: 1px solid var(--line) !important;
}
body.exporting .fc .fc-timegrid-axis,
body.exporting .fc .fc-timegrid-slot-label {
  width: var(--tl-axis-width, 88px) !important;
  min-width: var(--tl-axis-width, 88px) !important;
  max-width: var(--tl-axis-width, 88px) !important;
}
body.exporting #calendar-container .fc .fc-scrollgrid {
  min-width: 0 !important;
}
body.exporting #calendar,
body.exporting .fc,
body.exporting .fc-view-harness,
body.exporting .fc-scrollgrid,
body.exporting .fc-scrollgrid-sync-table {
  width: var(--export-container-width) !important;
  max-width: var(--export-container-width) !important;
}
body.exporting .tl-event-delete {
  display: none !important;
}
body.exporting .fc .fc-col-header-cell-cushion,
body.exporting .fc .fc-timegrid-slot-label-cushion {
  font-size: 15px;
  font-weight: 600;
}
body.exporting .tl-event-title {
  font-size: 15px;
}
body.exporting .tl-event-time {
  font-size: 12px;
}

.site-footer {
  flex-shrink: 0;
  margin: var(--panel-gap) var(--page-gutter) var(--page-gutter);
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  color: #8a8a8a;
  line-height: 1.5;
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: var(--panel-radius);
}
.site-footer .ft-sep { margin: 0 8px; opacity: 0.45; }

#sidebarToggle { display: none; }

/* Export preview modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 2vh 2vw;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 96vw;
  height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-weight: 800;
  color: #333;
  border-bottom: 1px solid #eee;
  flex: none;
}
.modal-head button {
  border: none;
  background: #eee;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}
.modal-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  flex: none;
  flex-wrap: wrap;
}
.orient-btn {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 14px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  font-family: inherit;
}
.orient-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.zoom-group { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.zbtn {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 14px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  min-width: 30px;
  font-family: inherit;
}
.zbtn:hover { background: #f4f5f7; }
.modal-body {
  padding: 24px;
  overflow: auto;
  background: #f4f5f7;
  flex: 1;
  min-height: 0;
}
.modal-body canvas {
  display: block;
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  background: #fff;
}
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid #eee;
  flex: none;
}
body.modal-open { overflow: hidden; }

.course-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  z-index: 900;
}
.course-backdrop.open { display: block; }
.course-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 360px);
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  z-index: 901;
  display: none;
}
.course-panel.open { display: block; }
.course-panel-wide {
  width: min(92vw, 420px);
}
.saved-schedules-hint,
.save-schedule-date {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--teacher);
}
.saved-schedules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.saved-schedules-empty {
  margin: 0 0 12px;
  text-align: center;
  font-size: 13px;
  color: var(--teacher);
}
.saved-schedule-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.saved-schedule-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 143, 177, 0.25);
}
.saved-schedule-meta {
  flex: 1;
  min-width: 0;
}
.saved-schedule-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #4a3f55;
  word-break: break-word;
}
.saved-schedule-date {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #8a7f92;
}
.saved-schedule-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 143, 177, 0.2);
  color: var(--app-fg);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.saved-schedule-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
}
.saved-schedule-actions .zbtn {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  font-size: 11px;
}
.course-panel-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--app-fg);
  margin-bottom: 14px;
  text-align: center;
}
.course-field {
  margin-bottom: 12px;
}
.course-field label {
  display: block;
  font-size: 13px;
  color: var(--teacher);
  margin-bottom: 6px;
}
.course-field input,
.course-field select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.course-panel-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.course-panel-actions #courseDeleteBtn { margin-right: auto; }

@media (min-width: 1200px) {
  :root {
    --page-gutter: 28px;
    --panel-gap: 14px;
  }
}
@media (max-width: 768px) {
  :root {
    --page-gutter: 12px;
    --panel-gap: 10px;
  }
  .timeline-layout { flex-direction: column; }
  #sidebarToggle {
    display: inline-flex;
    margin-right: 8px;
  }
  #sidebar {
    position: fixed;
    left: var(--page-gutter);
    top: 56px;
    bottom: var(--page-gutter);
    width: min(320px, calc(100vw - var(--page-gutter) * 2));
    z-index: 200;
    transform: translateX(calc(-100% - var(--page-gutter)));
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    background: transparent;
    gap: var(--panel-gap);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebarBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
  }
  #sidebarBackdrop.open { display: block; }
  #calendar-container {
    overflow: hidden;
  }
  .sidebar-btn-group .tbtn,
  .sidebar-io-group .tbtn,
  #addCourseBtn {
    min-height: 44px;
  }
  #external-events-list .pool-drag-handle {
    -webkit-touch-callout: none;
    touch-action: none;
  }
}

@media print {
  .timeline-toolbar, #sidebar, .site-footer, #sidebarToggle { display: none !important; }
}
