:root {
  --navy: #1d2b45;
  --navy-dark: #14203a;
  --gold: #d8b45a;
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #2b2620;
  --muted: #6b6257;
  --line: #e5e0d8;
  --good: #2e7d32;
  --warn: #e09b00;
  --bad: #c62828;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar .mark {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--gold); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; letter-spacing: -1px;
}
.topbar .titles .kicker {
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold);
}
.topbar .titles h1 { margin: 0; font-size: 18px; font-weight: 700; }

.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }

.progress {
  display: flex; gap: 6px; margin: 4px 0 20px;
}
.progress span {
  flex: 1; height: 6px; border-radius: 3px; background: var(--line);
}
.progress span.done { background: var(--gold); }
.progress span.now { background: var(--navy); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(29,43,69,.06);
}
.card h2 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.card .sub { color: var(--muted); margin: 0 0 20px; line-height: 1.5; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 8px; background: #fdfcfa;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
textarea { min-height: 96px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; border: 0; cursor: pointer; font-family: inherit;
  background: var(--navy); color: #fff; font-size: 16px; font-weight: 600;
  padding: 12px 28px; border-radius: 8px; margin-top: 20px;
}
.btn:hover { background: var(--navy-dark); }
.btn:disabled { background: #b8b2a8; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn.gold { background: var(--gold); color: var(--navy); }

.error { color: var(--bad); font-weight: 600; margin-top: 12px; min-height: 1.2em; }
.uploadrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.uploadrow .or { color: var(--muted); font-weight: 600; }
.btn.slim { margin: 0; padding: 10px 18px; }
.doccam-box { max-width: 560px; }
.doccam-box video, .doccam-box canvas { width: 100%; border-radius: 10px; background: #000; margin-top: 10px; }
.doccam-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.doccam-btns .btn { margin: 0; padding: 12px 20px; }
.face-status { margin-top: 8px; min-height: 1.3em; font-weight: 600; color: var(--muted); }
.face-status.ok { color: var(--good); }
.face-status.bad { color: var(--bad); }
.notice {
  background: #fdf9ef; border: 1px solid #eadfc0; border-radius: 8px;
  padding: 12px 16px; margin: 14px 0; font-size: 14px; line-height: 1.55;
}
.notice.red { background: #fdf4f4; border-color: #ecc9c9; }
ul.rules { line-height: 1.7; padding-left: 20px; }
ul.rules li { margin-bottom: 4px; }

.consent-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; line-height: 1.5; }
.consent-box input { margin-top: 3px; width: 18px; height: 18px; }

.filelist { margin-top: 10px; }
.filelist .fitem {
  display: flex; align-items: center; gap: 10px;
  background: #f8f6f1; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin-bottom: 6px; font-size: 14px;
}
.filelist .fitem .ok { color: var(--good); font-weight: 700; }

.camwrap { text-align: center; margin: 16px 0; }
video, canvas.preview, img.preview {
  width: 100%; max-width: 400px; border-radius: 12px;
  border: 2px solid var(--line); background: #111;
  max-height: 55vh; max-height: 55dvh; object-fit: cover;
}
.hidden { display: none !important; }

/* Test screen */
.testhead {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap;
}
.qcat {
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold); font-weight: 700; background: var(--navy);
  padding: 4px 12px; border-radius: 999px;
}
.qcount { color: var(--muted); font-size: 14px; font-weight: 600; }
.timerbar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 20px; }
.timerbar .fill { height: 100%; background: var(--good); width: 100%; transition: width 1s linear, background .3s; }
.timerbar .fill.low { background: var(--warn); }
.timerbar .fill.crit { background: var(--bad); }
.qtext { font-size: 18px; font-weight: 600; line-height: 1.5; margin-bottom: 18px; user-select: none; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  text-align: left; font-size: 15px; font-family: inherit; cursor: pointer;
  background: #fdfcfa; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 13px 16px; line-height: 1.4; user-select: none;
}
.opt:hover { border-color: var(--navy); }
.opt.sel { border-color: var(--navy); background: #eef1f7; font-weight: 600; }
.monitor-pip {
  position: fixed; right: 14px; bottom: 14px; width: 110px; border-radius: 10px;
  border: 2px solid var(--gold); overflow: hidden; z-index: 50; background: #111;
}
.monitor-pip video { width: 100%; display: block; border: 0; border-radius: 0; }
.monitor-pip .lbl {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 9px; text-align: center;
  background: rgba(20,32,58,.85); color: #fff; padding: 2px 0; letter-spacing: 1px;
}
.warn-overlay {
  position: fixed; inset: 0; background: rgba(20,32,58,.93); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.warn-overlay .box {
  background: #fff; border-radius: 14px; padding: 32px; max-width: 460px; text-align: center;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  overflow-y: auto; box-sizing: border-box; width: 100%;
}
/* camera overlay: keep the preview short enough that the buttons stay on screen */
.doccam-box video, .doccam-box canvas {
  max-height: 50vh; max-height: 50dvh; object-fit: contain;
}
.doccam-box .doccam-btns {
  position: sticky; bottom: 0; background: #fff; padding: 10px 0 2px;
}
@media (max-width: 560px) {
  .warn-overlay { padding: 10px; align-items: flex-start; }
  .warn-overlay .box { padding: 18px 14px; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .doccam-box .sub { font-size: 14px; margin: 4px 0 6px; }
  .doccam-btns .btn { padding: 12px 14px; font-size: 15px; }
}
.warn-overlay h3 { color: var(--bad); margin: 0 0 10px; font-size: 20px; }

.done-ref {
  font-size: 26px; font-weight: 800; color: var(--navy);
  background: #f8f6f1; border: 1.5px dashed var(--gold); border-radius: 10px;
  padding: 14px 20px; display: inline-block; margin: 14px 0; letter-spacing: 1px;
}
.center { text-align: center; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; line-height: 1.6; }
