/* 라일리 챗봇 — JANDI 디자인 토큰(tokens.css)만 참조한다 */

/* display 를 지정한 요소도 hidden 속성이면 숨긴다 */
[hidden] { display: none !important; }

body {
    /* JANDI 디자인 최소 폭 — 320px(WCAG 1.4.10 Reflow)까지는 가로 스크롤 없이 줄어든다 */
    min-width: 320px;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

.app {
    /* 페이지 전체가 스크롤된다 — 상단 바·대화·입력창이 같은 폭을 공유해 스크롤바가 있어도 정렬이 맞는다 */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Topbar — 안쪽 내용은 대화 영역과 같은 폭(최대 760px, 좌우 24px)에 맞춘다 */
.topbar {
    position: sticky; top: 0;
    height: 64px; flex: none;
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}
.topbar__inner {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; max-width: 760px; margin: 0 auto;
}
/* 좁은 폭·웹폰트 로드 전 대체 글꼴에서도 넘치지 않게 타이틀이 줄어든다 */
.topbar__brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar__title {
    font-size: 0.9375rem; font-weight: 700; color: var(--text);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: 12px; }
.brand-mark, .topbar .badge { flex: none; }
/* 라일리(봇) 정체성은 잔디 그린, 고객 쪽은 JANDI Blue — 한 화면이 파랑 하나로 뭉치지 않게 나눈다 */
.brand-mark {
    width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--s-100); color: var(--s-700);
}

/* Badge */
.badge {
    font-size: 0.6875rem; font-weight: 600; padding: 1px 7px;
    border-radius: 999px; line-height: 1.4;
    background: var(--surface-2); color: var(--text-muted);
}
.badge--local { background: var(--warning-bg); color: var(--warning-text); }
.badge--ai { background: var(--s-100); color: var(--s-700); }

/* Buttons */
.btn {
    min-height: 38px; padding: 0 18px;
    border: none; border-radius: 10px;
    font-size: 0.8125rem; font-weight: 600; font-family: inherit;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; transition: all 0.15s ease;
}
.btn--primary { background: var(--p-500); color: var(--on-primary); box-shadow: var(--shadow-primary-sm); }
.btn--ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 0.75rem; }
.btn:disabled { background: var(--text-disabled); color: var(--surface); box-shadow: none; cursor: not-allowed; }
.btn--ghost:disabled { background: var(--surface); color: var(--text-disabled); border-color: var(--border); }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px;
    display: grid; place-items: center;
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; transition: all 0.15s ease;
}
[data-theme='light'] .icon-sun, [data-theme='dark'] .icon-moon { display: none; }
@media (hover: hover) {
    .btn--primary:not(:disabled):hover {
        background: var(--p-600); transform: translateY(-1px);
        box-shadow: var(--shadow-primary-md), inset 0 0 0 1px var(--p-800);
    }
    .btn--ghost:hover { background: var(--hover); border-color: var(--border-strong); }
    .icon-btn:hover { background: var(--hover); color: var(--text); }
}

/* Main column */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 28px 24px 12px;
}
.thread > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }

/* Empty state */
.empty {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 8px; padding-bottom: 40px;
}
.empty__mark {
    width: 36px; height: 36px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--s-100); color: var(--s-700);
    margin-bottom: 4px;
}
.empty__title { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.empty__desc { margin: 0; font-size: 0.8125rem; color: var(--text-muted); }
.recent { margin-top: 16px; width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.recent__head { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    font-family: inherit; font-size: 0.75rem; font-weight: 500; color: var(--p-700);
}
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 100%; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* 선택지 버튼 — 고객의 다음 행동이라 Chip active 형태로 눈에 띄게 (채운 Primary 는 보내기 하나만) */
.choice {
    padding: 7px 14px; border-radius: 999px;
    background: var(--p-50); border: 1px solid var(--p-500); color: var(--p-700);
    font-family: inherit; font-size: 0.8125rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s ease;
}
.choice--action { display: inline-flex; align-items: center; gap: 6px; }
.choice:disabled { background: var(--surface); border-color: var(--border); color: var(--text-disabled); cursor: not-allowed; }
@media (hover: hover) {
    .choice:not(:disabled):hover { background: var(--p-100); transform: translateY(-1px); box-shadow: var(--shadow-primary-sm); }
}
.chip-outline:disabled { cursor: not-allowed; color: var(--text-disabled); }
.chip-outline {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 12px; font-size: 0.75rem; font-weight: 500; font-family: inherit;
    color: var(--text-2); cursor: pointer; transition: all 0.15s ease;
}
@media (hover: hover) {
    .chip-outline:not(:disabled):hover { border-color: var(--p-400); color: var(--p-700); }
}

/* Messages */
.msg { display: flex; gap: 12px; margin-bottom: 24px; animation: fadeIn 0.2s ease; }
.msg--user { justify-content: flex-end; align-items: flex-start; }
/* 고객 쪽 — 상담사도 같은 화면을 보므로 누가 말했는지 아바타로 구분한다 */
.msg__user-body { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; max-width: 80%; }
.msg__user-body .bubble { max-width: 100%; }
.msg--user .avatar--user { background: var(--p-100); color: var(--p-700); margin-top: 2px; }
/* 고객이 보낸 화면 캡처 — 누르면 원본을 새 탭에서 연다 */
.msg__images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.msg__images img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); cursor: zoom-in; }
.bubble:empty { display: none; }
.bubble {
    max-width: 80%;
    padding: 7px 12px;
    background: var(--p-500); color: var(--on-primary);
    border-radius: 14px;
    font-size: 0.875rem; line-height: 1.6;
    white-space: pre-wrap; word-break: break-word;
}
.avatar {
    flex: none; width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--s-100); color: var(--s-700);
}
.msg__body { flex: 1; min-width: 0; }
.msg__meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.msg__name { font-size: 0.8125rem; font-weight: 700; color: var(--text); }
.msg__time { font-size: 0.6875rem; color: var(--text-muted); }
.msg__turn { font-size: 0.6875rem; color: var(--text-muted); }
.msg__turn::before { content: "·"; margin-right: 8px; }
.msg__turn:empty { display: none; }
.review__turns { margin-left: 4px; vertical-align: 1px; }
.msg__foot { margin-top: 4px; font-size: 0.6875rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; min-height: 24px; }
.msg__info:empty { display: none; }
/* 👍/👎 — 아이콘 글리프가 본문 시작선에 오게 버튼 여백만큼 당긴다 */
.feedback { display: inline-flex; gap: 0; margin-left: -6px; }
.foot-end { margin-left: auto; font-size: 0.75rem; color: var(--text-muted); }
.foot-end .link-btn { font-weight: 600; }
.icon-btn--sm { width: 24px; height: 24px; border-radius: 6px; }
.feedback__btn[aria-pressed="true"] { background: var(--p-50); color: var(--p-700); }
.feedback__btn:disabled { cursor: not-allowed; opacity: 0.5; }
.feedback__comment { display: block; margin-top: 6px; max-width: 420px; }
.feedback__comment input {
    width: 100%; padding: 7px 10px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.75rem; font-family: inherit; transition: all 0.15s ease;
}
.feedback__comment input::placeholder { color: var(--text-muted); }
.feedback__comment input:focus { outline: none; border-color: var(--p-500); box-shadow: 0 0 0 3px var(--p-100); }
.feedback__comment input:disabled { background: var(--surface-2); color: var(--text-muted); }

/* Search steps */
.steps { display: flex; flex-direction: column; gap: 6px; }
.steps:not(:empty) { margin-bottom: 10px; }
.step {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface);
}
.step summary {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; cursor: pointer; list-style: none;
    font-size: 0.75rem; color: var(--text-2);
}
.step summary::-webkit-details-marker { display: none; }
.step summary svg { flex: none; color: var(--text-muted); }
.step__query { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step__count { margin-left: auto; flex: none; }
.step__chevron { transition: transform 0.15s ease; }
.step[open] .step__chevron { transform: rotate(180deg); }
.step ol { margin: 0; padding: 4px 12px 10px; list-style: none; border-top: 1px solid var(--border); }
.step li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.75rem; min-width: 0; }
.step li a, .step li span.step__title { color: var(--text-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) {
    .step summary:hover { background: var(--hover); border-radius: 10px; }
    .step li a:hover { color: var(--p-700); text-decoration: underline; }
}

/* Chip (출처 분류) */
.chip {
    flex: none; padding: 2px 9px; border-radius: 999px;
    font-size: 0.6875rem; font-weight: 600;
}
.chip--guide { background: var(--accent-1-bg); color: var(--accent-1-text); }
.chip--faq { background: var(--accent-2-bg); color: var(--accent-2-text); }
.chip--blog { background: var(--surface-2); color: var(--text-2); }

/* Status */
.status { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-muted); padding: 4px 0; }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border-strong); border-top-color: var(--p-500);
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
}

/* Error */
.error {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 8px; padding: 10px 14px; border-radius: 10px;
    background: var(--danger-bg);
}
.error__text { font-size: 0.8125rem; font-weight: 600; color: var(--danger-text); flex: 1; min-width: 200px; }

