.container-tree {
    display: flex;
    height: 100vh;

}

/* Общие стили для всей вкладки */
#tab5 {
    display: grid;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #ffffff;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Стили для групп ввода */
.reliability-input-group {
    display: grid;
    gap: 0.8rem;
    position: relative;
}

.reliability-input-group label {
    font-weight: 500;
    color: #2d3748;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reliability-input-group label::after {
    content: "?";
    width: 18px;
    height: 18px;
    border: 1px solid #cbd5e0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: help;
    color: #718096;
}

/* Стилизация полей ввода */
.reliability-input-group input,
.reliability-input-group select {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #f8fafc;
    width: 100%;
    box-sizing: border-box;
}

.reliability-input-group input:focus,
.reliability-input-group select:focus {
    outline: none;
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.2);
    background: white;
}

.reliability-input-group input:hover,
.reliability-input-group select:hover {
    border-color: #cbd5e0;
}

/* Специфичные стили для числовых полей */
input[type="number"] {
    appearance: textfield; -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Стили для динамических полей */
.dynamic-field {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f1f5f9;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
    #tab5 {
        padding: 1rem;
        gap: 1.2rem;
    }

    .reliability-input-group {
        gap: 0.6rem;
    }

    .reliability-input-group input,
    .reliability-input-group select {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .reliability-input-group label {
        font-size: 0.9rem;
    }
}

/* Дополнительные эффекты для улучшения UX */
.reliability-input-group input:invalid,
.reliability-input-group select:invalid {
    border-color: #fc8181;
    background: #fff5f5;
}

.reliability-input-group input:disabled {
    background: #edf2f7;
    cursor: not-allowed;
}

/* Стили для выпадающего списка */
#kValue {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg...");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}


.reliability-controls {
    display: grid;
    gap: 1rem;
    max-width: 800px;
    margin: 1rem 0;
    padding: 1.2rem;
    background: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-info {
    font-size: 0.9em;
    color: #666;
}

.control-group {
    display: grid;
    gap: 0.5rem;
}

.form-select, #componentSearch {
    padding: 0.8rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    max-width: 100%;
    transition: border-color 0.3s ease;
}

#componentSearch {
    min-width: 300px;
    background-image: url("data:image/svg+xml,%3Csvg...");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 16px;
}

#componentSuggestions {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#componentSuggestions option {
    padding: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

#componentSuggestions option:hover {
    background: #e9ecef;
}

/* Стили для вкладки надежности */
.reliability-input-group {
    margin: 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.dynamic-field {
    margin-top: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.parallel-section {
    margin-top: 25px;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.multiselect-dropdown {
    width: 100%;
    min-height: 100px;
    padding: 8px;
    margin: 5px 0;
}

.branches-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

.btn-action {
    background: #4CAF50;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-action:hover {
    background: #45a049;
}

.form-control {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
}

/* Уровень 1 */
.jstree li[aria-level="1"] > .jstree-anchor.jstree-clicked {
    background-color: #e0f7fa !important;  /* светло-голубой фон */
    color: #006064 !important;             /* темно-синий цвет текста */
    font-weight: bold;
    box-shadow: inset 0 0 0 2px #006064;
    transition: background-color 0.3s, color 0.3s;
  }

  /* Уровень 2 */
  .jstree li[aria-level="2"] > .jstree-anchor.jstree-clicked {
    background-color: #f1f8e9 !important;  /* светло-зелёный фон */
    color: #33691e !important;             /* тёмно-зелёный текст */
    font-weight: bold;
    box-shadow: inset 0 0 0 2px #33691e;
    transition: background-color 0.3s, color 0.3s;
  }

  /* Уровень 3 и ниже */
  .jstree li[aria-level="3"] > .jstree-anchor.jstree-clicked,
  .jstree li[aria-level="4"] > .jstree-anchor.jstree-clicked,
  .jstree li[aria-level="5"] > .jstree-anchor.jstree-clicked {
    background-color: #f3e5f5 !important;  /* светло-фиолетовый фон */
    color: #4a148c !important;             /* темно-фиолетовый текст */
    font-weight: bold;
    box-shadow: inset 0 0 0 2px #4a148c;
    transition: background-color 0.3s, color 0.3s;
  }


/* Уровень 4 */
.jstree li[aria-level="4"] > .jstree-anchor.jstree-clicked {
    background-color: #d1c4e9 !important;  /* более тёмный светло-фиолетовый фон */
    color: #311b92 !important;             /* более тёмный фиолетовый текст */
    font-weight: bold;
    box-shadow: inset 0 0 0 2px #311b92;
    transition: background-color 0.3s, color 0.3s;
}

/* Уровень 5 и выше */
.jstree li[aria-level="5"] > .jstree-anchor.jstree-clicked,
.jstree li[aria-level="6"] > .jstree-anchor.jstree-clicked,
.jstree li[aria-level="7"] > .jstree-anchor.jstree-clicked {
    background-color: #b39ddb !important;  /* ещё более тёмный фиолетовый фон */
    color: #1a237e !important;             /* глубокий синий текст */
    font-weight: bold;
    box-shadow: inset 0 0 0 2px #1a237e;
    transition: background-color 0.3s, color 0.3s;
}

.container-tree #resizer {
    width: 8px;
    background-color: #f1f1f1;
    cursor: ew-resize !important;
    transition: background-color 0.2s ease;
    position: relative;
    z-index: 10;
}


.container-tree #resizer:hover,
.container-tree #resizer.resizing {
    background-color: #0056b3;
}


/* Опционально: добавляем визуальную подсказку в виде линии */
.container-tree #resizer::after {
    content: "";
    display: block;
    width: 2px;
    height: 100%;
    background-color: #999;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: background-color 0.2s ease;
}

