:root {
  /* Совпадает с shop.css / TailAdmin createrra-theme (тёмная витрина) */
  --bg: #0d0d0e;
  --bg-additional: #1a1a1b;
  --card: #1a1a1b;
  --text: #ffffff;
  --muted: #9ca3af;
  --red: #ee252c;
  --line: #2d2d30;
  --grey-regular: #252527;
  --success: #3c9742;
  --danger: #cc3625;
  --admin-toolbar-h: 40px;
  --admin-toolbar-radius: 10px;
}

/* Глобальный body задаёт TailAdmin (static/tailadmin/style.css). Контент админки — в .admin-dshop-stack */
.admin-dshop-stack,
.admin-dshop-stack * {
  box-sizing: border-box;
}
.admin-dshop-stack {
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Светлая тема (TailAdmin: класс dark только на body в тёмном режиме) */
body:not(.dark) .admin-dshop-stack {
  --bg-additional: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --grey-regular: #e5e7eb;
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  background: linear-gradient(180deg, #0f0f10 0%, var(--bg) 100%);
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Кнопка «Сохранить» в шапке карточки товара (дублирует submit внизу формы) */
.btn-icon-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.65rem;
  line-height: 0;
}

.btn-icon-save svg {
  display: block;
}

/* Список товаров: остаток суммой + разбивка по org_index */
.product-stock-details {
  margin-top: 0.25rem;
}
.product-stock-details__summary {
  cursor: pointer;
  font-size: 0.75rem;
  list-style: none;
}
.product-stock-details__summary::-webkit-details-marker {
  display: none;
}
.product-stock-orgs {
  margin: 0.35rem 0 0 1rem;
  padding: 0;
  list-style: disc;
  font-size: 0.75rem;
  color: var(--muted);
}

.sdt-org-details summary {
  list-style: none;
}
.sdt-org-details summary::-webkit-details-marker {
  display: none;
}
.sdt-org-nested {
  width: 100%;
  max-width: 18rem;
}

/* —— Страница «Товары»: заголовок + панель фильтров —— */
.admin-page-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-page-head__title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-page-head__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.admin-page-head__add {
  flex-shrink: 0;
  height: var(--admin-toolbar-h);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--admin-toolbar-radius);
  font-size: 14px;
  box-sizing: border-box;
}

.admin-page-head__toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.admin-page-head__seed-form {
  margin: 0;
}

.admin-page-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 72ch;
}

.admin-page-hint--toolbar {
  max-width: none;
}

