/* ============================================================
   1. RESET И ПЕРЕМЕННЫЕ
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f0f2f5;
    --text: #1e293b;
    --text-heading: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --primary: #1e293b;
    --primary-hover: #334155;
    --primary-text: #ffffff;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --success-text: #16a34a;
    --warning: #eab308;
    --warning-bg: #fefce8;
    --warning-text: #ca8a04;
    --shadow: 0 2px 8px rgba(0,0,0,0.02);
    --shadow-hover: 0 20px 30px -12px rgba(0,0,0,0.08);
    --shadow-card: 0 20px 30px -12px rgba(0,0,0,0.08);
    --logo-gradient-1: #1e293b;
    --logo-gradient-2: #334155;
    --logo-badge-bg: #e8f5e9;
    --logo-badge-text: #2e7d32;
    --modal-overlay: rgba(0,0,0,0.5);
    --toast-bg: #1e293b;
    --toast-text: #ffffff;
    --toggle-bg: #cbd5e1;
    --toggle-active: #22c55e;
    --row-hover: #e3f2fd;        /* светло-голубой */
    --selected-row: #e8f4fd;     /* очень светлый голубой */
    --selected-row-border: #2196f3;  /* синий */
    --btn-outline-hover: #f8fafc;
    --btn-outline-border: #e2e8f0;
    --btn-outline-text: #475569;
    --input-border: #e2e8f0;
    --stat-bg: #f8fafc;
    --stat-badge: #0f172a;
    --logo-stroke: #CBD5E1;
    --logo-runner: #475569;
    --logo-text: #000000;
    --info-bg: #e8f4fd;
    --info-border: #3b82f6;
    --info-text: #1e40af;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --border-light: #1e293b;
    --text: #f1f5f9;
    --text-heading: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #f1f5f9;
    --primary-hover: #ffffff;
    --primary-text: #0f172a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: #451a1a;
    --success: #22c55e;
    --success-bg: #052e16;
    --success-text: #4ade80;
    --warning: #eab308;
    --warning-bg: #451a03;
    --warning-text: #fbbf24;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 20px 30px -12px rgba(0,0,0,0.5);
    --shadow-card: 0 12px 20px -12px rgba(0,0,0,0.4);
    --logo-gradient-1: #f1f5f9;
    --logo-gradient-2: #94a3b8;
    --logo-badge-bg: #052e16;
    --logo-badge-text: #4ade80;
    --modal-overlay: rgba(0,0,0,0.7);
    --toast-bg: #f1f5f9;
    --toast-text: #0f172a;
    --toggle-bg: #475569;
    --toggle-active: #22c55e;
    --row-hover: #1a2e1a;
    --selected-row: #052e16;
    --selected-row-border: #22c55e;
    --btn-outline-hover: #1e293b;
    --btn-outline-border: #475569;
    --btn-outline-text: #94a3b8;
    --input-border: #475569;
    --stat-bg: #1e293b;
    --stat-badge: #f8fafc;
    --logo-stroke: #475569;
    --logo-runner: #94A3B8;
    --logo-text: #FFFFFF;
    --info-bg: #1e3a5f;
    --info-border: #3b82f6;
    --info-text: #93c5fd;
    --summary-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}


/* ============================================================
   2. БАЗОВЫЕ СТИЛИ
   ============================================================ */
body {
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
    padding: 8px 32px 32px 32px;
    color: var(--text);
}

.container { max-width: 1600px; margin: 0 auto; }

.header {
    background: var(--surface);
    border-radius: 0 !important;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 20px 32px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo span:first-child {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Хлебные крошки */
.breadcrumb-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.breadcrumb-home {
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.breadcrumb-home:hover { color: var(--text); }

.breadcrumb-separator {
    color: var(--text-muted);
    user-select: none;
}

.breadcrumb-current {
    position: relative;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.breadcrumb-current:hover { background: var(--surface-hover); }
.breadcrumb-current.open .breadcrumb-arrow { transform: rotate(180deg); }

.breadcrumb-arrow {
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.breadcrumb-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    min-width: 220px;
    padding: 4px 0;
    display: none;
    z-index: 100;
}
.breadcrumb-current.open .breadcrumb-dropdown { display: block; }

.dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-item.active {
    background: var(--success-bg);
    color: var(--success-text);
    font-weight: 600;
}


/* ============================================================
   3. КОМПОНЕНТЫ
   ============================================================ */

/* ----- КНОПКИ ----- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--btn-outline-border);
    color: var(--btn-outline-text);
}
.btn-outline:hover {
    background: var(--btn-outline-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

/* ----- ТЕМА ----- */
.theme-toggle-btn .icon-sun { display: none; color: #eab308; }
.theme-toggle-btn .icon-moon { display: inline; color: #64748b; }
[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle-btn .icon-sun { display: inline; }

.theme-label-dark { display: none; }
[data-theme="dark"] .theme-label-light { display: none; }
[data-theme="dark"] .theme-label-dark { display: inline; }

/* ----- КАРТОЧКИ МОДУЛЕЙ (рабочий стол) ----- */
.dashboard { display: block; }

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    color: var(--text-heading);
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.module-card {
    background: var(--surface);
    border-radius: 28px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid var(--border-light);
    text-align: center;
}
.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: var(--border);
}

.module-icon-svg {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text);
}
.module-card:hover .module-icon-svg {
    animation: gentleBounce 0.3s ease;
}

@keyframes gentleBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.module-title {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 6px;
    color: var(--text-heading);
}
.module-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.add-module {
    border: 2px dashed var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ----- ВКЛАДКИ ----- */
.inner-tabs {
    display: flex;
    gap: 8px;
    background: var(--surface);
    border-radius: 60px;
    padding: 6px;
    margin-bottom: 28px;
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.inner-tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.inner-tab.active {
    background: var(--primary);
    color: var(--primary-text);
}
.inner-tab svg { stroke: currentColor; }

.tab-pane {
    display: none;
    background: var(--surface);
    border-radius: 28px;
    padding: 28px;
    border: 1px solid var(--border-light);
}
.tab-pane.active { display: block; }

/* ----- МЕТРИКИ ----- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 20px;
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.metric-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card);
    background: var(--surface);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 8px 0;
}

.progress-bar {
    background: var(--border);
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
}
.progress-fill {
    background: var(--success);
    height: 100%;
    border-radius: 20px;
}

/* ----- ТОСТЫ ----- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--toast-bg);
    color: var(--toast-text);
    padding: 12px 24px;
    border-radius: 48px;
    z-index: 1100;
    animation: slideIn 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ----- СТАТУСЫ ----- */
.status-active {
    color: var(--success);
    font-weight: 600;
    background: var(--success-bg);
    padding: 4px 10px;
    border-radius: 40px;
    display: inline-block;
    font-size: 0.75rem;
}
.status-archived {
    color: var(--text-muted);
    background: var(--surface-hover);
    padding: 4px 10px;
    border-radius: 40px;
    display: inline-block;
    font-size: 0.75rem;
}

.status-badge {
    padding: 2px 1px;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.status-badge.status-active {
    background: var(--success-bg);
    color: var(--success-text);
}
.status-badge.status-expired {
    background: var(--danger-bg);
    color: var(--danger);
}

.positive {
    color: var(--success-text);
    font-weight: 600;
}
.negative {
    color: var(--danger);
    font-weight: 600;
}

/* ----- ТОГГЛ ----- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    transition: 0.3s;
    border-radius: 34px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
    background-color: var(--toggle-active);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ----- ИКОНКИ ----- */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}
.icon-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.icon-btn-sm {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.icon-btn-sm:hover {
    background: var(--surface);
    transform: translateY(-1px);
}

/* ----- АВАТАР ----- */
.btn-avatar {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}
.btn-avatar:hover {
    background: var(--surface-hover);
    transform: scale(1.05);
}
.btn-avatar:active { transform: scale(0.98); }
.btn-avatar svg { stroke: var(--text-secondary); }
.btn-avatar:hover svg { stroke: var(--text); }
.btn-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ----- МОДАЛЬНЫЕ ОКНА ----- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
.modal.active { display: flex !important; }

.modal-content {
    background: var(--surface);
    border-radius: 28px;
    padding: 28px;
    max-width: 500px;
    width: 90%;
    animation: modalFadeIn 0.2s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px 14px;
    margin: 4px 0 0 0;
    border: 1px solid var(--input-border);
    border-radius: 16px;
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text);
}

/* ----- ФОРМЫ ----- */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.form-group {
    flex: 1;
    min-width: 150px;
    padding: 0 8px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.form-group input { display: block; width: 100%; }

input, select, textarea {
    border-radius: 16px;
    border: 1px solid var(--input-border);
    padding: 10px 14px;
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text);
}

.form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----- КАСТОМНЫЙ DROPDOWN ----- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    border: 1px solid var(--input-border);
    border-radius: 16px;
    padding: 10px 14px;
    background: var(--surface);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text);
    transition: border-color 0.2s;
	gap: 12px;
}
.custom-select-trigger:hover { border-color: var(--text-muted); }

.arrow {
    border: solid var(--text-secondary);
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    transition: transform 0.2s;
}
.custom-select-wrapper.open .arrow { transform: rotate(-135deg); }

.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    display: none;
    list-style: none;
    padding: 4px 0 0 0;
    margin: 0;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}
.custom-select-wrapper.open .custom-options { display: block; }

.custom-option {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.15s;
}
.custom-option:hover { background: var(--surface-hover); }
.custom-option.selected {
    background: var(--success-bg);
    color: var(--success-text);
    font-weight: 600;
}

.option-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.create-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--surface-hover);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.create-item:hover {
    background: var(--surface);
    transform: translateY(-1px);
}
.create-item:active { transform: translateY(0px); }


/* ============================================================
   4. ТАБЛИЦЫ — УНИВЕРСАЛЬНАЯ СИСТЕМА
   ============================================================ */

/* ----- БАЗОВЫЕ СТИЛИ ДЛЯ ВСЕХ ТАБЛИЦ ----- */
table { 
    width: 100%; 
    border-collapse: collapse; 
}

th, td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}
th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* ----- ОБЁРТКА ТАБЛИЦЫ (горизонтальный скролл) ----- */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    border-radius: 20px;
    max-height: 65vh;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
}
.table-wrapper thead th {
    border-bottom: 2px solid var(--border);
}

/* ====== ОСНОВНАЯ ТАБЛИЦА ====== */
.products-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

/* ====== ЯЧЕЙКИ (БЕЗ ПЕРЕНОСОВ) ====== */
.products-table th,
.products-table td {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    vertical-align: middle;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* ====== ЗАГОЛОВКИ ====== */
.products-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    background: var(--surface);
    position: relative;
    white-space: nowrap;
    /* padding НЕ ДОБАВЛЯЙ! */
}

/* ----- СТРУКТУРА ЗАГОЛОВКА ----- */
.products-table th .th-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.products-table th .th-text {
    white-space: nowrap;
}

/* ----- КОНТЕЙНЕР ИКОНОК ----- */
.products-table th .table-icons-container {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    min-width: 0;           /* ← по умолчанию без места */
    width: auto;            /* ← ширина по содержимому */
    justify-content: flex-start;
    transition: min-width 0.2s ease;
}

/* Когда есть активная сортировка — расширяем контейнер */
.products-table th.sort-active .table-icons-container {
    min-width: 32px;        /* ← появляется место для иконки сортировки */
}

/* ----- ИКОНКИ ----- */
.products-table th .sort-icon,
.products-table th .filter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Иконка сортировки */
.products-table th .sort-icon {
    width: 14px;
    height: 14px;
}

/* Показываем иконку сортировки только когда активна */
.products-table th.sort-active .sort-icon {
    opacity: 1;
}

/* Иконка фильтра */
.products-table th .filter-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Показываем фильтр при наведении или когда активен */
.products-table th[data-column]:hover .filter-icon,
.products-table th .filter-icon.filter-active {
    opacity: 1;
}

/* ============================================================
   4.1 ТАБЛИЦА ТОВАРОВ (#productsTable)
   ============================================================ */

/* select — узкий */
#productsTable th:first-child,
#productsTable td:first-child {
    width: 1%;
    min-width: 30px;
    max-width: 40px;
    white-space: nowrap;
    text-align: center;
}

