:root {
  --ink: #111113;
  --muted: #68686f;
  --line: #e2e2e5;
  --paper: #ffffff;
  --canvas: #f6f6f7;
  --crimson: #dc143c;
  --crimson-dark: #a50f2d;
  --crimson-soft: #fff0f3;
  --crimson-bright: #ff315a;
  --amber: #7d182c;
  --amber-soft: #fff1f4;
  --red: #dc143c;
  --red-soft: #fff0f3;
  --blue: #171719;
  --blue-soft: #eeeeef;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.08);
  --radius: 22px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.035em;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.page-width {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 780;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand--light {
  color: white;
}

.brand__mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--crimson);
  font-weight: 850;
  box-shadow: 0 7px 18px rgba(220, 20, 60, 0.2);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--crimson);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow--light {
  color: var(--crimson-bright);
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.topbar__inner {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
}

.topbar__actions,
.session-actions,
.start-form {
  display: flex;
  align-items: center;
  gap: 14px;
}

.date-chip {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 0.8rem;
  font-weight: 650;
}

.text-button,
.text-link {
  padding: 0;
  border: 0;
  color: var(--crimson);
  background: transparent;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.text-button:hover,
.text-link:hover {
  text-decoration: underline;
}

.dashboard {
  padding-top: 44px;
  padding-bottom: 72px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.dashboard-heading .muted {
  margin-bottom: 0;
}

.compact-input {
  width: 220px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
}

.compact-input:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.12);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button--primary {
  color: white;
  background: var(--crimson);
  box-shadow: 0 8px 22px rgba(220, 20, 60, 0.2);
}

.button--primary:hover:not(:disabled) {
  background: var(--crimson-dark);
}

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

.button--secondary:hover:not(:disabled) {
  border-color: #bcbcc2;
  background: #fafafa;
}

.button--danger-soft {
  border-color: #f2bdc8;
  color: var(--red);
  background: var(--red-soft);
}

.button--wide {
  width: 100%;
}

.button--large {
  min-height: 54px;
  border-radius: 14px;
}

.button--small {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 0.85rem;
}

.button--loading {
  color: transparent;
  pointer-events: none;
}

.button--loading::after {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  content: "";
  animation: spin 700ms linear infinite;
}

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

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--live {
  background: var(--crimson);
  box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.13);
}

.alert {
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  line-height: 1.5;
}

.alert--success {
  border-color: #f2bdc8;
  color: var(--crimson-dark);
  background: var(--crimson-soft);
}

.alert--error {
  border-color: #f0caca;
  color: var(--red);
  background: var(--red-soft);
}

.alert--warning {
  border-color: #e9b7c1;
  color: #741229;
  background: var(--amber-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 22px 0;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}

.stat-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.stat-card strong {
  font-size: 1.65rem;
  letter-spacing: -0.04em;
}

.stat-card__icon {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 13px;
  font-size: 1.2rem;
  font-weight: 850;
}

.stat-card__icon--blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.stat-card__icon--green {
  color: var(--crimson);
  background: var(--crimson-soft);
}

.stat-card__icon--amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.75fr);
  gap: 22px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.035);
}

.panel__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 0;
}

.panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.panel__actions form {
  margin: 0;
}

.panel-copy {
  margin: 14px 26px 20px;
  font-size: 0.9rem;
}

.panel-copy code,
.alert code {
  padding: 2px 5px;
  border-radius: 5px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.06);
}

.live-badge,
.present-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--crimson);
  background: var(--crimson-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.live-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 0 4px rgba(220, 20, 60, 0.14);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(220, 20, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 20, 60, 0);
  }
}

.qr-stage {
  display: grid;
  justify-items: center;
  padding: 22px 32px 30px;
}

.qr-frame {
  position: relative;
  width: min(100%, 350px);
  padding: 15px;
  background: white;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.qr-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--crimson);
  border-style: solid;
}

.qr-corner--tl {
  top: 0;
  left: 0;
  border-width: 3px 0 0 3px;
  border-radius: 8px 0 0;
}

.qr-corner--tr {
  top: 0;
  right: 0;
  border-width: 3px 3px 0 0;
  border-radius: 0 8px 0 0;
}

.qr-corner--bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 3px 3px;
  border-radius: 0 0 0 8px;
}

.qr-corner--br {
  right: 0;
  bottom: 0;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 8px;
}

.qr-timer {
  display: flex;
  min-width: 180px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--canvas);
}

.qr-timer__label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.qr-timer strong {
  color: var(--crimson);
  font-size: 1.1rem;
}

.qr-help {
  max-width: 460px;
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.82rem;
}

.upload-form {
  padding: 0 26px;
}

.file-drop {
  display: flex;
  min-height: 105px;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1.5px dashed #bdbdc2;
  border-radius: 15px;
  background: #fafafa;
  cursor: pointer;
}

.file-drop:hover {
  border-color: var(--crimson);
  background: var(--crimson-soft);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-drop__icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--crimson);
  background: var(--crimson-soft);
  font-size: 1.3rem;
  font-weight: 800;
}

.file-drop strong,
.file-drop small {
  display: block;
}

.file-drop strong {
  margin-bottom: 4px;
}