.order-meta-line {
  margin-top: 8px;
}
.admin-kv {
  margin: 0 0 8px;
  line-height: 1.45;
}
.admin-kv__key {
  color: var(--muted);
  font-weight: 600;
  margin-right: 6px;
}
.admin-kv__value {
  color: var(--text);
  font-weight: 500;
}
.admin-page-hint--under-kv {
  margin-top: -2px;
  margin-bottom: 8px;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.form-section-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.form-section-title--spaced {
  margin-top: 1.25rem;
}
.form-submit-spaced {
  margin-top: 0.5rem;
}

.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
}
.inline-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* —— Плашки настроек: «API и интеграции», «Настройки магазина» —— */
.integrations-form .integrations-grid,
.shop-settings-form .integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
.integrations-form .integration-plaque,
.shop-settings-form .integration-plaque {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.integration-plaque__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  padding-bottom: 8px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.integration-plaque__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.integration-plaque__env {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.integration-plaque__env code {
  font-size: inherit;
  color: var(--muted);
  background: var(--bg-additional);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.integration-plaque .form-hint {
  margin: 0;
}
.integration-plaque label {
  margin: 0;
}
.integration-plaque label + .form-hint,
.integration-plaque label + span.form-hint {
  margin-top: -4px;
}
.integrations-save-bar {
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.integrations-save-bar .btn {
  flex-shrink: 0;
}

.admin-flash {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  border: 1px solid var(--line);
}

.admin-flash--success {
  background: rgba(60, 151, 66, 0.14);
  border-color: rgba(60, 151, 66, 0.45);
  color: #c8eccb;
}

.admin-flash--error {
  background: rgba(204, 54, 37, 0.12);
  border-color: rgba(204, 54, 37, 0.4);
  color: #ffb4a8;
}

.admin-flash--info {
  background: rgba(104, 104, 104, 0.18);
  color: var(--text);
}

.products-filter-form__input-date {
  height: var(--admin-toolbar-h);
  padding: 0 10px;
  margin: 0;
  border-radius: var(--admin-toolbar-radius);
  border: 1px solid var(--line);
  background: var(--bg-additional);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  min-width: 140px;
}

.products-filter-form__input-date:focus {
  outline: none;
  border-color: var(--muted);
  box-shadow: 0 0 0 2px rgba(238, 37, 44, 0.2);
}

.products-filter-form__search--grow {
  flex: 1 1 240px;
  max-width: none;
  min-width: min(100%, 200px);
}

.products-filter-form__actions--start {
  margin-left: 0;
}

.card--table {
  padding: 12px 16px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
}

table.products-table {
  table-layout: fixed;
  width: 100%;
}

.products-table__col-id { width: 8%; min-width: 56px; }
.products-table__col-sku { width: 10%; min-width: 72px; }
.products-table__col-photo { width: 64px; min-width: 64px; max-width: 64px; }
.products-table__col-name { width: 22%; min-width: 120px; }
.products-table__col-cat { width: 12%; min-width: 100px; }
.products-table__col-price { width: 7%; min-width: 64px; }
.products-table__col-stock {
  width: 76px;
  min-width: 76px;
  max-width: 96px;
  text-align: center;
}
.products-table__col-actions { width: 120px; min-width: 120px; max-width: 132px; }
.products-table__col-vitrina {
  width: 72px;
  min-width: 72px;
  max-width: 88px;
  text-align: center;
}
.products-table__cell-vitrina {
  text-align: center;
  vertical-align: middle;
}
.products-table__col-check {
  width: 40px;
  min-width: 40px;
  max-width: 44px;
  text-align: center;
}
.products-table__cell-check {
  text-align: center;
  vertical-align: middle;
}

.products-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
}
.products-bulk-bar__label {
  color: var(--muted);
  font-size: 14px;
}

.products-table__cell-stock {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.products-table__cell-actions {
  vertical-align: middle;
  text-align: center;
}

.products-table__cell-name {
  word-break: break-word;
  hyphens: auto;
}

.products-table__cell-wrap {
  word-break: break-word;
  font-size: 13px;
}

.products-table__cell-muted {
  color: var(--muted);
  font-size: 13px;
}

.products-table__cell-photo {
  width: 64px;
  vertical-align: middle;
}

.thumb--sm {
  width: 48px;
  height: 48px;
  min-width: 48px;
}

.orders-table__col-check {
  width: 40px;
  min-width: 40px;
  max-width: 44px;
  text-align: center;
}
.orders-table__col-date { width: 118px; white-space: nowrap; }
.orders-table__cell-date {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.orders-table__cell-delivery {
  word-break: break-word;
  font-size: 13px;
}

/* Форма возврата: Safari может рисовать слишком маленькие чекбоксы без явных размеров. */
#refund-form input[type="checkbox"] {
  -webkit-appearance: checkbox;
  appearance: checkbox;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--red);
  vertical-align: middle;
  cursor: pointer;
}

.inline-form--table {
  flex-wrap: wrap;
  align-items: center;
}

.input-table {
  width: auto;
  max-width: 220px;
  min-width: 120px;
  height: 36px;
  padding: 0 10px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}

.btn--compact {
  padding: 8px 12px;
  font-size: 13px;
}

.products-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
}

.products-filter-form__search {
  flex: 1 1 220px;
  min-width: min(100%, 200px);
  max-width: 420px;
  width: auto;
  height: var(--admin-toolbar-h);
  margin: 0;
  padding: 0 12px;
  border-radius: var(--admin-toolbar-radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}

.products-filter-form__search::placeholder {
  color: var(--muted);
}

.products-filter-form__search:focus {
  outline: none;
  border-color: var(--muted);
  box-shadow: 0 0 0 2px rgba(238, 37, 44, 0.2);
}

.products-filter-form__group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.products-filter-form__label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
}

.products-filter-form__select {
  height: var(--admin-toolbar-h);
  min-width: 168px;
  padding: 0 10px;
  margin: 0;
  border-radius: var(--admin-toolbar-radius);
  border: 1px solid var(--line);
  background: var(--bg-additional);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  box-sizing: border-box;
}

.products-filter-form__select--narrow {
  min-width: 72px;
  width: 72px;
  padding: 0 6px;
}

.products-filter-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.products-filter-form__actions--icons {
  gap: 6px;
  flex-shrink: 0;
}

.products-filter-form__btn {
  height: var(--admin-toolbar-h);
  min-width: 0;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--admin-toolbar-radius);
  font-size: 14px;
  font-weight: 600;
  box-sizing: border-box;
  text-decoration: none;
}

.admin-page-head__stats {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.admin-page-head__stats strong {
  color: var(--text);
  font-weight: 600;
}

.admin-page-head__stats-sep {
  margin: 0 6px;
  opacity: 0.6;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tabs a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--grey-regular);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

.narrow {
  width: min(480px, 100%);
  margin: 40px auto;
}

h1 { margin: 0; font-size: 28px; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  background: var(--grey-regular);
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--red); }
.btn-secondary { border-color: var(--line); background: var(--bg-additional); }
.btn-danger { background: var(--danger); }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th { color: var(--muted); font-size: 13px; }

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  display: block;
}

