.admin-body {
  background: #f4f3ed;
}
.admin-header {
  height: 94px;
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  background: var(--paper);
  gap: 20px;
}
.admin-label {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
}
.admin-header .text-link {
  font-size: 11px;
}
.login-view {
  max-width: 1000px;
  margin: 80px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  padding: 0 30px;
  align-items: center;
}
.login-copy h1 {
  font-size: 70px;
  letter-spacing: -4px;
}
.login-copy > p {
  font-size: 13px;
  color: var(--muted);
}
.login-card {
  padding: 35px;
}
.login-card .button {
  margin-top: 25px;
}
.login-card .form-error {
  margin-top: 20px;
}
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--border);
  background: #fff;
  padding: 0 42px;
  gap: 25px;
}
.admin-toolbar nav {
  display: flex;
  gap: 26px;
}
.tab {
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  padding: 22px 0;
  border-bottom: 3px solid transparent;
}
.tab.active {
  border-bottom-color: var(--ink);
}
.admin-toolbar > .text-button {
  font-size: 11px;
  white-space: nowrap;
}
.admin-content {
  max-width: 1440px;
  margin: auto;
  padding: 38px 42px 60px;
}
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  margin-bottom: 28px;
}
.dashboard-heading .section-index {
  margin-bottom: 10px;
}
.dashboard-heading h1 {
  font-size: 31px;
  letter-spacing: -1.5px;
  margin: 0;
  line-height: 1.2;
}
.dashboard-heading h1 > span {
  color: #689523;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 35px;
}
.metric {
  background: #fff;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.metric.lime {
  background: var(--lime);
}
.metric.lilac {
  background: var(--lilac);
}
.metric > span {
  font-size: 11px;
  font-weight: 600;
}
.metric strong {
  font-size: 44px;
  letter-spacing: -2px;
  line-height: 1.15;
}
.metric small {
  font-size: 9px;
  color: #53564e;
}
.admin-panel {
  background: white;
  border: var(--border);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 28px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 26px;
}
.panel-heading h2 {
  font-size: 24px;
  letter-spacing: -1px;
  margin-bottom: 7px;
}
.panel-heading p {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0;
}
.panel-heading .button {
  white-space: nowrap;
}
.filters {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 25px;
}
label > input,
label > select,
label > textarea {
  display: block;
  margin-top: 7px;
}
label > textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
}
.filters label,
.dialog-form > label:not(.check-label) {
  font-size: 11px;
  font-weight: 600;
}
.filters .button {
  height: 43px;
  box-shadow: 2px 2px 0 var(--ink);
}
.table-scroll {
  position: relative;
  overflow-x: auto;
  min-height: 170px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 11px;
  white-space: nowrap;
}
th {
  background: #f1f1e9;
  border-top: 1px solid #d8d9cf;
  border-bottom: 1px solid #d8d9cf;
  font-size: 9px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 14px 12px;
}
td {
  padding: 17px 12px;
  border-bottom: 1px solid #e8e8df;
}
td .name-button {
  font-size: 12px;
  font-weight: 600;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.status-badge {
  font-size: 9px;
  border: 1px solid var(--ink);
  padding: 5px 7px;
  display: inline-block;
  background: var(--paper);
}
.status-badge.confirmed {
  background: #e2f3c7;
}
.status-badge.waitlist {
  background: #e8dcfb;
}
.status-badge.cancelled {
  background: #eeeae5;
}
.mail-status {
  font-size: 10px;
  color: var(--muted);
}
.mail-status.failed {
  color: #a52739;
}
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 55px 15px;
  font-size: 13px;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 24px;
  font-size: 11px;
  color: var(--muted);
}
.pagination > div {
  display: flex;
  gap: 12px;
}
.pagination .button {
  font-size: 10px;
  padding: 9px 12px;
}
.notice {
  font-size: 11px;
  padding: 15px 17px;
  border: 1px solid #d5d4ca;
  background: var(--paper);
  line-height: 1.7;
  color: #5c5f54;
}
.notice.warning {
  border-color: #c98d35;
  background: #fff0d8;
  color: #654917;
  margin-bottom: 25px;
}
.units-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 25px;
}
.unit-card {
  border: var(--border);
  padding: 20px;
  background: var(--paper);
}
.unit-card h3 {
  font-size: 18px;
  margin: 15px 0 8px;
  letter-spacing: -0.5px;
}
.unit-card > p {
  font-size: 11px;
  color: var(--muted);
  min-height: 34px;
}
.unit-numbers {
  display: flex;
  gap: 25px;
  font-size: 10px;
  margin: 20px 0;
}
.unit-numbers strong {
  display: block;
  font-size: 23px;
  margin-bottom: 4px;
}
.unit-card .button {
  width: 100%;
  font-size: 11px;
}
.dialog-form > label:not(.check-label) {
  display: block;
  margin-bottom: 18px;
}
.dialog-form .check-label {
  font-size: 12px;
}
.toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  max-width: 440px;
  background: var(--lime);
  padding: 18px 24px;
  border: var(--border);
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 20;
  font-size: 12px;
}
.toast.error {
  background: var(--peach);
}
.detail-modal {
  max-width: 580px;
}
.detail-modal dl {
  margin: 22px 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px 12px;
  font-size: 12px;
}
.detail-modal dt {
  color: var(--muted);
}
.detail-modal dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.detail-actions .button {
  font-size: 11px;
  padding: 12px;
}
.action-buttons {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}
.action-buttons .button {
  flex: 1;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 1000px) {
  .metrics {
    gap: 12px;
  }
  .metric {
    padding: 17px;
  }
  .metric small {
    font-size: 8px;
  }
  .units-grid {
    grid-template-columns: 1fr 1fr;
  }
  .admin-content {
    padding: 30px 24px;
  }
  .admin-panel {
    padding: 22px;
  }
  .dashboard-heading h1 {
    font-size: 28px;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .login-view {
    gap: 40px;
  }
  .login-copy h1 {
    font-size: 62px;
  }
  .login-card h2 {
    font-size: 25px;
  }
}
@media (max-width: 700px) {
  .admin-header {
    padding: 0 20px;
    height: 80px;
  }
  .admin-label {
    display: none;
  }
  .admin-toolbar {
    padding: 0 20px;
    gap: 15px;
  }
  .admin-toolbar nav {
    gap: 18px;
    overflow: auto;
  }
  .tab {
    font-size: 10px;
    white-space: nowrap;
    padding: 20px 0;
  }
  .admin-toolbar > .text-button {
    font-size: 9px;
  }
  .admin-content {
    padding: 26px 16px;
  }
  .dashboard-heading {
    align-items: start;
    flex-direction: column;
    gap: 16px;
  }
  .dashboard-heading h1 {
    font-size: 29px;
    max-width: 330px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .metric strong {
    font-size: 37px;
  }
  .metric > span {
    font-size: 10px;
  }
  .metric small {
    font-size: 9px;
  }
  .admin-panel {
    padding: 20px 15px;
  }
  .panel-heading {
    align-items: start;
    flex-direction: column;
    gap: 16px;
  }
  .panel-heading h2 {
    font-size: 23px;
  }
  .filters {
    gap: 12px;
  }
  .filters label {
    font-size: 10px;
  }
  .filters input,
  .filters select {
    font-size: 14px !important;
  }
  .filters .button {
    height: 48px;
  }
  .units-grid {
    grid-template-columns: 1fr;
  }
  .pagination {
    align-items: start;
    flex-direction: column;
  }
  .login-view {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 36px auto;
    gap: 25px;
    padding: 0 23px;
  }
  .login-copy h1 {
    font-size: 45px;
    letter-spacing: -2px;
  }
  .login-copy h1 br {
    display: none;
  }
  .login-copy p {
    display: none;
  }
  .login-card {
    padding: 26px;
  }
  .toast {
    right: 20px;
    left: 20px;
    bottom: 20px;
    max-width: none;
  }
  .detail-modal dl {
    grid-template-columns: 90px 1fr;
    gap: 14px 8px;
    font-size: 11px;
  }
  .detail-actions .button {
    width: 100%;
  }
}

.filters > label {
  min-width: 0;
}
.filters input,
.filters select {
  min-width: 0;
  max-width: 100%;
}

/* ---------- Event switcher and session ---------- */
.event-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.event-switcher select {
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border: var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  max-width: 320px;
}
.admin-session {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- School, event and user cards ---------- */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.school-token {
  display: block;
  padding: 8px 10px;
  border: var(--border);
  background: var(--paper);
  font-size: 12px;
  word-break: break-all;
}
.mail-status.none {
  opacity: 0.6;
}

/* ---------- Wider dialogs ---------- */
.wide-modal {
  max-width: 640px;
}
.wide-modal .dialog-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.wide-modal .dialog-form > .check-label,
.wide-modal .dialog-form > fieldset,
.wide-modal .dialog-form > .form-error,
.wide-modal .dialog-form > button {
  grid-column: 1 / -1;
}
.user-events {
  border: var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.user-events legend {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 6px;
}

/* ---------- Toggle rows with an explanation ---------- */
.dialog-form .check-label small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Destructive actions read differently ---------- */
.button.danger {
  border-color: #9d2235;
  color: #9d2235;
}
.button.danger:hover:not(:disabled) {
  background: #9d2235;
  color: #fff;
}

/* ---------- Typed confirmation on destructive actions ---------- */
#action-typing {
  display: block;
  margin: 18px 0 4px;
  font-size: 12px;
  font-weight: 600;
}
#action-typing input {
  display: block;
  margin-top: 8px;
  width: 100%;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---------- Brand in the organisation area ---------- */
.admin-header .brand--lettering {
  width: 128px;
  flex: none;
}
.login-seal {
  display: block;
  width: 96px;
  margin-bottom: 18px;
  color: #0c4885;
  line-height: 0;
}
.login-seal svg {
  width: 100%;
  height: auto;
  display: block;
}
@media (max-width: 820px) {
  .admin-header .brand--lettering {
    width: 96px;
  }
}

/* ---------- Teachers: drag to reorder, portrait preview ---------- */
.teacher-admin-card {
  cursor: grab;
}
.teacher-admin-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}
.drag-handle {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}
.teacher-thumb {
  width: 96px;
  height: 96px;
  border: var(--border);
  background: var(--paper);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 11px;
}
.teacher-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

