.tariff-chat {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10050;
  font-family: "Open Sans", Arial, sans-serif;
  color: #24464b;
}

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

.tariff-chat__button {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: #185b62;
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.18s ease;
}

.tariff-chat__button:hover,
.tariff-chat__button:focus {
  background: #00abc4;
  outline: none;
  transform: translateY(-1px);
}

.tariff-chat__button svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.tariff-chat__panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 470px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid rgba(24, 91, 98, 0.16);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.tariff-chat.is-open .tariff-chat__panel {
  display: flex;
}

.tariff-chat__header {
  background: #185b62;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tariff-chat__title {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.tariff-chat__subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 16px;
  opacity: 0.85;
}

.tariff-chat__header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tariff-chat__clear {
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0;
  width: 28px;
}

.tariff-chat__clear:hover,
.tariff-chat__clear:focus {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.tariff-chat__clear svg {
  display: block;
  fill: currentColor;
  height: 16px;
  width: 16px;
}

.tariff-chat__close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 26px;
  cursor: pointer;
  padding: 0 2px;
}

.tariff-chat__messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f5f8f8;
}

.tariff-chat__message {
  max-width: 86%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 18px;
}

.tariff-chat__li {
  display: inline-block;
  color: #00abc4;
  font-weight: 700;
  margin-right: 2px;
  user-select: none;
}

.tariff-chat__message--bot {
  background: #fff;
  border: 1px solid rgba(24, 91, 98, 0.12);
}

.tariff-chat__message--loading {
  color: #607174;
  font-style: italic;
  display: inline-block; /* shrink-wrap to content width */
}

/* Animated typing dots */
.tariff-chat__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}

.tariff-chat__typing-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #607174;
  animation: tariff-chat-bounce 1.2s infinite ease-in-out;
}

.tariff-chat__typing-dots span:nth-child(1) { animation-delay: 0s; }
.tariff-chat__typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.tariff-chat__typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes tariff-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

.tariff-chat__message--user {
  margin-left: auto;
  background: #00abc4;
  color: #fff;
}

.tariff-chat__message a {
  color: #185b62;
  font-weight: 700;
  text-decoration: underline;
}

.tariff-chat__message--user a {
  color: #fff;
}

.tariff-chat__answer {
  margin-bottom: 0;
}

.tariff-chat__sources {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(128, 185, 71, 0.28);
  border-radius: 6px;
  background: #f5faf1;
  color: #607174;
  font-size: 12px;
  line-height: 17px;
}

.tariff-chat__sources-heading {
  margin-bottom: 7px;
  color: #185b62;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tariff-chat__sources-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tariff-chat__source-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: start;
}

.tariff-chat__source-type {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #80b947;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 13px;
  text-transform: uppercase;
}

.tariff-chat__source-title {
  min-width: 0;
  color: #24464b;
  font-weight: 600;
}

.tariff-chat__source-legacy {
  color: #24464b;
}

.tariff-chat__suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 12px 0;
  background: #fff;
  border-top: 1px solid rgba(24, 91, 98, 0.12);
}

.tariff-chat__suggestion {
  border: 1px solid rgba(24, 91, 98, 0.2);
  background: #fff;
  color: #185b62;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
}

.tariff-chat__form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
}

.tariff-chat__input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(24, 91, 98, 0.22);
  border-radius: 4px;
  padding: 10px;
  font-size: 13px;
}

.tariff-chat__input:disabled {
  background: #eef4f4;
  color: #7a8b8d;
}

.tariff-chat__send {
  border: 0;
  border-radius: 4px;
  background: #80b947;
  color: #fff;
  font-weight: 700;
  padding: 0 13px;
  cursor: pointer;
}

.tariff-chat__send:disabled {
  background: #a7c985;
  cursor: wait;
}

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

  .tariff-chat__panel {
    width: calc(100vw - 28px);
    height: min(460px, calc(100vh - 96px));
  }
}
