.ce-chat [hidden] { display: none !important; }

.ce-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: var(--cc-font, system-ui, sans-serif);
  font-size: var(--cc-font-size, 14px);
}

.ce-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--cc-window, #F97316);
  color: var(--cc-icon, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .45);
  transition: transform .15s ease, box-shadow .2s ease;
}
.ce-chat-button:hover { transform: translateY(-2px) scale(1.04); }
.ce-chat-button__icon svg { width: 28px; height: 28px; display: block; }
.ce-chat-button__img { width: 32px; height: 32px; object-fit: contain; border-radius: 50%; }

.ce-chat-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 460px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
  animation: ce-chat-in .18s ease;
}
@keyframes ce-chat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.ce-chat-head {
  background: var(--cc-window, #F97316);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ce-chat-head__title { font-weight: 700; font-size: 15px; }
.ce-chat-head__close {
  background: none; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; opacity: .85;
}
.ce-chat-head__close:hover { opacity: 1; }

.ce-chat-gate { padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.ce-chat-gate__intro { margin: 0 0 4px; color: #374151; font-size: 14px; }
.ce-chat-input {
  width: 100%; border: 1px solid #E5E7EB; border-radius: 10px; padding: 11px 12px;
  font: inherit; color: #111827;
}
.ce-chat-input:focus { outline: none; border-color: var(--cc-window, #F97316); }
.ce-chat-gate__err { color: #EF4444; font-size: 13px; }
.ce-chat-cta {
  background: var(--cc-window, #F97316); color: #fff; border: none; border-radius: 10px;
  padding: 12px; font: inherit; font-weight: 700; cursor: pointer;
}
.ce-chat-cta:disabled { opacity: .6; cursor: default; }
.ce-chat-login { text-align: center; color: var(--cc-window, #F97316); font-weight: 600; text-decoration: none; font-size: 13px; }

.ce-chat-thread {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: #F9FAFB;
}
.ce-chat-msg { display: flex; flex-direction: column; max-width: 80%; }
.ce-chat-msg--user { align-self: flex-end; align-items: flex-end; }
.ce-chat-msg--reply { align-self: flex-start; align-items: flex-start; }
.ce-chat-bubble {
  padding: 9px 13px; border-radius: 14px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap;
}
.ce-chat-msg--user .ce-chat-bubble { background: var(--cc-user, #F97316); color: #fff; border-bottom-right-radius: 4px; }
.ce-chat-msg--reply .ce-chat-bubble { background: var(--cc-reply, #E5E7EB); color: #111827; border-bottom-left-radius: 4px; }
.ce-chat-time { font-size: 10px; color: #9CA3AF; margin-top: 3px; }

.ce-chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #F3F4F6; background: #fff; }
.ce-chat-compose__input {
  flex: 1; border: 1px solid #E5E7EB; border-radius: 999px; padding: 10px 14px; font: inherit;
}
.ce-chat-compose__input:focus { outline: none; border-color: var(--cc-window, #F97316); }
.ce-chat-compose__send {
  background: var(--cc-window, #F97316); color: #fff; border: none; border-radius: 999px;
  padding: 0 16px; font: inherit; font-weight: 700; cursor: pointer;
}

.ce-chat-ended { padding: 18px 16px; text-align: center; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid #F3F4F6; }
.ce-chat-ended__text { margin: 0; color: #6B7280; font-size: 14px; }

.ce-chat-msg__row { display: flex; align-items: center; gap: 6px; }
.ce-chat-msg--sending .ce-chat-bubble { opacity: .6; }
.ce-chat-msg--failed .ce-chat-bubble { opacity: .7; box-shadow: 0 0 0 1px #EF4444 inset; }
.ce-chat-spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18); border-top-color: var(--cc-window, #F97316);
  animation: ce-chat-spin .7s linear infinite; flex: none;
}
@keyframes ce-chat-spin { to { transform: rotate(360deg); } }
.ce-chat-retry {
  border: none; background: none; cursor: pointer; color: #EF4444; padding: 0; line-height: 0; flex: none;
}
.ce-chat-retry svg { width: 16px; height: 16px; }
.ce-chat-retry:hover { color: #B91C1C; }
