/* ── ГУПР · Логистика · Заявки от клиентов (pages/gupr-logistics.js) ─────── */

/* Шапка списка (заголовок, фильтры, сводка) прибита к верху при прокрутке */
.gl-top {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: -24px;
  padding-top: 24px;
  background: var(--bg-app);
}

/* «Сбросить фильтры» — на том же месте, что «← Все заявки» в карточке счёта */
.gl-reset { padding: 0; font: inherit; font-size: 12.5px; cursor: pointer; }
.gl-reset--off { visibility: hidden; }

/* Фильтры: первая строка — выпадающие списки, вторая — поиск */
.gl-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.gl-filters__row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 16px; }
.gl-fld { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.gl-fld > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Поиск — на всю ширину, заметный */
.gl-search { position: relative; flex: 1; min-width: 260px; }
.gl-search__icon {
  position: absolute;
  left: 12px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.gl-search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.gl-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); background: var(--bg-card); }
.gl-search input::placeholder { color: var(--text-muted); }

/* Фильтр по клиенту — плашка с крестиком под поиском */
.gl-client {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border-radius: 20px;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 13px;
  white-space: nowrap;
}
.gl-client[hidden] { display: none; }
.gl-client__x { width: 22px; height: 22px; border-radius: 50%; font-size: 10px; color: var(--green-dark); }
.gl-client__x:hover { background: rgba(0,0,0,.08); }

/* Маленькая воронка у имени клиента: показать только его заявки */
.gl-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  margin-left: 2px;
  vertical-align: -4px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  opacity: .45;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.gl-filter-btn svg { width: 12px; height: 12px; }
.gl-row:hover .gl-filter-btn, .gl-group:hover .gl-filter-btn { opacity: 1; }
.gl-filter-btn:hover { background: var(--green-light); color: var(--green-dark); }
.gl-fld .field__select, .gl-fld .field__input { padding: 6px 10px; font-size: 13px; }

