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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

.header {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 32px;
}

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

.auth-section {
    background: white;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.auth-section input {
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 15px;
}

.auth-section button {
    padding: 15px 40px;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

.auth-section button:hover {
    transform: translateY(-2px);
}

.main-content {
    display: none;
}

.nav-tabs {
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.nav-tabs a {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-tabs a:hover {
    background: #f0f0f0;
}

.nav-tabs a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.panel.full-width {
    grid-column: 1 / -1;
}

.panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.person-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.person-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.person-card.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #e7f0ff 0%, #d4e5ff 100%);
}

.person-card h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 18px;
}

.person-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.person-card .status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status.empty {
    background: #fee;
    color: #c00;
}

.status.filled {
    background: #efe;
    color: #0a0;
}

.editor-container {
    margin-top: 20px;
}

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

.editor-header h3 {
    color: #333;
    font-size: 20px;
}

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

textarea.editor {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

textarea.editor:focus {
    outline: none;
    border-color: #667eea;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-success {
    background: #51cf66;
    color: white;
}

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

.btn-secondary {
    background: #868e96;
    color: white;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.session-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.8;
}

.session-info strong {
    color: #667eea;
}

.upload-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-zone:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.file-list {
    max-height: 500px;
    overflow-y: auto;
}

.file-accordion {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.file-accordion:last-child {
    margin-bottom: 0;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-header .folder-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #333;
}

.accordion-header .folder-label .folder-icon {
    font-size: 18px;
    transition: transform 0.2s;
}

.file-accordion.open .accordion-header .folder-icon {
    transform: rotate(90deg);
}

.accordion-header .badge {
    background: #dee2e6;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.accordion-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-clear-folder {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-clear-folder:hover {
    background: #ff6b6b;
    opacity: 1;
}

.btn-remove-folder {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
}

.btn-remove-folder:hover {
    background: #c92a2a;
    color: #fff;
    opacity: 1;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}

.file-accordion.open .accordion-content {
    max-height: 2000px;
    transition: max-height 0.35s ease-in;
}

.accordion-inner {
    padding: 4px 0;
    background: #fff;
    border-top: 1px solid #eee;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 6px 24px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    font-size: 13px;
}

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

.file-item:hover {
    background: #f8f9fa;
}

.file-item.selected {
    background: #e7f0ff;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

.file-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #667eea;
}

.folder-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #667eea;
}

.bulk-actions {
    display: none;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;
    align-items: center;
    gap: 12px;
}

.bulk-actions.visible {
    display: flex;
}

.bulk-actions .selected-count {
    font-weight: 600;
    color: #856404;
}

.bulk-actions .btn {
    margin-left: auto;
}

.file-icon {
    font-size: 16px;
}

.file-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-actions {
    display: flex;
    gap: 4px;
}

.file-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.empty-folder {
    padding: 8px 12px 8px 24px;
    color: #999;
    font-size: 13px;
    background: #fafafa;
}

.tree-folder {
    margin-left: 16px;
    border-left: 1px dashed #ddd;
}

.tree-folder-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    transition: background 0.2s;
}

.tree-folder-header:hover {
    background: #f8f9fa;
}

.tree-folder-header .folder-icon {
    margin-right: 6px;
    font-size: 14px;
    transition: transform 0.2s;
}

.tree-folder.open > .tree-folder-header .folder-icon {
    transform: rotate(90deg);
}

.tree-folder-content {
    display: none;
}

.tree-folder.open > .tree-folder-content {
    display: block;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: #51cf66;
}

.toast.error {
    background: #ff6b6b;
}

.template-hint {
    background: #fff9db;
    border-left: 4px solid #ffd43b;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.template-hint strong {
    color: #f59f00;
}

input[type="file"] {
    display: none;
}

/* Каналы связи */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.channel-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s;
}

.channel-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.channel-card h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

.channel-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
}

