/* Kamayo customer support chat widget (Chat V1, Phase 3). Every class starts with "kmchat" so it cannot clash with the site. */
#kmchat{--kmchat-green:var(--km-green,#16a34a);--kmchat-green-dark:var(--km-green-dark,#15803d);--kmchat-soft:var(--km-green-soft,#ecfdf3);--kmchat-ink:#1f2937;--kmchat-muted:#6b7280;--kmchat-line:#e5e7eb;font-family:inherit;font-size:15px;line-height:1.4;color:var(--kmchat-ink)}
#kmchat *,#kmchat *::before,#kmchat *::after{box-sizing:border-box}
#kmchat [hidden]{display:none !important}

/* ONE floating help button: the old WhatsApp float is hidden (this stylesheet only loads when the chat widget is shown, so
   guests / the app WebView / chat-OFF keep the plain WhatsApp button). WhatsApp moves into the launcher's menu. */
.km-whatsapp-float{display:none !important}
/* launcher: takes the old WhatsApp button's place (bottom-right, above the mobile bottom nav) */
.kmchat-launcher{position:fixed;right:20px;bottom:20px;z-index:9998;width:54px;height:54px;border-radius:50%;border:0;background:var(--kmchat-green);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 10px rgba(0,0,0,.28);padding:0}
.kmchat-launcher:hover{background:var(--kmchat-green-dark)}
.kmchat-launcher svg{width:26px;height:26px;fill:currentColor}
.kmchat-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;border-radius:10px;background:#dc2626;color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 5px}
body.km-has-bottom-nav .kmchat-launcher{bottom:calc(78px + env(safe-area-inset-bottom))}
@media (max-width:600px){.kmchat-launcher{right:16px;bottom:16px;width:50px;height:50px}}

