.it-helpdesk-agent-wrap {
  font-family: inherit;
  --it-agent-primary: #0f766e;
  --it-agent-user: #2563eb;
  --it-agent-panel-width: 380px;
  --it-agent-offset-x: 24px;
  --it-agent-offset-y: 24px;
  --it-agent-surface: #ffffff;
  --it-agent-border: rgba(15, 23, 42, 0.1);
  --it-agent-text: #17202a;
}

.it-helpdesk-agent-wrap--floating {
  position: fixed;
  z-index: 99999;
}

.it-helpdesk-agent-wrap--bottom-right {
  bottom: var(--it-agent-offset-y);
  right: var(--it-agent-offset-x);
}

.it-helpdesk-agent-wrap--bottom-left {
  bottom: var(--it-agent-offset-y);
  left: var(--it-agent-offset-x);
}

.it-helpdesk-agent-wrap--top-right {
  right: var(--it-agent-offset-x);
  top: var(--it-agent-offset-y);
}

.it-helpdesk-agent-wrap--top-left {
  left: var(--it-agent-offset-x);
  top: var(--it-agent-offset-y);
}

.it-helpdesk-agent {
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--it-agent-surface) 94%, transparent);
  border: 1px solid var(--it-agent-border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  color: var(--it-agent-text);
  font-family: inherit;
  max-width: 720px;
  overflow: hidden;
  transform-origin: bottom right;
}

.it-helpdesk-agent--floating {
  max-width: min(var(--it-agent-panel-width), calc(100vw - 32px));
  position: absolute;
  width: var(--it-agent-panel-width);
}

.it-helpdesk-agent-wrap.is-open .it-helpdesk-agent--floating {
  animation: itAgentPanelIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.it-helpdesk-agent-wrap--bottom-right .it-helpdesk-agent--floating {
  bottom: 78px;
  right: 0;
  transform-origin: bottom right;
}

.it-helpdesk-agent-wrap--bottom-left .it-helpdesk-agent--floating {
  bottom: 78px;
  left: 0;
  transform-origin: bottom left;
}

.it-helpdesk-agent-wrap--top-right .it-helpdesk-agent--floating {
  right: 0;
  top: 78px;
  transform-origin: top right;
}

.it-helpdesk-agent-wrap--top-left .it-helpdesk-agent--floating {
  left: 0;
  top: 78px;
  transform-origin: top left;
}

.it-helpdesk-agent__launcher {
  align-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--it-agent-primary) 92%, #ffffff), var(--it-agent-primary));
  border: 0;
  border-radius: 999px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.28);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  gap: 8px;
  min-height: 58px;
  padding: 0 22px;
  position: relative;
  transition: box-shadow 180ms ease, transform 180ms ease, filter 180ms ease;
}

.it-helpdesk-agent__launcher::before {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  content: "?";
  display: inline-flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.it-helpdesk-agent__launcher::after {
  animation: itAgentPulse 2.4s ease-out infinite;
  border: 1px solid color-mix(in srgb, var(--it-agent-primary) 70%, #ffffff);
  border-radius: inherit;
  content: "";
  inset: -6px;
  opacity: 0;
  position: absolute;
}

.it-helpdesk-agent__launcher:hover {
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.34);
  filter: saturate(1.06);
  transform: translateY(-2px);
}

.it-helpdesk-agent-wrap.is-open .it-helpdesk-agent__launcher {
  display: none;
}

.it-helpdesk-agent__header {
  align-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--it-agent-primary) 96%, #ffffff), color-mix(in srgb, var(--it-agent-primary) 78%, #111827));
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  padding: 18px;
}

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

.it-helpdesk-agent__header strong,
.it-helpdesk-agent__header span {
  display: block;
}

.it-helpdesk-agent__header span {
  font-size: 14px;
  opacity: 0.9;
}

.it-helpdesk-agent__messages {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--it-agent-primary) 8%, transparent), transparent 34%),
    #f7f9fc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  min-height: 220px;
  overflow-y: auto;
  padding: 16px;
}

.it-helpdesk-agent--floating .it-helpdesk-agent__messages {
  max-height: min(420px, calc(100vh - 310px));
  min-height: 240px;
}

