:root {
  color-scheme: light;
  --gateway-red: #ed1c24;
  --gateway-red-action: #d71920;
  --gateway-red-dark: #b9141a;
  --gateway-red-soft: #fff0ef;
  --ink: #171717;
  --ink-soft: #3e3b38;
  --cream: #f8f3e8;
  --cream-deep: #efe5d3;
  --surface: #ffffff;
  --surface-muted: #faf8f3;
  --line: #ded8ce;
  --muted: #6c665f;
  --success: #227448;
  --success-soft: #e8f6ee;
  --warning: #996300;
  --warning-soft: #fff4d6;
  --info: #255f87;
  --info-soft: #e8f3fb;
  --danger: #b42318;
  --danger-soft: #ffebe9;
  --historical: #69548f;
  --historical-soft: #f1ebfa;
  --shadow-sm: 0 1px 2px rgb(23 23 23 / 7%), 0 4px 14px rgb(23 23 23 / 5%);
  --shadow-md: 0 18px 50px rgb(23 23 23 / 10%);
  --radius-sm: 0.45rem;
  --radius-md: 0.8rem;
  --radius-lg: 1.2rem;
  --content-width: 72rem;
  --content-width-wide: 88rem;
  --focus-ring: 0 0 0 3px rgb(237 28 36 / 24%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 4%, rgb(237 28 36 / 7%), transparent 22rem),
    linear-gradient(180deg, #fffdf8 0, var(--cream) 32rem);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--gateway-red-dark);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--gateway-red);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--gateway-red);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  transform: translateY(-180%);
  transition: transform 150ms ease;
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 20;
  color: #fff;
  background: var(--ink);
  border-bottom: 0.25rem solid var(--gateway-red);
  box-shadow: 0 3px 18px rgb(0 0 0 / 18%);
}

.site-header__inner {
  width: min(calc(100% - 2rem), var(--content-width-wide));
  min-height: 5rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand__mark {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #050505;
  border: 1px solid rgb(255 255 255 / 18%);
}

.brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand__text {
  display: grid;
  line-height: 1.05;
}

.brand__school {
  color: #d5d0c8;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand__product {
  margin-top: 0.2rem;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.site-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-nav__list {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.site-nav__link {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  padding: 0.45rem 0.72rem;
  border-radius: var(--radius-sm);
  color: #ddd9d2;
  font-size: 0.92rem;
  font-weight: 680;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease;
}

.site-nav__link:hover {
  color: #fff;
  background: rgb(255 255 255 / 9%);
}

.site-nav__link--active {
  color: #fff;
  background: rgb(237 28 36 / 24%);
}

.site-nav__toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: var(--radius-sm);
  color: #fff;
  background: transparent;
  font-weight: 700;
}

.site-nav__toggle:hover {
  background: rgb(255 255 255 / 9%);
}

.site-nav__toggle-icon {
  width: 1.1rem;
  display: grid;
  gap: 0.22rem;
}

.site-nav__toggle-icon span {
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.account-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
}

.account-menu__identity {
  min-width: 0;
  display: grid;
  justify-items: end;
  line-height: 1.2;
}

.account-menu__name {
  max-width: 16rem;
  overflow: hidden;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__email {
  max-width: 16rem;
  margin-top: 0.15rem;
  overflow: hidden;
  color: #bdb7ae;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  margin-top: 0.28rem;
  padding: 0.12rem 0.38rem;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 999px;
  color: #f4d6d4;
  background: rgb(237 28 36 / 16%);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.signout-form {
  margin: 0;
}

.page-shell {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) 0 4rem;
  flex: 1;
}

.page-shell--wide {
  width: min(calc(100% - 2rem), var(--content-width-wide));
}

.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.page-header__copy {
  max-width: 46rem;
}

.page-title,
h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.page-title,
h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
}

h2 {
  margin-bottom: 0.7rem;
  font-size: clamp(1.28rem, 2vw, 1.6rem);
}

h3 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

p {
  margin-top: 0;
}

.eyebrow {
  margin-bottom: 0.35rem;
  color: var(--gateway-red-dark);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.lede,
.muted {
  color: var(--muted);
}

.lede {
  max-width: 46rem;
  margin-bottom: 0;
  font-size: 1.06rem;
}

.page-actions,
.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--ink);
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.button:hover {
  color: #fff;
  background: #303030;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  background: var(--gateway-red-action);
}

.button--primary:hover {
  background: var(--gateway-red-dark);
}

.button--secondary {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}

.button--secondary:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.button--ghost {
  border-color: rgb(255 255 255 / 28%);
  color: #fff;
  background: transparent;
}

.button--ghost:hover {
  background: rgb(255 255 255 / 10%);
}

.button--danger {
  background: var(--danger);
}

.button--small {
  min-height: 2.15rem;
  padding: 0.42rem 0.68rem;
  font-size: 0.8rem;
}

.button[disabled],
button[disabled] {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.alert {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border: 1px solid;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.alert__icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.alert--success {
  color: #155735;
  border-color: #a8d9bd;
  background: var(--success-soft);
}

.alert--success .alert__icon {
  background: var(--success);
}

.alert--error {
  color: #841d15;
  border-color: #efb1ac;
  background: var(--danger-soft);
}

.alert--error .alert__icon {
  background: var(--danger);
}

.card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow-sm);
}

.card + .card,
.section + .section {
  margin-top: 1rem;
}

.card__header {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card__header h2,
.card__header h3,
.card__header p {
  margin-bottom: 0;
}

.card__footer {
  margin: 1.25rem -1.5rem -1.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--surface-muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric-card {
  min-height: 8.5rem;
  padding: 1.1rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-card::after {
  content: "";
  width: 4.5rem;
  height: 4.5rem;
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  border-radius: 50%;
  background: var(--gateway-red-soft);
}

.metric-card__label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card__value {
  margin-top: 0.35rem;
  display: block;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.metric-card__detail {
  margin-top: 0.5rem;
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 0.8fr);
  gap: 1rem;
}

.split-grid > * {
  min-width: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.22rem 0.56rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 790;
  line-height: 1.1;
  white-space: nowrap;
}

.status-badge--neutral {
  color: #55504a;
  border-color: #d4cec5;
  background: #f3f0eb;
}

.status-badge--warning {
  color: #755000;
  border-color: #ead18e;
  background: var(--warning-soft);
}

.status-badge--info {
  color: #174c70;
  border-color: #acd0e8;
  background: var(--info-soft);
}

.status-badge--confirmed {
  color: #315f77;
  border-color: #aed3e4;
  background: #eaf7fb;
}

.status-badge--success {
  color: #155735;
  border-color: #a8d9bd;
  background: var(--success-soft);
}

.status-badge--historical {
  color: #554177;
  border-color: #cfc0e7;
  background: var(--historical-soft);
}

.status-badge--danger {
  color: #841d15;
  border-color: #efb1ac;
  background: var(--danger-soft);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.82rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 0.72rem;
  font-weight: 820;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fffdf8;
}

.data-table .numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.table-link {
  color: var(--ink);
  font-weight: 740;
}

.filter-bar {
  margin-bottom: 1rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(13rem, 2fr) repeat(3, minmax(9rem, 1fr)) auto;
  align-items: end;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.form-card {
  max-width: 52rem;
}

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

.field {
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  margin-bottom: 0.35rem;
  display: block;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 760;
}

.required-mark {
  color: var(--gateway-red-dark);
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.66rem 0.75rem;
  border: 1px solid #bdb6ac;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 1px 1px rgb(23 23 23 / 3%);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.input:hover {
  border-color: #8c857b;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: 0;
  border-color: var(--gateway-red);
  box-shadow: var(--focus-ring);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffafa;
}

.field__hint,
.field__error {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
}

.field__hint {
  color: var(--muted);
}

.field__error {
  color: var(--danger);
  font-weight: 690;
}

.fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.fieldset + .fieldset {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.fieldset legend {
  margin-bottom: 1rem;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 820;
}

.choice-list {
  display: grid;
  gap: 0.55rem;
}

.choice {
  padding: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.choice:has(input:checked) {
  border-color: var(--gateway-red);
  background: var(--gateway-red-soft);
}

.choice input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.18rem;
  accent-color: var(--gateway-red);
}

.progress {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cream-deep);
}

.progress__bar {
  height: 100%;
  border-radius: inherit;
  background: var(--gateway-red);
}

.progress-native {
  width: 100%;
  height: 0.7rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: var(--gateway-red);
  background: var(--cream-deep);
  accent-color: var(--gateway-red);
}

.progress-native::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--cream-deep);
}

.progress-native::-webkit-progress-value {
  border-radius: 999px;
  background: var(--gateway-red);
}

.progress-native::-moz-progress-bar {
  border-radius: 999px;
  background: var(--gateway-red);
}

.empty-state,
.loading-state {
  min-height: 13rem;
  padding: 2rem 1rem;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px dashed #c8c0b5;
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgb(255 255 255 / 60%);
  text-align: center;
}

.empty-state h2,
.empty-state h3,
.loading-state p {
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.empty-state p {
  max-width: 30rem;
}

.empty-state .button {
  margin-top: 0.6rem;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.8rem;
  border: 3px solid var(--cream-deep);
  border-top-color: var(--gateway-red);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.pagination {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.site-footer {
  border-top: 1px solid var(--cream-deep);
  color: var(--muted);
  background: rgb(255 253 248 / 65%);
}

.site-footer__inner {
  width: min(calc(100% - 2rem), var(--content-width-wide));
  min-height: 4.5rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 650;
}

.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 68rem) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 54rem) {
  .site-header__inner {
    min-height: 4.5rem;
    flex-wrap: wrap;
    gap: 0;
  }

  .js .site-nav__toggle {
    display: inline-flex;
  }

  .site-nav {
    width: 100%;
    flex-basis: 100%;
    padding: 0.65rem 0 1rem;
    align-items: stretch;
    flex-direction: column;
  }

  .js .site-nav:not([data-open="true"]) {
    display: none;
  }

  .site-nav__list {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav__link {
    width: 100%;
  }

  .account-menu {
    padding-top: 0.8rem;
    justify-content: space-between;
    border-top: 1px solid rgb(255 255 255 / 12%);
  }

  .account-menu__identity {
    justify-items: start;
  }

  .split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 40rem) {
  .site-header__inner,
  .page-shell,
  .page-shell--wide,
  .site-footer__inner {
    width: min(calc(100% - 1.25rem), var(--content-width-wide));
  }

  .brand__school {
    font-size: 0.62rem;
  }

  .brand__product {
    font-size: 0.98rem;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-actions .button,
  .button-row .button {
    width: 100%;
  }

  .metric-grid,
  .form-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .field--full {
    grid-column: auto;
  }

  .card {
    border-radius: var(--radius-md);
  }

  .card__header {
    flex-direction: column;
  }

  .card__footer {
    margin: 1rem -1rem -1rem;
    padding: 1rem;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    display: block;
    background: #fff;
  }

  .site-header,
  .site-footer,
  .page-actions,
  .button-row,
  .filter-bar {
    display: none !important;
  }

  .page-shell,
  .page-shell--wide {
    width: 100%;
    padding: 0;
  }

  .card,
  .table-wrap {
    box-shadow: none;
  }
}
