/* =====================================================================
   WINMER B2B — Дополнения к базовой системе styles.css (v34 / v39)
   Белый лист, тонкие разделительные линии var(--line), табличные цифры.
   ===================================================================== */

/* Приглашение по реферальной ссылке представителя (?ref=REP01) */
.b2b-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #f4f6f8;
  box-shadow: inset 2px 0 0 var(--cold);
}
.b2b-ref b {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
}
.b2b-ref span {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.b2b-ref__code {
  flex: none;
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cold);
}

/* Прогресс оборота в карточке авторизованного корпоративного клиента */
.b2b-tier {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.b2b-tier__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.b2b-tier__head span {
  color: var(--ink-2);
}
.b2b-tier__head b {
  font-weight: 650;
  color: var(--ink);
}
.b2b-tier__bar {
  height: 6px;
  margin: 10px 0 8px;
  border-radius: 999px;
  background: #eef1f4;
  overflow: hidden;
}
.b2b-tier__bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--cold);
  transition: width .35s var(--ease-out);
}
.b2b-tier__foot {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* Блок реферальной ссылки в карточке мерчендайзера */
.b2b-rep-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.b2b-rep-box__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.b2b-rep-box__url {
  display: flex;
  gap: 6px;
}
.b2b-rep-box__url input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: #f4f6f8;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12.5px;
  color: var(--ink);
}

/* Поиск и фильтры внутри кабинета СТО */
.b2b-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  box-shadow: inset 0 -1px 0 var(--line);
}
.b2b-bar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.b2b-bar__filters .field {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background: #f4f6f8;
  font-size: 14px;
}
.b2b-bar__filters input.field {
  flex: 1 1 260px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.b2b-bar__filters input.field:focus {
  box-shadow: inset 0 0 0 1.5px var(--cold), 0 0 0 4px var(--cold-tint);
}

/* Строка товара в оптовом каталоге B2B (расширение .pline из styles.css) */
.pline--b2b {
  grid-template-columns: 88px minmax(0, 1fr) 230px;
}
.pline__wo {
  width: 100%;
  height: 34px;
  margin-top: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #f4f6f8;
  box-shadow: inset 0 0 0 1px var(--line);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}
.pline__wo:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--cold);
}
.pline__subprice {
  font-size: 12.5px;
  color: var(--ink-3);
}
.pline__margin {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ok);
}

/* Таблицы на белом листе (рассылки, клиенты, заказы в админке) */
.b2b-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.b2b-sheet-table th,
.b2b-sheet-table td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
  box-shadow: inset 0 -1px 0 var(--line);
}
.b2b-sheet-table th:first-child,
.b2b-sheet-table td:first-child {
  padding-left: 0;
}
.b2b-sheet-table th:last-child,
.b2b-sheet-table td:last-child {
  padding-right: 0;
}
.b2b-sheet-table th {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}

