/* ── Google Fonts ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Variables ───────────────────────────────── */
:root {
  --green:        #00A651;
  --green-light:  #33bb74;
  --green-dark:   #007a3c;
  --green-bg:     #e6f7ed;
  --teal:         #2CADA2;
  --teal-light:   #4ec4ba;
  --teal-bg:      #e6f7f6;
  --white:        #ffffff;
  --off-white:    #f8fafb;
  --gray-100:     #f2f4f6;
  --gray-200:     #e5e8ec;
  --gray-400:     #c2c8d0;
  --gray-600:     #6b7280;
  --gray-800:     #1A1A1A;
  --red:          #e53e3e;
  --red-light:    #fff5f5;
  --orange:       #dd6b20;
  --orange-light: #fffaf0;
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --shadow:       0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
  --transition:   0.22s ease;
  --frame-w:      390px;
  --frame-h:      844px;
}

/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Phone Frame (desktop simulation) ───────── */
#phone-frame {
  width: var(--frame-w);
  height: var(--frame-h);
  background: var(--white);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* On actual mobile, fill viewport */
@media (max-width: 430px) {
  body { background: var(--white); align-items: flex-start; }
  #phone-frame {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ── App container ───────────────────────────── */
#app {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Progress bar ────────────────────────────── */
#progress-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 14px 0 10px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
}
#progress-bar.hidden { display: none; }
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: var(--transition);
}
.dot.active { background: var(--green); transform: scale(1.4); width: 18px; border-radius: 4px; }
.dot.done { background: var(--green-light); }

/* ── Steps ───────────────────────────────────── */
.step {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--white);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.step.active {
  display: flex;
  transform: translateX(0);
}
.step.slide-out {
  display: flex;
  transform: translateX(-100%);
}

.step-header {
  padding: 52px 24px 16px;
  flex-shrink: 0;
}
.step-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-800);
  letter-spacing: -0.3px;
}
.step-header p {
  font-size: 14px;
  color: var(--gray-600);
  margin-top: 4px;
}

.step-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}

.step-footer {
  padding: 14px 20px 30px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--white);
}
.step-footer .btn { flex: 1; }

.step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.step-content.centered {
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 28px;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  transition: var(--transition);
  flex: none;
  text-align: center;
  letter-spacing: -0.1px;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--green); color: var(--white); box-shadow: 0 2px 8px rgba(0,166,81,0.25); }
.btn-primary:hover:not(:disabled) { background: var(--green-light); box-shadow: 0 4px 12px rgba(0,166,81,0.35); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1.5px solid var(--gray-200);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-200); }

.btn-large { padding: 10px 20px; font-size: 15px; border-radius: 12px; }

.btn-icon {
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--gray-600); padding: 4px 8px;
}

/* ── Welcome ─────────────────────────────────── */
#step-welcome {
  background: var(--white);
  flex-direction: column;
}
.welcome-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px 36px;
  flex-shrink: 0;
}
.welcome-logo {
  width: 160px;
  height: auto;
  display: block;
}
.welcome-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px 36px;
}
.welcome-headline {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
  line-height: 1.15;
  margin-bottom: 6px;
  text-align: center;
}
.welcome-sub {
  font-size: 14px;
  color: var(--gray-600);
  text-align: center;
}
.welcome-features {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 2px;
  gap: 10px;
}
.feature-line {
  width: 78%;
  font-size: 13px;
  color: var(--gray-800);
  font-weight: 500;
  line-height: 1;
  text-align: center;
  padding: 10px 16px;
  background: var(--green-bg);
  border-radius: 4px;
}
#btn-start {
  width: 100%;
  background: var(--green);
  color: var(--white);
  flex-shrink: 0;
}

/* ── Name Form (Step 1) ──────────────────────── */
#step-name {
  background: var(--white);
}
.name-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px 36px;
  flex-shrink: 0;
}
.name-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px 36px;
}
.name-headline {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
  text-align: center;
  margin-bottom: 6px;
}
.name-sub {
  font-size: 14px;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 40px;
}
.name-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: auto;
}
.name-body .btn {
  width: 100%;
  margin-top: 32px;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field-group input[type="text"] {
  padding: 15px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-800);
  background: var(--off-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
}
.field-group input[type="text"]:focus {
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,166,81,0.10);
}
.field-group input[type="text"]::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