.container-tree #resizer:hover::after,
.container-tree #resizer.resizing::after {
    background-color: #0056b3;
}


/* Дополнительно: обеспечиваем, что курсор применяется ко всем потомкам разделителя */
.container-tree #resizer * {
    cursor: ew-resize !important;
}


.sidebar {
    flex: 0 0 auto;
    min-width: 200px;
    max-width: 1200px;
    width: 300px; /* начальная ширина */
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.1s ease-in-out;
}


#resizer {
    width: 8px;
    background-color: #f1f1f1;
    cursor: ew-resize;  /* Добавляем курсор в виде двунаправленной стрелки */
    transition: background-color 0.3s;
}


#resizer:hover {
    background-color: #ccc;
}

/* Опционально: добавляем визуальную подсказку в виде линии */
#resizer::after {
    content: "";
    display: block;
    width: 2px;
    height: 100%;
    background-color: #999;
    margin: 0 auto;
}


.control-panel {
    margin-bottom: 10px;
}

.control-panel button {
    position: relative;
}

.control-panel button::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 5px;
    border-radius: 5px;
    background: #000;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    font-size: 12px;
}

.control-panel button:hover::after {
    opacity: 1;
}

/* Улучшаем контейнер main-content */
.main-content {
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
}

.jstree-node {
    position: relative;
}

.ui-tooltip {
    padding: 8px;
    position: absolute;
    z-index: 9999;
    max-width: 300px;
    background-color: #333;
    color: white;
    border: none;
    font-size: 14px;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.jstree-anchor {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: calc(100% - 24px);
    display: inline-block;
}

.workspace {
    flex: 2;
    min-width: 0;
    border-bottom: 1px solid #ccc;
    padding: 20px;
    overflow-y: auto;
    overflow-x: auto;
    /* УБРАЛИ: max-height: 60vh; */
    min-height: 400px; /* Минимальная высота вместо максимальной */
}

.properties {
    flex: 1;
    min-width: 0;
    padding: 20px;
    overflow-y: auto;
    overflow-x: auto;
    /* УБРАЛИ: max-height: 40vh; */
    min-height: 300px; /* Минимальная высота вместо максимальной */
}


/* Дополнительные стили для табличного содержимого внутри вкладок */
#functionsTableContainer, #vvfTableContainer, #requirementsTableContainer {
    /* УБРАЛИ: max-height: 30vh; */
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    /* Добавляем адаптивную высоту */
    max-height: calc(100vh - 300px); /* Высота экрана минус отступы */
    min-height: 200px;
}



/* Стили для содержимого вкладок */
.workspace-tab-content, .tab-content {
    overflow-y: auto !important;
    max-height: 100%;
}

