.supervisor-roster-page {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 22px;
}

.supervisor-roster-page .page-header {
  min-height: 48px;
  padding: 0 0 2px;
}

.supervisor-roster-page .page-header h1 {
  font-size: clamp(22px, 1.8vw, 29px);
}

.supervisor-roster-page .page-header p {
  max-width: 780px;
  margin-top: 4px;
  color: #5e6b82;
  font-size: 13px;
}

.supervisor-roster-page .profile {
  min-width: 214px;
  margin-right: 0;
}

.supervisor-roster-page .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.roster-config-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.roster-toolbar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.roster-toolbar-copy strong {
  color: #07132c;
  font-size: 15px;
  line-height: 1.1;
}

.roster-toolbar-copy span {
  color: #52627c;
  font-size: 12px;
  font-weight: 760;
}

.roster-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.secondary-action,
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.secondary-action:hover,
.danger-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.secondary-action {
  color: var(--dept-design);
  border: 1px solid color-mix(in srgb, var(--dept-design) 22%, transparent);
  background: #edf6ff;
}

.danger-action {
  color: #be123c;
  border: 1px solid rgba(225, 29, 72, 0.18);
  background: #fff1f2;
}

.roster-week-grid {
  min-width: 0;
}

.roster-week-shell {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.roster-week-board {
  display: grid;
  grid-template-columns: minmax(128px, 0.72fr) repeat(5, minmax(178px, 1fr));
  min-width: 1120px;
}

.week-corner,
.week-day-heading,
.week-period-heading,
.supervision-cell {
  border-right: 1px solid rgba(16, 24, 40, 0.07);
  border-bottom: 1px solid rgba(16, 24, 40, 0.07);
}

.week-corner,
.week-day-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  background: rgba(248, 251, 255, 0.98);
  backdrop-filter: blur(12px);
}

.week-corner {
  left: 0;
  z-index: 6;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  color: #5b6b84;
  font-size: 11px;
  font-weight: 920;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.week-corner strong {
  color: #07132c;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

.week-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
}

.week-day-heading div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.week-day-heading strong {
  color: #07132c;
  font-size: 15px;
  line-height: 1.05;
}

.week-day-heading span {
  color: #64748b;
  font-size: 11px;
  font-weight: 820;
}

.day-count-pill,
.period-pill,
.slot-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.day-count-pill {
  min-width: 34px;
  min-height: 26px;
  padding: 0 9px;
  color: #0b3973;
  background: rgba(11, 114, 255, 0.1);
  font-size: 11px;
}

.week-period-heading {
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 96px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.period-pill {
  width: 34px;
  height: 34px;
  color: #fff;
  background: linear-gradient(135deg, #0b72ff, #0b3973);
  font-size: 13px;
  box-shadow: 0 10px 20px rgba(11, 114, 255, 0.18);
}

.period-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.period-meta strong {
  color: #07132c;
  font-size: 13px;
  line-height: 1.05;
}

.period-meta span {
  color: #64748b;
  font-size: 11px;
  font-weight: 820;
}

.supervision-cell {
  position: relative;
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 96px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.supervision-cell:hover,
.supervision-cell.is-active {
  z-index: 5;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(11, 114, 255, 0.12), 0 14px 26px rgba(15, 23, 42, 0.08);
}

.cell-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.slot-count-pill {
  min-width: 22px;
  height: 22px;
  color: #0b3973;
  background: rgba(11, 114, 255, 0.09);
  font-size: 10px;
}

.roster-selected-list {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 6px;
  min-height: 28px;
}

.roster-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 25px;
  padding: 0 4px 0 9px;
  color: #0b3973;
  border: 1px solid rgba(11, 114, 255, 0.14);
  border-radius: 999px;
  background: rgba(11, 114, 255, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.roster-selected-chip b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-selected-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #45617f;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}

.roster-selected-chip button:hover {
  color: #be123c;
  background: #fff1f2;
}

.roster-empty {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  margin: 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 850;
}

.cell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.cell-add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  color: var(--dept-design);
  border: 1px solid color-mix(in srgb, var(--dept-design) 18%, transparent);
  border-radius: 999px;
  background: rgba(237, 246, 255, 0.94);
  font: inherit;
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
}

.cell-add-button:hover {
  border-color: color-mix(in srgb, var(--dept-design) 34%, transparent);
  background: #e5f1ff;
}

.roster-cell-editor {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(11, 114, 255, 0.14);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(237, 246, 255, 0.92), rgba(255, 255, 255, 0.96));
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.roster-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.roster-cell-editor input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  color: #07132c;
  border: 1px solid rgba(16, 24, 40, 0.14);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 780;
  outline: 0;
}

.roster-cell-editor input:focus {
  border-color: rgba(11, 114, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(11, 114, 255, 0.08);
}

.roster-cell-editor button[type="submit"] {
  min-width: 38px;
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #0b72ff, #0b3973);
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
}

.roster-cell-editor button[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.roster-search-results {
  display: grid;
  gap: 5px;
  max-height: 210px;
  overflow: auto;
}

.roster-search-results button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  color: #25324d;
  border: 1px solid rgba(16, 24, 40, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.roster-search-results button:hover {
  color: #0b3973;
  border-color: rgba(11, 114, 255, 0.2);
  background: rgba(11, 114, 255, 0.08);
}

.roster-search-results button b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-search-results button span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
}

.roster-search-results p,
.roster-loading {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 820;
}

.roster-loading {
  padding: 18px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.roster-loading.is-error {
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.2);
  background: #fff1f2;
}

.roster-save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: end;
  min-height: 30px;
  margin: 0;
  padding: 0 10px;
  color: #047857;
  border-radius: 999px;
  background: rgba(236, 253, 245, 0.82);
  opacity: 0;
  font-size: 12px;
  font-weight: 950;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: translateY(-4px);
}

.roster-save-state.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.roster-save-state.is-error {
  color: #be123c;
  background: #fff1f2;
}

@media (max-width: 1180px) {
  .roster-week-board {
    min-width: 1040px;
    grid-template-columns: minmax(118px, 0.65fr) repeat(5, minmax(170px, 1fr));
  }
}

@media (max-width: 760px) {
  .supervisor-roster-page {
    padding: 18px;
  }

  .roster-config-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .roster-actions {
    justify-content: stretch;
  }

  .secondary-action,
  .danger-action {
    flex: 1 1 180px;
  }

  .roster-week-shell {
    border-radius: 14px;
  }
}
