/* Публичная часть: посадочная страница и анкета курьера.
   Mobile-first — анкету заполняют с телефона и фотографируют документы им же.
   Зоны документов — стиль КИТ (яркая обводка, тинт, вензельные углы), см. zones.css. */
:root {
  --bg: #f4f2ec;
  --surface: #fffdf8;
  --ink: #16181d;
  --ink-2: #4c4f57;
  --muted: #868993;
  --line: rgba(22,24,29,0.12);
  --accent: #e0561b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(224,86,27,0.12);
  --ok: #18864b;
  --err: #c9302c;
  --err-soft: rgba(201,48,44,0.10);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22,24,29,0.06), 0 6px 20px -10px rgba(22,24,29,0.25);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1b1c20;
    --ink: #f2f1ec;
    --ink-2: #c3c2bb;
    --muted: #8d8f97;
    --line: rgba(255,255,255,0.12);
    --accent: #ff7a3d;
    --accent-ink: #1a0d05;
    --accent-soft: rgba(255,122,61,0.16);
    --ok: #3ccf82;
    --err: #ff6b66;
    --err-soft: rgba(255,107,102,0.14);
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -12px rgba(0,0,0,0.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font);
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* --- Шапка и шаги --- */
.site-head { padding: 18px 0 8px; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo-img { flex: none; width: 36px; height: 36px; display: block; }
.head-phone { font-size: 14px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }

.steps { display: flex; gap: 6px; margin: 14px 0 22px; padding: 0; list-style: none; counter-reset: st; }
.steps li { flex: 1; font-size: 12.5px; color: var(--muted); counter-increment: st; }
.steps li::before {
  content: ""; display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 6px;
}
.steps li.done::before, .steps li.now::before { background: var(--accent); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li span::before { content: counter(st) ". "; }

/* --- Заголовки --- */
h1 { font-size: clamp(26px, 6vw, 38px); line-height: 1.15; letter-spacing: -0.02em; margin: 8px 0 10px; }
.lead { color: var(--ink-2); font-size: 17px; margin: 0 0 24px; max-width: 58ch; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); text-decoration: none; margin-bottom: 4px; }
.back:hover { color: var(--accent); }
.pill { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--ink); margin: 0 6px 6px 0; }

.how { display: grid; gap: 10px; margin: 8px 0 30px; padding: 0; list-style: none; counter-reset: how; }
.how li { display: flex; gap: 12px; align-items: baseline; color: var(--ink-2); counter-increment: how; }
.how li::before {
  content: counter(how); flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
}

/* --- Поля формы: подпись слева в строку (правило КИТ), на телефоне — над полем --- */
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--accent); }
.field .ctl { flex: 1; min-width: 0; }
@media (min-width: 640px) {
  .field { flex-direction: row; align-items: flex-start; gap: 14px; }
  .field > label { min-width: 200px; max-width: 200px; padding-top: 11px; white-space: normal; }
}
input[type=text], input[type=tel], input[type=date], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px — iOS не зумит поле */
  padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invalid input, .invalid select, input.invalid { border-color: var(--err); background: var(--err-soft); }
.err { color: var(--err); font-size: 13.5px; margin-top: 3px; }
.err:empty { display: none; }

/* --- Фото документа --- */
.photos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 6px; }
.photo {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 132px; padding: 10px; text-align: center;
  border: 2px dashed var(--sect-border, var(--line)); border-radius: 12px;
  background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--ink-2);
  overflow: hidden;
}
.photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo svg { width: 28px; height: 28px; fill: none; stroke: var(--sect-border, var(--accent)); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.photo .ph-label { font-weight: 600; color: var(--ink); line-height: 1.3; }
.photo .ph-opt { font-size: 12px; color: var(--muted); }
.photo img.thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.has-file { border-style: solid; }
.photo.has-file .ph-state {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 8px; font-size: 12px;
  background: rgba(0,0,0,0.62); color: #fff; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo:not(.has-file) .ph-state { display: none; }
.photo.invalid { border-color: var(--err); background: var(--err-soft); }
.photo .pdf-mark { font-weight: 800; font-size: 22px; color: var(--sect-border, var(--accent)); }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 26px; border-radius: 12px; border: none;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; font-size: 17px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.wide { width: 100%; }
.actions { margin: 22px 0 10px; }

.consent {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 6px 0 4px;
  border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); cursor: pointer;
}
.consent.invalid { border-color: var(--err); background: var(--err-soft); }
.consent input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin-top: 1px; }
.consent span { font-size: 15px; color: var(--ink-2); }
.alert { padding: 12px 16px; border-radius: 12px; background: var(--err-soft); color: var(--err); margin: 0 0 16px; font-weight: 600; }
.alert[hidden] { display: none; }
.note { font-size: 14px; color: var(--muted); }

