/* Проверка наряда (задача 3): классы .chk- */
/* Телефон — шаги phone-04 … phone-12, компьютер — тёмная карточка desktop-01 … desktop-04. Размеры и цвета из макетов;
   где макет не задаёт высоту строки, она normal, как в макете */

/* ---------- Телефон: страница шага ---------- */
/* Шапка прилипает к верху, кнопки — к низу, между ними прокручивается шаг */
.chk-page { display: flex; flex-direction: column; min-height: 100dvh; line-height: normal; }
/* Поле в фокусе не прячется под шапкой и кнопками */
html:has(.chk-page) { scroll-padding: 100px 0 230px; }
/* Шапка выше списка подсказок названия (4), он — выше кнопок внизу (3) */
.chk-top { position: sticky; top: 0; z-index: 5; background: #fff; }
.chk-bar { display: flex; align-items: center; height: 52px; padding: 0 8px; }
.chk-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.chk-heading { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; text-align: center; }
.chk-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 2px 16px 14px; }
.chk-step { font-size: 12px; font-weight: 500; color: var(--c-muted-3); }
.chk-step::before { content: ''; display: block; height: 4px; margin-bottom: 6px; border-radius: 2px; background: #E3E6EA; }
.chk-step-done::before { background: var(--c-text); }
.chk-step-now { font-weight: 600; color: var(--c-text); }

/* Нижний отступ — зазор над кнопками в конце прокрутки, как в макете: его отступ минус высота кнопок */
.chk-body { display: flex; flex: 1; flex-direction: column; gap: 14px; padding: 4px 16px 10px; }
.chk-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -1px 0 var(--c-border);
}
.chk-foot-tight { padding-top: 10px; }
.chk-foot-plain { box-shadow: none; }
.chk-cta { min-height: 54px; }
.chk-title { font-size: 26px; font-weight: 700; line-height: 31px; letter-spacing: -.02em; }

/* ---------- Город и дата визита ---------- */
.chk-label { margin-top: 6px; font-size: 17px; font-weight: 700; }
/* Город — одна строка, как строки главной и профиля: список городов открывает шторка «Город» */
.chk-city-row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: var(--r-18);
  background: var(--c-surface);
  font-size: 16px;
  font-weight: 600;
}
.chk-city-pin { display: flex; color: var(--c-text-2); }
.chk-city-name { flex: 1; min-width: 0; }
.chk-city-edit { font-size: 14px; color: var(--c-primary); }
.chk-dates { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-date { font-size: 15px; font-weight: 600; }
/* Поля проверки — 16 px, а не 15 и 14 px макета: с меньшим шрифтом iPhone увеличивает страницу при вводе
   (так же «Найти город» в шторке и поиск в home.css) */
.chk-day {
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-14);
  background: var(--c-surface);
  font-size: 16px;
  color: var(--c-text);
}
/* День раньше сегодня или пустое поле после «Дальше» (в слое «Дата визита» — после «Готово»): поле помечено,
   под ним подсказка. Подсказка ближе к полю, чем общий зазор шага: 14 − 8 = 6 px */
.chk-day[aria-invalid='true'] { background: var(--c-warn-bg); color: var(--c-warn-text); }
.chk-day-hint { margin-top: -8px; font-size: 13px; line-height: 18px; color: var(--c-warn-text); }
/* Зачем дата — под чипами и полем, ближе к ним, чем общий зазор шага: 14 − 4 = 10 px */
.chk-date-why { margin-top: -4px; font-size: 13px; line-height: 18px; color: var(--c-text-2); }

/* ---------- Способ добавить наряд ---------- */
.chk-body-method { padding-top: 0; padding-bottom: 40px; }
.chk-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-pick { font-weight: 600; }
/* Чипы стоят вплотную под липкой шапкой шага (z-index 5), и верхние 4 px общей области .chip-sm::after уходят
   под неё. Область растёт только вниз: 36 + 8 = 44 px, до заголовка под чипами остаётся 6 px */
