#xmodelsCoachChatRoot {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2147482000;
  font-family: Poppins, system-ui, sans-serif;
}

.xm-chat-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 132px;
  border: none;
  border-radius: 999px;
  padding: 8px 16px 8px 8px;
  background: linear-gradient(135deg, #ff1a5c, #9c27b0);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 26, 92, 0.35);
  position: relative;
  z-index: 2;
}

.xm-chat-toggle-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  background: #fff;
}

.xm-chat-toggle-label {
  line-height: 1;
  white-space: nowrap;
}

.xm-chat-toggle:hover {
  filter: brightness(1.05);
}

.xm-chat-badge {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #ff1a5c;
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.xm-chat-badge.visible {
  display: inline-block;
}

.xm-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: none;
  width: min(380px, calc(100vw - 24px));
  height: min(520px, calc(100vh - 100px));
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  flex-direction: column;
  z-index: 1;
}

.xm-chat-panel.open {
  display: flex;
}

.xm-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 26, 92, 0.08), rgba(156, 39, 176, 0.08));
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.xm-chat-head strong {
  font-size: 14px;
  color: #0f172a;
}

.xm-chat-head span {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.xm-chat-close {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.xm-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #f8fafc;
}

.xm-chat-welcome {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
  line-height: 1.45;
}

.xm-chat-msg {
  max-width: 88%;
  margin: 0 0 8px;
  padding: 8px 11px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.xm-chat-msg.user {
  margin-left: auto;
  background: linear-gradient(135deg, #ff1a5c, #9c27b0);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.xm-chat-msg.coach {
  margin-right: auto;
  background: #fff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.xm-chat-msg-media {
  margin-bottom: 6px;
}

.xm-chat-msg-media img,
.xm-chat-msg-media video {
  display: block;
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.06);
}

.xm-chat-msg time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.75;
}

.xm-chat-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.xm-chat-compose textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  max-height: 80px;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

.xm-chat-compose-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.xm-chat-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 18px;
  cursor: pointer;
}

.xm-chat-attach:hover {
  background: #f1f5f9;
}

.xm-chat-attach input {
  display: none;
}

.xm-chat-file-hint {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xm-chat-send {
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: #ff1a5c;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.xm-chat-send:disabled,
.xm-chat-attach.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.xm-chat-status {
  padding: 0 12px 8px;
  font-size: 11px;
  color: #64748b;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  #xmodelsCoachChatRoot {
    right: 10px;
    bottom: 10px;
  }

  .xm-chat-send {
    padding: 10px 12px;
    font-size: 12px;
  }
}
