:root {
  --brand: #287683; --brand-1: #39919D; --brand-2: #185B6B; --accent: #3F7770;
  --soft: #E3F0F1; --bg: #EEF0F5; --card: #fff; --ink: #212B36; --muted: #6B7785; --line: #DDE2EA;
  --err: #C8442F; --ok: #2EA06E; --r: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Montserrat, system-ui, -apple-system, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.logo { height: 30px; width: auto; display: block; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }

.hero { padding: 22px 20px; border-radius: var(--r); color: #fff; margin-bottom: 14px;
  background: linear-gradient(110deg, var(--brand-1), var(--brand) 55%, var(--brand-2)); }
.hero h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; font-weight: 800; }
.hero p { margin: 0; opacity: .92; }

/* сегменты-пилюли */
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; flex: 0 0 auto; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--brand); color: #fff; }

/* шаги */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 14px; }
.steps li { min-width: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.steps li::before { content: ""; display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 6px; }
.steps li.on, .steps li.past { color: var(--brand); }
.steps li.on::before, .steps li.past::before { background: var(--brand); }
.steps li span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card { background: var(--card); border-radius: var(--r); padding: 18px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(33,43,54,.04); }
.card > h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-weight: 600; margin-bottom: 7px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.input { width: 100%; min-width: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .15s; font-size: 16px; }
.input:focus { border-color: var(--brand); }
textarea.input { min-height: 88px; resize: vertical; }
.field.bad .input, .field.bad .pick, .field.bad .phone { border-color: var(--err); }
.err { display: none; color: var(--err); font-size: 13px; font-weight: 500; margin-top: 6px; }
.field.bad .err { display: block; }

.phone { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s; }
.phone:focus-within { border-color: var(--brand); }
.phone b { padding: 0 4px 0 14px; font-weight: 600; flex: 0 0 auto; }
.phone .input { border: 0; padding-left: 4px; }

.pick { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 1.5px solid var(--line);
  background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.pick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .ph { color: var(--muted); }
.pick svg { flex: 0 0 auto; color: var(--muted); }
.sub { margin-top: 6px; color: var(--brand); font-weight: 600; font-size: 13px; }

/* выбор: пилюли и карточки */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: 14px; }
.chip.on { border-color: var(--brand); background: var(--soft); color: var(--brand-2); }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yn .chip { border-radius: 12px; padding: 11px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.opt::before { content: ""; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.opt.on { border-color: var(--brand); background: var(--soft); }
.opt.on::before { border: 5px solid var(--brand); }
.field.bad .chip, .field.bad .opt { border-color: #EBC2BA; }

.toggle { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; padding: 4px 0; font-weight: 500; }
.toggle i { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 1px; }
.toggle.on i { background: var(--brand); border-color: var(--brand); }
.toggle.on i::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.field.bad .toggle i { border-color: var(--err); }

/* фото */
.photo { display: flex; align-items: center; gap: 14px; }
.photo .ava { flex: 0 0 auto; width: 92px; height: 92px; border-radius: 50%; background: var(--soft) center/cover no-repeat; display: grid; place-items: center; color: var(--brand); overflow: hidden; }
.photo .ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .acts { display: grid; gap: 8px; min-width: 0; flex: 1; }
.field.bad .ava { box-shadow: 0 0 0 2px var(--err); }
.doc { display: flex; align-items: center; gap: 14px; }
.doc-prev { flex: 0 0 auto; width: 128px; aspect-ratio: 1.42; border-radius: 12px; background: var(--soft); color: var(--brand); display: grid; place-items: center; overflow: hidden; }
.doc-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-acts { display: grid; gap: 8px; min-width: 0; flex: 1; }
.pickfile { position: relative; overflow: hidden; cursor: pointer; }
.pickfile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.field.bad .doc-prev { box-shadow: 0 0 0 2px var(--err); }
.review .docthumb { width: 100%; max-width: 260px; aspect-ratio: 1.42; object-fit: cover; border-radius: 12px; display: block; margin-bottom: 12px; }

/* опыт работы */
.job { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.job-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 > * { min-width: 0; }
.row2 .pick { padding: 12px; }
.row2 .pick svg { display: none; }
.job .field { margin-bottom: 10px; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 4px 0; }
.link.del { color: var(--err); font-size: 13px; }

/* кнопки */
.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: linear-gradient(110deg, var(--brand-1), var(--brand-2)); color: #fff; }
.btn.primary:disabled { opacity: .6; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.soft { background: var(--soft); color: var(--brand-2); padding: 11px 14px; font-size: 14px; width: 100%; }
.nav { display: flex; gap: 10px; margin-top: 4px; }
.nav .btn.primary { flex: 1; }
.nav .btn.ghost { flex: 0 0 auto; }
.formerr { color: var(--err); font-weight: 600; text-align: center; min-height: 1em; margin: 10px 0 0; }

/* проверка */
.review dl { margin: 0; display: grid; gap: 10px; }
.review dt { color: var(--muted); font-size: 13px; font-weight: 500; }
.review dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.review .head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.review .head img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.review .edit { float: right; }

.done { background: #fff; border-radius: var(--r); padding: 32px 20px; text-align: center; }
.done .check { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(110deg, var(--brand-1), var(--brand-2)); }
.done h2 { margin: 0 0 8px; }
.done p { margin: 0 0 6px; color: var(--muted); }
.done .num { color: var(--brand); font-weight: 700; }

/* шторка */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20,30,40,.45); }
.sheet-card { position: relative; width: 100%; max-width: 560px; max-height: 82vh; display: flex; flex-direction: column; background: #fff;
  border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; margin: 0; text-align: center; font-size: 16px; }
.icon { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.icon:hover { background: var(--bg); }
.icon.invisible { visibility: hidden; }
.sheet-body { overflow-y: auto; padding: 14px 16px 18px; }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(4, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c7 { grid-template-columns: repeat(7, 1fr); }
.grid.c1 { grid-template-columns: 1fr; }
.cell { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 11px 4px; font-weight: 600; min-width: 0; }
.grid.c1 .cell { text-align: left; padding: 13px 14px; }
.cell.on { border-color: var(--brand); background: var(--soft); color: var(--brand-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (min-width: 700px) {
  .wrap { padding-top: 24px; }
  .hero { padding: 28px; }
  .hero h1 { font-size: 26px; }
  .card { padding: 22px; }
  .sheet { align-items: center; }
  .sheet-card { border-radius: 20px; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .chip { padding: 8px 12px; }
}

/* камера: полноэкранный снимок с фронтальной камеры */
.cam { position: fixed; inset: 0; z-index: 60; background: #0d1418; color: #fff; display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); }
.cam-title { font-weight: 600; font-size: 15px; text-align: center; margin: 4px 0 14px; }
.cam-view { position: relative; width: min(100%, 460px, 62vh); aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: #000; margin: auto 0; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-ring { position: absolute; inset: 9%; border-radius: 50%; box-shadow: 0 0 0 999px rgba(13,20,24,.45); border: 2px solid rgba(255,255,255,.85); pointer-events: none; }
.cam-bar { width: min(100%, 460px); display: grid; grid-template-columns: minmax(0,1fr) 72px minmax(0,1fr); align-items: center; margin-top: 18px; }
.cam-bar .btn.ghost { justify-self: start; max-width: 100%; background: transparent; color: #fff; border: 0; padding: 10px 4px; font-size: 15px; font-weight: 600; }
.cam-shot { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #0d1418; }
.cam-shot:active { transform: scale(.94); }
