.schedule-app-body {
  margin: 0;
  min-height: 100vh;
  background: #f6f2ea;
  color: #172033;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.schedule-people-panel,
.supervisor-hub-panel,
.schedule-inbox-panel {
  display: grid;
  gap: 14px;
}

.schedule-role-note {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4f5d67;
  font-size: 0.92rem;
}

.schedule-role-note span {
  flex: 1;
}

.schedule-invite-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.schedule-invite-list {
  display: grid;
  gap: 8px;
}

.schedule-invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #e2d7c7;
  border-radius: 8px;
  background: #fffaf2;
  font-size: 0.88rem;
}

.schedule-invite-row > span {
  flex: 1;
  min-width: 0;
}

.schedule-invite-row form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.schedule-invite-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #65717a;
  font-size: 0.8rem;
}

.invite-status {
  border-radius: 999px;
  padding: 2px 7px;
  background: #e8edf0;
  color: #4f5d67;
  font-size: 0.72rem;
  text-transform: capitalize;
}

.invite-status.accepted {
  background: #dcf4e6;
  color: #1f7a46;
}

.invite-status.pending {
  background: #fff0c2;
  color: #8a5a00;
}

.schedule-inline-invite,
.supervisor-allocate-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.supervisor-allocate-form {
  grid-template-columns: minmax(220px, 1.3fr) minmax(200px, 1fr) auto;
  align-items: end;
}

.supervisor-room-picker {
  display: grid;
  gap: 4px;
}

.supervisor-availability-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #4f5d67;
  font-size: 0.82rem;
  line-height: 1.2;
}

.supervisor-availability-toggle input {
  width: 15px;
  height: 15px;
}

.supervisor-room-unavailable {
  color: #9a9388;
  background: #f1e8db;
  opacity: .52;
}

.icon-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #77838c;
  border-radius: 6px;
}

.icon-link-button:hover {
  background: #f2e8d9;
  color: #b33333;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.supervisor-dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.supervisor-dept-list span,
.locked-room-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: #edf4f6;
  color: #31515b;
  padding: 3px 8px;
  font-size: 0.76rem;
}

.supervisor-locked-room .combo-input {
  border-color: #2f6f7e;
  background: #eef8fb;
}

.locked-room-note {
  margin-top: 4px;
}

.schedule-topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px 24px;
  background: #12343b;
  color: #fff;
  border-bottom: 4px solid #f2a65a;
}

.schedule-topbar--sticky {
  position: sticky;
  top: 0;
}

.schedule-brand,
.schedule-brand:hover {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #2ec4b6;
  color: #102a31;
}

.schedule-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-link,
.topbar-link:hover {
  color: #f5ead7;
  text-decoration: none;
  font-size: .9rem;
}

.schedule-page {
  width: 100%;
  min-height: calc(100vh - 62px);
  padding: 28px 0 54px;
  color: #172033;
}

.schedule-shell {
  width: min(1500px, calc(100vw - 48px));
  margin: 0 auto 40px;
}

.schedule-toolbar,
.schedule-actions,
.schedule-filterbar,
.schedule-inline-form,
.schedule-metrics,
.schedule-tabs,
.teacher-pref-controls,
.teacher-savebar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.excel-upload-form {
  margin: 0;
}

.schedule-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.schedule-history-actions .btn {
  min-width: 74px;
}

.schedule-undo-toast-stack {
  position: fixed;
  inset-inline-end: 18px;
  bottom: 18px;
  z-index: 4000;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.schedule-undo-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong, #c9d8d5);
  border-radius: 8px;
  background: var(--surface, #fffdf8);
  color: var(--text, #12343b);
  box-shadow: 0 14px 34px rgba(18, 52, 59, .16);
  font-size: .9rem;
  pointer-events: auto;
  transition: opacity .18s ease, transform .18s ease;
}

.schedule-undo-toast.hiding {
  opacity: 0;
  transform: translateY(6px);
}

.schedule-undo-toast i {
  color: var(--success, #2f8f83);
}

.schedule-undo-toast span {
  flex: 1;
}

.schedule-undo-toast button {
  border: 0;
  background: transparent;
  color: var(--primary, #2f6f7e);
  font-weight: 750;
  padding: 0;
}

.schedule-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.schedule-toolbar h2,
.workspace-hero h1,
.board-hero h1,
.teacher-pref-header h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: #6c5f4d;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.schedule-message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.schedule-message {
  border: 1px solid #d7c8ad;
  border-left: 4px solid #2ec4b6;
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px 12px;
  color: #26353a;
  font-size: .92rem;
}

.workspace-hero,
.board-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 420px);
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid #d9cdb8;
  box-shadow: 0 14px 38px rgba(30, 52, 48, .08);
}

.board-hero {
  grid-template-columns: minmax(280px, 1fr) auto;
}

.workspace-hero h1,
.board-hero h1 {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  line-height: 1.04;
  color: #12343b;
}

.workspace-hero p,
.board-hero p {
  max-width: 720px;
  margin: 8px 0 14px;
  color: #52615c;
}

.schedule-visual {
  position: relative;
  display: grid;
  gap: 9px;
  padding: 16px;
  border-radius: 8px;
  background: #12343b;
  color: #fff;
  min-height: 190px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.visual-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
}

.visual-row.strong {
  background: #2ec4b6;
  color: #0b2c32;
  font-weight: 800;
}

.visual-row.warn {
  background: #f2a65a;
  color: #3a2410;
}

.visual-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: auto;
}

.visual-dots b {
  display: block;
  height: 8px;
  border-radius: 8px;
  background: #f4d35e;
}

.schedule-page .btn-primary,
.schedule-landing .btn-primary {
  background: #d95d39;
  border-color: #d95d39;
}

.schedule-page .btn-primary:hover,
.schedule-landing .btn-primary:hover {
  background: #bd4e2f;
  border-color: #bd4e2f;
}

.schedule-page .btn-outline-primary,
.schedule-landing .btn-outline-primary {
  color: #12343b;
  border-color: #2ec4b6;
}

.schedule-page .btn-outline-primary:hover,
.schedule-landing .btn-outline-primary:hover {
  color: #102a31;
  background: #2ec4b6;
  border-color: #2ec4b6;
}

.schedule-two-column {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 16px;
}

.schedule-dashboard-grid {
  --semester-dashboard-card-height: 322px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.semester-dashboard-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 12px;
}