/* Название — может переноситься */
#productsTable th:nth-child(2),
#productsTable td:nth-child(2) {
    min-width: 120px;
    max-width: 300px;
    text-align: left;
}

#productsTable td:nth-child(2) {
    white-space: normal !important;
    word-break: break-word;
}

/* Артикул */
#productsTable th:nth-child(3),
#productsTable td:nth-child(3) {
    min-width: 80px;
    max-width: 180px;
    text-align: left;
}

/* Категория */
#productsTable th:nth-child(4),
#productsTable td:nth-child(4) {
    min-width: 80px;
    max-width: 200px;
    text-align: left;
}

/* Числовые колонки — по центру */
#productsTable th:nth-child(5),
#productsTable td:nth-child(5),
#productsTable th:nth-child(6),
#productsTable td:nth-child(6),
#productsTable th:nth-child(7),
#productsTable td:nth-child(7),
#productsTable th:nth-child(8),
#productsTable td:nth-child(8),
#productsTable th:nth-child(9),
#productsTable td:nth-child(9),
#productsTable th:nth-child(10),
#productsTable td:nth-child(10) {
    min-width: 60px;
    max-width: 100px;
    text-align: center;
}

/* Описание — может переноситься */
#productsTable th:nth-child(11),
#productsTable td:nth-child(11) {
    min-width: 80px;
    max-width: 200px;
    text-align: left;
}

#productsTable td:nth-child(11) {
    white-space: normal !important;
    word-break: break-word;
}

/* Статус — по центру */
#productsTable th:nth-child(12),
#productsTable td:nth-child(12) {
    min-width: 80px;
    max-width: 120px;
    white-space: nowrap;
    text-align: center;
}

/* toggle — рядом со статусом */
#productsTable .toggle-cell {
    width: 1%;
    min-width: 50px;
    max-width: 60px;
    text-align: center;
    white-space: nowrap;
}

/* действия — компактно */
#productsTable .actions-cell {
    width: 1%;
    min-width: 70px;
    max-width: 90px;
    white-space: nowrap;
    text-align: center;
}

#productsTable .actions-cell .row-actions {
    opacity: 0 !important;
    display: flex;
    gap: 2px;
    justify-content: center;
}

#productsTable tbody tr:hover .actions-cell .row-actions {
    opacity: 1 !important;
}

#productsTable .actions-cell .row-actions .icon-btn {
    padding: 4px;
    width: 28px;
    height: 28px;
}

#productsTable .actions-cell .row-actions .icon-btn svg {
    width: 14px;
    height: 14px;
}

/* Описание */
#productsTable .description-cell {
    max-width: 200px;
    white-space: normal;
    word-break: break-word;
    text-align: left;
}


/* ============================================================
   4.2 ТАБЛИЦА КОМПЛЕКТОВ (#kitsTable)
   ============================================================ */

#kitsTable th,
#kitsTable td {
    padding: 6px 12px;
}

#kitsTable th:first-child,
#kitsTable td:first-child {
    width: 1%;
    min-width: 30px;
    max-width: 40px;
    text-align: center;
}

#kitsTable th:nth-child(2),
#kitsTable td:nth-child(2) {
    min-width: 70px;
    max-width: 120px;
    text-align: left;
}

#kitsTable th:nth-child(3),
#kitsTable td:nth-child(3) {
    min-width: 120px;
    max-width: 300px;
    text-align: left;
}

#kitsTable td:nth-child(3) {
    white-space: normal !important;
    word-break: break-word;
}

#kitsTable th:nth-child(4),
#kitsTable td:nth-child(4) {
    min-width: 80px;
    max-width: 200px;
    text-align: left;
}

#kitsTable th:nth-child(5),
#kitsTable td:nth-child(5) {
    min-width: 80px;
    max-width: 120px;
    white-space: nowrap;
    text-align: center;
}

#kitsTable th:nth-child(6),
#kitsTable td:nth-child(6) {
    width: 1%;
    min-width: 50px;
    max-width: 60px;
    text-align: center;
}

#kitsTable th:nth-child(7),
#kitsTable td:nth-child(7) {
    width: 1%;
    min-width: 70px;
    max-width: 90px;
    white-space: nowrap;
    text-align: center;
}

#kitsTable td:nth-child(7) .row-actions {
    opacity: 0 !important;
    display: flex;
    gap: 2px;
    justify-content: center;
}

#kitsTable tbody tr:hover td:nth-child(7) .row-actions {
    opacity: 1 !important;
}

#kitsTable td:nth-child(7) .row-actions .icon-btn {
    padding: 4px;
    width: 28px;
    height: 28px;
}

#kitsTable td:nth-child(7) .row-actions .icon-btn svg {
    width: 14px;
    height: 14px;
}


/* ============================================================
   4.3 ТАБЛИЦА ОСТАТКОВ (#stocksTable)
   ============================================================ */

#stocksTable th,
#stocksTable td {
    padding: 6px 12px;
}

#stocksTable td.product-name-cell {
    white-space: normal !important;
    word-break: break-word;
    max-width: 250px;
}


/* ============================================================
   4.4 ТАБЛИЦА ПРОДАЖ (#salesTable)
   ============================================================ */

#salesTable th,
#salesTable td {
    padding: 6px 12px !important;
}


/* ============================================================
   4.5 ТАБЛИЦА ПОСТУПЛЕНИЙ (#suppliesTable)
   ============================================================ */

#suppliesTable th,
#suppliesTable td {
    padding: 6px 12px;
}

#suppliesTable th:first-child,
#suppliesTable td:first-child {
    width: 1%;
    min-width: 30px;
    max-width: 40px;
    text-align: center;
}

#suppliesTable th:nth-child(2),
#suppliesTable td:nth-child(2) {
    min-width: 80px;
    max-width: 140px;
    text-align: left;
}

#suppliesTable th:nth-child(3),
#suppliesTable td:nth-child(3) {
    min-width: 80px;
    max-width: 120px;
    text-align: left;
}

#suppliesTable th:nth-child(4),
#suppliesTable td:nth-child(4),
#suppliesTable th:nth-child(5),
#suppliesTable td:nth-child(5) {
    min-width: 100px;
    max-width: 220px;
    text-align: left;
}

#suppliesTable th:nth-child(6),
#suppliesTable td:nth-child(6) {
    min-width: 80px;
    max-width: 140px;
    text-align: right;
}

#suppliesTable th:nth-child(7),
#suppliesTable td:nth-child(7) {
    width: 1%;
    min-width: 70px;
    max-width: 90px;
    white-space: nowrap;
    text-align: center;
}

