/*
 * Компоненты дизайн-системы ЛД (§4) + общие компоненты, перенесённые из dpan/public/styles.css
 * (modal, toast, switch, checkbox, textarea, kpi, notice, spinner, accordion, table, toolbar и т. д.).
 * Все классы — с префиксом ld-. Стили вкладок/модулей волны 2 — в public/css/views/<view>.css.
 * Витрина: /dev/kit.html.
 */

/* ---------- Шапка (§4.1) ---------- */
.ld-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
  background-color: var(--grey-700);
  border-bottom: 2px solid var(--yellow-700);
  color: var(--white-1000);
  flex-shrink: 0;
}
.ld-app-header__brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.ld-logo {
  width: 60px;
  height: 36px;
  flex-shrink: 0;
}
.ld-app-header__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--white-1000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ld-app-header__actions {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  min-width: 0;
}
.ld-app-header__user {
  color: var(--grey-100);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Вкладки в тёмной шапке: те же ld-tab, светлый текст, жёлтая линия снизу */
.ld-header-tabs {
  display: flex;
  align-items: stretch;
  gap: 24px;
  height: 100%;
}
.ld-header-tabs .ld-tab {
  height: 100%;
  color: var(--grey-100);
}
.ld-header-tabs .ld-tab:hover {
  color: var(--white-1000);
}
.ld-header-tabs .ld-tab--active {
  color: var(--white-1000);
}
.ld-header-tabs .ld-tab--active::after {
  bottom: -2px;
}

/* ---------- Вкладки (§4.6) ---------- */
.ld-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ld-tabs::-webkit-scrollbar { display: none; }
.ld-tab {
  position: relative;
  height: 40px;
  padding: 0 4px;
  background: none;
  border: none;
  font-family: var(--ff-basic);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-450);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: color 150ms ease;
}
.ld-tab:hover { color: var(--text-primary); }
.ld-tab--active {
  color: var(--text-primary);
  font-weight: 700;
}
.ld-tab--active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--yellow-700);
}
.ld-tab__count {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
/* Подвкладки внутри экрана (компактнее) */
.ld-tabs--sub { gap: 24px; margin-bottom: 16px; }
.ld-tabs--sub .ld-tab { height: 38px; font-size: 12px; }

/* ---------- Кнопки (§4.3) ---------- */
.ld-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 39px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--ff-basic);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 200ms ease-out, box-shadow 200ms ease-out, color 200ms ease-out, border-color 200ms ease-out;
}
.ld-btn--primary {
  background: var(--yellow-700);
  color: var(--grey-700);
}
.ld-btn--primary:hover:not(:disabled) {
  background: var(--yellow-500);
  box-shadow: var(--yellow-button-hover-shadow);
}
.ld-btn--primary:disabled {
  background: var(--yellow-100);
  color: var(--text-muted);
  cursor: not-allowed;
}
.ld-btn--secondary {
  background: var(--grey-700);
  color: var(--white-1000);
}
.ld-btn--secondary:hover:not(:disabled) {
  background: var(--yellow-700);
  color: var(--grey-700);
}
.ld-btn--outline {
  background: transparent;
  border-color: var(--mist-300);
  color: var(--text-primary);
}
.ld-btn--outline:hover:not(:disabled) {
  border-color: var(--text-primary);
  background: var(--mist-90);
}
.ld-btn--secondary:disabled,
.ld-btn--outline:disabled,
.ld-btn--quiet:disabled,
.ld-btn--danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Quiet — без рамки (иконки в строках, «Ещё») */
.ld-btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-primary);
}
.ld-btn--quiet:hover:not(:disabled) { background: var(--mist-90); }
/* Danger — удаление */
.ld-btn--danger {
  background: var(--status-danger-bg);
  border-color: var(--status-danger);
  color: var(--status-danger);
}
.ld-btn--danger:hover:not(:disabled) {
  background: var(--status-danger);
  color: var(--white-1000);
}
.ld-btn--lg { height: 49px; padding: 0 32px; font-size: 14px; }
.ld-btn--sm { height: 32px; padding: 0 16px; border-radius: var(--radius-sm); font-size: 11px; }
.ld-btn--block { width: 100%; }
/* Квадратная кнопка-иконка */
.ld-btn--icon { width: 39px; padding: 0; gap: 0; }
.ld-btn--icon.ld-btn--sm { width: 32px; }
.ld-btn .ld-spinner { margin-right: -4px; }

