@import url("tokens.14c881f863a0.css");
@import url("layout.54c9b62f1cb1.css");
@import url("sidebar.c111372fc7b9.css");
@import url("topbar.90ef568ccd08.css");
@import url("filters.8c7e8e13b10a.css");
@import url("table.3ead6f6fb950.css");
@import url("rightbar.6cda8d2a724e.css");
@import url("tree-sidebar.3b3d63cdc00a.css");
@import url("norm_doc.6070be62454f.css");

html,
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

.hide {
  display: none !important;
}

/* Скрытое поле CSRF, чтобы не занимало места и не мигало на странице */
.hidden-csrf-token {
  display: none !important;
}
.text-muted {
  color: var(--muted);
}
.rounded {
  border-radius: var(--r-md);
}
.shadow {
  box-shadow: var(--shadow);
}

.sidepanel .card {
  border-radius: 14px;
}
.sidepanel .card .card-body {
  padding: 14px;
}
.sidepanel .btn-apply {
  height: 36px;
  margin-top: 10px;
  /* Использует базовые стили .glass-btn */
}

/* ==== КАСТОМНЫЕ СЕЛЕКТЫ (плавное раскрытие) ==== */
.cselect {
  position: relative;
  width: 240px;
}
.cselect-toggle {
  height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 0 40px 0 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  min-width: 0; /* Позволяет flex-элементам сжиматься */
  position: relative; /* Для абсолютного позиционирования стрелки */
}

.cselect-value {
  flex: 1;
  min-width: 0; /* Позволяет тексту обрезаться */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 4px; /* Небольшой отступ от стрелки */
}
.cselect-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 12px rgba(99, 102, 241, 0.2),
    0 0 20px rgba(99, 102, 241, 0.15);
}

.cselect-toggle:focus {
  outline: none;
  border-color: rgba(199, 210, 254, 0.6);
  box-shadow:
    0 0 0 1px rgba(199, 210, 254, 0.35),
    0 0 16px rgba(99, 102, 241, 0.18);
}
.cselect-caret {
  position: absolute;
  right: 10px;
  width: 18px;
  height: 18px;
  -webkit-mask: url("/static/test_main/img/chevron-down.f00599a07ccc.svg") no-repeat
    center/contain;
  mask: url("/static/test_main/img/chevron-down.f00599a07ccc.svg") no-repeat center/contain;
  background: #6b7280;
  transition: transform 0.18s ease;
}
.cselect[aria-expanded="true"] .cselect-caret {
  transform: rotate(180deg);
}

.cselect[aria-expanded="true"] {
  z-index: 1000;
  position: relative;
}

.cselect[aria-expanded="true"] .cselect-menu,
.cselect-menu.open {
  pointer-events: auto;
}

.cselect-menu {
  pointer-events: none;
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 0; /* анимируем от 0 к Hpx */
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 0.25s ease,
    opacity 0.18s ease,
    transform 0.25s ease;
  z-index: 1001;
  padding: 6px;
}

/* Скролл меню селектов — в едином стиле со скроллами страницы */
.cselect-menu::-webkit-scrollbar {
  width: 10px;
}

.cselect-menu::-webkit-scrollbar-track {
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  margin: 8px 0px;
}

.cselect-menu::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: linear-gradient(180deg, #09f4c5b2, #0098ea80);
}

.cselect-menu::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #09f4c5cc, #0098ea99);
}
/*/////////////////////////////////////////////////////*/

/* Открыто: НЕ задаём max-height! */
.cselect-menu.open {
  opacity: 1;
  transform: translateY(0);
}

.cselect-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 6px 10px;
  margin-bottom: 4px;
  background: #fff;
  border: 0;
  border-radius: 26px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
}
.cselect-option:last-child {
  margin-bottom: 0;
}
.cselect-option:hover {
  background: #b3b3b32d;
}
.cselect-option-selected {
  background: linear-gradient(135deg, #b6e9ff86, #c4b1ff3a);
}
.cselect-option-selected:hover {
  background: #82cbff2d;
}

.cselect-checkbox {
  width: 18px;
  height: 18px;
  border: 1px solid #fdfdfd42;
  border-radius: 12px;
  background: #e1e1e133;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
}
.cselect-checkbox-checked {
  background: linear-gradient(
    135deg,
    #ffffff,
    #ffffff
  ); /* Голубо-бирюзовый градиент */
  opacity: 1;
}
.cselect-checkbox-checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 4px;
  height: 8px;
  border: solid #111827;
  border-width: 0 1.7px 1.7px 0;
}