#suppliesTable td:nth-child(7) .row-actions {
    opacity: 0 !important;
    display: flex;
    gap: 2px;
    justify-content: center;
}

#suppliesTable tbody tr:hover td:nth-child(7) .row-actions {
    opacity: 1 !important;
}

#suppliesTable td:nth-child(7) .row-actions .icon-btn {
    padding: 4px;
    width: 28px;
    height: 28px;
}

#suppliesTable td:nth-child(7) .row-actions .icon-btn svg {
    width: 14px;
    height: 14px;
}


/* ============================================================
   4.6 ТАБЛИЦА ЗАКАЗОВ (#ordersTable)
   ============================================================ */

#ordersTable td:nth-child(4) {
    max-width: 250px;
    min-width: 150px;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}


/* ============================================================
   5. КОМПОНЕНТЫ ТУЛБАРОВ И ЭКШЕНОВ
   ============================================================ */
.products-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.products-actions-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.export-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.categories-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 8px;
}
.categories-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 4px 12px;
    background: var(--stat-bg);
    border-radius: 40px;
    transition: all 0.2s;
}
.stat-item:hover { background: var(--surface-hover); }
.stat-badge {
    font-weight: 700;
    color: var(--stat-badge);
}

.remains-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.remains-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.remains-toolbar-buttons {
    display: flex;
    gap: 8px;
}

.selected-row {
    background: var(--selected-row);
}

/* ============================================================
   6. КАРТОЧКА-СВОДКА
   ============================================================ */
/* ============================================================
   КАРТОЧКИ-СВОДКИ (с hover-эффектом)
   ============================================================ */

.summary-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 16px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.10), 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    width: fit-content;
    max-width: 100%;
    min-width: 280px;
    cursor: default;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--border);
}

[data-theme="dark"] .summary-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.summary-card__title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.summary-card__items {
    display: flex;
    gap: 48px;
    align-items: center;
}

.summary-card__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 70px;
}

.summary-card__item:not(:last-child) {
    padding-right: 48px;
    border-right: 1px solid var(--border-light);
}

/* ====== ЦИФРЫ (ОДИНАКОВАЯ ВЫСОТА) ====== */
.summary-card__value {
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== АКТИВНЫЕ И ЗАКРЫТЫЕ — МЕНЬШЕ ====== */
.summary-card__item--active .summary-card__value,
.summary-card__item--closed .summary-card__value {
    font-size: 1.2rem;
    font-weight: 600;
    position: relative;
    top: 0.3rem;
}

/* ====== ПОДПИСИ (ОДИНАКОВАЯ ВЫСОТА) ====== */
.summary-card__label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====== ЦВЕТА ====== */
.summary-card__item--active .summary-card__value {
    color: var(--success-text);
}
.summary-card__item--closed .summary-card__value {
    color: var(--text-muted);
}
.summary-card__item--total .summary-card__value {
    color: var(--text-heading);
}

/* ====== АДАПТИВ ====== */
@media (max-width: 768px) {
    .summary-card {
        padding: 16px;
    }
    
    .summary-card__items {
        gap: 20px;
        flex-wrap: wrap;
    }
    
    .summary-card__item:not(:last-child) {
        padding-right: 20px;
    }
    
    .summary-card__value {
        font-size: 1.4rem;
        height: 1.8rem;
    }
    
    .summary-card__item--active .summary-card__value,
    .summary-card__item--closed .summary-card__value {
        font-size: 1.0rem;
    }
}


/* ============================================================
   7. МОДУЛИ (страницы/разделы)
   ============================================================ */

/* ----- ЛИЧНЫЙ КАБИНЕТ ----- */
.settings-card {
    background: var(--surface);
    border-radius: 28px;
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
    overflow: hidden;
}
.settings-card input,
.settings-card select,
.settings-card textarea { border-radius: 16px; }

.card-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.card-header-left h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0;
}

.card-body { padding: 24px 28px; }

.profile-photo {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.avatar {
    width: 80px;
    height: 80px;
    background: var(--surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid var(--border);
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-secondary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
}
.radio-item input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-heading);
}

/* ----- ТОКЕНЫ ----- */
.token-card {
    background: var(--surface-hover);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 16px;
    transition: all 0.2s;
}
.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.token-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}
.token-actions { display: flex; gap: 8px; }

.token-secret {
    font-family: monospace;
    font-size: 0.75rem;
    background: var(--surface);
    padding: 10px 12px;
    border-radius: 16px;
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    word-break: break-all;
}
.token-secret code,
.token-secret input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: monospace;
    font-size: 0.75rem;
    outline: none;
}
.token-secret input {
    border-bottom: 1px dashed var(--border);
    padding: 4px 0;
}

.token-info {
    font-size: 0.75rem;
    color: var(--text);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.token-info span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.token-info-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}
.info-icon {
    flex-shrink: 0;
    color: var(--text-muted);
    width: 14px;
    height: 14px;
}
.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    /* min-width убран */
}
.info-value {
    color: var(--text);
    font-weight: 500;
}
.info-value.expiring-soon {
    color: var(--warning-text);
    font-weight: 600;
}
.info-value.expired {
    color: var(--danger);
    font-weight: 600;
}

.token-link {
    margin-top: 8px;
    font-size: 0.7rem;
}
.token-link a {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}
.token-link a:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.btn-add {
    background: transparent;
    border: 1px dashed var(--border);
    width: 100%;
    padding: 12px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 8px;
}
.btn-add:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

/* ----- МАРКЕТЫ ----- */
.market-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    justify-content: center;
    flex-wrap: wrap;
}
.market-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 32px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
}
.market-tab:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: var(--primary);
}
.market-tab.active {
    border-color: var(--primary);
    background: var(--surface-hover);
}
.market-tab-logo svg {
    width: 48px;
    height: 48px;
}
.market-tab-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.section-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--surface);
    border-radius: 60px;
    padding: 6px;
    border: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.section-tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.section-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.section-tab.active {
    background: var(--primary);
    color: var(--primary-text);
}
.section-tab svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.section-pane {
    display: none;
    background: var(--surface);
    border-radius: 28px;
    padding: 28px;
    border: 1px solid var(--border-light);
}
.section-pane.active { display: block; }

.mapped-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 40px;
    background: var(--success-bg);
}


/* ============================================================
   8. ДЕТАЛИ ЗАКАЗА (финансовые)
   ============================================================ */
.financial-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}
.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.detail-value.positive { color: var(--success-text); }
.detail-value.negative { color: var(--danger); }

.detail-row.total {
    border-top: 2px solid var(--border);
    border-bottom: none;
    margin-top: 4px;
    padding-top: 12px;
}
.detail-row.total .detail-label {
    font-weight: 700;
    color: var(--text);
}
.detail-row.total .detail-value {
    font-size: 1rem;
}

.financial-summary {
    background: var(--surface-hover);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.financial-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}
.financial-card .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.financial-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}
.financial-card .value.positive { color: var(--success-text); }
.financial-card .value.negative { color: var(--danger); }


/* ============================================================
   9. ПЕРЕОПРЕДЕЛЕНИЯ
   ============================================================ */

/* ====== МОДАЛКА КОМПЛЕКТОВ ====== */
#kitFormModal .modal-content {
    max-width: 750px;
}

#kitFormModal .table-wrapper {
    max-height: 250px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
}

#kitFormModal .products-table {
    min-width: auto !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

#kitFormModal .products-table th,
#kitFormModal .products-table td {
    padding: 8px 6px !important;
    font-size: 0.85rem !important;
    white-space: normal !important;
    word-break: break-word !important;
}

#kitFormModal .products-table thead th {
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
}

#kitFormModal .products-table th:nth-child(1),
#kitFormModal .products-table td:nth-child(1) {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    text-align: center !important;
}

#kitFormModal .products-table th:nth-child(2),
#kitFormModal .products-table td:nth-child(2) {
    max-width: 300px !important;
    word-break: break-word !important;
}

#kitFormModal .products-table th:nth-child(3),
#kitFormModal .products-table td:nth-child(3) {
    width: 100px !important;
    min-width: 60px !important;
    max-width: 100px !important;
    text-align: center !important;
}

#kitFormModal .products-table th:nth-child(4),
#kitFormModal .products-table td:nth-child(4) {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    text-align: center !important;
}

#kitFormModal .products-table tbody tr:hover {
    background: var(--surface-hover) !important;
}

#kitFormModal .products-table tbody tr:nth-child(even) {
    background: transparent !important;
}


/* ====== МОДАЛКА ПОСТУПЛЕНИЯ ====== */
#supplyItemsContainer {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
}

#supplyItemsTable {
    width: 100% !important;
    border-collapse: collapse !important;
}

#supplyItemsTable thead {
    position: sticky !important;
    top: 0 !important;
    background: var(--surface) !important;
    z-index: 1 !important;
}

#supplyItemsTable thead th {
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
}

#supplyItemsTable td,
#supplyItemsTable th {
    padding: 6px 8px !important;
    font-size: 0.85rem !important;
}


/* ====== МОДАЛКА ДОБАВЛЕНИЯ ИНТЕГРАЦИИ ====== */
#addMarketModal .modal-options {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin: 16px 0 !important;
}

#addMarketModal .modal-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    cursor: pointer !important;
    font-size: 0.95rem !important;
    padding: 4px 0 !important;
}

#addMarketModal .modal-option input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: var(--primary) !important;
    transform: none !important;
}

