.ucx-widget {
  --ucx-primary: #155EEF;
  --ucx-accent: #10B981;
  --ucx-ink: #111827;
  --ucx-muted: #667085;
  --ucx-border: rgba(17, 24, 39, 0.12);
  --ucx-surface: #ffffff;
  bottom: 22px;
  color: var(--ucx-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  right: 22px;
  z-index: 999999;
}

.ucx-widget.ucx-pos-left {
  left: 22px;
  right: auto;
}

.ucx-widget * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.ucx-bubble {
  align-items: center;
  background: linear-gradient(135deg, var(--ucx-primary), #0F766E);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 800;
  gap: 9px;
  min-height: 56px;
  padding: 0 20px;
}

.ucx-color-solid .ucx-bubble {
  background: var(--ucx-primary);
}

.ucx-bubble-icon-only {
  border-radius: 999px;
  height: 58px;
  justify-content: center;
  min-height: 58px;
  padding: 0;
  width: 58px;
}

.ucx-bubble-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.ucx-bubble-icon svg {
  fill: currentColor;
  height: 19px;
  width: 19px;
}

.ucx-bubble-icon-only .ucx-bubble-icon {
  background: rgba(255, 255, 255, 0.18);
  height: 36px;
  width: 36px;
}

.ucx-bubble-icon-only .ucx-bubble-icon svg {
  height: 22px;
  width: 22px;
}

.ucx-panel {
  background: var(--ucx-surface);
  border: 1px solid var(--ucx-border);
  border-radius: 18px;
  bottom: 74px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  display: none;
  flex-direction: column;
  height: min(660px, calc(100vh - 112px));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(392px, calc(100vw - 24px));
}

.ucx-pos-left .ucx-panel {
  left: 0;
  right: auto;
}

.ucx-panel.is-open {
  display: flex;
}

.ucx-header {
  align-items: center;
  background: linear-gradient(135deg, var(--ucx-primary), #073B4C);
  color: #ffffff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 76px;
  padding: 18px;
}

.ucx-color-solid .ucx-header {
  background: var(--ucx-primary);
}

.ucx-header strong,
.ucx-header span {
  display: block;
}

.ucx-header > div {
  flex: 1;
  min-width: 0;
}

.ucx-header-avatar {
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.ucx-header strong {
  font-size: 16px;
  line-height: 1.25;
}

.ucx-header span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  margin-top: 3px;
}

.ucx-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  font-size: 24px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.ucx-thread {
  background:
    linear-gradient(180deg, rgba(21, 94, 239, 0.06), rgba(255, 255, 255, 0)),
    #F8FAFC;
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.ucx-message {
  align-items: flex-end;
  display: flex;
  gap: 9px;
  margin: 0 0 13px;
  max-width: 88%;
}

.ucx-message-content {
  min-width: 0;
}

.ucx-message-avatar {
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  flex: 0 0 auto;
  height: 30px;
  object-fit: cover;
  width: 30px;
}

.ucx-message span {
  color: var(--ucx-muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 5px 2px;
}

.ucx-message p {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px 16px 16px 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: #1F2937;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 12px 14px;
}

.ucx-visitor {
  justify-content: flex-end;
  margin-left: auto;
}

.ucx-visitor span {
  text-align: right;
}

.ucx-visitor p {
  background: var(--ucx-primary);
  border-color: var(--ucx-primary);
  border-radius: 16px 16px 6px 16px;
  color: #ffffff;
}

.ucx-system p {
  background: #FFF7ED;
  border-color: #FDBA74;
  color: #9A3412;
}

.ucx-typing p {
  align-items: center;
  display: flex;
  gap: 5px;
  min-height: 42px;
}

.ucx-typing i {
  animation: ucxPulse 1.1s infinite ease-in-out;
  background: var(--ucx-muted);
  border-radius: 999px;
  display: block;
  height: 6px;
  opacity: 0.55;
  width: 6px;
}

.ucx-typing i:nth-child(2) {
  animation-delay: 0.12s;
}

.ucx-typing i:nth-child(3) {
  animation-delay: 0.24s;
}

.ucx-quick-row {
  background: #ffffff;
  border-top: 1px solid var(--ucx-border);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
}

.ucx-quick-row button {
  background: #EFF6FF;
  border: 1px solid rgba(21, 94, 239, 0.16);
  border-radius: 999px;
  color: #1D4ED8;
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  min-height: 34px;
  padding: 0 12px;
}

.ucx-lead {
  background: #ffffff;
  border-top: 1px solid var(--ucx-border);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.ucx-lead.is-compact {
  grid-template-columns: 1fr 1fr;
}

.ucx-lead input:not([type="checkbox"]) {
  appearance: none;
  background: #F8FAFC;
  border: 1px solid var(--ucx-border);
  border-radius: 12px;
  color: var(--ucx-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  min-height: 42px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

.ucx-lead input:not([type="checkbox"]):focus {
  background: #ffffff;
  border-color: var(--ucx-primary);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.ucx-lead label {
  align-items: center;
  color: var(--ucx-muted);
  display: flex;
  font-size: 12px;
  gap: 7px;
}

.ucx-consent {
  align-items: flex-start !important;
  background: #F8FAFC;
  border: 1px solid var(--ucx-border);
  border-radius: 12px;
  gap: 9px !important;
  line-height: 1.55;
  padding: 10px 12px;
}

.ucx-consent input[type="checkbox"] {
  accent-color: var(--ucx-primary);
  flex: 0 0 auto;
  height: 16px;
  margin: 2px 0 0;
  width: 16px;
}

.ucx-consent span {
  flex: 1;
  min-width: 0;
}

.ucx-consent a {
  color: var(--ucx-primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ucx-composer {
  align-items: flex-end;
  background: #ffffff;
  border-top: 1px solid var(--ucx-border);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 68px;
  padding: 12px;
}

.ucx-composer textarea {
  border: 1px solid var(--ucx-border);
  border-radius: 14px;
  color: var(--ucx-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 120px;
  min-height: 44px;
  outline: none;
  padding: 12px;
  resize: none;
  width: 100%;
}

.ucx-composer textarea:focus {
  border-color: var(--ucx-primary);
  box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.12);
}

.ucx-composer button {
  background: var(--ucx-accent);
  border: 0;
  border-radius: 14px;
  color: #06281F;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  min-height: 44px;
}

.ucx-color-solid .ucx-composer button {
  background: var(--ucx-accent);
}

.ucx-composer button:disabled {
  cursor: progress;
  opacity: 0.62;
}

@keyframes ucxPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
}

@media (max-width: 520px) {
  .ucx-widget,
  .ucx-widget.ucx-pos-left {
    bottom: 14px;
    left: 12px;
    right: 12px;
  }

  .ucx-bubble {
    margin-left: auto;
  }

  .ucx-panel,
  .ucx-pos-left .ucx-panel {
    bottom: 72px;
    left: 0;
    right: 0;
    width: 100%;
  }
}
