.ai-chat {
  --chat-border: #cf0086;
  --chat-bg: #ffffff;
  --chat-text: #171717;
  --chat-muted: #666666;
  --chat-accent: #c90086;
  --chat-soft: #f7eff8;
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 1200;
  font-family: Arial, "Noto Sans KR", sans-serif;
  color: var(--chat-text);
}
.ai-chat *, .ai-chat *::before, .ai-chat *::after { box-sizing: border-box; }
.ai-chat__launcher { width:320px; min-height:76px; display:flex; align-items:center; gap:13px; border:0; border-radius:999px; background:linear-gradient(135deg,#d3008b,#bd007c); color:#fff; padding:8px 10px 8px 24px; cursor:pointer; box-shadow:0 10px 28px rgba(92,0,59,.22); text-align:left; }
.ai-chat__launcher-avatar { width:52px; height:52px; flex:0 0 52px; margin-left:auto; border:3px solid #fff; border-radius:50%; position:relative; background:#fff; }
.ai-chat__launcher-avatar img { width:100%; height:100%; display:block; object-fit:cover; border-radius:50%; }
.ai-chat__launcher-avatar i { position:absolute; right:-2px; bottom:1px; width:13px; height:13px; border:2px solid #fff; border-radius:50%; background:#32c94a; }
.ai-chat__mobile-label { display:none; }
.ai-chat__avatar { width:44px; height:44px; flex:0 0 44px; border-radius:50%; overflow:hidden; display:inline-flex; align-items:center; justify-content:center; background:#fff; }
.ai-chat__avatar img { width:100%; height:100%; object-fit:cover; display:block; }
.ai-chat__launcher-text, .ai-chat__identity { min-width:0; display:flex; flex-direction:column; }
.ai-chat__launcher-text strong { font-size:18px; line-height:1.15; font-weight:700; color:#fff; }
.ai-chat__launcher-text small { margin-top:2px; font-size:15px; line-height:1.15; color:#fff; }
.ai-chat__identity strong { font-size:17px; line-height:1.15; font-weight:500; }
.ai-chat__identity small { font-size:16px; line-height:1.25; }
.ai-chat__panel { width:min(430px,calc(100vw - 32px)); height:auto; min-height:0; max-height:calc(100vh - 36px); max-height:calc(100dvh - 36px); display:none; flex-direction:column; overflow:hidden; border:1px solid var(--chat-accent); border-radius:23px; background:#fff; box-shadow:0 16px 46px rgba(0,0,0,.13); }
/* Keep the bottom position fixed; the panel grows upward as messages arrive. */
.ai-chat__panel > :not(.ai-chat__body) { flex-shrink:0; }
.ai-chat.is-open .ai-chat__launcher { display:none; }
.ai-chat.is-open .ai-chat__panel { display:flex; }
.ai-chat__header { min-height:67px; display:flex; align-items:center; gap:11px; padding:10px 17px; background:var(--chat-accent); color:#fff; }
.ai-chat__header .ai-chat__avatar { width:48px; height:48px; flex-basis:48px; border:2px solid rgba(255,255,255,.75); }
.ai-chat__identity { flex:1; gap:2px; }
.ai-chat__identity small { color:#fff; }
.ai-chat__close { width:36px; height:36px; flex:0 0 36px; border:0; background:transparent; color:#fff; font-size:38px; line-height:1; font-weight:200; cursor:pointer; padding:0; }
.ai-chat__body { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:38px 14px 14px 68px; background:#f8f1f9; }
.ai-chat__message { display:flex; position:relative; margin-bottom:12px; }
.ai-chat__message--manager { justify-content:flex-start; }
.ai-chat__message--manager::before { content:""; position:absolute; width:43px; height:43px; left:-52px; top:0; border-radius:50%; background:#fff var(--chat-avatar-url, url("/images/chat_sena.png")) center/cover no-repeat; }
.ai-chat__message--user { justify-content:flex-end; }
.ai-chat__bubble { max-width:100%; padding:13px 15px; border-radius:17px; background:#fff; border:1px solid var(--chat-accent); line-height:1.45; font-size:14px; white-space:pre-wrap; word-break:break-word; }
.ai-chat__message--user .ai-chat__bubble { max-width:82%; background:var(--chat-accent); border-color:var(--chat-accent); color:#fff; padding:12px 18px; }
.ai-chat__quick, .ai-chat__actions { display:flex; gap:9px; flex-wrap:wrap; padding:16px 16px 8px; background:#fff; border-top:1px solid #f0e8f0; }
.ai-chat__actions { padding-top:6px; border-top:0; }
.ai-chat__quick button, .ai-chat__actions button { border:1px solid #e1e1e1; border-radius:999px; background:#fff; color:#222; padding:8px 13px; font-size:12px; line-height:1.2; cursor:pointer; }
.ai-chat__quick button:hover, .ai-chat__actions button:hover { border-color:var(--chat-accent); color:var(--chat-accent); }
.ai-chat__composer { display:flex; align-items:center; gap:9px; padding:18px 15px 20px; background:#fff; }
.ai-chat__composer textarea { flex:1; min-width:0; min-height:43px; max-height:120px; resize:none; border:1px solid #9a768e; border-radius:15px; padding:11px 12px; font:inherit; font-size:14px; line-height:1.4; outline:none; }
.ai-chat__composer textarea:focus { border-color:var(--chat-accent); }
.ai-chat__send { width:46px; height:46px; flex:0 0 46px; border:0; border-radius:50%; background:var(--chat-accent); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; padding:0; background-image:url("/images/btn_send.png"); background-position:center; background-repeat:no-repeat; background-size:46px 46px; }
.ai-chat__send-fallback { font-size:23px; line-height:1; transform:rotate(-18deg); }
.ai-chat__notice { min-height:0; padding:0 14px; color:var(--chat-muted); background:#fff; font-size:11px; }
.ai-chat__status:empty { display:none; }
.ai-chat__debug { margin:8px 14px 0; padding:10px 12px; border:1px dashed var(--chat-border); border-radius:12px; background:var(--chat-soft); font-size:11px; line-height:1.5; }
.ai-chat__debug-row + .ai-chat__debug-row { margin-top:2px; }
.ai-chat[data-mode="matching"] .ai-chat__launcher, .ai-chat[data-mode="profile"] .ai-chat__launcher { width:300px; }
@media (max-width:767px) {
  .ai-chat { right:16px; bottom:16px; left:auto; }
  .ai-chat__launcher { width:auto; height:64px; min-height:64px; margin:0; padding:0 5px 0 17px; display:flex; align-items:center; justify-content:flex-end; gap:10px; border:0; border-radius:999px; background:var(--chat-accent); box-shadow:0 8px 24px rgba(92,0,59,.24); }
  .ai-chat__launcher-text { display:none; }
  .ai-chat__mobile-label { display:flex; flex-direction:column; color:#fff; white-space:nowrap; line-height:1.1; }
  .ai-chat__mobile-label strong { font-size:15px; font-weight:700; }
  .ai-chat__mobile-label small { margin-top:3px; font-size:12px; font-weight:500; color:#fff; }
  .ai-chat__launcher-avatar { display:block; width:54px; height:54px; flex:0 0 54px; margin:0; border:2px solid #fff; box-shadow:none; }
  .ai-chat__launcher-avatar i { width:15px; height:15px; right:-1px; bottom:2px; }
  .ai-chat__panel { position:fixed; inset:0; width:100%; min-height:100vh; height:100vh; height:100dvh; max-width:none; max-height:none; border:0; border-radius:0; }
  .ai-chat__header { min-height:64px; padding-top:max(10px,env(safe-area-inset-top)); }
  .ai-chat__body { padding:24px 14px 12px 64px; }
  .ai-chat__quick { overflow-x:auto; flex-wrap:nowrap; padding-bottom:8px; }
  .ai-chat__quick button { flex:0 0 auto; }
  .ai-chat__composer { padding-bottom:max(14px,env(safe-area-inset-bottom)); }
}
@media (min-width:768px) and (max-width:1100px) {
  .ai-chat { right:18px; bottom:18px; }
  .ai-chat__panel { width:400px; height:auto; max-height:calc(100vh - 36px); max-height:calc(100dvh - 36px); }
}
