* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Профессиональная корпоративная цветовая палитра */
    --primary-color: #1e293b;
    --primary-light: #334155;
    --primary-dark: #0f172a;
    --secondary-color: #475569;
    --secondary-light: #64748b;
    --secondary-dark: #334155;
    --accent-color: #2563eb;
    --accent-light: #3b82f6;
    --accent-dark: #1d4ed8;
    --success-color: #059669;
    --success-light: #10b981;
    --success-dark: #047857;
    --danger-color: #dc2626;
    --danger-light: #ef4444;
    --danger-dark: #b91c1c;
    --warning-color: #d97706;
    --warning-light: #f59e0b;
    --warning-dark: #b45309;
    --info-color: #0284c7;
    --info-light: #0ea5e9;
    --info-dark: #0369a1;
    
    /* Фоны */
    --background: #f8fafc;
    --background-secondary: #f1f5f9;
    --background-tertiary: #e2e8f0;
    --card-background: #ffffff;
    --card-hover: #fafbfc;
    
    /* Текст */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Границы */
    --border-color: #cbd5e1;
    --border-light: #e2e8f0;
    --border-dark: #94a3b8;
    
    /* Тени */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    --shadow-colored: 0 10px 15px -3px rgba(37, 99, 235, 0.2), 0 4px 6px -2px rgba(37, 99, 235, 0.15);
    
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --gradient-secondary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #047857 100%);
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    --gradient-warm: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    --gradient-accent: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    
    /* Скругления */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Анимации */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Другие */
    --sidebar-width: 260px;
    --header-height: 64px;

    /* Единая навигация (сайдбар, настройки, подменю финансов) */
    --nav-chevron-transition: transform var(--transition-fast);
    --nav-submenu-surface: var(--card-background);
    --nav-submenu-active-bg: rgba(37, 99, 235, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Подключение современного шрифта */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Гарантия работы ввода: страница и поля не блокируются */
html, body, .main-content {
    pointer-events: auto !important;
}

/* Стили для резервного копирования */
.backup-item {
    transition: box-shadow 0.2s ease;
}

.backup-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.backup-auto {
    font-size: 0.85em;
}

.backup-manual {
    font-size: 0.85em;
}

/* Стили для глобального поиска */
#globalSearchContainer {
    position: relative;
}

#globalSearchInput::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

#globalSearchInput:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

#searchSuggestions {
    pointer-events: auto !important;
}

.search-suggestion-item {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.search-result-item {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.search-result-item:hover {
    background: #e8f4f8 !important;
    transform: translateX(5px);
}

/* Стили для уведомлений */
#notificationsIcon {
    pointer-events: auto !important;
    cursor: pointer !important;
}

#notificationsIcon:hover {
    opacity: 0.8;
}

.notification-item {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.notification-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notification-toast-container {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1200;
    max-width: min(420px, calc(100vw - 36px));
}

.notification-toast {
    position: relative;
    background: #fff;
    border: 1px solid var(--border-color);
    border-left: 4px solid #3498db;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(10, 20, 40, 0.2);
    padding: 12px 14px 10px;
    transform: translateY(8px);
    opacity: 0;
    pointer-events: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.notification-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.notification-toast.is-hiding {
    transform: translateY(8px);
    opacity: 0;
}

.notification-toast.severity-critical {
    border-left-color: #e74c3c;
}

.notification-toast.severity-warning {
    border-left-color: #f39c12;
}

.notification-toast .toast-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: transparent;
    color: #7b8899;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
}

.notification-toast .toast-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 24px;
}

.notification-toast .toast-message {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.notification-toast .toast-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.notification-center-shell {
    padding: 16px;
    max-height: 72vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-center-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) auto auto auto;
    gap: 10px;
    align-items: center;
}

.analytics-stacked-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.analytics-legend-item {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.analytics-legend-item.is-off {
    opacity: 0.45;
    text-decoration: line-through;
}

.analytics-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.analytics-day-bar {
    appearance: none;
}

.analytics-day-tooltip {
    position: absolute;
    z-index: 20;
    width: 260px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35);
    padding: 10px;
    pointer-events: none;
}

.analytics-tooltip-date {
    font-weight: 700;
    margin-bottom: 4px;
}

.analytics-tooltip-total {
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.analytics-tooltip-list {
    display: grid;
    gap: 4px;
    font-size: 0.82rem;
}

.analytics-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.analytics-tooltip-empty {
    font-size: 0.82rem;
    opacity: 0.85;
}

.notification-center-toolbar .form-control {
    width: 100%;
}

.notification-center-unread {
    white-space: nowrap;
}

.notification-center-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.notification-center-item {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.notification-center-item.is-unread {
    border-left: 4px solid #2563eb;
    background: #f8fbff;
}

.notification-center-item-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.notification-center-item-title {
    font-weight: 700;
    color: var(--text-primary);
}

.notification-center-item-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.notification-center-item-message {
    margin-top: 6px;
    color: var(--text-secondary);
}

.notification-center-item-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.notification-center-item-type {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.notification-center-empty {
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    background: #fff;
}

.btn-light {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
}

@media (max-width: 980px) {
    .notification-center-toolbar {
        grid-template-columns: 1fr 1fr;
    }
}

/* Стили для аналитики */
.analytics-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.analytics-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.analytics-item {
    background: #f7f9fc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.analytics-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.analytics-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.analytics-value.revenue {
    color: #27ae60;
}

.analytics-value.profit {
    color: #27ae60;
}

.analytics-value.loss {
    color: #e74c3c;
}

.analytics-value.expense {
    color: #e74c3c;
}

.analytics-table {
    margin-top: 15px;
    max-height: min(70vh, 560px);
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

.analytics-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.analytics-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border-color);
}

.analytics-table th {
    background: #f7f9fc;
    font-weight: 600;
    color: var(--text-primary);
}

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

.analytics-table tbody tr:hover {
    background: #f7f9fc;
}

.modal-overlay.modal-overlay-hidden {
    display: none !important;
    pointer-events: none !important;
}

.modal-overlay:not(.modal-overlay-hidden) {
    pointer-events: auto !important;
}

.modal-content {
    pointer-events: auto !important;
}

input:not([type="hidden"]):not([disabled]):not([readonly]),
textarea:not([disabled]):not([readonly]),
select:not([disabled]) {
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: text !important;
}

input[disabled],
textarea[disabled],
select[disabled] {
    pointer-events: none !important;
}

input[readonly="true"],
textarea[readonly="true"] {
    pointer-events: auto !important;
    user-select: text !important;
}

/* Убеждаемся, что родительские элементы не блокируют */
.form-group,
.data-item,
.content-section,
.modal-content > * {
    pointer-events: auto !important;
}

/* Боковая навигация */
.nav-link,
.nav-link *,
.nav-group-toggle {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: var(--gradient-primary);
    color: white;
    padding: 8px 0;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

.sidebar.sidebar-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.sidebar:hover {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Стили для иконок */
.app-icon,
.nav-icon,
.page-icon,
.section-icon,
.btn-icon {
    display: inline-block;
    font-weight: 600;
    font-style: normal;
    line-height: 1;
    vertical-align: middle;
}

svg.icon-use {
    display: block;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
}

.nav-icon svg.icon-use,
.date-filter-icon svg.icon-use {
    margin: 0 auto;
}

.app-icon {
    font-size: 1.1rem;
    margin-right: 6px;
}

.nav-icon {
    font-size: 0.95rem;
    margin-right: 8px;
    width: 22px;
    text-align: center;
    opacity: 0.95;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-icon {
    font-size: 1.5rem;
    margin-right: 10px;
    vertical-align: middle;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.section-icon {
    font-size: 1.2rem;
    margin-right: 8px;
    vertical-align: middle;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon {
    font-size: 0.9rem;
    margin-right: 6px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.btn-icon svg.icon-use {
    display: inline-block;
    vertical-align: middle;
}

.kpi-icon svg.icon-use {
    stroke: #fff;
}

.sidebar-header {
    padding: 0 16px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.sidebar-header-brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-align: left;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.erp-header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.erp-header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.45);
}

.erp-header-icon-btn.is-active {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.erp-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.user-apps-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 8px;
}
.user-app-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
}
.user-app-badge--none {
    background: #f1f5f9;
    color: #64748b;
}
.user-login-tag {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 400;
}
.user-data-item--disabled {
    opacity: 0.65;
}
.user-disabled-label {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 4px;
}
.user-apps-checkboxes {
    display: grid;
    gap: 6px;
}
.user-app-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.settings-panel-users-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-users-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.settings-users-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin: 0;
    line-height: 1.2;
}

.storage-status {
    display: none;
}

.mobile-dl-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
}

.mobile-dl-card {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: #f8fafc;
}

.mobile-dl-qr-wrap {
    flex: 0 0 auto;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.mobile-dl-qr {
    display: block;
    width: 240px;
    height: 240px;
}

.mobile-dl-meta p {
    margin: 0 0 8px;
}

.settings-callout--ok {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}
.settings-callout--warn {
    border-left: 4px solid #d97706;
    background: #fffbeb;
}

.nav-menu {
    list-style: none;
    padding: 0 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nav-menu li {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition-base);
    font-weight: 500;
    white-space: nowrap;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.nav-link:hover::before,
.nav-link.active::before {
    transform: scaleY(1);
}

.nav-item {
    position: relative;
}

.nav-group-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
    font-size: 0.875rem;
    text-align: left;
}

.nav-group-label {
    flex: 1;
    min-width: 0;
}

.nav-group-chevron {
    flex-shrink: 0;
    font-size: 0.65rem;
    opacity: 0.88;
    line-height: 1;
    transition: var(--nav-chevron-transition);
}

.nav-group.open .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nav-submenu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    display: none;
    flex-direction: column;
    gap: 4px;
    background: var(--nav-submenu-surface);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 8px;
    z-index: 1100;
    backdrop-filter: blur(10px);
    animation: slideUp var(--transition-base);
}

.nav-submenu .nav-link {
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all var(--transition-base);
    font-size: 0.875rem;
}

.nav-submenu .nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--secondary-color);
    transform: translateX(4px);
    font-weight: 600;
}

.nav-group.open .nav-submenu {
    display: flex;
}

.nav-link.nav-link-primary {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-submenu .nav-link.active {
    background: var(--nav-submenu-active-bg);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.3rem;
    margin-right: 12px;
    min-width: 1.5em;
    width: auto;
    text-align: center;
    font-weight: normal;
    font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.date-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.date-filter-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: var(--text-secondary);
}

/* Строка «иконка + текст» в карточках (клиенты, финансы, приёмка и т.д.) */
.clients-email-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.35;
    vertical-align: middle;
}

.clients-email-row svg.icon-use {
    flex-shrink: 0;
    align-self: center;
}

/* Заголовки блоков WMS с иконкой слева */
.wms-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wms-section-title .section-icon {
    margin-right: 0;
}

/* Кнопки, в которых только SVG (история / точки / карандаш в списках) */
.btn-small.btn-secondary:has(> svg.icon-use:only-child),
.btn-small.btn-edit:has(> svg.icon-use:only-child),
.btn-small.btn-danger:has(> svg.icon-use:only-child) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    min-height: 2.35rem;
    padding: 6px 8px;
    line-height: 0;
}

.btn-small.btn-secondary:has(> svg.icon-use:only-child) svg.icon-use,
.btn-small.btn-edit:has(> svg.icon-use:only-child) svg.icon-use,
.btn-small.btn-danger:has(> svg.icon-use:only-child) svg.icon-use {
    display: block;
}

/* Колокольчик уведомлений в шапке сайдбара */
.sidebar-notifications-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    margin-top: 2px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.95);
    transition: background 0.2s ease;
}

