/* xneedzai — 검증형 AI 챗봇. 2026-10-25 새 디자인: 사이드바 없이 상단 바 하나, 가운데 한 줄 대화, 둥근 입력창.
   라이트/다크/시스템, 글자 크기 3단계, 모바일 대응. JS 가 쓰는 클래스 이름은 그대로 둔다. */
:root {
  --bg: #f6f6f8; --surface: #ffffff; --surface2: #f0f1f4; --line: #e6e7ec; --text: #15171c; --muted: #6f7584;
  --brand: #5b5bd6; --brand-fg: #ffffff; --brand-soft: #ecedfc; --brand-ink: #4646b8;
  --ok: #1d8a4e; --ok-soft: #e4f6ec; --warn: #a66500; --warn-soft: #fff2d9; --bad: #c92a2a; --bad-soft: #fde8e8; --info-soft: #edf1fb;
  --radius: 16px; --radius-s: 10px; --fs: 15px; --panel-w: 400px; --top-h: 56px; --sb-w: 264px;
  --shadow: 0 10px 30px rgba(20, 24, 40, .10), 0 1px 2px rgba(20, 24, 40, .06);
  --shadow-s: 0 1px 2px rgba(20, 24, 40, .05);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface2: #1f2330; --line: #2a2f3b; --text: #eceef3; --muted: #8f97a8;
  --brand: #8b8ff7; --brand-fg: #0e1020; --brand-soft: #24284a; --brand-ink: #a9acff;
  --ok: #4fc47f; --ok-soft: #15311f; --warn: #f0b24b; --warn-soft: #3a2d12; --bad: #ff7b7b; --bad-soft: #3a1b1b; --info-soft: #1c2740;
  --shadow: 0 12px 36px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0f1115; --surface: #171a21; --surface2: #1f2330; --line: #2a2f3b; --text: #eceef3; --muted: #8f97a8;
    --brand: #8b8ff7; --brand-fg: #0e1020; --brand-soft: #24284a; --brand-ink: #a9acff;
    --ok: #4fc47f; --ok-soft: #15311f; --warn: #f0b24b; --warn-soft: #3a2d12; --bad: #ff7b7b; --bad-soft: #3a1b1b; --info-soft: #1c2740;
    --shadow: 0 12px 36px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-fs="s"] { --fs: 13.5px; }
:root[data-fs="l"] { --fs: 17px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs)/1.65 "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }

/* 기본 요소 */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; line-height: 1.4; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); border-color: transparent; background: var(--bad-soft); }
.btn.sm { padding: 4px 10px; font-size: .85em; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; padding: 6px 9px; border-radius: 10px; color: var(--muted); line-height: 1; }
.icon-btn:hover { background: var(--surface2); color: var(--text); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 11px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.field { display: block; margin: 12px 0; }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .8em; background: var(--surface2); border: 1px solid transparent; color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--brand-ink); }
.grade { display: inline-block; min-width: 1.6em; text-align: center; border-radius: 5px; font-weight: 700; font-size: .78em; padding: 0 4px; }
.grade.A { background: var(--ok-soft); color: var(--ok); } .grade.B { background: var(--info-soft); color: var(--brand-ink); } .grade.C { background: var(--warn-soft); color: var(--warn); } .grade.X { background: var(--bad-soft); color: var(--bad); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-s); }
.card + .card { margin-top: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92em; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: .9em; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* 레이아웃: 상단 바 + 본문 + (오른쪽) 출처 패널 */
.app { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); }
/* 왼쪽 사이드바: 로고 · 새 대화 · 대화 목록 · 메뉴 */
.sb { position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sb .brand { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 9px; row-gap: 5px; padding: 14px 16px 10px; color: var(--text); }
.sb .brand:hover { text-decoration: none; }
/* 2026-10-26: 메인 페이지 로고와 같게(xneedz 글자 + 문구), 왼쪽에 xneedzlogo */
.sb .brand .brand-mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
.sb .brand .brand-word { height: 22px; width: auto; display: block; }
.sb .brand .brand-sub { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); letter-spacing: -.5px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root[data-theme="dark"] .sb .brand .brand-word { filter: invert(1); }   /* 검은 글자 로고가 어두운 배경에서도 보이게 */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="dark"]) .sb .brand .brand-word { filter: invert(1); } }
.sb .newchat { display: flex; margin: 4px 12px 6px; justify-content: center; }
.sb .newchat .plus { font-weight: 700; }
.sb .convs { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.sb .convs h4 { margin: 12px 10px 4px; font-size: .74em; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sb .conv { display: block; padding: 7px 10px; border-radius: 10px; color: var(--text); font-size: .94em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb .conv:hover { background: var(--surface2); text-decoration: none; }
.sb .conv.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.sb nav { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.sb nav a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: .94em; }
.sb nav a i { font-style: normal; width: 18px; text-align: center; color: var(--muted); font-size: .9em; }
.sb nav a:hover, .sb nav a.active { background: var(--surface2); text-decoration: none; }
.sb nav a.active { font-weight: 600; }
.sb-dim { display: none; }
.menu-btn { display: none; }
.convrow { display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.convrow .conv { flex: 1; min-width: 0; }
.convrow .convact { display: none; gap: 2px; flex: none; }
.convrow:hover .convact, .convrow:focus-within .convact, .convrow.active .convact { display: inline-flex; }
.convrow .icon-btn.sm { width: 26px; height: 26px; padding: 0; font-size: 13px; line-height: 26px; border-radius: 8px; }
@media (hover: none) { .convrow .convact { display: inline-flex; } }
.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--bg); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.top .top-mid { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.top .top-mid .btn.sm { white-space: nowrap; }
.top .title { font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95em; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; transition: padding-right .2s; }
.app.panel-open .main { padding-right: var(--panel-w); }
.view { flex: 1; min-height: 0; }
.page { max-width: 880px; margin: 0 auto; padding: 28px 20px 80px; }
.page h2 { margin: 0 0 18px; font-size: 1.35em; letter-spacing: -.02em; }

/* 모델 선택 */
.pop { position: relative; }
#modelbtn { border-radius: 999px; padding: 6px 12px; background: var(--surface); }
#modelbtn b { font-weight: 600; }
.pop-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 300px; max-width: 92vw; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.pop-menu h5 { margin: 8px 10px 4px; font-size: .78em; color: var(--muted); font-weight: 600; }
.pop-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: 0; padding: 8px 10px; border-radius: 9px; }
.pop-item:hover { background: var(--surface2); text-decoration: none; }
.pop-item.sel { background: var(--brand-soft); }
.pop-item small { color: var(--muted); display: block; }
.pop-item .grow b { font-weight: 600; }
.balance { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9em; white-space: nowrap; }
.balance.low { color: var(--bad); font-weight: 700; }

/* 채팅 */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); min-height: 0; }
.msgs { flex: 1; overflow-y: auto; padding: 26px 16px 8px; }
.msgs-in { max-width: 760px; margin: 0 auto; }
.msg { margin: 0 0 22px; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
/* 2026-10-26: 말풍선 아래에 작성 시각 + 복사·다시 쓰기 아이콘. 자리를 미리 차지해 호버 때 화면이 밀리지 않는다 */
.msg.user .uact { display: flex; align-items: center; gap: 2px; height: 24px; visibility: hidden; color: var(--muted); font-size: .8em; }
.msg.user:hover .uact, .msg.user:focus-within .uact { visibility: visible; }
.msg.user .utime { margin-right: 6px; }
.ibtn { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.ibtn:hover { background: var(--surface2); color: var(--text); }
.bubble { background: var(--brand); color: var(--brand-fg); border-radius: 20px 20px 6px 20px; padding: 10px 16px; max-width: 80%; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.acard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-s); }
.acard .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; font-size: .82em; color: var(--muted); }
.acard .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: .82em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.acard .foot .btn { font-size: 1em; }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.srcs .chip { cursor: pointer; background: var(--surface2); }
.srcs .chip:hover { border-color: var(--brand); color: var(--text); }
.box { border-radius: 12px; padding: 10px 13px; margin-top: 10px; font-size: .92em; }
.box.warn { background: var(--warn-soft); } .box.info { background: var(--info-soft); } .box.bad { background: var(--bad-soft); }
.box h5 { margin: 0 0 4px; font-size: .95em; }
.box ul { margin: 4px 0 0; padding-left: 18px; }
.progress { list-style: none; padding: 0; margin: 0; }
.progress li { padding: 3px 0; color: var(--muted); display: flex; gap: 8px; align-items: baseline; }
.progress li.done { color: var(--ok); }
.progress li.cur { color: var(--text); font-weight: 600; }
.progress li.cur::before { content: ""; width: 10px; height: 10px; border: 2px solid var(--brand); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; align-self: center; }
.progress li.done::before { content: "✓"; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.draft { opacity: .85; border-left: 3px solid var(--warn); padding-left: 10px; }
.empty { text-align: center; padding: 14vh 12px 24px; }
.empty .hero-mark { display: inline-block; width: 52px; height: 52px; border-radius: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.empty h1 { margin: 0 0 6px; font-size: 1.8em; letter-spacing: -.03em; }
.empty .sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0; }
.empty .sugg button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px; color: var(--muted); }
.empty .sugg button:hover { border-color: var(--brand); color: var(--text); }
.composer { padding: 8px 16px 14px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer-in { max-width: 760px; margin: 0 auto; }
.composer .box-in { display: flex; gap: 6px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.composer .box-in:focus-within { border-color: var(--brand); }
.composer textarea { min-height: 28px; max-height: 200px; resize: none; border: 0; background: transparent; padding: 6px 0; line-height: 1.5; }
.composer textarea:placeholder-shown { min-height: calc(1.5em * 3 + 12px); }   /* 비어 있을 때 안내 문구(모델 추천 포함)가 잘리지 않게 */
.composer textarea:focus { outline: 0; }
.composer .box-in .btn { border-radius: 999px; }
.composer .box-in #attach { border: 0; background: transparent; color: var(--muted); padding: 2px 5px; font-size: 1.6em; line-height: 1; }   /* 2026-10-26: 2배 → 20% 축소 */
.composer .box-in #send { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; flex: none; }
.composer .box-in #send.danger { background: transparent; }
.composer .box-in #send .stop-dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--bad); }
.composer .box-in #send svg { width: 14px; height: 14px; }   /* 전송·중지 버튼 20% 축소(2026-10-26) */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.composer .meta { display: flex; justify-content: space-between; font-size: .78em; color: var(--muted); margin: 6px 10px 0; }
.errcard { border: 1px solid transparent; background: var(--bad-soft); border-radius: var(--radius); padding: 12px 14px; }
.chipbtn { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .85em; cursor: pointer; color: inherit; }
.chipbtn:hover { border-color: var(--brand); }
.chipbtn.on { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }

/* 마크다운 */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: .55em 0; } .md ul, .md ol { margin: .5em 0; padding-left: 1.4em; } .md li { margin: .15em 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .35em; line-height: 1.3; letter-spacing: -.01em; } .md h1 { font-size: 1.25em; } .md h2 { font-size: 1.15em; } .md h3, .md h4 { font-size: 1.05em; }
.md code { background: var(--surface2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.md pre { background: var(--surface2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; } .md pre code { background: none; padding: 0; }
.md blockquote { margin: .6em 0; padding: .1em 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md table { border-collapse: collapse; margin: .6em 0; font-size: .93em; } .md th, .md td { border: 1px solid var(--line); padding: 5px 9px; } .md th { background: var(--surface2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md .fn { font-size: .78em; font-weight: 700; padding: 0 4px; border-radius: 4px; background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; cursor: pointer; vertical-align: super; line-height: 0; }

/* 출처 패널(오른쪽 서랍) */
.panel { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: var(--panel-w); max-width: 100vw; z-index: 35; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; box-shadow: var(--shadow); }
.panel .ph { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.panel .pb { overflow-y: auto; padding: 12px 16px 30px; flex: 1; }
.panel h4 { margin: 16px 0 6px; font-size: .85em; color: var(--muted); text-transform: none; }
.src { border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; margin-bottom: 8px; }
.src.hl { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.src .t { font-weight: 600; display: block; word-break: break-word; }
.src details { margin-top: 4px; font-size: .88em; color: var(--muted); }
.clm { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; font-size: .92em; }
.clm.SUPPORTED { border-color: var(--ok); } .clm.PARTIAL { border-color: var(--warn); } .clm.UNSUPPORTED, .clm.CONTRADICTED { border-color: var(--bad); }
.clm q { color: var(--muted); display: block; font-size: .9em; margin-top: 2px; }

/* 안내·모달·토스트 */
.welcome { max-width: 760px; margin: 0 auto; padding: 8vh 18px 40px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 22px 0; }
.steps .card b { display: block; margin: 4px 0; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-fg); font-weight: 700; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); display: grid; place-items: center; z-index: 50; padding: 14px; backdrop-filter: blur(4px); }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; }
.modal h3 { margin: 0 0 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; font-size: .92em; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; background: var(--surface2); padding: 4px; border-radius: 999px; width: max-content; max-width: 100%; }
.tabs button { background: transparent; border: 0; padding: 7px 14px; color: var(--muted); border-radius: 999px; }
.tabs button.on { color: var(--text); background: var(--surface); font-weight: 600; box-shadow: var(--shadow-s); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 14px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: var(--bg); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .v { font-size: 1.5em; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile.good .v { color: var(--ok); } .tile.badv .v { color: var(--bad); }
.pcard { display: flex; gap: 12px; align-items: flex-start; }
.pcard .grow > * + * { margin-top: 8px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; align-items: center; }
.sparkline { width: 100%; height: 60px; }

/* 설정 > 답변 기준: 최신성 슬라이더·할루시네이션 체크 */
.pref { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
.pref-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.pref-h > span { font-weight: 600; }
.pref-v { color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface2); border: 0; padding: 0; margin: 10px 0 4px; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer; }
.slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer; }
.slider:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.ticks { display: flex; justify-content: space-between; font-size: .78em; color: var(--muted); }
.pref.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.pref.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.pref.check small { display: block; color: var(--muted); margin-top: 2px; }

/* 공유 보기 */
.share-note { background: var(--info-soft); padding: 8px 12px; border-radius: 10px; margin-bottom: 14px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sb { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .app.sb-open .sb { transform: none; }
  .app.sb-open .sb-dim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; font-size: 18px; }
  .app.panel-open .main { padding-right: 0; }
  .panel { top: 0; width: 100vw; z-index: 45; }
  .kv { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 60px; }
}
@media (max-width: 640px) {
  .top { padding: 0 10px; gap: 6px; }
  .top .title { display: none; }
  .bubble { max-width: 90%; }
  .msgs { padding: 18px 12px 8px; }
  .composer { padding: 6px 10px 10px; }
}
@media print {
  .sb, .sb-dim, .top, .composer, .panel, .acard .foot, .toast, .menu-btn { display: none !important; }
  .app { display: block; height: auto; }
  .view, .msgs, .chat { overflow: visible; height: auto; }
  body { background: #fff; color: #000; }
  .acard { break-inside: avoid; }
}

/* 모델 선택 트리(구분 > AI 챗봇 > 모델) */
.pop-menu.tree { min-width: 280px; max-height: 70vh; overflow: auto; }
.pop-menu .tree-h { display: flex; align-items: baseline; gap: 6px; width: 100%; background: none; border: 0; padding: 8px 10px 4px; color: inherit; cursor: pointer; text-align: left; }
.pop-menu .tree-h small { color: var(--muted); font-size: .8em; }
.pop-menu .caret { display: inline-block; width: 12px; color: var(--muted); font-size: .85em; }
.pop-menu .lv1 { padding-left: 22px; }
.pop-menu .lv2 { padding-left: 46px; }
.pop-menu .tree-p { display: flex; align-items: baseline; gap: 6px; }
.webrow { margin: 6px 0; flex-wrap: wrap; gap: 8px; }
.webrow select { width: auto; max-width: 180px; }
.webrow input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.webrow input[type=radio]:disabled { cursor: not-allowed; }
#xz-row .webrow { padding-bottom: 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
#xz-row .webrow.off { opacity: .6; cursor: default; }
#xz-row .webrow select { max-width: 220px; }

/* 에이전트 수행 단계 */
.aglive { display: flex; align-items: center; gap: 6px; margin-top: 0; padding: 4px 8px; border-radius: 8px; background: var(--surface2); min-width: 0; flex-wrap: nowrap; }
.aglive .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: agpulse 1.2s ease-in-out infinite; }
.aglive .agwhere { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.aglive b { flex: none; font-weight: 600; }
.aglive.idle .dot { background: var(--muted); }
@keyframes agpulse { 50% { opacity: .3; } }
.agwatch { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.agwatch .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: agpulse 1.2s ease-in-out infinite; }
.agstage { margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--brand); background: var(--brand-soft); }
.agstage-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.agstage-h b { font-size: 1.02em; }
.agprog { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 4px; }
.agprog li { padding: 1px 0; font-size: .92em; }
.agstep.noop .agh b { color: var(--warn); }
.agsteps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.agstep { padding: 6px 0 6px 4px; border-bottom: 1px dashed var(--line); }
.agstep:last-child { border-bottom: 0; }
.agstep .agh { margin-bottom: 2px; }
.agstep .agk { display: inline-block; font-weight: 600; color: var(--muted); margin-right: 6px; }
.agstep.running .agh b::after { content: ' …'; }
.agstep pre { max-height: 280px; overflow: auto; font-size: .82em; margin: 4px 0; }
.agstep .aglog { opacity: .8; }
.agok { color: var(--ok); }
.agfail { color: var(--bad); }
.agcode summary, .agdone summary { cursor: pointer; font-size: .85em; color: var(--muted); }
.agdone { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }
.pop-note { padding: 8px 12px; font-size: .82em; color: var(--muted); line-height: 1.5; }
.pop-note a { color: var(--brand-ink); }
/* 에이전트 작업 화면 미리보기 */
.agview { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface2); max-width: 640px; }
.agview img { display: block; width: 100%; max-height: 520px; object-fit: contain; object-position: top; background: #fff; cursor: zoom-in; }
.agview-empty { padding: 28px 12px; text-align: center; }
.agview-bar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.agview-cap { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 설정 > 스케쥴링 */
.field .flabel { display: block; font-weight: 600; margin-bottom: 4px; }
.schedlist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.schedrow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.schedrow.off { opacity: .62; }
.schedrow .sp { margin: 2px 0; overflow-wrap: anywhere; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 640px) { .schedrow { flex-wrap: wrap; } .schedrow > .grow { flex-basis: 100%; } }

/* 녹화(2026-10-25) */
.rc-count { font-size: 72px; font-weight: 800; line-height: 1.1; text-align: center; color: var(--brand); margin: 10px 0 2px; }
.recdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #e0245e; animation: recblink 1s infinite; }
@keyframes recblink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rec-on { border-color: #e0245e; }
.recsteps { margin: 4px 0 0; padding-left: 22px; }
.recsteps li { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.recsteps li.secret { color: var(--muted); }
.recdetail { margin-top: 6px; }
.btn.warn { background: var(--warn-soft); }

/* 2026-10-27 답변 중 글자가 채팅창 밖으로 나가지 않게: 띄어쓰기 없는 긴 글(URL·붙은 진행 표시)은 필요할 때만 끊고,
   표·코드·그림은 카드 폭 안에서 가로 스크롤한다. */
.msgs { overflow-x: hidden; }
.msg, .acard, .md { min-width: 0; max-width: 100%; }
/* 2026-10-27 대화 폭: 답변·내 메시지·입력창은 main 영역 가로의 60% 를 넘지 않게(좁은 화면에서는 전체 폭) */
.msgs-in, .composer-in { min-width: 0; max-width: 60%; }
@media (max-width: 900px) { .msgs-in, .composer-in { max-width: 100%; } }
.bubble .uimgs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.bubble .uimgs img { max-height: 160px; max-width: 100%; border-radius: 10px; display: block; }
.composer.drag .box-in { border-color: var(--brand); border-style: dashed; }
.acard, .md, .md p, .md li, .md h1, .md h2, .md h3, .md h4, .md blockquote, .md td, .md th { overflow-wrap: anywhere; }
.md pre { max-width: 100%; white-space: pre; }
.md table { display: block; max-width: 100%; overflow-x: auto; }
.md img { max-width: 100%; height: auto; }

/* 설정 > 나의 지능 > RAG 파일 올리기 영역 */
.ragdrop { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 6px; padding: 18px 12px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface2); cursor: pointer; text-align: center; overflow-wrap: anywhere; }
.ragdrop:hover, .ragdrop.on { border-color: var(--brand); }

/* 2026-10-27 버튼 정리: 답변 아래 동작(복사·재생성·추천·비추천·신고)과 대화 목록의 고정·삭제를 같은 선 아이콘으로 통일 */
.acard .foot { gap: 8px 10px; }
.acard .foot .fmeta { flex: 1 1 160px; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 6px; }
.acard .foot .facts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px; margin-left: auto; }
.abtn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s, transform .08s; }
.abtn:hover { background: var(--surface2); color: var(--text); }
.abtn:active { transform: scale(.92); }
.abtn:focus-visible, .icon-btn.sm:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.abtn.on.up { background: var(--brand-soft); color: var(--brand-ink); }
.abtn.on.down { background: var(--bad-soft); color: var(--bad); }
.asep { width: 1px; height: 16px; margin: 0 4px; background: var(--line); }
.convrow .icon-btn.sm { display: inline-grid; place-items: center; width: 26px; height: 26px; line-height: 1; }
.convrow .icon-btn.sm svg { width: 15px; height: 15px; }
.convrow .cpin.on { color: var(--brand-ink); }
.convrow .cdel:hover { background: var(--bad-soft); color: var(--bad); }
.sb h4 { display: flex; align-items: center; gap: 6px; }
.btn svg { vertical-align: -3px; }
