:root {
  --red: #B22527; --red-dark: #8E1B1D; --red-soft: #FBEDED;
  --ink: #1D1D1F; --muted: #64646B; --line: #DADAE0; --bg: #F4F4F6; --card: #FFFFFF;
  --ok: #1F7A4A; --ok-soft: #E7F4EC; --warn: #9A5B00; --warn-soft: #FFF4E0;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }

.brand { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand img { flex: none; }
.brand-txt { flex: 1; min-width: 0; }
.brand-name { font-weight: 700; color: var(--red); font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.25; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.lang button { border: 0; background: none; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang button.on { background: var(--red); color: #fff; }

.progress { height: 4px; background: var(--line); position: sticky; top: calc(66px + env(safe-area-inset-top)); z-index: 4; }
.progress div { height: 100%; width: 0; background: var(--red); transition: width .25s; }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; outline: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card.center { text-align: center; padding: 40px 16px; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 4px; }
.step-no { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--red); margin-bottom: 2px; }
.lead { color: var(--muted); margin: 0 0 12px; }
.small { font-size: 13.5px; color: var(--muted); }
.ref { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.field { margin: 0 0 14px; }
.field label, .flabel { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin: -2px 0 5px; }
.req { color: var(--red); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: 12.5px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input:not([type]), select {
  width: 100%; height: 48px; padding: 0 12px; border: 1px solid #C4C4CC; border-radius: 10px; background: #fff; font-size: 16px; }
input.upper { text-transform: uppercase; }
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
input.bad { border-color: var(--red); background: var(--red-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; border: 1px solid #C4C4CC;
  border-radius: 10px; font-weight: 600; cursor: pointer; margin: 0; }
.seg input { accent-color: var(--red); width: 20px; height: 20px; }
.seg label:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-dark); }
.btn-ghost { background: #fff; border-color: #C4C4CC; color: var(--ink); }
.btn-link { background: none; border: 0; color: var(--red); font-weight: 600; padding: 0; min-height: 36px; cursor: pointer; }
.btn[disabled] { opacity: .55; cursor: default; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.nav-in { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; }
.nav-in .btn-primary { flex: 1; }

.callout { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.callout.info { background: #EEF2FA; color: #233A6B; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.list { margin: 6px 0 0; padding-left: 20px; }
.list li { margin: 3px 0; }

.rep { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.rep-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }

.sig-wrap { position: relative; border: 1.5px dashed #A9A9B2; border-radius: 10px; background: #FCFCFD; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 150px; border-radius: 10px; }
.sig-wrap .sig-line { position: absolute; left: 14px; right: 14px; bottom: 34px; border-top: 1px solid #C9C9D0; pointer-events: none; }
.sig-wrap .sig-ph { position: absolute; left: 14px; bottom: 10px; font-size: 12.5px; color: #9A9AA3; pointer-events: none; }
.sig-wrap.signed .sig-ph { display: none; }
.sig-tools { display: flex; justify-content: flex-end; }

.doc { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.doc-h { display: flex; align-items: flex-start; gap: 10px; }
.doc-h .t { flex: 1; }
.doc-h .t b { display: block; }
.doc-h .badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.doc-h .badge.ok { background: var(--ok-soft); color: var(--ok); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.thumb button { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: #fff;
  font-size: 15px; line-height: 26px; cursor: pointer; }
.thumb.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.6) ; border-radius: 8px; }
.doc .btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.doc .btns .btn { min-height: 44px; font-size: 14px; flex: 1; padding: 0 10px; white-space: nowrap; }

.review dl { margin: 0; display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 10px; font-size: 14.5px; }
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 600; word-break: break-word; }
.review h3 { font-size: 15px; margin: 14px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.review h3:first-child { margin-top: 0; }

.consent { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.consent input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--red); }
.consent .tr { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

.done-ico { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; background: var(--ok-soft); color: var(--ok);
  display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; }
.spin { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 9; max-width: 560px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 12px 14px; font-size: 14.5px; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--red-dark); }
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(255,255,255,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-weight: 600; }
