/* =========================================================
   catalog.css — Стили для модуля «Каталог процессов»
   Адаптировано из navigation/style.css для встройки в
   основной проект Reag for work
   ========================================================= */


/* ==========================================================
   ПОЛНОЭКРАННЫЙ КОНТЕЙНЕР КАТАЛОГА
   Перекрывает весь экран при открытии
   ========================================================== */
#catalog-fullscreen {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: #151A20;
    color: #e0e0e0;
    z-index: 8000;
    flex-direction: column;
    font-family: Arial, sans-serif;
    overflow: hidden;
    box-sizing: border-box;
}
#catalog-fullscreen.catalog-open {
    display: flex;
}

/* --- Шапка каталога --- */
#catalog-appbar {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #1C2128;
    border-bottom: 1px solid #2D3238;
    flex-shrink: 0;
    gap: 12px;
}
#catalog-appbar .cat-logo {
    height: 24px;
    margin-right: 8px;
}
#catalog-title {
    font-family: Arial, sans-serif; font-weight: 600;
    font-size: 15px;
    color: #009CD0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#catalog-appbar .cat-btn {
    background: #2D3238;
    border: none;
    color: #e0e0e0;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 12px;
    font-family: Arial, sans-serif;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    white-space: nowrap;
}
#catalog-appbar .cat-btn:hover {
    color: #009CD0 !important;
    transform: scale(1.04);
}
#catalog-appbar .cat-btn.active {
    background: #009CD0;
    color: white !important;
}
#catalog-appbar .cat-btn.save-btn {
    background: #4caf50;
    color: white !important;
}
#catalog-appbar .cat-btn.save-btn:hover {
    background: #66bb6a;
    color: white !important;
}
#catalog-appbar .cat-btn-icon {
    background: transparent;
    border: none;
    color: #e0e0e0;
    padding: 0;
    height: 32px;
    min-width: 32px;
    cursor: pointer;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s;
    line-height: 1;
    flex-shrink: 0;
}
#catalog-appbar .cat-btn-icon .material-symbols-outlined {
    font-size: 19px;
    font-variation-settings: 'FILL' 0, 'wght' 350, 'GRAD' 0, 'opsz' 20;
    display: block;
}
#catalog-appbar .cat-btn-icon:hover {
    background: rgba(255,255,255,0.12);
}
/* Кнопка «Сохранить» как зелёная иконка */
#catalog-appbar .cat-btn-icon.save-btn { background: #4caf50; color: #fff; }
#catalog-appbar .cat-btn-icon.save-btn:hover { background: #43a047; }
#catalog-appbar .cat-btn-icon.save-btn:disabled { opacity: 0.6; cursor: default; }

/* Разделитель в шапке */
#catalog-appbar .cat-separator {
    width: 1px;
    height: 28px;
    background: #2D3238;
    margin: 0 4px;
}

/* Поиск процессов в шапке каталога */
#cat-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 6px;
}
#cat-search-wrap #cat-search-icon {
    position: absolute;
    left: 8px;
    font-size: 13px;
    line-height: 1;
    pointer-events: none;
}
#cat-search-input {
    width: 200px;
    padding: 6px 46px 6px 30px;
    background: rgba(255,255,255,0.06);
    border: 1px solid #3a424b;
    border-radius: 6px;
    color: #e6e9ed;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, width 0.15s;
}
#cat-search-input:focus {
    border-color: #009CD0;
    width: 240px;
}
#cat-search-input::placeholder { color: #7c8593; }
#cat-search-count {
    position: absolute;
    right: 26px;
    font-size: 11px;
    color: #009CD0;
    pointer-events: none;
}
#cat-search-clear {
    display: none;
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: #8a93a0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
}
#cat-search-clear:hover { color: #e6e9ed; }

/* Светлая тема: поле поиска читаемо на светлом appbar */
[data-theme="light"] #cat-search-input {
    background: #FFFFFF;
    border-color: #C4C4C4;
    color: #111;
}
[data-theme="light"] #cat-search-input::placeholder { color: #999; }
[data-theme="light"] #cat-search-clear { color: #777; }
[data-theme="light"] #cat-search-clear:hover { color: #111; }

/* Подсветка найденной строки (фон) + подсветка совпавших букв */
#catalog-data-table tr.cat-search-match > td {
    background: rgba(0, 156, 208, 0.18) !important;
}
.cat-search-hl {
    background: #ffd54f;
    color: #1a1a1a;
    border-radius: 2px;
    padding: 0 1px;
}

