/* =========================
   БАЗА
   ========================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    background: #edf1f9;
    color: #111827;
}

header {
    padding: 12px 20px;
    border-bottom: 1px solid #d1d5db;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

h2 {
    margin: 4px 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

main {
    display: flex;
    height: calc(100vh - 50px);
    overflow: hidden;
}

/* =========================
   ЛЕВАЯ ПАНЕЛЬ (SIDEBAR)
   ========================= */

#sidebar {
    width: 320px;
    border-right: 1px solid #d1d5e3;
    background: linear-gradient(180deg, #f5f7ff 0%, #f3f4f6 55%, #e5ecff 100%);
    padding: 14px 12px;
    box-sizing: border-box;
    overflow-y: auto;

    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sidebar .section {
    border-radius: 10px;
    border: 1px solid #dde3f0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    padding: 8px 10px;
    margin-bottom: 0;
}

#sidebar .section h2 {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

#sidebar .small {
    font-size: 11px;
    color: #4b5563;
}

/* Кнопки в сайдбаре — компактные и на всю ширину */

#sidebar button {
    width: 100%;
    font-size: 11px;
    padding: 6px 9px;
    border-radius: 7px;
    border: 1px solid transparent;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.06s ease,
        border-color 0.12s ease;
}

#sidebar button:hover:not(:disabled) {
    background-color: #1d4ed8;
    box-shadow: 0 2px 7px rgba(37, 99, 235, 0.35);
    transform: translateY(-0.5px);
}

#sidebar button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
}

#sidebar button:disabled {
    opacity: 0.55;
    cursor: default;
    box-shadow: none;
}

/* Акцент для текста "выбранный проект/версия" */

#currentProjectLabel,
#currentProjectNameLabel,
#currentVersionLabel,
#currentStageLabel {
    font-weight: 600;
    color: #1d4ed8;
}

/* Контейнер проектов */

#projectsContainer {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Карточка проекта */

.project {
    border-radius: 9px;
    border: 1px solid #dde3f0;
    background: #ffffff;
    padding: 7px 8px;
    margin-bottom: 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.06s ease,
        border-color 0.12s ease;
}

.project:hover {
    background: #f4f6ff;
    border-color: #bfdbfe;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
}

/* Шапка проекта */

.project-header {
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #111827;
}

.project-header:hover {
    color: #1d4ed8;
}

/* Кнопка-стрелка сворачивания/разворачивания проекта */

.project-toggle {
    font-size: 15px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #9ca3af;
    transition:
        background-color 0.12s ease,
        color 0.12s ease,
        transform 0.06s ease;
}

.project-toggle:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    transform: translateY(-0.5px);
}

/* При наведении на заголовок — подсветка стрелки */

.project-header:hover .project-toggle {
    color: #1d4ed8;
}

/* Список версий */

.versions {
    margin-top: 6px;
    padding-left: 6px;
    border-left: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Одна версия */

.version-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-width: 0; /* текст может ужиматься */
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 6px;
    transition:
        background-color 0.1s ease,
        color 0.1s ease,
        transform 0.05s ease;
}

/* Текст версии: тянется и обрезается троеточием */

.version-item span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* hover по версии */

.version-item:hover {
    background: #eef2ff;
    color: #1d4ed8;
    transform: translateY(-0.5px);
}

/* выбранная версия */

.version-item.selected {
    background: #e0ecff;
    color: #1d4ed8;
    font-weight: 600;
}

/* Кнопка удаления версии — маленький квадратный крестик справа */

.version-item button {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    min-width: 22px;

    padding: 0;
    margin-left: 6px;

    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #e5edff;
    color: #1f2937;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    line-height: 1;
    box-shadow: none;
}

/* Hover/active для крестика */

.version-item button:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
    transform: translateY(0);
}

.version-item button:active:not(:disabled) {
    transform: translateY(1px);
}

.version-item button:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
}

/* Отключённые/недоступные секции */

.dimmed-section {
    opacity: 0.55;
    pointer-events: none;
}

/* =========================
   ПРАВАЯ ЧАСТЬ
   ========================= */

#content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
}

.content-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Общие секции/карточки справа */

