/* coaching-content-intel — 따뜻한 톤의 라이프코치 팔레트 */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f4efe7;
  --ink: #2f2a24;
  --ink-soft: #6b6258;
  --line: #e7ddd930;
  --line-solid: #e8e0d5;
  --accent: #c8743b;       /* 따뜻한 테라코타 */
  --accent-soft: #f3e4d7;
  --green: #4f8a5b;
  --amber: #c79a2e;
  --red: #c4543f;
  --shadow: 0 1px 3px rgba(70, 55, 40, 0.06), 0 6px 20px rgba(70, 55, 40, 0.05);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 헤더 ── */
header.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-solid);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 18px; letter-spacing: -0.02em; }
.brand .sub { font-size: 13px; color: var(--ink-soft); }
.brand .dot { color: var(--accent); }
nav.tabs { display: flex; gap: 4px; margin-left: auto; }
nav.tabs button {
  font: inherit; font-size: 14px; font-weight: 500;
  border: none; background: transparent; color: var(--ink-soft);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
nav.tabs button:hover { background: var(--surface-2); color: var(--ink); }
nav.tabs button.active { background: var(--accent); color: #fff; }

/* ── 레이아웃 ── */
main { max-width: 1180px; margin: 0 auto; padding: 28px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 신선도 배너 ── */
.freshness {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff7ec; border: 1px solid #f0dcc0;
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px;
  font-size: 13px; color: #7a5a2e;
}
.freshness b { color: #5e4420; }

/* ── 섹션 ── */
.section { margin-bottom: 34px; }
.section > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); margin-bottom: 14px; font-weight: 600;
}

/* ── 카드 그리드 ── */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr !important; } }

.card {
  background: var(--surface); border: 1px solid var(--line-solid);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.card.link { cursor: pointer; }
.card.link:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(70,55,40,.08), 0 12px 30px rgba(70,55,40,.08); }