/* Кнопка вернуться назад в шапке */
#btn-catalog-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,156,208,0.1);
    border: 1px solid rgba(0,156,208,0.3);
    color: #009CD0 !important;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: Arial, sans-serif;
    transition: background 0.2s, transform 0.15s;
}
#btn-catalog-back:hover {
    background: rgba(0,156,208,0.2);
    transform: scale(1.02);
}

/* Информация о пользователе */
#catalog-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
#catalog-user-info img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
#catalog-user-info span {
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: #aaa;
    white-space: nowrap;
}

/* --- Тело каталога --- */
#catalog-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Контейнер таблицы --- */
#catalog-table-container {
    flex: 1;
    overflow: auto;
    scrollbar-width: none;
    border-left: 1px solid #2D3238;
    border-right: 1px solid #2D3238;
    padding-bottom: 60px;
}
#catalog-table-container::-webkit-scrollbar { display: none; }
#catalog-table-container::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
#catalog-table-container::-webkit-scrollbar-thumb:hover { background: #777; }

/* --- Нижняя панель управления --- */
#catalog-control-panel {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: #1C2128;
    padding: 6px 12px;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #2D3238;
    z-index: 20;
    flex-wrap: wrap;
    min-height: 48px;
}
#catalog-control-panel .cat-ctrl-btn {
    background: #2D3238;
    border: none;
    color: #e0e0e0;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 11px;
    font-family: Arial, sans-serif;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
#catalog-control-panel .cat-ctrl-btn:hover {
    color: #009CD0 !important;
    transform: scale(1.05);
}

/* Панель стилей --- */
#cat-style-toolbar {
    display: none;
    gap: 4px;
    background: #151A20;
    border: 1px solid #009CD0;
    padding: 5px;
    border-radius: 5px;
    align-items: center;
}
#cat-style-toolbar button {
    background: #2D3238;
    border: none;
    color: white;
    font-size: 14px;
    font-family: Arial, sans-serif; font-weight: bold;
    padding: 4px 8px;
    min-width: 28px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}
#cat-style-toolbar button:hover { color: #009CD0 !important; transform: scale(1.05); }
#cat-style-toolbar button.active { background: #009CD0; color: white !important; }
#cat-style-toolbar input[type="number"] { width: 40px; font-size: 12px; padding: 4px; background: #2D3238; border: 1px solid #555; color: white; border-radius: 4px; }
#cat-style-toolbar input[type="color"] { width: 28px; height: 28px; padding: 2px; border: 1px solid #555; background: #2D3238; cursor: pointer; }
.cat-palette-container { position: relative; display: flex; align-items: center; }
.cat-color-palette { display: flex; gap: 2px; background: #2D3238; padding: 3px; border-radius: 4px; margin-left: 3px; }
.cat-color-swatch { width: 18px; height: 18px; padding: 0; border: 1px solid #555; min-width: 0; cursor: pointer; border-radius: 2px; }
.cat-clear-swatch { font-size: 12px; line-height: 18px; background: #151A20; color: #e0e0e0; }

/* ==========================================================
   ТАБЛИЦА КАТАЛОГА
   ========================================================== */
#catalog-data-table {
    border-collapse: collapse;
    width: 100%;
    background: #161B21;
    table-layout: fixed;
    font-size: 0.75em;
    color: #DDDDDD;
    font-family: Arial, sans-serif;
}

#catalog-data-table th,
#catalog-data-table td {
    border: 1px solid #2D3238;
    padding: 1px 4px;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
    height: auto;
    line-height: 1.2;
}

#catalog-data-table th {
    position: sticky;
    top: 0;
    z-index: 11;
    cursor: pointer;
    padding: 5px 2px;
    user-select: none;
    border: none;
    background: #30363C;
    border-bottom: 1px solid #4a5058;
    border-left: 1px solid #2D3238;
    border-right: 1px solid #2D3238;
    font-family: Arial, sans-serif; font-weight: 600;
}
#catalog-data-table th.filtered { background: #009CD0; color: white; }
#catalog-data-table th.sorted-asc { background: #007A9F; color: white; }
#catalog-data-table th.sorted-desc { background: #007A9F; color: white; }
#catalog-data-table th.sorted-asc::after { content: '▼'; margin-left: 5px; font-size: 0.8em; }
#catalog-data-table th.sorted-desc::after { content: '▲'; margin-left: 5px; font-size: 0.8em; }

