/**
 * STEM System — тёмная тема (логика в dark-theme.js)
 * Класс .dark-theme добавляется на html и body.
 *
 * Палитра:
 * Фоны: #1F1F1F (хедер), #171717 (основной)
 * Блоки: #2E2E2E, #303030, #333333, #3E3E3E, #4A4A4A
 * Текст: #7A7A7A (muted), #A8A8A8 (secondary), #C9C9C9 (primary)
 * Акценты: #FF4F47, #FF9D14, #02590F, #040273, #082567, #01826B
 */

/* ========== CSS-ПЕРЕМЕННЫЕ ДЛЯ ТЁМНОЙ ТЕМЫ ========== */
html.dark-theme,
html.dark-theme body {
  --stem-bg: #171717;
  --stem-bg-header: #1F1F1F;
  --stem-card-bg: #2E2E2E;
  --stem-card-bg-hover: #303030;
  --stem-block-mid: #333333;
  --stem-block-light: #3E3E3E;
  --stem-block-lighter: #4A4A4A;
  --stem-border: #3E3E3E;
  --stem-border-light: #4A4A4A;
  --stem-text: #C9C9C9;
  --stem-text-secondary: #A8A8A8;
  --stem-text-muted: #7A7A7A;
  --stem-header-bg: #1F1F1F;
  --stem-sidebar-bg: #1F1F1F;
  /* Акцентные цвета */
  --stem-danger: #FF4F47;
  --stem-warning: #FF9D14;
  --stem-success: #02590F;
  --stem-success-light: #01826B;
  --stem-primary: #082567;
  --stem-primary-dark: #040273;
  --stem-primary-light: #082567;
  --stem-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* layout.css переменные + фон под PWA (иначе внизу просвечивает белый у html) */
html.dark-theme {
  --stem-top-bar-bg: #1F1F1F;
  background-color: #171717 !important;
  color-scheme: dark;
}

/* PWA: полноэкранный слой base.css — в тёмной теме не #f3f4f6 */
@media (display-mode: standalone) {
  html.dark-theme::after {
    background-color: #171717 !important;
  }
  html.dark-theme:has(.admin-layout)::after {
    background-color: #f3f4f6 !important;
  }
}

/* ========== БАЗОВЫЕ ЭЛЕМЕНТЫ ========== */
html.dark-theme body {
  background: #171717 !important;
  color: #C9C9C9 !important;
}

/* ========== АДМИН-ПАНЕЛЬ — тёмная тема не применяется, меню универсальное ========== */
/* Когда на странице есть .admin-layout — сбрасываем все тёмные стили на светлые */
html.dark-theme:has(.admin-layout) {
  background: #f3f4f6 !important;
  color-scheme: light;
}
html.dark-theme:has(.admin-layout) body {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
}

html.dark-theme:has(.admin-layout) .admin-layout,
html.dark-theme:has(.admin-layout) .content-area,
html.dark-theme:has(.admin-layout) .pages-container,
html.dark-theme:has(.admin-layout) .page {
  background: #f3f4f6 !important;
}

html.dark-theme:has(.admin-layout) .sidebar {
  background: #1F1F1F !important;
}

html.dark-theme:has(.admin-layout) .page-iframe {
  background: #f3f4f6 !important;
}

/* Карточки, текст и прочие элементы в админке — светлая тема */
html.dark-theme:has(.admin-layout) .card,
html.dark-theme:has(.admin-layout) .stat-card,
html.dark-theme:has(.admin-layout) .kanban-column,
html.dark-theme:has(.admin-layout) .order-mini-card {
  background: #fff !important;
  border-color: #e5e7eb !important;
  color: #1f2937 !important;
}

html.dark-theme:has(.admin-layout) .card-title,
html.dark-theme:has(.admin-layout) .card-header,
html.dark-theme:has(.admin-layout) h1,
html.dark-theme:has(.admin-layout) h2,
html.dark-theme:has(.admin-layout) h3 {
  color: #acacac !important;
}

html.dark-theme:has(.admin-layout) .sidebar-user-details h3,
html.dark-theme:has(.admin-layout) .sidebar-user-details #userName {
  color: white !important;
}

html.dark-theme:has(.admin-layout) .sidebar-user-details p {
  color: rgba(255,255,255,0.7) !important;
}

html.dark-theme:has(.admin-layout) .sidebar-nav-item span {
  color: rgba(255,255,255,0.9) !important;
}

