/* === 💎 ПРЕМИУМ ДИЗАЙН СИСТЕМЫ ОСТАТКОВ === */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  /* 🎨 Элегантная серо-бело-золотая палитра */
  --gold-50: #fffef7;
  --gold-100: #fffaeb;
  --gold-200: #fff3c4;
  --gold-300: #ffe89d;
  --gold-400: #ffd54f;
  --gold-500: #ffc107;
  --gold-600: #ffb300;
  --gold-700: #ffa000;
  --gold-800: #ff8f00;
  --gold-900: #ff6f00;
  
  /* Основная золотая палитра для акцентов */
  --primary-50: #fffef7;
  --primary-100: #fffaeb;
  --primary-200: #fff3c4;
  --primary-300: #ffe89d;
  --primary-400: #ffd54f;
  --primary-500: #ffc107;
  --primary-600: #ffb300;
  --primary-700: #ffa000;
  --primary-800: #ff8f00;
  --primary-900: #ff6f00;
  
  /* Серые оттенки */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* Статус цвета */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;
  
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-700: #b91c1c;
  
  /* 💫 Премиум тени */
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-elegant: 0 8px 24px rgba(0, 0, 0, 0.08), 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-luxury: 0 20px 60px rgba(0, 0, 0, 0.15), 0 30px 80px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 0 1px rgba(194, 142, 90, 0.1), 0 4px 16px rgba(194, 142, 90, 0.15);
  
  /* Скругления */
  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-md: 1rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  
  /* ⚡ Плавные переходы */
  --transition-swift: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-elegant: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === ✨ БАЗОВЫЕ СТИЛИ === */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: 
    radial-gradient(circle at 20% 20%, rgba(255, 193, 7, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 179, 0, 0.04) 0%, transparent 50%),
    linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  margin: 0;
  padding: 0;
  color: var(--gray-800);
  line-height: 1.65;
  font-weight: 400;
  min-height: 100vh;
  letter-spacing: -0.01em;
}

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  animation: fadeInUp 0.6s var(--transition-elegant);
}

/* === 🎯 ЗАГОЛОВКИ === */
h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--gray-800);
  letter-spacing: -0.03em;
  line-height: 1.2;
  position: relative;
  animation: fadeInDown 0.8s var(--transition-elegant) 0.2s backwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gray-800) 50%, transparent 100%);
  border-radius: 2px;
}

/* Информация об актуальности в заголовке */
.update-info-inline {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--gray-600);
  margin-top: 0.25rem;
  letter-spacing: 0;
}

.update-info-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.25rem;
}

.update-info-item {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--gray-600);
  letter-spacing: 0;
}

.update-info-item.outdated {
  color: var(--error-600);
  font-weight: 500;
}

.update-info {
  display: none; /* Скрываем старый блок */
}

/* === 🔍 ПОИСК И ФИЛЬТРЫ === */
.search-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.4rem;
  border-radius: var(--radius-2xl);
  position: sticky;
  top: 1rem;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  margin-top: 1.5rem;
  margin-bottom: 1.4rem;
  border: 2px solid var(--gray-200);
  transition: padding 0.2s ease-out, border-radius 0.2s ease-out, box-shadow 0.2s ease-out;
  animation: fadeInUp 0.8s var(--transition-elegant) 0.6s backwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* Компактный режим при прокрутке */
.search-container.scrolled {
  padding: 1rem 1.4rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--gray-200);
  /* Оптимизация для плавности */
  will-change: padding, border-radius;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Предотвращаем резкие изменения размера */
  min-height: 80px;
}

.search-container.scrolled .search-box {
  margin-bottom: 0.75rem;
  max-width: 100%;
}

.search-container.scrolled .search-box input {
  height: 2.8rem;
  padding: 0 2.8rem 0 1.2rem;
  font-size: 0.95rem;
}

/* Скрываем кнопки фильтров в компактном режиме только при большой прокрутке */
.search-container.scrolled .filter-buttons {
  display: flex;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}


.search-box {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto 1.2rem;
}

.search-box input {
  width: 100%;
  height: 2.8rem;
  padding: 0 2.8rem 0 1.2rem;
  font-size: 0.95rem;
  color: var(--gray-800);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  outline: none;
  transition: var(--transition-smooth);
  font-family: inherit;
  font-weight: 400;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-subtle);
}

.search-box input:focus {
  border-color: var(--gray-400);
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 0 4px rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
}

.search-box input::placeholder {
  color: var(--gray-400);
  font-weight: 300;
}