/* ---------- Поля (§4.4) ---------- */
.ld-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ld-field__label {
  color: var(--grey-500);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ld-input,
.ld-select,
.ld-textarea {
  height: 40px;
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background-color: var(--white-1000);
  color: var(--text-primary);
  font-family: var(--ff-basic);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  outline: none;
  transition: border-color 150ms ease-out;
}
.ld-textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
  line-height: 1.45;
}
.ld-select {
  padding-right: 36px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--grey-450) 50%),
    linear-gradient(135deg, var(--grey-450) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.ld-input::placeholder,
.ld-textarea::placeholder { color: var(--placeholder); font-weight: 400; }
.ld-input:hover,
.ld-select:hover,
.ld-textarea:hover { border-color: var(--placeholder); }
.ld-input:focus,
.ld-select:focus,
.ld-textarea:focus { border-color: var(--text-primary); }
.ld-input--invalid,
.ld-input--invalid:hover,
.ld-input--invalid:focus { border-color: var(--status-danger); }
.ld-field__hint { color: var(--grey-450); font-size: 12px; }
.ld-field__error { color: var(--status-danger); font-size: 12px; font-weight: 500; }
.ld-input:disabled,
.ld-select:disabled,
.ld-textarea:disabled {
  background-color: var(--mist-80);
  border-color: var(--border-line-default);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ---------- Карточки, статусы, бейджи (§4.5) ---------- */
.ld-card {
  background: var(--lightcard-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--box-shadow);
  padding: 24px;
}
.ld-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}
.ld-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-450);
}
.ld-status--success::before { background: var(--status-success); }
.ld-status--warning::before { background: var(--status-warning); }
.ld-status--danger::before { background: var(--status-danger); }
.ld-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--yellow-700);
  color: var(--grey-700);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ld-badge--success { background: var(--status-success-bg); color: var(--status-success); }
.ld-badge--warning { background: var(--status-warning-bg); color: var(--grey-700); }
.ld-badge--danger { background: var(--status-danger-bg); color: var(--status-danger); }
.ld-badge--neutral { background: var(--mist-200); color: var(--grey-700); }

