/* ==========================================================================
   ИОНИКС: Dark Smart Industrial UI 2026 Theme
   Глобальный визуальный каркас платформы (Web, PWA & Mobile APK)
   Поддерживает мгновенное переключение Dark / Light
   ========================================================================== */

/* Переменные для темной темы */
html.theme-dark, body.theme-dark {
  --bg-main: #070a12;
  --bg-sidebar: #0b0f1a;
  --bg-card: #111726;
  --bg-card-hover: #162035;
  --border-card: #1e293b;
  --border-accent: rgba(56, 189, 248, 0.35);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --bg: #070a12;
  --surface: #0b0f1a;
  --surface2: #111726;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;

  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-light: rgba(56, 189, 248, 0.15);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  
  --danger: #f43f5e;
  --danger-light: rgba(244, 63, 94, 0.15);
  
  --teal: #14b8a6;
  --teal-light: rgba(20, 184, 166, 0.15);
  
  --cyan: #06b6d4;
  --cyan-light: rgba(6, 182, 212, 0.15);

  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ТЁМНАЯ ТЕМА (активна, когда на html или body есть класс .theme-dark) */
html.theme-dark,
html.theme-dark body,
body.theme-dark {
  background: var(--bg-main) !important;
  color: var(--text-main) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

html.theme-dark .app,
body.theme-dark .app {
  background: var(--bg-main) !important;
}

/* Sidebar */
html.theme-dark .sidebar,
body.theme-dark .sidebar {
  background: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border-card) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
}

html.theme-dark .sidebar__brand,
body.theme-dark .sidebar__brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html.theme-dark .brand-title,
body.theme-dark .brand-title {
  color: #fff !important;
  letter-spacing: 0.5px;
}

html.theme-dark .sidebar__user-box,
html.theme-dark .user-card,
html.theme-dark .sidebar__user,
body.theme-dark .sidebar__user-box,
body.theme-dark .user-card,
body.theme-dark .sidebar__user {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 10px !important;
  color: var(--text-main) !important;
}

html.theme-dark .user-name,
html.theme-dark .sidebar__user-name,
body.theme-dark .user-name,
body.theme-dark .sidebar__user-name {
  color: #fff !important;
  font-weight: 600;
}

html.theme-dark .user-role,
html.theme-dark .sidebar__user-role,
body.theme-dark .user-role,
body.theme-dark .sidebar__user-role {
  color: var(--text-muted) !important;
}

/* Навигация сайдбара */
html.theme-dark .nav-item,
html.theme-dark .sidebar__nav a,
html.theme-dark .nav-btn,
html.theme-dark .sidebar__link,
body.theme-dark .nav-item,
body.theme-dark .sidebar__nav a,
body.theme-dark .nav-btn,
body.theme-dark .sidebar__link {
  color: var(--text-muted) !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
}

html.theme-dark .nav-item:hover,
html.theme-dark .sidebar__nav a:hover,
html.theme-dark .nav-btn:hover,
html.theme-dark .sidebar__link:hover,
body.theme-dark .nav-item:hover,
body.theme-dark .sidebar__nav a:hover,
body.theme-dark .nav-btn:hover,
body.theme-dark .sidebar__link:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
}

html.theme-dark .nav-item.active,
html.theme-dark .sidebar__nav a.active,
html.theme-dark .nav-btn.active,
html.theme-dark .sidebar__link.active,
body.theme-dark .nav-item.active,
body.theme-dark .sidebar__nav a.active,
body.theme-dark .nav-btn.active,
body.theme-dark .sidebar__link.active {
  background: rgba(37, 99, 235, 0.18) !important;
  color: #60a5fa !important;
  border-left: 3px solid #3b82f6 !important;
  box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.1) !important;
}

/* Рабочая область */
html.theme-dark .main,
html.theme-dark .workspace,
html.theme-dark .content,
html.theme-dark .app__main,
body.theme-dark .main,
body.theme-dark .workspace,
body.theme-dark .content,
body.theme-dark .app__main {
  background: var(--bg-main) !important;
  color: var(--text-main) !important;
}

