/* Trang điện thoại (P4): wizard 4 bước + màn hình chụp thẻ. Dùng biến màu của styles.css. */
[hidden] { display: none !important; }

.app-notice { margin: 12px 16px 0; }

/* Thanh tiến trình */
.wz-progress {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
}
.wz-progress li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}
.wz-progress li span {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e5e7eb; color: #374151; font-weight: 700;
}
.wz-progress li.done span { background: var(--success-color); color: #fff; }
.wz-progress li.active span { background: var(--primary-color); color: #fff; box-shadow: 0 0 0 3px rgba(0, 90, 60, 0.2); }
.wz-progress li.active { color: var(--primary-color); font-weight: 600; }

.wz-step h2 { font-size: 1.05rem; }
.wz-gap { margin-top: 10px; }
.wz-row { display: flex; gap: 10px; margin-top: 12px; }
.wz-row .btn { flex: 1; font-size: 0.95rem; padding: 12px 8px; }
.wz-note { font-size: 0.88rem; color: var(--text-muted); margin: 8px 0; }
.wz-center { justify-content: center; }
.wz-small { width: auto; padding: 6px 12px; font-size: 0.85rem; }
/* Bước 4: địa chỉ cũ trên thẻ -> phường/xã mới theo nghị quyết */
#addressNote { display: block; }
#addressNote[hidden] { display: none; }
#addressNote p { margin: 0 0 4px; }
.wz-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.wz-status { margin-top: 12px; font-size: 0.92rem; color: #1e40af; min-height: 1.2em; }
.wz-status.error { color: #991b1b; }
.wz-tips { margin: 14px 0 0 18px; font-size: 0.85rem; color: var(--text-muted); }
.wz-tips li { margin-bottom: 4px; }
.wz-done-name { font-weight: 700; font-size: 1.1rem; margin: 6px 0; }

/* Input file ẩn bên trong nhãn nút */
.cs-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
label.btn { position: relative; margin: 0; color: inherit; font-size: 1rem; }
label.btn.btn-primary { color: #fff; }

/* Camera quét QR */
.qr-live { margin-bottom: 4px; }
.qr-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 60vh;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.qr-viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-target {
  position: absolute; left: 50%; top: 50%;
  width: 62%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

/* Màn hình chụp thẻ */
.cs-title { font-size: 1.05rem; color: var(--primary-color); margin-bottom: 10px; }
.cs-guide { margin: 14px 0 12px; }
.cs-ill { width: 100%; max-width: 320px; display: block; margin: 0 auto 8px; }
.cs-ill-card { fill: #e6f0ef; stroke: #4b5563; stroke-width: 2; }
.cs-ill-emblem { fill: #dc2626; }
.cs-ill-photo { fill: #d6b9a3; }
.cs-ill-text { fill: #94a3b8; }
.cs-ill-head { fill: #dc2626; opacity: 0.7; }
.cs-ill-finger { fill: #f3f4f6; stroke: #9ca3af; }
.cs-ill-mrz { font: 600 14px monospace; fill: #111827; letter-spacing: 1px; }
.cs-ill-qr rect { fill: #fff; stroke: #111827; stroke-width: 2; }
.cs-ill-qr .cs-ill-qr-finder { fill: #111827; }
.cs-ill-qr-maybe rect:first-child { stroke-dasharray: 4 3; }
.cs-side-hint { font-weight: 600; font-size: 0.92rem; margin: 6px 0; }
.cs-checklist { margin: 6px 0 0 18px; font-size: 0.86rem; color: #374151; }
.cs-checklist li { margin-bottom: 2px; }

.cs-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 64vh;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.cs-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cs-guide-frame { fill: none; stroke: #fbbf24; stroke-width: 3; stroke-dasharray: 10 6; }
.cs-guide-frame.ok { stroke: #22c55e; stroke-dasharray: none; }
.cs-quad { fill: rgba(251, 191, 36, 0.12); stroke: #fbbf24; stroke-width: 3; }
.cs-quad.ok { fill: rgba(34, 197, 94, 0.18); stroke: #22c55e; }
.cs-live-hint {
  position: absolute; left: 0; right: 0; bottom: 10px;
  margin: 0 auto; width: fit-content; max-width: 92%;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  padding: 6px 12px; border-radius: 999px; font-size: 0.9rem; text-align: center;
}
.cs-live-actions { margin-top: 10px; }
.cs-shutter { font-size: 1.1rem; padding: 14px; }
.cs-row { display: flex; gap: 8px; margin-top: 8px; }
.cs-row .btn { flex: 1; }
.cs-small { padding: 8px 10px; font-size: 0.88rem; }
.cs-native .btn { margin-top: 10px; }
.cs-note { font-size: 0.88rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 8px 10px; }
.cs-busy { text-align: center; padding: 24px 0; }
.cs-spinner {
  width: 40px; height: 40px; margin: 0 auto 10px;
  border: 4px solid #e5e7eb; border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: cs-spin 0.9s linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-result .btn { margin-top: 10px; }
.cs-result-img { width: 100%; height: auto; display: block; border-radius: var(--radius-sm); margin-bottom: 12px; background: #111; }
.cs-issues { list-style: none; padding: 0; margin: 0 0 6px; }
.cs-issues li { border-left: 4px solid var(--danger-color); background: #fef2f2; padding: 8px 10px; margin-bottom: 8px; border-radius: 4px; }
.cs-issues strong { display: block; color: #991b1b; }
.cs-issues span { display: block; font-size: 0.88rem; color: #374151; margin-top: 2px; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; display: block; }
.cs-verify { margin-top: 6px; font-size: 0.9rem; }
.cs-back { margin-top: 14px; }
.cs-debug { margin-top: 12px; font-size: 0.75rem; }
.cs-debug table { width: 100%; border-collapse: collapse; }
.cs-debug td { border: 1px solid #e5e7eb; padding: 2px 4px; word-break: break-all; }

/* Bước 4 */
.wz-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.wz-photo img, .wz-photo-missing { width: 100%; aspect-ratio: 1356 / 855; object-fit: cover; border-radius: var(--radius-sm); display: block; background: #f3f4f6; }
.wz-photo-missing { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.85rem; }
.wz-photo-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 0.85rem; font-weight: 600; }
.field-error { color: #b91c1c; font-size: 0.82rem; margin-top: 4px; }
.has-error { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important; }
select:disabled { background-color: #f9fafb; color: #4b5563; opacity: 1; }
#formError { display: block; }

@media (max-width: 380px) {
  .form-row { flex-direction: column; gap: 0; }
  .wz-row { flex-direction: column; }
}
/* Chạm số bước để quay lại bước đã qua */
.wz-progress li.reachable { cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: var(--radius-sm); }
.wz-progress li.reachable span { box-shadow: 0 0 0 2px rgba(0, 90, 60, 0.25); }
.wz-progress li.reachable:hover span, .wz-progress li.reachable:active span { filter: brightness(1.1); }
.wz-progress li.reachable:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* Tiến trình khi chụp / chọn ảnh mã QR (P6c): từng bước + thời gian */
.wz-prog { list-style: none; margin: 12px 0 0; padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: var(--radius-sm); font-size: 0.9rem; }
.wz-prog-item { display: grid; grid-template-columns: 1.5em 1fr auto; gap: 2px 6px; align-items: start; padding: 3px 0; color: var(--text-muted); }
.wz-prog-item.active { color: #1e40af; font-weight: 600; }
.wz-prog-item.done { color: var(--success-color); }
.wz-prog-item.fail { color: #991b1b; }
.wz-prog-time { font-variant-numeric: tabular-nums; font-size: 0.82rem; white-space: nowrap; }
.wz-prog-note { grid-column: 2 / 4; font-weight: 400; font-size: 0.84rem; }
