/**
 * Стили для фронтенда CTR LAB
 */

/* Убираем margin-top у класса wrap */
.wrap {
    margin-top: 0 !important;
}

.ctr-lab-dashboard,
.ctr-lab-projects,
.ctr-lab-cabinet-management,
.ctr-lab-cabinet-users {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.ctr-lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.ctr-lab-header h1 {
    margin: 0;
}

.ctr-lab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.ctr-lab-nav-item {
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.ctr-lab-nav-item:hover,
.ctr-lab-nav-item.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.ctr-lab-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ctr-lab-stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ctr-lab-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ctr-lab-stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ctr-lab-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0073aa;
    margin: 10px 0;
}

.ctr-lab-stat-card .stat-subtitle {
    font-size: 12px;
    color: #999;
    margin: 5px 0 0 0;
}

.ctr-lab-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ctr-lab-stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
}

.ctr-lab-stat-card .stat-value {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
    color: #0073aa;
}

.ctr-lab-stat-card .stat-progress {
    margin-top: 10px;
    font-size: 12px;
}

.progress-bar {
    display: block;
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    display: block;
    height: 100%;
    background: #0073aa;
    transition: width 0.3s;
}

.ctr-lab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.ctr-lab-btn-primary {
    background: #0073aa;
    color: #fff;
}

.ctr-lab-btn-primary:hover {
    background: #005a87;
}

.ctr-lab-btn-secondary {
    background: #666;
    color: #fff;
}

.ctr-lab-btn-secondary:hover {
    background: #555;
}

.ctr-lab-btn-success {
    background: #28a745;
    color: #fff;
}

.ctr-lab-btn-success:hover {
    background: #218838;
}

.ctr-lab-btn-danger {
    background: #dc3232;
    color: #fff;
}

.ctr-lab-btn-danger:hover {
    background: #b52727;
}

.ctr-lab-btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.ctr-lab-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Общая статистика проектов */
.ctr-lab-projects-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.summary-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 5px;
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Фильтры проектов */
.ctr-lab-projects-filters {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: visible;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filters-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    position: relative;
    min-width: 0; /* Предотвращает переполнение */
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group .ctr-lab-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Исправление для выпадающих списков */
.filter-group select.ctr-lab-select {
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-group.filter-search {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
}

.filter-group.filter-search input {
    flex: 1;
    min-width: 0;
}

/* Исправление для мобильных устройств */
@media (max-width: 768px) {
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group .ctr-lab-select {
        width: 100%;
    }
}

/* Элементы управления видом */
.projects-view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
}

.projects-count {
    font-size: 14px;
    color: #666;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f5f5f5;
}

.view-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.view-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Вид списка для проектов */
.ctr-lab-projects-grid.list-view {
    grid-template-columns: 1fr;
}

.ctr-lab-projects-grid.list-view .ctr-lab-project-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.ctr-lab-projects-grid.list-view .project-card-header {
    flex: 1;
}

.ctr-lab-projects-grid.list-view .project-stats {
    display: flex;
    gap: 20px;
}

.ctr-lab-projects-grid.list-view .project-actions {
    margin-left: auto;
}

.ctr-lab-project-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ctr-lab-project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ctr-lab-project-card h3 {
    margin: 0 0 10px 0;
}

.ctr-lab-project-card h3 a {
    text-decoration: none;
    color: #0073aa;
}

.project-shared-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4CAF50;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    font-size: 14px;
    vertical-align: middle;
}

.project-shared-badge .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.project-meta {
    display: flex;
    gap: 10px;
    margin: 0;
    font-size: 12px;
    color: #666;
    align-items: center;
    flex-wrap: wrap;
}

.project-title .project-meta {
    margin: 0;
}

.project-region {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.project-region .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #666;
}

.project-region .region-name {
    color: #333;
}

.edit-region-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: #666;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
}

.edit-region-btn:hover {
    color: #0073aa;
}

.edit-region-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.project-region-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.project-region-edit .ctr-lab-select {
    margin: 0;
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
}

.project-region-edit .ctr-lab-btn {
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.3;
}

.project-status {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
}

.project-status.status-active {
    background: #d4edda;
    color: #155724;
}

.project-status.status-paused {
    background: #fff3cd;
    color: #856404;
}

.project-header-limits {
    font-size: 0.85em;
    font-weight: normal;
    opacity: 0.8;
    margin-left: 5px;
}

.ctr-lab-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ctr-lab-limit-reached {
    padding: 10px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.ctr-lab-info-table {
    width: 100%;
    border-collapse: collapse;
}

.ctr-lab-info-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.ctr-lab-info-table td:first-child {
    font-weight: bold;
    width: 200px;
}

.ctr-lab-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ctr-lab-table th,
.ctr-lab-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 11px;
}

.ctr-lab-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.ctr-lab-add-user-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.ctr-lab-add-user-form form {
    display: flex;
    gap: 10px;
}

.ctr-lab-add-user-form input[type="email"],
.ctr-lab-add-user-form select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#ctr-lab-add-user-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

#ctr-lab-add-user-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#ctr-lab-add-user-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.project-access-level {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
}

.project-access-level.level-viewer {
    background: #e3f2fd;
    color: #1976d2;
}

.project-access-level.level-editor {
    background: #fff3e0;
    color: #f57c00;
}

.ctr-lab-tab-content {
    display: none;
}

.ctr-lab-tab-content.active {
    display: block;
}

/* Модальные окна — оверлей на весь экран, контент по центру */
.ctr-lab-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
    box-sizing: border-box;
}
/* Центрирование попапа при показе (jQuery .show() ставит display: block) */
.ctr-lab-modal[style*="display: block"] {
    display: flex !important;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.ctr-lab-modal .ctr-lab-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    flex-shrink: 0;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.ctr-lab-modal .ctr-lab-modal-header {
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ctr-lab-modal .ctr-lab-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}
.ctr-lab-modal .ctr-lab-modal-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.merge-groups-hint {
    margin-bottom: 1em;
    color: #555;
    font-size: 0.95em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Страница проекта */
.ctr-lab-project-detail {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

/* Меню пользователя и инструменты в одну линию */
.ctr-lab-project-header-tools {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    font-size: 14px;
    flex-wrap: wrap;
}

.ctr-lab-project-header-tools .header-menu-section {
    display: flex;
    gap: 15px;
    align-items: center;
}

.ctr-lab-project-header-tools .header-menu-section .menu-item {
    color: #333;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.ctr-lab-project-header-tools .header-menu-section .menu-item:hover {
    background-color: #f0f0f0;
}

.ctr-lab-project-header-tools .header-tools-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Инструменты для работы с запросами (старый класс для совместимости) */
.ctr-lab-project-queries-tools {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    font-size: 14px;
}

.queries-search-wrapper {
    flex: 1;
    max-width: 400px;
}

.queries-selection-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: #f0f0f0;
    border-color: #0073aa;
}

.icon-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.queries-table-wrapper.hidden {
    display: none !important;
}

/* Выделение строк таблицы */
.queries-table-selectable tbody tr.query-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.queries-table-selectable tbody tr.query-row:hover {
    background-color: #f5f5f5;
}

.queries-table-selectable tbody tr.query-row.selected {
    background-color: #eae4f0 !important;
}

.queries-table-selectable tbody tr.query-row.selected:hover {
    background-color: #e0d8ec !important;
}

/* Цвета для позиций */
.queries-table-selectable tbody tr td.position-top-10 {
    background-color: #d3e3f0 !important;
}

.queries-table-selectable tbody tr td.position-improved {
    background-color: #b9eabf !important;
}

.queries-table-selectable tbody tr td.position-degraded {
    background-color: #f6ebeb !important;
}

/* Выпадающее меню экспорта */
.export-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.export-dropdown-wrapper .ctr-lab-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.export-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 250px;
    margin-top: 5px;
}

.export-dropdown-menu .export-option {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid #eee;
}

.export-dropdown-menu .export-option:last-child {
    border-bottom: none;
}

.export-dropdown-menu .export-option:hover {
    background-color: #f0f0f0;
}

/* Скрытие кнопки меню под "Создать задачу" */
.mobile-nav-toggle {
    display: none !important;
}

.ctr-lab-project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
    padding-bottom: 1px;
    border-bottom: 2px solid #e0e0e0;
}

.project-title {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    flex-wrap: wrap;
}

.project-title h1 {
    margin: 0;
    line-height: 1.2;
    padding: 0;
}

.project-domain-wrapper {
    position: relative;
}

.project-domain-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.edit-domain-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: #666;
    transition: color 0.3s;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
}

.edit-domain-btn:hover {
    color: #0073aa;
}

.edit-domain-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.project-domain-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.project-domain-edit .ctr-lab-input {
    margin: 0;
    padding: 8px 12px;
    font-size: 24px;
    height: auto;
}

.project-domain-edit .ctr-lab-btn {
    padding: 8px 16px;
    font-size: 14px;
    height: auto;
}

.project-title .project-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-title .header-menu-section {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-left: auto;
}

.project-title .header-menu-section .menu-item {
    color: #333;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 13px;
}

.project-title .header-menu-section .menu-item:hover {
    background-color: #f0f0f0;
}

.ctr-lab-project-nav {
    display: flex;
    gap: 5px;
    margin-bottom: 6px;
    padding: 1px 20px;
    border-bottom: 2px solid #e0e0e0;
}

.ctr-lab-project-nav .nav-item {
    padding: 2px 12px;
    text-decoration: none;
    color: #333;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
    font-size: 13px;
}

.ctr-lab-project-nav .nav-item:hover,
.ctr-lab-project-nav .nav-item.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* Выпадающие пункты меню (Модули, Настройки) */
.ctr-lab-project-nav .nav-dropdown-wrap {
    position: relative;
    display: inline-flex;
}

.ctr-lab-project-nav .nav-item-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ctr-lab-project-nav .nav-dropdown-arrow {
    font-size: 10px;
    opacity: 0.8;
}

.ctr-lab-project-nav .nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 4px 0;
    z-index: 100;
    display: none;
}

.ctr-lab-project-nav .nav-dropdown-wrap:hover .nav-dropdown,
.ctr-lab-project-nav .nav-dropdown-wrap.open .nav-dropdown {
    display: block;
}

.ctr-lab-project-nav .nav-dropdown .nav-dropdown-item {
    display: block;
    padding: 8px 14px;
    white-space: nowrap;
    border-bottom: none;
    margin-bottom: 0;
}

.ctr-lab-project-nav .nav-dropdown .nav-dropdown-item:hover {
    background: #f5f5f5;
}

.project-info,
.project-stats {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
    padding: 5px;
    background: #f5f5f5;
    border-radius: 4px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 0px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

.access-token-info {
    margin-top: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.access-token-info code,
.access-token-display code {
    display: block;
    padding: 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-family: monospace;
    word-break: break-all;
    margin: 5px 0;
}

.access-token-display {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.access-token-display button,
.token-actions button {
    margin-top: 10px;
    margin-right: 10px;
}

.token-url {
    margin-top: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.token-url code {
    display: block;
    word-break: break-all;
    margin-top: 5px;
}

.access-level-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
}

.access-level-badge.level-viewer {
    background: #e3f2fd;
    color: #1976d2;
}

.access-level-badge.level-editor {
    background: #fff3e0;
    color: #f57c00;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.form-row input,
.form-row select {
    flex: 1;
}

.public-access-section,
.users-access-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.add-user-form {
    margin-bottom: 30px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

#grant-access-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

#grant-access-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#grant-access-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Настройка модулей */
.ctr-lab-module-settings {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.module-settings-header {
    margin-bottom: 25px;
}

.module-settings-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.module-settings-description {
    color: #666;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.modules-list-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.modules-list-single {
    min-height: 200px;
}

.modules-list-single .empty-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 60px 20px;
    margin: 0;
}

.module-row {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.module-row:last-child {
    border-bottom: none;
}

.module-row:hover {
    background: #f9f9f9;
}

.module-row.inactive {
    opacity: 0.6;
}

.module-row.inactive .module-title {
    color: #999;
}

.module-row-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
}

.module-drag-handle {
    cursor: grab;
    color: #999;
    display: flex;
    align-items: center;
    padding: 5px;
    transition: color 0.2s;
}

.module-drag-handle:hover {
    color: #0073aa;
}

.module-drag-handle:active {
    cursor: grabbing;
}

.module-drag-handle .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-file-name {
    font-size: 11px;
    color: #666;
    font-weight: normal;
    margin-left: 8px;
    opacity: 0.8;
}

.module-file-name code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.module-details {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.module-file-info,
.module-name-label {
    font-size: 11px;
}

.module-name-label code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.module-warning-badge {
    background: #fff3cd;
    color: #856404;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.module-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.module-file-name {
    font-size: 11px;
    color: #666;
    font-weight: normal;
    opacity: 0.8;
}

.module-file-name code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
}

.module-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
}

.module-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: #777;
    margin-top: 6px;
}

.module-details span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.module-details code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #0073aa;
}

.module-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-settings-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.module-settings-btn:hover {
    background: #e0e0e0;
    border-color: #0073aa;
    color: #0073aa;
}

.module-settings-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Toggle Switch */
.module-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin: 0;
}

.module-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.module-toggle-switch input:checked + .toggle-slider {
    background-color: #0073aa;
}

.module-toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.module-toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Drag and Drop States */
.module-ghost {
    opacity: 0.3 !important;
    background: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
    transform: scale(0.95) !important;
    transition: all 0.2s ease !important;
}

.module-chosen {
    background: #fff3e0 !important;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3) !important;
    transform: scale(1.03) !important;
    border: 2px solid #ff9800 !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    z-index: 1000 !important;
    position: relative !important;
}

.module-chosen .module-drag-handle {
    color: #ff9800 !important;
    cursor: grabbing !important;
}

.module-drag {
    opacity: 0.9 !important;
    transform: scale(1.05) rotate(2deg) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
    border: 2px solid #0073aa !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    z-index: 1001 !important;
    transition: all 0.2s ease !important;
}

/* Индикатор места вставки */
.module-row.sortable-insert-above {
    position: relative;
    border-top: 3px solid #2196f3 !important;
    margin-top: 2px;
}

.module-row.sortable-insert-above::before {
    content: '';
    position: absolute;
    left: 0;
    top: -3px;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #2196f3, transparent);
    animation: pulse-line 1s ease-in-out infinite;
    z-index: 999;
}

.module-row.sortable-insert-below {
    position: relative;
    border-bottom: 3px solid #2196f3 !important;
    margin-bottom: 2px;
}

.module-row.sortable-insert-below::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #2196f3, transparent);
    animation: pulse-line 1s ease-in-out infinite;
    z-index: 999;
}

@keyframes pulse-line {
    0%, 100% {
        opacity: 0.6;
        transform: scaleX(0.8);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

/* Улучшенные стили для перетаскиваемого элемента */
.module-row.dragging {
    opacity: 0.7 !important;
    transform: scale(0.98) !important;
    pointer-events: none !important;
}

/* Визуальная обратная связь при наведении на место вставки */
.modules-list-single.sortable-drag-over {
    background: #f0f8ff;
    border: 2px dashed #2196f3;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Анимация при начале перетаскивания */
@keyframes drag-start {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1.03);
    }
}

.module-chosen {
    animation: drag-start 0.3s ease-out;
}

/* Подсказка при перетаскивании */
.drag-hint {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #0073aa;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.drag-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.drag-hint::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #0073aa;
}

/* Состояния контейнера при перетаскивании */
.modules-list-single.sortable-dragging {
    position: relative;
}

.modules-list-single.sortable-dragging::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 150, 243, 0.05);
    border: 2px dashed rgba(33, 150, 243, 0.3);
    border-radius: 8px;
    pointer-events: none;
    z-index: 1;
}