.section {
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.card {
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.small {
    font-size: 12px;
    color: #4b5563;
}

/* Кнопки (общий стиль, но в сайдбаре переопределён через #sidebar button) */

button {
    padding: 6px 11px;
    margin: 4px 0;
    cursor: pointer;
    border-radius: 7px;
    border: 1px solid transparent;
    background-color: #2563eb;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.06s ease,
        border-color 0.12s ease;
}

button:hover:not(:disabled) {
    background-color: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transform: translateY(-0.5px);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}

button:disabled {
    opacity: 0.55;
    cursor: default;
    box-shadow: none;
}

/* INPUT / SELECT */

input[type="file"],
input[type="number"],
input[type="text"],
select {
    margin: 2px 0 6px;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #111827;
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input[type="number"],
input[type="text"],
select {
    width: 200px;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

/* =========================
   Блок информации о версии
   ========================= */

.version-info-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.version-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.version-info-actions {
    white-space: nowrap;
}

.busy-indicator {
    color: #b91c1c;
    font-weight: 500;
    min-height: 16px;
}

/* =========================
   ВКЛАДКИ ПРАВОЙ ЧАСТИ
   ========================= */

.tabs-shell {
    padding: 0;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #d1d5e3;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 0 10px;
    background: linear-gradient(180deg, #f3f6ff 0%, #e5edff 100%);
    border-bottom: 1px solid #d1d5e3;
}

.ksg-tab {
    background: transparent;
    border-radius: 9px 9px 0 0;
    border: none;
    padding: 7px 14px;
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    box-shadow: none;
}

.ksg-tab:hover:not(.tab-active) {
    background: rgba(255, 255, 255, 0.7);
    color: #1d4ed8;
    box-shadow: none;
}

/* Активная вкладка */

.ksg-tab.tab-active {
    background: #ffffff;
    color: #1d4ed8;
    box-shadow: 0 -1px 0 0 #ffffff, 0 0 0 1px #bfdbfe;
}

/* При наведении на уже выбранную вкладку — синий фон и белый текст */

.ksg-tab.tab-active:hover {
    background-color: #1d4ed8;
    color: #ffffff;
}

/* Контент вкладок */

.tabs-body {
    padding: 8px 14px 12px;
}

.tabs-shell .stage-section {
    border: none;
    box-shadow: none;
    padding: 8px 0;
    margin: 0;
}

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

.ksg-tab-panel.tab-panel-active {
    display: block;
}

/* =========================
   ЛОГ / СТАТУС
   ========================= */

.log-section {
    padding-top: 10px;
}

#status {
    white-space: pre-wrap;
    font-size: 12px;
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* =========================
   ТАБЛИЦА
   ========================= */

#tableContainer table {
    border-collapse: collapse;
    font-size: 12px;
    width: 100%;
    background: #ffffff;
}

#tableContainer th,
#tableContainer td {
    border: 1px solid #e5e7eb;
    padding: 3px 6px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tableContainer thead th {
    position: sticky;
    top: 0;
    background: #f3f4ff;
    z-index: 1;
    font-weight: 600;
    color: #1f2937;
}

#tableContainer tbody tr:nth-child(even) {
    background: #f9fafb;
}

#tableContainer tbody tr:hover {
    background: #e5f0ff;
}

/* Детали строки под таблицей */

.row-details-box {
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
}

/* Фильтры уровней */

#levelFiltersContainer label {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    margin-bottom: 2px;
    white-space: nowrap;
}

/* =========================
   details / summary
   ========================= */

details {
    border-radius: 6px;
    /* background: #f9fafb; */
    padding: 4px 6px;
}

details[open] {
    background: #eff6ff;
}

details summary {
    list-style: none;
    outline: none;
}

details summary::-webkit-details-marker {
    display: none;
}


/* Красивый файл-инпут для создания проекта */

#createProjectFile {
    width: 100%;
    font-size: 11px;
    color: #4b5563;
    border: none;
    padding: 0;
    background: transparent;
}

/* Современные браузеры: кнопка выбора файла */
#createProjectFile::file-selector-button {
    font-size: 11px;
    padding: 6px 10px;
    margin-right: 8px;

    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background-color: #e5edff;
    color: #1f2937;

    cursor: pointer;
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.06s ease,
        border-color 0.12s ease;
}