.cselect-option-text {
  flex: 1;
  min-width: 0;
  /* Убрана обрезка текста - названия документов отображаются полностью */
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cselect-clear-all {
  display: block;
  width: calc(100% - 8px);
  max-width: 100%;
  padding: 8px 12px;
  margin: 4px;
  background: #f3f4f6c7;
  border: 0;
  border-radius: 14px;
  color: #616b7e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}
.cselect-clear-all:hover {
  background: #e5e7eb;
  color: #374151;
}

/* та же высота у поиска, что у селектов  */
.filters .form-control {
  height: 32px;
  border-radius: 22px;
}

/* ==== АНИМАЦИЯ ПАНЕЛИ ДЕТАЛЕЙ (снизу выезжает) ==== */

#demand-detail {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(6px);
  transition:
    max-height 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.5s ease-out 0.1s,
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}

#demand-detail.open {
  opacity: 1;
  transform: translateY(0);
}

/* Содержимое панели детали требования */
.demands-detail-block-content {
  padding: 20px;
}

.demand-detail-title {
  margin-top: 0; /* убираем большой отступ сверху */
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demand-detail-id {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #111827 0%, #000000 100%);
  color: #ffffff;
  display: inline-block;
  line-height: 28px; /* выравниваем цифру по вертикали */
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.demand-detail-doc {
  font-weight: 400;
  color: #6b7280;
  margin-left: 4px;
}

/* Заголовок + поле тегов в одной строке */
.demand-detail-tags-edit {
  width: 100%;
}

/* Теги в режиме просмотра в заголовке (справа) */
.demand-detail-tags-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.demand-detail-source-doc {
  margin-bottom: 12px;
}

.demand-detail-source-doc-link {
  margin-left: 6px;
}

.demand-tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: #e5e7eb;
  background: linear-gradient(135deg, #180556, #1d4ed8);
  white-space: nowrap;
}

.demand-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.demand-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: none;
}

/* Технология — пастельный мятно-голубой (совпадает с chip в перечне) */
.demand-badge-tech {
  background: linear-gradient(135deg, #a5cefc, #93fdea);
  font-weight: 500;
  color: #0c4a6e;
}

/* Категория — пастельный градиент голубой → лавандовый (совпадает с chip в перечне) */
.demand-badge-cat {
  background: linear-gradient(135deg, #d4bbff, #a8b7f8);
  font-weight: 500;
  color: #4c1d95;
}

/* Узел требований — пастельный розовый градиент (как Технология и Категория) */
.demand-badge-node {
  background: linear-gradient(135deg, #fbcfe8c4, #ff8bff7f);
  font-weight: 500;
  color: #831843;
}

.demand-detail-node-view {
  margin-bottom: 10px;
}

.demand-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-style: italic;
  color: #6b7280;
  margin-bottom: 12px;
}

.demand-detail-section {
  border: 1px solid #e5e7eb;
  border-radius: 10px; /* скруглённые края обводки */
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #ffffff;
}

.demand-detail-section-title {
  display: block;
  margin-bottom: 4px;
}

.demand-detail-section-body {
  color: #111827;
}

.demand-detail-comments {
  color: #4b5563;
}

.demand-detail-dates {
  font-size: 0.9em;
  color: #9ca3af;
  margin-bottom: 12px;
}

/* Карточка термина: серый заголовок «Определение», дополнительные отступы */
.term-detail-def-title {
  color: #6b7280bb;
}

.term-detail-source-doc,
.term-detail-dates {
  padding-left: 16px;
  padding-right: 16px;
}

.demand-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Кнопки деталей требования используют glass-btn */
.btn-detail-edit,
.btn-detail-delete,
.btn-detail-save,
.btn-detail-cancel {
  /* Наследуем все стили от .glass-btn через множественный селектор */
  min-width: 120px;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  color: #111827;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.btn-detail-edit,
.btn-detail-delete {
  background: rgba(255, 255, 255, 0.9);
}

.btn-detail-edit:hover,
.btn-detail-delete:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 2px 2px 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(99, 102, 241, 0.25);
}

.btn-detail-edit {
  --glass-gradient-start: rgba(99, 102, 241, 0.5);
  --glass-gradient-middle: rgba(129, 140, 248, 0.5);
  --glass-gradient-end: rgba(165, 180, 252, 0.5);
}

.btn-detail-delete {
  --glass-gradient-start: rgba(244, 35, 94, 0.4);
  --glass-gradient-middle: rgba(248, 113, 167, 0.4);
  --glass-gradient-end: rgba(239, 165, 252, 0.4);
  min-width: auto; /* ширина по содержимому "Удалить" */
}

.btn-detail-delete:hover {
  box-shadow:
    inset 2px 2px 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(239, 68, 68, 0.25);
}

.btn-detail-save {
  --glass-gradient-start: rgba(97, 117, 245, 0.6);
  --glass-gradient-middle: rgba(79, 70, 229, 0.6);
  --glass-gradient-end: rgba(129, 140, 248, 0.6);
}

.btn-detail-cancel {
  --glass-gradient-start: rgba(107, 114, 128, 0.6);
  --glass-gradient-middle: rgba(75, 85, 99, 0.6);
  --glass-gradient-end: rgba(156, 163, 175, 0.6);
}

/* Стили для полей inline редактирования */
.demand-field-edit {
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 12px;
  background: #ffffff;
  max-width: 100%;
  box-sizing: border-box;
}

/* Фиксированная ширина и высота для textarea */
#demand-text-textarea,
#demand-comments-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

/* Текст требования выше */
#demand-text-textarea {
  min-height: 140px;
}

/* Комментарии немного ниже, но тоже выше базового поля */
#demand-comments-textarea {
  min-height: 90px;
}

.demand-field-edit:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.demand-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.demand-tags-input {
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 6px 14px;
  height: 32px;
  min-width: 220px;
}

.demand-tags-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Стили для поиска по узлу и селекта */
.demand-detail-node-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.demand-detail-node-edit-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

#demand-node-search {
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 4px 12px;
  height: 28px;
  flex: 1 1 50%;
  box-sizing: border-box;
}

#demand-node-search:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#demand-node-search::placeholder {
  opacity: 0.7;
}

#demand-node-select {
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 10px;
  height: 28px;
  flex: 1 1 50%;
  box-sizing: border-box;
}

#demand-node-select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/*//////////////////////////////////////////////////////////*/
[hidden] {
  display: none !important;
}

/* панель детали  */
/* ==== выезжающая средняя панель ==== */

/* Базовая сетка (без средней панели)*/
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(220px, 22vw, 320px);
  grid-template-areas:
    "filters filters"
    "table   side";
  gap: 14px;
  padding-right: 12px;
}

.filters-wrap {
  grid-area: filters;
  display: flex;
  justify-content: stretch;
  align-items: stretch;
  width: 100%;
  margin-bottom: 12px;
  padding-right: 12px;
}

.filters-toolbar > .card {
  flex: 1 1 auto;
  width: 100%;
}

.sidepanel {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Строка фильтров: всё в одну линию */
/* кнопка-переключатель внутри .filters-toolbar */

.mid-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  --icon-right: url("/static/test_main/img/chevron-right.4894b8875c90.svg");
  --icon-left: url("/static/test_main/img/chevron-left.4894b8875c90.svg");
  -webkit-mask: var(--icon-right) no-repeat center/18px 18px;
  mask: var(--icon-right) no-repeat center/18px 18px;
  background-color: #6b7280;
  transition: background-color 0.2s ease;
}
.mid-toggle.open {
  -webkit-mask: var(--icon-left) no-repeat center/18px 18px;
  mask: var(--icon-left) no-repeat center/18px 18px;
}
.mid-toggle:hover {
  background-color: #374151;
}
/* Базовая сетка (2 колонки: таблица + правая панель) */
.sidepanel {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 14px;
  padding-right: 14px;
}

