.wfm-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5000;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  color: #102033;
}

.wfm-chat-toggle {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg,#4f46e5,#1663d8);
  box-shadow: 0 18px 34px rgba(22,99,216,.28);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease;
}

.wfm-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 42px rgba(22,99,216,.34);
}

.wfm-chat-toggle i { font-size: 23px; }

.wfm-chat-pulse {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #16a34a;
}

.wfm-chat-drawer {
  position: fixed;
  right: 22px;
  bottom: 88px;
  width: min(390px, calc(100vw - 28px));
  max-height: min(680px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto auto minmax(210px, 1fr) auto;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 28px 70px rgba(12,43,58,.24);
  overflow: hidden;
  transform: translateY(14px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.wfm-chat-widget.open .wfm-chat-drawer {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

.wfm-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid #dce5ee;
  background: linear-gradient(180deg,#f8fbff,#eef4ff);
}

.wfm-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wfm-chat-title-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg,#4f46e5,#1663d8);
  flex: 0 0 auto;
}

.wfm-chat-title strong,
.wfm-chat-title span {
  display: block;
}

.wfm-chat-title strong {
  color: #0d2b3a;
  font-size: 14px;
  line-height: 1.2;
}

.wfm-chat-title span {
  margin-top: 2px;
  color: #627086;
  font-size: 11px;
  font-weight: 700;
}

.wfm-chat-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #526276;
  background: #fff;
  cursor: pointer;
}

.wfm-chat-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 10px 12px;
  border-bottom: 1px solid #dce5ee;
  background: #f8fbfd;
}

.wfm-chat-chip {
  min-height: 31px;
  border: 1px solid #dce5ee;
  border-radius: 999px;
  background: #fff;
  color: #40546b;
  padding: 6px 9px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.wfm-chat-chip:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.wfm-chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 13px;
  overflow-y: auto;
  background: #fff;
}

.wfm-chat-msg {
  display: flex;
}

.wfm-chat-msg.user {
  justify-content: flex-end;
}

.wfm-chat-bubble {
  max-width: 86%;
  border: 1px solid #dce5ee;
  border-radius: 10px;
  background: #fff;
  padding: 10px 11px;
  box-shadow: 0 8px 18px rgba(12,43,58,.04);
  font-size: 12px;
  line-height: 1.5;
}

.wfm-chat-msg.user .wfm-chat-bubble {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg,#4f46e5,#1663d8);
}

.wfm-chat-bubble strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: inherit;
}

.wfm-chat-bubble p {
  margin: 0;
  color: inherit;
}

.wfm-chat-msg.bot .wfm-chat-bubble p {
  color: #415163;
}

.wfm-chat-citations {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.wfm-chat-citation {
  border: 1px solid #b9b5f4;
  border-radius: 999px;
  background: #f5f4ff;
  color: #4f46e5;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
}

.wfm-chat-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  padding: 11px 12px 12px;
  border-top: 1px solid #dce5ee;
  background: #f8fbfd;
}

.wfm-chat-input {
  min-height: 42px;
  max-height: 96px;
  width: 100%;
  border: 1px solid #d4e1ec;
  border-radius: 9px;
  background: #fff;
  color: #102033;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  padding: 9px 10px;
  resize: vertical;
  outline: none;
}

.wfm-chat-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.wfm-chat-send {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg,#4f46e5,#1663d8);
  cursor: pointer;
}

.wfm-chat-footnote {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #16a34a;
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 620px) {
  .wfm-chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .wfm-chat-drawer {
    right: 14px;
    bottom: 78px;
    width: calc(100vw - 28px);
    max-height: calc(100vh - 98px);
  }

  .wfm-chat-toggle {
    width: 54px;
    height: 54px;
  }
}