/* Переключатель «проведён» */
.gl-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-app);
  padding: 2px;
  gap: 2px;
}
.gl-seg button {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.gl-seg button:hover { color: var(--text-primary); }
.gl-seg button.gl-seg--on {
  background: var(--bg-card);
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* Сводка по отбору */
.gl-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 0 4px 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.gl-summary b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.gl-summary__warn { color: var(--orange); font-weight: 600; }

/* Таблица */
.gl-tbl .tbl-td { vertical-align: top; max-width: 340px; }
.gl-tbl .gl-r { text-align: right; font-variant-numeric: tabular-nums; }
.gl-tbl .tbl-row:nth-child(even) { background: none; }   /* зебра спорит с группами */
.gl-tbl .tbl-row:hover { background: var(--green-subtle); }
#glBody { transition: opacity var(--t-med); }
#glBody.gl-loading { opacity: .45; pointer-events: none; }

/* День — разделитель */
.gl-day td {
  padding: 18px 14px 8px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
}
.gl-day:first-child td { padding-top: 12px; }
.gl-day { cursor: pointer; }
.gl-day .gl-r { text-align: right; font-weight: 700; font-size: 13px; color: var(--text-primary); vertical-align: bottom; font-variant-numeric: tabular-nums; }
.gl-day--closed td { padding-top: 10px; padding-bottom: 10px; }
.gl-day:hover .gl-chev { color: var(--green); }
.gl-day__in { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.gl-day__title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.gl-day__meta { font-size: 12px; color: var(--text-muted); }

/* Клиент с несколькими счетами: свёрнутая строка группы, по клику — счета под ней */
.gl-group { cursor: pointer; }
.gl-group--open td { background: var(--green-subtle); border-bottom-color: transparent; }
.gl-chev {
  display: inline-block;
  width: 14px;
  margin-right: 4px;
  color: var(--text-muted);
  font-size: 11px;
}
.gl-group:hover .gl-chev { color: var(--green); }
.gl-row--child td { background: var(--bg-stripe); border-bottom-style: dashed; }
.gl-row--child td:first-child { padding-left: 28px; position: relative; }
.gl-row--child td:first-child::before {
  content: '';
  position: absolute;
  left: 15px; top: 0; bottom: 0;
  border-left: 2px solid var(--green-light);
}
.gl-group + .gl-row--child td:first-child::before { top: -1px; }
.gl-count {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 11.5px;
  font-weight: 600;
}

.gl-num { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .1px; }
.gl-client-name { font-weight: 600; white-space: normal; }
.gl-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gl-link {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.gl-link:hover { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }

.gl-unassigned { margin-bottom: 14px; border: 1px solid #f0c98b; border-radius: var(--radius-lg); background: var(--bg-card); overflow: hidden; }
.gl-unassigned[hidden] { display: none; }
.gl-unassigned__head { padding: 11px 14px; background: var(--orange-light); color: #92400e; font-size: 13px; }
.gl-unassigned__head div div { margin-top: 3px; font-size: 12px; }
.gl-unassigned__item { display: flex; align-items: center; gap: 16px; padding: 10px 14px; color: var(--text-primary); text-decoration: none; }
.gl-unassigned__item + .gl-unassigned__item { border-top: 1px solid var(--border); }
.gl-unassigned__item:hover { background: var(--bg-hover); }
.gl-unassigned__item > span:first-child { flex: 1; min-width: 0; font-size: 13px; }
.gl-unassigned__item small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 11.5px; }
.gl-unassigned__amount { font-size: 13px; white-space: nowrap; }
.gl-unassigned__link { color: var(--green-dark); font-size: 12px; font-weight: 600; white-space: nowrap; }
.gi-assign { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Метки 1С */
.gl-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.gl-tag--ok    { background: var(--green-light);  color: var(--green-dark); }
.gl-tag--warn  { background: var(--orange-light); color: #92400e; }
.gl-tag--muted { background: var(--bg-hover);     color: var(--text-secondary); border: 1px solid var(--border); }

/* Пагинация */
.gl-footer { justify-content: space-between; gap: 12px; }
.gl-footer[hidden] { display: none; }

/* Попап выбора филиала */
.gl-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gl-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  text-align: left;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.gl-pick:hover { border-color: var(--green); background: var(--green-subtle); }
.gl-pick:last-child { grid-column: 1 / -1; background: var(--bg-stripe); }
.gl-pick__title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.gl-pick__sub { font-size: 12px; color: var(--text-muted); }

/* Строка счёта в списке ведёт в карточку */
.gl-row { cursor: pointer; }

/* ── Карточка счёта (gi-) ─────────────────────────────────────────────────── */
.gi-back {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
}
.gi-back:hover { color: var(--green); }

.gi-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.gi-head__line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gi-head__line .page-title { font-variant-numeric: tabular-nums; }
.gi-head__sub { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.gi-head__total { text-align: right; }
.gi-head__sum { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.gi-head__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 9px; }

/* Маршрут заявки: пройденные вагоны зелёные, текущий выделен кольцом,
   будущие приглушены. Линия находится под точками и не режет подписи. */
.gi-progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin: 0 0 14px;
  padding: 12px 16px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.gi-progress__step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--text-muted);
}
.gi-progress__step::before,
.gi-progress__step::after {
  content: '';
  position: absolute;
  top: 11px;
  width: 50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.gi-progress__step::before { left: 0; }
.gi-progress__step::after { right: 0; }
.gi-progress__step:first-child::before,
.gi-progress__step:last-child::after { display: none; }
.gi-progress__step--done::before,
.gi-progress__step--done::after,
.gi-progress__step--current::before { background: var(--green); }
.gi-progress__dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}
.gi-progress__step--done .gi-progress__dot {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.gi-progress__step--current .gi-progress__dot {
  border-color: var(--green);
  color: var(--green-dark);
  box-shadow: 0 0 0 4px var(--green-light);
}
.gi-progress__label {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
}
.gi-progress__step--done .gi-progress__label,
.gi-progress__step--current .gi-progress__label { color: var(--green-dark); font-weight: 600; }

.gi-props {
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.gi-props__row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  padding: 12px 18px;
}
.gi-props__row + .gi-props__row { border-top: 1px solid var(--border); }
.gi-props__title {
  display: flex;
  align-items: center;
  align-self: start;
  gap: 8px;
  padding-top: 1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.gi-props__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--green-light);
  color: var(--green-dark);
}
.gi-props__icon svg { width: 14px; height: 14px; }
.gi-props__icon:empty { display: none; }

.gi-props__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 0;
}
.gi-props__list > div { min-width: 0; max-width: 420px; }
.gi-props__list dt { font-size: 11.5px; color: var(--text-muted); }
.gi-props__list dt:empty { display: none; }
.gi-props__list dd { margin: 1px 0 0; font-size: 13px; color: var(--text-primary); overflow-wrap: anywhere; }

.gi-lines .tbl-td { vertical-align: top; }
.gi-lines .gl-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gi-lines .gi-name { max-width: 560px; white-space: normal; }
.gi-lines .gi-no { width: 40px; color: var(--text-muted); }
.gi-total td { font-weight: 700; background: var(--bg-stripe); border-bottom: none; }

.gi-foot { margin-top: 10px; font-size: 11.5px; color: var(--text-muted); }

/* Карточка счёта: навигация слева, сама карточка — ограниченной ширины */
.gi-wrap {
  display: grid;
  grid-template-columns: 280px minmax(0, 1040px);
  gap: 24px;
  align-items: start;
}
.gi-main { min-width: 0; }

.gi-nav {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* «Назад» и филиал стоят на месте, прокручивается только список счетов */
.gi-nav__head { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.gi-nav .gi-back { margin-bottom: 0; }
.gi-nav__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gi-nav__div {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.gi-nav__group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
}
.gi-nav__ghead {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
}
.gi-nav__ghead:hover { background: var(--bg-hover); }
.gi-nav__gname { flex: 1; font-size: 13px; font-weight: 700; color: var(--text-primary); }
.gi-nav__gcnt { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.gi-nav__gbody { display: none; border-top: 1px solid var(--border); }
.gi-nav__group--open .gi-nav__gbody { display: block; }
.gi-nav__empty { padding: 12px; font-size: 12px; color: var(--text-muted); }

.gi-nav__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px 8px 9px;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: background var(--t-fast);
}
.gi-nav__item + .gi-nav__item { border-top: 1px solid var(--bg-hover); }
.gi-nav__item:hover { background: var(--bg-hover); }
.gi-nav__item--cur { border-left-color: var(--green); background: var(--green-subtle); }
.gi-nav__item--cur .gi-nav__name { color: var(--green-dark); font-weight: 600; }
.gi-nav__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.gi-nav__name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gi-nav__meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-nav__sum { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Точка этапа: цвет как у бейджа этапа, только насыщенный */
.gi-nav__dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; flex-shrink: 0; border: none; }
.gi-nav__dot.badge--orange { background: var(--orange); }
.gi-nav__dot.badge--blue   { background: var(--blue); }
.gi-nav__dot.badge--green  { background: var(--green); }
.gi-nav__dot.badge--gray   { background: var(--border); }

@media (max-width: 1100px) {
  .gi-wrap { grid-template-columns: minmax(0, 1fr); }
  .gi-nav { position: static; max-height: 360px; }
}

@media (max-width: 720px) {
  .gi-progress { overflow-x: auto; grid-template-columns: repeat(7, minmax(112px, 1fr)); }
}

/* ── Наличие: чипы ───────────────────────────────────────────────────────── */
.gl-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.gl-chip--ok    { background: var(--green-light);  color: var(--green-dark); }
.gl-chip--short { background: var(--red-light);    color: var(--red-dark); }
.gl-chip--hold  { background: var(--blue-light);   color: var(--blue); }

/* «В сборку →» в строке списка — появляется при наведении */
.gl-pick-btn {
  display: block;
  margin-top: 4px;
  padding: 1px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.gl-row:hover .gl-pick-btn, .gl-group:hover .gl-pick-btn, .gl-pick-btn:focus { opacity: 1; }
.gl-pick-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.gl-pick-btn:disabled { opacity: .4; cursor: progress; }

/* ── Карточка: правки ОС, действия, история ──────────────────────────────── */
.gi-warn {
  margin-bottom: 12px;
  padding: 9px 14px;
  border: 1px solid #f5d9a8;
  border-radius: var(--radius);
  background: var(--orange-light);
  color: #92400e;
  font-size: 13px;
}

.gi-props__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-stripe);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.gi-edited dt::after, .gi-edited-dot {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 5px;
  vertical-align: 1px;
  border-radius: 50%;
  background: var(--blue);
}
.gi-edited-dot { margin: 0 6px 0 0; }
.gi-edited-note { font-size: 12px; color: var(--text-muted); }

.gi-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.gi-section__title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gi-section__title h2 { margin: 0; font-size: 15px; font-weight: 700; }
.gi-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.gi-log {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 12.5px;
}
.gi-log__title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.gi-log__row { display: flex; gap: 14px; padding: 3px 0; }
.gi-log__at { width: 90px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gi-foot .gl-link { font-size: inherit; color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
.gi-foot .gl-link:hover { color: var(--green); }

/* Статус синхронизации счёта с 1С (метод update). */
.gi-sync { font-weight: 600; }
.gi-sync--synced { color: var(--green); }
.gi-sync--pending { color: var(--orange); }
.gi-sync--changed_in_1c { color: var(--orange); }
.gi-sync--error { color: var(--red); }

/* ── Окна правки ─────────────────────────────────────────────────────────── */
.modal.gi-modal--wide { max-width: 760px; }
.gi-modal--wide .modal__footer { align-items: center; }
.gi-lines-ed__total { margin-right: auto; }

.gi-form { display: flex; flex-direction: column; gap: 10px; }
.gi-form__group {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.gi-form__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.gi-led { display: flex; flex-direction: column; }
.gi-led__row {
  display: grid;
  grid-template-columns: 1fr 140px 150px 28px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.gi-led__name { min-width: 0; font-size: 13px; }
.gi-led__qty { display: flex; align-items: center; gap: 6px; }
.gi-led__qty input { width: 100%; padding: 5px 8px; text-align: right; }
.gi-led__x {
  width: 26px; height: 26px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 11px;
}
.gi-led__x:hover { background: var(--red-light); color: var(--red-dark); }
.gi-led__add { align-self: flex-start; }

.gi-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-stripe);
}
.gi-pick__list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.gi-pick__row {
  display: grid;
  grid-template-columns: 1fr auto 110px 90px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.gi-pick__price { text-align: right; white-space: nowrap; }

.gi-json {
  margin: 0;
  padding: 12px;
  max-height: 60vh;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--bg-stripe);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.45;
}

/* ── Вкладки экрана заявок ───────────────────────────────────────────────── */
.tabs.gl-tabs { margin-bottom: 12px; }
.gl-tabs .tab { text-decoration: none; }

/* ── Работа по заявкам: доска (gb-) ──────────────────────────────────────── */
.gb-toolbar { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.gb-toolbar .gl-sub { padding-bottom: 8px; }

.gb-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
  transition: opacity var(--t-med);
}
.gb-board.gl-loading { opacity: .45; pointer-events: none; }

.gb-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-stripe);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.gb-col__head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.gb-col__head .gi-nav__dot { margin-top: 0; }
.gb-col__name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.gb-col__cnt {
  padding: 0 7px;
  border-radius: 10px;
  background: var(--bg-hover);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.gb-col__kg { margin-left: auto; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gb-col__body { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.gb-empty { padding: 14px 0; text-align: center; font-size: 12px; color: var(--text-muted); }

.gb-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.gb-card:hover { border-color: var(--green); box-shadow: var(--shadow-sm); }
.gb-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.gb-card__client {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gb-card__nums { font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.gb-card__meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.gb-card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.gb-card__since { font-size: 11px; color: var(--text-muted); }

/* ── Резерв (gr-) ────────────────────────────────────────────────────────── */
.gr-search { flex: 0 1 420px; }
.gr-row { cursor: pointer; }
.gr-row--open td { background: var(--green-subtle); }
/* Таблица резерва — компактная, как карточка счёта: колонок мало, на всю ширину они расползаются */
.gr-wrap { max-width: 1040px; }
.gr-tbl .tbl-td:first-child { max-width: none; white-space: normal; }
.gr-name { display: flex; gap: 6px; align-items: flex-start; }
.gr-name .gl-chev { padding-top: 2px; }
.gr-order td { padding-top: 6px; padding-bottom: 6px; background: var(--bg-stripe); border-bottom-style: dashed; }
.gr-order td:first-child { padding-left: 34px; }
.gr-order td:first-child > * { margin-right: 10px; }
.gr-order__link { font-weight: 600; color: var(--text-primary); text-decoration: none; font-variant-numeric: tabular-nums; }
.gr-order__link:hover { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.gr-order__client { color: var(--text-secondary); }

/* Факт сборки под количеством в составе счёта */
.gi-lines .gi-picked { color: var(--green-dark); font-weight: 600; }

/* Окно даты отгрузки перед «Подтвердить» / «В сборку» */
.gi-date { font-size: 15px; }
.gi-date-quick { display: flex; gap: 6px; flex-wrap: wrap; }

/* Клиенты: фильтры в заголовках и карточка рядом со списком. */
.cli-filters .gl-search { flex: 1 1 300px; }
.cli-scope { color: var(--text-muted); font-size: 11.5px; }
.cli-scope[hidden] { display: none; }
.cli-table .gl-r { text-align: right; font-variant-numeric: tabular-nums; }
.cli-table .tbl-th { height: auto; min-width: 115px; padding: 10px 14px; vertical-align: top; }
.cli-table .tbl-th:first-child { min-width: 240px; }
.cli-sort { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; }
.cli-sort:hover { color: var(--green); }
.cli-sort span { color: var(--green); font-size: 12px; }
.cli-row { cursor: pointer; }
.cli-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.cli-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cli-footer:empty { display: none; }
.cli-drawer-wrap { position: fixed; inset: 0; z-index: 900; }
.cli-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); }
.cli-drawer { position: absolute; inset: 0 0 0 auto; display: flex; flex-direction: column; width: min(780px, 62vw); max-width: 100%; background: var(--bg-card); box-shadow: var(--shadow-lg); }
.cli-drawer__head { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 15px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
.cli-drawer__close { display: flex; justify-content: center; align-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted); }
.cli-drawer__close:hover { background: var(--bg-hover); }
.cli-drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.cli-profile h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.cli-profile p { margin: 5px 0 0; color: var(--text-secondary); font-size: 13px; }
.cli-profile__props { display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 16px 0; }
.cli-profile__props > div { min-width: 90px; max-width: 100%; }
.cli-profile__props dt { color: var(--text-muted); font-size: 11px; }
.cli-profile__props dd { margin: 3px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.cli-profile__summary { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 12px 14px; border-radius: var(--radius); background: var(--green-light); color: var(--green-dark); font-size: 13px; }
.cli-profile__summary b { font-size: 15px; }
.cli-profile__note { margin: 9px 0 0; color: var(--text-muted); font-size: 11.5px; line-height: 1.4; }
.cli-section { margin-top: 24px; }
.cli-section h3 { margin: 0 0 10px; font-size: 15px; }
.cli-section h3 span { margin-left: 6px; color: var(--text-muted); font-size: 12px; font-weight: 400; }
.cli-detail-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.cli-detail-table .tbl-th { height: 34px; padding: 0 10px; }
.cli-detail-table .tbl-td { padding: 8px 10px; vertical-align: top; }
.cli-detail-table .gl-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cli-product { min-width: 200px; white-space: normal; }
.cli-product .gl-sub { white-space: normal; }
.cli-invoices { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cli-invoice { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text-primary); text-decoration: none; font-size: 13px; }
.cli-invoice + .cli-invoice { border-top: 1px solid var(--border); }
.cli-invoice:hover { background: var(--green-subtle); }
.cli-invoice > span:first-child { flex: 1; min-width: 0; }
.cli-invoice small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.cli-invoice__sum { text-align: right; white-space: nowrap; font-weight: 600; }
.cli-invoice__sum small { font-weight: 400; }
.cli-empty { padding: 18px; color: var(--text-muted); font-size: 13px; }
@media (max-width: 800px) { .cli-drawer { width: min(100%, 680px); } .cli-invoice { flex-wrap: wrap; } }

/* Заявки по клиентам: строка клиента раскрывается в таблицу товаров. */
.gc-client { cursor: pointer; }
.gc-client > td:first-child b { color: var(--text-primary); }
.gc-items-row > td { padding: 0 !important; background: var(--panel-2, #f8fafc); }
.gc-items { width: 100%; }
.gc-items .tbl-th { height: 32px; padding: 0 12px; font-size: 10px; }
.gc-items .tbl-td { padding: 8px 12px; vertical-align: top; }
.gc-orders a { color: #2563eb; text-decoration: none; font-weight: 600; white-space: nowrap; }
.gc-orders a:hover { text-decoration: underline; }
.gc-item { cursor: pointer; }
.gc-lines-row > td { padding: 0 0 8px 24px !important; background: var(--panel-2, #f8fafc); }
.gc-lines .tbl-th { height: 28px; padding: 0 12px; font-size: 10px; color: #94a3b8; }
.gc-lines .tbl-td { padding: 6px 12px; }
.gc-lines a { color: #2563eb; text-decoration: none; font-weight: 600; }
.gc-lines a:hover { text-decoration: underline; }
.gc-lines__date { white-space: nowrap; }

/* Снабжение строки заявки: запрос / партия / ЗП / перемещение */
.gi-supply { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.gi-supply .gl-chip { text-decoration: none; }

/* Расхождение по количеству в перемещении из 1С. */
.gi-lines .gi-line-diff > td { background: #fff7ed; }
.gi-line-diff__value { color: #b45309; font-weight: 700; }

.gi-transfer-route { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.gi-transfer-route .gi-props__row { min-width: 0; grid-template-columns: minmax(90px, 130px) minmax(0, 1fr); }
.gi-transfer-route .gi-props__row + .gi-props__row { border-top: 0; border-left: 1px solid var(--border); }
@media (max-width: 800px) {
  .gi-transfer-route { grid-template-columns: 1fr; }
  .gi-transfer-route .gi-props__row + .gi-props__row { border-left: 0; border-top: 1px solid var(--border); }
}

.transit-route { margin-top: 22px; }
.transit-route__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.transit-route__head h2 { margin: 0; font-size: 16px; }
.transit-route__head span { color: var(--text-muted); font-size: 12px; }

.gupr-product-grouping { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; color: var(--text-muted); font-size: 12px; }
.gupr-product-grouping select { width: auto; min-width: 150px; }
.gupr-product-grouping__error { color: var(--red-dark); }
.gupr-product-group { width: 100%; border: 0; background: var(--bg-hover); color: var(--text-primary); text-align: left; font: inherit; font-weight: 700; padding: 9px 12px; cursor: pointer; }
tr[data-product-code][hidden] { display: none; }
.transit-route__warehouses { margin-top: 4px; color: var(--text-muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.gupr-product-group-row > td { background: var(--bg-hover); border-bottom: 1px solid var(--border); }
.gupr-product-group-row--0 > td { background: var(--bg-stripe); }
.gupr-product-group-total { padding: 9px 12px; text-align: right; font-size: 12px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr[data-product-group-header][hidden] { display: none; }
.transit-items { table-layout: fixed; min-width: 850px; }
.transit-items col:nth-child(1) { width: 42%; }
.transit-items col:nth-child(2) { width: 12%; }
.transit-items col:nth-child(3) { width: 7%; }
.transit-items col:nth-child(4) { width: 17%; }
.transit-items col:nth-child(5) { width: 22%; }
.gupr-product-group-units, .gupr-product-group-meta { font-size: 12px; vertical-align: middle; }
.gupr-product-group-total, .gupr-product-group-units { line-height: 1.5; }
.gupr-product-group-meta { overflow-wrap: anywhere; }
