.ccb-root {
  --ccb-color: #2563eb;
  position: fixed;
  bottom: 20px;
  z-index: 99999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: #1f2937;
}
.ccb-root.ccb-right { right: 20px; }
.ccb-root.ccb-left { left: 20px; }
.ccb-root *, .ccb-root *::before, .ccb-root *::after { box-sizing: border-box; }

.ccb-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ccb-color);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.ccb-toggle:hover { transform: scale(1.06); }
.ccb-toggle:focus-visible,
.ccb-close:focus-visible,
.ccb-send:focus-visible,
.ccb-input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.ccb-panel {
  position: absolute;
  bottom: 72px;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.ccb-panel[hidden] { display: none; }
.ccb-right .ccb-panel { right: 0; }
.ccb-left .ccb-panel { left: 0; }

.ccb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--ccb-color);
  color: #fff;
}
.ccb-title { font-weight: 600; }
.ccb-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.ccb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f6f7f9;
}
.ccb-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ccb-msg.ccb-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.ccb-msg.ccb-user {
  align-self: flex-end;
  background: var(--ccb-color);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ccb-msg.ccb-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.ccb-msg.ccb-typing:empty::before {
  content: "…";
  letter-spacing: 3px;
  color: #6b7280;
}

.ccb-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.ccb-input {
  flex: 1;
  resize: none;
  max-height: 90px;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font: inherit;
  color: inherit;
}
.ccb-send {
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--ccb-color);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ccb-send:disabled,
.ccb-input:disabled { opacity: 0.6; cursor: not-allowed; }

.ccb-footer {
  padding: 8px 12px 10px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #6b7280;
  background: #fff;
}
.ccb-privacy { color: inherit; text-decoration: underline; }

@media (max-width: 480px) {
  .ccb-root { bottom: 14px; }
  .ccb-root.ccb-right { right: 14px; }
  .ccb-root.ccb-left { left: 14px; }
  .ccb-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ccb-toggle { transition: none; }
}
