:root {
  --navy-950: #02040A; --navy-900: #080F20; --navy-800: #0D1B36; --navy-700: #132649;
  --sky-500: #2165E8; --sky-400: #3373ED; --sky-300: #8FB7FF; --sky-soft: rgba(51, 115, 237, .16);
  --ink: #F4F7FF; --muted: #AAB5C9; --line: rgba(145, 181, 255, .14); --line-2: rgba(145, 181, 255, .28);
  --ok: #5BD69A; --amber: #FFC66B; --red: #FF8080;
  --r: 10px; --r-lg: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.55;
  color: var(--ink); background: radial-gradient(1200px 600px at 50% -200px, #12306a 0%, var(--navy-900) 60%) fixed, var(--navy-900); min-height: 100vh; }
a { color: var(--sky-300); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 16px; border-bottom: 1px solid var(--line);
  background: rgba(8, 15, 32, .8); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand span { padding-left: .7rem; border-left: 1px solid var(--line-2); color: var(--muted); font-weight: 500; }
.who { display: flex; align-items: center; gap: .6rem; }
.who form { margin: 0; }
.who-name { font-weight: 500; }
.pill { font-size: .72rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.pill-admin { color: var(--sky-300); border-color: rgba(143, 183, 255, .5); background: var(--sky-soft); }

.wrap { max-width: 760px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.card { background: rgba(13, 27, 54, .85); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; margin-bottom: 1rem;
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .65); }
.card.center { text-align: center; }
.login { max-width: 420px; margin: 3rem auto; }
.login form { display: grid; gap: .8rem; margin-top: 1rem; }

.input { width: 100%; font: inherit; font-size: 16px; /* 16px+ stops iPhones zooming in on tap */ color: var(--ink); background: var(--navy-950); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: .65rem .8rem; min-height: 44px; }
.input:focus { outline: 2px solid var(--sky-400); outline-offset: 1px; border-color: transparent; }
.input[readonly] { color: var(--muted); }
.input.code { font-size: 1.4rem; letter-spacing: .4em; text-align: center; }
textarea.input { resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.field { display: grid; gap: .3rem; }
.field > span { font-size: .85rem; color: var(--muted); }
.field b { color: var(--red); font-weight: 500; }
.field i { font-style: normal; opacity: .75; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted); }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--sky-400); }

.btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border-radius: var(--r);
  padding: .6rem 1.1rem; min-height: 44px; border: 1px solid transparent; cursor: pointer; color: var(--ink); background: transparent; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--sky-500); border-color: var(--sky-400); }
.btn-primary:hover:not(:disabled) { background: var(--sky-400); }
.btn-ghost { border-color: var(--line-2); }
.btn-ghost:hover { background: var(--sky-soft); }
.btn-sm { min-height: 34px; padding: .3rem .75rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1rem; }

.alert { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: var(--r); background: rgba(255, 96, 96, .14); color: var(--red); font-size: .9rem; }
.check-row { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-top: .9rem; }
.check-row .input { font-size: 1.1rem; }

.result-title { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; margin: 0 0 .2rem; }
.result-title + .muted { margin-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(91, 214, 154, .18); }
.dot-list { background: var(--sky-300); box-shadow: 0 0 0 4px var(--sky-soft); }
.dot-new { background: var(--amber); box-shadow: 0 0 0 4px rgba(255, 198, 107, .16); }
.result-registered, .result-done { border-color: rgba(91, 214, 154, .35); }

.reg { display: grid; gap: 1rem; margin-top: 1rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.locked { display: flex; gap: .5rem; align-items: center; }
.came { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; padding: .9rem; border: 1px dashed var(--line-2); border-radius: var(--r); }
.picker { position: relative; }
.picker-list { list-style: none; margin: .3rem 0 0; padding: .3rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--navy-950);
  max-height: 260px; overflow: auto; position: absolute; left: 0; right: 0; z-index: 3; }
.picker-list button { width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 8px; padding: .5rem .6rem; cursor: pointer; display: grid; }
.picker-list button:hover, .picker-list button:focus { background: var(--sky-soft); outline: none; }
.picker-list small { color: var(--muted); }
.picker-list .empty { padding: .5rem .6rem; font-size: .9rem; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .5rem .5rem .8rem; border-radius: var(--r);
  background: var(--sky-soft); border: 1px solid rgba(143, 183, 255, .4); font-weight: 500; min-height: 44px; }

.photo-pick { display: flex; align-items: center; gap: .6rem; }
.photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; background: var(--navy-700); }
.photo.initials { display: grid; place-items: center; font-weight: 600; font-size: 1.4rem; color: var(--sky-300); }

