/* ============================================
   СБРОС
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* ============================================
   ПЕРЕМЕННЫЕ
   ============================================ */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f2;
  --bg-active: #e8e8ed;

  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-inverse: #ffffff;

  --accent: #0071e3;

  --border: #d2d2d7;
  --border-light: #e8e8ed;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --header-height: 52px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg-input: #ffffff;
  --accent-hover: #0077ed;
  --accent-active: #006edb;
  --success: #34c759;
  --danger: #ff3b30;
  --warning: #ff9500;
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  padding-top: var(--sat);
  padding-left: var(--sal);
  padding-right: var(--sar);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  -webkit-tap-highlight-color: transparent;
}

button, .app-header, label {
  user-select: none;
  -webkit-user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================
   ШАПКА
   ============================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--header-height);
  padding: 0 var(--space-3);
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border-light);
}

.app-header--brand {
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

.app-header__title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.brand__logo {
  color: var(--text);
  flex-shrink: 0;
}

.brand__text {
  font-size: 16px;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.brand__text strong {
  font-weight: 700;
}

.app-header__icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.app-header__icon-btn:active {
  background: rgba(0, 0, 0, 0.08);
}


/* ============================================
   ФОРМЫ
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-textarea {
  min-height: 88px;
  resize: vertical;
}

/* ============================================
   КНОПКИ
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn--primary:active {
  background: var(--accent-active);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 0.5px solid var(--border);
}
.btn--secondary:active {
  background: var(--bg-active);
}

.btn--danger {
  background: var(--danger);
  color: var(--text-inverse);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}
/* ============================================
   MAIN
   ============================================ */
main {
  padding: var(--space-4);
  min-height: calc(100dvh - var(--header-height) - var(--sab));
}

/* ============================================
   ГЛАВНАЯ
   ============================================ */
.home {
  padding: var(--space-2) 0 0;
}

.home__title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: var(--space-1);
  color: var(--text);
}

.home__subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}

.home__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.home__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 140px;
  padding: var(--space-4);
  background: var(--bg-card);
  border: none;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.home__card:active {
  transform: scale(0.98);
  background: var(--bg-hover);
}

.home__card--wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  min-height: 88px;
}

.home__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  flex-shrink: 0;
}

.home__icon svg {
  width: 24px;
  height: 24px;
}

.home__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.home__card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

.home__card-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.home__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  flex-shrink: 0;
  align-self: flex-end;
}

.home__card--wide .home__arrow {
  align-self: center;
}

/* ============================================
   АДАПТАЦИЯ
   ============================================ */
@media (min-width: 768px) {
  main {
    max-width: 640px;
    margin: 0 auto;
  }
  .app-header {
    max-width: 640px;
    margin: 0 auto;
  }
}
/* ============================================
   СПИСОК ТОВАРОВ
   ============================================ */
.products__toolbar {
  margin-bottom: var(--space-4);
}

.products__search {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.products__search:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.products__cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.products__cats::-webkit-scrollbar { display: none; }

.category-chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s;
}
.category-chip.is-active {
  background: var(--text);
  color: var(--text-inverse);
}

.products__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .products__grid { grid-template-columns: 1fr 1fr 1fr; }
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s;
}
.product-card:active { transform: scale(0.98); }

.product-card__preview {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f0f0f2;
}
.product-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card__letter {
  font-size: 56px;
  font-weight: 700;
  color: rgba(0,0,0,0.25);
}

.product-card__sizes-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  justify-content: flex-end;
}

.product-card__sizes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.size-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.size-chip b { font-weight: 700; }
.size-chip--more { background: rgba(0,0,0,0.7); color: #fff; }

.product-card__sizes--empty {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--danger);
  color: #fff;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.product-card__info {
  padding: 10px 12px 12px;
}

.product-card__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.product-card__meta .mono { font-size: 11px; }
.product-card__price { font-weight: 600; color: var(--text); }

/* ============================================
   МОДАЛКА ТОВАРА
   ============================================ */
.product-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.product-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 92dvh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(16px + var(--sab));
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Обёртка крестика: sticky, не занимает места */
.product-modal__close-wrap {
  position: sticky;
  top: 0;
  height: 0;
  z-index: 250;
  pointer-events: none;
}

