/* ═══════════════════════════════════════════════════════
   14  RAG 관리 (KB Admin)
   ══════════════════════════════════════════════════════ */
.kb-login-card { max-width: 460px; }
.kb-main { display: flex; flex-direction: column; gap: 12px; }
.kb-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--s1); border: 1px solid var(--bd1);
  border-radius: var(--rm);
}
.kb-session { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--t1); }
.kb-actions { display: flex; gap: 8px; }
.kb-filters { padding: 12px; }
.kb-msg { font-size: 12px; color: var(--t2); margin-left: 8px; }
.kb-stats { font-size: 12px; color: var(--t2); padding: 4px 6px; }

.kb-doc-tbl { width: 100%; font-size: 12px; }
.kb-doc-tbl th, .kb-doc-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--bd1); }
.kb-doc-tbl th { background: var(--s1); text-align: left; font-weight: 600; color: var(--t1); }
.kb-doc-tbl td.mono { font-family: var(--ffm); font-size: 11px; color: var(--t2); }

.kb-tag {
  display: inline-block; padding: 1px 6px; margin: 0 2px 2px 0;
  background: var(--s2); border: 1px solid var(--bd1); border-radius: 8px;
  font-size: 11px; color: var(--t1);
}

.kb-status {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.kb-st-pending   { background: #3a3a55; color: #aab2d4; }
.kb-st-parsing   { background: #4a4a1a; color: #f3d76b; }
.kb-st-embedding { background: #4a4a1a; color: #f3d76b; }
.kb-st-indexed   { background: #1f4a2a; color: #6bd58b; }
.kb-st-failed    { background: #5a1f1f; color: #f37070; }
.kb-st-disabled  { background: #303032; color: #888; }

.kb-err {
  font-size: 11px; color: #f37070; margin-top: 2px;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 모달 */
.kb-modal {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.kb-modal.hidden { display: none; }
.kb-modal-body {
  background: var(--s2); border: 1px solid var(--bd2);
  border-radius: var(--rl); padding: 22px;
  width: 460px; max-width: 92vw; max-height: 90vh; overflow-y: auto;
}
.kb-modal-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; color: var(--t0); }

/* 청크 미리보기 모달 (큰 사이즈) */
.kb-chunk-modal-body { width: 820px; max-width: 96vw; max-height: 92vh; }
.kb-chunk-body { max-height: 70vh; overflow-y: auto; padding-right: 4px; margin-bottom: 12px; }
.kb-chunk-stat { color: var(--t2); font-size: 12px; margin-bottom: 8px; }
.kb-chunk-card {
  border: 1px solid var(--bd1); border-radius: var(--rm);
  margin-bottom: 8px; background: var(--s1); overflow: hidden;
}
.kb-chunk-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; cursor: pointer; user-select: none;
  background: var(--s2); border-bottom: 1px solid var(--bd1);
}
.kb-chunk-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: #2a3a5a; color: #b8d4ff;
}
.kb-chunk-kind-table { background: #3a5a2a; color: #c0e0b0; }
.kb-chunk-kind-page  { background: #5a4a2a; color: #ffd09c; }
.kb-chunk-kind-row   { background: #2a5a4a; color: #a0e0d0; }
.kb-chunk-locator {
  flex: 1; font-family: var(--ffm); font-size: 11px; color: var(--t2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-chunk-len { font-family: var(--ffm); font-size: 11px; color: var(--t3); }
.kb-chunk-preview {
  padding: 8px 10px; font-size: 12px; line-height: 1.5; color: var(--t1);
  white-space: pre-wrap; word-break: break-word;
}
.kb-chunk-full { display: none; }
.kb-chunk-card.open .kb-chunk-preview { display: none; }
.kb-chunk-card.open .kb-chunk-full { display: block; }
.kb-chunk-full pre {
  margin: 0; padding: 10px 12px;
  font-size: 12px; line-height: 1.55; color: var(--t1);
  white-space: pre-wrap; word-break: break-word;
  background: var(--s0); font-family: var(--ffm);
  max-height: 50vh; overflow-y: auto;
}

/* Field Instrument Inference */
.kb-infer-card { border-left: 3px solid #4472C4; }
.kb-infer-body { padding: 8px 0; }
.kb-infer-desc { color: #666; font-size: 0.9em; margin: 8px 0; }
.kb-infer-options { margin: 8px 0; }
.kb-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.9em; }
.kb-toggle input { margin: 0; }
.kb-infer-result { margin-top: 12px; padding: 12px; background: #f0f7ff; border-radius: 6px; }
.kb-infer-stats { display: flex; gap: 16px; margin-bottom: 8px; }
.kb-stat { font-weight: 600; color: #333; }
.kb-stat::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4472C4; margin-right: 4px; }