.workspace-tab, .tab {
    overflow-y: auto !important;
    max-height: 100%;
}


#jstree {
    margin-top: 20px;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

button i {
    font-size: 20px;
}

.add-item {
    display: inline-flex;
    align-items: center;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #f9f9f9;
    cursor: pointer;
}

#functionsList,
#requirementsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#propertiesForm {
    display: flex;
    flex-direction: column;
}

#propertiesForm label,
#propertiesForm input {
    margin-bottom: 10px;
}

#propertiesForm button {
    align-self: flex-start;
}

.vakata-context {
    position: absolute !important;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    padding: 10px;
    display: none; /* Добавлено, чтобы скрыть меню по умолчанию */
    list-style: none;
}

.vakata-context li {
    padding: 5px 10px;
    cursor: pointer;
}

.vakata-context li:hover {
    background: #eee;
}

.jstree-default .jstree-icon {
    margin-right: 5px;
}

.jstree-default .jstree-children li {
    list-style: none;
}

.jstree-icon {
    margin-right: 5px;
}

.jstree-anchor {
    display: flex;
    align-items: center;
}

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

.failure-item input {
    margin-bottom: 5px;
}

.failure-item .failure-rate {
    width: 100%;
}

.tabs {
    display: flex;
    overflow: hidden;
    height: 100%;
}

.tab-buttons {
    display: flex;
    flex-direction: column;
    width: 200px;
    overflow-y: auto;
}

.tab-buttons button {
    padding: 10px;
    border: none;
    background: #f1f1f1;
    cursor: pointer;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.tab-buttons button.active {
    background: #ddd;
}

.scrollable-table-container {
    overflow-x: auto;
    min-width: 100%;
    max-width: 100%;
}

#functionsTableContainer {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    max-height: min(70vh, 900px);
    position: relative;
}

.tab-content {
    flex: 1;
    padding: 10px;
    border-left: 1px solid #ccc;
    overflow-x: auto;
    overflow-y: auto;
}

.tab-content .tab {
    display: none;
}

.tab-content .tab.active {
    display: block;
    overflow-x: auto;
    overflow-y: auto;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
}

table {
    width: 100%;
    min-width: auto;
    border-collapse: collapse;
}

table, th, td {
    border: 1px solid #ccc;
}

th, td {
    padding: 8px;
    text-align: center;
}

thead {
    background: #f9f9f9;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-content .dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
}

.dropdown:hover .dropdown-content {
    display: block;
}

#sidebar.pinned {
    width: 250px;
    position: fixed;
    top: 0;
    bottom: 0;
}

#sidebar.hidden {
    display: none;
}

#sidebar-pin.active {
    color: #007bff;
}

#toggle-sidebar {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
}


/* Стили для таблицы */
#functionsTableContainer table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

#functionsTableContainer th,
#functionsTableContainer td {
    white-space: normal;
    word-break: break-word;
}

#functionsTableContainer th,
#functionsTableContainer td {
    padding: 8px;
    border: 1px solid #ddd;
    vertical-align: top;
}

#functionsTableContainer th {
    background: #f5f5f5;
    text-align: left;
}

#functionsTableContainer thead th {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #f5f5f5;
    box-shadow: 0 1px 0 #ddd;
}

/* Стили для селекторов зависимостей */
.tree-select-container {
    position: relative;
    min-width: 200px;
}

.remove-item-btn {
    border: none;
    background: none;
    color: #666;
    margin-left: 5px;
    cursor: pointer;
    padding: 0;
}

/* Улучшенные стили для выпадающего списка поиска */
.tree-search-dropdown {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    font-size: 13px;
}

.tree-search-dropdown .dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.tree-search-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.tree-search-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

.tree-search-dropdown .dropdown-item i {
    width: 16px;
    text-align: center;
    color: #666;
}

.tree-search-dropdown .no-results {
    padding: 12px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 12px;
}

/* Поле поиска */
.tree-search-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tree-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.tree-search-input::placeholder {
    color: #aaa;
    font-size: 12px;
}

