.klee-ai,
.klee-ai * {
  box-sizing: border-box;
}

.klee-ai {
  --klee-ai-blue: #0c63e7;
  --klee-ai-blue-deep: #083f9e;
  --klee-ai-ink: #12233d;
  --klee-ai-muted: #5b6b81;
  --klee-ai-line: #dce5f2;
  --klee-ai-soft: #f2f6fc;
  --klee-ai-white: #ffffff;
  position: fixed;
  z-index: 2147483000;
  right: 24px;
  bottom: 22px;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--klee-ai-ink);
  line-height: 1.45;
}

.klee-ai [hidden] {
  display: none !important;
}

.klee-ai__launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--klee-ai-blue) 0%, var(--klee-ai-blue-deep) 100%);
  box-shadow: 0 14px 34px rgba(8, 63, 158, 0.34);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.klee-ai__launcher:hover,
.klee-ai__launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(8, 63, 158, 0.42);
  outline: none;
}

.klee-ai__launcher:focus-visible,
.klee-ai__close:focus-visible,
.klee-ai__send:focus-visible,
.klee-ai__suggestion:focus-visible,
.klee-ai__input:focus-visible {
  outline: 3px solid rgba(12, 99, 231, 0.24);
  outline-offset: 2px;
}

.klee-ai__launcher-icon {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.klee-ai__hint {
  position: absolute;
  right: 74px;
  bottom: 10px;
  width: max-content;
  max-width: 220px;
  padding: 9px 13px;
  border: 1px solid var(--klee-ai-line);
  border-radius: 12px;
  color: var(--klee-ai-ink);
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 35, 61, 0.14);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.klee-ai__hint--visible {
  opacity: 1;
  transform: translateX(0);
}

.klee-ai--open .klee-ai__hint {
  opacity: 0;
  transform: translateX(8px);
}

.klee-ai--busy .klee-ai__identity span::before {
  background: #f7c94f;
  box-shadow: 0 0 0 3px rgba(247, 201, 79, 0.16);
  animation: klee-ai-status-pulse 1.2s infinite ease-in-out;
}

.klee-ai__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: 390px;
  height: min(610px, calc(100vh - 124px));
  min-height: 440px;
  overflow: hidden;
  border: 1px solid rgba(18, 35, 61, 0.12);
  border-radius: 22px;
  background: var(--klee-ai-white);
  box-shadow: 0 28px 70px rgba(7, 29, 65, 0.24);
  transform-origin: bottom right;
  animation: klee-ai-panel-in 180ms ease-out;
}

.klee-ai__header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 70px;
  padding: 13px 14px 13px 16px;
  color: #fff;
  background: linear-gradient(125deg, #0e2d59 0%, var(--klee-ai-blue-deep) 100%);
}

.klee-ai__avatar {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 20px;
  font-weight: 800;
}

.klee-ai__identity {
  min-width: 0;
  flex: 1;
}

.klee-ai__identity strong,
.klee-ai__identity span {
  display: block;
}

.klee-ai__identity strong {
  color: #fff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  line-height: 1.3;
}

.klee-ai__identity span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.klee-ai__identity span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #40d9aa;
  box-shadow: 0 0 0 3px rgba(64, 217, 170, 0.14);
}

.klee-ai__close {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.klee-ai__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.klee-ai__messages {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 15px 12px;
  background: linear-gradient(180deg, #f7f9fd 0%, #fff 45%);
  overscroll-behavior: contain;
  scrollbar-color: #c7d4e5 transparent;
  scrollbar-width: thin;
}

.klee-ai__message {
  display: flex;
  margin-bottom: 12px;
}

.klee-ai__message--user {
  justify-content: flex-end;
}

.klee-ai__bubble {
  max-width: 86%;
  padding: 11px 13px;
  border: 1px solid var(--klee-ai-line);
  border-radius: 5px 16px 16px 16px;
  color: #263952;
  background: #fff;
  box-shadow: 0 5px 16px rgba(18, 35, 61, 0.06);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.klee-ai__message--user .klee-ai__bubble {
  border-color: transparent;
  border-radius: 16px 5px 16px 16px;
  color: #fff;
  background: var(--klee-ai-blue);
  box-shadow: none;
}

.klee-ai__bubble a {
  color: var(--klee-ai-blue-deep);
  font-weight: 600;
  text-decoration: underline;
}

.klee-ai__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 3px 0 16px;
}

.klee-ai__suggestion {
  padding: 8px 11px;
  border: 1px solid #bfd2ee;
  border-radius: 999px;
  color: var(--klee-ai-blue-deep);
  background: #f5f9ff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.klee-ai__suggestion:hover {
  border-color: var(--klee-ai-blue);
  background: #eaf2ff;
}

.klee-ai__suggestion--action {
  display: inline-block;
  text-decoration: none;
}

.klee-ai__typing .klee-ai__bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.klee-ai__typing-copy {
  color: #5b6b81;
  font-size: 13px;
}

.klee-ai__typing-dots {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
}

.klee-ai__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b9bb1;
  animation: klee-ai-dot 1.1s infinite ease-in-out;
}

.klee-ai__typing-dot:nth-child(2) {
  animation-delay: 120ms;
}

.klee-ai__typing-dot:nth-child(3) {
  animation-delay: 240ms;
}

.klee-ai__composer {
  padding: 11px 12px 10px;
  border-top: 1px solid var(--klee-ai-line);
  background: #fff;
}

.klee-ai__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border: 1px solid #cbd8e9;
  border-radius: 16px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.klee-ai__form:focus-within {
  border-color: var(--klee-ai-blue);
  box-shadow: 0 0 0 3px rgba(12, 99, 231, 0.1);
}

.klee-ai__input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 105px;
  padding: 8px 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  outline: 0 !important;
  box-shadow: none !important;
  color: var(--klee-ai-ink);
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.klee-ai__input::placeholder {
  color: #8796aa;
}

.klee-ai__send {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--klee-ai-blue);
  cursor: pointer;
}

.klee-ai__send:hover {
  background: var(--klee-ai-blue-deep);
}

.klee-ai__send:disabled,
.klee-ai__input:disabled {
  cursor: wait;
  opacity: 0.58;
}

.klee-ai__send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.klee-ai__privacy {
  margin: 7px 4px 0;
  color: #8491a3;
  font-size: 10.5px;
  text-align: center;
}

@keyframes klee-ai-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes klee-ai-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-4px);
  }
}

@keyframes klee-ai-status-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

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

  .klee-ai__launcher {
    width: 58px;
    height: 58px;
  }

  .klee-ai__hint {
    display: none;
  }

  .klee-ai__panel {
    position: fixed;
    inset: 10px 10px 82px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
    transform-origin: bottom center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .klee-ai__panel,
  .klee-ai__typing-dot,
  .klee-ai--busy .klee-ai__identity span::before {
    animation: none;
  }

  .klee-ai__launcher,
  .klee-ai__hint {
    transition: none;
  }
}