/* Карточки и блоки */
html.theme-dark .card,
html.theme-dark .panel,
html.theme-dark .box,
html.theme-dark .section,
html.theme-dark .view-panel,
html.theme-dark .del-table-container,
html.theme-dark .holding-col,
html.theme-dark .dash-exec-kpis,
html.theme-dark .line-card,
html.theme-dark .lines-board,
html.theme-dark .intake-card,
html.theme-dark .kpi-block,
html.theme-dark .calc-card,
html.theme-dark .warehouse-zone,
body.theme-dark .card,
body.theme-dark .panel,
body.theme-dark .box,
body.theme-dark .section,
body.theme-dark .view-panel,
body.theme-dark .del-table-container,
body.theme-dark .holding-col,
body.theme-dark .dash-exec-kpis,
body.theme-dark .line-card,
body.theme-dark .lines-board,
body.theme-dark .intake-card,
body.theme-dark .kpi-block,
body.theme-dark .calc-card,
body.theme-dark .warehouse-zone {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-card) !important;
  border-radius: 14px !important;
  color: var(--text-main) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4) !important;
}

html.theme-dark .card h1, html.theme-dark .card h2, html.theme-dark .card h3,
html.theme-dark .panel h1, html.theme-dark .panel h2, html.theme-dark .panel h3,
html.theme-dark .section-title, html.theme-dark .card-title, html.theme-dark .heading,
body.theme-dark .card h1, body.theme-dark .card h2, body.theme-dark .card h3,
body.theme-dark .panel h1, body.theme-dark .panel h2, body.theme-dark .panel h3,
body.theme-dark .section-title, body.theme-dark .card-title, body.theme-dark .heading {
  color: #fff !important;
}

/* Таблицы */
html.theme-dark table,
html.theme-dark .table,
html.theme-dark .data-table,
html.theme-dark .del-table,
body.theme-dark table,
body.theme-dark .table,
body.theme-dark .data-table,
body.theme-dark .del-table {
  background: transparent !important;
  color: var(--text-main) !important;
}

html.theme-dark table th,
html.theme-dark .table th,
html.theme-dark .data-table th,
html.theme-dark .del-table th,
body.theme-dark table th,
body.theme-dark .table th,
body.theme-dark .data-table th,
body.theme-dark .del-table th {
  background: rgba(0, 0, 0, 0.4) !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid var(--border-card) !important;
}

html.theme-dark table td,
html.theme-dark .table td,
html.theme-dark .data-table td,
html.theme-dark .del-table td,
body.theme-dark table td,
body.theme-dark .table td,
body.theme-dark .data-table td,
body.theme-dark .del-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: var(--text-main) !important;
}

/* Формы и поля ввода */
html.theme-dark input[type="text"],
html.theme-dark input[type="number"],
html.theme-dark input[type="date"],
html.theme-dark input[type="password"],
html.theme-dark input[type="search"],
html.theme-dark select,
html.theme-dark textarea,
html.theme-dark .input-field,
html.theme-dark .form-control,
body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
body.theme-dark input[type="date"],
body.theme-dark input[type="password"],
body.theme-dark input[type="search"],
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .input-field,
body.theme-dark .form-control {
  background: #070a12 !important;
  border: 1px solid #334155 !important;
  color: #fff !important;
  border-radius: 8px !important;
}

/* ==========================================================================
   ЛИЧНАЯ КАРТОЧКА СИЗ (МБ-6) И АНТРОПОМЕТРИЯ
   ========================================================================== */

/* В тёмной теме карточка МБ-6 */
html.theme-dark .ppe-mb6-card,
body.theme-dark .ppe-mb6-card {
  background: #0b111e !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
}

/* Рамка антропометрии справа в карточке СИЗ */
html.theme-dark .ppe-mb6-anthro-box,
body.theme-dark .ppe-mb6-anthro-box {
  background: #0f172a !important;
  border: 1px solid #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2) !important;
  border-radius: 8px !important;
  color: #f8fafc !important;
}

