.klouded-chat {
  --klouded-blue: #3484e3;
  --klouded-navy: #0f2d55;
  --klouded-orange: #f6a21a;
  --klouded-text: #17233a;
  font-family: Arial, "Helvetica Neue", sans-serif;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147482500;
}

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

.klouded-chat__launcher {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--klouded-blue);
  box-shadow: 0 18px 38px rgba(15, 45, 85, 0.32);
  font-weight: 700;
  cursor: pointer;
}

.klouded-chat__launcher:hover {
  background: var(--klouded-navy);
}

.klouded-chat__panel {
  display: none;
  position: absolute;
  right: 0;
  bottom: 88px;
  width: min(390px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 122px));
  overflow: hidden;
  border: 1px solid #d8e4f2;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 45, 85, 0.28);
}

.klouded-chat-is-open .klouded-chat__panel {
  display: flex;
  flex-direction: column;
}

.klouded-chat-is-open .klouded-chat__launcher {
  display: none;
}

.klouded-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--klouded-navy);
  color: #fff;
}

.klouded-chat__header strong,
.klouded-chat__header span {
  display: block;
}

.klouded-chat__header strong {
  font-size: 16px;
  line-height: 1.2;
}

.klouded-chat__header span {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.82;
}

.klouded-chat__header button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.klouded-chat__messages {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
  padding: 16px;
  background: #f7fbff;
}

.klouded-chat__message {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 10px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.klouded-chat__message--bot {
  background: #fff;
  color: var(--klouded-text);
  border: 1px solid #d8e4f2;
}

.klouded-chat__message--user {
  margin-left: auto;
  background: var(--klouded-blue);
  color: #fff;
}

.klouded-chat__quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #d8e4f2;
  background: #fff;
}

.klouded-chat__quick button {
  min-height: 36px;
  border: 1px solid #bed6f2;
  border-radius: 6px;
  background: #eef6ff;
  color: var(--klouded-navy);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.klouded-chat__quick button:hover {
  border-color: var(--klouded-blue);
}

.klouded-chat__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #d8e4f2;
  background: #fff;
}

.klouded-chat__composer input,
.klouded-chat__lead-form input,
.klouded-chat__lead-form select,
.klouded-chat__lead-form textarea {
  width: 100%;
  border: 1px solid #c9d8ea;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--klouded-text);
  font: inherit;
}

.klouded-chat__composer button,
.klouded-chat__lead-form button {
  border: 0;
  border-radius: 6px;
  padding: 10px 13px;
  background: var(--klouded-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.klouded-chat__composer button:hover,
.klouded-chat__lead-form button:hover {
  background: var(--klouded-navy);
}

.klouded-chat__composer button:disabled,
.klouded-chat__composer input:disabled {
  opacity: 0.65;
  cursor: wait;
}

.klouded-chat__lead-form {
  display: grid;
  gap: 9px;
  margin: 12px 0;
  padding: 13px;
  border: 1px solid #d8e4f2;
  border-radius: 10px;
  background: #fff;
}

.klouded-chat__form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.klouded-chat__privacy {
  margin: 0;
  padding: 0 14px 12px;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

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

  .klouded-chat__panel {
    right: -2px;
    bottom: 82px;
    width: calc(100vw - 24px);
  }

  .klouded-chat__quick,
  .klouded-chat__form-grid {
    grid-template-columns: 1fr;
  }
}
