#aa-widget-root,
#aa-widget-root * {
  box-sizing: border-box;
}

#aa-widget-root {
  font-family: Arial, sans-serif;
}

.aa-widget-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.35);
  z-index: 999999;
}

.aa-widget-panel {
  position: fixed;
  right: 20px;
  bottom: 95px;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 620px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.22);
  z-index: 999999;
}

.aa-widget-panel.is-open {
  display: flex;
}

.aa-widget-header {
  padding: 14px 16px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aa-widget-header-left {
  min-width: 0;
}

.aa-widget-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.aa-widget-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: #cbd5e1;
}

.aa-widget-close {
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
}

.aa-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
}

.aa-widget-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.aa-widget-message.visitor {
  align-items: flex-end;
}

.aa-widget-message.assistant {
  align-items: flex-start;
}

.aa-widget-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.aa-widget-message.visitor .aa-widget-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.aa-widget-message.assistant .aa-widget-bubble {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #dbe3ef;
  border-bottom-left-radius: 4px;
}

.aa-widget-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 88%;
}

.aa-widget-action {
  display: inline-block;
  text-decoration: none;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
}

.aa-widget-quick-topics {
  padding: 12px 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.aa-widget-topic {
  border: 1px solid #cbd5e1;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.aa-widget-lead-box {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.aa-widget-lead-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}

.aa-widget-input,
.aa-widget-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 8px;
  outline: none;
}

.aa-widget-textarea {
  min-height: 72px;
  resize: vertical;
}

.aa-widget-row {
  display: flex;
  gap: 8px;
}

.aa-widget-row .aa-widget-input {
  margin-bottom: 0;
}

.aa-widget-save-lead {
  width: 100%;
  border: 0;
  background: #16a34a;
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
}

.aa-widget-footer {
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.aa-widget-form {
  display: flex;
  gap: 8px;
}

.aa-widget-form .aa-widget-input {
  margin-bottom: 0;
}

.aa-widget-send {
  border: 0;
  background: #2563eb;
  color: #ffffff;
  min-width: 88px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.aa-widget-note {
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
}

.aa-widget-muted {
  color: #64748b;
  font-size: 12px;
}

.aa-widget-hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .aa-widget-toggle {
    right: 14px;
    bottom: 14px;
    width: 58px;
    height: 58px;
  }

  .aa-widget-panel {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    height: 72vh;
    max-height: 72vh;
  }

  .aa-widget-form {
    flex-direction: column;
  }

  .aa-widget-send {
    min-width: 100%;
    padding: 12px;
  }

  .aa-widget-row {
    flex-direction: column;
  }
}