/* AI 챗봇 · 상담원 채팅 위젯 (src/components/chat/ChatWidget.tsx). Own cw- prefix: no rule here reaches the legacy markup. */
.cw-fab {
  position: fixed;
  right: 20px;
  bottom: 28px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px 0 8px;
  border: 0;
  border-radius: 24px;
  background: #13806a;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px rgba(19, 128, 106, 0.35);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.cw-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(19, 128, 106, 0.4); }
.cw-fab:focus-visible { outline: 3px solid #8fcbbd; outline-offset: 2px; }
.cw-fab-ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: #13806a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-fab-ico svg { width: 19px; height: 19px; }

.cw-dim { position: fixed; inset: 0; z-index: 10001; background: rgba(20, 24, 31, 0.35); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.25s, visibility 0s 0.25s; }
.cw-dim.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 0.25s; }

.cw-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10002;
  width: 400px;
  height: min(680px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: #f6f7f9;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  font-size: 14px;
  color: #252525;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  /* closed: hidden from Tab and screen readers too (visibility), after the fade-out */
  visibility: hidden;
  transition: transform 0.25s, opacity 0.25s, visibility 0s 0.25s;
}
.cw-panel.on { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform 0.25s, opacity 0.25s; }
.cw-panel button { font-family: inherit; }

.cw-head { flex: none; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 10px 0 14px; background: #13806a; color: #fff; }
.cw-head-title { font-size: 16px; font-weight: 700; }
.cw-head-tag { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.22); }
.cw-head-sp { flex: 1; }
.cw-icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cw-icon-btn:hover { background: rgba(255, 255, 255, 0.18); }
.cw-icon-btn svg { width: 20px; height: 20px; }

.cw-banner { flex: none; padding: 9px 16px; font-size: 13px; }
.cw-banner.wait { background: #fff7e6; color: #7a4b00; }
.cw-banner.open { background: #e9f5f2; color: #0d5a4a; }
.cw-banner.info { background: #eef0f3; color: #4a4f57; }
.cw-banner.err { background: #fdecec; color: #a3201b; }

.cw-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cw-list { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.cw-row { display: flex; align-items: flex-start; gap: 8px; }
.cw-row.me { justify-content: flex-end; }
.cw-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1px solid #dbdbdb; display: flex; align-items: center; justify-content: center; color: #13806a; }
.cw-avatar svg { width: 18px; height: 18px; }
.cw-avatar.agent { background: #13806a; border-color: #13806a; color: #fff; }
.cw-bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cw-bubble.bot { background: #fff; border: 1px solid #e3e5e8; border-top-left-radius: 4px; }
.cw-bubble.me { background: #13806a; color: #fff; border-bottom-right-radius: 4px; }
.cw-bubble a { color: #0e6b58; text-decoration: underline; word-break: break-all; }
.cw-bubble.me a { color: #fff; }
.cw-name { font-size: 11px; color: #6b6b6b; margin-bottom: 2px; }
.cw-read { font-size: 11px; color: #8a8f96; text-align: right; margin-top: 2px; }
.cw-system { text-align: center; }
.cw-system span { display: inline-block; max-width: 90%; padding: 6px 12px; border-radius: 12px; font-size: 12px; color: #6b6b6b; white-space: pre-wrap; text-align: left; }
.cw-system.summary span { background: #fff; border: 1px dashed #c9cdd2; }
.cw-typing { padding-left: 42px; display: flex; gap: 4px; }
.cw-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b9bec5; animation: cw-bounce 1s infinite; }
.cw-typing i:nth-child(2) { animation-delay: 0.15s; }
.cw-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes cw-bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }
.cw-hint { font-size: 12px; color: #6b6b6b; padding-left: 42px; }

.cw-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 42px; }
.cw-chip { border: 1px solid #a9d6cc; background: #fff; color: #0e6b58; border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-align: left; }
.cw-chip:hover { background: #e9f5f2; }
.cw-chip:disabled { opacity: 0.5; cursor: default; }

.cw-card { margin: 4px 8px; padding: 20px; border-radius: 14px; background: #fff; border: 1px solid #e3e5e8; text-align: center; }
.cw-card strong { display: block; font-size: 15px; }
.cw-card p { margin-top: 6px; font-size: 13px; color: #6b6b6b; line-height: 1.5; }
.cw-btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 20px; margin-top: 14px; border: 0; border-radius: 20px; background: #13806a; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.cw-btn:hover { background: #0f6b58; }
.cw-btn.line { background: #fff; color: #454545; border: 1px solid #c9cdd2; }

.cw-form { flex: none; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #e3e5e8; }
.cw-input { flex: 1; min-width: 0; resize: none; max-height: 110px; border: 1px solid #c9cdd2; border-radius: 20px; padding: 9px 14px; font-size: 14px; line-height: 1.5; outline: none; font-family: inherit; color: #252525; background: #fff; }
.cw-panel .cw-input:focus { border-color: #13806a; outline: none; box-shadow: 0 0 0 3px rgba(19, 128, 106, 0.18); }
.cw-input:disabled { background: #f3f4f6; }
.cw-send { flex: none; height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: #13806a; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.cw-send:disabled { opacity: 0.4; cursor: default; }
.cw-attach { flex: none; width: 40px; height: 40px; border: 1px solid #c9cdd2; border-radius: 50%; background: #fff; color: #6b6b6b; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cw-attach svg { width: 18px; height: 18px; }
.cw-attach:disabled { opacity: 0.4; cursor: default; }
.cw-actions { flex-basis: 100%; display: flex; gap: 8px; }
.cw-action { flex: 1; height: 36px; border-radius: 18px; border: 1px solid #c9cdd2; background: #fff; color: #454545; font-size: 13px; font-weight: 600; cursor: pointer; }
.cw-action:hover { background: #f6f7f9; }
.cw-action.on { border-color: #13806a; color: #0e6b58; background: #e9f5f2; }
.cw-action.agent { border-color: #a9d6cc; color: #0e6b58; }
.cw-action.stop { border-color: #f1b8b5; color: #a3201b; }
.cw-ferr { flex-basis: 100%; font-size: 12px; color: #a3201b; }
.cw-ferr.busy { color: #6b6b6b; }

.cw-pop { position: absolute; left: 10px; right: 10px; bottom: 112px; z-index: 3; max-height: 60%; overflow-y: auto; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid #e3e5e8; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); }
.cw-pop-head { display: flex; align-items: center; font-weight: 700; }
.cw-pop-head button { margin-left: auto; width: 28px; height: 28px; border: 0; background: none; font-size: 18px; color: #6b6b6b; cursor: pointer; border-radius: 50%; }
.cw-pop h4 { margin: 12px 0 6px; font-size: 12px; color: #6b6b6b; font-weight: 700; }
.cw-pop .cw-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.cw-side { position: absolute; inset: 0; z-index: 4; display: flex; }
.cw-side-in { width: 78%; max-width: 280px; height: 100%; background: #edf3f1; display: flex; flex-direction: column; }
.cw-side-new { margin: 12px; height: 42px; border: 0; border-radius: 10px; background: #13806a; color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.cw-side h4 { padding: 0 16px 6px; font-size: 12px; color: #6b6b6b; }
.cw-side-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.cw-side-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.cw-side-item:hover, .cw-side-item.on { background: #fff; }
.cw-side-item strong { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-side-item span { font-size: 11px; color: #8a8f96; }
.cw-side-dim { flex: 1; background: rgba(20, 24, 31, 0.3); }

.cw-file img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; background: #eef0f3; }
.cw-file-doc { display: flex; align-items: center; gap: 8px; color: inherit; }
.cw-file-doc b { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; }
.cw-file-doc small { font-size: 11px; opacity: 0.75; }
.cw-drop { position: absolute; inset: 8px; z-index: 20; border: 2px dashed #6fb8a7; border-radius: 14px; background: rgba(233, 245, 242, 0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #0e6b58; font-size: 13px; text-align: center; pointer-events: none; }
.cw-hidden { display: none; }

@media (max-width: 768px) {
  .cw-fab { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); height: 44px; font-size: 14px; padding-right: 14px; }
  .cw-fab-ico { width: 30px; height: 30px; }
  .cw-panel { right: 0; bottom: 0; width: 100%; height: 100dvh; border-radius: 0; }
  .cw-input { font-size: 16px; }
}