/* Улучшенные стили для выбранного элемента */
.module-row.sortable-choosing {
    background: #fff9e6;
    border-left: 4px solid #ff9800;
    transition: all 0.2s ease;
}

/* Плавная анимация при перемещении */
.module-row {
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

/* Визуальная обратная связь для сообщения о перемещении */
#module-settings-message.success {
    background: #4caf50;
    color: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    font-weight: 500;
}

.module-settings-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ctr-lab-btn-danger {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.ctr-lab-btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    color: #fff;
}

.ctr-lab-btn-danger:disabled {
    background: #dc3545;
    opacity: 0.65;
    cursor: not-allowed;
}

#save-module-order.has-changes {
    background: #ff9800;
}

#module-settings-message {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

#module-settings-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Лог выполнения модулей */
.module-execution-logs {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.module-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.module-logs-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.module-logs-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.module-logs-actions .ctr-lab-btn {
    white-space: nowrap;
}

.module-logs-content {
    max-height: 600px;
    overflow-y: auto;
}

.empty-logs-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
}

.execution-session {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.session-time {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.session-count {
    color: #666;
    font-size: 13px;
}

.session-logs {
    padding: 10px;
}

.execution-log-item {
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
    transition: all 0.2s;
}

.execution-log-item:last-child {
    margin-bottom: 0;
}

.execution-log-item.status-pending {
    border-left: 4px solid #ffc107;
    background: #fffbf0;
}

.execution-log-item.status-running,
.execution-log-item.status-pending {
    border-left: 4px solid #2196f3;
    background: #f0f8ff;
}

.execution-log-item.is-active {
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.execution-log-item.is-active.status-running {
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-left-color: #2196f3;
    }
    50% {
        border-left-color: #03a9f4;
    }
}

.status-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    margin-left: 8px;
    animation: status-pulse 1.5s infinite;
}

@keyframes status-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.execution-log-item.status-completed {
    border-left: 4px solid #4caf50;
    background: #f1f8f4;
}

.execution-log-item.status-failed {
    border-left: 4px solid #f44336;
    background: #fff5f5;
}

.log-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.log-module-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-module-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.log-order {
    background: #e0e0e0;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.log-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.status-pending {
    background: #ffc107;
    color: #fff;
}

.status-badge.status-running {
    background: #2196f3;
    color: #fff;
}

.status-badge.status-completed {
    background: #4caf50;
    color: #fff;
}

.status-badge.status-failed {
    background: #f44336;
    color: #fff;
}

.status-badge.status-cancelled {
    background: #ff9800;
    color: #fff;
}

.log-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #2196f3;
    transition: width 0.3s;
}

.progress-text {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 50px;
    text-align: right;
}

.log-message {
    margin: 10px 0;
    padding: 8px 12px;
    background: #fff;
    border-left: 3px solid #2196f3;
    border-radius: 3px;
    font-size: 13px;
    color: #555;
    max-height: 300px;
    overflow-y: auto;
}

.log-message-line {
    margin: 2px 0;
    padding: 2px 0;
    line-height: 1.4;
}

.log-message-line:first-child {
    margin-top: 0;
}

.log-message-line:last-child {
    margin-bottom: 0;
}

/* Стили для разных типов сообщений в логе */
.log-message-line:contains("✓") {
    color: #4caf50;
}

.log-message-line:contains("✗") {
    color: #f44336;
}

.log-message-line:contains("---") {
    font-weight: 600;
    color: #333;
    margin-top: 5px;
    margin-bottom: 5px;
}

.log-error {
    margin: 10px 0;
    padding: 10px 12px;
    background: #ffebee;
    border-left: 3px solid #f44336;
    border-radius: 3px;
    font-size: 13px;
    color: #c62828;
}

.log-error strong {
    color: #d32f2f;
}

.log-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
}

.log-date,
.log-duration {
    display: flex;
    align-items: center;
    gap: 5px;
}

.log-date strong,
.log-duration strong {
    color: #333;
}

/* Анимация вращения для кнопки обновления */
.dashicons.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Стили для валидации форм */
.ctr-lab-input.error,
.ctr-lab-select.error,
.ctr-lab-textarea.error {
    border-color: #dc3232;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.3);
}

.field-error {
    display: block;
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}

.field-warning {
    display: block;
    color: #f56e28;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 10px;
}

.ctr-lab-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}
.ctr-lab-form-row .ctr-lab-form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}
.ctr-lab-task-meta-row .ctr-lab-form-group {
    flex: 1;
    min-width: 0;
}
.ctr-lab-form-group {
    margin-bottom: 20px;
}

