.kacb-widget{
  position:fixed;
  bottom:24px;
  z-index:2147482000;
  font-family:var(--kacb-font),-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  line-height:1.35;
}
.kacb-widget *{box-sizing:border-box}
.kacb-widget.kacb-right{right:24px}
.kacb-widget.kacb-left{left:24px}

.kacb-launch{
  position:relative;
  z-index:2;
  width:62px;
  height:62px;
  border:0;
  border-radius:50%;
  background:var(--kacb-button);
  color:#fff;
  box-shadow:0 12px 34px rgba(0,0,0,.28);
  cursor:pointer;
  display:grid;
  place-items:center;
  overflow:hidden;
  transition:opacity .16s ease,visibility .16s ease,transform .18s ease,box-shadow .18s ease;
  pointer-events:auto;
}
.kacb-launch img{width:100%;height:100%;display:block;object-fit:contain;object-position:center bottom}
.kacb-launch span{font-size:20px;font-weight:800}
.kacb-launch:hover{transform:translateY(-2px);box-shadow:0 16px 40px rgba(0,0,0,.34)}
.kacb-launch:focus-visible{outline:3px solid rgba(77,111,255,.32);outline-offset:3px}
.kacb-widget.kacb-is-open .kacb-launch{opacity:0;visibility:hidden;pointer-events:none;transform:translateY(8px) scale(.92)}

.kacb-panel{
  position:absolute;
  bottom:76px;
  width:330px;
  height:min(560px,calc(100vh - 90px));
  background:var(--kacb-bg);
  color:var(--kacb-text);
  border-radius:19px;
  overflow:hidden;
  box-shadow:0 24px 70px rgba(0,0,0,.28);
  border:1px solid rgba(120,130,150,.18);
  display:flex;
  flex-direction:column;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(12px) scale(.985);
  transform-origin:bottom right;
  transition:opacity .18s ease,transform .18s ease,visibility .18s ease,bottom .18s ease;
}
.kacb-right .kacb-panel{right:0}
.kacb-left .kacb-panel{left:0;transform-origin:bottom left}
.kacb-panel.open{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0) scale(1)}
.kacb-widget.kacb-is-open .kacb-panel{bottom:0}

