/* ===== BACKROOM COMPONENTS ===== */
/* Специализированные компоненты для BackRoom */
/* Версия: 2.0.3 - Убрано принудительное масштабирование, используем нормальные размеры */

/* ===== ГЛОБАЛЬНОЕ МАСШТАБИРОВАНИЕ ===== */
/* Убрано принудительное масштабирование - используем нормальные размеры */
/* Уменьшаем базовые размеры для компактности */
@media (min-width: 1024px) {
  body {
    font-size: 14px;
    /* Уменьшаем базовый размер шрифта */
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .supplier-section {
    padding: 8px;
    /* Уменьшаем отступы */
    margin-bottom: 12px;
  }

  .legend-container {
    margin-bottom: 8px;
  }

  .legend-item {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* ===== CSS VARIABLES ===== */
:root {
  /* Цвета */
  --primary: #0A84FF;
  --primary-dark: #0056CC;
  --primary-light: #5AC8FA;
  --success: #34C759;
  --warning: #FF9500;
  --danger: #FF3B30;
  --info: #5AC8FA;

  /* Нейтральные цвета */
  --white: #FFFFFF;
  --black: #000000;
  --gray-50: #F9F9F9;
  --gray-100: #F2F2F7;
  --gray-200: #E5E5EA;
  --gray-300: #D1D1D6;
  --gray-400: #C7C7CC;
  --gray-500: #AEAEB2;
  --gray-600: #8E8E93;
  --gray-700: #636366;
  --gray-800: #48484A;
  --gray-900: #1C1C1E;

  /* Размеры */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  /* Отступы */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 48px;

  /* Тени */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Анимации */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Типографика */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, system-ui, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;

  /* Z-индексы */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* Совместимость с theme.css */
  --bg: var(--bg-primary, #FBFBFD);
  --bg-card: var(--bg-card, #FFFFFF);
  --text: var(--text-primary, #111);
  --text-sec: var(--text-secondary, #6B6B6B);
  --sep: var(--border-primary, #E5E5EA);
  --fill: var(--bg-tertiary, #F2F2F7);
  --tint: var(--primary, #0A84FF);
  --radius: var(--radius-md, 12px);
  --radius-lg: var(--radius-lg, 16px);
  --shadow: var(--shadow, 0 1px 2px rgba(0, 0, 0, .06));
  --space: var(--space-lg, 16px);
  --font: var(--font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, system-ui, sans-serif);
}

/* ===== THEME SUPPORT ===== */
/* Светлая тема */
.light-theme {
  --bg-primary: var(--white);
  --bg-secondary: var(--gray-50);
  --bg-tertiary: var(--gray-100);
  --bg-card: var(--white);
  --bg-overlay: rgba(0, 0, 0, 0.5);

  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-700);
  --text-tertiary: var(--gray-500);

  --border-primary: var(--gray-200);
  --border-secondary: var(--gray-100);
  --border-focus: var(--primary);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
}

/* Темная тема */
.dark-theme {
  --bg-primary: var(--gray-900);
  --bg-secondary: var(--gray-800);
  --bg-tertiary: var(--gray-700);
  --bg-card: var(--gray-800);
  --bg-overlay: rgba(0, 0, 0, 0.7);

  --text-primary: var(--gray-100);
  --text-secondary: var(--gray-300);
  --text-tertiary: var(--gray-500);

  --border-primary: var(--gray-600);
  --border-secondary: var(--gray-700);
  --border-focus: var(--primary-light);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
}

/* ===== BASE STYLES ===== */
/* Базовые стили для всех элементов */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  height: 40px;
  /* Единая высота как у select/input */
  box-sizing: border-box;
  /* Совпадение правил растягивания */
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Размеры кнопок */
.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-sm);
  height: 32px;
}

.btn-md {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  height: 40px;
}

.btn-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--font-size-lg);
  height: 48px;
}

/* Варианты кнопок */
.btn-primary {
  background-color: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-tertiary);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

.btn-danger:hover {
  background-color: #D70015;
  border-color: #D70015;
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success);
  color: var(--white);
  border-color: var(--success);
}

.btn-success:hover {
  background-color: #2DB350;
  border-color: #2DB350;
  transform: translateY(-1px);
}

/* ===== GRID SYSTEM ===== */
.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

/* Make grid utility classes self-sufficient */
.grid-cols-1,
.grid-cols-2,
.grid-cols-3,
.grid-cols-4,
.grid-cols-5,
.grid-cols-6 {
  display: grid;
  gap: var(--space-md, var(--space, 16px));
}

/* Text utilities */
.text-right {
  text-align: right;
}

.right {
  text-align: right;
}

.text-secondary {
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
}

/* Minimal generic table styles for unified look */
.table-container {
  overflow-x: auto;
  margin-top: var(--space-md, 12px);
  border: 1px solid var(--sep);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 1px 2px rgba(0, 0, 0, .06));
  background: var(--bg-card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

.table th,
.table td {
  padding: var(--space-md, 12px);
  border-bottom: 1px solid var(--sep);
  text-align: left;
  color: var(--text);
  vertical-align: middle;
}

.table th {
  background: var(--bg-tertiary, var(--fill, #F2F2F7));
  font-weight: 600;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
  /* Compact global size (was var(--font-size-base)=16px) */
  background-color: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

/* Базовая унификация высоты для всех выпадающих списков */
/* Базовая унификация высоты для всех выпадающих списков */
select.form-input {
  height: auto;
  /* Was 40px */
  min-height: 32px;
  line-height: 1.2;
  padding: 6px 12px;
  /* Was 8px top/bottom */
  padding-right: 36px;
  /* Keep space for arrow */
  box-sizing: border-box;
  /* Унифицируем скругления и внешний вид с input/button */
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  /* Четкий индикатор выпадающего меню (адаптируется к теме) */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(-45deg, transparent 50%, var(--text) 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 12px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* Единая высота для текстовых полей (как у select) */
input.form-input {
  height: auto;
  /* Was 40px */
  min-height: 32px;
  line-height: 1.2;
  padding: 6px 12px;
  /* Was 8px top/bottom */
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

/* ===== SUPPLIER COMPONENTS ===== */
.supplier-section {
  background-color: var(--bg-card, var(--bg-card, #FFFFFF));
  border: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  border-radius: var(--radius-lg, var(--radius-lg, 16px));
  overflow: hidden;
  margin-bottom: var(--space-xl, var(--space, 16px));
  box-shadow: var(--shadow, 0 1px 2px rgba(0, 0, 0, .06));
  transition: all var(--transition-normal, 0.3s ease);
}

.supplier-section:hover {
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
  transform: translateY(-2px);
}

.supplier-header {
  background-color: var(--bg-secondary, var(--fill, #F2F2F7));
  padding: var(--space-lg, var(--space, 16px)) var(--space-xl, var(--space, 16px));
  border-bottom: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  /* Запрещаем перенос элементов */
  gap: var(--space-md, var(--space, 16px));
}

.supplier-name {
  font-size: var(--font-size-xl, 20px);
  font-weight: 600;
  color: var(--text-primary, var(--text, #111));
  margin: 0;
}

.supplier-actions {
  display: flex;
  gap: var(--space-md, var(--space, 16px));
  flex-wrap: nowrap;
  /* Запрещаем перенос элементов */
}

.supplier-actions .btn {
  min-width: 140px;
  height: 40px;
  font-size: var(--font-size-sm, 14px);
  font-weight: 500;
}

/* ===== SUPPLIER BUTTONS WITH COLOR SCHEME ===== */
.suppliers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  /* как у buyer: авто‑подгон, тянутся на ширину */
  gap: var(--space-md, var(--space, 16px));
  margin-bottom: var(--space-xl, var(--space, 16px));
}

.supplier-btn {
  padding: var(--space-lg, var(--space, 16px));
  font-size: var(--font-size-base, 16px);
  font-weight: 500;
  border-radius: var(--radius-md, var(--radius, 12px));
  transition: all var(--transition-normal, 0.3s ease);
  border: 2px solid;
  cursor: pointer;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Цветовая схема для кнопок поставщиков */
.supplier-btn.color-1 {
  background: #E8F5E8;
  border-color: #4CAF50;
  color: #2E7D32;
}

.supplier-btn.color-2 {
  background: #FFF3E0;
  border-color: #FF9800;
  color: #E65100;
}

.supplier-btn.color-3 {
  background: #E3F2FD;
  border-color: #2196F3;
  color: #1565C0;
}

.supplier-btn.color-4 {
  background: #F3E5F5;
  border-color: #9C27B0;
  color: #6A1B9A;
}

.supplier-btn.color-5 {
  background: #E0F2F1;
  border-color: #009688;
  color: #00695C;
}

.supplier-btn.color-6 {
  background: #FFF8E1;
  border-color: #FFC107;
  color: #F57F17;
}

.supplier-btn.color-7 {
  background: #FCE4EC;
  border-color: #E91E63;
  color: #AD1457;
}

.supplier-btn.color-8 {
  background: #E8EAF6;
  border-color: #3F51B5;
  color: #283593;
}

.supplier-btn.color-9 {
  background: #E0F7FA;
  border-color: #00BCD4;
  color: #006064;
}

.supplier-btn.color-10 {
  background: #F1F8E9;
  border-color: #8BC34A;
  color: #558B2F;
}

/* Hover эффекты для цветных кнопок */
.supplier-btn.color-1:hover {
  background: #C8E6C9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.supplier-btn.color-2:hover {
  background: #FFE0B2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.supplier-btn.color-3:hover {
  background: #BBDEFB;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.supplier-btn.color-4:hover {
  background: #D1C4E9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

.supplier-btn.color-5:hover {
  background: #B2DFDB;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 150, 136, 0.3);
}

.supplier-btn.color-6:hover {
  background: #FFECB3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.supplier-btn.color-7:hover {
  background: #F8BBD9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.supplier-btn.color-8:hover {
  background: #C5CAE9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(63, 81, 181, 0.3);
}

.supplier-btn.color-9:hover {
  background: #B2EBF2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

.supplier-btn.color-10:hover {
  background: #DCEDC8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 195, 74, 0.3);
}

/* Активное состояние для цветных кнопок */
.supplier-btn.color-1.active {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.supplier-btn.color-2.active {
  background: #FF9800;
  color: white;
  border-color: #FF9800;
}

.supplier-btn.color-3.active {
  background: #2196F3;
  color: white;
  border-color: #2196F3;
}

.supplier-btn.color-4.active {
  background: #9C27B0;
  color: white;
  border-color: #9C27B0;
}

.supplier-btn.color-5.active {
  background: #009688;
  color: white;
  border-color: #009688;
}

.supplier-btn.color-6.active {
  background: #FFC107;
  color: white;
  border-color: #FFC107;
}

.supplier-btn.color-7.active {
  background: #E91E63;
  color: white;
  border-color: #E91E63;
}

.supplier-btn.color-8.active {
  background: #3F51B5;
  color: white;
  border-color: #3F51B5;
}

.supplier-btn.color-9.active {
  background: #00BCD4;
  color: white;
  border-color: #00BCD4;
}

.supplier-btn.color-10.active {
  background: #8BC34A;
  color: white;
  border-color: #8BC34A;
}

/* ===== QUANTITY CONTROLS ===== */
.qty-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 4px);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  -webkit-box-shadow: none;
  box-shadow: none;
}

.qty-input {
  width: 45px;
  height: 36px;
  text-align: center;
  box-sizing: border-box;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-sm, 14px);
  padding: 0;
  margin: 0;
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  color: var(--text-primary, var(--text, #111));
  transition: all var(--transition-fast, 0.15s ease);
}

.qty-input:focus {
  outline: none;
  border-color: var(--border-primary, var(--sep, #E5E5EA));
  box-shadow: none;
}

.qty-input.has-quantity {
  background: var(--success, #34C759);
  color: white;
  border-color: transparent;
}

.ui-btn.qty-btn,
.ui-btn.icon-btn.qty-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: var(--font-size-base, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  color: var(--text-primary, var(--text, #111));
  border: none;
  outline: none;
  border-radius: var(--radius-sm, 8px);
  box-sizing: border-box;
  margin: 0;
  transition: all var(--transition-fast, 0.15s ease);
  cursor: pointer;
}

.qty-btn:hover,
.ui-btn.qty-btn:hover,
.ui-btn.icon-btn.qty-btn:hover {
  background: var(--bg-secondary, var(--fill, #F2F2F7));
}

.qty-btn:active,
.ui-btn.qty-btn:active,
.ui-btn.icon-btn.qty-btn:active {
  transform: scale(0.95);
}

/* Убрали стили для кнопок + и - */

/* ===== PRODUCT ITEMS ===== */
.product-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: var(--space-sm, var(--space, 16px));
  align-items: center;
  padding: var(--space-md, var(--space, 16px));
  border: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  border-radius: var(--radius-md, var(--radius, 12px));
  margin-bottom: var(--space-sm, var(--space, 16px));
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  transition: all var(--transition-normal, 0.3s ease);

  /* Защищаем от изменения layout на маленьких экранах */
  min-width: 300px;
  /* Минимальная ширина строки (сократили на 40%) */
}

/* Контейнер для продуктов - поддерживает минимальную ширину */
#products-list {
  min-width: 300px;
  /* Минимальная ширина контейнера (сократили на 40%) */
}

.product-item:hover {
  border-color: var(--border-focus, var(--tint, #0A84FF));
  box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Убрали стили для неактивных товаров */

.product-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs, 4px);
}

.product-name {
  font-weight: 500;
  font-size: var(--font-size-sm, 14px);
  color: var(--text-primary, var(--text, #111));
}

.product-price {
  font-weight: 500;
  color: var(--primary, var(--tint, #0A84FF));
  text-align: right;
}

.unit-label {
  font-size: var(--font-size-xs, 12px);
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
  text-align: center;
  min-width: 30px;
  margin: 0;
  padding: 0;
}

.skip-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: var(--font-size-base, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  color: var(--text-primary, var(--text, #111));
  border: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  border-radius: var(--radius-sm, 8px);
  box-sizing: border-box;
  margin: 0;
  transition: all var(--transition-fast, 0.15s ease);
  cursor: pointer;
}

.skip-btn .skip-icon {
  color: currentColor;
}

.skip-btn:hover .skip-icon,
.skip-btn.skipped .skip-icon {
  color: #fff;
}

.skip-btn:hover {
  background: var(--primary, var(--tint, #0A84FF));
  color: white;
  border-color: var(--primary, var(--tint, #0A84FF));
  transform: scale(1.1);
}

.skip-btn.skipped {
  background: var(--success, #34C759);
  color: white;
  border-color: transparent;
}

.skip-btn.skipped.category-skipped {
  background: var(--text-secondary, var(--text-sec, #6B6B6B));
  opacity: 0.7;
}

.skip-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-secondary, var(--fill, #F2F2F7));
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
}

/* ===== CATEGORY HEADERS ===== */
.category-header {
  background: var(--primary, var(--tint, #0A84FF));
  color: white;
  padding: var(--space-md, var(--space, 16px)) var(--space-xl, var(--space, 16px));
  margin: var(--space-sm, var(--space, 16px)) 0;
  border-radius: var(--radius-md, var(--radius, 12px));
  font-weight: 600;
  font-size: var(--font-size-base, 16px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.category-header:first-child {
  margin-top: 0;
}

.category-header.category-skipped {
  background: var(--gray-200, #E5E5EA);
  color: var(--gray-600, #8E8E93);
}

.dark-theme .category-header.category-skipped, 
html.dark-theme .category-header.category-skipped {
  background: var(--gray-800, #48484A);
  color: var(--gray-500, #AEAEB2);
}

.category-header.category-skipped .skip-category-btn {
  background: var(--primary, var(--tint, #0A84FF));
  color: white;
  border-color: var(--primary, var(--tint, #0A84FF));
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(10, 132, 255, 0.2);
}

.category-header.category-skipped .skip-category-btn:hover {
  background: var(--primary-dark, #0056CC);
  border-color: var(--primary-dark, #0056CC);
}

.skip-category-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: var(--space-xs, 4px) var(--space-md, var(--space, 16px));
  font-size: var(--font-size-xs, 12px);
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
}

.skip-category-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.category-name {
  font-weight: 600;
}

/* ===== PROGRESS BARS ===== */
.progress-bar {
  background: var(--sep, #E5E5EA);
  border: 1px solid var(--sep, #E5E5EA);
  border-radius: var(--radius-xs, 4px);
  height: 8px;
  margin: var(--space-md, 16px) 0;
  overflow: hidden;
  padding: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== APPEAR ANIMATIONS (GLOBAL, LIGHTWEIGHT) ===== */
@keyframes br-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Базовые элементы, которые часто появляются динамически */
.recent-order-card,
.completed-order-card,
.supplier-btn,
.supplier-section,
.order-summary,
.shopping-list,
.product-item,
.category-header,
.modal-content {
  animation: br-fade-in-up 660ms cubic-bezier(.2, .6, .2, 1) both;
  will-change: opacity, transform;
}

/* Лёгкая ступенчатость для карточек в сетке */
.recent-orders-grid>.recent-order-card:nth-child(1) {
  animation-delay: 60ms;
}

.recent-orders-grid>.recent-order-card:nth-child(2) {
  animation-delay: 120ms;
}

.recent-orders-grid>.recent-order-card:nth-child(3) {
  animation-delay: 180ms;
}

.recent-orders-grid>.recent-order-card:nth-child(4) {
  animation-delay: 240ms;
}

/* Ступенчатое появление плиток поставщиков */
.suppliers-grid>.supplier-btn:nth-child(1) {
  animation-delay: 60ms;
}

.suppliers-grid>.supplier-btn:nth-child(2) {
  animation-delay: 120ms;
}

.suppliers-grid>.supplier-btn:nth-child(3) {
  animation-delay: 180ms;
}

.suppliers-grid>.supplier-btn:nth-child(4) {
  animation-delay: 240ms;
}

.suppliers-grid>.supplier-btn:nth-child(5) {
  animation-delay: 300ms;
}

.suppliers-grid>.supplier-btn:nth-child(6) {
  animation-delay: 360ms;
}

.suppliers-grid>.supplier-btn:nth-child(7) {
  animation-delay: 420ms;
}

.suppliers-grid>.supplier-btn:nth-child(8) {
  animation-delay: 480ms;
}

.suppliers-grid>.supplier-btn:nth-child(9) {
  animation-delay: 540ms;
}

.suppliers-grid>.supplier-btn:nth-child(10) {
  animation-delay: 600ms;
}

.suppliers-grid>.supplier-btn:nth-child(11) {
  animation-delay: 660ms;
}

.suppliers-grid>.supplier-btn:nth-child(12) {
  animation-delay: 720ms;
}

/* Плавное появление элементов форм (заметно даже без рамок в PWA) */
label,
.form-input,
input,
select,
textarea,
.btn,
.search-bar,
.table-container {
  animation: br-fade-in-up 660ms cubic-bezier(.2, .6, .2, 1) both;
}

/* Ступенчатость для сеток форм (admin и др.) */
.grid-cols-1>*:nth-child(1) {
  animation-delay: 60ms;
}

.grid-cols-1>*:nth-child(2) {
  animation-delay: 120ms;
}

.grid-cols-1>*:nth-child(3) {
  animation-delay: 180ms;
}

.grid-cols-1>*:nth-child(4) {
  animation-delay: 240ms;
}

.grid-cols-2>*:nth-child(1) {
  animation-delay: 60ms;
}

.grid-cols-2>*:nth-child(2) {
  animation-delay: 120ms;
}

.grid-cols-2>*:nth-child(3) {
  animation-delay: 180ms;
}

.grid-cols-2>*:nth-child(4) {
  animation-delay: 240ms;
}

.grid-cols-2>*:nth-child(5) {
  animation-delay: 300ms;
}

.grid-cols-2>*:nth-child(6) {
  animation-delay: 360ms;
}

.grid-cols-3>*:nth-child(1) {
  animation-delay: 60ms;
}

.grid-cols-3>*:nth-child(2) {
  animation-delay: 120ms;
}

.grid-cols-3>*:nth-child(3) {
  animation-delay: 180ms;
}

.grid-cols-3>*:nth-child(4) {
  animation-delay: 240ms;
}

.grid-cols-3>*:nth-child(5) {
  animation-delay: 300ms;
}

.grid-cols-3>*:nth-child(6) {
  animation-delay: 360ms;
}

.grid-cols-3>*:nth-child(7) {
  animation-delay: 420ms;
}

.grid-cols-3>*:nth-child(8) {
  animation-delay: 480ms;
}

.grid-cols-3>*:nth-child(9) {
  animation-delay: 540ms;
}

@media (prefers-reduced-motion: reduce) {

  label,
  .form-input,
  input,
  select,
  textarea,
  .btn,
  .search-bar,
  .table-container {
    animation: none !important;
  }
}

/* Уважение системной настройки «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {

  .recent-order-card,
  .completed-order-card,
  .supplier-btn,
  .supplier-section,
  .order-summary,
  .shopping-list,
  .product-item,
  .category-header,
  .modal-content {
    animation: none !important;
  }
}

.progress-fill {
  background: linear-gradient(90deg, #1a5f1a 0%, var(--success, #34C759) 100%);
  height: 8px;
  width: 0%;
  transition: width var(--transition-normal, 0.3s ease);
  border-radius: var(--radius-xs, 4px);
}

/* ===== ORDER SUMMARY ===== */
.order-summary {
  position: sticky;
  top: 60px;
  z-index: 999;
  margin-bottom: var(--space-xl, var(--space, 16px));
  padding: var(--space-xl, var(--space, 16px));
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  border: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  border-radius: var(--radius-lg, var(--radius-lg, 16px));
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
}

.order-summary h2 {
  margin: 0;
  font-size: var(--font-size-lg, 18px);
  font-weight: 600;
  color: var(--text-primary, var(--text, #111));
}

.order-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md, var(--space, 16px));
}

.total-amount {
  font-size: var(--font-size-2xl, 24px);
  font-weight: 600;
  color: var(--primary, var(--tint, #0A84FF));
  text-align: right;
  margin: 0;
}

.submit-btn {
  width: 100%;
  padding: var(--space-lg, var(--space, 16px));
  font-size: var(--font-size-lg, 18px);
  font-weight: 500;
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== SECTION COMPONENTS ===== */
.suppliers-section,
.products-section {
  margin-bottom: var(--space-xl, var(--space, 16px));
  padding: var(--space-xl, var(--space, 16px));
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  border: 1px solid var(--border-primary, var(--sep, #E5E5EA));
  border-radius: var(--radius-lg, var(--radius-lg, 16px));
}

/* Мобильные отступы для секций */
@media (max-width: 768px) {

  .suppliers-section,
  .products-section {
    /* Убираем border-radius: 0; чтобы сохранить скругления на мобильных */
    padding: var(--space-sm, 8px);
    /* Сокращаем с 16px до 8px */
    /* Сохраняем фон и рамки, как у закупщика, для визуального единства */
  }

  /* Сокращаем отступы заголовков секций */
  .suppliers-section h2,
  .products-section h2 {
    margin: 0 0 var(--space-xs, 4px) 0;
    /* Сокращаем с 16px до 4px */
  }

  /* Сокращаем отступы описаний секций */
  .section-description {
    margin: 0 0 var(--space-sm, 8px) 0;
    /* Сокращаем с 16px до 8px */
  }

  /* Сокращаем отступы заголовков с кнопками */
  .section-header {
    margin-bottom: var(--space-sm, 8px);
    /* Сокращаем с 16px до 8px */
  }

  /* Сокращаем отступы карточек заказов */
  .recent-order-card,
  .completed-order-card {
    padding: var(--space-sm, 8px);
    /* Сокращаем с 16px до 8px */
    display: flex;
    flex-direction: column;
    /* Сохраняем фон и рамки карточек на мобильных, как у закупщика */
  }

  /* Сокращаем отступы между заказами */
  .recent-orders-grid,
  .completed-orders-grid {
    gap: var(--space-sm, 8px);
    /* Сокращаем с 16px до 8px */
  }

  /* Убираем рамки у товаров в заказе для максимальной чистоты */
  .product-item {
    border: none;
    /* Убираем рамки товаров */
    background: transparent;
    /* Убираем фон товаров */
    border-radius: 0;
    /* Убираем скругления */
    box-shadow: none;
    /* Убираем тени */
    margin-bottom: var(--space-xs, 4px);
    /* Уменьшаем отступы между товарами */
  }

  /* Убираем рамки у кнопок пропуска на мобильных (только для неактивных) */
  .skip-btn:not(.skipped) {
    border: none;
    /* Убираем рамки кнопок */
    background: transparent;
    /* Убираем фон кнопок */
    box-shadow: none;
    /* Убираем тени */
  }
}

.suppliers-section h2,
.products-section h2 {
  margin: 0 0 var(--space-sm, var(--space, 16px)) 0;
  font-size: var(--font-size-lg, 18px);
  font-weight: 600;
  color: var(--text-primary, var(--text, #111));
}

.section-description {
  margin: 0 0 var(--space-xl, var(--space, 16px)) 0;
  font-size: var(--font-size-sm, 14px);
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
  line-height: 1.4;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl, var(--space, 16px));
}

.section-header h2 {
  margin: 0;
}

/* Контейнер действий в заголовке секции */
.section-actions {
  display: inline-flex;
  gap: var(--space-sm, 8px);
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .section-header {
    align-items: flex-start;
    gap: var(--space-sm, 8px);
  }

  .section-actions {
    width: 100%;
    margin-top: var(--space-sm, 8px);
  }

  .section-actions .btn {
    flex: 1 1 160px;
  }
}

/* ===== SEARCH BAR (унифицировано) ===== */
.search-bar {
  margin: var(--space-md, 12px) 0 var(--space-lg, 16px) 0;
}

.search-bar .form-input {
  width: 100%;
  max-width: 400px;
}


/* ===== AUTH MODAL ===== */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.auth-modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.auth-modal-logo {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-logo img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  transition: filter 0.3s ease;
  display: block;
  margin: 0 auto;
}

.auth-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--text);
}

.auth-modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 25px 0;
}

.auth-pin-input {
  width: 100%;
  padding: 15px;
  font-size: 1.5rem;
  text-align: center;
  border: 2px solid var(--border-primary);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0.5em;
  font-family: monospace;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
}

.auth-pin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-pin-input.error {
  border-color: var(--danger);
  animation: shake 0.5s ease-in-out;
}

.auth-modal-button {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-modal-button:hover {
  background: var(--accent-hover, #0066CC);
}

.auth-modal-button:disabled {
  background: var(--fill);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.auth-error-message {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 15px;
  display: none;
}

/* ===== USER INFO DISPLAY ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.user-info-name {
  font-weight: 600;
  color: var(--text);
}

.user-info-logout {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8rem;
}

.user-info-logout:hover {
  text-decoration: underline;
}

/* ===== MODAL COMPONENTS ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

/* ===== Unified Order Cards (exactly as in buyer.html) ===== */
/* This block intentionally mirrors buyer page styles to ensure 100% identical UI across roles */
.recent-orders-section {
  margin-bottom: 30px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--sep);
  border-radius: 12px;
  width: 100%;
}

.recent-orders-section h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.section-description {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.4;
}

.recent-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  /* как у buyer */
  gap: 16px;
  justify-items: stretch;
  width: 100%;
}

.recent-order-card {
  padding: 16px;
  border: 1px solid var(--sep);
  border-radius: 8px;
  background: var(--bg);
  transition: all 0.2s ease;
  width: 100%;
  /* растягиваем карточку внутри колонки */
  display: flex;
  flex-direction: column;
}

.recent-order-card:hover {
  border-color: var(--tint);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recent-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

.recent-order-supplier {
  font-weight: 600;
  color: var(--text);
}

.recent-order-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.recent-order-status.submitted {
  background: var(--tint);
  color: #fff;
}

.recent-order-status.completed {
  background: #34C759;
  color: #fff;
}

.recent-order-status.in_progress {
  background: #FF9500;
  color: #fff;
}

.recent-order-status.creating {
  background: #8E8E93;
  color: #fff;
}

.recent-order-date {
  font-size: 14px;
  color: var(--text-sec);
  margin-bottom: 8px;
}

.recent-order-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 14px;
}

.recent-order-detail {
  display: flex;
  justify-content: space-between;
}

.recent-order-detail-label {
  color: var(--text-sec);
}

.recent-order-detail-value {
  font-weight: 500;
  color: var(--text);
}

.orders-by-dept {
  margin: 12px 0;
}

.dept-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.dept-row:last-child {
  border-bottom: none;
}

.dept-name {
  font-weight: 500;
  color: var(--text);
  min-width: 80px;
}

.dept-items {
  color: var(--text-sec);
  text-align: center;
  flex: 1;
}

.dept-amount {
  font-weight: 500;
  color: var(--tint);
  min-width: 80px;
  text-align: right;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-top: 12px;
  font-weight: 600;
  font-size: 16px;
}

/* ===== ORDER VIEW (modal) unified table header/rows ===== */
.order-items-section h4 {
  margin: 12px 0;
  font-weight: 600;
  color: var(--text);
}

.order-item-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 2px solid var(--sep);
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 600;
}

.order-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--sep);
}

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

.total-label {
  color: var(--text);
  min-width: 80px;
}

.total-items {
  color: var(--text);
  flex: 1;
  text-align: center;
}

.total-amount {
  color: var(--tint);
  min-width: 80px;
  text-align: right;
}

.recent-order-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

/* DEPRECATED: Use .btn .btn-sm instead */
/* Legacy button styles - kept for backward compatibility */
.recent-order-btn {
  padding: 6px 12px;
  border: 1px solid var(--sep);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
  color: var(--text);
}

.recent-order-btn:hover {
  border-color: var(--tint);
  background: var(--tint);
  color: #fff;
}

.recent-order-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  border-color: var(--sep);
  background: var(--bg-card);
  color: var(--text-sec);
}

.copy-order-btn {
  background: var(--tint);
  color: #fff;
  border-color: var(--tint);
}

.copy-order-btn:hover {
  background: var(--tint);
  color: #fff;
  opacity: .9;
}

.completed-orders-section {
  margin-bottom: 30px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--sep);
  border-radius: 12px;
  opacity: .8;
}

.completed-orders-section h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.completed-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  justify-items: stretch;
  width: 100%;
}

/* Enforce identical column counts across roles */
@media (min-width: 601px) and (max-width: 1024px) {

  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

@media (min-width: 1025px) {

  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.completed-order-card {
  padding: 16px;
  border: 1px solid var(--sep);
  border-radius: 8px;
  background: var(--bg);
  transition: all 0.2s ease;
  opacity: .9;
  display: flex;
  flex-direction: column;
}

.completed-order-card:hover {
  border-color: var(--sep);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  opacity: 1;
}

.modal-content {
  background: var(--bg, #FFFFFF);
  /* как у buyer */
  border-radius: var(--radius-lg, 16px);
  padding: var(--space-xl, 16px);
  max-width: 600px;
  /* как у buyer */
  width: 90%;
  max-height: 80vh;
  /* как у buyer */
  overflow-y: auto;
  box-shadow: var(--shadow-xl, 0 20px 25px rgba(0, 0, 0, 0.15));
  border: 1px solid var(--sep, #E5E5EA);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  /* как у buyer */
  border-bottom: 1px solid var(--sep, #E5E5EA);
}

.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-lg, 18px);
  font-weight: 600;
  color: var(--text-primary, var(--text, #111));
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: var(--font-size-xl, 20px);
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
  cursor: pointer;
  padding: var(--space-xs, 4px);
  border-radius: var(--radius-sm, 8px);
  transition: all var(--transition-fast, 0.15s ease);
}

.modal-close-btn:hover {
  background: var(--bg-tertiary, var(--fill, #F2F2F7));
  color: var(--text-primary, var(--text, #111));
}

.modal-body {
  color: var(--text-primary, var(--text, #111));
}

/* ===== NOTIFICATION MESSAGES ===== */
.notification-message {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success, #34C759);
  color: white;
  padding: var(--space-md, var(--space, 16px)) var(--space-lg, var(--space, 16px));
  border-radius: var(--radius-md, var(--radius, 12px));
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
  z-index: 1000;
  font-weight: 500;
  cursor: pointer;
  max-width: 90%;
  text-align: center;
}

.notification-message.error {
  background: var(--danger, #FF3B30);
}

.notification-message.warning {
  background: var(--warning, #FF9500);
}

.notification-message.info {
  background: var(--info, #5AC8FA);
}

/* ===== ERROR MESSAGES ===== */
.error-message {
  color: var(--danger, #FF3B30);
  padding: var(--space-lg, var(--space, 16px));
  text-align: center;
  font-weight: 500;
}

/* ===== PAGE SPECIFIC PADDING ===== */
/* Общие стили для всех страниц BackRoom */
.chef-page,
.bartender-page,
.buyer-page,
.analytics-page,
.admin-page {
  padding: 2px;
  /* Базовый отступ для мобильных */
  min-width: 280px;
  /* Базовая минимальная ширина для мобильных */
}

/* ===== ORDER ITEM DETAILS ===== */
.order-item-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm, var(--space, 16px)) 0;
  border-bottom: 1px solid var(--border-secondary, var(--sep, #E5E5EA));
}

.order-item-detail:last-child {
  border-bottom: none;
}

.order-item-name {
  font-weight: 500;
  color: var(--text-primary, var(--text, #111));
}

.order-item-quantity {
  font-weight: 600;
  color: var(--primary, var(--tint, #0A84FF));
}

.order-item-price {
  font-weight: 500;
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
}

/* ===== ORDER STATUS BADGES ===== */
.order-status {
  display: inline-block;
  padding: var(--space-xs, 4px) var(--space-sm, var(--space, 16px));
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-xs, 12px);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-status.submitted {
  background: var(--info, #5AC8FA);
  color: white;
}

.order-status.in_progress {
  background: var(--warning, #FF9500);
  color: white;
}

.order-status.completed {
  background: var(--success, #34C759);
  color: white;
}

/* ===== DEPARTMENT LABELS ===== */
.department-label {
  display: inline-block;
  padding: var(--space-xs, 4px) var(--space-sm, var(--space, 16px));
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-xs, 12px);
  font-weight: 500;
  background: var(--bg-tertiary, var(--fill, #F2F2F7));
  color: var(--text-secondary, var(--text-sec, #6B6B6B));
}

.department-label.kitchen {
  background: var(--warning, #FF9500);
  color: white;
}

.department-label.bar {
  background: var(--info, #5AC8FA);
  color: white;
}

.department-label.both {
  background: var(--primary, var(--tint, #0A84FF));
  color: white;
}

/* Убрали дублирующееся правило .unit-label */

/* ===== QUANTITY INPUT OPTIMIZATION ===== */
.qty-input {
  width: 45px;
  height: 36px;
  text-align: center;
  box-sizing: border-box;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font-size: var(--font-size-sm, 14px);
  padding: 0;
  margin: 0;
  background: var(--bg-card, var(--bg-card, #FFFFFF));
  color: var(--text-primary, var(--text, #111));
  transition: all var(--transition-fast, 0.15s ease);
}

.qty-input:focus {
  outline: none;
  border-color: var(--border-primary, var(--sep, #E5E5EA));
  box-shadow: none;
}

.qty-input.has-quantity {
  background: var(--success, #34C759);
  color: white;
  border-color: transparent;
}

.qty-input[style*="width: 36px"] {
  width: 36px !important;
}

/* ===== COMPACT QUANTITY INPUT ===== */
.qty-input-compact {
  width: 36px !important;
}

/* ===== SKIP BUTTON STATES ===== */
.skip-btn.skipped {
  background: var(--success, #34C759) !important;
  color: white !important;
  border-color: transparent !important;
}

.skip-btn.skipped.category-skipped {
  background: var(--text-secondary, var(--text-sec, #6B6B6B)) !important;
  opacity: 0.7;
}

/* (duplicate removed; using the unified .progress-fill above) */

/* ===== SUBMIT BUTTON SUCCESS STATE ===== */
.submit-btn.success {
  background: var(--success, #34C759) !important;
  border-color: var(--success, #34C759) !important;
}

.total-amount.success {
  color: var(--success, #34C759) !important;
  font-weight: bold !important;
}

/* ===== GLOBAL UTILITIES ===== */
.hidden {
  display: none !important;
}

/* ===== RESTART BUTTON VISIBILITY ===== */
.restart-btn.hidden {
  display: none !important;
}

.restart-btn.visible {
  display: inline-block !important;
}

/* ===== MODAL VISIBILITY ===== */
.modal-overlay.hidden {
  display: none !important;
}

.modal-overlay.visible {
  display: flex !important;
}


/* Убрали медиа-запросы, которые ломали структуру */

/* ===== iOS SPECIFIC FIXES ===== */
@supports (-webkit-touch-callout: none) {
  .qty-input {
    min-height: 44px;
    font-size: 16px;
  }

  .qty-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .supplier-btn {
    min-height: 44px;
  }

  .modal-content {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== АДАПТИВНЫЕ ПРАВИЛА (МОБИЛЬНЫЙ-FIRST) ===== */
/* Начинаем с самого маленького экрана и растём до самого большого */

/* Очень маленькие смартфоны (до 360px) */
@media (max-width: 360px) {

  /* Кнопки поставщиков - в одну колонку с минимальными отступами */
  .suppliers-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm, 8px);
  }

  /* Таблица продуктов - компактная версия */
  .product-item {
    min-width: 260px;
    padding: var(--space-sm, 8px);
    gap: var(--space-xs, 4px);
  }

  /* Минимальные размеры для touch-интерфейса */
  .qty-input {
    width: 36px;
    height: 36px;
    /* Apple рекомендует минимум 44px, но у нас ограничения */
    font-size: var(--font-size-xs, 12px);
  }

  .qty-btn {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm, 14px);
  }

  .skip-btn {
    width: 32px;
    height: 32px;
  }

  /* Минимальные отступы страницы для экономии места */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 8px;
    /* Базовый комфортный отступ на малых экранах */
    min-width: 280px;
  }

  /* Заказы - в одну колонку */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: 1fr;
  }

  /* Модальные окна - почти на всю ширину */
  .modal-content {
    width: 98%;
    margin: var(--space-xs, 4px);
  }

  /* Сверхкомпактные отступы для очень маленьких экранов */
  .suppliers-section,
  .products-section,
  .recent-orders-section,
  .completed-orders-section {
    padding: var(--space-sm, 8px);
    /* Компактно, но с сохранением структуры */
  }

  .suppliers-section h2,
  .products-section h2,
  .recent-orders-section h2,
  .completed-orders-section h2 {
    margin: 0 0 var(--space-xs, 4px) 0;
  }

  .section-description {
    margin: 0 0 var(--space-xs, 4px) 0;
  }

  .section-header {
    margin-bottom: var(--space-xs, 4px);
  }

  .recent-order-card,
  .completed-order-card {
    padding: var(--space-sm, 8px);
  }

  .recent-orders-grid,
  .completed-orders-grid {
    gap: var(--space-xs, 4px);
  }

  /* Убираем рамки у товаров для максимальной чистоты */
  .product-item {
    border: none;
    /* Убираем рамки товаров */
    background: transparent;
    /* Убираем фон товаров */
    border-radius: 0;
    /* Убираем скругления */
    box-shadow: none;
    /* Убираем тени */
    margin-bottom: var(--space-xs, 4px);
    /* Минимальные отступы */
  }

  /* Убираем рамки у кнопок пропуска (только для неактивных) */
  .skip-btn:not(.skipped) {
    border: none;
    /* Убираем рамки кнопок */
    background: transparent;
    /* Убираем фон кнопок */
    box-shadow: none;
    /* Убираем тени */
  }
}

/* Маленькие смартфоны (361px - 480px) */
@media (min-width: 361px) and (max-width: 480px) {

  /* Кнопки поставщиков - в одну колонку */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - сохраняем структуру, уменьшаем отступы */
  .product-item {
    min-width: 280px;
    padding: var(--space-sm, var(--space, 16px));
    gap: var(--space-xs, 4px);
  }

  /* Оптимальные размеры для touch-интерфейса */
  .qty-input {
    width: 40px;
    height: 40px;
    /* Увеличиваем для лучшего touch */
    font-size: var(--font-size-sm, 14px);
  }

  .qty-btn {
    width: 36px;
    height: 36px;
    font-size: var(--font-size-sm, 14px);
  }

  .skip-btn {
    width: 36px;
    height: 36px;
  }

  /* Минимальные отступы страницы */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 8px;
    /* Базовый комфортный отступ на маленьких смартфонах */
  }

  /* Заказы - в одну колонку */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: 1fr;
  }

  /* Модальные окна - на всю ширину */
  .modal-content {
    width: 95%;
    margin: var(--space-sm, var(--space, 16px));
  }

  /* Компактные отступы для маленьких смартфонов */
  .suppliers-section,
  .products-section,
  .recent-orders-section,
  .completed-orders-section {
    padding: var(--space-sm, 8px);
    /* Сокращаем до 8px */
    border: none;
    /* Убираем рамки */
    background: transparent;
    /* Убираем фон */
  }

  .suppliers-section h2,
  .products-section h2,
  .recent-orders-section h2,
  .completed-orders-section h2 {
    margin: 0 0 var(--space-xs, 4px) 0;
  }

  .section-description {
    margin: 0 0 var(--space-sm, 8px) 0;
  }

  .section-header {
    margin-bottom: var(--space-sm, 8px);
  }

  .recent-order-card,
  .completed-order-card {
    padding: var(--space-sm, 8px);
    display: flex;
    flex-direction: column;
  }

  .recent-orders-grid,
  .completed-orders-grid {
    gap: var(--space-sm, 8px);
  }

  /* Убираем рамки у товаров для максимальной чистоты */
  .product-item {
    border: none;
    /* Убираем рамки товаров */
    background: transparent;
    /* Убираем фон товаров */
    border-radius: 0;
    /* Убираем скругления */
    box-shadow: none;
    /* Убираем тени */
    margin-bottom: var(--space-sm, 8px);
    /* Компактные отступы */
  }

  /* Убираем рамки у кнопок пропуска (только для неактивных) */
  .skip-btn:not(.skipped) {
    border: none;
    /* Убираем рамки кнопок */
    background: transparent;
    /* Убираем фон кнопок */
    box-shadow: none;
    /* Убираем тени */
  }
}

/* Средние смартфоны (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {

  /* Кнопки поставщиков - в две колонки */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - средняя ширина */
  .product-item {
    min-width: 400px;
    padding: var(--space-md, var(--space, 16px));
  }

  /* Компактные отступы страницы */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 2px;
    /* Всего 2px от края экрана - максимум экономии! */
  }

  /* Заказы - в две колонки */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  /* Умеренные отступы для средних смартфонов */
  .suppliers-section,
  .products-section,
  .recent-orders-section,
  .completed-orders-section {
    padding: var(--space-md, 12px);
    /* Сокращаем до 12px */
    border: none;
    /* Убираем рамки */
    background: transparent;
    /* Убираем фон */
  }

  .suppliers-section h2,
  .products-section h2,
  .recent-orders-section h2,
  .completed-orders-section h2 {
    margin: 0 0 var(--space-sm, 8px) 0;
  }

  .section-description {
    margin: 0 0 var(--space-md, 12px) 0;
  }

  .section-header {
    margin-bottom: var(--space-md, 12px);
  }

  .recent-order-card,
  .completed-order-card {
    padding: var(--space-md, 12px);
    display: flex;
    flex-direction: column;
  }

  .recent-orders-grid,
  .completed-orders-grid {
    gap: var(--space-md, 12px);
  }

  /* Убираем рамки у товаров для максимальной чистоты */
  .product-item {
    border: none;
    /* Убираем рамки товаров */
    background: transparent;
    /* Убираем фон товаров */
    border-radius: 0;
    /* Убираем скругления */
    box-shadow: none;
    /* Убираем тени */
    margin-bottom: var(--space-md, 12px);
    /* Умеренные отступы */
  }

  /* Убираем рамки у кнопок пропуска */
  .skip-btn {
    border: none;
    /* Убираем рамки кнопок */
    background: transparent;
    /* Убираем фон кнопок */
    box-shadow: none;
    /* Убираем тени */
  }
}

/* Планшеты и большие смартфоны (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {

  /* Кнопки поставщиков - в три колонки */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - большая ширина */
  .product-item {
    min-width: 450px;
    padding: var(--space-md, var(--space, 16px));
  }

  /* Умеренные отступы страницы */
  .chef-page,
  .bartender-page {
    padding: 8px;
  }

  /* Заказы - в две колонки */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* Малые десктопы (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Кнопки поставщиков - в три колонки */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - большая ширина */
  .product-item {
    min-width: 500px;
    padding: var(--space-lg, var(--space, 16px));
  }

  /* Заказы - в три колонки */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Увеличиваем отступы страницы */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 16px;
    /* Увеличиваем с 2px до 16px */
    min-width: 520px;
  }
}

/* Большие экраны (от 1025px) */
@media (min-width: 1025px) {

  /* Кнопки поставщиков - в четыре колонки */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - максимальная ширина */
  .product-item {
    min-width: 600px;
    padding: var(--space-xl, var(--space, 20px));
  }

  /* Заказы - в четыре колонки */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  /* Максимальные отступы страницы */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 32px;
    min-width: 640px;
  }
}

/* Очень большие экраны (от 1440px) */
@media (min-width: 1440px) {

  /* Кнопки поставщиков - в пять колонок для очень широких экранов */
  .suppliers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  /* Таблица продуктов - очень большая ширина */
  .product-item {
    min-width: 700px;
    padding: var(--space-2xl, var(--space, 24px));
  }

  /* Заказы - в пять колонок */
  .recent-orders-grid,
  .completed-orders-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  /* Максимальные отступы для очень больших экранов */
  .chef-page,
  .bartender-page,
  .buyer-page,
  .analytics-page,
  .admin-page {
    padding: 40px;
    min-width: 720px;
  }
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ МОБИЛЬНЫЕ ОПТИМИЗАЦИИ ===== */

/* Touch-оптимизация для всех мобильных устройств */
@media (max-width: 768px) {

  /* Увеличиваем touch-области */
  .qty-btn,
  .skip-btn,
  .supplier-btn {
    min-height: 44px;
    /* Apple рекомендует минимум 44px */
    min-width: 44px;
  }

  /* Улучшаем читаемость на маленьких экранах */
  .product-name {
    font-size: var(--font-size-base, 16px);
    /* Увеличиваем с 14px */
    line-height: 1.4;
  }

  .product-price {
    font-size: var(--font-size-lg, 18px);
    /* Увеличиваем с 14px */
  }

  /* Оптимизируем заголовки секций */
  .section-header h2 {
    font-size: var(--font-size-xl, 20px);
    margin-bottom: var(--space-md, var(--space, 16px));
  }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {

  /* Уменьшаем отступы для экономии вертикального пространства */
  .chef-page,
  .bartender-page {
    padding: 16px;
  }

  .product-item {
    padding: var(--space-sm, var(--space, 16px));
  }

  /* Кнопки поставщиков - в две колонки для ландшафтной ориентации */
  .suppliers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Analytics Mobile Fix */
@media (max-width: 600px) {
  .analytics-page.container {
    padding-left: 6px !important;
    padding-right: 6px !important;
    width: 100%;
    max-width: 100%;
  }

  /* Ensure inner sections don't have extra margins that compound this */
  .analytics-page .recent-orders-section,
  .analytics-page .suppliers-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Fix Calendar Icon in Dark Mode */
@media (prefers-color-scheme: dark) {
  input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
  }
}

/* Ensure it works when manually toggled via class */
.dark-theme input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* ===== НОВЫЕ ЧИСТЫЕ СТИЛИ БУРГЕРА ===== */
/* Современный дизайн без конфликтов */

.burger-menu {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--sep);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  position: fixed;
}

.burger-menu .line {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.burger-menu .line:nth-child(1) {
  top: 12px;
}

.burger-menu .line:nth-child(2) {
  top: 19px;
}

.burger-menu .line:nth-child(3) {
  top: 26px;
}

.burger-menu.active .line:nth-child(1) {
  top: 19px;
  transform: translateX(-50%) rotate(45deg);
}

.burger-menu.active .line:nth-child(2) {
  opacity: 0;
}

.burger-menu.active .line:nth-child(3) {
  top: 19px;
  transform: translateX(-50%) rotate(-45deg);
}

.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 320px;
  height: 100vh;
  background-color: var(--bg-card, #ffffff);
  /* гарантируем непрозрачный фон */
  border-left: 1px solid var(--sep);
  box-shadow: var(--shadow-xl);
  z-index: 999;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.mobile-nav.active {
  right: 0;
  pointer-events: auto;
}

.mobile-nav-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 998; /* Strictly below .mobile-nav (999) but above all page elements */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.mobile-nav-backdrop.active {
  opacity: 1;
  visibility: visible;
}



.mobile-nav-content {
  padding: var(--space-md);
}

.mobile-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0 var(--space-md) 0;
  margin-bottom: var(--space-md);
}

.mobile-header .brand-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

/* Профиль пользователя в бургер-меню */
.user-profile {
  background: var(--fill);
  border: 1px solid var(--sep);
  border-radius: 999px;
  padding: var(--space-md) var(--space-md);
  /* Увеличиваем отступы: 12px вместо 8px */
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  .user-profile {
    background: var(--fill-secondary, var(--fill));
    border-color: var(--sep);
  }
}

.user-profile .user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.user-profile .user-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  padding-left: var(--space-xs);
  /* Дополнительный отступ слева: 4px */
}

.user-profile .logout-btn {
  background: var(--tint);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-profile .logout-btn:hover {
  background: var(--tint);
  opacity: 0.8;
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  .user-profile .logout-btn:hover {
    opacity: 0.9;
  }
}

.segmented-control {
  display: inline-flex;
  background: var(--fill);
  border: 1px solid var(--sep);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.segmented-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
}

.segmented-option.active {
  background: var(--bg-card);
  border-color: var(--tint);
  color: var(--tint);
}

.theme-segment .segmented-option {
  font-size: 14px;
}

.theme-segment .segmented-option svg {
  display: block;
  color: var(--text);
}

.theme-segment .segmented-option.active svg {
  color: var(--tint);
}

/* Force standard border radius for ingredient inputs */
.tech-card-ingredients-admin input,
.tech-card-ingredients-admin .form-input,
.admin-card-ingredients input,
.admin-card-ingredients .form-input {
  border-radius: var(--radius-md) !important;
}

.nav-section {
  margin-bottom: var(--space-md);
}

.nav-section h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--sep);
  padding-bottom: var(--space-xs);
}

.nav-link {
  display: block;
  padding: var(--space-sm);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  margin-bottom: var(--space-xs);
}

.nav-link:hover {
  background: var(--fill);
  color: var(--tint);
  transform: translateX(4px);
}

.lang-btn,
.theme-btn {
  display: block;
  width: 100%;
  padding: var(--space-sm);
  margin-bottom: var(--space-xs);
  background: var(--bg-card);
  border: 1px solid var(--sep);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: var(--font-size-base);
}

.lang-btn:hover,
.theme-btn:hover {
  background: var(--fill);
  border-color: var(--tint);
  transform: translateY(-1px);
}

.lang-btn.active,
.theme-btn.active {
  background: var(--tint);
  color: var(--white);
  border-color: var(--tint);
  box-shadow: var(--shadow-sm);
}

/* Адаптивность */
@media (max-width: 768px) {
  .burger-menu {
    top: 16px;
    right: 16px;
  }

  .mobile-nav {
    width: 280px;
  }
}

/* ===== ПРЕДОТВРАЩЕНИЕ АВТОЗУМА НА iOS ===== */
/* Дополнительная защита от автозума на iOS устройствах */
@supports (-webkit-touch-callout: none) {
  /* iOS устройства */

  /* Улучшение тапа для чекбоксов */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 44px;
    min-height: 44px;
    transform: scale(1.2);
  }

  /* Защита для кнопок */
  .btn {
    min-height: 44px;
    /* Keep buttons touch-friendly */
  }
}

/* Дополнительная защита для всех мобильных устройств */
@media (max-width: 768px) {
  /* Removed forced 16px font size to maintain consistency */
}

/* Очень маленькие экраны - исправляем обрезание текста */
@media (max-width: 480px) {
  /* Removed forced padding/height overrides */
}

/* Исправляем растягивание селектов дней недели в существующих daily checklist */
@media (max-width: 768px) {

  /* Ограничиваем ширину селектов дней недели в checklist-item-editor */
  .checklist-item-editor select.form-input {
    max-width: 120px !important;
    width: auto !important;
    min-width: 80px !important;
  }

  /* Для очень маленьких экранов делаем еще компактнее */
  @media (max-width: 480px) {
    .checklist-item-editor select.form-input {
      max-width: 100px !important;
      min-width: 70px !important;
      /* font-size removed to use global style */
    }
  }
}





/* ===== UNIFIED TABS COMPONENT ===== */
/* Единый компонент вкладок для всех страниц */
.tabs {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--sep);
}

.tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-sec);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 14px;
}

.tab.active {
  background: var(--tint);
  color: white;
}

.tab:hover:not(.active) {
  background: var(--fill);
  color: var(--text);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}


/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .tab {
    flex: 1 1 calc(50% - 2px);
    min-width: 0;
    padding: 6px 12px;
    /* Match input padding */
    min-height: 32px;
    /* Match input height */
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text on mobile too? User didn't specify, but inputs are left aligned. Tabs usually center. */
    text-align: center;
    background: var(--fill);
    color: var(--text-sec);
    border: 1px solid var(--sep);
    border-radius: 12px;
    /* Match input radius */
  }

  .tab.active {
    background: var(--tint);
    color: white;
    border: none;
  }
}

@media (max-width: 480px) {
  .tab {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* ===== LOADING SPINNER ===== */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  /* Darker background for better contrast */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(4px);
  /* Nice blur effect */
}

.spinner-overlay.active {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #34C759;
  /* Green spinner as requested */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-progress-text {
  margin-top: 16px;
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  /* Prevent jumping numbers */
}

.spinner-status-text {
  margin-top: 4px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

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

/* ===== SHARED ORDER DETAILS & STATS ===== */
.order-dept {
  background: var(--tint);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.order-total {
  font-size: 18px;
  font-weight: 600;
  color: var(--tint);
}

.order-items-count {
  font-size: 16px;
  color: var(--text);
  font-weight: 500;
}

/* Purchase Stats */
.purchase-stats {
  margin: 8px 0;
  padding: 8px 0;
  font-size: 14px;
}

.purchase-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.purchase-label {
  color: var(--text-sec);
}

.purchase-percentage {
  font-weight: 600;
  color: var(--success);
}

.purchase-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.purchased-info {
  color: var(--text-sec);
}

.purchased-amount {
  font-weight: 600;
  color: var(--success);
}

.not-purchased-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: var(--fill);
  border-radius: 4px;
  font-size: 13px;
}

.not-purchased-label {
  color: var(--text-sec);
}

.not-purchased-count {
  color: var(--text-sec);
}

.not-purchased-amount {
  font-weight: 600;
  color: var(--danger);
}

.strikethrough {
  text-decoration: line-through;
  color: var(--text-sec);
}

.not-purchased-item {
  opacity: 0.6;
  background: var(--fill);
}

.purchased-qty {
  color: var(--success);
  font-size: 12px;
}

.purchase-status {
  text-align: center;
}

.status-purchased {
  color: var(--success);
  font-weight: 600;
  font-size: 12px;
}

.status-not-purchased {
  color: var(--danger);
  font-weight: 600;
  font-size: 12px;
}

.purchase-stats-section {
  margin: 16px 0;
  padding: 12px;
  background: var(--fill);
  border-radius: 8px;
}

.purchase-stats-section h4 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 16px;
}

.purchase-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
}

.purchase-stats-row.not-purchased {
  color: var(--danger);
  font-weight: 600;
}

.purchase-stats-label {
  color: var(--text-sec);
}

.purchase-stats-value {
  font-weight: 600;
  color: var(--text);
}

/* ===== MODE SELECTION SCREEN ===== */
.start-screen {
  padding: 20px 0;
}

.start-screen-content {
  max-width: 600px;
  margin: 0 auto;
}

.start-screen-content h2,
.start-screen-content p {
  text-align: center;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 2 columns for compact layout */
  gap: 12px;
  /* Smaller gap */
  margin-top: 20px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.mode-button {
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
  background: var(--fill);
  border: 2px solid var(--sep);
  border-radius: 12px;
  /* Slightly rounder */
  padding: 12px;
  /* Reduced padding */
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 100px;
  /* Fixed height for uniformity */
  display: flex;
  flex-direction: column;
  /* Stack icon and text vertically */
  align-items: center;
  /* Center content */
  justify-content: center;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  /* Center text */
  gap: 8px;
}

.mode-button:nth-child(1) {
  animation-delay: 0.05s;
}

.mode-button:nth-child(2) {
  animation-delay: 0.1s;
}

.mode-button:nth-child(3) {
  animation-delay: 0.15s;
}

.mode-button:nth-child(4) {
  animation-delay: 0.2s;
}

.mode-button:nth-child(5) {
  animation-delay: 0.25s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mode-button:hover {
  background: var(--fill-sec);
  border-color: var(--tint);
  transform: translateY(-2px);
}

.mode-icon {
  font-size: 28px;
  /* Smaller icon */
  text-align: center;
  flex-shrink: 0;
  width: auto;
  height: auto;
  display: block;
  margin-right: 0;
  /* Remove right margin since vertical */
  margin-bottom: 4px;
}

.mode-button-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center text */
  text-align: center;
  flex: 1;
  width: 100%;
}

.mode-title {
  font-size: 15px;
  /* Smaller title */
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.2;
}

.mode-subtitle {
  font-size: 11px;
  /* Smaller subtitle */
  color: var(--text-sec);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* Limit to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Styles already updated in previous step, just ensuring cleanup if needed */

/* Today Shift Block */
.today-shift-block {
  margin-top: 12px;
  padding: 16px;
  background: var(--fill);
  /* Match mode-buttons background */
  border-radius: 16px;
  border: 1px solid var(--sep);
  max-width: 500px;
  /* Match mode-buttons width */
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.today-shift-block h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  /* Slightly smaller */
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.shift-departments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Side by side departments */
  gap: 12px;
}

.department-group h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sec);
  /* Removed text-transform: uppercase */
  letter-spacing: 0.5px;
  text-align: left;
}

.staff-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-member {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  padding: 0;
  /* No padding */
  background: none;
  /* No background */
  border: none;
  /* No border */
}

/* Shift Markers (Colored Squares) */
.staff-member::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  background-color: var(--sep);
  /* Default color */
}

.staff-member.shift-morning::before {
  background-color: #4CAF50;
  /* Green */
}

.staff-member.shift-evening::before {
  background-color: #FF9800;
  /* Orange */
}

.staff-member.shift-procurer::before {
  background-color: #9C27B0;
  /* Purple */
}

.staff-member .shift-name {
  display: none;
  /* Hide text label */
}

.loading-text {
  color: var(--text-sec);
  font-size: 13px;
  font-style: italic;
}

@media (max-width: 600px) {
  .section-description {
    display: none;
  }
}

/* Скрываем чекбоксы в переключателях */
.switch input[type="checkbox"] {
  opacity: 0;
  position: absolute;
}
/* ===== MODAL SYSTEM (Legacy tech-card-modal name kept for compatibility) ===== */
.tech-card-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tech-card-modal-content {
  background: var(--bg);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.tech-card-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--sep);
}

.tech-card-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.tech-card-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-sec);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.tech-card-modal-close:hover {
  background: var(--fill);
  color: var(--text);
}

.tech-card-modal-body {
  padding: 24px;
}

/* ===== CHECKLIST COMPONENTS ===== */
.checklist-content {
  padding: var(--space-md);
}

.checklist-section {
  margin-bottom: var(--space-xl);
}

.checklist-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--sep);
  color: var(--text-primary);
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--sep);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.checklist-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
}

.checklist-item.completed {
  background: var(--bg-tertiary);
  opacity: 0.8;
}

.checklist-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.checklist-item-text {
  flex: 1;
  font-size: var(--font-size-base);
  color: var(--text-primary);
}

.checklist-item.completed .checklist-item-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* ===== IOS/MOBILE MODAL SCROLL FIXES ===== */
body.modal-open {
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

@media (max-width: 768px) {
  .modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2000 !important;
    background: var(--bg, #FFFFFF) !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
  }
  
  .modal-content {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
    background: var(--bg, #FFFFFF) !important;
  }

  .modal-header {
    flex-shrink: 0 !important;
    padding: 16px 0 !important;
    border-bottom: 1px solid var(--sep) !important;
    margin-bottom: 16px !important;
  }

  .modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 !important;
  }
}