/* Answer markdown */
.md { font-size: 0.875rem; line-height: 1.7; color: var(--text); word-break: break-word; }
.md:empty { display: none; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.md strong { font-weight: 700; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md a { color: var(--p-700); text-decoration: none; word-break: break-all; }
.md code {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 6px; padding: 1px 6px; font-size: 0.75rem; color: var(--text);
}
/* 메뉴 경로 — 본문 글꼴로 단계를 굵게, 사이는 꺾쇠 아이콘. 줄바꿈은 단계 사이에서만 한다 */
.md .menu-path {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
    padding: 1px 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.menu-path__step { font-weight: 600; color: var(--text); white-space: nowrap; }
.menu-path__sep { display: inline-block; vertical-align: -1px; margin: 0 3px; color: var(--text-muted); }
.md pre { background: var(--surface-2); border-radius: 8px; padding: 12px; overflow-x: auto; }
.md pre code { border: none; padding: 0; background: none; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.md blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md table { border-collapse: collapse; margin: 0 0 10px; font-size: 0.8125rem; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md img {
    display: block; max-width: 100%; max-height: 420px;
    margin: 8px 0 12px; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow-sm); cursor: zoom-in; background: var(--surface);
}
@media (hover: hover) {
    .md a:hover { text-decoration: underline; }
}

/* 출처 카드 (답변 끝 "참고:" 목록) — 검색 단계 카드와 같은 크기로 작게 */
.sources {
    margin-top: 10px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); overflow: hidden;
}
.sources__head {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; font-size: 0.6875rem; font-weight: 600; color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.sources a {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; font-size: 0.75rem; font-weight: 500;
    color: var(--text-2); text-decoration: none;
}
.sources a + a { border-top: 1px solid var(--border); }
.sources a span.sources__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources svg { flex: none; width: 12px; height: 12px; color: var(--text-muted); }
@media (hover: hover) {
    .sources a:hover { background: var(--hover); color: var(--p-700); }
}

/* 상담 리뷰 */
.review {
    margin: 4px auto 24px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-sm); padding: 18px 20px;
    animation: fadeIn 0.2s ease;
}
.review__head { display: flex; gap: 10px; align-items: flex-start; }
.review__icon {
    flex: none; width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--p-50); color: var(--p-700);
}
.review__title { margin: 0; font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.review__sub { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-muted); }
.review__body { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
/* 리뷰 구획 — DetailSection 구분선형 */
.review__section { padding: 16px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.review__section + .review__section { border-top: 1px solid var(--border-strong); margin-top: 12px; }
.review__section-head { min-height: 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.review__section-title { margin: 0; font-size: 1rem; line-height: 1.3; font-weight: 700; color: var(--text); }
.review__comment { margin: 0; font-size: 0.8125rem; color: var(--text); line-height: 1.6; }
.review__points-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.review__points-grid:empty { display: none; }
/* 잘한 점·아쉬운 점 — 제목은 본문과 같은 크기, 아이콘·불릿 색으로 구분한다 */
.review__points h4 { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 700; color: var(--text); }
.review__points--good h4 svg, .review__points--good li::marker { color: var(--s-700); }
.review__points--bad h4 svg, .review__points--bad li::marker { color: var(--warning-text); }
.review__points ul { margin: 0; padding-left: 18px; font-size: 0.8125rem; color: var(--text); line-height: 1.6; }
.review__item { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.review__section-head + .review__item { border-top: none; padding-top: 0; }
/* 평가 등급 — StatusPill 형태 (dot + 라벨) */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--great { background: var(--s-100); color: var(--s-700); }
.pill--good { background: var(--p-100); color: var(--p-700); }
.pill--fair { background: var(--warning-bg); color: var(--warning-text); }
.pill--poor { background: var(--danger-bg); color: var(--danger-text); }
.review__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.review__target { font-size: 0.8125rem; font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.review__target { color: var(--p-700); }
.review__question { font-size: 0.75rem; color: var(--text-muted); }
.review__suggestion { font-size: 0.8125rem; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.review__evidence { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; white-space: pre-wrap; }
.review--stale { opacity: 0.55; }
.review__docs {
    margin: 2px 0 0; padding: 4px 12px; list-style: none;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.review__docs li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.75rem; min-width: 0; }
.review__docs li + li { border-top: 1px solid var(--border); }
.review__docs a, .review__doc-title { flex: 1; min-width: 0; color: var(--text-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review__docs svg { flex: none; color: var(--text-muted); }
.chip--improve_guide { background: var(--p-100); color: var(--p-700); }
.chip--add_paraphrase { background: var(--accent-1-bg); color: var(--accent-1-text); }
.chip--improve_faq { background: var(--accent-3-bg); color: var(--accent-3-text); }
.chip--new_faq { background: var(--accent-2-bg); color: var(--accent-2-text); }
.chip--fix_doc { background: var(--warning-bg); color: var(--warning-text); }
.chip--cause { background: var(--warning-bg); color: var(--warning-text); }
.skeleton {
    height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
    background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (hover: hover) {
    a.review__target:hover { text-decoration: underline; }
    .review__docs a:hover { color: var(--p-700); text-decoration: underline; }
    .link-btn:hover { text-decoration: underline; }
}

/* 이미지 크게 보기 — jandi-design Modal 의 배경(--backdrop + blur)을 쓰고, 패널 없이 이미지만 띄운다 */
.lightbox {
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
    margin: 0; padding: 56px 24px 24px; border: none;
    background: var(--backdrop); backdrop-filter: blur(4px);
    place-items: center; cursor: zoom-out;
}
.lightbox[open] { display: grid; animation: fadeIn 0.15s ease; }
.lightbox::backdrop { background: transparent; }
.lightbox__img {
    max-width: min(100%, 1200px); max-height: calc(100vh - 80px); object-fit: contain;
    border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); cursor: default;
}
.lightbox__close { position: fixed; top: 12px; right: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); }
body:has(.lightbox[open]) { overflow: hidden; }

/* Composer */
.composer {
    position: sticky; bottom: 0; z-index: 10;
    padding: 12px 24px calc(16px + env(safe-area-inset-bottom));
    background: var(--bg);
}
.composer > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.composer__float {
    position: absolute; left: 24px; right: 24px; bottom: 100%;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.composer__float > * { pointer-events: auto; }
.notice {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
    padding: 8px 8px 8px 12px;
    background: var(--surface); border: 1px solid var(--p-500); border-radius: 10px;
    box-shadow: var(--shadow-md); font-size: 0.8125rem; font-weight: 600; color: var(--text);
}
.notice__body { display: flex; align-items: center; gap: 8px; min-width: 0; }
.notice__icon { flex: none; display: grid; }
/* 등급 — jandi-design InlineMessage 색. 대화 위에 겹쳐 뜨므로 반투명 등급 배경(다크) 아래에 surface 를 깔아 불투명하게 둔다 */
.notice--info { background: linear-gradient(var(--p-50), var(--p-50)), var(--surface); border-color: var(--p-500); }
.notice--info .notice__icon { color: var(--p-700); }
.notice--success { background: linear-gradient(var(--s-100), var(--s-100)), var(--surface); border-color: var(--s-500); }
.notice--success .notice__icon { color: var(--s-700); }
.notice--warning { background: linear-gradient(var(--warning-bg), var(--warning-bg)), var(--surface); border-color: var(--warning); }
.notice--warning .notice__icon { color: var(--warning-text); }
.notice--danger { background: linear-gradient(var(--danger-bg), var(--danger-bg)), var(--surface); border-color: var(--danger); }
.notice--danger .notice__icon { color: var(--danger-text); }
.notice__actions { display: flex; gap: 8px; }
.composer__box {
    display: flex; align-items: flex-end; gap: 6px;
    padding: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-md); transition: all 0.15s ease;
}
.composer__box:focus-within { border-color: var(--p-500); box-shadow: 0 0 0 3px var(--p-100), var(--shadow-md); }
.composer textarea {
    flex: 1; resize: none; border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 0.875rem; line-height: 1.6; color: var(--text);
    padding: 6px 0; max-height: 180px; overflow-y: hidden;
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:disabled { cursor: not-allowed; }
.composer .end { flex: none; }
.composer .attach { flex: none; width: 38px; height: 38px; }
/* 보낼 이미지 미리보기 */
.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.attachment img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attachment__remove {
    position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center; padding: 0; cursor: pointer;
    background: var(--surface); color: var(--text-2); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
/* 상담 종료 뒤 잠긴 입력창 */
.composer__box:has(textarea:disabled) { background: var(--surface-2); box-shadow: none; }
/* 보내기 버튼 바깥선(입력창 테두리 1px + 안쪽 여백 8px)에 맞춰 양쪽을 들인다 */
.composer__hint { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 8px; padding: 0 9px; font-size: 0.6875rem; color: var(--text-muted); word-break: keep-all; }
.composer__keys { flex: none; margin-left: auto; }

/* 반응형 */
@media (max-width: 760px) {
    .topbar { padding: 0 16px; }
    .topbar .badge { display: none; }
    .thread { padding: 20px 16px 8px; }
    .composer { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
    .composer__float { left: 16px; right: 16px; }
    .send { padding: 0 12px; }
    .msg__user-body { max-width: 88%; }
    .review__points-grid { grid-template-columns: 1fr; }
    .avatar { display: none; }
}
@media (max-width: 480px) {
    /* 상단 버튼은 아이콘만 (이름은 aria-label 로 유지) */
    .topbar .btn__label, .composer .btn__label { display: none; }
    .composer .btn { padding: 0 12px; }
    .topbar .btn--sm { padding: 0 9px; }
}
/* iOS 는 16px 미만 입력창에 포커스하면 화면을 확대한다 */
@media (pointer: coarse) {
    .composer textarea { font-size: 1rem; }
}