.clear-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-300);
  border: none;
  border-radius: 50%;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-spring);
  color: var(--gray-600);
  font-size: 1rem;
  line-height: 1;
  visibility: hidden;
  box-shadow: var(--shadow-subtle);
}

.clear-btn:hover {
  background: var(--gray-700);
  color: white;
  transform: translateY(-50%) scale(1.1) rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-box input:not(:placeholder-shown) ~ .clear-btn {
  visibility: visible;
  animation: popIn 0.3s var(--transition-spring);
}

/* 🎛️ Фильтры */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

.group-nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  padding: 0.05rem 0.15rem 0.2rem;
}

.group-nav-label {
  flex: 0 0 auto;
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.group-nav-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0.1rem 0.4rem;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.group-nav-list::-webkit-scrollbar {
  height: 6px;
}

.group-nav-list::-webkit-scrollbar-track {
  background: transparent;
}

.group-nav-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border: 0;
}

.group-nav-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  color: var(--gray-700);
  text-decoration: none;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  box-shadow: var(--shadow-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  scroll-snap-align: start;
  transition: var(--transition-smooth);
}

.group-nav-link:hover {
  color: var(--gray-900);
  background: white;
  border-color: var(--gray-300);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.group-nav-link.active {
  color: white;
  background: var(--gray-800);
  border-color: var(--gray-800);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.group-nav-count {
  min-width: 1.35rem;
  padding: 0.12rem 0.38rem;
  color: var(--gray-500);
  background: var(--gray-100);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.group-nav-link.active .group-nav-count {
  color: var(--gray-800);
  background: white;
}

.search-container.scrolled .group-nav {
  padding-bottom: 0.05rem;
}

.search-container.scrolled .group-nav-list {
  padding-bottom: 0.25rem;
}

.search-container.scrolled .group-nav-link {
  min-height: 1.8rem;
  padding: 0.28rem 0.58rem;
  font-size: 0.74rem;
}

/* Ссылка на пояснение по складам */
.warehouse-link {
  display: inline-flex;
  align-items: center;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  transition: var(--transition-smooth);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

.warehouse-link:hover {
  color: var(--gray-900);
  background: var(--gray-200);
  border-color: var(--gray-300);
  text-decoration: underline;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}


.filter-btn {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 2px solid var(--gray-200);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gray-200);
  opacity: 0;
  transition: var(--transition-smooth);
}

.filter-btn > * {
  position: relative;
  z-index: 1;
}

.filter-btn:hover {
  border-color: var(--gray-300);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  background: var(--gray-200);
}

.filter-btn:hover::before {
  opacity: 0.5;
}

.filter-btn.active {
  background: var(--gray-800);
  border-color: var(--gray-800);
  color: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.filter-btn:active {
  transform: translateY(0);
}

/* Эмодзи убраны для минималистичного дизайна */

/* === 📦 ГРУППЫ ТОВАРОВ === */
.group-container {
  margin-bottom: 2.5rem;
  scroll-margin-top: 11.5rem;
  background: white;
  backdrop-filter: blur(10px);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--gray-200);
  transition: var(--transition-elegant);
  animation: slideInUp 0.6s var(--transition-elegant) backwards;
}

.group-container:nth-child(1) { animation-delay: 0.1s; }
.group-container:nth-child(2) { animation-delay: 0.15s; }
.group-container:nth-child(3) { animation-delay: 0.2s; }
.group-container:nth-child(4) { animation-delay: 0.25s; }
.group-container:nth-child(5) { animation-delay: 0.3s; }
.group-container:nth-child(n+6) { animation-delay: 0.35s; }

.group-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-2xl);
  padding: 2px;
  background: linear-gradient(135deg, 
    rgba(0, 0, 0, 0.08) 0%, 
    transparent 50%,
    rgba(0, 0, 0, 0.08) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: var(--transition-smooth);
}

.group-container:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: var(--gray-300);
}

.group-container:hover::after {
  opacity: 1;
}

.group-title {
  margin: 0;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, 
    var(--gray-50) 0%, 
    white 100%);
  font-size: 1.35rem;
  font-weight: 600;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gray-800);
  border-bottom: 2px solid var(--gray-200);
  letter-spacing: -0.02em;
  transition: var(--transition-smooth);
}

.group-title .total-available {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--gray-500);
  margin-left: 0.5rem;
}

.group-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(to bottom, 
    var(--gray-700), 
    var(--gray-800),
    var(--gray-900));
  border-radius: 0 4px 4px 0;
}

