.chip-widget{
  max-width: 640px;
  margin: 0 auto;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #fff;
  overflow: hidden;
}
.chip-header{
  display:flex; align-items:center; gap:12px;
  padding:16px 16px 8px 16px;
  position:relative;
}
.chip-avatar{ width:48px; height:48px; border-radius:50%; object-fit:cover; }
.chip-titles{ flex:1; }
.chip-name{ font-weight:700; font-size:18px; }
.chip-disclaimer{ font-size:12px; color:#555; opacity:.9; margin-top:4px; line-height:1.4; }
.chip-menu-wrap{ position:absolute; right:8px; top:8px; }
.chip-menu-btn{ background:transparent; border:0; font-size:20px; cursor:pointer; }
.chip-menu{
  position:absolute; right:0; top:28px; background:#fff; border:1px solid #eee;
  border-radius:12px; overflow:hidden; min-width:200px; box-shadow:0 8px 24px rgba(0,0,0,.12);
}
.chip-menu-item{ display:block; padding:10px 14px; text-decoration:none; color:#222; font-size:14px; }
.chip-menu-item:hover{ background:#f6f6f6; }
.chip-body{ padding:16px; height:360px; overflow:auto; background:#fafafa; }
.chip-msg{ margin-bottom:12px; max-width: 90%; }
.chip-msg.bot .chip-text{ background:#fff; border:1px solid #eee; }
.chip-msg.user{ margin-left:auto; }
.chip-msg.user .chip-text{ background:#2b6cb0; color:#fff; }
.chip-text{ padding:10px 12px; border-radius:14px; line-height:1.5; font-size:15px; }
.chip-options{ margin-top:8px; display:flex; flex-wrap:wrap; gap:8px; }
.chip-opt{ border:1px solid #ddd; background:#fff; padding:6px 10px; border-radius:999px; cursor:pointer; }
.chip-opt:hover{ background:#f0f0f0; }
.chip-footer{ display:flex; gap:8px; padding:12px; border-top:1px solid #eee; background:#fff; }
.chip-input{ flex:1; padding:10px 12px; border-radius:999px; border:1px solid #ddd; }
.chip-send{ border:0; padding:0 14px; border-radius:999px; background:#2b6cb0; color:#fff; cursor:pointer; }

/* Floating widget (CSS backup; inline style in PHP already sets right/left) */
.chip-floating{
  position: fixed !important;
  right: 20px !important;
  left: auto !important;
  bottom: 92px !important;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 540px;
  z-index: 999999;
}
.chip-floating .chip-body{ height: calc(520px - 56px - 56px); }

/* Launcher button */
.chip-launcher{
  position: fixed !important;
  right: 20px !important;
  left: auto !important;
  bottom: 20px !important;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #2b6cb0;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 1000000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.chip-launcher:hover{ filter: brightness(1.05); }
.chip-launcher-hidden{ display:none; }

@media (max-width: 480px){
  .chip-floating{ right: 10px !important; bottom: 82px !important; width: calc(100vw - 20px); height: 70vh; }
  .chip-floating .chip-body{ height: calc(70vh - 56px - 56px); }
}
