:root {
  --ink: #0f3077;
  --ink-soft: #12366e;
  --text: #16325c;
  --muted: #5a7a96;
  --line: rgba(15, 48, 119, 0.14);
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --primary: #00b1b1;
  --primary-deep: #009494;
  --accent: #a1bed0;
  --accent-soft: rgba(0, 177, 177, 0.12);
  --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, 48, 119, 0.08);
  --shadow-soft: 0 4px 14px rgba(0, 177, 177, 0.10);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: "Montserrat", "Segoe UI", sans-serif;
  --wave-navy: rgba(15, 48, 119, 0.10);
  --wave-teal: rgba(0, 177, 177, 0.14);
  --wave-mist: rgba(161, 190, 208, 0.42);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, var(--wave-teal), transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 100%, var(--wave-navy), transparent 50%),
    #ffffff;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    radial-gradient(ellipse 80% 55% at 80% 115%, var(--wave-mist), transparent 58%),
    radial-gradient(ellipse 55% 40% at 10% 105%, var(--wave-teal), transparent 55%);
  background-repeat: no-repeat;
  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;
}

html:has(body.page-admin) {
  height: 100%;
  overflow: hidden;
}

body.page-admin {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #eef4f8;
}

body.page-admin .app-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0f3077;
}

body.page-admin .sidebar {
  position: relative;
  top: auto;
  height: auto;
  min-height: 0;
  align-self: stretch;
}

body.page-admin .content {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, var(--wave-teal), transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 100%, var(--wave-navy), transparent 50%),
    #eef6fa;
}

.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: #e8f4f6;
  background: #0f3077;
  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: #00b1b1;
  border-radius: 999px;
  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, 177, 177, 0.28);
  color: #fff;
  box-shadow: inset 3px 0 0 #00b1b1;
  font-weight: 600;
}

.nav-ico {
  display: none;
}

.sidebar-user {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(232, 246, 252, 0.72);
}

.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: #8ec8c8;
}

.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, 177, 177, 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: #00b1b1;
  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: #0f3077;
  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: #009494;
  background: rgba(0, 177, 177, 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: #0f3077;
  background: rgba(0, 177, 177, 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: #00b1b1;
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover {
  background: #009494;
}

.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-delegate { background: #00b1b1; color: #fff; }
.pill-faculty { background: #0f3077; color: #fff; }
.pill-organiser { background: #0f3077; color: #fff; }

.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);
}

.registry-panel {
  padding: 0;
}

.registry-panel .table-wrap {
  border-radius: 0;
}

.registry-panel table {
  min-width: 680px;
}

.registry-panel th,
.registry-panel td {
  padding: 0.72rem 0.9rem;
}

.registry-panel thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f8fb;
  box-shadow: inset 0 -1px 0 var(--line);
}

.registry-panel .id-card-thumb {
  width: 44px;
}

.registry-panel .id-card-missing {
  width: 44px;
  height: 60px;
}

.registry-panel .empty {
  padding: 1.2rem 1rem;
}

.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% 50% at 50% -8%, rgba(0, 177, 177, 0.16), transparent 55%),
    radial-gradient(ellipse 80% 45% at 110% 100%, rgba(15, 48, 119, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 40% at 0% 100%, rgba(161, 190, 208, 0.40), transparent 52%),
    #ffffff;
}

.scan-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: linear-gradient(90deg, #0f3077, #00b1b1);
}

.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.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #00b1b1;
}

.scan-title {
  margin: 0;
  font-size: clamp(1.55rem, 6.5vw, 2.1rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #0f3077;
}

.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, 177, 177, 0.28);
  color: #0f3077;
}

.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, 177, 177, 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, 177, 177, 0.28);
  border-radius: 12px;
  padding: 0.8rem 2.5rem 0.8rem 0.9rem;
  font: 600 16px var(--font);
  color: #0f3077;
  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: #00b1b1;
  box-shadow: 0 0 0 3px rgba(0, 177, 177, 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, 177, 177, 0.2), rgba(15, 58, 102, 0.12));
  box-shadow: inset 0 0 0 1px rgba(0, 177, 177, 0.2);
}

.scanner-reader {
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #0f3077;
  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, 177, 177, 0.15);
  padding-top: 0.65rem;
}

.manual-details summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f3077;
  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: #00b1b1;
  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, 177, 177, 0.28);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  min-height: 48px;
  color: #0f3077;
  background: #fff;
  box-sizing: border-box;
}

.manual-scan input:focus {
  outline: none;
  border-color: #00b1b1;
  box-shadow: 0 0 0 3px rgba(0, 177, 177, 0.15);
}

.page-scan .manual-scan .btn {
  width: 100%;
  border-radius: 12px;
  background: #00b1b1;
  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: #009494;
}

@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, 177, 177, 0.28);
  background: #fff;
  color: #0f3077;
  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: #00b1b1;
  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,
  body.page-admin .app-shell {
    display: block;
    grid-template-columns: none;
    background: transparent;
  }

  body.page-admin .content {
    height: 100%;
  }

  .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,
  body.page-admin .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    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: 0;
    font-size: 0.92rem;
  }
}