.sidebar-notifications-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-notifications-trigger .sidebar-notifications-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.sidebar-notifications-trigger svg.icon-use {
    stroke: currentColor;
}

.report-title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.report-inline-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 15px;
    padding: 10px 12px;
    background: #fff3cd;
    border-radius: 6px;
    color: #856404;
}

.report-inline-alert svg.icon-use {
    flex-shrink: 0;
    margin-top: 2px;
    stroke: #b45309;
}

.meat-arrival-choice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.top-list-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
}

.top-list-rank--lead {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

/* Основной контент */
.main-content {
    margin-left: 0;
    padding: 32px;
    min-height: 100vh;
    min-width: 0;
    padding-top: 0; /* Отступ будет установлен динамически через JavaScript */
    background: var(--background);
}

.content-section {
    display: none;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0;
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.page-header--with-context {
    align-items: flex-start;
}

.page-header--with-context .page-header-main {
    flex: 1;
    min-width: 0;
}

.page-header--with-context .page-header-main h2 {
    margin: 0 0 4px;
}

.page-header-context {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-tertiary);
    max-width: 36rem;
}

.page-header--with-context .page-header-actions {
    flex-shrink: 0;
    margin-left: auto;
    align-self: flex-start;
}

@media (max-width: 720px) {
    .page-header h2 {
        font-size: 1.45rem;
        line-height: 1.25;
    }

    .page-header--with-context {
        flex-direction: column;
        gap: 12px;
    }
    .page-header--with-context .page-header-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
}

.empty-state-block {
    padding: 20px 16px;
    text-align: center;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
    background: var(--background-secondary);
}

.empty-state-block .empty-state {
    margin: 0 0 14px;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.prod-section-heading {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

.prod-section-heading--accent {
    font-size: 1.12rem;
    color: #0c4a6e;
}

/* Производство: рабочий стол — спокойные панели вместо градиентов */
.prod-desk-tabs {
    margin-bottom: 12px;
    padding: 10px 12px;
}

.prod-desk-tab-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.prod-desk-panel {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--card-background);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.prod-desk-panel--shift {
    border-left: 4px solid #0ea5e9;
}

.prod-desk-panel--buffer {
    border-left: 4px solid #10b981;
}

.prod-desk-panel--journal {
    border-left: 4px solid #94a3b8;
}

.prod-desk-lead {
    margin: 0 0 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #0369a1;
}

.prod-desk-lead--buffer {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #0f766e;
}

.prod-desk-lead--muted {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.prod-desk-metric-card {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
}

/* CARVER буферы — дашборд */
.prod-buffer-mount { min-height: 120px; }
.prod-buffer-dashboard { display: flex; flex-direction: column; gap: 16px; }
.prod-buffer-dashboard__hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 55%, #fff 100%);
    border: 1px solid #bae6fd;
}
.prod-buffer-dashboard__hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.prod-buffer-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}
.prod-buffer-updated { font-size: 0.8rem; color: #64748b; }
.prod-buffer-alert--error {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.prod-buffer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.prod-buffer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #475569;
}
.prod-buffer-field select,
.prod-buffer-field input {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    min-width: 140px;
}
.prod-buffer-status {
    font-size: 0.9rem;
    color: #64748b;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
}
.prod-buffer-lanes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}
.prod-buffer-lane {
    border-radius: 14px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.prod-buffer-lane--primary { border-top: 4px solid #059669; }
.prod-buffer-lane--leftovers { border-top: 4px solid #d97706; }
.prod-buffer-lane__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
}
.prod-buffer-lane__title { margin: 0; font-size: 1.05rem; color: #0f172a; }
.prod-buffer-lane__sub { margin: 4px 0 0; font-size: 0.8rem; color: #64748b; }
.prod-buffer-lane__total { font-size: 1.35rem; font-weight: 900; color: #0f172a; white-space: nowrap; }
.prod-buffer-gauge { margin: 8px 0 12px; }
.prod-buffer-gauge__track {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.prod-buffer-gauge__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #34d399, #059669);
    transition: width 0.35s ease;
}
.prod-buffer-lane--leftovers .prod-buffer-gauge__fill {
    background: linear-gradient(90deg, #fcd34d, #d97706);
}
.prod-buffer-gauge__fill--over { background: linear-gradient(90deg, #f87171, #dc2626); }
.prod-buffer-gauge__marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #0f172a;
    opacity: 0.35;
    transform: translateX(-50%);
}
.prod-buffer-gauge__labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 4px;
}
.prod-buffer-gauge__goal { color: #059669; font-weight: 700; }
.prod-buffer-lane__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.prod-buffer-chip {
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}
.prod-buffer-chip--warn { background: #fff7ed; color: #c2410c; }
.prod-buffer-products { display: flex; flex-direction: column; gap: 10px; }
.prod-buffer-product {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fafafa;
}
.prod-buffer-product--success { border-color: #86efac; background: #f0fdf4; }
.prod-buffer-product--warn { border-color: #fdba74; background: #fffbeb; }
.prod-buffer-product--danger { border-color: #fca5a5; background: #fef2f2; }
.prod-buffer-product__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.prod-buffer-product__title { margin: 0; font-size: 0.95rem; font-weight: 800; color: #0f172a; }
.prod-buffer-product__kg { font-size: 1.2rem; font-weight: 900; color: #0f172a; margin-bottom: 6px; }
.prod-buffer-pill {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.prod-buffer-pill--success { background: #dcfce7; color: #166534; }
.prod-buffer-pill--warn { background: #ffedd5; color: #9a3412; }
.prod-buffer-pill--danger { background: #fee2e2; color: #991b1b; }
.prod-buffer-pill--info { background: #e0f2fe; color: #075985; }
.prod-buffer-pill--muted { background: #f1f5f9; color: #64748b; }
.prod-buffer-product__bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: 6px;
}
.prod-buffer-product__bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}
.prod-buffer-product__bar-fill--success { background: #22c55e; }
.prod-buffer-product__bar-fill--warn { background: #f59e0b; }
.prod-buffer-product__bar-fill--danger { background: #ef4444; }
.prod-buffer-product__bar-fill--info { background: #38bdf8; }
.prod-buffer-product__meta,
.prod-buffer-product__hint {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0 0 8px;
}
.prod-buffer-sources__title { margin: 0 0 10px; font-size: 1rem; color: #0f172a; }
.prod-buffer-pallet {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
}
.prod-buffer-pallet__sum {
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.88rem;
}
.prod-buffer-pallet__kg { margin-left: auto; font-weight: 800; color: #059669; }
.prod-buffer-pallet__body { padding: 0 12px 12px; font-size: 0.82rem; color: #475569; }
.prod-buffer-pallet__tasks { margin: 8px 0 0; padding-left: 18px; }

.prod-analytics-range {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-filter select {
    padding: 8px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

/* KPI карточки */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--card-background);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color);
}

.kpi-card--drill {
    cursor: pointer;
}

.kpi-card--drill:focus {
    outline: 2px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

.kpi-hint {
    margin: 0 0 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-tertiary, #64748b);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.dashboard-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.dashboard-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid var(--border-light);
}

.dashboard-alert--warn {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.dashboard-alert--info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}

.dashboard-period-caption {
    margin: -12px 0 20px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.top-list-item--drill {
    cursor: pointer;
}

.top-list-item--drill:focus {
    outline: 2px solid var(--primary-color, #6366f1);
    outline-offset: 2px;
}

.kpi-icon {
    font-size: 2rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: var(--gradient-accent);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    transition: transform var(--transition-base);
    font-weight: normal;
    line-height: 1;
    color: white;
}

.kpi-card:hover .kpi-icon {
    transform: scale(1.1) rotate(5deg);
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-change {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-top: 4px;
}

.kpi-change.positive {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.kpi-change.negative {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

/* Дашборд сетка */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: var(--card-background);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.dashboard-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.dashboard-card canvas {
    max-height: 300px;
    width: 100%;
    height: 300px;
    display: block;
    background: var(--card-background);
    border-radius: var(--radius);
}

.top-list {
    list-style: none;
}

.top-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-base);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.top-list-item:hover {
    background: var(--background-secondary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.top-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Формы */
.form-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.form-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    background: var(--card-background);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.cutting-options {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 12px;
    border: 1px solid var(--border-light);
}

.option-group {
    margin-bottom: 20px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: var(--radius);
    transition: all var(--transition-base);
    user-select: none;
    border: 1.5px solid var(--border-color);
    background: var(--card-background);
}

.radio-label:hover {
    background: var(--background-secondary);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.radio-label:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--secondary-color);
}

.radio-label span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Кнопки */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm);
}

.btn-primary::before,
.btn-secondary::before,
.btn-danger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.btn-danger:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-secondary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--gradient-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-colored);
    filter: brightness(1.05);
}

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

.btn-secondary:hover {
    background: var(--background-secondary);
    border-color: var(--border-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
}

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

.btn-danger:hover {
    background: var(--gradient-danger);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3), 0 4px 6px -2px rgba(239, 68, 68, 0.2);
    filter: brightness(1.05);
}

/* Результаты производства */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.result-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    color: white;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transition: transform var(--transition-slow);
}

.result-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.result-card:hover::before {
    transform: rotate(45deg);
}

.result-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.result-percent {
    font-size: 0.9rem;
    opacity: 0.8;
}

.summary {
    background: var(--background);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.summary-item:first-child {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 10px;
}

/* История и списки данных */
.history-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.history-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-filters label {
    font-weight: 600;
    color: var(--text-primary);
}

.history-list,
.data-list {
    max-height: 600px;
    overflow-y: auto;
}

/* Карточки истории производства */
.production-history-card {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.production-history-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.production-history-card:hover::before {
    transform: scaleX(1);
}

.production-history-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-color);
}

.production-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.production-card-main-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.production-card-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.production-card-supplier {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.production-card-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.production-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
}

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

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.production-card-products {
    margin-bottom: 20px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.production-product-card {
    background: var(--background-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition-base);
    position: relative;
}

.production-product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary-color);
    background: var(--card-background);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--border-light);
}

.product-card-header strong {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.product-kpd-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-sm);
}

.product-kpd-badge.kpd-good {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.product-kpd-badge.kpd-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.product-kpd-badge.kpd-bad {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.product-card-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    gap: 8px;
}

.product-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.product-value {
    font-weight: 600;
    color: var(--text-primary);
}

.product-value.product-fact {
    font-size: 0.95rem;
}

.product-delta-percent {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.production-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.production-card-form,
.production-card-details {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.history-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1400px;
    background: var(--card-background);
    font-size: 0.9rem;
}

.history-table thead th {
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #f7f9fc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.history-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.06);
}

.history-row-details td {
    background: #fffaf0;
}

.history-cell-mono {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.cell-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.cell-title-small {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-align: center;
}

.cell-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f7f9fc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    min-width: 140px;
}

.cell-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    align-items: center;
}

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

.cell-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.cell-delta {
    font-weight: 700;
    font-size: 0.85rem;
}

.cell-muted {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.delta-positive {
    color: var(--success-color);
}

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

.history-date-cell {
    white-space: nowrap;
    font-weight: 600;
}

.supplier-cell {
    min-width: 150px;
}

.supplier-name {
    font-weight: 600;
    color: var(--text-primary);
}

.supplier-name.muted {
    color: var(--text-secondary);
    font-weight: normal;
}

.input-cell {
    text-align: center;
    font-size: 1rem;
}

.meat-cell {
    min-width: 180px;
    padding: 10px !important;
}

.meat-cell-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.meat-cell-plan {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 4px 6px;
    background: #f0f4f8;
    border-radius: 4px;
}

.meat-cell-fact {
    color: var(--text-primary);
    font-weight: 600;
    padding: 4px 6px;
    background: #e8f4f8;
    border-radius: 4px;
}

.meat-cell-fact strong {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.meat-cell-kpd {
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    margin: 4px 0;
}

.meat-cell-kpd.kpd-good {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.meat-cell-kpd.kpd-warning {
    background: rgba(241, 196, 15, 0.2);
    color: #f39c12;
}

.meat-cell-kpd.kpd-bad {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.meat-cell-kpd strong {
    font-size: 0.95rem;
}

.meat-cell-delta {
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
}

.meat-cell-delta.delta-positive {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.meat-cell-delta.delta-negative {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.meat-cell-delta.delta-zero {
    background: #f0f4f8;
    color: var(--text-secondary);
}

.total-cell {
    min-width: 160px;
    background: #f0f4f8;
}

.actions-cell {
    text-align: center;
}

.kpd-cell {
    text-align: center;
    min-width: 100px;
}

.kpd-value {
    font-weight: 700;
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
}

.kpd-value.muted {
    color: var(--text-secondary);
    font-weight: normal;
}

.kpd-good {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-weight: 700;
}

.kpd-warning {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-weight: 700;
}

.kpd-bad {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-weight: 700;
}

.forecast-products-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.forecast-product-item {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-end;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.forecast-product-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.forecast-product-item .form-group {
    flex: 1;
    margin-bottom: 0;
}

.forecast-results {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-top: 24px;
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
}

.forecast-results:hover {
    box-shadow: var(--shadow-md);
}

.forecast-summary-card {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.forecast-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

.forecast-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.forecast-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
}

.forecast-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.forecast-details-section {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
}

.forecast-details-section:hover {
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.forecast-details-section h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.forecast-detail-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.forecast-detail-item.muted {
    color: var(--text-secondary);
    font-style: italic;
}

.history-item,
.data-item {
    background: var(--background);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid var(--secondary-color);
    transition: transform 0.2s;
}

.history-item:hover,
.data-item:hover {
    transform: translateX(5px);
}

.history-item-header,
.data-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    gap: 10px;
}

.finance-type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.finance-type-purchase { background: #e3f2fd; color: #1565c0; }
.finance-type-sale { background: #e8f5e9; color: #2e7d32; }
.finance-type-expense { background: #ffebee; color: #c62828; }

/* Внутренняя навигация раздела «Финансы» (закупка / продажа / расход / отчёты) — в духе finance-segmented */
.finance-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 18px;
    padding: 6px;
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.finance-subnav-btn {
    position: relative;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.finance-subnav-btn:hover {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-primary);
}

.finance-subnav-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.finance-subnav-btn.is-active {
    background: var(--card-background);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.finance-view-reports[hidden] {
    display: none !important;
}

.finance-reports-intro {
    margin: 0 0 14px;
    padding: 12px 14px;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.finance-reports-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.finance-reports-toolbar-fields {
    flex: 1 1 280px;
    min-width: 0;
}

.finance-reports-select {
    max-width: 100%;
    width: min(420px, 100%);
    margin-top: 4px;
}

.finance-reports-hint {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--text-tertiary, #64748b);
}

.finance-reports-content {
    margin-top: 4px;
}

#finances.finance-sub--purchase .finance-field--types,
#finances.finance-sub--sale .finance-field--types,
#finances.finance-sub--expense .finance-field--types {
    display: none;
}

/* Панель фильтров финансов */
.finance-filters-toggle-wrap {
    margin-bottom: var(--spacing-md);
}

.finance-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
}

.finance-filters-panel {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.finance-filters-panel:focus-within {
    box-shadow: var(--shadow);
}

.finance-filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.finance-filters-row--toolbar {
    justify-content: space-between;
}

.finance-quick-period {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-width: min(100%, 320px);
}

.finance-filters-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.finance-pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.finance-pill {
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.finance-pill:hover {
    background: var(--background-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.finance-pill:active {
    transform: scale(0.98);
}

.finance-saved-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.btn-compact {
    padding: 8px 14px;
    font-size: 0.8125rem;
    margin: 0;
}

.finance-select {
    min-width: 200px;
    max-width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.finance-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md) var(--spacing-lg);
    align-items: start;
}

.finance-field--grow {
    grid-column: span 2;
    min-width: 240px;
}

@media (max-width: 720px) {
    .finance-field--grow {
        grid-column: span 1;
    }
}

.finance-field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.finance-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.finance-input:hover {
    border-color: var(--border-dark);
}

.finance-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.finance-field-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1.35;
}

.finance-field--multiselect {
    grid-column: span 1;
    min-width: 220px;
}

.finance-multiselect {
    position: relative;
}

.finance-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    color: var(--text-primary);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.finance-multiselect-trigger:hover {
    border-color: var(--accent-light);
}

.finance-multiselect-trigger[aria-expanded="true"] {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.finance-multiselect-summary {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.finance-multiselect-chevron {
    flex-shrink: 0;
    font-size: 0.65rem;
    opacity: 0.7;
}

.finance-multiselect-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1200;
    padding: 8px;
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.finance-multiselect-search {
    width: 100%;
    margin-bottom: 8px;
    padding: 8px 10px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.finance-multiselect-search:focus {
    outline: none;
    border-color: var(--accent-color);
}

.finance-multiselect-list {
    max-height: 220px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
}

.finance-ms-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 2px 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.finance-ms-option:hover {
    background: var(--background-secondary);
}

.finance-ms-option input.finance-ms-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-color);
    cursor: pointer;
    flex-shrink: 0;
}

.finance-type-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.finance-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.finance-type-chip.finance-type-chip--on {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-dark);
}

.finance-type-chip:hover {
    border-color: var(--border-color);
}

.finance-segmented {
    display: flex;
    flex-wrap: wrap;
    padding: 4px;
    gap: 4px;
    background: var(--background-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.finance-segment {
    flex: 1;
    min-width: 88px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.finance-segment:hover {
    color: var(--text-primary);
    background: var(--card-background);
}

.finance-segment.is-active {
    color: var(--text-inverse);
    background: var(--gradient-secondary);
    box-shadow: var(--shadow-sm);
}

.finance-field--actions {
    display: flex;
    align-items: flex-end;
}

.finance-field--actions .btn-secondary {
    width: 100%;
    justify-content: center;
}

.btn-edit {
    padding: 10px 20px;
    background: var(--gradient-secondary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit:hover {
    background: var(--gradient-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-colored);
    filter: brightness(1.05);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
    margin: 0 4px;
    border-radius: var(--radius);
    font-weight: 500;
}

/* Финансы табы */
.finance-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: var(--background);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--border-color);
}

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

.finance-tab {
    display: none;
    margin-top: 20px;
}

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

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.modal-content {
    background: var(--card-background);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-light);
    animation: slideUp var(--transition-base);
    position: relative;
}

/* Выезжающая панель справа (длинные формы, списки ячеек / партий) */
.modal-overlay.modal-overlay--drawer {
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
}

.modal-content.modal-content--drawer {
    width: min(560px, 100vw);
    max-width: min(560px, 100vw);
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    padding: 24px 24px 28px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInDrawer 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-content.modal-content--drawer .modal-header {
    flex-shrink: 0;
}

.modal-content.modal-content--drawer > *:not(.modal-header):not(.modal-drawer-body) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.modal-content.modal-content--drawer .modal-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

/* Секции длинных форм в настройках */
.settings-form-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--card-background, #fff);
    margin-bottom: 16px;
    overflow: hidden;
}

.settings-form-section[open] {
    overflow: visible;
}

.settings-form-section > summary.settings-form-section-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.settings-form-section > summary.settings-form-section-summary::-webkit-details-marker {
    display: none;
}

.settings-form-section > summary.settings-form-section-summary::after {
    content: '▾';
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    transition: transform 0.2s ease;
}

.settings-form-section[open] > summary.settings-form-section-summary::after {
    transform: rotate(-180deg);
}

.settings-form-section-body {
    padding: 16px 14px 18px;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-header h3.modal-title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    -webkit-text-fill-color: var(--text-primary);
    color: var(--text-primary);
}

.modal-header h3.modal-title-with-icon svg.icon-use {
    stroke: var(--secondary-color, #6366f1);
    flex-shrink: 0;
}

.modal-content .btn-close:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.modal-body {
    padding: 0 2px 4px;
}

.finance-save-filter-modal .finance-input {
    margin-top: 6px;
}

.finance-save-filter-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* Настройки: боковое меню разделов (в духе главной навигации) */
.settings-muted {
    color: #64748b;
    font-size: 0.85rem;
}

.settings-norm-profiles-lead {
    margin: 0 0 10px;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #64748b;
}

.settings-norm-profiles-root {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.settings-norm-profile-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.settings-norm-profile-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-norm-profile-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafafa;
}

.settings-norm-profile-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.settings-norm-profile-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    flex: 1;
    min-width: 0;
}

.settings-norm-profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    min-width: 140px;
}

.settings-norm-profile-products {
    margin-top: 4px;
}

.settings-norm-profile-products summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #0369a1;
    font-weight: 600;
}

.settings-norm-profile-product-grid {
    margin-top: 8px;
    display: grid;
    gap: 6px;
    max-height: 240px;
    overflow: auto;
    padding-right: 4px;
}

.settings-norm-profile-product-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 100px;
    gap: 8px;
    align-items: center;
    font-size: 0.82rem;
}

.settings-norm-profile-product-label small {
    color: #94a3b8;
    font-weight: 400;
}

.settings-norm-profiles-advanced {
    margin-top: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px 10px;
    background: #f9fafb;
}

.settings-norm-profiles-advanced summary {
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    font-size: 0.82rem;
    list-style: none;
}

.settings-norm-profiles-advanced summary::-webkit-details-marker {
    display: none;
}

.settings-norm-profiles-json-ta {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    resize: vertical;
    min-height: 100px;
    background: #fff;
}

.settings-norm-profiles-json-note {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.4;
}

.settings-norm-profile-hint {
    margin: 8px 0 0;
    font-size: 0.8rem;
}

.settings-wms-mobcat-scroll {
    max-height: min(62vh, 520px);
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
}

.settings-wms-cat-block {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
}

.settings-wms-cat-block:last-child {
    margin-bottom: 0;
}

.settings-wms-cat-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    list-style: none;
}

.settings-wms-cat-summary::-webkit-details-marker {
    display: none;
}

.settings-wms-cat-title {
    flex: 1;
    min-width: 0;
}

.settings-wms-cat-meta {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.settings-wms-cat-body {
    padding: 8px 10px 10px;
    border-top: 1px solid #e2e8f0;
}

.settings-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 52vh;
    margin-bottom: 20px;
}

/* Настройки: нейтральный сайдбар (Tabler / Primer-подобный) */
.settings-sidebar-nav {
    flex: 0 0 208px;
    background: var(--background-secondary);
    border-radius: 0;
    padding: 4px 0 10px;
    box-shadow: none;
    border: none;
    border-right: 1px solid var(--border-light);
}

.settings-nav-menu {
    list-style: none;
    margin: 0;
    padding: 4px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: none;
    overflow: visible;
}

.settings-nav-section-label {
    list-style: none;
    margin: 14px 10px 6px;
    padding: 0;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    user-select: none;
}

.settings-nav-section-label:first-child {
    margin-top: 4px;
}

.settings-nav-item {
    margin: 0;
}

.settings-nav-link {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    white-space: normal;
    line-height: 1.3;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-nav-link:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.settings-nav-link.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-dark);
    font-weight: 600;
}

.settings-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: transform var(--transition-fast);
}

.settings-nav-link:hover::before,
.settings-nav-link.active::before {
    transform: scaleY(1);
}

.settings-nav-group {
    margin: 0;
}

.settings-nav-group-toggle {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--background-secondary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    line-height: 1.3;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-nav-group-toggle:hover {
    background: var(--background-tertiary);
    color: var(--text-primary);
}

.settings-nav-group-label {
    flex: 1;
    min-width: 0;
}

.settings-nav-chevron {
    flex-shrink: 0;
    font-size: 0.6rem;
    opacity: 0.55;
    margin-left: 4px;
    line-height: 1;
    color: var(--text-tertiary);
    transition: var(--nav-chevron-transition);
}

.settings-nav-group.open .settings-nav-chevron {
    transform: rotate(180deg);
}

.settings-nav-submenu {
    list-style: none;
    margin: 2px 0 4px 0;
    padding: 4px 0 6px 10px;
    display: none;
    flex-direction: column;
    gap: 1px;
    border-left: 2px solid var(--border-light);
    margin-left: 14px;
}

.settings-nav-group.open .settings-nav-submenu {
    display: flex;
}

.settings-nav-submenu li {
    margin: 0;
}

.settings-nav-sublink {
    width: 100%;
    display: block;
    padding: 7px 10px 7px 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    line-height: 1.35;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.settings-nav-sublink:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.settings-nav-sublink.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-dark);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent-color);
}

.settings-nav-link.settings-nav-dirty,
.settings-nav-sublink.settings-nav-dirty,
.settings-nav-group-toggle.settings-nav-dirty {
    position: relative;
}

.settings-nav-link.settings-nav-dirty::after,
.settings-nav-sublink.settings-nav-dirty::after,
.settings-nav-group-toggle.settings-nav-dirty::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: #d97706;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.settings-panel-page-head {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.settings-panel-page-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.settings-panel-page-title--warn {
    color: var(--danger-dark);
}

.settings-panel-page-desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-tertiary);
    max-width: none;
}

.settings-panel-page-desc code {
    font-size: 0.84em;
}

/* Настройки: одна шапка (заголовок + поиск + действия) внутри контента */
.settings-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 14px;
}

.settings-page-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.settings-page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

#settings .settings-page-header-row .settings-top-tools {
    flex: 1 1 220px;
    min-width: 0;
    margin-bottom: 0;
    box-shadow: none;
    background: var(--background-secondary);
}

.settings-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

mark.settings-search-mark {
    background: rgba(250, 204, 21, 0.42);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.settings-layout {
    position: relative;
}

.settings-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 14px;
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--card-background);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.settings-mobile-menu-btn:hover {
    background: var(--background-secondary);
}

.settings-layout-backdrop {
    display: none;
}

.settings-layout-backdrop--visible {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(15, 23, 42, 0.42);
    cursor: pointer;
}

@media (min-width: 901px) {
    .settings-layout-backdrop--visible {
        display: none !important;
    }
}

body.settings-mobile-nav-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .settings-mobile-menu-btn {
        display: inline-flex;
    }

    #settings .settings-layout {
        flex-direction: column;
        gap: 0;
    }

    #settings .settings-sidebar-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1200;
        width: min(288px, 90vw);
        max-height: 100vh;
        margin: 0;
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
        transform: translateX(-105%);
        transition: transform var(--transition-base);
        box-shadow: var(--shadow-md);
    }

    #settings .settings-layout--nav-open .settings-sidebar-nav {
        transform: translateX(0);
    }

    #settings .settings-panels {
        flex: 1;
        min-height: 0;
    }
}

.settings-save-dirty {
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35);
}

.settings-search-hidden {
    display: none !important;
}

.settings-input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.settings-input-ok {
    border-color: #16a34a !important;
}

.settings-url-live {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
}

.settings-wms-subpanel-title {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

/* Настройки: на всю высоту экрана, без вложенных «коробок» */
#settings.content-section.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px);
    min-height: calc(100vh - 72px);
    max-height: none;
}

#settings #settingsContent {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#settings .settings-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#settings .settings-layout {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    margin-bottom: 0;
    display: flex;
    align-items: stretch;
    gap: 16px;
    overflow: hidden;
}

/* Сайдбар + контент: плоский макет на всю ширину */
#settings .settings-layout--unified,
#settings .settings-layout--fullscreen {
    gap: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

#settings .settings-layout--unified .settings-sidebar-nav {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--background-secondary);
    border-right: 1px solid var(--border-light);
}

#settings .settings-sidebar-nav {
    align-self: stretch;
    position: sticky;
    top: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 0 0 208px;
    padding: 6px 0 12px;
    -webkit-overflow-scrolling: touch;
}

.settings-page-header-row--actions-only {
    justify-content: flex-end;
}

.settings-page-header-row--actions-only .settings-page-actions {
    margin-left: auto;
}

#settings .settings-layout--unified .settings-panels {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

#settings .settings-panels {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    margin-left: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 16px 16px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.settings-wms-scheme-wh-bar {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: #f8fafc;
}

.settings-wms-scheme-wh-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #0f172a;
}

.settings-wms-scheme-wh-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.settings-wms-scheme-wh-select {
    flex: 1 1 220px;
    min-width: 200px;
    max-width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.settings-wms-scheme-wh-hint {
    margin: 0;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.45;
}

.settings-wms-scheme-wh-msg {
    font-size: 0.8rem;
    color: #64748b;
    min-height: 1.1em;
}

.settings-panel-inner--wms-scheme {
    max-width: none;
}

.settings-wms-locations-block {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

#settings .settings-wms-locations-block .settings-wms-subpanel-title {
    margin: 0;
    font-size: 0.95rem;
}

.settings-wms-locations-list {
    max-height: min(200px, 28vh);
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
}

.settings-panels {
    flex: 1;
    min-width: 0;
    margin-left: 0;
}

.settings-panel {
    display: none;
}

.settings-panel.is-active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#settings .settings-panel-page-head {
    flex-shrink: 0;
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border-light);
}

#settings .settings-panel-page-desc {
    max-width: none;
}

.settings-panel-inner,
#settings .settings-panel-inner--form,
#settings .settings-panel-inner--form-tight,
#settings .settings-panel-inner--column,
#settings .settings-panel-inner--pricelist-full,
#settings .settings-panel-inner--wms-catalog-full,
#settings .settings-panel-inner--wms-scheme,
#settings .settings-panel-users-inner,
#settings .settings-notif-rows {
    max-width: none !important;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 16px;
}

#settings #usersList.data-list {
    max-height: none;
    overflow: visible;
}

#settings .settings-notif-row {
    grid-template-columns: minmax(88px, 120px) minmax(0, 1fr);
}

#settings .settings-panel-inner.settings-notif-rows {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 4px 16px 8px;
}

#settings .settings-panel-inner--wms-scheme {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#settings .settings-wms-visual-editor-host {
    width: 100%;
    min-height: 0;
    flex-shrink: 0;
}

#settings #wms-vis-grid-wrap {
    max-height: min(52vh, 560px) !important;
}

#settings .settings-scroll-box {
    max-height: min(42vh, 420px);
}

#settings .settings-wh-list-box {
    max-height: min(36vh, 360px);
}

#settings .settings-wms-locations-list {
    max-height: min(28vh, 280px);
}

#settings .data-list {
    max-height: none !important;
    overflow: visible;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

/* ——— Настройки: единая сетка полей (убираем инлайн из settings.js) ——— */
#settings .settings-top-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 14px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

#settings .settings-search-input {
    flex: 1;
    min-width: 200px;
    max-width: 560px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#settings .settings-search-input:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#settings .settings-panel-inner--form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: stretch;
}

#settings .settings-panel-inner--form-tight {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    /* Скролл на этом же блоке — дочерние секции не растягивают панель за экран */
    min-height: 0;
    overflow-y: auto;
}

/* Карточки секций внутри панели (как Tabler settings) */
#settings .settings-panel-inner--form > .form-group,
#settings .settings-panel-inner--form-tight > .form-group {
    margin: 0;
    padding: 14px 16px;
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: none;
}

#settings .settings-panel-inner--form-tight > .settings-form-section,
#settings .settings-panel-inner--form > .settings-form-section {
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    min-height: auto;
    overflow: visible;
    background: var(--card-background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: none;
}

#settings .settings-form-section:not([open]) {
    overflow: hidden;
}

