:root {
  --ink: #0f3a66;
  --ink-soft: #17406d;
  --text: #1a3a5c;
  --muted: #5a7a96;
  --line: rgba(0, 158, 227, 0.18);
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --primary: #009ee3;
  --primary-deep: #0080b8;
  --accent: #7ec8e8;
  --accent-soft: rgba(0, 158, 227, 0.1);
  --success: #2d6a4f;
  --success-bg: #e8f3ec;
  --error: #9b2c2c;
  --error-bg: #fceceb;
  --warn: #8a6a1f;
  --warn-bg: #f8f1db;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(15, 58, 102, 0.08);
  --shadow-soft: 0 4px 14px rgba(0, 158, 227, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(126, 200, 232, 0.45), transparent 55%),
    radial-gradient(ellipse 60% 45% at 100% 100%, rgba(0, 158, 227, 0.14), transparent 50%),
    #ffffff;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(7, 17, 31, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 17, 31, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.1rem calc(1.25rem + var(--safe-bottom));
  color: #e8f6fc;
  background: #0f3a66;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 1.6rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: #009ee3;
  box-shadow: none;
  flex-shrink: 0;
}

.brand strong {
  display: block;
  color: #fff;
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand small {
  color: rgba(232, 246, 252, 0.65);
  font-size: 0.78rem;
}

.nav-label {
  margin: 0 0 0.55rem 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 246, 252, 0.45);
}

.sidebar nav {
  display: grid;
  gap: 0.28rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(232, 246, 252, 0.78);
  text-decoration: none;
  padding: 0.72rem 0.9rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar a.active {
  background: rgba(0, 158, 227, 0.35);
  color: #fff;
  box-shadow: inset 3px 0 0 #7ec8e8;
  font-weight: 600;
}

.nav-ico {
  display: none;
}

.sidebar-foot {
  margin-top: auto;
  padding: 1rem 0.85rem 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(215, 230, 239, 0.45);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sidebar-logout {
  color: #e8f6fc;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.sidebar-logout:hover {
  color: #7ec8e8;
}

.nav-toggle,
.nav-close {
  display: none;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  padding: 0.35rem;
}

.nav-close {
  margin-left: auto;
  font-size: 1.7rem;
  line-height: 1;
  color: rgba(215, 230, 239, 0.6);
}

.nav-toggle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.sidebar-backdrop { display: none; }

.topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.topbar-title {
  font-family: var(--font);
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

/* Content */
.content {
  padding: 1.75rem clamp(1rem, 3vw, 2.25rem) calc(1.75rem + var(--safe-bottom));
  min-width: 0;
  width: 100%;
}

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

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font);
  font-size: clamp(1.55rem, 3.5vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
}

.page-header p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
  line-height: 1.5;
  font-size: 0.95rem;
}

.header-actions,
.actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.05rem, 2.5vw, 1.45rem);
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-soft);
}

.panel-public {
  border-color: rgba(0, 158, 227, 0.28);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-head h2,
.panel h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-soft);
}

.stat-card::after {
  display: none;
}

.stat-total {
  background: #009ee3;
  color: #fff;
  border: none;
  box-shadow: var(--shadow-soft);
}

.stat-total::after {
  display: none;
}

.stat-total .stat-label,
.stat-total small { color: rgba(255, 255, 255, 0.82); }

.stat-public {
  background: #0f3a66;
  color: #fff;
  border: none;
  box-shadow: var(--shadow-soft);
}

.stat-public::after {
  display: none;
}

.stat-public .stat-label,
.stat-public small { color: rgba(255, 255, 255, 0.78); }

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-card strong {
  position: relative;
  z-index: 1;
  font-family: var(--font);
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-card small {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0080b8;
  background: rgba(0, 158, 227, 0.12);
}

.source-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: rgba(15, 58, 102, 0.06);
  vertical-align: middle;
}

.source-tag.source-public {
  color: #0f3a66;
  background: rgba(0, 158, 227, 0.12);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

.row-actions form {
  margin: 0;
}

.name-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.muted-cell {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  min-height: 34px;
  border-radius: 8px;
}

.btn-danger {
  background: #fff;
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error-bg);
  border-color: var(--error);
}