.it-helpdesk-agent__message {
  animation: itAgentMessageIn 180ms ease both;
  border-radius: 14px;
  line-height: 1.45;
  max-width: 82%;
  padding: 11px 13px;
  white-space: pre-wrap;
}

.it-helpdesk-agent__message--agent {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.it-helpdesk-agent__message--user {
  align-self: flex-end;
  background: linear-gradient(135deg, color-mix(in srgb, var(--it-agent-user) 90%, #ffffff), var(--it-agent-user));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--it-agent-user) 28%, transparent);
  color: #ffffff;
}

.it-helpdesk-agent__form {
  align-items: stretch;
  background: #ffffff;
  border-top: 1px solid #d8dee4;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.it-helpdesk-agent__contact {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
}

.it-helpdesk-agent__contact.is-captured {
  display: none;
}

.it-helpdesk-agent__contact label {
  color: #3d444d;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 5px;
}

.it-helpdesk-agent__contact em {
  color: #6a737d;
  font-style: normal;
  font-weight: 400;
}

.it-helpdesk-agent__contact input {
  border: 1px solid #d6dee7;
  border-radius: 10px;
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.it-helpdesk-agent__form textarea {
  border: 1px solid #d6dee7;
  border-radius: 12px;
  font: inherit;
  min-height: 48px;
  padding: 10px;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.it-helpdesk-agent__contact input:focus,
.it-helpdesk-agent__form textarea:focus {
  border-color: color-mix(in srgb, var(--it-agent-primary) 68%, #ffffff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--it-agent-primary) 16%, transparent);
  outline: none;
}

.it-helpdesk-agent__form button {
  align-self: end;
  background: linear-gradient(135deg, color-mix(in srgb, var(--it-agent-primary) 92%, #ffffff), var(--it-agent-primary));
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0 18px;
  transition: filter 160ms ease, transform 160ms ease;
}

.it-helpdesk-agent__form button:hover:not(:disabled) {
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.it-helpdesk-agent__form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.it-helpdesk-agent__fineprint {
  background: #ffffff;
  color: #57606a;
  font-size: 13px;
  margin: 0;
  padding: 0 12px 12px;
}

.it-helpdesk-agent__disclaimer {
  background: #ffffff;
  border-top: 1px solid #d8dee4;
  color: #3d444d;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  padding: 10px 12px 6px;
}

@media (max-width: 520px) {
  .it-helpdesk-agent-wrap--floating {
    bottom: 16px;
    left: 16px;
    right: 16px;
    top: auto;
  }

  .it-helpdesk-agent--floating {
    bottom: 70px;
    max-width: none;
    top: auto;
    width: 100%;
  }

  .it-helpdesk-agent-wrap--bottom-left .it-helpdesk-agent--floating,
  .it-helpdesk-agent-wrap--bottom-right .it-helpdesk-agent--floating,
  .it-helpdesk-agent-wrap--top-left .it-helpdesk-agent--floating,
  .it-helpdesk-agent-wrap--top-right .it-helpdesk-agent--floating {
    left: 0;
    right: 0;
  }

  .it-helpdesk-agent__launcher {
    justify-content: center;
    width: 100%;
  }

  .it-helpdesk-agent__form {
    grid-template-columns: 1fr;
  }

  .it-helpdesk-agent__contact {
    grid-template-columns: 1fr;
  }

  .it-helpdesk-agent__form button {
    width: 100%;
  }

  .it-helpdesk-agent__message {
    max-width: 94%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .it-helpdesk-agent-wrap.is-open .it-helpdesk-agent--floating,
  .it-helpdesk-agent__launcher::after,
  .it-helpdesk-agent__message {
    animation: none;
  }

  .it-helpdesk-agent__launcher,
  .it-helpdesk-agent__form button,
  .it-helpdesk-agent__contact input,
  .it-helpdesk-agent__form textarea {
    transition: none;
  }
}

@keyframes itAgentPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes itAgentMessageIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes itAgentPulse {
  0% {
    opacity: 0.7;
    transform: scale(0.96);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.2);
  }
}
