.cpbc-ai-chat{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:900;
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
  font-family:Manrope,Inter,Arial,sans-serif;
}

.cpbc-ai-chat-window{
  width:372px;
  max-width:calc(100vw - 32px);
  height:min(590px,calc(100vh - 110px));
  display:none;
  flex-direction:column;
  overflow:hidden;
  background:#07110f;
  border:1px solid rgba(0,184,148,.24);
  border-radius:10px;
  box-shadow:0 24px 80px rgba(5,8,7,.34);
}

.cpbc-ai-chat-window.open{display:flex}

.cpbc-ai-chat-window.expanded{
  position:fixed;
  top:16px;
  right:16px;
  bottom:16px;
  width:min(780px,calc(100vw - 32px));
  height:auto;
}

.cpbc-ai-chat-head{
  display:flex;
  align-items:center;
  gap:10px;
  padding:13px 14px;
  background:linear-gradient(135deg,#07110f,#12231f);
  border-bottom:1px solid rgba(255,255,255,.1);
}

.cpbc-ai-chat-mark{
  width:34px;
  height:34px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  background:linear-gradient(135deg,#00b894,#caa85a);
  color:#07110f;
  font-size:12px;
  font-weight:900;
  letter-spacing:.04em;
}

.cpbc-ai-chat-title{min-width:0;flex:1}
.cpbc-ai-chat-title strong{display:block;color:#fff;font-size:13px;line-height:1.1}
.cpbc-ai-chat-title span{display:block;color:#bceee4;font-size:10px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.cpbc-ai-chat-icon{
  width:30px;
  height:30px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:8px;
  background:rgba(255,255,255,.06);
  color:#eafff9;
  cursor:pointer;
  font-size:12px;
  line-height:1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.cpbc-ai-chat-reset{
  width:auto;
  padding:0 8px;
  font-size:10px;
  font-weight:850;
}

.cpbc-ai-chat-expand-btn span{
  width:12px;
  height:12px;
  border:1.5px solid currentColor;
  border-radius:2px;
  display:block;
}

.cpbc-ai-chat-window.expanded .cpbc-ai-chat-expand-btn span{
  width:14px;
  height:2px;
  border:0;
  border-top:2px solid currentColor;
  border-radius:0;
}

.cpbc-ai-chat-icon:hover{
  border-color:#00b894;
  color:#74f2d3;
}

.cpbc-ai-chat-body{
  flex:1;
  min-height:0;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:9px;
  padding:14px;
  background:radial-gradient(circle at 100% 0%,rgba(0,184,148,.08),transparent 36%),#07110f;
}

.cpbc-ai-chat-msg{
  max-width:88%;
  border-radius:9px;
  padding:10px 12px;
  font-size:12px;
  line-height:1.55;
  word-break:break-word;
}

.cpbc-ai-chat-msg.bot{
  align-self:flex-start;
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.11);
  color:#ecfff9;
  border-bottom-left-radius:2px;
}

.cpbc-ai-chat-msg.user{
  align-self:flex-end;
  background:#00b894;
  color:#07110f;
  font-weight:800;
  border-bottom-right-radius:2px;
}

.cpbc-ai-chat-msg.thinking{
  color:#bceee4;
  opacity:.84;
}

.cpbc-ai-chat-msg p{margin:0 0 8px}
.cpbc-ai-chat-msg p:last-child,
.cpbc-ai-chat-msg ul:last-child{margin-bottom:0}
.cpbc-ai-chat-msg ul{margin:0 0 8px;padding-left:18px}
.cpbc-ai-chat-msg li{margin:3px 0}
.cpbc-ai-chat-msg a{color:#74f2d3;font-weight:850;text-decoration:underline;text-underline-offset:3px}
.cpbc-ai-chat-msg.user a{color:#07110f}

.cpbc-ai-chat-input{
  display:flex;
  gap:8px;
  padding:10px 12px;
  border-top:1px solid rgba(255,255,255,.1);
  background:#0c1714;
}

.cpbc-ai-chat-input input{
  flex:1;
  min-width:0;
  background:#fff;
  border:1px solid rgba(0,184,148,.28);
  color:#07110f;
  border-radius:8px;
  padding:10px;
  font-size:12px;
  outline:none;
}

.cpbc-ai-chat-input input::placeholder{
  color:#68756f;
  opacity:1;
}

.cpbc-ai-chat-input input:focus{
  border-color:#00b894;
  background:#fff;
  color:#07110f;
  box-shadow:0 0 0 3px rgba(0,184,148,.16);
}

.cpbc-ai-chat-send,
.cpbc-ai-chat-toggle{
  background:#00b894;
  border:0;
  color:#07110f;
  font-weight:900;
  cursor:pointer;
}

.cpbc-ai-chat-send{
  width:38px;
  border-radius:8px;
}

.cpbc-ai-chat-toggle{
  width:52px;
  height:52px;
  border-radius:10px;
  box-shadow:0 12px 28px rgba(5,8,7,.3);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform .24s ease,box-shadow .24s ease;
}

.cpbc-ai-chat-toggle:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 34px rgba(5,8,7,.34);
}

.cpbc-ai-toggle-logo{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
}

.cpbc-ai-toggle-main{
  font-size:10px;
  font-weight:900;
  color:#07110f;
  letter-spacing:.04em;
}

.cpbc-ai-toggle-line{
  width:18px;
  height:1px;
  background:#07110f;
  opacity:.42;
}

.cpbc-ai-toggle-sub{
  font-size:6px;
  font-weight:800;
  color:#07110f;
  letter-spacing:.12em;
  opacity:.7;
  text-transform:uppercase;
}

.cpbc-ai-chat-ping{
  position:absolute;
  top:-3px;
  right:-3px;
  width:10px;
  height:10px;
  border-radius:50%;
  background:#caa85a;
  border:2px solid #07110f;
}

.cpbc-ai-chat-nudge{
  position:absolute;
  right:0;
  bottom:78px;
  width:max-content;
  max-width:min(270px,calc(100vw - 36px));
  padding:10px 12px;
  border:1px solid rgba(0,184,148,.24);
  border-radius:10px;
  background:#07110f;
  color:#ecfff9;
  box-shadow:0 16px 42px rgba(5,8,7,.28);
  font-size:12px;
  font-weight:800;
  line-height:1.35;
  opacity:0;
  pointer-events:none;
  transform:translateY(8px) scale(.98);
  transition:opacity .24s ease,transform .24s ease;
}

.cpbc-ai-chat-nudge:after{
  content:"";
  position:absolute;
  right:18px;
  bottom:-6px;
  width:10px;
  height:10px;
  border-right:1px solid rgba(0,184,148,.24);
  border-bottom:1px solid rgba(0,184,148,.24);
  background:#07110f;
  transform:rotate(45deg);
}

.cpbc-ai-chat.nudging:not(.is-open) .cpbc-ai-chat-nudge{
  opacity:1;
  transform:translateY(0) scale(1);
}

@media(max-width:620px){
  .cpbc-ai-chat{
    right:12px;
    bottom:calc(12px + env(safe-area-inset-bottom,0px));
    z-index:1200;
  }
  .cpbc-ai-chat-window,
  .cpbc-ai-chat-window.expanded{
    position:fixed;
    left:10px;
    right:10px;
    bottom:calc(10px + env(safe-area-inset-bottom,0px));
    width:auto;
    max-width:none;
    height:min(620px,calc(var(--cpbc-chat-vh,100dvh) - 92px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));
    max-height:calc(var(--cpbc-chat-vh,100dvh) - 92px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
    border-radius:14px;
  }
  .cpbc-ai-chat-window.expanded{
    top:calc(10px + env(safe-area-inset-top,0px));
    left:10px;
    right:10px;
    bottom:calc(10px + env(safe-area-inset-bottom,0px));
    height:auto;
  }
  body.cpbc-ai-chat-open{
    overflow:hidden;
    overscroll-behavior:none;
  }
  body.cpbc-ai-chat-open .cpbc-ai-chat{
    inset:0;
    right:auto;
    bottom:auto;
    align-items:stretch;
    pointer-events:none;
  }
  body.cpbc-ai-chat-open .cpbc-ai-chat-window{
    top:calc(10px + env(safe-area-inset-top,0px));
    bottom:calc(10px + env(safe-area-inset-bottom,0px));
    height:auto;
    max-height:none;
    pointer-events:auto;
  }
  body.cpbc-ai-chat-open .cpbc-ai-chat-toggle,
  body.cpbc-ai-chat-open .cpbc-ai-chat-nudge{
    display:none;
  }
  .cpbc-ai-chat-head{
    gap:8px;
    padding:10px;
  }
  .cpbc-ai-chat-mark{
    width:30px;
    height:30px;
    border-radius:7px;
  }
  .cpbc-ai-chat-title strong{font-size:12px}
  .cpbc-ai-chat-title span{font-size:9px}
  .cpbc-ai-chat-icon{
    width:30px;
    height:30px;
    border-radius:7px;
  }
  .cpbc-ai-chat-reset{
    width:44px;
    padding:0;
  }
  .cpbc-ai-chat-body{
    padding:12px;
    gap:8px;
  }
  .cpbc-ai-chat-msg{
    max-width:92%;
    font-size:12px;
  }
  .cpbc-ai-chat-input{
    padding:10px;
    padding-bottom:calc(10px + env(safe-area-inset-bottom,0px));
  }
  .cpbc-ai-chat-input input{
    font-size:16px;
    min-height:42px;
  }
  .cpbc-ai-chat-send{
    width:42px;
  }
}

@media(max-width:360px){
  .cpbc-ai-chat-title span{display:none}
  .cpbc-ai-chat-reset{
    width:36px;
    font-size:9px;
  }
}