.danger-zone {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(180, 35, 24, 0.18);
}

.danger-zone h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--error);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(47, 74, 106, 0.04);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0.62rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 42px;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(11, 21, 36, 0.1);
}

.btn-primary {
  background: #009ee3;
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover {
  background: #0080b8;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.55);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.filters input,
.filters select,
.field-row input,
.category-card input[type="number"],
.register-form input,
.register-form select,
.fix-name-form input[type="text"],
.checkpoint-select,
.manual-scan input {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.9);
  min-height: 46px;
  width: 100%;
  max-width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.filters input,
.filters select {
  width: auto;
  min-width: min(100%, 180px);
  flex: 1 1 160px;
}

.filters input:focus,
.filters select:focus,
.register-form input:focus,
.register-form select:focus,
.fix-name-form input:focus,
.manual-scan input:focus {
  outline: 2px solid rgba(47, 74, 106, 0.28);
  border-color: rgba(47, 74, 106, 0.35);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #e8eef5;
  color: #334155;
}

.pill-company { background: #e3f5fc; color: #0080b8; }
.pill-delegate { background: #e8f3ec; color: #2d6a4f; }
.pill-faculty { background: #e8eef5; color: #0f3a66; }
.pill-organiser { background: #eef4f8; color: #17406d; }

.flash-group { margin-bottom: 1rem; }

.flash {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(15, 122, 76, 0.15);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(180, 35, 24, 0.12);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-top: 1rem;
}

.pagination a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.15rem;
}

.preview-panel img {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.meta {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 1fr;
  gap: 0.75rem 1rem;
}

.meta dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meta dd {
  margin: 0;
  word-break: break-word;
  font-weight: 600;
}

code {
  font-size: 0.84rem;
  background: rgba(7, 17, 31, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
  word-break: break-all;
}

.id-card-link { display: inline-block; line-height: 0; }

.id-card-thumb {
  width: 52px;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease;
}

.id-card-link:hover .id-card-thumb {
  transform: scale(1.06) rotate(-1deg);
}

.id-card-missing {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.6);
}

.empty { color: var(--muted); margin: 0; }

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.fix-name-form,
.register-form label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
}

.fix-name-form { gap: 0.9rem; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-weight: 600;
}

.register-form .register-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.85rem;
  margin: 1rem 0;
}

.category-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
}

.category-card strong { display: block; }
.category-card small { color: var(--muted); }

.form-actions { margin-top: 1rem; }

/* —— Public scanner page —— */
body.page-scan {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--font);
  color: #1a3a5c;
  background: #ffffff;
  overflow-x: hidden;
}

body.page-scan::before {
  display: none;
}

.scan-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 0% 0%, rgba(126, 200, 232, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(0, 158, 227, 0.18), transparent 50%),
    #f7fbfe;
}

.scan-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: #009ee3;
}

.scan-public {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) max(0.85rem, env(safe-area-inset-right, 0px))
    calc(1.25rem + env(safe-area-inset-bottom, 0px)) max(0.85rem, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: landing-in 0.55s ease both;
  box-sizing: border-box;
}

.scan-brand {
  text-align: center;
  padding: 0.1rem 0.25rem 0;
}

.scan-course {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f3a66;
}