#addMarketModal input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}


/* ====== ГЛОБАЛЬНЫЕ СТИЛИ ДЛЯ ЧЕКБОКСОВ ====== */
.products-table input[type="checkbox"] {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: var(--primary) !important;
}

.products-table tbody tr:hover input[type="checkbox"] {
    transform: none !important;
    width: 14px !important;
    height: 14px !important;
}

input[type="checkbox"]:not(.products-table input[type="checkbox"]) {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    flex-shrink: 0 !important;
    margin: 0 4px 0 0 !important;
    padding: 0 !important;
    accent-color: var(--primary) !important;
    transform: none !important;
}

input[type="checkbox"]:not(.products-table input[type="checkbox"]):hover {
    transform: none !important;
    width: 16px !important;
    height: 16px !important;
}

.radio-group input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    flex-shrink: 0 !important;
    margin: 0 4px 0 0 !important;
    padding: 0 !important;
    accent-color: var(--primary) !important;
    transform: none !important;
}

.radio-group input[type="radio"]:hover {
    transform: none !important;
    width: 16px !important;
    height: 16px !important;
}


/* ============================================================
   APPLE-СТИЛЬ СКРОЛЛА
   ============================================================ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.table-wrapper:hover::-webkit-scrollbar-thumb,
.modal-content:hover::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

::-webkit-scrollbar-thumb:active {
    background: rgba(0, 0, 0, 0.5);
}

* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
}

*:hover {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

[data-theme="dark"] .table-wrapper:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] .modal-content:hover::-webkit-scrollbar-thumb,
[data-theme="dark"] *:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] *:hover {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}


/* ============================================================
   ИКОНКИ В ЗАГОЛОВКАХ ТАБЛИЦ
   ============================================================ */
.products-table th[data-column] {
    cursor: pointer;
    user-select: none;
    position: relative;
}


/* ============================================================
   МОДАЛКА ФИЛЬТРА
   ============================================================ */
.filter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.filter-modal {
    background: var(--surface);
    border-radius: 20px;
    min-width: 340px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.2s ease;
}

.filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.filter-modal-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-heading);
}

.filter-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 4px;
    line-height: 1;
}

.filter-modal-close:hover {
    color: var(--text);
}

.filter-modal-body {
    padding: 20px;
}

.filter-modal-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.filter-modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.filter-modal-input:focus {
    border-color: var(--primary);
}

.filter-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 20px;
    border-top: 1px solid var(--border-light);
}

.filter-modal-footer .btn-sm {
    padding: 6px 16px;
    font-size: 0.8rem;
}


/* ============================================================
   КАРТОЧКА-СВОДКА В ТЁМНОЙ ТЕМЕ
   ============================================================ */
[data-theme="dark"] .summary-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    border-color: #334155;
}


/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 768px) {
    body { padding: 16px; }
    .form-row { flex-direction: column; }
    .products-actions { flex-direction: column; align-items: stretch; }
    .products-actions-right { justify-content: flex-start; }
    
    .breadcrumb-wrapper {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        justify-content: center;
        padding-top: 8px;
    }

    .summary-card { padding: 16px; }
    .summary-card__items {
        gap: 20px;
        flex-wrap: wrap;
    }
    .summary-card__item:not(:last-child) {
        padding-right: 20px;
    }
    .summary-card__value {
        font-size: 1.3rem;
    }

    .card-header { flex-direction: column; align-items: flex-start; }
    .token-header { flex-direction: column; align-items: flex-start; }
    .token-secret { flex-direction: column; align-items: stretch; }
    .profile-photo { flex-direction: column; align-items: flex-start; }
    .radio-group { flex-direction: column; gap: 12px; }
    .form-actions { justify-content: center; }

    #ordersTable td:nth-child(4) {
        max-width: 180px;
        min-width: 120px;
    }
}

/* ============================================================
   ЭФФЕКТЫ СТРОК ТАБЛИЦ (ПОДСКОК И ПОДСВЕТКА)
   ============================================================ */

/* ----- HOVER ЭФФЕКТ ДЛЯ ВСЕХ ТАБЛИЦ ----- */
.products-table tbody tr {
    transition: all 0.2s ease;
    cursor: pointer;
}

.products-table tbody tr:hover {
    background: var(--row-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ----- ВЫДЕЛЕНИЕ ВЫБРАННЫХ СТРОК ----- */
.products-table tbody tr.selected-row {
    background: var(--selected-row);
    border-left: 3px solid var(--selected-row-border);
    box-shadow: inset 0 0 0 1px var(--selected-row-border);
}

/* ----- В ТЁМНОЙ ТЕМЕ ----- */
[data-theme="dark"] .products-table tbody tr:hover {
    background: var(--row-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .products-table tbody tr.selected-row {
    background: var(--selected-row);
    border-left: 3px solid var(--selected-row-border);
    box-shadow: inset 0 0 0 1px var(--selected-row-border);
}

/* ============================================================
   ЗАГОЛОВКИ ТАБЛИЦ — HOVER ЭФФЕКТ
   ============================================================ */

.products-table th[data-column] {
    cursor: pointer;
    user-select: none;
    position: relative;
   /* padding-right: 35px !important;*/
    transition: background 0.2s ease;
}

/* Подсветка заголовка при наведении */
.products-table th[data-column]:hover {
    background: var(--surface-hover) !important;
}

/* Активная сортировка — подсветка */
.products-table th[data-column].sort-active {
    background: var(--surface-hover) !important;
}

\/* ============================================================
   ИКОНКА ФИЛЬТРА — УЛУЧШЕННАЯ
   ============================================================ */

/* Иконка фильтра */
.products-table th .filter-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    opacity: 0 !important;
    cursor: pointer !important;
    transition: opacity 0.2s ease, transform 0.15s ease !important;
    color: var(--text-muted) !important;
    pointer-events: auto !important;  /* <- важно для клика */
    z-index: 2 !important;
    position: relative !important;
}

/* Показываем при наведении на заголовок — ярче */
.products-table th[data-column]:hover .filter-icon {
    opacity: 0.7 !important;
    color: var(--text-secondary) !important;
}

/* При наведении на саму иконку — ещё ярче и с увеличением */
.products-table th .filter-icon:hover {
    opacity: 1 !important;
    color: var(--primary) !important;
    transform: scale(1.15) !important;
}

/* Если фильтр активен — показываем всегда, ярко и подсвеченно */
.products-table th .filter-icon.filter-active {
    opacity: 1 !important;
    color: var(--primary) !important;
    transform: scale(1) !important;
}

/* При активном фильтре и наведении */
.products-table th .filter-icon.filter-active:hover {
    transform: scale(1.15) !important;
}

/* Убеждаемся, что иконка кликабельна */
.products-table th .filter-icon svg {
    pointer-events: none !important;
    display: block !important;
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
}

/* ============================================================
   DRAG & DROP — ПЕРЕТАСКИВАНИЕ КОЛОНОК
   ============================================================ */

/* Курсор при наведении на сортируемые колонки */
th[data-column] {
    cursor: grab;
    user-select: none;
}

/* При перетаскивании */
th[data-column].dragging {
    opacity: 0.4;
    cursor: grabbing;
}

/* Подсветка места вставки */
th[data-column].drag-over {
    border-left: 3px solid var(--success);
    border-right: 3px solid var(--success);
    background: var(--success-bg);
    transform: scale(1.02);
    transition: all 0.15s ease;
}

/* В тёмной теме */
[data-theme="dark"] th[data-column].drag-over {
    border-left-color: var(--success);
    border-right-color: var(--success);
    background: var(--success-bg);
}


/* ============================================================
   ФИЛЬТР-ДРОПДАУН (НОВЫЙ)
   ============================================================ */

/* Базовый контейнер дропдауна */
.filter-dropdown {
    display: none;
    position: fixed;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    max-height: 420px;
    z-index: 10000;
    border: 1px solid var(--border);
    animation: dropdownFadeIn 0.15s ease;
    overflow: hidden;
}

.filter-dropdown--open {
    display: block;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Стрелка-носик */
.filter-dropdown__beak {
    position: absolute;
    top: -6px;
    left: 30px;
    width: 12px;
    height: 12px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
    transform: rotate(45deg);
}

/* Заголовок */
.filter-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px 16px;
    border-bottom: 1px solid var(--border-light);
}

.filter-dropdown__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-heading);
}

.filter-dropdown__close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s;
    padding: 0;
}

.filter-dropdown__close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Тело */
.filter-dropdown__body {
    padding: 12px 16px;
}

/* Поле поиска */
.filter-dropdown__search {
    position: relative;
    margin-bottom: 10px;
}

.filter-dropdown__search-input {
    width: 100%;
    padding: 6px 32px 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
    height: 32px;
    background: var(--surface);
    color: var(--text);
}

.filter-dropdown__search-input:focus {
    border-color: var(--primary);
}

.filter-dropdown__search-input::placeholder {
    color: var(--text-muted);
}

.filter-dropdown__search-clear {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.2s;
    display: none;
    color: var(--text-muted);
}

.filter-dropdown__search-clear:hover {
    opacity: 0.8;
}

.filter-dropdown__search-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    opacity: 0.3;
    pointer-events: none;
    color: var(--text-muted);
}

/* Список значений */
.filter-dropdown__items {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 2px 0;
}

.filter-dropdown__items::-webkit-scrollbar {
    width: 4px;
}