#settings .settings-panel-inner--form > .form-group .settings-subbox,
#settings .settings-panel-inner--form-tight > .form-group .settings-subbox {
    background: var(--card-background);
}

#settings .settings-panel-inner--form > .settings-callout,
#settings .settings-panel-inner--form-tight > .settings-callout {
    margin: 0;
    background: var(--background);
    border-color: var(--border-light);
}

#settings .settings-panel-inner--form > .settings-toolbar-row + .form-group,
#settings .settings-panel-inner--form-tight > .settings-toolbar-row + .form-group {
    margin-top: 0;
}

#settings .settings-field-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

#settings .settings-field-label--strong {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#settings .settings-field-label--spaced {
    margin-top: 10px;
}

#settings .settings-input,
#settings .settings-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--card-background);
    color: var(--text-primary);
}

#settings .settings-input--max420 {
    max-width: 420px;
}

#settings .settings-input:disabled {
    background: var(--background-secondary);
    color: var(--text-tertiary);
}

#settings .settings-select--multi {
    min-width: 190px;
    padding: 4px 8px;
}

#settings .settings-help {
    display: block;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.45;
}

#settings .settings-help--tight {
    margin-top: 4px;
}

#settings .settings-help--flush {
    margin: 0;
}

#settings .settings-stack {
    display: grid;
    gap: var(--spacing-sm);
}

