html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: auto;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.tree-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
}

.item-row {
    padding: 8px 12px;
    margin: 6px 0;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 3px;
}

.empty-placeholder {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    border: 1px dashed #ddd;
    border-radius: 4px;
    margin: 10px 0;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.no-group-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

.group-header {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-left: 4px solid #2c90fc;
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.edit-button {
    position: relative;
}

.edit-dropdown {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    top: 100%;
    right: 0;
}

.edit-dropdown.active {
    display: block;
}

.edit-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    color: #333;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.edit-option:hover {
    background-color: #f5f5f5;
}

.edit-option.delete {
    color: #ff3b30;
}

.edit-btn {
    font-size: 12px;
    padding: 5px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 3px;
    cursor: pointer;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.custom-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    align-items: center;
    justify-content: center;
}

.custom-popup.active {
    display: flex;
}

.custom-popup-content {
    background: white;
    border-radius: 8px;
    padding: 25px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 80vh;
    overflow-y: auto;
}

.custom-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.custom-popup-title {
    font-size: 18px;
    font-weight: 500;
    color: #222;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.custom-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    font-family: Arial, sans-serif;
}

.custom-popup-body {
    margin-bottom: 20px;
}

.custom-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.custom-popup-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.custom-popup-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    margin-bottom: 15px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.auth-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    font-size: 16px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 12px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 12px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.tabs-border__items>.tabs-border__item {
    display: none;
}

.tabs-border__items>.tabs-border__item.b-active {
    display: block;
}

.error-data {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.page {
    min-height: 100vh;
    background: #f5f5f5;
}

.ui-kit {
    padding: 20px 0;
}

/* Уменьшаем отступы контейнера для увеличения полезного пространства */
.container {
    max-width: 1600px !important;
    /* Увеличиваем максимальную ширину */
    padding-left: 10px !important;
    /* Уменьшаем отступ слева */
    padding-right: 10px !important;
    /* Уменьшаем отступ справа */
    margin-left: auto;
    margin-right: auto;
}

/* Стили для выпадающих меню */
.filter-group p {
    margin-bottom: 5px;
    font-size: 12px;
    color: #222;
    font-weight: 600;
}

/* Контейнер для выпадающего меню */
.dropdown-container {
    position: relative;
    width: 100%;
}

/* Кнопка, которая отображает выбранное значение */
.dropdown-button {
    width: 100%;
    height: 32px;
    padding: 6px 30px 6px 10px;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-size: 12px;
    color: #222;
    background-color: white;
    border: 1px solid #bfbfbf;
    border-radius: 0;
    text-align: left;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dropdown-button:after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #222;
}

.dropdown-button:hover {
    border-color: #2c90fc;
}

.dropdown-button.active {
    border-color: #2c90fc;
    box-shadow: 0 0 0 1px #2c90fc;
}

/* Выпадающий список */
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #2c90fc;
    border-top: none;
    border-radius: 0 0 3px 3px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dropdown-list.active {
    display: block;
}

/* Элементы списка */
.dropdown-item {
    padding: 8px 10px;
    cursor: pointer;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    font-size: 12px;
    color: #222;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}

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

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

.dropdown-item.selected {
    background-color: #e8f2ff;
    color: #2c90fc;
    font-weight: 500;
}

/* Чекбоксы для множественного выбора */
.dropdown-checkbox {
    margin-right: 8px;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Плейсхолдер для выбранных значений */
.selected-text {
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.placeholder {
    color: #999;
    font-style: italic;
}

/* Стили для одиночного выбора (Проект) */
.dropdown-item.single {
    padding-left: 10px;
}

/* Стиль для "Очистить выбор" */
.dropdown-item.clear-option {
    color: #ff3b30;
    border-top: 1px solid #eee;
    margin-top: 5px;
    padding-top: 10px;
    background-color: #fff5f5;
}

.dropdown-item.clear-option:hover {
    background-color: #ffeaea;
}

/* Стиль для "Очистить все" в выпадающем списке организаций */
.dropdown-item.clear-all {
    color: #ff3b30;
    border-top: 1px solid #eee;
    margin-top: 5px;
    padding-top: 10px;
    background-color: #fff5f5;
}

.dropdown-item.clear-all:hover {
    background-color: #ffeaea;
}

/* Стили для отчета */
.report-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.report-actions {
    display: flex;
    gap: 10px;
}

.toggle-all-btn {
    font-size: 12px;
    padding: 6px 12px;
    background: #2c90fc;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}

.toggle-all-btn:hover {
    background: #1a7ae6;
}

/* Новая стилизация для горизонтальной таблицы отчета */
.report-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.report-table thead th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid #34495e;
    position: sticky;
    top: 0;
    z-index: 10;
}

.report-table thead th:first-child {
    text-align: left;
    padding-left: 15px;
    background: #34495e !important;
    position: sticky;
    left: 0;
    z-index: 20;
    min-width: 250px;
}

.report-table tbody td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
    border-right: 1px solid #ecf0f1;
    background: white;
}

.report-table tbody td:first-child {
    text-align: left;
    padding-left: 15px;
    background: white;
    position: sticky;
    left: 0;
    z-index: 5;
    font-weight: 500;
    min-width: 250px;
    border-right: 1px solid #bdc3c7;
}

.report-table tbody tr:hover td {
    background-color: #f8f9fa;
}

.report-table tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}

/* Стили для отступов и сворачивания */
.report-table .level-0 {
    font-weight: 600;
    background-color: #f8f9fa !important;
    cursor: pointer;
}

.report-table .level-0 td:first-child {
    position: relative;
    padding-left: 15px;
}

.report-table .level-0 .toggle-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    cursor: pointer;
    color: #2c90fc;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.report-table .level-1 td:first-child {
    padding-left: 30px;
    font-weight: 500;
    color: #2c3e50;
    background-color: #fdfdfd !important;
}

.report-table .level-2 td:first-child {
    padding-left: 45px;
    color: #7f8c8d;
    font-style: italic;
    background-color: #fefefe !important;
}

.report-table .level-3 td:first-child {
    padding-left: 60px;
    font-size: 11px;
    color: #95a5a6;
    background-color: #ffffff !important;
}

.report-table .collapsed {
    display: none;
}

/* Цветовые стили для значений */
.positive {
    color: #27ae60;
    font-weight: 500;
}

.negative {
    color: #e74c3c;
    font-weight: 500;
}

.highlight {
    background-color: #e8f4ff !important;
}

.total-row {
    background-color: #ecf0f1 !important;
    font-weight: 600;
}

.total-row td {
    border-top: 2px solid #bdc3c7 !important;
    border-bottom: 2px solid #bdc3c7 !important;
}

.total-row td:first-child {
    background-color: #ecf0f1 !important;
}

.profit-row {
    background-color: #e8f6f3 !important;
}

.expense-row {
    background-color: #fff8e1 !important;
}

.revenue-row {
    background-color: #e8f4ff !important;
}

/* Стили для организации и периода */
.period-header {
    background: #3498db !important;
    color: white;
}

.organization-header {
    background: #2980b9 !important;
    color: white;
}

/* Стили для скролла */
.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.no-data {
    padding: 40px;
    text-align: center;
    color: #95a5a6;
    font-style: italic;
}

/* Стили для метрик */
.metric-value {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.metric-label {
    color: #7f8c8d;
    font-size: 11px;
    margin-top: 2px;
}

/* Адаптивные стили */
@media (max-width: 768px) {

    .report-table thead th:first-child,
    .report-table tbody td:first-child {
        min-width: 200px;
    }

    .report-controls {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .report-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Стили для статуса отчета */
.report-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #7f8c8d;
}

.report-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #2c90fc;
}

.report-summary h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.summary-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.summary-stat {
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ecf0f1;
    min-width: 120px;
}

.summary-stat .label {
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 4px;
}

.summary-stat .value {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.summary-stat .value.positive {
    color: #27ae60;
}

.summary-stat .value.negative {
    color: #e74c3c;
}

/* НОВЫЕ СТИЛИ ДЛЯ ОТЧЕТА ОПИУ */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.report-controls {
    display: flex;
    gap: 10px;
}

.toggle-all-btn {
    font-size: 12px;
    padding: 6px 12px;
    background: #2c90fc;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
    transition: all 0.2s;
}

.toggle-all-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.toggle-all-btn.danger {
    background: #e74c3c;
}

/* Контейнер отчета */
.report-container-wrapper {
    width: 100%;
    height: 600px;
    overflow: auto;
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Таблица */
.financial-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    line-height: 1.4;
}

/* Фиксированный thead */
.financial-table thead {
    position: sticky;
    top: 0;
    z-index: 200;
    background: white;
}

/* Заголовки столбцов */
.financial-table thead th {
    background: #2c3e50 !important;
    color: white;
    padding: 12px 10px;
    font-weight: 500;
    text-align: center;
    border-right: 1px solid #34495e;
    white-space: nowrap;
    min-width: 140px;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Первый заголовок (Показатель) - фиксированный */
.financial-table thead th:first-child {
    position: sticky;
    left: 0;
    background: #34495e !important;
    z-index: 300;
    min-width: 300px;
    text-align: left;
    padding-left: 20px;
    border-right: 1px solid #2c3e50;
}

/* Колонка ИТОГО - такой же фон как у показатель */
.financial-table thead th.total-row {
    background: #34495e !important;
    border-right: 1px solid #2c3e50;
}

/* Ячейки данных */
.financial-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #ecf0f1;
    border-right: 1px solid #ecf0f1;
    white-space: nowrap;
    background: white;
    text-align: right;
    vertical-align: middle;
    transition: background-color 0.2s ease;
    color: #333333;
}

/* Первая ячейка каждой строки (название показателя) - фиксированная */
.financial-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 150;
    min-width: 300px;
    text-align: left;
    padding-left: 20px;
    background: white;
    border-right: 1px solid #bdc3c7;
    font-weight: 500;
    color: #222222;
}

/* Подсветка строки при наведении */
.financial-table tbody tr:hover td {
    background-color: #f8f9fa;
}

.financial-table tbody tr:hover td:first-child {
    background-color: #f8f9fa;
}

/* Именование метрик */
.metric-name {
    font-weight: 500;
    color: #222222;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Кнопка развернуть/свернуть */
.expand-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    color: #186999;
    position: relative;
}

.expand-btn:hover {
    border-color: #2c90fc;
    background-color: #2c90fc;
    color: white;
    transform: scale(1.1);
}

.expand-btn:active {
    transform: scale(0.95);
}

/* Иконка плюс/минус */
.expand-btn::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease;
}

.expand-btn::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 8px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease;
}

.expand-btn.expanded::after {
    transform: rotate(90deg);
}

/* Цвета значений */
.positive {
    color: #1e7d34;
    font-weight: 600;
}

.negative {
    color: #c0392b;
    font-weight: 600;
}

.neutral {
    color: #5d6d7e;
}

.zero-value {
    color: #95a5a6 !important;
}

/* Строки с детализацией */
.sub-row td {
    padding-left: 40px !important;
    font-size: 11px;
    color: #444444;
    background: #fdfdfd !important;
}

.sub-row td:first-child {
    padding-left: 60px !important;
    font-weight: 400;
    color: #555555;
}

.sub-sub-row td {
    padding-left: 60px !important;
    font-size: 10px;
    color: #666666;
    font-style: italic;
    background: #fefefe !important;
}

.sub-sub-row td:first-child {
    padding-left: 80px !important;
}

/* Основные группы (выручка, себестоимость, расходы) */
.main-group-row {
    background: #f8f9fa !important;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.main-group-row td:first-child {
    background: #f8f9fa !important;
    font-weight: 600;
    color: #222222;
}

/* Группы внутри расходов */
.expense-group-row {
    background: #f8f9fa !important;
}

.expense-group-row td:first-child {
    background: #f8f9fa !important;
    font-weight: 500;
}

/* Итоговые строки */
.total-row {
    background: #ecf0f1 !important;
    font-weight: 700;
}

.total-row td {
    border-top: 2px solid #bdc3c7;
    border-bottom: 2px solid #bdc3c7;
    font-weight: 700;
}

.total-row td:first-child {
    background: #ecf0f1 !important;
    color: #222222;
}

/* Финальная строка */
.final-row {
    background: #f8f9fa !important;
    font-weight: 700;
    border-top: 3px solid #2c3e50;
}

.final-row td {
    border-top: 3px solid #2c3e50;
    border-bottom: 2px solid #bdc3c7;
    font-weight: 700;
    color: #222222;
}

.final-row td:first-child {
    background: #f8f9fa !important;
    color: #222222;
}

/* Скрытые строки */
.hidden-row {
    display: none;
}

/* Цветовые акценты слева */
.revenue-row {
    border-left: 3px solid #27ae60;
}

.cost-row {
    border-left: 3px solid #e74c3c;
}

.expense-row {
    border-left: 3px solid #f39c12;
}

.profit-row {
    border-left: 3px solid #2c90fc;
}

/* Анимация */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.financial-table tbody tr {
    animation: fadeIn 0.2s ease;
}

/* Подсказки */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Пустые месяцы - скрываем если все нули */
.all-zero {
    color: #95a5a6 !important;
    font-style: italic;
}

/* Адаптивность */
@media (max-width: 768px) {
    .report-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .report-controls {
        width: 100%;
        justify-content: flex-end;
    }

    .financial-table thead th:first-child,
    .financial-table tbody td:first-child {
        min-width: 200px;
    }
}