.filter-dropdown__items::-webkit-scrollbar-track {
    background: var(--surface-hover);
    border-radius: 3px;
}

.filter-dropdown__items::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.filter-dropdown__items::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Элемент списка */
.filter-dropdown__item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.8rem;
    color: var(--text);
    gap: 6px;
}

.filter-dropdown__item:hover {
    background: var(--surface-hover);
}

.filter-dropdown__item-checkbox {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-dropdown__item-label {
    cursor: pointer;
    user-select: none;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-dropdown__item-count {
    color: var(--text-muted);
    font-size: 0.7rem;
    flex-shrink: 0;
}

/* Пустое состояние */
.filter-dropdown__empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Нижняя панель */
.filter-dropdown__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 6px;
}

.filter-dropdown__exclude {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.filter-dropdown__exclude input[type="checkbox"] {
    width: 13px;
    height: 13px;
    accent-color: var(--primary);
    cursor: pointer;
}

.filter-dropdown__reset {
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    background: transparent;
    font-weight: 500;
    transition: background 0.2s;
}

.filter-dropdown__reset:hover {
    background: var(--surface-hover);
}

/* Кнопки действий */
.filter-dropdown__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.filter-dropdown__actions .btn {
    padding: 4px 16px;
    font-size: 0.8rem;
}

/* Тёмная тема */
[data-theme="dark"] .filter-dropdown {
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .filter-dropdown__beak {
    border-color: var(--border);
}


/* ============================================================
   ВЫРАВНИВАНИЕ В ТАБЛИЦЕ ТОВАРОВ
   ============================================================ */

/* Числовые колонки — по левому краю */
#productsTable td[data-column="length"],
#productsTable td[data-column="width"],
#productsTable td[data-column="height"],
#productsTable td[data-column="weight"],
#productsTable td[data-column="volume"],
#productsTable th[data-column="length"],
#productsTable th[data-column="width"],
#productsTable th[data-column="height"],
#productsTable th[data-column="weight"],
#productsTable th[data-column="volume"] {
    text-align: left !important;
}

/* Статус — по левому краю */
#productsTable td[data-column="status"],
#productsTable th[data-column="status"] {
    text-align: left !important;
}

/* Toggle — по левому краю */
#productsTable td[data-column="toggle"],
#productsTable th[data-column="toggle"] {
    text-align: left !important;
}

/* Action — по левому краю */
#productsTable td[data-column="action"],
#productsTable th[data-column="action"] {
    text-align: left !important;
}

/* Чекбокс (select) — по центру (оставляем как есть) */
#productsTable td[data-column="select"],
#productsTable th[data-column="select"] {
    text-align: center !important;
}

/* Артикул (sku) — по левому краю */
#productsTable td[data-column="sku"],
#productsTable th[data-column="sku"] {
    text-align: left !important;
}


/* ============================================================
   НОВАЯ ТЕХНИКА — СОРТИРОВКА РАЗДВИГАЕТ ФИЛЬТР
   ============================================================ */

/* Иконка сортировки — по умолчанию свёрнута */
.products-table th .sort-icon {
    max-width: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
    margin-right: 0 !important;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.3s ease,
                margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Когда сортировка активна — иконка появляется и раздвигает фильтр */
.products-table th.sort-active .sort-icon {
    max-width: 20px !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin-right: 4px !important;
}

/* Иконка сортировки в состоянии active (asc/desc) */
.products-table th .sort-icon.sort-asc,
.products-table th .sort-icon.sort-desc {
    /* Классы для направления, но стили уже управляются через sort-active */
}

/* ============================================================
   КНОПКИ ДЕЙСТВИЙ — ПОЯВЛЯЮТСЯ ПРИ НАВЕДЕНИИ (ДЛЯ ВСЕХ ТАБЛИЦ)
   ============================================================ */

/* Базовое правило для всех таблиц */
.products-table tbody tr .row-actions {
    opacity: 0 !important;
    display: flex !important;
    gap: 2px;
    transition: opacity 0.2s ease;
}

.products-table tbody tr:hover .row-actions {
    opacity: 1 !important;
}

/* Переопределяем для всех конкретных таблиц */
#stocksTable tbody tr .row-actions,
#suppliersTable tbody tr .row-actions,
#storesTable tbody tr .row-actions,
#kitsTable tbody tr .row-actions,
#salesTable tbody tr .row-actions,
#ordersTable tbody tr .row-actions,
#categoriesTable tbody tr .row-actions,
#suppliesTable tbody tr .row-actions {
    opacity: 0 !important;
}

#stocksTable tbody tr:hover .row-actions,
#suppliersTable tbody tr:hover .row-actions,
#storesTable tbody tr:hover .row-actions,
#kitsTable tbody tr:hover .row-actions,
#salesTable tbody tr:hover .row-actions,
#ordersTable tbody tr:hover .row-actions,
#categoriesTable tbody tr:hover .row-actions,
#suppliesTable tbody tr:hover .row-actions {
    opacity: 1 !important;
}

/* ====== ЗАКАЗЫ В МАРКЕТАХ — КНОПКИ ПОЯВЛЯЮТСЯ ПРИ НАВЕДЕНИИ ====== */
#ordersTable tbody tr .icon-btn {
    opacity: 0 !important;
    transition: opacity 0.2s ease;
}

#ordersTable tbody tr:hover .icon-btn {
    opacity: 1 !important;
}

/* ====== ОТКЛЮЧАЕМ ПОДСВЕТКУ ВЫБРАННЫХ СТРОК ====== */
.products-table tbody tr.selected-row {
    background: transparent !important;
    border-left: none !important;
    box-shadow: none !important;
}


/* ============================================================
   МОДАЛКА ПРОСМОТРА КОМПЛЕКТА (#kitInfoModal)
   ============================================================ */

/* Основные размеры как у #kitFormModal */
#kitInfoModal .modal-content {
    max-width: 750px;
}

/* Таблица в модалке просмотра */
#kitInfoModal .table-wrapper {
    max-height: 250px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    border: none !important;           /* ← Убираем рамку */
    border-radius: 0 !important;       /* ← Убираем скругление */
    background: transparent !important; /* ← Прозрачный фон */
}

#kitInfoModal .products-table {
    min-width: auto !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

#kitInfoModal .products-table th,
#kitInfoModal .products-table td {
    padding: 8px 6px !important;
    font-size: 0.85rem !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Заголовки таблицы — sticky */
#kitInfoModal .products-table thead th {
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
}

/* Колонка № */
#kitInfoModal .products-table th:nth-child(1),
#kitInfoModal .products-table td:nth-child(1) {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    text-align: center !important;
}

/* Колонка Товар */
#kitInfoModal .products-table th:nth-child(2),
#kitInfoModal .products-table td:nth-child(2) {
    max-width: 300px !important;
    word-break: break-word !important;
}

/* Колонка Кол-во */
#kitInfoModal .products-table th:nth-child(3),
#kitInfoModal .products-table td:nth-child(3) {
    width: 100px !important;
    min-width: 60px !important;
    max-width: 100px !important;
    text-align: center !important;
}

/* Колонка Текущая себестоимость */
#kitInfoModal .products-table th:nth-child(4),
#kitInfoModal .products-table td:nth-child(4) {
    width: 150px !important;
    min-width: 120px !important;
    max-width: 180px !important;
    text-align: right !important;
}

/* Hover для строк — одинаковая подсветка */
#kitInfoModal .products-table tbody tr:hover {
    background: var(--surface-hover) !important;
}

/* Убираем шахматный паттерн */
#kitInfoModal .products-table tbody tr:nth-child(even) {
    background: transparent !important;
}

/* ДОБАВЛЯЕМ: перебиваем :nth-child при hover */
#kitInfoModal .products-table tbody tr:nth-child(even):hover {
    background: var(--surface-hover) !important;
}

/* Поля в режиме просмотра (disabled) */
#kitInfoModal input[disabled] {
    cursor: default !important;
    opacity: 0.8 !important;
}

/* Категория в режиме просмотра */
#kitInfoModal .custom-select-wrapper[style*="pointer-events:none"] .custom-select-trigger {
    cursor: default !important;
    opacity: 0.8 !important;
}

/* Итоговая себестоимость */
#kitInfoModal .kit-total-cost {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
}

/* Предупреждение о неполном расчёте */
#kitInfoModal .kit-cost-warning {
    color: var(--warning-text) !important;
    font-size: 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

/* Вкладки внутри модалки просмотра */
#kitInfoModal .inner-tabs {
    margin: 20px 0 16px 0 !important;
}

/* ====== ВКЛАДКА "ОБЩЕЕ" — убираем панель ====== */
#kitInfoModal #kitInfoGeneral {
    padding: 0 !important;           /* ← Убираем отступы */
    border: none !important;         /* ← Убираем обводку */
    background: transparent !important; /* ← Прозрачный фон */
    border-radius: 0 !important;     /* ← Убираем скругление */
}

/* ====== ВКЛАДКА "ДИНАМИКА" — убираем панель ====== */
#kitInfoModal #kitInfoDynamics {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
}

/* ====== ВКЛАДКА "ДИНАМИКА" ====== */

/* Контейнер графика */
#kitInfoModal .chart-container {
    background: var(--surface-hover) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    height: 250px !important;
    position: relative !important;
}

/* Фильтр по периоду */
#kitInfoModal .dynamics-filter {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    margin-bottom: 16px !important;
    flex-wrap: wrap !important;
}

