.staff-profiles-page {
  color: var(--text-main, #263247);
}

.staff-profiles-page .page-header {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
}

.staff-profiles-page .page-header h1 {
  margin-top: 2px;
}

.staff-eyebrow {
  color: var(--link-color, #2356a8);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.staff-back-link {
  display: inline-flex;
  flex: 0 0 auto;
  text-decoration: none;
}

.staff-setup-flow {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 18px;
}

.staff-setup-flow > * {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 10px;
  color: var(--text-main, #263247);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
  padding: 10px 14px;
  text-decoration: none;
}

.staff-setup-flow span {
  color: var(--text-muted, #667085);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.staff-setup-flow strong {
  margin-top: 3px;
}

.staff-setup-flow a:hover {
  border-color: var(--primary-blue, #2356a8);
}

.staff-setup-flow__current {
  border-color: var(--primary-blue, #2356a8);
  box-shadow: inset 0 3px 0 var(--primary-blue, #2356a8);
}

.staff-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.staff-summary > div {
  align-items: baseline;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  padding: 12px 15px;
}

.staff-summary span {
  color: var(--text-strong, #182448);
  font-size: 1.35rem;
  font-weight: 800;
}

.staff-summary small {
  color: var(--text-muted, #667085);
}

.staff-layout {
  align-items: start;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}

.staff-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #dbe3ef);
  border-radius: 12px;
  box-shadow: var(--shadow-card, 0 2px 8px rgba(0, 0, 0, 0.08));
  overflow: hidden;
}

.staff-panel-header {
  align-items: center;
  background: linear-gradient(135deg, #182448 0%, #2a4a7a 100%);
  color: #fff;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 70px;
  padding: 13px 16px;
}

.staff-panel-header h2,
.staff-panel-header p {
  color: #fff;
  margin: 0;
}

.staff-panel-header h2 {
  font-size: 1.05rem;
}

.staff-panel-header p {
  font-size: 0.78rem;
  margin-top: 3px;
  opacity: 0.82;
}

.staff-panel-header__button {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.36);
  color: #fff;
  flex: 0 0 auto;
}

.staff-panel-header__button:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.staff-panel-body {
  padding: 16px;
}

.staff-list-panel-body {
  min-height: 440px;
}

.staff-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-field > span {
  color: var(--text-strong, #344054);
  font-size: 0.82rem;
  font-weight: 700;
}

.staff-field small {
  color: var(--text-muted, #667085);
  line-height: 1.35;
}

.staff-field input,
.staff-group-controls select {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cfd8e5);
  border-radius: 7px;
  color: var(--text-main, #263247);
  min-height: 40px;
  padding: 9px 11px;
}

.staff-field input:focus,
.staff-group-controls select:focus {
  border-color: var(--link-color, #2356a8);
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(35, 86, 168, 0.12));
  outline: none;
}

.staff-field input:disabled {
  background: var(--surface-muted, #f3f5f8);
  color: var(--text-muted, #667085);
}

.staff-profile-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
  max-height: 65vh;
  overflow: auto;
}

.staff-profile-row {
  align-items: center;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e0e6ef);
  border-radius: 9px;
  color: var(--text-main, #263247);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}

.staff-profile-row:hover,
.staff-profile-row.is-active {
  background: var(--surface-elevated, #f5f8ff);
  border-color: var(--primary-blue, #2356a8);
}

.staff-profile-row__identity {
  min-width: 0;
}

.staff-profile-row__identity strong,
.staff-profile-row__identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-profile-row__identity span,
.staff-profile-row__count {
  color: var(--text-muted, #667085);
  font-size: 0.78rem;
}

.staff-profile-row__count {
  background: var(--surface-muted, #eef2f7);
  border-radius: 999px;
  padding: 4px 8px;
}

.staff-empty-state {
  border: 1px dashed var(--border, #ccd5e2);
  border-radius: 9px;
  color: var(--text-muted, #667085);
  padding: 22px 14px;
  text-align: center;
}

.staff-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staff-editor-section {
  border-top: 1px solid var(--border, #e1e6ee);
  margin-top: 18px;
  padding-top: 18px;
}

.staff-section-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 11px;
}

.staff-section-heading h3,
.staff-section-heading p {
  margin: 0;
}

.staff-section-heading h3 {
  color: var(--text-strong, #182448);
  font-size: 1rem;
}

.staff-section-heading p,
.staff-section-heading a {
  color: var(--text-muted, #667085);
  font-size: 0.8rem;
  margin-top: 4px;
}

.staff-section-heading a {
  color: var(--link-color, #2356a8);
  white-space: nowrap;
}

.staff-group-controls {
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.staff-inline-status {
  color: var(--text-muted, #667085);
  font-size: 0.8rem;
  margin: 7px 0 0;
  min-height: 1.2em;
}

.staff-count-chip,
.staff-save-state {
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 9px;
  white-space: nowrap;
}

.staff-count-chip {
  background: var(--surface-muted, #eef2f7);
  color: var(--text-main, #344054);
}

.staff-save-state {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.staff-selected-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
}

.staff-subject-chip {
  align-items: center;
  background: var(--surface-muted, #eef3fb);
  border: 1px solid var(--border, #d4deec);
  border-radius: 999px;
  color: var(--text-main, #263247);
  display: inline-flex;
  font-size: 0.82rem;
  gap: 7px;
  max-width: 100%;
  padding: 6px 8px 6px 11px;
}

.staff-subject-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-subject-chip button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted, #667085);
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  height: 24px;
  justify-content: center;
  padding: 0;
  width: 24px;
}

.staff-subject-chip button:hover {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}

.staff-exam-search {
  margin-bottom: 10px;
}

.staff-available-exams {
  border: 1px solid var(--border, #dfe5ed);
  border-radius: 9px;
  max-height: 330px;
  overflow: auto;
}

.staff-exam-row {
  align-items: center;
  background: var(--surface, #fff);
  border: 0;
  border-bottom: 1px solid var(--border, #edf0f4);
  color: var(--text-main, #263247);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.staff-exam-row:last-child {
  border-bottom: 0;
}

.staff-exam-row:hover {
  background: var(--surface-elevated, #f5f8ff);
}

.staff-exam-row strong,
.staff-exam-row small {
  display: block;
}

.staff-exam-row small {
  color: var(--text-muted, #667085);
  margin-top: 3px;
}

.staff-exam-row__add {
  color: var(--link-color, #2356a8);
  font-size: 0.8rem;
  font-weight: 800;
}

.staff-actions {
  align-items: center;
  border-top: 1px solid var(--border, #e1e6ee);
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 18px;
}

.staff-actions .save-btn {
  width: auto;
}

.staff-delete-btn {
  border-color: var(--color-danger, #b42318);
  color: var(--color-danger-dark, #b42318);
  margin-right: auto;
}

.sidebar-profile-picker {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 15px;
  padding-top: 15px;
}

.sidebar-profile-picker__label {
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
  opacity: 0.7;
  text-transform: uppercase;
}

.sidebar-profile-picker__select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 8px;
  width: 100%;
}

.sidebar-account {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
  padding-top: 10px;
}

#user-email-display {
  font-size: 0.75rem;
  margin-bottom: 8px;
  opacity: 0.8;
  overflow-wrap: anywhere;
}

.sidebar-account__signout {
  background: #dc2626;
  border: 0;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
  width: 100%;
}

@media (max-width: 1050px) {
  .staff-layout {
    grid-template-columns: 1fr;
  }

  .staff-profile-list {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .staff-profiles-page .page-header,
  .staff-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .staff-setup-flow,
  .staff-summary,
  .staff-form-grid {
    grid-template-columns: 1fr;
  }

  .staff-group-controls {
    grid-template-columns: 1fr;
  }

  .staff-actions {
    flex-wrap: wrap;
  }

  .staff-delete-btn {
    margin-right: 0;
  }
}