@media (min-width: 1100px) {
  body:not(.page-admin) .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 90% 50% at 50% -8%, rgba(0, 177, 177, 0.16), transparent 55%),
    radial-gradient(ellipse 80% 45% at 110% 100%, rgba(15, 48, 119, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 40% at 0% 100%, rgba(161, 190, 208, 0.40), transparent 52%),
    #ffffff;
}

.landing-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: linear-gradient(90deg, #0f3077, #00b1b1);
}

.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(0.82rem, 2.4vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #00b1b1;
  animation: landing-fade 0.8s 0.1s ease both;
}

.landing-title {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(2.05rem, 6.5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #0f3077;
  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: #0f3077;
  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, 177, 177, 0.28);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font: 500 16px var(--font);
  color: #0f3077;
  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: #00b1b1;
  box-shadow: 0 0 0 3px rgba(0, 177, 177, 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: #0f3077;
}

.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, 177, 177, 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, 177, 177, 0.08);
  color: #0f3077;
  font: 700 1.35rem/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.copies-btn:hover:not(:disabled) {
  background: #00b1b1;
  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: 999px;
  padding: 1rem 1.25rem;
  font: 800 1.02rem var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: #00b1b1;
  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, 177, 177, 0.28);
}

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

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

@media (max-width: 640px) {
  .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 / download screen */
.landing-success {
  justify-content: flex-start;
  max-width: 980px;
  gap: 1.15rem;
  padding-top: calc(1.15rem + env(safe-area-inset-top, 0px));
}

.success-brand {
  text-align: center;
  animation: landing-fade 0.7s ease both;
}

.success-brand .landing-course {
  margin-bottom: 0.7rem;
}

.success-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #00b1b1;
}

.success-name {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1.45rem, 4.6vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #0f3077;
}

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

.success-category,
.success-copies {
  display: inline-block;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f3077;
  background: rgba(0, 177, 177, 0.12);
}

.success-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.05rem 0.95rem 1.15rem;
  border: 1px solid rgba(0, 177, 177, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(15, 48, 119, 0.08);
  animation: landing-fade 0.85s 0.12s ease both;
}

.success-panel-head {
  text-align: center;
}

.success-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0f3077;
}

.success-panel-head p {
  margin: 0.28rem 0 0;
  font-size: 0.92rem;
  color: #5a7a96;
}

