:root {
  --paper: #f3f5f8;
  --sheet: #ffffff;
  --ink: #1c2430;
  --muted: #667085;
  --line: #dde2e9;
  --stamp: #2b4fa2;
  --stamp-deep: #1f3c80;
  --stamp-soft: #e9eef9;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius-sheet: 18px;
  --radius-control: 12px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.55 var(--font);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 1;
}
a { color: var(--stamp); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--stamp) 45%, transparent); outline-offset: 2px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; text-decoration: none; margin-bottom: 28px; }
.brand svg { width: 26px; height: 26px; }

h1 { font-size: clamp(26px, 6vw, 34px); line-height: 1.15; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 600; margin: 0 0 14px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 34em; }
.meta { color: var(--muted); font-size: 14px; margin: 0; }

.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-sheet); padding: 22px; margin-top: 18px; }
.sheet.quiet { background: transparent; border-style: dashed; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius-control);
  border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font: 500 16px/1 var(--font); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #c5ccd6; }
.btn.primary { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn.primary:hover { background: var(--stamp-deep); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn svg { width: 20px; height: 20px; flex: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 180px; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field input[type="text"] {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--line); font: inherit; color: inherit; background: #fff;
}
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 12px; margin: 14px 0 0; font-size: 14px; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-control); overflow: hidden; background: #fff; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; min-width: 56px; padding: 12px 0; text-align: center; font-weight: 500; cursor: pointer; }
.segmented input:checked + span { background: var(--stamp-soft); color: var(--stamp-deep); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--stamp) 45%, transparent); outline-offset: -3px; }

.drop {
  display: grid; place-items: center; text-align: center; gap: 6px;
  min-height: 150px; padding: 20px; border: 1.5px dashed #c3cad5; border-radius: var(--radius-sheet);
  background: #fbfcfd; cursor: pointer; margin-bottom: 18px;
}
.drop.over, .drop:hover { border-color: var(--stamp); background: var(--stamp-soft); }
.drop strong { font-weight: 600; }
.drop small { color: var(--muted); }
.drop.has-file { border-style: solid; border-color: var(--stamp); background: var(--stamp-soft); }

/* Signatures: each one is an ink stamp, an empty slot is a dashed ring. */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }
.stamp-card { text-align: center; }
.stamp-card svg { width: 132px; height: 132px; display: block; margin: 0 auto 8px; }
.stamp-card .who { font-weight: 600; font-size: 14px; line-height: 1.3; }
.stamp-card .when { color: var(--muted); font-size: 13px; }
.stamp-card.pending .who { color: var(--muted); font-weight: 500; }
.stamp-ink { mix-blend-mode: multiply; }
.stamp-card.just-signed svg { animation: press .55s cubic-bezier(.2, .9, .25, 1.15) both; }
@keyframes press {
  0% { transform: scale(1.35) rotate(-14deg); opacity: 0; }
  60% { transform: scale(.96) rotate(-5deg); opacity: 1; }
  100% { transform: none; }
}

.qr-box { position: relative; width: min(260px, 100%); margin: 4px auto 14px; aspect-ratio: 1; }
.qr-box > svg, .qr-box > img { width: 100%; height: 100%; display: block; }
.qr-mark { position: absolute; inset: 40%; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.qr-mark svg { width: 82%; height: 82%; }
.timer { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.steps { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 38px; color: var(--muted); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted);
}
.steps li.now { color: var(--ink); font-weight: 500; }
.steps li.now::before { border-color: var(--stamp); color: var(--stamp); }
.steps li.done::before { content: "✓"; background: var(--stamp); border-color: var(--stamp); color: #fff; }

.only-phone { display: none; }
@media (pointer: coarse) and (max-width: 820px) {
  .only-phone { display: block; }
  .only-desktop { display: none; }
}

.banner { display: flex; gap: 14px; align-items: center; }
.banner svg { width: 56px; height: 56px; flex: none; }
.banner p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.share-link { display: flex; gap: 8px; margin-bottom: 12px; }
.share-link input { flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-control); font: 14px var(--font); color: var(--muted); background: #fbfcfd; }

details { margin-top: 18px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 12px 0 0; font-size: 14px; }
.checks li { padding: 4px 0 4px 24px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 2px; color: var(--stamp); font-weight: 700; }
.checks li.bad::before { content: "✕"; color: var(--danger); }
.checks .signer { font-weight: 600; padding-left: 0; margin-top: 10px; }
.checks .signer::before { content: none; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--muted); }

.footer-link { display: block; text-align: center; margin-top: 28px; font-size: 14px; color: var(--muted); }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .stamp-card.just-signed svg { animation: none; }
}