/* ── Camera step ─────────────────────────────── */
#step-camera { background: var(--white); }
.camera-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px 36px;
  flex-shrink: 0;
}
.camera-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px 32px;
}
.camera-headline {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
  text-align: center;
  margin-bottom: 6px;
}
.camera-sub {
  font-size: 14px;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 20px;
}
.camera-viewport {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: #111;
  flex-shrink: 0;
  margin-top: 20px;
}
#camera-video {
  /* hidden behind canvas — canvas renders the cropped mirrored frame */
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
#camera-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  display: block;
}
.camera-overlay-msg {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
  color: var(--white);
  gap: 12px;
  font-size: 15px;
}
#camera-status-bar {
  width: 100%;
  margin-top: 14px;
  text-align: center;
  pointer-events: none;
}
#camera-message {
  display: inline-block;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 40px;
  border: 1.5px solid rgba(255,255,255,0.18);
  letter-spacing: 0.01em;
}
.camera-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}
.btn-capture {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  border: none;
  cursor: pointer;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(0,166,81,0.35);
}
.btn-capture:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-capture:not(:disabled):hover { transform: scale(1.06); }
.capture-ring {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--white);
  display: block;
}
.camera-hint {
  color: var(--gray-400);
  font-size: 12px;
  text-align: center;
}

/* Countdown */
#capture-countdown { display: flex; align-items: center; justify-content: center; }
#capture-countdown.hidden { display: none; }
.countdown-ring {
  position: relative; width: 60px; height: 60px;
}
.countdown-ring svg { transform: rotate(-90deg); }
.countdown-track { fill: none; stroke: rgba(255,255,255,0.2); stroke-width: 4; }
.countdown-fill {
  fill: none; stroke: var(--green); stroke-width: 4;
  stroke-dasharray: 163; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
#countdown-number {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 22px; font-weight: 700;
}

/* ── Photo Preview ───────────────────────────── */
/* ── Photo Preview ───────────────────────────── */
.photo-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 32px 36px;
  flex-shrink: 0;
}
.photo-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 28px 36px;
  min-height: 0;
}
.photo-headline {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
  text-align: center;
  margin-bottom: 6px;
}
.photo-sub {
  font-size: 14px;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 24px;
}
.photo-processing {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  color: var(--gray-600);
}
.photo-processing p { font-size: 15px; font-weight: 500; }
.processing-sub { font-size: 13px; color: var(--gray-400) !important; }
#photo-result {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
#photo-result.hidden { display: none; }
.photo-preview-card {
  width: 200px; height: 200px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border: 3px solid var(--green-bg);
}
.photo-preview-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-meta {
  font-size: 12px;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 7px 14px;
  border-radius: 20px;
  font-weight: 500;
}
.photo-ok-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-bg);
  color: var(--green-dark);
  font-size: 13px; font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
}
/* Quality gate error panel */
#photo-quality-error.hidden { display: none; }
.photo-preview-card--dim img { filter: brightness(0.65) saturate(0.5); }
.quality-error-box {
  background: #fff3cd;
  border: 1.5px solid #f0ad4e;
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 10px;
  width: 100%;
  max-width: 300px;
  text-align: left;
}
.quality-error-title {
  font-size: 14px;
  font-weight: 700;
  color: #7d4e00;
  margin-bottom: 8px;
}
.quality-issue-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #5c3d00;
  line-height: 1.6;
}
.photo-footer {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}
.photo-footer .btn { flex: 1; }

/* ── Content Header (Steps 4–8: compact logo bar) ── */
.content-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 28px 18px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--gray-200);
}
.content-logo {
  width: 120px;
  height: auto;
  display: block;
  margin-bottom: 14px;
}
.content-headline {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.4px;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.15;
}
.content-sub {
  font-size: 13px;
  color: var(--gray-600);
  text-align: center;
  line-height: 1.4;
}

/* ── Document Selection ──────────────────────── */
.doc-section { margin-bottom: 20px; }
.doc-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.doc-options { display: flex; flex-direction: column; gap: 7px; }
.doc-option {
  display: flex; align-items: flex-start; gap: 0;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
  background: var(--off-white);
}
.doc-option:hover { border-color: var(--teal); background: var(--white); }
.doc-option input[type="radio"] { display: none; }
.doc-option input:checked ~ .doc-option-body {
  background: var(--green-bg);
  border-left: 3px solid var(--green);
}
.doc-option:has(input:checked) {
  border-color: var(--green);
  background: var(--white);
}
.doc-option-body {
  flex: 1;
  padding: 11px 13px;
  display: flex; flex-direction: column; gap: 2px;
  position: relative;
}
.doc-option-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.doc-option-sub { font-size: 11px; color: var(--gray-600); line-height: 1.4; }
.doc-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
  margin-top: 4px;
  width: fit-content;
  letter-spacing: 0.02em;
}
.doc-badge.dual { background: var(--teal-bg); color: var(--teal); }