#kitInfoModal .dynamics-filter label {
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
}

#kitInfoModal .dynamics-filter input[type="date"] {
    padding: 6px 12px !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font-size: 0.8rem !important;
}

/* Заголовки секций в динамике */
#kitInfoModal .dynamics-section-title {
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    color: var(--text-secondary) !important;
    display: block !important;
    margin-bottom: 12px !important;
}

/* Таблица истории в динамике */
#kitInfoModal .dynamics-history-table .table-wrapper {
    max-height: 250px !important;
    overflow-y: auto !important;
}

#kitInfoModal .dynamics-history-table th {
    font-size: 0.7rem !important;
}

/* Процент изменения (зелёный/красный) */
#kitInfoModal .dynamics-change-positive {
    color: var(--success-text) !important;
    font-weight: 600 !important;
}

#kitInfoModal .dynamics-change-negative {
    color: var(--danger) !important;
    font-weight: 600 !important;
}

/* Спиннер загрузки */
#kitInfoModal .loading-spinner {
    width: 32px !important;
    height: 32px !important;
    border: 3px solid var(--border) !important;
    border-top-color: var(--primary) !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
    margin: 0 auto !important;
}

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

/* Пустое состояние в динамике */
#kitInfoModal .dynamics-empty {
    text-align: center !important;
    padding: 40px !important;
    color: var(--text-muted) !important;
}

#kitInfoModal .dynamics-empty svg {
    margin-bottom: 12px !important;
}

/* ============================================================
   АДАПТИВ ДЛЯ МОДАЛКИ ПРОСМОТРА
   ============================================================ */

@media (max-width: 768px) {
    #kitInfoModal .modal-content {
        max-width: 95% !important;
        padding: 16px !important;
    }
    
    #kitInfoModal .products-table th,
    #kitInfoModal .products-table td {
        padding: 6px 4px !important;
        font-size: 0.75rem !important;
    }
    
    #kitInfoModal .products-table th:nth-child(4),
    #kitInfoModal .products-table td:nth-child(4) {
        width: 100px !important;
        min-width: 80px !important;
    }
    
    #kitInfoModal .dynamics-filter {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    #kitInfoModal .chart-container {
        height: 180px !important;
    }
}

/* ============================================================
   МОДАЛКА РЕДАКТИРОВАНИЯ КОМПЛЕКТА (#kitFormModal)
   ============================================================ */

/* Основные размеры */
#kitFormModal .modal-content {
    max-width: 750px;
}

/* Таблица в модалке редактирования */
#kitFormModal .table-wrapper {
    max-height: 250px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
}

#kitFormModal .products-table {
    min-width: auto !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

#kitFormModal .products-table th,
#kitFormModal .products-table td {
    padding: 8px 6px !important;
    font-size: 0.85rem !important;
    white-space: normal !important;
    word-break: break-word !important;
    vertical-align: middle !important;
}

/* Заголовки таблицы — sticky */
#kitFormModal .products-table thead th {
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
}

/* Колонка № */
#kitFormModal .products-table th:nth-child(1),
#kitFormModal .products-table td:nth-child(1) {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    text-align: center !important;
}

/* Колонка Товар */
#kitFormModal .products-table th:nth-child(2),
#kitFormModal .products-table td:nth-child(2) {
    min-width: 180px !important;
    max-width: 300px !important;
    word-break: break-word !important;
}

#kitFormModal .products-table td:nth-child(2) select {
    width: 100% !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font-size: 0.8rem !important;
    min-height: 32px !important;
}

/* Колонка Кол-во */
#kitFormModal .products-table th:nth-child(3),
#kitFormModal .products-table td:nth-child(3) {
    width: 100px !important;
    min-width: 80px !important;
    max-width: 100px !important;
    text-align: center !important;
}

#kitFormModal .products-table td:nth-child(3) input {
    width: 100% !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    text-align: center !important;
    font-size: 0.8rem !important;
    max-width: 80px !important;
}

/* Колонка Текущая себестоимость */
#kitFormModal .products-table th:nth-child(4),
#kitFormModal .products-table td:nth-child(4) {
    width: 150px !important;
    min-width: 120px !important;
    max-width: 180px !important;
    text-align: right !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    white-space: nowrap !important;
}

/* Колонка Действия (✕) */
#kitFormModal .products-table th:nth-child(5),
#kitFormModal .products-table td:nth-child(5) {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    text-align: center !important;
}

#kitFormModal .products-table td:nth-child(5) .icon-btn {
    padding: 4px !important;
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#kitFormModal .products-table td:nth-child(5) .icon-btn svg {
    width: 16px !important;
    height: 16px !important;
}

#kitFormModal .products-table tbody tr:hover {
    background: var(--surface-hover) !important;
}

#kitFormModal .products-table tbody tr:nth-child(even) {
    background: transparent !important;
}

/* ДОБАВЛЯЕМ: перебиваем :nth-child при hover */
#kitFormModal .products-table tbody tr:nth-child(even):hover {
    background: var(--surface-hover) !important;
}

/* Пустая строка */
#kitFormModal #kitEmptyRow td {
    padding: 40px !important;
    text-align: center !important;
    color: var(--text-muted) !important;
}

/* Поля ввода (disabled) */
#kitFormModal input[disabled] {
    cursor: default !important;
    opacity: 0.8 !important;
}

/* ====== ИТОГОВАЯ СЕБЕСТОИМОСТЬ ====== */
#kitFormModal .kit-total-cost {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
}

#kitFormModal .kit-cost-warning {
    color: var(--warning-text) !important;
    font-size: 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
}

/* ============================================================
   АДАПТИВ ДЛЯ МОДАЛКИ РЕДАКТИРОВАНИЯ
   ============================================================ */

@media (max-width: 768px) {
    #kitFormModal .modal-content {
        max-width: 95% !important;
        padding: 16px !important;
    }
    
    #kitFormModal .products-table th,
    #kitFormModal .products-table td {
        padding: 4px 4px !important;
        font-size: 0.7rem !important;
    }
    
    #kitFormModal .products-table th:nth-child(2),
    #kitFormModal .products-table td:nth-child(2) {
        min-width: 100px !important;
        max-width: 150px !important;
    }
    
    #kitFormModal .products-table th:nth-child(4),
    #kitFormModal .products-table td:nth-child(4) {
        width: 100px !important;
        min-width: 80px !important;
        font-size: 0.7rem !important;
    }
    
    #kitFormModal .products-table td:nth-child(2) select {
        font-size: 0.7rem !important;
        padding: 2px 4px !important;
        min-height: 28px !important;
    }
    
    #kitFormModal .products-table td:nth-child(3) input {
        font-size: 0.7rem !important;
        padding: 2px 4px !important;
        max-width: 60px !important;
    }
}

/* ============================================================
   ТАБЛИЦА ИСТОРИИ В ДИНАМИКЕ (#dynamicsHistoryTable)
   ============================================================ */

#dynamicsHistoryTable {
    width: 100% !important;
    border-collapse: collapse !important;
}

#dynamicsHistoryTable thead th {
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
}

#dynamicsHistoryTable tbody td {
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    border-bottom: 1px solid var(--border-light) !important;
    vertical-align: middle !important;
}

/* Колонка № */
#dynamicsHistoryTable thead th:nth-child(1),
#dynamicsHistoryTable tbody td:nth-child(1) {
    width: 1% !important;
    min-width: 30px !important;
    max-width: 40px !important;
    text-align: center !important;
}

/* Колонка Дата */
#dynamicsHistoryTable thead th:nth-child(2),
#dynamicsHistoryTable tbody td:nth-child(2) {
    text-align: left !important;
    white-space: nowrap !important;
}

/* Колонка Себестоимость */
#dynamicsHistoryTable thead th:nth-child(3),
#dynamicsHistoryTable tbody td:nth-child(3) {
    text-align: right !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

/* Колонка Изменение */
#dynamicsHistoryTable thead th:nth-child(4),
#dynamicsHistoryTable tbody td:nth-child(4) {
    text-align: center !important;
    white-space: nowrap !important;
}

#dynamicsHistoryTable thead th:nth-child(5),
#dynamicsHistoryTable tbody td:nth-child(5) {
    text-align: center !important;
}

/* Hover для строк */
#dynamicsHistoryTable tbody tr:hover {
    background: var(--surface-hover) !important;
}

#dynamicsHistoryTable tbody tr:nth-child(even) {
    background: transparent !important;
}

#dynamicsHistoryTable tbody tr:nth-child(even):hover {
    background: var(--surface-hover) !important;
}

/* Цвета изменений */
#dynamicsHistoryTable .positive {
    color: var(--success-text) !important;
}

#dynamicsHistoryTable .negative {
    color: var(--danger) !important;
}

/* ============================================================
   МОДАЛКА ЗАКАЗА — НОВАЯ ВЕРСИЯ (с увеличенными тенями)
   ============================================================ */

/* ====== 1. КАРТОЧКА ЗАКАЗА ====== */
.order-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    border-color: var(--border);
}

[data-theme="dark"] .order-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .order-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ====== 2. ФИНАНСОВЫЙ ОТЧЁТ ====== */
.finance-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
}

.finance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    border-color: var(--border);
}

[data-theme="dark"] .finance-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .finance-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ====== 3. КАРТОЧКА ТОВАРЫ В ЗАКАЗЕ ====== */
.items-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    margin-top: 16px;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
}

.items-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    border-color: var(--border);
}

