.klegr-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  font-family: Inter, Arial, sans-serif;
  color: #101014;
}

.klegr-chat * {
  box-sizing: border-box;
}

.klegr-chat__button {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101014;
  color: #ffffff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.klegr-chat__button:hover {
  transform: translateY(-2px);
  background: #24242b;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.34);
}

.klegr-chat__button svg {
  width: 30px;
  height: 30px;
}

.klegr-chat__pulse {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #31d27c;
  border: 2px solid #ffffff;
}

.klegr-chat__panel {
  position: absolute;
  right: 0;
  bottom: 82px;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 118px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(16, 16, 20, 0.12);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.25);
}

.klegr-chat.is-open .klegr-chat__panel {
  display: grid;
}

.klegr-chat__header {
  padding: 18px;
  background: #101014;
  color: #ffffff;
}

.klegr-chat__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.klegr-chat__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.klegr-chat__avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #ffffff;
  color: #101014;
  font-weight: 800;
  letter-spacing: 0;
}

.klegr-chat__name {
  margin: 0;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
}

.klegr-chat__status {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.35;
}

.klegr-chat__close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.klegr-chat__intro {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.5;
}

.klegr-chat__messages {
  padding: 16px;
  overflow-y: auto;
  background: #f5f5f2;
}

.klegr-chat__message {
  max-width: 86%;
  margin: 0 0 12px;
  padding: 12px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-line;
}

.klegr-chat__message--bot {
  border-top-left-radius: 4px;
  background: #ffffff;
  color: #141416;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
}

.klegr-chat__message--user {
  margin-left: auto;
  border-top-right-radius: 4px;
  background: #101014;
  color: #ffffff;
}

.klegr-chat__message strong {
  font-weight: 800;
}

.klegr-chat__typing {
  width: auto;
  min-width: 112px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.klegr-chat__typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(16, 16, 20, 0.42);
  animation: klegrTyping 1s infinite ease-in-out;
}

.klegr-chat__typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.klegr-chat__typing span:nth-child(3) {
  animation-delay: 0.32s;
}

.klegr-chat__typing-label {
  margin-right: 2px;
  color: rgba(16, 16, 20, 0.58);
  font-size: 12px;
  line-height: 1;
}

@keyframes klegrTyping {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.38;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.klegr-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 14px;
}

.klegr-chat__chip {
  padding: 8px 10px;
  border: 1px solid rgba(16, 16, 20, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: #101014;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.klegr-chat__chip:hover {
  border-color: rgba(16, 16, 20, 0.32);
}

.klegr-chat__actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 10px;
}

.klegr-chat__action {
  display: inline-flex;
  width: 86px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  border-radius: 12px;
  background: rgba(37, 211, 102, 0.12);
  color: #128c4a;
  text-decoration: none;
  box-shadow: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.klegr-chat__action:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 211, 102, 0.18);
}

.klegr-chat__whatsapp-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #25d366;
  color: #ffffff;
}

.klegr-chat__whatsapp-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.klegr-chat__action-label {
  max-width: 76px;
  color: #101014;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  text-align: center;
}

.klegr-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(16, 16, 20, 0.08);
  background: #ffffff;
}

.klegr-chat__input {
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(16, 16, 20, 0.14);
  border-radius: 999px;
  outline: 0;
  color: #101014;
  background: #ffffff;
  font: inherit;
  font-size: 14px;
}

.klegr-chat__input:focus {
  border-color: #101014;
}

.klegr-chat__send {
  width: 46px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #101014;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.klegr-chat__send svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 479px) {
  .klegr-chat {
    right: 14px;
    bottom: 14px;
  }

  .klegr-chat__button {
    width: 58px;
    height: 58px;
  }

  .klegr-chat__panel {
    right: -7px;
    bottom: 74px;
    height: min(580px, calc(100vh - 96px));
    border-radius: 16px;
  }
}
