        html, body {
            height: 100%;
            margin: 0;
            padding: 0;
            background-color: #f8f9fa;
        }
        .page-wrapper {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        .header {
            background-color: #fff;
            border-bottom: 1px solid #dee2e6;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            flex-shrink: 0;
            z-index: 1000;
        }
        .content-wrapper {
            display: flex;
            flex: 1;
            overflow: hidden;
        }
        .objects-sidebar {
            width: 350px;
            min-width: 350px;
            background-color: #fff;
            border-right: 1px solid #dee2e6;
            padding: 20px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .main-content {
            flex: 1;
            background-color: #f8f9fa;
            padding: 20px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        @media (max-width: 992px) {
            .content-wrapper {
                flex-direction: column;
            }
            .objects-sidebar {
                width: 100%;
                min-width: unset;
                border-right: none;
                border-bottom: 1px solid #dee2e6;
            }
        }

        /* Вертикальные подписи таблицы */
        .rotate-header {
            writing-mode: vertical-rl;
            text-orientation: mixed;
            white-space: nowrap;
            transform: rotate(180deg);
            padding: 10px 4px;
        }
        .icon-col {
            width: 60px;
            text-align: center;
            vertical-align: middle;
        }
        .temp-col {
            width: 160px;
            text-align: center;
            vertical-align: middle;
            white-space: nowrap;
        }
        @media (max-width: 768px) {
            .rotate-header {
                writing-mode: horizontal-tb;
                transform: none;
                padding: 8px;
            }
            .icon-col, .temp-col {
                width: auto;
            }
        }
        .dnd-list {
            min-height: 200px;
            border: 1px dashed #dee2e6;
            border-radius: 0.375rem;
            padding: 10px;
            overflow: auto;
        }
        #edit-devices-available,
        #edit-devices-in-object {
            max-height: 400px;
            overflow-y: auto;
        }
    /* Стили для списка событий в модалке */
    .event-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .event-item {
        display: flex;
        align-items: flex-start;
        padding: 12px 8px;
        border-bottom: 1px solid #eee;
        font-size: 0.95rem;
    }

    .event-item:last-child {
        border-bottom: none;
    }

    .event-item.critical {
        background-color: #fff5f5;
        border-left: 4px solid #dc3545;
    }

    .event-item.resolved {
        background-color: #f8fff8;
        opacity: 0.85;
    }

    .event-icon {
        font-size: 1.4rem;
        min-width: 32px;
        text-align: center;
        margin-top: 2px;
    }

    .event-details {
        flex: 1;
        margin-left: 10px;
    }

    .event-name {
        font-weight: 600;
        margin: 0 0 4px 0;
        color: #333;
    }

    .event-time {
        margin: 0;
        color: #666;
        font-size: 0.9rem;
    }

    .event-status {
        margin: 4px 0 0 0;
        color: #28a745;
        font-weight: 600;
        font-size: 0.85rem;
    }

    .date-separator {
        background-color: #f1f3f5;
        padding: 8px 12px;
        font-weight: 600;
        color: #495057;
        font-size: 0.9rem;
        border-bottom: 1px solid #dee2e6;
        margin: 0;
    }

    .no-events {
        text-align: center;
        padding: 30px;
        color: #888;
        font-style: italic;
    }

    /* Фильтр */
    .filter-select {
        max-width: 300px;
    }

    /* Адаптив для маленьких экранов */
    @media (max-width: 576px) {
        .event-item {
            flex-direction: column;
        }
        .event-icon {
            margin-bottom: 8px;
        }
        .event-details {
            margin-left: 0;
        }
    }

.device.alarm-blink rect {
  animation: blink-alarm 1s infinite;
}
@keyframes blink-alarm {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.5; }
}
        @media (orientation: landscape) and (max-height: 600px) {
            /* Скрываем блок с информацией о пользователе на мобильных в альбомной ориентации */
            .user-info-mobile {
                display: none !important;
            }
            /* Делаем шапку максимально компактной */
            .header {
                padding: 8px 12px;
            }
            .header .d-flex.align-items-center {
                min-height: auto;
            }
            .header img {
                width: 32px !important;
                height: 32px !important;
            }
            .header h1 {
                font-size: 1.1rem !important;
                margin: 0;
            }
        #edit-devices-available,
        #edit-devices-in-object {
            max-height: 300px;
            overflow-y: auto;
        }
                .dnd-list {
            min-height: 100px;
            border: 1px dashed #dee2e6;
            border-radius: 0.375rem;
            padding: 10px;
            overflow: auto;
        }

        }
        @media (max-height: 700px) {

        #edit-devices-available,
        #edit-devices-in-object {
            max-height: 300px;
            overflow-y: auto;
        }
                .dnd-list {
            min-height: 100px;
            border: 1px dashed #dee2e6;
            border-radius: 0.375rem;
            padding: 10px;
            overflow: auto;
        }

        }

       /* Мобильная адаптация: На экранах < 576px (xs/mobile) показываем только иконки */
        @media (max-width: 575.98px) {
            .nav-tabs .nav-link {
                padding: 0.5rem;
                font-size: 0; /* Скрываем текст */
            }
            .nav-tabs .nav-link i {
                font-size: 1.2rem; /* Увеличиваем иконки */
            }
            .nav-tabs .nav-link span {
                display: none; /* Полностью скрываем текст */
            }
        }


 /* Прелоадер - должен быть внутри chartContainer */
#chartLoading {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(255, 255, 255, 0.95) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100 !important; /* Не слишком высокий! */
  pointer-events: none !important; /* Чтобы не блокировал клики */
  transition: opacity 0.3s !important;
}