/* Когда открыта средняя панель — 2 колонки: mid + table; правая скрыта */
.content-grid.with-mid {
  grid-template-columns: 350px minmax(0, 1fr);
  grid-template-areas:
    "filters filters"
    "mid     table";
}

#rightpanel {
  transition:
    opacity 380ms ease,
    transform 420ms cubic-bezier(0.22, 0.6, 0.18, 1);
}
#rightpanel.anim-hide {
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none; /* чтобы не ловила клики во время ухода */
}
#rightpanel.anim-show {
  opacity: 1;
  transform: translateX(0);
}
/* правую панель прячем, когда открыта средняя */
.content-grid.hide-right #rightpanel {
  display: none;
}

/* строка фильтров в одну линию, кнопка не перекрывает элементы */
.filters-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.req-tree-filter,
.filters-toolbar .input,
.filters-toolbar .select {
  flex: 1 1 auto;
  min-width: 0;
}

/* кнопка-переключатель */
.mid-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  --icon-right: url("/static/test_main/img/chevron-right.4894b8875c90.svg");
  --icon-left: url("/static/test_main/img/chevron-left.4894b8875c90.svg");
  -webkit-mask: var(--icon-right) no-repeat center/18px 18px;
  mask: var(--icon-right) no-repeat center/18px 18px;
  background-color: #6b7280;
  transition: background-color 0.2s ease;
}
.mid-toggle:hover {
  background-color: #374151;
}
.mid-toggle.open {
  -webkit-mask: var(--icon-left) no-repeat center/18px 18px;
  mask: var(--icon-left) no-repeat center/18px 18px;
}

/* Ряд под фильтрами: mid | table | right */
.main-row {
  display: flex;
  align-items: stretch;
  min-width: 0; /* важно, чтобы таблица могла сжиматься/расти */
  gap: 14px;
}

/* Таблица занимает всё оставшееся */
.table-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

/* Адаптивная верстка для мобильных устройств */
@media (max-width: 768px) {
  .main-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .midpanel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 1px;
    flex: 0 0 auto !important;
  }

  .table-wrap {
    width: 100%;
    flex: 0 0 auto !important;
  }

  /* Дополнительный отступ под панелью деталей требования на мобильных,
     чтобы она не "прилипала" к футеру */
  #demand-detail {
    margin-bottom: 16px;
  }

}

/* ПРАВАЯ панель: фикс. ширина, плавное исчезновение */
#rightpanel {
  flex: 0 0 clamp(220px, 22vw, 320px);
  max-width: clamp(220px, 22vw, 320px);
  transition:
    flex-basis 0.7s cubic-bezier(0.22, 0.6, 0.18, 1),
    max-width 0.7s cubic-bezier(0.22, 0.6, 0.18, 1),
    opacity 0.4s ease,
    transform 0.7s cubic-bezier(0.22, 0.6, 0.18, 1);
}

/* СРЕДНЯЯ панель с деревом требований — всегда видна слева от таблицы */
.midpanel {
  /* Фиксированная ширина панели с деревом — не сжимается, не растёт */
  flex: 0 0 330px;
  min-width: 330px;
  max-width: 330px;
  margin-right: 14px;
  height: 720px;
  opacity: 1;
  transform: translateX(0);
  overflow: visible;
  border-radius: 14px;
  position: relative;
}