.toggle-button {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-spring);
  font-size: 1.25rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  line-height: 1;
}

.toggle-button:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  background: var(--gray-800);
  color: white;
  border-color: var(--gray-800);
}

.toggle-button:active {
  transform: scale(0.95);
}

.group-container.collapsed .table-wrapper {
  display: none;
}

.group-container.collapsed .toggle-button {
  transform: rotate(0deg);
}

.group-container.collapsed .toggle-button:hover {
  transform: scale(1.1) rotate(-90deg);
}

/* === 📊 ПРЕМИУМ ТАБЛИЦЫ === */
.table-wrapper {
  overflow-x: auto;
  overflow-y: visible;
  background: transparent;
}

.searchableTable thead {
  position: relative;
  overflow: visible;
}

.searchableTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
}

.searchableTable th {
  background: linear-gradient(135deg, 
    rgba(194, 142, 90, 0.1) 0%, 
    rgba(212, 165, 116, 0.05) 100%);
  color: var(--gray-700);
  font-weight: 600;
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 2px solid rgba(194, 142, 90, 0.2);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: visible;
}

/* Стили для заголовков с подсказками */
.searchableTable th[data-tooltip] {
  position: relative;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--gray-400);
  text-underline-offset: 3px;
  cursor: help;
}

.searchableTable th[data-tooltip]:hover {
  text-decoration-color: var(--gray-600);
}

/* Стили для сортируемых заголовков */
.searchableTable th.sortable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.searchableTable th.sortable:hover {
  background: rgba(194, 142, 90, 0.15);
}

.searchableTable th.sortable .sort-indicator {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.9em;
  opacity: 0.3;
  transition: opacity 0.2s ease;
  vertical-align: middle;
}

/* Кастомный tooltip через JavaScript */
.custom-tooltip {
  position: fixed;
  padding: 0.75rem 1rem;
  background: var(--gray-900);
  color: white;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  white-space: normal;
  width: 320px;
  max-width: 90vw;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
  word-wrap: break-word;
}

.custom-tooltip-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.searchableTable td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(194, 142, 90, 0.08);
  transition: var(--transition-smooth);
}

.searchableTable tbody tr {
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.searchableTable tbody tr::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  max-width: 0;
  min-width: 0;
  background: linear-gradient(90deg, var(--gray-800), transparent);
  transition: var(--transition-smooth);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: translateX(-100%);
  /* Исправление для Safari - полностью скрываем по умолчанию */
  -webkit-transform: translateX(-100%);
  visibility: hidden;
  display: none;
  will-change: width, opacity, transform;
}

.searchableTable tbody tr:hover {
  background: linear-gradient(90deg, 
    rgba(0, 0, 0, 0.02) 0%, 
    rgba(0, 0, 0, 0.01) 100%);
}

.searchableTable tbody tr:hover::after {
  display: block;
  width: 4px;
  max-width: 4px;
  min-width: 4px;
  opacity: 1;
  transform: translateX(0);
  -webkit-transform: translateX(0);
  visibility: visible;
}

.searchableTable tbody tr:nth-child(even) {
  background: rgba(194, 142, 90, 0.02);
}

.searchableTable tbody tr:nth-child(even):hover {
  background: linear-gradient(90deg, 
    rgba(194, 142, 90, 0.08) 0%, 
    rgba(212, 165, 116, 0.04) 100%);
}

/* 🏷️ Стиль для колонки "Доступно" с градиентом цветов */
.quantity-cell {
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.available-note {
  display: block;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  font-style: italic;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  line-height: 1.4;
}

/* Дефицит */
.searchableTable tbody tr.deficit-row {
  background: linear-gradient(90deg, 
    var(--error-50) 0%, 
    rgba(254, 242, 242, 0.3) 100%) !important;
}

/* Убираем красную полосу для дефицитных товаров - она вызывает проблемы в Safari */
.searchableTable tbody tr.deficit-row::after {
  display: none !important;
  width: 0 !important;
  max-width: 0 !important;
  min-width: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

.searchableTable tbody tr.deficit-row:hover {
  background: linear-gradient(90deg, 
    var(--error-100) 0%, 
    rgba(254, 226, 226, 0.4) 100%) !important;
}

.searchableTable tbody tr.deficit-row:hover::after {
  display: none !important;
}

.searchableTable tbody tr.deficit-row .quantity-cell {
  color: var(--error-700);
  font-weight: 700;
}

/* Ссылки */
/* Все названия товаров - жирные (первая колонка) */
.searchableTable tbody td:first-child {
  font-weight: 600;
}

.searchableTable a {
  color: var(--gray-800);
  text-decoration: underline;
  text-decoration-color: var(--gray-400);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: var(--transition-smooth);
  position: relative;
  cursor: pointer;
}

.searchableTable a:hover {
  color: var(--gray-900);
  text-decoration-color: var(--gray-800);
  text-decoration-thickness: 2px;
}

/* === 🚀 КНОПКА НАВЕРХ === */
#scrollToTopBtn {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  background: var(--gray-800);
  color: white;
  border: none;
  border-radius: 50%;
  width: 4rem;
  height: 4rem;
  font-size: 1.75rem;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: var(--transition-spring);
  z-index: 1000;
  border: 2px solid var(--gray-700);
  line-height: 1;
}

#scrollToTopBtn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--gray-900);
  z-index: -1;
  opacity: 0;
  transition: var(--transition-smooth);
}

