/* ════════ P4b 재설계 — 지식 지도 / 탐색 / 유닛 / 검토 (§0.5 calm 등급) ════════ */

/* 탭의 검토 대기 배지 — 채운 필 금지, 작은 무채 카운트 + 민트 점 의미만 */
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 6px;
  font-size: 11px; font-weight: 700; color: var(--ink-sub);
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
  vertical-align: middle;
}
.tabs a.active .tab-count { border-color: var(--line-net-2); color: var(--blue); }

/* ── 1) 지식 지도 ── */
.health-card { margin-top: 8px; }
.stat-link { text-decoration: none; }
.stat-link:hover .num { color: var(--blue); }

.kind-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px; margin-top: 12px;
}
/* 카드 = 폴더(kind). §0.5: 헤어라인 보더 + 틴트, 상단 교대 보더 금지. 선택/호버만 블루. */
.kind-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-tint); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 16px; min-height: 132px; cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}
.kind-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.kind-card.empty { background: var(--bg); }
.kind-card.empty .kind-card-num { color: var(--muted-2); }
.kind-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* 글리프 = 폴더 식별 문자(kind). 모노스페이스 무채 — 코드 의미론 */
.kind-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; font-weight: 800; color: var(--ink-sub);
}
.kind-inject { font-size: 11.5px; font-weight: 700; color: var(--muted-head); white-space: nowrap; }
.kind-card-name { font-size: 16px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.kind-card-sub { font-size: 12px; font-weight: 600; color: var(--muted-2); margin-top: -4px; }
.kind-card-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: auto; }
.kind-card-num { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -1px; line-height: 1; }
.kind-card-num small { font-size: 13px; font-weight: 600; color: var(--muted-2); letter-spacing: 0; }
.kind-card-fresh { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-sub); }
.kind-card-fresh.dim { color: var(--muted-2); }
/* 주제 영역 카드(제품/비즈니스) — 보통 2장이라 auto-fill 4칸의 우측 빈칸이 생긴다. flex+중앙정렬로 빈칸 없애고
   카드 폭은 위 종류 카드와 비슷하게 유지(과하게 넓어지지 않게 cap). */
.area-grid { display: flex; flex-wrap: wrap; justify-content: center; }
.area-grid > .area-card { flex: 1 1 240px; max-width: 340px; }

/* ── 2) 탐색 ── */
.browse-layout { display: flex; gap: 22px; align-items: flex-start; margin-top: 8px; }
.browse-side { flex: 0 0 218px; min-width: 0; position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain; }
.browse-main { flex: 1; min-width: 0; }
@media (max-width: 820px) { .browse-layout { flex-direction: column; } .browse-side { position: static; flex-basis: auto; width: 100%; } }