#createProjectFile::file-selector-button:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    transform: translateY(-0.5px);
}

#createProjectFile::file-selector-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

/* Для старых WebKit (если нужно) */
#createProjectFile::-webkit-file-upload-button {
    font-size: 11px;
    padding: 6px 10px;
    margin-right: 8px;

    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background-color: #e5edff;
    color: #1f2937;

    cursor: pointer;
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.06s ease,
        border-color 0.12s ease;
}

#createProjectFile::-webkit-file-upload-button:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    transform: translateY(-0.5px);
}

#createProjectFile::-webkit-file-upload-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

/* =========================
   Встроенный статус (busyIndicator)
   ========================= */

.status-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.status-label {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
}

.status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    min-width: 90px;
    text-align: center;

    background: #e5f3ff; /* базовый (инфо) */
    color: #1d4ed8;
    border: 1px solid #bfdbfe;

    white-space: nowrap;
}

.status-hint {
    margin-top: 2px;
    color: #9ca3af;
}

/* =========================
   Лог / статус (консоль)
   ========================= */

.log-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}

.log-header h2 {
    margin: 0;
}

.log-hint {
    color: #9ca3af;
    font-size: 11px;
}

.status-console {
    white-space: pre-wrap;
    font-size: 12px;
    background: #020617;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;

    border-left: 3px solid #2563eb;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.7);

    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
}

/* Контейнер формы логина */
#loginPage.login-page {
    max-width: 400px;
    margin: 40px auto;
    padding: 24px 24px 20px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Заголовок */
.login-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

/* Обёртка для одного поля */
.login-field {
    margin-bottom: 14px;
}

/* Подписи к полям */
.login-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
}

/* Сами инпуты — одинаковый вид для text и password */
.login-input {
    width: 100%;
    box-sizing: border-box;
    display: block;

    /* фиксируем одинаковую высоту */
    height: 38px;

    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #c4c4c4;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}


.login-input:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 1px rgba(33, 150, 243, 0.25);
}

/* Кнопка входа */
.login-button {
    width: 100%;
    margin-top: 4px;
    padding: 9px 12px;
    border: none;
    border-radius: 4px;
    background: #2196f3;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.login-button:hover {
    background: #1976d2;
}

.login-button:active {
    background: #1565c0;
}

/* Ошибка под формой */
.login-error {
    margin-top: 8px;
    min-height: 18px;
    font-size: 12px;
    color: #c62828;
}

/* Поля логина и пароля — всегда на всю ширину */
#loginPage .login-input {
    width: 100% !important;
    box-sizing: border-box;
    display: block;
    height: 38px;
}

#busyIndicator {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  /* border: 1px solid transparent; */
}

/* нормальное состояние */
.status-pill-ok {
  background: #ecfdf5;   /* мягко-зелёный */
  color: #047857;
  border-color: #6ee7b7;
}

/* идёт операция */
.status-pill-busy {
  background: #eff6ff;   /* мягко-синий */
  color: #1d4ed8;
  border-color: #93c5fd;
}

/* ошибка */
.status-pill-error {
  background: #fef2f2;   /* мягко-красный */
  color: #b91c1c;
  border-color: #fecaca;
}

/* Общий вид "кнопки" для summary */
.settings-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    list-style: none; /* убрать маркер details */
}

.settings-toggle::-webkit-details-marker {
    display: none;
}

.settings-toggle:hover {
    background: #e5e7eb;
}

.settings-toggle-icon {
    font-size: 12px;
}

.dev-only-label {
    font-size: 10px;
    opacity: 0.7;
}

.sequence-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 16px;
    align-items: flex-start;
    margin-top: 8px;
}

