:root {
  --bg: #f3f5f8; --card: #fff; --text: #14181f; --muted: #6b7380; --line: #e2e6ec;
  --brand: #0b5cab; --brand-text: #fff; --ok: #1d8a4e; --warn: #b5620b; --err: #c0322b;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1216; --card: #1a1f26; --text: #e9edf2; --muted: #9aa3ae; --line: #2a313a; --brand: #3d8bff; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; background: var(--brand); color: var(--brand-text);
  font-weight: 600; font-size: 19px; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 24px; padding: 4px 8px; }
main { padding: 16px; padding-bottom: calc(env(safe-area-inset-bottom) + 24px); max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.card.tap { cursor: pointer; }
.row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.num { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 10px; }
.kv div:nth-child(odd) { color: var(--muted); }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 15px; }
input { width: 100%; font-size: 22px; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); }
.btn { display: block; width: 100%; padding: 16px; margin-top: 12px; border-radius: 12px; border: 0;
  background: var(--brand); color: var(--brand-text); font-size: 18px; font-weight: 600; }
.btn.secondary { background: var(--card); color: var(--brand); border: 1px solid var(--brand); }
.btn.done { background: var(--ok); }
.btn:disabled { opacity: .5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .btn { margin-top: 0; font-size: 16px; padding: 14px 8px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; background: var(--line); }
.badge.ok { background: var(--ok); color: #fff; }
.back { background: none; border: 0; color: var(--brand); font-size: 17px; padding: 0 0 12px; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: #222a; backdrop-filter: blur(8px); color: #fff; padding: 14px 16px; border-radius: 12px; text-align: center; z-index: 10; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* этапы */
.badge.cur { background: var(--brand); color: #fff; }
.card.locked { opacity: .55; }
.card.warn { border-color: var(--warn); }
.stage.done { border-left: 4px solid var(--ok); }
.stage.cur { border-left: 4px solid var(--brand); }
.stage.wait { opacity: .6; }
.ok-text { color: var(--ok); }
.doc { margin-top: 10px; }
.mini { border: 1px solid var(--brand); background: none; color: var(--brand); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.btn.disabled { opacity: .45; }
.th { position: relative; }
.th img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--line); }
.th .x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 12px; border: 0; background: var(--err); color: #fff; font-size: 16px; line-height: 24px; padding: 0; }
pre.sms { white-space: pre-wrap; font: inherit; font-size: 15px; margin: 8px 0 0; }
/* скан */
.scan { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.scan-top { color: #fff; text-align: center; padding: calc(env(safe-area-inset-top) + 12px) 16px 8px; font-size: 16px; }
.scan-area { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 16px; }
.scan-wrap { position: relative; touch-action: none; }
.scan-wrap img { display: block; max-width: calc(100vw - 32px); max-height: calc(100vh - 200px); user-select: none; -webkit-user-drag: none; }
.scan-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-wrap polygon { fill: rgba(61,139,255,.18); stroke: #3d8bff; stroke-width: 2; }
.scan .h { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 3px solid #3d8bff; background: rgba(255,255,255,.35); touch-action: none; }
.scan-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px); }
.scan-bar .btn { margin: 0; }
.phone { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.phone span { font-size: 22px; padding: 0 4px 0 14px; color: var(--text); }
.phone input { border: 0; padding-left: 6px; background: transparent; }
.phone input:focus { outline: none; }
.phone:focus-within { outline: 2px solid var(--brand); }