.success-variants {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.success-variant {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.85rem 0.95rem;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid rgba(15, 48, 119, 0.08);
  border-radius: 16px;
  background: #f5fbfb;
}

.success-variant-num {
  display: none;
}

.success-preview {
  margin: 0;
  width: 92px;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 177, 177, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.success-preview img {
  display: block;
  max-width: calc(100% - 10px);
  max-height: calc(100% - 10px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.success-variant-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.success-variant h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #0f3077;
}

.success-variant p {
  margin: 0 0 0.45rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #5a7a96;
}

.success-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: #00b1b1;
  color: #fff;
  font: 800 0.78rem var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 177, 177, 0.22);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.success-download:hover {
  background: #009494;
}

.success-download:active {
  transform: translateY(1px);
}

.success-copies-list {
  text-align: left;
  border-top: 1px solid rgba(0, 177, 177, 0.14);
  padding-top: 0.9rem;
}

.success-copies-label {
  margin: 0 0 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  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;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(0, 177, 177, 0.16);
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
  color: #0f3077;
}

.success-copy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.success-copies-list a {
  color: #00b1b1;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

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

.success-again {
  display: inline-flex;
  align-self: center;
  margin: 0.15rem 0 0.4rem;
  color: #00b1b1;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

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

@media (min-width: 840px) {
  .success-panel {
    padding: 1.35rem 1.3rem 1.4rem;
  }

  .success-variants {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.95rem;
    align-items: stretch;
  }

  .success-variant {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem 0.95rem 1.05rem;
    text-align: center;
  }

  .success-variant-num {
    display: block;
    position: absolute;
    top: 0.85rem;
    left: 0.9rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #00b1b1;
  }

  .success-preview {
    width: 100%;
    height: 248px;
  }

  .success-variant-body {
    align-items: center;
    flex: 1;
  }

  .success-variant p {
    margin-bottom: 0.7rem;
  }

  .success-download {
    width: 100%;
    margin-top: auto;
    min-height: 46px;
  }
}

/* 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 90% 50% at 50% -8%, rgba(0, 177, 177, 0.16), transparent 55%),
    radial-gradient(ellipse 80% 45% at 110% 100%, rgba(15, 48, 119, 0.12), transparent 50%),
    radial-gradient(ellipse 70% 40% at 0% 100%, rgba(161, 190, 208, 0.40), transparent 52%),
    #ffffff;
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  background: linear-gradient(90deg, #0f3077, #00b1b1);
}

.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: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #00b1b1;
}

.login-title {
  margin: 0;
  font-size: clamp(1.85rem, 6vw, 2.45rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: #0f3077;
}

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

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

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

.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field input {
  width: 100%;
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #5a7a96;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

body.page-login .login-form .landing-field input {
  width: 100%;
  border: 1px solid rgba(0, 177, 177, 0.28);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font: 500 16px var(--font);
  color: #0f3077;
  background: rgba(255, 255, 255, 0.92);
  min-height: 52px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.page-login .login-form .password-field input {
  padding-right: 3rem;
}

body.page-login .login-form .landing-field input:focus {
  outline: none;
  border-color: #00b1b1;
  box-shadow: 0 0 0 3px rgba(0, 177, 177, 0.18);
}

.password-toggle:hover {
  color: #00b1b1;
  background: rgba(0, 177, 177, 0.08);
}

.password-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 177, 177, 0.18);
}

.password-toggle .icon-eye-closed {
  display: none;
}

.password-toggle.is-visible .icon-eye-open {
  display: none;
}

.password-toggle.is-visible .icon-eye-closed {
  display: block;
}

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

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

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

/* —— Phone / tablet polish —— */
@media (max-width: 720px) {
  .sidebar a {
    min-height: 48px;
    font-size: 1rem;
  }

  .sidebar {
    padding-top: calc(1rem + var(--safe-top));
  }

  .btn,
  .btn-sm {
    min-height: 44px;
    touch-action: manipulation;
  }

  .filters input,
  .filters select,
  .field-row input,
  .register-form input,
  .register-form select,
  .fix-name-form input[type="text"],
  .checkpoint-select,
  .manual-scan input {
    font-size: 16px;
    min-height: 48px;
  }

  .landing-title,
  .login-title {
    font-size: clamp(1.55rem, 8vw, 2.1rem);
  }

  .landing-course,
  .login-course,
  .scan-course {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
  }

  .success-name {
    font-size: clamp(1.35rem, 6vw, 1.8rem);
  }

  .success-panel {
    padding: 0.95rem 0.8rem 1.05rem;
    border-radius: 18px;
  }

  .success-download {
    min-height: 44px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }

  .stat-card {
    padding: 0.9rem 0.85rem;
  }

  .stat-card strong {
    font-size: 1.45rem;
  }

  .panel {
    padding: 0.95rem 0.85rem;
    border-radius: 12px;
  }

  .row-actions {
    justify-content: stretch;
  }

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

  .table-wrap {
    overflow: visible;
  }

  .registry-panel {
    padding: 0.75rem;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .registry-panel table,
  .table-wrap table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.7rem;
    box-shadow: var(--shadow-soft);
  }

  .table-wrap tbody tr:hover {
    background: #fff;
  }

  .table-wrap tbody tr:has(.id-card-link),
  .table-wrap tbody tr:has(.id-card-missing) {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 0.85rem;
    row-gap: 0.2rem;
    align-items: start;
  }

  .table-wrap tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
    text-align: right;
  }

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

  .table-wrap tbody td::before {
    content: attr(data-label);
    flex: 0 0 36%;
    text-align: left;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .table-wrap tbody td:not([data-label])::before,
  .table-wrap tbody td[data-label=""]::before {
    content: none;
    flex: 0;
  }

  .table-wrap tbody td:not([data-label]),
  .table-wrap tbody td[data-label=""] {
    justify-content: flex-end;
  }

  .table-wrap tbody tr:has(.id-card-link) td,
  .table-wrap tbody tr:has(.id-card-missing) td {
    grid-column: 2;
  }

  .table-wrap tbody td[data-label="ID card"],
  .table-wrap tbody td[data-label="ID Card"],
  .table-wrap tbody td[data-label="Badge"] {
    grid-column: 1;
    grid-row: 1 / span 6;
    display: block;
    width: auto;
    padding: 0;
    border: none;
    text-align: left;
  }

  .table-wrap tbody td[data-label="ID card"]::before,
  .table-wrap tbody td[data-label="ID Card"]::before,
  .table-wrap tbody td[data-label="Badge"]::before {
    display: none;
  }

  .table-wrap tbody td[data-label="Name"],
  .table-wrap tbody td[data-label="Display name"] {
    display: block;
    text-align: left;
    padding-top: 0;
    border-bottom: none;
    font-weight: 800;
    color: #0f3077;
  }

  .table-wrap tbody td[data-label="Name"]::before,
  .table-wrap tbody td[data-label="Display name"]::before {
    display: none;
  }

  .table-wrap tbody td.row-actions,
  .table-wrap tbody tr:has(.id-card-link) td[data-label=""],
  .table-wrap tbody tr:has(.id-card-missing) td[data-label=""] {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 0.65rem;
    margin-top: 0.2rem;
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }

  .id-card-thumb,
  .registry-panel .id-card-thumb {
    width: 64px;
  }

  .pagination {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .pagination a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.75rem;
  }
}

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

  .stat-total {
    grid-column: auto;
  }
}

@media (hover: none) {
  .btn:hover,
  .landing-cta:hover,
  .id-card-link:hover .id-card-thumb {
    transform: none;
  }
}
