@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/space-grotesk-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  /* Matches admin/detail.html's near-black / blue-accent theme (admin.css --a-*). */
  --bg: #0a0e14;
  --bg-soft: #0d1219;
  --surface: rgba(16, 21, 31, 0.82);
  --surface-strong: rgba(13, 18, 25, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7ecf5;
  --muted: rgba(231, 236, 245, 0.55);
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --success: #5cfa8e;
  --warning: #ffbd59;
  --danger: #ff5575;
  --shadow: rgba(2, 5, 10, 0.6);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.12), transparent 55%),
    radial-gradient(circle at 80% 0%, rgba(96, 165, 250, 0.12), transparent 45%),
    linear-gradient(180deg, #05070c, #030509 68%, #020304);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 140px 140px;
  opacity: 0.7;
  pointer-events: none;
  z-index: -1;
}

.page {
  min-height: 100vh;
  padding: 40px 24px 48px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.shell {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.hero {
  text-align: center;
  max-width: 720px;
}

.eyebrow {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  margin: 8px 0 12px;
  line-height: 1.18;
  text-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.lede {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
}

.capture-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
}

@media (min-width: 900px) {
  .capture-block {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
  }
}

.capture-frame {
  width: min(480px, 92vw);
  aspect-ratio: 3 / 2;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  position: relative;
  box-shadow: 0 30px 80px rgba(2, 8, 20, 0.9);
}

.capture-frame.portrait {
  aspect-ratio: 3 / 4;
}

.capture-frame video,
.capture-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mirror-feed video,
.mirror-feed canvas {
  transform: scaleX(-1);
  transform-origin: center;
}

.capture-frame canvas {
  pointer-events: none;
}

.quality-toast {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(5, 8, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.8rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 15px 40px rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.countdown.show {
  opacity: 1;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(9, 13, 27, 0.65);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.pill::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 12px transparent;
}

.pill.ok {
  color: var(--success);
  border-color: rgba(92, 250, 142, 0.5);
}

.pill.ok::before {
  background: var(--success);
  box-shadow: 0 0 16px rgba(92, 250, 142, 0.5);
}

.pill.warn {
  color: var(--warning);
  border-color: rgba(255, 189, 89, 0.5);
}

.pill.warn::before {
  background: var(--warning);
}

.actions {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

button.primary {
  border: none;
  border-radius: 18px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #030712;
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
}

button.primary:active {
  transform: scale(0.98);
}

button.primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

button.primary.success {
  background: linear-gradient(120deg, var(--success), #43c779);
  color: #03140a;
}

button.ghost,
button.link,
button.secondary {
  border-radius: 16px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

button.ghost:active {
  transform: scale(0.99);
}

button.link {
  border: none;
  text-decoration: underline;
  padding: 0;
  align-self: flex-start;
}

.challenge-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 28px;
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: 0 18px 45px rgba(0, 6, 18, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.challenge-panel h3 {
  margin: 0;
  font-size: 1.1rem;
}

.challenge-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.challenge-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  transition: all 0.2s;
}

.challenge-item::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.challenge-item.active {
  border-color: rgba(59, 130, 246, 0.6);
  color: var(--text);
}

.challenge-item.active::before {
  background: var(--accent);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.8);
}

.challenge-item.done {
  border-color: rgba(92, 250, 142, 0.6);
  color: var(--success);
}

.challenge-item.done::before {
  content: '✓';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(92, 250, 142, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  font-size: 0.8rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--accent), var(--success));
  transition: width 0.3s ease;
}

.preview-row {
  width: 100%;
  background: rgba(8, 13, 30, 0.65);
  border-radius: 28px;
  border: 1px solid var(--border);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
}

.preview-row[hidden] {
  display: none;
}

.preview-frames {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-frames > img {
  width: 100%;
  border-radius: 18px;
  object-fit: cover;
}

.preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preview-strip img {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.preview-meta {
  align-self: center;
}

.preview-title {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--muted);
}

.preview-meta ul {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.ai-note,
.liveness-meta {
  width: min(560px, 100%);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.challenge-panel small {
  color: var(--muted);
}

.review-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.review-card {
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.55);
}

.review-card img {
  width: 100%;
  border-radius: 18px;
  margin-top: 16px;
}

.review-card ul {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}

.payload-card {
  width: 100%;
  background: var(--surface-strong);
  border-radius: 28px;
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.55);
}

.payload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.payload-header span {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

.payload-card pre {
  margin: 18px 0 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 20px;
  padding: 18px;
  color: #aee2ff;
  font-size: 0.85rem;
  max-height: 320px;
  overflow: auto;
}

.payload-card button {
  border-radius: 14px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.secondary-actions {
  width: min(420px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.secondary-actions button {
  border: none;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 40;
}

.loader {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

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

.alert {
  width: min(420px, 100%);
  text-align: center;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--warning);
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  .challenge-panel,
  .payload-card,
  .review-card,
  .preview-row {
    border-radius: 20px;
  }
}

/* ── Selection phase ─────────────────────────────────────────────────────── */

.select-block {
  width: min(680px, 100%);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.select-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.select-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin: 0;
}

/* Country search */
.country-search-wrap {
  position: relative;
  width: 100%;
}

.country-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 27, 0.7);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}

.country-input::-webkit-search-cancel-button { display: none; }

.country-input:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.country-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(6, 9, 22, 0.97);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 6px;
  list-style: none;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.country-list.is-open {
  display: block;
}

.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.country-item:hover,
.country-item.hovered {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text);
}

.ci-flag { font-size: 1.3rem; line-height: 1; }

.ci-name {
  flex: 1;
  font-size: 0.95rem;
}

.ci-name mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.ci-code {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

.country-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  list-style: none;
}

.selected-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(92, 250, 142, 0.4);
  background: rgba(92, 250, 142, 0.06);
  font-size: 0.95rem;
  color: var(--success);
}

.selected-tag[hidden] {
  display: none;
}

.tag-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Document type grid */
.doc-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 560px) {
  .doc-type-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.doc-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px 16px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 27, 0.55);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
  text-align: center;
}

.doc-type-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.05);
  color: var(--text);
  transform: translateY(-2px);
}

.doc-type-card.selected {
  border-color: rgba(92, 250, 142, 0.7);
  background: rgba(92, 250, 142, 0.08);
  color: var(--success);
  box-shadow: 0 0 0 1px rgba(92, 250, 142, 0.2);
}

.doc-icon {
  font-size: 2rem;
  line-height: 1;
}

.doc-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: inherit;
}

.doc-hint {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.75;
}

/* ── Capture phase additions ─────────────────────────────────────────────── */

.capture-breadcrumb {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 10px;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.back-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

.doc-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.06);
  font-size: 0.9rem;
  color: var(--accent);
}