.ctr-lab-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.ctr-lab-form-group .field-hint {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

/* Стили для breadcrumbs */
.ctr-lab-breadcrumbs {
    margin-bottom: 1px;
    padding: 2px 0;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 11px;
}

.breadcrumb-link {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #005177;
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: #999;
}

.breadcrumb-current {
    color: #333;
    font-weight: 500;
}

/* Стили для быстрого поиска */
.ctr-lab-quick-search {
    position: relative;
    max-width: 400px;
    margin-left: auto;
}

.quick-search-input-wrapper {
    position: relative;
}

.quick-search-input {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.quick-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.quick-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.quick-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-section {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-title {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.search-result-item {
    margin: 0;
}

.search-result-item.active {
    background: #f0f0f0;
}

.search-result-link {
    display: flex;
    align-items: center;
    padding: 8px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.search-result-link:hover,
.search-result-item.active .search-result-link {
    background: #f0f0f0;
}

.search-result-icon {
    margin-right: 8px;
    font-size: 16px;
}

.search-result-text {
    flex: 1;
}

.search-result-meta {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #999;
}

#module-settings-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Прогресс-бар выполнения модулей */
.ctr-lab-module-progress {
    display: none;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.overall-progress {
    margin-bottom: 20px;
}

.overall-progress-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.overall-progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.overall-progress-bar .progress-fill {
    height: 100%;
    background: #2196f3;
    transition: width 0.3s, background 0.3s;
}

.overall-progress-bar .progress-fill.complete {
    background: #4caf50;
}

.overall-progress-text {
    font-weight: bold;
    color: #333;
}

.modules-progress-list {
    margin-top: 20px;
}

.module-progress-item {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.module-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.module-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.module-progress-bar .progress-fill {
    height: 100%;
    transition: width 0.3s;
}

.module-progress-bar .progress-fill.status-running {
    background: #2196f3;
}

.module-progress-bar .progress-fill.status-complete {
    background: #4caf50;
}

.module-progress-bar .progress-fill.status-failed {
    background: #f44336;
}

.module-progress-bar .progress-fill.status-pending {
    background: #ff9800;
}

.module-status {
    font-size: 12px;
    color: #666;
}

.module-status.status-complete {
    color: #4caf50;
    font-weight: bold;
}

.module-status.status-running {
    color: #2196f3;
}

.module-status.status-failed {
    color: #f44336;
}

.project-actions-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.action-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Стили для таблицы запросов */
.ctr-lab-queries-container {
    margin: 2px 0;
}

.ctr-lab-queries-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 1px 0;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Информация о лимитах */
.cabinet-limits-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
    white-space: nowrap;
    font-size: 13px;
}

.cabinet-limits-info .limits-label {
    font-weight: 600;
    color: #555;
}

.cabinet-limits-info .limits-value {
    font-weight: 700;
    color: #0073aa;
    font-family: monospace;
    letter-spacing: 0.5px;
}

/* a) Поиск */
.queries-search-block {
    flex: 1;
    min-width: 200px;
    padding-top: 1px;
    padding-bottom: 1px;
}

.queries-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.queries-search-wrapper .queries-search-clear {
    position: absolute;
    left: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: #888;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    z-index: 2;
    flex-shrink: 0;
}

.queries-search-wrapper.has-text .queries-search-clear {
    color: #555;
}

.queries-search-wrapper .queries-search-clear:hover {
    color: #222;
    background: rgba(0, 0, 0, 0.08);
}

.queries-search-block input {
    width: 100%;
    padding: 1px 10px 1px 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box;
}

/* b) Кнопки выбора запросов и копирования */
.ctr-lab-queries-header .queries-selection-tools {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-top: 1px;
    padding-bottom: 1px;
}

.ctr-lab-queries-header .queries-selection-tools .icon-btn {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctr-lab-queries-header .queries-selection-tools .icon-btn:hover {
    background-color: #f0f0f0;
    border-color: #0073aa;
}

.ctr-lab-queries-header .queries-selection-tools .icon-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* c) Кнопки действий */
.queries-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 1px;
    padding-bottom: 1px;
}

.queries-actions .ctr-lab-btn {
    padding: 7px 12px;
    font-size: 10px;
}

.queries-actions #bulk-actions-btn {
    padding: 7px 12px;
    font-size: 16px;
    line-height: 1;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queries-actions #create-task-btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Поисковая система: Яндекс / Google */
.queries-search-engine-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 1px;
    padding-bottom: 1px;
}

.search-engine-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.search-engine-filter-blocks {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.search-engine-filter-block {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    white-space: nowrap;
}

.search-engine-filter-block:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.search-engine-filter-block.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* c) Все позиции (блоками) */
.queries-position-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 1px;
    padding-bottom: 1px;
}

.position-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.position-filter-blocks {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.position-filter-block {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    white-space: nowrap;
}

.position-filter-block:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.position-filter-block.active,
.position-filter-block[data-active="true"] {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Выпадающий селект позиций — показываем только при ширине ≤1920px */
.position-filter-select {
    display: none;
    min-width: 90px;
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

@media (max-width: 1920px) {
    .queries-position-filters .position-filter-blocks {
        display: none !important;
    }
    .queries-position-filters .position-filter-select {
        display: inline-block !important;
    }
}

@media (min-width: 1921px) {
    .queries-position-filters .position-filter-select {
        display: none !important;
    }
}

/* d) Только с частотой (поменьше) */
.queries-frequency-filter {
    font-size: 11px;
    padding-top: 1px;
    padding-bottom: 1px;
}

.frequency-filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #666;
}

.frequency-filter-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.ctr-lab-queries-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
    min-height: calc(100vh - 120px); /* Минимальная высота равна высоте экрана минус заголовок и отступы */
}

.ctr-lab-queries-main {
    flex: 1;
    min-width: 0;
    padding: 2px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.queries-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    height: 1220px; /* Фиксированная высота для 100 строк (12px на строку * 100 + заголовок ~20px) */
    min-height: 1220px; /* Минимальная высота всегда 100 строк */
}

.ctr-lab-queries-sidebar {
    width: 360px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: calc(100vh - 120px); /* Минимальная высота равна высоте экрана минус заголовок и отступы */
    max-height: 100%;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 3px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.sidebar-header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 13px;
}

.sidebar-header .groups-summary {
    padding: 0;
    font-size: 12px;
    color: #555;
    border-bottom: none;
}

.sidebar-header #add-group-btn {
    padding: 4px 20px;
}

.groups-sidebar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.groups-search-input {
    flex: 1;
    min-width: 80px;
    padding: 4px 8px;
    font-size: 12px;
}

.groups-toolbar-icons {
    display: flex;
    gap: 2px;
    align-items: center;
}

.groups-toolbar-icons .icon-btn {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

.groups-toolbar-icons .icon-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.groups-summary {
    padding: 4px 15px;
    font-size: 12px;
    color: #555;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.group-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.group-color-swatch {
    display: inline-block;
    cursor: pointer;
}

.group-color-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.group-color-swatch-box {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.group-color-swatch input:checked + .group-color-swatch-box {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 1px #1d4ed8;
}

.group-color-swatch:hover .group-color-swatch-box {
    opacity: 0.9;
}

.groups-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 15px 10px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.groups-sort label {
    flex-shrink: 0;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.groups-sort select {
    flex: 1;
    min-width: 0;
    padding: 2px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

.groups-list {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    position: relative;
    padding: 0 15px;
}

#groups-list.groups-dragging-active,
.ctr-lab-queries-sidebar.groups-dragging-active {
    overflow: visible !important;
}

/* Зона для открепления подгрупп (становится группой верхнего уровня) */
.groups-list .detach-zone {
    display: none;
    position: relative;
    margin: 8px 0;
    padding: 12px;
    background: #f0f7ff;
    border: 2px dashed #2271b1;
    border-radius: 4px;
    text-align: center;
    color: #2271b1;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    z-index: 10;
}

.groups-list .detach-zone.active {
    display: block;
    background: #e7f3ff;
    border-color: #135e96;
    box-shadow: 0 2px 8px rgba(35, 113, 177, 0.2);
}

.groups-list .detach-zone::before {
    content: '↑';
    display: block;
    font-size: 20px;
    margin-bottom: 4px;
    color: #2271b1;
}

/* Индикатор при перетаскивании подгруппы */
.groups-list.dragging-subgroup .group-item[data-level="0"] {
    border-top: 2px solid #2271b1;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.groups-list.dragging-subgroup .group-item[data-level="0"]:first-of-type {
    border-top: none;
}

/* Визуальная зона перед первой корневой группой */
.groups-list .root-groups-zone {
    position: relative;
    min-height: 2px;
    margin: 4px 0;
    transition: all 0.2s ease;
    opacity: 0;
}

.groups-list.dragging-subgroup .root-groups-zone {
    min-height: 50px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e7f3ff 100%);
    border: 2px dashed #2271b1;
    border-radius: 6px;
    margin: 8px 0;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(35, 113, 177, 0.15);
}

/* Подсветка зоны при наведении во время перетаскивания подгруппы */
.groups-list.dragging-subgroup .root-groups-zone.active {
    background: linear-gradient(135deg, #e7f3ff 0%, #d0e8ff 100%);
    border-color: #135e96;
    box-shadow: 0 2px 12px rgba(35, 113, 177, 0.3);
}

.groups-list.dragging-subgroup .root-groups-zone::before {
    content: '↑';
    display: block;
    text-align: center;
    font-size: 24px;
    color: #2271b1;
    margin-top: 8px;
    line-height: 1;
}

.groups-list.dragging-subgroup .root-groups-zone::after {
    content: 'Перетащите сюда, чтобы сделать группой верхнего уровня';
    display: block;
    text-align: center;
    padding: 4px 8px 8px;
    color: #2271b1;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

/* Поле "Перенести в корень" — по умолчанию скрыто, показывается только при перетаскивании группы */
.move-to-root-wrapper {
    flex-shrink: 0;
    padding: 8px 0;
    margin: 0 0 8px 0;
    border-bottom: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
    display: none;
}

.move-to-root-wrapper .move-to-root-zone {
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.move-to-root-wrapper:not(.move-to-root-active):not(.move-to-root-drag-active) .move-to-root-zone {
    opacity: 0.6;
}

/* При перетаскивании группы — зона «Перенести в корень» на всю ширину сайдбара */
.move-to-root-wrapper.move-to-root-drag-active {
    display: block !important;
    padding: 10px 0;
}

.move-to-root-wrapper.move-to-root-drag-active .move-to-root-zone {
    display: block !important;
    width: 100%;
    min-height: 44px;
    line-height: 44px;
    padding: 0 12px;
}

/* Зона «Перенести в корень», вставленная под перетаскиваемой группой */
.groups-list .move-to-root-zone-inline {
    display: block !important;
    width: 100%;
    min-height: 40px;
    line-height: 40px;
    margin: 6px 0;
    box-sizing: border-box;
}

/* Поле "Перенести в корень" под выбранной подгруппой */
.groups-list .move-to-root-zone,
.move-to-root-wrapper .move-to-root-zone {
    display: block !important;
    margin: 4px 0 8px 0;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e7f3ff 100%);
    border: 2px dashed #2271b1;
    border-radius: 4px;
    text-align: center;
    color: #2271b1;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    visibility: visible !important;
}

.groups-list .move-to-root-zone:hover,
.move-to-root-wrapper .move-to-root-zone:hover {
    background: linear-gradient(135deg, #e7f3ff 0%, #d0e8ff 100%);
    border-color: #135e96;
    color: #135e96;
    box-shadow: 0 2px 8px rgba(35, 113, 177, 0.2);
}

.group-item {
    padding-top: 1px;
    padding-bottom: 1px;
    padding-right: 8px;
    padding-left: 8px; /* Базовый отступ */
    margin-bottom: 1px;
    border-radius: 3px;
    cursor: grab;
    display: flex;
    flex-wrap: nowrap !important; /* keep actions on the same line - force no wrap */
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, border-left 0.2s, box-shadow 0.2s;
    overflow: hidden; /* prevent content overflow */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
    border-left: 3px solid transparent;
}

.group-item:active {
    cursor: grabbing;
}

.group-item.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd !important;
    border: 2px dashed #2196f3 !important;
}

/* Клон при forceFallback — следует за курсором, без ограничений */
.sortable-fallback.group-item {
    z-index: 99999 !important;
    pointer-events: none !important;
    opacity: 0.95 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

.group-item.sortable-drag {
    opacity: 0.9;
    transform: scale(1.02) rotate(1deg);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3) !important;
    border: 2px solid #0073aa !important;
    background: #ffffff !important;
    z-index: 1001 !important;
}

/* Состояние перетаскивания - показываем все группы как потенциальные зоны drop */
#groups-list.groups-dragging-active .group-item:not(.group-dragging) {
    opacity: 0.85;
    transition: opacity 0.2s, background 0.2s;
}

#groups-list.groups-dragging-active .group-item:not(.group-dragging):hover {
    opacity: 1;
    background: #e8f4fd;
}

/* Зоны drop при перетаскивании */
.group-item.drop-zone {
    background: #e8f4fd !important;
    border-left: 4px solid #0073aa !important;
    box-shadow: 0 0 8px rgba(0, 115, 170, 0.3) !important;
    position: relative;
    opacity: 1 !important;
}

/* Убрано для подгрупп - используем только drop-zone-right */
.group-item.drop-zone:not([data-level="0"]) .group-name::after {
    display: none;
}

/* Для корневых групп оставляем текст "Перетащите сюда" */
.group-item.drop-zone[data-level="0"] .group-name::after {
    content: '↓ Перетащите сюда';
    display: inline-block;
    margin-left: 8px;
    background: #0073aa;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    vertical-align: middle;
}

.group-children.drop-zone {
    background: #f0f7ff !important;
    border: 2px dashed #0073aa !important;
    border-radius: 4px !important;
    min-height: 40px;
    position: relative;
    margin: 4px 0;
}

.group-children.drop-zone::before {
    content: 'Перетащите группу сюда';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0073aa;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* Индикатор места вставки */
.group-item.sortable-insert-above {
    border-top: 3px solid #0073aa !important;
    margin-top: 2px;
    padding-top: 2px;
}

.group-item.sortable-insert-below {
    border-bottom: 3px solid #0073aa !important;
    margin-bottom: 2px;
    padding-bottom: 2px;
}

/* Подсветка родительской группы при перетаскивании */
.group-item.parent-group-highlight {
    background: #fff4e6 !important;
    border-left: 4px solid #ff9800 !important;
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.4) !important;
    position: relative;
}

.group-item.parent-group-highlight::after {
    content: '← Родительская группа';
    display: inline-block;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff9800;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* Визуальные зоны перетаскивания (влево/середина/вправо) */
.group-item.drop-zone-left {
    border-left: 4px solid #4caf50 !important;
    background: linear-gradient(to right, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 33%, transparent 33%) !important;
}

.group-item.drop-zone-left::before {
    content: '← Корневая';
    display: inline-block;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #4caf50;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.group-item.drop-zone-middle {
    border-left: 4px solid #2196f3 !important;
    background: linear-gradient(to right, transparent 0%, rgba(33, 150, 243, 0.05) 33%, rgba(33, 150, 243, 0.1) 66%, transparent 66%) !important;
}

.group-item.drop-zone-middle::before {
    content: '↔ Корневая группа';
    display: inline-block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #2196f3;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.group-item.drop-zone-right {
    border-left: 4px solid #ff9800 !important;
    background: linear-gradient(to right, rgba(255, 152, 0, 0.05) 0%, rgba(255, 152, 0, 0.1) 100%) !important;
    position: relative;
}

.group-item.drop-zone-right::before {
    content: '+ Подгруппа';
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    padding: 0;
    border-radius: 0;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Иерархия групп с отступами - используем data-level для автоматического расчета */
.group-item[data-level="0"] {
    padding-left: 8px !important;
    display: flex !important; /* ensure flex layout for root groups */
    flex-wrap: nowrap !important; /* prevent wrapping for root groups */
}

.group-item[data-level="1"] {
    padding-left: 28px !important; /* 8px базовый + 20px отступ */
}

.group-item[data-level="2"] {
    padding-left: 48px !important; /* 8px базовый + 40px отступ */
}

.group-item[data-level="3"] {
    padding-left: 68px !important; /* 8px базовый + 60px отступ */
}

.group-item[data-level="4"] {
    padding-left: 88px !important; /* 8px базовый + 80px отступ */
}

.group-item[data-level="5"] {
    padding-left: 108px !important; /* 8px базовый + 100px отступ */
}

/* Приоритет для inline стилей с !important */
.group-item[style*="padding-left"] {
    /* Inline стили с !important имеют наивысший приоритет */
}

.group-item:hover:not(.active):not(.group-item-trash) {
    background: #e8f4fd;
    border-left: 3px solid #0073aa;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.1);
}

.group-item:hover:not(.active):not(.group-item-trash) .group-name::before {
    content: '⋮⋮';
    display: inline-block;
    margin-right: 6px;
    color: #0073aa;
    font-size: 14px;
    opacity: 0.7;
    line-height: 1;
    vertical-align: middle;
}

.group-item.active {
    background: #0073aa;
    color: #fff;
}

/* Выделенная группа с собственным цветом — тёмный текст, чтобы был виден на светлом фоне */
.group-item.active[data-group-color] {
    color: #1d2327;
}
.group-item.active[data-group-color] .group-frequency,
.group-item.active[data-group-color] .group-frequency-general,
.group-item.active[data-group-color] .group-avg-position,
.group-item.active[data-group-color] .group-stats-inline,
.group-item.active[data-group-color] .group-name-text {
    color: #50575e;
}
.group-item.active[data-group-color] .group-actions button {
    color: #1d2327;
}

.group-item.active .group-frequency,
.group-item.active .group-frequency-general,
.group-item.active .group-avg-position,
.group-item.active .group-stats-inline {
    color: rgba(255, 255, 255, 0.9);
}

.group-frequency-general,
.group-avg-position {
    margin-left: 8px;
    font-size: 0.9em;
    color: #666;
}

.group-item.active .group-frequency-general,
.group-item.active .group-avg-position,
.group-item.active .group-stats-inline {
    color: rgba(255, 255, 255, 0.8);
}

.group-item-trash {
    border-left: 3px solid #dc3232;
    background: #fff5f5;
}

.group-item-trash.active {
    background: #dc3232;
    color: #fff;
}

.group-item-trash:hover {
    background: #ffe5e5;
}

.group-item-trash.active:hover {
    background: #c92a2a;
}

/* Корзина всегда наверху, не участвует в сортировке */
.group-item-trash {
    order: -1; /* Корзина первой (порядок также задаётся в sortGroups: Корзина → Все запросы → Запросы без группы) */
    border-top: 2px solid #dc3232;
    margin-top: 4px;
    padding-top: 0px;
}

/* Скрываем кнопки редактирования/удаления для корзины */
.group-item-trash .group-actions .edit-group-btn {
    display: none;
}

.group-item-trash .group-actions .delete-group-btn {
    display: none;
}

/* Стили для массового управления группами */
.groups-bulk-actions {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.select-all-groups-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.select-all-groups-label input[type="checkbox"] {
    cursor: pointer;
}

.group-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    margin-right: 4px;
    padding: 2px 0;
    font-size: 12px;
    line-height: 1;
    color: #999;
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
    pointer-events: auto;
}

.group-drag-handle:active {
    cursor: grabbing;
}

.group-item[data-group-id="0"] .group-drag-handle,
.group-item-trash .group-drag-handle {
    display: none;
}

/* Группы — Drag and Drop (ручка ⋮⋮): разрешаем перетаскивание в WebKit */
#groups-list .group-drag-handle[draggable="true"] {
    cursor: grab;
    -webkit-user-drag: element;
}

#groups-list .group-item.group-dragging {
    cursor: grabbing;
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.35);
    border: 2px solid #0073aa;
    z-index: 9999;
    opacity: 0.92;
}

#move-to-root-wrapper.group-drop-target,
.group-item.group-drop-target,
.move-to-root-zone.group-drop-target {
    background: #e7f3ff !important;
    border: 2px dashed #0073aa !important;
}

.group-checkbox-label {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    cursor: pointer;
    flex-shrink: 0; /* prevent checkbox from shrinking */
}

.group-checkbox {
    cursor: pointer;
    margin: 0;
}

.group-item[data-group-id="0"] .group-checkbox-label,
.group-item-trash .group-checkbox-label {
    display: none; /* Скрываем чекбоксы для "Все запросы" и "Корзина" */
}

#delete-selected-groups-btn {
    font-size: 12px;
    padding: 4px 10px;
}

.ctr-lab-btn-danger {
    background-color: #dc3232;
    color: #fff;
    border-color: #dc3232;
}

.ctr-lab-btn-danger:hover {
    background-color: #c92a2a;
    border-color: #c92a2a;
}

/* Стили для иерархии групп */
.group-item-parent {
    position: relative;
}

.group-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0; /* prevent toggle button from shrinking */
}

.group-toggle:hover {
    opacity: 1;
}

.group-toggle .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.group-item-parent.collapsed .group-toggle .dashicons {
    transform: rotate(-90deg);
}

.group-toggle-placeholder {
    width: 16px;
    display: inline-block;
    flex-shrink: 0; /* prevent placeholder from shrinking */
}

.group-children {
    margin-left: 0;
    padding-left: 0;
}

/* Изначально все подгруппы скрыты */
.group-children {
    display: none;
}

/* Показываем подгруппы только если родитель не свернут */
.group-item-parent:not(.collapsed) + .group-children {
    display: block !important;
}

/* ВАЖНО: НЕ показываем вложенные подгруппы автоматически - они должны показываться только при разворачивании их непосредственного родителя */
/* Это правило удалено, чтобы группы 2-го уровня не показывались при разворачивании группы 0-го уровня */

/* ВАЖНО: Удалено правило, которое автоматически показывало вложенные контейнеры */
/* Вложенные контейнеры должны показываться только при разворачивании их непосредственного родителя */
/* Это нужно, чтобы группы 2-го уровня не показывались при разворачивании группы 0-го уровня */

/* Убеждаемся, что свернутые группы остаются видимыми */
.group-item-parent.collapsed {
    display: block !important;
}

/* Скрываем подгруппы когда родитель свернут */
.group-item-parent.collapsed + .group-children {
    display: none !important;
}

/* Скрываем вложенные подгруппы внутри свернутых контейнеров */
.group-item-parent.collapsed + .group-children .group-children {
    display: none !important;
}

/* Скрываем группы 3-го уровня и выше, если они не находятся внутри контейнера .group-children */
#groups-list > .group-item[data-level="2"],
#groups-list > .group-item[data-level="3"],
#groups-list > .group-item[data-level="4"],
#groups-list > .group-item[data-level="5"] {
    display: none !important;
}

/* Показываем группы только если они внутри развернутого контейнера */
.group-item-parent:not(.collapsed) + .group-children .group-item {
    display: block !important;
}

/* Принудительно применяем отступы для всех групп с data-level через более специфичный селектор */
#groups-list .group-item[data-level="1"],
.groups-list .group-item[data-level="1"],
.group-children .group-item[data-level="1"] {
    padding-left: 28px !important;
}

#groups-list .group-item[data-level="2"],
.groups-list .group-item[data-level="2"],
.group-children .group-item[data-level="2"] {
    padding-left: 48px !important;
}

#groups-list .group-item[data-level="3"],
.groups-list .group-item[data-level="3"],
.group-children .group-item[data-level="3"] {
    padding-left: 68px !important;
}

#groups-list .group-item[data-level="4"],
.groups-list .group-item[data-level="4"],
.group-children .group-item[data-level="4"] {
    padding-left: 88px !important;
}

#groups-list .group-item[data-level="5"],
.groups-list .group-item[data-level="5"],
.group-children .group-item[data-level="5"] {
    padding-left: 108px !important;
}

/* Отступы для групп внутри .group-children - принудительно применяем отступы */
.group-children .group-item[data-level="1"] {
    padding-left: 28px !important;
}

.group-children .group-item[data-level="2"] {
    padding-left: 48px !important;
}

.group-children .group-item[data-level="3"] {
    padding-left: 68px !important;
}

.group-children .group-item[data-level="4"] {
    padding-left: 88px !important;
}

.group-children .group-item[data-level="5"] {
    padding-left: 108px !important;
}

/* Принудительно применяем inline стили для всех групп с data-level */
.group-item[data-level] {
    /* Inline стили с !important должны работать, но добавим дополнительную защиту */
}

/* Стили для drag and drop групп */
.group-item {
    cursor: move;
    transition: background-color 0.2s, transform 0.2s;
}

.group-item.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd !important;
}

.group-item.sortable-drag {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.group-item.sortable-chosen {
    background: #e8f5e9 !important;
}

.group-name {
    cursor: move;
    user-select: none;
}

/* Отключаем drag для кнопок действий */
.group-actions,
.group-actions *,
.group-toggle {
    cursor: pointer;
    pointer-events: auto;
}

.group-item.sortable-drag .group-actions,
.group-item.sortable-drag .group-toggle {
    pointer-events: none;
}

/* Стили для модуля конкурентов */
.ctr-lab-competitors-container {
    margin: 20px 0;
}

.competitors-header {
    margin-bottom: 20px;
}

.competitors-description {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

.competitors-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
}

.competitors-table-wrapper {
    overflow-x: auto;
}

/* Графики конкурентов: модалки */
.competitor-url-charts {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.competitor-url-charts .chart-block {
    position: relative;
    min-height: 200px;
}

.competitor-url-charts .chart-block h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.competitor-url-charts .chart-block canvas {
    max-width: 100%;
}

.chart-loading,
.chart-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.competitor-actions .view-url-chart {
    margin-left: 4px;
}

.urls-list .url-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.urls-list .view-url-chart {
    flex-shrink: 0;
}

/* Стили для истории позиций */
.ctr-lab-position-history-container {
    margin: 20px 0;
}

/* Таблица запросов с позициями по датам */
.queries-positions-table-wrapper {
    margin: 30px 0;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
}

.queries-positions-table-wrapper .table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.queries-positions-table-wrapper .table-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.table-wrapper-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

#queries-positions-table {
    min-width: 100%;
    font-size: 11px;
}

#queries-positions-table th {
    background: #f5f5f5;
    font-weight: 600;
    padding: 10px 8px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

#queries-positions-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: #f5f5f5;
}

#queries-positions-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

#queries-positions-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
}

#queries-positions-table tbody tr:hover td:first-child {
    background: #f9f9f9;
}

#queries-positions-table tbody tr:hover {
    background: #f9f9f9;
}

