:root {
  --kc-orange: #E57500;
  --kc-orange-soft: #FFA567;
  --kc-navy: #1F3540;
  --kc-cream: #FFF7ED;
}

#kcDialog, #kcChat { box-sizing: border-box; }
#kcDialog *, #kcChat * { box-sizing: border-box; }

@keyframes kc-chat-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

#kcDialog {
  position: fixed; right: clamp(16px,3vw,24px); bottom: clamp(16px,3vw,24px); z-index: 10000;
  width: min(380px, calc(100vw - 32px)); font-family: Inter, -apple-system, sans-serif;
  animation: kc-chat-in .22s cubic-bezier(.21,.6,.35,1) both;
}
#kcDialog[hidden] { display: none; }
.kc-chat-link { color: #FFA567; text-decoration: none; font-weight: 600; }
.kc-chat-link:hover { text-decoration: underline; }
.kcd-card {
  width: 100%; max-height: min(78vh,640px); background: rgb(31,53,64); border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column; color: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.08);
}
.kcd-card header {
  padding: 12px 16px; background: linear-gradient(135deg, rgb(31,53,64) 0%, rgb(45,78,92) 50%, rgb(181,91,0) 130%);
  display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08);
}
.kcd-who { display: flex; align-items: center; gap: 10px; }
.kcd-av {
  width: 34px; height: 34px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.kcd-av img { width: 34px; height: 34px; object-fit: cover; }
.kcd-name { color: #fff; font-weight: 700; font-size: 14px; line-height: 1.1; letter-spacing: -.01em; }
.kcd-sub { color: rgba(255,255,255,.7); font-size: 11.5px; margin-top: 2px; }
.kcd-x {
  background: rgba(255,255,255,.1); border: 0; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.kcd-x:hover { background: rgba(255,255,255,.2); }
.kcd-body { padding: 20px 22px 18px; overflow-y: auto; color: #fff; display: flex; flex-direction: column; }
.kcd-body h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; font-family: "Space Grotesk", sans-serif; }
.kcd-disc {
  margin-top: 12px; padding: 12px 14px; background: rgba(255,165,103,.1); border: 1px solid rgba(255,165,103,.25);
  border-radius: 10px; font-size: 13px; line-height: 1.6; color: rgba(255,255,255,.92);
}
.kcd-disc b { font-weight: 700; color: #FFA567; margin-right: 6px; }
.kcd-body ul { padding-left: 18px; margin: 12px 0 0; font-size: 12.5px; line-height: 1.55; color: rgba(255,255,255,.78); }
.kcd-body li { margin-bottom: 6px; }
.kcd-agree { margin-top: 14px; font-size: 11.5px; color: rgba(255,255,255,.55); line-height: 1.5; }
.kcd-actions { display: flex; gap: 8px; margin-top: 14px; }
.kcd-cancel {
  flex: 0 0 auto; padding: 10px 16px; border-radius: 10px; background: transparent; color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.18); font: 600 13px Inter, sans-serif; cursor: pointer; transition: .15s;
}
.kcd-cancel:hover { background: rgba(255,255,255,.08); color: #fff; }
.kcd-start {
  flex: 1 1 0; padding: 10px 18px; border-radius: 10px; background: linear-gradient(135deg, #FFA567 0%, #E57500 100%);
  color: #fff; border: 0; font: 700 13px Inter, sans-serif; cursor: pointer; box-shadow: 0 6px 18px rgba(229,117,0,.35);
  transition: transform .15s, box-shadow .15s;
}
.kcd-start:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(229,117,0,.45); }

#kcChat {
  position: fixed; z-index: 10000; right: 16px; bottom: 91px; width: 400px; height: min(600px, calc(100vh - 107px));
  background: #fff; border-radius: 8px; box-shadow: 0 5px 40px rgba(0,0,0,.16);
  display: none; flex-direction: column; overflow: hidden; font-family: "Open Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: kc-chat-in .22s cubic-bezier(.21,.6,.35,1) both;
}
#kcChat.open { display: flex; }
@media (max-width: 639px) {
  #kcChat { right: 0; bottom: 0; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; border-radius: 0; }
}
#kcChat.kc-full {
  position: static; width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none;
  display: flex; animation: none;
}

.kcc-head {
  flex: 0 0 56px; height: 56px; background: var(--kc-orange); color: #fff; display: flex; align-items: center;
  padding: 0 10px 0 15px; gap: 0; position: relative; font-family: Inter, -apple-system, sans-serif;
}
.kcc-head-av { width: 40px; height: 40px; border-radius: 9999px; flex-shrink: 0; overflow: hidden; background: #2f6fb3; }
.kcc-head-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kcc-title { padding: 0 12px; font-weight: 600; font-size: 16px; line-height: 1.35; max-width: 190px; white-space: pre-wrap; }
.kcc-tools { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.kcc-tools button { background: transparent; border: 0; cursor: pointer; padding: 8px; margin: -8px; display: flex; color: #fff; }
.kcc-tools button:hover { opacity: .8; }
#kcMessages { flex: 1; overflow-y: scroll; padding: 14px 12px 6px; background: #fff; scroll-behavior: smooth; }
.kcm-row { display: flex; align-items: flex-start; margin: 0 50px 8px 0; }
.kcm-row.user { justify-content: flex-end; margin: 0 0 8px 50px; }
.kcm-av { width: 40px; height: 40px; border-radius: 9999px; flex-shrink: 0; object-fit: cover; overflow: hidden; }
.kcm-av.fallback { background: #2f6fb3; color: #fff; font: 700 15px Inter, sans-serif; display: flex; align-items: center; justify-content: center; }
.kcm-bubble {
  padding: 8px 16px; border-radius: 6px; font-size: 15px; line-height: 1.55; max-width: 100%; min-width: 0;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.kcm-bubble.bot { margin-left: 8px; background: var(--kc-cream); color: var(--kc-navy); }
.kcm-bubble.bot p { margin: 0 0 5.25px; white-space: pre-wrap; }
.kcm-bubble.bot p:last-child { margin-bottom: 0; }
.kcm-bubble.bot a { color: #E57500; text-decoration: underline; word-break: break-all; }
.kcm-bubble.bot a:hover { opacity: .8; }
.kcm-bubble.user { background: var(--kc-orange); color: #fff; }
.kcm-bubble.error { background: #FDECEC; color: #8A1F1F; }
.kcm-typing { margin-left: 8px; display: inline-flex; gap: 4px; padding: 14px 16px; background: #F0F1F3; border-radius: 6px; }
.kcm-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9AA4AB; animation: kc-blink 1.2s infinite ease-in-out; }
.kcm-typing span:nth-child(2) { animation-delay: .15s; }
.kcm-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes kc-blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.kcc-warn { flex: 0 0 auto; margin: 0 20px 6px; padding: 6px 10px; border-radius: 6px; background: #FDECEC; color: #8A1F1F; font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; }
.kcc-warn[hidden] { display: none; }
.kcc-inputwrap { flex: 0 0 auto; padding: 0 20px 5px; }
.kcc-input {
  display: flex; align-items: center; height: 56px; background: #fff; border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.08); padding: 0 0 0 16px;
}
#kcInput { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 15px Poppins, sans-serif; color: #303235; padding: 0; }
#kcInput::placeholder { color: #A9B1B6; }
.kcc-input button { background: transparent; border: 0; cursor: pointer; height: 56px; padding: 0 16px; display: flex; align-items: center; }
.kcc-input button:disabled { opacity: .5; cursor: default; }
.kcc-foot { flex: 0 0 auto; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 4px; text-align: center; font-size: 13px; color: #303235; padding: 6px 10px 10px; }
.kcc-foot a { font-weight: 700; text-decoration: none; color: #303235; }
.kcc-foot a:hover { text-decoration: underline; }
