#ezbiz-chat-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147482000;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

#ezbiz-chat-root * {
  box-sizing: border-box;
}

#ezbiz-chat-root .ezbiz-chat-fab {
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 999px;
  background: radial-gradient(circle at top, #1d4ed8 0%, #0f172a 90%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#ezbiz-chat-root .ezbiz-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(15, 23, 42, 0.42);
}

#ezbiz-chat-root .ezbiz-chat-fab-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

#ezbiz-chat-root .ezbiz-chat-fab-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

#ezbiz-chat-root .ezbiz-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 120px));
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(148, 163, 184, 0.22);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#ezbiz-chat-root .ezbiz-chat-panel.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#ezbiz-chat-root .ezbiz-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, #0f172a 0%, #111827 45%, #1d4ed8 100%);
  color: #fff;
}

#ezbiz-chat-root .ezbiz-chat-header-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

#ezbiz-chat-root .ezbiz-chat-header-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ezbiz-chat-root .ezbiz-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 600;
}

#ezbiz-chat-root .ezbiz-chat-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

#ezbiz-chat-root .ezbiz-chat-status {
  padding: 8px 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.01em;
}

#ezbiz-chat-root .ezbiz-chat-status[data-state="success"] {
  color: #166534;
}

#ezbiz-chat-root .ezbiz-chat-status[data-state="error"] {
  color: #991b1b;
}

#ezbiz-chat-root .ezbiz-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

#ezbiz-chat-root .ezbiz-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#ezbiz-chat-root .ezbiz-chat-thread + .ezbiz-chat-thread {
  margin-top: 2px;
}

#ezbiz-chat-root .ezbiz-chat-message {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 8px;
}

#ezbiz-chat-root .ezbiz-chat-message--left {
  justify-content: flex-start;
  align-items: flex-start;
}

#ezbiz-chat-root .ezbiz-chat-message--right {
  justify-content: flex-end;
  align-items: flex-end;
}

#ezbiz-chat-root .ezbiz-chat-message-meta {
  width: 100%;
  max-width: none;
  display: flex;
  padding: 0 2px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  line-height: 1.2;
}

#ezbiz-chat-root .ezbiz-chat-message--right .ezbiz-chat-message-meta {
  width: fit-content;
  max-width: 84%;
  margin-left: auto;
  align-self: flex-end;
  display: block;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#ezbiz-chat-root .ezbiz-chat-message--left .ezbiz-chat-message-meta {
  align-self: flex-start;
  justify-content: flex-start;
  text-align: left;
}

#ezbiz-chat-root .ezbiz-chat-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 16px;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

#ezbiz-chat-root .ezbiz-chat-message--left .ezbiz-chat-bubble {
  background: #ffffff;
  border-color: rgba(226, 232, 240, 0.9);
  color: #0f172a;
  border-top-left-radius: 6px;
}

#ezbiz-chat-root .ezbiz-chat-message--right .ezbiz-chat-bubble {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #fff;
  border-top-right-radius: 6px;
}

#ezbiz-chat-root .ezbiz-chat-bubble-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

#ezbiz-chat-root .ezbiz-chat-link {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#ezbiz-chat-root .ezbiz-chat-message--right .ezbiz-chat-link {
  color: #dbeafe;
}

#ezbiz-chat-root .ezbiz-chat-message--right .ezbiz-chat-bubble {
  align-self: flex-end;
}

#ezbiz-chat-root .ezbiz-chat-message--left .ezbiz-chat-bubble {
  align-self: flex-start;
}

#ezbiz-chat-root .ezbiz-chat-bubble--pending {
  min-height: 46px;
}

#ezbiz-chat-root .ezbiz-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  margin: 2px 0 0;
}

#ezbiz-chat-root .ezbiz-chat-typing i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
  animation: ezbiz-chat-pulse 1.1s infinite ease-in-out;
}

#ezbiz-chat-root .ezbiz-chat-typing i:nth-child(2) {
  animation-delay: 0.14s;
}

#ezbiz-chat-root .ezbiz-chat-typing i:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes ezbiz-chat-pulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

#ezbiz-chat-root .ezbiz-chat-composer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
}

#ezbiz-chat-root .ezbiz-chat-input {
  width: 100%;
  min-height: 46px;
  max-height: 120px;
  resize: none;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #0f172a;
  outline: none;
  background: #fff;
}

#ezbiz-chat-root .ezbiz-chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

#ezbiz-chat-root .ezbiz-chat-send {
  min-width: 84px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.24);
}

#ezbiz-chat-root .ezbiz-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 24px rgba(37, 99, 235, 0.28);
}

#ezbiz-chat-root .ezbiz-chat-send:disabled,
#ezbiz-chat-root .ezbiz-chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  #ezbiz-chat-root {
    right: 12px;
    bottom: 12px;
  }

  #ezbiz-chat-root .ezbiz-chat-panel {
    width: calc(100vw - 24px);
    height: min(640px, calc(100vh - 100px));
    min-height: 360px;
  }

  #ezbiz-chat-root .ezbiz-chat-input {
    font-size: 16px;
  }
}