/* the two-choice menu above the launcher */
.kmchat-menu{position:fixed;right:20px;bottom:86px;z-index:9999;width:290px;max-width:calc(100vw - 32px);background:#fff;border:1px solid var(--kmchat-line);border-radius:14px;box-shadow:0 10px 32px rgba(0,0,0,.22);padding:8px;display:flex;flex-direction:column;gap:6px}
body.km-has-bottom-nav .kmchat-menu{bottom:calc(144px + env(safe-area-inset-bottom))}
@media (max-width:600px){.kmchat-menu{right:16px;bottom:82px}body.km-has-bottom-nav .kmchat-menu{bottom:calc(144px + env(safe-area-inset-bottom))}}
.kmchat-menu__item{display:block;width:100%;text-align:left;text-decoration:none;color:var(--kmchat-ink);background:#fff;border:1px solid var(--kmchat-line);border-radius:10px;padding:10px 12px;cursor:pointer;font:inherit}
.kmchat-menu__item strong{display:block;font-size:15px;margin-bottom:2px}
.kmchat-menu__item span{display:block;font-size:12.5px;line-height:1.35;color:var(--kmchat-muted)}
.kmchat-menu__chat strong{color:var(--kmchat-green-dark)}
.kmchat-menu__wa strong{color:#128c7e}
.kmchat-menu__item:hover{background:#f9fafb;border-color:#cbd5e1}

.kmchat-panel{position:fixed;right:20px;bottom:86px;z-index:9999;width:360px;max-width:calc(100vw - 24px);height:520px;max-height:calc(100vh - 110px);background:#fff;border:1px solid var(--kmchat-line);border-radius:14px;box-shadow:0 10px 32px rgba(0,0,0,.22);display:flex;flex-direction:column;overflow:hidden}
.kmchat-head{display:flex;align-items:center;gap:8px;padding:10px 12px;background:var(--kmchat-green);color:#fff}
.kmchat-title{flex:1;font-weight:700;font-size:16px;margin:0}
.kmchat-head button{background:transparent;border:0;color:#fff;cursor:pointer;border-radius:6px;padding:4px 8px;font-size:13px}
.kmchat-head button:hover{background:rgba(255,255,255,.18)}
.kmchat-minimize{font-size:20px;line-height:1}

.kmchat-bar{display:flex;flex-wrap:wrap;gap:6px;padding:8px 10px;background:var(--kmchat-soft);border-bottom:1px solid var(--kmchat-line)}
.kmchat-bar button{border:1px solid var(--kmchat-green);background:#fff;color:var(--kmchat-green-dark);border-radius:16px;padding:5px 12px;font-size:13px;cursor:pointer}
.kmchat-bar button:hover:not(:disabled){background:var(--kmchat-green);color:#fff}
.kmchat-bar button:disabled{opacity:.6;cursor:default}
.kmchat-orderchip{align-self:center;font-size:12px;color:var(--kmchat-green-dark);font-weight:600}

.kmchat-banner{padding:6px 12px;font-size:12.5px;background:#fffbeb;color:#92400e;border-bottom:1px solid #fde68a}
.kmchat-notice{padding:8px 12px;font-size:13px}
.kmchat-notice--info{background:var(--kmchat-soft);color:var(--kmchat-green-dark)}
.kmchat-notice--error{background:#fef2f2;color:#b91c1c}
.kmchat-link{color:inherit;font-weight:700;text-decoration:underline}

.kmchat-orders{max-height:170px;overflow:auto;border-bottom:1px solid var(--kmchat-line);padding:6px}
.kmchat-orderitem{display:flex;justify-content:space-between;gap:8px;width:100%;text-align:left;background:#fff;border:1px solid var(--kmchat-line);border-radius:8px;padding:8px 10px;margin-bottom:6px;cursor:pointer;font-size:13px}
.kmchat-orderitem:hover{border-color:var(--kmchat-green)}
.kmchat-orderitem span{color:var(--kmchat-muted)}

.kmchat-messages{flex:1;overflow-y:auto;padding:12px;background:#f9fafb;display:flex;flex-direction:column;gap:8px;-webkit-overflow-scrolling:touch}
.kmchat-empty{color:var(--kmchat-muted);font-size:13.5px;text-align:center;margin:auto 0;padding:10px}
.kmchat-more{align-self:center;background:#fff;border:1px solid var(--kmchat-line);border-radius:14px;padding:4px 12px;font-size:12.5px;cursor:pointer;color:var(--kmchat-muted)}
.kmchat-msg{max-width:84%;padding:8px 11px;border-radius:12px;word-wrap:break-word;overflow-wrap:anywhere}
.kmchat-who{display:block;font-size:11.5px;font-weight:700;margin-bottom:2px;opacity:.75}
.kmchat-text{white-space:pre-wrap}
.kmchat-time,.kmchat-state{display:block;font-size:11px;margin-top:3px;opacity:.7}
.kmchat-msg--customer{align-self:flex-end;background:var(--kmchat-green);color:#fff;border-bottom-right-radius:4px}
.kmchat-msg--agent,.kmchat-msg--bot{align-self:flex-start;background:#fff;border:1px solid var(--kmchat-line);border-bottom-left-radius:4px}
.kmchat-msg--system{align-self:center;max-width:92%;background:transparent;color:var(--kmchat-muted);font-size:12.5px;text-align:center;padding:2px 8px}
.kmchat-msg--pending{opacity:.7}
.kmchat-msg--failed{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.kmchat-retry{background:#fff;border:1px solid #b91c1c;color:#b91c1c;border-radius:10px;padding:1px 8px;font-size:12px;cursor:pointer;margin-left:4px}

.kmchat-form{display:flex;align-items:flex-end;gap:8px;padding:8px 10px;border-top:1px solid var(--kmchat-line);background:#fff}
.kmchat-input{flex:1;resize:none;border:1px solid #d1d5db;border-radius:10px;padding:8px 10px;font:inherit;max-height:120px;min-height:38px}
.kmchat-send{border:0;background:var(--kmchat-green);color:#fff;border-radius:10px;padding:0 16px;height:38px;font-weight:700;cursor:pointer}
.kmchat-send:hover{background:var(--kmchat-green-dark)}
.kmchat-sr{position:absolute !important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

#kmchat button:focus-visible,#kmchat textarea:focus-visible,#kmchat a:focus-visible{outline:3px solid #2563eb;outline-offset:2px}

/* phones: a bottom sheet that uses the full width */
@media (max-width:600px){
    .kmchat-panel{right:0;left:0;bottom:0;width:100%;max-width:100%;height:min(82vh,640px);max-height:none;border-radius:16px 16px 0 0;padding-bottom:env(safe-area-inset-bottom)}
    .kmchat-input{font-size:16px}   /* 16px stops iOS zooming into the field */
    #kmchat.kmchat--open .kmchat-launcher{display:none}
}
@media (prefers-reduced-motion:no-preference){.kmchat-panel{animation:kmchat-in .16s ease-out}@keyframes kmchat-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}}

/* clickable links inside bot answers: the usual blue, underlined, so it is clear they can be tapped */
.kmchat-link,.kmchat-link:visited{color:#0b57d0;text-decoration:underline;text-underline-offset:2px;font-weight:600;cursor:pointer}
.kmchat-link:hover{color:#0842a0}

/* Guest Help (Route 1): static "login to chat" panel, no messages, no form */
.kmchat-panel--guest{height:auto;max-height:calc(100vh - 110px)}
.kmchat-guest{padding:22px 18px 24px;text-align:center;background:#f9fafb}
.kmchat-guest__msg{margin:0 0 16px;font-size:17px;font-weight:700;color:var(--kmchat-ink)}
.kmchat-guest__login{display:inline-block;background:var(--kmchat-green);color:#fff;text-decoration:none;font-weight:700;padding:10px 28px;border-radius:22px}
.kmchat-guest__login:hover{background:var(--kmchat-green-dark);color:#fff}