/* ---------- Список с анимацией строки (§4.2) ---------- */
.ld-list {
  background: var(--lightcard-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--box-shadow);
  width: 100%;
  overflow: hidden;
  --ld-cols: minmax(0, 1fr);
  --ld-gap: 24px;
}
.ld-list__head {
  display: grid;
  grid-template-columns: var(--ld-cols);
  gap: 0 var(--ld-gap);
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border-line-default);
}
.ld-list__head-cell {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ld-list__head-cell--right { text-align: right; }
.ld-list-row {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: var(--ld-cols);
  gap: 0 var(--ld-gap);
  padding: 16px 24px;
  align-items: center;
  border-bottom: 1px solid var(--border-line-default);
}
.ld-list-row:last-child { border-bottom: none; }
.ld-list-row::before {
  content: "";
  position: absolute;
  inset: 0 0 -1px;
  z-index: -1;
  background: var(--table-row-hover-bg);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 300ms ease-out;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .ld-list-row:hover::before { transform: scaleX(1); }
}
.ld-list-row__title { color: var(--text-primary); font-size: 14px; font-weight: 500; letter-spacing: 0.03em; }
.ld-list-row__sku {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}
.ld-list-row__sub { color: var(--grey-450); font-size: 12px; }
.ld-list-row__price { font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-list-row__action { display: flex; justify-content: flex-end; gap: 8px; }
/* Строка-кнопка (выбор в списке) и выбранная строка */
.ld-list-row--interactive { cursor: pointer; }
.ld-list-row--selected { box-shadow: inset 3px 0 0 var(--yellow-700); }

/* ---------- Пустое состояние, загрузка, сообщения ---------- */
.ld-empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-width: 560px;
}
.ld-empty-state__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.ld-empty-state__text { color: var(--grey-500); }
.ld-empty-state__code {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.ld-loading {
  color: var(--grey-450);
  font-size: 13px;
}

/* ---------- Баннер (readOnly, нет сессии) ---------- */
.ld-banner {
  padding: 10px 24px;
  background: var(--status-warning-bg);
  border-bottom: 1px solid var(--status-warning);
  font-size: 13px;
  font-weight: 500;
}

/* Баннер «только чтение» и критичный баннер */
.ld-banner--readonly {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ld-banner--danger {
  background: var(--status-danger-bg);
  border-bottom-color: var(--status-danger);
}

/* ======================================================================
   Компоненты, перенесённые из dpan/public/styles.css (общие, без экранов дилеров)
   ====================================================================== */

/* ---------- Пользователь в шапке ---------- */
.ld-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 8%);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--white-1000);
}
.ld-user-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-success);
  flex-shrink: 0;
}
.ld-user-pill__name {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Подшапка и хлебные крошки ---------- */
.ld-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background: var(--grey-25);
  border-bottom: 1px solid var(--border-default);
}
.ld-sub-header__title,
.ld-page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}
.ld-sub-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ld-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--grey-450);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ld-breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ld-breadcrumbs__item + .ld-breadcrumbs__item::before {
  content: "/";
  color: var(--grey-100);
}
.ld-breadcrumbs a { text-decoration: none; }
.ld-breadcrumbs a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.ld-breadcrumbs [aria-current="page"] { color: var(--text-primary); }

/* ---------- Заголовки и вспомогательный текст ---------- */
.ld-section-title {
  font-size: 20px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ld-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.ld-subtitle {
  margin: 20px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--grey-500);
}
.ld-muted { color: var(--grey-450); font-size: 13px; }
.ld-card--compact { padding: 16px 20px; }
.ld-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.ld-card-head__search { width: 280px; max-width: 100%; }

/* ---------- Строки «ключ — значение» (§4.5) ---------- */
.ld-spec-list { display: flex; flex-direction: column; gap: 12px; }
.ld-spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}
.ld-spec-row__label {
  color: var(--grey-450);
  font-weight: 400;
  display: flex;
  flex: 1;
  align-items: baseline;
}
.ld-spec-row__label::after {
  content: "";
  flex: 1;
  margin: 0 8px;
  border-bottom: 2px dotted var(--mist-300);
}
.ld-spec-row__value { color: var(--text-primary); font-weight: 500; }

/* ---------- Копируемый элемент (§4.6) ---------- */
.ld-copyable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: background-color 150ms ease-out;
}
.ld-copyable:hover { background: var(--white-1000); }
.ld-copyable:active,
.ld-copyable--copied { background: var(--yellow-700); }

/* ---------- Чекбокс ---------- */
.ld-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.ld-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.ld-checkbox__box {
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--grey-50);
  border-radius: var(--radius-sm);
  background: var(--white-1000);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.ld-checkbox:hover .ld-checkbox__box { border-color: var(--grey-100); }