#settings .settings-two-col {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 140px;
    gap: 10px;
    align-items: center;
}

#settings .settings-text-muted {
    color: var(--text-muted);
    font-size: 0.82rem;
}

#settings .settings-subbox {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--background-secondary);
}

#settings .settings-callout {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--background-secondary);
    display: grid;
    gap: 10px;
}

#settings .settings-callout--muted {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

#settings .settings-callout-row {
    margin-top: 4px;
}

#settings .settings-callout-row:first-child {
    margin-top: 0;
}

#settings .settings-callout-foot {
    margin-top: 6px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

#settings .settings-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
}

#settings .settings-toolbar-row--between {
    justify-content: space-between;
}

#settings .settings-status-line {
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

#settings .settings-grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

#settings .settings-form-group--flush {
    margin: 0;
}

#settings .settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#settings .settings-checkbox-label input[type='checkbox'] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

#settings .settings-checkbox-label--compact input[type='checkbox'] {
    width: 16px;
    height: 16px;
}

#settings .settings-inline-field {
    display: grid;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#settings .settings-inline-field .settings-input {
    width: 100%;
}

#settings .settings-title-warn {
    color: var(--danger-dark);
}

#settings .settings-scroll-box {
    max-height: 180px;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: var(--background-secondary);
}

#settings .settings-scroll-box > .settings-checkbox-label {
    margin-bottom: 6px;
}