html.dark-theme:has(.admin-layout) .sidebar-nav-section {
  color: #e4e4e7 !important;
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Страница «Распределение» — те же цвета, что в тёмной теме STEM (--stem-*), без «синего» slate */
html.dark-theme:has(.cabinet-distribution-shell) body {
  background: var(--stem-bg) !important;
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .admin-layout,
html.dark-theme:has(.cabinet-distribution-shell) .content-area,
html.dark-theme:has(.cabinet-distribution-shell) .stem-main.main-content {
  background: var(--stem-bg) !important;
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .dist-table-wrap {
  background: var(--stem-card-bg) !important;
  border-color: var(--stem-border) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .dist-table thead tr {
  background: var(--stem-block-mid) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .dist-table th,
html.dark-theme:has(.cabinet-distribution-shell) .dist-table td {
  color: var(--stem-text) !important;
  border-color: var(--stem-border) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .dist-table tbody tr {
  border-color: var(--stem-border) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .user-cab-block h3 {
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .form-label,
html.dark-theme:has(.cabinet-distribution-shell) .dist-tariffs-hint {
  color: var(--stem-text-secondary) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .form-input,
html.dark-theme:has(.cabinet-distribution-shell) .stem-modal__input {
  background: var(--stem-card-bg) !important;
  border-color: var(--stem-border) !important;
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .dist-page-title {
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) #cabinetDistStatus {
  color: var(--stem-text-secondary) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .user-cab-block .dist-select {
  background: var(--stem-card-bg) !important;
  border-color: var(--stem-border) !important;
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .user-cab-block .uid-mono {
  color: var(--stem-text-muted) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) #distMainLayout .dist-distribution-topbar {
  background: var(--stem-bg-header) !important;
  border-bottom-color: var(--stem-border) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) #editCabinetModal.modal-overlay {
  background: rgba(0, 0, 0, 0.62) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .modal-content.stem-modal {
  background: var(--stem-card-bg) !important;
  border-color: var(--stem-border) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .stem-modal__title,
html.dark-theme:has(.cabinet-distribution-shell) .stem-modal__label {
  color: var(--stem-text) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .stem-modal__hint {
  color: var(--stem-text-secondary) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .tariff-status--paid {
  color: var(--stem-success-light) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .tariff-status--unpaid {
  color: var(--stem-danger) !important;
}
html.dark-theme:has(.cabinet-distribution-shell) .tariff-status--none {
  color: var(--stem-text-muted) !important;
}

html.dark-theme .top-bar {
  background: #1F1F1F !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

html.dark-theme .top-bar h2 {
  color: #A3A3A3 !important;
}

/* Карточки и контент */
html.dark-theme .card,
html.dark-theme .stat-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

html.dark-theme .card-header,
html.dark-theme .card-title,
html.dark-theme .stat-value,
html.dark-theme .placeholder h3 {
  color: #A3A3A3 !important;
}

html.dark-theme .card-header {
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .stat-label,
html.dark-theme .placeholder p,
html.dark-theme .placeholder {
  color: #8C8C8C !important;
}

/* Настройки — табы */
html.dark-theme .settings-tabs {
  border-color: #3E3E3E !important;
}

html.dark-theme .settings-tab-btn {
  background: #333333 !important;
  color: #8C8C8C !important;
  border-right-color: #3E3E3E !important;
}

html.dark-theme .settings-tab-btn:hover {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .settings-tab-btn.active {
  background: #082567 !important;
  color: #E8E8E8 !important;
}

html.dark-theme .settings-tab-group-label {
  color: #8C8C8C !important;
}

html.dark-theme .settings-page {
  background: transparent;
}

html.dark-theme .modal-content {
  background: #2E2E2E !important;
  border: 1px solid #3E3E3E !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6) !important;
}

/* STEM Modal (settings / role editor) */
html.dark-theme .modal-content.stem-modal {
  background: #252525 !important;
  border-color: #3E3E3E !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55) !important;
}
html.dark-theme .stem-modal__title {
  color: #e5e5e5 !important;
}
html.dark-theme .stem-modal__header,
html.dark-theme .stem-modal__footer {
  border-color: #3E3E3E !important;
}
html.dark-theme .stem-modal__label {
  color: #a3a3a3 !important;
}
html.dark-theme .stem-modal__hint {
  color: #8c8c8c !important;
}
html.dark-theme .stem-modal__input {
  background: #333333 !important;
  border-color: #454545 !important;
  color: #e5e5e5 !important;
}
html.dark-theme .stem-modal__input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}
html.dark-theme .stem-modal__btn-secondary {
  background: #404040 !important;
  color: #e5e5e5 !important;
}
html.dark-theme .role-block-card {
  background: #2e2e2e !important;
  border-color: #454545 !important;
}
html.dark-theme .role-block-card__title {
  color: #e5e5e5 !important;
}
html.dark-theme .role-block-card__hint {
  color: #8c8c8c !important;
}
html.dark-theme .role-pages-grid,
html.dark-theme .role-settings-tabs-grid,
html.dark-theme #roleBlocksContainer label {
  color: #b0b0b0 !important;
}
html.dark-theme .role-pages-grid input,
html.dark-theme .role-settings-tabs-grid input,
html.dark-theme #roleBlocksContainer input {
  accent-color: #3b82f6;
}

html.dark-theme #settingsLoading {
  color: #8C8C8C !important;
}

/* Theme pill */
html.dark-theme .theme-pill-toggle.daymode {
  background: #333333 !important;
}

html.dark-theme .theme-pill-toggle.daymode .theme-pill-label {
  color: #8C8C8C !important;
}

/* Kanban */
html.dark-theme .kanban-column {
  background: #2E2E2E !important;
  border-color: #3E3E3E;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

html.dark-theme .kanban-column.today {
  border-color: #082567;
  background: linear-gradient(180deg, rgba(8, 37, 103, 0.4) 0%, #2E2E2E 100%) !important;
}

html.dark-theme .kanban-column.overdue {
  border-color: #FF4F47;
  background: linear-gradient(180deg, rgba(255, 79, 71, 0.2) 0%, #2E2E2E 100%) !important;
}

html.dark-theme .kanban-header {
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .kanban-title {
  color: #A3A3A3 !important;
}

html.dark-theme .order-mini-card {
  background: #171717 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-mini-card:hover {
  border-color: #082567 !important;
  box-shadow: 0 4px 12px rgba(8, 37, 103, 0.3);
}

html.dark-theme .order-mini-number,
html.dark-theme .order-mini-info strong {
  color: #A3A3A3 !important;
}

html.dark-theme .order-mini-info {
  color: #8C8C8C !important;
}

html.dark-theme .order-mini-date {
  background: rgba(8, 37, 103, 0.5) !important;
  color: #A3A3A3 !important;
}

html.dark-theme .order-mini-date.urgent {
  background: rgba(255, 79, 71, 0.3) !important;
  color: #FF4F47 !important;
}

/* iframe фон */
html.dark-theme .page-iframe {
  background: #171717 !important;
}

/* ========== КОМПОНЕНТЫ (кнопки, инпуты) ========== */
html.dark-theme .btn-outline,
html.dark-theme .stem-btn-outline {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .btn-outline:hover,
html.dark-theme .stem-btn-outline:hover {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
}

/* ========== СТРАНИЦЫ В IFRAME ========== */
html.dark-theme body {
  background: #171717 !important;
}

html.dark-theme .layout,
html.dark-theme .files-layout,
html.dark-theme .configurator-layout,
html.dark-theme .analytics-layout,
html.dark-theme .warehouse-layout {
  background: #171717 !important;
}

html.dark-theme .stem-top-bar {
  background: #1F1F1F !important;
}

/* Конфигуратор/файлы/аналитика/склад: top-nav — убрать градиент, однотонный */
html.dark-theme .top-nav {
  background: #1F1F1F !important;
}

/* stem-page-header, stem-header — оставляем #1F1F1F */
html.dark-theme .stem-page-header,
html.dark-theme .stem-header {
  background: #1F1F1F !important;
}

html.dark-theme .stem-page-header-title,
html.dark-theme .stem-header h1 {
  color: #A3A3A3 !important;
}

html.dark-theme .stem-page-header #stem-header-actions .btn,
html.dark-theme .stem-page-header #stem-header-actions .tab-btn {
  color: #8C8C8C !important;
}

html.dark-theme .stem-page-header #stem-header-actions .btn:hover,
html.dark-theme .stem-page-header #stem-header-actions .tab-btn:hover {
  color: #A3A3A3 !important;
}

html.dark-theme .main-content {
  background: transparent;
}

/* Карточки на страницах */
html.dark-theme .section-panel .card,
html.dark-theme .warehouse-panel-left .card,
html.dark-theme .warehouse-panel-right .card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

/* Таблицы */
html.dark-theme .table-wrap,
html.dark-theme .card .table-wrap {
  background: #171717 !important;
  border-color: #3E3E3E !important;
}

/* Модальные окна */
html.dark-theme .modal {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6) !important;
}

/* Инпуты */
html.dark-theme input[type="text"],
html.dark-theme input[type="number"],
html.dark-theme input[type="email"],
html.dark-theme input[type="password"],
html.dark-theme textarea,
html.dark-theme select {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme input::placeholder,
html.dark-theme textarea::placeholder {
  color: #616161 !important;
}

html.dark-theme body:has(.card) .card {
  background: rgba(46, 46, 46, 0.95) !important;
  border-color: rgba(62, 62, 62, 0.8) !important;
}

/* tasks-shop: task-row — светлее фон, border-left по статусу как в светлой теме */
html.dark-theme .task-row {
  background: #333333 !important;
  border: 1px solid #525252 !important;
}

html.dark-theme .task-row.can-take {
  border-left: 4px solid #10b981 !important;
}

html.dark-theme .task-row.shortage {
  border-left: 4px solid #f59e0b !important;
}

html.dark-theme .task-shortage-block {
  border-left-color: #f59e0b !important;
  color: #e7e5e4 !important;
}
html.dark-theme .task-shortage-lead {
  color: #fcd34d !important;
}
html.dark-theme .task-shortage-name {
  color: #fef3c7 !important;
}
html.dark-theme .task-shortage-muted {
  color: #a8a29e !important;
}
html.dark-theme .task-take-unavailable {
  color: #fcd34d !important;
}

html.dark-theme .task-row.taken {
  background: rgba(8, 37, 103, 0.35) !important;
  border-color: #3b82f6 !important;
  border-left: 4px solid #3b82f6 !important;
}

html.dark-theme .task-row.completed {
  background: rgba(2, 89, 15, 0.35) !important;
  border-color: #10b981 !important;
  border-left: 4px solid #10b981 !important;
}

html.dark-theme .task-order-comment {
  background: #2a2a2a !important;
  color: #d1d5db !important;
  border-left-color: #60a5fa !important;
}
html.dark-theme .task-timer-live { color: #86efac !important; }
html.dark-theme .task-timer-live.task-timer--overdue { color: #fca5a5 !important; }

html.dark-theme .task-next-step {
  color: #9ca3af !important;
}
html.dark-theme .task-next-step--op-hint {
  color: #78716c !important;
}

/* tasks-shop: выделить разделы */
html.dark-theme .tasks-subsection-header {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
  border-radius: 8px !important;
  padding: 12px 18px !important;
}

html.dark-theme .task-op-panel-toolbar {
  border-top-color: rgba(255, 255, 255, 0.12) !important;
}
html.dark-theme .task-op-toolbar-btn.btn-outline {
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #e5e7eb !important;
  background: rgba(255, 255, 255, 0.06) !important;
}
html.dark-theme .task-op-toolbar-btn.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* tasks-shop: панель операций — тёмная тема */
html.dark-theme .task-op-panel {
  background: linear-gradient(180deg, #2a2a2e 0%, #1f1f24 100%) !important;
  border-color: #4b5563 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
html.dark-theme .task-op-panel-label {
  color: #9ca3af !important;
}
html.dark-theme .task-op-chain-arr {
  color: #6b7280 !important;
}
html.dark-theme .task-op-chip {
  background: #2e2e33 !important;
  border-color: #4b5563 !important;
  color: #e5e7eb !important;
}
html.dark-theme .task-op-chip-hint {
  color: #9ca3af !important;
}
html.dark-theme .task-op-chip--plan {
  background: #252529 !important;
  border-color: #52525b !important;
  color: #9ca3af !important;
}
html.dark-theme .task-op-chip--later {
  color: #71717a !important;
}
html.dark-theme .task-op-chip--done {
  border-color: #166534 !important;
  background: linear-gradient(180deg, rgba(22, 101, 52, 0.35) 0%, rgba(22, 101, 52, 0.2) 100%) !important;
  color: #bbf7d0 !important;
}
html.dark-theme .task-op-chip--active {
  border-color: #3b82f6 !important;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35) 0%, rgba(30, 64, 175, 0.25) 100%) !important;
  color: #dbeafe !important;
}
html.dark-theme .task-op-chip--wait {
  border-color: #ea580c !important;
  background: linear-gradient(180deg, rgba(234, 88, 12, 0.25) 0%, rgba(234, 88, 12, 0.12) 100%) !important;
  color: #fed7aa !important;
}
html.dark-theme .task-op-wait-bar {
  background: rgba(234, 88, 12, 0.15) !important;
  border-color: rgba(251, 146, 60, 0.45) !important;
  color: #fdba74 !important;
}
html.dark-theme .task-op-wait-bar .task-op-wait-label {
  color: #fdba74 !important;
}
html.dark-theme .task-op-readonly-hint {
  color: #9ca3af !important;
}
html.dark-theme .task-op-panel-note {
  color: #9ca3af !important;
}
html.dark-theme .task-op-chip--signal.task-op-chip--active {
  border-color: #fbbf24 !important;
}
html.dark-theme button.task-op-chip--pickup {
  border-color: #059669 !important;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.35) 0%, rgba(4, 120, 87, 0.25) 100%) !important;
  color: #d1fae5 !important;
}
html.dark-theme button.task-op-chip--pickup.task-op-chip--signal {
  border-color: #fbbf24 !important;
  animation: task-op-signal-pulse 1.15s ease-in-out infinite !important;
}
html.dark-theme .task-op-panel-toolbar--single-row {
  border-top-color: rgba(255, 255, 255, 0.12) !important;
}

/* tasks-shop: количество — выделить как в светлой теме */
html.dark-theme .task-qty-cell {
  font-weight: 700 !important;
}

html.dark-theme .task-qty-value {
  color: #f3f4f6 !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  padding: 4px 10px !important;
  background: rgba(75, 85, 99, 0.6) !important;
  border-radius: 6px !important;
  display: inline-block !important;
}

/* tasks-shop: scan-cell-badge — «Ячейка A1» — контрастный текст в тёмной теме */
html.dark-theme .scan-cell-badge {
  background: #047857 !important;
  color: #ecfdf5 !important;
  border: 1px solid #059669 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

html.dark-theme .task-cell-badge {
  background: #047857 !important;
  color: #ecfdf5 !important;
  border: 1px solid #059669 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}

/* tasks-shop: scan-barcode-result — зелёный/красный при сканировании */
html.dark-theme .scan-barcode-result.ok {
  background: rgba(2, 89, 15, 0.4) !important;
  color: #a7f3d0 !important;
  border: 2px solid #059669 !important;
}

html.dark-theme .scan-barcode-result.error {
  background: rgba(255, 79, 71, 0.25) !important;
  color: #fecaca !important;
  border: 2px solid #ef4444 !important;
}

/* Статусы: убрать белый фон, фон = цвет статуса */
html.dark-theme .task-status-badge.s1 {
  background: #4A4A4A !important;
  color: #8C8C8C !important;
}

html.dark-theme .task-status-badge.s2 {
  background: rgba(8, 37, 103, 0.6) !important;
  color: #A3A3A3 !important;
}

html.dark-theme .task-status-badge.s2-paused {
  background: rgba(255, 157, 20, 0.4) !important;
  color: #FF9D14 !important;
}

html.dark-theme .task-status-badge.s3 {
  background: rgba(2, 89, 15, 0.6) !important;
  color: #01826B !important;
}

/* tasks-shop: бейджи типов задач */
html.dark-theme .task-type-badge.warehouse {
  background: rgba(4, 2, 115, 0.4) !important;
  color: #A3A3A3 !important;
}

html.dark-theme .task-type-badge.orders {
  background: rgba(255, 157, 20, 0.25) !important;
  color: #FF9D14 !important;
}

html.dark-theme .task-type-badge.urgent {
  background: rgba(255, 79, 71, 0.25) !important;
  color: #FF4F47 !important;
}

html.dark-theme .task-type-badge.purchase,
html.dark-theme .task-type-badge.assembly {
  background: rgba(2, 89, 15, 0.25) !important;
  color: #01826B !important;
}

html.dark-theme .task-type-badge.metal,
html.dark-theme .task-type-badge.ldsp {
  background: #3E3E3E !important;
  color: #8C8C8C !important;
}

html.dark-theme .task-type-badge.welding,
html.dark-theme .task-type-badge.painting {
  background: rgba(255, 79, 71, 0.2) !important;
  color: #FF4F47 !important;
}

/* top-bar tabs (tasks_shop, warehouse) */
html.dark-theme .top-bar-tabs .tab-btn,
html.dark-theme .warehouse-tab {
  color: #8C8C8C !important;
  background: transparent !important;
}

html.dark-theme .top-bar-tabs .tab-btn:hover,
html.dark-theme .warehouse-tab:hover {
  color: #A3A3A3 !important;
  background: rgba(62, 62, 62, 0.5) !important;
}

html.dark-theme .top-bar-tabs .tab-btn.active,
html.dark-theme .warehouse-tab.active {
  background: #082567 !important;
  color: #E8E8E8 !important;
}

/* all_orders, delivery и др. — общие классы */
html.dark-theme .order-card,
html.dark-theme .status-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-card:hover,
html.dark-theme .status-card:hover {
  border-color: #082567 !important;
}

/* Таблицы (analytics, configurator, warehouse) */
html.dark-theme th {
  background: #2E2E2E !important;
  color: #8C8C8C !important;
  border-color: #3E3E3E !important;
}

html.dark-theme td {
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme tr:hover,
html.dark-theme .item-row:hover {
  background: #303030 !important;
}

/* Конфигуратор: убрать синий градиент — однотонный серый */
html.dark-theme .cat-row-parent {
  background: #333333 !important;
  border-left: 4px solid #4A4A4A !important;
}

html.dark-theme .cat-row-parent:hover {
  background: #3E3E3E !important;
}

html.dark-theme .cat-row-parent.cat-row-selected {
  background: #3E3E3E !important;
  box-shadow: inset 0 0 0 2px #4A4A4A !important;
}

/* Конфигуратор: hover на позиции — слегка светлее, не белый */
html.dark-theme .item-row:hover,
html.dark-theme .editable-cell:hover,
html.dark-theme .cat-row-sub.drag-over {
  background: #3E3E3E !important;
}

html.dark-theme .item-row.drag-over {
  background: #3E3E3E !important;
}

html.dark-theme .cat-row-sub {
  background: #171717 !important;
  border-left-color: #4A4A4A !important;
}

html.dark-theme .cat-row-sub:hover {
  background: #2E2E2E !important;
}

html.dark-theme .cat-row-sub.cat-row-selected {
  background: #2E2E2E !important;
  box-shadow: inset 0 0 0 2px #4A4A4A !important;
}

html.dark-theme .entity-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .entity-row .entity-label,
html.dark-theme .form-group label {
  color: #8C8C8C !important;
}

html.dark-theme .detail-table thead th {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #8C8C8C !important;
}

html.dark-theme .anomalies-card {
  background: rgba(255, 157, 20, 0.15) !important;
  border-left-color: #FF9D14 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .anomalies-card.anomaly-cost-drop {
  background: rgba(1, 130, 107, 0.2) !important;
  color: #01826B !important;
}

html.dark-theme .anomalies-card.anomaly-cost-spike {
  background: rgba(255, 79, 71, 0.2) !important;
  color: #FF4F47 !important;
}

html.dark-theme .action-menu-btn {
  background: #333333 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .action-menu-btn:hover {
  background: #3E3E3E !important;
}

html.dark-theme .action-menu-dropdown {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .action-menu-dropdown button,
html.dark-theme .action-menu-dropdown a {
  color: #A3A3A3 !important;
}

html.dark-theme .action-menu-dropdown button:hover,
html.dark-theme .action-menu-dropdown a:hover {
  background: #333333 !important;
}

/* Текст по умолчанию */
html.dark-theme h1,
html.dark-theme h2,
html.dark-theme h3 {
  color: #A3A3A3 !important;
}

html.dark-theme p,
html.dark-theme span {
  color: inherit;
}

html.dark-theme a {
  color: #01826B !important;
}

html.dark-theme a:hover {
  color: #FF9D14 !important;
}

/* Кнопки primary, success, danger */
html.dark-theme .btn-primary {
  background: #082567 !important;
  border-color: #082567 !important;
  color: #E8E8E8 !important;
}

html.dark-theme .btn-success {
  background: #02590F !important;
  border-color: #02590F !important;
  color: #E8E8E8 !important;
}

html.dark-theme .btn-danger,
html.dark-theme .btn-dangerous {
  background: #FF4F47 !important;
  border-color: #FF4F47 !important;
  color: #171717 !important;
}

html.dark-theme .btn-warning {
  background: #FF9D14 !important;
  border-color: #FF9D14 !important;
  color: #171717 !important;
}

/* Scrollbar в тёмной теме */
html.dark-theme ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html.dark-theme ::-webkit-scrollbar-track {
  background: #2E2E2E;
}

html.dark-theme ::-webkit-scrollbar-thumb {
  background: #4A4A4A;
  border-radius: 4px;
}

html.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: #616161;
}

/* ========== СТРАНИЦА ВХОДА (LOGIN) ========== */
html.dark-theme .login-container {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6) !important;
}

html.dark-theme .login-body {
  background: #2E2E2E;
}

html.dark-theme .form-tabs {
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .form-tab {
  color: #8C8C8C !important;
}

html.dark-theme .form-tab.active {
  color: #A3A3A3 !important;
  border-bottom-color: #082567 !important;
}

html.dark-theme .form-input,
html.dark-theme input.form-input {
  background: #171717 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .alert {
  background: rgba(46, 46, 46, 0.95) !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .alert.success {
  background: rgba(2, 89, 15, 0.25) !important;
  border-color: #02590F !important;
  color: #01826B !important;
}

html.dark-theme .alert.error {
  background: rgba(255, 79, 71, 0.2) !important;
  border-color: #FF4F47 !important;
  color: #FF4F47 !important;
}

/* ========== ВСЕ ЗАКАЗЫ (НОВАЯ) ========== */
html.dark-theme .status-grid,
html.dark-theme #statusGrid {
  background: #171717 !important;
}

html.dark-theme .status-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .status-card-title {
  color: #8C8C8C !important;
}

/* Кол-во в статус-карточках — ярче */
html.dark-theme .status-card-count {
  color: #A3A3A3 !important;
  font-size: 24px !important;
  font-weight: 800 !important;
}

html.dark-theme .stat-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .stat-card .value {
  color: #A3A3A3 !important;
}

html.dark-theme .stat-card .label {
  color: #8C8C8C !important;
}

/* Источник (mp-toggle) — не белый */
html.dark-theme .mp-toggle-row .label {
  color: #8C8C8C !important;
}

html.dark-theme .mp-toggle {
  border-color: #3E3E3E !important;
}

html.dark-theme .mp-toggle button {
  background: #333333 !important;
  color: #8C8C8C !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .mp-toggle button:hover {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .mp-toggle button.active {
  background: #082567 !important;
  color: #E8E8E8 !important;
}

/* FBS и DBS — более выраженные */
html.dark-theme .badge-fbs {
  background: rgba(8, 37, 103, 0.6) !important;
  color: #E8E8E8 !important;
  border: 1px solid #082567 !important;
}

html.dark-theme .badge-dbs {
  background: rgba(2, 89, 15, 0.6) !important;
  color: #01826B !important;
  border: 1px solid #02590F !important;
}

html.dark-theme .badge-status {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .order-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-number,
html.dark-theme .order-info strong {
  color: #A3A3A3 !important;
}

html.dark-theme .order-info,
html.dark-theme .order-items {
  color: #8C8C8C !important;
}

html.dark-theme .container {
  background: transparent !important;
}

html.dark-theme .fbs-dbs-toggle {
  border-color: #3E3E3E !important;
}

html.dark-theme .fbs-dbs-toggle button {
  background: #333333 !important;
  color: #8C8C8C !important;
}

html.dark-theme .fbs-dbs-toggle button.active {
  background: #082567 !important;
  color: #E8E8E8 !important;
}

html.dark-theme .order-photo {
  background: #2E2E2E !important;
}

html.dark-theme .order-card-map,
html.dark-theme .modal-map-wrap {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme #content {
  background: transparent !important;
}

/* Модальное окно all_orders_new — убрать белый фон, ячейка и даты */
html.dark-theme .modal,
html.dark-theme #orderModal .modal {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .modal-body,
html.dark-theme .order-modal-body {
  background: #2E2E2E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .modal-label {
  color: #8C8C8C !important;
}

html.dark-theme .modal-value {
  color: #A3A3A3 !important;
}

html.dark-theme .order-modal-stem-labels {
  background: #333333 !important;
  border-color: #3E3E3E !important;
}
html.dark-theme .order-modal-stem-labels > div:first-of-type,
html.dark-theme #orderModalLabelPreviewTitle {
  color: #E5E5E5 !important;
}
html.dark-theme .order-modal-label-pdf-frame-wrap {
  border-color: #3E3E3E !important;
  background: #1a1a1a !important;
}
html.dark-theme .order-modal-label-pdf-hint {
  color: #8C8C8C !important;
}
html.dark-theme .order-modal-label-action-row .order-modal-label-dl--ozon,
html.dark-theme .order-modal-label-action-row .order-modal-label-dl--yandex {
  color: #fff !important;
}
html.dark-theme .order-modal-label-preview-item {
  border-color: #3E3E3E !important;
  background: #2a2a2a !important;
}
html.dark-theme .order-modal-label-preview-item .label-preview {
  background: #fff !important;
}
html.dark-theme #orderModalFbsBoxOuter {
  background: #333333 !important;
  border-color: #3E3E3E !important;
}
html.dark-theme #orderModalFbsBoxOuter > div:first-of-type {
  color: #E5E5E5 !important;
}
html.dark-theme #orderModalFbsBoxBarcodeLine {
  color: #A3A3A3 !important;
}

html.dark-theme .modal-cell-select {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .order-logs-list {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-logs-table th {
  background: #333333 !important;
  color: #8C8C8C !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-logs-table td {
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .status-dropdown {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .status-dropdown-item {
  color: #A3A3A3 !important;
}

html.dark-theme .status-dropdown-item:hover {
  background: #333333 !important;
}

/* ========== УПАКОВКА ЗАКАЗОВ (assembly) ========== */
html.dark-theme .assembly-content {
  background: #171717 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .assembly-content h3 {
  color: #A3A3A3 !important;
}

html.dark-theme .sorted-orders-section,
html.dark-theme .cells-section {
  background: transparent !important;
}

html.dark-theme .cells-section,
html.dark-theme .cells-section-new {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .cell-item {
  background: #333333 !important;
  border-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}

html.dark-theme .cell-item.cell-assigned {
  background: rgba(8, 37, 103, 0.5) !important;
  border-color: #082567 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .cell-item.cell-has-content {
  background: rgba(255, 157, 20, 0.3) !important;
  border-color: #FF9D14 !important;
  color: #FF9D14 !important;
}

html.dark-theme .cell-item.cell-sorted {
  background: rgba(255, 79, 71, 0.3) !important;
  border-color: #FF4F47 !important;
  color: #FF4F47 !important;
}

html.dark-theme .cell-item.cell-packed {
  background: rgba(2, 89, 15, 0.4) !important;
  border-color: #02590F !important;
  color: #01826B !important;
}

html.dark-theme .date-sort-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}
html.dark-theme .date-sort-row .label {
  color: #A3A3A3 !important;
}
html.dark-theme .btn-date-sort {
  background: #333333 !important;
  border-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}
html.dark-theme .btn-date-sort:hover {
  background: #3E3E3E !important;
  color: #E5E5E5 !important;
}
html.dark-theme .btn-date-sort.active {
  background: #082567 !important;
  border-color: #082567 !important;
  color: #E5E5E5 !important;
}

html.dark-theme .cell-context-menu {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}
html.dark-theme .cell-context-item {
  color: #A3A3A3 !important;
}
html.dark-theme .cell-context-item:hover {
  background: #333333 !important;
}
html.dark-theme .cell-context-item.cell-context-danger {
  color: #f87171 !important;
}
html.dark-theme .cell-context-item.cell-context-danger:hover {
  background: rgba(127, 29, 29, 0.35) !important;
}

html.dark-theme .cell-history-body .cell-history-empty,
html.dark-theme .cell-history-loading {
  color: #8C8C8C !important;
}
html.dark-theme .cell-history-item {
  border-color: #3E3E3E !important;
}
html.dark-theme .cell-history-meta {
  color: #8C8C8C !important;
}
html.dark-theme .cell-history-act {
  color: #A3A3A3 !important;
}
html.dark-theme .cell-history-bind .cell-history-act {
  color: #4ade80 !important;
}
html.dark-theme .cell-history-unbind .cell-history-act {
  color: #fbbf24 !important;
}
html.dark-theme .cell-history-order {
  color: #93c5fd !important;
}
html.dark-theme .cell-history-detail {
  color: #A3A3A3 !important;
}
html.dark-theme .cell-history-by {
  color: #6b7280 !important;
}

html.dark-theme .order-api-missing-banner {
  background: rgba(120, 53, 15, 0.35) !important;
  border-color: #78350f !important;
  color: #fcd34d !important;
}

html.dark-theme .order-selection-actions .btn-outline-sm {
  background: #333333 !important;
  border-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}
html.dark-theme .cells-manage-input {
  background: #333333 !important;
  border-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}

html.dark-theme .sorted-orders-section {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .sorted-order-chip {
  background: rgba(255, 79, 71, 0.3) !important;
  border-color: #FF4F47 !important;
  color: #FF4F47 !important;
}

html.dark-theme .sorted-order-chip.locked {
  background: #333333 !important;
  border-color: #4A4A4A !important;
  color: #8C8C8C !important;
}

html.dark-theme .barcode-footer,
html.dark-theme .packing-orders-bar {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .packing-orders-bar h4 {
  color: #8C8C8C !important;
}

html.dark-theme .packing-order-chip {
  background: rgba(8, 37, 103, 0.3) !important;
  border-color: #082567 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .packing-order-chip.packed {
  background: rgba(2, 89, 15, 0.3) !important;
  border-color: #02590F !important;
  color: #01826B !important;
}

html.dark-theme .order-card-overlay {
  background: rgba(0, 0, 0, 0.58) !important;
}

html.dark-theme .order-card-full {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .order-card-body,
html.dark-theme .order-card-photo-wrap {
  background: #2E2E2E !important;
}

html.dark-theme .packing-print-frame-host {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

html.dark-theme .packing-print-frame-toolbar {
  background: #252525 !important;
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .packing-print-frame {
  background: #1a1a1a !important;
}

/* assembly: Ячейка A1 в карточке заказа — контрастный текст */
html.dark-theme .order-card-cell {
  background: #059669 !important;
  color: #ecfdf5 !important;
  border: 1px solid #10b981 !important;
}

html.dark-theme .composition-list li {
  border-color: #3E3E3E !important;
}

html.dark-theme .composition-list li.scanned {
  background: rgba(2, 89, 15, 0.2) !important;
  color: #01826B !important;
}

/* ========== ФАЙЛЫ — серые разделы, тёмная зона загрузки ========== */
html.dark-theme .sec-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .sec-row:hover {
  background: #333333 !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .sec-row.selected {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .cat-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  border-left-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}

html.dark-theme .cat-row:hover,
html.dark-theme .cat-row.selected {
  background: #333333 !important;
}

html.dark-theme .file-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .file-row:hover {
  background: #333333 !important;
}

html.dark-theme .file-name {
  color: #A3A3A3 !important;
}

html.dark-theme .file-meta {
  color: #8C8C8C !important;
}

html.dark-theme .upload-zone {
  background: #2E2E2E !important;
  border: 2px dashed #4A4A4A !important;
  color: #8C8C8C !important;
}

html.dark-theme .upload-zone:hover,
html.dark-theme .upload-zone.dragover {
  background: #333333 !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .preview-area {
  background: #2E2E2E !important;
}

/* ========== СКЛАД — как конфигуратор, убрать белый фон ========== */
html.dark-theme .warehouse-layout,
html.dark-theme body:has(.warehouse-layout),
html.dark-theme .warehouse-layout .main-content {
  background: #171717 !important;
}

html.dark-theme .warehouse-layout .warehouse-inner-bar,
html.dark-theme .warehouse-layout .top-bar {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .warehouse-layout .warehouse-inner-bar h2,
html.dark-theme .warehouse-layout .top-bar h2 {
  color: #A3A3A3 !important;
}

html.dark-theme .warehouse-layout .card,
html.dark-theme .warehouse-panel-left .card,
html.dark-theme .warehouse-panel-right .card,
html.dark-theme .warehouse-layout .content-area,
html.dark-theme .warehouse-layout .stem-content-area {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .warehouse-layout .sec-row,
html.dark-theme .warehouse-layout .cat-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .warehouse-layout .sec-row:hover,
html.dark-theme .warehouse-layout .sec-row.selected,
html.dark-theme .warehouse-layout .cat-row:hover,
html.dark-theme .warehouse-layout .cat-row.selected {
  background: #333333 !important;
}

html.dark-theme .warehouse-layout .card .table-wrap,
html.dark-theme .warehouse-layout table,
html.dark-theme .warehouse-layout th,
html.dark-theme .warehouse-layout td {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .warehouse-layout th {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .warehouse-layout tr:hover {
  background: #333333 !important;
}

html.dark-theme .warehouse-layout .cat-row-parent,
html.dark-theme .warehouse-layout .cat-row-sub {
  background: #2E2E2E !important;
  border-left-color: #4A4A4A !important;
}

html.dark-theme .warehouse-layout .cat-row-parent.cat-row-selected,
html.dark-theme .warehouse-layout .cat-row-sub.cat-row-selected {
  background: #333333 !important;
}

/* ========== ПОСЕЩАЕМОСТЬ — тёмные дни в календаре ========== */
/* Квадратики дней — хорошо видимые, контрастная рамка */
html.dark-theme .calendar-day {
  background: #3E3E3E !important;
  color: #A3A3A3 !important;
  border: 1px solid #4A4A4A !important;
}

html.dark-theme .calendar-day.empty {
  background: #2E2E2E !important;
  border: 1px solid #4A4A4A !important;
  color: #8C8C8C !important;
}

html.dark-theme .calendar-day.weekend {
  background: #333333 !important;
  color: #FF4F47 !important;
}

html.dark-theme .calendar-day.today {
  border: 2px solid #082567 !important;
  background: rgba(8, 37, 103, 0.3) !important;
  color: #A3A3A3 !important;
}

html.dark-theme .calendar-day.has-attendance {
  background: rgba(2, 89, 15, 0.5) !important;
  color: #01826B !important;
}

html.dark-theme .calendar-day.partial,
html.dark-theme .calendar-day.type-late {
  background: rgba(255, 157, 20, 0.4) !important;
  color: #FF9D14 !important;
}

html.dark-theme .calendar-day.type-absent {
  background: rgba(255, 79, 71, 0.4) !important;
  color: #FF4F47 !important;
}

html.dark-theme .calendar-day.type-leave {
  background: rgba(8, 37, 103, 0.4) !important;
  color: #A3A3A3 !important;
}

html.dark-theme .calendar-day.type-sick {
  background: rgba(255, 79, 71, 0.3) !important;
  color: #FF4F47 !important;
}

html.dark-theme .calendar-day.type-dayoff {
  background: #333333 !important;
  color: #8C8C8C !important;
}

html.dark-theme .calendar-weekday {
  color: #8C8C8C !important;
}

html.dark-theme .day-detail {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .attendance-calendar .card,
html.dark-theme #calendarContainer,
html.dark-theme .left-col .card,
html.dark-theme .right-col .card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .main-layout {
  background: #171717 !important;
}

/* ========== ОТМЕТКА ПРИХОДА/УХОДА (attendance-scan) ========== */
html.dark-theme body[data-page-title*="Сканирование"],
html.dark-theme body[data-page-title*="посещаемости"] {
  background: #171717 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .scan-section {
  background: #171717 !important;
}

html.dark-theme .scan-card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .scan-card h1 {
  color: #A3A3A3 !important;
}

html.dark-theme .scan-card p {
  color: #8C8C8C !important;
}

html.dark-theme .scan-bar-bottom {
  background: #2E2E2E !important;
  border-color: #02590F !important;
}

html.dark-theme .scan-bar-bottom input {
  background: #333333 !important;
  border-color: #02590F !important;
  color: #A3A3A3 !important;
}

html.dark-theme .scan-result.ok {
  background: rgba(2, 89, 15, 0.3) !important;
  color: #01826B !important;
  border-color: #02590F !important;
}

html.dark-theme .scan-result.err {
  background: rgba(255, 79, 71, 0.3) !important;
  color: #FF4F47 !important;
  border-color: #FF4F47 !important;
}

html.dark-theme .scan-result.warn {
  background: rgba(234, 179, 8, 0.25) !important;
  color: #fde047 !important;
  border-color: rgba(234, 179, 8, 0.6) !important;
}

html.dark-theme .scan-result.wait {
  background: rgba(255, 157, 20, 0.3) !important;
  color: #FF9D14 !important;
  border-color: #FF9D14 !important;
}

/* ========== ПРИЁМКА НА СКЛАД ========== */
html.dark-theme .receiving-page {
  background: #171717 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .receiving-scan-section,
html.dark-theme .receiving-search-section,
html.dark-theme .receiving-history-section {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .receipt-history-list {
  background: #333333 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .receipt-log-item {
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .receipt-log-item strong {
  color: #A3A3A3 !important;
}

html.dark-theme .receipt-log-meta {
  color: #8C8C8C !important;
}

html.dark-theme .receipt-history-empty {
  color: #8C8C8C !important;
}

html.dark-theme .receiving-section-title {
  color: #A3A3A3 !important;
}

html.dark-theme .receiving-hint,
html.dark-theme .search-placeholder {
  color: #8C8C8C !important;
}

html.dark-theme .wr-qty-unit-suffix {
  color: #34d399 !important;
}

html.dark-theme #stem-page-boot-overlay {
  background: rgba(0, 0, 0, 0.94) !important;
}

html.dark-theme #stem-page-boot-overlay .stem-boot-spinner {
  border-color: #404040 !important;
  border-top-color: #34d399 !important;
}

html.dark-theme #stem-page-boot-overlay .stem-boot-label {
  color: #a3a3a3 !important;
}

html.dark-theme .wr-stock-preview {
  color: #a7f3d0 !important;
}

html.dark-theme .wr-stock-preview strong {
  color: #6ee7b7 !important;
}

/* Выше html.dark-theme input[type="number"] и .btn-outline (полная рамка 2px, как у select) */
html.dark-theme body.receiving-page .wr-qty-step-wrap input.wr-qty-input-match-select[type="number"] {
  background: #333333 !important;
  border: 2px solid #02590F !important;
  color: #A3A3A3 !important;
}

html.dark-theme body.receiving-page .wr-qty-step-wrap input.wr-qty-input-match-select[type="number"]:focus {
  border-color: #01826B !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(1, 130, 107, 0.25) !important;
}

html.dark-theme body.receiving-page .wr-qty-step-wrap .btn.wr-qty-step-btn {
  background: #333333 !important;
  border: 2px solid #02590F !important;
  color: #34d399 !important;
}

html.dark-theme body.receiving-page .wr-qty-step-wrap .btn.wr-qty-step-btn:hover {
  background: #3a3a3a !important;
  border-color: #01826B !important;
  color: #6ee7b7 !important;
}

html.dark-theme .receiving-scan-input,
html.dark-theme .receiving-search-input {
  background: #333333 !important;
  border-color: #02590F !important;
  color: #A3A3A3 !important;
}

html.dark-theme .receiving-scan-input:focus,
html.dark-theme .receiving-search-input:focus {
  border-color: #01826B !important;
  box-shadow: 0 0 0 3px rgba(1, 130, 107, 0.25) !important;
}

html.dark-theme .camera-btn {
  background: #02590F !important;
}

html.dark-theme .camera-btn:hover {
  background: #01826B !important;
}

html.dark-theme .item-found-block {
  background: rgba(2, 89, 15, 0.2) !important;
  border-color: #02590F !important;
}

html.dark-theme .item-found-info {
  color: #01826B !important;
}

html.dark-theme .qty-input {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .search-result-item {
  border-bottom-color: #3E3E3E !important;
}

html.dark-theme .sr-name {
  color: #A3A3A3 !important;
}

html.dark-theme .sr-sku {
  color: #8C8C8C !important;
}

html.dark-theme .sr-section {
  background: #3E3E3E !important;
  color: #8C8C8C !important;
}

html.dark-theme .receiving-bar-bottom {
  background: #2E2E2E !important;
  border-color: #02590F !important;
}

html.dark-theme .receiving-bar-bottom input {
  background: #333333 !important;
  border-color: #02590F !important;
  color: #A3A3A3 !important;
}

/* ========== АНАЛИТИКА — как конфигуратор ========== */
html.dark-theme .analytics-layout .card,
html.dark-theme .analytics-layout .section-panel .card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .analytics-layout .entity-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

/* ========== НАСТРОЙКИ, РАЗДЕЛЫ ЗАДАНИЙ, ЭТИКЕТКИ, API, ЛОГИ ========== */
html.dark-theme .settings-page,
html.dark-theme #settingsContent {
  background: #171717 !important;
  color: #A3A3A3 !important;
}

html.dark-theme .settings-section .card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .settings-table-wrap,
html.dark-theme .settings-card .card-body {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

/* Настройка системы — карточка дефолтной темы, селекты, список меню */
html.dark-theme #settings-section-system-setup .settings-desc,
html.dark-theme #settings-section-system-setup .checkbox-row span {
  color: #8C8C8C !important;
}

html.dark-theme #settings-section-system-setup label {
  color: #A3A3A3 !important;
}

html.dark-theme #settings-section-system-setup select {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme #systemDefaultThemeCard {
  background: #252525 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme #systemDefaultThemeCard p {
  color: #616161 !important;
}

html.dark-theme #settings-section-system-setup .system-section-label-input {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme #settings-section-system-setup .system-menu-struct-hint {
  color: #616161 !important;
}

html.dark-theme .system-menu-editor-group > .system-menu-editor-group-label {
  color: #94a3b8;
}

html.dark-theme .system-page-order-row--page {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .system-page-order-row--section {
  background: #262626 !important;
  border-color: #4A4A4A !important;
  border-left-color: #5b6b8a !important;
}

html.dark-theme .system-page-order-row--divider {
  background: #1f1f1f !important;
  border-color: #3a3a3a !important;
  border-left: 3px dashed #5c5c5c !important;
}

html.dark-theme .system-page-order-row--divider .system-page-order-label {
  color: #8C8C8C !important;
}

html.dark-theme .system-page-order-row--block {
  background: #1a2e2a !important;
  border-color: #2d4a42 !important;
  border-left-color: #01826B !important;
}

html.dark-theme .system-page-order-kind {
  background: #3E3E3E !important;
  color: #8C8C8C !important;
}

html.dark-theme .system-page-order-kind--page {
  background: #082567 !important;
  color: #b4c5e8 !important;
}

html.dark-theme .system-page-order-row--section .system-page-order-kind,
html.dark-theme .system-page-order-row--divider .system-page-order-kind {
  background: #333333 !important;
  color: #8C8C8C !important;
}

html.dark-theme .system-page-order-row--block .system-page-order-kind {
  background: #0d3d32 !important;
  color: #6ee7b7 !important;
}

html.dark-theme .system-page-order-title {
  color: #A3A3A3 !important;
}

html.dark-theme .system-page-order-grip {
  color: #616161 !important;
}

html.dark-theme .system-role-matrix-legend {
  background: #262626 !important;
  border-color: #3a3a3a !important;
  color: #a3a3a3 !important;
}
html.dark-theme .system-role-matrix-colhead {
  background: #2e2e2e !important;
  border-color: #454545 !important;
  color: #e5e5e5 !important;
}
html.dark-theme .system-role-matrix-cb-label {
  background: #252525 !important;
  border-color: #333 !important;
}
html.dark-theme .system-page-order-role-cells--na .system-role-matrix-cell-na {
  background: #222 !important;
  border-color: #3a3a3a !important;
  color: #525252 !important;
}

/* Разделы заданий — убрать белые зоны */
html.dark-theme body:has(.tasks-conf-content) {
  background: #171717 !important;
}

html.dark-theme .tasks-conf-content,
html.dark-theme .tasks-conf-header {
  background: #171717 !important;
}

html.dark-theme .tasks-conf-title {
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .page-block,
html.dark-theme .tasks-conf-content .subsection-block,
html.dark-theme .tasks-conf-content .section-block {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .section-header {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .tasks-conf-content .section-name {
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .page-row,
html.dark-theme .tasks-conf-content .pages-list {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .subsection-row,
html.dark-theme .tasks-conf-content .top-menu-item {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .tasks-conf-content .icon-picker .icon-opt {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .icon-picker .icon-opt:hover {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .tasks-conf-content .icon-picker .icon-opt.selected {
  background: #333333 !important;
  border-color: #01826B !important;
  color: #A3A3A3 !important;
}

html.dark-theme .tasks-conf-content .checkboxes-wrap {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

/* Кнопки в разделе заданий — тёмные */
html.dark-theme .tasks-conf-content .btn-outline {
  background: #333333 !important;
  color: #A3A3A3 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .tasks-conf-content .btn-outline:hover {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
}

html.dark-theme .page-name {
  color: #A3A3A3 !important;
}

html.dark-theme .labels-page,
html.dark-theme .labels-content {
  background: #171717 !important;
}

html.dark-theme .labels-embedded-bar {
  background: #2e2e2e !important;
  border-color: #3e3e3e !important;
}

html.dark-theme .labels-content .card,
html.dark-theme .label-card,
html.dark-theme .label-editor,
html.dark-theme .label-preview {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .visual-editor {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

/* Этикетки — тёмные кнопки вместо белых */
html.dark-theme .labels-page .btn:not(.btn-primary):not(.btn-success):not(.btn-danger),
html.dark-theme .labels-page .btn-outline {
  background: #333333 !important;
  color: #A3A3A3 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .labels-page .btn-outline:hover {
  background: #3E3E3E !important;
  border-color: #4A4A4A !important;
  color: #A3A3A3 !important;
}

html.dark-theme .labels-page .preview-size-btn {
  background: #333333 !important;
  color: #A3A3A3 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .labels-page .preview-size-btn.active {
  background: #01826B !important;
  color: #fff !important;
  border-color: #01826B !important;
}

html.dark-theme .labels-page .visual-editor-item {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

html.dark-theme #settings-section-api .card,
html.dark-theme #settings-section-logging .card {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .logs-list .log-entry,
html.dark-theme .log-entry {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}

/* Убрать большие белые зоны — общие переопределения */
html.dark-theme .modal,
html.dark-theme .modal-content,
html.dark-theme .modal-body {
  background: #2E2E2E !important;
  color: #A3A3A3 !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .modal-header {
  border-color: #3E3E3E !important;
}

html.dark-theme .modal h2,
html.dark-theme .modal h3 {
  color: #A3A3A3 !important;
}

html.dark-theme .modal-close {
  color: #A3A3A3 !important;
}

/* Конфигуратор entity-row (форма позиции) */
html.dark-theme .entity-row {
  background: #2E2E2E !important;
  border-color: #3E3E3E !important;
}

html.dark-theme .entity-row .entity-label {
  color: #8C8C8C !important;
}

/* Пустые состояния и загрузка */
html.dark-theme .empty,
html.dark-theme .loading,
html.dark-theme .empty-state {
  color: #8C8C8C !important;
  background: transparent !important;
}

html.dark-theme .loading-state {
  color: #8C8C8C !important;
}

/* Формы в модалках */
html.dark-theme .modal .form-group label {
  color: #8C8C8C !important;
}

html.dark-theme .modal input,
html.dark-theme .modal select {
  background: #333333 !important;
  border-color: #3E3E3E !important;
  color: #A3A3A3 !important;
}
