.klean-chat {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 80;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: auto;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
}
.klean-chat.is-open {
  width: min(360px, calc(100vw - 24px));
  animation: none;
}
.klean-chat[hidden] { display: none !important; }
.klean-chat-teaser {
  position: relative;
  order: 2;
  margin: 0 6px 4px 0;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--green);
  border-radius: 20px 20px 6px 20px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 600;
}
.klean-chat-teaser::before,
.klean-chat-teaser::after {
  content: "";
  position: absolute;
  right: 16px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: var(--white);
}
.klean-chat-teaser::before {
  bottom: -8px;
  right: 15px;
  width: 14px;
  height: 14px;
  background: var(--green);
}
.klean-chat-teaser::after {
  bottom: -6px;
}
.klean-chat-toggle {
  order: 3;
  align-self: flex-end;
}
@media (prefers-reduced-motion: no-preference) {
  .klean-chat:not(.is-open) {
    animation: klean-chat-bounce 1.6s ease-in-out infinite;
  }
}
@keyframes klean-chat-bounce {
  0%, 40%, 100% { transform: translate3d(0, 0, 0); }
  8% { transform: translate3d(0, -18px, 0); }
  16% { transform: translate3d(0, 0, 0); }
  24% { transform: translate3d(0, -10px, 0); }
  32% { transform: translate3d(0, 0, 0); }
}
.klean-chat.is-open .klean-chat-teaser { display: none; }
.klean-chat-toggle {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 3px solid var(--green);
  border-radius: 50%;
  overflow: hidden;
  background: var(--green);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.klean-chat-toggle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}
.klean-chat-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--white);
}
.klean-chat-x {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
}
.klean-chat.is-open .klean-chat-toggle img,
.klean-chat.is-open .klean-chat-dot { display: none; }
.klean-chat.is-open .klean-chat-x { display: flex; }
.klean-chat-panel {
  position: relative;
  order: 1;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 560px);
  overflow: auto;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--green);
  border-radius: 28px 28px 8px 28px;
  box-shadow: var(--shadow);
  padding: 0 16px 18px;
  box-sizing: border-box;
}
.klean-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--green);
  color: var(--white);
  margin: 0 -16px 14px;
  padding: 14px 16px;
  border-radius: 26px 26px 0 0;
}
.klean-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.klean-chat-head p {
  margin: 0;
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 800;
}
.klean-chat-online {
  font-family: Inter, sans-serif !important;
  font-weight: 500 !important;
  font-size: 0.78rem;
  opacity: 0.9;
}
.klean-chat-close {
  margin-left: auto;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--white);
  background: transparent;
  border: 0;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
.klean-chat-bubble {
  background: var(--paper);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 14px;
  font-size: 0.95rem;
  margin: 0 0 12px;
  color: var(--ink);
}
.klean-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0 0 10px;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  color: inherit;
}
.klean-chat-btn-gold { background: var(--gold); color: var(--ink); }
.klean-chat-btn-green { background: var(--green); color: var(--white); }
.klean-chat-btn-ghost {
  background: var(--paper);
  color: var(--green-dark);
}
.klean-chat-back {
  font: inherit;
  font-weight: 700;
  color: var(--green-dark);
  background: transparent;
  border: 0;
  padding: 8px 0 12px;
  cursor: pointer;
  min-height: 44px;
}
.klean-chat-counties {
  margin: 0 0 14px;
  padding: 0 0 0 1.2rem;
  color: var(--ink);
  font-weight: 600;
}
.klean-chat-counties li { margin: 6px 0; }
@media (max-width: 420px) {
  .klean-chat {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
  .klean-chat.is-open {
    width: calc(100vw - 16px);
  }
}