.position-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.position-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.stat-card {
    background: #fff;
    padding: 10px 12px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.stat-card h3 {
    margin: 0;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.stat-card .stat-label {
    font-size: 11px;
    color: #666;
    font-weight: normal;
    white-space: nowrap;
}

.stat-card .stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #0073aa;
    margin: 0;
    white-space: nowrap;
}

.stat-card .stat-percent {
    font-size: 11px;
    color: #666;
    margin: 0;
    font-weight: normal;
    white-space: nowrap;
}

.stat-card.improved {
    background: #d4edda;
    border-left: 3px solid #28a745;
}

.stat-card.improved .stat-label {
    color: #155724;
}

.stat-card.improved .stat-value {
    color: #155724;
}

.stat-card.improved .stat-percent {
    color: #155724;
}

.stat-card.degraded {
    background: #f8d7da;
    border-left: 3px solid #dc3545;
}

.stat-card.degraded .stat-label {
    color: #721c24;
}

.stat-card.degraded .stat-value {
    color: #721c24;
}

.stat-card.degraded .stat-percent {
    color: #721c24;
}

/* Объединенный блок истории позиций и изменений */
.position-history-combined-block {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    padding: 15px;
}

.combined-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
    overflow: visible;
}

.combined-block-header h3 {
    flex-shrink: 0;
    margin: 0;
}

.header-title-section {
    display: flex !important;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.header-title-section .period-dropdown-wrapper {
    display: inline-block !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.header-title-section #period-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    padding: 8px 15px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    visibility: visible !important;
    opacity: 1 !important;
    background-color: #f0f0f1 !important;
    border: 1px solid #8c8f94 !important;
    color: #2c3338 !important;
}

.header-actions-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Выпадающее меню периода */
.period-dropdown-wrapper {
    position: relative;
    display: inline-block !important;
    z-index: 10;
    margin-right: 10px;
}

#period-filter-btn {
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
}

.period-dropdown-wrapper .arrow-icon {
    font-size: 10px;
    vertical-align: middle;
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.2s;
}

.period-dropdown-wrapper.active .arrow-icon {
    transform: rotate(180deg);
}

.period-btn-with-arrow {
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.period-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 15px;
    min-width: 280px;
    z-index: 1000;
}

.period-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.period-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.period-filter-group .ctr-lab-input {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
}

.period-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.period-filter-actions .ctr-lab-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

.combined-block-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.changes-stats-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.changes-label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.changes-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.change-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.change-item .change-icon {
    font-size: 14px;
    font-weight: bold;
}

.change-item .change-count {
    font-size: 13px;
    font-weight: 600;
}

.change-item .change-percent {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 3px;
}

.change-item.improved {
    background: #d4edda;
    color: #155724;
}

.change-item.degraded {
    background: #f8d7da;
    color: #721c24;
}

.change-item.unchanged {
    background: #fff3cd;
    color: #856404;
}

.change-item.new {
    background: #d1ecf1;
    color: #0c5460;
}

.position-history-table-wrapper {
    overflow-x: auto;
}

.position-history-table-wrapper table {
    margin-top: 0;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .combined-block-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .combined-block-header h3 {
        margin-bottom: 10px;
    }
    
    .changes-stats-compact {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .changes-label {
        font-size: 12px;
    }
    
    .changes-items {
        width: 100%;
        justify-content: space-between;
    }
    
    .change-item {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
}

/* Старые стили для обратной совместимости */
.position-changes-stats {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.changes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.change-card {
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

.change-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: normal;
}

.change-card .change-value {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.change-card.improved {
    background: #d4edda;
    color: #155724;
}

.change-card.degraded {
    background: #f8d7da;
    color: #721c24;
}

.change-card.unchanged {
    background: #fff3cd;
    color: #856404;
}

.change-card.new {
    background: #d1ecf1;
    color: #0c5460;
}

.position-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
    flex-wrap: wrap;
}

/* Расширенная аналитика позиций */
.position-analytics {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.analytics-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.analytics-period-toggle {
    display: flex;
    gap: 5px;
}

.period-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.period-btn:hover {
    background: #f5f5f5;
}

.period-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.analytics-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.analytics-card h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-value {
    font-size: 28px;
    font-weight: 700;
    color: #0073aa;
    margin: 5px 0;
}

.analytics-value.improved {
    color: #28a745;
}

.analytics-value.degraded {
    color: #dc3545;
}

.analytics-change {
    font-size: 12px;
    margin-top: 5px;
}

.analytics-change.change-positive {
    color: #28a745;
}

.analytics-change.change-negative {
    color: #dc3545;
}

/* Прогнозирование */
.position-forecast {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.position-forecast h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.forecast-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.forecast-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.forecast-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.forecast-value {
    font-size: 32px;
    font-weight: 700;
    color: #0073aa;
    margin: 10px 0;
}

.forecast-description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.position-forecast.trend-improving {
    border-left: 4px solid #28a745;
}

.position-forecast.trend-degrading {
    border-left: 4px solid #dc3545;
}

.position-forecast.trend-stable {
    border-left: 4px solid #ffc107;
}

.forecast-chart-container {
    margin-top: 20px;
    height: 300px;
}

/* Сравнение периодов */
.position-comparison {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.position-comparison h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.comparison-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    align-items: end;
}

.comparison-period {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.comparison-period label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.comparison-period input {
    flex: 1;
}

.comparison-results {
    margin-top: 20px;
}

.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table-wrapper .ctr-lab-data-table td.change-positive {
    color: #28a745;
    font-weight: 600;
}

.comparison-table-wrapper .ctr-lab-data-table td.change-negative {
    color: #dc3545;
    font-weight: 600;
}

.comparison-table-wrapper .ctr-lab-data-table td.change-neutral {
    color: #856404;
    font-weight: 600;
}

.position-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.position-chart-container {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    height: 400px;
}

.collapsible-chart {
    transition: all 0.3s ease;
}

.collapsible-chart.collapsed {
    height: auto;
}

.collapsible-chart.collapsed .chart-content-wrapper {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.collapsible-chart.collapsed .chart-full-view {
    display: none;
}

.collapsible-chart.collapsed .chart-mini-preview {
    display: block;
}

.collapsible-chart:not(.collapsed) .chart-mini-preview {
    display: none;
}

.collapsible-chart:not(.collapsed) .chart-full-view {
    display: block;
}

.chart-content-wrapper {
    position: relative;
    transition: max-height 0.3s ease;
}

.chart-mini-preview {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
    height: 180px;
}

.chart-mini-preview canvas {
    width: 100%;
    height: 180px;
    max-width: 100%;
}

.chart-toggle-btn {
    padding: 5px 10px;
    min-width: auto;
}

.chart-toggle-btn .toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.collapsible-chart.collapsed .chart-toggle-btn .toggle-icon {
    transform: rotate(-90deg);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chart-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.position-history-table-wrapper {
    overflow-x: auto;
}

/* Таблица истории позиций */
.position-history-table-section {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 30px;
}

.table-section-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e0e0e0;
}

.table-section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
}

.history-search-controls {
    display: flex;
    align-items: center;
    min-width: 250px;
    margin-right: 15px;
}

.history-search-controls input {
    width: 100%;
    max-width: 300px;
}

.history-table-controls {
    flex: 1;
    min-width: 0;
}

/* Блок графика истории показателей (кнопка «График» в разделе История позиций) */
.position-history-chart-block {
    margin-bottom: 16px;
}

.position-history-chart-block .positions-chart-container {
    margin-bottom: 0;
}

/* Строка показателей под графиком (Запросов, Средняя позиция, 1-10 и т.д.) */
.history-table-stats-row {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

/* График изменения позиций */
.positions-chart-container {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    padding: 5px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.chart-legend-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.chart-legend-controls .checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}

.chart-legend-controls .checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.chart-content {
    position: relative;
    height: 400px;
}

.chart-content canvas {
    max-height: 400px;
}

#toggle-positions-chart .toggle-icon {
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.3s;
}

/* Выбор поисковой системы */
.search-engine-selector {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
    margin-bottom: 10px;
}

.search-engine-selector label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.search-engine-selector .ctr-lab-select {
    min-width: 150px;
}

.date-selection-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.date-selection-controls label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.date-selection-controls .calendar-container {
    position: relative;
}

.date-input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.date-range-input {
    min-width: 200px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}

.calendar-toggle-btn {
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-toggle-btn:hover {
    background: #f5f5f5;
}

.date-range-calendar {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px;
    padding-right: 42px;
}

.date-range-calendar-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: #f0f0f0;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.date-range-calendar-close:hover {
    background: #e0e0e0;
    color: #333;
}

.date-range-calendar-close .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.date-range-calendar-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.date-range-calendar-actions .ctr-lab-btn {
    padding: 6px 14px;
    font-size: 12px;
}

.date-range-calendar-compare {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.date-range-calendar-compare .date-range-calendar-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

.date-range-calendar-compare .date-range-calendar-checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Календарь в истории позиций — поверх таблицы, под строкой с датами */
.history-toolbar-in-pagination .date-range-calendar {
    position: fixed;
    top: auto;
    left: auto;
    margin-top: 0;
    z-index: 10000;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

/* Стили для jQuery UI datepicker с датами снятия позиций */
.ui-datepicker .has-position-data {
    background-color: #e3f2fd !important;
    font-weight: bold;
}

.ui-datepicker .has-position-data a {
    color: #1976d2 !important;
}

.ui-datepicker .no-position-data {
    opacity: 0.4;
    cursor: not-allowed !important;
}

.ui-datepicker .no-position-data a {
    color: #ccc !important;
    cursor: not-allowed !important;
    text-decoration: line-through;
}

.ui-datepicker .ui-state-disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
}

.ui-datepicker .ui-state-disabled a {
    color: #ccc !important;
    cursor: not-allowed !important;
}

.ui-datepicker .selected-date {
    background-color: #2196f3 !important;
    color: #fff !important;
}

.ui-datepicker .selected-date a {
    color: #fff !important;
    font-weight: bold;
}

.date-selection-controls .ctr-lab-btn {
    padding: 6px 15px;
    font-size: 13px;
    white-space: nowrap;
}

/* Современный календарь с 3 месяцами */
.calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.calendar-nav-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.calendar-nav-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.calendar-months-container {
    display: flex;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

.calendar-month {
    flex: 1;
    min-width: 280px;
}

.calendar-month-header {
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 5px;
}

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: #666;
    padding: 8px 4px;
    background: #f8f9fa;
    border-radius: 4px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    background: #fff;
    border: 1px solid transparent;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
    border: none;
}

.calendar-day.no-data {
    color: #ccc;
    cursor: not-allowed;
    background: #f9f9f9;
}

/* Даты, по которым есть данные в истории позиций */
.calendar-day.has-data:not(.empty):not(.selected) {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
}

.calendar-day.has-data:not(.empty):not(.no-data):hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: scale(1.05);
}

.calendar-day.selected {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
    border-color: #005a87;
}

.calendar-day.range-start {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
    border-top-left-radius: 50%;
    border-bottom-left-radius: 50%;
}

.calendar-day.range-end {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
    border-top-right-radius: 50%;
    border-bottom-right-radius: 50%;
}

.calendar-day.selected:not(.range-start):not(.range-end) {
    background: #e3f2fd;
    color: #0073aa;
    border-color: #2196f3;
}

.ctr-lab-history-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.ctr-lab-history-main {
    flex: 1;
    min-width: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ctr-lab-history-sidebar {
    width: 360px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.ctr-lab-history-sidebar .sidebar-header {
    margin-bottom: 10px;
    padding: 3px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.ctr-lab-history-sidebar .groups-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 0 15px 10px 15px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.ctr-lab-history-sidebar .groups-sort label {
    flex-shrink: 0;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.ctr-lab-history-sidebar .groups-sort select {
    flex: 1;
    min-width: 0;
    padding: 2px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

.ctr-lab-history-sidebar .groups-list {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    position: relative;
    padding: 0 15px;
}

.history-table-scroll-container {
    position: relative;
    flex: 1;
    min-height: 0;
}

.history-table-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0;
    border-bottom: 1px solid #ddd;
    max-height: 0;
    visibility: hidden;
}

.history-table-scroll-top-inner {
    height: 1px;
    min-width: 0;
}

.history-table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: visible; /* Без вертикального скролла — все 100 запросов на странице */
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    /* Высота подстраивается под контент — без ограничения и скролла */
}

.history-table-scroll-wrapper.has-scroll {
    overflow-x: auto;
}

#position-history-dates-table {
    min-width: 100%;
    font-size: 10px;
    border-collapse: collapse;
}

#position-history-dates-table th,
#position-history-dates-table td {
    font-size: 11px;
}

#position-history-dates-table th {
    background: #f5f5f5;
    font-weight: 600;
    padding: 0 8px;
    line-height: 18px;
    height: 18px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #ddd;
    overflow: hidden;
}

#position-history-dates-table th:first-child,
#position-history-dates-table th:nth-child(2),
#position-history-dates-table th:nth-child(3),
#position-history-dates-table th:nth-child(4),
#position-history-dates-table th:nth-child(5),
#position-history-dates-table th:nth-child(6) {
    position: sticky;
    background: #f5f5f5;
    z-index: 11;
}

/* Колонка 1: чекбокс */
#position-history-dates-table th:first-child {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    left: 0;
    z-index: 15;
}

/* Колонка 2: № — по ширине числа (до 4 цифр: 1–9999) */
#position-history-dates-table th.col-num,
#position-history-dates-table td.col-num {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
}
#position-history-dates-table th.col-num {
    left: 30px;
    z-index: 14;
}

/* Колонка 3: Запрос */
#position-history-dates-table th:nth-child(3) {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    left: 62px;
    z-index: 13;
}

/* Колонка 4: Группы */
#position-history-dates-table th:nth-child(4) {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    left: 362px;
    z-index: 12;
}

/* Колонки 5–6: W, !W */
#position-history-dates-table th:nth-child(5) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    text-align: center;
    left: 562px;
    z-index: 11;
}

#position-history-dates-table th:nth-child(6) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    text-align: center;
    left: 622px;
    z-index: 11;
}

/* Hover для sticky заголовков */
#position-history-dates-table thead:hover th {
    background: #f5f5f5;
}

#position-history-dates-table tbody tr:hover td:first-child,
#position-history-dates-table tbody tr:hover td.col-num,
#position-history-dates-table tbody tr:hover td:nth-child(3),
#position-history-dates-table tbody tr:hover td:nth-child(4),
#position-history-dates-table tbody tr:hover td:nth-child(5),
#position-history-dates-table tbody tr:hover td:nth-child(6) {
    background: #f9f9f9;
    z-index: 2;
}

#position-history-dates-table td {
    padding: 2px 4px;
    line-height: 18px;
    height: 18px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
}

#position-history-dates-table td:first-child,
#position-history-dates-table td.col-num,
#position-history-dates-table td:nth-child(3),
#position-history-dates-table td:nth-child(4),
#position-history-dates-table td:nth-child(5),
#position-history-dates-table td:nth-child(6) {
    position: sticky;
    background: #fff;
    z-index: 1;
}

/* Фиксированные ширины для ячеек: 1=чекбокс, 2=№, 3=Запрос, 4=Группы, 5=W, 6=!W */
#position-history-dates-table td:first-child {
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    left: 0;
    text-align: center;
}

#position-history-dates-table td.col-num {
    left: 30px;
    text-align: center;
}

#position-history-dates-table td:nth-child(3) {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    left: 62px;
}

#position-history-dates-table td:nth-child(4) {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    left: 362px;
}

#position-history-dates-table td:nth-child(5) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    left: 562px;
    text-align: center;
}

#position-history-dates-table td:nth-child(6) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    left: 622px;
    text-align: center;
}


#position-history-dates-table tbody tr:hover {
    background: #f9f9f9;
}