.kacb-panel header{
  position:relative;
  min-height:56px;
  flex:0 0 auto;
  background:var(--kacb-theme);
  color:#fff;
  padding:9px 48px 8px 80px;
  display:flex;
  align-items:center;
}
.kacb-head-avatar{
  position:absolute;
  left:8px;
  bottom:0;
  width:68px;
  height:68px;
  background:transparent;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  overflow:visible;
  font-weight:800;
}
.kacb-head-avatar img{width:100%;height:100%;display:block;object-fit:contain;object-position:center bottom}
.kacb-head-avatar span{width:50px;height:50px;border-radius:50%;background:rgba(255,255,255,.2);display:grid;place-items:center}
.kacb-head-copy{min-width:0}
.kacb-head-copy strong{display:block;font-size:13px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kacb-head-copy small{display:block;font-size:10px;line-height:1.2;opacity:.96;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kacb-ai-badge{display:inline-block;background:#fff;color:#111;border-radius:3px;padding:1px 3px;font-size:8px;line-height:1.2;vertical-align:2px}
.kacb-close{
  position:absolute;
  right:9px;
  top:9px;
  width:31px;
  height:31px;
  margin:0;
  border:0;
  border-radius:9px;
  background:#fff;
  color:#111;
  cursor:pointer;
  display:grid;
  place-items:center;
  font-size:24px;
  font-weight:400;
  line-height:1;
  padding:0;
}
.kacb-close:hover{background:#f3f3f3}

.kacb-messages{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:17px 12px 14px;
  display:flex;
  flex-direction:column;
  gap:11px;
  background:var(--kacb-bg);
  scroll-behavior:smooth;
  scrollbar-width:thin;
  scrollbar-color:#9b9b9b transparent;
}
.kacb-messages::-webkit-scrollbar{width:7px}
.kacb-messages::-webkit-scrollbar-track{background:transparent}
.kacb-messages::-webkit-scrollbar-thumb{background:#9b9b9b;border-radius:999px}
.kacb-msg{max-width:88%;font-size:13px;line-height:1.48;white-space:pre-wrap;overflow-wrap:anywhere}
.kacb-msg.assistant{align-self:flex-start;max-width:100%;background:transparent;color:var(--kacb-text);padding:3px 0;border-radius:0}
.kacb-msg.user{align-self:flex-end;background:#f4ebfb;color:#2f2733;padding:9px 12px;border-radius:12px}
.kacb-msg.loading{opacity:.6}
.kacb-msg-text+.kacb-msg-files{margin-top:8px}
.kacb-msg-files{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;max-width:230px}
.kacb-msg-file{min-width:0;border-radius:10px;overflow:hidden;background:rgba(120,130,150,.12);display:flex;align-items:center;gap:6px}
.kacb-msg-file img{display:block;width:100%;height:82px;object-fit:cover}
.kacb-msg-file span{padding:8px 0 8px 8px}
.kacb-msg-file small{padding:8px 8px 8px 0;max-width:125px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.kacb-privacy{font-size:9px;opacity:.66;padding:0 12px 5px;line-height:1.4;text-align:center}
.kacb-form{flex:0 0 auto;border-top:1px solid #e5e5e5;padding:9px 12px 9px;background:var(--kacb-bg);position:relative}
.kacb-attachment-tray{display:none;gap:7px;overflow-x:auto;padding:0 0 8px}
.kacb-attachment-tray.has-files{display:flex}
.kacb-attachment-chip{position:relative;flex:0 0 165px;min-width:0;border:1px solid rgba(120,130,150,.26);background:#f5f6f8;border-radius:11px;padding:6px 28px 6px 6px;display:flex;align-items:center;gap:8px;color:#242832}
.kacb-attachment-preview{width:38px;height:38px;border-radius:8px;background:#e7e9ee;display:grid;place-items:center;overflow:hidden;color:#26313f;font-size:14px;flex:0 0 auto}
.kacb-attachment-preview img{width:100%;height:100%;object-fit:cover}
.kacb-attachment-chip>span{min-width:0}
.kacb-attachment-chip strong,.kacb-attachment-chip small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kacb-attachment-chip strong{font-size:10px}
.kacb-attachment-chip small{font-size:9px;opacity:.58;margin-top:2px}
.kacb-attachment-remove{position:absolute;top:5px;right:5px;width:20px;height:20px;border:0;border-radius:50%;background:rgba(20,25,32,.1);color:inherit;cursor:pointer;display:grid;place-items:center;font-size:14px}

.kacb-composer{
  position:relative;
  display:flex;
  align-items:center;
  gap:5px;
  min-height:46px;
  background:#e9e9e9;
  border:0;
  border-radius:14px;
  padding:5px 6px;
  box-shadow:none;
}
.kacb-form textarea{
  flex:1;
  resize:none;
  max-height:92px;
  min-height:34px;
  border:0!important;
  background:transparent!important;
  color:#2a2a2a!important;
  border-radius:0!important;
  padding:8px 4px!important;
  outline:none!important;
  box-shadow:none!important;
  font:inherit!important;
  font-size:13px!important;
  line-height:1.4;
}
.kacb-form textarea::placeholder{color:#868686}
.kacb-upload-wrap{position:relative;flex:0 0 auto}
.kacb-upload-trigger,.kacb-send{width:34px;height:34px;border:0;border-radius:50%;cursor:pointer;display:grid;place-items:center;flex:0 0 auto;padding:0}
.kacb-upload-trigger{background:transparent;color:#202020}
.kacb-upload-trigger svg{width:19px;height:19px;display:block}
.kacb-upload-trigger:hover{background:rgba(0,0,0,.06)}
.kacb-upload-trigger:disabled,.kacb-send:disabled{opacity:.45;cursor:not-allowed}
.kacb-send{background:var(--kacb-button);color:#fff;font-size:19px;font-weight:700}
.kacb-send:hover{filter:brightness(.96)}

.kacb-attach-menu[hidden]{display:none!important}
.kacb-attach-menu{position:absolute;left:-3px;bottom:42px;z-index:10;width:225px;padding:6px;background:#fff;color:#15191f;border:1px solid #e4e7ec;border-radius:13px;box-shadow:0 14px 42px rgba(0,0,0,.2)}
.kacb-attach-choice{width:100%;border:0;background:transparent;color:inherit;border-radius:9px;padding:9px 10px;display:flex;align-items:center;gap:10px;text-align:left;cursor:pointer}
.kacb-attach-choice:hover{background:#f2f4f7}
.kacb-paperclip{width:30px;height:30px;border-radius:8px;background:#f6f7f9;display:grid;place-items:center;font-size:16px;flex:0 0 auto}
.kacb-paperclip svg{width:18px;height:18px;stroke:currentColor}
.kacb-attach-choice strong{display:block;font-size:12px}
.kacb-attach-choice small{display:block;font-size:10px;color:#8b919c;margin-top:2px}

.kacb-panel footer{
  flex:0 0 auto;
  text-align:center;
  font-size:9px;
  line-height:1.2;
  background:#f3f3ff;
  color:#7079b5;
  padding:7px 0 8px;
  border-top:1px solid #e6e8f5;
}
.kacb-panel footer strong{color:#37428b}
.kacb-panel button,.kacb-panel textarea{font-family:inherit}

@media(max-width:520px){
  .kacb-widget{right:12px!important;left:auto!important;bottom:12px}
  .kacb-launch{width:56px;height:56px}
  .kacb-panel{position:fixed;right:12px!important;left:12px!important;bottom:78px;width:auto;height:min(560px,calc(100vh - 24px));border-radius:18px;transform-origin:bottom center}
  .kacb-widget.kacb-is-open .kacb-panel{bottom:12px}
  .kacb-panel header{padding-left:76px}
  .kacb-head-avatar{width:64px;height:64px}
  .kacb-attach-menu{position:fixed;left:16px;right:16px;bottom:82px;width:auto}
  .kacb-msg-files{max-width:205px}
}