.dual-notice {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-bg);
  border: 1px solid rgba(0,166,81,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--green-dark);
  font-weight: 500;
  margin-bottom: 10px;
}
.dual-notice.hidden { display: none; }

/* ── ID Capture ──────────────────────────────── */
.id-capture-card {
  border: 2px dashed var(--gray-300, #d1d5db);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--off-white);
  transition: var(--transition);
}
.id-capture-card.done {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-bg);
}
.id-capture-label {
  font-size: 14px; font-weight: 600;
  color: var(--gray-800); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.id-capture-label .check { color: var(--green); font-size: 16px; }
.id-capture-preview {
  width: 100%; height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block; margin-bottom: 8px;
}
.id-capture-btns {
  display: flex; gap: 8px;
}
.id-capture-btns .btn { padding: 10px; font-size: 13px; }

/* Camera modal */
.modal {
  position: absolute; inset: 0;
  z-index: 200;
  background: #000;
  display: flex; flex-direction: column;
}
.modal.hidden { display: none; }
.modal-inner { display: flex; flex-direction: column; height: 100%; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #111;
  color: var(--white);
  font-size: 15px; font-weight: 600;
  flex-shrink: 0;
}
.id-camera-container { flex: 1; position: relative; overflow: hidden; }
#id-camera-video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.id-guidance-text {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  text-align: center;
}
#btn-id-capture { margin: 14px 16px 24px; }

/* ── Validation ──────────────────────────────── */
.validation-steps {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.val-step {
  display: flex; align-items: center; gap: 12px;
  background: var(--off-white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color 0.3s;
}
.val-step:has(.val-icon.success) { border-color: rgba(0,166,81,0.3); background: var(--green-bg); }
.val-step:has(.val-icon.fail) { border-color: rgba(229,62,62,0.3); background: var(--red-light); }
.val-step:has(.val-icon.warn) { border-color: rgba(221,107,32,0.3); background: var(--orange-light); }
.val-icon { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.val-icon.success::after { content: '✓'; color: var(--green); font-size: 18px; font-weight: 700; }
.val-icon.fail::after { content: '✗'; color: var(--red); font-size: 18px; font-weight: 700; }
.val-icon.warn::after { content: '!'; color: var(--orange); font-size: 18px; font-weight: 700; }
.val-text { display: flex; flex-direction: column; gap: 2px; }
.val-label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.val-detail { font-size: 12px; color: var(--gray-600); }

.error-box {
  background: var(--red-light);
  border: 1.5px solid rgba(229,62,62,0.4);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #c53030;
  font-size: 13px;
  line-height: 1.5;
  width: 100%; max-width: 340px;
  margin-top: 6px;
}
.error-box.hidden { display: none; }
.warn-box {
  background: var(--orange-light);
  border: 1.5px solid rgba(221,107,32,0.4);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #9c4221;
  font-size: 13px;
  line-height: 1.5;
  width: 100%; max-width: 340px;
  margin-top: 6px;
  white-space: pre-line;
}
#val-override {
  width: 100%; max-width: 340px;
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 10px;
}
#val-override.hidden { display: none; }
.checkbox-label {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  font-size: 13px; color: var(--gray-800);
  line-height: 1.4;
}
.checkbox-label input { margin-top: 2px; flex-shrink: 0; accent-color: var(--green); }

/* ── Processing overlay ──────────────────────── */
.processing-overlay {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--gray-600);
  padding: 24px;
}
.processing-overlay p {
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-600);
}