.channel-card input:focus {
    outline: none;
    border-color: #667eea;
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.page-grid.three-cols {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Консоль */
.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.console-info {
    background: #e7f5ff;
    border-left: 4px solid #339af0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

.console-info code {
    background: #d0ebff;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
}

/* Светлая тема консоли (по умолчанию) */
.terminal-container {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

.terminal {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.terminal-output {
    background: #ffffff;
    color: #333;
    padding: 20px;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-output::-webkit-scrollbar {
    width: 10px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 5px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.terminal-line {
    margin-bottom: 2px;
}

.terminal-line.command {
    color: #495057;
    font-weight: 600;
}

.terminal-line.command-line {
    color: #495057;
    font-weight: 600;
}

.terminal-line.output {
    color: #333;
}

.terminal-line.error {
    color: #e03131;
}

.terminal-line.muted {
    color: #868e96;
    font-style: italic;
}

.terminal-line.info {
    color: #1971c2;
    font-style: italic;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border-top: 2px solid #e9ecef;
}

.terminal-prompt {
    color: #495057;
    font-weight: 600;
    margin-right: 10px;
    user-select: none;
}

.prompt-user {
    color: #2f9e44;
}

.prompt-dir {
    color: #1971c2;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #333;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    caret-color: #333;
}

.terminal-input::placeholder {
    color: #adb5bd;
}

.terminal-input:disabled {
    opacity: 0.5;
}

/* Тёмная тема консоли */
.terminal-container.dark-theme {
    background: #1e1e1e;
    border-color: #3e3e42;
}

.terminal-container.dark-theme .terminal-output {
    background: #1e1e1e;
    color: #d4d4d4;
}

.terminal-container.dark-theme .terminal-output::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.terminal-container.dark-theme .terminal-output::-webkit-scrollbar-thumb {
    background: #555;
}

.terminal-container.dark-theme .terminal-output::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.terminal-container.dark-theme .terminal-line.command,
.terminal-container.dark-theme .terminal-line.command-line {
    color: #4ec9b0;
}

.terminal-container.dark-theme .terminal-line.output {
    color: #d4d4d4;
}

.terminal-container.dark-theme .terminal-line.error {
    color: #f48771;
}

.terminal-container.dark-theme .terminal-line.muted {
    color: #868e96;
}

.terminal-container.dark-theme .terminal-line.info {
    color: #6cb6ff;
}

.terminal-container.dark-theme .terminal-input-line {
    background: #252526;
    border-top-color: #3e3e42;
}

.terminal-container.dark-theme .terminal-prompt {
    color: #4ec9b0;
}

.terminal-container.dark-theme .prompt-user {
    color: #51cf66;
}

.terminal-container.dark-theme .prompt-dir {
    color: #339af0;
}

.terminal-container.dark-theme .terminal-input {
    color: #d4d4d4;
    caret-color: #aeafad;
}

.terminal-container.dark-theme .terminal-input::placeholder {
    color: #6a6a6a;
}

.console-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
}

.status-indicator {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator.ready {
    color: #51cf66;
}

.status-indicator.executing {
    color: #ff922b;
}

.status-indicator.error {
    color: #ff6b6b;
}

.welcome-message {
    margin-bottom: 5px;
}

/* Статистика диска */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 10px;
}

.stat-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

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

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.top-files-list {
    max-height: 300px;
    overflow-y: auto;
}

.top-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: #f8f9fa;
    font-size: 13px;
}

.top-file-item:hover {
    background: #e9ecef;
}

.top-file-rank {
    font-weight: 600;
    color: #667eea;
    min-width: 25px;
}

.top-file-size {
    font-weight: 600;
    color: #333;
    min-width: 60px;
    font-family: 'Monaco', 'Courier New', monospace;
}

.top-file-path {
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
}

/* Навыки (Skills) */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.skills-category {
    margin-bottom: 30px;
}

.category-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.skill-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s;
}

.skill-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.skill-card.selected {
    border-color: #51cf66;
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
}

.skill-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.skill-checkbox-wrapper {
    flex-shrink: 0;
    margin-top: 2px;
}

.skill-select-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #51cf66;
}

.skill-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.3;
}

.skill-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.skill-tag {
    background: #e9ecef;
    color: #495057;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.skill-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
}

.skill-visibility {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 8px;
}

.skill-visibility.public {
    background: #e7f5ff;
    color: #1971c2;
}

.skill-visibility.private {
    background: #fff9db;
    color: #f59f00;
}

.skill-owner {
    background: #f3e8ff;
    color: #7c3aed;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
}

.skill-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.btn-view, .btn-edit {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-view:hover, .btn-edit:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.btn-delete {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #fff5f5;
    border-color: #ff6b6b;
}

/* Мета-информация о навыке */
.skill-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    font-size: 12px;
}

.skill-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-meta-label {
    color: #868e96;
    font-weight: 500;
}

.skill-meta-value {
    color: #333;
    font-weight: 600;
}

.skill-meta-value code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Превью системного промпта */
.skill-prompt-preview {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
    font-size: 12px;
}

.skill-prompt-preview strong {
    color: #495057;
    display: block;
    margin-bottom: 4px;
}

.skill-prompt-preview p {
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* Модальные окна */
.modal-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Задачи (Tasks) — новый дизайн ────────────────────────────────────────── */

/* Сетка карточек */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

/* Фильтры */
.tasks-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tasks-filter-btn {
    padding: 6px 14px;
    border: 1.5px solid #dee2e6;
    border-radius: 20px;
    background: #fff;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tasks-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.tasks-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #fff;
}

.filter-count {
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
}

.tasks-filter-btn:not(.active) .filter-count {
    background: #e9ecef;
    color: #868e96;
}

/* Карточка задачи */
.task-card-new {
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card-new:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-color: #d0d7ff;
}

/* Цветная полоска слева по статусу */
.task-card-new.status-in-progress { border-left: 4px solid #667eea; }
.task-card-new.status-done        { border-left: 4px solid #51cf66; }
.task-card-new.status-failed      { border-left: 4px solid #ff6b6b; }
.task-card-new.status-paused      { border-left: 4px solid #ffd43b; }
.task-card-new.status-unknown     { border-left: 4px solid #dee2e6; }

/* Шапка карточки */
.task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.task-card-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.task-card-goal {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.4;
    /* Обрезаем длинные цели до 2 строк */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-card-meta {
    flex-shrink: 0;
    text-align: right;
}

.task-date {
    font-size: 11px;
    color: #adb5bd;
    white-space: nowrap;
}

/* Бейдж статуса */
.task-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
}

.task-status-badge.in-progress { background: #eef2ff; color: #4c6ef5; }
.task-status-badge.done        { background: #ebfbee; color: #2f9e44; }
.task-status-badge.failed      { background: #fff5f5; color: #e03131; }
.task-status-badge.paused      { background: #fff9db; color: #e67700; }
.task-status-badge.unknown     { background: #f1f3f5; color: #868e96; }

/* Прогресс */
.task-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-progress-bg {
    flex: 1;
    height: 6px;
    background: #e9ecef;
    border-radius: 99px;
    overflow: hidden;
}

.task-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.5s ease, background 0.3s ease;
}

.task-progress-pct {
    font-size: 12px;
    font-weight: 700;
    color: #495057;
    min-width: 34px;
    text-align: right;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Метрики */
.task-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.task-metric {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 7px 8px;
    text-align: center;
}

.task-metric-label {
    font-size: 10px;
    color: #868e96;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.task-metric-value {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Активный шаг */
.task-active-step {
    background: #eef2ff;
    border-left: 3px solid #667eea;
    border-radius: 0 8px 8px 0;
    padding: 8px 12px;
    font-size: 13px;
    color: #4c6ef5;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Превью шагов */
.task-steps-preview {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 10px;
}

.task-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #495057;
    line-height: 1.4;
}

.task-step-icon {
    font-size: 11px;
    font-weight: 700;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    font-family: 'Monaco', 'Courier New', monospace;
}

.task-step-icon.tsc-done     { color: #2f9e44; }
.task-step-icon.tsc-progress { color: #4c6ef5; }
.task-step-icon.tsc-failed   { color: #e03131; }
.task-step-icon.tsc-pending  { color: #ced4da; }

.task-step-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-steps-more {
    font-size: 11px;
    color: #adb5bd;
    padding-top: 4px;
    padding-left: 22px;
    font-style: italic;
}

/* Кнопки действий */
.task-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.task-btn {
    padding: 9px 12px;
    border: 1.5px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.task-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.task-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.task-btn-steps {
    border-color: #667eea;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102,126,234,0.25);
}

.task-btn-steps:hover {
    box-shadow: 0 4px 14px rgba(102,126,234,0.4);
}

.task-btn-log { border-color: #cc5de8; color: #862e9c; }
.task-btn-log:hover { background: #f8f0fc; }

/* Строка удаления зависшей задачи */
.task-delete-row {
    margin-top: -4px;
}

.task-btn-delete {
    width: 100%;
    border-color: #ffc9c9;
    color: #c92a2a;
    background: #fff5f5;
    font-size: 12px;
    padding: 7px 12px;
}

.task-btn-delete:hover {
    background: #ffe0e0;
    border-color: #ff6b6b;
    box-shadow: 0 3px 10px rgba(255,107,107,0.2);
}

/* Кнопка подтверждения удаления в диалоге */
.task-btn-delete-confirm {
    border-color: #ff6b6b;
    color: #fff;
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    box-shadow: 0 2px 8px rgba(255,107,107,0.3);
}

.task-btn-delete-confirm:hover {
    box-shadow: 0 4px 14px rgba(255,107,107,0.45);
}

/* ─── Модальное окно задач ──────────────────────────────────────────────────── */

.task-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.task-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.task-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.25s ease;
    overflow: hidden;
}

.task-modal-overlay.visible .task-modal {
    transform: translateY(0) scale(1);
}

.task-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.task-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.task-modal-controls {
    display: flex;
    gap: 6px;
}

.task-modal-ctrl-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.task-modal-ctrl-btn:hover { background: rgba(255,255,255,0.28); }
.task-modal-close { font-size: 18px; }

.task-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.task-modal-body::-webkit-scrollbar { width: 8px; }
.task-modal-body::-webkit-scrollbar-track { background: #f8f9fa; }
.task-modal-body::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 4px; }

/* Цель задачи в модале */
.task-modal-goal {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    line-height: 1.5;
}

/* Список шагов в модале */
.task-modal-steps {
    padding: 8px 0;
}

.task-step-row.modal-step {
    padding-top: 8px;
    padding-right: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    color: #333;
}

.task-step-row.modal-step:last-child {
    border-bottom: none;
}

/* Debug Log в модале */
.task-debug-body {
    padding: 16px 20px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafafa;
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
}

.task-debug-body::-webkit-scrollbar { width: 8px; }
.task-debug-body::-webkit-scrollbar-track { background: #f0f0f0; }
.task-debug-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ─── Старые стили задач (оставляем для совместимости) ──────────────────────── */

.task-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

.task-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #2c3e50;
}

.task-status {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
}

.status-IN_PROGRESS { background: #e3f2fd; color: #1976d2; }
.status-DONE { background: #e8f5e9; color: #388e3c; }
.status-FAILED { background: #ffebee; color: #d32f2f; }
.status-PAUSED { background: #fff3e0; color: #f57c00; }

.progress-container {
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-bar {
    height: 10px;
    background-color: #4CAF50;
    transition: width 0.5s ease-in-out;
}

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

.step-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: flex-start;
}

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

.step-icon {
    margin-right: 10px;
    font-family: monospace;
    font-weight: bold;
}

.step-icon.done { color: #4CAF50; }
.step-icon.progress { color: #2196F3; }
.step-icon.failed { color: #f44336; }
.step-icon.pending { color: #9e9e9e; }

.step-content {
    flex-grow: 1;
}

.step-text {
    margin: 0;
}

.step-notes {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
    background: #f9f9f9;
    padding: 5px;
    border-radius: 4px;
    border-left: 3px solid #ccc;
}

.debug-log {
    margin-top: 15px;
    padding: 10px;
    background: #2b2b2b;
    color: #a9b7c6;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9em;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.toggle-debug {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 0;
    font-size: 0.9em;
    margin-top: 10px;
}

.toggle-debug:hover {
    text-decoration: underline;
}

/* ─── Лоадер инициализации контейнера ──────────────────────────────────────── */

.init-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.init-loader-overlay.visible {
    opacity: 1;
}

.init-loader-overlay.hiding {
    opacity: 0;
    pointer-events: none;
}

.init-loader-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    transform: translateY(20px);
    transition: transform 0.35s ease;
}

.init-loader-overlay.visible .init-loader-card {
    transform: translateY(0);
}

.init-loader-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}

.init-loader-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0 0 4px;
}

.init-loader-subtitle {
    font-size: 13px;
    color: #888;
    margin: 0;
}

/* Spinner */
.init-spinner {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #e9ecef;
    border-top-color: #667eea;
    animation: initSpin 0.9s linear infinite;
}

@keyframes initSpin {
    to { transform: rotate(360deg); }
}

/* Прогресс-бар */
.init-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.init-progress-bar-bg {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 99px;
    overflow: hidden;
}

.init-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.init-progress-pct {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    min-width: 36px;
    text-align: right;
}

/* Текущий шаг */
.init-step-label {
    font-size: 13px;
    color: #555;
    margin-bottom: 20px;
    min-height: 18px;
    font-style: italic;
}

/* Список шагов */
.init-steps-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.init-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    color: #aaa;
    background: transparent;
    transition: background 0.2s, color 0.2s;
}

.init-step-item.active {
    background: #f0f3ff;
    color: #333;
}

.init-step-item.done {
    color: #555;
}

/* Иконка-точка статуса */
.init-step-icon-wrap {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.init-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
    transition: background 0.2s, transform 0.2s;
}

.init-step-item.active .init-step-dot {
    background: #667eea;
    transform: scale(1.4);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    animation: initPulse 1.2s ease-in-out infinite;
}

.init-step-item.done .init-step-dot {
    background: #51cf66;
}

@keyframes initPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }
    50%       { box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.08); }
}

.init-step-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.init-step-name {
    flex: 1;
    font-weight: 500;
}

/* Статус справа (галочка для done) */
.init-step-status {
    font-size: 14px;
    min-width: 18px;
    text-align: center;
}

.init-step-item.done .init-step-status::after {
    content: '✓';
    color: #51cf66;
    font-weight: 700;
}

.init-step-item.active .init-step-status::after {
    content: '…';
    color: #667eea;
}

/* Сноска */
.init-loader-note {
    font-size: 12px;
    color: #bbb;
    text-align: center;
    margin: 0;
}

/* ─── Приложения (Apps / PM2) ───────────────────────────────────────────────── */

/* ── Просмотр приложения в модальном окне ── */
.appview-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.appview-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.appview-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 1100px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,0.35);
    overflow: hidden;
    transform: translateY(24px) scale(0.98);
    transition: transform 0.25s ease;
}

.appview-overlay.visible .appview-modal {
    transform: translateY(0) scale(1);
}

.appview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.appview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.appview-icon { font-size: 18px; }

.appview-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.appview-ctrl-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s;
    line-height: 1;
}

.appview-ctrl-btn:hover { background: rgba(255,255,255,0.28); }
.appview-close { font-size: 18px; }

.appview-body {
    flex: 1;
    overflow: hidden;
    background: #f0f0f0;
}

.appview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.appview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    gap: 12px;
}

.appview-url {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #667eea;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appview-hint {
    font-size: 11px;
    color: #adb5bd;
    white-space: nowrap;
    flex-shrink: 0;
}

.apps-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.apps-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.apps-count-badge {
    background: #e9ecef;
    color: #495057;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.apps-autoupdate {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.apps-autoupdate input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    margin: 0;
    padding: 0;
}

.apps-empty {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.apps-empty .apps-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
}

.apps-empty p {
    font-size: 15px;
    margin-bottom: 6px;
    color: #888;
}

.apps-empty small {
    font-size: 13px;
    color: #bbb;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.app-card {
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 20px;
    background: #fff;
    transition: box-shadow 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-color: #d0d7ff;
}

.app-card.status-online  { border-left: 4px solid #51cf66; }
.app-card.status-stopped { border-left: 4px solid #adb5bd; }
.app-card.status-errored { border-left: 4px solid #ff6b6b; }
.app-card.status-launching { border-left: 4px solid #ffd43b; }
.app-card.status-unknown { border-left: 4px solid #dee2e6; }

/* Заголовок карточки */
.app-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.app-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-card-id {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-card-name {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Бейдж статуса */
.app-status-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.app-status-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.app-status-badge.online   { background: #ebfbee; color: #2f9e44; }
.app-status-badge.stopped  { background: #f1f3f5; color: #868e96; }
.app-status-badge.errored  { background: #fff5f5; color: #e03131; }
.app-status-badge.launching { background: #fff9db; color: #e67700; }
.app-status-badge.unknown  { background: #f1f3f5; color: #adb5bd; }

/* Метрики */
.app-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.app-metric {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
}

.app-metric-label {
    font-size: 11px;
    color: #868e96;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.app-metric-value {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Путь к скрипту */
.app-script-path {
    font-size: 12px;
    color: #868e96;
    font-family: 'Monaco', 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 14px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Кнопки действий — две строки */
.app-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

/* Строка управления: 3 равных + маленький delete */
.app-actions-ctrl {
    grid-template-columns: 1fr 1fr 1fr auto;
}

.app-btn {
    padding: 9px 12px;
    border: 1.5px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
    color: #495057;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    min-width: 0;
}

.app-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.app-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Открыть — акцентная */
.app-btn.btn-open {
    border-color: #667eea;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}
.app-btn.btn-open:hover {
    box-shadow: 0 4px 14px rgba(102,126,234,0.45);
    transform: translateY(-1px);
}

/* Логи */
.app-btn.btn-logs    { border-color: #cc5de8; color: #862e9c; }
.app-btn.btn-logs:hover    { background: #f8f0fc; }

/* Старт */
.app-btn.btn-start   { border-color: #51cf66; color: #2f9e44; }
.app-btn.btn-start:hover   { background: #ebfbee; }

/* Стоп */
.app-btn.btn-stop    { border-color: #adb5bd; color: #495057; }
.app-btn.btn-stop:hover    { background: #f1f3f5; }

/* Рестарт */
.app-btn.btn-restart { border-color: #339af0; color: #1971c2; }
.app-btn.btn-restart:hover { background: #e7f5ff; }

/* Удалить — иконка-кнопка */
.app-btn.btn-delete {
    border-color: #ff6b6b;
    color: #c92a2a;
    padding: 9px 11px;
    flex-shrink: 0;
}
.app-btn.btn-delete:hover  { background: #fff5f5; }

/* Модальное окно логов */
.logs-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.logs-modal {
    background: #1e1e1e;
    border-radius: 14px;
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

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

.logs-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logs-modal-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    line-height: 1;
}

.logs-modal-close:hover {
    background: #333;
    color: #fff;
}

.logs-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-all;
}

.logs-modal-body::-webkit-scrollbar { width: 8px; }
.logs-modal-body::-webkit-scrollbar-track { background: #2d2d2d; }
.logs-modal-body::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }

.logs-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.logs-lines-select {
    background: #2d2d2d;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Бейдж порта в заголовке карточки */
.app-port-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Monaco', 'Courier New', monospace;
    color: #667eea;
    background: #eef0ff;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid #c5cbf5;
}

/* Блок предупреждения для errored-приложений */
.app-error-hint {
    background: #fff5f5;
    border: 1px solid #ffc9c9;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #c92a2a;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Кнопка "Починить" */
.app-btn.btn-fix {
    border-color: #fd7e14;
    color: #d9480f;
    background: #fff4e6;
    font-size: 12px;
    padding: 6px 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.app-btn.btn-fix:hover { background: #ffe8cc; }

@media (max-width: 768px) {
    .tab-content.active {
        grid-template-columns: 1fr;
    }
    .page-grid {
        grid-template-columns: 1fr;
    }
    .page-grid.three-cols {
        grid-template-columns: 1fr;
    }
    .console-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .console-controls {
        width: 100%;
    }
    .console-controls .btn {
        flex: 1;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .skills-grid {
        grid-template-columns: 1fr;
    }
}

/* Content pipeline page */
.page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.page-grid .panel {
    margin-bottom: 0;
}

.panel.full-width {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.panel.full-width:last-child {
    margin-bottom: 0;
}

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

.content-status-line {
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}

.content-status-line.ok {
    color: #2f9e44;
}

.content-status-line.error {
    color: #c92a2a;
}

.content-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 10px;
}

.content-metric-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
}

.content-metric-label {
    color: #868e96;
    font-size: 12px;
    margin-bottom: 6px;
}

.content-metric-value {
    color: #212529;
    font-size: 20px;
    font-weight: 700;
}

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

.content-settings-grid select {
    margin-bottom: 0;
}

.content-settings-grid input[type="text"] {
    margin-bottom: 0;
}

.content-settings-grid input[type="number"] {
    margin-bottom: 0;
}

.content-jobs-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.content-jobs-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.content-jobs-filters select {
    margin-bottom: 0;
    min-width: 180px;
}

.content-jobs-table-wrap {
    overflow-x: auto;
}

.content-jobs-table {
    width: 100%;
    border-collapse: collapse;
}

.content-jobs-table th,
.content-jobs-table td {
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 8px;
    vertical-align: top;
    font-size: 14px;
}

.content-jobs-table th {
    color: #495057;
    font-size: 13px;
    font-weight: 700;
    background: #f8f9fa;
}

.content-empty-cell {
    color: #868e96;
    text-align: center;
    padding: 20px 8px;
}

.content-empty-state {
    color: #868e96;
}

.content-job-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.content-job-meta div {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 13px;
}

.content-job-text-wrap,
.content-log-wrap {
    margin-top: 8px;
}

.content-job-text-wrap label,
.content-log-wrap label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #495057;
}

.content-log-box {
    background: #212529;
    color: #e9ecef;
    border-radius: 8px;
    padding: 12px;
    max-height: 260px;
    overflow: auto;
    font-size: 12px;
    margin: 0;
}

.content-status-badge {
    display: inline-block;
    border-radius: 14px;
    padding: 3px 10px;
    background: #eef2ff;
    border: 1px solid #dbe4ff;
    color: #364fc7;
    font-size: 12px;
}
