/* ==========================================================================
   Teacher Schedule: Google Calendar Design & Focus Mode Stylesheet
   Source: bel-google-calendar-prototype.html & bel-google-calendar-implementation.md
   ========================================================================== */

:root,
.crm-panel[data-panel="courses/teacher-schedule"] {
  --ts-shell: #f8fafd;
  --ts-paper: #ffffff;
  --ts-ink: #1f1f1f;
  --ts-muted: #444746;
  --ts-line: #dadce0;
  --ts-blue: #0b57d0;
  --ts-hover: #e8edf5;
  --ts-rail: 264px;
  --ts-font: "Roboto", "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
  --ts-tools: 48px;
  --ts-gutter: 58px;
  --ts-hour: 50px;
  --ts-hour-height: 50px;
  --ts-days: 7;
  --ts-scrollbar: 10px;
  --ts-ease-enter: cubic-bezier(0.2, 0, 0, 1);
  --ts-ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --ts-dur-popover-enter: 160ms;
  --ts-dur-popover-exit: 100ms;
  --ts-dur-settle: 120ms;
  --ts-dur-snapback: 140ms;

  /* Approved opaque event families. Pastel is the default presentation; Solid is opt-in. */
  --ts-pastel-blue-bg: #D2E3FC;
  --ts-pastel-blue-hover-bg: #C6DAF7;
  --ts-pastel-purple-bg: #E8DEF8;
  --ts-pastel-purple-hover-bg: #DDD0F2;
  --ts-pastel-teal-bg: #CDEBE6;
  --ts-pastel-teal-hover-bg: #BFE3DC;
  --ts-pastel-green-bg: #CEEAD6;
  --ts-pastel-green-hover-bg: #C1E3CB;
  --ts-pastel-orange-bg: #FCE3C1;
  --ts-pastel-orange-hover-bg: #F7D6AA;
  --ts-pastel-red-bg: #FAD2CF;
  --ts-pastel-red-hover-bg: #F3C3BF;
  --ts-pastel-indigo-bg: #DDE3FA;
  --ts-pastel-indigo-hover-bg: #D0D8F5;
  --ts-pastel-coral-bg: #F8D9E5;
  --ts-pastel-coral-hover-bg: #F1CAD9;

  --ts-solid-blue-bg: #1A73E8;
  --ts-solid-blue-hover-bg: #1765CC;
  --ts-solid-purple-bg: #8E24AA;
  --ts-solid-purple-hover-bg: #7B1FA2;
  --ts-solid-teal-bg: #00796B;
  --ts-solid-teal-hover-bg: #00695C;
  --ts-solid-green-bg: #188038;
  --ts-solid-green-hover-bg: #137333;
  --ts-solid-orange-bg: #B06000;
  --ts-solid-orange-hover-bg: #A45100;
  --ts-solid-red-bg: #D93025;
  --ts-solid-red-hover-bg: #B3261E;
  --ts-solid-indigo-bg: #3F51B5;
  --ts-solid-indigo-hover-bg: #34449F;
  --ts-solid-coral-bg: #C2185B;
  --ts-solid-coral-hover-bg: #AD1457;
}

/* --------------------------------------------------------------------------
   Calendar Focus Mode: full-viewport workspace, hide CRM navigation chrome
   -------------------------------------------------------------------------- */
body.crm-focus-mode {
  overflow: hidden !important;
  background: var(--ts-shell) !important;
}

body.crm-focus-mode #crm-sidebar,
body.crm-focus-mode .crm-sidebar,
body.crm-focus-mode #crm-topbar,
body.crm-focus-mode .crm-topbar,
body.crm-focus-mode .crm-header,
body.crm-focus-mode #crm-header,
body.crm-focus-mode .crm-nav,
body.crm-focus-mode > header,
body.crm-focus-mode .site-header,
body.crm-focus-mode > .crm-app-header {
  display: none !important;
}

body.crm-focus-mode .crm-layout,
body.crm-focus-mode .crm-container,
body.crm-focus-mode .crm-main,
body.crm-focus-mode #crm-main {
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

body.crm-focus-mode .crm-panel[data-panel="courses/teacher-schedule"] {
  display: flex !important;
  flex-direction: column !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: var(--ts-shell) !important;
  overflow: hidden !important;
}

body.crm-focus-mode .crm-panel[data-panel="courses/teacher-schedule"] > .crm-panel-header {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Google Calendar UI Components: Typography & Base Primitives
   -------------------------------------------------------------------------- */
.teacher-scheduler-google {
  font-family: var(--ts-font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ts-ink);
  background: var(--ts-shell);
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.teacher-scheduler-google *,
.teacher-scheduler-google *::before,
.teacher-scheduler-google *::after {
  box-sizing: border-box;
}

.teacher-scheduler-google :where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
}

.teacher-scheduler-google :where(button) {
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  background: none;
}

.teacher-scheduler-google button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.teacher-scheduler-google button:focus-visible,
.teacher-scheduler-google input:focus-visible,
.teacher-scheduler-google select:focus-visible,
.teacher-scheduler-google textarea:focus-visible {
  outline: 2px solid var(--ts-blue);
  outline-offset: 2px;
}

/* Icon helper */
.ts-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.ts-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ts-muted);
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.ts-icon-btn:hover {
  background: var(--ts-hover);
}

.ts-pill-btn {
  height: 36px;
  border: 1px solid #858987;
  border-radius: 24px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ts-ink);
  transition: background-color 0.15s;
}

.ts-pill-btn:hover {
  background: var(--ts-hover);
}

.ts-blue-btn {
  color: #ffffff !important;
  background: var(--ts-blue) !important;
  border: 0 !important;
  font-weight: 600;
}

.ts-blue-btn:hover {
  background: #0848b4 !important;
}

.ts-text-btn {
  color: var(--ts-blue);
  border-radius: 20px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
}

.ts-text-btn:hover {
  background: #eaf1fc;
}

/* --------------------------------------------------------------------------
   Top Bar: 56px Google Calendar Navigation Row
   -------------------------------------------------------------------------- */
.ts-topbar {
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 0 8px;
  white-space: nowrap;
  background: var(--ts-shell);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 10;
}

.ts-brand {
  width: var(--ts-rail);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  flex-shrink: 0;
}

.ts-brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #18764a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.ts-brand-title {
  font-size: 21px;
  font-weight: 400;
  color: var(--ts-ink);
  letter-spacing: -0.2px;
}

.ts-back-crm-btn {
  font-size: 12px;
  color: #157a3b;
  border-color: #a7d7b9;
  height: 32px;
  padding: 0 12px;
  margin-left: 6px;
  font-weight: 600;
}

.ts-back-crm-btn:hover {
  background: #e8f5ed;
  border-color: #18764a;
}

.ts-nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 8px 0 12px;
}

.ts-nav-group .ts-icon-btn {
  width: 32px;
  height: 32px;
}

.ts-month-button {
  font-size: 22px;
  font-weight: 500;
  line-height: 28px;
  text-align: left;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ts-ink);
  letter-spacing: -0.3px;
}

.ts-month-button:hover {
  background: var(--ts-hover);
}

.ts-top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ts-view-picker {
  margin: 0 4px;
  padding: 0 14px;
  font-size: 13px;
  height: 36px;
}

.ts-switch {
  display: flex;
  border: 1px solid #858987;
  border-radius: 24px;
  height: 36px;
  overflow: hidden;
  margin: 0 4px;
}