.chk-pick::after { inset: 0 0 -8px; }
.chk-ways { flex: none; padding: 0 16px; border-radius: var(--r-22); background: var(--c-surface); }
.chk-way { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 75px; border-bottom: 1px solid var(--c-border-2); }
.chk-way:last-child { min-height: 74px; border-bottom: 0; }
.chk-way-soon { opacity: .55; }
.chk-way-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-14);
  background: #fff;
}
.chk-way-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.chk-way-title { font-size: 16px; font-weight: 600; line-height: 21px; }
.chk-way-sub { font-size: 13px; line-height: 18px; color: var(--c-text-2); }
.chk-chevron { display: flex; color: #A0A7B0; }
.chk-tag { padding: 3px 8px; border-radius: 8px; background: #fff; font-size: 12px; font-weight: 600; color: var(--c-muted-4); }
.chk-free { font-size: 13px; color: var(--c-text-2); text-align: center; }

/* ---------- Распознавание: лист под сканером и найденные строки ---------- */
.chk-body-recognizing { gap: 12px; padding-top: 0; }
.chk-scan {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  height: 180px;
  margin-bottom: 6px;
  overflow: hidden;
  border-radius: var(--r-22);
  background: #1B1E22;
}
.chk-paper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 46%;
  height: 86%;
  padding: 12px 10px;
  border-radius: 5px;
  background: #ECEEF1;
  transform: rotate(-2deg);
}
.chk-paper > span { height: 5px; border-radius: 3px; background: #C9CED4; }
.chk-paper > span:nth-child(1) { width: 66%; height: 7px; background: #AEB4BC; }
.chk-paper > span:nth-child(2) { width: 90%; margin-top: 8px; }
.chk-paper > span:nth-child(3) { width: 80%; }
.chk-paper > span:nth-child(4) { width: 86%; }
.chk-paper > span:nth-child(5) { width: 72%; }
.chk-paper > span:nth-child(6) { width: 84%; }
.chk-scanline {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 10%;
  height: 3px;
  border-radius: 2px;
  background: #43D69B;
  box-shadow: 0 0 18px 5px rgba(67, 214, 155, .55);
  animation: npScan 1.6s ease-in-out infinite alternate;
}
.chk-recog-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.chk-track { flex: none; height: 8px; overflow: hidden; border-radius: 4px; background: var(--c-border); }
.chk-fill { display: block; width: 6%; height: 100%; border-radius: 4px; background: var(--c-primary); transition: width .4s ease; }
.chk-found { font-size: 14px; color: var(--c-text-2); }
.chk-rows { flex: none; padding: 0 16px; border-radius: var(--r-22); background: var(--c-surface); }
.chk-row { display: flex; align-items: center; gap: 10px; min-height: 57px; border-bottom: 1px solid var(--c-border-2); }
.chk-row-in { animation: npIn .35s ease-out; }
.chk-row-main { flex: 1; min-width: 0; }
.chk-row-name { font-size: 15px; font-weight: 600; line-height: 20px; }
.chk-row-qty { font-size: 12px; color: var(--c-text-2); }
.chk-row-price { font-size: 15px; font-weight: 700; white-space: nowrap; }
.chk-skel > span { height: 12px; border-radius: var(--r-6); background: #E3E6EA; }
.chk-skel > span:first-child { flex: 1; }
.chk-skel > span:last-child { width: 56px; }

/* ---------- Наряд не распознался ---------- */
.chk-body-failed { align-items: center; justify-content: center; gap: 12px; padding: 0 28px; text-align: center; }
.chk-fail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 26px;
  background: var(--c-surface);
  color: var(--c-muted-4);
}
.chk-fail-title { margin-top: 6px; font-size: 24px; font-weight: 700; line-height: 29px; letter-spacing: -.02em; }
.chk-fail-text { font-size: 15px; line-height: 21px; color: var(--c-text-2); }

/* ---------- Редактор строк: «Проверьте строки» и «Наряд текстом» ---------- */
.chk-body-lines, .chk-body-text { gap: 10px; padding-top: 0; padding-bottom: 36px; }
.chk-sub { margin-top: -4px; font-size: 14px; line-height: 20px; color: var(--c-text-2); }
.chk-cards { display: flex; flex-direction: column; gap: 10px; }
/* Рамка 1 px в покое прозрачна: поле карточки 7 + 1 = 8 px, как в макете. Карточка, в поле которой печатают, светится
   основным цветом, как «Моя машина»: рамка и мягкое свечение. При «меньше движения» переход выключает tokens.css,
   подсветка остаётся */
.chk-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: var(--r-18);
  background: var(--c-surface);
  transition: border-color .18s, box-shadow .18s;
}
.chk-card:focus-within { border-color: var(--glow-pill-border); box-shadow: var(--glow-shadow); }
/* Название и крестик — одной строкой; список подсказок — под ней, на всю ширину карточки */
.chk-card-head { position: relative; display: flex; align-items: center; }
.chk-card-head > .chk-in-name { flex: 1; }
/* Крестик «Удалить строку» — тихий, в правом верхнем углу. Нажимается на 44 × 44 px: справа заходит в поле карточки,
   сверху и снизу — на 1 px за строку названия. Значок 18 px в середине — зазор до поля названия и так есть */
.chk-del {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -1px -6px -1px 0;
  border-radius: 50%;
  color: var(--c-muted-3);
}
/* Подсказки названия (views/check.mjs, nameField) — поверх строки артикула и следующих карточек */
.chk-hints {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 4;
  padding: 6px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-16);
  background: #fff;
  box-shadow: var(--glass-shadow);
}
/* Подсказка — строка 44 px; длинное название переносится. Блок, а не flex: пробелы вокруг выделенного начала слова
   остаются на месте */
.chk-hint {
  min-height: 44px;
  padding: 12px;
  border-radius: var(--r-10);
  font-size: 15px;
  line-height: 20px;
  color: var(--c-text);
  cursor: pointer;
}
.chk-hint > b { font-weight: 700; }
/* Выбранная стрелками — подсветка и кольцо основного цвета, как фокус */
.chk-hint[aria-selected='true'] { background: var(--glow-pill); box-shadow: inset 0 0 0 2px var(--c-primary); color: var(--c-primary-ink); }
/* «Подставить пример» — тихая текстовая кнопка под «Добавить строку» */
.chk-sample { align-self: center; min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 600; color: var(--c-primary); }
@media (hover: hover) {
  .chk-del:hover { background: var(--c-surface-hover); color: var(--c-text); }
  .chk-hint:hover { background: var(--c-surface); }
  .chk-hint[aria-selected='true']:hover { background: var(--glow-pill); }
}
.chk-card-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1fr); gap: 6px; }
/* Видно поле как в макете — 42 и 40 px, а нажать можно на 46 и 44 px: прозрачная рамка 2 px
   выходит за белый край, отрицательный отступ возвращает раскладку макета */