[data-theme="dark"] .items-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .items-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ====== 4. ЭЛЕМЕНТ ТОВАРА ====== */
.item-card {
    background: var(--surface-hover);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
    border-color: var(--border);
}

[data-theme="dark"] .item-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .item-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ====== 5. ДЕТАЛИ (общие стили) ====== */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.detail-value {
    font-size: 0.85rem;
    color: var(--text);
}

.detail-value.negative {
    color: var(--danger);
}

.detail-value.positive {
    color: var(--success-text);
}

/* ====== 6. АДАПТИВ ====== */
@media (max-width: 768px) {
    .order-card,
    .finance-card,
    .items-card,
    .item-card {
        padding: 12px;
    }
    
    .order-card:hover,
    .finance-card:hover,
    .items-card:hover,
    .item-card:hover {
        transform: translateY(-1px);
    }
}



/* ============================================================
   СВАЙПЕР ДЛЯ МОДАЛКИ ЛОГИНА
   ============================================================ */

/* ----- МОДАЛКА С БЛЮРОМ ----- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface);
    border-radius: 28px;
    padding: 28px;
    max-width: 500px;
    width: 90%;
    animation: modalFadeIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10001;
}

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

/* ----- СВАЙП-ПОЛОСКА (БЕЗ ТЕКСТА) ----- */
.swipe-container {
    width: 100%;
    position: relative;
    margin-top: 4px;
}

.swipe-track {
    width: 100%;
    height: 54px;
    background: var(--surface-hover);
    border-radius: 27px;
    border: 2px solid var(--border);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: background 0.3s, border-color 0.3s;
    padding: 0;
}
.swipe-track:active {
    cursor: grabbing;
}

/* КРУЖОК */
.swipe-thumb {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    background: var(--surface);
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    touch-action: none;
    z-index: 2;
    transition: box-shadow 0.2s, transform 0.1s, border-color 0.3s, background 0.3s;
}
.swipe-thumb:active {
    cursor: grabbing;
    box-shadow: var(--shadow-hover);
}

.swipe-thumb .arrow-icon {
    width: 22px;
    height: 22px;
    stroke: var(--text-secondary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: transform 0.3s, stroke 0.3s;
}

/* Разблокировано */
.swipe-track.unlocked {
    background: var(--success);
    border-color: var(--success-text);
}
.swipe-track.unlocked .swipe-thumb {
    border-color: var(--success-text);
    background: #ffffff;
}
.swipe-track.unlocked .swipe-thumb .arrow-icon {
    transform: rotate(90deg);
    stroke: var(--success-text);
}

/* ----- ЗАМОК В МОДАЛКЕ ----- */
.modal-lock-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 4px;
}

.modal-lock-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.modal-lock-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.modal-lock-icon .shackle {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: 24px 24px;
}

.modal-lock-icon .shackle path {
    transition: fill 0.3s;
}

.modal-lock-icon .lock-body {
    transition: all 0.5s ease;
}

.modal-lock-icon .lock-body path {
    transition: fill 0.5s ease;
}

.modal-lock-icon .keyhole {
    transition: all 0.5s ease;
}

.modal-lock-icon .keyhole path {
    transition: fill 0.5s ease;
}

/* Зелёный */
.modal-lock-icon.green .lock-body path {
    fill: var(--success) !important;
}
.modal-lock-icon.green .shackle path {
    fill: var(--success-text) !important;
}
.modal-lock-icon.green .keyhole path {
    fill: var(--success-text) !important;
}

/* Открытый */
.modal-lock-icon.open .shackle {
    transform: rotate(-30deg) translateX(4px);
}
.modal-lock-icon.open .lock-body path {
    fill: var(--success) !important;
}
.modal-lock-icon.open .shackle path {
    fill: var(--success-text) !important;
}
.modal-lock-icon.open .keyhole path {
    fill: var(--success-text) !important;
}

/* ----- СТАТУС ЗАМКА ----- */
.modal-lock-status {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    min-height: 26px;
    text-align: center;
    transition: color 0.3s;
}
.modal-lock-status.green {
    color: var(--success-text);
}
.modal-lock-status.open {
    color: var(--success-text);
}
.modal-lock-status.error {
    color: var(--danger);
}

/* ----- ПОДСКАЗКА ВНИЗУ ----- */
.modal-swipe-hint {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.6;
    min-height: 28px;
    transition: all 0.5s ease;
}
.modal-swipe-hint.hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}
.modal-swipe-hint.error {
    color: var(--danger);
    opacity: 1;
}

/* ----- ПОЛЯ ВВОДА ----- */
.modal-form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 4px;
}

.modal-form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    outline: none;
}
.modal-form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 41, 59, 0.1);
}
.modal-form-group input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

/* Тёмная тема */
[data-theme="dark"] .modal-form-group input:focus {
    box-shadow: 0 0 0 4px rgba(241, 245, 249, 0.1);
}
[data-theme="dark"] .modal-form-group input.error {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}
[data-theme="dark"] .swipe-track.unlocked .swipe-thumb {
    background: #1e293b;
}

/* ----- ТРЯСКА ----- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

.modal-lock-icon.shake {
    animation: shake 0.5s ease;
}
.swipe-track.shake {
    animation: shake 0.5s ease;
}
.modal-form-group input.shake {
    animation: shake 0.5s ease;
}

/* ----- АНИМАЦИИ ПЕРЕХОДА ----- */
@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.modal.fade-out {
    animation: modalFadeOut 0.5s ease forwards;
}

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

.dashboard.fade-in {
    animation: dashboardFadeIn 0.6s ease forwards;
}

/* ----- АДАПТИВ ДЛЯ МОДАЛКИ ----- */
@media (max-width: 420px) {
    .modal-lock-icon { width: 56px; height: 56px; }
    .swipe-track { height: 46px; }
    .swipe-thumb { width: 42px; height: 42px; }
    .swipe-thumb .arrow-icon { width: 18px; height: 18px; }
}

/* ----- СКРЫВАЕМ ДАШБОРД ПО УМОЛЧАНИЮ ----- */
.dashboard {
    display: none;
}

/* ----- КРАСНЫЙ ЗАМОК (ОШИБКА) ----- */
.modal-lock-icon.error .lock-body path {
    fill: var(--danger) !important;
}
.modal-lock-icon.error .shackle path {
    stroke: var(--danger) !important;
}
.modal-lock-icon.error .keyhole circle,
.modal-lock-icon.error .keyhole rect {
    fill: var(--danger) !important;
}

/* ============================================================
   ФИЛЬТР ЗАКАЗОВ (order-filter)
   ============================================================ */

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.filter-group label svg {
    flex-shrink: 0;
}

/* ====== DROPDOWN — ФИКСИРОВАННАЯ ШИРИНА ====== */
.filter-bar .custom-select-wrapper {
    min-width: 210px;          /* минимальная ширина */
    max-width: 280px;          /* максимальная ширина */
    flex-shrink: 0;            /* не сжимается */
}

.filter-bar .custom-select-trigger {
    width: 100%;
    min-height: 40px;
    padding: 8px 14px;
    gap: 12px;
    white-space: nowrap;       /* текст в одну строку */
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-bar .custom-select-trigger .trigger-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-bar .custom-select-trigger .arrow {
    flex-shrink: 0;
}

/* ====== ПОЛЯ ДАТЫ ====== */
.manual-date-group input[type="date"] {
    width: 160px;              /* фиксированная ширина */
    min-height: 40px;          /* высота как у dropdown */
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    outline: none;
    box-sizing: border-box;
}

.manual-date-group input[type="date"]:focus {
    border-color: var(--primary);
}

.manual-date-group input[type="date"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--surface-hover);
}

/* Кнопка сброса */
#resetFilterGroup {
    align-self: flex-end;
}

/* ====== АДАПТИВ ====== */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-bar .custom-select-wrapper {
        min-width: 140px;
        max-width: 100%;
        flex-shrink: 1;
    }
    
    .filter-bar .custom-select-trigger {
        min-height: 36px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .manual-date-group > div {
        flex-wrap: wrap;
    }
    
    .manual-date-group input[type="date"] {
        flex: 1;
        min-width: 120px;
        max-width: 100%;
    }
    
    #resetFilterGroup {
        align-self: stretch;
    }
    
    #resetFilterGroup button {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   МАРКЕТЫ — НОВЫЙ ТАБ-БАР (Вариант 3: иконка + текст, зелёный фон)
   ============================================================ */

.markets-tabs-bar {
    display: flex;
    align-items: stretch;
    gap: 4px;
    background: var(--surface);
    border-radius: 60px;
    padding: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 48px;
}

.markets-tabs-bar::-webkit-scrollbar {
    display: none;
}

/* ====== ОБЩИЕ СТИЛИ ДЛЯ ВСЕХ КНОПОК ====== */
.markets-tabs-bar .inner-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px 6px 12px;
    border-radius: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 36px;
    font-family: inherit;
    flex-shrink: 0;
}

.markets-tabs-bar .inner-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* ====== ИКОНКИ ВНУТРИ КНОПОК ====== */
.markets-tabs-bar .inner-tab svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.markets-tabs-bar .inner-tab img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
    border-radius: 2px;
}

/* ====== АКТИВНОЕ СОСТОЯНИЕ ДЛЯ МАРКЕТОВ (только фон, иконка НЕ меняется) ====== */
.markets-tabs-bar .inner-tab.active[data-value] {
    background: #dcfce7;
    color: #166534;
}

