.un-chat {
  --un-jaune: #ffd400;
  --un-encre: #14161a;
  --un-nuit: #121418;
  --un-gris: #5b616b;
  --un-ligne: #d5d8dd;
  --un-fond: #f1f2f4;
  --un-vert: #1a7f37;
  --un-rouge: #b42318;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--un-encre);
  pointer-events: none;
}
.un-chat > * {
  pointer-events: auto;
}
.un-chat.est-discret:not(.est-ouvert) {
  visibility: hidden;
  opacity: 0;
}
.un-chat.est-discret:not(.est-ouvert) > * {
  pointer-events: none;
}
.un-chat svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.un-chat button {
  font: inherit;
  cursor: pointer;
}
.un-chat :focus-visible {
  outline: 3px solid var(--un-encre);
  outline-offset: 2px;
}

.un-chat-bouton {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--un-jaune);
  color: var(--un-encre);
  box-shadow: 0 6px 20px rgba(20, 22, 26, 0.28);
  transition: transform 0.16s ease;
}
.un-chat-bouton:active {
  transform: scale(0.94);
}
.un-chat-bouton svg {
  grid-area: 1 / 1;
  width: 28px;
  height: 28px;
}
.un-chat-ico-bulle {
  fill: currentColor !important;
  stroke: none !important;
}
.un-chat-ico-croix,
.un-chat.est-ouvert .un-chat-ico-bulle,
.un-chat.est-ouvert .un-chat-pastille {
  display: none;
}
.un-chat.est-ouvert .un-chat-ico-croix {
  display: block;
}
.un-chat-pastille {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--un-vert);
}

.un-chat-invite {
  position: relative;
  max-width: min(280px, calc(100vw - 32px));
  border: 1px solid var(--un-ligne);
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(20, 22, 26, 0.18);
}
.un-chat-invite-texte {
  display: block;
  width: 100%;
  padding: 14px 48px 14px 16px;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  text-align: left;
}
.un-chat-invite-texte strong {
  display: block;
  font-weight: 650;
}
.un-chat-invite-fermer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--un-gris);
}
.un-chat-invite-fermer svg {
  width: 16px;
  height: 16px;
}

.un-chat-panneau {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  height: min(560px, calc(100dvh - 120px));
  overflow: hidden;
  border: 1px solid var(--un-ligne);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(20, 22, 26, 0.24);
}
.un-chat-panneau[hidden] {
  display: none;
}
.un-chat-tete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px 14px 16px;
  background: var(--un-nuit);
  color: #fff;
}
.un-chat-logo {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
}
.un-chat-qui {
  flex: 1;
  min-width: 0;
}
.un-chat-qui p {
  margin: 0;
}
.un-chat-titre {
  font-weight: 650;
  line-height: 1.2;
}
.un-chat-statut {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #c3c7ce;
}
.un-chat-point {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3ccf6a;
  box-shadow: 0 0 0 3px rgba(60, 207, 106, 0.22);
}
.un-chat-fermer {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #fff;
}

.un-chat-fil {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--un-fond);
}
.un-chat-msg {
  max-width: 85%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.un-chat-msg-equipe {
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  background: #fff;
  border: 1px solid var(--un-ligne);
}
.un-chat-msg-visiteur {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  background: var(--un-encre);
  color: #fff;
}
.un-chat-points {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
}
.un-chat-points span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--un-gris);
  animation: un-chat-point 1s infinite ease-in-out;
}
.un-chat-points span:nth-child(2) {
  animation-delay: 0.15s;
}
.un-chat-points span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes un-chat-point {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: none;
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.un-chat-encore {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--un-encre);
  border-radius: 999px;
  background: #fff;
  color: var(--un-encre);
  font-weight: 600;
}

.un-chat-saisie {
  padding: 12px;
  border-top: 1px solid var(--un-ligne);
  background: #fff;
}
.un-chat-saisie[hidden] {
  display: none;
}
.un-chat-ligne {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.un-chat-champ {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  max-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--un-ligne);
  border-radius: 10px;
  background: #fff;
  color: var(--un-encre);
  font: inherit;
  font-size: 16px;
  resize: none;
}
.un-chat-champ:focus {
  border-color: var(--un-encre);
  outline: none;
  box-shadow: 0 0 0 2px var(--un-encre);
}
.un-chat-champ[aria-invalid="true"] {
  border-color: var(--un-rouge);
}
.un-chat-envoyer {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--un-jaune);
  color: var(--un-encre);
}
.un-chat-envoyer:disabled {
  opacity: 0.6;
  cursor: progress;
}
.un-chat-erreur {
  margin: 8px 0 0;
  color: var(--un-rouge);
  font-size: 0.9375rem;
  font-weight: 600;
}
.un-chat-mention {
  margin: 8px 0 0;
  color: var(--un-gris);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.un-chat-mention a {
  color: inherit;
}
.un-chat-sr,
.un-chat-pot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .un-chat {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .un-chat-bouton {
    width: 56px;
    height: 56px;
  }
  .un-chat-invite {
    position: absolute;
    right: 64px;
    bottom: 0;
    width: min(280px, calc(100vw - 88px));
    max-width: none;
    border-radius: 14px 4px 14px 14px;
  }
  .un-chat-invite-texte {
    min-height: 56px;
    padding: 8px 44px 8px 12px;
    font-size: 0.875rem;
    line-height: 1.3;
  }
  .un-chat.est-ouvert .un-chat-bouton {
    display: none;
  }
  .un-chat.est-ouvert {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  .un-chat-panneau {
    width: 100%;
    height: calc(100vh - 16px);
    height: min(640px, calc(100dvh - 16px));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .un-chat {
    transition:
      opacity 0.2s ease,
      visibility 0.2s;
  }
  .un-chat-panneau:not([hidden]) {
    animation: un-chat-entree 0.22s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: bottom right;
  }
  .un-chat-invite:not([hidden]) {
    animation: un-chat-entree 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: bottom right;
  }
}
@keyframes un-chat-entree {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

@media print {
  .un-chat {
    display: none;
  }
}
body .site-footer {
  padding-bottom: 100px;
}