/* Passport capture frame: taller aspect ratio */
.capture-frame.passport-mode {
  aspect-ratio: 17 / 12;
}

/* Quality score bar label */
.quality-score-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quality-score-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

/* Inline check items */
.quality-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qcheck {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: 12px;
}

.qcheck::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.qcheck-ok {
  color: var(--success);
  background: rgba(92, 250, 142, 0.06);
}

.qcheck-ok::before {
  background: var(--success);
  box-shadow: 0 0 8px rgba(92, 250, 142, 0.5);
}

.qcheck-warn {
  color: var(--warning);
  background: rgba(255, 189, 89, 0.06);
}

.qcheck-warn::before {
  background: var(--warning);
}

/* ── Take Picture button inside quality panel ───────────────────────────── */
.take-btn {
  margin-top: 16px;
  width: 100%;
}

/* ── Capture step indicator ─────────────────────────────────────────────── */
.capture-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.step-dot {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
}

.step-dot.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.step-dot.done {
  background: rgba(92, 250, 142, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.step-sep {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ── Upload panel ───────────────────────────────────────────────────────── */
.upload-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.upload-copy h3 {
  margin: 4px 0 6px;
  font-size: 1.25rem;
}

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

.upload-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-btn {
  flex: 1 1 180px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-btn:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

.upload-title {
  font-weight: 600;
}

.upload-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Flip prompt ─────────────────────────────────────────────────────────── */
.flip-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  margin: 16px 0;
}

.flip-icon {
  font-size: 3rem;
  animation: spin-once 0.6s ease-out;
}

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(180deg); }
}

.flip-prompt h2 {
  margin: 0;
  font-size: 1.4rem;
}

.flip-prompt p {
  margin: 0;
  color: var(--muted);
  max-width: 280px;
}

/* ── Preview images (front + back) ───────────────────────────────────────── */
.preview-images {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-image-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preview-image-wrap[hidden] {
  display: none;
}

.preview-image-wrap img {
  width: 140px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.preview-frames {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-frames > img {
  width: 100%;
  max-width: 260px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
}

#face-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#face-preview-strip img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* ── ID capture: compact single-screen layout ────────────────────────────── */
.id-page .page { padding-top: 28px; }

.id-page .shell {
  gap: 16px;
}

.id-page .hero.id-hero {
  max-width: 100%;
  width: 100%;
}

.id-page .capture-breadcrumb {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.id-page .capture-steps {
  margin-bottom: 0;
}

.id-page .hero h1 {
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  margin: 0;
  line-height: 1.3;
}

.id-page .capture-block {
  gap: 16px;
}

.id-page .challenge-panel.compact-panel {
  padding: 16px;
  gap: 12px;
}

.id-page .quality-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.id-page .qcheck {
  font-size: 0.78rem;
  padding: 6px 8px;
}

.id-page .take-btn {
  margin-top: 0;
}

.upload-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.upload-inline-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.upload-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.upload-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(59, 130, 246, 0.06);
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--muted);
  flex-basis: 100%;
}

.id-page .preview-row {
  padding: 14px 16px;
  gap: 12px;
}

.id-page .preview-image-wrap img {
  width: 108px;
}

.quality-list-compact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.quality-list-compact li {
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

.id-page .actions {
  margin-top: 0;
}

#capture-steps[hidden],
#upload-back-label[hidden] {
  display: none;
}

.loading-hint {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  max-width: 320px;
  margin: 0;
  line-height: 1.5;
}

.loading-hint.loading-warn {
  color: var(--warning);
}

.capture-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px auto 0;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 189, 89, 0.35);
  background: rgba(255, 189, 89, 0.08);
  color: var(--warning);
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 480px;
  text-align: left;
}

/* ── Upload crop editor ──────────────────────────────────────────────────── */
.crop-panel {
  width: min(420px, 92vw);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(2, 8, 20, 0.9);
}

.crop-title {
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.crop-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.crop-stage {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  touch-action: none;
  cursor: grab;
  border: 1px solid var(--border);
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage img {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.crop-frame-edge {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 18px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(2, 6, 16, 0.45);
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.crop-zoom-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.crop-zoom-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.crop-actions button {
  padding: 10px 18px;
}

@media (max-width: 640px) {
  .id-page .page { padding-top: 20px; }
}
