
        :root {
            --primary: #3498db;
            --success: #2ecc71;
            --warning: #f39c12;
            --danger: #e74c3c;
            --dark: #2c3e50;
            --light: #ecf0f1;
        }
        body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
         }
        /*body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
            color: #333;
        }*/
        
        .filter-section {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 15px;
            margin-bottom: 25px;
            padding: 20px;
            background-color: #f8f9fa;
            border-radius: 8px;
            border: 1px solid #ddd;
        }
        .filter-group {
            display: flex;
            flex-direction: column;
			font-size: 16px;
            font-weight: 600;
        }
        .search-group {
            grid-column: span 2;
        }
        label {
            margin-bottom: 5px;
            font-weight: 600;
            font-size: 16px;
        }
        select, input {
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            width: 100%;
            box-sizing: border-box;
        }
        select:focus, input:focus {
            outline: none;
            border-color: var(--primary);
        }
        .clear-btn {
            align-self: flex-end;
            padding: 10px 15px;
            background-color: #f8f9fa;
            border: 1px solid #ddd;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
        }
        .clear-btn:hover {
            background-color: #e9ecef;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            border: 1px solid #ddd;
            z-index: 1;
        }
        .table-container {
         position: relative;
         z-index: 1;
}
        th, td {
            padding: 12px;
            text-align: center;
			font-size: 18px;
			font-weight: 600;
            border-bottom: 1px solid #ddd;
            border-right: 1px solid #eee;
            z-index: 1
            
            
        }
        th {
            background-color: #3c616a;
            color: white;
            position: sticky;
            top: 0;
            font-weight: 600;
            z-index: 1;
            
        }
        th:last-child, td:last-child {
            border-right: none;
            z-index: 1;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
            position: relative;
            z-index: 1;
            
        }
        tr:hover {
            background-color: rgba(52, 152, 219, 0.05);
            z-index: 1;
        }
        
        .status {
            display: inline-flex;
            align-items: center;
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }
        .status.active {
            background-color: rgba(46, 204, 113, 0.2);
            color: var(--success);
        }
        .status.trial {
            background-color: rgba(241, 196, 15, 0.2);
            color: var(--warning);
        }
        .status.blocked {
            background-color: rgba(231, 76, 60, 0.2);
            color: var(--danger);
        }
        .vertical-actions {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }
        .action-btn {
            padding: 8px 12px;
            font-size: 12px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            gap: 5px;
            justify-content: center;
            width: 100%;
            border: none;
            cursor: pointer;
            transition: all 0.3s;
        }
        .action-btn:hover {
            opacity: 0.9;
            transform: translateY(-1px);
        }
        .btn-danger {
            background-color: var(--danger);
            color: white;
        }
        .btn-warning {
            background-color: var(--warning);
            color: white;
        }
        .pagination {
            display: flex;
            justify-content: space-between;
            margin-top: 30px;
            align-items: center;
        }
        .pagination-info {
            font-size: 14px;
            color: #777;
        }
        .pagination-controls {
            display: flex;
            gap: 5px;
        }
        .pagination-btn {
            padding: 8px 12px;
            min-width: 40px;
            background-color: white;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
        }
        .pagination-btn.active {
            background-color: rgb(10 75 118);
            color: white;
            border-color: rgb(10 75 118);
        }
        .pagination-btn:hover:not(.active) {
            background-color: #f8f9fa;
        }
        .badge {
            display: inline-block;
            padding: 3px 6px;
            border-radius: 4px;
            font-size: 12px;
            background-color: #eee;
            color: #555;
            margin-right: 5px;
            z-index: 1;
        }
        .search-container {
            position: relative;
        }
        .search-results {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 1px solid #ddd;
            border-radius: 0 0 6px 6px;
            max-height: 200px;
            overflow-y: auto;
            z-index: 100;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        .search-result-item {
            padding: 8px 15px;
            cursor: pointer;
            border-bottom: 1px solid #eee;
        }
        .search-result-item:hover {
            background-color: #f5f5f5;
        }
        .search-result-item:last-child {
            border-bottom: none;
        }
        
       
        

/* Адаптивность для таблицы */
@media (max-width: 768px) {
    table {
        font-size: 12px;
    }
    
    .dropdown-content {
        min-width: 200px;
        right: 0;
    }
}
/* Стили для кликабельных строк */
.clickable-row {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.clickable-row:hover {
    background-color: rgba(52, 152, 219, 0.08) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 1;
}

.clickable-row:active {
    background-color: rgba(52, 152, 219, 0.15) !important;
    transform: translateY(0);
    z-index: 1;
}

/* Индикатор кликабельности */
.clickable-row td:first-child::before {
    content: '→';
    position: absolute;
    left: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--primary);
}

.clickable-row:hover td:first-child::before {
    opacity: 0.5;
}

/* Запрещаем выделение текста при кликах */
.clickable-row {
    user-select: none;
    -webkit-user-select: none;
}

/* Улучшаем внешний вид кнопок действий */
.vertical-actions {
    cursor: default;
    pointer-events: all;
}

.action-btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

        .company-info {
            flex-grow: 1;
        }
        .company-info h2 {
            margin: 0 0 5px 0;
            color: var(--dark);
        }
        .company-info p {
            margin: 0;
            color: #777;
        }
        .stats-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin-bottom: 25px;
        }
        .stat-card {
            background-color: white;
            border-radius: 8px;
            padding: 15px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            border-left: 4px solid var(--primary);
        }
        .stat-card h3 {
            margin: 0 0 10px 0;
            font-size: 14px;
            color: #777;
        }
        .stat-card .value {
            font-size: 24px;
            font-weight: bold;
            color: var(--dark);
        }
        /* Стили для выпадающего списка заведений */
.establishments-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.establishments-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.establishments-dropdown-content {
    display: none;
    position: absolute;
    z-index: 9999; /* ОЧЕНЬ ВЫСОКИЙ z-index чтобы было поверх всего */
    min-width: 380px;
    max-height: 500px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 15px;
    top: 100%;
    left: 0;
    margin-top: 5px;
}

.establishments-dropdown:hover .establishments-dropdown-content {
    display: block;
}


/* Стили для элементов внутри выпадающего окна */
.establishment-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #eee;
    background-color: #fafafa;
}
.establishment-item:last-child {
    margin-bottom: 0;
}

.establishment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.establishment-header strong {
    font-size: 15px;
    color: #2c3e50;
}

.establishment-location {
    font-size: 13px;
    color: #677;
    margin-bottom: 5px;
    line-height: 1.4;
}

.establishment-phone {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.establishment-region {
    font-size: 12px;
    color: #95a5a6;
    font-style: italic;
}

.trial-date {
    font-size: 12px;
    color: #e67e22;
    font-weight: bold;
    margin-top: 5px;
    padding: 3px 8px;
    background-color: rgba(230, 126, 34, 0.1);
    border-radius: 4px;
    display: inline-block;
}

/* Стили для статусов в выпадающем окне */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background-color: rgba(46, 204, 113, 0.15);
    color: #27ae60;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-trial {
    background-color: rgba(241, 196, 15, 0.15);
    color: #f39c12;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.status-inactive {
    background-color: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}





/* ===== КРИТИЧЕСКИ ВАЖНЫЕ ИСПРАВЛЕНИЯ ===== */
.establishments-dropdown {
    position: relative;
    display: inline-block;
    
}

.establishments-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
    cursor: pointer;
}