.dropdown-item {
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

.node-id {
    color: #666;
    font-size: 0.9em;
    margin-right: 10px;
}

.error-message {
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.tree-search-container {
    position: relative;
    margin-bottom: 15px;
}

#treeSearch {
    width: 300px;
    padding: 8px 30px 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#clearSearch {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
}

#clearSearch:hover {
    color: #666;
}

.jstree-search-result {
    max-height: 400px !important;  /* Увеличиваем высоту */
    overflow-y: auto !important;   /* Добавляем прокрутку */
    min-width: 300px !important;   /* Минимальная ширина */
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#resultsTable th,
#resultsTable td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: left;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jstree-search {
    background-color: #e6f3ff !important;
    font-weight: 500;
}

/* Контейнер таблицы с горизонтальным скроллом */
#avpkoTableContainer {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible; /* Убираем ограничение по высоте */
    margin: 10px 0;
    padding: 5px;
    background: #fff;
    border: 1px solid #ccc;
  }

  /* Таблица с фиксированным расположением столбцов и минимальной шириной 1800px */
  .avpko-table {
    width: 100%;
    min-width: 1800px;
    border-collapse: collapse;
    table-layout: fixed; /* фиксированное расположение для стабильных размеров столбцов */
    /* Убираем любые ограничения высоты */
    height: auto;
  }

  /* Заголовки и ячейки таблицы */
  .avpko-table th,
  .avpko-table td {
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: top;
    text-align: left;
    white-space: normal;    /* разрешает перенос строк */
    word-break: break-word;  /* переносит длинные слова */
  }

  /* Фон заголовков */
  .avpko-table th {
    background-color: #f2f2f2;
    font-weight: bold;
  }

  /* Задаём фиксированные ширины для столбцов */
  .avpko-table th:nth-child(1) { width: 150px; }  /* Режим отказа */
  .avpko-table th:nth-child(2) { width: 250px; }  /* Причина отказа */
  .avpko-table th:nth-child(3) { width: 80px; }   /* Alpha */
  .avpko-table th:nth-child(4) { width: 150px; }  /* NHA */
  .avpko-table th:nth-child(5) { width: 150px; }  /* NHE */
  .avpko-table th:nth-child(6) { width: 80px; }   /* Beta */
  .avpko-table th:nth-child(7) { width: 150px; }  /* Конечный эффект */
  .avpko-table th:nth-child(8) { width: 150px; }  /* Обнаружение */
  .avpko-table th:nth-child(9) { width: 120px; }  /* Критичность */
  .avpko-table th:nth-child(10) { width: 200px; } /* Корректирующие меры */
  .avpko-table th:nth-child(11) { width: 200px; } /* Компенсирующие меры */
  .avpko-table th:nth-child(12) { width: 120px; } /* Выбранные действия */
  .avpko-table th:nth-child(13) { width: 100px; } /* Вероятность (O) */
  .avpko-table th:nth-child(14) { width: 100px; } /* Эффективность обнаружения (D) */
  .avpko-table th:nth-child(15) { width: 80px; }  /* RPN */
  .avpko-table th:nth-child(16) { width: 80px; }  /* ΔRPN */

  /* Стили для textarea с переносом строк */
  .avpko-table textarea {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  /* Стили для input и select */
  .avpko-table input[type="number"],
  .avpko-table select {
    width: 100%;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
  }

/* ===== СТИЛИ ДЛЯ ВСТРОЕННЫХ УЛУЧШЕНИЙ ТАБЛИЦ - НАЧАЛО ===== */
/* Добавить этот код в КОНЕЦ файла tree_structure.css */

/* Панель управления таблицей */
.table-control-panel {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.table-control-panel h4 {
    margin: 0;
    color: #495057;
    font-size: 16px;
}

.table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-btn {
    padding: 6px 12px;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.control-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.control-btn.secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.control-btn.secondary:hover {
    background: #545b62;
    border-color: #545b62;
}

.control-btn.active {
    background: #28a745;
    border-color: #28a745;
}

.control-btn.active:hover {
    background: #218838;
    border-color: #218838;
}

/* Dropdown для столбцов */
.column-dropdown {
    position: relative;
    display: inline-block;
}

.column-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 200px;
    margin-top: 5px;
}

.column-dropdown-content.show {
    display: block;
}

.column-option {
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-option label {
    cursor: pointer;
    font-size: 13px;
}

/* Улучшенные textarea и input */
#functionsTableContainer textarea {
    min-height: 50px !important;
    resize: vertical !important;
    padding: 8px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    transition: border-color 0.2s !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

#functionsTableContainer textarea:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1) !important;
    outline: none !important;
}

#functionsTableContainer input[type="text"] {
    min-height: 35px !important;
    padding: 6px 8px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    transition: border-color 0.2s !important;
    width: 100% !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

#functionsTableContainer input[type="text"]:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1) !important;
    outline: none !important;
}

#functionsTableContainer select {
    padding: 6px 8px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    background: white !important;
}

