/* Стили экрана «Приём в ремонт». Используют переменные из css/app.css,
   поэтому тёмная тема работает автоматически. */

.intake {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform: translateY(14px);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}
.intake.is-open { transform: none; opacity: 1; }
.intake.hidden { display: none !important; }

.intake-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.intake-head { flex: 1; min-width: 0; }
.intake-head h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.intake-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intake-draft { font-size: 11.5px; color: var(--muted); }

.intake-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 14px 120px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.intake-foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 41;
}
.intake-foot .btn { max-width: 532px; margin: 0 auto; display: flex; }

.intake-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 2px 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.intake-section .ico { width: 18px; height: 18px; }
.intake-section:first-child { margin-top: 4px; }

.intake-field { margin-bottom: 12px; }
.intake-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.intake-field label b { color: var(--danger); }

.intake-input {
  width: 100%;
  min-height: 50px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;       /* меньше 16 px — iOS зумит при фокусе */
  font-family: inherit;
  line-height: 1.35;
  appearance: none;
}
.intake-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.intake-input.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
textarea.intake-textarea { resize: vertical; min-height: 84px; }
select.intake-input { background-image: none; }

.intake-hint { margin: 6px 2px 0; font-size: 12.5px; color: var(--muted); }

.field-error {
  margin: 6px 2px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.hits { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 15.5px;
}
.hit:active { background: var(--surface-2); }
.hit-name { font-weight: 700; }
.hit-sub { font-size: 13px; color: var(--muted); }
.hit-empty {
  padding: 10px 4px;
  font-size: 13.5px;
  color: var(--muted);
}
.hit-empty.err { color: var(--danger); font-weight: 600; }

/* ---------- выбор нескольких значений из справочника ---------- */
.ms-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.ms-none { font-size: 13px; color: var(--muted); }
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .10);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, .22);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ms-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(37, 99, 235, .16);
  color: inherit;
  flex: 0 0 auto;
}
.ms-x .ico { width: 13px; height: 13px; }
.ms-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ms-open.is-on { background: var(--surface-2); }
.ms-count { font-size: 12.5px; color: var(--muted); }
.ms-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: var(--surface-2);
  margin-bottom: 8px;
}
.ms-panel .ms-q { margin-bottom: 8px; min-height: 44px; }
.ms-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 270px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ms .ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.ms .ms-item:active { background: var(--surface); }
.ms .ms-item input[type=checkbox] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.ms .ms-item span { min-width: 0; overflow-wrap: anywhere; }
.ms-item-text { display: flex; flex-direction: column; gap: 1px; }
.ms-sub { font-size: 12.5px; font-style: normal; color: var(--muted); line-height: 1.25; }
.ms-empty { margin: 6px 2px; font-size: 12.5px; color: var(--muted); }
.ms .ms-item.hidden, .ms-empty.hidden { display: none !important; }
.ms-text { min-height: 56px; }

.pick-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 12px;
}
.pick-card .pc-main { flex: 1; min-width: 0; }
.pick-card .pc-name { font-weight: 700; font-size: 16px; }
.pick-card .pc-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.intake-row { margin-bottom: 10px; }
.intake-row .segmented { width: 100%; }
.intake-row .segmented .seg { flex: 1; min-height: 44px; }

.quick-dates {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.quick-dates .btn { min-width: 76px; }

.intake-error { margin-top: 14px; }

/* экран успеха */
.intake-success {
  text-align: center;
  padding: 18px 0 10px;
}
.intake-success .is-ok {
  width: 64px; height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--st-done-bg);
  color: var(--st-done-fg);
  display: flex; align-items: center; justify-content: center;
}
.intake-success .is-ok .ico { width: 34px; height: 34px; stroke-width: 2.4; }
.intake-success .is-num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.intake-success .is-date { color: var(--muted); font-size: 14px; margin-top: 2px; }

.intake-success-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.intake-success-actions .btn { min-height: 52px; }

/* быстрые даты: одна строка, кнопки не переносятся */
.quick-dates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-dates .btn { min-width: 0; width: 100%; padding: 0 6px; font-size: 13.5px; }

/* ===================== групповой приём: единицы оборудования ===================== */
.section-extra { margin-left: auto; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.units-count { font-weight: 700; }

.unit-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  margin-bottom: 12px;
  overflow: hidden;
}
.unit-card.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.unit-card.is-collapsed { background: var(--surface-2, var(--surface)); }

.unit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  min-height: 54px;
  cursor: pointer;
  user-select: none;
}
.unit-num {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.unit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.unit-title {
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-summary {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-chev { width: 20px; height: 20px; color: var(--muted); transform: rotate(90deg); transition: transform .15s ease; flex: none; }
.unit-card.is-collapsed .unit-chev { transform: rotate(0deg); }
.unit-del {
  flex: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.unit-del .ico { width: 18px; height: 18px; }
.unit-del:active { background: var(--surface-2); }

.unit-body { padding: 2px 12px 4px; border-top: 1px solid var(--border); }

.btn-add-unit {
  width: 100%;
  min-height: 52px;
  margin: 2px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px dashed var(--accent);
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
  font-size: 15.5px;
  font-weight: 700;
}
.btn-add-unit .ico { width: 20px; height: 20px; }
.btn-add-unit:disabled { opacity: .5; border-color: var(--border); color: var(--muted); }

/* прогресс отправки */
.intake-progress {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.intake-progress .ip-head { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.intake-progress .ip-bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2, #e6ebf5);
  overflow: hidden;
}
.intake-progress .ip-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .2s ease;
}

/* результат по нескольким документам */
.intake-success.is-partial .is-ok { background: var(--st-wait-bg, #fef3c7); color: var(--st-wait-fg, #92400e); }
.intake-success .is-count {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.result-list { display: flex; flex-direction: column; }
.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: 0; }
.result-row .rr-main { flex: 1; min-width: 0; }
.result-row .rr-num { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.result-row .rr-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.result-row .rr-warn { font-size: 12.5px; font-weight: 600; color: var(--danger); margin-top: 2px; }

.intake-failed {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
}
.intake-failed ul { margin: 8px 0 0; padding-left: 18px; }
.intake-failed li { margin-bottom: 6px; }
.intake-failed li:last-child { margin-bottom: 0; }

/* ===================== группы полей (общая разметка с ПК) =====================
   Поля приёма сгруппированы: клиент, оборудование, срок/механик, комментарий.
   На телефоне это обычные блоки — отступы ровно такие же, как были до
   группировки; на ПК из этих групп собирается форма в две колонки
   (css/desktop.css). */
.in-grp { display: block; }
.in-grp:not(:first-child) > .intake-section:first-child { margin-top: 18px; }