.scan-title {
  margin: 0;
  font-size: clamp(1.55rem, 6.5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.12;
  color: #0f3a66;
}

.page-scan .scan-result {
  position: static;
  border-radius: 14px;
  padding: 0.85rem 0.85rem;
  min-height: 78px;
  text-align: center;
  border: 2px solid transparent;
  box-shadow: 0 10px 28px rgba(15, 58, 102, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.page-scan .scan-result .scan-status {
  font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.1;
}

.page-scan .scan-result .scan-name {
  margin-top: 0.3rem;
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  font-weight: 700;
}

.page-scan .scan-result .scan-meta {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.88;
  word-break: break-word;
}

.page-scan .scan-result.idle {
  background: #fff;
  border-color: rgba(0, 158, 227, 0.28);
  color: #0f3a66;
}

.page-scan .scan-result.allowed {
  background: #0f7a4c;
  border-color: #0f7a4c;
  color: #fff;
}

.page-scan .scan-result.denied {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.page-scan .scan-result.invalid {
  background: #9a6700;
  border-color: #9a6700;
  color: #fff;
}

.page-scan .scan-result.allowed .scan-meta,
.page-scan .scan-result.denied .scan-meta,
.page-scan .scan-result.invalid .scan-meta {
  color: rgba(255, 255, 255, 0.88);
}

.scan-card {
  background: #fff;
  border: 1px solid rgba(0, 158, 227, 0.22);
  border-radius: 18px;
  padding: 0.85rem 0.8rem 1rem;
  box-shadow: 0 14px 36px rgba(15, 58, 102, 0.08);
}

.checkpoint-block {
  margin-bottom: 0.85rem;
}

.checkpoint-heading {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a7a96;
  margin-bottom: 0.45rem;
}

.page-scan .checkpoint-select {
  display: block;
  width: 100%;
  border: 1px solid rgba(0, 158, 227, 0.28);
  border-radius: 12px;
  padding: 0.8rem 2.5rem 0.8rem 0.9rem;
  font: 600 16px var(--font);
  color: #0f3a66;
  background: #f4fafd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23009ee3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
  min-height: 52px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.page-scan .checkpoint-select:focus {
  outline: none;
  border-color: #009ee3;
  box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.15);
  background-color: #fff;
}

.scanner-stage {
  margin: 0 auto 0.65rem;
  width: 100%;
  max-width: min(100%, 420px);
}

.scanner-frame {
  position: relative;
  padding: 0.35rem;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0, 158, 227, 0.2), rgba(15, 58, 102, 0.12));
  box-shadow: inset 0 0 0 1px rgba(0, 158, 227, 0.2);
}

.scanner-reader {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #0f3a66;
  aspect-ratio: 1;
  max-height: min(62vw, 52dvh, 420px);
  margin: 0 auto;
  box-shadow: 0 12px 28px rgba(15, 58, 102, 0.2);
}

.scanner-reader video,
.scanner-reader canvas,
#reader video,
#reader canvas {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: cover;
  border-radius: 14px;
}

#reader {
  border: none !important;
}

#reader__dashboard_section,
#reader__dashboard_section_csr,
#reader__header_message,
#reader__status_span,
#reader__scan_region > img {
  display: none !important;
}

.scanner-frame-hint {
  margin: 0.55rem 0 0;
  text-align: center;
  color: #5a7a96;
  font-size: 0.85rem;
  font-weight: 600;
}

.manual-details {
  margin-top: 0.25rem;
  border-top: 1px solid rgba(0, 158, 227, 0.15);
  padding-top: 0.65rem;
}

.manual-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f3a66;
  user-select: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.manual-details summary::-webkit-details-marker {
  display: none;
}

.manual-details summary::after {
  content: " +";
  color: #009ee3;
  font-weight: 700;
  margin-left: 0.25rem;
}

.manual-details[open] summary::after {
  content: " −";
}

.manual-scan {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.manual-scan input {
  width: 100%;
  border: 1px solid rgba(0, 158, 227, 0.28);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  min-height: 48px;
  color: #0f3a66;
  background: #fff;
  box-sizing: border-box;
}

.manual-scan input:focus {
  outline: none;
  border-color: #009ee3;
  box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.15);
}

.page-scan .manual-scan .btn {
  width: 100%;
  border-radius: 12px;
  background: #009ee3;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.page-scan .manual-scan .btn:hover {
  background: #0080b8;
}

@media (min-width: 640px) {
  .scanner-reader {
    max-height: none;
  }
}

/* Shared chip fallback (admin pages if any) */
.checkpoint-select { /* kept for a11y */ }
.chip {
  border: 1px solid rgba(0, 158, 227, 0.28);
  background: #fff;
  color: #0f3a66;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.chip.active {
  background: #009ee3;
  border-color: transparent;
  color: #fff;
}