.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  background: var(--bg-additional);
}

.actions {
  display: flex;
  gap: 8px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.row-actions--icons {
  justify-content: center;
  gap: 6px;
}
.row-actions--wrap {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-action-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
  vertical-align: middle;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-additional);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: var(--grey-regular);
  border-color: var(--muted);
}

.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(238, 37, 44, 0.35);
}

.btn-icon--secondary {
  border-color: var(--line);
}

.btn-icon--primary {
  background: var(--red);
  border-color: transparent;
  color: #fff;
}

.btn-icon--primary:hover {
  background: var(--red);
  filter: brightness(1.08);
  border-color: transparent;
}

.btn-icon--danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn-icon--danger:hover {
  background: #e03020;
  filter: brightness(1.05);
}

.btn-icon:disabled,
.btn-icon.btn-icon--disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}
.btn-icon--danger:disabled,
.btn-icon--danger.btn-icon--disabled {
  filter: grayscale(0.25);
}
.btn-icon--danger:disabled:hover,
.btn-icon--danger.btn-icon--disabled:hover {
  background: var(--danger);
  filter: grayscale(0.25);
  opacity: 0.42;
}

button.btn-icon {
  font: inherit;
}

.icon-action-form .btn-icon {
  vertical-align: middle;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

input, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
}

.error { color: #ff7e83; }
.success { color: var(--success); }
.muted { color: var(--muted); text-align: center; }
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--bg-additional);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}

.inline-form {
  display: flex;
  gap: 10px;
}

select {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

.preview-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-additional);
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.preview-item-error {
  color: var(--danger);
  font-size: 12px;
  padding: 8px;
  text-align: center;
}

.preview-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 24px;
  flex-wrap: wrap;
}

.pagination-meta {
  text-align: left;
  margin: 8px 0 0;
}

.filters-form .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filters-form .filter-row label {
  font-size: 13px;
  min-width: 0;
}

.filters-form input[type="date"],
.filters-form input[type="search"] {
  min-width: 140px;
}

.inline-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.inline-label select {
  width: auto;
}

.badge-success {
  border-color: var(--success);
  color: var(--success);
}
.badge-lg {
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
}

.admin-order-status-form {
  flex-wrap: wrap;
  align-items: center;
}
.admin-order-status-form__select-wrap select {
  min-width: 200px;
}

/* Карточка «Оплата»: иконка синка — всегда в правом верхнем углу плашки */
.admin-billing-card {
  position: relative;
}
.admin-billing-card__title {
  margin: 0 0 12px;
}
.admin-billing-card:has(.admin-billing-card__actions) .admin-billing-card__title {
  padding-right: 104px; /* место под две иконки */
}
.admin-billing-card__actions {
  position: absolute;
  top: 16px;
  right: 16px;
  margin: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.admin-billing-card__sync-form {
  margin: 0;
}

/* Оплата: URL + иконка, синхронизация — иконка */
.admin-billing-payment-block {
  margin: 0.75rem 0 0;
}
.admin-billing-payment-block__label {
  margin: 0 0 0.35rem;
}
.admin-billing-payment-block__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}
.admin-billing-payment-block__url {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.admin-billing-payment-block__url:hover {
  color: var(--red);
}

/* Сайдбар: бейдж неоплаченных заказов у пункта «Заказы» */
.admin-menu-item--with-badge {
  position: relative;
}
.admin-nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  background: var(--danger);
  color: #fff;
}
body:not(.dark) .admin-nav-badge {
  color: #fff;
}

