* {
    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;
}

.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: 8px 0;
    background: #fff;
    border-top: 1px solid #eee;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px 32px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.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: 10px;
    flex: 1;
}

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

.folder-checkbox {
    width: 16px;
    height: 16px;
    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: 18px;
}

.file-name {
    font-weight: 500;
    color: #333;
}

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

.empty-folder {
    padding: 12px 16px 12px 32px;
    color: #999;
    font-size: 14px;
    background: #fafafa;
}

.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: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

.terminal-output {
    background: #1e1e1e;
    color: #d4d4d4;
    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: #2d2d2d;
}

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

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

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

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

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

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

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

.terminal-input-line {
    display: flex;
    align-items: center;
    background: #252526;
    padding: 15px 20px;
    border-top: 1px solid #3e3e42;
}

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

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

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

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

.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);
    }
}

@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;
    }
}
