/* KPhysio AI Assistant – clean chat UI v0.3.4
   Scope: assistant widget only. No page/header/SEO layout is modified. */
#kphysio-ai-root{
  --kai:#1B7771;
  --kai-2:#009879;
  --kai-dark:#073f4f;
  --kai-deep:#053244;
  --kai-soft:#eef9f7;
  --kai-border:#d8e9e6;
  --kai-ink:#153945;
  --kai-muted:#72868d;
  --kai-shadow:0 22px 70px rgba(5,48,58,.24),0 7px 24px rgba(5,48,58,.12);
  position:fixed;
  z-index:2147482000;
  right:20px;
  bottom:24px;
  color:var(--kai-ink);
  font-family:inherit;
  pointer-events:none;
  opacity:0;
  transform:translateY(12px);
  transition:opacity .25s ease,transform .25s ease;
}
#kphysio-ai-root.kai-ready{opacity:1;transform:none}
#kphysio-ai-root *{box-sizing:border-box}
#kphysio-ai-root button,#kphysio-ai-root textarea,#kphysio-ai-root a{font-family:inherit}

.kai-launch-wrap{display:flex;align-items:center;gap:10px;justify-content:flex-end;pointer-events:auto}
.kai-launch-hint{max-width:190px;padding:9px 12px;border:1px solid rgba(27,119,113,.18);border-radius:14px 14px 4px 14px;background:rgba(255,255,255,.97);color:#173b46;box-shadow:0 9px 28px rgba(4,46,56,.14);font-size:12px;font-weight:700;line-height:1.25}
.kai-launch{position:relative;width:68px;height:68px;padding:0;border:0;border-radius:50%;background:linear-gradient(145deg,#12b7aa,#06645f);box-shadow:0 13px 32px rgba(0,94,91,.30),0 0 0 5px rgba(35,210,190,.11);display:grid;place-items:center;cursor:pointer;overflow:hidden}
.kai-launch:hover{box-shadow:0 16px 40px rgba(0,94,91,.38),0 0 0 6px rgba(35,210,190,.13)}
.kai-launch:focus-visible{outline:3px solid rgba(0,152,121,.32);outline-offset:3px}
.kai-launch img{width:58px;height:58px;object-fit:contain;display:block}
.kai-launch-badge{position:absolute;top:3px;right:3px;width:12px;height:12px;border-radius:50%;background:#35d988;border:2px solid #fff;box-shadow:0 0 0 3px rgba(53,217,136,.16)}
.kai-icon-fallback::before{content:'✦';color:#fff;font-size:26px;font-weight:900}

.kai-panel{display:none;position:absolute;right:0;bottom:0;width:min(420px,calc(100vw - 28px));height:min(640px,calc(100dvh - 112px));min-height:490px;background:#fff;border:1px solid rgba(27,119,113,.22);border-radius:23px;box-shadow:var(--kai-shadow);overflow:hidden;pointer-events:auto;isolation:isolate}
.kai-panel.open{display:flex;flex-direction:column;animation:kaiPanelIn .18s ease-out}
@keyframes kaiPanelIn{from{opacity:0;transform:translateY(8px) scale(.99)}to{opacity:1;transform:none}}

.kai-head{flex:0 0 auto;min-height:82px;padding:13px 14px;display:flex;justify-content:space-between;align-items:center;gap:12px;color:#fff;background:radial-gradient(circle at 18% 0%,rgba(47,220,200,.22),transparent 38%),linear-gradient(135deg,#0a716e 0%,#006e72 48%,#063d58 100%);border-bottom:1px solid rgba(255,255,255,.18)}
.kai-brand{display:flex;align-items:center;min-width:0;gap:11px}.kai-brand-icon{width:52px;height:52px;flex:0 0 52px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.34);box-shadow:0 7px 22px rgba(0,35,44,.20);overflow:hidden}.kai-brand-icon img{display:block;width:48px;height:48px;object-fit:contain}.kai-brand-copy{min-width:0}.kai-head strong{display:block;font-size:17px;line-height:1.15;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kai-status{display:flex;align-items:center;gap:7px;margin-top:5px;color:rgba(255,255,255,.88);font-size:12px;line-height:1.2}.kai-status-dot{width:8px;height:8px;border-radius:50%;background:#43df8e;box-shadow:0 0 0 4px rgba(67,223,142,.13)}
.kai-head-actions{display:flex;gap:7px;flex:0 0 auto}.kai-head button{width:36px;height:36px;padding:0;display:grid;place-items:center;border:1px solid rgba(255,255,255,.15);border-radius:50%;background:rgba(255,255,255,.10);color:#fff;font-size:20px;cursor:pointer}.kai-head button:hover{background:rgba(255,255,255,.18)}

.kai-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 15px 14px;background:linear-gradient(180deg,#fff 0%,#fbfefe 55%,#f7fbfa 100%);scrollbar-width:thin;scrollbar-color:#b8cfcb transparent;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}.kai-body::-webkit-scrollbar{width:6px}.kai-body::-webkit-scrollbar-thumb{background:#bfd4d0;border-radius:99px}
.kai-msg-row{display:flex;align-items:flex-end;gap:8px;width:100%;margin:10px 0}.kai-msg-row.user{justify-content:flex-end}.kai-msg-avatar{width:34px;height:34px;flex:0 0 34px;border-radius:50%;overflow:hidden;display:grid;place-items:center;background:#e8f7f5;border:1px solid #d0e9e5;box-shadow:0 3px 12px rgba(18,96,91,.09)}.kai-msg-avatar img{width:32px;height:32px;object-fit:contain}.kai-msg{max-width:82%;padding:11px 13px;border-radius:17px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.48;box-shadow:0 3px 12px rgba(15,71,74,.055)}.kai-msg.assistant{background:#edf8f7;border:1px solid #e1efed;border-bottom-left-radius:6px;color:#183b45}.kai-msg.user{background:linear-gradient(135deg,#0d807a,#08706e);color:#fff;border:1px solid rgba(0,0,0,.02);border-bottom-right-radius:6px;margin-left:auto}.kai-msg.operator{background:#e9f0ff;border:1px solid #dae5fb;border-bottom-left-radius:6px;color:#17394b}.kai-msg.system{max-width:100%;margin:8px auto;padding:6px 10px;background:transparent;box-shadow:none;text-align:center;color:var(--kai-muted);font-size:11px}.kai-msg .kai-action{margin-top:9px}
.kai-typing{display:inline-flex;align-items:center;gap:6px;margin:4px 0 5px 42px;padding:7px 10px;border-radius:999px;background:#eef7f6;color:var(--kai-muted);font-size:11px}.kai-typing::before{content:'•••';letter-spacing:2px;color:var(--kai)}
.kai-action.payment{display:inline-block;text-decoration:none;background:linear-gradient(135deg,#0b8d84,#08726f);color:#fff;border:1px solid #08726f;text-align:center;border-radius:11px;padding:10px 12px;font-weight:750;font-size:12px}

.kai-bottom{flex:0 0 auto;background:#fff;border-top:1px solid #e8f0ef;padding-bottom:max(0px,env(safe-area-inset-bottom))}
.kai-consent{padding:7px 12px 0;color:#718286;font-size:9.5px;line-height:1.3;transition:opacity .18s ease,max-height .18s ease,padding .18s ease}.kai-consent label{display:flex;gap:7px;align-items:flex-start}.kai-consent input{width:14px;height:14px;flex:0 0 14px;margin:0;margin-top:1px;accent-color:var(--kai)}.kai-consent a{color:#14736e;text-decoration:none;font-weight:700}.kai-consent.kai-consent-done{max-height:0;overflow:hidden;opacity:0;padding-top:0}.kai-consent.kai-consent-attention{animation:kaiConsentPulse .7s ease}@keyframes kaiConsentPulse{50%{background:#fff1df}}
.kai-compose{display:flex;align-items:flex-end;gap:8px;padding:9px 11px 8px;background:#fff}.kai-compose textarea{flex:1;min-width:0;resize:none;overflow-y:auto;height:46px;max-height:112px;border:1px solid #cbdedb;border-radius:16px;padding:12px 13px;background:#fff;color:#183944;font-size:14px;line-height:1.35;outline:none}.kai-compose textarea::placeholder{color:#8a9ca2}.kai-compose textarea:focus{border-color:#66bdb3;box-shadow:0 0 0 3px rgba(0,152,121,.10)}.kai-send{width:46px;height:46px;flex:0 0 46px;border:0;border-radius:50%;background:linear-gradient(145deg,#10a39a,#08716f);color:#fff;font-size:19px;cursor:pointer;box-shadow:0 7px 18px rgba(0,126,118,.22)}.kai-note{padding:0 12px 9px;background:#fff;color:#718286;text-align:center;font-size:9.5px;line-height:1.3}.kai-hidden{display:none!important}

@media (max-width:600px){
  html:has(body.kai-chat-lock){overscroll-behavior:none}
  body.kai-chat-lock{position:fixed!important;left:0!important;right:0!important;width:100%!important;overflow:hidden!important;overscroll-behavior:none!important}
  #kphysio-ai-root{right:10px;bottom:16px;left:auto}
  #kphysio-ai-root.kai-open{left:0!important;right:0!important;top:0!important;bottom:0!important;width:100vw!important;height:100dvh!important;transform:none!important;opacity:1!important;background:#fff;pointer-events:auto}
  .kai-launch-hint{display:none}.kai-launch{width:62px;height:62px}.kai-launch img{width:54px;height:54px}
  .kai-panel,.kai-panel.open{position:fixed!important;left:0!important;right:0!important;top:var(--kai-vvo,0px)!important;bottom:auto!important;width:100vw!important;height:var(--kai-vvh,100dvh)!important;min-height:0!important;max-height:none!important;border:0!important;border-radius:0!important;box-shadow:none!important;margin:0!important}
  .kai-head{min-height:74px;padding:calc(10px + env(safe-area-inset-top)) 12px 10px}.kai-brand-icon{width:46px;height:46px;flex-basis:46px}.kai-brand-icon img{width:43px;height:43px}.kai-head strong{font-size:15px}.kai-status{font-size:11px;margin-top:4px}.kai-head button{width:36px;height:36px}.kai-minimize{display:none!important}
  .kai-body{padding:13px 11px 12px;scroll-padding-bottom:16px}.kai-msg{max-width:87%;font-size:14px;padding:10px 11px}.kai-msg-avatar{width:31px;height:31px;flex-basis:31px}.kai-msg-avatar img{width:29px;height:29px}.kai-msg.system{font-size:10.5px}
  .kai-bottom{padding-bottom:max(4px,env(safe-area-inset-bottom));box-shadow:0 -8px 24px rgba(14,62,66,.05)}.kai-consent{padding:6px 10px 0;font-size:9px}.kai-compose{padding:8px 9px 7px}.kai-compose textarea{min-height:44px;height:44px;font-size:15px;border-radius:15px}.kai-send{width:44px;height:44px;flex-basis:44px}.kai-note{padding:0 10px 7px;font-size:8.5px}
}

@media (max-width:380px){.kai-head strong{font-size:14px}.kai-msg{max-width:89%}}
@media (prefers-reduced-motion:reduce){#kphysio-ai-root,.kai-launch,.kai-panel.open,.kai-send{animation:none!important;transition:none!important}}