/* Сам крестик — прилипает к правому верхнему углу модалки */
.product-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: auto;
}

.product-modal__body { padding: 0; }

.product-modal__preview {
  aspect-ratio: 1;
  max-height: 60dvh;
  background: #ececee;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-modal__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-modal__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  font-weight: 700;
  color: rgba(0,0,0,0.2);
}

.product-modal__name {
  font-size: 22px;
  font-weight: 700;
  margin: 16px 16px 4px;
  letter-spacing: -0.3px;
}
.product-modal__sku {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 16px;
}
.product-modal__cat,
.product-modal__price,
.product-modal__desc {
  margin: 8px 16px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.product-modal__price { font-weight: 600; color: var(--text); }

/* ============================================================
   БЛОК ЗАМЕРОВ
   ============================================================ */
.measurements {
  margin: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.measurements__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.measurements__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.measurements__actions {
  display: flex;
  gap: 6px;
}
.measurements__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 12px 0;
  font-size: 14px;
}

.btn--sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 8px;
}

.measure-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.measure-chips::-webkit-scrollbar { display: none; }

.measure-chip {
  flex: 0 0 auto;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  background: #e8e8ed;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.measure-chip.is-active {
  background: var(--text);
  color: var(--text-inverse);
}

.measure-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.measure-block__title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.measure-block__empty {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.measure-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0 4px 12px;
  font-size: 14px;
  border-bottom: 0.5px solid var(--border-light);
}
.measure-line:last-child { border-bottom: none; }
.measure-line span { color: var(--text-muted); }
.measure-line b { font-weight: 600; }

.measure-edit-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 12px;
  font-size: 14px;
}
.measure-edit-line label { color: var(--text-muted); }
.measure-edit-line input {
  width: 80px;
  height: 36px;
  padding: 0 10px;
  font-size: 15px;
  text-align: right;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
}
.measure-edit-line input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
.measure-edit-unit {
  min-width: 30px;
  font-size: 13px;
  color: var(--text-muted);
}
/* ============================================
   ТОСТЫ
   ============================================ */
.toast-container {
  position: fixed;
  top: calc(var(--sat) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  bottom: auto;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  height: auto;
  max-height: 60dvh;
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-inverse);
  background: var(--text);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s;
  pointer-events: auto;
}

.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
.toast--warning { background: var(--warning); }

@keyframes toastIn {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
[hidden] {
  display: none !important;
}
/* ============================================
   БЛОК ВАРИАНТОВ (ОСТАТКИ)
   ============================================ */
.variants-block {
  margin: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.variants-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.variants-block__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.variants-block__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 12px 0;
  font-size: 14px;
}

.variants-list {
  display: flex;
  flex-direction: column;
}

.variants-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border-light);
}

.variants-row:last-child {
  border-bottom: none;
}

.variants-row__main {
  flex: 1;
  min-width: 0;
}

.variants-row__size {
  font-size: 15px;
  font-weight: 600;
}

.variants-row__article {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.variants-row__qty {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
}

.variants-row__qty--empty {
  color: var(--danger);
  font-weight: 600;
}

.variants-row__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.variants-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f0f0f2;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  padding: 0;
}

.variants-btn:active {
  background: var(--bg-active);
}
/* ============================================
   ВЛОЖЕННЫЕ МОДАЛКИ (submodal)
   ============================================ */
.submodal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.submodal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 0 0 calc(16px + var(--sab));
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

.submodal__head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--border-light);
}
.submodal__head h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}
.submodal__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.submodal__body {
  padding: 16px;
}

.submodal__actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}

/* Строка варианта в модалке остатков */
.stock-modal__variant {
  text-align: center;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  margin-bottom: 16px;
}
.stock-modal__variant-size {
  font-size: 20px;
  font-weight: 700;
}
.stock-modal__variant-article {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.stock-modal__variant-qty {
  font-size: 14px;
  margin-top: 8px;
  color: var(--text-muted);
}
.stock-modal__variant-qty b {
  color: var(--text);
  font-weight: 600;
}

/* Радио-список причин */
.radio-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.radio-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}
.radio-line input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin: 0;
}