#settings .settings-scroll-box > .settings-checkbox-label:last-child {
    margin-bottom: 0;
}

#settings .settings-checkbox-label--strong span:last-child {
    font-weight: 500;
    color: var(--text-primary);
}

#settings .settings-cutters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    width: 100%;
}

#settings .settings-cutters-card {
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--card-background);
}

#settings .settings-cutters-card-meta {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

#settings .settings-panel-lead {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-tertiary);
}

#settings .settings-panel-inner--column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#settings .settings-pricelist-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

#settings .settings-expense-list {
    margin-bottom: 10px;
}

#settings .settings-expense-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

#settings .settings-expense-row .settings-input {
    flex: 1;
}

#settings .settings-wms-product-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

#settings .settings-wms-product-row > .set-wms-product-item,
#settings .settings-carver-row > .set-carver-product-item {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

#settings .settings-wms-matrix-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#settings .settings-wms-matrix-col .settings-help {
    margin-top: 0;
}

#settings .settings-carver-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

#settings .settings-carver-row .settings-select {
    width: auto;
    min-width: 120px;
    padding: 4px 8px;
}

#settings .settings-wh-list-box {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--card-background);
    max-height: 220px;
    overflow: auto;
}

#settings .settings-wh-msg {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

#settings .settings-panels {
    box-shadow: none;
}

/* Price catalog (settings -> nomenclature) */
.price-catalog-shell {
    display: grid;
    gap: 16px;
}

.price-catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.price-catalog-title h3 {
    margin: 0;
    font-size: 1.15rem;
}

.price-catalog-title p {
    margin: 6px 0 0;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.price-catalog-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.price-category-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.price-chip {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.price-chip.is-active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-dark);
    border-color: var(--accent-color);
}

.price-category-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    background: #fff;
}

.price-category-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.price-category-head h4 {
    margin: 0;
    font-size: 1rem;
}

.price-category-head span {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.price-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
}

.price-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 8px;
}

.price-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.price-name {
    font-weight: 700;
    color: var(--text-primary);
}

.price-code {
    color: var(--text-tertiary);
    font-size: 0.82rem;
}

.price-card-actions {
    display: flex;
    gap: 6px;
}

.price-meta {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.price-category-edit {
    display: grid;
    gap: 6px;
}

.price-category-edit label {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

/* Modern nomenclature catalog */
.price-catalog-modern .price-catalog-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
}
.price-catalog-modern .price-catalog-top h3 {
    margin: 0;
    font-size: 1.2rem;
}
.price-catalog-modern .price-catalog-top p {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}
.price-catalog-search-row {
    margin-top: 12px;
}
.price-catalog-search {
    width: 100%;
    max-width: 480px;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.06a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
}
.price-catalog-body {
    display: grid;
    grid-template-columns: minmax(200px, 260px) 1fr;
    gap: 16px;
    margin-top: 14px;
    align-items: start;
}
.price-catalog-sidebar {
    position: sticky;
    top: 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-background);
    padding: 12px;
    max-height: calc(100vh - 180px);
    overflow: auto;
}
.price-sidebar-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.price-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}
.price-nav-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.price-nav-row .price-nav-item {
    flex: 1;
    min-width: 0;
}
.price-cat-edit-btn,
.price-cat-delete-btn {
    flex-shrink: 0;
    align-self: center;
}
.price-nav-sub-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
}
.price-nav-sub-row .price-nav-item {
    flex: 1;
    min-width: 0;
}
.price-category-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}
.price-table-section-head,
.price-category-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.price-table-section-head h4,
.price-category-head h4 {
    margin: 0;
    flex: 1;
    min-width: 120px;
}
.price-nav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: background 0.12s, border-color 0.12s;
}
.price-nav-item:hover {
    background: #f1f5f9;
}
.price-nav-item.is-active {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--accent-dark);
    font-weight: 600;
}
.price-nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.price-nav-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.price-nav-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}
.price-nav-item.is-active .price-nav-count {
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent-dark);
}
.price-nav-item.is-empty {
    opacity: 0.72;
}
.price-nav-item.is-empty .price-nav-count {
    font-style: italic;
}
.price-nav-group {
    margin-bottom: 4px;
}
.price-nav-sublist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 6px 14px;
    border-left: 2px solid #e2e8f0;
    margin: 2px 0 6px 8px;
}
.price-nav-item--sub {
    font-size: 0.88rem;
    padding: 6px 8px;
}
.price-nav-row .price-subcat-add-btn {
    flex-shrink: 0;
    min-width: 28px;
    padding: 4px 8px;
}
.price-nav-flags {
    display: flex;
    gap: 2px;
}
.price-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.62rem;
    font-weight: 800;
    border-radius: 4px;
    background: #e2e8f0;
    color: #94a3b8;
}
.price-flag.is-on {
    background: #dbeafe;
    color: #1d4ed8;
}
.price-flag--companion.is-on {
    background: #fef3c7;
    color: #b45309;
}
.price-flag--kyroff.is-on {
    background: #dcfce7;
    color: #15803d;
}
.price-kyroff-toggle {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    color: #94a3b8;
    font-weight: 800;
    font-size: 0.75rem;
    cursor: pointer;
}
.price-kyroff-toggle.is-on {
    background: #dcfce7;
    border-color: #86efac;
    color: #15803d;
}
.price-kyroff-prices-hint {
    font-size: 0.72rem;
    color: #15803d;
    font-weight: 700;
}
.price-client-prices-grid {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    max-height: 220px;
    overflow: auto;
}
.price-client-price-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 8px;
    align-items: center;
}
.price-client-price-label {
    font-size: 0.88rem;
    color: #334155;
}
.price-sidebar-add-cat {
    width: 100%;
    margin-top: 8px;
}
.price-catalog-main {
    min-width: 0;
}
.price-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}
.price-view-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-tertiary);
}
.price-view-btn.is-active {
    background: var(--accent-color);
    color: #fff;
}
.price-category-flags-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.price-category-flags-bar .price-cat-edit-btn {
    margin-left: auto;
}
.price-category-flags-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 4px;
}
.price-flag-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.price-table-wrap {
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: #fff;
    margin-bottom: 16px;
}
.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.price-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}
.price-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.price-table tbody tr:hover {
    background: #f8fafc;
}
.price-td-product {
    min-width: 180px;
    max-width: 280px;
}
.price-td-name {
    font-weight: 600;
    color: var(--text-primary);
}
.price-td-sub {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.price-td-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.price-td-sale {
    font-weight: 600;
    color: #0f766e;
}
.price-code-pill {
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
}
.price-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.price-badge--dir {
    background: #e0e7ff;
    color: #3730a3;
}
.price-badge--raw {
    background: #fce7f3;
    color: #9d174d;
}
.price-badge--companion {
    background: #fef3c7;
    color: #b45309;
}
.price-badge--default {
    background: #f1f5f9;
    color: #64748b;
}
.price-badge--muted {
    background: #f8fafc;
    color: #94a3b8;
    font-weight: 500;
}
.price-inline-select {
    max-width: 140px;
    padding: 4px 8px;
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.price-td-actions {
    white-space: nowrap;
}
.price-table-section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 16px 0 8px;
}
.price-table-section-head h4 {
    margin: 0;
    font-size: 1rem;
}
.price-table-section-head span {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}
.price-card-prices {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
}
.price-card-prices small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
}
.price-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.price-empty {
    padding: 24px;
    text-align: center;
}
.price-form-modern .price-form-section {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 14px 6px;
    margin-bottom: 12px;
}
.price-form-modern legend {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0 6px;
    color: var(--text-secondary);
}
.price-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.price-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
#settings #priceListSettings.data-list--pricelist {
    overflow: visible !important;
}

#settings-panel-pricelist .settings-panel-page-head--compact {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 8px;
}

.settings-pricelist-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

#settings-panel-pricelist .settings-panel-inner--pricelist-full {
    flex: 1;
    min-height: 0;
    max-width: none !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.price-catalog--fullscreen {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-catalog-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.price-catalog-toolbar-row .price-catalog-search {
    flex: 1 1 280px;
    max-width: none;
    margin-top: 0;
}

.price-catalog-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.price-filter-hint {
    margin: 8px 0 0;
    padding: 10px 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.88rem;
    line-height: 1.4;
}

.price-catalog--fullscreen .price-catalog-body {
    flex: 1;
    min-height: 0;
    margin-top: 0;
    grid-template-columns: minmax(200px, 22%) minmax(0, 1fr);
    align-items: stretch;
    height: 100%;
}

.price-catalog--fullscreen .price-catalog-sidebar {
    position: relative;
    top: auto;
    max-height: none;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    border-radius: var(--radius);
}

.price-catalog--fullscreen .price-catalog-main {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    height: 100%;
}

.price-catalog--fullscreen .price-table-wrap {
    overflow: visible;
    margin-bottom: 0;
}

.price-catalog--fullscreen .price-table {
    min-width: 900px;
}

/* WMSmob: каталог позиций склада */
#settings-panel-wms-mobcat .settings-panel-inner--wms-catalog-full {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    min-height: 0;
}

.wms-catalog-wh-bar {
    flex-shrink: 0;
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-background);
}

