.department-filter,
.journal-group-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  margin: 0;
  color: #4a3d5e;
  font-size: 14px;
  line-height: 1.5;
}
.department-filter > span,
.journal-group-filter > span {
  font-size: 12px;
  font-weight: 600;
}
.department-filter select,
.journal-group-filter select {
  width: 100%;
  min-height: 44px;
  font-size: 16px;
  border-color: #beb3d0;
  color: #362b47;
  background: #fff;
}
.department-filter select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234A3D5E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
}
.department-filter {
  min-width: 190px;
}
.journal-group-filter {
  min-width: 135px;
}
.heading-actions:has(.department-filter) {
  align-items: flex-end;
  flex-wrap: wrap;
}
.journal-group-filter select:disabled {
  color: #6b607a;
  background: #f2eff6;
  opacity: 1;
}
.department-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid #d0c3e5;
  border-radius: 6px;
  background: #f2edf9;
  color: #50327f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
}
.journal-info .department-badge {
  margin-top: 8px;
}
.admin-toolbar {
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}
.admin-toolbar > .search-field {
  flex: 1 1 240px;
  margin-right: 0;
  min-width: 0;
}
.admin-toolbar > .search-field input {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  max-width: none;
}
.admin-toolbar > .search-field > .icon {
  flex-shrink: 0;
}
.journal-table .row-number {
  display: inline-block;
}
.admin-toolbar .department-filter {
  flex: 0 1 210px;
}
.admin-toolbar .btn {
  flex-shrink: 0;
}
.department-results {
  margin: -8px 0 18px;
  color: #5b526a;
  font-size: 14px;
}
.department-results strong {
  color: #362b47;
}
.admin-group > .department-badge {
  margin-top: 15px;
}
.admin-group > .department-badge + h3 {
  margin-top: 14px;
}
.roster-intro {
  margin-bottom: 20px;
}
.roster-intro p,
.archived-roster > p {
  font-size: 14px;
  line-height: 1.6;
  color: #5b526a;
  margin-top: 8px;
}
#students-form > label {
  font-size: 14px;
  color: #4a3d5e;
}
#students-form textarea {
  font-size: 16px;
  line-height: 1.6;
  margin-top: 8px;
  border-color: #beb3d0;
}
.active-roster {
  margin-top: 26px;
}
.active-roster > h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #362b47;
  font-size: 16px;
}
.roster-list {
  margin-top: 12px;
  max-height: 38vh;
  border: 1px solid #d5cedf;
  border-radius: 8px;
  background: #fff;
}
.roster-list > div {
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
}
.roster-list > div:last-child {
  border-bottom: 0;
}
.roster-list > div > strong {
  min-width: 0;
  color: #362b47;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.roster-list .roster-number {
  width: 24px;
  flex-shrink: 0;
  font-size: 12px;
  color: #6b607a;
}
.roster-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.roster-actions .icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #d5cedf;
  border-radius: 6px;
  color: #50327f;
}
.roster-delete {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #c68194;
  border-radius: 6px;
  color: #9a304d;
  background: #fff6f8;
  font-size: 14px;
  font-weight: 600;
}
.roster-delete:hover {
  background: #fce4eb;
  border-color: #9a304d;
}
.roster-delete:focus-visible,
.archived-roster summary:focus-visible {
  outline: 2px solid #5b438f;
  outline-offset: 3px;
}
.roster-empty {
  padding: 18px;
  color: #5b526a;
  font-size: 14px;
  line-height: 1.5;
}
.archived-roster {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #d5cedf;
}
.archived-roster summary {
  cursor: pointer;
  font-size: 16px;
  color: #4a3d5e;
  font-weight: 600;
  line-height: 1.5;
}
.archived-roster .count {
  margin-left: 6px;
}
.roster-restore {
  font-size: 14px;
  min-height: 40px;
  flex-shrink: 0;
}
.student-removal-name {
  font-weight: 600;
  color: #362b47 !important;
  font-size: 18px !important;
  line-height: 1.5;
}
.roster-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.btn.danger {
  color: #fff;
  background: #9a304d;
  border: 1px solid #9a304d;
}
.btn.danger:hover {
  background: #7f2440;
}
.btn.danger:disabled,
.roster-restore:disabled {
  opacity: 0.65;
  cursor: wait;
}
@media (max-width: 1050px) {
  .heading-actions:has(.department-filter) {
    width: 100%;
    justify-content: flex-start;
  }
}
@media (max-width: 760px) {
  .heading-actions .department-filter {
    flex: 1 1 190px;
    min-width: 0;
  }
  .heading-actions .journal-group-filter {
    flex: 1 1 130px;
    min-width: 0;
  }
  .admin-toolbar > .search-field,
  .admin-toolbar .department-filter {
    flex: 0 1 auto;
    width: 100%;
    max-width: none;
  }
  .admin-toolbar .department-filter {
    min-width: 0;
  }
  .admin-toolbar > .btn {
    width: 100%;
  }
  .roster-list > div {
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
  }
  .roster-list > div > strong {
    flex: 1 1 calc(100% - 50px);
  }
  .roster-actions {
    margin-left: 32px;
    width: calc(100% - 32px);
    justify-content: flex-end;
  }
  .roster-restore {
    margin-left: auto;
  }
  .roster-confirm-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .roster-confirm-actions > .btn {
    width: 100%;
  }
  .active-roster .roster-list {
    max-height: 42vh;
  }
}