/* История */
.history-list {
  display: flex;
  flex-direction: column;
}
.history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border-light);
}
.history-row:last-child {
  border-bottom: none;
}
.history-row__main {
  flex: 1;
  min-width: 0;
}
.history-row__reason {
  font-size: 14px;
  font-weight: 600;
}
.history-row__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-row__comment {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}
.history-row__qty {
  text-align: right;
  flex-shrink: 0;
}
.history-row__qty-delta {
  font-size: 16px;
  font-weight: 700;
}
.history-row__qty-after {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.history-qty--in .history-row__qty-delta {
  color: var(--success);
}
.history-qty--out .history-row__qty-delta {
  color: var(--danger);
}

/* Инвентаризация */
.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inventory-row {
  display: grid;
  grid-template-columns: 1fr auto 80px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border-light);
}
.inventory-row:last-child {
  border-bottom: none;
}
.inventory-row__size {
  font-size: 15px;
  font-weight: 600;
}
.inventory-row__article {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.inventory-row__was {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.inventory-row__input {
  width: 80px;
  height: 40px;
  padding: 0 10px;
  font-size: 15px;
  text-align: center;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
}
.inventory-row__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
/* ============================================
   ФОРМА СОЗДАНИЯ ТОВАРА
   ============================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sizes-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 100px 40px;
  gap: 8px;
  align-items: center;
}

.size-row__size,
.size-row__qty {
  height: 44px;
  padding: 0 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.size-row__size:focus,
.size-row__qty:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.size-row__qty {
  text-align: center;
}

.size-row__remove {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.size-row__remove:active {
  background: var(--bg-active);
  color: var(--danger);
}

/* ============================================
   CATEGORY PICKER
   ============================================ */
.cat-picker {
  position: relative;
}

.cat-picker__value {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 16px;
  text-align: left;
  color: var(--text);
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cat-picker__value:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.cat-picker__value svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.cat-picker__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  -webkit-overflow-scrolling: touch;
}

.cat-picker__item {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.cat-picker__item:active {
  background: var(--bg-hover);
}

.cat-picker__item--clear {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   ФОРМА СОЗДАНИЯ ТОВАРА
   ============================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sizes-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.size-row {
  display: grid;
  grid-template-columns: 1fr 100px 40px;
  gap: 8px;
  align-items: center;
}

.size-row__size,
.size-row__qty {
  height: 44px;
  padding: 0 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.size-row__size:focus,
.size-row__qty:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.size-row__qty {
  text-align: center;
}

.size-row__remove {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.size-row__remove:active {
  background: var(--bg-active);
  color: var(--danger);
}
.app-header__icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.app-header__icon-btn:active {
  background: rgba(0, 0, 0, 0.08);
}
/* Кнопка-иконка в модалке товара */
.product-modal__icon-btn {
  position: absolute;
  top: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: auto;
}

.product-modal__icon-btn:active {
  background: rgba(0, 0, 0, 0.7);
}

.product-modal__icon-btn--left {
  left: 12px;
}

.product-modal__icon-btn--right {
  right: 12px;
  font-size: 22px;
  line-height: 1;
}

/* Убрать старый крестик — теперь он иконочная кнопка */
.product-modal__close {
  /* не используем, оставляем для совместимости */
}

/* Удалённая строка размера */
.size-row--removed {
  opacity: 0.4;
  text-decoration: line-through;
}

.size-row--removed .size-row__size {
  color: var(--text-muted);
}

/* Опасная зона */
.danger-zone {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border-light);
}

/* Selected в category picker */
.cat-picker__item--selected {
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 500;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal__title {
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   КНОПКИ В ШАПКЕ (группа справа)
   ============================================ */
.app-header__actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* ============================================
   НАСТРОЙКИ — ПОДТАБЫ
   ============================================ */
.settings {
  padding: 0;
}

.settings__tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 0.5px solid var(--border-light);
  scrollbar-width: none;
}
.settings__tabs::-webkit-scrollbar { display: none; }

.settings-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.settings-tab:active {
  background: var(--bg-hover);
}

.settings-tab.is-active {
  background: var(--text);
  color: var(--text-inverse);
}

.settings__body {
  /* пусто, наполняется подтабами */
}
/* ============================================
   АДМИНКА КАТЕГОРИЙ
   ============================================ */
.cat-admin {
  padding: 0;
}

.cat-admin__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cat-admin__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.cat-admin__list {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.cat-admin__row {
  display: flex;
  align-items: center;
  border-bottom: 0.5px solid var(--border-light);
  min-height: 48px;
}

.cat-admin__row:last-child {
  border-bottom: none;
}

.cat-admin__main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 48px;
}

.cat-admin__main:active {
  background: var(--bg-hover);
}

.cat-admin__name {
  flex: 1;
}

.cat-admin__add {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.1s;
  flex-shrink: 0;
  margin-right: 4px;
}

.cat-admin__add:active {
  background: var(--bg-hover);
}

.cat-admin .loading {
  padding: 32px;
}
/* ============================================
   АДМИНКА ЗАМЕРОВ
   ============================================ */
.meas-admin {
  padding: 0;
}

.meas-admin__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.meas-admin__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.meas-admin__list {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.meas-admin__row {
  border-bottom: 0.5px solid var(--border-light);
}

.meas-admin__row:last-child {
  border-bottom: none;
}

.meas-admin__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 56px;
  justify-content: center;
}

.meas-admin__main:active {
  background: var(--bg-hover);
}

.meas-admin__name {
  font-weight: 600;
  font-size: 15px;
}

.meas-admin__params {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meas-admin__preview {
  color: var(--text-muted);
}

.meas-admin__preview-empty {
  color: var(--text-muted);
  font-style: italic;
}

.meas-admin__inherited {
  color: var(--accent);
  font-size: 12px;
}

/* Модалка редактирования параметров */
.meas-inherit {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
}

.meas-inherit__text {
  font-size: 14px;
  color: var(--text-muted);
}

.meas-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meas-edit-row {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  gap: 8px;
  align-items: center;
}

.meas-edit-row__name,
.meas-edit-row__unit {
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.meas-edit-row__name:focus,
.meas-edit-row__unit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.meas-edit-row__unit {
  text-align: center;
}

.meas-edit-row__remove {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.meas-edit-row__remove:active {
  background: var(--bg-active);
  color: var(--danger);
}
/* ============================================
   АДМИНКА ПОЛЬЗОВАТЕЛЕЙ
   ============================================ */
.users-admin, .groups-admin {
  padding: 0;
}

.users-admin__head, .groups-admin__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.users-admin__head h3, .groups-admin__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.users-admin__list, .groups-admin__list {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.user-row, .group-row {
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}

.user-row:last-child, .group-row:last-child {
  border-bottom: none;
}

.user-row:active, .group-row:active {
  background: var(--bg-hover);
}

.user-row__main, .group-row__main {
  padding: 12px 16px;
}

.user-row__name, .group-row__name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.user-row__email, .group-row__meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.user-row__groups {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.user-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  color: var(--text);
}

.user-chip--inactive {
  background: var(--danger);
  color: #fff;
}

/* Чекбоксы */
.check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.check-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin: 0;
}

/* Права в группе */
.perms-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.perm-group__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.perm-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perm-group .check-line {
  background: transparent;
  padding: 0;
  min-height: 32px;
}
/* ============================================
   ФОТОГРАФИИ (в форме редактирования)
   ============================================ */
.photos-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photos-editor__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-hover);
  cursor: pointer;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-tile--preview {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.photo-tile--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.photo-tile__star {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: inherit;
}

.photo-tile--preview .photo-tile__star {
  background: var(--accent);
  color: #fff;
}

.photo-tile__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: inherit;
}

.photo-tile__star:active,
.photo-tile__remove:active {
  transform: scale(0.9);
}

.photos-editor__add {
  align-self: flex-start;
}

/* ============================================
   ЛАЙТБОКС
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
  padding: var(--space-4);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: calc(var(--sat) + 16px);
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
}

.lightbox__close:active {
  background: rgba(255, 255, 255, 0.25);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* ============================================
   СЛАЙДЕР ФОТО В МОДАЛКЕ ТОВАРА
   ============================================ */
.product-slider {
  position: relative;
  background: #ececee;
}

.product-slider__viewport {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 60dvh;
  overflow: hidden;
}

.product-slider__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.product-slider__slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.product-slider__slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

/* Стрелки — на десктопе */
.product-slider__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: inherit;
  z-index: 5;
}

.product-slider__arrow--prev { left: 12px; }
.product-slider__arrow--next { right: 12px; }

.product-slider__arrow:active {
  background: rgba(255, 255, 255, 1);
}

@media (hover: hover) {
  .product-slider__arrow {
    display: flex;
  }
}

/* Миниатюры */
.product-slider__thumbs {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--border-light);
  -webkit-overflow-scrolling: touch;
}

.product-slider__thumbs::-webkit-scrollbar {
  display: none;
}

.product-slider__thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-hover);
  cursor: pointer;
  transition: outline-color 0.15s;
  outline: 2px solid transparent;
  outline-offset: -2px;
}

.product-slider__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-slider__thumb.is-active {
  outline-color: var(--accent);
}

/* ============================================
   ЗАКУПКИ
   ============================================ */
.purchases__toolbar {
  margin-bottom: var(--space-4);
}

.purchases__list {
  /* пусто */
}

/* Статусы */
.purchase-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
  letter-spacing: 0.3px;
}

.purchase-status.status--draft {
  background: #e8e8ed;
  color: var(--text-muted);
}
.purchase-status.status--ordered {
  background: #fff3cd;
  color: #856404;
}
.purchase-status.status--receiving {
  background: #cfe2ff;
  color: #084298;
}
.purchase-status.status--received {
  background: #d1e7dd;
  color: #0a3622;
}
.purchase-status.status--canceled {
  background: #f8d7da;
  color: #842029;
}

/* Модалка закупки */
.purchase-modal {
  padding: 16px;
}

.purchase-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.purchase-modal__number {
  font-size: 18px;
  font-weight: 600;
}

.purchase-modal__meta {
  margin-bottom: 16px;
  font-size: 15px;
}

.purchase-modal__totals {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.purchase-modal__total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.purchase-modal__total-row span {
  color: var(--text-muted);
}

.purchase-modal__total-row--final {
  border-top: 0.5px solid var(--border-light);
  margin-top: 4px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 600;
}

.purchase-modal__total-row--final b {
  color: var(--text);
}

/* Позиции */
.purchase-items {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.purchase-items__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.purchase-items__head h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.purchase-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border-light);
}

.purchase-item:last-child {
  border-bottom: none;
}

.purchase-item__main {
  flex: 1;
  min-width: 0;
}

.purchase-item__name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-item__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.purchase-item__qty {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.purchase-item__qty-received {
  color: var(--success);
  font-weight: 700;
}

.purchase-item__cost {
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
}

.purchase-item__remove {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.purchase-item__remove:active {
  background: var(--bg-hover);
  color: var(--danger);
}

/* Затраты */
.purchase-expense-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

/* Действия */
.purchase-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

/* ============================================
   ДОБАВЛЕНИЕ ПОЗИЦИИ
   ============================================ */
.add-item__results {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
  border-radius: 12px;
  background: var(--bg);
}

.add-item-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.add-item-row:last-child {
  border-bottom: none;
}

.add-item-row:active {
  background: var(--bg-hover);
}

.add-item-row--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.add-item-row__name {
  font-size: 15px;
  font-weight: 500;
}

.add-item-row__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.add-item-info {
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 16px;
}

.add-item-info__name {
  font-size: 15px;
  font-weight: 600;
}

.add-item-info__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Клик по позиции */
.purchase-item {
  cursor: pointer;
}

.purchase-item__clickable {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.purchase-item__remove {
  cursor: pointer;
}

/* ============================================
   ПРИЁМКА
   ============================================ */
.receiving-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.receiving-row {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
}

.receiving-row__head {
  margin-bottom: 8px;
}

.receiving-row__name {
  font-size: 15px;
  font-weight: 600;
}

.receiving-row__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.receiving-row__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.receiving-row__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.receiving-row__field span {
  font-size: 12px;
  color: var(--text-muted);
}

.receiving-row__field input {
  height: 40px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
}

.receiving-row__field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* Сводка */
.receiving-summary {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 16px;
}

.receiving-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.receiving-summary__row span {
  color: var(--text-muted);
}

.receiving-summary__row--final {
  border-top: 0.5px solid var(--border-light);
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 600;
}

.receiving-summary__items {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border-light);
}

.receiving-summary__item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.receiving-summary__item span:first-child {
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   АДМИНКА ПОСТАВЩИКОВ
   ============================================ */
.suppliers-admin {
  padding: 0;
}

.suppliers-admin__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.suppliers-admin__head h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.suppliers-admin__filters {
  margin-bottom: 12px;
}

.suppliers-admin__list {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.supplier-row {
  border-bottom: 0.5px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}

.supplier-row:last-child {
  border-bottom: none;
}

.supplier-row:active {
  background: var(--bg-hover);
}

.supplier-row__main {
  padding: 12px 16px;
}

.supplier-row__name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.supplier-row__meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   ЗАТРАТЫ
   ============================================ */
.expenses__filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-4);
}

.expenses__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.expenses__row--dates {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 8px;
}

.form-input--sm {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 15px;
}

/* Чипы на затратах */
.expense-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.expense-chip--auto {
  background: #cfe2ff;
  color: #084298;
}

.expense-chip--lock {
  background: #f8d7da;
  color: #842029;
}
/* ============================================
   ПРОСМОТР ЗАТРАТЫ (модалка)
   ============================================ */
.expense-view {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
}

.expense-view__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border-light);
  font-size: 14px;
}

.expense-view__row:last-child {
  border-bottom: none;
}

.expense-view__row span {
  color: var(--text-muted);
  flex-shrink: 0;
}

.expense-view__row b {
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}
/* ============================================
   ЗАКАЗЫ
   ============================================ */
.orders__toolbar {
  margin-bottom: var(--space-4);
}

.orders__list {
  /* пусто */
}
.list__item{
  padding: 8px 14px;
  margin: 5px 0;
  font-size: 14px;
  border: none;
  border-radius: 16px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s;
}

/* ============================================
   SVG-ГРАФИКИ
   ============================================ */
.chart {
  display: block;
  width: 100%;
}

.chart--line {
  /* пусто */
}

.chart--donut {
  margin: 0 auto;
}

.chart-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg);
  border-radius: 12px;
}

/* ============================================
   АНАЛИТИКА
   ============================================ */
.analytics {
  padding: 0;
}

.analytics__period {
  margin-bottom: 16px;
}

.analytics__presets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.analytics__presets::-webkit-scrollbar { display: none; }

.analytics__dates {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.analytics__dates input {
  flex: 1;
}

.analytics__subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 0.5px solid var(--border-light);
  scrollbar-width: none;
}

.analytics__subtabs::-webkit-scrollbar { display: none; }

/* Карточки */
.analytics-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.analytics-card {
  padding: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.analytics-card--accent {
  background: linear-gradient(135deg, #e8f2ff, #ffffff);
  border: 0.5px solid rgba(0, 113, 227, 0.15);
}

.analytics-card--success {
  background: linear-gradient(135deg, #e8f9ee, #ffffff);
  border: 0.5px solid rgba(52, 199, 89, 0.15);
}

.analytics-card--danger {
  background: linear-gradient(135deg, #ffe8e8, #ffffff);
  border: 0.5px solid rgba(255, 59, 48, 0.15);
}

.analytics-card--warning {
  background: linear-gradient(135deg, #fff3e0, #ffffff);
  border: 0.5px solid rgba(255, 149, 0, 0.15);
}

.analytics-card__title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}

.analytics-card__value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.analytics-card__subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Блоки */
.analytics-block {
  margin-bottom: 24px;
}

.analytics-block h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.chart-container {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px 8px 8px;
  box-shadow: var(--shadow-sm);
}

/* Круговая */
.analytics-donut {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.analytics-donut__chart {
  flex-shrink: 0;
}

.analytics-donut__legend {
  flex: 1;
  min-width: 0;
}

.analytics-donut__legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}

.analytics-donut__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.analytics-donut__label {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-donut__value {
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

/* Мобильная адаптация */
@media (max-width: 420px) {
  .analytics-donut {
    flex-direction: column;
    align-items: stretch;
  }
  .analytics-donut__chart {
    align-self: center;
  }
}

/* ============================================
   ОБОРАЧИВАЕМОСТЬ
   ============================================ */
.analytics-filters {
  margin-bottom: 16px;
}

.turnover-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.turnover--dead {
  background: #f8d7da;
  color: #842029;
}

.turnover--slow {
  background: #fff3cd;
  color: #856404;
}

.turnover--fast {
  background: #d1e7dd;
  color: #0a3622;
}

.turnover--zero {
  background: #e8e8ed;
  color: var(--text-muted);
}