.wms-catalog-mount {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.wms-catalog--embedded {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wms-catalog-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    flex-shrink: 0;
}

.wms-catalog-search {
    flex: 1 1 240px;
    min-width: 180px;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.06a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 10px center;
}

.wms-catalog-filter-enabled {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.wms-catalog-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.wms-catalog-hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.45;
    flex-shrink: 0;
}

.wms-catalog-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(240px, 32%) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.wms-catalog-sidebar {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-background);
    padding: 10px;
    overflow-y: auto;
    min-height: 0;
}

.wms-catalog-sidebar-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.wms-catalog-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0;
}

.wms-catalog-nav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.wms-catalog-nav-item:hover {
    background: var(--background-secondary);
}

.wms-catalog-nav-item.is-active {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.25);
    color: var(--accent-dark);
    font-weight: 600;
}

.wms-catalog-nav-item.is-empty {
    opacity: 0.72;
}

.wms-catalog-nav-item.is-empty .wms-catalog-nav-count {
    font-style: italic;
}

.wms-catalog-nav-group {
    margin-bottom: 4px;
}

.wms-catalog-nav-sublist {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 6px 12px;
    margin-left: 8px;
    border-left: 2px solid var(--border-color, #e2e8f0);
}

.wms-catalog-nav-item--sub {
    font-size: 0.88rem;
}

.wms-catalog-nav-count {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 600;
}

.wms-catalog-sidebar-foot {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.wms-catalog-list-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-background);
    overflow: hidden;
}

.wms-catalog-list-head {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-light);
    background: #f8fafc;
}

.wms-catalog-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wms-catalog-list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px 10px;
    align-items: center;
    width: 100%;
    padding: 10px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.wms-catalog-list-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.wms-catalog-list-item.is-active {
    border-color: var(--accent-color);
    background: rgba(37, 99, 235, 0.06);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.wms-catalog-list-item.is-enabled .wms-catalog-list-name {
    font-weight: 600;
}

.wms-catalog-list-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.wms-catalog-list-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wms-catalog-list-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wms-catalog-list-code {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: ui-monospace, monospace;
}

.wms-catalog-list-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.wms-catalog-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wms-catalog-badge--on {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.wms-catalog-detail-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-background);
    overflow: hidden;
}

