.xk-chat {
  --xk-mint: #79c8c2;
  --xk-mint-dark: #397f7a;
  --xk-ink: #111515;
  --xk-muted: #66716f;
  --xk-line: #dce5e4;
  --xk-soft: #eff8f7;
  --xk-white: #fff;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 999999;
  color: var(--xk-ink);
  font-family: inherit;
}

.xk-chat *, .xk-chat *::before, .xk-chat *::after { box-sizing: border-box; }
.xk-chat button, .xk-chat textarea { font: inherit; }
.xk-chat .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.xk-chat__launcher {
  display: grid;
  width: 64px;
  height: 64px;
  padding: 15px;
  border: 2px solid var(--xk-mint);
  border-radius: 50%;
  background: var(--xk-ink);
  color: var(--xk-white);
  box-shadow: 0 14px 38px rgba(17, 21, 21, .24);
  place-items: center;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.xk-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(17, 21, 21, .3); }
.xk-chat__launcher:focus-visible, .xk-chat button:focus-visible, .xk-chat textarea:focus-visible { outline: 3px solid rgba(121, 200, 194, .55); outline-offset: 3px; }
.xk-chat__launcher > svg {
  display: block;
  width: 34px;
  height: 34px;
  overflow: visible;
  transform: translate(1px, -1px);
  transform-origin: center;
}
.xk-chat__icon-bubble { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.xk-chat__icon-spark { fill: var(--xk-mint); stroke: var(--xk-mint); stroke-linejoin: round; stroke-width: .8; }
.xk-chat__icon-dots { fill: none; stroke: var(--xk-mint); stroke-linecap: round; stroke-width: 3.2; }

.xk-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(390px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--xk-line);
  border-radius: 24px;
  background: var(--xk-white);
  box-shadow: 0 24px 80px rgba(17, 21, 21, .24);
  transform-origin: right bottom;
  animation: xk-chat-in .2s ease-out;
}
.xk-chat__panel[hidden] { display: none; }

.xk-chat__header { display: flex; align-items: center; gap: 12px; padding: 15px 16px; background: var(--xk-ink); color: var(--xk-white); }
.xk-chat__header > img { width: 46px; height: 46px; border: 2px solid var(--xk-mint); border-radius: 50%; object-fit: cover; }
.xk-chat__header > div { display: grid; flex: 1; line-height: 1.25; }
.xk-chat__header strong { font-size: 16px; }
.xk-chat__header span { color: #cbd6d4; font-size: 12px; }
.xk-chat__header i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--xk-mint); }
.xk-chat__header button { display: grid; width: 40px; height: 40px; padding: 9px; border: 0; border-radius: 50%; background: transparent; color: var(--xk-white); place-items: center; cursor: pointer; }
.xk-chat__header button:hover { background: rgba(255, 255, 255, .1); }
.xk-chat__header svg { width: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }

.xk-chat__messages { overflow-y: auto; padding: 20px 16px; background: linear-gradient(180deg, #f8fbfb 0%, var(--xk-white) 30%); overscroll-behavior: contain; }
.xk-chat__message { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.xk-chat__message > img { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.xk-chat__bubble { max-width: 82%; padding: 11px 13px; border-radius: 16px 16px 16px 4px; background: var(--xk-soft); font-size: 15px; line-height: 1.5; }
.xk-chat__message--user { justify-content: flex-end; }
.xk-chat__message--user .xk-chat__bubble { border-radius: 16px 16px 4px 16px; background: var(--xk-ink); color: var(--xk-white); }
.xk-chat__bubble p { margin: 0; }
.xk-chat__sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 36px; }
.xk-chat__sources a { padding: 5px 8px; border: 1px solid var(--xk-line); border-radius: 999px; color: var(--xk-mint-dark); font-size: 12px; font-weight: 700; text-decoration: none; }
.xk-chat__sources a:hover { border-color: var(--xk-mint); }
.xk-chat__contact { display: inline-flex; margin-top: 9px; color: var(--xk-mint-dark); font-weight: 700; }

.xk-chat__suggestions { display: grid; gap: 8px; margin: 16px 0 4px 36px; }
.xk-chat__suggestions button { width: fit-content; max-width: 100%; padding: 9px 12px; border: 1px solid var(--xk-line); border-radius: 999px; background: var(--xk-white); color: var(--xk-ink); font-size: 13px; line-height: 1.3; text-align: left; cursor: pointer; }
.xk-chat__suggestions button:hover { border-color: var(--xk-mint); background: var(--xk-soft); }

.xk-chat__typing { display: inline-flex; gap: 4px; align-items: center; min-height: 20px; }
.xk-chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--xk-muted); animation: xk-dot 1s infinite ease-in-out; }
.xk-chat__typing i:nth-child(2) { animation-delay: .15s; }
.xk-chat__typing i:nth-child(3) { animation-delay: .3s; }

.xk-chat__composer { padding: 12px 14px 10px; border-top: 1px solid var(--xk-line); background: var(--xk-white); }
.xk-chat__composer form { display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 13px; border: 1px solid #bfcac8; border-radius: 17px; }
.xk-chat__composer form:focus-within { border-color: var(--xk-mint-dark); box-shadow: 0 0 0 3px rgba(121, 200, 194, .18); }
.xk-chat__composer textarea {
  width: 100%;
  max-height: 108px;
  padding: 6px 0;
  resize: none;
  appearance: none;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--xk-ink);
  font-size: 15px;
  line-height: 1.4;
}
.xk-chat__composer textarea::placeholder { color: #7d8987; }
.xk-chat__composer button { display: grid; width: 38px; height: 38px; flex: 0 0 auto; padding: 9px; border: 0; border-radius: 50%; background: var(--xk-mint); color: var(--xk-ink); place-items: center; cursor: pointer; }
.xk-chat__composer button:disabled { opacity: .45; cursor: wait; }
.xk-chat__composer svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.xk-chat__composer > p { margin: 7px 4px 0; color: var(--xk-muted); font-size: 11px; line-height: 1.35; text-align: center; }

@keyframes xk-chat-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes xk-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }

@media (max-width: 520px) {
  .xk-chat { right: 14px; bottom: 14px; }
  .xk-chat__launcher { width: 60px; height: 60px; padding: 14px; }
  .xk-chat__panel { position: fixed; inset: 8px; width: auto; height: auto; border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .xk-chat__panel, .xk-chat__launcher, .xk-chat__typing i { animation: none; transition: none; }
}