#scrollToTopBtn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  background: var(--gray-900);
}

#scrollToTopBtn:hover::before {
  opacity: 1;
  animation: rotate 3s linear infinite;
}

#scrollToTopBtn:active {
  transform: translateY(-2px) scale(0.98);
}

/* === 📱 МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 768px) {
  .main-container {
    padding: 1.5rem 1rem;
  }
  
  h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }
  
  h1::after {
    width: 60px;
    bottom: -0.4rem;
    height: 2px;
  }
  
  .update-info-inline {
    font-size: 0.7rem;
  }
  
  .update-info-block {
    gap: 0.1rem;
  }
  
  .update-info-item {
    font-size: 0.7rem;
  }
  
  .update-info {
    display: none;
  }
  
  .search-container {
    position: sticky;
    top: 0;
    padding: 1rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
    /* Убираем анимацию на мобильных для производительности */
    animation: none;
    /* Упрощаем transition для лучшей производительности */
    transition: padding 0.15s linear, border-radius 0.15s linear;
    z-index: 100;
    /* Оптимизация для мобильных */
    will-change: padding;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  
  .search-container.scrolled {
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    will-change: auto;
  }
  
  /* Упрощаем transitions для всех элементов на мобильных */
  .search-container * {
    transition-duration: 0.15s !important;
  }
  
  .search-box {
    margin-bottom: 1.25rem;
    max-width: 100%;
  }
  
  .search-box input {
    height: 3.5rem;
    font-size: 1rem;
    padding: 0 3rem 0 1.25rem;
  }
  
  .filter-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .group-nav {
    align-items: flex-start;
    gap: 0;
    padding: 0;
  }

  .group-nav-label {
    display: none;
  }

  .group-nav-list {
    width: 100%;
    padding: 0.05rem 0.05rem 0.35rem;
  }

  .group-nav-link {
    min-height: 2rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }

  .search-container.scrolled .group-nav-list {
    padding-bottom: 0.25rem;
  }
  
  .filter-btn {
    width: 100%;
    padding: 1rem 1.25rem;
    justify-content: center;
  }
  
  .group-container {
    margin-bottom: 1.5rem;
    scroll-margin-top: 13rem;
  }
  
  .group-title {
    padding: 1.25rem 1rem;
    font-size: 1.15rem;
  }
  
  .toggle-button {
    width: 2.25rem;
    height: 2.25rem;
  }
  
  /* Таблица → карточки */
  .table-wrapper {
    overflow: visible;
  }
  
  .searchableTable,
  .searchableTable thead,
  .searchableTable tbody,
  .searchableTable th,
  .searchableTable td,
  .searchableTable tr {
    display: block;
  }
  
  .searchableTable thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .searchableTable tbody tr {
    margin: 0 0 1.25rem 0;
    border: 1px solid rgba(194, 142, 90, 0.15);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
    overflow: hidden;
  }
  
  .searchableTable tbody tr::after {
    width: 3px !important;
  }
  
  .searchableTable td {
    position: relative;
    padding: 1.125rem 1rem 1.125rem 50%;
    text-align: right;
    border: none;
    border-bottom: 1px solid rgba(194, 142, 90, 0.08);
  }
  
  .searchableTable td:last-child {
    border-bottom: none;
  }
  
  .searchableTable td:first-child {
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
  }
  
  .searchableTable td::before {
    content: attr(data-label);
    position: absolute;
    left: 1rem;
    width: 45%;
    padding-right: 1rem;
    font-weight: 600;
    text-align: left;
    color: var(--gray-600);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  
  #scrollToTopBtn {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.5rem;
  }
}