/* Строки */
#cat-tbody tr { transition: background-color 0.15s ease; }
#cat-tbody tr:hover { background-color: rgba(0, 156, 208, 0.1); }

/* Уровни иерархии */
#catalog-data-table tr[data-level="0"] {
    font-family: Arial, sans-serif; font-weight: 600;
    font-size: 1.05em;
}
#catalog-data-table td.level-0-name { font-family: Arial, sans-serif; font-weight: bold; }
#catalog-data-table td.level-0-name-cell-bg { background-color: rgba(111,115,118,0.15); }
#cat-tbody tr.level-0-row:hover { background-color: rgba(0, 156, 208, 0.15); }

/* Анимации строк */
@keyframes catFadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}
#cat-tbody tr.row-fade-in { animation: catFadeIn 0.4s ease forwards; }

/* Иконка раскрытия треугольника */
.cat-drill-icon {
    display: inline-block;
    cursor: pointer;
    margin-right: 5px;
    font-size: 0.7em;
    font-family: Arial, sans-serif; font-weight: bold;
    user-select: none;
    transition: transform 0.2s ease, color 0.2s;
}
.cat-drill-icon.expanded { transform: rotate(90deg); }
.cat-drill-icon:hover { color: #009CD0; }

/* Кнопки +/× в столбце №п/п */
#catalog-data-table td[data-col-id="0"] {
    position: relative;
    text-align: center;
    vertical-align: middle;
    padding: 1px 0;
}
.cat-row-number {
    font-weight: normal;
    font-size: 1em;
    margin: 0 20px;
    display: inline-block;
    min-width: 2.5em;
}
.cat-btn-add, .cat-btn-del {
    width: 16px; height: 16px;
    font-size: 12px; line-height: 16px;
    padding: 0; border-radius: 4px; margin: 0;
    display: none;
    align-items: center; justify-content: center;
    position: absolute; top: 50%;
    transform: translateY(-50%);
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
    font-family: Arial, sans-serif; font-weight: bold;
    background: #2D3238;
    border: none;
    color: #e0e0e0;
}
.catalog-editing td[data-col-id="0"] .cat-btn-add { display: flex; left: 4px; }
.catalog-editing td[data-col-id="0"] .cat-btn-del { display: flex; right: 4px; }
.cat-btn-add:hover { background: #009CD0 !important; color: white !important; }
.cat-btn-del:hover { background: #DB1717 !important; color: white !important; }

/* Кнопки ссылки */
.cat-icon-btn {
    background: transparent;
    color: #DDDDDD;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    width: 20px; height: 18px;
    min-width: 14px; min-height: 14px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.cat-icon-btn:hover { background: #2D3238; color: #009CD0 !important; }
.cat-link-go-btn {
    background: rgba(0,156,208,0.15);
    color: #009CD0 !important;
    border: 1px solid rgba(0,156,208,0.4);
    font-size: 13px;
    font-weight: bold;
}
.cat-link-go-btn:hover { background: rgba(0,156,208,0.35) !important; transform: scale(1.1); }
/* Зелёная — процесс подвязан через систему (быстро отличить от обычной ссылки) */
.cat-link-go-btn--system {
    background: rgba(76,175,80,0.15);
    color: #4caf50 !important;
    border: 1px solid rgba(76,175,80,0.4);
}
.cat-link-go-btn--system:hover { background: rgba(76,175,80,0.35) !important; color: #4caf50 !important; transform: scale(1.1); }
.cat-link-edit-btn { display: none; margin-left: 5px; }
.catalog-editing td[data-col-id="8"] .cat-link-edit-btn { display: inline-flex; }

/* Чекбоксы */
td[data-col-id^="custom_"] input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background-color: transparent;
    border: 2px solid #888;
    border-radius: 0;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s;
}
td[data-col-id^="custom_"] input[type="checkbox"]:checked { background-color: #009747; border-color: #009747; }
td[data-col-id^="custom_"] input[type="checkbox"]:checked::after {
    content: '✔'; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); color: white; font-size: 12px; line-height: 1;
}
td[data-col-id^="custom_"] input[type="checkbox"]:disabled { opacity: 0.7; cursor: not-allowed; }

/* Режим редактирования: никакого выделения/обводки у редактируемых ячеек.
   Класс catalog-editing висит на #cat-tbody, поэтому от него не зависим. */
#catalog-data-table td[contenteditable="true"],
#catalog-data-table td[contenteditable="true"]:focus,
#catalog-data-table td[contenteditable="true"]:focus-visible,
#catalog-data-table td[contenteditable="true"]:focus-within,
#catalog-data-table .cat-num-span,
#catalog-data-table .cat-num-span:focus,
#catalog-data-table .cat-num-span:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Режим редактирования: номер вводится в инлайн-span. Делаем его кликабельным
   и заметным по размеру, чтобы можно было поставить курсор даже в пустую ячейку. */
.catalog-editing td[data-col-id="3"] { cursor: text; }
.catalog-editing .cat-num-span {
    display: inline-block;
    min-width: 2.5em;
    min-height: 1.15em;
    cursor: text;
}
.cat-table-input {
    width: 100%; height: 100%;
    background: transparent; border: none; outline: none;
    color: inherit; font-family: inherit; font-size: inherit;
    text-align: center; padding: 0; margin: 0;
    box-sizing: border-box; cursor: text;
}
.cat-table-input:focus { background-color: transparent; outline: none; box-shadow: none; }

/* Тип столбца «Срок»: дата + бейдж остатка дней */
.cat-due-date { white-space: nowrap; }
.cat-due-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 0 6px;
    border-radius: 9px;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
}
.cat-due-ok      { background: rgba(76,175,80,0.18);  color: #58c25c; }
.cat-due-soon    { background: rgba(255,152,0,0.20);  color: #ffa726; }
.cat-due-overdue { background: rgba(219,23,23,0.20);  color: #ff5252; }
/* В режиме редактирования: компактное поле даты + бейдж рядом */
.cat-date-input { width: auto; max-width: 130px; cursor: pointer; color-scheme: dark; }
.cat-date-badge-wrap { margin-left: 4px; vertical-align: middle; }
.catalog-editing td[data-col-id^="custom_"] .cat-date-input { color: inherit; }
.cat-status-select {
    width: 100%; background: #151A20; color: #e0e0e0;
    border: 1px solid #009CD0; padding: 2px;
    font-family: Arial, sans-serif; font-size: 1em;
}
.cat-resize-handle {
    position: absolute; top: 0; right: 0; bottom: 0; width: 3px;
    cursor: col-resize; z-index: 12; display: none;
}
.col-hidden { display: none !important; }
.cat-ghost { opacity: 0.5; background: #2D3238; }

/* Подсветка строки */
tr.cat-row-highlight { background-color: rgba(0,156,208,0.2) !important; }
tr.cat-row-highlight td:first-child { box-shadow: inset 3px 0 0 #009CD0; }

/* ==========================================================
   ФИЛЬТР-ВЫПАДАШКА
   ========================================================== */
#cat-filter-dropdown {
    position: fixed;
    background: #2D3238;
    border: 1px solid #009CD0;
    z-index: 9100;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    min-width: max-content;
    width: auto;
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
}
.cat-filter-options { max-height: 35vh; overflow-y: auto; padding: 6px; }
.cat-filter-footer { padding: 6px; border-top: 1px solid #009CD0; }
.cat-filter-item {
    padding: 4px 6px; cursor: pointer; font-size: 12px;
    transition: background 0.15s; white-space: nowrap;
    display: block; user-select: none;
}
.cat-filter-item:hover { background: rgba(0,156,208,0.25); }
.cat-filter-item input[type="checkbox"] { margin-right: 8px; vertical-align: middle; }
.cat-filter-item.cat-filter-select-all { font-style: italic; border-bottom: 1px solid #555; margin-bottom: 5px; }
.cat-sort-buttons { display: flex; gap: 5px; margin-bottom: 5px; }
.cat-sort-btn { flex: 1; padding: 3px 6px; font-size: 11px; background: #2D3238; border: none; color: #e0e0e0; cursor: pointer; border-radius: 3px; }
.cat-sort-btn.active { background: #009CD0; color: white !important; }
.cat-filter-apply-btn { width: 100%; background: #009CD0; color: white !important; border: none; padding: 4px; cursor: pointer; margin-bottom: 5px; border-radius: 3px; font-size: 11px; }
.cat-filter-apply-btn:hover { background: #00B0F0; }
.cat-filter-clear-one { color: #DB1717; background: transparent; border: none; cursor: pointer; font-size: 11px; padding: 2px; }
.cat-filter-clear-all { color: #e0e0e0; background: transparent; border: none; border-top: 1px solid #555; cursor: pointer; font-size: 11px; padding: 4px; display: block; width: 100%; text-align: left; margin-top: 3px; }

/* ==========================================================
   МОДАЛЬНЫЕ ОКНА КАТАЛОГА
   ========================================================== */
.cat-modal {
    display: none;
    position: fixed;
    z-index: 9500;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: #2D3238;
    border: 1px solid #009CD0;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    border-radius: 8px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    min-width: 300px;
}
.cat-modal.show { display: block; }
.cat-modal h4 { margin-top: 0; font-family: Arial, sans-serif; font-weight: 600; color: #009CD0; }
.cat-modal input[type="text"] {
    background: #1C2128; border: 1px solid #555; color: white;
    padding: 6px 10px; font-size: 13px; border-radius: 4px;
    width: 100%; box-sizing: border-box; margin-bottom: 10px;
    font-family: Arial, sans-serif;
}
.cat-modal input[type="text"]:focus { border-color: #009CD0; outline: none; }
.cat-modal button { background: #2D3238; border: none; color: white; padding: 6px 14px; cursor: pointer; font-size: 12px; font-family: Arial, sans-serif; border-radius: 4px; margin-top: 6px; transition: background 0.2s; }
.cat-modal button:hover { color: #009CD0 !important; }
.cat-modal select { background: #1C2128; border: 1px solid #555; color: white; padding: 4px 8px; font-size: 12px; border-radius: 4px; font-family: Arial, sans-serif; }
.cat-modal .input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.cat-modal .input-row label { font-size: 12px; color: #aaa; white-space: nowrap; }

/* Настройки столбцов */
#cat-column-settings-list {
    display: flex; flex-direction: column; gap: 6px;
    max-height: 50vh; overflow-y: auto;
}
#cat-column-settings-list label { display: block; font-size: 13px; white-space: nowrap; color: #e0e0e0; flex: 1; }
.cat-column-setting-item { display: flex; align-items: center; gap: 5px; padding: 5px; border-radius: 4px; background: #1C2128; }
.cat-column-item-controls { margin-left: auto; display: flex; gap: 5px; }
.cat-drag-handle { cursor: grab; user-select: none; margin-right: 8px; color: #888; }
.cat-drag-handle:active { cursor: grabbing; }
.cat-column-setting-item.cat-ghost { background: #009CD0; opacity: 0.4; }
#cat-new-column-section { display: flex; gap: 6px; margin-bottom: 12px; align-items: center; }

/* Опции select-столбца */
#cat-select-options-container { max-height: 200px; overflow-y: auto; border: 1px solid #555; padding: 5px; background: #1C2128; min-width: 280px; border-radius: 4px; }
.cat-select-option-item { display: flex; justify-content: space-between; align-items: center; padding: 4px; border-bottom: 1px solid #2D3238; }
.cat-select-option-item:last-child { border-bottom: none; }
.cat-select-option-item button { background: #DB1717; color: white; padding: 2px 6px; font-size: 11px; }

/* Контекстное меню ПКМ */
#cat-context-menu {
    position: fixed;
    background: #2D3238;
    border: 1px solid #009CD0;
    border-radius: 6px;
    z-index: 9800;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    min-width: 220px;
    overflow: hidden;
}
.cat-ctx-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cat-ctx-item:last-child { border-bottom: none; }
.cat-ctx-item:hover { background: rgba(0,156,208,0.2); color: #009CD0; }
.cat-ctx-header { padding: 8px 16px; font-size: 11px; color: #888; font-family: Arial, sans-serif; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid #009CD0; }
.cat-ctx-process-item { padding: 6px 16px; cursor: pointer; font-size: 12px; transition: background 0.15s; }
.cat-ctx-process-item:hover { background: rgba(0,156,208,0.15); color: #009CD0; }
.cat-ctx-empty { padding: 8px 16px; font-size: 12px; color: #666; font-style: italic; }

/* Редактирование ссылки */
#cat-link-edit-modal input { width: 400px; max-width: 80vw; font-size: 11px; }

/* ==========================================================
   СВЕТЛАЯ ТЕМА — КАТАЛОГ
   ========================================================== */
[data-theme="light"] #catalog-fullscreen {
    background: #FAFAFA;
    color: #111;
}
[data-theme="light"] #catalog-appbar {
    background: #F0F0F0;
    border-color: #CCC;
}
[data-theme="light"] #catalog-appbar .cat-btn {
    background: #E0E0E0;
    color: #111;
}
[data-theme="light"] #catalog-appbar .cat-btn:hover { color: #007A9F !important; }
[data-theme="light"] #catalog-control-panel {
    background: #F0F0F0;
    border-color: #CCC;
}
[data-theme="light"] #catalog-control-panel .cat-ctrl-btn {
    background: #E0E0E0;
    color: #111;
}
[data-theme="light"] #catalog-data-table { background: #FFFFFF; color: #111; }
[data-theme="light"] #catalog-data-table th,
[data-theme="light"] #catalog-data-table td { border-color: #CCC; }
[data-theme="light"] #catalog-data-table th {
    background: #EAEAEA; border-bottom-color: #009CD0;
    border-left-color: #CCC; border-right-color: #CCC;
}
[data-theme="light"] #catalog-data-table th.filtered { background: #009CD0; color: white; }
[data-theme="light"] #catalog-data-table th.sorted-asc,
[data-theme="light"] #catalog-data-table th.sorted-desc { background: #C9EAF6; color: #111; }
[data-theme="light"] #cat-tbody tr:hover { background-color: rgba(0,156,208,0.08); }
[data-theme="light"] #catalog-table-container { background: #FAFAFA; }
[data-theme="light"] .cat-modal { background: #F0F0F0; }
[data-theme="light"] .cat-modal input[type="text"] { background: #FFF; color: #111; border-color: #AAA; }
[data-theme="light"] .cat-modal button { background: #E0E0E0; color: #111; }
[data-theme="light"] #cat-filter-dropdown { background: #F0F0F0; }
[data-theme="light"] .cat-filter-item:hover { background: rgba(0,156,208,0.15); }
[data-theme="light"] #cat-context-menu { background: #F0F0F0; }
[data-theme="light"] .cat-column-setting-item { background: #FFF; border: 1px solid #EEE; }
[data-theme="light"] #cat-select-options-container { background: #FFF; }
[data-theme="light"] .cat-status-select { background: #FFF; color: #111; border-color: #AAA; }
[data-theme="light"] .cat-table-input { color: #111; }
[data-theme="light"] #catalog-data-table td.level-0-name-cell-bg { background-color: rgba(193,227,250,0.35); }

/* --- Кнопка «Сохранить» — принудительно тёмный текст в светлой теме --- */
[data-theme="light"] #catalog-appbar .cat-btn.save-btn {
    background: #4caf50;
    color: #fff !important;
}
[data-theme="light"] #catalog-appbar .cat-btn.save-btn:hover {
    background: #388e3c;
    color: #fff !important;
}

/* --- Кнопка смены темы и пользователь в светлой теме --- */
[data-theme="light"] #catalog-appbar .cat-btn-icon {
    color: #333;
}
[data-theme="light"] #catalog-appbar .cat-btn-icon:hover {
    background: rgba(0,0,0,0.08);
}
[data-theme="light"] #catalog-user-info span {
    color: #333;
}

/* --- Тулбар форматирования ячеек в светлой теме --- */
[data-theme="light"] #cat-style-toolbar {
    background: #F5F5F5;
    border-color: #009CD0;
}
[data-theme="light"] #cat-style-toolbar button {
    background: #E0E0E0;
    color: #111;
}
[data-theme="light"] #cat-style-toolbar button.active {
    background: #009CD0;
    color: #fff !important;
}
[data-theme="light"] #cat-style-toolbar button:hover { color: #009CD0 !important; }
[data-theme="light"] #cat-style-toolbar input[type="number"] {
    background: #FFF;
    border-color: #AAA;
    color: #111;
}
[data-theme="light"] #cat-style-toolbar input[type="color"] {
    background: #FFF;
    border-color: #AAA;
}
[data-theme="light"] .cat-color-palette { background: #E0E0E0; }
[data-theme="light"] .cat-color-swatch { border-color: #AAA; }
[data-theme="light"] .cat-clear-swatch { background: #FFF; color: #333; }

/* --- Кнопки добавления/удаления строк (столбец №п/п) --- */
[data-theme="light"] .cat-btn-add,
[data-theme="light"] .cat-btn-del {
    background: #E0E0E0;
    color: #333;
}
[data-theme="light"] .cat-btn-add:hover { background: #009CD0 !important; color: #fff !important; }
[data-theme="light"] .cat-btn-del:hover { background: #DB1717 !important; color: #fff !important; }

/* --- Модальные окна каталога — текст в светлой теме --- */
[data-theme="light"] .cat-modal { color: #111; }
[data-theme="light"] .cat-modal h4 { color: #007A9F; }
[data-theme="light"] .cat-modal select { background: #FFF; border-color: #AAA; color: #111; }
[data-theme="light"] .cat-modal .input-row label { color: #333; }
[data-theme="light"] #cat-column-settings-list label { color: #111; }
[data-theme="light"] .cat-drag-handle { color: #555; }
[data-theme="light"] .cat-column-item-controls button { background: #E0E0E0; color: #111; }
[data-theme="light"] #cat-new-column-section input,
[data-theme="light"] #cat-new-column-section select {
    background: #FFF; border-color: #AAA; color: #111;
}

/* --- Фильтр-дропдаун в светлой теме --- */
[data-theme="light"] .cat-filter-item { color: #111; }
[data-theme="light"] .cat-sort-btn { background: #E0E0E0; color: #111; }
[data-theme="light"] .cat-sort-btn.active { background: #009CD0; color: #fff !important; }
[data-theme="light"] .cat-filter-clear-one { color: #c0392b; }
[data-theme="light"] .cat-filter-clear-all { color: #333; border-top-color: #CCC; }

/* --- Контекстное меню в светлой теме --- */
[data-theme="light"] .cat-ctx-item { color: #111; border-bottom-color: rgba(0,0,0,0.07); }
[data-theme="light"] .cat-ctx-header { color: #555; border-bottom-color: #009CD0; }
[data-theme="light"] .cat-ctx-process-item { color: #111; }
[data-theme="light"] .cat-ctx-empty { color: #888; }

/* --- Индикатор загрузки в светлой теме --- */
[data-theme="light"] #catalog-loading {
    background: rgba(250,250,250,0.85);
}
[data-theme="light"] #catalog-loading span { color: #007A9F; }

/* --- Скроллбар таблицы в светлой теме --- */
[data-theme="light"] #catalog-table-container {
    scrollbar-color: #aaa #f0f0f0;
}
[data-theme="light"] #catalog-table-container::-webkit-scrollbar-track { background: #f0f0f0; }
[data-theme="light"] #catalog-table-container::-webkit-scrollbar-thumb { background: #aaa; }
[data-theme="light"] #catalog-table-container::-webkit-scrollbar-thumb:hover { background: #888; }

/* ============================================================
   ВКЛАДКИ ВИДОВ (как листы Excel)
   ============================================================ */
#catalog-view-tabs {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    height: 42px;
    box-sizing: border-box;
    background: #161B21;
    border-top: 1px solid #2D3238;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    z-index: 30;
}
.cat-view-tab {
    padding: 6px 18px;
    background: #232931;
    color: #c2c8cf;
    font-family: Arial, sans-serif;
    font-size: 12.5px;
    border: 1px solid #333a42;
    border-radius: 7px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.cat-view-tab:hover {
    color: #fff;
    background: #2c333c;
    transform: translateY(-1px);
}
.cat-view-tab.active {
    background: #009CD0;
    color: #fff;
    border-color: #009CD0;
    font-family: Arial, sans-serif; font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,156,208,0.35);
}
.cat-view-tab.is-default { font-style: italic; }
.cat-view-tab.active.is-default { font-style: italic; }
.cat-view-add {
    width: 30px; height: 28px;
    background: #232931;
    color: #009CD0;
    border: 1px solid #333a42;
    border-radius: 7px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.cat-view-add:hover { background: #009CD0; color: white; transform: translateY(-1px); }

/* Контекстное меню вкладки вида */
.cat-view-context-menu {
    position: fixed;
    z-index: 9600;
    background: #2D3238;
    border: 1px solid #009CD0;
    border-radius: 6px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
    padding: 4px;
    min-width: 210px;
    font-family: Arial, sans-serif;
    font-size: 13px;
}
.cat-vctx-item {
    padding: 7px 12px;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
}
.cat-vctx-item:hover { background: rgba(0,156,208,0.18); color: #009CD0; }
.cat-vctx-item.cat-vctx-danger:hover { background: rgba(219,23,23,0.2); color: #ff6b6b; }

/* Замок фиксации ширины столбца (в «Настройках столбцов») */
.cat-lock-row {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2D3238;
}
.cat-lock-hint { font-size: 11px; color: #888; line-height: 1.35; }
.cat-lock-col-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #888 !important;
    padding: 2px 5px !important;
    border-radius: 5px !important;
    cursor: pointer;
    font-size: 14px !important;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.cat-lock-col-btn:hover { transform: scale(1.12); }
.cat-lock-col-btn.active {
    background: rgba(0,156,208,0.18) !important;
    border-color: #009CD0 !important;
}
/* Граница заморозки — синяя грань только в ШАПКЕ (видно, по какому столбцу закреплено) */
#catalog-data-table th.cat-col-freeze-boundary {
    border-right: 3px solid #009CD0 !important;
}

/* Заморозка закреплённых столбцов: не уезжают при горизонтальной прокрутке.
   Нативные вертикальные грани (border-collapse) убираем — иначе при прокрутке
   они «уезжают» с соседней ячейкой и/или двоятся. Рисуем ровно одну правую
   грань тенью (она часть закреплённой ячейки и не пропадает). */
#catalog-data-table td.cat-col-sticky {
    position: sticky;
    z-index: 6;
    background: #161B21;                 /* непрозрачный фон, как у таблицы */
    border-left: 0;
    border-right: 0;
    /* правая грань + прозрачный тинт-слой (для плавной анимации hover) */
    box-shadow: inset -1px 0 0 0 #2D3238, inset 0 0 0 1000px rgba(0,156,208,0);
    transition: box-shadow 0.15s ease;    /* плавный hover, как у строки */
}
#catalog-data-table th.cat-col-sticky {
    /* шапка уже sticky сверху — добавляем закрепление слева; её грани собственные */
    position: sticky;
    z-index: 13;
    background: #30363C;
}
/* Hover: тот же rgba поверх того же фона, что и у обычных ячеек → идентичный цвет.
   box-shadow анимируется так же (0.15s ease), поэтому нет рассинхрона. */
#cat-tbody tr:hover td.cat-col-sticky {
    box-shadow: inset -1px 0 0 0 #2D3238, inset 0 0 0 1000px rgba(0,156,208,0.10);
}
#cat-tbody tr.level-0-row:hover td.cat-col-sticky {
    box-shadow: inset -1px 0 0 0 #2D3238, inset 0 0 0 1000px rgba(0,156,208,0.15);
}
[data-theme="light"] #catalog-data-table td.cat-col-sticky {
    background: #FFFFFF;
    box-shadow: inset -1px 0 0 0 #CCC, inset 0 0 0 1000px rgba(0,156,208,0);
}
[data-theme="light"] #catalog-data-table th.cat-col-sticky { background: #ECECEC; }
[data-theme="light"] #cat-tbody tr:hover td.cat-col-sticky {
    box-shadow: inset -1px 0 0 0 #CCC, inset 0 0 0 1000px rgba(0,156,208,0.10);
}

/* Список столбцов в модале создания вида */
.cat-newview-columns {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #2D3238;
    border-radius: 6px;
    padding: 6px;
    background: #1C2128;
}
.cat-newview-col {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    font-size: 13px;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
}
.cat-newview-col:hover { background: rgba(0,156,208,0.12); }

/* Светлая тема для вкладок видов */
[data-theme="light"] #catalog-view-tabs { background: #ECECEC; border-top-color: #CCC; }
[data-theme="light"] .cat-view-tab { background: #DDD; color: #333; border-color: #CCC; }
[data-theme="light"] .cat-view-tab.active { background: #FFF; color: #007A9F; border-color: #009CD0; }
[data-theme="light"] .cat-view-add { background: #DDD; }
[data-theme="light"] .cat-view-context-menu { background: #F0F0F0; }
[data-theme="light"] .cat-vctx-item { color: #222; }
[data-theme="light"] .cat-newview-columns { background: #FFF; border-color: #DDD; }
[data-theme="light"] .cat-newview-col { color: #222; }