.ts-switch button {
  width: 42px;
  display: grid;
  place-items: center;
  border-right: 1px solid #858987;
  color: var(--ts-muted);
}

.ts-switch button:last-child {
  border-right: 0;
}

.ts-switch button.active {
  background: #c2e7ff;
  color: #004a77;
}

.ts-avatar {
  height: 32px;
  width: 32px;
  border-radius: 50%;
  background: #dce9e1;
  color: #22523b;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.ts-searchbar {
  height: 38px;
  background: #e9eef6;
  max-width: 480px;
  flex: 1;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 16px;
  margin: 0 16px;
}

.ts-searchbar input {
  border: 0;
  background: none;
  outline: none;
  min-width: 0;
  width: 100%;
  font-size: 14px;
  color: var(--ts-ink);
}

/* --------------------------------------------------------------------------
   Main Workspace Shell: 3-Column Layout (Sidebar, Calendar, Tools)
   -------------------------------------------------------------------------- */
.ts-shell {
  flex: 1 1 0;
  min-height: 0;
  height: calc(100dvh - 56px);
  max-height: calc(100dvh - 56px);
  display: grid;
  grid-template-columns: var(--ts-rail) minmax(0, 1fr) var(--ts-tools);
  overflow: hidden;
  position: relative;
}

.ts-shell.sidebar-hidden {
  grid-template-columns: 0 minmax(0, 1fr) var(--ts-tools);
}

.ts-shell.sidebar-hidden .ts-sidebar {
  visibility: hidden;
}

/* Left Sidebar */
.ts-sidebar {
  grid-column: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
  background: var(--ts-shell);
  border-right: 1px solid rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 2;
}

.ts-create-wrap {
  padding: 12px 14px 18px;
}

.ts-create-btn {
  height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 1px 2px rgba(60, 64, 67, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ts-ink);
  transition: background-color 0.15s, box-shadow 0.15s;
}

.ts-create-btn:hover {
  background: #edf3fa;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.3);
}

/* Mini Calendar */
.ts-mini-calendar {
  padding: 0 18px 12px;
}

.ts-mini-heading {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ts-ink);
}

.ts-mini-nav {
  display: flex;
  gap: 2px;
}

.ts-mini-nav .ts-icon-btn {
  width: 24px;
  height: 24px;
}

.ts-mini-weekdays,
.ts-mini-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.ts-mini-weekdays {
  margin: 6px 0 4px;
}

.ts-mini-weekdays span {
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--ts-muted);
  font-weight: 600;
}