/* === ✨ АНИМАЦИИ === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Премиум скроллбар */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 100px;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

/* Selection */
::selection {
  background: rgba(194, 142, 90, 0.3);
  color: var(--gray-900);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Счетчик посетителей */
.visitor-counter {
  text-align: center;
  padding: 1rem 0;
  margin-top: 3rem;
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 300;
}

/* Tooltip для информации о складах */
.warehouse-tooltip {
  position: fixed;
  padding: 0;
  background: var(--gray-900);
  color: white;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  min-width: 220px;
  max-width: 320px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
  word-wrap: break-word;
  overflow: hidden;
}

.warehouse-tooltip-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.warehouse-tooltip-list {
  padding: 0.5rem 0;
  max-height: 300px;
  overflow-y: auto;
}

.warehouse-tooltip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s ease;
}

.warehouse-tooltip-item:last-child {
  border-bottom: none;
}

.warehouse-tooltip-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.warehouse-name {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
}

.warehouse-qty {
  font-weight: 600;
  color: #4ade80;
  font-size: 0.8rem;
  margin-left: 1rem;
}

.warehouse-tooltip-footer {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  text-align: center;
}

.warehouse-tooltip-footer strong {
  color: #4ade80;
  font-size: 0.85rem;
}

.warehouse-tooltip-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

/* Tooltip для информации о поступлениях */
.delivery-tooltip {
  position: fixed;
  padding: 0;
  background: var(--gray-900);
  color: white;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  min-width: 220px;
  max-width: 320px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
  word-wrap: break-word;
  overflow: hidden;
}

.delivery-tooltip-header {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.delivery-tooltip-list {
  padding: 0.5rem 0;
  max-height: 300px;
  overflow-y: auto;
}

.delivery-tooltip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s ease;
}

.delivery-tooltip-item:last-child {
  border-bottom: none;
}

.delivery-tooltip-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.delivery-date {
  flex: 1;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
}

.delivery-qty {
  font-weight: 600;
  color: #4ade80;
  font-size: 0.8rem;
  margin-left: 1rem;
}

.delivery-tooltip-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

/* Маленькая меточка у названия товара с ожидаемыми поступлениями */
.delivery-indicator {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #4ade80;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* Tooltip для информации о расчете "Доступно" */
.available-tooltip {
  position: fixed;
  padding: 0.75rem 1rem;
  background: var(--gray-900);
  color: white;
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  min-width: 200px;
  max-width: 400px;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
  word-wrap: break-word;
  line-height: 1.5;
}

.available-text-green {
  color: #4ade80;
}

.available-text-green strong {
  color: #4ade80;
  font-weight: 700;
}

.available-text-red {
  color: #f87171;
}

.available-text-red strong {
  color: #f87171;
  font-weight: 700;
}

.available-text-result {
  color: white;
}

.available-text-result strong {
  color: white;
  font-weight: 700;
}

/* Легкое выделение ячейки при показе tooltip */
.tooltip-highlight {
  background: rgba(255, 193, 7, 0.08) !important;
  border-radius: 4px;
  position: relative;
}

.tooltip-highlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 4px;
  pointer-events: none;
}

/* Легенда складов */
.warehouse-legend {
  max-width: 1400px;
  margin: 3rem auto 2rem;
  padding: 2rem;
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid var(--gray-200);
}

.legend-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-200);
  letter-spacing: -0.02em;
}

.legend-subtitle {
  color: var(--gray-500);
  font-size: 0.7em;
  font-weight: 400;
  margin-left: 0.5rem;
}

.legend-content {
  display: grid;
  gap: 1.25rem;
}

.legend-item {
  padding: 1.25rem;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  transition: var(--transition-smooth);
}

.legend-item:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.legend-item-header {
  margin-bottom: 0.75rem;
}

.legend-warehouse-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  letter-spacing: -0.01em;
}

.legend-description {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.6;
  margin: 0;
}

/* Ссылка в tooltip */
.custom-tooltip a {
  color: #4ade80;
  text-decoration: underline;
  font-weight: 500;
  margin-top: 0.5rem;
  display: inline-block;
}

.custom-tooltip a:hover {
  color: #22c55e;
}

@media (max-width: 768px) {
  .warehouse-legend {
    margin: 2rem 1rem 1.5rem;
    padding: 1.5rem 1rem;
  }
  
  .legend-title {
    font-size: 1.25rem;
  }
  
  .legend-item {
    padding: 1rem;
  }
}

.available-tooltip-arrow {
  position: fixed;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}
