/* Public signing page — mobile first. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; background: #eef2f6; color: #1a202c; min-height: 100vh; line-height: 1.5; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: #1a365d; color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.brand { width: 36px; height: 36px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; }
.brand svg { width: 20px; height: 20px; }
.top-t { min-width: 0; }
.top h1 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top p { font-size: 12.5px; opacity: .8; }

.wrap { max-width: 820px; margin: 0 auto; padding: 14px 12px 24px; }
.card { background: #fff; border-radius: 14px; box-shadow: 0 1px 6px rgba(15, 23, 42, .08); margin-bottom: 14px; overflow: hidden; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 16px; background: #f7fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: 14.5px; color: #2d3748; }
.card-b { padding: 16px; }
.muted { color: #718096; font-weight: 400; font-size: 13px; }
.doc-name { font-size: 18px; font-weight: 700; color: #1a365d; word-break: break-word; }
.doc-meta { margin-top: 4px; font-size: 13px; color: #4a5568; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #ebf4ff; color: #2a4365; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.hint { font-size: 13.5px; color: #744210; background: #fffbeb; border: 1px solid #f6e05e; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }

.viewer { position: relative; touch-action: pan-y pinch-zoom; }
.page { position: relative; width: 100%; background: #fff; box-shadow: 0 0 0 1px #d8dee8, 0 2px 6px rgba(0, 0, 0, .08); line-height: 0; aspect-ratio: 210 / 297; }
.page canvas { display: block; width: 100%; height: 100%; }
.page.turn { animation: turn .18s ease-out; }
@keyframes turn { from { opacity: .35; } to { opacity: 1; } }
.spots { position: absolute; inset: 0; pointer-events: none; }
.page-load { position: absolute; inset: 0; display: grid; place-items: center; line-height: 1.4; color: #a0aec0; font-size: 13px; background: #fff; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.btn-nav { height: 46px; min-width: 112px; padding: 0 16px; background: #1a365d; color: #fff; font-size: 15.5px; font-weight: 600; }
.btn-nav:disabled { background: #cbd5e0; color: #4a5568; }
.pg-no { font-size: 15px; font-weight: 600; color: #2d3748; font-variant-numeric: tabular-nums; }
.swipe { margin-top: 8px; text-align: center; font-size: 12.5px; color: #718096; }
.spot { position: absolute; border: 2px dashed #d69e2e; background: rgba(250, 204, 21, .28); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.spot span { font-size: 11px; line-height: 1.2; font-weight: 700; color: #744210; background: rgba(255, 255, 255, .85); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13.5px; color: #4a5568; margin-bottom: 4px; font-weight: 500; }
.field input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 10px; font: inherit; font-size: 16px; background: #fff; color: inherit; }
.field input:focus { outline: none; border-color: #1a365d; box-shadow: 0 0 0 3px rgba(26, 54, 93, .12); }
.field input.bad { border-color: #c53030; }
.consent { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f7fafc; font-size: 14px; margin-bottom: 14px; cursor: pointer; }
.consent input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: #1a365d; }
.consent.bad { border-color: #c53030; }

.pad-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; color: #4a5568; margin-bottom: 6px; }
.pad { position: relative; height: 190px; border: 2px dashed #a0aec0; border-radius: 12px; background: #fcfcfd; touch-action: none; cursor: crosshair; overflow: hidden; }
.pad.has { border-style: solid; border-color: #1a365d; }
.pad.bad { border-color: #c53030; }
.pad canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.pad-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #a0aec0; font-size: 18px; pointer-events: none; user-select: none; }
.pad.has .pad-ph { display: none; }

.btn { font: inherit; border: 0; border-radius: 10px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { display: block; width: 100%; height: 52px; margin-top: 14px; background: #1a365d; color: #fff; font-size: 16.5px; font-weight: 600; }
.btn-primary:not(:disabled):active { transform: scale(.99); }
.btn-ghost { background: #edf2f7; color: #2d3748; padding: 6px 14px; font-size: 14px; }
.err { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff5f5; color: #c53030; font-size: 14px; }

.state { text-align: center; padding: 40px 20px; }
.state h2 { font-size: 20px; margin-bottom: 8px; }
.state p { color: #4a5568; font-size: 15px; }
.state-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; font-weight: 700; color: #fff; }
.state-ic--bad { background: #c53030; }
.state-ic--ok { background: #2f855a; }
.spinner { width: 44px; height: 44px; margin: 0 auto 14px; border: 4px solid #e2e8f0; border-top-color: #1a365d; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { max-width: 820px; margin: 0 auto; padding: 0 16px 28px; padding-bottom: max(28px, env(safe-area-inset-bottom)); font-size: 12px; color: #718096; text-align: center; }

@media (min-width: 700px) {
  .wrap { padding: 24px 16px 32px; }
  .pad { height: 220px; }
}