/* Механизм сворачивания/разворачивания только для десктопа */
@media (min-width: 769px) {
  .midpanel {
    transition:
      flex-basis 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      min-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Свернутое состояние midpanel */
  .midpanel.collapsed {
    flex: 0 0 24px;
    min-width: 24px;
    max-width: 24px;
    margin-right: 0;
    overflow: hidden;
  }

  /* Скрываем содержимое при сворачивании */
  .midpanel.collapsed .card-tree,
  .midpanel.collapsed .tree-header-mobile {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    max-height: 0;
    padding: 0;
    transition:
      opacity 0.3s ease,
      max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Показываем содержимое при разворачивании */
  .midpanel:not(.collapsed) .card-tree,
  .midpanel:not(.collapsed) .tree-header-mobile {
    opacity: 1;
    pointer-events: auto;
    transition:
      opacity 0.3s ease 0.1s,
      max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Кнопка для сворачивания/разворачивания */
  .midpanel-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: #ffffff00;
    border: 0px solid var(--line, #ffffff00);
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    padding: 0;
  }

  .midpanel-toggle:hover {
    background: #ffffff00;
    border: 0px solid var(--line, #ffffff00);
  }

  .midpanel-toggle-icon {
    width: 16px;
    height: 16px;
    display: block;
    fill: #09f4c5; /* бирюзовый цвет */
    transform: rotate(180deg); /* изначально повернута на 180 градусов */
    transition:
      transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      filter 0.3s ease;
  }

  /* Эффект свечения при наведении */
  .midpanel-toggle:hover .midpanel-toggle-icon {
    fill: #00d9b8; /* более яркий бирюзовый при наведении */
    filter: drop-shadow(0 0 6px rgba(9, 244, 197, 0.8))
      drop-shadow(0 0 12px rgba(9, 244, 197, 0.5));
  }

  /* Возвращаем иконку в исходное положение при свернутом состоянии */
  .midpanel.collapsed .midpanel-toggle-icon {
    transform: rotate(0deg);
  }

  /* Позиционирование кнопки при свернутом состоянии */
  .midpanel.collapsed .midpanel-toggle {
    right: 0;
    border-radius: 12px;
  }
}

/* Заголовок для мобильной версии дерева */
.tree-header-mobile {
  display: none;
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 14px;
  border-radius: 14px 14px 0 0;
}

.tree-header-mobile .tree-toggle-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  fill: #09f4c5; /* бирюзовый цвет */
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
  transform: rotate(90deg); /* поворачиваем вниз для развернутого состояния */
}

.tree-header-mobile:hover .tree-toggle-icon {
  fill: #00d9b8; /* более яркий бирюзовый при наведении */
  filter: drop-shadow(0 0 4px rgba(9, 244, 197, 0.6))
    drop-shadow(0 0 8px rgba(9, 244, 197, 0.4));
}

.tree-header-mobile.collapsed .tree-toggle-icon {
  transform: rotate(0deg); /* горизонтально при свернутом состоянии */
}

/* Адаптивная верстка для мобильных устройств */
@media (max-width: 768px) {
  .midpanel {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  /* Скрываем кнопку сворачивания на мобильных (она только для десктопа) */
  .midpanel-toggle {
    display: none !important;
  }

  /* На мобильных игнорируем класс collapsed, используем только expanded */
  .midpanel.collapsed {
    flex: 0 0 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
  }

  .midpanel.collapsed .tree-header-mobile {
    opacity: 1 !important;
    pointer-events: auto !important;
    max-height: none !important;
  }

  .midpanel.collapsed .card-tree {
    opacity: 0 !important;
    pointer-events: none !important;
    max-height: 0 !important;
    padding: 0 !important;
  }

  .tree-header-mobile {
    display: flex;
  }

  .card-tree {
    overflow: hidden;
    transition:
      max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
      padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0 !important;
    padding: 0 !important;
  }

  .midpanel.expanded .card-tree {
    max-height: 3000px !important;
    padding: 6px !important;
  }

  .midpanel:not(.expanded) .card-tree {
    max-height: 0 !important;
    padding: 0 !important;
  }
}

.card-tree {
  padding: 6px;
}

/* Подсветка одного требования (клик в таблице) */
.doc-demand-highlight-single {
  background-color: rgba(199, 247, 239, 0.7); /* мягкий пастельно-мятный */
  padding: 0 1px;
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

/* Подсветка всех требований (кнопка) */
.doc-demand-highlight-all {
  background-color: rgba(190, 237, 255, 0.7); /* чуть более насыщенный мятный */
  padding: 0 1px;
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

/* Подсветка результатов поиска */
.doc-search-highlight {
  background-color: rgba(212, 255, 235, 0.6); /* пастельно-мятный для поиска */
  padding: 0 1px;
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

.doc-search-highlight.doc-search-current {
  background-color: rgba(
    174,
    255,
    243,
    0.75
  ); /* более насыщенный мятный для текущего */
  font-weight: 500;
}