.scan-result {
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
}

.scan-result .scan-status {
  font-weight: 700;
  text-transform: uppercase;
}

.scan-result.allowed { color: #0f7a4c; }
.scan-result.denied { color: #b42318; }
.scan-result.invalid { color: #9a6700; }

/* Responsive */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }

  .topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(238, 246, 250, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: calc(0.6rem + var(--safe-top)) 0 0.6rem;
    margin: calc(-1.75rem) 0 1rem;
  }

  .nav-toggle { display: inline-flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: none;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 50px rgba(7, 17, 31, 0.4);
  }

  .nav-close { display: inline-block; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(7, 17, 31, 0.5);
    backdrop-filter: blur(2px);
    z-index: 35;
  }

  .sidebar-backdrop[hidden] { display: none; }

  .detail-grid { grid-template-columns: 1fr; }

  .content {
    padding: 1.2rem 1rem calc(1.3rem + var(--safe-bottom));
  }

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

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

  .header-actions .btn,
  .page-header .btn,
  .actions .btn,
  .form-actions .btn {
    flex: 1 1 auto;
  }

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

  .stat-total { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .filters { flex-direction: column; }

  .filters input,
  .filters select,
  .filters .btn {
    width: 100%;
    min-width: 0;
  }

  .manual-scan { flex-direction: column; }
  .manual-scan .btn { width: 100%; }

  .meta {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .meta dt { margin-top: 0.5rem; }

  body:not(.page-scan) .checkpoint-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:not(.page-scan) .chip {
    width: 100%;
    text-align: center;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    font-size: 0.84rem;
  }

  table {
    min-width: 460px;
    font-size: 0.92rem;
  }
}

@media (min-width: 1100px) {
  .content { max-width: 1180px; }
}

/* —— Public registration landing (mirrors ID card look) —— */
body.page-landing {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--font);
  color: #1a3a5c;
  background: #ffffff;
  overflow-x: hidden;
}

body.page-landing::before {
  display: none;
}

.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 85% 60% at -5% -10%, rgba(126, 200, 232, 0.55), transparent 58%),
    radial-gradient(ellipse 70% 50% at 105% 105%, rgba(0, 158, 227, 0.22), transparent 55%),
    #ffffff;
}

.landing-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 7px;
  background: #009ee3;
}

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
    calc(2rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  animation: landing-in 0.7s ease both;
  box-sizing: border-box;
}

@keyframes landing-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.landing-brand {
  margin-bottom: 1.75rem;
  text-align: center;
}

.landing-course {
  margin: 0 0 0.65rem;
  font-family: var(--font);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0f3a66;
  animation: landing-fade 0.8s 0.1s ease both;
}

.landing-title {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(2.15rem, 7vw, 3.15rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #0f3a66;
  animation: landing-fade 0.85s 0.18s ease both;
}

.landing-meta {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #009ee3;
  animation: landing-fade 0.85s 0.28s ease both;
}

.landing-lead {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.45;
  color: #5a7a96;
  animation: landing-fade 0.85s 0.35s ease both;
}

@keyframes landing-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.landing-flashes {
  margin-bottom: 1rem;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: landing-fade 0.9s 0.42s ease both;
}

.landing-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5a7a96;
}

.landing-field input,
.landing-field select {
  width: 100%;
  border: 1px solid rgba(0, 158, 227, 0.28);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font: 500 16px var(--font);
  color: #0f3a66;
  background: rgba(255, 255, 255, 0.92);
  min-height: 52px;
  text-transform: none;
  letter-spacing: normal;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.landing-field input::placeholder {
  color: #9bb4c8;
}

.landing-field input:focus,
.landing-field select:focus {
  outline: none;
  border-color: #009ee3;
  box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.18);
}

.landing-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23009ee3' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.landing-field select option {
  background: #fff;
  color: #0f3a66;
}