/* При разрешении 1920×1080 и меньше — уменьшенные столбцы Запрос и Группы */
@media (max-width: 1920px) {
    #position-history-dates-table th:nth-child(3),
    #position-history-dates-table td:nth-child(3) {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }
    #position-history-dates-table th:nth-child(4),
    #position-history-dates-table td:nth-child(4) {
        width: 150px;
        min-width: 150px;
        max-width: 150px;
    }
    #position-history-dates-table th:nth-child(3) { left: 62px; }
    #position-history-dates-table th:nth-child(4) { left: 282px; }
    #position-history-dates-table th:nth-child(5) { left: 432px; }
    #position-history-dates-table th:nth-child(6) { left: 492px; }
    #position-history-dates-table td:nth-child(3) { left: 62px; }
    #position-history-dates-table td:nth-child(4) { left: 282px; }
    #position-history-dates-table td:nth-child(5) { left: 432px; }
    #position-history-dates-table td:nth-child(6) { left: 492px; }
}

/* Ячейка Запрос: ссылка + текст с прокруткой */
#position-history-dates-table td.history-query-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
#position-history-dates-table .history-query-text {
    flex: 1;
    min-width: 0;
}

/* Обёртки для прокрутки при наведении в столбцах Запрос и Группы */
#position-history-dates-table .history-query-text,
#position-history-dates-table .history-groups-text {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#position-history-dates-table .history-query-text::-webkit-scrollbar,
#position-history-dates-table .history-groups-text::-webkit-scrollbar {
    display: none;
}
#position-history-dates-table .history-query-text.is-scrolling,
#position-history-dates-table .history-groups-text.is-scrolling {
    overflow-x: auto;
}

/* Статистика таблицы истории */
.history-table-stats {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 0px 0;
    flex: 1;
}

.history-table-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 12px;
    user-select: none;
    position: relative;
}

.history-table-stats .stat-item:hover {
    background-color: #f0f0f0;
}

.history-table-stats .stat-item.active {
    background-color: #0073aa;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.3);
}

.history-table-stats .stat-item.active .stat-label,
.history-table-stats .stat-item.active .stat-value,
.history-table-stats .stat-item.active .stat-percent {
    color: #fff;
}

/* Убеждаемся, что дочерние элементы не блокируют клики */
.history-table-stats .stat-item * {
    pointer-events: none;
}

.history-table-stats .stat-item.improved {
    background-color: #d4edda;
    color: #155724;
}

.history-table-stats .stat-item.improved:hover {
    background-color: #c3e6cb;
}

.history-table-stats .stat-item.improved.active {
    background-color: #0073aa;
    color: #fff;
}

.history-table-stats .stat-item.degraded {
    background-color: #f8d7da;
    color: #721c24;
}

.history-table-stats .stat-item.degraded:hover {
    background-color: #f5c6cb;
}

.history-table-stats .stat-item.degraded.active {
    background-color: #0073aa;
    color: #fff;
}

.history-table-stats .stat-label {
    font-weight: 600;
}

.history-table-stats .stat-value {
    font-weight: bold;
}

/* Сортируемые заголовки */
.sortable-header {
    position: relative;
}

.sortable-header:hover {
    background-color: #e8e8e8 !important;
}

/* Пагинация */
/* Строка над таблицей истории: поиск и управление слева, пагинация справа (компактно) */
.history-pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 8px;
}

.history-toolbar-in-pagination {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}

.history-toolbar-in-pagination .history-search-controls {
    min-width: 180px;
    max-width: 220px;
    margin-right: 0;
}

.history-toolbar-in-pagination .history-search-controls input {
    max-width: 100%;
    padding: 5px 8px;
    font-size: 12px;
}

.history-toolbar-in-pagination .history-table-controls {
    flex: 1;
    min-width: 0;
}

.history-toolbar-in-pagination .date-selection-controls {
    padding: 4px 6px;
    gap: 6px;
    background: #f8f8f8;
    border-radius: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.history-toolbar-in-pagination .date-selection-controls label {
    font-size: 11px;
    font-weight: 600;
}

.history-toolbar-in-pagination .date-selection-controls .date-range-input {
    min-width: 140px;
    padding: 4px 8px;
    font-size: 11px;
}

.history-toolbar-in-pagination .date-selection-controls .calendar-toggle-btn {
    padding: 4px 8px;
}

.history-toolbar-in-pagination .date-selection-controls .ctr-lab-btn {
    padding: 4px 10px;
    font-size: 11px;
}

.history-toolbar-in-pagination .checkbox-label {
    font-size: 11px;
}

.history-toolbar-in-pagination .queries-search-engine-filters .search-engine-filter-block {
    padding: 4px 10px;
    font-size: 11px;
}

.history-toolbar-in-pagination .collect-positions-controls .ctr-lab-btn {
    padding: 4px 10px;
    font-size: 11px;
}

/* Столбец «Показать ещё» в таблице истории позиций — бирюзовый почти прозрачный фон */
.history-show-more-col {
    white-space: nowrap;
    min-width: 120px;
    vertical-align: middle;
    background: rgba(0, 188, 212, 0.08);
    border-left: 1px solid rgba(0, 188, 212, 0.2);
}
.history-show-more-col .history-show-more-dates-btn {
    padding: 4px 10px;
    font-size: 12px;
}
.history-show-more-cell {
    min-width: 120px;
    background: rgba(0, 188, 212, 0.06);
    border-left: 1px solid rgba(0, 188, 212, 0.15);
}

.history-pagination-row .history-table-pagination-top {
    flex-shrink: 0;
    margin: 0;
}

.history-table-pagination-top,
.history-table-pagination-bottom {
    margin: 8px 0;
	display: block;
}

.pagination-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 11px;
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 3px 8px;
    font-size: 11px;
    min-width: 28px;
}

.pagination-dots {
    padding: 0 3px;
    color: #666;
    font-size: 11px;
}

.change-improved {
    color: #155724;
    font-weight: bold;
}

.change-degraded {
    color: #721c24;
    font-weight: bold;
}

.change-unchanged {
    color: #856404;
}

.change-new {
    color: #0c5460;
    font-weight: bold;
}

/* Стили для стоплиста */
.ctr-lab-stoplist-container {
    margin: 20px 0;
}

.stoplist-header {
    margin-bottom: 20px;
}

.stoplist-description {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
    line-height: 1.6;
}

.stoplist-actions {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.add-stopword-form,
.bulk-add-stopwords,
.cleanup-actions {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.add-stopword-form:last-child,
.bulk-add-stopwords:last-child,
.cleanup-actions:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.add-stopword-form h3,
.bulk-add-stopwords h3,
.cleanup-actions h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
}

.add-stopword-form .form-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.add-stopword-form .form-group input {
    flex: 1;
}

.form-hint {
    color: #666;
    font-size: 12px;
    margin: 5px 0 0 0;
}

.bulk-add-stopwords textarea {
    width: 100%;
    margin-bottom: 10px;
}

.cleanup-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.stopwords-list-section {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stopwords-list-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.stopwords-count {
    color: #666;
    font-weight: normal;
    font-size: 14px;
}

.no-stopwords {
    color: #666;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.stopwords-filters {
    margin-bottom: 15px;
}

.stopwords-table-wrapper {
    overflow-x: auto;
}

.stopwords-table-wrapper .lemmatized-version {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

/* Стили для экспорта/импорта */
.ctr-lab-export-import-container {
    margin: 20px 0;
}

/* Превью файла импорта: заголовки в размер ячеек, без наложения */
.import-preview-table-wrap .import-preview-table {
    table-layout: fixed;
}
.import-preview-table-wrap .import-preview-th {
    padding: 8px;
    min-width: 60px;
    max-width: 120px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    line-height: 1.3;
    vertical-align: top;
}
.import-preview-table-wrap .import-preview-table td {
    min-width: 60px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-import-header {
    margin-bottom: 30px;
}

/* Стили для вкладок */
.ctr-lab-tabs {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.ctr-lab-tab-nav {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f9f9f9;
}

.ctr-lab-tab-btn {
    padding: 15px 30px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    position: relative;
    margin-bottom: -2px;
}

.ctr-lab-tab-btn:hover {
    color: #0073aa;
    background: #f0f0f0;
}

.ctr-lab-tab-btn.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
    background: #fff;
}

.ctr-lab-tab-content {
    display: none;
    padding: 20px;
}

.ctr-lab-tab-content.active {
    display: block;
}

.export-section,
.import-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.ctr-lab-tab-content .export-section,
.ctr-lab-tab-content .import-section {
    box-shadow: none;
    background: #f9f9f9;
}

.export-section h3,
.import-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.section-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
}

.export-form,
.import-form {
    margin-top: 20px;
}

.columns-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.columns-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.export-filters select,
.export-filters label {
    min-width: 150px;
}

/* Стили для настроек проекта */
.ctr-lab-project-settings-container {
    margin: 20px 0;
}

.settings-header {
    margin-bottom: 20px;
}

.ctr-lab-settings-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.ctr-lab-settings-subtabs .settings-subtab {
    padding: 8px 16px;
    text-decoration: none;
    color: #555;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.ctr-lab-settings-subtabs .settings-subtab:hover {
    background: #f5f5f5;
    color: #0073aa;
}

.ctr-lab-settings-subtabs .settings-subtab.active {
    background: #0073aa;
    color: #fff;
}

.settings-section {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.settings-form {
    margin-top: 20px;
}

.settings-form .form-group {
    margin-bottom: 20px;
}

.settings-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.settings-form .form-hint {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    margin-bottom: 0;
}

.current-region-info {
    margin-top: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 3px;
    color: #333;
}

.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.settings-danger-zone {
    border: 2px solid #dc3232;
    background: #fff5f5;
}

.settings-danger-zone h3 {
    color: #dc3232;
    border-bottom-color: #dc3232;
}

.danger-actions {
    margin-top: 20px;
}

.danger-item {
    padding: 15px;
    background: #fff;
    border-radius: 5px;
    margin-bottom: 15px;
}

.danger-item h4 {
    margin-top: 0;
    color: #dc3232;
}

.danger-item p {
    color: #666;
    margin-bottom: 15px;
}

/* Стили для уведомлений */
.ctr-lab-notifications-widget {
    position: relative;
    display: inline-block;
}

.notifications-toggle {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 20px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3232;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    margin-top: 10px;
}

.notifications-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 {
    margin: 0;
    font-size: 16px;
}

.mark-all-read {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    transition: background 0.2s;
}

.notification-item.unread {
    background: #f0f8ff;
}

.notification-item.read {
    opacity: 0.7;
}

.notification-icon {
    font-size: 20px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.notification-message {
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
}

.notification-time {
    color: #999;
    font-size: 11px;
}

.notification-actions {
    display: flex;
    gap: 5px;
}

.notification-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    padding: 5px;
}

.notification-actions button:hover {
    color: #0073aa;
}

.delete-notification {
    font-size: 18px;
    line-height: 1;
}

.no-notifications {
    padding: 30px;
    text-align: center;
    color: #999;
}

.notifications-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.notifications-footer a {
    color: #0073aa;
    text-decoration: none;
}

/* Стили для страницы уведомлений */
.ctr-lab-notifications-page {
    margin: 20px 0;
}

.notifications-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.notifications-page-header h2 {
    margin: 0;
}

.notification-item-page {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    transition: all 0.2s;
}

.notification-item-page:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.notification-icon-page {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #f0f0f0;
}

.notification-item-page.type-module .notification-icon-page {
    background: #e8f5e9;
    color: #4caf50;
}

.notification-item-page.type-limit .notification-icon-page {
    background: #fff3e0;
    color: #ff9800;
}

.notification-item-page.type-position .notification-icon-page {
    background: #e3f2fd;
    color: #2196f3;
}

.notification-item-page.type-shared .notification-icon-page {
    background: #f3e5f5;
    color: #9c27b0;
}

.notification-item-page.type-invite .notification-icon-page {
    background: #e1f5fe;
    color: #00bcd4;
}

.notification-item-page.type-default .notification-icon-page {
    background: #f5f5f5;
    color: #757575;
}
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.notification-item-page.unread {
    border-left: 4px solid #0073aa;
}

.notification-content-page {
    flex: 1;
    min-width: 0;
}

.notifications-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

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

.notifications-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.notifications-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notifications-filters label {
    font-weight: 500;
    white-space: nowrap;
}
}

.notification-title-page {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 8px;
}

.notification-message-page {
    color: #666;
    margin-bottom: 8px;
}

.notification-time-page {
    color: #999;
    font-size: 12px;
}

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

/* Стили для статистики и графиков */
.ctr-lab-dashboard-stats {
    margin: 20px 0;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #0073aa;
    margin-bottom: 0px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-section {
    background: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-section.full-width {
    grid-column: 1 / -1;
}

.chart-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.chart-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-section canvas {
    max-height: 400px;
}

/* Адаптивность для мобильных устройств */
/* ============================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================ */

@media (max-width: 768px) {
    /* Общие стили */
    .ctr-lab-dashboard,
    .ctr-lab-projects,
    .ctr-lab-cabinet-management,
    .ctr-lab-cabinet-users {
        padding: 10px;
    }
    
    .ctr-lab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* Breadcrumbs */
    .ctr-lab-breadcrumbs {
        padding: 8px 0;
        font-size: 12px;
    }
    
    .breadcrumb-list {
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .breadcrumb-item {
        font-size: 12px;
    }
    
    .breadcrumb-separator {
        margin: 0 5px;
    }
    
    /* Быстрый поиск */
    .ctr-lab-quick-search {
        width: 100%;
        max-width: 100%;
        margin: 10px 0;
    }
    
    .quick-search-results {
        max-height: 300px;
    }
    
    .ctr-lab-nav {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .ctr-lab-nav-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Статистика */
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ctr-lab-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Графики */
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Мобильное меню навигации */
    .mobile-nav-toggle {
        display: block;
        width: 100%;
    }
    
    .ctr-lab-project-nav {
        display: none;
        flex-direction: column;
        gap: 5px;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .ctr-lab-project-nav.active {
        display: flex;
    }
    
    .ctr-lab-project-nav .nav-item {
        padding: 10px 15px;
        font-size: 14px;
        border-bottom: 1px solid #eee;
        margin-bottom: 0;
        border-radius: 3px;
    }
    
    .ctr-lab-project-nav .nav-item:last-child {
        border-bottom: none;
    }
    
    .ctr-lab-project-nav .nav-item:hover,
    .ctr-lab-project-nav .nav-item.active {
        background: #f0f8ff;
        border-bottom-color: transparent;
    }

    .ctr-lab-project-nav .nav-dropdown-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .ctr-lab-project-nav .nav-dropdown {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        margin-top: 0;
        padding: 0 0 0 20px;
        background: #f9f9f9;
        display: none;
    }

    .ctr-lab-project-nav .nav-dropdown-wrap:hover .nav-dropdown {
        display: none;
    }

    .ctr-lab-project-nav .nav-dropdown-wrap.open .nav-dropdown {
        display: block;
    }

    .ctr-lab-project-nav .nav-dropdown .nav-dropdown-item {
        padding: 10px 15px;
        border-bottom: 1px solid #eee;
    }

    .ctr-lab-project-nav .nav-dropdown .nav-dropdown-item:last-child {
        border-bottom: none;
    }
    
    /* Таблицы */
    .ctr-lab-queries-layout {
        flex-direction: column;
        min-height: calc(100vh - 140px); /* Минимальная высота для мобильных устройств */
    }
    
    .ctr-lab-queries-sidebar {
        width: 100%;
        margin-bottom: 20px;
        min-height: auto; /* На мобильных устройствах сайдбар не должен иметь фиксированную минимальную высоту */
    }
    
    .queries-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .ctr-lab-input,
    .ctr-lab-select {
        width: 100%;
    }
    
    .queries-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ctr-lab-data-table {
        min-width: 600px;
    }
    
    /* Модальные окна */
    .ctr-lab-modal {
        width: 95%;
        max-width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        padding: 15px;
    }
    
    /* Формы */
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    /* Кнопки */
    .ctr-lab-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .queries-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .queries-actions .ctr-lab-btn {
        width: 100%;
    }
    
    /* Карточки проектов */
    .ctr-lab-projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ctr-lab-project-card {
        padding: 15px;
    }
    
    .project-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .project-actions .ctr-lab-btn {
        width: 100%;
    }
    
    .project-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Карточки статистики */
    .position-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card h3 {
        font-size: 13px;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    /* Фильтры позиций */
    .position-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    /* История позиций */
    .position-chart-container {
        height: 300px;
        padding: 15px;
    }
    
    /* Стоплист */
    .stoplist-actions {
        padding: 15px;
    }
    
    .add-stopword-form,
    .bulk-add-stopwords {
        flex-direction: column;
    }
    
    /* Экспорт/Импорт */
    .export-import-container {
        padding: 15px;
    }
    
    .columns-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Настройки проекта */
    .project-settings-container {
        padding: 15px;
    }
    
    /* Уведомления */
    .notification-item-page {
        flex-direction: column;
        gap: 10px;
    }
    
    .notification-actions-page {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Конкуренты */
    .competitors-container {
        padding: 15px;
    }
    
    .competitors-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Прогресс модулей */
    .ctr-lab-module-progress {
        padding: 15px;
    }
    
    .modules-progress-list {
        gap: 10px;
    }
    
    .module-progress-item {
        padding: 10px;
    }
    
    /* Настройки модулей */
    .module-settings-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .modules-column {
        width: 100%;
    }
    
    .module-item {
        padding: 12px;
        font-size: 14px;
    }
    
    .module-handle {
        font-size: 18px;
        padding: 5px 10px;
        cursor: grab;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .module-item:active .module-handle {
        cursor: grabbing;
    }
    
    .module-settings-actions {
        flex-direction: column;
    }
    
    .module-settings-actions .ctr-lab-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    /* Общие стили */
    .ctr-lab-dashboard,
    .ctr-lab-projects,
    .ctr-lab-cabinet-management,
    .ctr-lab-cabinet-users {
        padding: 8px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .position-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ctr-lab-header h1 {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* Breadcrumbs */
    .breadcrumb-item {
        font-size: 11px;
    }
    
    /* Навигация */
    .ctr-lab-nav {
        flex-direction: column;
    }
    
    .ctr-lab-nav-item {
        width: 100%;
        text-align: center;
    }
    
    /* Кнопки */
    .ctr-lab-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* Таблицы - карточный вид */
    /* Убираем скрытие таблицы запросов на мобильных */
    #queries-table,
    .queries-table-wrapper .ctr-lab-data-table {
        display: table !important;
        min-width: 100%;
    }
    
    .ctr-lab-data-table-mobile {
        display: block;
    }
    
    /* Модальные окна */
    .ctr-lab-modal {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    /* Фильтры */
    .ctr-lab-projects-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    /* Графики */
    .position-chart-container {
        height: 250px;
        padding: 10px;
    }
    
    .chart-section {
        padding: 10px;
    }
    
    /* Быстрые действия */
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-action-btn {
        padding: 15px;
    }
    
    .stat-card .stat-value {
        font-size: 18px;
    }
    
    .columns-selector {
        grid-template-columns: 1fr;
    }
}

.group-info {
    flex: 1;
    display: flex;
    flex-direction: row; /* explicitly set row direction */
    align-items: center;
    gap: 2px;
    min-width: 0; /* allow text truncation inside */
    overflow: hidden; /* prevent content from breaking layout */
}

.group-name {
    font-weight: 500;
    font-size: 10px;
    flex: 1;
    min-width: 0;           /* enable ellipsis */
    overflow: hidden;       /* enable ellipsis */
    white-space: nowrap;    /* keep on one line */
    text-overflow: ellipsis;/* show ellipsis for long names */
    display: flex;          /* flex container for name and stats */
    align-items: center;    /* vertically center content */
    gap: 0;                 /* no gap between name and stats */
}

.group-name-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;       /* clipped by default */
    white-space: nowrap;
    overflow-y: hidden;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge legacy */
}

.group-name-text::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.group-name-text.is-scrolling {
    overflow-x: auto; /* enable horizontal scroll during hover animation */
}

/* Стили для ссылок в таблицах с движением при наведении */
#queries-table td a,
#position-history-dates-table td a {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    color: #0073aa;
}

#queries-table td .url-link-wrapper,
#position-history-dates-table td .url-link-wrapper {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
}

#queries-table td .url-link-text,
#position-history-dates-table td .url-link-text {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    overflow-y: hidden;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge legacy */
}

#queries-table td .url-link-text::-webkit-scrollbar,
#position-history-dates-table td .url-link-text::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

#queries-table td .url-link-text.is-scrolling,
#position-history-dates-table td .url-link-text.is-scrolling {
    overflow-x: auto; /* enable horizontal scroll during hover animation */
}

/* Кнопка перехода в поиск (Яндекс/Google) — иконка со стрелкой */
.ctr-lab-search-link {
    display: inline-block;
    margin-right: 6px;
    padding: 0 2px;
    color: #0073aa;
    text-decoration: none;
    font-weight: bold;
    vertical-align: middle;
    line-height: 1;
}
.ctr-lab-search-link:hover {
    color: #005177;
    text-decoration: none;
}

.group-stats {
    display: flex;
    gap: 6px;
    font-size: 9px;
    opacity: 0.8;
}

.group-stats-inline {
    font-weight: normal;
    font-size: 0.9em;
    opacity: 0.8;
    margin-left: 4px;
    white-space: nowrap; /* prevent stats from wrapping */
    flex-shrink: 0; /* prevent stats from shrinking */
}

/* Стили для drag-and-drop запросов */
.query-dragging {
    opacity: 0.5;
    background: #e3f2fd !important;
}

.group-drag-over {
    background: #e8f5e9 !important;
    border: 2px dashed #4caf50 !important;
}

/* Единый компактный вид таблицы запросов (для «Все запросы» и для любой группы) */
#queries-table {
    font-size: 11px;
}

#queries-table th,
#queries-table td {
    font-size: 11px;
    padding: 3px 6px;
    line-height: 1.25;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    vertical-align: middle;
}

/* Строка «Запросы не найдены» — такой же компактный отступ */
#queries-table tbody tr td[colspan] {
    padding: 8px 6px;
    font-size: 11px;
    line-height: 1.25;
}

#queries-table tbody tr {
    cursor: move;
}

#queries-table tbody tr:hover {
    background: #f5f5f5;
}

#queries-table tbody tr.dragging {
    opacity: 0.5;
    cursor: grabbing !important;
}

/* Фиксированная ширина столбца запросов */
#queries-table th.query-column,
#queries-table td:nth-child(2) {
    min-width: 300px;
    max-width: 300px;
    width: 300px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Слова в запросе: подсветка при наведении и при фильтре по слову */
#queries-table .query-word {
    cursor: pointer;
    border-radius: 2px;
    padding: 0 1px;
}
#queries-table .query-word.word-hover {
    background: rgba(0, 123, 255, 0.2);
}
#queries-table .query-word.word-highlight {
    background: rgba(0, 123, 255, 0.35);
    font-weight: 600;
}