select { min-height: 48px; }
option:disabled { color: var(--muted); }

/* --- Страница агрегатора: шапка-баннер и сводка анкеты --- */
.agg-hero { margin: 0 0 14px; padding: 20px 20px 18px; border-radius: var(--radius); background: var(--hero-bg, var(--accent-soft)); color: var(--hero-ink, var(--ink)); }
.agg-hero h1 { margin: 2px 0 8px; }
.agg-hero p { margin: 0; font-size: 16.5px; max-width: 60ch; }
.agg-name { display: inline-block; font-weight: 800; font-size: 14px; letter-spacing: .02em; padding: 3px 10px; border-radius: 99px; background: var(--hero-ink, var(--ink)); color: var(--hero-bg, var(--surface)); }
.lead-card { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 15px; color: var(--ink-2); }
.lead-card b { color: var(--ink); }
.lead-card a { margin-left: auto; font-size: 14px; }
.zone-note { margin: -4px 0 12px; font-size: 14px; color: var(--ink-2); }

/* --- Тема «Яндекс»: жёлто-чёрная (страница агрегатора) --- */
.theme-yandex {
  --bg: #f5f5f2; --surface: #ffffff; --ink: #000000; --ink-2: #3b3b3b; --muted: #7a7a7a;
  --line: rgba(0,0,0,0.14);
  --accent: #fce000; --accent-ink: #000000; --accent-soft: rgba(252,224,0,0.35);
  --hero-bg: #fce000; --hero-ink: #000000; --link: #000000; --bar: #000000;
}
.theme-yandex a { color: var(--link); }
.theme-yandex .site-head { background: #000; padding: 12px 0; margin-bottom: 6px; }
.theme-yandex .logo { color: #fff; }
.theme-yandex .head-phone { color: #fce000; }
.theme-yandex .steps li.done::before, .theme-yandex .steps li.now::before { background: var(--bar); }
.theme-yandex .field .req { color: #000; }
.theme-yandex input:focus, .theme-yandex select:focus { border-color: #000; box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-yandex .btn { box-shadow: inset 0 0 0 2px #000; }
.theme-yandex .progress i { background: #000; }
@media (prefers-color-scheme: dark) {
  .theme-yandex {
    --bg: #0e0e0e; --surface: #1a1a1a; --ink: #f5f5f0; --ink-2: #c9c9c2; --muted: #8e8e8e;
    --line: rgba(255,255,255,0.14); --accent-soft: rgba(252,224,0,0.18);
    --link: #fce000; --bar: #fce000;
  }
  .theme-yandex .site-head { background: #000; border-bottom: 2px solid #fce000; }
  .theme-yandex .field .req { color: #fce000; }
  .theme-yandex input:focus, .theme-yandex select:focus { border-color: #fce000; }
  .theme-yandex .btn { box-shadow: none; }
  .theme-yandex .progress i { background: #fce000; }
}

/* --- Прогресс отправки --- */
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin-top: 12px; }
.progress[hidden] { display: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-text { font-size: 14px; color: var(--ink-2); margin-top: 6px; min-height: 1.5em; }

.done-card { text-align: center; padding: 34px 20px; }
.done-mark { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.done-mark svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

.prose { color: var(--ink-2); }
.prose h2 { color: var(--ink); font-size: 18px; margin: 22px 0 6px; }

.site-foot { padding: 30px 0 40px; font-size: 13px; color: var(--muted); }

/* --- Телефон --- */
input[type=text], input[type=tel], input[type=date] { min-height: 48px; }   /* палец, не курсор */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.pill { overflow-wrap: anywhere; }

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 12px; }
  .site-head { padding: 12px 0 4px; }
  .logo { font-size: 17px; }
  .steps { margin: 10px 0 16px; }
  .steps li { font-size: 11.5px; }
  h1 { font-size: 26px; margin: 4px 0 8px; }
  .lead { font-size: 15.5px; margin-bottom: 16px; }
  .zone { padding: 14px 12px 10px; margin-bottom: 14px; border-radius: 12px; }
  .zone-head { font-size: 16px; margin-bottom: 12px; }
  .field { margin-bottom: 10px; }
  .field > label { font-size: 13.5px; }
  .photos { grid-template-columns: 1fr 1fr; gap: 8px; }
  .photo { min-height: 118px; padding: 8px; font-size: 13px; }
  .consent { padding: 12px; }
  .how { margin-bottom: 20px; }
  /* Кнопка «Отправить» прилипает к низу экрана, пока листается анкета */
  .actions.sticky {
    position: sticky; bottom: 0; z-index: 5; margin: 16px -12px 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg); box-shadow: 0 -8px 16px -12px rgba(0,0,0,.45);
  }
  .actions.sticky .progress-text:empty { display: none; }
}

/* --- Страница согласия: таблица получателей --- */
.table-wrap { overflow-x: auto; margin: 10px 0 16px; }
.consent-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.consent-table th, .consent-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.consent-table th { background: var(--surface); color: var(--ink); }

/* --- Тема «Купер»: зелёная (страница агрегатора). Цвета временные — сверить с брендбуком. --- */
.theme-kuper {
  --bg: #f3f7f3; --surface: #ffffff; --ink: #10231a; --ink-2: #3c4f45; --muted: #75857c;
  --line: rgba(16,35,26,0.14);
  --accent: #1f9d55; --accent-ink: #ffffff; --accent-soft: rgba(31,157,85,0.16);
  --hero-bg: #1f9d55; --hero-ink: #ffffff; --link: #16803f; --bar: #1f9d55;
}
.theme-kuper a { color: var(--link); }
.theme-kuper .site-head { background: #0f3d24; padding: 12px 0; margin-bottom: 6px; }
.theme-kuper .logo { color: #fff; }
.theme-kuper .head-phone { color: #b8f0cd; }
.theme-kuper .steps li.done::before, .theme-kuper .steps li.now::before { background: var(--bar); }
@media (prefers-color-scheme: dark) {
  .theme-kuper {
    --bg: #0d1511; --surface: #16211b; --ink: #eef5f0; --ink-2: #c3d2c9; --muted: #8a9a91;
    --line: rgba(255,255,255,0.14); --accent: #34c472; --accent-ink: #06150c;
    --accent-soft: rgba(52,196,114,0.18); --hero-bg: #1f9d55; --link: #6fe3a0; --bar: #34c472;
  }
  .theme-kuper .site-head { background: #07130c; border-bottom: 2px solid #34c472; }
}

/* --- Подвал и карточка оператора --- */
.site-foot p { margin: 0 0 6px; }
.operator-card p { margin: 0 0 6px; }

/* --- Тема «Достависта»: синяя (сайт агрегатора). Цвета временные — сверить с брендбуком. --- */
.theme-dostavista {
  --bg: #f2f5fa; --surface: #ffffff; --ink: #0f1b2d; --ink-2: #3a4a60; --muted: #74839a;
  --line: rgba(15,27,45,0.14);
  --accent: #2463eb; --accent-ink: #ffffff; --accent-soft: rgba(36,99,235,0.16);
  --hero-bg: #2463eb; --hero-ink: #ffffff; --link: #1d4fc4; --bar: #2463eb;
}
.theme-dostavista a { color: var(--link); }
.theme-dostavista .site-head { background: #0d2352; padding: 12px 0; margin-bottom: 6px; }
.theme-dostavista .logo { color: #fff; }
.theme-dostavista .head-phone { color: #bcd2ff; }
.theme-dostavista .steps li.done::before, .theme-dostavista .steps li.now::before { background: var(--bar); }
@media (prefers-color-scheme: dark) {
  .theme-dostavista {
    --bg: #0c111b; --surface: #151c29; --ink: #edf2fa; --ink-2: #c1ccdc; --muted: #8a97ab;
    --line: rgba(255,255,255,0.14); --accent: #5b8cff; --accent-ink: #061026;
    --accent-soft: rgba(91,140,255,0.18); --hero-bg: #2463eb; --link: #93b4ff; --bar: #5b8cff;
  }
  .theme-dostavista .site-head { background: #060c1a; border-bottom: 2px solid #5b8cff; }
}

/* --- Страница выбора агрегатора (cour.host-kit.ru) --- */
.hub-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 0 0 28px; }
.hub-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius);
            background: var(--hero-bg, var(--accent-soft)); color: var(--hero-ink, var(--ink)); text-decoration: none;
            border: 2px solid transparent; transition: transform .12s, border-color .12s; }
a.hub-card:hover, a.hub-card:focus-visible { transform: translateY(-2px); border-color: var(--hero-ink, var(--ink)); }
.hub-card .agg-name { align-self: flex-start; font-size: 16px; }
.hub-hint { font-size: 15.5px; }
.hub-go { margin-top: auto; font-weight: 700; }
.hub-card.off { opacity: .55; }