.wms-catalog-detail-headbar {
    flex-shrink: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.wms-catalog-detail-headbar strong {
    color: var(--text-primary);
    font-weight: 600;
}

.wms-catalog-detail-panes {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.wms-catalog-detail-pane {
    padding: 14px 16px 18px;
}

.wms-catalog-detail-head {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.wms-catalog-detail-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 600;
}

.wms-catalog-detail-code {
    font-size: 0.82rem;
    color: var(--text-tertiary);
}

.wms-catalog-detail-grid {
    display: grid;
    gap: 16px;
}

.wms-catalog-detail-section {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: #f8fafc;
}

.wms-catalog-detail-section-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.wms-catalog-field {
    display: grid;
    gap: 6px;
}

.wms-catalog-field-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.wms-catalog-field-hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.wms-catalog-field-control {
    width: 100%;
}

.wms-catalog-empty {
    padding: 24px 12px;
    text-align: center;
}

@media (max-width: 1100px) {
    .wms-catalog-body {
        grid-template-columns: minmax(160px, 200px) 1fr;
        grid-template-rows: minmax(180px, 36vh) minmax(0, 1fr);
    }
    .wms-catalog-detail-col {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .wms-catalog-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .wms-catalog-sidebar {
        max-height: 200px;
    }
    .wms-catalog-list-col {
        max-height: 36vh;
    }
}

.price-td-category .price-inline-select {
    max-width: none;
    min-width: 120px;
    width: 100%;
}

@media (max-width: 960px) {
    .price-catalog--fullscreen .price-catalog-body {
        grid-template-columns: 1fr;
    }
    .price-catalog-body {
        grid-template-columns: 1fr;
    }
    .price-catalog-sidebar {
        position: static;
        max-height: none;
    }
    .price-nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .price-nav-item {
        width: auto;
        flex: 1 1 auto;
        min-width: 140px;
    }
    .price-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar-nav {
        flex: none;
        width: 100%;
    }

    .settings-panels {
        margin-left: 0;
        margin-top: 12px;
    }

    .settings-nav-menu {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .settings-nav-link,
    .settings-nav-group-toggle {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    .settings-nav-submenu {
        margin-left: 14px;
    }
}

/* Настройки: компактный блок уведомлений */
.settings-notifications-card {
    grid-column: 1 / -1;
    background: var(--card-background) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    padding: 14px 18px 16px !important;
    box-shadow: var(--shadow-sm);
}

.settings-notifications-card-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.settings-notifications-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.settings-notif-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-notif-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px 14px;
    padding: 10px 0;
    align-items: start;
    border-bottom: 1px solid var(--border-light);
}

.settings-notif-row--last {
    border-bottom: none;
    padding-bottom: 2px;
}

.settings-notif-cat {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    line-height: 1.4;
    padding-top: 3px;
}

.settings-notif-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.settings-notif-fields--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.settings-notif-subrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    padding-left: 0;
}

.settings-notif-subrow--wrap {
    gap: 8px 16px;
}

.settings-check-inline,
.settings-inline-num {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    line-height: 1.35;
}

.settings-check-inline input[type="checkbox"],
.settings-inline-num input {
    cursor: pointer;
}

.settings-check-inline input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}

.settings-input-compact {
    width: 3.25rem;
    min-width: 3.25rem;
    padding: 5px 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-background);
}

.settings-input-compact:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.settings-unit {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 520px) {
    .settings-notif-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .settings-notif-cat {
        padding-top: 0;
    }
}

.btn-close {
    background: var(--background-secondary);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.btn-close:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* Форма фактических данных */
.actual-data-form {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.actual-data-form h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.actual-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.actual-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.actual-input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.actual-input-group input {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.actual-input-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.planned-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.btn-save-actual {
    padding: 10px 20px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-save-actual:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Детальная информация о производстве */
.production-details {
    background: #f8f9fa;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.production-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.production-details-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.production-details-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.details-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.details-table-wrap {
    overflow-x: auto;
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.details-table thead {
    background: var(--primary-color);
    color: white;
}

.details-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.details-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.details-table tbody tr:hover {
    background: #f8f9fa;
}

.details-table tbody tr:last-child {
    border-bottom: none;
}

.details-total-row {
    background: #e8f4f8 !important;
    font-weight: 700;
}

.details-total-row td {
    border-top: 2px solid var(--primary-color);
    padding-top: 15px;
}

.delta-positive {
    color: #27ae60;
    font-weight: 600;
}

.delta-negative {
    color: #e74c3c;
    font-weight: 600;
}

.delta-zero {
    color: var(--text-secondary);
}

.delta-percent {
    font-size: 0.85rem;
    margin-left: 5px;
    opacity: 0.8;
}

.details-note {
    padding: 12px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #856404;
}

.details-note p {
    margin: 0;
}

.history-date {
    font-weight: 600;
    color: var(--secondary-color);
}

.history-input {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.history-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.history-detail-item {
    text-align: center;
}

.history-detail-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.history-detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.history-detail-value .planned {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.history-detail-value .actual {
    color: var(--success-color);
    font-weight: 600;
}

.history-detail-value .loss {
    color: var(--danger-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.history-detail-value .gain {
    color: #27ae60;
    font-size: 0.9rem;
    font-weight: 600;
}

.history-detail-value .loss-total {
    color: var(--danger-color);
    font-size: 1rem;
    font-weight: 700;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 2px solid var(--danger-color);
}

.history-detail-value .gain-total {
    color: #27ae60;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 2px solid #27ae60;
}

.empty-state {
    text-align: center;
    color: var(--text-tertiary);
    padding: 48px 24px;
    font-style: italic;
    font-size: 1rem;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    margin: 24px 0;
}

/* Опции действий */
.action-options {
    background: var(--background);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border: 2px solid var(--border-color);
}

.action-options h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar-header {
        padding: 0 12px 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .sidebar-header h1,
    .sidebar-subtitle {
        font-size: 1rem;
    }

    .nav-menu {
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .nav-submenu {
        position: fixed;
        left: 10px;
        right: 10px;
        min-width: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 0; /* Отступ будет установлен динамически через JavaScript */
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

/* Light theme refinements */
.sidebar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.main-content {
    background: transparent;
}

.page-header h2 {
    color: var(--primary-color);
}

.kpi-card,
.dashboard-card,
.data-item,
.history-item {
    background: var(--card-background);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.kpi-card::before,
.dashboard-card::before,
.data-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.kpi-card:hover::before,
.dashboard-card:hover::before,
.data-item:hover::before {
    transform: scaleX(1);
}

.kpi-card:hover,
.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-color);
}

.kpi-icon {
    background: var(--gradient-accent);
    color: white;
}

.kpi-label,
.kpi-change {
    color: var(--text-secondary);
}

.kpi-value {
    color: var(--primary-color);
}

.dashboard-card h3,
.data-item-header,
.history-item-header {
    color: var(--primary-color);
}

.data-item,
.history-item {
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.data-item:hover,
.history-item:hover {
    box-shadow: var(--shadow-md);
}

.data-item-header,
.history-item-header {
    border-bottom: 1px solid var(--border-color);
}

.form-group label,
.summary-item span,
.history-detail-label,
.result-label {
    color: var(--text-secondary);
}

input,
select,
textarea {
    background: var(--card-background);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--card-background);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-dark);
}

.btn-primary {
    background: var(--secondary-color);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background: #2f80d3;
}

.btn-secondary {
    background: #eef2f7;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e3e8f0;
}

.btn-danger {
    background: var(--danger-color);
    border: 1px solid transparent;
}

.btn-edit {
    background: #eef2f7;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: #ffffff;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.tab-btn.active {
    background: rgba(52, 152, 219, 0.12);
    color: var(--primary-color);
    border-color: rgba(52, 152, 219, 0.4);
}

.modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-hover);
}

.empty-state {
    color: var(--text-secondary);
}

.summary {
    background: #f1f4f9;
    border: 1px solid var(--border-color);
}

.result-card {
    background: #f1f4f9;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.result-card .result-label,
.result-card .result-percent {
    color: var(--text-secondary);
}

.result-card .result-value {
    color: var(--text-primary);
}

.warehouse-compact-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.warehouse-chip {
    background: #f8fafc;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.86rem;
    color: #475569;
}

.warehouse-chip strong {
    color: #0f172a;
    font-weight: 700;
}

.warehouse-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.warehouse-filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.warehouse-filter-group .btn-small.active {
    background: var(--gradient-secondary);
    color: #fff;
    border-color: transparent;
}

.inventory-filters-mount {
    flex: 1;
    min-width: min(100%, 320px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inventory-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inventory-filters-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.inventory-filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
}

.inventory-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.inventory-filter-toggle input {
    accent-color: var(--accent-color);
}

.inventory-filters-summary {
    font-size: 0.82rem;
    color: #64748b;
}

.warehouse-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.warehouse-panel-status {
    margin-top: 4px;
    font-size: 0.86rem;
    color: #64748b;
}

.warehouse-panel-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.warehouse-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 0.82rem;
    color: #475569;
}

.warehouse-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 6px;
}

.warehouse-dot.free { background: #22c55e; }
.warehouse-dot.warn { background: #f59e0b; }
.warehouse-dot.critical { background: #ef4444; }

.warehouse-zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.warehouse-sketch-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.warehouse-sketch-layout .zone-c {
    grid-column: 1 / -1;
}

.warehouse-sketch-layout .zone-other {
    grid-column: 1 / -1;
}

.warehouse-plan-space {
    display: grid;
    grid-template-columns: minmax(420px, 2fr) 44px minmax(200px, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 10px;
    align-items: start;
}

.warehouse-zone-title-inline {
    font-weight: 800;
    color: #1f2937;
    text-align: center;
    letter-spacing: 0.06em;
}

.warehouse-zone-title-inline.label-a { grid-column: 1; grid-row: 1; }
.warehouse-zone-title-inline.label-b { grid-column: 3; grid-row: 1; }
.warehouse-zone-title-inline.label-c { grid-column: 1 / 4; grid-row: 4; margin-top: 2px; }

.zone-buffer-plan {
    grid-column: 2 / 4;
    grid-row: 2;
    max-width: 210px;
    justify-self: start;
}

.zone-a-plan { grid-column: 1; grid-row: 2; }
.zone-b-plan { grid-column: 3; grid-row: 2; }
.zone-q-plan { grid-column: 1; grid-row: 3; max-width: 120px; }
.zone-c-plan { grid-column: 1 / 4; grid-row: 5; }

.warehouse-plan-grid {
    display: grid;
    gap: 8px;
}

.warehouse-plan-grid.four-cols {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    margin-bottom: 8px;
}

.warehouse-plan-grid.two-cols {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
    margin-bottom: 8px;
}

.warehouse-plan-grid.seven-cols {
    grid-template-columns: repeat(7, minmax(86px, 1fr));
}

.warehouse-passage {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: repeating-linear-gradient(
        45deg,
        #f8fafc,
        #f8fafc 10px,
        #eef2f7 10px,
        #eef2f7 20px
    );
}

.passage-top { grid-column: 2; grid-row: 2; min-height: 180px; margin-top: 108px; }
.passage-center { grid-column: 2 / 4; grid-row: 3; min-height: 66px; }

.warehouse-cell-placeholder {
    border-style: dashed;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 62px;
}

.warehouse-zone-card {
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
}

.warehouse-zone-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.warehouse-scheme-grid {
    display: grid;
    gap: 8px;
}

/* Схема склада ERP: сетка ряд × место (как визуальный редактор в настройках) */
.warehouse-rowpos-scheme {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.warehouse-rowpos-grid {
    display: grid;
    gap: 6px;
    align-items: stretch;
    min-width: min(100%, 480px);
}

.warehouse-rowpos-corner {
    min-height: 28px;
}

.warehouse-rowpos-col-head,
.warehouse-rowpos-row-head {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
}

.warehouse-rowpos-row-head {
    justify-content: flex-end;
    padding-right: 10px;
}

.warehouse-rowpos-slot {
    min-height: 0;
}

.warehouse-rowpos-slot .warehouse-cell {
    height: 100%;
    box-sizing: border-box;
}

.warehouse-rowpos-multi {
    font-size: 0.72rem;
    color: #b45309;
    text-align: center;
    margin-top: 2px;
}

.warehouse-rowpos-extras {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    background: #f8fafc;
}

.warehouse-rowpos-extras-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
}

.warehouse-rowpos-extras-grid {
    gap: 8px;
}

.warehouse-cell-sub {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.2;
}

.warehouse-cell.compact .warehouse-cell-line:nth-child(n+4) {
    display: none;
}

@media (max-width: 980px) {
    .warehouse-sketch-layout {
        grid-template-columns: 1fr;
    }
    .warehouse-plan-space {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .warehouse-zone-title-inline.label-a,
    .warehouse-zone-title-inline.label-b,
    .warehouse-zone-title-inline.label-c,
    .zone-a-plan,
    .zone-b-plan,
    .zone-q-plan,
    .zone-c-plan,
    .passage-top,
    .passage-center {
        grid-column: 1;
        grid-row: auto;
    }
    .warehouse-plan-grid.seven-cols {
        grid-template-columns: repeat(3, minmax(86px, 1fr));
    }
}

.warehouse-cell {
    position: relative;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    padding: 8px;
    background: #f8fafc;
    font-size: 0.8rem;
}

.warehouse-cell-top-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.warehouse-cell-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.warehouse-cell-menu-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.warehouse-cell.compact {
    padding: 6px;
}

.warehouse-cell-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.warehouse-indicator {
    width: 9px;
    height: 9px;
    border-radius: 999px;
}

.warehouse-indicator.free { background: #22c55e; }
.warehouse-indicator.warn { background: #f59e0b; }
.warehouse-indicator.critical { background: #ef4444; }

.warehouse-dot.expiry-soon { background: #f97316; }
.warehouse-dot.expiry-expired { background: #b91c1c; }

.warehouse-cell-occupancy {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    margin: 6px 0 8px;
    overflow: hidden;
}

.warehouse-cell-occupancy-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.2s ease;
}

.warehouse-cell-occupancy-fill--free { background: linear-gradient(90deg, #4ade80, #22c55e); }
.warehouse-cell-occupancy-fill--warn { background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.warehouse-cell-occupancy-fill--critical { background: linear-gradient(90deg, #fca5a5, #ef4444); }

.warehouse-cell-occupancy-label {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.62rem;
    font-weight: 700;
    color: #334155;
    line-height: 1;
}

.warehouse-cell-expiry-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.warehouse-cell-expiry-badge--soon {
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fdba74;
}

.warehouse-cell-expiry-badge--expired {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.warehouse-cell.expiry-soon {
    box-shadow: inset 0 0 0 2px #fdba74;
}

.warehouse-cell.expiry-expired {
    box-shadow: inset 0 0 0 2px #f87171;
    animation: warehouse-expiry-pulse 2s ease-in-out infinite;
}

@keyframes warehouse-expiry-pulse {
    0%, 100% { box-shadow: inset 0 0 0 2px #f87171; }
    50% { box-shadow: inset 0 0 0 2px #dc2626, 0 0 8px rgba(220, 38, 38, 0.35); }
}

[data-erp-manual-map="1"] .warehouse-cell[data-cell-id] {
    cursor: pointer;
}

[data-erp-manual-map="1"] .warehouse-cell[data-cell-id]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.warehouse-cell-line {
    color: #475569;
    line-height: 1.25;
}

.warehouse-cell.free { border-color: #86efac; background: #f0fdf4; }
.warehouse-cell.warn { border-color: #fcd34d; background: #fffbeb; }
.warehouse-cell.critical { border-color: #fca5a5; background: #fef2f2; }

.warehouse-table-wrap {
    overflow: auto;
    max-height: min(65vh, 440px);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.warehouse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.warehouse-table th,
.warehouse-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 10px;
    text-align: left;
}

.warehouse-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
}

/* Прокрутка таблиц в модалках (журналы и т.п.) */
.erp-table-scroll {
    max-height: min(60vh, 480px);
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.erp-table-scroll table {
    width: 100%;
    border-collapse: collapse;
}

.erp-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    box-shadow: 0 1px 0 #e2e8f0;
}

.warehouse-table tbody tr.is-free {
    background: #f0fdf4;
}

.warehouse-table tbody tr.is-warn {
    background: #fffbeb;
}

.warehouse-table tbody tr.is-critical {
    background: #fef2f2;
}

.warehouse-map-filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
    margin: 10px 0 12px;
}

.warehouse-map-filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #475569;
}

.warehouse-map-filter-bar input,
.warehouse-map-filter-bar select {
    min-width: 120px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
}

.warehouse-cell.filter-dim {
    opacity: 0.28;
}

.warehouse-cell.filter-match {
    box-shadow: 0 0 0 2px #2563eb, 0 4px 14px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

.warehouse-table tbody tr.is-filter-dim {
    opacity: 0.35;
}

.warehouse-table tbody tr.is-filter-match {
    box-shadow: inset 0 0 0 2px #2563eb;
}

.warehouse-map-hover-tooltip {
    position: fixed;
    z-index: 12000;
    max-width: 420px;
    white-space: pre-wrap;
    pointer-events: none;
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.96);
    color: #e2e8f0;
    font-size: 0.8rem;
    line-height: 1.35;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 14px 38px rgba(2, 6, 23, 0.5);
}

.form-section,
.actual-data-form {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.top-list-item {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.planned-value,
.history-detail-value .planned {
    color: var(--text-secondary);
}

.history-detail-value .actual {
    color: var(--text-primary);
}

/* Учёт времени (финансы → персонал) */
.finance-view-staff {
    margin-top: 12px;
}
.staff-timesheet-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.staff-timesheet-toolbar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.staff-timesheet-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}
.staff-timesheet-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1 1 220px;
}
.timesheet-scroll {
    overflow: auto;
    max-width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-background);
}
.timesheet-table {
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: max-content;
}
.timesheet-table th,
.timesheet-table td {
    border: 1px solid var(--border-color);
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}
.timesheet-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card-background);
    text-align: left !important;
    min-width: 160px;
    max-width: 220px;
}
.timesheet-col-total {
    left: 160px;
    min-width: 56px;
    font-weight: 600;
}
.timesheet-name {
    text-align: left !important;
    padding: 6px 8px !important;
}
.timesheet-name-text {
    display: block;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.timesheet-badge {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0369a1;
}
.timesheet-badge--general {
    background: #f1f5f9;
    color: #475569;
}
.timesheet-day {
    min-width: 28px;
    font-weight: 600;
    color: var(--text-secondary);
}
.timesheet-day--off {
    background: #f8fafc;
}
.timesheet-cell {
    cursor: pointer;
    color: #94a3b8;
    min-width: 28px;
    transition: background 0.12s;
}
.timesheet-cell:hover {
    background: #eff6ff;
}
.timesheet-cell--filled {
    color: #0f172a;
    font-weight: 600;
    background: #ecfdf5;
}
.timesheet-month-total {
    font-size: 0.8rem;
    white-space: nowrap;
}
.payroll-lines-block select,
.payroll-lines-block input {
    width: 100%;
    box-sizing: border-box;
}

/* Динамика закупочных цен */
.finance-view-purchase-prices {
    margin-top: 12px;
}
.purchase-prices-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.purchase-prices-intro,
.purchase-prices-empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.purchase-prices-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: end;
    padding: 12px 14px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.purchase-prices-toolbar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.purchase-prices-card {
    padding: 14px 16px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.purchase-prices-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}
.price-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.price-compare-table th,
.price-compare-table td {
    border: 1px solid var(--border-color);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}
.price-compare-table th {
    background: #f8fafc;
    font-weight: 600;
}
.price-trend--up {
    color: #dc2626;
    font-weight: 600;
}
.price-trend--down {
    color: #059669;
    font-weight: 600;
}
.price-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.price-badge--best {
    background: #dcfce7;
    color: #166534;
}
.price-badge--dear {
    background: #fee2e2;
    color: #991b1b;
}
.price-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-height: 140px;
    padding: 8px 4px 4px;
    overflow-x: auto;
}
.price-chart-bar-wrap {
    flex: 1 1 48px;
    min-width: 44px;
    max-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 130px;
    justify-content: flex-end;
}
.price-chart-bar {
    width: 100%;
    max-width: 36px;
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}
.price-chart-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.price-chart-value {
    font-size: 0.65rem;
    color: #64748b;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
}
.price-supplier-months {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.price-supplier-line {
    margin-bottom: 6px;
}
.price-month-sup {
    margin-right: 4px;
}
.price-points-list {
    margin: 0;
    padding-left: 20px;
    font-size: 0.9rem;
}

/* Контекстное меню ручного склада ERP (схема в разделе Склад) */
.wms-vis-context-menu {
    position: fixed;
    z-index: 12000;
    min-width: 220px;
    padding: 6px 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
}
.wms-vis-context-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 0.88rem;
    cursor: pointer;
    color: #0f172a;
}
.wms-vis-context-item:hover:not(:disabled) {
    background: #f1f5f9;
}
.wms-vis-context-item--danger {
    color: #b91c1c;
}
.wms-vis-context-item--danger:hover:not(:disabled) {
    background: #fef2f2;
}
.wms-vis-context-item--muted {
    cursor: default;
    color: #64748b;
    font-size: 0.8rem;
}
.wms-vis-context-sep {
    height: 1px;
    margin: 4px 0;
    background: #e2e8f0;
}
[data-erp-manual-map="1"] .warehouse-cell,
[data-erp-manual-map="1"] .warehouse-table tbody tr[data-cell-id] {
    cursor: context-menu;
}

.finance-settlement-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}
.finance-settlement-badge--cash {
    background: #dcfce7;
    color: #166534;
}
.finance-settlement-badge--bank {
    background: #e0e7ff;
    color: #3730a3;
}

/* Водители (ERP) */
.drivers-layout {
    display: grid;
    grid-template-columns: minmax(200px, 260px) 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 960px) {
    .drivers-layout {
        grid-template-columns: 1fr;
    }
}
.drivers-sidebar {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    padding: 10px;
}
.drivers-sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.drivers-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 6px 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 6px;
}
.drivers-list-item.is-active {
    border-color: #0ea5e9;
    background: #f0f9ff;
}
.drivers-list-select {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 4px 2px;
    border: none;
    background: transparent;
    cursor: pointer;
    min-width: 0;
}
.drivers-list-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.drivers-list-name {
    font-weight: 600;
    color: #0f172a;
}
.drivers-list-id {
    font-size: 0.78rem;
    color: #64748b;
}
.drivers-info-banner {
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0f9ff, #fff);
    border: 1px solid #bae6fd;
    margin-bottom: 14px;
    font-size: 0.9rem;
    color: #334155;
}
.drivers-info-banner p {
    margin: 6px 0 0;
}
.drivers-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.drivers-date-label {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.drivers-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 1100px) {
    .drivers-grid-2 {
        grid-template-columns: 1fr;
    }
}
.drivers-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    padding: 14px;
}
.drivers-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}
.drivers-hint {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0 0 10px;
}
.drivers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.drivers-table th,
.drivers-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 6px 8px;
    text-align: left;
}
.drivers-muted {
    color: #64748b;
    font-size: 0.85rem;
}
.drivers-address-search {
    width: 100%;
    padding: 8px 10px;
    margin: 8px 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
}
.drivers-address-list {
    max-height: 320px;
    overflow: auto;
    display: grid;
    gap: 6px;
}
.drivers-address-sublabel {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}
.drivers-meat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.drivers-meat-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #475569;
}
.drivers-select {
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
}
.drivers-extra-nom-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.drivers-extra-nom-product {
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
}
.drivers-extra-always {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
}
.director-recurring-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    padding: 14px;
    margin-bottom: 16px;
}
.director-recurring-card h3 { margin: 0 0 8px; font-size: 1rem; }
.director-recurring-hint { font-size: 0.82rem; color: #64748b; margin: 0 0 10px; }
.director-recurring-row {
    display: grid;
    grid-template-columns: 1.5fr 90px 1fr auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.director-recurring-row input,
.director-recurring-row select {
    padding: 7px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.88rem;
}
.director-recurring-empty { color: #64748b; font-size: 0.85rem; }
.suppliers-catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 8px;
}
.suppliers-catalog-table th,
.suppliers-catalog-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.suppliers-catalog-hint {
    color: #64748b;
    font-size: 0.85rem;
    margin: 4px 0 8px;
}
.drivers-address-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
}
.drivers-address-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
}
.drivers-address-addr {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
}
.drivers-buffer-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}
.drivers-buffer-row input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}
.drivers-stop {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fafafa;
}
.drivers-stop-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.drivers-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}
.drivers-tag.is-preorder {
    background: #dbeafe;
    color: #1d4ed8;
}
.drivers-tag.is-onsite {
    background: #fef3c7;
    color: #92400e;
}
.drivers-job {
    margin-top: 8px;
    padding: 8px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}
.drivers-error {
    padding: 12px;
    color: #b91c1c;
    background: #fef2f2;
    border-radius: 8px;
}

/* ERP web login gate */
body.erp-login-active .sidebar,
body.erp-login-active .main-content,
body.erp-login-active .startup-loader {
    visibility: hidden;
}
.erp-login-gate {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 55%, #334155 100%);
}
.erp-login-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 32px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35);
}
.erp-login-title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}
.erp-login-desc {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.45;
}
.erp-login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.erp-login-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}
.erp-login-input {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
}
.erp-login-error {
    margin: 0;
    font-size: 0.85rem;
    color: #b91c1c;
}
.erp-login-submit {
    width: 100%;
    margin-top: 4px;
}
.erp-login-bootstrap {
    margin-top: 20px;
    font-size: 0.85rem;
    color: #64748b;
}
.erp-login-bootstrap summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
}
.erp-login-hint {
    margin: 8px 0 12px;
    line-height: 1.4;
}

.counterparty-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    margin-left: 6px;
    vertical-align: middle;
}
.counterparty-link-block {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

/* --- Настройки: выбор темы интерфейса --- */
.erp-ui-theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}
.erp-ui-theme-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.erp-ui-theme-card:hover {
    border-color: #93c5fd;
}
.erp-ui-theme-card.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}
.erp-ui-theme-card input[type='radio'] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.erp-ui-theme-card__title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}
.erp-ui-theme-card__desc {
    font-size: 0.88rem;
    line-height: 1.45;
    color: #64748b;
}

/* --- Режим производительности (html.erp-theme-performance) --- */
html.erp-theme-performance,
html.performance-mode {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
    --shadow-sm: none;
    --shadow: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-hover: none;
    --shadow-colored: none;
    --gradient-primary: #334155;
    --gradient-secondary: #2563eb;
    --gradient-accent: #2563eb;
    --gradient-danger: #dc2626;
    --gradient-success: #059669;
    --gradient-warm: #d97706;
}

html.erp-theme-performance *,
html.erp-theme-performance *::before,
html.erp-theme-performance *::after,
html.performance-mode *,
html.performance-mode *::before,
html.performance-mode *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

html.erp-theme-performance .sidebar,
html.erp-theme-performance .nav-submenu,
html.erp-theme-performance .modal-overlay,
html.erp-theme-performance .settings-layout-backdrop,
html.performance-mode .sidebar,
html.performance-mode .nav-submenu,
html.performance-mode .modal-overlay,
html.performance-mode .settings-layout-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.erp-theme-performance .sidebar,
html.performance-mode .sidebar {
    background: var(--primary-color, #334155) !important;
}

html.erp-theme-performance .btn-primary::before,
html.erp-theme-performance .btn-secondary::before,
html.erp-theme-performance .btn-danger::before,
html.erp-theme-performance .kpi-card::before,
html.erp-theme-performance .dashboard-card::before,
html.erp-theme-performance .data-item::before,
html.erp-theme-performance .result-card::before,
html.performance-mode .btn-primary::before,
html.performance-mode .btn-secondary::before,
html.performance-mode .btn-danger::before,
html.performance-mode .kpi-card::before,
html.performance-mode .dashboard-card::before,
html.performance-mode .data-item::before,
html.performance-mode .result-card::before {
    display: none !important;
}

html.erp-theme-performance .kpi-card:hover,
html.erp-theme-performance .dashboard-card:hover,
html.erp-theme-performance .data-item:hover,
html.erp-theme-performance .btn-primary:hover,
html.erp-theme-performance .btn-danger:hover,
html.erp-theme-performance .btn-secondary:hover,
html.erp-theme-performance .warehouse-cell:hover,
html.performance-mode .kpi-card:hover,
html.performance-mode .dashboard-card:hover,
html.performance-mode .data-item:hover,
html.performance-mode .btn-primary:hover,
html.performance-mode .btn-danger:hover,
html.performance-mode .btn-secondary:hover,
html.performance-mode .warehouse-cell:hover {
    transform: none !important;
    filter: none !important;
    box-shadow: var(--shadow-sm, none) !important;
}

html.erp-theme-performance .kpi-card:hover .kpi-icon,
html.erp-theme-performance .result-card:hover::before,
html.performance-mode .kpi-card:hover .kpi-icon,
html.performance-mode .result-card:hover::before {
    transform: none !important;
}

html.erp-theme-performance .warehouse-cell.expiry-expired,
html.performance-mode .warehouse-cell.expiry-expired {
    animation: none !important;
}

html.erp-theme-performance .warehouse-passage,
html.performance-mode .warehouse-passage {
    background: #f1f5f9 !important;
}

html.erp-theme-performance .warehouse-cell-occupancy-fill--free,
html.erp-theme-performance .warehouse-cell-occupancy-fill--warn,
html.erp-theme-performance .warehouse-cell-occupancy-fill--critical,
html.erp-theme-performance .prod-buffer-gauge__fill,
html.erp-theme-performance .prod-buffer-gauge__fill--over,
html.performance-mode .warehouse-cell-occupancy-fill--free,
html.performance-mode .warehouse-cell-occupancy-fill--warn,
html.performance-mode .warehouse-cell-occupancy-fill--critical,
html.performance-mode .prod-buffer-gauge__fill,
html.performance-mode .prod-buffer-gauge__fill--over {
    background: #64748b !important;
}

html.erp-theme-performance .sidebar-header h1,
html.erp-theme-performance .modal-header h3,
html.performance-mode .sidebar-header h1,
html.performance-mode .modal-header h3 {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: inherit !important;
    color: inherit !important;
}

html.erp-theme-performance .sidebar-hidden,
html.performance-mode .sidebar-hidden {
    transition: none !important;
}

html.erp-theme-performance .notification-toast,
html.performance-mode .notification-toast {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

@media (prefers-reduced-motion: reduce) {
    html:not(.erp-theme-quality) *,
    html:not(.erp-theme-quality) *::before,
    html:not(.erp-theme-quality) *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
