* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #18202a;
  background: #f5f7fa;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a {
  color: #1557a6;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 28px;
  color: #fff;
  background: #17324d;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.topnav {
  display: flex;
  gap: 16px;
  flex: 1;
}

.topnav a,
.account a {
  color: #e8f1fb;
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px;
}

.login-page {
  max-width: 420px;
  margin: 8vh auto;
  padding: 32px 24px;
  background: #fff;
  border: 1px solid #d6dde7;
  border-radius: 8px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.login-brand h1 {
  margin: 0;
}

.panel {
  background: #fff;
  border: 1px solid #d6dde7;
  border-radius: 8px;
  padding: 24px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric {
  background: #fff;
  border: 1px solid #d6dde7;
  border-radius: 8px;
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 28px;
}

label {
  display: block;
  margin: 16px 0 6px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #aeb9c6;
  border-radius: 6px;
  font: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 20px;
  padding: 8px 16px;
  color: #fff;
  background: #1557a6;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 43, 67, 0.18);
}

button:hover,
.button:hover {
  filter: brightness(0.94);
}

button:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(21, 87, 166, 0.28);
  outline-offset: 2px;
}

.error {
  padding: 12px;
  color: #7a1d1d;
  background: #fff1f1;
  border: 1px solid #e2aaaa;
  border-radius: 6px;
}

.muted {
  color: #66717f;
}

.flash {
  padding: 12px;
  border-radius: 6px;
}

.flash.success {
  color: #174828;
  background: #ecf8ef;
  border: 1px solid #a8d8b5;
}

.flash.error {
  color: #7a1d1d;
  background: #fff1f1;
  border: 1px solid #e2aaaa;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #d6dde7;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e4e9f0;
  vertical-align: top;
}

th {
  color: #394655;
  background: #f0f3f7;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #aeb9c6;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.inline-form {
  display: inline;
}

.pin-value {
  display: inline-block;
  min-width: 48px;
  font-family: "Consolas", "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0;
}

.reveal-pin-button {
  min-height: 34px;
  margin: 0 0 0 8px;
  padding: 6px 10px;
}

.pin-form {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto;
  gap: 8px;
  align-items: end;
  min-width: 180px;
}

.pin-form input,
.pin-form button {
  margin-top: 0;
}

.app-settings-section {
  margin-top: 24px;
}

.settings-panel {
  margin-bottom: 22px;
}

.settings-section {
  margin-top: 24px;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading-row h2 {
  margin-bottom: 0;
}

.exam-board-list {
  display: grid;
  gap: 10px;
}

.exam-board-row {
  background: #fff;
  border: 1px solid #d6dde7;
  border-radius: 8px;
  padding: 12px;
}

.exam-board-summary {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.exam-board-summary strong,
.exam-board-summary span {
  display: block;
  overflow-wrap: anywhere;
}

.exam-board-summary strong {
  color: #17324d;
}

.exam-board-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.exam-board-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  justify-content: flex-end;
  min-width: 122px;
}

.exam-board-actions form {
  margin: 0;
}

.exam-board-actions button {
  width: 100%;
}

.exam-board-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.exam-board-edit-form {
  display: grid;
  grid-template-columns: minmax(86px, 0.7fr) minmax(180px, 1.6fr) minmax(70px, 0.45fr) minmax(116px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
}

.exam-board-edit-form > div {
  min-width: 0;
}

.exam-board-edit-form label {
  margin-top: 0;
  font-size: 13px;
}

.exam-board-edit-form input,
.exam-board-edit-form select {
  min-height: 34px;
  padding: 6px 8px;
}

.exam-board-primary-action {
  display: flex;
  gap: 8px;
  align-items: end;
}

.exam-board-edit-form input,
.exam-board-edit-form select,
.exam-board-edit-form button,
.exam-board-actions button {
  margin-top: 0;
}

.housekeeping-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  margin: 0 0 16px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin: 16px 0 0;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.housekeeping-selected-count {
  min-height: 42px;
  margin: 16px 0 0;
  padding: 10px 0;
}

.row-form {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(180px, 1.5fr) minmax(70px, 0.5fr) minmax(110px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
  min-width: 560px;
}

.row-form input,
.row-form select,
.row-form button {
  margin-top: 0;
}

.compact-checkbox input {
  width: auto;
  min-height: auto;
}

.danger {
  background: #a61f2b;
  border: 1px solid #821722;
}

.primary {
  color: #fff;
  background: #1557a6;
  border: 1px solid #0f457f;
}

.secondary {
  color: #17324d;
  background: #e8eef5;
  border: 1px solid #9eb0c4;
}

.compact {
  min-height: 34px;
  margin-top: 0;
  padding: 6px 10px;
}

.filter-actions,
.dashboard-actions,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-actions .button,
.filter-actions button {
  margin-top: 20px;
}

.dashboard-actions {
  margin-top: 24px;
}

.pagination {
  justify-content: flex-end;
  margin-top: 16px;
}

.exam-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.exam-results-table th:last-child,
.exam-results-table td:last-child {
  width: 230px;
}

.exam-actions .button,
.exam-actions button {
  min-width: 52px;
  white-space: nowrap;
}

.exam-actions form {
  display: inline-flex;
  margin: 0;
}

.status,
.tag {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid #b9c4d0;
  border-radius: 4px;
  color: #394655;
  background: #f0f3f7;
  font-size: 13px;
  font-weight: 700;
}

.status-open {
  color: #174828;
  background: #ecf8ef;
  border-color: #a8d8b5;
}

.status-closed {
  color: #244d78;
  background: #edf4fb;
  border-color: #b7cce2;
}

.status-failed,
.status-deleted {
  color: #7a1d1d;
  background: #fff1f1;
  border-color: #e2aaaa;
}

.severity-badge {
  display: inline-block;
  min-width: 72px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.severity-critical {
  color: #fff;
  background: #a61f2b;
  border-color: #7d1720;
}

.severity-high {
  color: #5d2a00;
  background: #ffcf99;
  border-color: #dc8735;
}

.severity-medium {
  color: #584300;
  background: #fff0a6;
  border-color: #d5b942;
}

.severity-low {
  color: #16436f;
  background: #e6f1fc;
  border-color: #9dbfdf;
}

.severity-info {
  color: #394655;
  background: #f0f3f7;
  border-color: #b9c4d0;
}

.lockdown-events-table {
  min-width: 980px;
}

.lockdown-event-when {
  white-space: nowrap;
}

.lockdown-event-name {
  min-width: 170px;
}

.lockdown-details-button {
  white-space: nowrap;
}

.lockdown-details-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  padding: 22px;
  border: 1px solid #aeb9c6;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(20, 34, 50, 0.28);
}

.lockdown-details-dialog::backdrop {
  background: rgba(16, 26, 38, 0.55);
}

.lockdown-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lockdown-dialog-heading h2,
.lockdown-dialog-heading form,
.lockdown-dialog-heading button {
  margin: 0;
}

.lockdown-details-dialog pre {
  max-height: 480px;
  margin: 16px 0 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #18202a;
  background: #f5f7fa;
  border: 1px solid #d6dde7;
  border-radius: 6px;
}

.row-open td:first-child {
  border-left: 4px solid #2e7d4f;
}

.audit-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 8px;
  margin: 6px 0 0;
  color: #66717f;
  font-size: 13px;
}

.audit-details dt {
  font-weight: 700;
}

.audit-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.school-assignment-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
  min-width: 280px;
}

.account-summary,
.account-password {
  max-width: 680px;
}

.account-password {
  margin-top: 20px;
}

.account-summary dl {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px 18px;
  margin-bottom: 0;
}

.account-summary dt {
  font-weight: 700;
}

.account-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.print-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.print-document {
  background: #fff;
  border: 1px solid #d6dde7;
  padding: 32px;
}

.print-header {
  border-bottom: 2px solid #18202a;
  margin-bottom: 18px;
  padding-bottom: 12px;
}

.print-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.print-script-table {
  width: 100%;
  border-collapse: collapse;
}

.print-script-table th,
.print-script-table td {
  padding: 0;
  border: 0;
}

.print-script-table th {
  color: inherit;
  background: transparent;
  text-align: left;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 18px;
  margin-bottom: 24px;
}

.answer-script pre {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 420px;
  padding: 0;
  font: 12pt/1.5 "Times New Roman", Times, serif;
}

.signature-block {
  border-top: 1px solid #18202a;
  margin-top: 32px;
  padding-top: 18px;
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .topbar,
  .print-actions {
    display: none;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .print-document {
    border: 0;
    padding: 0;
  }

  .print-meta {
    grid-template-columns: repeat(4, 1fr);
  }

  .print-script-table thead {
    display: table-header-group;
  }

  .print-script-table tfoot {
    display: table-footer-group;
  }
}

@media (max-width: 720px) {
  .topbar,
  .topnav,
  .account {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 16px;
  }

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

  .account-summary dl {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .account-summary dd {
    margin-bottom: 10px;
  }

  .exam-board-list-header {
    display: none;
  }

  .exam-board-summary,
  .exam-board-body,
  .exam-board-edit-form {
    grid-template-columns: 1fr;
  }

  .exam-board-tags,
  .exam-board-actions {
    justify-content: flex-start;
  }

  .exam-board-actions {
    flex-direction: row;
    min-width: 0;
  }
}
.mfa-qr-wrap {
  display: inline-flex;
  max-width: 100%;
  padding: 10px;
  margin: 8px 0 18px;
  background: #fff;
  border: 1px solid #d7e0e7;
  border-radius: 10px;
}

.mfa-qr-code {
  display: block;
  width: min(294px, 80vw);
  height: auto;
}

.mfa-secret,
.mfa-uri {
  overflow-wrap: anywhere;
  user-select: all;
}
