.ecotox-assistant,
.ecotox-assistant * {
  box-sizing: border-box;
}

.ecotox-assistant {
  --ecotox-brand: #01a1ac;
  --ecotox-ink: #15343a;
  --ecotox-muted: #63777b;
  --ecotox-border: #d9e4e5;
  --ecotox-surface: #ffffff;
  position: fixed;
  z-index: 999999;
  right: 22px;
  bottom: 22px;
  color: var(--ecotox-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.ecotox-assistant button,
.ecotox-assistant input,
.ecotox-assistant select,
.ecotox-assistant textarea {
  font: inherit;
}

.ecotox-assistant [hidden] {
  display: none !important;
}

.ecotox-assistant__launcher {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ecotox-brand);
  color: #fff;
  box-shadow: 0 10px 30px rgba(9, 64, 70, 0.25);
  cursor: pointer;
  font-weight: 700;
}

.ecotox-assistant__launcher:hover,
.ecotox-assistant__launcher:focus-visible {
  filter: brightness(0.93);
  transform: translateY(-1px);
}

.ecotox-assistant__launcher:focus-visible,
.ecotox-assistant button:focus-visible,
.ecotox-assistant a:focus-visible,
.ecotox-assistant input:focus-visible,
.ecotox-assistant textarea:focus-visible,
.ecotox-assistant select:focus-visible {
  outline: 3px solid rgba(1, 161, 172, 0.28);
  outline-offset: 2px;
}

.ecotox-assistant__launcher-icon {
  font-size: 20px;
  line-height: 1;
}

.ecotox-assistant__panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 100px));
  overflow: hidden;
  border: 1px solid var(--ecotox-border);
  border-radius: 18px;
  background: var(--ecotox-surface);
  box-shadow: 0 20px 60px rgba(20, 52, 58, 0.24);
}

.ecotox-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  background: var(--ecotox-brand);
  color: #fff;
}

.ecotox-assistant__header strong,
.ecotox-assistant__header span {
  display: block;
}

.ecotox-assistant__header strong {
  font-size: 16px;
}

.ecotox-assistant__header span {
  margin-top: 1px;
  font-size: 12px;
  opacity: 0.88;
}

.ecotox-assistant__close,
.ecotox-assistant__lead-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.ecotox-assistant__messages {
  min-height: 180px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background: #f6f9f9;
  overscroll-behavior: contain;
}

.ecotox-assistant__message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 12px;
}

.ecotox-assistant__message--user {
  align-items: flex-end;
}

.ecotox-assistant__bubble {
  max-width: 86%;
  padding: 10px 12px;
  border: 1px solid var(--ecotox-border);
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: var(--ecotox-ink);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.ecotox-assistant__message--user .ecotox-assistant__bubble {
  border-color: var(--ecotox-brand);
  border-radius: 14px 14px 4px;
  background: var(--ecotox-brand);
  color: #fff;
}

.ecotox-assistant__sources {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 86%;
  margin-top: 6px;
  padding-left: 4px;
  font-size: 12px;
}

.ecotox-assistant__sources span {
  color: var(--ecotox-muted);
  font-weight: 700;
}

.ecotox-assistant__sources a {
  color: var(--ecotox-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ecotox-assistant__typing {
  flex-direction: row;
  gap: 4px;
  width: fit-content;
  padding: 12px 14px;
  border: 1px solid var(--ecotox-border);
  border-radius: 14px 14px 14px 4px;
  background: #fff;
}

.ecotox-assistant__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ecotox-muted);
  animation: ecotox-assistant-pulse 1.1s infinite ease-in-out;
}

.ecotox-assistant__typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.ecotox-assistant__typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ecotox-assistant-pulse {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ecotox-assistant__quick-actions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 12px 4px;
  background: #fff;
}

.ecotox-assistant__quick-actions button {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--ecotox-border);
  border-radius: 999px;
  background: #fff;
  color: var(--ecotox-ink);
  cursor: pointer;
  font-size: 12px;
}

.ecotox-assistant__quick-actions button:hover {
  border-color: var(--ecotox-brand);
  color: var(--ecotox-brand);
}

.ecotox-assistant__actions {
  display: flex;
  gap: 8px;
  padding: 9px 12px;
  background: #fff;
}

.ecotox-assistant__actions a {
  display: inline-flex;
  min-height: 35px;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
  border: 1px solid var(--ecotox-brand);
  border-radius: 9px;
  background: #fff;
  color: var(--ecotox-brand);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.ecotox-assistant__actions .is-recommended,
.ecotox-assistant__contact-link {
  background: var(--ecotox-brand);
  color: #fff;
}

.ecotox-assistant__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--ecotox-border);
  background: #fff;
}

.ecotox-assistant__composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 110px;
  flex: 1;
  padding: 9px 10px;
  border: 1px solid #bdcdcf;
  border-radius: 8px;
  background: #fff;
  color: var(--ecotox-ink);
  resize: none;
}

.ecotox-assistant__composer button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  place-items: center;
  background: var(--ecotox-brand);
  color: #fff;
  cursor: pointer;
}

.ecotox-assistant__composer button:disabled,
.ecotox-assistant__composer textarea:disabled {
  cursor: wait;
  opacity: 0.6;
}

.ecotox-assistant__privacy {
  margin: 0;
  padding: 0 12px 10px;
  background: #fff;
  color: var(--ecotox-muted);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 520px) {
  .ecotox-assistant {
    right: 14px;
    bottom: 14px;
  }

  .ecotox-assistant__panel {
    position: fixed;
    inset: 10px 10px 78px;
    width: auto;
    max-height: none;
    border-radius: 15px;
  }

  .ecotox-assistant__launcher-label {
    display: none;
  }

  .ecotox-assistant__launcher {
    width: 54px;
    height: 54px;
    justify-content: center;
    padding: 0;
  }

}

@media (prefers-reduced-motion: reduce) {
  .ecotox-assistant__typing span {
    animation: none;
  }

  .ecotox-assistant__launcher {
    transition: none;
  }
}