.file-drop small {
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.check-row input {
  accent-color: var(--crimson);
}

.roster-note {
  display: flex;
  gap: 11px;
  margin: 20px 26px 26px;
  padding: 12px;
  border-radius: 12px;
  color: #55555b;
  background: var(--canvas);
  font-size: 0.8rem;
  line-height: 1.45;
}

.roster-note > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #bdbdc2;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

.roster-note p {
  margin: 0;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 65px 30px;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 70px;
  height: 70px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 22px;
  color: var(--crimson);
  background: var(--crimson-soft);
  font-size: 2rem;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 350px;
  margin: 0;
  color: var(--muted);
}

.attendance-panel {
  margin-top: 22px;
}

.attendance-panel .panel__heading {
  padding-bottom: 20px;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

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

th,
td {
  padding: 15px 26px;
  border-bottom: 1px solid #ededf0;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fafafa;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #55555b;
  font-size: 0.86rem;
}

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

.student-cell {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}

.avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--crimson);
  background: var(--crimson-soft);
  font-weight: 800;
}

.empty-table-row td {
  padding: 42px 26px;
  color: var(--muted);
  text-align: center;
}

.login-page {
  background: #eeeeef;
}

.login-shell {
  display: grid;
  width: min(1120px, calc(100% - 48px));
  min-height: min(760px, calc(100vh - 48px));
  grid-template-columns: 1.05fr 0.95fr;
  margin: 24px auto;
  overflow: hidden;
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow);
}

.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 85% 15%, rgba(220, 20, 60, 0.28), transparent 30%),
    linear-gradient(150deg, #19191b, #050505);
}

.login-intro::after {
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 55px rgba(255, 255, 255, 0.025),
    0 0 0 110px rgba(255, 255, 255, 0.018);
  content: "";
}

.login-intro h1 {
  margin-bottom: 24px;
  color: white;
  font-size: clamp(2.6rem, 5vw, 4.7rem);
}

.login-intro__copy {
  max-width: 490px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 1rem;
  line-height: 1.8;
}

.login-intro__foot {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.78rem;
}

.login-panel {
  display: grid;
  padding: 50px;
  place-items: center;
}

.login-card {
  width: min(100%, 390px);
}

.login-card h2 {
  margin-bottom: 9px;
  font-size: 2.2rem;
}

.login-card > .muted {
  margin-bottom: 28px;
}

.stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font-size: 0.82rem;
  font-weight: 750;
}

.field small {
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #cfcfd4;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: white;
}

.field input:focus,
.field select:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.12);
}

.checkin-page {
  background:
    radial-gradient(circle at 20% 10%, rgba(220, 20, 60, 0.2), transparent 26%),
    linear-gradient(155deg, #18181a, #050505);
}

.checkin-shell {
  display: grid;
  width: min(100% - 30px, 510px);
  min-height: 100vh;
  align-content: center;
  gap: 22px;
  margin: 0 auto;
  padding: 32px 0;
}

.checkin-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: white;
  font-weight: 800;
}

.checkin-card {
  overflow: hidden;
  padding: clamp(25px, 6vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  background: white;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.checkin-card__heading {
  margin-bottom: 19px;
  text-align: center;
}

.checkin-card__heading h1,
.result-view h1 {
  margin: 13px 0 9px;
  font-size: clamp(1.8rem, 7vw, 2.5rem);
}

.checkin-card__heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.step-chip {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--crimson);
  background: var(--crimson-soft);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pass-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 24px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #56565c;
  background: var(--canvas);
  font-size: 0.78rem;
}

.pass-timer__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
}

.pass-timer strong {
  color: var(--ink);
}

.form-message {
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 0.83rem;
  line-height: 1.45;
}

.form-message--error {
  color: var(--red);
  background: var(--red-soft);
}

.remaining-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.remaining-note strong {
  color: var(--ink);
}

.result-view {
  display: grid;
  justify-items: center;
  padding: 14px 0;
  text-align: center;
}

.result-icon {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 23px;
  place-items: center;
  border-radius: 24px;
  font-size: 2rem;
  font-weight: 850;
}

.result-icon--success {
  color: var(--crimson);
  background: var(--crimson-soft);
  box-shadow: 0 0 0 9px rgba(255, 240, 243, 0.65);
}

.result-icon--expired {
  color: var(--amber);
  background: var(--amber-soft);
}

.result-icon--neutral {
  color: var(--muted);
  background: var(--canvas);
}

.result-view .eyebrow {
  margin-bottom: 0;
}

.result-view > .muted {
  margin-bottom: 20px;
}

.locked-device,
.scan-again {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 13px;
  color: #55555b;
  background: var(--canvas);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;
}

.locked-device span,
.scan-again__icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--crimson);
  background: white;
}

.locked-device p,
.scan-again p {
  margin: 0;
}

.checkin-foot {
  margin: 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.73rem;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: 370px;
  }
}

@media (max-width: 680px) {
  .page-width {
    width: min(100% - 26px, 1180px);
  }

  .dashboard {
    padding-top: 28px;
  }

  .dashboard-heading,
  .start-form {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-heading {
    gap: 20px;
  }

  .compact-input {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .panel__heading {
    padding: 20px 20px 0;
  }

  .panel-copy {
    margin-right: 20px;
    margin-left: 20px;
  }

  .upload-form {
    padding: 0 20px;
  }

  .roster-note {
    margin-right: 20px;
    margin-left: 20px;
  }

  th,
  td {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar__actions .date-chip {
    display: none;
  }

  .login-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .login-intro {
    min-height: 300px;
    padding: 30px;
  }

  .login-intro h1 {
    font-size: 2.7rem;
  }

  .login-intro__copy {
    display: none;
  }

  .login-panel {
    padding: 38px 25px;
  }
}

@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;
  }
}
