:root{--bg:#f3f5ff;--card:#fff;--line:#dfe3f3;--fg:#161a2e;--mut:#6a7090;--pri:#7b6cf0;--priD:#5f50d6;--me:#dbe8ff;--paid:#f2557b}
*{box-sizing:border-box}
html,body{height:100%;margin:0;background:var(--bg);color:var(--fg);font-family:system-ui,-apple-system,"Noto Sans KR",sans-serif}
.app{max-width:640px;margin:0 auto;height:100vh;height:100dvh;display:flex;flex-direction:column;padding:8px 10px max(10px,env(safe-area-inset-bottom))}
.head{flex:none;display:flex;align-items:center;gap:8px;padding:2px 4px 8px}
.back{width:44px;height:44px;display:grid;place-items:center;font-size:28px;color:var(--priD);text-decoration:none}
.brand{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;font-weight:900;font-size:clamp(20px,6vw,30px);letter-spacing:-.5px}
.brand img{width:46px;height:46px;object-fit:contain}
.paid{border:0;background:var(--paid);color:#fff;font:inherit;font-weight:800;font-size:17px;padding:8px 20px;border-radius:30px}
.tabs{flex:none;display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:var(--card);border:1px solid var(--line);border-radius:20px;padding:6px;margin-bottom:8px}
.tabs button{border:0;background:#eef1fb;color:#2a3050;font:inherit;font-weight:700;font-size:17px;padding:11px 0;border-radius:16px}
.tabs button.on{background:var(--pri);color:#fff}
.log{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:12px;padding:6px 2px 10px}
.msg{max-width:84%;padding:11px 14px;border-radius:18px;word-break:break-word;border:1px solid var(--line);background:var(--card)}
.msg.ai{align-self:flex-start;border-top-left-radius:6px}
.msg.me{align-self:flex-end;background:var(--me);border-color:#c5d8fb;border-top-right-radius:6px}
.msg .ko{display:block;font-weight:750;font-size:clamp(17px,4.6vw,21px);line-height:1.4;white-space:pre-wrap}
.msg .tr{display:block;margin-top:3px;color:var(--mut);font-size:clamp(14px,3.8vw,17px);line-height:1.4;white-space:pre-wrap}
.msg.me .tr{color:#4d5a80}
.msg .again{margin-top:6px;border:1px solid var(--line);background:#f6f7ff;color:var(--priD);border-radius:12px;font:inherit;font-size:14px;padding:4px 12px}
.msg.wait{color:var(--mut)}
.status{flex:none;margin:0;padding:2px 6px;min-height:20px;font-size:13px;color:var(--mut);text-align:center}
.chips{flex:none;display:flex;gap:8px;overflow-x:auto;padding:2px 0 8px}
.chips button{flex:none;border:1px solid var(--line);background:var(--card);color:#2a3050;font:inherit;font-size:14px;font-weight:650;padding:7px 12px;border-radius:20px}
.chips small{color:var(--mut);font-weight:500}
.bar{flex:none;display:flex;align-items:center;gap:8px;background:var(--card);border:1px solid var(--line);border-radius:26px;padding:8px}
.bar textarea{flex:1;min-width:0;resize:none;border:1px solid var(--line);border-radius:20px;padding:10px 14px;font:inherit;font-size:17px;line-height:1.35;background:#fff;color:var(--fg)}
.bar textarea::placeholder{color:#9aa0bd}
.round{flex:none;width:52px;height:52px;border-radius:50%;border:0;display:grid;place-items:center}
.round svg{width:26px;height:26px;fill:currentColor}
.mic{background:#eef1fb;color:#2a3050}.mic.on{background:var(--pri);color:#fff}
.go{background:var(--pri);color:#fff}
button:disabled{opacity:.45}
.tiny{flex:none;margin:6px 4px 0;text-align:center;font-size:11.5px;color:var(--mut);line-height:1.35}
.tiny span{display:block}
.sheet{position:fixed;inset:0;background:rgba(20,22,40,.5);display:flex;align-items:flex-end;justify-content:center;z-index:5}
.sheet[hidden]{display:none}
.sheetBox{width:100%;max-width:640px;max-height:88dvh;overflow:auto;background:var(--card);border-radius:22px 22px 0 0;padding:16px 16px max(18px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:12px}
.sheetHead{display:flex;justify-content:space-between;align-items:center}
.sheetHead small{color:var(--mut);font-weight:500}
.sheetHead button{border:0;background:#eef1fb;border-radius:50%;width:38px;height:38px;font-size:18px}
.sheetBox label{display:flex;flex-direction:column;gap:5px;font-size:14px;color:var(--mut)}
.sheetBox label.check{flex-direction:row;align-items:center;gap:8px;color:var(--fg);font-size:16px}
.sheetBox select,.sheetBox input[type=text]{font:inherit;font-size:16px;padding:10px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--fg);min-width:0}
.row{display:flex;gap:8px}.row input{flex:1}.row button{border:1px solid var(--line);background:#eef1fb;color:var(--fg);border-radius:12px;font:inherit;padding:0 14px}
.small{margin:0;font-size:12.5px;color:var(--mut);line-height:1.5}

.msg.sys{align-self:center;max-width:94%;background:#fff3f5;border-color:#f6c5cf;text-align:center}
.msg.sys .tr{color:#9b2c45;margin:0}
.msg.failed{opacity:.55}

/* v9: 저장 단추 표시, 안내 색, 고쳐 준 말 */
#saveTicket.saved{background:#1f9d55;color:#fff;border-color:#1f9d55}
.small.okMsg{color:#12703a;font-weight:700}
.small.badMsg{color:#b3261e;font-weight:700}
.msg .fix{display:block;margin-top:6px;font-size:.92em;color:#3b3b8f}
/* 언어가 길어도 줄 안에 들어가게 */
.tabs{grid-template-columns:repeat(4,minmax(0,1fr))}
.tabs button{min-width:0;padding:11px 2px;font-size:clamp(11px,3.4vw,17px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chips{overflow-x:visible}
.chips button{flex:1 1 0;min-width:0;white-space:normal;line-height:1.25;text-align:center;font-size:clamp(12px,3.6vw,14px);padding:7px 8px}
.tiny{overflow-wrap:anywhere}
#text::placeholder{font-size:13.5px;line-height:1.3}
.chips button.on{background:var(--pri);border-color:var(--pri);color:#fff}
.msg.me.unheard{opacity:.75;border-style:dashed}

/* v318: 이용권 없을 때 — 예시 대화 표시, 잠긴 입력칸 대신 큰 단추 하나 */
.msg.pv{opacity:.92}
.msg.sys.pvTag{background:#f1efff;border-color:#d9d3ff}
.msg.sys.pvTag .tr{color:#4b3fb5}
.lockBar{flex:none;width:100%;border:2px dashed #b9b0f5;background:#fff;color:#4b3fb5;font:inherit;font-weight:800;font-size:17px;line-height:1.35;padding:14px 16px;border-radius:26px;cursor:pointer}
.lockBar[hidden],.chips[hidden],.bar[hidden]{display:none}
.planInfo{background:#fff6e5;border:1px solid #f3d9a4;border-radius:12px;padding:10px 12px;color:#6b4a00;white-space:pre-line}

/* v321: 구매 단추·복구 코드 */
.buyBtn{width:100%;border:0;background:var(--paid);color:#fff;font:inherit;font-weight:800;font-size:16px;padding:12px 14px;border-radius:14px;cursor:pointer}
.buyBtn:disabled{opacity:.55}
.rcInfo{white-space:pre-line;word-break:break-all;background:#f6f7ff;border:1px solid var(--line);border-radius:12px;padding:8px 10px}

/* v323: 결제 내역·환불 신청 */
.histBtn{width:100%;border:1px solid var(--line);background:#fff;color:var(--fg);font:inherit;font-size:14px;padding:10px 12px;border-radius:12px;text-align:start;cursor:pointer}
.histList{display:flex;flex-direction:column;gap:8px}
.histList[hidden]{display:none}
.histRow{display:flex;flex-direction:column;gap:4px;border:1px solid var(--line);border-radius:12px;padding:8px 10px;background:#fafbff}
.rfBtn{align-self:flex-start;border:1px solid #f6c5cf;background:#fff3f5;color:#9b2c45;font:inherit;font-size:14px;font-weight:700;padding:6px 12px;border-radius:10px;cursor:pointer}
.rfBtn:disabled{opacity:.5}
.inlineBuy{display:block;margin-top:10px}

/* v349 (2026-12-02 원장님 「화면 진행해」): 대화 칸 넓히기 — 기능·글자 크기 그대로, 둘레만 줄임. 맨 끝에 두어 위 설정보다 먼저 적용 */
.app{padding-top:4px}
.head{padding:0 2px 4px;gap:6px}
.back{width:38px;height:38px;font-size:24px}
.brand{font-size:clamp(17px,5vw,22px);gap:6px;white-space:nowrap}
.brand img{width:34px;height:34px}
.paid{font-size:15px;padding:6px 14px}
.tabs{padding:4px;margin-bottom:6px;border-radius:16px}
.tabs button{padding:8px 2px;border-radius:12px}
.msg .again{margin-top:4px;padding:2px 10px;font-size:13px}
.status{min-height:16px;padding:0 6px}
.chips{padding:0 0 6px}
.chips button{padding:5px 8px}
.bar{padding:6px;border-radius:24px}
.bar textarea{padding:9px 12px}
.round{width:46px;height:46px}
.tiny{margin:4px 40px 0}
#kt-rep-wrap{margin:-24px 6px 4px !important}
.chips button{word-break:keep-all;overflow-wrap:anywhere} /* v352: 단추 세 개일 때 낱말 중간에서 줄이 바뀌지 않게 */
/* v357: 대화 화면 맨 아래 사업자 정보 한 줄, 구매 전 18세 확인 */
.bizMini{flex:none;margin:2px 40px 0;text-align:center;font-size:10.5px;color:var(--mut);line-height:1.35;overflow-wrap:anywhere}
.bizMini a{color:inherit;text-decoration:underline}
.sheetBox label.ageChk{font-size:15px}
.ageChk input{width:22px;height:22px;flex:none;margin:0}
.sheetBox label.ageChk[hidden]{display:none} /* v358: 판매 꺼짐일 때 확인 칸 숨김(label의 display:flex가 hidden을 이기던 문제) */
