/* ══ 챗봇 화면 — 7차 퍼블리싱(챗봇 팝업 layout_chatbot_popup.html · chatbot.css, W7-38) 구조·모양 ══
   7차 chatbot.css 를 덮어쓰지 않고 비교해 옮겼다: 색·간격은 아래 --cb-* 토큰, 그 밖은 SDC pub2026 토큰(krds-tokens.css).
   데모 스위처 규칙(7차 3~13행)은 넣지 않았다. 라이트 모드만(W7-27). 동작 클래스는 chat.js·feedback.js·explain.js·cb-ui.js 와 같다.
   그림: static/img/ico_chat_*.svg · chatbot_logo.png(7차 원본 그대로). */
:root {
  --cb-primary-50: #6a5ce2; --cb-primary-60: #40369e; --cb-primary-70: #201384; --cb-primary-hover: #5a4ec0;
  --cb-secondary: #eae8f9; --cb-line: #eaeaee; --cb-bg: #f3f3f5; --cb-check-bg: #f8f8ff; --cb-dash: #d1d1d1;
  --cb-blue: #0b50d0; --cb-blue-weak: #ecf2fe; --cb-green: #285811; --cb-green-weak: #edf6e1; --cb-done: #1e3fc7; --cb-done-bg: #e3e8ff;
  /* 경계선 대비 3:1(W7-25 #4) — 7차 #aea8e8 · #bebebe 는 흰 바탕 2:1 이라 한 단계 진하게 */
  --cb-chip-line: #8a80dc; --cb-btn-line: var(--gray-60);
  --cb-filter-primary: brightness(0) saturate(100%) invert(34%) sepia(83%) saturate(1107%) hue-rotate(223deg) brightness(93%) contrast(91%);
  --cb-filter-info: brightness(0) saturate(100%) invert(29%) sepia(68%) saturate(5477%) hue-rotate(229deg) brightness(87%) contrast(92%);
  --cb-filter-warning: brightness(0) saturate(100%) invert(34%) sepia(41%) saturate(1223%) hue-rotate(7deg) brightness(98%) contrast(101%);
  --clamp-fs-14-15: clamp(14px, 1.41vw, 15px);
  --clamp-fs-20-24: clamp(20px, 1.6vw + 12px, 24px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cb-bg); color: var(--text-default); font-family: var(--font-sans); font-size: var(--clamp-fs-14-15);
  line-height: 1.5; letter-spacing: -0.02em; word-break: keep-all; overflow-wrap: break-word;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.popup { display: block; height: 100vh; overflow: auto; }
button, input, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); }