/* Шапка: быстрый поиск заказа */
.admin-header-order-search__input {
  width: min(11rem, 28vw);
  height: 2.75rem;
  padding: 0 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
}
.admin-header-order-search__input::placeholder {
  color: var(--muted);
}
.admin-header-order-search__input:focus {
  outline: 2px solid rgba(238, 37, 44, 0.35);
  outline-offset: 1px;
}

/* Карточка клиента: сводка */
.admin-user-summary__list {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.6;
}
.admin-user-summary__last {
  margin-top: 0.35rem;
}

/* Таблица заказов: колонка ссылки на оплату */
.orders-table__col-paylink,
.orders-table__cell-paylink {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.orders-table__paylink-dash {
  font-size: 0.875rem;
}

.banner-msg {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(60, 151, 66, 0.15);
}

.admin-page-head__title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.orders-bulk-bar {
  align-items: flex-start;
}
.orders-bulk-hint {
  flex: 1 1 200px;
  margin: 0;
  max-width: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-grid--stats {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.dashboard-charts-card {
  margin-bottom: 24px;
}
.dashboard-charts__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}
.dashboard-charts__title {
  margin: 0;
}
.dashboard-charts__period {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.dashboard-charts__period-label {
  white-space: nowrap;
}
.dashboard-charts__select {
  min-width: 140px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-additional);
  color: var(--text);
  font-size: 14px;
}
.dashboard-charts__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .dashboard-charts__grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}
.dashboard-chart-wrap__title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.dashboard-chart-wrap__canvas {
  position: relative;
  height: 260px;
  width: 100%;
}

.dashboard-section-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.dashboard-card__title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.dashboard-card__value {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.dashboard-card__value--sm {
  font-size: 22px;
}
.dashboard-card__sub {
  margin: -8px 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.dashboard-card--mini .dashboard-card__title {
  font-size: 12px;
}

.import-errors-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  max-height: 280px;
  overflow: auto;
  font-size: 13px;
}

.images-url-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.images-url-editor__empty {
  margin: 0;
  font-size: 13px;
}
.images-url-row {
  display: grid;
  grid-template-columns: auto 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-additional);
  cursor: grab;
}
.images-url-row--dragging {
  opacity: 0.65;
}
.images-url-row--over {
  outline: 2px dashed var(--red);
  outline-offset: 2px;
}
.images-url-row__grip {
  color: var(--muted);
  font-size: 12px;
  user-select: none;
  cursor: grab;
  line-height: 1;
}
.images-url-row__thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grey-regular);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
}
.images-url-row__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.images-url-row__url {
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  min-width: 0;
}
.images-url-row__remove {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .admin-page-head__title-row {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-page-head__title-actions {
    width: 100%;
    justify-content: stretch;
  }
  .admin-page-head__title-actions .admin-page-head__add {
    flex: 1;
    justify-content: center;
  }
  .admin-page-head__add {
    width: 100%;
    justify-content: center;
  }
  .products-filter-form__search {
    flex: 1 1 100%;
    max-width: none;
  }
  .products-filter-form__actions {
    margin-left: 0;
    width: 100%;
  }
  .products-filter-form__actions--icons {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }
  .products-filter-form__btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
  .card:not(.card--table) table,
  .card:not(.card--table) tbody,
  .card:not(.card--table) tr,
  .card:not(.card--table) td,
  .card:not(.card--table) th,
  .card:not(.card--table) thead {
    display: block;
  }
  .card:not(.card--table) thead {
    display: none;
  }
  .card:not(.card--table) tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  .card:not(.card--table) td {
    border: 0;
    padding: 6px 0;
  }
}

/* —— Модальное окно «ПВЗ на карте» (карточка заказа) —— */
.admin-map-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.admin-map-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.admin-map-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  border: 0;
  padding: 0;
}
.admin-map-modal__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.admin-map-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.admin-map-modal__head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.admin-map-modal__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--grey-regular);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.admin-map-modal__close:hover {
  filter: brightness(1.08);
}
.admin-map-modal__frame-wrap {
  position: relative;
  flex: 1;
  min-height: 320px;
  background: var(--bg-additional);
}
.admin-map-modal__frame-wrap iframe {
  display: block;
  width: 100%;
  height: min(60vh, 520px);
  min-height: 280px;
  border: 0;
}
.admin-map-modal__foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.admin-map-modal__foot a {
  font-size: 0.875rem;
  color: var(--muted);
}
.admin-map-modal__foot a:hover {
  color: var(--text);
}