/* Фиксированная ширина столбца группы */
#queries-table th:nth-child(3),
#queries-table td:nth-child(3) {
    min-width: 200px;
    max-width: 200px;
    width: 200px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Фиксированная ширина столбцов с частотами W и !W */
#queries-table th:nth-child(4),
#queries-table td:nth-child(4),
#queries-table th:nth-child(5),
#queries-table td:nth-child(5) {
    min-width: 50px;
    max-width: 50px;
    width: 50px;
    text-align: center;
    white-space: nowrap;
}

/* Sticky заголовки для таблицы запросов при вертикальной прокрутке */
#queries-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

/* Убеждаемся, что заголовки не накладываются друг на друга */
#queries-table thead {
    position: relative;
    z-index: 10;
}

/* Выпадающее меню массовых действий */
#bulk-actions-menu {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 250px;
    max-width: 350px;
}

.bulk-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
}

.bulk-actions-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bulk-actions-close:hover {
    color: #333;
}

.bulk-actions-list {
    padding: 5px 0;
}

.bulk-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.bulk-action-item:hover {
    background: #f5f5f5;
}

.bulk-action-item .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #666;
}

.bulk-action-item.bulk-action-danger {
    color: #dc3232;
}

.bulk-action-item.bulk-action-danger:hover {
    background: #ffeaea;
}

#queries-table tbody tr[draggable="true"] {
    cursor: grab;
}

#queries-table tbody tr[draggable="true"]:hover {
    background-color: #f0f0f0;
}

.group-item.group-drag-over {
    background-color: #e8f5e9 !important;
    border: 2px dashed #4caf50 !important;
}

/* Убираем старые стили queries-filters */
.queries-filters {
    display: none;
}

.group-count {
    font-size: 9px;
}

.group-frequency {
    font-size: 9px;
    color: #0073aa;
    font-weight: 500;
}

.group-item.active .group-frequency {
    color: rgba(255, 255, 255, 0.9);
}

.group-actions {
    display: flex;
    gap: 5px;
    margin-left: 10px;
    white-space: nowrap; /* prevent buttons from wrapping */
    flex-shrink: 0;      /* keep actions visible on the same row */
}

.group-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
    opacity: 0.7;
}

.group-actions button:hover {
    opacity: 1;
}

.ctr-lab-queries-main {
    flex: 1;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 2px;
}

.queries-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ctr-lab-input,
.ctr-lab-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    background-color: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

.ctr-lab-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Toast уведомления */
#ctr-lab-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.ctr-lab-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
}

.ctr-lab-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.ctr-lab-toast .toast-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
}

.ctr-lab-toast.toast-success {
    border-left: 4px solid #46b450;
}

.ctr-lab-toast.toast-success .toast-icon {
    background: #46b450;
    color: #fff;
}

.ctr-lab-toast.toast-error {
    border-left: 4px solid #dc3232;
}

.ctr-lab-toast.toast-error .toast-icon {
    background: #dc3232;
    color: #fff;
}

.ctr-lab-toast.toast-warning {
    border-left: 4px solid #ffb900;
}

.ctr-lab-toast.toast-warning .toast-icon {
    background: #ffb900;
    color: #fff;
}

.ctr-lab-toast.toast-info {
    border-left: 4px solid #0073aa;
}

.ctr-lab-toast.toast-info .toast-icon {
    background: #0073aa;
    color: #fff;
}

.ctr-lab-toast .toast-content {
    flex: 1;
    min-width: 0;
}

.ctr-lab-toast .toast-message {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    word-wrap: break-word;
}

.ctr-lab-toast .toast-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.ctr-lab-toast .toast-close:hover {
    color: #333;
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Мобильная адаптация для toast */
@media (max-width: 768px) {
    #ctr-lab-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .ctr-lab-toast {
        min-width: auto;
        max-width: none;
        padding: 12px 14px;
    }
    
    .ctr-lab-toast .toast-message {
        font-size: 13px;
    }
}

/* Мобильная адаптация для валидации */
@media (max-width: 480px) {
    .field-error,
    .field-warning {
        font-size: 11px;
        margin-top: 3px;
        margin-bottom: 8px;
    }
    
    .ctr-lab-input.error,
    .ctr-lab-select.error,
    .ctr-lab-textarea.error {
        border-width: 2px;
    }
}

/* Исправление для фильтров проектов */
.ctr-lab-projects-filters .filter-group {
    position: relative;
    overflow: visible;
}

.ctr-lab-projects-filters .filter-group select {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Улучшение для мобильных устройств */
@media (max-width: 768px) {
    .ctr-lab-projects-filters {
        padding: 15px;
    }
    
    .filters-row {
        gap: 10px;
    }
    
    .filter-group .ctr-lab-select {
        font-size: 14px;
        padding: 10px 35px 10px 12px;
    }
}

.queries-table-wrapper {
    overflow-x: auto;
}

.ctr-lab-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

/* Единый компактный вид ячеек (совпадает с #queries-table) */
.ctr-lab-data-table th,
.ctr-lab-data-table td {
    padding: 3px 6px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 11px;
    line-height: 1.25;
    vertical-align: middle;
}

.ctr-lab-data-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.ctr-lab-data-table tr:hover {
    background: #f9f9f9;
}

/* Строка: поиск слева, кнопки/фильтры по центру, пагинация справа */
.queries-pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

/* Поиск по запросам — компактнее на 1920x1080, но с запасом под крестик */
.queries-search-in-pagination {
    min-width: 200px;
    max-width: 280px;
    flex-shrink: 0;
}

.queries-search-in-pagination .queries-search-wrapper {
    width: 100%;
}

.queries-search-in-pagination input.ctr-lab-input {
    padding-left: 34px;
    padding-right: 10px;
    min-width: 0;
}

/* Панель кнопок и фильтров справа от поиска */
.queries-toolbar-after-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.queries-toolbar-after-search .queries-selection-tools {
    display: flex;
    gap: 4px;
    align-items: center;
}

.queries-toolbar-after-search .queries-selection-tools .icon-btn {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.queries-toolbar-after-search .queries-selection-tools .icon-btn:hover {
    background-color: #f0f0f0;
    border-color: #0073aa;
}

.queries-toolbar-after-search .queries-selection-tools .icon-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.queries-pagination {
    display: flex;
    justify-content: flex-end;
}

.queries-pagination-top {
}

.queries-pagination-bottom {
    margin-top: 8px;
}

.pagination {
    display: flex;
    gap: 3px;
    align-items: center;
}

.page-btn {
    padding: 3px 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 3px;
    font-size: 11px;
}

.page-btn:hover {
    background: #f5f5f5;
}

.page-current {
    padding: 3px 8px;
    background: #0073aa;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
}

.edit-query-btn,
.delete-query-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
    opacity: 0.7;
}

.edit-query-btn:hover,
.delete-query-btn:hover {
    opacity: 1;
}

/* Стили для публичных страниц — на всю ширину экрана, как в разделе проектов */
.ctr-lab-public-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 24px;
    box-sizing: border-box;
    background: #fff;
    min-height: 100vh;
    font-size: 13px;
}

.ctr-lab-public-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.ctr-lab-public-header h1 {
    margin: 0;
    color: #1d2327;
    font-size: 18px;
    font-weight: 600;
}

.public-view-label {
    margin: 4px 0 0 0;
    color: #646970;
    font-size: 12px;
    font-weight: normal;
}

.ctr-lab-public-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0;
}

.ctr-lab-public-nav .nav-item {
    padding: 8px 14px;
    font-size: 13px;
    text-decoration: none;
    color: #1d2327;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: inline-block;
}

.ctr-lab-public-nav .nav-item:hover,
.ctr-lab-public-nav .nav-item.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.ctr-lab-public-content {
    margin-top: 20px;
}

/* Таблица запросов на публичной странице — не растягивать на всю ширину, как в Истории позиций */
.ctr-lab-public-page .queries-table-wrapper {
    overflow-x: auto;
}
.ctr-lab-public-page #queries-table {
    width: max-content;
    table-layout: auto;
}

/* Стили для страницы доступов */
.ctr-lab-project-access {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.public-access-section,
.users-access-section {
    margin-bottom: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

.public-access-section h2,
.users-access-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.access-toggle label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    margin-bottom: 15px;
}

.public-slug-info {
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
    font-size: 13px;
}

.public-slug-info code {
    display: inline-block;
    padding: 3px 8px;
    background: #fff;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    margin-left: 5px;
}

.public-links-section {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.public-link-item {
    margin-bottom: 15px;
}

.public-link-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.link-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.public-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    font-family: monospace;
    background: #f9f9f9;
}

.copy-link-btn {
    padding: 8px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.copy-link-btn:hover {
    background: #005a87;
}

.add-user-form {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.add-user-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.access-level-badge.level-owner {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Стили для таблицы пользователей с доступом */
.ctr-lab-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
}

.ctr-lab-table thead {
    background: #f5f5f5;
}

.ctr-lab-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
    font-size: 11px;
}

.ctr-lab-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 11px;
}

.ctr-lab-table tbody tr:hover {
    background: #f9f9f9;
}

.ctr-lab-btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

/* Стили для сортировки таблицы запросов */
.queries-table-sortable thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px !important;
    transition: background-color 0.2s;
}

