/* === KNOWLEDGE.CSS === */
/* assets/css/knowledge.css */
/* НАЗНАЧЕНИЕ: Стили модуля Базы знаний - 3-панельный layout, папки, статусы */
/* РАЗМЕР: ~350 строк */

/* ===================== LAYOUT ===================== */

.tf-kb-wrap {
    display: flex; height: 100%; overflow: hidden;
}

/* Левая панель - дерево папок */
.tf-kb-folders {
    width: 200px; flex: 0 0 200px;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
}
.tf-kb-folders-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    flex: 0 0 auto; text-transform: uppercase; letter-spacing: 0.5px;
}
.tf-kb-folders-list {
    flex: 1 1 auto; overflow-y: auto; padding: 4px 0;
}

/* Средняя панель - список документов */
.tf-kb-list {
    width: 280px; flex: 0 0 280px;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
}
.tf-kb-list-header {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.tf-kb-search {
    flex: 1; padding: 4px 8px; font-size: 11px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
}
.tf-kb-list-body {
    flex: 1 1 auto; overflow-y: auto;
}
.tf-kb-list-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 10px; border-top: 1px solid var(--border);
    font-size: 10px; color: var(--text-muted); flex: 0 0 auto;
}

/* Правая панель - детали документа */
.tf-kb-detail {
    flex: 1 1 auto; display: flex; flex-direction: column;
    overflow: hidden; min-width: 0;
}
.tf-kb-detail-header {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.tf-kb-detail-body {
    flex: 1 1 auto; overflow-y: auto; padding: 10px;
}
.tf-kb-detail-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted); font-size: 12px;
}

/* ===================== ПАПКИ (ДЕРЕВО) ===================== */