.establishments-dropdown-content {
    display: none;
    position: fixed; /* Меняем на fixed! */
    z-index: 1000;
    min-width: 380px;
    max-height: 60vh;
    overflow-y: auto;
    background: white;
    border: 2px solid #3c616a;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    padding: 15px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

..establishments-dropdown-trigger:focus + .establishments-dropdown-content,
.establishments-dropdown-trigger:active + .establishments-dropdown-content {
    display: block;
}

/* Делаем триггер доступным для фокуса */
.establishments-dropdown-trigger {
    cursor: pointer;
}

/* РЕШЕНИЕ КОНФЛИКТОВ Z-INDEX */
table {
    position: relative;
    z-index: 1;
}

tr {
    position: relative;
    z-index: 1;
}

td {
    position: relative;
    z-index: 1;
    overflow: visible !important;
}

.establishments-dropdown {
    position: relative;
    z-index: 1000; /* Выше чем ячейки */
}

.establishments-dropdown-content {
    position: absolute;
    z-index: 1000;
    min-width: 380px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border: 2px solid #3c616a;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    padding: 15px;
    top: 100%;
    left: -250px; /* Сдвиг влево */
    margin-top: 5px;
}

.establishments-dropdown:hover .establishments-dropdown-content {
    display: block;
}

/* Убираем все hover эффекты для строк где есть dropdown */
tr .establishments-dropdown:hover ~ * {
    z-index: 1;
}
#custom-period-fields {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

.apply-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.apply-btn:hover {
    background: #45a049;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.stat-card .value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

/* Стили для модального окна и затемнения фона */
			.modal {
				display: none; /* По умолчанию скрыто */
				position: fixed;
				z-index: 1000;
				left: 0;
				top: 0;
				width: 100%;
				height: 100%;
				background-color: rgba(0, 0, 0, 0.5); /* Затемнение фона */
				overflow: auto;
			}

			.modal-content {
				background-color: #fefefe;
				margin: 10% auto; /* Центрирование по вертикали */
				padding: 20px;
				border: 1px solid #888;
				width: 60%; /* Ширина модального окна */
				max-width: 600px; /* Максимальная ширина */
				border-radius: 10px;
				position: relative;
			}

			.close {
				color: #aaa;
				float: right;
				font-size: 28px;
				font-weight: bold;
				cursor: pointer;
			}

			.close:hover {
				color: #000;
			}

			.tabs {
				display: flex;
				justify-content: space-around;
				margin-bottom: 20px;
			}

			.tablink {
				background-color: #f1f1f1;
				border: none;
				padding: 10px 20px;
				cursor: pointer;
				flex: 1;
				text-align: center;
			}

			.tablink.active {
				background-color: #007bff;
				color: white;
			}

			.tabcontent {
				display: none;
			}

			.tabcontent.active {
				display: block;
			}

			/* Блокировка прокрутки страницы при открытом модальном окне */
			body.modal-open {
				overflow: hidden;
			}
			/* В конец существующего CSS */
/* Дополнительные стили для выпадающих списков */
    .badge {
        display: inline-block;
        padding: 4px 10px;
        background: #e2e8f0;
        color: #795991;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 600;
        line-height: 1;
        border: 1px solid #e2e8f0;
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .badge:hover {
        background: #e2e8f0;
        transform: translateY(-1px);
    }
    
    .establishments-dropdown {
        position: relative;
        display: inline-block;
    }
    
    .establishments-dropdown-trigger {
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
    }
    
    .establishments-dropdown-content {
        display: none;
        position: absolute;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 15px;
        z-index: 1000;
        width: 320px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        max-height: 400px;
        overflow-y: auto;
        top: 100%;
        left: 0;
        margin-top: 8px;
    }
    
    .establishments-dropdown-content::before {
        content: '';
        position: absolute;
        top: -6px;
        left: 20px;
        width: 12px;
        height: 12px;
        background: white;
        border-left: 1px solid #e2e8f0;
        border-top: 1px solid #e2e8f0;
        transform: rotate(45deg);
    }
    
    .establishment-item {
        padding: 12px;
        border-bottom: 1px solid #f1f5f9;
        transition: background 0.2s ease;
    }
    
    .establishment-item:hover {
        background: #f8fafc;
        border-radius: 6px;
    }
    
    .establishment-item:last-child {
        border-bottom: none;
    }
    
    .establishment-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 6px;
    }
    
    .establishment-header strong {
        font-size: 14px;
        color: #1e293b;
        flex: 1;
    }
    
    .status-badge {
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-left: 8px;
        white-space: nowrap;
    }
    
    .status-active {
        background: #dcfce7;
        color: #166534;
        border: 1px solid #bbf7d0;
    }
    
    .status-trial {
        background: #fef9c3;
        color: #854d0e;
        border: 1px solid #fef08a;
    }
    
    .status-inactive {
        background: #fee2e2;
        color: #991b1b;
        border: 1px solid #fecaca;
    }
    
    .establishment-location,
    .establishment-region,
    .establishment-phone,
    .trial-date {
        font-size: 12px;
        color: #64748b;
        margin-top: 4px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .trial-date {
        color: #ea580c;
        font-weight: 500;
    }
    
    .no-establishments {
        color: #94a3b8;
        font-style: italic;
        font-size: 13px;
    }
    
    /* Стили для регионов */
    .region-badge {
        margin: 2px;
        cursor: default;
    }
    
    .region-badge:hover {
        transform: none;
        background: #f1f5f9;
    }
    
    /* Анимация появления */
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    .establishments-dropdown-content.show {
        display: block;
        animation: fadeIn 0.2s ease;
    }
	
    /* Стили для поиска и фильтров */
    .search-container {
        position: relative;
        width: 100%;
    }
    
    .search-results {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-top: 5px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        max-height: 300px;
        overflow-y: auto;
    }
    
    .search-result-item {
        padding: 12px;
        border-bottom: 1px solid #f1f5f9;
        transition: background 0.2s ease;
    }
    
    .search-result-item:hover {
        background: #f8fafc;
    }
    
    .search-result-item:last-child {
        border-bottom: none;
    }
    
    /* Стили для статистики */
    .stats-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
        margin: 20px 0;
    }
    
    .stat-card {
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        border: 1px solid #e2e8f0;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .stat-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    }
    
    .stat-card h3 {
        font-size: 14px;
        color: #64748b;
        margin-bottom: 10px;
        font-weight: 500;
    }
    
    .stat-card .value {
        font-size: 24px;
        font-weight: 700;
        color: #1e293b;
    }


.container {
            display: none; /* Скрыть пока не авторизован */
        }
        #loading-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: white;
            z-index: 9999;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
        .spinner {
            border: 5px solid #f3f3f3;
            border-top: 5px solid #3498db;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            animation: spin 1s linear infinite;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }




   