/* 파이프라인 카드 */
.pipe .stage { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.pipe .status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; display: inline-block; margin-bottom: 10px; }
.pipe .detail { font-size: 13px; color: var(--ink-soft); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* 상태 색 */
.s-검증중, .s-ready { background: #e6f1e8; color: var(--green); }
.s-설계, .s-risk { background: #faf0d6; color: var(--amber); }
.s-미착수, .s-blocked { background: #f7e3df; color: var(--red); }

/* 소스 매트릭스 */
.source .top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.source .emoji { font-size: 20px; }
.source .name { font-weight: 600; }
.source .key { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.source .key.need { background: #f7e3df; color: var(--red); }
.source .note { font-size: 12.5px; color: var(--ink-soft); }

/* 주제 카드 */
.topic .head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.topic .emoji { font-size: 22px; }
.topic .title { font-weight: 700; font-size: 16px; }
.topic .counts { margin-left: auto; font-size: 12px; color: var(--ink-soft); }
.topic .fresh-badge { background: var(--green); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.topic .tldr { font-size: 13.5px; color: var(--ink-soft); }

/* 최근 피드 */
.feed-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line-solid); }
.feed-item:last-child { border-bottom: none; }
.feed-item a { color: var(--ink); text-decoration: none; font-size: 14px; flex: 1; }
.feed-item a:hover { color: var(--accent); }
.chip { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.chip.fresh { background: #e6f1e8; color: var(--green); }
.chip.src { background: var(--accent-soft); color: var(--accent); }
.feed-item .date { font-size: 12px; color: var(--ink-soft); width: 86px; text-align: right; white-space: nowrap; }

/* ── 위키 브라우저 ── */
.wiki-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .wiki-layout { grid-template-columns: 1fr; } }
.wiki-nav {
  position: sticky; top: 80px;
  background: var(--surface); border: 1px solid var(--line-solid);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.wiki-nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 14px 0 6px; font-weight: 600; }
.wiki-nav .group:first-child { margin-top: 0; }
.wiki-nav a { display: block; font-size: 13.5px; color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.wiki-nav a:hover { background: var(--surface-2); }
.wiki-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.wiki-content {
  background: var(--surface); border: 1px solid var(--line-solid);
  border-radius: var(--radius); padding: 30px 36px; box-shadow: var(--shadow);
  min-height: 60vh;
}
.wiki-content .placeholder { color: var(--ink-soft); text-align: center; padding: 80px 0; }

/* 마크다운 렌더 */
.md h1 { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--accent-soft); }
.md h2 { font-size: 19px; margin: 26px 0 10px; color: var(--ink); }
.md h3 { font-size: 16px; margin: 20px 0 8px; }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0 10px 22px; }
.md li { margin: 4px 0; }
.md a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.md a:hover { border-bottom-color: var(--accent); }
.md code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }
.md pre { background: #2f2a24; color: #f4efe7; padding: 16px; border-radius: 10px; overflow-x: auto; margin: 14px 0; }
.md pre code { background: none; padding: 0; color: inherit; }
.md blockquote { border-left: 3px solid var(--accent); padding: 4px 16px; margin: 14px 0; color: var(--ink-soft); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line-solid); padding: 8px 11px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md tr:nth-child(even) td { background: #fdfbf8; }

.loading { color: var(--ink-soft); font-size: 14px; padding: 40px; text-align: center; }

/* ── 공용 브라우즈 레이아웃 (콘텐츠 탭) ── */
.browse-layout { display: grid; grid-template-columns: 330px 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .browse-layout { grid-template-columns: 1fr; } }
.browse-nav {
  position: sticky; top: 80px;
  background: var(--surface); border: 1px solid var(--line-solid);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.browse-content {
  background: var(--surface); border: 1px solid var(--line-solid);
  border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); min-height: 60vh;
}
.browse-content .placeholder { color: var(--ink-soft); text-align: center; padding: 80px 0; }

/* 필터바 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filter-bar select { font: inherit; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--line-solid); border-radius: 8px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.f-toggle { font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* 콘텐츠 목록 카드 */
.content-list-items { display: flex; flex-direction: column; gap: 10px; }
.content-card { border: 1px solid var(--line-solid); border-radius: 12px; padding: 12px; cursor: pointer; transition: all .15s; background: var(--surface); }
.content-card:hover { border-color: var(--accent-soft); transform: translateY(-1px); box-shadow: var(--shadow); }
.content-card.active { border-color: var(--accent); background: var(--accent-soft); }
.cc-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cc-date { margin-left: auto; font-size: 11px; color: var(--ink-soft); }
.cc-title { font-weight: 600; font-size: 14px; line-height: 1.4; margin-bottom: 6px; }
.cc-tldr { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; line-height: 1.5; }
.cc-foot { display: flex; }

/* 중복 위험 배지 */
.dup-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.dup-none { background: #e6f1e8; color: var(--green); }
.dup-low { background: #eef4ec; color: var(--green); }
.dup-med { background: #faf0d6; color: var(--amber); }
.dup-high { background: #f7e3df; color: var(--red); }

/* 콘텐츠 상세 */
.cd-head { border-bottom: 2px solid var(--accent-soft); padding-bottom: 16px; margin-bottom: 8px; }
.cd-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cd-date { font-size: 12px; color: var(--ink-soft); }
.cd-head h1 { font-size: 22px; letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 6px; border: none; padding: 0; }
.cd-author { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.cd-eng { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 12px; }
.cd-link { display: inline-block; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); padding: 7px 14px; border-radius: 999px; text-decoration: none; }
.cd-link:hover { filter: brightness(1.06); }
.cd-section { margin-top: 20px; }
.cd-section h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; font-weight: 700; }
.cd-section p { font-size: 14px; line-height: 1.75; color: var(--ink); white-space: pre-wrap; }

/* ── 콘텐츠 맥락 AI 챗봇 ── */
.cd-section.chat { margin-top: 26px; border-top: 1px dashed var(--line-solid); padding-top: 20px; }
.chat-note { font-size: 12.5px; color: var(--ink-soft); background: var(--surface-2); border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; }
.chat-note b { color: var(--ink); }
.chat-msgs { display: flex; flex-direction: column; gap: 12px; max-height: 360px; overflow-y: auto; padding: 4px 2px; }
.chat-empty { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 18px 0; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.chat-who { font-size: 11px; color: var(--ink-soft); padding: 0 4px; }
.chat-bubble { font-size: 13.5px; line-height: 1.65; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-bubble { background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-typing { letter-spacing: 2px; color: var(--ink-soft); animation: chatpulse 1s infinite; }
@keyframes chatpulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
.chat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.chat-chip { font: inherit; font-size: 12px; border: 1px solid var(--accent-soft); background: var(--accent-soft); color: var(--accent); padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.chat-chip:hover { background: var(--accent); color: #fff; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; font: inherit; font-size: 14px; padding: 10px 14px; border: 1px solid var(--line-solid); border-radius: 999px; background: var(--surface); color: var(--ink); }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form input:disabled { background: var(--surface-2); color: var(--ink-soft); }
.chat-form button { font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); border: none; padding: 0 18px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.chat-form button:hover:not(:disabled) { filter: brightness(1.06); }
.chat-form button:disabled { opacity: .55; cursor: default; }

/* 칩 변형 + 미니 버튼 */
.chip.ok { background: #e6f1e8; color: var(--green); }
.chip.warn { background: #faf0d6; color: var(--amber); }
.mini-btn { font: inherit; font-size: 11px; font-weight: 600; border: 1px solid var(--accent-soft); background: var(--accent-soft); color: var(--accent); padding: 2px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.mini-btn:hover { background: var(--accent); color: #fff; }
