:root {
  --navy: #071e49;
  --navy-deep: #021d49;
  --red: #d00e2c;
  --red-dark: #a90b25;
  --cream: #eadfb5;
  --paper: #f4f6f9;
  --surface: #ffffff;
  --ink: #17243a;
  --muted: #5d6b7d;
  --line: #d8dee7;
  --good: #176b49;
  --bad: #a52a38;
  --shadow: 0 12px 32px rgba(2, 29, 73, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 "Open Sans", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-140%);
  background: white;
  color: var(--navy);
  font-weight: 700;
}

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

header {
  border-top: 5px solid var(--red);
  background: var(--navy);
  color: white;
  box-shadow: 0 5px 18px rgba(2, 29, 73, .18);
}

.header-inner {
  width: min(100% - 48px, 1120px);
  min-height: 102px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 17px;
  color: white;
  text-decoration: none;
}

.brand:hover { color: white; }

.brand img {
  width: 42px;
  height: 82px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy { display: grid; gap: 2px; }

.school-name {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .76;
}

.product-name {
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  font-weight: 400;
  letter-spacing: .01em;
}

nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: .94rem;
}

nav a,
nav .link {
  display: inline-block;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 7px 0 5px;
  background: none;
  color: white;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

nav a:hover,
nav .link:hover { border-bottom-color: var(--red); color: white; }
nav form { margin: 0; }
.account-name { color: var(--cream); }

main {
  width: min(100% - 48px, 1120px);
  min-height: calc(100vh - 207px);
  margin: 0 auto;
  padding: 58px 0 72px;
}

main > section:first-child { position: relative; }

main > section:first-child::before {
  content: "";
  display: block;
  width: 58px;
  height: 5px;
  margin-bottom: 18px;
  background: var(--red);
}

footer {
  min-height: 100px;
  border-top: 5px solid var(--cream);
  padding: 25px max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: white;
  color: var(--muted);
  font-size: .88rem;
}

footer span:first-child { color: var(--navy); font-weight: 700; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1,
h2,
h3 { color: var(--navy-deep); }

h1 {
  max-width: 900px;
  margin: .08em 0 .38em;
  font-size: clamp(2rem, 4.7vw, 3.3rem);
  font-weight: 300;
  letter-spacing: -.025em;
  line-height: 1.08;
}

h2 { line-height: 1.25; font-weight: 400; }

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.16rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 32px;
}

.student-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.student-heading h1 { margin-bottom: 0; }

.card,
.panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card {
  position: relative;
  display: block;
  min-height: 190px;
  padding: 25px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--navy);
  transition: background .16s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #bcc7d6;
  box-shadow: 0 17px 38px rgba(2, 29, 73, .14);
  color: inherit;
}

.card:hover::after { background: var(--red); }
.card h2 { margin: .7rem 0 .4rem; }

.submission-meta {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: .85rem;
  color: var(--muted);
  font-size: .86rem;
}