/* Monthly exports support a readable checklist without modifier-key selection. */
#report-form [hidden] {
  display: none !important;
}
.monthly-report-groups {
  min-width: 0;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid #d0c3e5;
  border-radius: 10px;
  background: #fcfbfe;
}
.monthly-report-groups > legend {
  padding: 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: #362b47;
}
.report-group-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.report-group-modes > label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid #cfc6db;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.report-group-modes > label:has(:checked) {
  border-color: #6a4da0;
  background: #f0eaf8;
  box-shadow: inset 0 0 0 1px #6a4da0;
}
.report-group-modes input,
.report-group-option input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 3px 0 0;
  padding: 0;
  accent-color: #5b438f;
}
.report-group-modes strong {
  display: block;
  font-size: 14px;
  color: #362b47;
  font-weight: 600;
  line-height: 1.5;
}
.report-group-modes small {
  display: block;
  font-size: 12px;
  color: #5b526a;
  line-height: 1.5;
  margin-top: 3px;
}
.report-group-summary {
  font-size: 14px;
  color: #50327f;
  line-height: 1.6;
  margin: 14px 0 0;
  font-weight: 600;
}
.report-group-choices {
  margin-top: 14px;
}
.report-group-search-label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 14px;
  color: #4a3d5e;
  line-height: 1.5;
}
.report-group-search-label > .search-field {
  width: 100%;
  padding-left: 12px;
  background: #fff;
}
.report-group-search-label input {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  min-height: 44px;
}
.report-group-search-label .icon {
  flex-shrink: 0;
}
.report-selection-actions {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 9px 0;
}
.report-selection-actions button {
  min-height: 40px;
  border: 0;
  background: none;
  padding: 4px 0;
  color: #50327f;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  font-weight: 500;
}
.report-selection-actions button:hover {
  color: #362b47;
}
.report-selection-actions button:focus-visible,
.report-group-option:has(input:focus-visible) {
  outline: 2px solid #5b438f;
  outline-offset: 2px;
}
.report-group-checklist {
  max-height: 258px;
  overflow: auto;
  border: 1px solid #cfc6db;
  border-radius: 8px;
  background: #fff;
  scroll-padding: 6px;
}
.report-group-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border-bottom: 1px solid #ded6e8;
  cursor: pointer;
}
.report-group-option:last-child {
  border-bottom: 0;
}
.report-group-option:has(:checked) {
  background: #f1ebf9;
}
.report-group-option > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.report-group-option strong {
  color: #362b47;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.report-group-option small {
  font-size: 12px;
  color: #5b526a;
  line-height: 1.5;
  text-align: right;
}
.report-group-no-results,
.report-month-note {
  font-size: 12px;
  line-height: 1.6;
  color: #5b526a;
  margin: 12px 0 0;
}
.report-selection-error {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: #8d2346;
  border: 1px solid #d392a8;
  border-radius: 7px;
  background: #fff2f6;
  padding: 11px 12px;
  margin-top: 14px;
}
@media (max-width: 760px) {
  .monthly-report-groups {
    padding: 14px;
  }
  .report-group-modes {
    grid-template-columns: minmax(0, 1fr);
  }
  .report-group-modes > label {
    min-height: 72px;
  }
  .report-group-checklist {
    max-height: 285px;
  }
  .report-group-option > span {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .report-group-option small {
    text-align: left;
  }
}