html.theme-dark .ppe-anthro-lbl,
body.theme-dark .ppe-anthro-lbl {
  color: #94a3b8 !important;
  font-weight: 600 !important;
}

html.theme-dark .ppe-anthro-val,
body.theme-dark .ppe-anthro-val {
  color: #38bdf8 !important;
  font-weight: 700 !important;
}

html.theme-dark .ppe-mb6-prop-label,
body.theme-dark .ppe-mb6-prop-label {
  color: #94a3b8 !important;
}

html.theme-dark .ppe-mb6-prop-val,
body.theme-dark .ppe-mb6-prop-val {
  color: #f8fafc !important;
}

html.theme-dark .ppe-mb6-code,
body.theme-dark .ppe-mb6-code {
  color: #64748b !important;
}

html.theme-dark .ppe-mb6-title,
body.theme-dark .ppe-mb6-title {
  color: #fff !important;
}

html.theme-dark .ppe-mb6-subtitle,
body.theme-dark .ppe-mb6-subtitle {
  color: #94a3b8 !important;
}

/* Блок редактирования размеров СИЗ */
html.theme-dark .ppe-size-editor,
body.theme-dark .ppe-size-editor {
  background: #0d1527 !important;
  border: 1px solid #10b981 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.2) !important;
  color: #fff !important;
  border-radius: 10px !important;
}

html.theme-dark .ppe-size-editor label,
body.theme-dark .ppe-size-editor label {
  color: #94a3b8 !important;
}

html.theme-dark .ppe-size-editor input,
body.theme-dark .ppe-size-editor input {
  background: #070a12 !important;
  color: #34d399 !important;
  border: 1px solid #059669 !important;
  font-weight: 700 !important;
}

/* В светлой теме таблица антропометрии (гарантия контрастности) */
html.theme-light .ppe-mb6-anthro-box,
body.theme-light .ppe-mb6-anthro-box {
  background: #f8fafc !important;
  border: 2px solid #0f172a !important;
  color: #0f172a !important;
}
html.theme-light .ppe-anthro-lbl,
body.theme-light .ppe-anthro-lbl {
  color: #475569 !important;
}
html.theme-light .ppe-anthro-val,
body.theme-light .ppe-anthro-val {
  color: #0f172a !important;
}

/* ==========================================================================
   РАЗДЕЛ «СКЛАД» — УСТРАНЕНИЕ БЕСКОНЕЧНОЙ ПРОСТЫНИ СКРОЛЛА
   ========================================================================== */

/* Панель зон и колонки передержки: компактная фиксация */
.wh-holding-panel,
.zone-card__items,
.zone-card--panel .zone-card__items {
  max-height: calc(100vh - 290px) !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: #334155 transparent !important;
  padding-right: 6px !important;
}

/* Внутренний список заявок в ячейке: не растягивать на километры */
.wh-cell__items--scroll,
.wh-cell__items {
  max-height: 250px !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  padding: 6px !important;
}

/* Компактные ячейки склада */
.wh-cell {
  margin-bottom: 8px !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
}

.wh-cell__head {
  padding: 8px 12px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  user-select: none !important;
}

.wh-cell__head:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Тонкий стильный скроллбар */
.wh-holding-panel::-webkit-scrollbar,
.zone-card__items::-webkit-scrollbar,
.wh-cell__items::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.wh-holding-panel::-webkit-scrollbar-thumb,
.zone-card__items::-webkit-scrollbar-thumb,
.wh-cell__items::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.wh-holding-panel::-webkit-scrollbar-thumb:hover,
.zone-card__items::-webkit-scrollbar-thumb:hover,
.wh-cell__items::-webkit-scrollbar-thumb:hover {
  background: #38bdf8;
}

/* ==========================================================================
   КНОПКА ПЕРЕКЛЮЧЕНИЯ ТЕМЫ В САЙДБАРЕ
   ========================================================================== */
.sidebar__theme-toggle {
  margin: 10px 0;
  padding: 4px 6px;
  display: flex;
}

.theme-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-card, #cbd5e1);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

html.theme-light .theme-toggle-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
html.theme-light .theme-toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
