/* 실시간 채팅상담 — 색은 사이트 테마 변수(--accent, --cta …)를 따라갑니다 */
#chat-root{--c-main:var(--accent,#1f6fff);--c-main-ink:var(--accent-ink,#fff);--c-soft:var(--accent-soft,#e8f0ff);--c-ink:var(--ink,#12233d);--c-line:var(--line,#dfe6f1);position:fixed;right:14px;bottom:calc(86px + env(safe-area-inset-bottom));z-index:70;font-family:inherit;font-size:15px;color:var(--c-ink)}
#chat-root[hidden]{display:none}
#chat-root *{box-sizing:border-box}
.cx-fab{display:flex;align-items:center;gap:8px;height:50px;padding:0 18px;border:0;border-radius:999px;background:var(--c-main);color:var(--c-main-ink);font:inherit;font-weight:900;box-shadow:0 8px 24px rgba(18,35,61,.28);cursor:pointer;position:relative}
.cx-badge{position:absolute;top:-6px;right:-4px;min-width:22px;height:22px;border-radius:11px;background:#ef4444;color:#fff;font-size:12px;font-weight:900;display:none;align-items:center;justify-content:center;padding:0 6px}
.cx-bubble{position:absolute;right:0;bottom:60px;width:max-content;max-width:230px;background:#fff;border:1px solid var(--c-line);border-radius:14px;padding:10px 28px 10px 14px;box-shadow:0 6px 20px rgba(18,35,61,.18);font-size:14px;font-weight:700;line-height:1.4;display:none}
.cx-bubble button{position:absolute;top:2px;right:4px;border:0;background:none;font-size:18px;color:#94a3b8;cursor:pointer}
.cx-win{position:absolute;right:0;bottom:0;width:360px;height:min(560px,calc(100vh - 150px));background:#fff;border-radius:18px;box-shadow:0 14px 48px rgba(18,35,61,.35);display:none;flex-direction:column;overflow:hidden;border:1px solid var(--c-line)}
#chat-root.open .cx-win{display:flex}
#chat-root.open .cx-fab,#chat-root.open .cx-bubble{display:none!important}
.cx-head{background:var(--c-main);color:var(--c-main-ink);padding:14px 16px;display:flex;align-items:center;gap:10px}
.cx-head b{display:block;font-size:16px}.cx-head small{opacity:.85;font-size:12.5px}
.cx-head .t{flex:1}
.cx-x{border:0;background:rgba(255,255,255,.2);color:inherit;width:32px;height:32px;border-radius:50%;font-size:18px;cursor:pointer}
.cx-list{flex:1;overflow-y:auto;padding:14px;background:#f6f8fc;display:flex;flex-direction:column;gap:8px}
.cx-m{max-width:82%;padding:9px 12px;border-radius:14px;line-height:1.5;white-space:pre-wrap;word-break:break-word;font-size:14.5px}
.cx-m.customer{align-self:flex-end;background:var(--c-main);color:var(--c-main-ink);border-bottom-right-radius:4px}
.cx-m.owner,.cx-m.bot{align-self:flex-start;background:#fff;border:1px solid var(--c-line);border-bottom-left-radius:4px}
.cx-m.system{align-self:center;background:transparent;color:#64748b;font-size:12.5px;text-align:center;max-width:95%}
.cx-m img{display:block;max-width:100%;border-radius:10px;margin-top:4px}
.cx-who{align-self:flex-start;font-size:12px;font-weight:700;color:#64748b;margin:4px 0 -4px 4px}
.cx-m.pending{opacity:.6}
.cx-quick{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 10px;background:#f6f8fc}
.cx-quick button{border:1px solid var(--c-main);color:var(--c-main);background:#fff;border-radius:999px;padding:7px 12px;font:inherit;font-size:13.5px;font-weight:700;cursor:pointer}
.cx-contact{display:none;padding:12px 14px;background:#fff7ed;border-top:1px solid #fed7aa;font-size:13.5px}
.cx-contact p{margin:0 0 8px;font-weight:700}
.cx-contact .row{display:flex;gap:6px}
.cx-contact input{flex:1;min-width:0;height:40px;border:1px solid #fdba74;border-radius:10px;padding:0 10px;font:inherit}
.cx-contact button{height:40px;padding:0 14px;border:0;border-radius:10px;background:var(--cta,#ff7a1a);color:var(--cta-ink,#fff);font:inherit;font-weight:900;cursor:pointer}
.cx-bar{display:flex;gap:6px;padding:10px;border-top:1px solid var(--c-line);background:#fff;align-items:flex-end}
.cx-bar textarea{flex:1;min-width:0;resize:none;border:1px solid var(--c-line);border-radius:12px;padding:10px 12px;font:inherit;font-size:16px;max-height:90px;height:42px;outline:none}
.cx-bar textarea:focus{border-color:var(--c-main)}
.cx-bar button{height:42px;border:0;border-radius:12px;font:inherit;font-weight:900;cursor:pointer}
.cx-photo{width:42px;background:var(--c-soft);color:var(--c-main);font-size:18px}
.cx-send{padding:0 16px;background:var(--c-main);color:var(--c-main-ink)}
.cx-send:disabled{opacity:.5}
.cx-note{padding:6px 14px;font-size:12px;color:#dc2626;background:#fff;display:none}
@media(max-width:560px){
  #chat-root{right:12px}
  #chat-root.open{right:0;left:0;bottom:0;top:0}
  #chat-root.open .cx-win{position:fixed;inset:0;width:auto;height:auto;border-radius:0;border:0}
}
@media(min-width:900px){#chat-root{bottom:104px}}