/* ── 정부 누리집 배너·푸터 — 모양은 site-frame.css(SDC 원본). 챗봇은 <html data-gov-banner="on"> 일 때만 둘 다 보인다(W7-9 · W7-10 §2c) ── */
html:not([data-gov-banner="on"]) :is(.gov-eg, #wrap-footer) { display: none; }
.gov-eg { flex-shrink: 0; }
/* ── 배너·푸터 없음(팝업 W7-16 · W7-18 부터 단독 화면 기본) → 화면 틀이 창 높이에 꽉 차고 대화 영역만 스크롤(스크롤 1개).
   [닫기]는 팝업 모드(popup.js 가 data-mode="popup")에서만 ── */
html:not([data-mode="popup"]) #closeChat { display: none; }
html:not([data-gov-banner="on"]) body.popup { height: 100vh; height: 100dvh; overflow: hidden; }

/* ══ 화면 틀(7차): 헤더(고정) · 바디(스크롤) · 푸터(고정) ══ */
.wrap-chatbot { overflow: hidden; display: flex; flex-direction: column; width: 100%; height: 100vh; height: 100dvh; min-width: 320px; min-height: 440px; background: var(--cb-bg); }
.chatbot-body, .chatbot-footer { width: 100%; max-width: 1000px; margin: 0 auto; }

/* 헤더 */
.chatbot-header { display: flex; align-items: center; flex-wrap: wrap; position: relative; gap: 12px 10px; flex-shrink: 0; padding: 16px 15px 13px;
  box-shadow: 0 1px 3px var(--cb-dash); background: var(--bg-default); }
.chatbot-logo { display: flex; align-items: center; flex: 1 1 100%; gap: 8px; margin: 0; padding-right: 28px; line-height: 1; font-size: inherit; }
.chatbot-logo img { display: block; width: auto; height: clamp(18px, 1.9vw, 22px); }
.chatbot-logo em { color: #1a1a1a; font-size: clamp(18px, 1.95vw, 22px); font-weight: 700; font-style: normal; }
.chatbot-close { overflow: hidden; position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; padding: 0; text-indent: -9999px; border: 0; border-radius: 4px; background: transparent; }
.chatbot-close::before, .chatbot-close::after { content: ""; position: absolute; top: calc(50% - 1px); left: calc(50% - 7px); width: 14px; height: 2px; border-radius: 2px; background: #9b9bb0; }
.chatbot-close::before { transform: rotate(45deg); }
.chatbot-close::after { transform: rotate(-45deg); }
.chatbot-new { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 4px 2px; color: #333; font-weight: 500; border: 0; background: transparent; }
.chatbot-new::before { content: ""; width: 17px; height: 17px; background: url(img/ico_chat_new.svg) no-repeat center / contain; }
.chatbot-new:is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: 3px; }
/* 연결 상태 — <i> 하나만(state-on 보라 연결됨 · state-off 빨강 연결 안 됨 · 클래스 없음 초록 확인 중) */
.chatbot-state, .chatbot-state > i { display: inline-flex; align-items: center; }
.chatbot-state { flex: 1 1 auto; gap: 6px 12px; color: #333; font-weight: 500; white-space: nowrap; }
.chatbot-state > i { gap: 6px; font-style: normal; }
.chatbot-state > i::before { content: ""; flex: 0 0 auto; width: 16px; height: 16px; border: 4px solid #daedd1; border-radius: 50%; background: #3f7327; }
.chatbot-state .state-on::before { border-color: #dedaff; background: var(--cb-primary-50); }
.chatbot-state .state-off::before { border-color: #fcdfd9; background: #de3412; }

/* 바디 — 대화는 여기 하나에 쌓는다(7차 상태별 body 전환은 쓰지 않음) */
.chatbot-body { overflow-y: auto; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; gap: 14px; padding: clamp(12px, 1.2vw, 16px);
  scrollbar-width: thin; scrollbar-color: #c4c4ce transparent; }
.chatbot-body::-webkit-scrollbar { width: 6px; }
.chatbot-body::-webkit-scrollbar-thumb { border-radius: 3px; background: #c4c4ce; }

/* 아이콘 단추(7차 ico-help · ico-info · ico-reset) — 안의 <i> 는 낭독용 숨김 글자(지우지 않는다) */
:is(button, span).ico-help, :is(button, span).ico-info { overflow: hidden; display: inline-block; flex: 0 0 auto; position: relative; width: 17px; height: 17px; margin: 0 0 0 4px; padding: 0;
  vertical-align: -3px; border: 0; border-radius: 50%; background: transparent; }
:is(.ico-help, .ico-info, .ico-reset) i { overflow: hidden; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; white-space: nowrap; border: 0; clip: rect(0, 0, 0, 0); clip-path: inset(50%); }
/* W7-38b: 그림 주소는 크기 규칙과 같은 선택자에서 준다(더 센 선택자의 background 줄임 속성이 주소를 지우던 문제) */
:is(button, span).ico-help::before, :is(button, span).ico-info::before { content: ""; display: block; width: 100%; height: 100%;
  background-repeat: no-repeat; background-position: center; background-size: contain; }
:is(button, span).ico-help::before { background-image: url(img/ico_chat_help.svg); }
:is(button, span).ico-info::before { background-image: url(img/ico_chat_info.svg); }
button:is(.ico-help, .ico-info):is(:hover, :focus-visible) { outline: 2px solid var(--cb-primary-50); outline-offset: 1px; }

/* ── 말풍선 ── */
.chatbot-body [class*="talk-"] { display: flex; flex-direction: column; flex-shrink: 0; gap: 5px; max-width: 88%; padding: 10px 12px; border-radius: 15px; word-break: break-word; }
.chatbot-body [class*="talk-"] > p { line-height: 1.45; font-weight: 600; }
.talk-bot { align-self: flex-start; border: 1px solid var(--cb-line); border-bottom-left-radius: 0; background: var(--bg-default); }
.talk-bot:has(.wrap-answer) { width: 88%; }
.talk-user { align-self: flex-end; border-bottom-right-radius: 0; background: var(--cb-secondary); white-space: pre-wrap; }
.talk-user > p { color: var(--cb-primary-70); text-align: right; }
.talk-user .user-cond { color: var(--text-subtle-strong); font-size: 13px; text-align: right; }
/* W7-30 → W7-38: 질문 말풍선(옅은 보라 바탕·진한 보라 글자)에서 드래그한 글자가 보이게 — 진한 보라 바탕 + 흰 글자 */
.talk-user::selection, .talk-user *::selection { background: var(--cb-primary-50); color: var(--static-white); }
.talk-user-sub { align-self: flex-end; position: relative; max-width: 88%; margin-top: -10px; padding: 0 0 0 19px; color: var(--text-subtle-strong); font-size: 13px; text-align: right; }
.talk-user-sub::before { content: ""; position: absolute; top: 2px; left: 0; width: 15px; height: 15px; background: url(img/ico_chat_search.svg) no-repeat 50% / contain; }
/* 드래그 복사에 낭독용 머리말·진행 단계가 섞이지 않게(W7-31) */
.chatbot-body [class*="talk-"] > .sr-only, .answer-loading { user-select: none; }

/* ── 답변 묶음: 확인 카드 → 단계 → 본문 → 평가 → 근거 ── */
.wrap-answer, .answer-box { display: flex; flex-direction: column; gap: 10px; }
.confirm-slot:empty, .extras:empty, .cb-text:empty { display: none; }
.answer-box { padding: 10px; }
.answer-box:has(> .cb-text:empty):has(> .extras:empty) { display: none; }
.extras { display: flex; flex-direction: column; gap: 10px; }
/* 답변 안 일반 단추(7차 .wrap-answer button 규칙) — 칩·재검색·근거 보기·범위 */
.c-chip, .c-more, .src-toggle, .research, .opt-btn, .btn-no, .c-no { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 7px; color: var(--cb-primary-60); font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  border: 1px solid var(--cb-chip-line); border-radius: 4px; background: var(--bg-default); }
:is(.c-chip, .c-more, .src-toggle, .research, .opt-btn, .nq-chip, .cb-rate-tags button):is(:hover, :focus-visible) { text-decoration: underline; text-underline-offset: 3px; }
.c-chip[hidden] { display: none; }
.c-chip[aria-pressed="true"] { color: var(--static-white); border-color: var(--cb-primary-50); background: var(--cb-primary-50); }
.c-more { display: inline-flex; color: var(--text-subtle-strong); border-color: var(--cb-btn-line); }
.c-more:hover { color: var(--cb-primary-60); border-color: var(--cb-chip-line); }

/* 확인 카드(7차 answer-box-check) */
.answer-box-check { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 4px; background: var(--cb-check-bg); }
.cb-tit01 { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--cb-primary-50); font-weight: 700; }
.cb-tit02 { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--text-default-strong); font-weight: 700; }
.cb-list > li, .cb-list-path > li { position: relative; padding: 2px 0 2px 13px; line-height: 1.45; word-break: break-word; }
.cb-list > li::before, .cb-list-path > li::before { content: ""; position: absolute; top: 10px; left: 2px; width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle-strong); }
:is(.cb-list, .cb-list-path) li :is(b, strong) { font-weight: 600; }
.cb-list-path li b::after { content: ""; display: inline-block; width: 0; height: 0; margin: -2px 8px 0; border: 0 solid transparent; border-width: 3px 0 3px 5px;
  border-left-color: var(--cb-primary-50); vertical-align: middle; }
.cb-list-path .c-carried { margin-left: 4px; color: var(--text-subtle-strong); font-size: 13px; font-weight: 500; }
.cb-confirm { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cb-confirm .btn-yes, .cb-confirm .btn-no { padding: 5px 15px; font-size: inherit; font-weight: 600; border-radius: 4px; }
.cb-confirm .btn-yes { color: var(--static-white); border: 1px solid var(--cb-primary-50); background: var(--cb-primary-50); }
.cb-confirm .btn-yes:is(:hover, :focus-visible) { background: var(--cb-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.cb-confirm .btn-no { color: var(--text-subtle-strong); border-color: var(--cb-btn-line); background: var(--bg-default-weak); }
/* "아니요"를 누르면 강조가 옮겨 간다 — 아니요 채움 · 네 외곽선(비활성 아님, 다시 누를 수 있다) */
.confirm.is-no .btn-no { color: var(--static-white); border-color: var(--cb-primary-50); background: var(--cb-primary-50); }
.confirm.is-no .btn-yes { color: var(--cb-primary-60); border-color: var(--cb-chip-line); background: var(--bg-default); }
.confirm button:disabled { opacity: .45; cursor: default; }
.cb-chips { padding-top: 8px; border-top: 1px dashed var(--cb-dash); }
.cb-chips[hidden] { display: none; }
.c-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.c-suggest:empty { display: none; }
.c-sum { align-self: flex-start; padding: 4px 10px; font-size: 13px; color: var(--text-subtle-strong); background: var(--bg-subtle-weak); border-radius: 4px; }

/* 입력(푸터 7차 chatbot-input · W7-52 부터 카드 안 입력칸 없음) — 순서: 입력 → 지우기(btn-del) → 전송(btn-send) */
.chatbot-input { display: flex; align-items: flex-end; gap: 8px; padding: 6px; border-radius: 999px; box-shadow: 1px 2px 5px var(--cb-dash); background: var(--bg-default); }
.chatbot-input :is(textarea, input) { flex: 1 1 auto; min-width: 0; padding: 8px; color: var(--text-default); border: 0; border-radius: 999px; background: transparent; }
.chatbot-input :is(textarea, input)::placeholder { color: var(--text-subtle-strong); font-size: 13px; }
.chatbot-input :is(textarea, input):focus { outline: none; }
.chatbot-input:focus-within { box-shadow: 0 0 0 2px var(--cb-primary-50); }
/* 높이는 cb-ui.js 가 scrollHeight 로 넣는다 — 여기서 height 를 고정하지 않는다(7차 가이드 4화면) */
.chatbot-input textarea { min-height: 38px; max-height: 200px; line-height: 22px; resize: none; scrollbar-width: thin; scrollbar-color: #c4c4ce transparent; }
.chatbot-input .chatbot-btns { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 8px; }
.chatbot-input :is(.btn-del, .btn-send) { overflow: hidden; flex: 0 0 auto; position: relative; padding: 0; border: 0; }
.chatbot-input :is(.btn-del, .btn-send) i { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.chatbot-input .btn-send { width: 38px; height: 38px; border-radius: 50%; background: var(--cb-primary-50); }
.chatbot-input .btn-send::before { content: ""; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; transform: translate(calc(-50% - 1px), calc(-50% + 1px));
  background: url(img/ico_chat_send.svg) no-repeat 50% / contain; }
.chatbot-input .btn-send:is(:hover, :focus-visible) { background: var(--cb-primary-hover); }
.chatbot-input .btn-send:focus-visible, .chatbot-input .btn-del:focus-visible { outline: 2px solid var(--cb-primary-70); outline-offset: 2px; }
.chatbot-input .btn-send:disabled { opacity: .5; cursor: default; }
.chatbot-input .btn-del { display: none; width: 20px; height: 20px; margin-bottom: 9px; border-radius: 50%; background: #c4c4ce; }
.chatbot-input .btn-del::before, .chatbot-input .btn-del::after { content: ""; position: absolute; top: calc(50% - 1px); left: calc(50% - 5px); width: 10px; height: 2px; background: var(--static-white); }
.chatbot-input .btn-del::before { transform: rotate(45deg); }
.chatbot-input .btn-del::after { transform: rotate(-45deg); }
.chatbot-input .btn-del:is(:hover, :focus-visible) { background: #a9a9b3; }
.chatbot-input.is-multi { border-radius: 15px; }
.chatbot-input.is-multi textarea { border-radius: 10px 4px 4px 10px; }
.chatbot-input.has-val .btn-del { display: block; }

/* ── 진행 단계(7차 answer-loading): 없음 → is-doing(보라·회전) → is-done(파랑·체크) ── */
.answer-loading { display: flex; flex-wrap: wrap; gap: 7px 15px; margin: 0; padding: 10px; border: 1px dashed var(--cb-dash); border-radius: 4px; }
.answer-loading li { position: relative; padding-left: 24px; color: var(--text-subtle-strong); }
.answer-loading li > i { overflow: hidden; position: absolute; top: calc(50% - 9px); left: 0; width: 18px; height: 18px; line-height: 18px; color: var(--text-subtle-strong);
  font-size: 12px; font-style: normal; font-weight: 600; text-align: center; border-radius: 50%; background: var(--bg-subtle); }
.answer-loading li[class*="is-"] > i { text-indent: -9999px; }
.answer-loading li.is-doing { color: var(--cb-primary-50); font-weight: 600; }
.answer-loading li.is-doing > i { border: 3px solid #d9d2fb; border-top-color: var(--cb-primary-50); animation: cb-spin .8s linear infinite; background: transparent; }
.answer-loading li.is-done { color: var(--cb-done); font-weight: 600; }
.answer-loading li.is-done > i { background: var(--cb-done-bg); }
.answer-loading li.is-done > i::after { content: ""; position: absolute; top: 4px; left: 6px; width: 6px; height: 8px; border: solid #2c4dd4; border-width: 0 2px 2px 0; transform: rotate(42deg); }
.answer-loading .el { font-weight: 700; }
.answer-loading-tip { position: relative; padding: 0 10px 0 24px; color: var(--text-subtle-strong); }
.answer-loading-tip::before { content: "※"; position: absolute; top: -3px; left: 10px; font-size: 16px; font-weight: 400; }
@keyframes cb-spin { to { transform: rotate(360deg); } }
/* 대기 줄(W7-26, 71 P9 queue) — 단계 줄과 같은 색·크기 */
.q-wait { padding: 0 2px; color: var(--cb-primary-50); font-size: 13px; font-weight: 600; line-height: 1.5; }
.q-wait .q-pos, .q-wait .el { font-weight: 700; }
.spin { display: inline-block; width: 11px; height: 11px; margin-right: 5px; border: 2px solid #d9d2fb; border-top-color: var(--cb-primary-50); border-radius: 50%;
  animation: cb-spin .8s linear infinite; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) {   /* W7-25 #10: 움직임 줄이기면 회전을 멈춘다 */
  .spin { display: none; animation: none; }
  .answer-loading li.is-doing > i { animation: none; }
}

/* ── 답변 본문(7차 cb-text) — 마크다운은 md.js(W7-4c) 그대로, 모양만 ── */
.cb-text { display: flex; flex-direction: column; gap: 8px; }
.cb-text .md { white-space: normal; line-height: 1.6; font-weight: 500; overflow-wrap: anywhere; }
.md p { margin: 0 0 8px; line-height: 1.55; }
.md > :last-child, .md li > :last-child { margin-bottom: 0; }
.md .md-h { margin: 14px 0 6px; padding-left: 10px; border-left: 3px solid var(--cb-primary-50); font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--text-default-strong); }
.md > .md-h:first-child { margin-top: 2px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md ul { list-style: disc; } .md ol { list-style: decimal; }
.md li { margin: 2px 0; line-height: 1.45; }
.md li > ul, .md li > ol { margin: 3px 0 0; padding-left: 18px; }
.md li::marker { color: var(--text-subtle-strong); }
.md strong { font-weight: 700; }
.md code { font-family: var(--font-mono); font-size: 13px; padding: 1px 5px; color: var(--text-default-strong); background: var(--bg-subtle); border-radius: 4px; }
.md a { color: var(--cb-blue); text-decoration: underline; text-underline-offset: 3px; word-break: break-all; }
.md a:hover, .md a:focus-visible { color: var(--cb-primary-70); }
/* 표(7차 data-tbl 모양: 13px · 칸 5/6px · 머리 옅은 파랑 · 위 굵은 선) — 가로 스크롤 감싸기는 그대로 */
.md-table { max-width: 100%; overflow-x: auto; margin: 2px 0 12px; border-top: 2px solid #384889; -webkit-overflow-scrolling: touch; }
.md-table table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.5; }
.md-table th, .md-table td { padding: 5px 6px; border-bottom: 1px solid #cdd1d5; text-align: left; vertical-align: top; overflow-wrap: normal; }
.md-table th { background: var(--cb-blue-weak); font-weight: 700; color: var(--text-default-strong); white-space: nowrap; }
.md-table td { min-width: 4.5em; }
/* W7-33: 표 칸 속 긴 주소·영문 덩어리(md.js .brk)만 끊김 — 한글 낱말·짧은 값은 그대로, 칸 많은 표의 가로 스크롤 유지 */
.md .brk, .md a, .md code { overflow-wrap: anywhere; }
.md-table .c { text-align: center; }
.md-table .r { text-align: right; }
/* W7-36: 긴 표 접기(md.js fold — 스트림 끝에만). 단추·찾기 칸은 .md-table(가로 스크롤 감싸기) 바깥이라 390 폭에서도 화면 안에 선다 */
.md-tbox { margin: 2px 0 12px; }
.md-tbox > .md-table { margin-bottom: 6px; }
.md-tbox:not(.open):not(.q) tr.x, .md-tbox.q tr.nf { display: none; }
.md-more { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 10px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--cb-primary-60); background: var(--bg-default); border: 1px solid var(--cb-chip-line); border-radius: 4px; cursor: pointer; }
.md-more::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.md-more[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.md-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.md-find { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.md-find-in { flex: 1; min-width: 0; max-width: 320px; height: 34px; padding: 0 12px; font: inherit; font-size: 13px; color: var(--text-default-strong);
  background: var(--bg-default); border: 1px solid var(--cb-btn-line); border-radius: 999px; }
.md-find-n { font-size: 13px; color: var(--text-subtle-strong); white-space: nowrap; }
.md-sec { margin: 0 0 8px; border: 1px solid var(--cb-line); border-radius: 4px; }
.md-sec-h { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; font-size: 14px;
  font-weight: 700; line-height: 1.4; text-align: left; color: var(--text-default-strong); background: var(--cb-check-bg); border: 0; border-radius: 4px; cursor: pointer; }
.md-sec-h[aria-expanded="true"] { border-bottom: 1px solid var(--cb-line); border-radius: 4px 4px 0 0; }
.md-sec-h::before { content: ""; flex-shrink: 0; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); }
.md-sec-h[aria-expanded="true"]::before { transform: translateY(-2px) rotate(45deg); }
.md-sec-n { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--text-subtle-strong); white-space: nowrap; }
.md-sec-b { padding: 10px 12px 2px; min-width: 0; }
.md-more:focus-visible, .md-sec-h:focus-visible, .md-find-in:focus-visible { outline: 2px solid var(--cb-primary-50); outline-offset: 2px; }
/* W7-37: 71 table 이벤트(변수 전체·코드표) — 답변 본문 아래 블록, 목록 없는 데이터셋·더 있음 안내 줄(출처 문구는 W7-37b 에서 없앰) */
.md + .md-data { margin-top: 12px; }
.md-data > .md-h:first-child, .md-data > .md-note:first-child + .md-h { margin-top: 2px; }
.md-note { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: var(--text-subtle-strong); }
.md-data .md-sec-b > .md-tbox, .md-data .md-sec-b > .md-table { margin-bottom: 8px; }

/* ── 안내 상자(7차) — 상황별로 하나만: 못 찾음 warn(노랑) · 범위 밖 info(파랑) · 오류 error(빨강 글자) ── */
[class*="cb-notice-"] { position: relative; padding: 10px 12px 10px 37px; border-radius: 8px; color: var(--text-default); line-height: 1.55; word-break: break-word; }
[class*="cb-notice-"]::before { content: ""; position: absolute; top: 11px; left: 13px; width: 17px; height: 17px; background: url(img/ico_chat_info.svg) no-repeat center / contain; }
.cb-notice-info { background: #eaf1fc; }
.cb-notice-info::before { filter: var(--cb-filter-info); }
.cb-notice-warn { background: #fdf3e2; }
.cb-notice-warn::before { filter: var(--cb-filter-warning); }
.cb-text-error { color: var(--danger-50); font-weight: 600; }
.err-ref { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--text-subtle-strong); }   /* 오류 때만 "문의 번호"(trace 앞 8자, W7-15) */
.fb-chips { margin-top: 2px; }

/* ── 설명 줄(7차 cb-desc — 71 explain 이벤트가 올 때만) ── */
.cb-desc { position: relative; padding-left: 22px; color: var(--text-subtle-strong); }
.cb-desc::before { content: ""; position: absolute; top: 1px; left: 0; width: 17px; height: 17px; background: url(img/ico_chat_info.svg) no-repeat center / contain; }
.im-link { padding: 0; font: inherit; color: var(--cb-primary-50); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.im-link:hover, .im-link:focus-visible { color: var(--cb-primary-70); }

/* ── 평가(7차 cb-feedback 👍/👎 · cb-rate-reason) — feedback.js ── */
.fb { display: flex; flex-direction: column; gap: 8px; }
.cb-feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-subtle-strong); }
.cb-feedback .fb-btn { overflow: hidden; position: relative; width: 25px; height: 25px; padding: 0; border: 1px solid var(--cb-btn-line); border-radius: 4px; background: var(--bg-default); }
.cb-feedback .fb-btn::before { content: ""; position: absolute; top: 50%; left: 50%; width: 13px; height: 13px; transform: translate(-50%, -50%) var(--rate-flip, );
  background: url(img/ico_chat_rate.svg) no-repeat center / contain; }
.cb-feedback .fb-btn i { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.cb-feedback .btn-rate-down::before { --rate-flip: scaleY(-1); }
.cb-feedback .fb-btn:is(:hover, :focus-visible), .cb-feedback .fb-btn[aria-pressed="true"] { border-color: var(--cb-primary-50); }
.cb-feedback .fb-btn:is(:hover, :focus-visible)::before, .cb-feedback .fb-btn[aria-pressed="true"]::before { filter: var(--cb-filter-primary); }
.cb-feedback .fb-btn[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--cb-primary-50); background: var(--cb-secondary); }
.fb-note:empty { display: none; }
.cb-rate-reason { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.cb-rate-reason[hidden] { display: none; }
.cb-rate-reason > strong { color: var(--text-default); font-weight: 600; }
.cb-rate-reason > strong em { color: var(--text-subtle-strong); font-weight: 500; font-style: normal; }
.cb-rate-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-rate-tags button { position: relative; padding: 5px 7px; color: var(--gray-60); font-size: 13px; font-weight: 600; border: 1px solid var(--cb-btn-line); border-radius: 4px; background: var(--bg-default); }
.cb-rate-tags button:is(:hover, :focus-visible) { color: var(--cb-primary-50); border-color: var(--cb-primary-50); }
.cb-rate-tags button[aria-pressed="true"] { padding-left: 22px; color: var(--cb-primary-50); border-color: var(--cb-primary-50); }
.cb-rate-tags button[aria-pressed="true"]::before { content: ""; position: absolute; top: calc(50% - 6px); left: 9px; width: 5px; height: 9px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(42deg); }
.fb button:disabled { opacity: .55; cursor: progress; }

/* ── 근거 출처(7차 cb-button · btn-basis-show/btn-basis · cb-source) ── */
.cb-button, .cb-button-right { display: flex; align-items: center; gap: 6px; }
.cb-button-right { justify-content: flex-end; }
.src-toggle::before { content: ""; width: 0; height: 0; border: 4px solid transparent; border-left: 5px solid currentColor; border-right: 0; transition: transform .2s ease; }
.src-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.cb-source { display: none; padding-top: 8px; border-top: 1px dashed var(--cb-dash); }
.cb-source.is-open { display: flex; flex-direction: column; gap: 9px; }
.cb-source > ul { display: flex; flex-direction: column; gap: 9px; }
.cb-source li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; line-height: 1.55; word-break: break-word; }
.cb-source li > [class*="tag"], .cb-source li > .cb-badge-fix { flex: none; }
.cb-source li > span { flex: 1 1 0; min-width: 0; }
.cb-source [class*="tag"] { display: inline-block; min-width: 32px; padding: 2px 8px; color: var(--text-default); font-size: 12px; font-weight: 600; line-height: 1.5; text-align: center;
  border-radius: 20px; background: #f3f3f3; }
.cb-source .tag-01 { color: var(--cb-blue); background: var(--cb-blue-weak); }
.cb-source .tag-02 { color: var(--cb-green); background: var(--cb-green-weak); }
.cb-source .src-no { margin-left: 4px; color: var(--text-subtle-strong); font-weight: 600; }
.cb-source span .ico-info { margin-left: 2px; }
.cb-source .src-rsch { display: block; font-size: 12.5px; color: var(--text-subtle-strong); }   /* 연구 ID · 연구결과 보기 한 줄(W7-8) */
.cb-source .src-link { color: var(--cb-primary-50); text-decoration: underline; text-underline-offset: 3px; }
/* 근거 → 통합포털 화면(W7-42 ②): 제목이 링크. 링크 없는 근거는 지금처럼 글자만 */
.cb-source a.src-portal { color: var(--cb-primary-50); text-decoration: underline; text-underline-offset: 3px; }
.cb-source a.src-portal:hover { text-decoration-thickness: 2px; }
.cb-source a.src-portal:focus-visible { outline: 2px solid var(--cb-primary-50); outline-offset: 2px; border-radius: 2px; }
.cb-source a.src-portal::after { content: "↗"; display: inline-block; margin-left: 2px; font-size: .85em; text-decoration: none; }
/* 고정근거 배지(7차 cb-badge-fix) */
.cb-badge-fix { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 6px; color: #d64545; font-size: 12px; font-weight: 600; line-height: 1.55;
  vertical-align: top; border-radius: 20px; background: #fdeeee; }
.cb-badge-fix::before { content: ""; flex: 0 0 auto; width: 12px; height: 12px; background: url(img/ico_pinned.svg) no-repeat center / contain; }
/* 근거 상세 — 분류 연계 자료(7차 data-group: 라벨-값 묶음, W7-11) */
.cb-source > .cb-tit02 { margin-top: 4px; font-size: 13.5px; }
.data-group { border-top: 2px solid #384889; }
.data-group dl { margin: 0; }
.data-group dl > div { display: grid; grid-template-columns: 60px 1fr; column-gap: 14px; padding: 5px 10px; border-bottom: 1px solid #cdd1d5; }
.data-group :where(dt, dd) { margin: 0; padding: 2px 0; font-size: 13px; }
.data-group dt { font-weight: 600; }
.data-group dd { min-width: 0; word-break: break-word; }
.data-group .cl-no { color: var(--text-subtle-strong); }
.data-group .btn-01 { display: inline-block; margin: 0 2px; padding: 1px 5px; color: var(--cb-blue); font-size: 12px; font-weight: 600; border: 1px solid #9eb5e4; border-radius: 4px; }
.cl-note { font-size: 12.5px; line-height: 1.5; color: var(--text-subtle-strong); }

/* ── 재검색 · 범위(7차 ico-reset · cb-filter) ── */
.research::before { content: ""; width: 12px; height: 12px; background: url(img/ico_chat_reset.svg) no-repeat center / contain; }
.cb-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-subtle-strong); font-size: 13px; }
.cb-filter .btn-01 { color: var(--cb-blue); border-color: #6f8fd4; }
.cb-filter .btn-02 { color: var(--cb-green); border-color: #7f8f6a; }
.opt-btn[aria-pressed="true"] { color: var(--static-white); border-color: var(--cb-primary-50); background: var(--cb-primary-50); }
.cb-filter .btn-01[aria-pressed="true"] { color: var(--static-white); border-color: var(--cb-blue); background: var(--cb-blue); }
.cb-filter .btn-02[aria-pressed="true"] { color: var(--static-white); border-color: var(--cb-green); background: var(--cb-green); }

/* ── 이어서 질문(7차 cb-suggest) · 다른 뜻(W7-29) ── */
.cb-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.cb-suggest > strong { position: relative; padding-left: 21px; color: var(--text-default); font-weight: 600; }
.cb-suggest > strong::before { content: ""; position: absolute; top: 0; left: 0; width: 18px; height: 18px; background: url(img/ico_chat_suggest.svg) no-repeat center / contain; }
.nq-chip { align-self: flex-start; max-width: 100%; padding: 5px 7px; color: var(--cb-primary-60); font-size: 13px; font-weight: 600; text-align: left;
  border: 1px solid var(--cb-primary-60); border-radius: 4px; background: var(--bg-default); }
.alt-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.alt-label { font-size: 13px; color: var(--text-subtle-strong); }

/* ── 푸터(7차 chatbot-footer) ── */
.chatbot-footer { flex: 0 0 auto; padding: clamp(12px, 1.2vw, 16px); position: relative; }
/* W7-47 답 생성 중 맨 아래 따라가기 — 애니메이션 없이 내린다(토큰마다 흔들림 방지 · 움직임 줄이기 설정과 무관).
   「↓ 새 답변 보기」: 위로 올려 읽는 중이고 답이 생성 중일 때만 입력칸 위 가운데(chat.js syncFollowBtn) */
.chatbot-body { scroll-behavior: auto; }
.btn-follow { position: absolute; bottom: 100%; left: 50%; z-index: 5; display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 8px; padding: 6px 14px; transform: translateX(-50%); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
  border: 0; border-radius: 999px; background: var(--cb-primary-50); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.btn-follow[hidden] { display: none; }
.btn-follow:is(:hover, :focus-visible) { background: var(--cb-primary-60); }
.btn-follow:focus-visible { outline: 2px solid var(--cb-primary-70); outline-offset: 2px; }
.chatbot-footer p.ico-info { position: relative; display: block; margin: 0 0 8px; padding-left: 17px; color: var(--text-subtle-strong); font-size: 12px; font-weight: 600; line-height: 1.5; }
.chatbot-footer p.ico-info::before { content: ""; position: absolute; top: 1px; left: 0; width: 15px; height: 15px; background: url(img/ico_chat_info.svg) no-repeat center / contain; }
.chatbot-footer p.ico-info strong { color: var(--cb-primary-50); font-size: inherit; }
.chatbot-notice { margin: 12px 0 0; color: var(--text-subtle-strong); }
.chatbot-notice li { position: relative; padding-left: 12px; font-size: 12px; }
.chatbot-notice li::before { content: "*"; position: absolute; top: 1px; left: 2px; }
.chatbot-notice li + li { margin-top: 4px; }

/* ══ 모달(설명 W7-19 · 첫 안내 W7-20) — SDC .wrap-modal 틀 + 7차 chatbot-guide 모양(cbGuide · cbDesc · cbHelp) ══ */
.wrap-modal { display: none; }
.wrap-modal.is-current { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; left: 0;
  width: 100%; height: 100vh; height: 100dvh; z-index: 99999; }
.wrap-modal.is-current::before { content: ""; position: absolute; inset: 0; background: var(--alpha-default-50); }
.wrap-modal .modal-body { overflow: hidden; position: relative; display: flex; flex-direction: column; flex: 0 1 auto;
  width: calc(100% - 40px); max-width: 680px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
  padding: 0 10px; border-radius: 10px; background: var(--bg-default); color: var(--text-default); z-index: 9999; }
.wrap-modal .modal-tit { display: block; position: relative; margin: 0; padding: 40px 50px 15px 20px; font-size: var(--clamp-fs-20-24);
  font-weight: 600; line-height: 1.4; color: var(--text-default-strong); }
/* W7-38b: 열 때 초점은 제목에 둔다(낭독기가 제목부터 읽음, W7-25) — 제목은 누르는 요소가 아니라(tabindex=-1) 테두리를 그리지 않는다.
   크롬은 팝업을 막 연 상태의 프로그램 초점도 focus-visible 로 보아 열자마자 테두리가 보였다. 단추·본문 초점 테두리는 그대로 */
.wrap-modal .modal-tit:focus, .wrap-modal .modal-tit:focus-visible { outline: none; }
.wrap-modal .modal-cont { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 20px; background: var(--bg-default); }
.wrap-modal .modal-cont:focus-visible { outline: 2px solid var(--cb-primary-50); outline-offset: -2px; }
.wrap-modal .modal-footer { flex: 0 0 auto; margin: 0; padding: 10px 20px 30px; }
.wrap-modal .board-button { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.button-fill01, .button-frame01 { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 80px; padding: 10px 15px; font: inherit;
  font-size: 15px; font-weight: 600; line-height: 1.4; cursor: pointer; text-decoration: none; border-radius: 6px; }
.button-fill01 { color: var(--static-white); background: var(--cb-primary-50); border: 1px solid var(--cb-primary-50); }
.button-fill01:hover, .button-fill01:focus-visible { background: var(--cb-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.button-frame01 { color: var(--text-default); background: var(--bg-default); border: 1px solid var(--cb-btn-line); }
.button-frame01:hover, .button-frame01:focus-visible { border-color: var(--cb-primary-50); color: var(--cb-primary-60); text-decoration: underline; text-underline-offset: 3px; }
.button-fill01 i, .button-frame01 i { font-style: normal; }
.button-fill01 .blank { font-size: 12px; font-weight: 500; opacity: .85; }
/* 닫기 X — 클래스는 modal-x(SDC 엔진과 겹치지 않게 'close' 를 쓰지 않음, 217 §5-3) · 모양은 7차(36px 원 · 보라 X) */
.wrap-modal .modal-x { display: block; position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; padding: 0; cursor: pointer;
  font-size: 0; background: var(--cb-bg); border: 0; border-radius: 50%; z-index: 10; }
.wrap-modal .modal-x::before, .wrap-modal .modal-x::after { content: ""; position: absolute; top: calc(50% - 8px); left: calc(50% - 1px); width: 2px; height: 16px; background: var(--cb-primary-50); }
.wrap-modal .modal-x::before { transform: rotate(45deg); }
.wrap-modal .modal-x::after { transform: rotate(-45deg); }
.wrap-modal .modal-x:is(:hover, :focus-visible) { background: var(--cb-primary-50); }
.wrap-modal .modal-x:is(:hover, :focus-visible)::before, .wrap-modal .modal-x:is(:hover, :focus-visible)::after { background: var(--static-white); }
.wrap-modal .modal-x:focus-visible { outline: 2px solid var(--cb-primary-70); outline-offset: 2px; }
.wrap-modal .modal-x i { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* 7차 chatbot-guide: 폭 440 · 제목 밑줄 · 바닥 점선 · 어두운 배경 75% */
.chatbot-guide.wrap-modal.is-current::before { background: var(--alpha-default-75); }
.chatbot-guide .modal-body { max-width: 440px; padding: 0 20px; }
.chatbot-guide .modal-tit { padding: 20px 50px 12px 0; font-size: 18px; font-weight: 700; border-bottom: 1px solid #ddd; }
.chatbot-guide .modal-cont { padding: 4px 15px 18px; }
.chatbot-guide .modal-footer { padding: 15px 0; border-top: 1px dashed #e3e2ea; }
/* 모달 본문 — 묶음 하나 = 제목(7차 cb-tit01) + 내용. cb-cont-area 를 누르면 점선 테두리(is-select, cb-ui.js) */
.im-list { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.im-row dt { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 14px 0 6px; color: var(--cb-primary-50); font-weight: 700; }
.im-row dd { margin: 0; line-height: 1.55; color: var(--text-default); overflow-wrap: anywhere; }
.im-row dd ul, .im-row dd ol { margin: 2px 0 0; }
.im-row dd ul > li { position: relative; padding: 2px 0 2px 13px; line-height: 1.45; }
.im-row dd ul > li::before { content: ""; position: absolute; top: 10px; left: 2px; width: 3px; height: 3px; border-radius: 50%; background: var(--text-subtle-strong); }
.im-row dd ol { list-style: decimal; padding-left: 20px; }
.im-row dd ol li { margin: 4px 0; }
.im-row dd b { font-weight: 700; }
.im-row.info dd { padding: 12px; background: var(--cb-bg); border-radius: 8px; }                /* 7차 cb-box01 */
.im-row.warn dd { padding: 12px; background: #fff3db; border-radius: 8px; }                     /* 7차 cb-box02 */
.cb-cont-area { cursor: pointer; }
.cb-cont-area.is-select { outline: 1px dashed var(--cb-primary-50); outline-offset: 6px; border-radius: 3px; }
.im-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.im-kv > span:nth-child(odd) { color: var(--text-subtle-strong); font-weight: 600; white-space: nowrap; }
.im-dest { margin: 10px 0 0; font-size: 13.5px; color: var(--text-subtle-strong); }
.im-sec { scroll-margin-top: 8px; }
.im-sec.is-target { outline: 2px solid var(--cb-primary-50); outline-offset: 6px; border-radius: 3px; }
.im-row .btn-01, .im-row .btn-02 { display: inline-block; padding: 1px 6px; font-size: 12px; font-weight: 600; border: 1px solid; border-radius: 4px; vertical-align: middle; }
.im-row .btn-01 { color: var(--cb-blue); border-color: #9eb5e4; }
.im-row .btn-02 { color: var(--cb-green); border-color: #b5bea8; }
/* 첫 안내(cbGuide) 단추 그림 설명 — 7차 cb-box01 */
.cb-box01 { margin: 10px 0; padding: 12px; border-radius: 8px; background: var(--cb-bg); }
.cb-box01 ul { display: flex; flex-direction: column; gap: 5px; }
.im-row dd .cb-box01 li { position: relative; padding-left: 24px; }
.im-row dd .cb-box01 li::before { display: none; }
.cb-box01 li > [class*="ico-"] { position: absolute; top: 2px; left: 0; margin: 0; }
.im-row dt [class*="ico-"] { margin: 0; }
@media (max-width: 640px) {
  .wrap-modal .modal-tit { padding: 36px 48px 12px 14px; }
  .chatbot-guide .modal-tit { padding: 18px 48px 12px 0; }
  .wrap-modal .modal-cont { padding: 14px; }
}

/* ══ 반응형 ══ */
@media (max-width: 767px) {
  .chatbot-body [class*="talk-"] { max-width: 96%; }
  .talk-bot:has(.wrap-answer) { width: 96%; }
}

/* ══ 접근성(W7-25) — 건너뛰기 링크는 초점을 받을 때만 보인다(#11) ══ */
.skip { position: absolute; left: 8px; top: -60px; z-index: 100000; padding: 8px 14px; font-size: 14px; font-weight: 700; text-decoration: none;
  color: var(--static-white); background: var(--cb-primary-50); border-radius: 4px; }
.skip:focus { top: 8px; outline: 2px solid var(--cb-primary-70); outline-offset: 2px; }
:is(.chatbot-new, .c-chip, .c-more, .src-toggle, .research, .opt-btn, .nq-chip, .btn-yes, .btn-no, .c-no, .cb-rate-tags button, .fb-btn, .chatbot-close, .im-link):focus-visible {
  outline: 2px solid var(--cb-primary-50); outline-offset: 2px; }