.status {
  display: inline-block;
  border-radius: 99px;
  padding: 4px 10px;
  background: #e7ebf1;
  color: #46566b;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.status.pending { background: #fff0c2; color: #6d5000; }
.status.approved { background: #dcefe5; color: var(--good); }
.status.rejected { background: #f8e0e3; color: #84202c; }

.login { max-width: 650px; margin: 0 auto; }
.panel, .form-panel { margin-top: 26px; padding: 27px; }
.form-panel { max-width: 880px; }

.copy {
  margin: 24px 0;
  border-left: 5px solid var(--red);
  border-radius: 0;
  padding: 20px 23px;
  background: #f6f1df;
}

.copy h2:first-child { margin-top: 0; }
label { display: block; margin: 19px 0; font-weight: 700; }

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid #aeb9c8;
  border-radius: 2px;
  padding: 12px 13px;
  background: white;
  color: var(--ink);
  font: inherit;
}

input:hover,
select:hover,
textarea:hover { border-color: #7d8ca0; }
textarea { min-height: 115px; resize: vertical; }

fieldset {
  margin: 25px 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 16px 21px;
  background: #fafbfc;
}

legend { padding: 0 8px; color: var(--navy); font-weight: 800; }
.choice { display: flex; align-items: flex-start; gap: 11px; font-weight: 500; }
.choice input { width: auto; margin: 5px 0 0; }

button,
.button {
  display: inline-block;
  border: 0;
  border-radius: 2px;
  padding: 12px 20px;
  background: var(--red);
  color: white;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

button:hover,
.button:hover { background: var(--red-dark); color: white; }
button:active,
.button:active { transform: translateY(1px); }
.button.secondary { background: #e6eaf0; color: var(--navy); }
.button.secondary:hover { background: #d9dfe8; color: var(--navy); }
button.danger { background: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #f2c34f;
  outline-offset: 3px;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 30px;
}
.actions.start { justify-content: flex-start; }

.alert { margin: 19px 0; border-radius: 2px; padding: 14px 16px; }
.alert.info { border: 1px solid #b8c6db; border-left: 5px solid var(--navy); background: #eef2f8; }
.alert.error { border: 1px solid #efb8bf; border-left: 5px solid var(--bad); background: #fbeaec; }
.alert.success { border: 1px solid #b3d8c6; border-left: 5px solid var(--good); background: #e6f3ec; }
.muted { color: var(--muted); font-size: .92rem; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0;
}

.metrics div {
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 2px;
  padding: 19px 20px;
  background: white;
  box-shadow: 0 8px 24px rgba(2, 29, 73, .06);
}

.metrics strong { display: block; color: var(--navy); font-size: 2rem; font-weight: 400; }
.metrics span { color: var(--muted); }

.queue-heading,
.review-heading,
.approve-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.queue-heading { margin: 28px 0 8px; }
.queue-heading p { margin: 0; color: var(--muted); }
.queue-heading strong { color: var(--navy); font-size: 1.55rem; font-weight: 500; }

.review-workflow { max-width: 980px; margin: 0 auto; }
.review-heading { align-items: flex-end; margin-bottom: 28px; }
.review-heading h1 { margin-bottom: .2em; }
.review-summary { margin: 0; color: var(--muted); }
.review-progress {
  flex: 0 0 auto;
  border-radius: 99px;
  padding: 7px 13px;
  background: #e7ebf1;
  color: #46566b;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.change-list {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.change-row { padding: 19px 22px 22px; }
.change-row + .change-row { border-top: 1px solid var(--line); }
.change-row h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 700; }
.change-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}
.change-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.change-value {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 11px 13px;
  background: #f6f7f9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.change-value.before { color: #4e5a69; }
.change-value.after { border-color: #9ccab5; background: #edf7f1; color: #104f37; font-weight: 700; }
.change-arrow { color: var(--red-dark); font-size: 1.3rem; text-align: center; }
.empty-value { color: #738095; font-style: italic; font-weight: 400; }
.empty-queue { margin: 0; padding: 22px; color: var(--muted); }

.approve-form {
  position: sticky;
  z-index: 5;
  bottom: 12px;
  justify-content: flex-end;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 13px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 9px 28px rgba(2, 29, 73, .16);
  backdrop-filter: blur(8px);
}
.reject-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 17px;
}
.reject-panel summary { width: fit-content; color: var(--bad); cursor: pointer; font-weight: 700; }
.reject-panel form { max-width: 620px; margin-top: 13px; }
.reject-panel label { margin-top: 0; }

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  font-weight: 700;
  text-decoration: none;
}
.history-page { max-width: 920px; margin: 0 auto; }
.history-page > .lead { margin: 0 0 36px; }
.history-year { margin-top: 34px; }
.history-year h2 { margin-bottom: 13px; font-size: 1.25rem; font-weight: 700; }
.history-list,
.answer-list {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
}
.history-item + .history-item { border-top: 1px solid var(--line); }
.history-item h3 { margin: 8px 0 2px; color: var(--navy); font-size: 1.05rem; }
.history-item p { margin: 0; color: var(--muted); font-size: .9rem; }
.button.compact { flex: 0 0 auto; padding: 9px 14px; font-size: .88rem; }
.private-answer { max-width: 190px; color: var(--muted); font-size: .82rem; text-align: right; }
.empty-history { box-shadow: none; }
.history-detail { max-width: 920px; margin: 0 auto; }
.history-detail .lead { margin-bottom: 28px; }
.answer-row {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(0, 1.7fr);
  gap: 24px;
  padding: 16px 20px;
}
.answer-row + .answer-row { border-top: 1px solid var(--line); }
.answer-row dt { color: var(--muted); font-size: .86rem; font-weight: 700; }
.answer-row dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.answer-row ul { margin: 0; padding-left: 20px; }

.table-wrap { overflow: auto; padding: 0; }
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 14px 17px; text-align: left; vertical-align: top; }
th { background: var(--navy); color: white; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:nth-child(even) { background: #f8f9fb; }
tbody tr:hover { background: #f3efe2; }

@media (max-width: 760px) {
  .header-inner { width: min(100% - 32px, 1120px); min-height: 90px; gap: 16px; }
  .brand img { width: 34px; height: 67px; }
  .school-name { display: none; }
  nav { gap: 14px; font-size: .87rem; }
  .account-name { display: none; }
  main { width: min(100% - 32px, 1120px); padding: 40px 0 56px; }
  footer { align-items: flex-start; flex-direction: column; padding: 22px 16px; }
  .metrics { grid-template-columns: 1fr; }
  .student-heading { align-items: flex-start; flex-direction: column; }
  .actions { align-items: stretch; flex-direction: column; }
  .actions > * { width: 100%; text-align: center; }
  .review-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .change-values { grid-template-columns: 1fr; }
  .change-arrow { transform: rotate(90deg); }
  .approve-form { align-items: stretch; flex-direction: column-reverse; }
  .approve-form > * { width: 100%; text-align: center; }
  .history-item { align-items: flex-start; flex-direction: column; gap: 13px; }
  .history-item .button.compact { width: 100%; text-align: center; }
  .private-answer { max-width: none; text-align: left; }
  .answer-row { grid-template-columns: 1fr; gap: 5px; }
}

@media (max-width: 460px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding: 14px 0 17px; }
  .brand img { display: none; }
  nav { width: 100%; justify-content: space-between; }
  h1 { font-size: 2.15rem; }
  .panel, .form-panel { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