.chk-in {
  min-width: 0;
  height: 44px;
  margin: -2px;
  padding: 0 8px;
  border: 2px solid transparent;
  border-radius: var(--r-14);
  background: #fff padding-box;
  font-size: 16px;
  color: var(--c-text);
  /* Длинное название не обрывается на полуслове: многоточие, пока поле не в фокусе */
  text-overflow: ellipsis;
}
/* Кольцо фокуса в 2 px от белого края, как у остальных элементов */
.chk-in:focus-visible { outline-offset: 0; }
.chk-in-name { height: 46px; padding: 0 10px; font-size: 16px; font-weight: 600; }
/* Пример в пустом поле — обычным начертанием, светлее набранного */
.chk-in::placeholder { font-weight: 400; }
/* На 320 px артикул «90915-10009» и «компл.» шрифтом 16 px помещаются в поля только с меньшими полями */
@media (max-width: 359.98px) {
  .chk-card-row .chk-in { padding: 0 6px; }
}
.chk-in-price { font-weight: 700; text-align: right; }
.chk-add { min-height: 50px; border-radius: var(--r-16); }
.chk-total { display: flex; gap: 12px; font-size: 14px; }
.chk-total > span { color: var(--c-text-2); }
.chk-total > b { margin-left: auto; white-space: nowrap; }