.ld-checkbox input:focus-visible ~ .ld-checkbox__box {
  outline: 2px solid var(--yellow-700);
  outline-offset: 2px;
}
.ld-checkbox input:checked ~ .ld-checkbox__box {
  background: var(--grey-700);
  border-color: var(--grey-700);
}
.ld-checkbox__box::after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--yellow-700);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ld-checkbox input:checked ~ .ld-checkbox__box::after { display: block; }
.ld-checkbox input:disabled ~ .ld-checkbox__box { background: var(--mist-80); }
.ld-checkbox--disabled { color: var(--text-muted); cursor: not-allowed; }
.ld-checkbox__count {
  margin-left: auto;
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Переключатель (button role="switch" aria-checked) ---------- */
.ld-switch {
  position: relative;
  width: 48px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: var(--mist-300);
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 200ms ease;
}
.ld-switch::after {
  content: "";
  position: absolute;
  top: 3.5px;
  left: 4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--white-1000);
  transition: transform 200ms ease;
}
.ld-switch--on,
.ld-switch[aria-checked="true"] { background: var(--yellow-700); }
.ld-switch--on::after,
.ld-switch[aria-checked="true"]::after { transform: translateX(21px); }
.ld-switch:disabled { opacity: 0.5; cursor: not-allowed; }
.ld-switch-field {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* ---------- KPI ---------- */
.ld-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.ld-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
  background: var(--lightcard-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--box-shadow);
  border-left: 4px solid transparent;
}
.ld-kpi-card--accent { border-left-color: var(--yellow-700); }
.ld-kpi-card__label {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ld-kpi-card__value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.ld-kpi-card__value--danger { color: var(--status-danger); }
.ld-kpi-card__note { font-size: 12px; color: var(--grey-450); }
@media (max-width: 1100px) {
  .ld-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ld-kpi-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Уведомление в контенте ---------- */
.ld-notice {
  padding: 14px 18px;
  background: var(--mist-50);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--grey-500);
}
.ld-notice--warning {
  background: var(--status-warning-bg);
  border-color: var(--status-warning);
  color: var(--grey-700);
}
.ld-notice--danger {
  background: var(--status-danger-bg);
  border-color: var(--status-danger);
  color: var(--grey-700);
}
.ld-notice--success {
  background: var(--status-success-bg);
  border-color: var(--status-success);
  color: var(--grey-700);
}

/* ---------- Спиннер, скелетон, экран загрузки ---------- */
.ld-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ld-spin 650ms linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
.ld-spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}
@keyframes ld-spin {
  to { transform: rotate(360deg); }
}
.ld-loading-screen {
  flex: 1;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--grey-450);
}
.ld-loading-screen p {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.ld-skeleton {
  display: block;
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--mist-200) 0%, var(--mist-100) 50%, var(--mist-200) 100%);
  background-size: 200% 100%;
  animation: ld-skeleton 1.2s ease-in-out infinite;
}
@keyframes ld-skeleton {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- Пустое состояние: вариант по центру ---------- */
.ld-empty-state--center {
  align-items: center;
  text-align: center;
  margin: 0 auto;
  padding: 56px 20px;
}
.ld-empty-state__icon { color: var(--grey-100); }

/* ---------- Аккордеон (<details class="ld-accordion">) ---------- */
.ld-accordion-stack { display: grid; gap: 12px; }
.ld-accordion {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--white-1000);
  overflow: hidden;
}
.ld-accordion__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--mist-80);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color 150ms ease;
}
.ld-accordion__summary::-webkit-details-marker { display: none; }
.ld-accordion__summary::marker { content: ""; }
.ld-accordion__summary:hover { background: var(--mist-90); }
.ld-accordion__summary:focus-visible {
  outline: 2px solid var(--grey-700);
  outline-offset: -2px;
}
.ld-accordion[open] > .ld-accordion__summary {
  background: var(--mist-90);
  border-bottom: 1px solid var(--border-default);
}
.ld-accordion__chevron {
  flex: none;
  color: var(--grey-450);
  transition: transform 200ms ease;
}
.ld-accordion[open] > .ld-accordion__summary > .ld-accordion__chevron {
  transform: rotate(90deg);
  color: var(--text-primary);
}
.ld-accordion__title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ld-accordion__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.ld-accordion__meta {
  font-size: 12px;
  color: var(--product-sku-and-attr);
}
.ld-accordion__aside {
  flex: none;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ld-accordion__body { padding: 20px; }
.ld-accordion--sm > .ld-accordion__summary { padding: 11px 14px; gap: 10px; }
.ld-accordion--sm .ld-accordion__name { font-size: 13px; }
.ld-accordion--sm > .ld-accordion__body { padding: 16px; }
.ld-accordion--flush > .ld-accordion__body { padding: 0; }
.ld-accordion--current { border-color: var(--yellow-700); }
.ld-accordion--current > .ld-accordion__summary { box-shadow: inset 3px 0 0 var(--yellow-700); }

/* ---------- Таблица (та же анимация строки, что у ld-list) ---------- */
.ld-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.ld-table-wrap--bordered {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.ld-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ld-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--mist-80);
  border-bottom: 1px solid var(--border-line-default);
  white-space: nowrap;
}
.ld-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-line-default);
  vertical-align: top;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.ld-table tbody tr:last-child td { border-bottom: none; }