.queries-table-sortable thead th.sortable:hover {
    background-color: #f0f0f0;
}

.queries-table-sortable thead th.sortable .sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.queries-table-sortable thead th.sortable:hover .sort-indicator {
    opacity: 0.6;
}

.queries-table-sortable thead th.sortable .sort-indicator.sort-asc {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #333;
    opacity: 1;
}

.queries-table-sortable thead th.sortable .sort-indicator.sort-desc {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #333;
    opacity: 1;
}

/* Стили для скрытых конкурентов */
#competitors-table tbody tr.competitor-hidden {
    opacity: 0.5;
    background-color: #f5f5f5 !important;
    color: #999;
}

#competitors-table tbody tr.competitor-hidden:hover {
    background-color: #eeeeee !important;
}

#competitors-table tbody tr.competitor-hidden td {
    color: #999;
}

#competitors-table tbody tr.competitor-hidden strong {
    color: #999;
    font-weight: normal;
}

.competitor-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.competitor-actions .ctr-lab-btn {
    white-space: nowrap;
}

/* Стили для попапа конкурентов */
.competitor-modal-content {
    max-width: 1200px !important;
}

.competitor-modal-body {
    padding: 20px;
}

.competitor-modal-layout {
    display: flex;
    gap: 20px;
    height: 600px;
}

.competitor-urls-list,
.competitor-queries-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.competitor-urls-list h4,
.competitor-queries-list h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.urls-container,
.queries-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.url-item {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.url-item:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

.url-item.active {
    background: #e7f5ff;
    border-color: #0073aa;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.url-item-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.url-item-text-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    min-width: 0;
    flex: 1;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.url-item-text-wrap::-webkit-scrollbar {
    height: 4px;
}

.url-item-text-wrap::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.url-item .url-item-text {
    color: #333;
    font-size: 13px;
    white-space: nowrap;
    display: inline-block;
}

.url-item .url-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #0073aa;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.url-item .url-icon-btn:hover {
    background-color: #f0f0f0;
    border-color: #0073aa;
    color: #005177;
}

.url-item .url-icon-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.url-item .url-open-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    vertical-align: middle;
    color: #0073aa;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
}

.url-item .url-open-link:hover {
    background-color: #f0f0f0;
    border-color: #0073aa;
    color: #005177;
}

.url-item .url-open-link .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.url-item .queries-count {
    display: inline;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12px;
    color: #666;
}

.url-link {
    display: block;
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 5px;
}

.url-link:hover {
    text-decoration: underline;
}

.queries-count {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.queries-table {
    width: 100%;
    font-size: 14px;
}

.queries-table th {
    background: #f5f5f5;
    font-weight: 600;
    padding: 10px;
    text-align: left;
}

.queries-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.queries-table tbody tr:hover {
    background: #f9f9f9;
}

.position-cell {
    text-align: center;
}

.position-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #0073aa;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.position-badge.position-project {
    background: #46b450;
}

.loading-message,
.empty-message,
.error-message {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.error-message {
    color: #dc3232;
}

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

/* Индикатор изменения URL */
.url-changed-indicator {
    display: inline-block;
    color: #ff6b00;
    font-weight: bold;
    font-size: 16px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1;
}

.url-changed-indicator:hover {
    color: #ff4500;
}

/* Рел.URL: цифра в скобках — количество найденных URL (подсказка при наведении) */
.ctr-lab-rel-url-count {
    cursor: help;
    color: #2271b1;
    font-weight: 600;
}
.ctr-lab-rel-url-link .url-link-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .competitor-modal-layout {
        flex-direction: column;
        height: auto;
        max-height: 80vh;
    }
    
    .competitor-urls-list,
    .competitor-queries-list {
        height: 300px;
    }
    
    .competitor-modal-content {
        max-width: 95% !important;
    }
}

/* Попап настроек модуля расширения запросов */
.ctr-lab-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

.ctr-lab-popup.show {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.ctr-lab-popup .popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.ctr-lab-popup .popup-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 100001;
}

.ctr-lab-popup .popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.ctr-lab-popup .popup-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.ctr-lab-popup .popup-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.2s;
}

.ctr-lab-popup .popup-close:hover {
    color: #dc3232;
}

.ctr-lab-popup .popup-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.ctr-lab-popup .popup-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ctr-lab-popup .form-group {
    margin-bottom: 20px;
}

.ctr-lab-popup .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.ctr-lab-popup .form-group .field-description {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: normal;
    margin-top: 4px;
    line-height: 1.4;
}

.ctr-lab-popup .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.ctr-lab-popup .form-control:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.ctr-lab-popup .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

body.popup-open {
    overflow: hidden;
}

/* Стили для серверных модулей REST API */
.ctr-lab-server-modules {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.server-modules-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.server-module-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.server-module-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.server-module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px;
    cursor: pointer;
    gap: 20px;
}

.server-module-info {
    flex: 1;
    min-width: 0;
}

