.khlt-ai-consultation {
  --khlt-ai-primary: #f97316;
  --khlt-ai-primary-dark: #c2410c;
  --khlt-ai-ink: #0f172a;
  --khlt-ai-muted: #64748b;
  --khlt-ai-line: rgba(15, 23, 42, 0.12);
  --khlt-ai-surface: rgba(255, 255, 255, 0.98);
  --khlt-ai-soft: #fff7ed;
  --khlt-ai-font-body: var(--forge-font-body, var(--font-inter), "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif);
  --khlt-ai-type-title: var(--forge-type-title, 1.25rem);
  --khlt-ai-type-message: var(--forge-type-body-sm, 0.9375rem);
  --khlt-ai-type-action: var(--forge-type-button, 0.875rem);
  --khlt-ai-type-caption: var(--forge-type-caption, 0.75rem);
  --khlt-ai-type-icon: var(--forge-type-body-lg, 1.125rem);
  --khlt-ai-type-icon-lg: var(--forge-type-title, 1.25rem);
  color: var(--khlt-ai-ink);
  font-family: var(--khlt-ai-font-body);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
}

.khlt-ai-consultation * {
  box-sizing: border-box;
}

.khlt-ai-bubble {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  color: var(--khlt-ai-ink);
  cursor: pointer;
  display: flex;
  gap: 8px;
  height: 46px;
  justify-content: center;
  padding: 0 16px 0 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.khlt-ai-bubble:hover {
  border-color: rgba(249, 115, 22, 0.36);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

.khlt-ai-bubble__icon {
  align-items: center;
  background: var(--khlt-ai-ink);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  font-size: var(--khlt-ai-type-caption);
  font-weight: 850;
  height: 28px;
  justify-content: center;
  letter-spacing: -0.02em;
  width: 28px;
}

.khlt-ai-bubble__icon svg {
  display: block;
  height: 16px;
  stroke-width: 2.2;
  width: 16px;
}

.khlt-ai-bubble__text {
  display: inline-flex;
  font-size: var(--khlt-ai-type-action);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.khlt-ai-panel {
  background: var(--khlt-ai-surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  bottom: 62px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
  display: none;
  max-height: min(720px, calc(100vh - 120px));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: 396px;
}

.khlt-ai-consultation.is-open .khlt-ai-panel {
  display: flex;
  flex-direction: column;
}

.khlt-ai-header {
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.4), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #111827 100%);
  color: #ffffff;
  padding: 18px 20px;
}

.khlt-ai-header__top {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.khlt-ai-title {
  font-size: var(--khlt-ai-type-title);
  font-weight: 850;
  letter-spacing: -0.02em;
  margin: 0;
}

.khlt-ai-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--khlt-ai-type-caption);
  margin: 5px 0 0;
}

.khlt-ai-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: var(--khlt-ai-type-icon-lg);
  height: 34px;
  justify-content: center;
  width: 34px;
}

.khlt-ai-status {
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  font-size: var(--khlt-ai-type-caption);
  gap: 8px;
  margin-top: 12px;
}

.khlt-ai-status::before {
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
  content: "";
  display: inline-block;
  height: 8px;
  width: 8px;
}

.khlt-ai-status.is-error::before {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

.khlt-ai-body {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.khlt-ai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
  overflow-y: auto;
  padding: 16px;
}

.khlt-ai-message {
  border-radius: 16px;
  font-size: var(--khlt-ai-type-message);
  line-height: 1.6;
  max-width: 88%;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.khlt-ai-message--assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--khlt-ai-line);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.khlt-ai-message--visitor {
  align-self: flex-end;
  background: var(--khlt-ai-ink);
  color: #ffffff;
}

.khlt-ai-message--system {
  align-self: center;
  background: var(--khlt-ai-soft);
  border: 1px solid rgba(249, 115, 22, 0.22);
  color: var(--khlt-ai-primary-dark);
  font-size: var(--khlt-ai-type-caption);
  max-width: 96%;
}

.khlt-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}

.khlt-ai-chip {
  background: #ffffff;
  border: 1px solid var(--khlt-ai-line);
  border-radius: 999px;
  color: var(--khlt-ai-ink);
  cursor: pointer;
  font-size: var(--khlt-ai-type-caption);
  font-weight: 700;
  padding: 8px 10px;
}

.khlt-ai-chip:hover {
  border-color: rgba(249, 115, 22, 0.45);
  color: var(--khlt-ai-primary-dark);
}

.khlt-ai-lead {
  background: #ffffff;
  border-top: 1px solid var(--khlt-ai-line);
  display: none;
  padding: 14px 16px;
}

.khlt-ai-lead.is-visible {
  display: block;
}

.khlt-ai-lead__title {
  align-items: center;
  color: var(--khlt-ai-ink);
  display: flex;
  font-size: var(--khlt-ai-type-action);
  font-weight: 850;
  justify-content: space-between;
  margin-bottom: 10px;
}

.khlt-ai-lead__title button {
  background: transparent;
  border: 0;
  color: var(--khlt-ai-muted);
  cursor: pointer;
  font-size: var(--khlt-ai-type-icon);
}

.khlt-ai-form-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.khlt-ai-field--full {
  grid-column: 1 / -1;
}

.khlt-ai-input,
.khlt-ai-textarea {
  background: #f8fafc;
  border: 1px solid var(--khlt-ai-line);
  border-radius: 12px;
  color: var(--khlt-ai-ink);
  font: inherit;
  font-size: var(--khlt-ai-type-action);
  outline: none;
  padding: 10px 11px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.khlt-ai-input:focus,
.khlt-ai-textarea:focus {
  border-color: rgba(249, 115, 22, 0.75);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.khlt-ai-textarea {
  min-height: 64px;
  resize: vertical;
}

.khlt-ai-submit {
  align-items: center;
  background: var(--khlt-ai-primary);
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: var(--khlt-ai-type-action);
  font-weight: 850;
  justify-content: center;
  margin-top: 10px;
  padding: 11px 14px;
  width: 100%;
}

.khlt-ai-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.khlt-ai-composer {
  align-items: flex-end;
  background: #ffffff;
  border-top: 1px solid var(--khlt-ai-line);
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
}

.khlt-ai-composer textarea {
  max-height: 90px;
  min-height: 44px;
}

.khlt-ai-send {
  align-items: center;
  background: var(--khlt-ai-ink);
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: var(--khlt-ai-type-action);
  font-weight: 850;
  height: 44px;
  justify-content: center;
  padding: 0 14px;
}

.khlt-ai-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 640px) {
  .khlt-ai-consultation {
    bottom: 16px;
    left: 14px;
    right: 14px;
  }

  .khlt-ai-bubble {
    margin-left: auto;
  }

  .khlt-ai-panel {
    bottom: 62px;
    max-height: calc(100vh - 96px);
    right: 0;
    width: 100%;
  }
}
