:root {
  --kaux-chat-primary: #0f2a5e;
  --kaux-chat-primary-rgb: 15, 42, 94;
  --kaux-chat-bg: #ffffff;
  --kaux-chat-muted: #86868b;
  --kaux-chat-surface: #f5f5f7;
  --kaux-chat-border: rgba(15, 42, 94, 0.12);
}

.kaux-chat-widget {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

.kaux-chat-widget *,
.kaux-chat-widget *::before,
.kaux-chat-widget *::after {
  box-sizing: border-box;
}

.kaux-chat-widget__toggle {
  width: 60px;
  height: 60px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kaux-chat-widget__toggle:hover {
  transform: scale(1.08);
}

.kaux-chat-widget__toggle:focus-visible,
.kaux-chat-widget__close:focus-visible,
.kaux-chat-widget__send:focus-visible,
.kaux-chat-widget__input:focus-visible {
  outline: 2px solid rgba(var(--kaux-chat-primary-rgb), 0.45);
  outline-offset: 3px;
}

.kaux-chat-widget__toggle img {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.kaux-chat-widget__panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 380px;
  height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(15, 42, 94, 0.08);
  border-radius: 18px;
  background: var(--kaux-chat-bg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.kaux-chat-widget__panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.kaux-chat-widget__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  color: #fff;
  background: rgba(15, 42, 94, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.kaux-chat-widget__brand {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.kaux-chat-widget__title {
  flex: 1;
  min-width: 0;
}

.kaux-chat-widget__title strong,
.kaux-chat-widget__title span {
  display: block;
}

.kaux-chat-widget__title strong {
  font-size: 15px;
  font-weight: 600;
}

.kaux-chat-widget__title span {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.kaux-chat-widget__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.kaux-chat-widget__messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  background: var(--kaux-chat-bg);
}

.kaux-chat-widget__message-row {
  display: flex;
  margin-bottom: 12px;
}

.kaux-chat-widget__message-row--user {
  justify-content: flex-end;
}

.kaux-chat-widget__message-row--assistant {
  justify-content: flex-start;
}

.kaux-chat-widget__message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 24px rgba(var(--kaux-chat-primary-rgb), 0.08);
}

.kaux-chat-widget__message--assistant {
  border-top-left-radius: 6px;
  background: var(--kaux-chat-surface);
  color: #1d1d1f;
}

.kaux-chat-widget__message--user {
  border-top-right-radius: 6px;
  background: var(--kaux-chat-primary);
  color: #fff;
}

.kaux-chat-widget__status,
.kaux-chat-widget__error {
  padding: 0 18px 12px;
  font-size: 12px;
}

.kaux-chat-widget__status {
  color: var(--kaux-chat-muted);
}

.kaux-chat-widget__error {
  color: #c9342f;
}

.kaux-chat-widget__footer {
  border-top: 1px solid var(--kaux-chat-border);
  background: #fff;
}

.kaux-chat-widget__composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 14px 10px;
}

.kaux-chat-widget__input {
  flex: 1;
  min-height: 46px;
  max-height: 110px;
  padding: 12px 14px;
  resize: none;
  border: 1px solid rgba(15, 42, 94, 0.14);
  border-radius: 14px;
  background: #fff;
  color: #1d1d1f;
  font: inherit;
}

.kaux-chat-widget__send {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: var(--kaux-chat-primary);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.kaux-chat-widget__send:disabled {
  opacity: 0.5;
  cursor: default;
}

.kaux-chat-widget__powered {
  padding: 0 14px 14px;
  color: #86868b;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 479px) {
  .kaux-chat-widget {
    right: 16px;
    bottom: 16px;
  }

  .kaux-chat-widget__panel {
    right: 0;
    bottom: 76px;
    width: calc(100vw - 32px);
    max-width: 380px;
    height: min(520px, calc(100vh - 112px));
  }
}