.server-module-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.server-module-method {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.server-module-method.method-get {
    background: #e3f2fd;
    color: #1976d2;
}

.server-module-method.method-post {
    background: #e8f5e9;
    color: #388e3c;
}

.server-module-method.method-put {
    background: #fff3e0;
    color: #f57c00;
}

.server-module-method.method-delete {
    background: #ffebee;
    color: #d32f2f;
}

.server-module-description {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.server-module-endpoint {
    margin-top: 8px;
}

.server-module-endpoint code {
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    font-family: 'Courier New', monospace;
}

.server-module-actions {
    flex-shrink: 0;
}

.test-module-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
}

.test-module-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.test-module-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.server-module-details {
    padding: 0 20px 20px 20px;
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
    padding-top: 20px;
}

.server-module-params h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.server-module-params ul {
    margin: 0 0 15px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.server-module-params li {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.server-module-params code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: #d63384;
    font-family: 'Courier New', monospace;
}

.server-module-result {
    border-top: 1px solid #e0e0e0;
    margin-top: 10px;
    padding: 20px;
    background: #f9f9f9;
}

.server-module-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.server-module-result-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.close-result-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.close-result-btn:hover {
    color: #333;
}

.server-module-result-content {
    position: relative;
}

.result-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #666;
}

.result-loading .spinner {
    float: none;
    margin: 0;
}

.result-success,
.result-error {
    padding: 15px;
    border-radius: 4px;
}

.result-success {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
}

.result-error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

.result-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.result-status.success {
    color: #2e7d32;
}

.result-status.error {
    color: #c62828;
}

.result-status .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.result-meta {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.result-info {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.result-data {
    margin-top: 15px;
}

.result-json,
.result-error-message {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-json {
    color: #333;
}

.result-error-message {
    color: #c62828;
}

/* Адаптивность */
@media (max-width: 768px) {
    .server-module-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .server-module-actions {
        width: 100%;
    }
    
    .test-module-btn {
        width: 100%;
        justify-content: center;
    }
}
/* Стили для вкладки Модули сервера */
.server-modules-header {
    margin-bottom: 25px;
}

.server-modules-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.server-modules-header .description {
    color: #666;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.server-modules-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.server-modules-stats .stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.server-modules-stats .stat-label {
    font-size: 13px;
    color: #666;
}

.server-modules-stats .stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
}

.server-modules-loading {
    text-align: center;
    padding: 60px 20px;
}

.server-modules-loading .loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.server-modules-error {
    padding: 20px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    margin-bottom: 20px;
}

.server-modules-error .error-message {
    color: #c62828;
    margin: 0;
}

.server-modules-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.modules-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f9f9f9;
}

.modules-tab-btn {
    padding: 15px 30px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    position: relative;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modules-tab-btn:hover {
    color: #0073aa;
    background: #f0f0f0;
}

.modules-tab-btn.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
    background: #fff;
}

.modules-tab-btn .tab-count {
    background: #e0e0e0;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.modules-tab-btn.active .tab-count {
    background: #0073aa;
    color: #fff;
}

.modules-tab-content {
    display: none !important;
    padding: 20px;
}

.modules-tab-content.active {
    display: block !important;
}

.modules-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.server-module-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.server-module-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.server-module-card.available {
    border-left: 4px solid #4caf50;
}

.server-module-card.not-available {
    border-left: 4px solid #f44336;
    opacity: 0.8;
}

.module-card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.module-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.module-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.module-technical-name {
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.module-technical-name code {
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    font-family: 'Courier New', monospace;
}

.module-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.module-badge.available-badge {
    background: #e8f5e9;
    color: #2e7d32;
}

.module-badge.not-available-badge {
    background: #ffebee;
    color: #c62828;
}

/* Источник модуля в разделе «Модули сервера» */
.module-source-badge,
.module-badge.module-source-badge {
    margin-left: 8px;
    font-size: 11px;
}
.module-source-server,
.module-badge.module-source-server {
    background: #e3f2fd;
    color: #1565c0;
}
.module-source-local,
.module-badge.module-source-local {
    background: #f5f5f5;
    color: #616161;
}
.server-module-row .module-details .module-source-badge {
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 4px;
}

.module-card-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.module-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.module-info-item .info-label {
    color: #666;
    font-weight: 500;
}

.module-info-item .info-value {
    color: #333;
}

.module-description {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

.no-modules {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-style: italic;
}

@media (max-width: 768px) {
    .server-modules-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .modules-tabs {
        flex-direction: column;
    }
    
    .modules-tab-btn {
        width: 100%;
        justify-content: space-between;
    }
    
    .modules-list {
        grid-template-columns: 1fr;
    }
}

/* Стили для серверных модулей с drag-and-drop */
.server-modules-actions-top,
.server-modules-actions-bottom {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.server-modules-actions-top {
    margin-bottom: 20px;
}

.server-modules-actions-bottom {
    margin-top: 20px;
}

.modules-list-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.modules-list-sortable {
    min-height: 200px;
}

.server-module-row {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s;
    background: #fff;
}

.server-module-row:last-child {
    border-bottom: none;
}

.server-module-row:hover {
    background: #f9f9f9;
}

.server-module-row.inactive {
    opacity: 0.6;
}

.server-module-row .module-row-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
}

.server-module-row .module-drag-handle {
    cursor: grab;
    color: #999;
    display: flex;
    align-items: center;
    padding: 5px;
    transition: color 0.2s;
}

.server-module-row .module-drag-handle:hover {
    color: #0073aa;
}

.server-module-row .module-drag-handle:active {
    cursor: grabbing;
}

.server-module-row .module-drag-handle .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.server-module-row .module-info {
    flex: 1;
    min-width: 0;
}

.server-module-row .module-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.server-module-row .module-file-name {
    font-size: 11px;
    color: #666;
    font-weight: normal;
    opacity: 0.8;
}

.server-module-row .module-file-name code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.server-module-row .module-description {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.server-module-row .module-details {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.server-module-row .module-file-info,
.server-module-row .module-date-info {
    font-size: 11px;
}

.server-module-row .module-file-info code,
.server-module-row .module-date-info code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.server-module-row .module-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.server-module-row .module-settings-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-module-row .module-settings-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.server-module-row .module-settings-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.server-module-row .module-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.server-module-row .module-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.server-module-row .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.server-module-row .toggle-slider:before {
    position: absolute;
    content: " \;
 height: 18px;
 width: 18px;
 left: 3px;
 bottom: 3px;
 background-color: white;
 transition: .4s;
 border-radius: 50%;
}

.server-module-row .module-toggle-switch input:checked + .toggle-slider {
 background-color: #0073aa;
}

.server-module-row .module-toggle-switch input:checked + .toggle-slider:before {
 transform: translateX(26px);
}

.server-module-row.module-ghost {
 opacity: 0.4;
}

.server-module-row.module-chosen {
 background: #f0f8ff;
}

.server-module-row.module-drag {
 opacity: 0.8;
}

#server-modules-message {
 margin: 20px 0;
 padding: 15px;
 border-radius: 8px;
 display: none;
}

#server-modules-message.success {
 background: #e8f5e9;
 border: 1px solid #c8e6c9;
 color: #2e7d32;
}

#server-modules-message.error {
 background: #ffebee;
 border: 1px solid #ffcdd2;
 color: #c62828;
}

@media (max-width: 768px) {
 .server-modules-actions-top,
 .server-modules-actions-bottom {
 flex-direction: column;
 }
 
 .server-module-row .module-row-content {
 flex-wrap: wrap;
 }
 
.server-module-row .module-actions {
width: 100%;
justify-content: flex-end;
}

/* Прогресс-бар выполнения модулей на сервере */
.ctr-lab-server-task-progress {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 100;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Состояние простоя - когда нет активной задачи */
.ctr-lab-server-task-progress.progress-bar-idle {
    background: #f9f9f9;
    border-color: #e0e0e0;
}

.ctr-lab-server-task-progress.progress-bar-idle .progress-bar-title .dashicons {
    animation: none;
    color: #999;
}

.ctr-lab-server-task-progress.progress-bar-idle .progress-bar-fill {
    background: #e0e0e0;
}

.ctr-lab-server-task-progress.progress-bar-idle .progress-status {
    color: #999;
    font-style: italic;
}

/* Состояние выполнения - когда есть активная задача */
.ctr-lab-server-task-progress.progress-bar-active {
    background: #fff;
    border-color: #0073aa;
}

.ctr-lab-server-task-progress.progress-bar-active .progress-bar-title .dashicons {
    animation: spin 2s linear infinite;
    color: #0073aa;
}

.ctr-lab-server-task-progress .progress-bar-container {
    display: flex;
    flex-direction: column;
}

.ctr-lab-server-task-progress .progress-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.ctr-lab-server-task-progress .progress-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ctr-lab-server-task-progress .progress-bar-title .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ctr-lab-server-task-progress .progress-bar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ctr-lab-server-task-progress .progress-bar-stop {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.ctr-lab-server-task-progress .progress-bar-stop:hover {
    color: #c00;
}

.ctr-lab-server-task-progress .progress-bar-stop .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ctr-lab-server-task-progress .progress-bar-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctr-lab-server-task-progress .progress-bar-close:hover {
    color: #333;
}

.ctr-lab-server-task-progress .progress-bar-close .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ctr-lab-server-task-progress .progress-bar-body {
    padding: 16px;
}

.ctr-lab-server-task-progress .progress-bar-track {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.ctr-lab-server-task-progress .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa 0%, #00a0d2 100%);
    border-radius: 12px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ctr-lab-server-task-progress .progress-bar-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.ctr-lab-server-task-progress .progress-bar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.ctr-lab-server-task-progress .progress-percentage {
    font-weight: 600;
    color: #0073aa;
}

.ctr-lab-server-task-progress.progress-bar-idle .progress-percentage {
    color: #999;
    font-weight: normal;
}

.ctr-lab-server-task-progress .progress-status {
    color: #666;
}
}

/* Канбан задач */
.ctr-lab-tasks-kanban-wrapper {
    padding: 16px 0;
    min-height: 400px;
}
.ctr-lab-tasks-kanban-toolbar {
    margin-bottom: 16px;
}
.ctr-lab-tasks-kanban-loading {
    padding: 24px;
    text-align: center;
    color: #666;
}

/* Публичный канбан — шрифты и стили как в админке (компактно) */
.ctr-lab-tasks-kanban-public {
    font-size: 13px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-tasks-kanban-toolbar .ctr-lab-btn {
    font-size: 13px;
    padding: 6px 12px;
}
/* Кнопка «Предложить задачу» — современный зелёный */
.ctr-lab-task-suggest-btn {
    background: #10b981 !important;
    color: #fff !important;
    border: none;
}
.ctr-lab-task-suggest-btn:hover {
    background: #059669 !important;
    color: #fff !important;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-column-header {
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    color: #1d2327;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-column-title {
    font-size: 13px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-column-count {
    font-size: 11px;
    padding: 2px 6px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card {
    padding: 10px;
    margin-bottom: 6px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #1d2327;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card-progress {
    font-size: 11px;
    color: #646970;
    margin-bottom: 2px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card-deadline {
    font-size: 11px;
    color: #646970;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card-assignee {
    font-size: 10px;
    color: #787c82;
    margin-top: 2px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-kanban-card-label {
    font-size: 10px;
}
.ctr-lab-tasks-kanban-public .ctr-lab-tasks-kanban-loading {
    font-size: 13px;
}
.ctr-lab-kanban-columns {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 360px;
}
.ctr-lab-kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
    background: #f5f5f5;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}
.ctr-lab-kanban-column-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ctr-lab-kanban-column-count {
    background: #e0e0e0;
    color: #555;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.ctr-lab-kanban-column-cards {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 80px;
}
.ctr-lab-kanban-column-cards.ctr-lab-kanban-drop-active {
    background: #e3f2fd;
    border: 2px dashed #1976d2;
    border-radius: 4px;
}
.ctr-lab-kanban-card {
    background: #fff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.ctr-lab-kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.ctr-lab-kanban-card-dragging {
    opacity: 0.8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.ctr-lab-kanban-card-title {
    font-weight: 500;
    margin-bottom: 6px;
    word-break: break-word;
}
.ctr-lab-kanban-card-progress {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}
.ctr-lab-kanban-card-deadline {
    font-size: 12px;
    color: #555;
}
.ctr-lab-kanban-card-deadline-overdue {
    color: #c62828;
    font-weight: 600;
}
.ctr-lab-kanban-card-assignee {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}
.ctr-lab-kanban-card-label {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-weight: 600;
}
.ctr-lab-kanban-card-label-client {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}
.ctr-lab-task-suggest-hint {
    font-size: 12px;
    color: #666;
    margin: 0 0 12px 0;
}

/* Модалка «Предложить задачу» — шрифты и стили как в админке (компактно) */
.ctr-lab-task-suggest-modal .ctr-lab-modal-content {
    font-size: 13px;
}
.ctr-lab-task-suggest-modal .ctr-lab-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #1d2327;
}
.ctr-lab-task-suggest-modal .ctr-lab-modal-close {
    font-size: 20px;
    font-weight: bold;
    color: #787c82;
}
.ctr-lab-task-suggest-modal .ctr-lab-modal-close:hover {
    color: #1d2327;
}
.ctr-lab-task-suggest-modal .ctr-lab-form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #1d2327;
}
.ctr-lab-task-suggest-modal .ctr-lab-input {
    font-size: 13px;
    padding: 6px 10px;
}
.ctr-lab-task-suggest-modal .ctr-lab-modal-footer .ctr-lab-btn {
    font-size: 13px;
    padding: 6px 12px;
}
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-hint {
    font-size: 11px;
    color: #646970;
    margin: 0 0 12px 0;
}
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-checklist-block label {
    font-size: 12px;
}
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-checklist-item,
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-checklist-title {
    font-size: 12px;
}
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-checklist-num {
    font-size: 11px;
}
.ctr-lab-task-suggest-modal .ctr-lab-task-suggest-checklist-add .ctr-lab-btn {
    font-size: 12px;
    padding: 5px 10px;
}
.ctr-lab-task-suggest-modal .ctr-lab-modal-header,
.ctr-lab-task-suggest-modal .ctr-lab-modal-body,
.ctr-lab-task-suggest-modal .ctr-lab-modal-footer {
    padding: 12px 16px;
}
.ctr-lab-task-suggest-modal .ctr-lab-form-group {
    margin-bottom: 14px;
}

.ctr-lab-task-suggest-checklist-block {
    margin-top: 12px;
}
.ctr-lab-task-suggest-checklist-list {
    list-style: none;
    margin: 0 0 10px 0;
    padding: 0;
}
.ctr-lab-task-suggest-checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.ctr-lab-task-suggest-checklist-cb {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.ctr-lab-task-suggest-checklist-cb input[type="checkbox"] {
    margin: 0;
    cursor: default;
}
.ctr-lab-task-suggest-checklist-num {
    flex-shrink: 0;
    min-width: 22px;
    font-weight: 600;
    color: #555;
}
.ctr-lab-task-suggest-checklist-title {
    flex: 1;
}
.ctr-lab-task-suggest-checklist-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    font-size: 18px;
    line-height: 1;
}
.ctr-lab-task-suggest-checklist-remove:hover {
    color: #c62828;
}
.ctr-lab-task-suggest-checklist-add {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.ctr-lab-task-suggest-checklist-add .ctr-lab-input {
    flex: 1;
}
.ctr-lab-kanban-add-card {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    margin-top: 4px;
}
.ctr-lab-kanban-add-card:hover {
    border-color: #0073aa;
    color: #0073aa;
}
.ctr-lab-task-modal .ctr-lab-modal-content,
.ctr-lab-task-add-modal .ctr-lab-modal-content {
    width: 50vw;
    max-width: 50vw;
}
.ctr-lab-task-checklist-block {
    margin-top: 16px;
}
.ctr-lab-task-checklist-progress {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}
.ctr-lab-task-checklist-list {
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
}
.ctr-lab-task-checklist-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}
.ctr-lab-task-checklist-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ctr-lab-task-checklist-item input[type="checkbox"].ctr-lab-task-checklist-done {
    flex-shrink: 0;
}
.ctr-lab-task-checklist-item .ctr-lab-task-checklist-num {
    flex-shrink: 0;
    min-width: 22px;
    font-weight: 600;
    color: #555;
}
.ctr-lab-task-checklist-title {
    flex: 1;
    min-width: 0;
}
.ctr-lab-task-checklist-item-head input:checked ~ .ctr-lab-task-checklist-title {
    text-decoration: line-through;
    color: #888;
}
.ctr-lab-task-checklist-edit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
}
.ctr-lab-task-checklist-edit:hover {
    color: #0073aa;
    background: #f0f0f0;
}
.ctr-lab-task-checklist-add-file-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: none;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
}
.ctr-lab-task-checklist-add-file-btn:hover {
    color: #0073aa;
    background: #f0f0f0;
}
.ctr-lab-task-checklist-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}
.ctr-lab-task-checklist-delete:hover {
    color: #c62828;
}
.ctr-lab-task-checklist-item-comment {
    font-size: 12px;
    color: #555;
    margin-left: 30px;
    margin-top: 1px;
    line-height: 1.3;
}
.ctr-lab-task-checklist-item-edit {
    margin-left: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ctr-lab-task-checklist-edit-actions {
    display: flex;
    gap: 8px;
}
.ctr-lab-task-checklist-drop {
    margin-left: 30px;
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}
.ctr-lab-task-checklist-drop:hover,
.ctr-lab-task-checklist-drop-over {
    border-color: #0073aa;
    color: #0073aa;
}
.ctr-lab-task-checklist-files {
    list-style: none;
    margin: 0 0 0 30px;
    padding: 0;
    font-size: 13px;
}
.ctr-lab-task-checklist-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.ctr-lab-task-checklist-file a {
    color: #0073aa;
}
.ctr-lab-task-checklist-file-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
}
.ctr-lab-task-checklist-file-delete:hover {
    color: #c62828;
}
.ctr-lab-task-checklist-add {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.ctr-lab-task-checklist-add .ctr-lab-input {
    flex: 1;
}
.ctr-lab-task-checklist-add-hours-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.ctr-lab-task-checklist-add-hours-row .ctr-lab-input {
    width: 100px;
    flex: none;
}
.ctr-lab-task-checklist-item-hours-view {
    font-size: 12px;
    color: #555;
    margin-top: 2px;
    margin-left: 28px;
    line-height: 1.3;
}
.ctr-lab-task-checklist-edit-hours-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}
.ctr-lab-task-checklist-edit-hours-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ctr-lab-task-checklist-edit-hours-row .ctr-lab-input {
    width: 80px;
}
.ctr-lab-task-checklist-total-block {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: 15px;
}
.ctr-lab-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Модалка «Новая задача»: план по пунктам с нумерацией */
.ctr-lab-task-add-checklist-block {
    margin-top: 12px;
}
.ctr-lab-task-add-checklist-list {
    list-style: none;
    margin: 0 0 10px 0;
    padding: 0;
}
.ctr-lab-task-add-checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.ctr-lab-task-add-checklist-cb {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.ctr-lab-task-add-checklist-cb input[type="checkbox"] {
    margin: 0;
    cursor: default;
}
.ctr-lab-task-add-checklist-num {
    flex-shrink: 0;
    min-width: 22px;
    font-weight: 600;
    color: #555;
}
.ctr-lab-task-add-checklist-title {
    flex: 1;
}
.ctr-lab-task-add-checklist-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    font-size: 18px;
    line-height: 1;
}
.ctr-lab-task-add-checklist-remove:hover {
    color: #c62828;
}
.ctr-lab-task-add-checklist-add {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.ctr-lab-task-add-checklist-add .ctr-lab-input {
    flex: 1;
}
.ctr-lab-task-add-checklist-item-meta {
    font-size: 12px;
    color: #666;
}
.ctr-lab-task-add-checklist-total-block {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
}
.ctr-lab-task-add-checklist-add-hours-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.ctr-lab-task-add-checklist-add-hours-row .ctr-lab-input {
    width: 100px;
    flex: none;
}

/* Планировщик модулей */
.ctr-lab-scheduler-wrapper {
    padding: 16px 0;
    max-width: 900px;
}
.ctr-lab-scheduler-form-section {
    margin-bottom: 24px;
}
.ctr-lab-scheduler-form-section h3,
.ctr-lab-scheduler-list-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
}
.ctr-lab-scheduler-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
.ctr-lab-scheduler-form .ctr-lab-form-group {
    margin-bottom: 0;
}
.ctr-lab-scheduler-loading {
    padding: 16px;
    color: #666;
}
.ctr-lab-scheduler-table {
    margin-top: 8px;
}
.ctr-lab-scheduler-status-on {
    color: #2e7d32;
    font-weight: 500;
}
.ctr-lab-scheduler-status-off {
    color: #666;
}
.ctr-lab-scheduler-empty {
    color: #666;
    padding: 16px 0;
}

/* ==========================================
   Технические аудиты
   ========================================== */

.ctr-lab-audits-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.audits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.audits-header h2 {
    margin: 0;
    font-size: 24px;
    color: #1d2327;
}

.audits-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.audits-empty-state p {
    font-size: 16px;
    margin: 10px 0;
}

.audits-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.audit-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.audit-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.audit-header-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.audit-date {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    font-size: 14px;
    white-space: nowrap;
}

.audit-date .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.audit-title-wrapper {
    flex: 1;
}

.audit-title {
    margin: 0;
    font-size: 18px;
    color: #1d2327;
    font-weight: 600;
}

.audit-actions {
    display: flex;
    gap: 8px;
}

.audit-toggle-btn,
.audit-edit-btn,
.audit-delete-btn {
    background: transparent;
    border: 1px solid #ddd;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.audit-toggle-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.audit-edit-btn:hover {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.audit-edit-btn:hover .dashicons {
    color: #fff;
}

.audit-delete-btn:hover {
    background: #d63638;
    border-color: #d63638;
    color: #fff;
}

.audit-delete-btn:hover .dashicons {
    color: #fff;
}

.audit-actions .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.audit-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #333;
    line-height: 1.6;
}

.audit-content p {
    margin: 0 0 15px 0;
}

.audit-content p:last-child {
    margin-bottom: 0;
}

/* Модальное окно аудита */
.audit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}

.audit-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.audit-modal-content {
    position: relative;
    max-width: 60vw;
    width: 60%;
    margin: 50px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.audit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.audit-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1d2327;
}

.audit-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.2s ease;
}

.audit-modal-close:hover {
    color: #d63638;
}

.audit-modal-close .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.audit-modal-body {
    padding: 25px;
    overflow-y: auto;
}

.audit-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

#audit-form .form-group {
    margin-bottom: 20px;
}

#audit-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d2327;
}

#audit-form .form-group .required {
    color: #d63638;
}

#audit-form .ctr-lab-input,
#audit-form .ctr-lab-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#audit-form .ctr-lab-input:focus,
#audit-form .ctr-lab-textarea:focus {
    outline: none;
    border-color: #2271b1;
}

#audit-form .ctr-lab-textarea {
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Стили для TinyMCE редактора в модальном окне */
#audit-form .wp-editor-wrap {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

#audit-form .wp-editor-container {
    border: none;
}

#audit-form .mce-toolbar-grp {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

#audit-form .mce-tinymce {
    border: none !important;
    box-shadow: none !important;
}

#audit-form .mce-edit-area iframe {
    min-height: 300px !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .audit-header-row {
        flex-wrap: wrap;
    }
    
    .audit-date {
        flex-basis: 100%;
        margin-bottom: 10px;
    }
    
    .audit-title-wrapper {
        flex-basis: 100%;
        order: -1;
        margin-bottom: 10px;
    }
    
    .audit-actions {
        flex-basis: 100%;
        justify-content: flex-end;
    }
    
    .audit-modal-content {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
}

/* Живой поиск по группам: переопределяет display:block !important для скрытия при фильтрации */
.groups-list .group-item.groups-search-hidden {
    display: none !important;
}
/* Скрытие нерелевантных подгрупп внутри развёрнутого контейнера (переопределяет правило .group-children .group-item) */
.groups-list .group-children .group-item.groups-search-hidden {
    display: none !important;
}
.groups-list .group-children.groups-search-children-hidden {
    display: none !important;
}

/* Кнопка «Свернуть/развернуть все»: принудительная видимость по классу на контейнере */
.groups-list.ctr-lab-all-expanded .group-item-parent { display: block !important; }
.groups-list.ctr-lab-all-expanded .group-children { display: block !important; }
.groups-list.ctr-lab-all-collapsed .group-children { display: none !important; }
/* Раскрытый контейнер подгрупп — показывать даже при ctr-lab-all-collapsed (то же специфичность, порядок даёт приоритет) */
.groups-list .group-item-parent:not(.collapsed) + .group-children { display: block !important; }

/* Живой поиск по регионам при создании проекта */
.ctr-lab-region-search {
    position: relative;
}
/* В попапе «Создать проект» — отступ снизу под выпадающий список регионов (чтобы не упирался в низ попапа) */
#create-project-modal .modal-body,
#create-project-modal .ctr-lab-modal-content {
    padding-bottom: 120px;
}
.ctr-lab-modal .ctr-lab-region-search {
    margin-bottom: 24px;
}
.ctr-lab-region-search .ctr-lab-region-search-input {
    width: 100%;
    box-sizing: border-box;
}
.ctr-lab-region-search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}
.ctr-lab-region-search-dropdown .ctr-lab-region-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ctr-lab-region-search-dropdown .ctr-lab-region-item:last-child {
    border-bottom: none;
}
.ctr-lab-region-search-dropdown .ctr-lab-region-item:hover,
.ctr-lab-region-search-dropdown .ctr-lab-region-item.ctr-lab-region-item-popular {
    background: #f0f6fc;
}
.ctr-lab-region-search-dropdown .ctr-lab-region-item-popular {
    font-weight: 600;
}
.ctr-lab-region-search-dropdown .ctr-lab-region-no-results {
    padding: 12px;
    color: #666;
    text-align: center;
}