.ld-table tbody tr {
  background-image: linear-gradient(var(--table-row-hover-bg), var(--table-row-hover-bg));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 300ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .ld-table tbody tr:hover { background-size: 100% 100%; }
}
.ld-table .ld-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ld-table td.ld-table__nowrap { white-space: nowrap; }
.ld-table--compact th { padding: 10px 14px; }
.ld-table--compact td { padding: 11px 14px; }

/* ---------- Тулбар фильтров ---------- */
.ld-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.ld-toolbar__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Чипы выбранных субъектов (ui/chips.js) ---------- */
.ld-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ld-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 30px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--white-1000);
  font-size: 13px;
  font-weight: 500;
}
.ld-chip__icon { color: var(--product-sku-and-attr); flex-shrink: 0; }
.ld-chip__label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ld-chip--inactive .ld-chip__label {
  color: var(--grey-450);
  text-decoration: line-through;
}
.ld-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--grey-450);
  cursor: pointer;
  flex-shrink: 0;
}
.ld-chip__remove:hover {
  background: var(--yellow-700);
  color: var(--grey-700);
}
.ld-chips__empty { color: var(--placeholder); font-size: 13px; }
.ld-chips__count {
  color: var(--product-sku-and-attr);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---------- Иконки ---------- */
.ld-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Модальное окно (ui/modal.js) ---------- */
.ld-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(38 38 38 / 60%);
  backdrop-filter: blur(2px);
  animation: ld-fade-in 150ms ease-out;
}
.ld-modal {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  background: var(--white-1000);
  border-radius: var(--radius-md);
  box-shadow: 0 25px 80px rgb(27 27 27 / 20%);
  outline: none;
  animation: ld-modal-in 180ms ease-out;
}
.ld-modal--lg { width: min(720px, 100%); }
.ld-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 0;
}
.ld-modal__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}
.ld-modal__close { margin: -6px -10px 0 0; }
.ld-modal__body {
  padding: 16px 28px 24px;
  overflow-y: auto;
  color: var(--grey-500);
  line-height: 1.55;
}
.ld-modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 28px 24px;
}
@keyframes ld-fade-in {
  from { opacity: 0; }
}
@keyframes ld-modal-in {
  from { opacity: 0; transform: translateY(8px); }
}
body.ld-modal-open { overflow: hidden; }