/* ── ID Crop ─────────────────────────────────── */
.crop-pair { margin-bottom: 22px; }
.crop-pair-label {
  font-size: 11px; font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.crop-images { display: flex; gap: 10px; }
.crop-before, .crop-after {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
}
.crop-before span, .crop-after span {
  font-size: 11px; color: var(--gray-600); text-align: center; font-weight: 500;
}
.crop-before img, .crop-after img {
  width: 100%; border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  display: block;
}
.crop-after img { border-color: var(--green); }

/* ── Final Preview ───────────────────────────── */
.preview-card {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.preview-card-header {
  padding: 10px 14px;
  background: var(--green-bg);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-card-header span {
  font-size: 13px; font-weight: 600; color: var(--green-dark);
}
.preview-card-check {
  width: 22px; height: 22px;
  background: var(--green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px;
}
.preview-card img {
  width: 100%;
  display: block;
  max-height: 200px;
  object-fit: contain;
  background: var(--gray-100);
}

/* ── Spinners ────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spinner.large { width: 44px; height: 44px; border-width: 4px; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; }

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

/* ── Gate page ───────────────────────────────── */
.gate-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 0 28px;
  background: #fff;
}
.gate-logo-section {
  padding: 36px 0 20px;
  display: flex;
  justify-content: center;
}
.gate-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  padding-top: 12px;
}
.gate-lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.gate-headline {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 16px;
}
.gate-message {
  font-size: 15px;
  color: var(--gray-600);
  line-height: 1.6;
  margin-bottom: 16px;
}
.gate-link {
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
}
.gate-note {
  font-size: 13px;
  color: var(--gray-400);
  line-height: 1.6;
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.gate-divider {
  width: 48px;
  height: 1px;
  background: var(--gray-200);
  margin-bottom: 24px;
}
.gate-nurse-btn {
  width: 100%;
  max-width: 280px;
  font-size: 14px;
}

/* ── Nurse Login Form ─────────────────────────── */
.nurse-login-form {
  width: 100%;
  max-width: 280px;
}
.nurse-login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nurse-login-form .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700, #374151);
  text-align: left;
}
.nurse-login-form .form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-300, #d1d5db);
  border-radius: 10px;
  font-size: 15px;
  color: var(--gray-900, #111827);
  background: #fff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.nurse-login-form .form-input:focus {
  border-color: var(--primary, #2d6a4f);
}
.nurse-login-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff1f1;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 13px;
  text-align: left;
  line-height: 1.4;
}
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  padding: 8px 0;
}
.btn-ghost:hover { color: var(--gray-700, #374151); }

/* ── Log FAB + Drawer ─────────────────────────── */
#log-fab {
  position: absolute;
  bottom: 14px; right: 14px; z-index: 200;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(30,30,30,0.82);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: background 0.15s;
  line-height: 1;
}
#log-fab:hover { background: rgba(0,0,0,0.95); }

#log-drawer {
  position: absolute;
  bottom: 0; left: 0; right: 0; z-index: 199;
  height: 0;
  overflow: hidden;
  background: #111;
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  transition: height 0.28s ease;
}
#log-drawer.log-open { height: 58%; }

#log-drawer-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  font-size: 12px; font-weight: 600;
  color: #bbb;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}
#log-entry-count { font-weight: 400; color: #666; margin-left: 4px; }

.log-hdr-btn {
  background: #222; border: 1px solid #333; color: #aaa;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  cursor: pointer; line-height: 1.4;
}
.log-hdr-btn:hover { background: #333; color: #fff; }

#log-list {
  overflow-y: auto; flex: 1;
  padding: 4px 0 8px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 10.5px;
}
#log-list::-webkit-scrollbar { width: 4px; }
#log-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.logr {
  display: grid;
  grid-template-columns: 88px 72px 1fr;
  gap: 0 6px;
  padding: 2px 10px;
  border-bottom: 1px solid #1a1a1a;
  line-height: 1.5;
}
.logr:hover { background: #1a1a1a; }
.logr-ts   { color: #555; white-space: nowrap; }
.logr-cat  { color: #5a9; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logr-evt  { color: #ccc; word-break: break-word; }
.logr-data { color: #888; margin-left: 4px; }
.logr--debug .logr-evt { color: #666; }
.logr--info  .logr-evt { color: #ccc; }
.logr--warn  .logr-evt { color: #ff9800; }
.logr--error .logr-evt { color: #f44336; }

/* ── Debug Panel ─────────────────────────────── */
.dbg-toggle {
  width: 100%;
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.dbg-toggle:hover { background: var(--gray-200); }
.dbg-body {
  margin-top: 6px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-xs);
  overflow: hidden;
  font-size: 11px;
  background: var(--gray-100);
}
.dbg-row {
  display: flex;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--gray-200);
}
.dbg-row:last-child { border-bottom: none; }
.dbg-key {
  color: var(--gray-600);
  flex-shrink: 0;
  width: 52%;
  font-weight: 500;
}
.dbg-val {
  color: var(--gray-800);
  font-family: 'Courier New', monospace;
  word-break: break-all;
  flex: 1;
}

/* ── Session Done Screen ─────────────────────── */
#step-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  text-align: center;
}
.done-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 320px;
}
.done-check-ring {
  width: 80px;
  height: 80px;
  animation: done-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes done-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
.done-headline {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.5px;
}
.done-sub {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.5;
}
.done-badges {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.done-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--green-bg);
  border: 1.5px solid #c3e6d0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--green-dark);
  text-align: left;
}
.done-badge-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.done-note {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.6;
  border-top: 1px solid var(--gray-200);
  padding-top: 16px;
  width: 100%;
}

/* ── Utility ─────────────────────────────────── */
.hidden { display: none !important; }