#functionsTableContainer select:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1) !important;
    outline: none !important;
}

/* Улучшенные заголовки таблицы */
#functionsTableContainer th {
    background: linear-gradient(135deg, #495057, #6c757d) !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 10px 8px !important;
    font-size: 12px !important;
    text-align: center !important;
}

/* Улучшенные строки */
#functionsTableContainer tbody tr:hover {
    background-color: #f8f9fa !important;
}

#functionsTableContainer tbody tr.selected-row {
    background-color: #e3f2fd !important;
    border-left: 3px solid #2196f3 !important;
}

/* Скрытые столбцы */
.hidden-column {
    display: none !important;
}

/* Улучшенные бейджи зависимостей */
#functionsTableContainer .selected-badge {
    background: #007bff !important;
    color: white !important;
    padding: 3px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    margin: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}

#functionsTableContainer .function-affects .selected-badge {
    background: #28a745 !important;
}

#functionsTableContainer .remove-item-btn {
    background: rgba(255,255,255,0.3) !important;
    border: none !important;
    color: white !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer !important;
    font-size: 10px !important;
}

/* Эффект дублирования */
.duplicating-row {
    background: #fff3cd !important;
    animation: duplicateGlow 0.8s ease-in-out;
}

@keyframes duplicateGlow {
    0%, 100% { background: #fff3cd; }
    50% { background: #ffeaa7; }
}

/* Drag & Drop стили */
.drop-zone-active {
    border: 2px dashed #007bff !important;
    background: rgba(0,123,255,0.1) !important;
    border-radius: 4px !important;
    animation: dropZonePulse 1s infinite;
}

@keyframes dropZonePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Уведомления */
.table-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 10000;
    font-size: 14px;
    max-width: 250px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

/* Контекстное меню */
.table-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 10000;
    min-width: 150px;
    padding: 5px 0;
}

.table-context-menu div {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #495057;
    transition: background 0.2s;
}

.table-context-menu div:hover {
    background: #f8f9fa;
}

/* Стили для detached режима */
.tab.detached .table-control-panel,
.tab.detached #functionsTableContainer {
    height: auto !important;
    max-height: none !important;
}

.tab.detached #functionsTableContainer {
    height: calc(100vh - 180px) !important;
    overflow: auto !important;
}

.tab.detached .table-control-panel {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Улучшения для detached окна */
.detached-window .table-control-panel,
.detached-window #functionsTableContainer {
    height: auto !important;
}

.detached-window #functionsTableContainer {
    height: calc(100% - 80px) !important;
    max-height: calc(100% - 80px) !important;
    overflow: auto !important;
}

/* Адаптивные стили для панели управления */
@media (max-width: 768px) {
    .table-control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .table-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .column-dropdown-content {
        right: auto;
        left: 0;
    }

}

/* Стили для многострочных textarea в таблицах */
.avpko-table textarea,
#functionsTableContainer textarea,
#vvfTableContainer textarea,
#requirementsTableContainer textarea {
    width: 100%;
    min-height: 40px;
    resize: vertical;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    font-family: inherit;
    font-size: inherit;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    box-sizing: border-box;
    line-height: 1.4;
}

.avpko-table textarea:focus,
#functionsTableContainer textarea:focus,
#vvfTableContainer textarea:focus,
#requirementsTableContainer textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Скрытые столбцы */
.hidden-column {
    display: none !important;
}

/* ===== СТИЛИ ДЛЯ ВСТРОЕННЫХ УЛУЧШЕНИЙ ТАБЛИЦ - КОНЕЦ ===== */