/* Модальное окно «Расшифровка phone из ссылки» */
.admin-decrypt-link-modal .admin-map-modal__panel {
  width: min(640px, 100%);
  max-height: min(90vh, 760px);
}
.admin-decrypt-link-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
}
.admin-decrypt-link-modal__block {
  margin-bottom: 14px;
}
.admin-decrypt-link-modal__block:last-child {
  margin-bottom: 0;
}
.admin-decrypt-link-modal__label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.admin-decrypt-link-modal__pre {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg-additional);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 14rem;
  overflow: auto;
  color: var(--text);
}
.admin-decrypt-link-modal__pre--error {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.45);
}
.admin-decrypt-link-modal__err {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
}

/* Настройки: вкладки */
.admin-settings-tabs-wrap {
  margin-top: 0.5rem;
}
.admin-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.admin-settings-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.55rem 1rem 0.65rem;
  margin-bottom: -1px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.admin-settings-tab:hover {
  color: var(--text);
  background: var(--bg-additional);
}
.admin-settings-tab--active {
  color: var(--text);
  background: var(--card);
  border-color: var(--line);
  border-bottom-color: var(--card);
  box-shadow: 0 1px 0 var(--card);
}
body:not(.dark) .admin-settings-tab--active {
  box-shadow: 0 1px 0 #fff;
}
.admin-settings-tab:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* Карточка заказа: две колонки (клиент | оплата) */
.admin-order-detail-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}
@media (max-width: 960px) {
  .admin-order-detail-pair {
    grid-template-columns: 1fr;
  }
}
.admin-order-detail-pair .card {
  margin-bottom: 0;
}
.admin-order-detail-pair .muted,
.admin-order-status-card .muted {
  text-align: inherit;
}
.admin-order-status-card .order-status-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}
.admin-order-items-tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}
.admin-order-items-tfoot .admin-order-items-tfoot__muted {
  font-weight: 500;
  color: var(--muted);
}