/* ---------- Toast (ui/toast.js) ---------- */
.ld-toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(440px, calc(100% - 48px));
  pointer-events: none;
}
.ld-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  border-left: 4px solid var(--yellow-700);
  border-radius: var(--radius-md);
  background: var(--grey-700);
  color: var(--white-1000);
  box-shadow: 0 10px 30px rgb(27 27 27 / 15%);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  pointer-events: auto;
  animation: ld-toast-in 200ms ease-out;
}
.ld-toast__text { flex: 1; min-width: 0; padding-top: 2px; overflow-wrap: anywhere; }
.ld-toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--grey-100);
  cursor: pointer;
  flex-shrink: 0;
}
.ld-toast__close:hover { color: var(--white-1000); background: var(--grey-800); }
.ld-toast--success { border-left-color: var(--status-success); }
.ld-toast--warning { border-left-color: var(--status-warning); }
.ld-toast--error { border-left-color: var(--status-danger); }
.ld-toast--leaving { opacity: 0; transform: translateY(4px); transition: opacity 150ms, transform 150ms; }
@keyframes ld-toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ---------- Перетаскиваемый список (ui/sortable.js) ---------- */
.ld-sortable { display: flex; flex-direction: column; }
.ld-sortable__item { position: relative; }
.ld-sortable__handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--grey-100);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}
.ld-sortable__handle:hover,
.ld-sortable__handle:focus-visible { color: var(--text-primary); background: var(--mist-90); }
.ld-sortable__item--dragging {
  z-index: 2;
  opacity: 0.95;
  box-shadow: var(--box-shadow), 0 8px 24px rgb(27 27 27 / 12%);
  background: var(--white-1000);
  cursor: grabbing;
}
.ld-sortable__item--grabbed { box-shadow: inset 3px 0 0 var(--yellow-700); background: var(--yellow-100); }
body.ld-sortable-active { cursor: grabbing; user-select: none; }

/* ---------- Экран «Сессия истекла» / фатальная ошибка ---------- */
.ld-fatal {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}
.ld-fatal__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  text-align: center;
}
.ld-fatal__icon { color: var(--grey-450); }
.ld-fatal__title {
  font-size: 18px;
  font-weight: 600;
}
.ld-fatal__text { color: var(--grey-500); }

/* ---------- Мобильная шапка: кнопка «≡» и выпадающее меню ---------- */
.ld-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 10%);
  color: var(--white-1000);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.ld-burger:hover { background: rgb(255 255 255 / 18%); }
.ld-header-menu { display: none; }

@media (max-width: 768px) {
  .ld-burger { display: inline-flex; }
  .ld-header-menu--open {
    position: absolute;
    top: 100%;
    right: 12px;
    left: 12px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
    padding: 12px;
    background: var(--grey-700);
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgb(27 27 27 / 35%);
    color: var(--white-1000);
  }
  .ld-header-menu__user {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgb(255 255 255 / 12%);
    font-size: 13px;
    font-weight: 600;
  }
  .ld-header-menu__position { color: var(--grey-100); font-size: 12px; font-weight: 400; }
  .ld-header-menu__item {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    color: var(--grey-100);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
  }
  .ld-header-menu__item:hover { background: var(--grey-800); color: var(--white-1000); }
  .ld-header-menu__item--active {
    color: var(--white-1000);
    box-shadow: inset 3px 0 0 var(--yellow-700);
  }
  .ld-user-pill { padding: 4px 8px; font-size: 11px; }
  .ld-user-pill__name { max-width: 120px; }
  .ld-modal__head { padding: 20px 20px 0; }
  .ld-modal__body { padding: 12px 20px 20px; }
  .ld-modal-actions { padding: 0 20px 20px; }
  .ld-modal-actions .ld-btn { flex: 1; }
  .ld-sub-header { padding: 14px 12px; }
  .ld-accordion__summary { flex-wrap: wrap; }
  .ld-accordion__aside { width: 100%; padding-left: 32px; }
  .ld-accordion__body { padding: 14px; }
  .ld-card-head__search { width: 100%; }
  .ld-toolbar { grid-template-columns: minmax(0, 1fr); }
  .ld-list__head { display: none; }
  .ld-list-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px 16px; }
  .ld-list-row__action { justify-content: flex-start; }
  .ld-toast-stack { width: auto; }
}

/* ---------- Служебное ---------- */
.ld-chips-box { display: flex; flex-direction: column; gap: 8px; }
/* Режим «только чтение»: элементы правки скрываются (ставит app.js при READ_ONLY) */
.ld-readonly .ld-requires-write { display: none !important; }
