/* KEYRANK — chat assistant widget */
.krc-root { --krc-red: #e63b2c; --krc-red2: #ff5640; --krc-navy: #0f172a; --krc-border: #e2e8f0; font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.krc-root *, .krc-root *::before, .krc-root *::after { box-sizing: border-box; }

/* Sits above the existing call / WhatsApp floating buttons */
.krc-launcher {
  position: fixed; right: 25px; bottom: 166px; z-index: 100000;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--krc-red) 0%, var(--krc-red2) 100%);
  box-shadow: 0 12px 28px -8px rgba(230, 59, 44, .6);
  transition: transform .2s ease;
}
.krc-launcher:hover { transform: scale(1.06); }
.krc-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--krc-red); }
.krc-dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.krc-dot[hidden] { display: none; }
.krc-root.is-open .krc-launcher { transform: rotate(0) scale(.92); }

.krc-teaser {
  position: fixed; right: 92px; bottom: 172px; z-index: 100000; max-width: 240px;
  background: #fff; color: var(--krc-navy); font-size: 14px; font-weight: 600; line-height: 1.4;
  padding: 12px 30px 12px 14px; border-radius: 14px 14px 4px 14px; cursor: pointer;
  box-shadow: 0 14px 34px -10px rgba(15, 23, 42, .35); border: 1px solid var(--krc-border);
  animation: krcIn .3s ease;
}
.krc-teaser[hidden] { display: none; }
.krc-teaser-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; color: #94a3b8; font-size: 18px; line-height: 1; cursor: pointer; }

.krc-panel {
  position: fixed; right: 25px; bottom: 234px; z-index: 100001;
  width: 370px; height: min(560px, calc(100vh - 260px)); min-height: 380px;
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 20px; border: 1px solid var(--krc-border);
  box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .45);
  animation: krcIn .25s ease;
}
.krc-panel[hidden] { display: none; }
@keyframes krcIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.krc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: var(--krc-navy); color: #fff; }
.krc-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, var(--krc-red), var(--krc-red2)); }
.krc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.krc-title strong { font-size: 15px; }
.krc-title span { font-size: 12px; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.krc-online { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; display: inline-block; }
.krc-wa, .krc-close { width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; font-size: 22px; line-height: 1; }
.krc-wa { background: #25d366; }
.krc-close:hover { background: rgba(255, 255, 255, .18); }

.krc-body { flex: 1; overflow-y: auto; padding: 16px 14px; background: #f8fafc; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.krc-msg { display: flex; }
.krc-msg.is-user { justify-content: flex-end; }
.krc-bubble { max-width: 85%; padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.is-bot .krc-bubble { background: #fff; color: #1e293b; border: 1px solid var(--krc-border); border-bottom-left-radius: 4px; }
.is-user .krc-bubble { background: var(--krc-red); color: #fff; border-bottom-right-radius: 4px; }
.krc-bubble a { color: inherit; font-weight: 700; text-decoration: underline; }
.is-bot .krc-bubble a { color: var(--krc-red); }

.krc-typing .krc-bubble { display: flex; gap: 4px; padding: 13px 14px; }
.krc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: krcDot 1s infinite ease-in-out; }
.krc-typing span:nth-child(2) { animation-delay: .15s; }
.krc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes krcDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.krc-quick { display: flex; gap: 8px; padding: 8px 12px 0; flex-wrap: wrap; background: #f8fafc; }
.krc-quick[hidden] { display: none; }
.krc-chip { border: 1px solid #fecaca; background: #fff; color: var(--krc-red); font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: 999px; cursor: pointer; font-family: inherit; }
.krc-chip:hover { background: var(--krc-red); color: #fff; border-color: var(--krc-red); }

.krc-wa-btn { display: inline-flex; align-items: center; gap: 8px; background: #25d366; color: #fff !important; text-decoration: none; font-weight: 700; font-size: 13.5px; padding: 9px 14px; border-radius: 999px; }
.krc-wa-btn::before { content: "💬"; }

.krc-lead { width: 100%; background: #fff; border: 1px solid var(--krc-border); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.krc-lead strong { font-size: 14px; color: var(--krc-navy); }
.krc-lead input, .krc-lead select, .krc-lead textarea { width: 100%; border: 1px solid var(--krc-border); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; color: #0f172a; background: #fff; }
.krc-lead input:focus, .krc-lead select:focus, .krc-lead textarea:focus { outline: none; border-color: var(--krc-red); box-shadow: 0 0 0 3px rgba(230, 59, 44, .12); }
.krc-lead button { border: 0; border-radius: 10px; padding: 10px; font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--krc-red), var(--krc-red2)); cursor: pointer; font-family: inherit; }
.krc-lead button:disabled { opacity: .7; cursor: wait; }
.krc-lead-err { color: #dc2626; font-size: 12.5px; min-height: 0; }
.krc-lead-err:empty { display: none; }
.krc-hp { position: absolute !important; left: -9999px !important; height: 0 !important; opacity: 0 !important; }

.krc-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--krc-border); background: #fff; }
.krc-input textarea { flex: 1; resize: none; border: 1px solid var(--krc-border); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.4; max-height: 110px; }
.krc-input textarea:focus { outline: none; border-color: var(--krc-red); }
.krc-input button { width: 42px; height: 42px; flex: 0 0 42px; border: 0; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--krc-red); cursor: pointer; }
.krc-foot { text-align: center; font-size: 11px; color: #94a3b8; padding: 0 0 8px; background: #fff; }
.krc-foot a { color: #64748b; }
.krc-root .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; }

@media (max-width: 575.98px) {
  .krc-launcher { right: 16px; bottom: 156px; width: 52px; height: 52px; }
  .krc-teaser { right: 78px; bottom: 160px; max-width: 200px; font-size: 13px; }
  .krc-panel { right: 0; left: 0; bottom: 0; width: 100%; height: 100%; max-height: none; min-height: 0; border-radius: 0; border: 0; }
  .krc-root.is-open .krc-launcher, .krc-root.is-open .krc-teaser { display: none; }
  .krc-input textarea { font-size: 16px; } /* prevents iOS zoom */
}
@media (prefers-reduced-motion: reduce) {
  .krc-panel, .krc-teaser { animation: none; }
  .krc-typing span { animation: none; }
}
