/* Базовые стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Панель аутентификации */
.auth-panel {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 50px auto;
    text-align: center;
}

.auth-panel h2 {
    margin-top: 0;
    color: #2c3e50;
}

.auth-panel input {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.auth-panel button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-panel button:hover {
    background-color: #2980b9;
}

/* Основной интерфейс приложения */
.app-container {
    display: flex;
    min-height: 80vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Сайдбар */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px 0;
}

.user-info {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info span {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

.logout-btn:hover {
    background: #c0392b;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0;
}

.sidebar nav li a {
    display: block;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar nav li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Основное содержимое */
.main-content {
    flex: 1;
    padding: 30px;
    /* Иначе широкая таблица (каналы) растягивает flex-элемент и обрезается у app-container без скролла */
    min-width: 0;
    overflow-x: auto;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* Общие элементы */
.search-container, .tasks-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-container select,
.search-container input,
.tasks-filter select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-container button,
.tasks-filter button {
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.search-container button:hover,
.tasks-filter button:hover {
    background-color: #2980b9;
}

/* Карточки каналов */
.channel-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.channel-card h3 {
    margin-top: 0;
    color: #2c3e50;
}

.channel-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 10px;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.pagination button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Форма новой задачи */
#newTaskForm {
    max-width: 600px;
    margin: 0 auto;
}

#newTaskForm input,
#newTaskForm textarea,
#newTaskForm select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#newTaskForm textarea {
    min-height: 120px;
    resize: vertical;
}

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

.form-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.form-actions button[type="submit"] {
    background-color: #2ecc71;
    color: white;
}

.form-actions button[type="submit"]:hover {
    background-color: #27ae60;
}

.form-actions button[type="reset"] {
    background-color: #f1f1f1;
}

.form-actions button[type="reset"]:hover {
    background-color: #e0e0e0;
}

/* Список задач */
.task-item {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding-right: 120px;
}

.task-item h3 {
    margin-top: 0;
    color: #2c3e50;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 10px;
}

.delete-task-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.delete-task-btn:hover {
    background-color: #c0392b;
}

/* Индикаторы загрузки и ошибок */
.loading-indicator {
    padding: 20px;
    text-align: center;
    background: #f8f8f8;
    border-radius: 8px;
    margin: 20px 0;
    color: #666;
}

.error-message {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}

/* Адаптивность */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .search-container, .tasks-filter {
        flex-direction: column;
    }

    .task-item {
        padding-right: 20px;
    }

    .delete-task-btn {
        position: static;
        display: block;
        margin-top: 10px;
    }
}

/* Стили для каналов в новом формате */
.channel-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.channel-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.channel-info h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.channel-info .username {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-edit {
    background-color: #3498db;
    color: white;
}

.btn-edit:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover:not(:disabled) {
    background-color: #c0392b;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.channel-stats {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.channel-stats span {
    font-size: 14px;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    gap: 5px;
}

.subscribers-count {
    font-weight: 500;
    color: #27ae60;
}

.last-update {
    color: #95a5a6;
}

/* Стили для задач */
.tasks-filter {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== Посты канала ===== */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.post-card {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.post-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

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

.post-info h4 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.post-time {
    margin: 2px 0 0 0;
    color: #7f8c8d;
    font-size: 12px;
}

.post-actions .btn {
    padding: 6px 10px;
    background: #f4f6f8;
    border: 1px solid #dfe3e8;
    border-radius: 6px;
    cursor: pointer;
}

.post-actions .btn:hover {
    background: #e9edf1;
}

.post-body {
    border-top: 1px dashed #e6e9ec;
    padding-top: 8px;
}

.post-text {
    margin: 6px 0 10px 0;
    color: #34495e;
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-stats {
    display: flex;
    gap: 14px;
    color: #7f8c8d;
    font-size: 13px;
}

.tasks-for-post {
    margin-top: 10px;
    border-top: 1px solid #f0f2f5;
    padding-top: 8px;
}

.task-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 110px;
    gap: 8px;
    align-items: center;
    padding: 8px 6px;
    border: 1px solid #eef1f4;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fafbfd;
}

.task-row .btn.btn-cancel {
    padding: 6px 10px;
    background: #ffecec;
    color: #c0392b;
    border: 1px solid #ffd0d0;
    border-radius: 6px;
    cursor: pointer;
}

.task-row .btn.btn-cancel:hover {
    background: #ffdede;
}

.tasks-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.tasks-filter button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.tasks-filter button:hover {
    background-color: #2980b9;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-item {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease;
}

.task-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.task-title {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    flex: 1;
    white-space: pre-line;
}

.task-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Старые стили для совместимости */
.status-active {
    background-color: #e8f5e8;
    color: #27ae60;
}

.status-completed {
    background-color: #e3f2fd;
    color: #2196f3;
}

.status-cancelled {
    background-color: #ffebee;
    color: #f44336;
}

.status-archived {
    background-color: #f5f5f5;
    color: #757575;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.no-tasks {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
}

.task-details p {
    margin: 10px 0;
    line-height: 1.6;
}

.task-details pre {
    background-color: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e1e8ed;
    text-align: right;
}

.modal-footer button {
    padding: 8px 16px;
    background-color: #7f8c8d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-footer button:hover {
    background-color: #6c7b7d;
}

/* ===== Редактор распределения по дням ===== */
.distribution-editor {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.distribution-settings-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #dfe6ee 15%, #dfe6ee 85%, transparent);
    margin: 4px 0;
}

.channel-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.channel-setting-card {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channel-setting-title {
    font-weight: 700;
    color: #2c3e50;
    font-size: 13px;
}

.channel-setting-hint {
    font-size: 12px;
    color: #7f8c8d;
}

.toggle-row {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 600;
    color: #34495e;
}

.channel-setting-card input[type="text"] {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
}

.channel-setting-card input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.distribution-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background: #ffffff;
}

.distribution-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.distribution-per-day-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid #ecf0f1;
}

.dist-sum-label {
    font-weight: 700;
    font-size: 14px;
    color: #2c3e50;
    margin-left: auto;
}

.btn-compact {
    padding: 6px 12px;
    font-size: 13px;
}

.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.distribution-title {
    font-weight: 800;
    color: #2c3e50;
}

.distribution-days {
    display: flex;
    align-items: center;
    gap: 10px;
}

.distribution-days label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 700;
}

.distribution-days input {
    width: 90px;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
}

.distribution-days input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

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

.range-raw-full {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
}

.range-raw-full:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.range-card .channel-setting-hint {
    margin-top: 2px;
}

.distribution-bars-scroll {
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background: #fafbfd;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.distribution-bars {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 12px 12px;
    min-width: min-content;
}

.dist-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    user-select: none;
    flex: 0 0 36px;
    min-width: 34px;
    max-width: 40px;
}

.dist-value {
    font-size: 11px;
    font-weight: 700;
    color: #2d7bd6;
    line-height: 1.1;
    text-align: center;
    width: 100%;
    white-space: nowrap;
}

.dist-bar-track {
    width: 100%;
    min-width: 28px;
    max-width: 36px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 10px;
    background: linear-gradient(#ffffff, #f3f6f9);
    border: 1px solid #dfe6ee;
    position: relative;
    cursor: ns-resize;
    touch-action: none;
}

.dist-bar {
    width: 100%;
    border-radius: 10px;
    background: linear-gradient(180deg, #4aa3ff, #2d7bd6);
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.35);
}

.dist-bar-handle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 6px;
    width: 18px;
    height: 4px;
    border-radius: 4px;
    background: rgba(44, 62, 80, 0.25);
    pointer-events: none;
}

.dist-col-label {
    font-size: 11px;
    color: #7f8c8d;
    font-weight: 600;
}

.distribution-inputs-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.distribution-inputs-head {
    font-weight: 700;
    font-size: 13px;
    color: #2c3e50;
}

.distribution-inputs-scroll {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.distribution-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.dist-input {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dist-input label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
}

.dist-input input {
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
}

.dist-input input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Стили для статусов задач */
.status-1 {
    background-color: #e8f5e8;
    color: #27ae60;
}

.status-2 {
    background-color: #e3f2fd;
    color: #2196f3;
}

.status-3 {
    background-color: #ffebee;
    color: #f44336;
}

.status-4 {
    background-color: #f5f5f5;
    color: #757575;
}

/* Модальное окно для задач аккаунта */
.modal-large {
    max-width: 900px;
    width: 95%;
}

.acc-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.acc-task-item {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.acc-task-item:hover {
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.acc-task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.acc-task-info {
    flex: 1;
}

.acc-task-title {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    white-space: pre-line;
}

.acc-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: #555;
}

.acc-task-meta span {
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e1e8ed;
}

.acc-task-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.acc-task-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .acc-task-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .acc-task-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .acc-task-status {
        align-self: flex-start;
    }
    
    .modal-large {
        width: 98%;
        margin: 10px;
    }
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

/* Модальное окно для информации о задаче */
.modal-small {
    max-width: 500px;
    width: 90%;
}

.task-info-content h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.body-data {
    background-color: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}

/* Поле поиска */
.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Информация о поиске */
.search-info {
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.search-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.search-info-text {
    color: #1565c0;
    font-weight: 500;
    font-size: 14px;
}

.clear-search-btn {
    background: #2196f3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s ease;
}

.clear-search-btn:hover {
    background: #1976d2;
}

/* Адаптивность для поиска */
@media (max-width: 768px) {
    .tasks-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .search-info-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Статистика задач */
.tasks-statistics {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 100px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    min-width: 60px;
    text-align: center;
}

.stat-total {
    background-color: #e3f2fd;
    color: #1976d2;
}

.stat-completed {
    background-color: #e8f5e8;
    color: #2e7d32;
}

.stat-active {
    background-color: #fff3e0;
    color: #f57c00;
}

/* Адаптивность для статистики */
@media (max-width: 768px) {
    .tasks-statistics {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
        width: 100%;
    }
}

/* Секция обновления */
.refresh-section {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    padding: 0 5px;
}

.btn-refresh {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-1px);
}

.btn-refresh:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Уведомления об обновлении */
.update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
}

.notification-content {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    font-size: 14px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Адаптивность для кнопки обновления */
@media (max-width: 768px) {
    .refresh-section {
        justify-content: center;
    }
    
    .btn-refresh {
        width: 100%;
        justify-content: center;
    }
}

/* Приветственное сообщение */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 2px dashed #e1e8ed;
    margin: 20px 0;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.welcome-message h3 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
}

.welcome-message p {
    color: #7f8c8d;
    font-size: 16px;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.feature-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.feature-item span:last-child {
    font-size: 14px;
    color: #555;
    text-align: center;
    line-height: 1.4;
}

/* Адаптивность для приветственного сообщения */
@media (max-width: 768px) {
    .welcome-message {
        padding: 40px 15px;
    }
    
    .welcome-features {
        flex-direction: column;
        gap: 20px;
    }
    
    .feature-item {
        min-width: auto;
    }
}

/* Proxy стили */
.proxy-section {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.proxy-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.proxy-section h4 {
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 15px;
}

.proxy-section h5 {
    color: #7f8c8d;
    margin-top: 15px;
    margin-bottom: 10px;
}


.country-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.country-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.proxy-edit-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
    font-size: 14px;
}

.proxy-input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.proxy-select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.proxy-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.check-result {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

.check-result pre {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    overflow-x: auto;
    font-size: 12px;
}

.proxy-info {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #28a745;
}

.proxy-info p {
    margin: 5px 0;
    color: #155724;
}

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

.settings-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

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

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

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    min-height: 100px;
    resize: vertical;
}

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

.current-settings {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.settings-info h6 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #495057;
}

.settings-info pre {
    background: #fff;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    overflow-x: auto;
    font-size: 12px;
    margin-bottom: 10px;
}

.placeholder-text {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Адаптивность для Proxy */
@media (max-width: 768px) {
    .country-selector {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .proxy-actions {
        flex-direction: column;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Admin Settings стили */
.admin-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.admin-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.assign-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.assign-form h4 {
    margin-top: 0;
    color: #495057;
}

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

.form-field {
    flex: 1;
    min-width: 200px;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.form-field button {
    padding: 8px 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.form-field button:hover {
    background-color: #218838;
}

.admin-filters {
    background: #e9ecef;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

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

.filter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.filter-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.filter-field button {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.filter-field button:hover {
    background-color: #0056b3;
}

.admin-stats {
    margin-bottom: 20px;
}

.admin-stats h4 {
    color: #495057;
    margin-bottom: 15px;
}

.stats-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.stats-list {
    display: grid;
    gap: 10px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-user {
    font-size: 16px;
    margin-bottom: 8px;
}

.stat-details {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #6c757d;
}

.stat-count {
    font-weight: 600;
    color: #28a745;
}

.stat-date {
    color: #6c757d;
}

.admin-assignments {
    margin-top: 20px;
}

.admin-assignments h4 {
    color: #495057;
    margin-bottom: 15px;
}

.assignments-list {
    display: grid;
    gap: 10px;
}

.assignment-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assignment-info {
    flex: 1;
}

.assignment-user {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.assignment-channel {
    margin-bottom: 5px;
}

.channel-id {
    font-weight: 500;
    color: #495057;
}

.channel-username {
    color: #007bff;
    margin-left: 10px;
    font-weight: 500;
}

.channel-title {
    color: #495057;
    margin-left: 10px;
    font-weight: 600;
    font-size: 15px;
}

.channel-no-name {
    color: #6c757d;
    margin-left: 10px;
    font-style: italic;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px dashed #dee2e6;
    font-size: 13px;
}

.assignment-date {
    font-size: 12px;
    color: #6c757d;
}

.assignment-actions {
    margin-left: 15px;
}

.remove-btn {
    padding: 6px 12px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.remove-btn:hover {
    background-color: #c82333;
}

/* Уведомления */
.success-notification,
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-weight: 500;
}

.success-notification {
    background: #28a745;
    color: white;
}

.error-notification {
    background: #dc3545;
    color: white;
}

/* User Channels Viewer стили */
.user-channels-viewer {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.user-channels-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #17a2b8;
}

.user-channels-header h4 {
    margin: 0;
    color: #495057;
}

.user-selector-section {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.user-channels-container {
    background: white;
    padding: 15px;
    border-radius: 6px;
}

.user-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.user-info-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-info-right {
    display: flex;
    align-items: center;
}

.user-info-header h5 {
    margin: 0;
    color: #2c3e50;
}

.channels-count {
    background: #17a2b8;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    align-self: flex-start;
}

.add-channel-btn {
    padding: 8px 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.add-channel-btn:hover {
    background-color: #218838;
}

.add-channel-form {
    background: #e9ecef;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 2px solid #28a745;
}

.add-channel-form h5 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057;
}

.cancel-btn {
    padding: 8px 16px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

.user-channels-list {
    display: grid;
    gap: 15px;
}

.user-channel-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.channel-main-info {
    margin-bottom: 15px;
}

.channel-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.channel-id {
    font-weight: 600;
    color: #495057;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.channel-username {
    color: #17a2b8;
    font-weight: 500;
}

.channel-title {
    color: #495057;
    font-weight: 600;
    font-size: 16px;
}

.channel-no-name {
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px dashed #dee2e6;
}

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

.stat-item-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: white;
    border-radius: 4px;
    font-size: 13px;
}

.stat-label {
    color: #6c757d;
    font-weight: 500;
}

.stat-value {
    color: #495057;
    font-weight: 600;
}

.channel-details {
    margin-bottom: 15px;
}

.channel-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.setting-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 2px;
}

.setting-value {
    font-size: 13px;
    color: #495057;
    font-weight: 600;
}

.channel-actions {
    display: flex;
    justify-content: flex-end;
}

.remove-channel-btn {
    padding: 6px 12px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.remove-channel-btn:hover {
    background-color: #c82333;
}

.no-channels {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #dee2e6;
}

.no-channels p {
    margin: 0;
}

/* Адаптивность для Admin Settings */
@media (max-width: 768px) {
    .assignment-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .assignment-actions {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .stat-details {
        flex-direction: column;
        gap: 5px;
    }
    
    .user-info-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .user-info-right {
        align-self: stretch;
    }
    
    .add-channel-btn {
        width: 100%;
    }
    
    .channel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .channel-stats {
        grid-template-columns: 1fr;
    }
    
    .channel-settings {
        grid-template-columns: 1fr;
    }
    
    .stat-item-small {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* Стили для аналитики */
.analytics-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-selector label {
    font-weight: 500;
    color: #495057;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.refresh-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.refresh-btn:hover {
    background: #0056b3;
}

.chart-container {
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

#analyticsChart {
    max-width: 100%;
    height: 400px !important;
}

.analytics-summary {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.analytics-summary h3 {
    margin-bottom: 15px;
    color: #495057;
}

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

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.summary-label {
    font-weight: 500;
    color: #6c757d;
}

.summary-value {
    font-weight: 600;
    color: #495057;
    font-size: 18px;
}

/* Таблица dialogs2 (массовое редактирование) */
.channels-search-row {
    flex-wrap: wrap;
    align-items: flex-end;
    row-gap: 12px;
}

.channels-view-fieldset {
    margin: 0;
    padding: 8px 12px 10px;
    border: 1px solid #b8d4f0;
    border-radius: 8px;
    background: #e8f4fc;
    min-width: 0;
}

.channels-view-fieldset legend {
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1a5276;
}

.channels-view-label {
    cursor: pointer;
    font-size: 14px;
    color: #2c3e50;
    margin-right: 14px;
    white-space: nowrap;
}

.channels-view-label input {
    margin-right: 4px;
    vertical-align: middle;
}

.channels-table-limit-wrap {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

.channels-search-hint {
    font-size: 12px;
    color: #6c757d;
    margin-left: 8px;
}

.channels-table-wrap {
    margin-bottom: 16px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.channels-table-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.channels-db-table {
    border-collapse: collapse;
    font-size: 12px;
    min-width: 2200px;
}

.channels-db-table th,
.channels-db-table td {
    border: 1px solid #e9ecef;
    padding: 6px 8px;
    vertical-align: top;
}

.channels-db-table thead th {
    background: #f1f3f5;
    font-weight: 600;
    color: #343a40;
    white-space: nowrap;
}

.channels-th-sort {
    cursor: pointer;
    user-select: none;
}

.channels-th-sort:hover {
    background: #e9ecef;
}

.channels-td-readonly {
    color: #6c757d;
    white-space: nowrap;
}

.channels-td-center {
    text-align: center;
}

.channels-cell-input {
    width: 100%;
    min-width: 72px;
    max-width: 160px;
    box-sizing: border-box;
    font-size: 12px;
    padding: 4px 6px;
}

.channels-cell-wide {
    min-width: 140px;
    max-width: 220px;
}

.channels-cell-num {
    max-width: 88px;
}

.channels-cell-json {
    width: 100%;
    min-width: 120px;
    max-width: 200px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    box-sizing: border-box;
    padding: 4px;
}

.channels-cell-json-wide {
    min-width: 200px;
    max-width: 320px;
}

.channels-td-actions {
    white-space: nowrap;
}

.channels-td-actions .btn-compact {
    margin: 2px 0;
    display: block;
    width: 100%;
}

/* Таблица каналов в стиле IDE / DataGrip (тёмная) */
.channels-table-ide .channels-table-scroll {
    border-color: #3c3c3c;
    border-radius: 4px;
    background: #1e1e1e;
    scrollbar-color: #5a5a5a #2d2d2d;
}

.channels-table-ide .channels-table-scroll::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.channels-table-ide .channels-table-scroll::-webkit-scrollbar-thumb {
    background: #5a5a5a;
    border-radius: 5px;
}

.channels-table-ide .channels-table-scroll::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.channels-table-ide .channels-db-table {
    font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 12px;
    line-height: 1.35;
    min-width: 2600px;
    table-layout: auto;
    color: #d4d4d4;
}

.channels-table-ide .channels-db-table th,
.channels-table-ide .channels-db-table td {
    border-color: #3c3c3c;
    padding: 2px 6px;
    vertical-align: middle;
}

.channels-table-ide .channels-db-table thead th {
    background: #252526;
    color: #cccccc;
    font-weight: 500;
    border-bottom: 1px solid #474747;
    box-shadow: inset 0 -1px 0 #1e1e1e;
}

.channels-table-ide .channels-th-ide {
    position: relative;
    white-space: nowrap;
}

.channels-table-ide .channels-th-sort:hover {
    background: #2a2d2e;
}

.channels-table-ide .channels-th-label {
    margin-right: 6px;
}

.channels-table-ide .channels-th-tools {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    opacity: 0.75;
}

.channels-table-ide .channels-th-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 12px;
    line-height: 1;
    color: #858585;
    cursor: default;
}

.channels-table-ide .channels-th-icon-filter::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid currentColor;
    opacity: 0.85;
}

.channels-table-ide .channels-th-icon-menu {
    font-weight: bold;
    letter-spacing: -2px;
}

.channels-table-ide .channels-th-rownum {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: right;
    color: #858585;
    font-weight: 400;
    position: sticky;
    left: 0;
    z-index: 4;
    background: #252526;
    border-right: 1px solid #474747;
}

.channels-table-ide thead th[data-sort="dialog"] {
    position: sticky;
    left: 36px;
    z-index: 4;
    background: #252526;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.25);
    border-right: 1px solid #474747;
}

.channels-table-ide .channels-td-rownum {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: right;
    color: #858585;
    background: #1e1e1e;
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 1px solid #3c3c3c;
    user-select: none;
}

.channels-table-ide .channels-td-sticky-dialog {
    position: sticky;
    left: 36px;
    z-index: 3;
    background: #1e1e1e;
    box-shadow: 3px 0 6px rgba(0, 0, 0, 0.35);
    border-right: 1px solid #3c3c3c;
}

.channels-table-ide .channels-td-sticky-dialog code {
    color: #9cdcfe;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(even) {
    background: #1a1a1a;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(even) .channels-td-rownum,
.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(even) .channels-td-sticky-dialog {
    background: #1a1a1a;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(odd) {
    background: #1e1e1e;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(odd) .channels-td-rownum,
.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:nth-child(odd) .channels-td-sticky-dialog {
    background: #1e1e1e;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:hover {
    background: #2a2d2e;
}

.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:hover .channels-td-rownum,
.channels-table-ide tbody#channelsTableBody tr.channels-tr-ide:hover .channels-td-sticky-dialog {
    background: #2a2d2e;
}

.channels-table-ide .channels-tr-compact--dim {
    opacity: 0.55;
}

.channels-table-ide .channels-tr-selected {
    background: #094771 !important;
    outline: 1px solid #1177bb;
}

.channels-table-ide .channels-tr-selected .channels-td-rownum,
.channels-table-ide .channels-tr-selected .channels-td-sticky-dialog {
    background: #094771;
}

.channels-table-ide .channels-paste-selected {
    outline: 2px dashed #4fc3f7;
    outline-offset: 1px;
    box-shadow: 0 0 0 1px rgba(79, 195, 247, 0.35);
}

/* Ячейки: в свёрнутом виде усечение; двойной клик — класс --expanded */
.channels-table-ide td.channels-td-cell {
    position: relative;
    vertical-align: middle;
}

.channels-table-ide td.channels-td-cell--collapsed {
    max-width: 112px;
}

.channels-table-ide td.channels-td-cell--collapsed:has(textarea.channels-cell-control) {
    max-width: 168px;
}

.channels-table-ide td.channels-td-cell--expanded {
    max-width: min(640px, 88vw);
    z-index: 8;
    overflow: visible;
    background: #252526;
    box-shadow: inset 0 0 0 1px #007fd4, 4px 4px 18px rgba(0, 0, 0, 0.45);
}

.channels-table-ide td.channels-td-sticky-dialog.channels-td-cell--expanded {
    z-index: 9;
}

.channels-table-ide td.channels-td-cell--collapsed .channels-readonly-val {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.channels-table-ide td.channels-td-cell--collapsed.channels-td-sticky-dialog code {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.channels-table-ide td.channels-td-cell--collapsed input.channels-cell-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.channels-table-ide td.channels-td-cell--collapsed textarea.channels-cell-control {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    resize: none;
    height: calc(1.35em + 8px);
    min-height: calc(1.35em + 8px);
    line-height: 1.35;
}

.channels-table-ide td.channels-td-cell--expanded textarea.channels-cell-control {
    white-space: pre-wrap;
    overflow: auto;
    resize: vertical;
    min-height: 5.5rem;
    height: auto;
}

.channels-table-ide td.channels-td-cell--expanded input.channels-cell-control {
    white-space: normal;
    overflow: visible;
    width: 100%;
    min-width: 10rem;
}

.channels-table-ide td.channels-td-cell-actions {
    max-width: none;
    white-space: nowrap;
    vertical-align: middle;
    background: inherit;
}

.channels-table-ide td.channels-td-cell-actions .btn-compact {
    display: inline-block;
    width: auto;
    margin: 0 3px 0 0;
    padding: 2px 6px;
    vertical-align: middle;
}

.channels-table-ide .channels-td-ellipsis {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channels-table-ide .channels-td-mono {
    max-width: 280px;
}

.channels-table-ide .channels-td-nowrap {
    white-space: nowrap;
}

.channels-table-ide .channels-td-actions-compact {
    white-space: nowrap;
}

.channels-table-ide .channels-dbl-hint {
    font-size: 10px;
    color: #858585;
    margin-right: 4px;
}

.channels-table-ide .channels-td-actions-compact .btn-compact {
    display: inline-block;
    width: auto;
    margin: 0 2px 0 0;
    padding: 2px 6px;
    vertical-align: middle;
}

.channels-table-ide .channels-tr-full {
    background: #252526;
}

.channels-table-ide .channels-tr-full--hidden {
    display: none;
}

.channels-table-ide .channels-expanded-skin {
    padding: 8px 10px 12px;
    border-top: 1px solid #007fd4;
}

.channels-table-ide .channels-expanded-hint {
    font-size: 11px;
    color: #858585;
    margin-bottom: 8px;
}

.channels-table-ide .channels-expanded-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 12px;
    align-items: start;
}

.channels-table-ide .channels-field label {
    display: block;
    font-size: 10px;
    color: #858585;
    margin-bottom: 2px;
    text-transform: none;
}

.channels-table-ide .channels-field-wide {
    grid-column: span 2;
}

.channels-table-ide .channels-field-json {
    grid-column: span 2;
}

.channels-table-ide .channels-field-json-wide {
    grid-column: 1 / -1;
}

.channels-table-ide .channels-field-readonly .channels-readonly-val {
    padding: 6px 8px;
    background: #1e1e1e;
    border-radius: 2px;
    color: #b5cea8;
    font-size: 11px;
}

.channels-table-ide .channels-field-check {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.channels-table-ide .channels-field-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #3c3c3c;
}

.channels-table-ide .ide-null {
    color: #6b6b6b;
    font-style: italic;
}

.channels-table-ide .channels-td-readonly {
    color: #b5cea8;
    white-space: nowrap;
}

.channels-table-ide .channels-cell-input,
.channels-table-ide .channels-cell-json,
.channels-table-ide .channels-cell-control {
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid transparent;
    border-radius: 2px;
    font-family: inherit;
    max-width: none;
}

.channels-table-ide .channels-cell-input:hover,
.channels-table-ide .channels-cell-json:hover,
.channels-table-ide .channels-cell-control:hover {
    border-color: #3c3c3c;
}

.channels-table-ide .channels-cell-input:focus,
.channels-table-ide .channels-cell-json:focus,
.channels-table-ide .channels-cell-control:focus {
    outline: none;
    border-color: #007fd4;
    background: #252526;
}

.channels-table-ide .channels-cell-json,
.channels-table-ide textarea.channels-cell-control.channels-cell-json {
    min-width: 140px;
    resize: vertical;
}

.channels-table-ide tr.channels-tr-selected td.channels-td-cell--expanded {
    background: #0b3550;
    box-shadow: inset 0 0 0 1px #3794c7, 4px 4px 18px rgba(0, 0, 0, 0.35);
}

.channels-table-ide .channels-cell-json-wide {
    min-width: 220px;
}

.channels-table-ide .channels-field-check input[type="checkbox"] {
    accent-color: #007fd4;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.channels-table-ide .channels-field-actions .btn-compact {
    background: #3c3c3c;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
}

.channels-table-ide .channels-field-actions .btn-compact:hover {
    background: #4a4a4a;
    border-color: #666;
}

.channels-table-ide .channels-field-actions .btn-edit {
    background: #0e639c;
    border-color: #1177bb;
}

.channels-table-ide .channels-field-actions .btn-edit:hover {
    background: #1177bb;
}