:root {
  --navy: #063b72;
  --navy-deep: #03294f;
  --ink: #102a43;
  --muted: #627d98;
  --teal: #43c7a3;
  --paper: #f3f7fa;
  --line: #dbe6ee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 12%, rgba(67, 199, 163, .17), transparent 23rem),
    linear-gradient(145deg, #eef5f8, #f9fbfc);
  font-family: "DM Sans", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 60 60 0M30 60 60 30M0 30 30 0' stroke='%2396afc0' stroke-width='.5'/%3E%3C/svg%3E");
}

.shell {
  width: min(1120px, calc(100% - 40px));
  min-height: calc(100vh - 68px);
  margin: auto;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
  padding: 64px 0 40px;
}

.intro { position: relative; }
.eyebrow {
  display: inline-block;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  border-bottom: 3px solid var(--teal);
  padding-bottom: 8px;
}
.intro h1 {
  margin: 24px 0 20px;
  color: var(--navy-deep);
  font-size: clamp(52px, 7vw, 86px);
  line-height: .92;
  letter-spacing: -.06em;
}
.intro h1 em { color: var(--teal); font-style: normal; }
.intro > p { max-width: 470px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.steps { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 36px; }
.steps span { display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: 13px; font-weight: 700; }
.steps b {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 50%;
}

.card {
  position: relative;
  min-height: 530px;
  padding: clamp(24px, 4vw, 46px);
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 26px;
  box-shadow: 0 28px 70px rgba(10, 52, 84, .14);
  backdrop-filter: blur(12px);
}

label { display: block; margin-bottom: 12px; font-size: 20px; font-weight: 800; }
.search-box { position: relative; }
.search-box svg {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 22px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  transform: translateY(-50%);
}
input {
  width: 100%;
  height: 58px;
  padding: 0 52px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid transparent;
  border-radius: 14px;
  outline: none;
  font: inherit;
  font-size: 16px;
}
input:focus { background: white; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(67, 199, 163, .12); }
.helper, .message { color: var(--muted); font-size: 13px; }
.helper { margin: 10px 2px 20px; }
.message { min-height: 20px; margin-bottom: 8px; }
.message.error { color: #c0392b; }
.message.count { color: var(--navy); font-weight: 700; }
.spinner {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 22px;
  height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results { display: grid; gap: 9px; max-height: 330px; overflow: auto; padding-right: 3px; }
.student-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 13px;
  padding: 12px;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
  transition: .18s ease;
}
.student-row:hover { border-color: var(--teal); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(10, 52, 84, .08); }
.avatar {
  display: grid;
  flex: 0 0 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 12px;
  font-weight: 800;
}
.student-info { display: grid; flex: 1; gap: 3px; min-width: 0; }
.student-info strong, .student-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-info small { color: var(--muted); font-size: 12px; }
.arrow { color: var(--teal); font-size: 22px; }

[hidden] { display: none !important; }
.qr-view { text-align: center; }
.back-button {
  display: block;
  margin-bottom: 10px;
  padding: 5px 0;
  color: var(--muted);
  background: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.qr-card { padding: 4px 10px 18px; }
.school-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin: auto;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 14px;
  font-weight: 800;
}
.qr-label { margin: 12px 0 8px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.qr-card h2 { margin: 0; color: var(--navy-deep); font-size: 24px; }
.student-details { margin: 6px 0 17px; color: var(--muted); font-size: 13px; }
.qr-frame {
  width: fit-content;
  margin: auto;
  padding: 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: 0 12px 30px rgba(10, 52, 84, .1);
}
.qr-frame canvas, .qr-frame img { display: block; width: min(280px, 66vw); height: auto; }
.qr-note { max-width: 330px; margin: 15px auto 0; color: var(--muted); font-size: 12px; }
.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  gap: 9px;
  padding: 14px 25px;
  color: white;
  background: var(--navy);
  border: 0;
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(6, 59, 114, .22);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.save-button:hover { background: var(--navy-deep); }
.save-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.save-status { min-height: 18px; margin: 10px 0 0; color: var(--teal); font-size: 12px; font-weight: 700; }

footer { position: relative; padding: 16px; color: var(--muted); text-align: center; font-size: 11px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; align-items: start; padding-top: 40px; }
  .intro { text-align: center; }
  .intro h1 { font-size: 58px; }
  .intro > p { margin-inline: auto; }
  .steps { justify-content: center; }
  .card { min-height: 500px; }
}

@media (max-width: 480px) {
  .shell { width: min(100% - 24px, 1120px); padding-top: 28px; gap: 28px; }
  .intro h1 { margin-top: 18px; font-size: 48px; }
  .intro > p { font-size: 15px; }
  .steps { gap: 10px; }
  .steps span { font-size: 11px; }
  .card { padding: 22px 17px; border-radius: 20px; }
}