.person { margin-top: .8rem; }
.card.person { margin-top: 0; }
.person-head { display: flex; gap: .9rem; align-items: center; margin-bottom: .8rem; }
.person-head p { margin: .1rem 0 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .88rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.back { font-size: .9rem; }

.photo-pick { flex-wrap: wrap; }
.photo-pick .photo { width: 88px; height: 88px; }
.camera { position: fixed; inset: 0; z-index: 20; background: rgba(2, 4, 10, .88); display: grid; place-items: center; padding: 16px; }
.camera-box { width: min(560px, 100%); display: grid; gap: .9rem; }
.camera-view { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #000; border: 1px solid var(--line-2); }
.camera-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-view video.is-mirrored { transform: scaleX(-1); }
.camera-guide { position: absolute; inset: 12%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .45); pointer-events: none; }
.camera-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .6rem; }
.camera-actions .btn-ghost:last-child { justify-self: end; }
.camera-actions .btn-ghost:first-child { justify-self: start; }
.btn-shutter { width: 72px; height: 72px; border-radius: 50%; padding: 0; border: 4px solid #fff; background: transparent; }
.btn-shutter span { width: 54px; height: 54px; border-radius: 50%; background: #fff; display: block; transition: transform .1s; }
.btn-shutter:active span { transform: scale(.88); }

/* ---------------------------------------------------------------- phones and small tablets */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.top { padding-top: max(.8rem, env(safe-area-inset-top)); flex-wrap: nowrap; }
.brand { min-width: 0; }
.brand img { flex: none; }
.who { flex: none; }
.wrap { padding-bottom: max(3rem, calc(env(safe-area-inset-bottom) + 2rem)); }
.btn svg { flex: none; }
.picker-list button { min-height: 48px; }

@media (max-width: 620px) {
  .grid, .came { grid-template-columns: 1fr; }
  .came { padding: .75rem; }
  .top { padding-left: 12px; padding-right: 12px; gap: .5rem; }
  .brand { gap: .5rem; }
  .brand img { height: 26px; width: auto; }
  .brand span { padding-left: .5rem; font-size: .85rem; }
  .who { gap: .4rem; }
  .who-name { display: none; }
  .signout-label { display: none; }
  .who .btn-sm { min-width: 40px; min-height: 36px; padding: .3rem .55rem; }
  .wrap { padding: 1rem 12px 2.5rem; }
  .card { padding: 1rem; border-radius: 14px; }
  h1 { font-size: 1.2rem; }
  .login { margin: 1.5rem auto; }
  .check-row .input { font-size: 18px; }
  /* photo: preview on top, the two buttons side by side, Remove under them */
  .photo-pick { display: grid; grid-template-columns: 1fr 1fr; }
  .photo-pick .photo { grid-column: 1 / -1; justify-self: center; width: 112px; height: 112px; }
  .photo-pick .btn { width: 100%; min-height: 44px; }
  .photo-pick [data-photo-clear] { grid-column: 1 / -1; }
  /* main actions: full width, primary first under the thumb */
  .btn-row { display: grid; grid-template-columns: 1fr; gap: .5rem; }
  .reg .btn-row { grid-template-columns: 1fr 1.4fr; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: .55rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
  .facts dt:first-child { margin-top: 0; }
  .person-head .photo { width: 56px; height: 56px; }
  .picker-list { max-height: 50vh; }
}
@media (max-width: 360px) {
  .brand span { display: none; }  /* logo alone on the narrowest phones */
  .pill { font-size: .68rem; padding: .1rem .45rem; }
  .check-row { gap: .45rem; }
  .check-row .btn { padding: .6rem .8rem; }
  .photo-pick .btn { font-size: .8rem; padding: .3rem .4rem; gap: .3rem; white-space: nowrap; }
}

/* camera: always fits the screen, portrait or landscape */
.camera { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.camera-box { width: min(560px, 100%, calc(100dvh - 130px)); }
@supports not (height: 100dvh) { .camera-box { width: min(560px, 100%, calc(100vh - 130px)); } }
@media (max-width: 380px) {
  .camera-actions .btn-ghost { padding: .5rem .6rem; font-size: .85rem; }
  .btn-shutter { width: 64px; height: 64px; }
  .btn-shutter span { width: 46px; height: 46px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .camera-box { width: auto; grid-template-columns: auto auto; align-items: center; }
  .camera-view { height: calc(100dvh - 32px); width: auto; }
  .camera-actions { grid-template-columns: 1fr; justify-items: center; }
  .camera-actions .btn-ghost:first-child, .camera-actions .btn-ghost:last-child { justify-self: center; }
  .camera-box .alert { grid-column: 1 / -1; }
}