#chartLoading.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* ВАЖНО: в полноэкранном режиме прелоадер не должен мешать */
#chartContainer[style*="position: fixed"] #chartLoading,
#chartContainer:fullscreen #chartLoading {
  display: none !important;
}


/* Для журнала операций */

/* 📱 Ограничение ширины колонки "Операция" для мобильных */
@media (max-width: 768px) {
    #operations-log-table th:nth-child(2),
    #operations-log-table td:nth-child(2) {
        max-width: 180px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.2;
    }
        #edit-devices-available,
        #edit-devices-in-object {
            max-height: 300px;
            overflow-y: auto;
        }
        .dnd-list {
            min-height: 100px;
            border: 1px dashed #dee2e6;
            border-radius: 0.375rem;
            padding: 10px;
            overflow: auto;
        }

}

/* Для очень маленьких экранов (≤480px) — ещё больше сжимаем */
@media (max-width: 480px) {
    #operations-log-table th:nth-child(2),
    #operations-log-table td:nth-child(2) {
        max-width: 120px;
        min-width: 100px;
    }
        #edit-devices-available,
        #edit-devices-in-object {
            max-height: 300px;
            overflow-y: auto;
        }
        .dnd-list {
            min-height: 100px;
            border: 1px dashed #dee2e6;
            border-radius: 0.375rem;
            padding: 10px;
            overflow: auto;
        }
    
    /* Уменьшаем шрифт во всей таблице */
    #operations-log-table {
        font-size: 11px;
    }
}

/* Конец блока для журнала операций*/






#myChart { touch-action: pan-x !important; -webkit-user-select: none; user-select: none; }



#chartContainer {
  touch-action: pan-y; /* Разрешаем скролл страницы, если палец НЕ на графике */
  position: relative;
}
/* Класс для фулскрина */
.chart-fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  z-index: 9999; background: #fff; padding: 10px; box-sizing: border-box;
}
.loading-overlay.hidden, #chartLoading.hidden { display: none !important; }
canvas.chart-hidden { display: none !important; }

/* Кнопки фильтров диагностики */
.btn-filter {
    min-width: 110px;
    font-weight: 500;
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-filter:active {
    transform: translateY(0);
}

.btn-filter i {
    font-size: 0.85rem;
}

/* На мобильных устройствах */
@media (max-width: 767.98px) {
    .btn-filter {
        flex: 1;
        min-width: auto;
    }
}

/* На десктопе - компактные кнопки */
@media (min-width: 768px) {
    .btn-filter {
        min-width: 120px;
    }
}







/* === Сайдбар === */
.objects-sidebar {
    position: relative;
    width: 280px; /* обычная ширина */
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #dee2e6;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === Контент сайдбара === */
.sidebar-content {
    padding: 16px;
    opacity: 1;
    transition: opacity 0.2s ease;
    min-width: 248px; /* чтобы не сжимался при анимации */
}

/* === Кнопка сворачивания сайдбара === */
.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 80px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 8px 0 0 8px;
     color: #000 !important; /
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
}

.sidebar-toggle-btn:hover {
    background: #f8f9fa;
color: #000 !important; 
    width: 28px;
}

.sidebar-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
color: #000 !important; 
}

/* === Свёрнутое состояние === */
.objects-sidebar.collapsed {
    width: 48px;
    min-width: 48px;
}

.objects-sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Поворот стрелки при сворачивании */
.objects-sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

/* Кнопка-полоска при свёрнутом состоянии */
.objects-sidebar.collapsed .sidebar-toggle-btn {
    right: 0;
    width: 48px;
    height: 100%;
    border-radius: 0;
    border: none;
    border-right: 1px solid #dee2e6;
    background: #fff;
}

.sidebar-toggle-btn:hover i {
    color: #000 !important; /* 🔥 Иконка остаётся чёрной */
}
.objects-sidebar.collapsed .sidebar-toggle-btn:hover {
    background: #f8f9fa;
    width: 48px;
}

/* === Основной контент === */
.main-content {
    flex: 1;
    transition: margin-left 0.3s ease;
}

/* Скрыть кнопку сворачивания на мобильных устройствах */
@media (max-width: 991.98px) {
    .sidebar-toggle-btn {
        display: none !important;
    }
    
    /* На мобильных сайдбар всегда развёрнут или всегда свёрнут - как вам удобнее */
    .objects-sidebar {
        width: 100% !important;
        min-width: 100% !important;
    }
}
/* === ИСПРАВЛЕНИЕ МОДАЛОК === */

/* Принудительный z-index для модалок диагностики */
#diagDetailsModal {
    z-index: 10000 !important;
}

#diagDetailsModal .modal-backdrop {
    z-index: 9999 !important;
}

#diagDetailsModal .modal-dialog {
    z-index: 10001 !important;
}

/* Фикс для backdrop при overflow: hidden на родителях */
.modal-backdrop.show {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
}

.modal.show {
    z-index: 10000 !important;
}

.modal.show .modal-dialog {
    z-index: 10001 !important;
}

/* Убираем проблемы с overflow */
.modal-open .content-wrapper {
    overflow: visible !important;
}

.modal-open .main-content {
    overflow: visible !important;
}

/* Для мобильных */
@media (max-width: 767.98px) {
    #diagDetailsModal .modal-dialog {
        margin: 10px !important;
        max-width: calc(100vw - 20px) !important;
    }
}

/* Datepicker z-index должен быть выше модалки */
.datepicker {
    z-index: 10000 !important;
}

.datepicker.dropdown-menu {
    z-index: 10000 !important;
}