.teacher-scheduler-mini-calendar .mini-cal-days,
.ts-mini-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell,
.ts-mini-days .mini-cal-day-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  position: relative;
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-in-range {
  background: #c2e7ff;
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-range-start {
  border-top-left-radius: 13px;
  border-bottom-left-radius: 13px;
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-range-end {
  border-top-right-radius: 13px;
  border-bottom-right-radius: 13px;
}

.teacher-scheduler-mini-calendar .mini-cal-day-btn,
.mini-cal-day-btn {
  font-size: 11px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  border: 0;
  background: none;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  color: var(--ts-ink, #202124);
  cursor: pointer;
  transition: background-color 0.1s;
}

.teacher-scheduler-mini-calendar .mini-cal-day-btn:hover {
  background: var(--ts-hover, #f1f3f4);
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-outside .mini-cal-day-btn {
  color: #9aa0a6;
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-today .mini-cal-day-btn {
  background: var(--ts-blue, #1a73e8);
  color: #ffffff;
  font-weight: 700;
}

.teacher-scheduler-mini-calendar .mini-cal-day-cell.is-in-range:not(.is-today) .mini-cal-day-btn {
  color: #004a77;
  font-weight: 600;
}

/* Sidebar Search & Sections */
.ts-sidebar-search {
  background: #e9eef6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin: 2px 16px 12px;
  padding: 0 10px;
  color: var(--ts-muted);
}

.ts-sidebar-search input {
  border: 0;
  background: none;
  font-size: 12px;
  width: 100%;
  min-width: 0;
  outline: none;
  color: var(--ts-ink);
}

.ts-side-section {
  padding: 0 12px 8px;
}

.ts-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  min-height: 32px;
  padding: 0 8px;
  font-weight: 600;
  font-size: 12px;
  color: var(--ts-muted);
  border-radius: 6px;
}

.ts-section-toggle:hover {
  background: var(--ts-hover);
}

.ts-check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 0 8px;
  cursor: pointer;
  border-radius: 4px;
}

.ts-check-row:hover {
  background: var(--ts-hover);
}

.ts-check-row input[type="checkbox"] {
  appearance: none;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 1.5px solid var(--color, #5f6368);
  border-radius: 3px;
  margin: 0;
  position: relative;
  background: #ffffff;
  cursor: pointer;
}

.ts-check-row input[type="checkbox"]:checked {
  background: var(--color, #0b57d0);
  border-color: var(--color, #0b57d0);
}

.ts-check-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ts-check-row .teacher-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ts-ink);
}

.ts-class-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.ts-class-row:hover {
  background: var(--ts-hover);
}

.ts-class-row.active {
  background: #d3e3fd;
  color: #0842a0;
  font-weight: 600;
}

.ts-class-dot {
  height: 9px;
  width: 9px;
  border-radius: 2px;
  background: var(--color, #5f6368);
  flex-shrink: 0;
}

.ts-class-row .name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-class-row small {
  color: #5f6368;
  font-size: 10.5px;
  white-space: nowrap;
}

.ts-side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  width: 100%;
  min-height: 36px;
  text-align: left;
  font-size: 12.5px;
  color: var(--ts-ink);
}

.ts-side-link:hover {
  background: var(--ts-hover);
}

.ts-sidebar-foot {
  margin-top: auto;
  padding: 16px 18px 0;
  font-size: 11px;
  color: #727776;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Calendar Surface: White, 28px Rounded Corners, Full-Height Grid
   -------------------------------------------------------------------------- */
.ts-calendar-surface {
  grid-column: 2;
  border-radius: 28px 28px 0 0;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
}

/* Week/Date Header (70px) */
.ts-calendar-head {
  display: grid;
  grid-template-columns: var(--ts-gutter) repeat(var(--ts-days), minmax(0, 1fr));
  height: 70px;
  min-height: 70px;
  padding-right: var(--ts-scrollbar);
  background: #ffffff;
  border-bottom: 1px solid var(--ts-line);
  z-index: 3;
}

.ts-gutter-head {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  font-size: 10px;
  color: #3c4043;
  font-weight: 500;
}

.ts-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 6px;
  position: relative;
}

.ts-day-head::after {
  position: absolute;
  content: '';
  height: 18px;
  width: 1px;
  background: #e0e3e7;
  bottom: 0;
  left: 0;
}

.ts-day-label,
.teacher-scheduler-workspace .scheduler-calendar-head .cal-head-dow {
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ts-muted);
  font-weight: 500;
}

.ts-day-date,
.teacher-scheduler-workspace .scheduler-calendar-head .cal-head-date {
  height: 38px;
  width: 38px;
  min-width: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--ts-ink);
  transition: background-color 0.1s;
}

.ts-day-date:hover,
.teacher-scheduler-workspace .scheduler-calendar-head .cal-head-date:hover {
  background: #f0f4f9;
}

.ts-day-head.today .ts-day-label,
.teacher-scheduler-workspace .scheduler-calendar-head.is-today .cal-head-dow {
  color: var(--ts-blue);
  font-weight: 700;
}

.ts-day-head.today .ts-day-date,
.teacher-scheduler-workspace .scheduler-calendar-head.is-today .cal-head-date {
  color: #ffffff;
  background: var(--ts-blue);
  font-weight: 600;
}

/* Timeline Scroll Area */
.ts-calendar-scroll {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.teacher-scheduler-workspace #teacher-scheduler-calendar,
#teacher-scheduler-calendar {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-color: #dadce0 transparent;
  scrollbar-width: thin;
}

#teacher-scheduler-calendar::-webkit-scrollbar {
  width: 10px;
  height: 8px;
}

#teacher-scheduler-calendar::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 8px;
  border: 2px solid #ffffff;
}

#teacher-scheduler-calendar::-webkit-scrollbar-track {
  background: #ffffff;
}

/* ==========================================================================
   Scheduler event presentation
   Grid geometry stays independent from the complete six-token event theme.
   ========================================================================== */

#teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-calendar-cell.teacher-scheduler-slot,
.teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-calendar-cell.teacher-scheduler-slot,
.teacher-scheduler-workspace .scheduler-calendar-cell.teacher-scheduler-slot {
  position: relative;
  z-index: auto;
  overflow: visible;
  contain: none;
}

#teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-session-pill.teacher-scheduler-session-pill,
.teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-session-pill.teacher-scheduler-session-pill,
.teacher-scheduler-workspace .scheduler-session-pill.teacher-scheduler-session-pill {
  position: absolute;
  z-index: 10;
  pointer-events: auto;
  font-family: var(--ts-font);
  font-size: 14px;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  border-radius: 4px;
  border: 0;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
  padding: 6px 8px;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  transition: transform var(--ts-dur-settle, 120ms) var(--ts-ease-enter, cubic-bezier(0.2, 0, 0, 1)),
              box-shadow 0.15s ease;
}

#teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-session-pill.teacher-scheduler-session-pill:hover,
.teacher-scheduler-workspace .scheduler-session-pill.teacher-scheduler-session-pill:hover {
  z-index: 20;
  background-color: var(--ts-event-hover-bg, #C6DAF7);
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.35);
}

.teacher-scheduler-workspace .teacher-scheduler-session-pill:focus-visible {
  outline: 2px solid var(--ts-event-focus, #174EA6);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px #ffffff, 0 0 0 4px color-mix(in srgb, var(--ts-event-focus, #174EA6) 36%, transparent);
}

#teacher-scheduler-workspace[data-ts-render-repair="v1"] .scheduler-session-pill.teacher-scheduler-session-pill.is-dragging,
.teacher-scheduler-workspace .scheduler-session-pill.teacher-scheduler-session-pill.is-dragging {
  z-index: 30;
  opacity: 0.35 !important;
}

/* Personal-calendar busy blocks: read-only, beneath class sessions, clicks pass through to the slot */
.teacher-scheduler-workspace .ts-busy-block {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 1;
  pointer-events: none;
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid #c4c7c5;
  background: repeating-linear-gradient(135deg, #eceef0 0 6px, #e3e5e8 6px 12px);
  overflow: hidden;
}

.teacher-scheduler-workspace .ts-busy-label {
  display: block;
  padding: 2px 6px;
  font-family: var(--ts-font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ts-muted);
}

.ts-personal-busy {
  margin: 4px 12px 8px;
}

.ts-personal-busy[hidden] {
  display: none;
}

.ts-personal-busy-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 4px;
  font-size: 14px;
  color: var(--ts-ink);
  cursor: pointer;
}

.ts-personal-busy-toggle input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: #5f6368;
  cursor: pointer;
}

.ts-personal-busy-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #c4c7c5;
  background: repeating-linear-gradient(135deg, #eceef0 0 3px, #d7dade 3px 6px);
}

.ts-personal-busy-note {
  margin: 0 4px;
  font-size: 12px;
  color: var(--ts-muted);
}

.ts-personal-busy-note:empty {
  display: none;
}

/* Red deliberate current-time indicator sits above events */
.teacher-scheduler-workspace .scheduler-now-line {
  z-index: 15;
  pointer-events: none;
}

/* Sticky headers and sticky time gutter remain above scrolling events */
.teacher-scheduler-workspace .scheduler-calendar-head {
  z-index: 25;
}
.teacher-scheduler-workspace .scheduler-calendar-time {
  z-index: 25;
}

/* Drop targets and hover highlights stay below event layer */
.teacher-scheduler-workspace .scheduler-calendar-cell.teacher-scheduler-slot.is-drop-target {
  z-index: auto;
}

.teacher-scheduler-workspace .scheduler-session-pill .pill-title {
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
}

.teacher-scheduler-workspace .scheduler-session-pill .pill-time {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
}

.teacher-scheduler-workspace .scheduler-session-pill .pill-teacher {
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-scheduler-workspace .pill-course {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ts-event-meta, #3C4043);
}

/* Dynamic 3-tier density styles */
/* Tier 1: compact (< 40px) */
.teacher-scheduler-workspace .scheduler-session-pill.is-compact,
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-compact {
  padding: 1px 4px;
}
.teacher-scheduler-workspace .scheduler-session-pill.is-compact .pill-meta-row,
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-compact .pill-meta-row,
.teacher-scheduler-workspace .scheduler-session-pill.is-compact .pill-teacher,
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-compact .pill-teacher {
  display: none !important;
}

/* Tier 2: mid (40-71px) - 2 lines: Title with ellipsis + Time; teacher omitted */
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid {
  padding: 3px 6px;
}
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid .pill-header {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid .pill-title {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
  -webkit-line-clamp: unset !important;
  line-height: 18px;
}
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid .pill-meta-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin-top: 1px;
  width: 100%;
}
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid .pill-time {
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
}
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-mid .pill-teacher {
  display: none !important;
}

/* Full events reserve separate lines for name, course, time and teacher. */
.teacher-scheduler-workspace .scheduler-session-pill.ts-density-full .pill-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 18px;
}

.teacher-scheduler-workspace .scheduler-calendar-time span {
  font-size: 12px;
  color: #5f6368;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* One teacher family resolves to Pastel by default. Inline theme tokens from the
   controller use the same contract and therefore also work on detached previews. */
[data-ts-color] {
  --ts-event-title: #1F1F1F;
  --ts-event-meta: #3C4043;
}

[data-ts-color="blue"] {
  --ts-event-bg: var(--ts-pastel-blue-bg);
  --ts-event-hover-bg: var(--ts-pastel-blue-hover-bg);
  --ts-event-accent: #1A73E8;
  --ts-event-focus: #174EA6;
}
[data-ts-color="purple"] {
  --ts-event-bg: var(--ts-pastel-purple-bg);
  --ts-event-hover-bg: var(--ts-pastel-purple-hover-bg);
  --ts-event-accent: #8E24AA;
  --ts-event-focus: #7B1FA2;
}
[data-ts-color="teal"] {
  --ts-event-bg: var(--ts-pastel-teal-bg);
  --ts-event-hover-bg: var(--ts-pastel-teal-hover-bg);
  --ts-event-accent: #00796B;
  --ts-event-focus: #00695C;
}
[data-ts-color="green"] {
  --ts-event-bg: var(--ts-pastel-green-bg);
  --ts-event-hover-bg: var(--ts-pastel-green-hover-bg);
  --ts-event-accent: #188038;
  --ts-event-focus: #137333;
}
[data-ts-color="orange"] {
  --ts-event-bg: var(--ts-pastel-orange-bg);
  --ts-event-hover-bg: var(--ts-pastel-orange-hover-bg);
  --ts-event-accent: #B06000;
  --ts-event-focus: #A45100;
}
[data-ts-color="red"] {
  --ts-event-bg: var(--ts-pastel-red-bg);
  --ts-event-hover-bg: var(--ts-pastel-red-hover-bg);
  --ts-event-accent: #D93025;
  --ts-event-focus: #B3261E;
}
[data-ts-color="indigo"] {
  --ts-event-bg: var(--ts-pastel-indigo-bg);
  --ts-event-hover-bg: var(--ts-pastel-indigo-hover-bg);
  --ts-event-accent: #3F51B5;
  --ts-event-focus: #34449F;
}
[data-ts-color="coral"] {
  --ts-event-bg: var(--ts-pastel-coral-bg);
  --ts-event-hover-bg: var(--ts-pastel-coral-hover-bg);
  --ts-event-accent: #C2185B;
  --ts-event-focus: #AD1457;
}

.ts-appearance-solid .scheduler-session-pill[data-ts-color="blue"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="blue"] {
  --ts-event-bg: var(--ts-solid-blue-bg);
  --ts-event-hover-bg: var(--ts-solid-blue-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="purple"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="purple"] {
  --ts-event-bg: var(--ts-solid-purple-bg);
  --ts-event-hover-bg: var(--ts-solid-purple-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="teal"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="teal"] {
  --ts-event-bg: var(--ts-solid-teal-bg);
  --ts-event-hover-bg: var(--ts-solid-teal-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="green"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="green"] {
  --ts-event-bg: var(--ts-solid-green-bg);
  --ts-event-hover-bg: var(--ts-solid-green-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="orange"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="orange"] {
  --ts-event-bg: var(--ts-solid-orange-bg);
  --ts-event-hover-bg: var(--ts-solid-orange-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="red"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="red"] {
  --ts-event-bg: var(--ts-solid-red-bg);
  --ts-event-hover-bg: var(--ts-solid-red-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="indigo"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="indigo"] {
  --ts-event-bg: var(--ts-solid-indigo-bg);
  --ts-event-hover-bg: var(--ts-solid-indigo-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}
.ts-appearance-solid .scheduler-session-pill[data-ts-color="coral"],
.teacher-scheduler-drag-ghost.ts-appearance-solid[data-ts-color="coral"] {
  --ts-event-bg: var(--ts-solid-coral-bg);
  --ts-event-hover-bg: var(--ts-solid-coral-hover-bg);
  --ts-event-title: #FFFFFF;
  --ts-event-meta: #FFFFFF;
  --ts-event-focus: #FFFFFF;
}

#teacher-scheduler-calendar .teacher-scheduler-session-pill,
.teacher-scheduler-drag-ghost {
  background-color: var(--ts-event-bg, #D2E3FC);
  color: var(--ts-event-title, #1F1F1F);
  opacity: 1;
}

#teacher-scheduler-calendar .teacher-scheduler-session-pill .pill-title,
.teacher-scheduler-drag-ghost .pill-title {
  color: var(--ts-event-title, #1F1F1F);
  opacity: 1;
}

#teacher-scheduler-calendar .teacher-scheduler-session-pill :is(.pill-time, .pill-teacher),
.teacher-scheduler-drag-ghost :is(.pill-time, .pill-teacher, .drag-ghost-chip) {
  color: var(--ts-event-meta, #3C4043);
  opacity: 1;
}

.teacher-scheduler-workspace .teacher-scheduler-session-pill.is-completed {
  background-color: var(--ts-event-bg, #D2E3FC);
  box-shadow: inset 0 0 0 2px var(--ts-event-accent, #1A73E8), 0 1px 2px rgba(60, 64, 67, 0.15);
}

.teacher-scheduler-workspace .scheduler-session-pill.is-completed .pill-title {
  color: var(--ts-event-title, #1F1F1F);
  opacity: 1;
}

.teacher-scheduler-workspace .scheduler-session-pill.is-completed .pill-time,
.teacher-scheduler-workspace .scheduler-session-pill.is-completed .pill-teacher {
  color: var(--ts-event-meta, #3C4043);
  opacity: 1;
}

.teacher-scheduler-workspace .teacher-scheduler-session-pill.is-saving {
  opacity: 1;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ts-event-accent, #1A73E8) 62%, transparent);
}

.teacher-scheduler-workspace .teacher-scheduler-session-pill .pill-badge-completed,
.teacher-scheduler-workspace .teacher-scheduler-session-pill .pill-badge-compact {
  color: var(--ts-event-title, #1F1F1F);
  background: color-mix(in srgb, var(--ts-event-accent, #1A73E8) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ts-event-accent, #1A73E8) 42%, transparent);
}

/* Neutral sidebar teacher rows and class cards */
.teacher-scheduler-workspace .ts-checkbox-row {
  background-color: transparent !important;
  color: var(--ts-ink, #202124) !important;
  transition: background-color 0.15s ease;
}
.teacher-scheduler-workspace .ts-checkbox-row:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}
.teacher-scheduler-workspace .ts-checkbox-row .ts-checkbox-label {
  color: var(--ts-ink, #202124) !important;
}

.teacher-scheduler-workspace .scheduler-class-card.ts-repair-class-row {
  background-color: transparent;
  color: inherit;
}

/* Detached previews use the same opaque token contract as their source event. */
.teacher-scheduler-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  border-radius: 4px;
  padding: 5px 8px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  line-height: 14px;
  box-shadow: 0 4px 12px rgba(32, 33, 36, 0.28);
  border: 1px solid color-mix(in srgb, var(--ts-event-accent, #1A73E8) 42%, transparent);
  opacity: 1;
  transition: none !important;
}

/* Section B: Left-rail class row layout with full-width text and wrapping title */
.teacher-scheduler-workspace .ts-repair-class-row,
.ts-repair-class-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease, border-color 0.15s ease;
  min-height: auto;
  box-sizing: border-box;
}

.teacher-scheduler-workspace .ts-repair-class-row:hover,
.ts-repair-class-row:hover {
  background: var(--ts-hover, #e8edf5);
}

.teacher-scheduler-workspace .ts-repair-class-row.is-armed,
.ts-repair-class-row.is-armed,
.ts-repair-class-row[aria-pressed="true"] {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.teacher-scheduler-workspace .ts-repair-color-dot,
.ts-repair-color-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--dot-color, #1a73e8);
  flex-shrink: 0;
}

.teacher-scheduler-workspace .ts-repair-class-body,
.ts-repair-class-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.teacher-scheduler-workspace .ts-repair-class-title,
.ts-repair-class-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ts-ink, #1f1f1f);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.teacher-scheduler-workspace .ts-repair-class-teacher,
.ts-repair-class-teacher {
  font-size: 12px;
  line-height: 17px;
  color: var(--ts-muted, #444746);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-scheduler-workspace .ts-repair-class-progress,
.ts-repair-class-progress {
  font-size: 12px;
  line-height: 17px;
  color: var(--ts-muted, #5f6368);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mini-calendar header on single line with non-shrinking buttons */
.teacher-scheduler-mini-calendar .mini-cal-header,
.ts-mini-heading {
  white-space: nowrap;
  gap: 4px;
}
.teacher-scheduler-mini-calendar .mini-cal-month-title,
.ts-mini-heading span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.teacher-scheduler-mini-calendar .mini-cal-nav,
.ts-mini-nav {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.teacher-scheduler-mini-calendar .mini-cal-nav-btn,
.ts-mini-nav .ts-icon-btn {
  flex-shrink: 0;
}

/* Compact pill title text truncation */
.teacher-scheduler-workspace .scheduler-session-pill.is-compact .pill-title {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100%;
}

.ts-timeline {
  display: grid;
  grid-template-columns: var(--ts-gutter) repeat(var(--ts-days), minmax(0, 1fr));
  height: calc(var(--ts-hour) * 24);
  min-height: calc(var(--ts-hour) * 24);
  position: relative;
}

/* Time Gutter (58px) */
.ts-time-axis {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-right: 1px solid #eef2f7;
}

.ts-hour-label {
  position: absolute;
  right: 12px;
  color: #3c4043;
  font-size: 9.5px;
  line-height: 12px;
  transform: translateY(-50%);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Day Columns */
.ts-day-column {
  position: relative;
  border-left: 1px solid #dfe3e9;
  background: repeating-linear-gradient(
    to bottom,
    #dfe3e9 0px,
    #dfe3e9 1px,
    transparent 1px,
    transparent var(--ts-hour)
  );
  min-width: 0;
}

/* Half-hour interactive slot */
.ts-slot {
  position: absolute;
  left: 0;
  right: 0;
  height: calc(var(--ts-hour) / 2);
  padding: 0;
  border: 0;
  background: transparent;
  width: 100%;
}

.ts-slot:hover {
  background: rgba(232, 240, 254, 0.45);
}

/* --------------------------------------------------------------------------
   Events / Sessions (Google Calendar style: near full-width, 4px radius)
   -------------------------------------------------------------------------- */
.ts-session {
  position: absolute;
  z-index: 1;
  border: 0;
  border-radius: 4px;
  color: #ffffff;
  background: var(--color, #0b57d0);
  text-align: left;
  padding: 4px 6px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 1px;
  user-select: none;
  touch-action: none;
  min-width: 0;
  transition: box-shadow 0.12s;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15);
}

.ts-session:hover {
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.35);
  z-index: 4;
}

.ts-session:focus-visible {
  outline: 2px solid #202124;
  outline-offset: 1px;
  z-index: 5;
}

.ts-session.selected {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3.5px #5f6368;
  z-index: 5;
}

.ts-session.drag-origin {
  opacity: 0.32;
}

.ts-session-title {
  font-size: 11px;
  line-height: 13px;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ts-session-time {
  font-size: 11px;
  line-height: 13px;
  white-space: nowrap;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  opacity: 0.95;
}

.ts-session.tiny {
  padding: 2px 5px;
  flex-direction: row;
  gap: 5px;
  align-items: center;
}

.ts-session.tiny .ts-session-title {
  -webkit-line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}

.ts-session.tiny .ts-session-time {
  display: none;
}

/* Resize Handle on bottom edge */
.ts-resize-handle {
  position: absolute;
  height: 8px;
  bottom: 0;
  left: 0;
  right: 0;
  cursor: ns-resize;
}

.ts-resize-handle::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.65);
  left: calc(50% - 8px);
  opacity: 0;
  transition: opacity 0.15s;
}

.ts-session:hover .ts-resize-handle::after {
  opacity: 1;
}

/* Red Current Time Line */
.ts-now-line {
  height: 2px;
  background: #ea4335;
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 3;
}

.ts-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  background: #ea4335;
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

/* Drag Ghost & Drop Preview */
.ts-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  border: 1px solid #ffffff;
  box-shadow: 0 4px 12px rgba(32, 33, 36, 0.25);
  border-radius: 4px;
  padding: 5px 8px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 11px;
  line-height: 14px;
  color: #ffffff;
  background: var(--color, #0b57d0);
}

.ts-drop-preview {
  position: absolute;
  pointer-events: none;
  background: rgba(211, 227, 253, 0.8);
  border: 1px dashed #0b57d0;
  border-radius: 4px;
  z-index: 1;
  left: 1px;
  right: 1px;
  color: #0842a0;
  font-size: 11px;
  padding: 4px 6px;
}

/* --------------------------------------------------------------------------
   Pastel & Color Palette System
   -------------------------------------------------------------------------- */
.ts-session.is-pastel-sky { --color: #0284c7; background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.ts-session.is-pastel-lavender { --color: #7c3aed; background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.ts-session.is-pastel-sage { --color: #16a34a; background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.ts-session.is-pastel-peach { --color: #ea580c; background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.ts-session.is-pastel-rose { --color: #e11d48; background: #ffe4e6; color: #be123c; border: 1px solid #fecdd3; }
.ts-session.is-pastel-teal { --color: #0d9488; background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.ts-session.is-pastel-coral { --color: #db2777; background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.ts-session.is-pastel-indigo { --color: #4f46e5; background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

.ts-session.is-completed {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

.ts-session.is-completed .ts-session-title {
  text-decoration: line-through;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Dropdown Menus: #ts-create-menu and #ts-view-menu
   -------------------------------------------------------------------------- */
#ts-create-menu,
#ts-view-menu,
.ts-menu-card {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border: 1px solid #dadce0;
  padding: 6px 0;
  min-width: 180px;
  box-sizing: border-box;
}

#ts-create-menu button,
#ts-view-menu button,
.ts-menu-card button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  line-height: 20px;
  color: #3c4043;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.12s ease;
}

#ts-create-menu button:hover,
#ts-view-menu button:hover,
.ts-menu-card button:hover,
#ts-create-menu button:focus-visible,
#ts-view-menu button:focus-visible,
.ts-menu-card button:focus-visible {
  background: #f1f3f4;
  color: #202124;
}

#ts-create-menu button svg,
.ts-menu-card button svg {
  width: 18px;
  height: 18px;
  color: #5f6368;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Right Tools Rail (48px)
   -------------------------------------------------------------------------- */
.ts-tools {
  grid-column: 3;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 10px;
  gap: 12px;
  border-left: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--ts-shell);
}

.ts-tools hr {
  width: 24px;
  border: 0;
  border-top: 1px solid #dadce0;
  margin: 2px 0;
}

.ts-tools .last-tool {
  margin-top: auto;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Floating Details Popover & Dialogs
   -------------------------------------------------------------------------- */
.ts-floating-dialog {
  position: fixed;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: #ffffff;
  color: var(--ts-ink);
  box-shadow: 0 8px 28px rgba(60, 64, 67, 0.3), 0 2px 8px rgba(60, 64, 67, 0.18);
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  z-index: 50;
}

.ts-floating-dialog::backdrop {
  background: transparent;
}

.ts-popover-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 8px 10px 0;
  min-height: 44px;
}

.ts-popover-content {
  padding: 4px 24px 22px;
}

.ts-info-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 14px 0;
}

.ts-info-row .ts-icon {
  width: 18px;
  height: 18px;
  color: #5f6368;
  margin-top: 3px;
}

.ts-info-row .square-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--color, #0b57d0);
  margin-top: 6px;
}

.ts-event-title-display {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
  color: var(--ts-ink);
}

.ts-event-date-display {
  font-size: 13px;
  color: #3c4043;
  line-height: 1.6;
}

.ts-info-detail {
  font-size: 13px;
  color: #3c4043;
  line-height: 1.6;
}

.ts-info-detail small {
  display: block;
  font-size: 11.5px;
  color: #5f6368;
}

.ts-popover-actions {
  margin: 18px 0 0 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Full Editor Dialog */
dialog.ts-modal-dialog,
.ts-modal-dialog {
  border: 0;
  border-radius: 12px;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  color: var(--ts-ink);
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  z-index: 60;
}

dialog.ts-modal-dialog::backdrop,
.ts-modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(1px);
}

.ts-dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e3e6eb;
}

.ts-dialog-header h2 {
  font-size: 19px;
  font-weight: 400;
  flex: 1;
  margin: 0;
}

.ts-dialog-body {
  padding: 18px 24px 24px;
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
}

.ts-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e3e6eb;
  padding: 14px 24px;
}

.ts-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.ts-form-field label {
  font-size: 12px;
  font-weight: 600;
  color: #444746;
}

.ts-form-field input,
.ts-form-field select,
.ts-form-field textarea {
  border: 0;
  border-bottom: 1px solid #9aa0a6;
  background: #f1f3f4;
  padding: 9px 12px;
  border-radius: 4px 4px 0 0;
  width: 100%;
  font-size: 13px;
  min-height: 38px;
  transition: border-bottom-color 0.15s;
}

.ts-form-field input:focus,
.ts-form-field select:focus,
.ts-form-field textarea:focus {
  border-bottom: 2px solid var(--ts-blue);
  outline: none;
}

.ts-form-field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.ts-form-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}

/* Toast Notification */
.ts-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(32, 33, 36, 0.25);
  border-radius: 6px;
  padding: 12px 20px;
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 13px;
  z-index: 100;
  max-width: calc(100vw - 24px);
}

.ts-toast button {
  color: #8ab4f8;
  font-weight: 600;
  font-size: 13px;
  padding: 0;
}

/* Placement Toast */
.ts-placement-toast {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #e8f0fe;
  color: #174ea6;
  box-shadow: 0 2px 8px rgba(32, 33, 36, 0.2);
  border-radius: 8px;
  font-size: 12.5px;
  max-width: 90%;
  white-space: nowrap;
}

.ts-placement-toast button {
  font-weight: 700;
  color: var(--ts-blue);
}

/* Schedule List View */
.ts-schedule-list {
  overflow-y: auto;
  padding: 12px 24px 36px;
  flex: 1;
}

.ts-schedule-day {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  padding: 16px 0;
  border-bottom: 1px solid #e0e3e7;
}

.ts-schedule-day-title {
  font-size: 12px;
  color: #5f6368;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: start;
}

.ts-schedule-day-title b {
  font-size: 24px;
  font-weight: 400;
  color: var(--ts-ink);
}

.ts-schedule-row {
  display: grid;
  grid-template-columns: 12px 140px minmax(0, 1fr) 180px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  text-align: left;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.ts-schedule-row:hover {
  background: #f1f3f4;
}

.ts-schedule-row .event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ts-event-accent, #1A73E8);
}

.ts-schedule-row .schedule-teacher {
  color: #5f6368;
  font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Class rows in left sidebar (Google Calendar flat style)
   -------------------------------------------------------------------------- */
.teacher-scheduler-workspace .scheduler-class-card {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ts-ink);
}

.teacher-scheduler-workspace .scheduler-class-card:hover {
  background: var(--ts-hover);
  border-color: transparent;
}

.teacher-scheduler-workspace .scheduler-class-card.is-armed {
  border: 1px solid transparent;
  background: #d3e3fd;
  color: #0842a0;
  font-weight: 600;
}

.teacher-scheduler-workspace .scheduler-class-card .ts-class-dot {
  height: 9px;
  width: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.teacher-scheduler-workspace .scheduler-class-card .ts-class-teacher {
  font-size: 12px;
  color: var(--ts-muted);
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  :root {
    --ts-rail: 195px;
    --ts-gutter: 48px;
  }
  .ts-brand {
    gap: 8px;
    padding: 0 8px;
  }
  .ts-month-button {
    font-size: 18px;
  }
}

@media (max-width: 760px) {
  :root {
    --ts-tools: 0px;
    --ts-gutter: 48px;
  }
  .ts-topbar {
    padding-right: 8px;
    gap: 4px;
  }
  .ts-brand {
    width: auto;
    padding: 0 4px;
  }
  .ts-brand-title {
    display: none;
  }
  .ts-brand-mark {
    display: none;
  }
  .ts-top-actions .ts-switch {
    display: none;
  }
  .ts-shell {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }
  .ts-sidebar {
    position: fixed;
    top: 56px;
    bottom: 0;
    left: 0;
    width: 220px;
    background: var(--ts-shell);
    z-index: 20;
    box-shadow: 4px 0 20px rgba(32, 33, 36, 0.2);
    visibility: visible;
  }
  .ts-shell.sidebar-hidden .ts-sidebar {
    display: none;
  }
  .ts-calendar-surface {
    border-radius: 20px 20px 0 0;
  }
  .ts-tools {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Quick Add Event Composer & Detached Drag Ghost Styles
   -------------------------------------------------------------------------- */
.ts-quick-add-dialog,
#teacher-scheduler-quick-add,
#teacher-scheduler-session-bubble,
.teacher-scheduler-session-bubble {
  position: fixed;
  z-index: 1000;
  width: 420px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24), 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 16px 20px;
  font-family: var(--ts-font);
  color: var(--ts-ink, #1f1f1f);
}

.ts-quick-add-dialog .crm-input,
#teacher-scheduler-quick-add .crm-input,
#teacher-scheduler-session-bubble .crm-input {
  background: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ts-ink, #1f1f1f);
  transition: all 0.15s ease;
}

.ts-quick-add-dialog .crm-input:focus,
#teacher-scheduler-quick-add .crm-input:focus,
#teacher-scheduler-session-bubble .crm-input:focus {
  background: #ffffff;
  border-color: #174ea6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

#teacher-scheduler-session-note {
  min-height: 80px;
  height: 86px;
  max-height: 200px;
  resize: vertical;
  line-height: 1.4;
  font-size: 13px;
}

#btn-teacher-scheduler-quick-add,
#btn-teacher-scheduler-save-outcome,
#btn-ts-save-settings,
.ts-blue-btn {
  background: #1a73e8 !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

#btn-teacher-scheduler-quick-add:hover,
#btn-teacher-scheduler-save-outcome:hover,
#btn-ts-save-settings:hover,
.ts-blue-btn:hover {
  background: #1557b0 !important;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

#teacher-scheduler-session-bubble,
.ts-floating-dialog {
  font-family: var(--ts-font);
  color: var(--ts-ink, #1f1f1f);
}

/* --------------------------------------------------------------------------
   Session Bubble Popover (Section P1.B Modernization)
   -------------------------------------------------------------------------- */
#teacher-scheduler-bubble-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  flex-shrink: 0;
}

#teacher-scheduler-session-bubble .ts-icon-btn,
.teacher-scheduler-session-bubble .ts-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #5f6368;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

#teacher-scheduler-session-bubble .ts-icon-btn:hover,
.teacher-scheduler-session-bubble .ts-icon-btn:hover {
  background: rgba(60, 64, 67, 0.08);
  color: #202124;
}

#teacher-scheduler-session-bubble .teacher-scheduler-session-meta,
.teacher-scheduler-session-bubble .teacher-scheduler-session-meta {
  margin-top: 4px;
  margin-bottom: 6px;
  line-height: 1.4;
}

#teacher-scheduler-session-bubble .ts-bubble-meta-date {
  font-size: 14px;
  font-weight: 400;
  color: var(--ts-ink, #1f1f1f);
}

#teacher-scheduler-session-bubble .ts-bubble-meta-teacher {
  font-size: 14px;
  color: var(--ts-meta, #5f6368);
  margin-top: 1px;
}

#teacher-scheduler-session-bubble .teacher-scheduler-session-lock,
.teacher-scheduler-session-bubble .teacher-scheduler-session-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef7e0;
  color: #873800;
  border: 1px solid #f9ab00;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
}

.ts-custom-select-wrap {
  position: relative;
  width: 100%;
}

.ts-bubble-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  background-color: #f8f9fa;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding: 8px 36px 8px 12px !important;
  border: 1px solid #dadce0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  color: var(--ts-ink, #1f1f1f) !important;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ts-bubble-select:focus {
  border-color: var(--ts-blue, #1a73e8) !important;
  background-color: #ffffff !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2) !important;
}

.ts-dictate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #174ea6;
  background: #f8fafd;
  border: 1px solid #dadce0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ts-dictate-btn:hover {
  background: #e8f0fe;
  border-color: #d2e3fc;
  color: #174ea6;
}

#teacher-scheduler-session-note,
.ts-bubble-textarea {
  min-height: 72px;
  height: 86px;
  max-height: 220px;
  resize: vertical;
  line-height: 1.45;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #f8f9fa;
  color: var(--ts-ink, #1f1f1f);
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

#teacher-scheduler-session-note:focus,
.ts-bubble-textarea:focus {
  background: #ffffff;
  border-color: #174ea6;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.ts-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ts-action-primary {
  background: #1a73e8 !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
}

.ts-action-primary:hover {
  background: #1557b0 !important;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

.ts-action-secondary {
  background: #ffffff;
  color: var(--ts-ink, #1f1f1f);
  border: 1px solid #dadce0;
}

.ts-action-secondary:hover {
  background: #f8f9fa;
  border-color: #c6c6c6;
}

.ts-bubble-more-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  min-width: 175px;
  z-index: 1010;
  padding: 4px 0;
}

.ts-bubble-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--ts-ink, #1f1f1f);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
  box-sizing: border-box;
}

.ts-bubble-dropdown-item:hover {
  background: #f1f3f4;
}

.ts-dropdown-danger {
  color: #c5221f;
}

.ts-dropdown-danger:hover {
  background: #fce8e6;
  color: #c5221f;
}

.teacher-scheduler-inline-cancel {
  border: 1px solid #fad2cf;
  background: #fff8f7;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  box-sizing: border-box;
}

.ts-action-danger {
  background: #d93025 !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
}

.ts-action-danger:hover {
  background: #c5221f !important;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
}

.ts-bubble-dropdown-divider {
  height: 1px;
  background: #e8eaed;
  margin: 4px 0;
}

.teacher-scheduler-drag-ghost,
.scheduler-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 4px;
  padding: 6px 8px;
  box-shadow: 0 6px 16px rgba(60, 64, 67, 0.35);
  font-family: var(--ts-font);
  opacity: 1;
  will-change: transform;
  transition: none !important;
}

.teacher-scheduler-workspace .scheduler-session-pill,
.teacher-scheduler-workspace .scheduler-session-resize-handle {
  touch-action: none;
}

/* Reduced motion rules */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* Readable schedule typography and shared colour controls. */
.teacher-scheduler-workspace #teacher-scheduler-admin-filter-group { display: none !important; }
.teacher-scheduler-workspace .ts-rail-title, .teacher-scheduler-workspace .ts-section-toggle { font-size: 14px; font-weight: 500; }
.teacher-scheduler-workspace .ts-rail-description { font-size: 12px; line-height: 18px; color: #5f6368; padding: 0 8px 8px; }
.teacher-scheduler-workspace .ts-class-course { font-size: 12px; line-height: 17px; color: #5f6368; overflow-wrap: anywhere; }
.teacher-scheduler-workspace .ts-class-course:empty { display: none; }
.teacher-scheduler-workspace .ts-repair-class-progress { white-space: normal; }
.teacher-scheduler-workspace .mini-cal-month-title { font-size: 14px; font-weight: 500; }
.teacher-scheduler-workspace .mini-cal-day-btn { font-size: 12px; }
.teacher-scheduler-workspace .mini-cal-day-cell { min-height: 30px; }
.teacher-scheduler-workspace #teacher-scheduler-teacher-search { font-size: 14px; min-height: 36px; }
.ts-custom-dates > summary { padding: 8px 0; cursor: pointer; font-size: 13px; color: #444746; }
.ts-custom-date-fields { display: grid; gap: 8px; padding-top: 8px; }
.ts-custom-date-fields label { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; font-size: 12px; }
.ts-custom-date-fields input { min-width: 0; font: inherit; min-height: 34px; }
#teacher-scheduler-session-bubble { width: 440px; padding: 20px; border-radius: 16px; font-size: 14px; line-height: 20px; max-height: calc(100dvh - 24px); overflow-y: auto; box-shadow: 0 8px 28px #3c40432e, 0 2px 6px #3c40431a; }
#teacher-scheduler-session-bubble .ts-session-heading { min-width: 0; flex: 1; }
#teacher-scheduler-session-bubble-title { font-size: 22px; line-height: 28px; font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
#teacher-scheduler-session-bubble .ts-session-subtitle { font-size: 14px; line-height: 20px; color: #5f6368; margin-top: 4px; }
#teacher-scheduler-session-bubble .teacher-scheduler-session-meta { margin: 14px 0; line-height: 22px; }
#teacher-scheduler-session-bubble .ts-field-label { font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: normal; color: #3c4043; }
#teacher-scheduler-session-bubble .crm-input { font-family: inherit; font-size: 14px; padding: 10px 12px; background: #f8f9fa; border: 1px solid #dadce0; }
#teacher-scheduler-session-bubble textarea.crm-input { height: 110px; line-height: 22px; }
#teacher-scheduler-session-bubble button { font-family: inherit; }
#teacher-scheduler-session-bubble .ts-action-btn, #btn-teacher-scheduler-save-outcome { font-size: 14px; min-height: 38px; }
#teacher-scheduler-session-bubble .ts-icon-btn { height: 36px; width: 36px; flex-shrink: 0; }
.ts-color-button { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; min-height: 36px; border: 1px solid #dadce0; border-radius: 18px; background: #fff; color: #3c4043; font-size: 14px; cursor: pointer; max-width: 100%; }
.ts-color-dot { display: inline-block; width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%; border: 1px solid #0002; }
.ts-color-panel { padding: 12px 0 16px; border-bottom: 1px solid #e8eaed; }
.ts-color-panel[hidden] { display: none; }
.ts-color-hint { margin: 0 0 10px; font-size: 12px; line-height: 18px; color: #5f6368; overflow-wrap: anywhere; }
.ts-color-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ts-color-panel button { cursor: pointer; font-size: 14px; min-height: 36px; background: #fff; color: #3c4043; border: 1px solid #dadce0; border-radius: 6px; padding: 6px 10px; }
.ts-color-tags button { display: inline-flex; align-items: center; gap: 6px; border-radius: 18px; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.ts-color-tags button[aria-pressed=true] { border-color: #1a73e8; background: #e8f0fe; }
.ts-color-swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.ts-color-swatches button { padding: 3px; border: 0; display: grid; place-items: center; background: transparent; }
.ts-color-swatches button span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--swatch); color: var(--swatch-ink); border: 1px solid #0002; font-weight: 500; }
.ts-color-swatches button[aria-pressed=true] span { outline: 2px solid #3c4043; outline-offset: 2px; }
.ts-color-panel button:hover { background-color: #f1f3f4; }
.ts-color-panel button:focus-visible, .ts-color-button:focus-visible { outline: 2px solid #1a73e8; outline-offset: 2px; }
.ts-color-panel button:disabled { opacity: .6; cursor: wait; }
.ts-color-custom { margin-top: 10px; }
.ts-color-custom summary { cursor: pointer; padding: 6px 0; }
.ts-color-custom label { display: flex; align-items: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.ts-color-custom input[type=text], .ts-color-custom select { font: inherit; padding: 8px; border: 1px solid #dadce0; border-radius: 6px; min-width: 0; max-width: 100%; }
.ts-color-custom input[type=color] { width: 44px; height: 36px; padding: 2px; cursor: pointer; border: 1px solid #dadce0; background: white; }
.ts-color-preview { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ts-color-preview strong { font-weight: 500; overflow-wrap: anywhere; }
.ts-color-scopes { border: 0; margin: 0; padding: 0; min-width: 0; }
.ts-color-scopes legend { font-size: 16px; font-weight: 500; margin-bottom: 8px; }
.ts-color-scopes label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.ts-color-scopes input { margin: 4px 0 0; accent-color: #1a73e8; }
.ts-color-scopes small { display: block; color: #5f6368; font-size: 12px; line-height: 18px; }
.ts-color-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ts-color-panel .ts-color-primary { background: #1a73e8; color: white; border-color: transparent; }
.ts-color-panel .ts-color-primary:hover { background: #1557b0; }
.ts-color-error { color: #b3261e; font-size: 13px; line-height: 20px; margin: 12px 0 4px; }
@media (max-width: 480px) {
  #teacher-scheduler-session-bubble { padding: 16px; max-width: calc(100vw - 16px); }
  .ts-color-swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #teacher-scheduler-session-bubble .bubble-action-bar { flex-wrap: wrap; gap: 8px; }
}
/* --------------------------------------------------------------------------
   FB-2MD6FFF1PQ (T5): sidebar sections never shrink/clip, weekly pattern card,
   right-rail feedback, quiet loading bar, session popup fit, colour/attendance.
   -------------------------------------------------------------------------- */
.ts-sidebar > * {
  flex-shrink: 0;
}

.teacher-scheduler-workspace .teacher-scheduler-pattern-card,
.teacher-scheduler-workspace .teacher-scheduler-pattern-card[open] {
  margin: 4px 12px 8px;
  padding: 0 4px;
  font-size: 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

/* Same flat heading style as the Teachers and Classes sections (no box around it). */
.teacher-scheduler-workspace .teacher-scheduler-pattern-card > summary.ts-pattern-summary,
.teacher-scheduler-workspace .teacher-scheduler-pattern-card[open] > summary.ts-pattern-summary {
  height: auto;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ts-ink);
}

/* An older rule (crm-admin.css) made this panel a 420px floating dropdown, which the
   sidebar clipped. In the sidebar it is a plain, in-flow section. */
.teacher-scheduler-workspace .teacher-scheduler-pattern-card .teacher-scheduler-pattern-panel,
.teacher-scheduler-pattern-card .teacher-scheduler-pattern-panel {
  position: static;
  width: auto;
  max-width: none;
  z-index: auto;
  display: grid;
  gap: 10px;
  padding: 6px 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.teacher-scheduler-pattern-card .teacher-scheduler-pattern-steps {
  margin: 0;
  font-size: 12px;
  color: var(--ts-muted);
}

.teacher-scheduler-pattern-card .ts-pattern-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.teacher-scheduler-pattern-card .ts-pattern-field label,
.teacher-scheduler-pattern-card .ts-pattern-label {
  font-size: 12px;
  color: var(--ts-muted);
}

.teacher-scheduler-pattern-card .ts-pattern-field .crm-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 13px;
  padding: 6px 8px;
}

.teacher-scheduler-pattern-card .teacher-scheduler-day-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.teacher-scheduler-pattern-card .ts-pattern-action {
  width: 100%;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 18px;
  cursor: pointer;
  border: 1px solid #c4c7c5;
  background: #fff;
  color: #0b57d0;
}

.teacher-scheduler-pattern-card .ts-pattern-action.crm-btn-primary {
  border-color: transparent;
  background: #0b57d0;
  color: #fff;
}

.teacher-scheduler-pattern-card .ts-pattern-action:hover {
  filter: brightness(0.96);
}

.teacher-scheduler-pattern-card .ts-pattern-note {
  font-size: 12px;
}

.teacher-scheduler-pattern-card .ts-pattern-note:empty {
  display: none;
}

/* A sidebar section reached from the right rail flashes briefly so the click is visible. */
@keyframes ts-flash-highlight {
  0% { background-color: #d3e3fd; box-shadow: 0 0 0 2px #a8c7fa; }
  100% { background-color: transparent; box-shadow: 0 0 0 2px transparent; }
}

.ts-flash-highlight {
  border-radius: 8px;
  animation: ts-flash-highlight 1.5s ease-out;
}

.ts-tools .ts-icon-btn.is-active {
  background: #d3e3fd;
}

/* Loading: a thin bar over the top of the calendar; the grid itself does not move. */
.ts-calendar-surface::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, transparent 0%, #1a73e8 50%, transparent 100%) 0 0 / 40% 100% no-repeat;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.2s ease;
}

.ts-calendar-surface.is-loading::before {
  opacity: 1;
  animation: ts-loading-slide 1.1s linear infinite;
}

@keyframes ts-loading-slide {
  0% { background-position: -40% 0; }
  100% { background-position: 140% 0; }
}

/* The session popup always fits inside the window; its content scrolls inside it. */
#teacher-scheduler-session-bubble {
  max-height: calc(100vh - 32px);
  overscroll-behavior: contain;
}

.ts-color-button .ts-color-chevron {
  flex: 0 0 16px;
  color: #5f6368;
}

.ts-color-swatches button span .ts-swatch-check {
  display: block;
}

.ts-attendance-link[hidden] {
  display: none;
}

/* FB-RSMW3ZNX2Y & FB-67F12AZNTS (T1): session number out of total on pills/agenda/popover & calendar modal header */
.teacher-scheduler-workspace .pill-session-count {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 15px;
  color: var(--ts-event-meta, #3c4043);
  opacity: 0.92;
  white-space: nowrap;
}

.teacher-scheduler-workspace .teacher-scheduler-session-pill.is-compact .pill-session-count {
  margin-left: 6px;
  font-size: 10.5px;
}

.teacher-scheduler-workspace .schedule-session-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ts-event-title, #1f1f1f);
  background: rgba(0, 0, 0, 0.06);
  white-space: nowrap;
}

#teacher-scheduler-session-bubble .ts-bubble-meta-progress {
  font-size: 13px;
  font-weight: 600;
  color: var(--ts-ink, #1f1f1f);
  margin-top: 2px;
}

.bca-choices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