.semester-sort-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.semester-sort-form label {
  color: var(--text-soft, #5f6d80);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.semester-sort-form .form-select {
  width: auto;
  min-width: 142px;
}

@media (max-width: 560px) {
  .semester-dashboard-toolbar {
    justify-content: stretch;
  }

  .semester-sort-form,
  .semester-sort-form .form-select {
    width: 100%;
  }
}

.semester-card {
  position: relative;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  gap: 14px;
  border: 1px solid #d9cdb8;
  background: #fffdf8;
  border-radius: 8px;
  padding: 15px 86px 15px 15px;
  box-shadow: 0 10px 28px rgba(30, 52, 48, .07);
  transition: box-shadow .22s ease, transform .22s ease;
}

.semester-card--owned,
.semester-create-card {
  min-height: var(--semester-dashboard-card-height);
}

.semester-card--shared {
  padding-right: 15px;
}

.semester-card-top-actions {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.semester-card-delete-form {
  margin: 0;
}

.semester-card-icon-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft, #5f6d80);
}

.semester-card-icon-button:hover,
.semester-card-icon-button:focus {
  background: var(--surface-soft, #fffaf0);
  border-color: var(--border-strong, #c8b99e);
  color: var(--text, #12343b);
}

.semester-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: #12343b;
}

.semester-card-main {
  flex: 1 1 auto;
  min-width: 0;
}

.semester-card--owned .semester-card-main {
  padding-inline-end: 78px;
}

.semester-card-title-link,
.semester-card-title-link:hover {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: inherit;
  text-decoration: none;
}

.semester-card-title-link:hover,
.semester-card-title-link:focus {
  color: var(--primary, #5d8f88);
}

.semester-card--owned.is-renaming .semester-card-main {
  padding-inline-end: 0;
  padding-block-start: 40px;
  margin-inline-end: -71px;
}

.semester-title-input {
  width: 100%;
  max-width: 100%;
  font-size: 1.05rem;
  font-weight: 750;
}

.semester-title-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.semester-title-actions[hidden] {
  display: none;
}

.semester-title-input.saving {
  border-color: var(--border-strong, #c8b99e);
  background: var(--surface-soft, #fffaf0);
}

.semester-title-input.save-error {
  border-color: var(--danger, #9b2c2c);
  background: var(--danger-soft, #fff0f0);
}

.semester-card-meta,
.semester-card-actions,
.landing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.semester-card-meta span {
  color: #5f6d80;
  font-size: .83rem;
}

.semester-reference-code {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-soft, #5f6d80);
  font-size: .82rem;
  font-weight: 700;
}

.semester-reference-code code {
  min-width: 0;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(29, 99, 237, .09);
  color: var(--text, #12343b);
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.semester-card-actions {
  margin-top: auto;
  min-width: 0;
  padding-top: 2px;
  flex-wrap: wrap;
}

.semester-card--owned .semester-card-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  align-items: stretch;
}

.semester-card-actions form {
  flex: 0 0 auto;
  margin: 0;
}

.semester-card--owned .semester-card-actions form {
  display: grid;
  min-width: 0;
}

.semester-card-actions .btn {
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.semester-card--owned .semester-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.15;
}

.semester-create-card {
  padding-right: 15px;
}

.semester-create-form {
  display: grid;
  gap: 8px;
}

.semester-create-form label {
  margin: 0;
  color: var(--primary, #5d8f88);
  font-size: .78rem;
  font-weight: 750;
}

.semester-create-form .btn {
  justify-self: flex-start;
}

.semester-create-form .errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--danger, #9b2c2c);
  font-size: .78rem;
}

.semester-card-invites {
  display: grid;
  gap: 0;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
  align-self: stretch;
  margin: 12px -86px -15px -15px;
  padding: 0 15px;
  border-top: 1px solid transparent;
  background: linear-gradient(180deg, #fffaf1 0%, #fff5e6 100%);
  opacity: 0;
  overflow: hidden;
  transform: translateY(-8px);
  max-height: 0;
  transition: max-height .28s ease, opacity .2s ease, transform .24s ease, padding .24s ease, border-color .2s ease;
  will-change: max-height, opacity, transform, padding;
}

.semester-card-invites.is-open {
  padding: 14px 15px 15px;
  border-color: #eddcbc;
  opacity: 1;
  transform: translateY(0);
}

.semester-card-invites[hidden] {
  display: none;
}

.semester-card-actions [data-semester-share-toggle].active {
  color: #12343b;
  border-color: #2ec4b6;
  background: #e8fbf8;
}

.semester-card-invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.semester-card-invite-form .form-control {
  grid-column: 1 / -1;
  min-width: 0;
}

.semester-card-invite-form .btn {
  justify-self: start;
  white-space: nowrap;
}

.semester-reference-card-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  margin: 0;
  padding: 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.semester-card-invites > * + * {
  border-top: 1px solid rgba(173, 138, 76, .14);
}

.semester-reference-card-form .form-control {
  grid-column: 1 / -1;
  min-width: 0;
}

.semester-reference-card-form .btn {
  justify-self: start;
  white-space: nowrap;
}

.semester-reference-card-form .semester-share-info {
  justify-self: start;
}

.semester-share-info {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(173, 138, 76, .18);
  background: rgba(255, 253, 248, .92);
  font-size: .82rem;
  color: var(--text-soft, #5f6d80);
  cursor: pointer;
  opacity: .88;
  flex-shrink: 0;
  transition: border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.semester-share-info:hover {
  opacity: 1;
  color: var(--primary, #5d8f88);
  border-color: rgba(93, 143, 136, .32);
  background: rgba(255, 255, 255, .95);
  transform: translateY(-1px);
}

.semester-info-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #1e2d3d;
  color: #fff;
  font-size: .8rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
}

.semester-info-tooltip[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .semester-card--owned {
    min-height: 0;
  }

  .semester-card--owned .semester-card-main {
    padding-inline-end: 0;
    padding-block-start: 36px;
  }

  .semester-card-invites {
    margin: 12px -15px -15px;
    padding: 0 15px;
  }

  .semester-card--owned .semester-card-actions {
    grid-template-columns: 1fr;
  }

  .semester-card-invite-form,
  .semester-reference-card-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .semester-card-invite-form .form-control,
  .semester-reference-card-form .form-control,
  .semester-reference-code {
    grid-column: 1 / -1;
  }

  .semester-card-invite-form .btn {
    justify-self: stretch;
  }

  .semester-reference-card-form .btn {
    justify-self: stretch;
  }
}

.semester-card-access-list {
  display: grid;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border, #eadfcc);
}

.semester-card-invites .semester-card-access-list {
  gap: 8px;
  padding: 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.semester-card-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
}

.semester-card-access-row span {
  min-width: 0;
  color: var(--text-soft, #5f6d80);
  font-size: .82rem;
}

.semester-card-access-row form {
  margin: 0;
}

.semester-card--shared .semester-card-actions {
  flex-wrap: wrap;
}

.semester-card--shared .semester-card-actions select {
  min-width: 150px;
}

.trash-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trash-section-collapsed {
  margin-top: 2px;
}

.trash-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 8px;
  background: var(--surface-soft, #fffaf0);
  color: var(--text-soft, #5f6d80);
  padding: 6px 10px;
  font-size: .84rem;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.trash-toggle::marker {
  content: "";
}

.trash-toggle::-webkit-details-marker {
  display: none;
}

.trash-toggle span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trash-toggle:hover,
.trash-toggle:focus {
  border-color: var(--border-strong, #c8b99e);
  background: var(--surface-strong, #fffdf8);
  color: var(--text, #12343b);
  outline: none;
}

.trash-count {
  min-width: 24px;
  justify-content: center;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  padding: 1px 7px;
  font-size: .76rem;
}

.trash-section-collapsed .trash-list {
  margin-top: 10px;
}

.trash-list {
  display: grid;
  gap: 8px;
}

.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #ece1cf;
  padding-top: 10px;
}

.trash-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.trash-row div {
  display: grid;
  gap: 2px;
}

.trash-row span {
  color: #5f6d80;
  font-size: .83rem;
}

.trash-row form {
  margin: 0;
}

.archived-semester-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quality-list {
  display: grid;
  gap: 10px;
  color: #4f5e72;
}

.quality-list span {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.quality-list i {
  color: #d95d39;
}

.empty-state {
  grid-column: 1 / -1;
}

.schedule-panel {
  border: 1px solid #d9cdb8;
  background: #fffdf8;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 28px rgba(30, 52, 48, .06);
}

.schedule-panel.compact {
  padding: 10px 12px;
}

.schedule-panel summary {
  cursor: pointer;
  font-weight: 700;
}

.schedule-panel h3 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.schedule-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px 12px;
  text-align: left;
}

.schedule-form-grid p {
  margin: 0;
}

.schedule-form-grid label {
  display: block;
  font-size: .78rem;
  color: #6c5f4d;
  margin-bottom: 3px;
  font-weight: 700;
}

.schedule-form-grid textarea,
.schedule-form-grid .wide {
  grid-column: 1 / -1;
}

.field-stack {
  display: grid;
  gap: 5px;
}

.field-stack span,
.time-pick-row > span,
.day-picker legend {
  color: #6c5f4d;
  font-size: .78rem;
  font-weight: 750;
}

.time-builder {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(320px, 2fr) minmax(210px, 1fr) minmax(210px, 1fr) minmax(110px, .6fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.time-builder input,
.time-builder select {
  min-height: 38px;
}

.day-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.day-picker legend {
  flex: 0 0 100%;
  margin: 0 0 2px;
}

.day-picker label {
  position: relative;
  margin: 0;
}

.day-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.day-picker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #d9cdb8;
  border-radius: 999px;
  background: #fffaf0;
  color: #38485b;
  font-size: .86rem;
  font-weight: 750;
  cursor: pointer;
  user-select: none;
}

.day-picker input:checked + span {
  border-color: #2ec4b6;
  background: #dff8f5;
  color: #12343b;
  box-shadow: inset 0 0 0 1px #2ec4b6;
}

.day-picker input:focus-visible + span {
  outline: 2px solid #12343b;
  outline-offset: 2px;
}

.time-pick-row {
  display: grid;
  gap: 5px;
}

.time-selects {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 6px;
}

.time-submit {
  min-height: 38px;
  white-space: nowrap;
}

.sort-field {
  min-width: 96px;
}

.column-tools-inline {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

[data-column-tool-panel] {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 36;
  min-width: min(540px, calc(100vw - 24px));
  max-width: min(760px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid var(--border, #d8c9b2);
  border-radius: 10px;
  background: var(--surface-strong, #fffdf8);
  box-shadow: var(--shadow-pop, 0 18px 40px rgba(18, 52, 59, .2));
}

.custom-field-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(150px, 1fr) minmax(220px, 1.6fr);
  gap: 10px;
  align-items: center;
  margin-top: 0;
}

.custom-field-form .btn {
  grid-column: 1 / -1;
  justify-self: end;
}

.custom-field-form [name="name"].is-invalid {
  border-color: var(--danger, #ef4444);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger, #ef4444) 20%, transparent);
}

[data-custom-field-choices]:disabled {
  cursor: not-allowed;
  opacity: .62;
}

.column-tool-tabs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0;
  padding: 3px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffaf0;
  width: fit-content;
}

.column-tool-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #48576b;
  padding: 5px 10px;
  font-weight: 750;
}

.column-tool-tab.active,
.column-tool-tab:hover,
.column-tool-tab:focus {
  background: #dff8f5;
  color: #12343b;
}

.first-weekday-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 3px 0 7px;
  color: var(--text-soft, #48576b);
  font-size: .8rem;
  font-weight: 750;
  white-space: nowrap;
}

.first-weekday-control .form-select {
  width: auto;
  min-width: 108px;
  min-height: 30px;
  border-radius: 6px;
  padding-block: 3px;
}

[data-column-tool-panel][hidden] {
  display: none;
}

.column-import-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.column-import-form.simple {
  grid-template-columns: minmax(150px, 220px) minmax(180px, 260px) auto;
  justify-content: start;
}

.column-import-form label {
  display: grid;
  gap: 5px;
  margin: 0;
}

.column-import-form label span {
  color: #6c5f4d;
  font-size: .78rem;
  font-weight: 750;
}

.column-import-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-field-cell input,
.custom-field-cell select,
.custom-field-cell textarea {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 2px 0;
  font: inherit;
  outline: none;
}

.custom-field-cell input[type="text"],
.custom-field-cell input[type="search"],
.custom-field-cell input[type="email"],
.custom-field-cell input[type="url"] {
  text-align: inherit;
}

.custom-field-cell input[type="number"] {
  text-align: end;
}

.custom-field-cell textarea {
  min-height: 56px;
  resize: vertical;
}

.custom-field-cell input[type="checkbox"] {
  padding: 0;
}

.custom-multi-select {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.subfield-check-list {
  min-width: 0;
}

.course-subfield-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
  padding: 4px 0;
}

.course-subfield-input::placeholder {
  color: #b3a78f;
  opacity: 1;
}

.custom-multi-select label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text, #172033);
  font-weight: 600;
  white-space: nowrap;
}

.custom-multi-select span {
  overflow-wrap: normal;
  white-space: nowrap;
}

.custom-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 2px 4px;
  border-radius: 6px;
}

.custom-rating button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #d8cdb5;
  padding: 0;
  line-height: 1;
  font-size: 1.05rem;
  cursor: pointer;
  transition: color .12s ease, transform .12s ease, filter .12s ease, background-color .12s ease;
}

.custom-rating button.selected {
  color: #f5a623;
  filter: drop-shadow(0 1px 0 rgba(180, 110, 4, .35));
}

.custom-rating:hover button.selected {
  color: #ddb066;
  filter: none;
}

.custom-rating button:hover,
.custom-rating button:focus-visible {
  color: #f5a623;
  background: transparent;
  transform: scale(1.18);
  filter: drop-shadow(0 1px 2px rgba(245, 166, 35, .45));
  outline: none;
}

.custom-rating button:hover ~ button:not(.rating-clear) {
  color: #d8cdb5;
  filter: none;
}

.custom-rating .rating-clear {
  margin-left: 6px;
  width: 18px;
  height: 18px;
  font-size: .7rem;
  color: #b3a78f;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .12s ease, color .12s ease, background-color .12s ease;
}

.schedule-grid tr:hover .custom-rating .rating-clear,
.custom-rating .rating-clear:focus-visible {
  opacity: .75;
}

.custom-rating .rating-clear:hover,
.custom-rating .rating-clear:focus-visible {
  color: #fff;
  background: #d05a4a;
  transform: none;
  filter: none;
  opacity: 1;
}

.schedule-grid input[type="checkbox"].lookup-checkbox,
.schedule-grid input[type="checkbox"].lookup-checkbox:hover {
  cursor: default;
  border-color: #c2b8a4;
}

.schedule-grid input[type="checkbox"].lookup-checkbox:checked {
  background: var(--primary, #1d63ed);
  border-color: var(--primary, #1d63ed);
  opacity: .75;
}

.lookup-cell-value {
  display: inline-block;
  min-width: 0;
  min-height: 22px;
  padding: 2px 8px;
  color: #48576b;
  background: rgba(46, 196, 182, .1);
  border: 1px solid rgba(46, 196, 182, .25);
  border-radius: 999px;
  font-size: .8rem;
  white-space: nowrap;
}

.rule-help-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 8px;
  color: #64736d;
  font-size: .82rem;
}

.rule-help-strip code {
  color: #12343b;
}

.rule-help-strip strong {
  color: #12343b;
}

.rule-setting-cell,
.rule-condition-cell {
  min-width: 190px;
}

.rule-setting-cell.is-readonly,
.rule-condition-copy,
.rule-muted-value {
  color: #66756f;
}

.rule-setting-input {
  width: 92px;
  min-height: 30px;
  border: 1px solid #e4d8c4;
  border-radius: 6px;
  background: #fffaf0;
  padding: 3px 6px;
  font: inherit;
}

.rule-setting-cell .rule-muted-value:not(:only-child) {
  display: inline-block;
  margin-left: 8px;
  font-size: .78rem;
}

.rule-condition-combobox {
  min-width: 210px;
}

.faculty-share-panel {
  margin-top: 0;
}

.faculty-share-form {
  display: grid;
  gap: 12px;
}

.faculty-share-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.faculty-compose-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.faculty-compose-chevron {
  font-size: .8rem;
  transition: transform .18s ease;
}

.faculty-compose-toggle.is-open .faculty-compose-chevron {
  transform: rotate(180deg);
}

.faculty-compose-panel {
  display: grid;
  gap: 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: max-height .3s ease, opacity .2s ease, transform .2s ease, visibility 0s linear .3s;
  visibility: hidden;
}

.faculty-compose-panel.is-open {
  max-height: 1600px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: max-height .34s ease, opacity .24s ease, transform .24s ease, visibility 0s;
  visibility: visible;
}

.faculty-share-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) minmax(190px, 260px);
  gap: 12px;
}

.faculty-share-grid .message {
  grid-column: 1 / -1;
}

.faculty-share-grid .message textarea {
  min-height: calc(1.5em * 5 + 1rem);
  overflow: hidden;
  resize: vertical;
}

.faculty-message-bidi-field,
.teacher-message {
  text-align: start;
  unicode-bidi: plaintext;
}

.faculty-template-tokens {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: max-height .24s ease, opacity .18s ease, transform .18s ease;
}

.faculty-template-tokens.is-visible {
  max-height: 180px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.template-token-button {
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 6px;
  background: var(--surface-soft, #fffaf0);
  color: var(--text-soft, #48576b);
  font-size: .78rem;
  font-weight: 750;
  padding: 4px 8px;
}

.template-token-button:hover,
.template-token-button:focus {
  border-color: var(--primary, #5d8f88);
  background: var(--primary-soft, #fffaf0);
  color: var(--text, #12343b);
}

.faculty-share-save-status {
  margin-inline-start: auto;
  color: #64736d;
  font-size: .82rem;
  font-weight: 800;
}

.faculty-share-save-status.saving {
  color: #76612a;
}

.faculty-share-save-status.saved {
  color: #1f7a65;
  animation: scheduleFadeAfterSuccess 1.45s ease .35s forwards;
}

.faculty-share-save-status.error {
  color: #8b2f2f;
}

.faculty-link-preview {
  display: grid;
  gap: 3px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px 12px;
}

.faculty-link-preview strong {
  color: #12343b;
}

.faculty-link-preview span {
  color: #38485b;
  font-size: .88rem;
}

.faculty-link-preview small {
  color: #667386;
}

.faculty-link-cell {
  display: grid;
  gap: 4px;
  min-width: 210px;
}

.faculty-class-count-cell {
  min-width: 120px;
  text-align: center;
  font-weight: 800;
  color: var(--text, #12343b);
}

.faculty-request-notes {
  display: grid;
  min-width: 320px;
}

.faculty-request-note-box {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 7px;
  background: var(--surface-soft, #fffaf0);
}

.faculty-request-note-box:focus-within {
  border-color: var(--primary, #5d8f88);
  background: var(--surface-strong, #ffffff);
  box-shadow: 0 0 0 3px rgba(29, 99, 237, .14);
}

.faculty-request-note-check-wrap {
  overflow: hidden;
  border-right: 1px solid var(--border, #d9cdb8);
  background: rgba(29, 99, 237, .04);
  padding-top: 7px;
}

.faculty-request-note-checks {
  display: grid;
  transition: transform .08s linear;
}

.faculty-request-note-check-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 0;
  padding-top: 3px;
}

.faculty-request-note-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #1d63ed);
}

.faculty-request-note-textbox {
  width: 100%;
  min-height: 90px;
  border: 0;
  background: transparent;
  color: var(--text, #12343b);
  padding: 7px 9px;
  font-size: .84rem;
  line-height: 22px;
  resize: vertical;
}

.faculty-request-note-textbox:focus {
  outline: none;
}

.faculty-request-note-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  min-width: 96px;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 8px;
  background: var(--surface-strong, #ffffff);
  color: var(--text-soft, #48576b);
  padding: 7px 11px;
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-pop, 0 16px 40px rgba(30, 52, 48, .18));
}

.faculty-request-note-status.saving {
  border-color: rgba(245, 158, 11, .42);
  background: var(--warning-soft, #fff8dc);
}

.faculty-request-note-status.saved {
  border-color: rgba(19, 164, 99, .36);
  background: var(--success-soft, #ecfdf3);
  color: var(--success, #1f7a65);
  animation: scheduleFadeAfterSuccess 1s ease forwards;
}

.faculty-request-note-status.error {
  border-color: rgba(239, 68, 68, .4);
  background: var(--danger-soft, #fff0f0);
  color: var(--danger, #8b2f2f);
}

.faculty-teacher-note {
  display: block;
  max-width: 360px;
  color: #38485b;
  white-space: pre-wrap;
}

.faculty-teacher-note strong {
  color: #12343b;
}

.faculty-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.faculty-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  min-height: 30px;
  border: 1px solid #2ec4b6;
  border-radius: 6px;
  background: #dff8f5;
  color: #12343b;
  padding: 5px 9px;
  font-weight: 750;
  text-decoration: none;
}

.faculty-link-button:hover {
  background: #2ec4b6;
  color: #102a31;
  text-decoration: none;
}

.faculty-link-button.whatsapp {
  border-color: #22c55e;
  background: #dcfce7;
  color: #14532d;
}

.faculty-link-button.whatsapp:hover {
  background: #22c55e;
  color: #052e16;
}

.faculty-link-button.email {
  border-color: #60a5fa;
  background: #dbeafe;
  color: #1e3a8a;
}

.faculty-link-button.email:hover {
  background: #60a5fa;
  color: #0f172a;
}

.faculty-link-button.copy {
  border-color: #a78bfa;
  background: #ede9fe;
  color: #4c1d95;
  cursor: pointer;
}

.faculty-link-button.copy:hover {
  background: #a78bfa;
  color: #1e1b4b;
}

.faculty-link-button.copy.copied {
  border-color: #22c55e;
  background: #dcfce7;
  color: #14532d;
}

.faculty-link-button.copy.copy-error {
  border-color: #dc2626;
  background: #fee2e2;
  color: #7f1d1d;
}

.schedule-list {
  display: grid;
  gap: 8px;
}

.schedule-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  color: inherit;
  text-decoration: none;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
}

.schedule-list-row small,
.muted {
  display: block;
  color: #667386;
}

.schedule-metrics {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.schedule-metrics span {
  border: 1px solid #d9cdb8;
  border-radius: 6px;
  padding: 6px 10px;
  background: transparent;
  cursor: default;
}

.schedule-tabs {
  overflow-x: auto;
  border-bottom: 1px solid #d9cdb8;
  margin-bottom: 12px;
}

.schedule-tabs a {
  padding: 10px 12px;
  color: #48576b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.schedule-tabs a.active {
  color: #12343b;
  border-color: #d95d39;
  font-weight: 700;
}

.schedule-filterbar {
  justify-content: space-between;
  margin-bottom: 10px;
}

.schedule-inline-form {
  width: min(720px, 100%);
}

.class-view-header {
  position: relative;
  margin-bottom: 8px;
}

.class-view-tabs {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
}

.class-view-primary-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  max-width: calc(100% - 180px);
  overflow-x: auto;
  padding: 10px 4px 8px;
}

.view-tabs-save-button {
  flex: 0 0 auto;
  min-height: 34px;
  white-space: nowrap;
}

.view-save-button-group {
  display: inline-flex;
  flex: 0 0 auto;
}

.view-tabs-save-button:has(+ .view-tabs-menu-button) {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.view-tabs-menu-button {
  min-width: 32px;
  min-height: 34px;
  margin-inline-start: -1px;
  padding-inline: 8px;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.view-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #d8c9b2;
  border-radius: 999px;
  background: #fffdf8;
  color: #48576b;
  text-decoration: none;
  font-size: .9rem;
  white-space: nowrap;
}

.view-chip:hover {
  color: #12343b;
  text-decoration: none;
}

.view-chip.active {
  border-color: #2ec4b6;
  background: #dff8f4;
  color: #12343b;
  font-weight: 700;
}

.view-chip-button,
.view-share-button,
.view-panel-close,
.view-rule-remove,
.view-rule-move {
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #48576b;
}

.view-chip-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.view-share-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 11px;
  font-size: .86rem;
  font-weight: 750;
  white-space: nowrap;
}

.view-save-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}

.view-save-status[hidden] {
  display: none;
}

.view-save-status.saving {
  border: 1px solid #ecd27c;
  background: #fff8dc;
  color: #735900;
}

.view-save-status.saved {
  border: 1px solid #9be1c0;
  background: #ecfdf3;
  color: #145734;
  animation: scheduleFadeAfterSuccess 1.45s ease .35s forwards;
}

.view-save-status.error {
  border: 1px solid #f0b4b4;
  background: #fff0f0;
  color: #8b2f2f;
}

.view-chip-button:hover,
.view-share-button:hover,
.view-panel-close:hover,
.view-rule-remove:hover,
.view-rule-move:hover {
  border-color: #2ec4b6;
  color: #12343b;
}

.view-action-popover,
.view-share-popover,
.view-save-popover {
  position: absolute;
  z-index: 35;
  width: min(390px, calc(100vw - 32px));
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 34px rgba(18, 52, 59, .18);
  padding: 10px;
}

.view-action-popover {
  top: 42px;
  right: 0;
  display: none;
  gap: 4px;
  width: min(320px, calc(100vw - 32px));
}

.view-share-popover {
  top: 42px;
  right: 0;
  display: none;
}

.view-action-popover.open,
.view-share-popover.open {
  display: grid;
}

.view-rename-form,
.save-view-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view-rename-form {
  padding: 8px 4px 4px;
}

.view-rename-form[hidden] {
  display: none;
}

.view-action-menu-form {
  margin: 0;
}

.view-action-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: transparent;
  color: #48576b;
  font-size: .86rem;
  font-weight: 750;
  text-align: start;
}

.view-action-menu-item:hover,
.view-action-menu-item:focus-visible {
  background: rgba(29, 99, 237, .08);
  color: var(--primary, #1d63ed);
}

.view-action-menu-item.danger {
  color: var(--danger, #dc3545);
}

.view-action-menu-item.danger:hover,
.view-action-menu-item.danger:focus-visible {
  background: rgba(220, 53, 69, .08);
}

.view-share-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid #eadfce;
  padding-top: 8px;
}

.view-share-list h4 {
  margin: 0;
  font-size: .82rem;
  font-weight: 800;
  color: #48576b;
}

.view-share-row {
  display: grid;
  gap: 6px;
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: #fffaf1;
  padding: 8px;
}

.view-share-link-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px;
  gap: 6px;
  align-items: center;
}

.view-share-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #48576b;
  font-size: .82rem;
}

.view-rename-form .form-control,
.save-view-form .form-control {
  width: min(260px, 100%);
}

.class-view-builder {
  position: relative;
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.offerings-tool-area {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px 4px;
  align-items: start;
  margin-bottom: 12px;
}

.offerings-tool-area .class-view-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
}

.offerings-tool-area .class-view-builder,
.offerings-tool-area .column-tools-inline {
  margin-bottom: 0;
}

.offerings-tool-area .column-tools-inline {
  grid-column: 2;
  min-width: 0;
}

.offerings-tool-area .class-view-primary-actions {
  flex-wrap: nowrap;
}

.offerings-tool-area .view-pill.matrix {
  flex: 0 0 auto;
  min-width: 220px;
}

.class-view-controls {
  display: grid;
  gap: 8px;
}

.view-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 12px;
  color: #172033;
  font-weight: 650;
}

.view-pill.matrix {
  flex: 1 1 320px;
  justify-content: flex-start;
  min-width: 220px;
  border-color: #2ec4b6;
  background: #dff8f5;
  color: #12343b;
}

.view-pill.matrix:hover,
.view-pill.matrix:focus {
  background: #2ec4b6;
  color: #102a31;
}

.view-pill.filter {
  background: #e9f5ff;
  --view-rule-count-bg: #e9f5ff;
  --view-rule-count-border: #9ed1ff;
}

.view-pill.group {
  background: #ebe5ff;
  --view-rule-count-bg: #ebe5ff;
  --view-rule-count-border: #b8a5ff;
}

.view-pill.sort {
  background: #ffe4d5;
  --view-rule-count-bg: #ffe4d5;
  --view-rule-count-border: #ffb28a;
}

.view-pill.columns {
  background: #e6f7ed;
}

.view-rule-count {
  position: absolute;
  top: -9px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--view-rule-count-border, #ffffff);
  border-radius: 999px;
  background: var(--view-rule-count-bg, #ffffff);
  color: #172033;
  box-shadow: 0 8px 16px rgba(18, 52, 59, .18);
  font-size: .7rem;
  font-weight: 850;
  line-height: 1;
  pointer-events: none;
}

.view-rule-count[hidden] {
  display: none;
}

.view-overlay-panel {
  position: absolute;
  top: 44px;
  left: 0;
  z-index: 34;
  width: min(720px, calc(100vw - 32px));
  border: 1px solid #d8c9b2;
  border-radius: 8px;
  padding: 10px;
  background: #fffdf8;
  box-shadow: 0 16px 34px rgba(18, 52, 59, .18);
}

.view-overlay-panel[hidden],
.view-save-popover[hidden] {
  display: none;
}

.view-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.view-panel-head h3 {
  margin: 0 0 8px;
  color: #48576b;
  font-size: .88rem;
  font-weight: 750;
}

.view-panel-close,
.view-rule-remove,
.view-rule-move {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.view-rule-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, .8fr) minmax(130px, 1fr) 30px;
  gap: 8px;
  margin-bottom: 8px;
}

.view-rule-row.filter-rule.no-value {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, .8fr) 30px;
}

.view-rule-row.two {
  grid-template-columns: minmax(140px, 1fr) minmax(110px, .7fr) 30px;
}

.view-rule-row.sort-rule {
  grid-template-columns: minmax(140px, 1fr) minmax(110px, .7fr) auto;
}

.view-rule-row.removed {
  display: none;
}

.view-rule-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.view-save-popover {
  top: 44px;
  right: 0;
}

.view-column-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.view-column-list input {
  accent-color: #2ec4b6;
}

.view-column-list .column-menu-row {
  display: grid;
}

@media (max-width: 700px) {
  .offerings-tool-area {
    grid-template-columns: 1fr;
  }

  .offerings-tool-area .class-view-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .offerings-tool-area .class-view-primary-actions {
    max-width: 100%;
  }

  .offerings-tool-area .column-tools-inline {
    grid-column: 1;
    min-width: 0;
  }

  .view-overlay-panel,
  .view-save-popover,
  .view-share-popover,
  .view-action-popover {
    left: 0;
    right: auto;
    width: calc(100vw - 32px);
  }

  .view-rule-row,
  .view-rule-row.two,
  .view-rule-row.filter-rule.no-value {
    grid-template-columns: 1fr 30px;
  }

  .view-rule-row.sort-rule {
    grid-template-columns: 1fr auto;
  }

  .view-rule-row .form-control,
  .view-rule-row .form-select {
    grid-column: 1;
  }

  .view-rule-remove {
    grid-column: 2;
    grid-row: 1;
  }
}

.schedule-table-wrap {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
}

.schedule-grid {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .85rem;
}

.schedule-grid thead {
  position: sticky;
  top: var(--schedule-sticky-header-top, 0);
  z-index: 5;
}

.schedule-grid th,
.schedule-grid td {
  box-sizing: border-box;
  border-right: 1px solid #e8eaef;
  border-bottom: 1px solid #e8eaef;
  padding: 7px 12px;
  vertical-align: middle;
  background: #ffffff;
  white-space: nowrap;
  line-height: 1.4;
}

.schedule-grid td {
  text-align: start;
}

.schedule-grid td[contenteditable="true"],
.schedule-grid input[type="text"],
.schedule-grid input[type="search"],
.schedule-grid input[type="email"],
.schedule-grid input[type="url"],
.schedule-grid input:not([type]),
.schedule-grid textarea,
.combo-input {
  unicode-bidi: plaintext;
}

.schedule-grid input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  border: 1.5px solid #c2b8a4;
  border-radius: 5px;
  background: #ffffff;
  cursor: pointer;
  vertical-align: middle;
  display: inline-grid;
  place-items: center;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.schedule-grid input[type="checkbox"]:hover {
  border-color: var(--primary, #1d63ed);
}

.schedule-grid input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 99, 237, .25);
}

.schedule-grid input[type="checkbox"]:checked {
  background: var(--primary, #1d63ed);
  border-color: var(--primary, #1d63ed);
}

.schedule-grid input[type="checkbox"]:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.schedule-grid input[type="checkbox"]:indeterminate {
  background: var(--primary, #1d63ed);
  border-color: var(--primary, #1d63ed);
}

.schedule-grid input[type="checkbox"]:indeterminate::after {
  content: "";
  width: 10px;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
}

.schedule-grid td:has(> input[type="checkbox"]),
.schedule-grid td:has(> input[type="checkbox"]:only-child) {
  text-align: center;
}

.schedule-grid td > input[type="checkbox"] {
  margin: 0 auto;
}

.schedule-grid input[type="search"]::-webkit-search-cancel-button,
.schedule-grid input[type="search"]::-webkit-search-decoration {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

.schedule-grid tr:hover input[type="search"]::-webkit-search-cancel-button,
.schedule-grid input[type="search"]:focus::-webkit-search-cancel-button {
  opacity: .65;
  pointer-events: auto;
}

.schedule-grid input[type="search"]::-webkit-search-cancel-button:hover {
  opacity: 1;
}

.schedule-grid th {
  position: sticky;
  top: var(--schedule-sticky-header-top, 0);
  z-index: 2;
  background: #12343b;
  color: #f5ead7;
  font-size: .72rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.15;
  cursor: cell;
  user-select: none;
  padding-top: 9px;
  padding-bottom: 9px;
}

.schedule-grid th [data-column-label] {
  hyphens: auto;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 9px;
  cursor: col-resize;
  z-index: 5;
  user-select: none;
  touch-action: none;
}

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 18%;
  bottom: 18%;
  left: 50%;
  width: 1px;
  background: rgba(20, 30, 50, .14);
  transform: translateX(-0.5px);
  transition: background-color .12s ease, width .12s ease;
}

.schedule-grid th:hover .column-resize-handle::after {
  background: rgba(20, 30, 50, .3);
}

.column-resize-handle:hover::after,
.schedule-grid th.is-resizing .column-resize-handle::after,
body.column-resize-active .column-resize-handle.active::after {
  background: var(--primary, #1d63ed);
  width: 3px;
}

.schedule-grid th.is-resizing {
  background-color: #eef1f6;
}

body.column-resize-active {
  cursor: col-resize !important;
  user-select: none;
}

body.column-resize-active * {
  cursor: col-resize !important;
}

.schedule-grid th[data-column-key] {
  padding-right: 22px;
  cursor: pointer;
}

.schedule-grid th[data-column-key]::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  opacity: .55;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid rgba(91, 100, 115, .5);
  border-right: 0;
}

.schedule-grid th[data-column-key].sorted-asc::after {
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom: 5px solid var(--primary, #1d63ed);
  opacity: 1;
  width: 0;
}

.schedule-grid th[data-column-key].sorted-desc::after {
  border-left: 0;
  border-right: 0;
  border-top: 5px solid var(--primary, #1d63ed);
  border-bottom: 0;
  opacity: 1;
  width: 0;
}

.schedule-grid th[data-column-key] .column-autofill-button {
  margin-right: 12px;
}

.schedule-grid th [data-column-label] {
  display: inline-block;
  vertical-align: middle;
}

.column-autofill-button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 5px;
  border: 0;
  border-radius: 5px;
  background: rgba(20, 30, 50, .05);
  color: var(--text-soft, #5b6473);
  font-size: .72rem;
  vertical-align: middle;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease, background-color .12s ease, color .12s ease, transform .12s ease;
}

.schedule-grid th:hover .column-autofill-button,
.column-autofill-button:focus-visible {
  opacity: 1;
}

.column-autofill-button:hover,
.column-autofill-button:focus {
  background: var(--primary, #1d63ed);
  color: #ffffff;
  transform: scale(1.08);
  outline: none;
  opacity: 1;
}

.schedule-grid th a {
  color: inherit;
  text-decoration: none;
}

.schedule-grid td[contenteditable="true"] {
  min-width: 0;
  outline: none;
  cursor: text;
}

.schedule-grid .source-cell {
  min-width: 0;
  max-width: 200px;
  color: #385061;
  font-weight: 650;
  white-space: normal;
  font-size: .8rem;
}

.schedule-grid td.editable-cell {
  cursor: cell;
}

.schedule-grid td[contenteditable="true"].editable-cell {
  cursor: text;
}

.schedule-grid td[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px var(--primary, #1d63ed);
  background: var(--primary-soft, #eef4ff);
}

.schedule-grid td.editable-cell:focus-within,
.schedule-grid td:has(.combo-input:focus),
.schedule-grid td:has(> input:focus),
.schedule-grid td:has(> textarea:focus),
.schedule-grid td:has(.course-subfield-input:focus) {
  box-shadow: inset 0 0 0 2px var(--primary, #1d63ed);
  background: var(--primary-soft, #eef4ff);
}

.schedule-grid td:has(.combo-input.conflict-input),
.schedule-grid td:has(.schedule-combobox.conflict-input) {
  box-shadow: inset 0 0 0 2px #dc2626;
}

.schedule-grid td[data-conflict-summary] {
  cursor: help;
}

.schedule-conflict-tooltip {
  position: fixed;
  z-index: 1100;
  width: min(360px, calc(100vw - 20px));
  padding: .85rem .95rem;
  border: 1px solid #f1a7a7;
  border-radius: 10px;
  background: var(--surface-strong, #fff);
  color: var(--text, #17233a);
  box-shadow: 0 12px 32px rgba(66, 20, 20, .2);
  font-size: .82rem;
  line-height: 1.4;
  pointer-events: none;
}

.schedule-conflict-tooltip[hidden] {
  display: none;
}

.schedule-conflict-tooltip-title,
.schedule-conflict-tooltip-count,
.schedule-conflict-tooltip li span {
  display: block;
}

.schedule-conflict-tooltip-title {
  color: #b91c1c;
  font-size: .92rem;
}

.schedule-conflict-tooltip-count {
  margin-top: .1rem;
  color: var(--text-soft, #526075);
}

.schedule-conflict-tooltip ul {
  display: grid;
  gap: .65rem;
  margin: .7rem 0 0;
  padding: .7rem 0 0 1.1rem;
  border-top: 1px solid #f3d1d1;
}

.schedule-conflict-tooltip li strong {
  overflow-wrap: anywhere;
}

.schedule-conflict-tooltip li span {
  margin-top: .12rem;
  color: var(--text-soft, #526075);
  overflow-wrap: anywhere;
}

.schedule-conflict-tooltip li .schedule-conflict-tooltip-reasons {
  color: #b42318;
  font-weight: 650;
}

.schedule-grid td.cell-selected {
  background: var(--primary-soft, #e7efff) !important;
  box-shadow: inset 0 0 0 2px var(--primary, #1d63ed);
}

.schedule-grid td.cell-cut-pending {
  outline: 2px dashed var(--primary, #1d63ed);
  outline-offset: -4px;
  opacity: .68;
}

.grid-selecting .schedule-grid,
.grid-selecting .schedule-grid * {
  user-select: none;
}

.grid-selecting .schedule-grid input::selection,
.grid-selecting .schedule-grid textarea::selection,
.grid-selecting .schedule-grid [contenteditable="true"]::selection {
  background: transparent;
}

.schedule-board.board-page-leaving {
  cursor: progress;
}

.schedule-grid .draft-row td {
  background: rgba(255, 250, 240, .56);
  color: #7c8798;
}

.schedule-grid .draft-row td:first-child {
  box-shadow: inset 4px 0 0 var(--border-strong, #c9d7ea);
}

.schedule-grid .draft-row .combo-input,
.schedule-grid .draft-row td[contenteditable="true"] {
  opacity: .72;
}

.schedule-grid .draft-row:focus-within td,
.schedule-grid .draft-row:hover td {
  background: #ffffff;
  color: #172033;
}

.schedule-grid .draft-row:focus-within .combo-input,
.schedule-grid .draft-row:hover .combo-input,
.schedule-grid .draft-row:focus-within td[contenteditable="true"],
.schedule-grid .draft-row:hover td[contenteditable="true"] {
  opacity: 1;
}

.schedule-grid .draft-row.draft-committed td {
  background: var(--primary-soft, #e7efff);
}

.draft-custom-cell {
  min-width: 0;
}

.draft-repeat-col,
.schedule-grid .check-col {
  width: 52px;
  min-width: 52px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

/* Bulk row-count stepper only makes sense when adding course offerings (Courses tab).
   Offerings draft row uses .check-col; the other tabs use .draft-repeat-col. */
.draft-repeat-col .draft-repeat-input {
  display: none;
}

.draft-create-control {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.draft-repeat-input {
  width: 38px;
  min-width: 38px;
  border: 1px solid var(--border, #d8c9b2);
  border-radius: 5px;
  background: var(--surface-soft, #fffaf0);
  padding: 3px 4px;
  text-align: center;
  font: inherit;
  -moz-appearance: textfield;
  appearance: textfield;
}

.draft-repeat-input::-webkit-outer-spin-button,
.draft-repeat-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.draft-repeat-stepper {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border, #d8c9b2);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-soft, #fffaf0);
}

.draft-repeat-stepper .draft-repeat-input {
  width: 30px;
  min-width: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 2px;
}

.draft-repeat-stepper .draft-repeat-step {
  display: inline-grid;
  place-items: center;
  width: 20px;
  border: 0;
  background: transparent;
  color: var(--text-soft, #48576b);
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 0;
}

.draft-repeat-stepper .draft-repeat-step:hover,
.draft-repeat-stepper .draft-repeat-step:focus-visible {
  background: var(--primary-soft, rgba(46, 196, 182, .14));
  color: var(--primary, #2ec4b6);
  outline: none;
}

.draft-repeat-stepper .draft-repeat-step:disabled {
  opacity: .35;
  cursor: not-allowed;
  background: transparent;
}

.draft-create-button {
  min-width: 62px;
  padding-inline: 7px;
}

.faculty-check-list {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.faculty-candidates {
  display: grid;
  gap: 5px;
}

.faculty-candidate-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  width: max-content;
  max-width: 100%;
}

.faculty-candidate-row > label {
  flex: 0 1 auto;
  min-width: 0;
}

.faculty-check-list label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text, #172033);
  font-weight: 600;
  white-space: nowrap;
}

.faculty-priority-pill,
.teacher-priority-pill {
  display: inline-grid;
  gap: 2px;
  justify-items: start;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(46, 196, 182, .35);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(46, 196, 182, .14), rgba(46, 196, 182, .06));
  color: #1d5b54;
  padding: 3px 9px;
  line-height: 1.2;
  cursor: help;
  box-shadow: 0 1px 0 rgba(46, 196, 182, .12);
}

.faculty-priority-pill [data-faculty-name],
.teacher-priority-pill > span:first-child {
  overflow-wrap: anywhere;
}

.teacher-rotation-priority,
.faculty-rotation-priority {
  display: block;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.faculty-check-list[data-manual-assignment] .faculty-rotation-priority {
  display: none;
}

.faculty-manual-check {
  display: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #159947;
  color: #fff;
  font-size: .72rem;
  line-height: 1;
  padding: 0;
}

.faculty-check-list small {
  color: #6e665b;
  font-size: .72rem;
  font-weight: 600;
}

.faculty-priority-pill .faculty-rotation-priority {
  color: #27625a;
}

.faculty-check-list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
}

.faculty-candidate-row.manually-assigned .faculty-check-list input[type="checkbox"],
.faculty-candidate-row.manually-assigned input[type="checkbox"] {
  display: none;
}

.faculty-candidate-row.manually-assigned .faculty-manual-check {
  display: inline-grid;
}

.faculty-remove-button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8b443d;
  opacity: 0;
  transition: opacity .12s ease, background-color .12s ease, color .12s ease;
}

.faculty-candidate-row:hover .faculty-remove-button,
.faculty-remove-button:focus-visible {
  opacity: .8;
}

.faculty-remove-button:hover,
.faculty-remove-button:focus {
  background: #ffe7e2;
  opacity: 1;
}

.faculty-add-control {
  position: relative;
  display: inline-grid;
  justify-self: start;
  margin-top: 3px;
}

.faculty-add-toggle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #cfc2ad;
  border-radius: 6px;
  background: #fffaf0;
  color: #23515a;
}

.faculty-add-toggle:hover,
.faculty-add-toggle:focus {
  border-color: #2ec4b6;
  background: #dff8f5;
}

.faculty-add-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  display: none;
  width: min(280px, calc(100vw - 24px));
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 32px rgba(18, 52, 59, .22);
  padding: 7px;
}

.faculty-add-control.open .faculty-add-popover {
  display: grid;
  gap: 6px;
}

.faculty-add-input {
  width: 100%;
  border: 1px solid #e4d8c4;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fffaf0;
  font: inherit;
}

.faculty-add-input:focus {
  outline: none;
  border-color: #2ec4b6;
  box-shadow: 0 0 0 2px rgba(46, 196, 182, .18);
}

.faculty-add-menu {
  display: grid;
  max-height: 180px;
  overflow: auto;
}

.faculty-add-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #efe4d0;
  background: transparent;
  padding: 7px 8px;
  color: #172033;
  text-align: left;
  font: inherit;
}

.faculty-add-option:hover,
.faculty-add-option:focus {
  background: #dff8f5;
}

.schedule-grid select {
  width: 100%;
  min-width: 112px;
  border: 0;
  background: transparent;
  font: inherit;
}

.schedule-grid option:disabled {
  color: #9a9388;
  background: #eee6d8;
}

.schedule-combobox {
  position: relative;
  min-width: 0;
  display: block;
}

.choice-combobox {
  min-width: 0;
}

.rule-combobox {
  min-width: 0;
}

.combo-input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 4px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  outline: none;
}

.schedule-grid .combo-input {
  field-sizing: content;
  min-width: 6ch;
  max-width: 100%;
}

.combo-input::placeholder {
  color: #9aa6b8;
  opacity: 1;
}

.choice-combobox .combo-input {
  min-width: 0;
}

.rule-combobox .combo-input {
  min-width: 0;
}

.combo-input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.combo-menu {
  position: fixed;
  top: auto;
  left: 0;
  right: auto;
  z-index: 120;
  display: none;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 12px 26px rgba(18, 52, 59, .16);
}

.schedule-combobox.open .combo-menu {
  display: grid;
}

.combo-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #efe4d0;
  background: transparent;
  padding: 8px 10px;
  color: #172033;
  text-align: left;
  font: inherit;
}

.combo-option:hover,
.combo-option:focus {
  background: #dff8f5;
}

.combo-option.combo-active {
  background: var(--primary-soft, #e7efff);
  box-shadow: inset 2px 0 0 var(--primary, #1d63ed);
}

.combo-option:disabled {
  color: #9a9388;
  background: #eee6d8;
  cursor: not-allowed;
}

.combo-option.conflict-option,
.faculty-add-option.conflict-option {
  color: #9aa3b2;
  background: transparent;
}

.combo-option.conflict-option:hover,
.combo-option.conflict-option:focus,
.faculty-add-option.conflict-option:hover,
.faculty-add-option.conflict-option:focus {
  color: #172033;
  background: #dce6f4;
}

.grid-selectionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.row-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.row-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  appearance: none;
  border: 0 !important;
  border-radius: 5px;
  background: transparent !important;
  color: rgba(116, 133, 155, .55);
  cursor: grab;
  padding: 0;
  box-shadow: none !important;
  line-height: 1;
  vertical-align: middle;
  transform: none !important;
  user-select: none;
  touch-action: none;
  opacity: 0;
  transition: opacity .12s ease, color .12s ease, background-color .12s ease;
}

tr:hover .row-drag-handle,
.row-drag-handle:focus-visible {
  opacity: 1;
}

.row-drag-handle i {
  pointer-events: none;
  font-size: .9rem;
  line-height: 1;
}

[data-schedule-table="time_slots"] .row-drag-handle {
  display: none;
}

.row-drag-handle:hover,
.row-drag-handle:focus {
  background: rgba(29, 99, 237, .08) !important;
  color: var(--primary, #1d63ed);
  outline: none;
}

.row-drag-handle:active,
.row-dragging .row-drag-handle {
  cursor: grabbing;
}

html.schedule-row-drag-active,
html.schedule-row-drag-active * {
  cursor: grabbing !important;
}

.row-dragging td {
  opacity: .72;
  background: rgba(29, 99, 237, .08) !important;
}

.row-drag-source td {
  box-shadow: inset 3px 0 0 var(--primary, #1d63ed);
}

.row-drop-marker td {
  height: 42px;
  padding: 4px 8px !important;
  background: transparent !important;
  border: 0 !important;
}

.row-drop-marker span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 2px dashed var(--primary, #1d63ed);
  border-radius: 7px;
  background: rgba(29, 99, 237, .1);
  color: var(--primary, #1d63ed);
  font-size: .82rem;
  font-weight: 800;
}

.row-drag-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3000;
  pointer-events: none;
  max-width: min(320px, calc(100vw - 40px));
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px;
  background: #10203a;
  color: #fff;
  box-shadow: 0 18px 46px rgba(13, 27, 49, .28);
  font-size: .84rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-order-dropped td,
.row-order-saved td {
  animation: rowOrderPulse 900ms ease;
}

@keyframes rowOrderPulse {
  0% { background: rgba(19, 164, 99, .2); }
  100% { background: transparent; }
}

html[data-schedule-theme="dark"] .row-drag-handle,
html[data-theme="dark"] .row-drag-handle,
.schedule-app-body.theme-dark .row-drag-handle {
  color: rgba(226, 235, 248, .68);
}

html[data-schedule-theme="dark"] .row-drag-handle:hover,
html[data-schedule-theme="dark"] .row-drag-handle:focus,
html[data-theme="dark"] .row-drag-handle:hover,
html[data-theme="dark"] .row-drag-handle:focus,
.schedule-app-body.theme-dark .row-drag-handle:hover,
.schedule-app-body.theme-dark .row-drag-handle:focus {
  background: rgba(255, 255, 255, .07) !important;
  color: #f8fbff;
}

.row-order-saving td {
  background: var(--warning-soft, #fff8dc) !important;
}

.row-order-saved td {
  background: var(--success-soft, #ecfdf3) !important;
}

.draft-day-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.draft-day-picker button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 6px;
  background: var(--surface-strong, #fff);
  color: var(--text-soft, #4f6077);
  font-size: .78rem;
  font-weight: 800;
  padding: 4px 2px;
}

[data-schedule-table="time_slots"] th[data-column-key="days"] {
  width: 50%;
}

[data-schedule-table="time_slots"] th[data-column-key="days"] + th,
[data-schedule-table="time_slots"] th[data-column-key="days"] + th + th {
  width: 25%;
}

[data-schedule-table="time_slots"] .draft-days-cell {
  min-width: 0;
  overflow: hidden;
}

.draft-day-picker button:hover,
.draft-day-picker button:focus {
  border-color: var(--primary, #1d63ed);
  color: var(--primary, #1d63ed);
  outline: none;
}

.draft-day-picker button.selected {
  border-color: var(--primary, #1d63ed);
  background: var(--primary, #1d63ed);
  color: #fff;
}

.draft-time-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text, #172033);
  font: inherit;
  padding: 5px 8px;
  cursor: pointer;
}

.draft-time-input:focus {
  outline: none;
}

.schedule-grid .draft-row .draft-time-input {
  opacity: .72;
}

.schedule-grid .draft-row:focus-within .draft-time-input,
.schedule-grid .draft-row:hover .draft-time-input {
  opacity: 1;
}

.schedule-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 52, 59, .42);
}

.schedule-popup-backdrop[hidden] {
  display: none;
}

html.schedule-popup-open,
body.schedule-popup-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.schedule-popup {
  position: fixed;
  inset: 80px 28px 28px;
  z-index: 61;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 20px 50px rgba(18, 52, 59, .24);
  padding: 12px;
}

.schedule-popup[hidden] {
  display: none;
}

.schedule-matrix-popup {
  inset: 10px;
  padding: 10px;
  grid-template-rows: auto minmax(0, 1fr);
}

.matrix-command-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
  margin-bottom: 8px;
}

.matrix-command-area .matrix-tools {
  margin-bottom: 0;
}

.matrix-command-area .schedule-popup-close {
  grid-column: 2;
  grid-row: 1;
}

.matrix-command-area .matrix-workbar {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 6px;
}

.matrix-scroll-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
}

.matrix-offscreen {
  position: absolute;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(18, 52, 59, .88);
  color: #f5fbf9;
  padding: 4px 11px;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(10, 28, 34, .28);
  cursor: pointer;
  opacity: .5;
  transition: opacity .18s ease;
}

.matrix-offscreen:hover {
  background: rgba(18, 52, 59, .97);
}

.matrix-scroll-shell.is-scrolling .matrix-offscreen:not(.is-empty) {
  opacity: 1;
}

.matrix-offscreen.is-empty {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.matrix-offscreen[data-direction="left"] {
  top: 50%;
  transform: translateY(-50%);
}

.matrix-offscreen[data-direction="right"] {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.matrix-offscreen[data-direction="up"] {
  top: 14px;
  transform: translateX(-50%);
}

.matrix-offscreen[data-direction="down"] {
  bottom: 14px;
  transform: translateX(-50%);
}

.schedule-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.schedule-popup-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #12343b;
}

.schedule-popup-close {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffaf0;
  color: #48576b;
}

.schedule-autofill-popup {
  inset: 110px auto auto 50%;
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 140px));
  transform: translateX(-50%);
  grid-template-rows: auto minmax(0, 1fr);
}

.schedule-room-assignment-popup {
  inset: 70px auto auto 50%;
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 100px));
  transform: translateX(-50%);
  grid-template-rows: auto minmax(0, 1fr);
}

.autofill-form {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.autofill-body {
  min-height: 0;
  overflow: auto;
}

.autofill-summary,
.autofill-status {
  margin: 0;
  color: #52615c;
  font-size: .86rem;
}

.autofill-status.error {
  color: #a23b28;
}

.autofill-status.saving {
  color: #76612a;
}

.autofill-status.saved {
  color: #1f7a65;
}

.autofill-preview {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #d9e2dc;
  border-radius: 8px;
  background: #f8fbf9;
  color: #34443e;
  font-size: .82rem;
}

.autofill-percent-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.autofill-percent-row,
.autofill-value-field,
.autofill-number-grid label {
  display: grid;
  gap: 5px;
  color: #26353a;
  font-size: .84rem;
  font-weight: 700;
}

.autofill-percent-row {
  grid-template-columns: minmax(0, 1fr) 110px;
  align-items: center;
}

.autofill-percent-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autofill-percent-row input {
  width: 100%;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  padding: 5px 7px;
  background: #fff;
  color: #172033;
}

.autofill-number-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.autofill-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.room-assignment-form {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
}

.room-assignment-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.room-assignment-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 10px;
  border: 1px solid #eadcc5;
  border-radius: 8px;
  background: #fffaf0;
}

.room-assignment-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #26353a;
  font-size: .86rem;
  font-weight: 700;
}

.room-assignment-toggle input[type="checkbox"],
.room-rank-room-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #16bfa8;
}

.room-assignment-options small {
  margin-top: -6px;
  color: #64736d;
  font-size: .76rem;
}

.room-assignment-section {
  display: grid;
  gap: 8px;
}

.room-assignment-section h4 {
  margin: 0;
  color: #12343b;
  font-size: .9rem;
}

.room-rank-list {
  display: grid;
  gap: 6px;
}

.room-rank-list-large {
  max-height: 260px;
  overflow: auto;
  padding-right: 3px;
}

.room-rank-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #eadcc5;
  border-radius: 8px;
  background: #fffdf8;
  color: #26353a;
  font-size: .84rem;
  font-weight: 700;
}

.room-rank-room-row {
  grid-template-columns: 26px 68px minmax(0, 1fr) auto;
}

.room-rank-controls {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  gap: 4px;
}

.room-rank-move {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffaf0;
  color: #12343b;
}

.room-rank-move:hover:not(:disabled),
.room-rank-move:focus:not(:disabled) {
  border-color: #16bfa8;
  background: #e8fbf6;
}

.room-rank-move:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.room-rank-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-rank-row small {
  color: #64736d;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .room-assignment-options {
    grid-template-columns: 1fr;
  }

  .room-rank-row,
  .room-rank-room-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .room-rank-room-row input[type="checkbox"] {
    grid-column: 1;
  }

  .room-rank-room-row .room-rank-controls {
    grid-column: 2;
  }

  .room-rank-row small {
    grid-column: 1 / -1;
  }
}

.matrix-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.matrix-workbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 10px;
  border-top: 1px solid #e4d8c4;
  padding-top: 9px;
}

.matrix-workbar-hint,
.matrix-panel-copy {
  color: #667386;
  font-size: .79rem;
  font-weight: 700;
}

.matrix-workbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.matrix-collision-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid #f2b8a0;
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  padding: 5px 9px;
  font-size: .8rem;
  font-weight: 850;
}

.matrix-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: #667386;
  font-size: .78rem;
  font-weight: 750;
  transition: color .2s ease;
}

.matrix-sync-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  transition: background-color .2s ease;
}

.matrix-sync-status.updated {
  color: #1f7a65;
}

.matrix-sync-status.updated::before {
  background: #2ec4b6;
}

.matrix-tool-label {
  color: #48576b;
  font-size: .82rem;
  font-weight: 750;
}

.matrix-day-chip {
  min-height: 30px;
  border: 1px solid #d8c9b2;
  border-radius: 999px;
  background: #fffaf0;
  color: #38485b;
  padding: 5px 10px;
  font: inherit;
  font-size: .82rem;
  font-weight: 750;
}

.matrix-time-select {
  min-height: 30px;
  max-width: min(320px, 100%);
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #38485b;
  padding: 4px 28px 4px 9px;
  font: inherit;
  font-size: .82rem;
  font-weight: 750;
}

.matrix-day-chip.active {
  border-color: #2ec4b6;
  background: #dff8f5;
  color: #12343b;
  box-shadow: inset 0 0 0 1px #2ec4b6;
}

.matrix-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #38485b;
  padding: 5px 9px;
  font-size: .82rem;
  font-weight: 750;
}

.matrix-checkbox input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #2ec4b6;
}

.matrix-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.matrix-body.has-details {
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
}

.matrix-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 16px;
  border: 1px solid #e4d8c4;
  border-radius: 8px;
}

.matrix-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .8rem;
}

.matrix-table th,
.matrix-table td {
  min-width: 145px;
  border-right: 1px solid #e4d8c4;
  border-bottom: 1px solid #e4d8c4;
  padding: 7px;
  vertical-align: top;
  background: #fffdf8;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 52px;
  background: #12343b;
  color: #f5ead7;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.matrix-table .matrix-room,
.matrix-room-head {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 180px;
  background: #fffaf0;
  color: #12343b;
}

.matrix-room-head {
  vertical-align: middle;
}

.matrix-table td {
  height: 82px;
}

.matrix-table td[data-matrix-cell] {
  outline: 1px dashed transparent;
}

.matrix-table td[data-matrix-cell]:hover {
  outline-color: #2ec4b6;
  background: #f2fffc;
}

.matrix-table td.matrix-empty-assignable {
  cursor: pointer;
}

.matrix-table td.matrix-needs-classroom {
  background: #fff5f5;
}

.matrix-table td.matrix-conflict {
  box-shadow: inset 0 0 0 2px #dc2626;
  background: #fff5f5;
}

.matrix-room-unavailable .matrix-room,
.matrix-room-unavailable td {
  background: #fff5f5;
}

.matrix-room-unavailable .matrix-room {
  box-shadow: inset 3px 0 0 #dc2626;
}

.matrix-empty-cell {
  height: 86px;
  color: #48576b;
  font-weight: 750;
  text-align: center;
  vertical-align: middle;
}

.matrix-class-chip {
  display: block;
  width: 100%;
  margin-bottom: 5px;
  border: 1px solid #2ec4b6;
  border-radius: 6px;
  background: #dff8f5;
  color: #12343b;
  padding: 5px 7px;
  text-align: left;
  font: inherit;
  font-weight: 750;
  cursor: grab;
}

.matrix-class-chip.has-warning {
  border-color: #f59e0b;
  background: #fff7ed;
}

.matrix-chip-head,
.matrix-chip-meta,
.matrix-chip-badges {
  display: flex;
  align-items: center;
  min-width: 0;
}

.matrix-chip-head {
  justify-content: space-between;
  gap: 6px;
}

.matrix-chip-meta {
  margin-top: 3px;
  color: #536174;
  font-size: .69rem;
  font-weight: 700;
}

.matrix-chip-badges {
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.matrix-chip-badge {
  border-radius: 999px;
  background: #fff;
  color: #8a3418;
  padding: 1px 5px;
  font-size: .58rem;
  font-weight: 850;
  line-height: 1.35;
}

.matrix-chip-badge.locked {
  color: #1d4ed8;
}

.matrix-unassigned-count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 0 6px;
  border: 1px solid #d8c9b2;
  border-radius: 999px;
  background: #fffaf0;
  color: #48576b;
  padding: 2px 7px;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}

.matrix-class-chip:active {
  cursor: grabbing;
}

.matrix-details {
  min-height: 0;
  max-height: 100%;
  align-self: stretch;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #d8c9b2;
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(18, 52, 59, .1);
}

.matrix-details[hidden] {
  display: none;
}

.matrix-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: #12343b;
}

.matrix-details-close {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #48576b;
}

.matrix-detail-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  border-top: 1px solid #e4d8c4;
  padding: 8px 0;
}

.matrix-detail-row span {
  color: #667386;
  font-size: .76rem;
  font-weight: 750;
}

.matrix-detail-row b {
  min-width: 0;
  color: #172033;
  font-size: .84rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.matrix-detail-control-row {
  align-items: center;
  margin: 0;
}

.matrix-detail-select,
.matrix-picker-search {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #172033;
  padding: 5px 8px;
  font: inherit;
  font-size: .86rem;
  font-weight: 750;
}

.matrix-panel-status {
  margin-top: 8px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #48576b;
  padding: 7px 8px;
  font-size: .8rem;
  font-weight: 800;
}

.matrix-panel-status.saving {
  color: #1d4ed8;
}

.matrix-panel-status.saved {
  color: #047857;
}

.matrix-panel-status.error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff5f5;
}

.matrix-detail-section-title {
  margin: 12px 0 7px;
  color: #12343b;
  font-size: .85rem;
  font-weight: 850;
}

.matrix-info-box {
  display: grid;
  gap: 3px;
  margin: 9px 0;
  border: 1px solid #d8c9b2;
  border-radius: 7px;
  background: #fffdf8;
  color: #48576b;
  padding: 8px;
  font-size: .76rem;
}

.matrix-info-box.warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.matrix-info-box.locked {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.matrix-info-box.success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.matrix-recommendations {
  display: grid;
  gap: 6px;
}

.matrix-recommendation {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid #b8e7df;
  border-radius: 7px;
  background: #f2fffc;
  color: #12343b;
  padding: 8px;
  text-align: left;
}

.matrix-recommendation span {
  color: #536174;
  font-size: .72rem;
  font-weight: 700;
}

.matrix-recommendation.has-conflict {
  border-color: #fecaca;
  background: #fff5f5;
}

.matrix-override-reason {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: #48576b;
  font-size: .76rem;
  font-weight: 800;
}

.matrix-override-reason textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #d8c9b2;
  border-radius: 7px;
  background: #fffdf8;
  color: #172033;
  padding: 7px;
  font: inherit;
}

.matrix-override-check {
  margin: 7px 0;
}

.matrix-audit-list {
  display: grid;
  gap: 7px;
  max-height: 560px;
  overflow: auto;
}

.matrix-audit-row {
  display: grid;
  gap: 3px;
  border: 1px solid #e4d8c4;
  border-radius: 7px;
  background: #fffdf8;
  padding: 8px;
  color: #38485b;
  font-size: .76rem;
}

.matrix-audit-row small,
.matrix-audit-row em {
  color: #667386;
  font-size: .69rem;
}

.matrix-picker-search {
  margin: 8px 0;
}

.matrix-picker-list {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}

.matrix-picker-option {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #12343b;
  padding: 8px;
  text-align: left;
  font: inherit;
}

.matrix-picker-option:hover,
.matrix-picker-option:focus {
  border-color: #2ec4b6;
  background: #f2fffc;
  outline: none;
}

.matrix-picker-option b,
.matrix-picker-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.matrix-picker-option span {
  color: #48576b;
  font-size: .78rem;
  font-weight: 700;
}

.matrix-picker-empty {
  border: 1px dashed #d8c9b2;
  border-radius: 6px;
  color: #48576b;
  padding: 12px;
  text-align: center;
  font-size: .82rem;
  font-weight: 800;
}

@media (max-width: 900px) {
  .matrix-workbar {
    align-items: stretch;
    flex-direction: column;
  }

  .matrix-workbar-actions {
    justify-content: flex-start;
  }

  .matrix-body.has-details {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .matrix-details {
    order: -1;
    max-height: min(45vh, 360px);
    align-self: start;
  }
}

.column-visibility-control {
  position: relative;
  display: inline-grid;
  justify-items: start;
  margin: 0 0 8px;
}

.column-tool-tabs .column-visibility-control {
  margin: 0;
}

.column-visibility-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 36;
  display: grid;
  gap: 7px;
  min-width: 330px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #cfc2ad;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 16px 34px rgba(18, 52, 59, .18);
  padding: 10px;
}

.column-visibility-menu[hidden] {
  display: none;
}

html[dir="rtl"] .column-visibility-menu {
  right: 0;
  left: auto;
}

.column-visibility-menu input {
  accent-color: #2ec4b6;
}

.column-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
}

.column-row-main {
  display: grid;
  grid-template-columns: 24px 22px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.column-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft, #718096);
  cursor: grab;
  touch-action: none;
}

.column-drag-handle:hover,
.column-drag-handle:focus-visible,
.column-drag-handle[aria-grabbed="true"] {
  background: var(--accent-soft, #edf8f6);
  color: var(--accent-strong, #226f67);
  outline: none;
}

.column-drag-handle:focus-visible {
  box-shadow: 0 0 0 2px rgba(46, 196, 182, .32);
}

.column-drag-handle:active,
.column-drag-handle[aria-grabbed="true"] {
  cursor: grabbing;
}

[data-column-control].is-reordering-columns {
  user-select: none;
}

.column-menu-row.is-column-dragging {
  position: relative;
  z-index: 2;
  border-radius: 7px;
  background: var(--accent-soft, #f1fbf9);
  box-shadow: 0 4px 14px rgba(18, 52, 59, .15);
}

.column-menu-row.is-column-dragging::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: #2ec4b6;
}

.column-visible-toggle {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  margin: 0;
}

.column-label-input {
  min-width: 0;
}

.column-lookup-badge {
  align-self: center;
  border: 1px solid #c6d8d5;
  border-radius: 999px;
  padding: 2px 6px;
  color: #2b625b;
  background: #edf8f6;
  font-size: .72rem;
  font-weight: 700;
}

.column-row-actions {
  display: flex;
  gap: 4px;
}

.column-edit-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d8c9b2;
  border-radius: 6px;
  background: #fffdf8;
  color: #48576b;
}

.column-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  border: 1px solid #e4d8c4;
  border-radius: 8px;
  background: #fffaf0;
  padding: 8px;
}

.column-editor[hidden] {
  display: none;
}

.column-lookup-note {
  color: #65727f;
  font-size: .78rem;
}

.compact-grid {
  min-width: 640px;
}

[data-schedule-table="time_slots"].fit-viewport-grid {
  table-layout: fixed;
  min-width: 0;
}

[data-schedule-table="time_slots"].fit-viewport-grid th,
[data-schedule-table="time_slots"].fit-viewport-grid td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-schedule-table="time_slots"].fit-viewport-grid .check-col {
  overflow: visible;
}

.day-checkboxes,
.schedule-form-grid ul {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}

.day-checkboxes label,
.schedule-form-grid ul label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.schedule-grid small {
  display: block;
  max-width: 180px;
  color: #6d7889;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-grid .check-col {
  width: 52px;
  min-width: 52px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

.empty {
  color: #667386;
  text-align: center;
  padding: 18px !important;
}

.group-block {
  display: block;
  --group-title-top: 0px;
  --group-header-top: 38px;
}

.group-block.group-level-2 {
  --group-title-top: 38px;
  --group-header-top: 76px;
}

.group-block.group-level-3 {
  --group-title-top: 76px;
  --group-header-top: 114px;
}

.group-block.group-level-4 {
  --group-title-top: 114px;
  --group-header-top: 152px;
}

.group-title {
  position: sticky;
  top: calc(var(--schedule-sticky-category-top, 0px) + var(--group-title-top, 0px));
  left: 0;
  z-index: 6;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  font-weight: 750;
  font-size: .95rem;
  color: var(--text, #1f2733);
  background: var(--surface-strong, #ffffff);
  border-bottom: 1px solid var(--border, #e4d8c4);
  box-shadow: 0 1px 0 rgba(18, 52, 59, .04);
}

/* Extra copy of a course listed under several requesting teachers. */
.schedule-grid tr.group-mirror-row > td {
  background-image: linear-gradient(rgba(102, 115, 134, .06), rgba(102, 115, 134, .06));
  cursor: pointer;
}

.schedule-grid tr.group-mirror-row > td > * {
  opacity: .72;
}

@keyframes group-mirror-flash {
  from { box-shadow: inset 0 0 0 999px rgba(59, 130, 246, .18); }
  to { box-shadow: inset 0 0 0 999px rgba(59, 130, 246, 0); }
}

.schedule-grid tr.group-mirror-flash > td {
  animation: group-mirror-flash 1.4s ease-out;
}

.group-summary {
  color: var(--muted, #667386);
  font-weight: 650;
}

.group-title.group-level-2 {
  z-index: 5;
  padding-left: 28px;
  font-size: .9rem;
  color: #48576b;
}

.group-title.group-level-3 {
  z-index: 4;
  padding-left: 42px;
  font-size: .85rem;
  color: #667386;
}

.group-title.group-level-4 {
  z-index: 4;
  padding-left: 42px;
  font-size: .85rem;
  color: #667386;
}

.group-block > .schedule-grid thead,
.group-block > .schedule-grid th {
  top: calc(var(--schedule-sticky-category-top, 0px) + var(--group-header-top, 38px));
  z-index: 5;
}

.group-children {
  display: block;
}

.group-children.group-level-1 {
  padding-left: 12px;
  border-left: 2px solid rgba(29, 99, 237, .16);
}

.issue {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 4px 10px;
  border-left: 4px solid #f4d35e;
  padding: 9px 10px;
  background: #fff8d4;
  margin-top: 8px;
}

.issues {
  border-color: rgba(244, 211, 94, .55);
}

.issues.clean {
  border-color: rgba(46, 196, 182, .35);
}

.issues-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  cursor: pointer;
  list-style: none;
}

.issues-head::-webkit-details-marker {
  display: none;
}

.issues-head h3 {
  margin: 0;
}

.issues-head p {
  margin: 2px 0 0;
  color: #6e665b;
  font-size: .86rem;
  font-weight: 700;
}

.issues-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(29, 99, 237, .25);
  border-radius: 8px;
  color: #1d63ed;
}

.issues[open] .issues-toggle i {
  transform: rotate(180deg);
}

.issues-body {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.issues-actions {
  display: flex;
  justify-content: flex-end;
}

.issue-list {
  display: grid;
  gap: 8px;
}

.issue.error {
  border-color: #d95d39;
  background: #fff0e8;
}

.issue small {
  grid-column: 2;
  color: #6e665b;
  font-size: .78rem;
  font-weight: 700;
}

.cell-saving {
  background: #fff8dc !important;
  transition: background-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.schedule-grid th.cell-saving {
  background: #12343b !important;
  color: #f5ead7;
  box-shadow: inset 0 -3px 0 #2ec4b6;
}

.schedule-grid th.cell-saving .column-autofill-button {
  border-color: #2ec4b6;
  background: rgba(46, 196, 182, .18);
  color: #f5ead7;
}

.cell-saved {
  background: #ecfdf3 !important;
  animation: scheduleCellSavedFade 1.2s ease forwards;
}

.cell-error {
  background: #fff0f0 !important;
}

@keyframes scheduleCellSavedFade {
  0% {
    background-color: #ecfdf3;
    box-shadow: inset 0 0 0 2px rgba(31, 122, 101, .32);
  }
  100% {
    background-color: transparent;
    box-shadow: inset 0 0 0 0 rgba(31, 122, 101, 0);
  }
}

@keyframes scheduleFadeAfterSuccess {
  0% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.schedule-grid th.cell-error {
  background: #7f2d20 !important;
  color: #fff8ef;
  box-shadow: inset 0 -3px 0 #d95d39;
}

.schedule-grid th.cell-error .column-autofill-button {
  border-color: rgba(255, 248, 239, .72);
  background: rgba(255, 248, 239, .12);
  color: #fff8ef;
}

.teacher-pref-body {
  margin: 0;
  background: #f6f2ea;
  color: #172033;
}

.teacher-pref-shell {
  width: min(1900px, calc(100vw - 48px));
  margin: 24px auto 90px;
}

.teacher-pref-header {
  margin-bottom: 16px;
}

.teacher-message-panel {
  max-width: 760px;
  margin: 8px 0 16px;
}

.teacher-message-head {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-soft, #526176);
  font-size: .8rem;
  font-weight: 800;
}

.teacher-message-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid var(--border, #d9cdb8);
  border-radius: 8px;
  background: var(--surface-soft, #fffdf8);
  padding: 3px 8px;
  color: var(--text-soft, #526176);
  font: inherit;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.teacher-message-toggle i {
  font-size: .88rem;
  line-height: 1;
}

.teacher-message-toggle:hover,
.teacher-message-toggle:focus {
  border-color: var(--primary, #1d63ed);
  background: var(--primary-soft, #e7efff);
  color: var(--primary-strong, #104ec7);
  outline: none;
}

.teacher-message-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(29, 99, 237, .16);
}

.teacher-message {
  /* Hug the text so an RTL message in this LTR page sits under the
     "Message" label instead of floating to the middle of a 760px box. */
  width: fit-content;
  max-width: min(760px, 100%);
  margin: 0;
  color: #526176;
  white-space: pre-line;
}

.teacher-deadline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 8px 8px 8px 0;
  border: 1px solid #d9cdb8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 6px 11px;
  color: #48576b;
  font-size: .88rem;
  font-weight: 700;
}

.teacher-deadline.closed {
  border-color: #d95d39;
  background: #fff0e8;
  color: #8b351c;
}

.teacher-save-status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 32px;
  margin: 0;
  border: 1px solid #d9cdb8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 5px 11px;
  color: #526176;
  font-size: .82rem;
  font-weight: 700;
}

.teacher-save-status[hidden] {
  display: none;
}

.teacher-save-status.saving {
  border-color: #c8ced8;
  background: #eef1f5;
  color: #526176;
}

.teacher-save-status.saved {
  border-color: #40b66f;
  background: #ecf9f1;
  color: #23633b;
  animation: scheduleFadeAfterSuccess 1.45s ease .35s forwards;
}

.teacher-save-status.error {
  border-color: #d95d39;
  background: #fff0e8;
  color: #8b351c;
}

.teacher-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.teacher-assignment-note {
  margin: 0 0 12px;
  color: #526176;
  font-size: .9rem;
  line-height: 1.45;
}

.teacher-credit-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 2px 0 10px;
  border: 1px solid rgba(46, 196, 182, .42);
  border-radius: 999px;
  background: rgba(46, 196, 182, .12);
  color: #12343b;
  padding: 6px 12px;
  font-size: .9rem;
  font-weight: 750;
}

.teacher-credit-meter.over-limit {
  border-color: rgba(217, 93, 57, .55);
  background: #fff0e8;
  color: #7f2d20;
}

.teacher-class-row.credit-blocked {
  cursor: not-allowed;
  opacity: .62;
}

.teacher-class-list {
  display: grid;
  gap: 8px;
}

.teacher-class-tools {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.teacher-collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #d9cdb8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 5px 13px;
  color: #526176;
  font-size: .82rem;
  font-weight: 800;
}

.teacher-collapse-toggle:hover,
.teacher-collapse-toggle:focus {
  border-color: #2ec4b6;
  color: #12343b;
  outline: none;
}

.teacher-class-panel.hidden,
.teacher-empty-mine.hidden,
.teacher-class-panel[data-teacher-class-panel="mine"] [data-teacher-hidden],
.teacher-class-panel[data-teacher-class-panel="applied"] [data-teacher-applied-hidden] {
  display: none;
}

.teacher-note-panel {
  display: block;
  margin: 0 0 12px;
}

.teacher-note-panel textarea {
  display: block;
  width: 100%;
  min-height: 132px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffdf8;
  color: #172033;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.teacher-note-panel textarea:focus {
  border-color: #2ec4b6;
  box-shadow: 0 0 0 3px rgba(46, 196, 182, .18);
  outline: none;
}

.teacher-note-panel textarea::placeholder {
  color: #7a8494;
}

.teacher-note-panel textarea.saving {
  background: #f4f6f8;
}

.teacher-note-panel textarea.save-error {
  border-color: #d95d39;
  background: #fff0e8;
}

.teacher-note-panel textarea:disabled {
  background: #f0ede5;
  color: #667386;
  cursor: default;
}

.teacher-scope-toggle {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 2px;
  margin: 0;
  border: 1px solid #d9cdb8;
  border-radius: 999px;
  background: #fffdf8;
  padding: 3px;
}

.teacher-scope-toggle a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 12px;
  color: #526176;
  font-size: .84rem;
  font-weight: 800;
  text-decoration: none;
}

.teacher-scope-toggle a:hover,
.teacher-scope-toggle a:focus {
  color: #12343b;
}

.teacher-scope-toggle a.active {
  background: #12343b;
  color: #fffdf8;
}

.teacher-course-group {
  display: grid;
  gap: 8px;
}

.teacher-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 4px 0 0;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffaf0;
  padding: 10px 12px;
  color: #12343b;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.teacher-group-title:hover,
.teacher-group-title:focus {
  border-color: #2ec4b6;
  background: #f2fffc;
  outline: none;
}

.teacher-group-heading {
  display: flex;
  align-items: baseline;
  gap: 8px 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.teacher-group-heading strong {
  color: #12343b;
  font-size: .95rem;
  font-weight: 850;
  line-height: 1.25;
}

.teacher-group-heading span {
  color: #48576b;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.teacher-group-meta {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: #667386;
  font-size: .88rem;
}

.teacher-group-meta i {
  transition: transform .16s ease;
}

.teacher-course-group:not(.collapsed) .teacher-group-meta i {
  transform: rotate(180deg);
}

.teacher-group-rows {
  display: grid;
  gap: 8px;
}

.teacher-class-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  background: #fffdf8;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.teacher-class-row:hover {
  border-color: #2ec4b6;
  background: #f2fffc;
}

.teacher-class-row.selected {
  border-color: #2ec4b6;
  background: #e6fbf8;
  box-shadow: inset 4px 0 0 #2ec4b6;
}

.teacher-class-row.locked {
  cursor: default;
}

.teacher-class-row.no-selection {
  grid-template-columns: minmax(0, 1fr);
}

.teacher-class-row.locked:hover {
  border-color: #d9cdb8;
  background: #fffdf8;
}

.teacher-class-row.locked .teacher-class-check {
  opacity: .72;
}

.teacher-class-row.saving {
  opacity: .78;
}

.teacher-class-row.save-error {
  border-color: #d95d39;
  background: #fff0e8;
}

.teacher-class-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.teacher-class-check {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffaf0;
  color: transparent;
  font-size: 1rem;
}

.teacher-class-check i {
  opacity: 0;
  transform: scale(.82);
  transition: opacity .14s ease, transform .14s ease;
}

.teacher-class-checkbox:checked + .teacher-class-check,
.teacher-class-row.selected .teacher-class-check {
  border-color: #2ec4b6;
  background: #12343b;
  color: #fff;
}

.teacher-class-checkbox:checked + .teacher-class-check i,
.teacher-class-row.selected .teacher-class-check i {
  opacity: 1;
  transform: scale(1);
}

.teacher-class-main {
  min-width: 0;
}

.teacher-class-cells {
  display: grid;
  grid-template-columns: minmax(150px, .85fr) minmax(220px, 1.25fr) repeat(3, minmax(112px, .7fr));
  gap: 14px 28px;
  align-items: start;
}

.teacher-class-cell {
  min-width: 0;
  padding: 2px 0;
}

.teacher-class-cell.featured {
  min-width: 0;
}

.teacher-class-cell[data-teacher-cell-key="course"] {
  grid-column: 1;
  grid-row: 1;
}

.teacher-class-cell[data-teacher-cell-key="faculty"] {
  grid-column: 1;
  grid-row: 2;
}

.teacher-class-cell[data-teacher-cell-key="course_name"] {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.teacher-class-cell[data-teacher-cell-key="days"] {
  grid-column: 3;
  grid-row: 1;
}

.teacher-class-cell[data-teacher-cell-key="time"] {
  grid-column: 4;
  grid-row: 1;
}

.teacher-class-cell[data-teacher-cell-key="room"] {
  grid-column: 5;
  grid-row: 1;
}

.teacher-class-cell strong {
  display: block;
  color: #172033;
  font-size: .98rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.teacher-class-cell span {
  display: block;
  color: #48576b;
  font-size: .9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.teacher-faculty-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.teacher-faculty-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #48576b;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.3;
}

.teacher-faculty-list li span {
  overflow-wrap: anywhere;
}

.teacher-faculty-list li.assigned {
  color: #12343b;
  font-weight: 800;
}

.teacher-faculty-list i {
  flex: 0 0 auto;
  color: #168a79;
  font-size: .95rem;
}

.teacher-class-row small {
  display: block;
}

.teacher-class-row small {
  margin-bottom: 1px;
  color: #667386;
  font-size: .73rem;
  font-weight: 750;
  text-transform: uppercase;
}

.teacher-pref-controls {
  align-items: stretch;
}

.teacher-pref-controls input[type="number"] {
  width: 74px;
}

.teacher-savebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  justify-content: center;
  padding: 12px;
  background: rgba(255, 253, 248, .92);
  border-top: 1px solid #d9cdb8;
  backdrop-filter: blur(10px);
}

.schedule-landing-body {
  margin: 0;
  color: #172033;
  background: #f6f2ea;
}

.schedule-landing {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 44px;
}

.landing-nav strong {
  font-size: 1.15rem;
}

.landing-brand,
.landing-brand:hover {
  color: #12343b;
}

.landing-nav-actions,
.landing-auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.landing-nav-actions {
  margin-left: auto;
  gap: 12px;
}

.landing-language-switcher {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft, rgba(255, 255, 255, .56));
}

.landing-language-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  line-height: 1;
}

.landing-language-option .lang-flag {
  font-size: 1.05rem;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 470px);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  max-width: none;
  padding: 32px 0 38px;
}

.landing-hero-copy {
  max-width: 780px;
}

.landing-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0;
}

.landing-hero p {
  max-width: 650px;
  color: #526176;
  font-size: 1.08rem;
}

.landing-visual {
  width: 100%;
  max-width: 520px;
  margin: 0;
  justify-self: end;
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.landing-feature-grid article {
  min-height: 190px;
  padding: 18px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  background: #fffdf8;
}

.landing-feature-grid i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #12343b;
  background: #2ec4b6;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.landing-feature-grid h2 {
  font-size: 1rem;
  margin: 0 0 8px;
  font-weight: 750;
}

.landing-feature-grid p {
  color: #5f6d80;
  margin: 0;
}

@media (max-width: 900px) {
  .schedule-shell,
  .teacher-pref-shell {
    width: calc(100vw - 24px);
  }

  .schedule-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .workspace-hero,
  .board-hero,
  .schedule-two-column,
  .faculty-share-grid {
    grid-template-columns: 1fr;
  }

  .teacher-class-row {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 11px 12px;
  }

  .teacher-class-cell.featured {
    min-width: 0;
  }

  .teacher-class-cells {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
  }

  .teacher-class-cell[data-teacher-cell-key] {
    grid-column: auto;
    grid-row: auto;
  }

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

  .schedule-actions,
  .teacher-pref-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .teacher-scope-row {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-scope-toggle {
    width: 100%;
  }

  .teacher-save-status {
    align-self: flex-end;
  }

  .teacher-scope-toggle a {
    flex: 1 1 0;
    justify-content: center;
  }

  .schedule-inline-form {
    flex-wrap: wrap;
  }

  .time-builder {
    grid-template-columns: 1fr;
  }

  .custom-field-form {
    grid-template-columns: 1fr;
  }

  .column-import-form {
    grid-template-columns: 1fr;
  }

  .day-picker span {
    min-width: 46px;
  }

  .landing-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-nav-actions {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .landing-visual {
    max-width: 620px;
    justify-self: stretch;
  }
}

@media (max-width: 420px) {
  .landing-language-switcher {
    gap: 3px;
  }

  .landing-language-option {
    width: 30px;
    height: 30px;
  }

  .landing-auth-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Modern dashboard theme override */
.schedule-app-body,
.teacher-pref-body,
.schedule-landing-body {
  --app-bg: #f5f7fb;
  --app-bg-2: #eef4ff;
  --surface: rgba(255, 255, 255, .92);
  --surface-strong: #ffffff;
  --surface-soft: #f7faff;
  --surface-muted: #eef4fb;
  --border: #dde6f3;
  --border-strong: #c9d7ea;
  --text: #152238;
  --text-soft: #4f6077;
  --muted: #74859b;
  --primary: #1d63ed;
  --primary-strong: #104ec7;
  --primary-soft: #e7efff;
  --semester-create-surface: #f3f8ff;
  --semester-create-border: #cfe0fa;
  --accent: #16c7b7;
  --accent-soft: #dcfbf6;
  --warning: #f59e0b;
  --warning-soft: #fff5d8;
  --danger: #ef4444;
  --danger-soft: #fff0f0;
  --success: #13a463;
  --success-soft: #e9f9f0;
  --purple: #7c3aed;
  --shadow-sm: 0 8px 22px rgba(21, 34, 56, .07);
  --shadow-md: 0 18px 46px rgba(21, 34, 56, .11);
  --shadow-pop: 0 22px 54px rgba(21, 34, 56, .18);
  background:
    radial-gradient(circle at top left, rgba(29, 99, 237, .13), transparent 31rem),
    radial-gradient(circle at 82% 0, rgba(22, 199, 183, .1), transparent 26rem),
    linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 260px);
  color: var(--text);
  color-scheme: light;
}

.schedule-app-body *,
.teacher-pref-body *,
.schedule-landing-body * {
  scrollbar-color: var(--border-strong) transparent;
}

.schedule-app-body ::selection,
.teacher-pref-body ::selection,
.schedule-landing-body ::selection {
  background: rgba(29, 99, 237, .2);
}

.schedule-topbar {
  min-height: 64px;
  padding: 10px 24px;
  background: rgba(13, 27, 49, .88);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 14px 40px rgba(13, 27, 49, .22);
  backdrop-filter: blur(16px);
}

.schedule-brand,
.schedule-brand:hover,
.topbar-link,
.topbar-link:hover {
  color: #f8fbff;
}

.topbar-link {
  opacity: .82;
}

.topbar-link:hover {
  opacity: 1;
}

.brand-mark {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(29, 99, 237, .28);
}

.schedule-page {
  color: var(--text);
}

.schedule-shell,
.teacher-pref-shell,
.schedule-landing {
  position: relative;
}

.workspace-hero,
.board-hero,
.schedule-panel,
.semester-card,
.landing-feature-grid article,
.teacher-class-row,
.teacher-group-title,
.teacher-note-panel textarea,
.faculty-link-preview,
.view-overlay-panel,
.view-action-popover,
.view-share-popover,
.view-save-popover,
.column-visibility-menu,
.column-editor,
.schedule-popup,
.matrix-details,
.room-rank-row,
.room-assignment-options {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.semester-card.semester-create-card {
  border-color: var(--semester-create-border, #cfe0fa);
  background: var(--semester-create-surface, #f3f8ff);
}

.workspace-hero,
.board-hero {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(29, 99, 237, .12), rgba(22, 199, 183, .08)),
    var(--surface-strong);
  box-shadow: var(--shadow-md);
}

.workspace-hero::before,
.board-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(29, 99, 237, .18), transparent 44%),
    radial-gradient(circle at 95% 10%, rgba(124, 58, 237, .11), transparent 18rem);
}

.workspace-hero > *,
.board-hero > * {
  position: relative;
}

.workspace-hero h1,
.board-hero h1,
.teacher-pref-header h1,
.semester-card h3,
.schedule-panel h3,
.landing-hero h1,
.landing-feature-grid h2,
.teacher-group-heading strong,
.teacher-class-cell strong,
.faculty-link-preview strong,
.room-assignment-section h4,
.schedule-popup-head h3 {
  color: var(--text);
}

.workspace-hero p,
.board-hero p,
.landing-hero p,
.landing-feature-grid p,
.teacher-message,
.teacher-assignment-note,
.autofill-summary,
.autofill-status,
.muted,
.schedule-list-row small,
.semester-card-meta span,
.trash-row span,
.teacher-class-cell span,
.teacher-group-heading span,
.teacher-group-meta,
.teacher-faculty-list li,
.matrix-tool-label,
.column-lookup-note,
.faculty-share-save-status,
.faculty-link-preview span,
.faculty-link-preview small,
.schedule-grid small,
.empty,
.quality-list,
.rule-help-strip,
.room-rank-row small {
  color: var(--text-soft);
}

.eyebrow,
.field-stack span,
.time-pick-row > span,
.day-picker legend,
.schedule-form-grid label,
.column-import-form label span,
.teacher-class-row small {
  color: var(--primary);
}

.schedule-visual {
  border: 1px solid rgba(255, 255, 255, .1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent),
    #101d33;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), var(--shadow-md);
}

.visual-row {
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .08);
}

.visual-row.strong {
  background: linear-gradient(135deg, var(--primary), #5891ff);
  color: #ffffff;
}

.visual-row.warn {
  background: linear-gradient(135deg, var(--warning), #ffbe55);
  color: #261604;
}

.visual-dots b {
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.schedule-page .btn,
.schedule-landing .btn,
.teacher-pref-body .btn,
.teacher-collapse-toggle,
.view-chip,
.view-pill,
.column-tool-tab,
.faculty-link-button,
.template-token-button,
.matrix-day-chip,
.matrix-checkbox,
.room-rank-move,
.schedule-popup-close,
.view-chip-button,
.view-panel-close,
.view-rule-remove,
.view-rule-move,
.column-edit-button,
.semester-card-icon-button,
.semester-card-delete,
.faculty-add-toggle {
  border-radius: 8px;
  font-weight: 750;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease, color .14s ease;
}

.schedule-page .btn:hover,
.schedule-landing .btn:hover,
.teacher-pref-body .btn:hover,
.teacher-collapse-toggle:hover,
.view-chip:hover,
.view-pill:hover,
.column-tool-tab:hover,
.faculty-link-button:hover,
.template-token-button:hover,
.matrix-day-chip:hover,
.room-rank-move:hover:not(:disabled),
.semester-card-icon-button:hover,
.semester-card-delete:hover,
.faculty-add-toggle:hover {
  transform: translateY(-1px);
}

.schedule-page .btn-primary,
.schedule-landing .btn-primary {
  background: linear-gradient(135deg, var(--primary), #4c82ff);
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(29, 99, 237, .24);
}

.schedule-page .btn-primary:hover,
.schedule-landing .btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  border-color: var(--primary-strong);
  box-shadow: 0 12px 26px rgba(29, 99, 237, .3);
}

.schedule-page .btn-outline-primary,
.schedule-landing .btn-outline-primary,
.teacher-pref-body .btn-outline-primary {
  color: var(--primary);
  border-color: rgba(29, 99, 237, .35);
  background: rgba(29, 99, 237, .06);
}

.schedule-page .btn-outline-primary:hover,
.schedule-landing .btn-outline-primary:hover,
.teacher-pref-body .btn-outline-primary:hover {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.schedule-page .btn-outline-secondary,
.teacher-pref-body .btn-outline-secondary {
  color: var(--text-soft);
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.schedule-page .btn-outline-secondary:hover,
.teacher-pref-body .btn-outline-secondary:hover {
  color: var(--text);
  border-color: rgba(29, 99, 237, .32);
  background: var(--primary-soft);
}

.schedule-topbar .btn-outline-light {
  color: #f8fbff;
  border-color: rgba(248, 251, 255, .24);
  background: rgba(255, 255, 255, .08);
}

.schedule-topbar .btn-outline-light:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, .42);
  background: rgba(255, 255, 255, .16);
}

.schedule-message,
.schedule-invite-row,
.teacher-deadline,
.teacher-save-status,
.teacher-scope-toggle,
.teacher-collapse-toggle,
.column-tool-tabs,
.day-picker span,
.view-chip,
.matrix-day-chip,
.matrix-checkbox,
.matrix-unassigned-count,
.locked-room-note,
.supervisor-dept-list span,
.faculty-add-toggle,
.faculty-add-input,
.autofill-percent-row input,
.faculty-link-preview,
.column-editor,
.teacher-class-check {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--text-soft);
}

.custom-field-cell input,
.custom-field-cell select,
.custom-field-cell textarea,
.combo-input,
.course-subfield-input {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.schedule-metrics span {
  border-color: var(--border);
  background: transparent;
  color: var(--text-soft);
  box-shadow: none;
}

.schedule-metrics strong {
  color: var(--text);
}

.schedule-message {
  border-left-color: var(--primary);
}

.schedule-invite-row,
.trash-row,
.view-share-list,
.view-share-row,
.semester-card-invites,
.semester-card-access-list,
.matrix-detail-row {
  border-color: var(--border);
}

.semester-card {
  border-radius: 10px;
}

.semester-card:hover,
.landing-feature-grid article:hover,
.teacher-class-row:hover {
  border-color: rgba(29, 99, 237, .32);
  box-shadow: var(--shadow-md);
}

.schedule-tabs {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .65);
  box-shadow: var(--shadow-sm);
}

.schedule-tabs a {
  border: 0;
  border-radius: 8px;
  color: var(--text-soft);
  transition: background-color .14s ease, color .14s ease;
}

.schedule-tabs a:hover,
.schedule-tabs a.active {
  background: var(--primary);
  color: #ffffff;
}

.schedule-tabs a.active {
  font-weight: 800;
}

.schedule-table-wrap,
.matrix-scroll {
  border-color: var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.schedule-grid th,
.matrix-table thead th {
  background: #f7f8fa;
  color: #5b6473;
  border-color: var(--border);
  text-transform: none;
  letter-spacing: .005em;
  font-size: .78rem;
  font-weight: 650;
  box-shadow: inset 0 -1px 0 var(--border-strong, #c9d7ea);
}

.schedule-grid td,
.matrix-table td,
.matrix-table th {
  border-color: var(--border);
  background: var(--surface-strong);
  color: var(--text);
}

.schedule-grid tbody tr:hover td,
.matrix-table td[data-matrix-cell]:hover {
  background: var(--primary-soft);
}

.schedule-grid td[contenteditable="true"]:focus,
.schedule-grid td.editable-cell:focus-within,
.schedule-grid td:has(.combo-input:focus),
.schedule-grid td:has(> input:focus),
.schedule-grid td:has(> textarea:focus),
.schedule-grid td:has(.course-subfield-input:focus),
.faculty-add-input:focus,
.teacher-note-panel textarea:focus {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.combo-input:focus {
  box-shadow: none;
  background: transparent;
}

.schedule-grid td.cell-selected,
.view-chip.active,
.day-picker input:checked + span,
.column-tool-tab.active,
.matrix-day-chip.active,
.teacher-class-row.selected {
  border-color: rgba(29, 99, 237, .45);
  background: var(--primary-soft) !important;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(29, 99, 237, .22);
}

.schedule-grid td.cell-selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.teacher-scope-toggle a.active,
.teacher-class-row.selected .teacher-class-check {
  background: var(--primary);
  color: #ffffff;
}

.schedule-grid .draft-row td,
.schedule-grid .draft-row:focus-within td,
.schedule-grid .draft-row:hover td {
  background: var(--surface-soft);
}

.schedule-grid .draft-row td:first-child {
  box-shadow: inset 4px 0 0 var(--border-strong);
}

.column-autofill-button {
  border-color: var(--border);
  background: rgba(20, 30, 50, .05);
  color: var(--text-soft, #5b6473);
}

.column-autofill-button:hover,
.column-autofill-button:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.combo-menu,
.faculty-add-popover {
  border-color: var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-pop);
}

.combo-option,
.faculty-add-option {
  border-color: var(--border);
  color: var(--text);
}

.combo-option:hover,
.combo-option:focus,
.faculty-add-option:hover,
.faculty-add-option:focus {
  background: var(--primary-soft);
}

.schedule-popup-backdrop {
  background: rgba(11, 20, 36, .54);
  backdrop-filter: blur(4px);
}

.issue {
  border-left-color: var(--warning);
  background: var(--warning-soft);
  color: var(--text);
}

.issue.error,
.teacher-deadline.closed,
.teacher-note-panel textarea.save-error,
.teacher-class-row.save-error,
.cell-error {
  border-color: var(--danger);
  background: var(--danger-soft) !important;
}

.cell-saving,
.view-save-status.saving,
.teacher-save-status.saving {
  background: var(--warning-soft) !important;
}

.cell-saved,
.view-save-status.saved,
.teacher-save-status.saved,
.faculty-share-save-status.saved {
  background: var(--success-soft) !important;
  color: var(--success);
}

.landing-nav {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .68);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.landing-brand,
.landing-brand:hover {
  color: var(--text);
}

.landing-feature-grid i {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(29, 99, 237, .18);
}

@media (prefers-color-scheme: dark) {
  .schedule-app-body,
  .teacher-pref-body,
  .schedule-landing-body {
    --app-bg: #0d1524;
    --app-bg-2: #101b2f;
    --surface: rgba(21, 32, 52, .9);
    --surface-strong: #162238;
    --surface-soft: #1b2a43;
    --surface-muted: #22334f;
    --border: #2b3d5c;
    --border-strong: #3a5075;
    --text: #eef5ff;
    --text-soft: #b7c4d9;
    --muted: #8ea0ba;
    --primary: #5b8cff;
    --primary-strong: #7aa2ff;
    --primary-soft: rgba(91, 140, 255, .16);
    --semester-create-surface: rgba(31, 48, 78, .94);
    --semester-create-border: #3b5a8c;
    --accent: #23d4c3;
    --accent-soft: rgba(35, 212, 195, .14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .14);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, .15);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, .14);
    --shadow-sm: 0 10px 30px rgba(0, 0, 0, .22);
    --shadow-md: 0 20px 54px rgba(0, 0, 0, .3);
    --shadow-pop: 0 24px 64px rgba(0, 0, 0, .42);
    background:
      radial-gradient(circle at top left, rgba(91, 140, 255, .18), transparent 31rem),
      radial-gradient(circle at 82% 0, rgba(35, 212, 195, .13), transparent 26rem),
      linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 300px);
    color-scheme: dark;
  }

  .schedule-topbar {
    background: rgba(9, 17, 31, .9);
    box-shadow: 0 14px 44px rgba(0, 0, 0, .36);
  }

  .workspace-hero,
  .board-hero {
    background:
      linear-gradient(135deg, rgba(91, 140, 255, .16), rgba(35, 212, 195, .08)),
      var(--surface);
  }

  .schedule-visual,
  .schedule-grid th,
  .matrix-table thead th {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, .06), transparent),
      #0b1424;
  }

  .schedule-tabs,
  .landing-nav {
    background: rgba(21, 32, 52, .72);
  }

  .schedule-page .btn-outline-secondary,
  .teacher-pref-body .btn-outline-secondary {
    color: var(--text-soft);
    background: rgba(255, 255, 255, .04);
  }

  .schedule-page .btn-outline-primary,
  .schedule-landing .btn-outline-primary,
  .teacher-pref-body .btn-outline-primary {
    background: rgba(91, 140, 255, .1);
  }

  .schedule-page .btn-outline-primary:hover,
  .schedule-landing .btn-outline-primary:hover,
  .teacher-pref-body .btn-outline-primary:hover {
    color: #061125;
    background: var(--primary);
  }

  .schedule-grid option:disabled,
  .combo-option:disabled {
    background: var(--surface-muted);
    color: var(--muted);
  }

  .combo-option.conflict-option,
  .faculty-add-option.conflict-option {
    background: transparent;
    color: var(--muted);
  }

  .combo-option.conflict-option:hover,
  .combo-option.conflict-option:focus,
  .faculty-add-option.conflict-option:hover,
  .faculty-add-option.conflict-option:focus {
    color: var(--text);
    background: var(--primary-soft);
  }

  .schedule-grid td[contenteditable="true"]:focus,
  .schedule-grid td.editable-cell:focus-within,
  .schedule-grid td:has(.combo-input:focus),
  .schedule-grid td:has(> input:focus),
  .schedule-grid td:has(> textarea:focus),
  .schedule-grid td:has(.course-subfield-input:focus),
  .faculty-add-input:focus,
  .teacher-note-panel textarea:focus {
    background: rgba(91, 140, 255, .14);
    box-shadow: inset 0 0 0 2px var(--primary);
  }

  .combo-input:focus {
    background: transparent;
    box-shadow: none;
  }

  .schedule-popup-backdrop {
    background: rgba(1, 6, 16, .68);
  }

  .visual-row.warn {
    color: #1f1300;
  }
}

.appearance-settings {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.appearance-settings--topbar {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 1;
  display: inline-grid;
}

.appearance-settings-toggle,
.appearance-settings-close {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .14s ease, background-color .14s ease, color .14s ease, opacity .14s ease;
}

.appearance-settings-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  backdrop-filter: blur(14px);
  opacity: .82;
}

.appearance-settings--topbar .appearance-settings-toggle {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(248, 251, 255, .86);
}

.schedule-topbar .appearance-settings--topbar .appearance-settings-toggle {
  padding: 0;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.appearance-settings-toggle--topbar {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.appearance-settings-toggle--topbar i {
  color: #ffffff;
}

.appearance-settings-toggle:hover,
.appearance-settings-toggle:focus,
.appearance-settings.open .appearance-settings-toggle {
  opacity: 1;
  color: var(--primary);
  border-color: rgba(29, 99, 237, .36);
  background: var(--surface-strong);
  transform: translateY(-1px);
  outline: none;
}

.appearance-settings--topbar .appearance-settings-toggle:hover,
.appearance-settings--topbar .appearance-settings-toggle:focus,
.appearance-settings--topbar.open .appearance-settings-toggle {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #ffffff;
}

.schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:hover,
.schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:focus,
.schedule-topbar .appearance-settings--topbar.open .appearance-settings-toggle {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-schedule-theme="dark"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle,
html[data-schedule-theme="dark"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:hover,
html[data-schedule-theme="dark"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:focus,
html[data-schedule-theme="dark"] .schedule-topbar .appearance-settings--topbar.open .appearance-settings-toggle {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

.appearance-settings-panel {
  width: min(280px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  padding: 12px;
  backdrop-filter: blur(16px);
}

.appearance-settings--topbar .appearance-settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  transform: translateX(var(--appearance-panel-shift, 0px));
}

.appearance-settings-panel[hidden] {
  display: none;
}

.appearance-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.appearance-settings-head strong {
  color: var(--text);
  font-size: .92rem;
  font-weight: 850;
}

.appearance-settings-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.appearance-settings-close:hover,
.appearance-settings-close:focus {
  color: var(--primary);
  border-color: rgba(29, 99, 237, .36);
  outline: none;
}

.appearance-choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.appearance-choice-group button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  transition: background-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.appearance-choice-group button:hover,
.appearance-choice-group button:focus {
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
}

.appearance-choice-group button.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(29, 99, 237, .24);
}

.appearance-language-group {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.appearance-section-label {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.appearance-language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.language-option {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font: inherit;
  font-size: .8rem;
  font-weight: 800;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.language-option:hover,
.language-option:focus {
  color: var(--text);
  background: var(--surface-strong);
  border-color: rgba(29, 99, 237, .3);
  outline: none;
}

.language-option.active-language {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(29, 99, 237, .22);
}

html[dir="rtl"] .schedule-app-body,
html[dir="rtl"] .teacher-pref-body,
html[dir="rtl"] .schedule-landing-body {
  text-align: right;
}

html[dir="rtl"] .appearance-settings {
  right: auto;
  left: max(16px, env(safe-area-inset-left));
  justify-items: start;
}

html[dir="rtl"] .appearance-settings--topbar {
  left: auto;
}

html[dir="rtl"] .appearance-settings--topbar .appearance-settings-panel {
  right: auto;
  left: 0;
}

html[dir="rtl"] .schedule-topbar,
html[dir="rtl"] .schedule-brand,
html[dir="rtl"] .schedule-topbar-actions,
html[dir="rtl"] .schedule-actions,
html[dir="rtl"] .semester-card-actions,
html[dir="rtl"] .teacher-scope-row,
html[dir="rtl"] .landing-nav {
  flex-direction: row-reverse;
}

html[data-schedule-theme="light"] .schedule-app-body,
html[data-schedule-theme="light"] .teacher-pref-body,
html[data-schedule-theme="light"] .schedule-landing-body {
  --app-bg: #f5f7fb;
  --app-bg-2: #eef4ff;
  --surface: rgba(255, 255, 255, .92);
  --surface-strong: #ffffff;
  --surface-soft: #f7faff;
  --surface-muted: #eef4fb;
  --border: #dde6f3;
  --border-strong: #c9d7ea;
  --text: #152238;
  --text-soft: #4f6077;
  --muted: #74859b;
  --primary: #1d63ed;
  --primary-strong: #104ec7;
  --primary-soft: #e7efff;
  --semester-create-surface: #f3f8ff;
  --semester-create-border: #cfe0fa;
  --accent: #16c7b7;
  --accent-soft: #dcfbf6;
  --warning: #f59e0b;
  --warning-soft: #fff5d8;
  --danger: #ef4444;
  --danger-soft: #fff0f0;
  --success: #13a463;
  --success-soft: #e9f9f0;
  --purple: #7c3aed;
  --shadow-sm: 0 8px 22px rgba(21, 34, 56, .07);
  --shadow-md: 0 18px 46px rgba(21, 34, 56, .11);
  --shadow-pop: 0 22px 54px rgba(21, 34, 56, .18);
  background:
    radial-gradient(circle at top left, rgba(29, 99, 237, .13), transparent 31rem),
    radial-gradient(circle at 82% 0, rgba(22, 199, 183, .1), transparent 26rem),
    linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 260px);
  color-scheme: light;
}

html[data-schedule-theme="light"] .schedule-topbar {
  background: rgba(13, 27, 49, .88);
  box-shadow: 0 14px 40px rgba(13, 27, 49, .22);
}

html[data-schedule-theme="light"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle,
html[data-schedule-theme="light"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:hover,
html[data-schedule-theme="light"] .schedule-topbar .appearance-settings--topbar .appearance-settings-toggle:focus,
html[data-schedule-theme="light"] .schedule-topbar .appearance-settings--topbar.open .appearance-settings-toggle {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

html[data-schedule-theme="light"] .workspace-hero,
html[data-schedule-theme="light"] .board-hero {
  background:
    linear-gradient(135deg, rgba(29, 99, 237, .12), rgba(22, 199, 183, .08)),
    var(--surface-strong);
}

html[data-schedule-theme="light"] .schedule-visual {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent),
    #101d33;
}

html[data-schedule-theme="light"] .schedule-grid th,
html[data-schedule-theme="light"] .matrix-table thead th {
  background: #f7f8fa;
  color: #5b6473;
  box-shadow: inset 0 -1px 0 var(--border-strong, #c9d7ea);
}

html[data-schedule-theme="light"] .schedule-tabs,
html[data-schedule-theme="light"] .landing-nav {
  background: rgba(255, 255, 255, .65);
}

html[data-schedule-theme="light"] .schedule-grid td[contenteditable="true"]:focus,
html[data-schedule-theme="light"] .schedule-grid td.editable-cell:focus-within,
html[data-schedule-theme="light"] .schedule-grid td:has(.combo-input:focus),
html[data-schedule-theme="light"] .schedule-grid td:has(> input:focus),
html[data-schedule-theme="light"] .schedule-grid td:has(> textarea:focus),
html[data-schedule-theme="light"] .schedule-grid td:has(.course-subfield-input:focus),
html[data-schedule-theme="light"] .faculty-add-input:focus,
html[data-schedule-theme="light"] .teacher-note-panel textarea:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}

html[data-schedule-theme="light"] .combo-input:focus {
  background: transparent;
  box-shadow: none;
}

html[data-schedule-theme="dark"] .schedule-app-body,
html[data-schedule-theme="dark"] .teacher-pref-body,
html[data-schedule-theme="dark"] .schedule-landing-body {
  --app-bg: #0d1524;
  --app-bg-2: #101b2f;
  --surface: rgba(21, 32, 52, .9);
  --surface-strong: #162238;
  --surface-soft: #1b2a43;
  --surface-muted: #22334f;
  --border: #2b3d5c;
  --border-strong: #3a5075;
  --text: #eef5ff;
  --text-soft: #b7c4d9;
  --muted: #8ea0ba;
  --primary: #5b8cff;
  --primary-strong: #7aa2ff;
  --primary-soft: rgba(91, 140, 255, .16);
  --semester-create-surface: rgba(31, 48, 78, .94);
  --semester-create-border: #3b5a8c;
  --accent: #23d4c3;
  --accent-soft: rgba(35, 212, 195, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .15);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, .14);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, .22);
  --shadow-md: 0 20px 54px rgba(0, 0, 0, .3);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, .42);
  background:
    radial-gradient(circle at top left, rgba(91, 140, 255, .18), transparent 31rem),
    radial-gradient(circle at 82% 0, rgba(35, 212, 195, .13), transparent 26rem),
    linear-gradient(180deg, var(--app-bg-2), var(--app-bg) 300px);
  color-scheme: dark;
}

html[data-schedule-theme="dark"] .schedule-topbar {
  background: rgba(9, 17, 31, .9);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .36);
}

html[data-schedule-theme="dark"] .workspace-hero,
html[data-schedule-theme="dark"] .board-hero {
  background:
    linear-gradient(135deg, rgba(91, 140, 255, .16), rgba(35, 212, 195, .08)),
    var(--surface);
}

html[data-schedule-theme="dark"] .schedule-visual,
html[data-schedule-theme="dark"] .schedule-grid th,
html[data-schedule-theme="dark"] .matrix-table thead th {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent),
    #0b1424;
}

html[data-schedule-theme="dark"] .schedule-tabs,
html[data-schedule-theme="dark"] .landing-nav {
  background: rgba(21, 32, 52, .72);
}

html[data-schedule-theme="dark"] .schedule-page .btn-outline-primary:hover,
html[data-schedule-theme="dark"] .schedule-landing .btn-outline-primary:hover,
html[data-schedule-theme="dark"] .teacher-pref-body .btn-outline-primary:hover {
  color: #061125;
}

html[data-schedule-theme="dark"] .schedule-grid option:disabled,
html[data-schedule-theme="dark"] .combo-option:disabled {
  background: var(--surface-muted);
  color: var(--muted);
}

html[data-schedule-theme="dark"] .matrix-recommendation,
html[data-schedule-theme="dark"] .matrix-override-reason textarea,
html[data-schedule-theme="dark"] .matrix-audit-row {
  border-color: var(--border);
  background: var(--surface-strong);
  color: var(--text);
}

html[data-schedule-theme="dark"] .matrix-detail-section-title,
html[data-schedule-theme="dark"] .matrix-recommendation,
html[data-schedule-theme="dark"] .matrix-audit-row {
  color: var(--text);
}

html[data-schedule-theme="dark"] .matrix-recommendation.has-conflict,
html[data-schedule-theme="dark"] .matrix-info-box.warning {
  border-color: rgba(251, 191, 36, .42);
  background: var(--warning-soft);
  color: var(--warning);
}

html[data-schedule-theme="dark"] .matrix-collision-label {
  border-color: rgba(251, 191, 36, .42);
  background: var(--warning-soft);
  color: var(--warning);
}

html[data-schedule-theme="dark"] .matrix-table td.matrix-needs-classroom {
  background: rgba(251, 113, 133, .1);
}

html[data-schedule-theme="dark"] .combo-option.conflict-option,
html[data-schedule-theme="dark"] .faculty-add-option.conflict-option {
  background: transparent;
  color: var(--muted);
}

html[data-schedule-theme="dark"] .combo-option.conflict-option:hover,
html[data-schedule-theme="dark"] .combo-option.conflict-option:focus,
html[data-schedule-theme="dark"] .faculty-add-option.conflict-option:hover,
html[data-schedule-theme="dark"] .faculty-add-option.conflict-option:focus {
  color: var(--text);
  background: var(--primary-soft);
}

html[data-schedule-theme="dark"] .schedule-grid td[contenteditable="true"]:focus,
html[data-schedule-theme="dark"] .schedule-grid td.editable-cell:focus-within,
html[data-schedule-theme="dark"] .schedule-grid td:has(.combo-input:focus),
html[data-schedule-theme="dark"] .schedule-grid td:has(> input:focus),
html[data-schedule-theme="dark"] .schedule-grid td:has(> textarea:focus),
html[data-schedule-theme="dark"] .schedule-grid td:has(.course-subfield-input:focus),
html[data-schedule-theme="dark"] .faculty-add-input:focus,
html[data-schedule-theme="dark"] .teacher-note-panel textarea:focus {
  background: rgba(91, 140, 255, .14);
  box-shadow: inset 0 0 0 2px var(--primary);
}

html[data-schedule-theme="dark"] .combo-input:focus {
  background: transparent;
  box-shadow: none;
}

html[data-schedule-theme="dark"] .teacher-class-row:not(.selected) {
  background: var(--surface);
}

html[data-schedule-theme="dark"] .teacher-class-row:not(.selected):hover {
  background: var(--surface-muted);
}

html[data-schedule-theme="dark"] .teacher-class-row.selected {
  border-color: rgba(91, 140, 255, .68);
  background: rgba(91, 140, 255, .18) !important;
  box-shadow: inset 4px 0 0 var(--primary), inset 0 0 0 1px rgba(91, 140, 255, .22);
}

html[data-schedule-theme="dark"] .teacher-class-row:not(.selected) .teacher-class-check {
  border-color: var(--border-strong);
  background: #162238;
  color: transparent;
}

html[data-schedule-theme="dark"] .teacher-class-row.selected .teacher-class-check {
  border-color: var(--primary-strong);
  background: var(--primary);
  color: #ffffff;
}

html[data-schedule-theme="dark"] .visual-row.warn {
  color: #1f1300;
}

@media (max-width: 700px) {
  .appearance-settings {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .appearance-settings--topbar {
    right: auto;
    bottom: auto;
  }

  .appearance-settings-toggle {
    width: 40px;
    height: 40px;
  }
}


/* ===== Power-user enhancements: bulk bar, fill menu, palette, context menu ===== */

/* Bulk action bar */
.sch-bulkbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2600;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 16px;
  border-radius: 12px;
  background: var(--surface-strong, #ffffff);
  border: 1px solid var(--border, #dde6f3);
  box-shadow: var(--shadow-pop, 0 22px 54px rgba(21, 34, 56, .18));
  font-size: .9rem;
  color: var(--text, #152238);
  max-width: calc(100vw - 28px);
}

.sch-bulkbar-count {
  font-weight: 700;
  white-space: nowrap;
}

.sch-bulkbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sch-bulkbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong, #c9d7ea);
  background: var(--surface-soft, #f7faff);
  color: var(--text, #152238);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: .86rem;
  font-weight: 650;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.sch-bulkbar-btn:hover {
  background: var(--primary-soft, #e7efff);
  border-color: var(--primary, #1d63ed);
  color: var(--primary-strong, #104ec7);
}

.sch-bulkbar-btn.danger:hover {
  background: var(--danger-soft, #fff0f0);
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}

.sch-bulkbar-btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted, #74859b);
}

.sch-bulkbar-btn.ghost:hover {
  color: var(--text, #152238);
  background: var(--surface-muted, #eef4fb);
}

/* Fill menu (opens above the bulk bar) */
.sch-fillmenu {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  min-width: 260px;
  max-width: 340px;
  max-height: 320px;
  overflow: auto;
  background: var(--surface-strong, #ffffff);
  border: 1px solid var(--border, #dde6f3);
  border-radius: 10px;
  box-shadow: var(--shadow-pop, 0 22px 54px rgba(21, 34, 56, .18));
  padding: 6px;
}

.sch-fillmenu-head,
.sch-fillmenu-empty {
  font-size: .76rem;
  color: var(--muted, #74859b);
  padding: 6px 8px;
}

.sch-fillmenu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--text, #152238);
}

.sch-fillmenu-item:hover {
  background: var(--primary-soft, #e7efff);
}

.sch-fillmenu-item span {
  font-weight: 650;
  font-size: .86rem;
}

.sch-fillmenu-item small {
  color: var(--muted, #74859b);
  font-size: .76rem;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right-click row context menu */
.sch-ctxmenu {
  position: fixed;
  z-index: 4600;
  min-width: 184px;
  background: var(--surface-strong, #ffffff);
  border: 1px solid var(--border, #dde6f3);
  border-radius: 10px;
  box-shadow: var(--shadow-pop, 0 22px 54px rgba(21, 34, 56, .18));
  padding: 5px;
}

.sch-ctxmenu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text, #152238);
  cursor: pointer;
}

.sch-ctxmenu button:hover {
  background: var(--primary-soft, #e7efff);
}

.sch-ctxmenu button.danger:hover {
  background: var(--danger-soft, #fff0f0);
  color: var(--danger, #ef4444);
}

.sch-ctxsep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border, #dde6f3);
}

/* Command palette */
.sch-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(11, 20, 36, .42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.sch-palette {
  width: min(560px, calc(100vw - 32px));
  background: var(--surface-strong, #ffffff);
  border: 1px solid var(--border, #dde6f3);
  border-radius: 14px;
  box-shadow: var(--shadow-pop, 0 22px 54px rgba(21, 34, 56, .18));
  overflow: hidden;
}

.sch-palette-input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--border, #dde6f3);
  padding: 15px 18px;
  font-size: 1.02rem;
  background: transparent;
  color: var(--text, #152238);
  outline: none;
}

.sch-palette-list {
  max-height: 52vh;
  overflow: auto;
  padding: 6px;
}

.sch-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .9rem;
  color: var(--text, #152238);
  cursor: pointer;
}

.sch-palette-item.active,
.sch-palette-item:hover {
  background: var(--primary-soft, #e7efff);
}

.sch-palette-item small {
  color: var(--muted, #74859b);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex: none;
}

.sch-palette-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted, #74859b);
  font-size: .9rem;
}

/* ===== Rules tab: fixed preloaded checklist (reversible UI lock) ===== */
/* Hide the "add new rule" draft row — rules are preloaded, not hand-added. */
[data-schedule-table="rules"] .draft-row {
  display: none;
}
/* Lock the rule name: clicking it must not open the picker or change the rule. */
[data-schedule-table="rules"] tr[data-row-model="rule"] [data-rule-type-control] .combo-input {
  pointer-events: none;
  cursor: default;
}
[data-schedule-table="rules"] tr[data-row-model="rule"] [data-rule-type-control] .combo-menu {
  display: none !important;
}

/* ------------------------------------------------------------------
   Spreadsheet-style cells (Airtable / Excel behaviour)
   A click selects, a second click / double-click / Enter / typing edits.
   The range gets one outline (edge classes painted by schedule.js) and the
   active cell stays white; no browser text highlight leaks across cells.
   ------------------------------------------------------------------ */
.schedule-grid td.editable-cell,
.schedule-grid td.editable-cell * {
  -webkit-user-select: none;
  user-select: none;
}

.schedule-grid td.editable-cell.cell-editing,
.schedule-grid td.editable-cell.cell-editing *,
.schedule-grid td.editable-cell input:not([type="checkbox"]):not([type="radio"]),
.schedule-grid td.editable-cell textarea,
.schedule-grid td[contenteditable="true"]:focus {
  -webkit-user-select: text;
  user-select: text;
}

.schedule-grid td.editable-cell,
.schedule-grid td[contenteditable="true"].editable-cell {
  cursor: default;
}

.schedule-grid td.editable-cell.cell-editing,
.schedule-grid td[contenteditable="true"].editable-cell.cell-editing {
  cursor: text;
}

.schedule-grid td.editable-cell .combo-input:not(:focus) {
  cursor: default;
}

html .schedule-board .schedule-grid td.editable-cell.cell-selected {
  --sel-color: var(--primary, #1d63ed);
  --sel-t: 0px;
  --sel-b: 0px;
  --sel-s: 0px;
  --sel-e: 0px;
  background: var(--primary-soft, #e7efff) !important;
  box-shadow:
    inset 0 var(--sel-t) 0 0 var(--sel-color),
    inset 0 calc(-1 * var(--sel-b)) 0 0 var(--sel-color),
    inset var(--sel-s) 0 0 0 var(--sel-color),
    inset calc(-1 * var(--sel-e)) 0 0 0 var(--sel-color);
}

html .schedule-board .schedule-grid td.cell-selected.sel-edge-top { --sel-t: 2px; }
html .schedule-board .schedule-grid td.cell-selected.sel-edge-bottom { --sel-b: 2px; }
html .schedule-board .schedule-grid td.cell-selected.sel-edge-start { --sel-s: 2px; }
html .schedule-board .schedule-grid td.cell-selected.sel-edge-end { --sel-e: 2px; }

/* In a right-to-left table the previous DOM cell sits on the right. */
html .schedule-board .schedule-grid:dir(rtl) td.editable-cell.cell-selected {
  box-shadow:
    inset 0 var(--sel-t) 0 0 var(--sel-color),
    inset 0 calc(-1 * var(--sel-b)) 0 0 var(--sel-color),
    inset calc(-1 * var(--sel-s)) 0 0 0 var(--sel-color),
    inset var(--sel-e) 0 0 0 var(--sel-color);
}

/* The active cell of a multi-cell range reads as "where typing goes". */
html .schedule-board.grid-multi-selected .schedule-grid td.editable-cell.cell-selected.cell-active {
  background: var(--surface-strong, #ffffff) !important;
}

html .schedule-board .schedule-grid td.editable-cell.cell-editing,
html .schedule-board .schedule-grid td.editable-cell.cell-selected.cell-editing {
  background: var(--surface-strong, #ffffff) !important;
  box-shadow: inset 0 0 0 2px var(--primary, #1d63ed), inset 0 0 0 4px rgba(29, 99, 237, .16);
}

html .schedule-board .schedule-grid td.editable-cell.cell-selected.cell-saving { background: #fff8dc !important; }
html .schedule-board .schedule-grid td.editable-cell.cell-selected.cell-error { background: #fff0f0 !important; }

.schedule-board .grid-clipboard-sink {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  resize: none;
  pointer-events: none;
  z-index: -1;
}

.schedule-board:focus,
.schedule-board:focus-visible {
  outline: none;
}

/* Live schedule issues: cells a warning depends on carry an amber underline
   and are watched — changing one rechecks the warnings immediately. */
.schedule-panel.issues[hidden] {
  display: none !important;
}

html .schedule-board .schedule-grid tr.schedule-issue-row > td.check-col {
  background-image: linear-gradient(var(--warning, #f59e0b), var(--warning, #f59e0b));
  background-repeat: no-repeat;
  background-size: 3px 100%;
  background-position: left top;
}

html .schedule-board .schedule-grid td.schedule-issue-cell {
  background-image: linear-gradient(var(--warning, #f59e0b), var(--warning, #f59e0b));
  background-repeat: no-repeat;
  background-size: 100% 2px;
  background-position: left bottom;
}

html .schedule-board .schedule-grid td.schedule-issue-cell.schedule-issue-rechecking,
.issue.rechecking {
  animation: schedule-issue-recheck 1s ease-in-out infinite;
}

.issue {
  transition: opacity .2s ease;
}

@keyframes schedule-issue-recheck {
  50% { opacity: .5; }
}

@media (prefers-reduced-motion: reduce) {
  html .schedule-board .schedule-grid td.schedule-issue-cell.schedule-issue-rechecking,
  .issue.rechecking {
    animation: none;
    opacity: .6;
  }
}

/* Warning links: every warning lists its classes (code, days, times) as links
   that jump to the row; the focus bar keeps them reachable while scrolling. */
/* A warning is one line: title, sentence (with its class codes as links) and,
   only for classes the sentence does not name, trailing links. It wraps only
   when it genuinely does not fit. */
.issue {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.issue-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .86rem;
  line-height: 1.7;
}

.issue-text > strong {
  margin-inline-end: 10px;
}

.issue-rows {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.issue-row-link,
.issue-rows-more {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid var(--border-strong, #c9d7ea);
  border-radius: 999px;
  background: var(--surface-strong, #ffffff);
  color: var(--text, #152238);
  font-size: .78rem;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}

.issue-row-link[hidden] {
  display: none;
}

.issue-row-link:hover,
.issue-row-link:focus-visible,
.issue-rows-more:hover,
.issue-rows-more:focus-visible {
  border-color: var(--primary, #1d63ed);
  color: var(--primary-strong, #104ec7);
  text-decoration: none;
}

.issue-row-link.active {
  border-color: var(--primary, #1d63ed);
  background: var(--primary-soft, #e7efff);
}

.issue-row-code {
  font-weight: 750;
}

.issue-row-when {
  color: var(--text-soft, #4f6077);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.issue-focus-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: min(980px, calc(100vw - 28px));
  padding: 9px 10px 9px 14px;
  border: 1px solid var(--border, #dde6f3);
  border-left: 4px solid var(--warning, #f59e0b);
  border-radius: 12px;
  background: var(--surface-strong, #ffffff);
  color: var(--text, #152238);
  box-shadow: var(--shadow-pop, 0 22px 54px rgba(21, 34, 56, .18));
}

.issue-focus-bar.resolved {
  border-left-color: var(--success, #13a463);
}

body:has(.sch-bulkbar:not([hidden])) .issue-focus-bar {
  bottom: 84px;
}

.issue-focus-text {
  display: grid;
  gap: 1px;
  flex: 0 1 300px;
  min-width: 0;
  font-size: .82rem;
}

.issue-focus-text span {
  overflow: hidden;
  color: var(--text-soft, #4f6077);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-focus-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #74859b);
  cursor: pointer;
}

.issue-focus-close:hover,
.issue-focus-close:focus-visible {
  background: var(--surface-muted, #eef4fb);
  color: var(--text, #152238);
}

@media (max-width: 700px) {
  .issue-focus-bar {
    flex-wrap: wrap;
    width: calc(100vw - 28px);
  }

  .issue-focus-text {
    flex-basis: calc(100% - 44px);
  }
}

/* The classes behind the warning the user jumped to. The one they clicked
   pulses once and keeps a stronger tint. */
html .schedule-board .schedule-grid tr.issue-focus-row > td {
  box-shadow: inset 0 0 0 999px rgba(245, 158, 11, .14);
}

html .schedule-board .schedule-grid tr.issue-focus-row > td:first-child {
  box-shadow: inset 3px 0 0 var(--warning, #f59e0b), inset 0 0 0 999px rgba(245, 158, 11, .14);
}

html .schedule-board .schedule-grid tr.issue-focus-target > td {
  box-shadow:
    inset 0 2px 0 var(--warning, #f59e0b),
    inset 0 -2px 0 var(--warning, #f59e0b),
    inset 0 0 0 999px rgba(245, 158, 11, .26);
  animation: schedule-issue-focus-pulse 1.4s ease-out;
}

html .schedule-board .schedule-grid tr.issue-focus-target > td:first-child {
  box-shadow:
    inset 0 2px 0 var(--warning, #f59e0b),
    inset 0 -2px 0 var(--warning, #f59e0b),
    inset 0 0 0 999px rgba(245, 158, 11, .26);
}

@keyframes schedule-issue-focus-pulse {
  from {
    box-shadow:
      inset 0 2px 0 var(--warning, #f59e0b),
      inset 0 -2px 0 var(--warning, #f59e0b),
      inset 0 0 0 999px rgba(245, 158, 11, .6);
  }
}

@media (prefers-reduced-motion: reduce) {
  html .schedule-board .schedule-grid tr.issue-focus-target > td {
    animation: none;
  }
}

/* Assistant rows on the semester card: status pill + permission toggles. */
.semester-access-status {
  display: inline-block;
  margin-inline-start: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  background: #e8f5ee;
  color: #1f7a4d;
}

.semester-access-status--pending {
  background: #fff3d6;
  color: #8a5a00;
}

.semester-access-perms {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: .8rem;
  color: var(--text-soft, #5f6d80);
}

.semester-access-perms label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Teacher course cards on phones: title first, one row of day/time/room
   facts, faculty set apart below. Every cell lines up on the page's start
   edge; the Arabic/English text inside still gets its own bidi direction,
   so labels and values no longer zig-zag between left and right. */
@media (max-width: 640px) {
  .teacher-message {
    width: auto;
    max-width: 100%;
  }

  .teacher-class-row {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 14px 14px 12px;
  }

  .teacher-class-check {
    width: 28px;
    height: 28px;
    margin-top: 2px;
  }

  .teacher-class-cells {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
  }

  .teacher-class-cell[data-teacher-cell-key] {
    direction: inherit;
    unicode-bidi: normal;
    text-align: start;
    padding: 0;
  }

  .teacher-class-cell > small,
  .teacher-class-cell > strong,
  .teacher-class-cell > span,
  .teacher-faculty-list li > span {
    unicode-bidi: plaintext;
    text-align: left;
  }

  html[dir="rtl"] .teacher-class-cell > small,
  html[dir="rtl"] .teacher-class-cell > strong,
  html[dir="rtl"] .teacher-class-cell > span,
  html[dir="rtl"] .teacher-faculty-list li > span {
    text-align: right;
  }

  .teacher-class-cell[data-teacher-cell-key="course_name"],
  .teacher-class-cell[data-teacher-cell-key="course"] {
    grid-column: 1 / -1;
  }

  .teacher-class-cell[data-teacher-cell-key="course_name"] {
    order: -2;
  }

  .teacher-class-cell[data-teacher-cell-key="course_name"] strong {
    font-size: 1.08rem;
    line-height: 1.3;
  }

  .teacher-class-cell[data-teacher-cell-key="course"] {
    order: -1;
    margin-top: -6px;
  }

  .teacher-class-cell[data-teacher-cell-key="course_name"] > small,
  .teacher-class-cell[data-teacher-cell-key="course"] > small {
    display: none;
  }

  .teacher-class-cell[data-teacher-cell-key="course"] strong {
    color: var(--text-soft, #526176);
    font-size: .9rem;
    font-weight: 700;
  }

  .teacher-class-cell[data-teacher-cell-key="faculty"] {
    grid-column: 1 / -1;
    order: 10;
    border-top: 1px solid var(--border, #d9cdb8);
    padding-top: 10px;
  }

  .teacher-faculty-list li {
    justify-content: flex-start;
  }

  .teacher-class-row small {
    font-size: .68rem;
    letter-spacing: .02em;
  }
}

/* Teacher request-note popup on teacher-grouped headers. */
.group-title { cursor: default; }
.teacher-note-popup {
  position: fixed;
  z-index: 60;
  width: min(360px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  display: flex;
  flex-direction: column;
  background: var(--surface-strong, #ffffff);
  color: var(--text, #1f2733);
  border: 1px solid var(--border, #e4d8c4);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(18, 52, 59, .22);
  font-size: .9rem;
  pointer-events: none;
}
.teacher-note-popup.is-pinned { pointer-events: auto; }
.teacher-note-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  font-weight: 750;
  border-bottom: 1px solid var(--border, #e4d8c4);
  background: var(--surface-soft, #f6f2ea);
  border-radius: 10px 10px 0 0;
}
.teacher-note-popup.is-pinned .teacher-note-popup-head { cursor: grab; touch-action: none; user-select: none; }
.teacher-note-popup-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-note-popup-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
}
.teacher-note-popup-close:hover { background: rgba(0, 0, 0, .08); }
.teacher-note-popup-body {
  padding: 10px 12px;
  overflow-y: auto;
}
.teacher-note-popup-name { font-weight: 750; margin: 6px 0 2px; }
.teacher-note-popup-name:first-child { margin-top: 0; }
.teacher-note-popup-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 2px 0;
  cursor: pointer;
}
.teacher-note-popup:not(.is-pinned) .teacher-note-popup-line { cursor: default; }
.teacher-note-popup-line input { margin: 3px 0 0; flex: none; }
.teacher-note-popup-line span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  min-height: 1.3em;
}
.teacher-note-popup-line.is-done span { text-decoration: line-through; opacity: .55; }