.sequence-controls,
.sequence-visual {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* На узких экранах — в одну колонку */
@media (max-width: 900px) {
    .sequence-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.sequence-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 16px;
    align-items: flex-start;
    margin-top: 8px;
}

.sequence-controls,
.sequence-visual {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* вертикальная линия между колонками */
.sequence-visual {
    border-left: 1px solid #e5e7eb;
    padding-left: 16px;
    margin-left: 4px;
}

/* подписи над двумя колонками */
.section-column-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin-bottom: 4px;
}

/* На узких экранах — в одну колонку, линию убираем */
@media (max-width: 900px) {
    .sequence-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sequence-visual {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-top: 12px;
    }
}

/* Подсветка строк таблицы */
.row-hl-changed td {
    background-color: #fff7e6; /* мягкий оранжевый / "есть изменения" */
}

.row-hl-sampled td {
    background-color: #e6f4ff; /* мягкий голубой / "была в выборке" */
}

.row-hl-sampled-changed td {
    background-color: #fce7f3; /* мягкий розовый / "в выборке и изменена" */
}

/* Чтобы текст был читаем при hover, можно немного усиливать рамку, но фон оставлять тот же */
.row-hl-changed:hover td,
.row-hl-sampled:hover td,
.row-hl-sampled-changed:hover td {
    outline: 1px solid rgba(0,0,0,0.05);
}

/* Блок управления подсветкой и легенда */
.table-highlight-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.table-highlight-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.table-highlight-legend {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4b5563;
}

.legend-color-box {
    width: 14px;
    height: 10px;
    border-radius: 3px;
    border: 1px solid #d1d5db;
}

/* те же цвета, что и у строк */
.legend-changed-box {
    background-color: #fff7e6;
}

.legend-sampled-box {
    background-color: #e6f4ff;
}

.legend-sampled-changed-box {
    background-color: #fce7f3;
}


.gantt-section {
  margin-top: 12px;
}

.gantt-scroll-wrapper {
  min-width: 600px;
}

.gantt-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 240px minmax(400px, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.gantt-row-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-track {
  position: relative;
  height: 18px;
  background: #f9fafb;
  border-radius: 4px;
  overflow: hidden;
}

.gantt-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 4px;
}

/* Цвета по уровню */
.gantt-bar.gantt-level-1 { background-color: #bfdbfe; }
.gantt-bar.gantt-level-2 { background-color: #a5b4fc; }
.gantt-bar.gantt-level-3 { background-color: #f9a8d4; }

/* Типы – через штриховку */
.gantt-bar.gantt-type-only-works {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.08),
    rgba(0,0,0,0.08) 4px,
    transparent 4px,
    transparent 8px
  );
}

.gantt-bar.gantt-type-only-folders {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(0,0,0,0.08),
    rgba(0,0,0,0.08) 4px,
    transparent 4px,
    transparent 8px
  );
}

.gantt-bar.gantt-type-mixed {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.08),
    rgba(0,0,0,0.08) 4px,
    transparent 4px,
    transparent 8px
  );
}

/* ===== Gantt ===== */

.gantt-container {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  max-height: 400px;
  max-width: 100%;       /* важно */
  overflow-x: auto;      /* горизонтальный скролл */
  overflow-y: auto;      /* вертикальный скролл */
  background: #fafafa;
}

.gantt-scroll-wrapper {
  position: relative;
  min-width: 600px;
}

.gantt-axis {
  position: relative;
  margin-left: 220px; /* такой же, как ширина label */
  margin-bottom: 8px;
  height: 20px;
  overflow: hidden;
}

.gantt-axis-inner {
  position: relative;
  height: 100%;
}

.gantt-axis-tick {
  position: absolute;
  top: 0;
  font-size: 10px;
  white-space: nowrap;
  transform: translateX(-50%);
  border-left: 1px solid #ccc;
  padding-left: 2px;
  color: #666;
}

.gantt-rows {
  position: relative;
}

.gantt-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
}