/* Подпись объёма на шагах градации (.isteps) */
.isteps__meta {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   Главная сетка входа и регистрации B2B (форма — основной широкий блок)
   ===================================================================== */
.b2b-auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) 380px;
  gap: 36px;
  align-items: start;
}
.b2b-auth-card {
  position: static;
  padding: 32px 36px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.b2b-auth-card .cseg {
  display: grid;
  width: 100%;
  margin-bottom: 22px;
}
.b2b-auth-head {
  margin-bottom: 22px;
}
.b2b-auth-head h2 {
  font-size: 1.5rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.b2b-auth-head p {
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.b2b-login-form {
  grid-template-columns: 1fr;
  max-width: 520px;
}
.b2b-reg-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}
.b2b-consents {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8f9fa;
  box-shadow: inset 0 0 0 1px var(--line);
}
.b2b-auth-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

/* Правая компактная колонка с градацией корпоративных скидок */
.b2b-side-card {
  padding: 28px;
  border-radius: 20px;
  background: #f4f6f8;
  box-shadow: inset 0 0 0 1px var(--line);
}
.b2b-side-card h2 {
  font-size: 1.25rem;
  font-weight: 680;
  letter-spacing: -0.018em;
  line-height: 1.25;
}
.b2b-side-card__lead {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.b2b-steps-v {
  counter-reset: st;
  display: grid;
  gap: 0;
  margin-top: 22px;
}
.b2b-steps-v li {
  counter-increment: st;
  position: relative;
  padding: 0 0 20px 44px;
}
.b2b-steps-v li:last-child {
  padding-bottom: 0;
}
.b2b-steps-v li::before {
  content: counter(st);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.b2b-steps-v li::after {
  content: "";
  position: absolute;
  left: 13.5px;
  top: 34px;
  bottom: 6px;
  width: 1px;
  background: var(--line-2);
}
.b2b-steps-v li:last-child::after {
  display: none;
}
.b2b-steps-v .isteps__meta {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}
.b2b-steps-v b {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.3;
}
.b2b-steps-v p {
  margin-top: 3px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.b2b-side-card__foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-3);
}
.b2b-side-card__foot a {
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

@media (max-width: 1024px) {
  .b2b-auth-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .b2b-auth-card {
    padding: 22px 18px;
  }
  .b2b-reg-form {
    grid-template-columns: 1fr;
  }
}

/* Входящие сообщения от представителя */
.b2b-msgs {
  display: grid;
  gap: 16px;
}
.b2b-msg {
  padding: 20px 0;
  box-shadow: inset 0 -1px 0 var(--line);
}
.b2b-msg:first-child {
  padding-top: 4px;
}
.b2b-msg__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.b2b-msg__top h3 {
  font-size: 1.0625rem;
  font-weight: 650;
}
.b2b-msg__top small {
  font-size: 13px;
  color: var(--ink-3);
}
.b2b-msg__body {
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-line;
  max-width: 72ch;
}
.b2b-msg__skus {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .pline--b2b {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .b2b-sheet-table {
    display: block;
    overflow-x: auto;
  }
}

/* =====================================================================
   Аналитика, графики, срезы и помесячная отчётность (Кабинет ТП и Админка)
   Строго в дизайн-системе winmer.ru: белый лист, тонкие линии, var(--cold)
   ===================================================================== */

/* Верхняя сводка KPI (4 карточки в ряд) */
.b2b-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.b2b-kpi-card {
  padding: 18px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.b2b-kpi-card--accent {
  background: #f8faff;
  box-shadow: 0 0 0 1px rgba(15, 89, 216, 0.22);
}
.b2b-kpi-card__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.b2b-kpi-card__val {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.b2b-kpi-card__val--ok {
  color: var(--ok);
}
.b2b-kpi-card__val--cold {
  color: var(--cold);
}
.b2b-kpi-card__sub {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.35;
}
.b2b-delta {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.b2b-delta.is-up {
  background: rgba(19, 122, 75, 0.1);
  color: var(--ok);
}
.b2b-delta.is-down {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}
.b2b-delta.is-flat {
  background: #eef1f4;
  color: var(--ink-2);
}

/* Блоки графиков и срезов */
.b2b-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.b2b-slices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.b2b-box {
  padding: 22px 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.b2b-box__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.b2b-box__head h3 {
  font-size: 1.0625rem;
  font-weight: 680;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.b2b-box__head p {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-3);
}
.b2b-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-2);
}
.b2b-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.b2b-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Столбчатый график помесячной динамики */
.b2b-mchart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  height: 210px;
  padding-top: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.b2b-mchart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
  cursor: pointer;
  padding: 6px 4px 0;
  border-radius: 10px;
  transition: background .2s;
}
.b2b-mchart__col:hover,
.b2b-mchart__col.is-active {
  background: #f4f7fb;
}
.b2b-mchart__val {
  font-size: 11px;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}
.b2b-mchart__comm {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.b2b-mchart__bars {
  width: 100%;
  max-width: 48px;
  height: 130px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.b2b-mchart__bar {
  flex: 1;
  border-radius: 6px 6px 2px 2px;
  background: var(--cold);
  min-height: 4px;
  transition: height .35s var(--ease-out);
}
.b2b-mchart__bar--pending {
  background: #cbd5e1;
}
.b2b-mchart__bar--comm {
  background: var(--ok);
  max-width: 12px;
}
.b2b-mchart__lbl {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.b2b-mchart__sub {
  font-size: 11px;
  color: var(--ink-3);
}

/* Горизонтальные полосы срезов (категории, уровни, география) */
.b2b-slist {
  display: grid;
  gap: 14px;
}
.b2b-sitem__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  margin-bottom: 5px;
}
.b2b-sitem__name {
  font-weight: 600;
  color: var(--ink);
}
.b2b-sitem__meta {
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.b2b-sitem__bar {
  height: 7px;
  border-radius: 999px;
  background: #eef1f4;
  overflow: hidden;
}
.b2b-sitem__bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--cold);
}
.b2b-sitem__bar--ok i {
  background: var(--ok);
}

/* Статус-бейджи полевой работы с клиентом (CRM мерчендайзера) */
.b2b-vstatus {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
}
.b2b-vstatus--active_partner {
  background: rgba(19, 122, 75, 0.1);
  color: var(--ok);
}
.b2b-vstatus--visit_planned,
.b2b-vstatus--Onboarding {
  background: rgba(15, 89, 216, 0.1);
  color: var(--cold);
}
.b2b-vstatus--call_needed {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}
.b2b-vstatus--paused {
  background: #eef1f4;
  color: var(--ink-3);
}

/* Статус базы данных и резервного копирования */
.b2b-sys-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.b2b-sys-card {
  padding: 18px 20px;
  border-radius: 14px;
  background: #f8f9fb;
  box-shadow: inset 0 0 0 1px var(--line);
}
.b2b-sys-card b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 4px;
}
.b2b-sys-card p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .b2b-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .b2b-analytics-grid,
  .b2b-slices-grid,
  .b2b-sys-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .b2b-kpi-strip {
    grid-template-columns: 1fr;
  }
  .b2b-mchart {
    gap: 6px;
  }
}

@media print {
  .header, .footer, .acc__auth, .acc__tabs, [data-no-print] {
    display: none !important;
  }
  .acc__grid {
    display: block !important;
  }
}

/* =====================================================================
   Привилегии юрлиц, статусы блокировки, карточки клиентов и Push-виджет
   ===================================================================== */

.b2b-priv-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.b2b-priv-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  background: rgba(15, 89, 216, 0.08);
  color: var(--cold);
  box-shadow: inset 0 0 0 1px rgba(15, 89, 216, 0.18);
}
.b2b-priv-chip--disc {
  background: rgba(19, 122, 75, 0.1);
  color: var(--ok);
  box-shadow: inset 0 0 0 1px rgba(19, 122, 75, 0.22);
}
.b2b-priv-chip--note {
  background: #f8f9fb;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b2b-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
}
.b2b-status-pill.is-active {
  background: rgba(19, 122, 75, 0.1);
  color: var(--ok);
}
.b2b-status-pill.is-blocked {
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}
tr.is-row-blocked {
  background: rgba(180, 35, 24, 0.03);
}

.b2b-row-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.btn.is-danger-btn {
  color: #b42318;
}
.btn.is-danger-btn:hover {
  background: rgba(180, 35, 24, 0.08);
}

.b2b-readonly-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8faff;
  box-shadow: inset 0 0 0 1px rgba(15, 89, 216, 0.2);
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 16px;
  line-height: 1.45;
}

.b2b-priv-panel {
  padding: 18px 20px;
  border-radius: 14px;
  background: #f8f9fb;
  box-shadow: inset 0 0 0 1px var(--line);
}
.b2b-priv-panel h3 {
  font-size: 1rem;
  font-weight: 680;
  color: var(--ink);
}

.b2b-push-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8f9fb;
  box-shadow: inset 0 0 0 1px var(--line);
}
.b2b-push-box__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.b2b-push-box__row b {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.b2b-push-box__row span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
.b2b-push-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.b2b-push-dot.is-on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(19, 122, 75, 0.16);
}
.b2b-push-box__acts {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
