/* Sandberg 0.5 — fenêtre chat côté cliente */
.sandberg-client-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  width: min(370px, calc(100vw - 32px));
  font-family: inherit;
  color: #344054;
}
.sandberg-client-chat-window {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  border: 1px solid #dbe3ef;
}
.sandberg-client-chat-header {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #E6EFFE;
  padding: 14px 16px;
  color: #344054;
}
.sandberg-client-chat-header strong,
.sandberg-client-chat-header small {
  display: block;
  line-height: 1.25;
}
.sandberg-client-chat-header small {
  font-size: 12px;
  opacity: .78;
}
.sandberg-client-status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .15);
  flex: 0 0 auto;
}
.sandberg-client-chat.is-standby .sandberg-client-status-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .16); }
.sandberg-client-chat.is-closed .sandberg-client-status-dot { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, .14); }
.sandberg-client-minimize {
  margin-left: auto;
  border: 0;
  background: rgba(255,255,255,.75);
  color: #344054;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.sandberg-client-chat-body {
  max-height: 330px;
  min-height: 145px;
  overflow: auto;
  padding: 14px;
  background: #fbfdff;
}
.sandberg-client-empty {
  margin: 0;
  color: #667085;
}
.sandberg-client-msg {
  max-width: 82%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f1f5f9;
}
.sandberg-client-msg.from-admin {
  background: #E6EFFE;
}
.sandberg-client-msg.from-visitor {
  margin-left: auto;
  background: #eef2f7;
}
.sandberg-client-msg span {
  display: block;
  color: #667085;
  font-size: 11px;
  margin-bottom: 4px;
}
.sandberg-client-msg p {
  margin: 0;
  white-space: pre-wrap;
}
.sandberg-client-msg a {
  color: #006fbf;
  font-weight: 600;
}
.sandberg-client-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #e5eaf2;
  background: #fff;
}
.sandberg-client-chat-form textarea {
  width: 100%;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid #d0d7e2;
  padding: 9px 10px;
  font-family: inherit;
}
.sandberg-client-chat-form button {
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: #E6EFFE;
  color: #344054;
  font-weight: 700;
  cursor: pointer;
}
.sandberg-client-closed {
  padding: 12px 14px;
  color: #667085;
  border-top: 1px solid #e5eaf2;
  background: #fff;
}
@media (max-width: 480px) {
  .sandberg-client-chat {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}

/* Sandberg 0.7 — corrections robustes mobile/chat + compatibilité ANIMA Loader */
.sandberg-client-chat,
.sandberg-client-chat * {
  box-sizing: border-box;
}
.sandberg-client-chat-form textarea,
.sandberg-client-chat-form button,
.sandberg-client-minimize {
  font-size: 16px;
}
.sandberg-client-chat-form textarea {
  min-height: 46px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
.sandberg-client-chat-form button,
.sandberg-client-minimize {
  touch-action: manipulation;
}
@media (max-width: 480px) {
  .sandberg-client-chat-body {
    max-height: 42vh;
  }
  .sandberg-client-chat-form {
    grid-template-columns: 1fr;
  }
  .sandberg-client-chat-form button {
    min-height: 44px;
  }
}

/* Sandberg 0.9 — réduire / terminer + pastille */
.sandberg-client-header-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.sandberg-client-minimize,
.sandberg-client-close {
  border: 0;
  background: rgba(255,255,255,.75);
  color: #344054;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}
.sandberg-client-close {
  color: #b91c1c;
}
.sandberg-client-chat.is-pill {
  width: auto;
}
.sandberg-client-chat-pill {
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #E6EFFE;
  color: #344054;
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  font-weight: 700;
  cursor: pointer;
  font-size: 16px;
}
.sandberg-client-msg.system {
  max-width: 100%;
  text-align: center;
  background: #f8fafc;
  border: 1px dashed #dbe3ef;
  color: #667085;
  font-size: 12px;
}

/* Sandberg 1.0 — fenêtre client plus grande + pastille réduite propre */
.sandberg-client-chat {
  width: min(560px, calc(100vw - 28px));
  right: 18px;
  bottom: 18px;
}
.sandberg-client-chat-window {
  max-height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
}
.sandberg-client-chat-body {
  max-height: min(430px, 48vh);
  flex: 1 1 auto;
}
.sandberg-client-chat.is-pill {
  left: 18px;
  right: auto;
  bottom: 18px;
  width: auto;
}
.sandberg-client-chat-pill {
  width: 58px;
  height: 58px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #E6EFFE;
  color: #344054;
  border: 1px solid #cddcf5;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .22);
  font-size: 25px;
}
.sandberg-client-chat-pill span {
  line-height: 1;
}
@media (max-width: 600px) {
  .sandberg-client-chat:not(.is-pill) {
    left: 10px;
    right: 10px;
    bottom: 12px;
    width: auto;
  }
  .sandberg-client-chat-window {
    max-height: min(78vh, 680px);
    border-radius: 20px;
  }
  .sandberg-client-chat-body {
    max-height: 46vh;
    min-height: 220px;
  }
  .sandberg-client-chat.is-pill {
    left: 14px;
    right: auto;
    bottom: 14px;
  }
}

/* Sandberg 1.1 — chat mobile compact + états admin propres */
.sandberg-client-chat {
  width: min(430px, calc(100vw - 28px));
}
.sandberg-client-chat-window {
  max-height: min(620px, calc(100vh - 36px));
}
.sandberg-client-chat-body {
  max-height: min(300px, 38vh);
}
.sandberg-client-chat-pill {
  width: auto;
  min-width: 62px;
  height: 58px;
  padding: 0 13px;
  gap: 8px;
}
.sandberg-client-chat-pill .sandberg-pill-icon,
.sandberg-client-chat-pill .sandberg-pill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sandberg-client-chat-pill .sandberg-pill-label {
  font-size: 13px;
  font-weight: 800;
}
.sandberg-client-chat.is-standby .sandberg-client-chat-pill {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
.sandberg-client-chat.is-closed .sandberg-client-chat-pill {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
.sandberg-client-chat.is-auto-closing .sandberg-client-chat-window {
  max-width: 360px;
}
.sandberg-client-closed-final {
  font-weight: 700;
  text-align: center;
  padding: 22px 18px;
}

@media (max-width: 480px) {
  .sandberg-client-chat:not(.is-pill) {
    left: auto;
    right: 10px;
    bottom: 12px;
    width: min(340px, calc(100vw - 20px));
  }
  .sandberg-client-chat-window {
    max-height: 66vh;
    border-radius: 16px;
  }
  .sandberg-client-chat-header {
    padding: 10px 12px;
  }
  .sandberg-client-chat-header strong {
    font-size: 15px;
  }
  .sandberg-client-chat-header small {
    font-size: 11px;
  }
  .sandberg-client-chat-body {
    min-height: 110px;
    max-height: 28vh;
    padding: 10px;
  }
  .sandberg-client-msg {
    max-width: 88%;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 14px;
  }
  .sandberg-client-chat-form {
    grid-template-columns: 1fr auto;
    padding: 10px;
    gap: 8px;
  }
  .sandberg-client-chat-form textarea {
    min-height: 44px;
    max-height: 96px;
    font-size: 16px;
  }
  .sandberg-client-chat-form button {
    min-height: 44px;
    padding: 0 12px;
    font-size: 14px;
  }
  .sandberg-client-chat.is-pill {
    left: 14px;
    right: auto;
    bottom: 14px;
    width: auto;
  }
  .sandberg-client-chat-pill {
    min-width: 58px;
    height: 54px;
    padding: 0 12px;
  }
}