/* Стили для Drag & Drop */
.drop-zone-active {
    background-color: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Области для сброса */
.selected-items {
    min-height: 40px !important;
    padding: 8px !important;
    border: 2px dashed #ddd !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    transition: all 0.2s ease !important;
    cursor: default !important;
}

.selected-items:empty::before {
    content: "Перетащите элементы сюда";
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}

.selected-items[data-type="depends"]:empty::before {
    content: "Перетащите элементы, от которых зависит функция/отказ";
}

.selected-items[data-type="affects"]:empty::before {
    content: "Перетащите элементы, на которые влияет функция/отказ";
}

/* Активная зона для сброса */
.drop-zone-active {
    background: linear-gradient(45deg, #e3f2fd, #bbdefb) !important;
    border-color: #2196f3 !important;
    border-style: solid !important;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.3) !important;
    transform: scale(1.02) !important;
}

.drop-zone-active::before {
    content: "Отпустите для добавления" !important;
    color: #1976d2 !important;
    font-weight: bold !important;
}

/* Стили для бейджей зависимостей */
.selected-badge {
    animation: slideIn 0.3s ease-out !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.selected-badge .remove-item-btn:hover {
    background: rgba(255,255,255,0.2) !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
}

/* Улучшенные стили для перетаскивания */
.jstree-dragging {
    opacity: 0.7 !important;
    transform: rotate(2deg) !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
}

/* Курсоры для drag & drop */
.jstree-anchor[draggable="true"] {
    cursor: grab !important;
}

.jstree-anchor[draggable="true"]:active {
    cursor: grabbing !important;
}


.selected-badge {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Визуальные индикаторы для узлов с детьми и без детей */
/* Базовые стили для jstree */
.jstree-default .jstree-anchor {
    line-height: 24px;
    height: 24px;
    color: #333;
    white-space: nowrap;
    padding: 2px 4px 2px 4px;
    border-radius: 2px;
    transition: background-color 0.15s ease-in-out;
}

.jstree-default .jstree-anchor:hover {
    background-color: #e1f5fe;
}

.jstree-default .jstree-anchor.jstree-clicked {
    background-color: #1976d2;
    color: white;
}

/* Иконки для разных типов узлов - только FontAwesome */
.jstree-default .jstree-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* Типы узлов */
.jstree-node[aria-level="1"] > .jstree-anchor {
    font-weight: bold;
    color: #1976d2;
}

.jstree-node[aria-level="1"] > .jstree-anchor:hover {
    color: #1976d2;
}

.jstree-node[aria-level="2"] > .jstree-anchor {
    color: #388e3c;
}

.jstree-node[aria-level="2"] > .jstree-anchor:hover {
    color: #388e3c;
}

.jstree-node[aria-level="3"] > .jstree-anchor {
    color: #f57c00;
}

.jstree-node[aria-level="3"] > .jstree-anchor:hover {
    color: #f57c00;
}

.jstree-node[aria-level="4"] > .jstree-anchor,
.jstree-node[aria-level="5"] > .jstree-anchor {
    color: #7b1fa2;
}

.jstree-node[aria-level="4"] > .jstree-anchor:hover,
.jstree-node[aria-level="5"] > .jstree-anchor:hover {
    color: #7b1fa2;
}

/* Простые индикаторы открытых/закрытых папок */
.jstree-closed > .jstree-anchor::after {
    content: " 📁";
    opacity: 0.6;
    font-size: 12px;
}

.jstree-open > .jstree-anchor::after {
    content: " 📂";
    opacity: 0.6;
    font-size: 12px;
}

.jstree-leaf > .jstree-anchor::after {
    content: " 📄";
    opacity: 0.6;
    font-size: 12px;
}

/* Drag and drop стили */
.jstree-anchor[draggable="true"] {
    cursor: grab;
}

.jstree-anchor[draggable="true"]:active {
    cursor: grabbing;
}

.jstree-anchor.jstree-dragging {
    opacity: 0.5;
}

/* ===== СТИЛИ ДЛЯ НОМЕНКЛАТУРЫ ПОКАЗАТЕЛЕЙ БНКТ - НАЧАЛО ===== */

/* Переопределение стилей для tab5 */
#tab5 {
    display: block;
    gap: 0;
    padding: 0;
    background: #f7fafc;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Контейнер под-вкладок БНКТ */
.bnkt-sub-tabs {
    width: 100%;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Кнопки под-вкладок */
.bnkt-sub-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.5rem 0.5rem 0 0.5rem;
}

.bnkt-sub-tab-button {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 0.75rem 1rem;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    margin-bottom: -2px;
    position: relative;
}

.bnkt-sub-tab-button:hover {
    background: #cbd5e0;
    color: #2d3748;
}

.bnkt-sub-tab-button.active {
    background: #ffffff;
    color: #2b6cb0;
    border-bottom: 3px solid #3182ce;
    font-weight: 700;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

/* Содержимое под-вкладок */
.bnkt-sub-tab-content {
    padding: 1.5rem;
    background: #ffffff;
}

.bnkt-tab-panel {
    display: none;
}

.bnkt-tab-panel.active {
    display: block;
    animation: bnktTabFadeIn 0.3s ease;
}

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

/* Секции внутри вкладок */
.bnkt-section {
    margin-bottom: 2rem;
}

.bnkt-section:last-child {
    margin-bottom: 0;
}

.bnkt-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bnkt-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #4299e1, #667eea);
    border-radius: 2px;
}

/* Сетки для полей */
.bnkt-input-grid,
.bnkt-output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Группы полей */
.bnkt-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bnkt-field-group label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.bnkt-field-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #718096;
    font-style: italic;
    line-height: 1.3;
}

/* КРИТИЧНО: Различие между вводимыми и расчетными полями */

/* Вводимые поля - обычное оформление, редактируемые */
.bnkt-input-field {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #ffffff;
    color: #2d3748;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.bnkt-input-field:hover {
    border-color: #a0aec0;
}

.bnkt-input-field:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
    background: #ffffff;
}

.bnkt-input-field::placeholder {
    color: #a0aec0;
    font-size: 0.85rem;
}

/* Расчетные поля - readonly, визуально отличаются */
.bnkt-output-field {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #f7fafc;
    color: #4a5568;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.2s ease;
}

.bnkt-output-field:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.bnkt-output-field::placeholder {
    color: #a0aec0;
    font-style: italic;
}

/* Иконки для различения типов полей */
.bnkt-field-group label::after {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Иконка для вводимых полей */
.bnkt-input-grid .bnkt-field-group label::after {
    content: 'ввод';
    background: #bee3f8;
    color: #2c5282;
}

/* Иконка для расчетных полей */
.bnkt-output-grid .bnkt-field-group label::after {
    content: 'расчет';
    background: #c6f6d5;
    color: #22543d;
}

/* Маленький текст с подсказками */
.reliability-input-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #718096;
    font-style: italic;
    line-height: 1.3;
}

/* Старые поля БНКТ для совместимости с аккордеоном */
.bnkt-section-header {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: linear-gradient(135deg, #4299e1, #667eea);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.bnkt-section-header:hover {
    background: linear-gradient(135deg, #3182ce, #5a67d8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.bnkt-section-header i {
    transition: transform 0.3s ease;
    font-size: 0.85rem;
}

.bnkt-section.active .bnkt-section-header i {
    transform: rotate(180deg);
}

.bnkt-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding: 0;
    background: #f8fafc;
    border-radius: 0 0 6px 6px;
}

.bnkt-section.active .bnkt-section-content {
    max-height: 3000px;
    padding: 1rem;
}

.bnkt-section-content .reliability-input-group {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.bnkt-section-content .reliability-input-group:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bnkt-section-content .reliability-input-group label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    display: block;
}

.bnkt-section-content .reliability-input-group input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.bnkt-section-content .reliability-input-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
    background: white;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .bnkt-sub-tab-button {
        min-width: 100px;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }

    .bnkt-input-grid,
    .bnkt-output-grid {
        grid-template-columns: 1fr;
    }

    .bnkt-sub-tab-content {
        padding: 1rem;
    }

    .bnkt-section-title {
        font-size: 1rem;
    }
}

/* ===== СТИЛИ ДЛЯ НОМЕНКЛАТУРЫ ПОКАЗАТЕЛЕЙ БНКТ - КОНЕЦ ===== */
