* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 3px solid #007bff;
    padding-bottom: 20px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #007bff;
}

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

/* СТАТУС */
.status-box {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.status-box h2 {
    margin-bottom: 15px;
    color: #333;
}

.status-running {
    color: #d9534f;
    font-weight: bold;
    margin-bottom: 15px;
}

.status-idle {
    color: #28a745;
    font-weight: bold;
}

.small-text {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* ЛОГ */
.log-box {
    background: #222;
    color: #0f0;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

#log-content {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* КНОПКИ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
}

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

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

.btn-danger:hover {
    background: #c9302c;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

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

/* ФОРМЫ */
.tasks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .tasks {
        grid-template-columns: 1fr;
    }
}

.task-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s;
}

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

.task-box h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* АЛЕРТЫ */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

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

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

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* НАВИГАЦИЯ */
.nav-box {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 30px;
}

.nav-box p {
    margin: 0;
}

.nav-box .btn {
    display: inline-block;
    margin: 0;
}

/* ТАБЛИЦА ФАЙЛОВ */
.files-table {
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #ddd;
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #333;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

table tr:hover {
    background: #f8f9fa;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

/* Строка-чекбокс (реестры СРО) */
.checkbox-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 4px;
    cursor: pointer;
}
.checkbox-line input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ДЕРЕВО ВЫБОРА РЕГИОНОВ */
.geotree {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}
.gt-loading {
    padding: 10px;
    color: #888;
    font-size: 13px;
}
.gt-search {
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
    box-sizing: border-box;
}
.gt-search:focus { outline: none; background: #f8fbff; }
.gt-tree {
    max-height: 440px;   /* ~20 строк */
    overflow-y: auto;
    padding: 4px 0;
}
.gt-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 2px 6px;
    font-size: 13px;
    white-space: nowrap;
}
.gt-row:hover { background: #f2f6fb; }
/* Перебиваем глобальное .form-group input{width:100%} — чекбоксы дерева малые и слева */
.gt-row input[type="checkbox"] {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
}
.gt-exp {
    width: 14px;
    flex: 0 0 auto;
    text-align: center;
    color: #888;
    cursor: pointer;
    user-select: none;
}
.gt-label {
    cursor: pointer;
    flex: 1 1 auto;
    user-select: none;
}
.gt-children { }

/* КОНВЕЙЕР: воркеры */
.worker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.worker-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    background: #f8f9fa;
}
.worker-card strong {
    display: inline-block;
    margin-bottom: 8px;
}

/* КОНВЕЙЕР: прогресс-бар */
.progress-bar {
    background: #e9ecef;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin: 6px 0 4px;
}
.progress-fill {
    background: #007bff;
    height: 100%;
}

/* КОНВЕЙЕР: таблица задач */
.pipeline-table {
    margin-top: 10px;
}

/* КОНВЕЙЕР: строка-заголовок job'а в таблице сегментов */
.job-header-row td {
    background: #f1f6fb;
    font-size: 13px;
    padding-top: 14px;
}

/* PROJECT-BAR в шапке */
.project-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}
.project-bar select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* ЭКСПОРТ: сетка кнопок */
.export-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* СТРАНИЦА НИSH: строка ниши */
.niche-row {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.niche-row:last-child { border-bottom: none; }
.niche-edit-area {
    margin-top: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 14px;
}

/* ВИДЖЕТ РУБРИК 2ГИС */
.rubrictree {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    margin-top: 4px;
}
.rubrictree-search-row {
    display: flex;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}
.rubrictree-search {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}
.rubrictree-sections {
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}
.rubrictree-section-header {
    padding: 5px 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    background: #f1f6fb;
    user-select: none;
}
.rubrictree-section-header:hover { background: #e2edf9; }
.rubrictree-toggle { margin-right: 6px; font-size: 11px; }
.rubrictree-items { padding: 4px 10px 4px 24px; }
.rubrictree-item { font-size: 13px; margin-bottom: 2px; }
.rubrictree-item input[type=checkbox] { width: auto; margin-right: 6px; }

/* ГЛАВНАЯ: производные списки (города 2ГИС / субъекты СРО) */
.derived-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
}
.derived-list .checkbox-line {
    margin-bottom: 2px;
}

/* ГЛАВНАЯ: карточка job'а */
.job-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #f8f9fa;
}
.job-card .small-text {
    margin: 4px 0 8px;
}

.logout-form { margin: 0; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-form {
    width: min(360px, calc(100% - 32px));
    padding: 28px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
}
.login-form h1 { margin: 0 0 24px; text-align: center; }
.login-form label { display: block; margin: 12px 0 5px; font-weight: 600; }
.login-form input { width: 100%; box-sizing: border-box; }
.login-form .btn { width: 100%; margin-top: 18px; }
.login-form .alert { margin-top: 16px; }