.landing-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.copies-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(0, 158, 227, 0.28);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  min-height: 52px;
}

.copies-btn {
  width: 2.6rem;
  border: none;
  background: rgba(0, 158, 227, 0.08);
  color: #0f3a66;
  font: 700 1.35rem/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.copies-btn:hover:not(:disabled) {
  background: #009ee3;
  color: #fff;
}

.copies-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.copies-stepper input {
  width: 2.75rem;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: center;
  min-height: 52px;
  padding: 0.5rem 0.15rem !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.copies-stepper input::-webkit-outer-spin-button,
.copies-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.landing-cta {
  margin-top: 0.35rem;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font: 700 1.05rem var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #009ee3;
  cursor: pointer;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.18s ease, background 0.18s ease;
  box-shadow: 0 10px 24px rgba(0, 158, 227, 0.28);
}

.landing-cta:hover {
  background: #0080b8;
  transform: translateY(-1px);
}

.landing-cta:active {
  transform: translateY(1px);
}

@media (max-width: 420px) {
  .landing-row {
    grid-template-columns: 1fr;
  }

  .landing-copies {
    max-width: none;
  }

  .copies-stepper {
    width: 100%;
  }

  .copies-stepper input {
    flex: 1;
    width: auto;
  }
}

/* Public registration success */
.landing-success {
  justify-content: flex-start;
  padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
}

.success-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  animation: landing-fade 0.9s 0.35s ease both;
  text-align: center;
}

.success-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2d6a4f;
}

.success-name {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1.65rem, 5.5vw, 2.15rem);
  font-weight: 700;
  line-height: 1.15;
  color: #0f3a66;
}

.success-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

.success-category,
.success-copies {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f3a66;
  background: rgba(0, 158, 227, 0.12);
}

.success-lead {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.02rem;
  line-height: 1.45;
  color: #5a7a96;
}

.success-preview {
  margin: 0.35rem auto 0.15rem;
  width: 100%;
  max-width: 280px;
}

.success-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 58, 102, 0.14);
  border: 1px solid rgba(0, 158, 227, 0.2);
}

.success-download {
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.success-copies-list {
  margin-top: 0.35rem;
  text-align: left;
  border-top: 1px solid rgba(0, 158, 227, 0.18);
  padding-top: 0.85rem;
}

.success-copies-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5a7a96;
}

.success-copies-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.success-copies-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(0, 158, 227, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  font-weight: 600;
  color: #0f3a66;
}

.success-copies-list a {
  color: #009ee3;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.success-copies-list a:hover {
  text-decoration: underline;
}

.success-missing {
  color: #9b2c2c;
  font-size: 0.85rem;
}

.success-again {
  margin-top: 0.5rem;
  color: #009ee3;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.success-again:hover {
  text-decoration: underline;
}

/* Staff login (no sidebar) */
body.page-login {
  font-family: var(--font);
  color: #1a3a5c;
  background: #ffffff;
  overflow-x: hidden;
}

body.page-login::before {
  display: none;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 85% 60% at -5% -10%, rgba(126, 200, 232, 0.55), transparent 58%),
    radial-gradient(ellipse 70% 50% at 105% 105%, rgba(0, 158, 227, 0.22), transparent 55%),
    #ffffff;
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 7px;
  background: #009ee3;
}

.login {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px))
    calc(2rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  animation: landing-in 0.7s ease both;
  box-sizing: border-box;
}

.login-brand {
  margin-bottom: 1.75rem;
  text-align: center;
}

.login-course {
  margin: 0 0 0.55rem;
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0f3a66;
}

.login-title {
  margin: 0;
  font-size: clamp(1.85rem, 6vw, 2.45rem);
  font-weight: 700;
  line-height: 1.1;
  color: #0f3a66;
}

.login-meta {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #009ee3;
}

.login-flashes {
  margin-bottom: 1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-foot {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: #5a7a96;
}

.login-foot a {
  color: #009ee3;
  text-decoration: none;
  font-weight: 600;
}

.login-foot a:hover {
  text-decoration: underline;
}