.gantt-row-label {
  flex: 0 0 220px;
  padding-right: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gantt-row-track {
  position: relative;
  flex: 1 1 auto;
  height: 20px;
}

.gantt-bar {
  position: absolute;
  top: 2px;
  height: 16px;
  border-radius: 3px;
  box-sizing: border-box;
}

/* Цвета уровней (1..8) — можно подобрать свои */
.gantt-level-1 { background-color: #1f77b4; }
.gantt-level-2 { background-color: #ff7f0e; }
.gantt-level-3 { background-color: #2ca02c; }
.gantt-level-4 { background-color: #d62728; }
.gantt-level-5 { background-color: #9467bd; }
.gantt-level-6 { background-color: #8c564b; }
.gantt-level-7 { background-color: #e377c2; }
.gantt-level-8 { background-color: #7f7f7f; }

/* Типы папок — поверх цвета уровня */
.gantt-type-only-works {
  border: 2px solid rgba(0, 0, 0, 0.8);
}
.gantt-type-only-folders {
  border: 2px dashed rgba(0, 0, 0, 0.8);
}
.gantt-type-mixed {
  border: 2px dotted rgba(0, 0, 0, 0.8);
}

/* Легенда */

.gantt-legend .legend-item {
  margin-right: 12px;
  display: inline-flex;
  align-items: center;
}

.legend-color-box,
.legend-pattern-box {
  display: inline-block;
  width: 16px;
  height: 12px;
  margin-right: 4px;
  border-radius: 3px;
  box-sizing: border-box;
}

/* Для паттернов типов достаточно границ — те же классы, что на барах */
/* .legend-pattern-box.gantt-type-only-works {
  border: 2px solid rgba(0, 0, 0, 0.8);
}
.legend-pattern-box.gantt-type-only-folders {
  border: 2px dashed rgba(0, 0, 0, 0.8);
}
.legend-pattern-box.gantt-type-mixed {
  border: 2px dotted rgba(0, 0, 0, 0.8);
} */

.gantt-container {
  position: relative;    /* важно для sticky-элементов внутри */
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  max-height: 400px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  background: #f3f3f3;   /* чуть более серый фон общего блока */
}

.gantt-axis {
  position: sticky;      /* закрепляем ось при вертикальном скролле */
  top: 0;
  z-index: 3;
  margin-left: 220px;
  margin-bottom: 8px;
  height: 24px;
  overflow: visible;
  background: #e9e9e9;   /* отдельный фон под ось */
  border-bottom: 1px solid #d0d0d0;
}

.gantt-axis-inner {
  position: relative;
  height: 100%;
}

.gantt-axis-tick {
  position: absolute;
  top: 0;
  font-size: 11px;
  white-space: nowrap;
  transform: translateX(-50%);
  border-left: 1px solid #ccc;
  padding: 2px 2px 0 2px;
  color: #555;
  background: #e9e9e9;   /* чтобы текст не “обрезался” линиями */
}

.gantt-rows {
  position: relative;
  background: #ffffff; /* отдельный фон для области с барами */
}

.gantt-row {
  display: flex;
  align-items: stretch;
  margin-bottom: 2px;
  font-size: 12px;
}

.gantt-row-label {
  position: sticky;   /* “прилипает” слева при горизонтальном скролле */
  left: 0;
  z-index: 2;
  flex: 0 0 220px;
  padding-right: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #f7f7f7;      /* отдельный фон для колонки имён */
  border-right: 1px solid #ddd;
}

.gantt-row-track {
  position: relative;
  flex: 1 1 auto;
  height: 20px;
  background: #ffffff;
  border-bottom: 1px solid #eee;
}

.gantt-controls {
  background: #f9f9f9;
  border-radius: 4px;
  padding: 4px 6px;
  margin-bottom: 6px;
}

/* ===== GANTT ===== */

.gantt-section {
    margin-top: 16px;
}

.gantt-header {
    margin-bottom: 8px;
}

.gantt-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.gantt-controls button {
    margin-right: 8px;
}

.gantt-filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 12px;
}

/* основной контейнер */
#ganttContainer {
    margin-top: 8px;
    max-height: 420px;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f3f3f3;
}

/* враппер, который шире, чем контейнер (для горизонтального скролла) */
.gantt-scroll-wrapper {
    position: relative;
    min-width: 600px;
}

/* строка с названиями колонок (Папка / Календарь) */
.gantt-column-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    background: #f0f0f0;
    border-bottom: 1px solid #d0d0d0;
    font-size: 12px;
}

.gantt-column-header-label {
    flex: 0 0 220px;
    padding: 4px 8px 4px 0;
    font-weight: 600;
}

.gantt-column-header-timeline {
    flex: 1 1 auto;
    padding: 4px 0 4px 8px;
    font-weight: 600;
    border-left: 1px solid #ddd;
}

/* ось времени */
.gantt-axis {
    position: sticky;
    top: 24px; /* ниже заголовка колонок */
    z-index: 3;
    margin-left: 220px; /* ширина колонки лейблов */
    background: #e9e9e9;
    border-bottom: 1px solid #d0d0d0;
    overflow: hidden;
}

.gantt-axis-inner {
    position: relative;
    height: 24px;
}

.gantt-axis-tick {
    position: absolute;
    top: 0;
    font-size: 11px;
    padding: 2px 2px 0 2px;
    white-space: nowrap;
    border-left: 1px solid #ccc;
}

/* строки */
.gantt-rows {
    position: relative;
    background: #ffffff;
}

.gantt-row {
    display: flex;
    align-items: center;
    height: 28px;
    border-bottom: 1px solid #eee;
}

/* левая колонка с названиями папок */
.gantt-row-label {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 220px;
    max-width: 220px;
    padding: 2px 8px 2px 0;
    font-size: 12px;
    background: #f7f7f7;
    border-right: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* дорожка для бара */
.gantt-row-track {
    position: relative;
    flex: 1 1 auto;
    height: 100%;
    background: #fff;
}

/* сам бар */
.gantt-bar {
    position: absolute;
    top: 4px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #999;
    box-sizing: border-box;
}

/* цвета по уровню (8 уровней) */
.gantt-level-1  { background-color: #e6f2ff; }
.gantt-level-2  { background-color: #d6f5e5; }
.gantt-level-3  { background-color: #fff0cc; }
.gantt-level-4  { background-color: #ffe0e0; }
.gantt-level-5  { background-color: #f0e0ff; }
.gantt-level-6  { background-color: #e0f7ff; }
.gantt-level-7  { background-color: #f5e6d6; }
.gantt-level-8  { background-color: #e6ffe0; }

/* дополнительные стили по типу, если захотим усиливать отличия */
.gantt-type-mixed {
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15);
}

.gantt-type-only_works {
    border-style: solid;
}

.gantt-type-only_folders {
    border-style: dashed;
}

/* легенда (если у тебя она уже есть — можно оставить как было) */
.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
}

.gantt-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legend-color-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #999;
}

/* пример: штриховка для смешанных */
.legend-mixed-box {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0,0,0,0.1) 0,
        rgba(0,0,0,0.1) 2px,
        transparent 2px,
        transparent 4px
    );
}

.gantt-date-wrapper {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
}

.gantt-date-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

/* сам инпут даты */
.gantt-date-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    padding: 4px 8px;
    border-radius: 999px;              /* «пилюлька» */
    border: 1px solid #ccc;
    background-color: #fff;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    min-width: 130px;

    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

/* ховер/фокус, как у остальных контролов */
.gantt-date-input:hover {
    border-color: #999;
    background-color: #fafafa;
}

.gantt-date-input:focus {
    outline: none;
    border-color: #4b8df8;
    box-shadow: 0 0 0 2px rgba(75, 141, 248, 0.2);
}

.gantt-date-input {
    position: relative;
    padding-right: 26px; /* место под иконку */
}

.gantt-date-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    position: relative;
    padding: 3px 20px 3px 8px;   /* компактнее и место под иконку */
    border-radius: 999px;        /* «пилюлька» */
    border: 1px solid #ccc;
    background-color: #fff;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    min-width: 110px;
    max-width: 140px;

    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.gantt-date-input:hover {
    border-color: #999;
    background-color: #fafafa;
}

.gantt-date-input:focus {
    outline: none;
    border-color: #4b8df8;
    box-shadow: 0 0 0 2px rgba(75, 141, 248, 0.2);
}

/* чуть сдвигаем системную иконку календаря левее */
.gantt-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    margin-right: -4px;  /* пододвигает иконку внутрь поля */
}

.gantt-bar-capped {
  border: 2px dashed #e74c3c;
  position: relative;
}

.gantt-bar-capped::after {
  content: "⚠";
  position: absolute;
  right: 2px;
  top: 2px;
  font-size: 15px;
  color: #e74c3c;
}

.gantt-divider {
    margin: 16px 0 10px 0;
    border: none;
    border-top: 1px solid #dddddd;
}

.projects-disabled {
  opacity: 0.6;
  pointer-events: none;
}