.browse-tree { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.tree-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px;
  cursor: pointer; color: var(--ink-sub); border: 1px solid transparent;
}
.tree-item:hover { background: var(--bg-tint); color: var(--ink); }
.tree-item.on { background: var(--bg-sel); border-color: var(--line-net-2); color: var(--ink); }
.tree-glyph {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 22px; height: 22px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; font-weight: 800; color: var(--muted-head);
}
.tree-glyph.all { color: var(--muted-2); }
.tree-label { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { font-size: 12px; font-weight: 600; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tree-item-sub { padding-left: 24px; }   /* '전체' 하위 한 단 들여쓰기 — 인덱스(핀) 필터(#336) */
.tree-item-sub .tree-glyph { font-size: 11px; }   /* 📌 이모지 글리프를 박스에 맞게 살짝 축소 */
/* 도메인 맵 등 filter-bar 의 레포 select — 기본이 너무 좁아 레포명이 잘렸다(browse 는 위에서 별도 폭 지정). */
.flt-domain { min-width: 220px; }

/* kind 배지(목록/검토 공용) — 모노 글리프 + 무채 한글 라벨 */
.kind-badge { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.kb-glyph {
  display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px;
  border-radius: 5px; background: var(--bg-tint-2); color: var(--muted-head);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; font-weight: 800;
}
.kb-ko { font-size: 12.5px; font-weight: 600; color: var(--ink-sub); }

/* ── 3) 유닛 상세 ── */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--ink-sub); }
.crumb-link:hover { color: var(--blue); }
.crumb-sep { color: var(--muted-2); }
.unit-head { padding-bottom: 0; }
.unit-layout { display: flex; gap: 22px; align-items: flex-start; margin-top: 10px; }
.unit-layout .detail-card { flex: 1.6; min-width: 0; }
.unit-side { flex: 1; min-width: 0; position: sticky; top: 80px; background: var(--bg-tint); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.unit-side .fields-table { font-size: 13px; }
.unit-side .fields-table td { padding: 5px 14px 5px 0; }
@media (max-width: 820px) { .unit-layout { flex-direction: column; } .unit-side { position: static; width: 100%; } }

/* 수정 이력(작성자/리비전) 타임라인 — 메타 패널 하단 접이식 */
.rev-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.rev-summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-sub); list-style: none; }
.rev-summary::-webkit-details-marker { display: none; }
.rev-summary::before { content: '▸ '; color: var(--muted); }
.rev-details[open] .rev-summary::before { content: '▾ '; }
.rev-count { color: var(--muted); font-weight: 600; }
.rev-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.rev-row { font-size: 12.5px; border-left: 2px solid var(--line); padding: 2px 0 2px 10px; }
.rev-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rev-ver { font-weight: 700; color: var(--ink); }
.rev-op { color: var(--ink-sub); font-weight: 600; }
.rev-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--bg-tint-2); color: var(--ink-note); }
.rev-actor-ai { background: #EEF4FF; color: var(--blue-deep); }
.rev-actor-human { background: var(--bg-success); color: var(--mint-deep); }
.rev-actor-connector { background: #FBF3EE; color: var(--coral-text); }
.rev-actor-system { background: var(--bg-tint-2); color: var(--muted-head); }
.rev-chan { background: var(--bg-tint); color: var(--ink-sub); }
.rev-meta { margin-top: 3px; color: var(--muted); }
.rev-snippet { margin-top: 4px; color: var(--ink-sub); font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.unit-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.unit-title-row .detail-title { margin: 0; }
.unit-actions { display: flex; gap: 8px; margin: 16px 0 4px; flex-wrap: wrap; }
.unit-actions-end { justify-content: flex-end; }
.unit-body { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }

/* ── 4) 검토 ── */
.review-row { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border-bottom: 1px solid var(--line-row); }
.review-row:last-child { border-bottom: none; }
.review-main { flex: 1; min-width: 0; }
.review-title { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.review-title:hover { color: var(--blue); }
.review-acts { display: flex; gap: 8px; flex: none; }

/* ── 지식(#/knowledge) — 두 직교축(주입·출처) 칩 + 카테고리 칩. §0.5 절제: 채운 필 최소, 점·테두리로 위계. ── */
.kn-chip { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; line-height: 1.7;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--ink-sub); white-space: nowrap; vertical-align: middle; }
/* 주입 = 항상(민트 계열, 서비스 포인트 — '늘 곁에 있는 규칙') / 검색(중립 — 필요할 때 소환) */
.kn-inject-always { color: var(--mint-deep); background: #F2FBF8; border-color: #DCEFE8; }
.kn-inject-recalled { color: var(--ink-sub); background: var(--bg-tint); border-color: var(--line); }
/* 출처 = 저작(중립 푸른 계열) / 외부 미러(흐린 회색 — 큐레이션 아님, 외부 진실) */
.kn-prov-authored { color: var(--blue); background: var(--bg-tint-2); border-color: var(--line-net-2); }
.kn-prov-observed { color: var(--muted-2); background: var(--bg-tint); border-color: var(--line); }
/* 작성 주체(#449) = 사람(민트 — 직접 저작·큐레이션, 드물어 눈에 띔) / AI(중립 — 사후 검토 대상). 지식 탭에서 주입 칩을 대체. */
.kn-author-human { color: var(--mint-deep); background: #F2FBF8; border-color: #DCEFE8; }
.kn-author-ai { color: var(--ink-sub); background: var(--bg-tint); border-color: var(--line); }
.kn-author-rule, .kn-author-observed { color: var(--muted-2); background: var(--bg-tint); border-color: var(--line); }
/* 핀(WIKI 인덱스) 뱃지 — 항상-주입이라 inject-always 와 같은 민트 계열로 묶는다('늘 곁에' 의미 일관). */
.kn-pin { color: var(--mint-deep); background: #F2FBF8; border-color: #DCEFE8; }
.kn-cat-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 2px; }
.kn-cat-chip { color: var(--ink-sub); background: var(--bg-tint); }
.kn-cat-empty { font-size: 13px; color: var(--muted-2); margin: 4px 0 2px; }
/* 카테고리를 메타데이터 셀로 편입(#290) — 단독 섹션 마진 제거, pill만 2px 위로 정렬. */
.kn-cat-inmeta { margin: 2px 0 0; gap: 6px; }
.umeta-empty { color: var(--muted-2); }

/* ── #290 연결된 지식 — 방향(포워드 →/백링크 ←) 그룹 + 컴팩트 리스트(제목 한 줄 전체폭, 옵시디언식). 카드 없음. ── */
.kn-links { margin: 4px 0 2px; }
.kn-links-body { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 2px; }
.kn-linkdir { display: flex; flex-direction: column; gap: 3px; }
.kn-linkdir-head { font-size: 12.5px; font-weight: 700; color: var(--muted-head); }
.kn-linkrows { display: flex; flex-direction: column; }
.kn-linkrow { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 3px 6px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.kn-linkrow:hover { background: var(--bg-tint); }
.kn-linkrow-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; line-height: 1.55; }
.kn-linkrow:hover .kn-linkrow-title { color: var(--blue); }
.kn-link-rel { flex: none; font-size: 10px; font-weight: 800; padding: 0 5px; border-radius: 5px; color: var(--blue-deep); background: var(--bg-punch); letter-spacing: -.2px; }
.kn-link-rel.kn-link-contradicts { color: var(--coral-text); background: #FCF1EF; }
.kn-link-rel.kn-link-source { color: var(--ink-sub); background: var(--bg-tint-2); }
/* #907 본문 [[…]] 파생 엣지 '본문' 배지 — 출처자료(kn-link-source)와 지금은 같은 톤이지만 별개 개념이라 클래스를 나눈다. */
.kn-link-rel.kn-link-auto { color: var(--ink-sub); background: var(--bg-tint-2); }
.kn-linkrow-x { flex: none; width: 18px; height: 18px; border: none; background: transparent; color: var(--muted-2); cursor: pointer; border-radius: 5px; font-size: 11px; line-height: 1; opacity: 0; transition: opacity .12s; }
.kn-linkrow:hover .kn-linkrow-x { opacity: 1; }
.kn-linkrow-x:hover { background: #FDECEC; color: #D6453C; }
/* 비슷한 지식(벡터 #172, 자동) — 같은 컴팩트 리스트 행 재사용. % pill은 '관계'가 아니라 유사도라 색을 구분. */
.kn-link-rel.kn-link-sim { color: var(--muted-head); background: var(--bg-tint-2); font-variant-numeric: tabular-nums; min-width: 30px; text-align: center; }
.kn-sim-hint { flex: none; font-size: 11px; font-weight: 600; color: var(--muted-2); }

/* ── 위키 ↔ 프로젝트 연결(#255·#256·#257) — 연결된 프로젝트 칩(필요/산출) + 선택 피커. ── */
.kn-projlinks { margin: 4px 0 2px; }
.kn-projlink-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 2px; }
.kn-projlink-group { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.kn-projlink-rel { flex: none; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 6px; letter-spacing: -.2px; }
.kn-projlink-rel-required { color: var(--blue); background: var(--bg-tint-2); border: 1px solid var(--line-net-2); }
.kn-projlink-rel-produced { color: #1F9D6B; background: var(--bg-success, #F0FAF5); border: 1px solid #CFEBDF; }
.kn-projchip { gap: 6px; padding: 1px 4px 1px 9px; }
.kn-projchip-link { color: var(--ink); text-decoration: none; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kn-projchip-link:hover { color: var(--blue); }
.kn-projchip-x { flex: none; width: 18px; height: 18px; border: none; background: transparent; color: var(--muted-2); cursor: pointer; border-radius: 5px; font-size: 11px; line-height: 1; }
.kn-projchip-x:hover { background: var(--bg-danger, #FDECEC); color: var(--danger, #D6453C); }
/* 선택 피커 상단 관계 토글 바 */
.kn-projpick-bar { display: flex; align-items: center; gap: 8px; }
.kn-projpick-rel { flex: none; }
/* 생성 페이지 — 프로젝트 연결 스테이징 */
.kn-create-card .field { margin-bottom: 14px; }
.kn-create-projhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kn-staged-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }

