.csa-root { position: fixed; bottom: 20px; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.45; }
.csa-root.csa-right { right: 20px; }
.csa-root.csa-left { left: 20px; }
.csa-root *, .csa-root *::before, .csa-root *::after { box-sizing: border-box; }

.csa-bubble { width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; background: var(--csa-accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0,0,0,.2); transition: transform .15s; padding: 0; }
.csa-bubble:hover { transform: scale(1.06); }

.csa-panel { position: absolute; bottom: 76px; width: 370px; max-width: calc(100vw - 40px); height: 520px; max-height: calc(100vh - 120px); background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.22); display: none; flex-direction: column; overflow: hidden; }
.csa-right .csa-panel { right: 0; }
.csa-left .csa-panel { left: 0; }
.csa-open .csa-panel { display: flex; }

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

.csa-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fafafa; }
.csa-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; color: #1f1f1f; }
.csa-assistant { background: #fff; border: 1px solid #e6e6e6; align-self: flex-start; border-bottom-left-radius: 4px; }
.csa-user { background: var(--csa-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.csa-error { background: #fdecea; color: #a12622; align-self: flex-start; font-size: 14px; }

.csa-typing { display: flex; gap: 4px; padding: 14px; }
.csa-typing span { width: 7px; height: 7px; border-radius: 50%; background: #aaa; animation: csa-dot 1.2s infinite ease-in-out; }
.csa-typing span:nth-child(2) { animation-delay: .15s; }
.csa-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes csa-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.csa-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; background: #fff; }
.csa-input { flex: 1; resize: none; border: 1px solid #ddd; border-radius: 10px; padding: 9px 11px; font: inherit; color: #1f1f1f; background: #fff; max-height: 100px; }
.csa-input:focus { outline: none; border-color: var(--csa-accent); }
.csa-send { background: var(--csa-accent); color: #fff; border: 0; border-radius: 10px; padding: 0 16px; font: inherit; font-weight: 600; cursor: pointer; }
.csa-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
  .csa-panel { width: calc(100vw - 24px); height: calc(100vh - 110px); }
  .csa-root.csa-right { right: 12px; } .csa-root.csa-left { left: 12px; }
}