.tf-kb-folder {
    cursor: pointer; user-select: none;
}
.tf-kb-folder-row {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 10px; font-size: 11px; color: var(--text-primary);
    transition: background 0.1s; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-folder-row:hover {
    background: var(--bg-hover);
}
.tf-kb-folder-row.active {
    background: hsla(217, 91%, 60%, 0.08);
    color: var(--color-primary); font-weight: 600;
}
.tf-kb-folder-arrow {
    width: 12px; font-size: 8px; color: var(--text-muted);
    flex: 0 0 12px; text-align: center; transition: transform 0.15s;
}
.tf-kb-folder-arrow.expanded { transform: rotate(90deg); }
.tf-kb-folder-icon {
    flex: 0 0 14px; color: var(--text-muted);
}
.tf-kb-folder-name {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-folder-count {
    flex: 0 0 auto; font-size: 9px; color: var(--text-muted);
    background: var(--bg-input); border-radius: 8px; padding: 0 5px;
}
.tf-kb-folder-children {
    padding-left: 12px;
}
.tf-kb-folder-children.collapsed {
    display: none;
}

/* All Docs pseudo-folder */
.tf-kb-folder-all {
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}

/* ===================== СПИСОК ДОКУМЕНТОВ ===================== */

.tf-kb-doc-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.1s;
}
.tf-kb-doc-item:hover { background: var(--bg-hover); }
.tf-kb-doc-item.active {
    background: hsla(217, 91%, 60%, 0.08);
    border-left: 2px solid var(--color-primary);
}
.tf-kb-doc-icon {
    flex: 0 0 20px; width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; font-size: 10px; font-weight: 700;
    color: #fff; margin-top: 1px;
}
.tf-kb-doc-info {
    flex: 1; min-width: 0;
}
.tf-kb-doc-title {
    font-size: 12px; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-doc-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
}

/* Doc type icon colors */
.tf-kb-type-regulation { background: #3b82f6; }
.tf-kb-type-checklist { background: #22c55e; }
.tf-kb-type-instruction { background: #a855f7; }
.tf-kb-type-policy { background: #ef4444; }
.tf-kb-type-contract { background: #f59e0b; }
.tf-kb-type-price_list { background: #06b6d4; }
.tf-kb-type-training_guide { background: #ec4899; }
.tf-kb-type-template { background: #6366f1; }
.tf-kb-type-google_doc { background: #4285f4; }
.tf-kb-type-other { background: var(--text-muted); }

/* ===================== СТАТУСЫ ===================== */

.tf-kb-status {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 6px; border-radius: 8px; font-size: 10px;
    font-weight: 500; white-space: nowrap;
}
.tf-kb-status-draft { background: hsla(0,0%,50%,0.15); color: var(--text-muted); }
.tf-kb-status-review { background: hsla(217,91%,60%,0.15); color: var(--color-primary); }
.tf-kb-status-approved { background: hsla(142,71%,45%,0.15); color: #22c55e; }
.tf-kb-status-published { background: hsla(262,65%,65%,0.15); color: #a855f7; }
.tf-kb-status-archived { background: hsla(0,0%,40%,0.1); color: var(--text-muted); opacity: 0.7; }

/* Status pipeline */
.tf-kb-pipeline {
    display: flex; align-items: center; gap: 2px; margin: 6px 0;
}
.tf-kb-pipeline-step {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); transition: background 0.2s;
}
.tf-kb-pipeline-step.done { background: #22c55e; }
.tf-kb-pipeline-step.current { background: var(--color-primary); box-shadow: 0 0 4px var(--color-primary); }
.tf-kb-pipeline-line {
    width: 16px; height: 2px; background: var(--border);
}
.tf-kb-pipeline-line.done { background: #22c55e; }

/* ===================== ДЕТАЛИ ===================== */

.tf-kb-detail-title {
    font-size: 16px; font-weight: 600; color: var(--text-primary);
    flex: 1; line-height: 1.3;
}
.tf-kb-detail-actions {
    display: flex; gap: 4px; flex: 0 0 auto;
}
.tf-kb-detail-section {
    margin-bottom: 10px;
}
.tf-kb-detail-section-title {
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.tf-kb-detail-content {
    font-size: 12px; line-height: 1.6; color: var(--text-primary);
}
.tf-kb-detail-content h2 { font-size: 14px; margin: 8px 0 4px; font-weight: 600; }
.tf-kb-detail-content h3 { font-size: 13px; margin: 6px 0 3px; font-weight: 600; }
.tf-kb-detail-content p { margin: 4px 0; }
.tf-kb-detail-content ul, .tf-kb-detail-content ol { padding-left: 18px; margin: 4px 0; }
.tf-kb-detail-content li { margin: 2px 0; }
.tf-kb-detail-content table {
    width: 100%; border-collapse: collapse; margin: 6px 0;
    font-size: 11px;
}
.tf-kb-detail-content table th,
.tf-kb-detail-content table td {
    border: 1px solid var(--border); padding: 4px 8px; text-align: left;
}
.tf-kb-detail-content table th {
    background: var(--bg-input); font-weight: 600;
}

/* Meta grid in detail */
.tf-kb-meta-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; font-size: 11px;
}
.tf-kb-meta-label {
    color: var(--text-muted); font-size: 10px;
}
.tf-kb-meta-value {
    color: var(--text-primary); font-weight: 500;
}

/* Versions list */
.tf-kb-version-item {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 0; font-size: 11px; border-bottom: 1px solid var(--border);
}
.tf-kb-version-badge {
    background: var(--bg-input); color: var(--text-primary);
    padding: 1px 6px; border-radius: 8px; font-weight: 600;
    font-size: 10px; flex: 0 0 auto;
}
.tf-kb-version-note {
    flex: 1; color: var(--text-muted); min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-kb-version-date {
    flex: 0 0 auto; color: var(--text-muted); font-size: 10px;
}

/* Reviews / history */
.tf-kb-review-item {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 4px 0; font-size: 11px;
}
.tf-kb-review-action {
    padding: 1px 6px; border-radius: 8px; font-size: 9px;
    font-weight: 600; flex: 0 0 auto;
}

/* Google Doc link */
.tf-kb-gdoc-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: #4285f4; font-size: 12px; text-decoration: none;
}
.tf-kb-gdoc-link:hover { text-decoration: underline; }

/* File info */
.tf-kb-file-info {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; background: var(--bg-input);
    border-radius: var(--radius); font-size: 11px;
}

/* AI section */
.tf-kb-ai-summary {
    padding: 8px; background: hsla(142,71%,45%,0.06);
    border: 1px solid hsla(142,71%,45%,0.15);
    border-radius: var(--radius); font-size: 11px;
    line-height: 1.5; color: var(--text-primary);
}

/* ===================== ФИЛЬТРЫ ===================== */

.tf-kb-filters {
    display: flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-bottom: 1px solid var(--border);
    flex: 0 0 auto; flex-wrap: wrap;
}
.tf-kb-filter-select {
    padding: 2px 4px; font-size: 10px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
}

/* ===================== QUILL OVERRIDES ===================== */

.tf-kb-editor-wrap {
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.tf-kb-editor-wrap .ql-toolbar {
    background: var(--bg-input); border-bottom: 1px solid var(--border);
    border-top: none; border-left: none; border-right: none;
}
.tf-kb-editor-wrap .ql-container {
    border: none; font-size: 12px; min-height: 200px;
    color: var(--text-primary);
}
.tf-kb-editor-wrap .ql-editor {
    padding: 10px; min-height: 200px;
}
.tf-kb-editor-wrap .ql-toolbar .ql-stroke {
    stroke: var(--text-muted);
}
.tf-kb-editor-wrap .ql-toolbar .ql-fill {
    fill: var(--text-muted);
}
.tf-kb-editor-wrap .ql-toolbar button:hover .ql-stroke {
    stroke: var(--text-primary);
}
.tf-kb-editor-wrap .ql-toolbar button:hover .ql-fill {
    fill: var(--text-primary);
}

/* ===================== CREATE/EDIT FORM ===================== */

.tf-kb-form {
    padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.tf-kb-form-row {
    display: flex; gap: 6px;
}
.tf-kb-form-field {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.tf-kb-form-label {
    font-size: 10px; color: var(--text-muted); font-weight: 500;
}
.tf-kb-form-input {
    padding: 4px 8px; font-size: 12px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
}
.tf-kb-form-input:focus {
    border-color: var(--color-primary); outline: none;
}
.tf-kb-form-actions {
    display: flex; gap: 6px; padding-top: 6px;
}

/* ===================== AI KNOWLEDGE BADGES ===================== */

/* Knowledge Type бейдж */
.tf-kb-badge-ktype {
    display: inline-flex; align-items: center;
    padding: 1px 5px; border-radius: 6px; font-size: 9px;
    font-weight: 600; white-space: nowrap; letter-spacing: 0.2px;
}
.tf-kb-ktype-system      { background: hsla(0, 84%, 60%, 0.15); color: #ef4444; }
.tf-kb-ktype-ai_behavior { background: hsla(262, 65%, 65%, 0.15); color: #a855f7; }
.tf-kb-ktype-rules       { background: hsla(25, 95%, 53%, 0.15); color: #f97316; }
.tf-kb-ktype-decision    { background: hsla(217, 91%, 60%, 0.15); color: #3b82f6; }
.tf-kb-ktype-process     { background: hsla(199, 89%, 48%, 0.15); color: #0ea5e9; }
.tf-kb-ktype-sop         { background: hsla(172, 66%, 50%, 0.15); color: #14b8a6; }
.tf-kb-ktype-faq         { background: hsla(142, 71%, 45%, 0.15); color: #22c55e; }
.tf-kb-ktype-company     { background: hsla(0, 0%, 50%, 0.12); color: var(--text-muted); }

/* Core AI бейдж */
.tf-kb-badge-core {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 1px 5px; border-radius: 6px; font-size: 9px;
    font-weight: 700; white-space: nowrap;
    background: hsla(142, 71%, 45%, 0.15); color: var(--ai-green);
}

/* Priority бейдж */
.tf-kb-badge-priority {
    display: inline-flex; align-items: center;
    padding: 1px 5px; border-radius: 6px; font-size: 9px;
    font-weight: 600; white-space: nowrap;
}
.tf-kb-prio-critical { background: hsla(0, 84%, 60%, 0.18); color: #ef4444; }
.tf-kb-prio-high     { background: hsla(25, 95%, 53%, 0.15); color: #f97316; }
.tf-kb-prio-normal   { background: hsla(0, 0%, 50%, 0.1); color: var(--text-muted); }
.tf-kb-prio-low      { background: hsla(0, 0%, 50%, 0.06); color: var(--text-muted); opacity: 0.7; }

/* Priority border-left для doc items */
.tf-kb-doc-item[data-priority="critical"] {
    border-left: 2px solid #ef4444;
}
.tf-kb-doc-item[data-priority="high"] {
    border-left: 2px solid #f97316;
}

/* Badges group в doc-meta */
.tf-kb-doc-badges {
    display: flex; align-items: center; gap: 3px;
    flex-wrap: wrap;
}

/* AI layers form section */
.tf-kb-form-section-title {
    font-size: 10px; font-weight: 700; color: var(--color-primary);
    text-transform: uppercase; letter-spacing: 0.5px;
    padding: 6px 0 2px; border-top: 1px solid var(--border);
    margin-top: 4px;
}
.tf-kb-form-checkbox {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--text-primary); cursor: pointer;
}
.tf-kb-form-checkbox input[type="checkbox"] {
    accent-color: var(--ai-green);
}

/* ===================== PROCESS STEPS PIPELINE ===================== */

.tf-kb-process-wrap {
    margin-bottom: 10px;
}
.tf-kb-process-title {
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
    display: flex; align-items: center; justify-content: space-between;
}
.tf-kb-process-steps {
    display: flex; flex-direction: column; gap: 0;
    border-left: 2px solid var(--color-primary); margin-left: 8px; padding-left: 14px;
}
.tf-kb-process-step {
    position: relative; padding: 6px 8px; font-size: 11px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card-bg); margin-bottom: 6px;
    transition: border-color 0.15s;
}
.tf-kb-process-step:hover { border-color: var(--color-primary); }
.tf-kb-process-step::before {
    content: ''; position: absolute; left: -20px; top: 12px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--color-primary); border: 2px solid var(--bg-primary);
}
.tf-kb-process-step-num {
    font-size: 9px; font-weight: 700; color: var(--color-primary);
    margin-right: 4px;
}
.tf-kb-process-step-title {
    font-weight: 600; color: var(--text-primary);
}
.tf-kb-process-step-desc {
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
}
.tf-kb-process-step-meta {
    display: flex; gap: 8px; margin-top: 3px; flex-wrap: wrap;
}
.tf-kb-process-step-meta span {
    font-size: 9px; color: var(--text-muted); white-space: nowrap;
}
.tf-kb-process-step-meta span svg { vertical-align: -2px; margin-right: 2px; }

/* SOP Trigger / Result */
.tf-kb-sop-info {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px;
}
.tf-kb-sop-block {
    padding: 6px 8px; background: var(--bg-input); border-radius: var(--radius);
    font-size: 11px;
}
.tf-kb-sop-block-label {
    font-size: 9px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px;
}

/* ===================== DOCUMENT RELATIONS ===================== */

.tf-kb-relations {
    margin-bottom: 10px;
}
.tf-kb-relations-header {
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
    display: flex; align-items: center; justify-content: space-between;
}
.tf-kb-relation-item {
    display: flex; align-items: center; gap: 6px; padding: 4px 0;
    font-size: 11px; border-bottom: 1px solid var(--border);
}
.tf-kb-relation-item:last-child { border-bottom: none; }
.tf-kb-relation-type {
    flex: 0 0 auto; font-size: 9px; font-weight: 600; padding: 1px 5px;
    border-radius: 6px; white-space: nowrap;
    background: hsla(217, 91%, 60%, 0.12); color: var(--color-primary);
}
.tf-kb-relation-type-depends_on { background: hsla(25, 95%, 53%, 0.12); color: #f97316; }
.tf-kb-relation-type-supersedes { background: hsla(0, 84%, 60%, 0.12); color: #ef4444; }
.tf-kb-relation-type-checklist_for { background: hsla(142, 71%, 45%, 0.12); color: #22c55e; }
.tf-kb-relation-doc {
    flex: 1; cursor: pointer; color: var(--color-primary); min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-kb-relation-doc:hover { text-decoration: underline; }
.tf-kb-relation-remove {
    flex: 0 0 auto; cursor: pointer; color: var(--text-muted);
    font-size: 14px; padding: 0 4px; line-height: 1;
}
.tf-kb-relation-remove:hover { color: #ef4444; }

/* ===================== ACCESS LEVEL BADGE ===================== */

.tf-kb-badge-access {
    display: inline-flex; align-items: center; gap: 2px;
    padding: 1px 5px; border-radius: 6px; font-size: 9px;
    font-weight: 600; white-space: nowrap;
}
.tf-kb-access-public_company { background: hsla(142, 71%, 45%, 0.12); color: #22c55e; }
.tf-kb-access-staff_only { background: hsla(217, 91%, 60%, 0.12); color: #3b82f6; }
.tf-kb-access-management { background: hsla(25, 95%, 53%, 0.12); color: #f97316; }
.tf-kb-access-admin_only { background: hsla(0, 84%, 60%, 0.12); color: #ef4444; }

/* ===================== WORD COUNTER ===================== */

.tf-kb-word-counter {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; color: var(--text-muted);
    padding: 2px 0;
}
.tf-kb-word-counter.warn { color: #f97316; }
.tf-kb-word-counter.over { color: #ef4444; }
.tf-kb-word-bar {
    flex: 1; height: 3px; background: var(--border); border-radius: 2px;
    overflow: hidden; max-width: 100px;
}
.tf-kb-word-bar-fill {
    height: 100%; border-radius: 2px; background: #22c55e;
    transition: width 0.2s, background 0.2s;
}
.tf-kb-word-bar-fill.warn { background: #f97316; }
.tf-kb-word-bar-fill.over { background: #ef4444; }

/* ===================== FOLDER ICONS ===================== */

.tf-kb-folder-lucide {
    flex: 0 0 14px; width: 14px; height: 14px; color: var(--text-muted);
}
.tf-kb-folder-row.active .tf-kb-folder-lucide { color: var(--color-primary); }
.tf-kb-folder-system .tf-kb-folder-name { font-weight: 600; }

/* Process steps editor */
.tf-kb-steps-editor {
    display: flex; flex-direction: column; gap: 6px;
}
.tf-kb-step-row {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 6px 8px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-input);
}
.tf-kb-step-num {
    flex: 0 0 20px; font-size: 10px; font-weight: 700;
    color: var(--color-primary); padding-top: 4px; text-align: center;
}
.tf-kb-step-fields {
    flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.tf-kb-step-fields input, .tf-kb-step-fields textarea {
    padding: 3px 6px; font-size: 11px;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
}
.tf-kb-step-fields textarea { resize: vertical; min-height: 30px; }
.tf-kb-step-remove {
    flex: 0 0 auto; cursor: pointer; color: var(--text-muted);
    font-size: 14px; padding: 4px;
}
.tf-kb-step-remove:hover { color: #ef4444; }

/* Add relation modal */
.tf-kb-relation-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.tf-kb-relation-modal-body {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px; width: 400px;
    max-width: 90vw;
}
.tf-kb-relation-search-results {
    max-height: 200px; overflow-y: auto; margin: 6px 0;
}
.tf-kb-relation-search-item {
    padding: 4px 8px; font-size: 11px; cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.tf-kb-relation-search-item:hover { background: var(--bg-hover); }

/* ===================== FILE UPLOAD ZONE ===================== */

.tf-kb-file-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
}
.tf-kb-file-upload-zone:hover {
    border-color: var(--color-primary);
}
.tf-kb-file-zone-drag {
    border-color: var(--color-primary) !important;
    background: hsla(217, 91%, 60%, 0.06);
}
.tf-kb-file-zone-error {
    border-color: #ef4444 !important;
    background: hsla(0, 84%, 60%, 0.06);
    animation: tf-kb-shake 0.4s;
}
@keyframes tf-kb-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}
.tf-kb-file-pick {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 10px; cursor: pointer; color: var(--text-muted);
    font-size: 11px; text-align: center;
}
.tf-kb-file-pick:hover { color: var(--color-primary); }
.tf-kb-file-pick svg { opacity: 0.5; }
.tf-kb-file-pick:hover svg { opacity: 1; stroke: var(--color-primary); }
.tf-kb-file-preview {
    display: flex; align-items: center; gap: 8px;
    padding: 10px; background: hsla(142, 71%, 45%, 0.06);
    border-top: 1px solid hsla(142, 71%, 45%, 0.15);
}
.tf-kb-file-preview-name {
    flex: 1; font-size: 12px; font-weight: 600; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-file-preview-size {
    flex: 0 0 auto; font-size: 10px; color: var(--text-muted);
}
.tf-kb-file-remove {
    flex: 0 0 auto; cursor: pointer; color: var(--text-muted);
    font-size: 16px; padding: 0 4px; line-height: 1;
    transition: color 0.15s;
}
.tf-kb-file-remove:hover { color: #ef4444; }
.tf-kb-file-existing {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; font-size: 11px; color: var(--text-muted);
    background: var(--bg-input); border-radius: var(--radius);
    margin-top: -4px;
}
.tf-kb-file-existing b { color: var(--text-primary); }

/* ===================== AI MODAL ===================== */

.tf-kb-ai-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.tf-kb-ai-modal-body {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; width: 500px;
    max-width: 90vw; max-height: 80vh; overflow-y: auto;
}

/* ===================== BATCH UPLOAD ===================== */

.tf-kb-batch-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1100; backdrop-filter: blur(2px);
}
.tf-kb-batch-modal {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: 8px; width: 720px; max-width: 95vw;
    max-height: 90vh; display: flex; flex-direction: column;
    overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.tf-kb-batch-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}
.tf-kb-batch-title {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: 6px;
}
.tf-kb-batch-close {
    cursor: pointer; font-size: 18px; color: var(--text-muted);
    padding: 0 4px; line-height: 1; transition: color 0.15s;
}
.tf-kb-batch-close:hover { color: #ef4444; }

/* Dropzone */
.tf-kb-batch-dropzone {
    padding: 10px; cursor: pointer; transition: background 0.2s;
}
.tf-kb-batch-dropzone-inner {
    border: 2px dashed var(--border); border-radius: 8px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px; padding: 30px 20px;
    transition: border-color 0.2s, background 0.2s;
}
.tf-kb-batch-dropzone:hover .tf-kb-batch-dropzone-inner {
    border-color: var(--color-primary);
    background: hsla(217, 91%, 60%, 0.04);
}
.tf-kb-batch-dropzone-drag .tf-kb-batch-dropzone-inner {
    border-color: var(--color-primary) !important;
    background: hsla(217, 91%, 60%, 0.08) !important;
}
.tf-kb-batch-dropzone-text {
    font-size: 13px; color: var(--text-primary); font-weight: 500;
}
.tf-kb-batch-dropzone-hint {
    font-size: 11px; color: var(--text-muted);
}

/* Progress */
.tf-kb-batch-progress {
    padding: 16px; text-align: center;
}
.tf-kb-batch-progress-bar {
    height: 4px; background: var(--border); border-radius: 2px;
    overflow: hidden; margin-bottom: 8px;
}
.tf-kb-batch-progress-fill {
    height: 100%; background: var(--color-primary); border-radius: 2px;
    transition: width 0.3s ease;
}
.tf-kb-batch-progress-text {
    font-size: 11px; color: var(--text-muted);
}

/* Results */
.tf-kb-batch-results {
    flex: 1; overflow-y: auto; padding: 10px;
    display: flex; flex-direction: column; gap: 6px;
}
.tf-kb-batch-results-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11px; color: var(--text-muted); padding: 0 4px 6px;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.tf-kb-batch-errors-count {
    color: #ef4444; font-weight: 600;
}

/* Batch item */
.tf-kb-batch-item {
    padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--card-bg);
    transition: border-color 0.15s;
}
.tf-kb-batch-item:hover { border-color: var(--color-primary); }
.tf-kb-batch-item-error {
    border-color: hsla(0, 84%, 60%, 0.3);
    background: hsla(0, 84%, 60%, 0.05);
}
.tf-kb-batch-item-error-msg {
    font-size: 10px; color: #ef4444; margin-top: 2px;
}

.tf-kb-batch-item-row1 {
    display: flex; align-items: flex-start; gap: 8px;
}
.tf-kb-batch-check {
    flex: 0 0 auto; padding-top: 2px;
}
.tf-kb-batch-check input { accent-color: var(--color-primary); }
.tf-kb-batch-item-main { flex: 1; min-width: 0; }
.tf-kb-batch-item-original {
    font-size: 10px; color: var(--text-muted); margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tf-kb-batch-item-size { font-size: 9px; }
.tf-kb-batch-item-name { font-size: 12px; font-weight: 600; }

.tf-kb-batch-item-title-row {
    display: flex; align-items: center; gap: 6px;
}
.tf-kb-batch-title-input {
    flex: 1; padding: 4px 8px; font-size: 12px; font-weight: 600;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary);
}
.tf-kb-batch-title-input:focus {
    border-color: var(--color-primary); outline: none;
}
.tf-kb-batch-ai-badge {
    flex: 0 0 auto; font-size: 9px; font-weight: 700; padding: 1px 5px;
    border-radius: 4px; background: hsla(142, 71%, 45%, 0.15);
    color: var(--ai-green); white-space: nowrap;
}

/* Row 2: selects */
.tf-kb-batch-item-row2 {
    display: flex; gap: 4px; margin-top: 6px; padding-left: 26px;
}
.tf-kb-batch-select {
    flex: 1; padding: 3px 4px; font-size: 10px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-primary);
}
.tf-kb-batch-select:focus {
    border-color: var(--color-primary); outline: none;
}

/* Row 3: tags + summary */
.tf-kb-batch-item-row3 {
    margin-top: 4px; padding-left: 26px;
}
.tf-kb-batch-tags {
    display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 3px;
}
.tf-kb-batch-tag {
    font-size: 9px; padding: 1px 5px; border-radius: 4px;
    background: hsla(217, 91%, 60%, 0.1); color: var(--color-primary);
    white-space: nowrap;
}
.tf-kb-batch-summary {
    font-size: 10px; color: var(--text-muted); line-height: 1.3;
}

/* Actions */
.tf-kb-batch-actions {
    display: flex; gap: 6px; justify-content: flex-end;
    padding: 10px 14px; border-top: 1px solid var(--border);
    background: var(--card-bg);
}

/* ===================== AI RENAME ===================== */

.tf-kb-rename-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1100;
}
.tf-kb-rename-modal {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: 8px; width: 480px; max-width: 95vw;
    overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.tf-kb-rename-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    font-size: 13px; font-weight: 600; background: var(--card-bg);
}
.tf-kb-rename-current {
    padding: 8px 14px; font-size: 11px; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.tf-kb-rename-current b { color: var(--text-primary); }
.tf-kb-rename-suggestions {
    padding: 8px 14px; display: flex; flex-direction: column; gap: 4px;
}
.tf-kb-rename-option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; cursor: pointer; font-size: 12px;
    border: 1px solid var(--border); border-radius: 6px;
    transition: all 0.15s;
}
.tf-kb-rename-option:hover {
    border-color: var(--color-primary); background: hsla(217, 91%, 60%, 0.05);
}
.tf-kb-rename-option.active {
    border-color: var(--color-primary); background: hsla(217, 91%, 60%, 0.1);
}
.tf-kb-rename-num {
    flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--color-primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
}
.tf-kb-rename-custom {
    display: flex; gap: 6px; padding: 10px 14px;
    border-top: 1px solid var(--border);
}
.tf-kb-rename-custom input { flex: 1; }

/* ===================== BATCH UPLOAD BUTTON ===================== */

.tf-kb-batch-btn {
    display: flex; align-items: center; gap: 4px;
    font-size: 11px; cursor: pointer;
}