/* ===== Design V2: global admin refresh ===== */
:root {
  --bg: #1a1d21;
  --bg-additional: #1e2227;
  --card: #242931;
  --card-inset: #181b1f;
  --text: #e8eaed;
  --muted: #8a8f98;
  --red: #e53935;
  --line: rgba(255, 255, 255, 0.06);
  --grey-regular: #2b3139;
  --shadow-light: rgba(255, 255, 255, 0.03);
  --shadow-dark: rgba(0, 0, 0, 0.5);
  --neu-convex: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  --neu-convex-sm: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  --neu-concave: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

.admin-dshop-stack {
  font-family: "Mulish", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark {
  background: linear-gradient(180deg, #171a1e 0%, #111317 100%);
}

body:not(.dark) .admin-dshop-stack {
  --bg: #f3f5f9;
  --bg-additional: #f7f8fb;
  --card: #ffffff;
  --card-inset: #eef1f6;
  --text: #111827;
  --muted: #6b7280;
  --line: #e6eaf2;
  --grey-regular: #e5e7eb;
}

body .sidebar {
  background: var(--bg-additional) !important;
  border-right: 1px solid var(--line) !important;
}

body header.sticky {
  background: color-mix(in srgb, var(--bg) 82%, transparent) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line) !important;
}

.menu-item {
  border-radius: 12px;
  transition: 0.2s ease;
}
.menu-item-inactive {
  color: var(--muted) !important;
}
.menu-item-inactive:hover {
  background: color-mix(in srgb, var(--card) 84%, transparent);
  color: var(--text) !important;
}
.menu-item-active {
  background: color-mix(in srgb, var(--card-inset) 88%, transparent) !important;
  box-shadow: var(--neu-concave);
  color: #ff7b7b !important;
}
.menu-item-icon-inactive {
  color: var(--muted) !important;
}
.menu-item-icon-active {
  color: var(--red) !important;
}

.card {
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--neu-convex-sm);
}

.btn {
  border-radius: 12px;
  background: linear-gradient(145deg, #303642, #272c35);
  box-shadow: var(--neu-convex-sm);
  transition: 0.2s ease;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn-primary {
  background: linear-gradient(145deg, #eb4743, #bf2521);
}
.btn-secondary {
  background: var(--bg-additional);
  color: var(--text);
}

.btn-icon {
  border-radius: 12px;
  background: linear-gradient(145deg, #2e3440, #252a33);
  box-shadow: var(--neu-convex-sm);
  transition: 0.2s ease;
}
.btn-icon:hover {
  background: color-mix(in srgb, var(--grey-regular) 82%, transparent);
}
.btn-icon--primary {
  background: linear-gradient(145deg, #eb4743, #bf2521);
}

input,
textarea,
select {
  border-radius: 12px;
  background: var(--card-inset);
  box-shadow: var(--neu-concave);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--red) 55%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 22%, transparent), var(--neu-concave);
}

table thead th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
}
table tbody tr:hover td {
  background: color-mix(in srgb, var(--card-inset) 62%, transparent);
}

/* Page polish: orders/products/users/refunds/settings */
.admin-page-head__toolbar,
.products-bulk-bar,
.orders-bulk-bar,
.admin-settings-tabs,
.admin-settings-details {
  box-shadow: var(--neu-convex-sm);
}

.products-bulk-bar,
.orders-bulk-bar {
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
}

.orders-table .badge,
.products-table .badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

.orders-table td,
.products-table td {
  font-size: 13px;
}

.table-scroll table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-scroll table tbody tr td:first-child {
  border-left: 1px solid transparent;
}

.table-scroll table tbody tr td:last-child {
  border-right: 1px solid transparent;
}

.table-scroll table tbody tr:hover td:first-child,
.table-scroll table tbody tr:hover td:last-child {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
}

.admin-settings-tab {
  border-radius: 12px 12px 0 0;
}

.admin-settings-tab--active {
  box-shadow: var(--neu-convex-sm);
}

.integration-plaque {
  background: color-mix(in srgb, var(--card) 95%, transparent);
}

.integration-plaque .form-hint code,
.admin-page-hint code {
  background: color-mix(in srgb, var(--card-inset) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1px 6px;
}

.admin-toolbar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-card-tight {
  margin-bottom: 10px;
}

.badge-muted {
  margin-left: 6px;
  opacity: 0.85;
}

.refund-summary-row {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-card-top-gap {
  margin-top: 12px;
}

.refund-lines {
  margin-top: 8px;
}

.refund-line-item {
  margin-bottom: 6px;
}

.admin-no-bottom-margin {
  margin-bottom: 0;
}

.admin-code-block--compact {
  margin: 0;
  white-space: pre;
  overflow: auto;
}

.is-refunded-row {
  opacity: 0.55;
}

.admin-section-gap { margin-bottom: 1rem; }
.admin-top-gap-sm { margin-top: 0.75rem; }
.admin-top-gap-xs { margin-top: 0.5rem; }
.admin-bottom-gap-sm { margin-bottom: 0.5rem; }
.admin-bottom-gap-md { margin-bottom: 0.75rem; }
.admin-text-sm { font-size: 0.875rem; }
.admin-text-xs { font-size: 0.8125rem; }
.admin-break-all { word-break: break-all; }
.admin-cursor-pointer { cursor: pointer; }
.admin-nowrap { flex-wrap: nowrap; }
.admin-max-h-22 { max-height: 22rem; }
.admin-max-h-18 { max-height: 18rem; }
.admin-settings-help { margin-bottom: 1rem; padding: 0.75rem 1rem; }
.admin-textarea-resize { resize: vertical; }
.admin-no-margin { margin: 0; }
.admin-inline-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-table-compact {
  width: 100%;
  max-width: 32rem;
  font-size: 0.9rem;
}
