.admin-body {
  min-height: 100vh;
  background: var(--bg);
}

.admin-login[hidden], .admin[hidden] { display: none; }

.admin {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Экран входа */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, var(--navy) 0%, #1a3a63 100%);
}
.admin-login__card {
  background: #fff;
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-login__card .logo { margin-bottom: 4px; }
.admin-login__card h2 { font-size: 18px; margin-bottom: 4px; }

/* Шапка */
.admin-header {
  background: var(--navy);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  flex-shrink: 0;
}
.admin-header .logo img { height: 22px; }
.admin-header__tag {
  font-size: 11px;
  font-weight: 600;
  color: #cfd9e6;
  background: rgba(255,255,255,.1);
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.btn-outline {
  display: inline-block;
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
.btn-outline:hover { background: rgba(255,255,255,.1); }

.admin-header__actions { display: flex; gap: 10px; align-items: center; }

/* Шапка сверху, слева панель разделов, справа скроллящийся контент */
.admin-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Боковая панель разделов */
.admin-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  padding: 16px 0;
  border-right: 1px solid var(--border);
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
}
.admin-tab {
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.admin-tab:hover { background: var(--bg); }
.admin-tab.active { color: var(--navy); border-left-color: var(--accent); background: var(--bg); }

/* Группа "Заказы" — раскрывающийся раздел с подпунктами */
.admin-tab--group {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-tab__chevron {
  font-size: 11px;
  transition: transform .15s ease;
}
.admin-tab-group.expanded .admin-tab__chevron { transform: rotate(180deg); }

.admin-subtabs {
  display: none;
  flex-direction: column;
}
.admin-tab-group.expanded .admin-subtabs { display: flex; }

.admin-subtab {
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 10px 22px 10px 38px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.admin-subtab:hover { background: var(--bg); }
.admin-subtab.active { color: var(--navy); border-left-color: var(--accent); background: var(--bg); }

.admin-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 28px 32px 60px;
}

/* Заказы — в духе выдачи поиска: сворачиваемые строки, развёрнутый заказ
   отдельной приподнятой карточкой (см. .order-group.expanded ниже), а не
   ряд одинаковых больших карточек подряд. */
.orders-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.orders-header .order-search-wrap { flex: 1; margin-bottom: 0; }
.orders-header #onecCheckReadyBtn { flex-shrink: 0; white-space: nowrap; }
.order-search-wrap { position: relative; max-width: 420px; margin-bottom: 16px; }
.order-search-wrap .order-search { margin-bottom: 0; padding-right: 34px; }
.order-search-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; background: transparent; color: var(--muted);
  cursor: pointer; border-radius: 50%; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.order-search-clear:hover { background: var(--bg); color: var(--text); }

.orders-list { display: flex; flex-direction: column; }

.order-group {
  background: #fff;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.order-group:first-child { border-top: 1px solid var(--border); }
.order-group:first-child:not(.expanded) { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.order-group:last-child:not(.expanded) { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.order-group:not(.expanded):has(+ .order-group.expanded) {
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
}

/* Развёрнутый заказ — отдельная приподнятая карточка со своими
   скруглениями, тенью и отступом от соседей, а не просто "ещё одна
   строка" в общем списке — чтобы не слипался с остальными заказами. */
.order-group.expanded {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 37, 68, .12);
  position: relative;
  z-index: 1;
}
.order-group.expanded:first-child { margin-top: 0; }
.order-group.expanded:last-child { margin-bottom: 0; }
.order-group.expanded + .order-group:not(.expanded) {
  border-top: 1px solid var(--border);
  border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
}

.order-group__header {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: none; border: none; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
}
.order-group__header:hover { background: var(--bg); }
.order-group__header:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.order-group__chevron { color: var(--muted); font-size: 12px; transition: transform .15s; flex-shrink: 0; }
.order-group.expanded .order-group__chevron { transform: rotate(180deg); }

.order-group__id { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; width: 60px; flex-shrink: 0; }

.order-group__customer { min-width: 0; flex: 1.4; }
.order-group__name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-group__submeta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-group__submeta b { color: var(--navy); font-weight: 600; }

/* Фиксированная ширина — иначе строка без бейджей ("не оплачено", без ЧЗ)
   уже строки с одним или двумя бейджами, и из-за единственной "резиновой"
   колонки .order-group__customer (flex: 1.4) весь хвост строки (дата,
   статус, сумма) съезжает вбок от заказа к заказу. */
.order-group__badges { display: flex; gap: 6px; flex-shrink: 0; width: 210px; }

.order-group__max-notified {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e0f2f1;
  color: #00796b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  vertical-align: middle;
}

.order-group__date { font-size: 12px; color: var(--muted); width: 88px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted);
}
.status-dot.status-new { background: #e65100; }
.status-dot.status-confirmed { background: #1565c0; }
.status-dot.status-sent_to_supplier { background: #5e35b1; }
.status-dot.status-awaiting_delivery { background: #0277bd; }
.status-dot.status-ready { background: #00796b; }
.status-dot.status-issued { background: #2e7d32; }
.status-dot.status-cancelled { background: #c62828; }

/* background: none — .status-new/.status-sent_to_supplier/.status-ready в
   styles.css задают фон для бейджей статуса позиции (не namespaced под
   .status-badge) и иначе "протекают" сюда через совпадение имени класса. */
.order-status-icon { display: flex; align-items: center; justify-content: center; width: 16px; flex-shrink: 0; color: var(--muted); background: none; }
.order-status-icon svg { display: block; }
.order-status-icon.status-new { color: #e65100; background: none; }
.order-status-icon.status-sent_to_supplier { color: #5e35b1; background: none; }
.order-status-icon.status-ready { color: #00796b; background: none; }
.order-status-icon--overdue { color: #c62828; background: none; cursor: help; }
.order-status-icons { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.order-group__total { font-size: 15px; font-weight: 700; color: var(--navy); width: 92px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.order-group__actions { display: flex; gap: 8px; flex-shrink: 0; }
/* Фиксированная ширина — бейдж "Оплачено" заметно уже кнопки "💳 Доплатить"/
   "⚠️ Переплата", а .order-group__customer (flex: 1.4) — единственная
   "резиновая" колонка в строке: без фиксации этой ячейки при смене
   кнопки на бейдж (и наоборот) вся дата/статус/сумма/действия справа
   съезжали вбок от заказа к заказу. */
.order-group__prepay-slot { width: 132px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.order-group__actions .btn-onec { padding: 7px 14px; font-size: 12px; }
.order-group__actions .btn-outline-dark { padding: 7px 14px; font-size: 12px; }

/* --- Развёрнутое содержимое: позиции компактными строками --- */
.order-group__body { border-top: 1px solid var(--border); background: var(--bg); }

.order-group__meta-line { padding: 10px 20px 4px 24px; font-size: 12px; color: var(--muted); }
.order-comment { padding: 4px 20px 4px 24px; font-size: 12px; color: var(--muted); font-style: italic; }
.order-group__onec-status { padding: 4px 20px 4px 24px; font-size: 12px; color: var(--muted); }

.order-item-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 24px;
  border-bottom: 1px solid var(--border);
}
.order-item-row:last-of-type { border-bottom: none; }
.order-item-row:hover { background: #fff; }
.order-item-row--match { background: #fff8e1; }
.order-item-row--match:hover { background: #fff3cd; }

.order-item-row__checkbox, .admin-return-item-checkbox { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

.btn-create-return { margin: 12px 20px 16px; }

/* Название реального товара нередко длиннее целого экрана ("Фильтр
   салона для а/м Lada Vesta 15-, Xray 16-; Renault Duster II 18-, ...") —
   в одну строку с многоточием и подсказкой (title) целиком, а не переносом
   на 6-8 строк вразнобой: иначе высота строк "гуляет" и всё визуально
   съезжает. Артикул короткий, ему перенос не грозит. */
.order-item-row__name { flex: 1.6; min-width: 0; }
.order-item-row__title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-item-row__article { font-size: 12px; color: var(--muted); margin-top: 1px; }

.order-item-row__supplier {
  font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.order-item-row__qty { font-size: 13px; color: var(--muted); width: 40px; text-align: center; flex-shrink: 0; }
.order-item-row__delivery { font-size: 12px; color: var(--muted); width: 60px; text-align: center; flex-shrink: 0; }
/* Прибыль (право "prices") — второй, более мелкой строкой под суммой в
   той же колонке, а не отдельной колонкой: иначе на длинных названиях
   строка становится ещё теснее. */
.order-item-row__sum { width: 100px; text-align: right; flex-shrink: 0; }
.order-item-row__sum--editable {
  background: none; border: none; padding: 2px 4px; margin: -2px -4px;
  font: inherit; cursor: pointer; border-radius: 4px;
}
.order-item-row__sum--editable:hover { background: var(--bg); }
.order-item-row__sum-price { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.order-item-row__sum-profit { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 1px; }
.order-item-row__status { width: 168px; flex-shrink: 0; text-align: right; }

/* Бейдж "ЧЗ" — просто индикатор, что позиция отмечена маркированным
   товаром (Честный знак); сама отметка ставится снизу, кнопкой в bulk-bar
   (см. .btn-mark-chestny), не отсюда. */
.order-item-row__marked {
  flex-shrink: 0;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}

.order-group-toggle {
  display: block; width: 100%; text-align: left; padding: 9px 20px 9px 24px;
  background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer;
}
.order-group-toggle:hover { text-decoration: underline; }

/* Раздел "Выдача" — одна группа на одну расходную накладную (выдачу),
   позиции этой накладной сразу под её строкой-заголовком. */
.goods-issue-group { border-top: 1px solid var(--border); }
.goods-issue-group:first-of-type { border-top: none; }
.goods-issue-group__header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--bg);
}
.goods-issue-group__title { font-size: 13px; font-weight: 600; flex: 1; }
.goods-issue-group__total { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn-prepay, .btn-process-return {
  background: #6cc244;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-prepay:hover, .btn-process-return:hover { background: #59a936; }
.btn-prepay:disabled, .btn-process-return:disabled { opacity: .5; cursor: not-allowed; }

/* Возвраты */
.return-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 10px 0;
  padding: 16px 20px;
}
.return-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.return-card__id { font-weight: 700; color: var(--navy); font-size: 14px; }
.return-card__customer { flex: 1; min-width: 160px; }
.return-card__amount { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.return-card__items { margin-top: 10px; font-size: 14px; }
.return-card__item { padding: 3px 0; }
.return-card__comment { margin-top: 8px; font-size: 13px; color: var(--muted); font-style: italic; }
.return-card__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.return-status-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
}
.return-card__error { flex-basis: 100%; }

.btn-overpaid {
  background: #e0662a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-overpaid:hover { background: #c2531e; }

.btn-confirm-marking {
  background: #e0a020;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-confirm-marking:hover { background: #c48a15; }

/* --- Панель массовых действий: выбор + кнопка "Статус" (открывает
   модалку) + отправка поставщику --- */
.bulk-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px 14px 24px; border-top: 1px dashed var(--border);
}
.bulk-bar__select-all {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; flex-shrink: 0;
}
.bulk-bar__select-all input { accent-color: var(--accent); cursor: pointer; }
.bulk-bar__count { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.bulk-bar__profit { font-size: 12px; color: var(--navy); font-weight: 600; flex-shrink: 0; }
.bulk-bar__spacer { flex: 1; }
.btn-outline-dark:disabled { opacity: .4; cursor: not-allowed; }

/* Счётчик у "Активные" — просто число рядом с названием вкладки. */
.admin-subtab__count {
  display: inline-block; margin-left: 4px; font-size: 11px; font-weight: 700;
  color: var(--muted); background: var(--bg); padding: 1px 7px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.admin-subtab.active .admin-subtab__count { color: var(--navy); background: #fff; }

/* Модалка смены статуса — плашки статуса кликабельны, как радиокнопки */
.status-options { display: flex; flex-wrap: wrap; gap: 8px; }
.status-option { border: none; font-family: inherit; cursor: pointer; }
.status-option.selected { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Список сотрудников переиспользует .order-row */
.order-row {
  display: grid;
  grid-template-columns: 60px 1fr 140px 110px 140px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.order-row:last-child { border-bottom: none; }
.order-row__head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
}
.order-row__total { font-weight: 700; }

.order-search,
.customer-search {
  display: block;
  width: 100%;
  max-width: 420px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}

/* Клиенты — в духе "Заказов": построчные карточки со своим бордером
   каждая (скругление только у первой/последней), а не одна общая
   обёртка-таблица (см. .order-group для сравнения). */
.customers-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.customer-search-wrap { position: relative; max-width: 420px; flex: 1; }
.customer-search-wrap .customer-search { margin-bottom: 0; padding-right: 34px; }
.customer-search-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; background: transparent; color: var(--muted);
  cursor: pointer; border-radius: 50%; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.customer-search-clear:hover { background: var(--bg); color: var(--text); }

.customers-list { display: flex; flex-direction: column; }

.customer-card {
  background: #fff;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.customer-card:first-child { border-top: 1px solid var(--border); border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.customer-card:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }

.customer-card__row {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: none; border: none; cursor: pointer; text-align: left;
  font-family: inherit; color: inherit;
}
.customer-card__row:hover { background: var(--bg); }
.customer-card__row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.customer-card__phone { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; width: 130px; flex-shrink: 0; }
.customer-card__main { min-width: 0; flex: 1.5 1 100px; }
.customer-card__name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.customer-card__submeta { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.customer-card__badges { display: flex; align-items: center; justify-content: flex-end; gap: 6px; row-gap: 4px; flex-wrap: wrap; flex-shrink: 1; min-width: 0; }
.chip--discount {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; background: #fff3e0; color: #b25a00;
}
.customer-card__order-btn {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; background: var(--accent); color: #fff; border: none; cursor: pointer;
}
.customer-card__order-btn:hover { background: var(--accent-dark); }

.customer-card__orders { font-size: 12px; color: var(--muted); width: 88px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.customer-card__total { font-size: 15px; font-weight: 700; color: var(--navy); width: 96px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.customer-card__date { font-size: 12px; color: var(--muted); width: 84px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.customer-card__chevron { color: var(--muted); font-size: 16px; flex-shrink: 0; }

/* Модалка клиента — секции с читаемой сеткой полей вместо голого dl,
   история заказов в стиле .order-item-row из раздела "Заказы". */
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.info-card { background: var(--bg); border-radius: var(--radius); padding: 14px 16px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.info-grid__item dt { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.info-grid__item dd { font-size: 14px; font-weight: 600; }

.status-line-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.status-line-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.customer-orders-title { font-size: 14px; margin: 18px 0 10px; }

.btn-outline-dark {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn-outline-dark:hover { background: var(--bg); }

.btn-onec {
  background: #f5c518;
  border: none;
  color: #1a1a1a;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn-onec:hover { background: #e0b20f; }
.btn-onec:disabled { opacity: 0.6; cursor: default; }

.btn-onec--synced { background: #7cb342; color: #fff; }
.btn-onec--synced:hover { background: #689f38; }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.send-confirm-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  max-height: 320px;
  overflow-y: auto;
}
.send-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.send-confirm-row--sent { background: #e6f7ee; }
.send-confirm-row--failed { background: #fdecea; }
.send-confirm-row__name { flex: 1; min-width: 0; }
.send-confirm-row__status {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.send-confirm-row__status--sent { color: #1c9d5b; }
.send-confirm-row__status--failed { color: #c0392b; }

/* Поставщики */
.suppliers-list { display: flex; flex-direction: column; gap: 16px; }
.supplier-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.supplier-card__header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.supplier-card__header:hover { background: var(--bg); }
.supplier-card__header h3 { font-size: 16px; }
.supplier-card__meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.supplier-card__chevron {
  color: var(--muted);
  transition: transform .15s;
  flex-shrink: 0;
}
.supplier-card.expanded .supplier-card__chevron { transform: rotate(180deg); }

.supplier-card__body { padding: 0 20px 20px; }

.supplier-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.supplier-form .field { flex: 1; min-width: 200px; }
.supplier-form .field--wide { flex-basis: 100%; }
.price-ranges-btn, .working-days-btn { flex-basis: 100%; width: fit-content; }

.price-ranges-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
.price-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.price-range-row__dash { color: var(--muted); }
.price-range-row input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  width: 90px;
}
.price-range-row .pr-markup { width: 80px; }
.price-range-row .pr-remove {
  background: var(--bg);
  color: var(--text);
  margin-left: auto;
}
.prepay-amount-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.prepay-amount-row input { flex: 1; }
.prepay-amount-row button { white-space: nowrap; }

.working-days-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}
.working-day-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.working-day-item input[type="checkbox"] { width: auto; }

.field-hint { font-size: 11px; color: var(--muted); }
.field--info { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; }
.field-hint--info { font-size: 13px; color: var(--text); margin: 4px 0 0; }
.field--checkbox__row { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.field--checkbox__row input[type="checkbox"] { width: auto; }

/* Сотрудники */
.employee-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.employee-form .field { flex: 1; min-width: 200px; }

.employees-list {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.employee-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 120px 140px;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
}
.employee-row:last-child { border-bottom: none; }
.employee-row:hover { background: var(--bg); }
.employee-row__head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 600;
  cursor: default;
}
.employee-row__head:hover { background: none; }

.status-max-linked { background: #e0f2f1; color: #00796b; }
.status-max-unlinked { background: var(--bg); color: var(--muted); }
.status-disabled { background: #fde8e8; color: #c62828; margin-left: 6px; }

.max-notify-admin-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.max-notify-admin-row:last-child { border-bottom: none; }
.max-notify-admin-row span:first-child { flex: 1; font-weight: 600; }
.max-notify-remove-btn { flex-shrink: 0; color: var(--muted); }
.max-notify-remove-btn:hover { color: var(--danger, #c0392b); }

.max-notify-add-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.max-notify-add-row select {
  flex: 1; max-width: 280px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 14px;
}
#maxBotNotifyAddBtn { margin-top: 12px; }

.employee-danger-zone {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.btn-danger-outline {
  background: transparent;
  border: 1px solid #c0392b;
  color: #c0392b;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn-danger-outline:hover { background: #fde8e8; }
.btn-danger-outline:disabled { opacity: .5; cursor: not-allowed; }

.btn-danger {
  background: #c0392b;
  border: none;
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn-danger:hover { background: #a5281b; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }

.modal__warning {
  color: #a4231a;
  background: #fdecea;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.modal__warning:empty { display: none; }

.permissions-field { flex-basis: 100%; }
.permissions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.permission-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.permission-checkbox input { width: auto; }

.employee-max-code {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .06em;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 0;
  text-align: center;
}

.onec-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.onec-form .field { flex: 1; min-width: 200px; }
.onec-form .field--wide { flex-basis: 100%; }

/* Группировка нескольких форм внутри одного раздела (например "Магазин
   1С": подключение к базе и настройки автопрохода — разные назначения,
   разные кнопки "Сохранить") в отдельные карточки, в духе .supplier-card.
   .onec-form внутри теряет свою собственную рамку/отступы (иначе получалась
   бы рамка в рамке) — раскладку полей (flex-wrap) оставляем как есть. */
.settings-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.settings-block:last-child { margin-bottom: 0; }
.settings-block h3 { font-size: 16px; margin-bottom: 6px; }
.settings-block > p.muted { margin-bottom: 14px; }
.settings-block .onec-form { background: none; border: none; padding: 0; margin-bottom: 0; }

/* Синонимы брендов */
.brand-synonym-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0 16px;
}
.brand-synonym-form .field { flex: 1; min-width: 200px; }
.brand-synonym-form .field--wide { flex-basis: 100%; }
.brand-synonym-form textarea { resize: vertical; }

.brand-synonyms-list { display: flex; flex-direction: column; }
.brand-synonym-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.brand-synonym-row:last-child { border-bottom: none; }
.brand-synonym-row__name { font-weight: 700; }
.brand-synonym-row__aliases { color: var(--muted); flex: 1; }
.brand-synonym-row .icon-btn { background: var(--bg); color: var(--muted); font-size: 14px; padding: 6px 10px; }
.brand-synonym-row .icon-btn:hover { background: #fde8e8; color: #c0392b; }

/* Скидки (уровни лояльности) */
.discount-level-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0 16px;
}
.discount-level-form .field { flex: 1; min-width: 200px; }

.discount-levels-list { display: flex; flex-direction: column; }
.discount-level-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.discount-level-row:last-child { border-bottom: none; }
.discount-level-row__name {
  flex: 1; min-width: 160px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
.discount-level-row__percent-wrap { display: flex; align-items: center; gap: 6px; color: var(--muted); flex-shrink: 0; }
.discount-level-row__percent {
  width: 70px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
.discount-level-row .icon-btn { background: var(--bg); color: var(--muted); font-size: 14px; padding: 6px 10px; flex-shrink: 0; }
.discount-level-row .icon-btn:hover { background: #fde8e8; color: #c0392b; }

.discount-level-select {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; font-size: 13px; font-family: inherit; color: var(--text); background: #fff;
}

/* Приход — блоки по поставщику, в духе .supplier-card, но без сворачивания:
   позиций внутри обычно мало, и все нужны сразу на виду для печати. */
.arrivals-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.arrivals-list { display: flex; flex-direction: column; gap: 16px; }
.arrival-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.arrival-block__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.arrival-block__header h3 { font-size: 15px; }
.arrival-block__count { font-size: 12px; color: var(--muted); }
.arrival-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.arrival-row:last-of-type { border-bottom: none; }
.arrival-row__name { flex: 1.6; min-width: 0; }
.arrival-row__title { font-weight: 600; }
.arrival-row__article { font-size: 11px; color: var(--muted); margin-top: 2px; }
.arrival-row__customer { flex: 1; }
.arrival-row__qty { width: 60px; text-align: right; color: var(--muted); flex-shrink: 0; }
.arrival-row__label-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.arrival-row__label-count span { font-size: 10px; color: var(--muted); white-space: nowrap; }
.arrival-row__label-count input {
  width: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 2px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
}
.arrival-block__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.arrival-block__footer .arrival-block__selected { font-size: 12px; color: var(--muted); margin-right: auto; }
.arrival-block__footer button { padding: 6px 12px; font-size: 12px; }
.arrival-remove-btn { border-color: #f0b8ae; color: #c62828; }
.arrival-remove-btn:hover { background: #fde8e8; }

/* Финансы */
.finance-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.finance-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.finance-card--accent { border: 2px solid var(--navy); }
.finance-card__label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.finance-card__value { font-size: 22px; font-weight: 700; color: var(--navy); }
.finance-card__note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.finance-card__note--up { color: #2e7d32; }
.finance-card__note--down { color: #c62828; }

.finance-block { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; }
.finance-block--table { overflow: hidden; }
.finance-block__title { font-size: 14px; font-weight: 700; color: var(--navy); padding: 16px 20px 0; }
.finance-block--table .finance-block__title { padding: 14px 20px; border-bottom: 1px solid var(--border); margin-bottom: 0; }

.finance-chart { display: flex; align-items: flex-end; gap: 24px; height: 170px; padding: 16px 24px 20px; }
.finance-chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.finance-chart__value { font-size: 12px; font-weight: 600; color: var(--navy); }
.finance-chart__bar { width: 56px; background: var(--navy); border-radius: 6px 6px 0 0; opacity: .85; }
.finance-chart__label { font-size: 12px; color: var(--muted); }

.finance-row {
  display: grid;
  grid-template-columns: 90px 70px 1.4fr 100px 100px 100px;
  padding: 11px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.finance-row:last-of-type { border-bottom: none; }
.finance-row--head { font-size: 11px; color: var(--muted); padding: 10px 20px; }
.finance-row__order { color: var(--muted); }
.finance-row__customer { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-row__num { text-align: right; }
.finance-row__num--muted { color: var(--muted); }
.finance-row__num--profit { font-weight: 600; color: var(--navy); }
.finance-note { padding: 10px 20px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); margin: 0; }

/* Печать этикеток — отдельная скрытая область, наполняется перед
   window.print() (см. printArrivalLabels в admin.js) и печатается ЕЮ ОДНОЙ:
   на экране весь остальной интерфейс скрывается через @media print, чтобы
   не печатать шапку/навигацию/список вместе с этикетками. */
#arrivalsLabelsPrintArea { display: none; }
@media print {
  body.admin-body > *:not(#arrivalsLabelsPrintArea) { display: none !important; }
  #arrivalsLabelsPrintArea { display: block !important; }
  /* Без этого правила страница печатается на дефолтном A4 с полями, а в
     полях браузер сам подписывает заголовок/URL/дату (то, что мешало —
     "адреса на печати"). Поля 0 у @page убирают место под них: печатать
     самому браузеру уже некуда, колонтитулы пропадают сами. Заодно и
     физический размер страницы становится ровно 57×40мм — то, что нужно
     принтеру этикеток. */
  @page { size: 57mm 40mm; margin: 0; }
  .arrival-label {
    width: 57mm;
    height: 40mm;
    padding: 2.3mm 2.9mm;
    box-sizing: border-box;
    page-break-after: always;
    font-family: Arial, sans-serif;
    color: #14213d;
    display: flex;
    flex-direction: column;
  }
  .arrival-label__header { text-align: center; margin-bottom: 1.1mm; line-height: 1; }
  .arrival-label__brand-name { font-size: 3.6mm; font-weight: 800; letter-spacing: 0.1mm; color: #1c3f8f; }
  .arrival-label__brand-sub { font-size: 1.6mm; font-weight: 700; letter-spacing: 0.6mm; color: #1c3f8f; margin-top: 0.6mm; }
  .arrival-label__item {
    border-top: 0.2mm solid #1c3f8f;
    border-bottom: 0.2mm solid #1c3f8f;
    padding: 1.1mm 0;
  }
  .arrival-label__name { font-size: 2.7mm; font-weight: 700; line-height: 1.2; max-height: 2.3em; overflow: hidden; }
  .arrival-label__article { font-size: 2.5mm; color: #6b7280; margin-top: 0.6mm; }
  .arrival-label__client { font-size: 3mm; font-weight: 700; margin: 1.5mm 0; }
  .arrival-label__footer { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 1.9mm; }
  .arrival-label__contacts { font-size: 1.9mm; line-height: 1.5; color: #4b5468; margin-bottom: 0.8mm; }
  .arrival-label__site { font-size: 2.85mm; font-weight: 800; font-style: italic; color: #1c8fd8; }
  .arrival-label__qr { width: 13mm; height: 13mm; flex-shrink: 0; }
}

.field-actions { display: flex; gap: 8px; margin-top: 10px; }

.btn-secondary {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn-secondary:hover { background: var(--accent); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }

.save-status-slot { font-size: 13px; margin-top: 10px; color: #1c9d5b; }
.save-status-slot.error { color: #d33; }
.save-status-slot:empty { display: none; }

@media (max-width: 720px) {
  .order-row { grid-template-columns: 1fr 1fr; }
  .order-row span:nth-child(n+5) { display: none; }

  .customer-card__phone, .customer-card__date, .customer-card__badges { display: none; }
  .info-grid { grid-template-columns: 1fr; }

  .admin-layout { flex-direction: column; }
  .admin-tabs {
    flex-direction: row;
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 6px;
    overflow-x: auto;
    overflow-y: visible;
  }
  .admin-tab { border-left: none; border-bottom: 3px solid transparent; }
  .admin-tab.active { border-bottom-color: var(--accent); }
  .admin-main { padding: 20px 16px 40px; }

  .admin-tab-group { display: flex; align-items: center; flex-shrink: 0; }
  .admin-tab--group { white-space: nowrap; border-bottom: 3px solid transparent; }
  .admin-subtabs.admin-subtabs { flex-direction: row; }
  .admin-tab-group.expanded .admin-subtabs { display: flex; }
  .admin-subtab { border-left: none; border-bottom: 3px solid transparent; padding: 13px 14px; white-space: nowrap; }
  .admin-subtab.active { border-bottom-color: var(--accent); }
}