/* ====== АКТИВНОЕ СОСТОЯНИЕ ДЛЯ СЕКЦИЙ (как на сайте — тёмный фон) ====== */
.markets-tabs-bar .inner-tab.active[data-section] {
    background: var(--primary);
    color: var(--primary-text);
}

.markets-tabs-bar .inner-tab.active[data-section] svg {
    stroke: var(--primary-text);
}

/* ====== РАЗДЕЛИТЕЛЬ (на всю высоту) ====== */
.markets-tabs-bar .divider {
    width: 1px;
    background: var(--border);
    flex-shrink: 0;
    align-self: stretch;
    margin: 0 2px;
}

/* ====== АДАПТИВ ====== */
@media (max-width: 768px) {
    .markets-tabs-bar {
        border-radius: 40px;
        padding: 4px;
        gap: 4px;
        min-height: 40px;
    }

    .markets-tabs-bar .inner-tab {
        font-size: 0.75rem;
        padding: 4px 12px 4px 8px;
        min-height: 30px;
        gap: 4px;
    }

    .markets-tabs-bar .inner-tab svg {
        width: 16px;
        height: 16px;
    }

    .markets-tabs-bar .inner-tab img {
        width: 16px;
        height: 16px;
    }

    .markets-tabs-bar .divider {
        margin: 0 2px;
    }
}

@media (max-width: 480px) {
    .markets-tabs-bar .inner-tab {
        font-size: 0.65rem;
        padding: 3px 8px 3px 6px;
        min-height: 26px;
    }

    .markets-tabs-bar .inner-tab svg {
        width: 14px;
        height: 14px;
    }

    .markets-tabs-bar .inner-tab img {
        width: 14px;
        height: 14px;
    }
}

/* ============================================================
   ТЁМНАЯ ТЕМА ДЛЯ МАРКЕТОВ
   ============================================================ */
[data-theme="dark"] .markets-tabs-bar .inner-tab {
    color: var(--text-secondary);
}

[data-theme="dark"] .markets-tabs-bar .inner-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

[data-theme="dark"] .markets-tabs-bar .inner-tab.active[data-value] {
    background: #064e3b;
    color: #4ade80;
}

[data-theme="dark"] .markets-tabs-bar .inner-tab.active[data-section] {
    background: var(--primary);
    color: var(--primary-text);
}

[data-theme="dark"] .markets-tabs-bar .inner-tab.active[data-section] svg {
    stroke: var(--primary-text);
}

[data-theme="dark"] .markets-tabs-bar .divider {
    background: var(--border);
}





/* ============================================================
   МАРКЕТЫ — УБИРАЕМ ЛИШНЮЮ РАМКУ
   ============================================================ */

/* Убираем рамку и фон у всех панелей маркетов */
#mmSectionProducts,
#mmSectionOrders,
#mmSectionRedemption,
#mmSectionReturns {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* А у table-wrapper оставляем рамку (одну) */
#mmSectionProducts .table-wrapper,
#mmSectionOrders .table-wrapper,
#mmSectionRedemption .table-wrapper,
#mmSectionReturns .table-wrapper {
    border: 1px solid var(--border-light) !important;
    border-radius: 20px !important;
    background: var(--surface) !important;
    overflow: auto !important;
    max-height: 65vh !important;
    padding: 0 !important;
}

/* Таблица без лишних рамок */
#mmSectionProducts .products-table,
#mmSectionOrders .products-table,
#mmSectionRedemption .products-table,
#mmSectionReturns .products-table {
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
}
/* ============================================================
   МАРКЕТЫ — ТАБЛИЦА БЕЗ РАМКИ (КАК В ДРУГИХ МОДУЛЯХ)
   ============================================================ */

/* Убираем рамку у всех панелей маркетов */
#mmSectionProducts,
#mmSectionOrders,
#mmSectionRedemption,
#mmSectionReturns {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
}

/* Убираем рамку у обёртки таблицы */
#mmSectionProducts .table-wrapper,
#mmSectionOrders .table-wrapper,
#mmSectionRedemption .table-wrapper,
#mmSectionReturns .table-wrapper {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    overflow: auto !important;
    max-height: 65vh !important;
    padding: 0 !important;
}

/* Таблица без лишних рамок */
#mmSectionProducts .products-table,
#mmSectionOrders .products-table,
#mmSectionRedemption .products-table,
#mmSectionReturns .products-table {
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    border-collapse: collapse !important;
}

/* Заголовки — только нижняя граница */
#mmSectionOrders .products-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background: var(--surface) !important;
    border-bottom: 2px solid var(--border) !important;
    padding: 10px 14px !important;
    text-align: left !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
}

/* Ячейки — только нижняя граница */
#mmSectionOrders .products-table tbody td {
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--border-light) !important;
    vertical-align: middle !important;
}

/* Последняя строка — без границы */
#mmSectionOrders .products-table tbody tr:last-child td {
    border-bottom: none !important;
}

/* Кнопка "глазок" — появляется при наведении */
#mmSectionOrders .products-table .icon-btn {
    opacity: 0 !important;
    transition: opacity 0.2s ease;
}

#mmSectionOrders .products-table tbody tr:hover .icon-btn {
    opacity: 1 !important;
}





/* ============================================================
   АНИМАЦИИ
   ============================================================ */
@keyframes logoWave {
    0% { transform: scaleX(0.2); opacity: 0; }
    40% { transform: scaleX(1); opacity: 1; }
    60% { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(0.2); opacity: 0; }
}
/* ============================================================
   АНИМАЦИЯ ВРАЩЕНИЯ ДЛЯ ИКОНКИ ПЕРЕСЧЁТА
   ============================================================ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 0.8s linear infinite;
}




/* LITEOVA FINANCE A3 PHASE 1 — SCOPED STYLES. DO NOT MODIFY OTHER TABLES. */
#operationDetailsModal.finance-a3-modal {
  padding: 20px;
  overscroll-behavior: contain;
}
#operationDetailsModal .finance-a3-dialog {
  box-sizing: border-box;
  width: min(100%, 560px);
  max-width: 560px;
  max-height: min(88vh, 820px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
#operationDetailsModal .finance-a3-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; margin-bottom: 22px; }
#operationDetailsModal .finance-a3-head h3 { font-size: 1.35rem; margin: 5px 0 0; line-height: 1.25; color: var(--text-heading); }
#operationDetailsModal .finance-a3-eyebrow { font-size: .78rem; color: var(--text-secondary); }
#operationDetailsModal .finance-a3-head .icon-btn { flex: none; border-radius: 50%; }
#operationDetailsModal .finance-a3-total { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border: 1px solid var(--border-light); border-radius: 16px; padding: 22px; background: var(--surface-hover); }
#operationDetailsModal .finance-a3-total span { color: var(--text-secondary); font-size: .88rem; }
#operationDetailsModal .finance-a3-total strong { font-size: clamp(1.9rem, 4vw, 2.3rem); font-weight: 720; line-height: 1.15; font-variant-numeric: tabular-nums; }
#operationDetailsModal .finance-a3-total-expense strong { color: var(--text-heading); }
#operationDetailsModal .finance-a3-total-income strong { color: var(--success-text); }
#operationDetailsModal .finance-a3-total small { font-size: .76rem; color: var(--text-muted); }
#operationDetailsModal .finance-a3-fields { padding: 6px 0; margin: 17px 0 0; }
#operationDetailsModal .finance-a3-fields > div { display: grid; grid-template-columns: minmax(120px, 37%) 1fr; align-items: start; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--border-light); font-size: .87rem; }
#operationDetailsModal .finance-a3-fields > div > span { color: var(--text-secondary); }
#operationDetailsModal .finance-a3-fields > div > strong { font-weight: 580; color: var(--text); }
#operationDetailsModal .finance-a3-description { white-space: pre-wrap; overflow-wrap: anywhere; }
#operationDetailsModal .finance-a3-note { border: 1px solid var(--border); border-radius: 14px; padding: 15px; background: var(--surface-hover); margin: 18px 0; font-size: .85rem; line-height: 1.5; }
#operationDetailsModal .finance-a3-note strong { display: block; margin-bottom: 4px; }
#operationDetailsModal .finance-a3-note p { color: var(--text-secondary); margin: 0; }
#operationDetailsModal .finance-a3-tech { margin-top: 18px; padding: 14px 0; border-bottom: 1px solid var(--border-light); font-size: .84rem; }
#operationDetailsModal .finance-a3-tech summary { cursor: pointer; font-weight: 600; }
#operationDetailsModal .finance-a3-tech p { color: var(--text-secondary); font-size: .77rem; margin: 10px 0 0; overflow-wrap: anywhere; }
#operationDetailsModal .finance-a3-footer { margin-top: 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#expensesTable .finance-a3-locked { font-size: .73rem; color: var(--text-secondary); white-space: nowrap; }
#expensesTable .expense-select:disabled { cursor: not-allowed; opacity: .3; }
@media (max-width: 600px) {
  #operationDetailsModal.finance-a3-modal { padding: 0; align-items: stretch; }
  #operationDetailsModal .finance-a3-dialog { max-height: 100dvh; height: 100dvh; width: 100%; max-width: none; border: 0; border-radius: 0; padding: 22px 18px; }
  #operationDetailsModal .finance-a3-fields > div { grid-template-columns: 1fr; gap: 4px; }
}
/* END LITEOVA FINANCE A3 PHASE 1 */