/* ---------- Компьютер: тёмная карточка на главной ---------- */
.chk-hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 600px;
  border-radius: var(--r-28);
  line-height: normal;
}
/* Кольцо фокуса на тёмной карточке светлое — общее правило .card-dark в shell.css */
.chk-hero-head { font-size: 40px; font-weight: 700; line-height: 46px; letter-spacing: -.025em; }
.chk-hero-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.chk-hero-lead { margin-top: -6px; font-size: 17px; line-height: 24px; color: #C4CAD1; }
.chk-hero-sub { margin-top: -8px; font-size: 15px; line-height: 21px; color: var(--c-muted-2); }
.chk-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chk-hero-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  background: rgba(255, 255, 255, .12);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
/* Чип 38 px, а нажимать можно на 44 px */
button.chk-hero-chip::after { content: ''; position: absolute; inset: -3px 0; }
.chk-hero-free { font-size: 13px; color: var(--c-muted-2); }

.chk-zone {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 280px;
  padding: 24px;
  border-radius: var(--r-22);
  background: rgba(255, 255, 255, .06);
  text-align: center;
  transition: background-color .15s, box-shadow .15s;
}
.chk-zone-over { background: rgba(67, 214, 155, .1); box-shadow: inset 0 0 0 2px #43D69B; }
.chk-zone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--r-20);
  background: rgba(255, 255, 255, .1);
}
.chk-zone-title { font-size: 20px; font-weight: 600; }
.chk-zone-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.chk-zone-btn { min-height: 48px; padding: 0 22px; }
.chk-zone-soon {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--r-14);
  background: rgba(255, 255, 255, .05);
  font-size: 15px;
  font-weight: 600;
  color: var(--c-muted);
}
.chk-zone-tag { padding: 2px 6px; border-radius: var(--r-6); background: rgba(255, 255, 255, .1); font-size: 11px; }

/* Распознавание на тёмной карточке: те же узлы, что у телефона, в цветах макета компьютера */
.chk-track-dark { background: rgba(255, 255, 255, .12); }
.chk-fill-dark { background: #43D69B; }
.chk-found-dark { font-size: 15px; color: var(--c-muted-2); }
.chk-rows-dark { padding: 0 20px; border-radius: var(--r-20); background: rgba(255, 255, 255, .06); }
.chk-hrow { display: flex; align-items: center; gap: 14px; min-height: 55px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.chk-hrow-name { flex: 1; min-width: 0; font-size: 15px; }
.chk-hrow-qty { font-size: 13px; color: var(--c-muted-2); }
.chk-hrow-price { flex: none; width: 90px; text-align: right; }
.chk-hskel > span { height: 12px; border-radius: var(--r-6); background: rgba(255, 255, 255, .1); }
.chk-hskel > span:first-child { flex: 1; }
.chk-hskel > span:last-child { width: 70px; }

.chk-hero-note { background: rgba(255, 255, 255, .06); color: #C4CAD1; }
.chk-hero-text {
  flex: 1;
  min-height: 300px;
  padding: 18px 20px;
  border: 0;
  border-radius: var(--r-20);
  background: #fff;
  color: var(--c-text);
  font-size: 15px;
  line-height: 27px;
  resize: none;
}
.chk-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.chk-hero-go { padding: 0 24px; }
.chk-hero-go:disabled, .chk-hero-go:disabled:hover { background: rgba(255, 255, 255, .1); color: var(--c-muted); }
.chk-hero-alt { background: rgba(255, 255, 255, .1); }
