/* Public chat widget. All selectors are scoped to the chat module. */
.chat-launcher{
  border:0;cursor:pointer;display:flex;align-items:center;gap:14px;max-width:min(420px,calc(100vw - 24px));
  font:700 14px/1.2 "Roboto Condensed",Arial,sans-serif;transition:opacity .24s ease,transform .24s ease,box-shadow .2s ease;
}
.chat-launcher:hover{box-shadow:0 18px 48px rgba(27,53,88,.2);transform:translateY(-2px)}
.chat-launcher:after{display:none}
.chat-launcher i{font-style:normal;display:grid;place-items:center;width:28px;height:100%;position:absolute;right:0;top:0;background:#20c96b;border-radius:0 16px 0 0}
.chat-launcher b[data-chat-unread]{position:absolute;right:21px;top:-8px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#ff4057;color:#fff;display:grid;place-items:center;font-size:11px;box-shadow:0 5px 15px rgba(174,18,47,.3)}
.chat-launcher.chat-is-open{opacity:0;pointer-events:none;transform:translateY(16px)}

.site-chat{position:fixed;right:28px;bottom:70px;width:min(380px,calc(100vw - 28px));height:min(570px,calc(100dvh - 110px));z-index:110;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(28px) scale(.965);transform-origin:bottom right;transition:opacity .26s ease,transform .32s cubic-bezier(.2,.8,.2,1),visibility 0s linear .32s}
.site-chat.is-open{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0) scale(1);transition:opacity .22s ease,transform .32s cubic-bezier(.2,.8,.2,1),visibility 0s}
.site-chat.is-dragging{transition:none;user-select:none}
.site-chat-card{height:100%;background:#fff;border:1px solid rgba(14,79,163,.13);border-radius:18px 18px 10px 10px;overflow:hidden;display:grid;grid-template-rows:auto minmax(0,1fr) auto;box-shadow:0 26px 80px rgba(20,45,78,.25)}
.site-chat-header{position:relative;min-height:72px;padding:12px 14px 12px 16px;color:#fff;background:linear-gradient(110deg,#0967e9 0%,#0b92d2 62%,#0bc0b6 100%);display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:grab;touch-action:none}
.site-chat-header:after{content:"";position:absolute;right:0;top:0;width:28px;height:28px;background:#20c96b;border-radius:0 18px 0 28px}
.site-chat.is-dragging .site-chat-header{cursor:grabbing}
.site-chat-person{display:flex;align-items:center;gap:11px;min-width:0}
.site-chat-person img{width:46px;height:46px;border-radius:50%;object-fit:cover;border:2px solid rgba(255,255,255,.88);background:#fff;flex:0 0 auto}
.site-chat-person div{display:grid;gap:2px;min-width:0}
.site-chat-person b{font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.site-chat-person small{font-size:12px;color:rgba(255,255,255,.82)}
.site-chat-close{position:relative;z-index:2;width:34px;height:34px;border:1px solid rgba(255,255,255,.48);border-radius:50%;background:rgba(255,255,255,.13);color:#fff;font-size:25px;line-height:1;display:grid;place-items:center;cursor:pointer;transition:background .18s ease,transform .18s ease}
.site-chat-close:hover{background:rgba(255,255,255,.24);transform:rotate(4deg)}
.site-chat-body{min-height:0;overflow-y:auto;background:#fff;scrollbar-width:thin;scrollbar-color:#c9ced6 transparent;padding:12px 10px 10px}
.site-chat-body::-webkit-scrollbar{width:6px}.site-chat-body::-webkit-scrollbar-thumb{background:#c9ced6;border-radius:10px}
.site-chat-messages{display:grid;gap:10px;padding:0 2px 8px}
.site-chat-message{display:flex;align-items:flex-end;gap:7px;animation:chatMessageIn .2s ease both}
.site-chat-message.bot{justify-content:flex-start}.site-chat-message.visitor{justify-content:flex-end}
.site-chat-message-avatar{width:29px;height:29px;border-radius:50%;object-fit:cover;flex:0 0 auto;background:#eef3f8}
.site-chat-bubble{position:relative;max-width:82%;padding:10px 12px 18px;border-radius:15px;font:400 15px/1.34 "Roboto Condensed",Arial,sans-serif;white-space:pre-wrap;word-break:break-word}
.site-chat-message.bot .site-chat-bubble{background:#f0f3f5;color:#2e333b;border-bottom-left-radius:5px;box-shadow:0 2px 4px rgba(30,50,70,.08)}
.site-chat-message.visitor .site-chat-bubble{background:#fff;color:#1766d8;border:1px solid #2c7af0;border-bottom-right-radius:5px;box-shadow:0 3px 9px rgba(23,102,216,.1)}
.site-chat-bubble time{position:absolute;right:9px;bottom:4px;color:#98a0aa;font-size:10px;line-height:1}
.site-chat-quick{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px;padding:3px 2px 8px}
.site-chat-quick button{border:1px solid #2b78ee;background:#fff;color:#2870dc;border-radius:999px;padding:8px 14px;font:400 14px/1.15 "Roboto Condensed",Arial,sans-serif;cursor:pointer;box-shadow:0 2px 7px rgba(23,102,216,.1);transition:background .15s,color .15s,transform .15s}
.site-chat-quick button:hover{background:#eef5ff;transform:translateY(-1px)}
.site-chat-quick button:disabled{opacity:.55;cursor:wait;transform:none}
.site-chat-composer{border-top:1px solid #e3e7ed;background:#fff;padding:10px;display:grid;grid-template-columns:minmax(0,1fr) 38px;gap:8px;align-items:end}
.site-chat-composer textarea{width:100%;max-height:90px;min-height:38px;resize:none;border:0;outline:0;padding:9px 4px;color:#303743;font:400 15px/1.3 "Roboto Condensed",Arial,sans-serif;background:transparent}
.site-chat-composer textarea::placeholder{color:#9aa3af}
.site-chat-composer button{width:38px;height:38px;border:0;border-radius:50%;background:#e9edf2;color:#fff;font-size:21px;cursor:pointer;transition:background .18s,transform .18s}
.site-chat-composer:focus-within button,.site-chat-composer button.ready{background:#126bea}
.site-chat-composer button:hover{transform:translateY(-1px)}
.site-chat-loading{color:#87919e;text-align:center;padding:24px 10px;font-size:13px}
@keyframes chatMessageIn{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}

@media(max-width:700px){
  .site-chat{left:8px!important;right:8px!important;top:auto!important;bottom:8px!important;width:auto;height:min(76dvh,620px);transform-origin:bottom center}
  .site-chat-card{border-radius:17px}
  .site-chat-header{cursor:default;touch-action:auto}
  .chat-launcher{right:0;bottom:0;border-radius:15px 0 0 0;max-width:calc(100vw - 18px);padding-left:16px;font-size:13px}
  .chat-launcher i{border-radius:0}
  .to-top{bottom:58px}
}
@media(max-width:420px){
  .site-chat{left:0!important;right:0!important;bottom:0!important;height:min(82dvh,660px)}
  .site-chat-card{border-radius:16px 16px 0 0}
  .site-chat-bubble{max-width:86%}
}
@media(prefers-reduced-motion:reduce){.site-chat,.chat-launcher,.site-chat-message{transition:none!important;animation:none!important}}

/* Chat identities, operator mode and visitor profile prompt. */
.site-chat [hidden]{display:none!important}
.site-chat-card{position:relative}
.site-chat-message.bot,.site-chat-message.operator{justify-content:flex-start}
.site-chat-message.operator .site-chat-bubble{background:#eaf3ff;color:#20354f;border:1px solid #d3e4fb;border-bottom-left-radius:5px;box-shadow:0 2px 5px rgba(30,78,135,.09)}
.site-chat-author{display:block;margin:0 0 4px;color:#68798b;font-size:10px;font-weight:700;line-height:1.2}
.site-chat-message-text{display:block}
.site-chat-system-message{align-self:center;max-width:92%;margin:2px auto;padding:6px 10px;border-radius:999px;background:#f3f6f9;color:#758292;text-align:center;font-size:11px;line-height:1.25;animation:chatMessageIn .2s ease both}
.site-chat-system-message time{margin-left:6px;color:#a0a8b1;font-size:9px}
.site-chat-typing{display:flex;align-items:center;gap:4px;width:max-content;margin:1px 0 8px 38px;padding:8px 11px;border-radius:14px 14px 14px 5px;background:#f0f3f5;color:#83909d;font-size:11px}
.site-chat-typing span{width:5px;height:5px;border-radius:50%;background:#8a96a3;animation:chatTyping 1.15s infinite ease-in-out}
.site-chat-typing span:nth-child(2){animation-delay:.14s}.site-chat-typing span:nth-child(3){animation-delay:.28s}
.site-chat-typing em{margin-left:3px;font-style:normal}
@keyframes chatTyping{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-3px);opacity:1}}
.site-chat-closed{border-top:1px solid #e3e7ed;background:#fff;padding:13px 14px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.site-chat-closed p{margin:0;color:#667484;font-size:13px}
.site-chat-closed button{border:0;border-radius:999px;padding:9px 13px;background:#126bea;color:#fff;font:700 12px/1.1 "Roboto Condensed",Arial,sans-serif;cursor:pointer;white-space:nowrap}
.site-chat-name-prompt{position:absolute;inset:0;z-index:8;display:grid;place-items:center;padding:18px;background:rgba(23,38,56,.32);backdrop-filter:blur(3px);opacity:0;transition:opacity .18s ease}
.site-chat-name-prompt.is-visible{opacity:1}
.site-chat-name-prompt form{position:relative;width:min(310px,100%);padding:22px;border-radius:17px;background:#fff;box-shadow:0 22px 70px rgba(18,43,74,.28);display:grid;gap:14px;transform:translateY(8px) scale(.98);animation:chatPromptIn .22s ease forwards}
.site-chat-name-prompt b{font-size:18px;color:#253141}
.site-chat-name-prompt input{width:100%;border:1px solid #d9e1eb;border-radius:11px;padding:11px 12px;outline:none;font:400 15px/1.2 "Roboto Condensed",Arial,sans-serif}
.site-chat-name-prompt input:focus{border-color:#6da4ef;box-shadow:0 0 0 3px rgba(18,107,234,.11)}
.site-chat-name-prompt form>div{display:flex;justify-content:flex-end;gap:8px}
.site-chat-name-prompt form>div button{border:0;border-radius:999px;padding:9px 14px;background:#126bea;color:#fff;font:700 12px/1 "Roboto Condensed",Arial,sans-serif;cursor:pointer}
.site-chat-name-prompt form>div button.secondary{background:#eef2f6;color:#657181}
.site-chat-name-close{position:absolute;right:9px;top:8px;width:28px;height:28px;border:0;border-radius:50%;background:transparent;color:#8a94a1;font-size:20px;cursor:pointer}
@keyframes chatPromptIn{to{transform:translateY(0) scale(1)}}

@media(max-width:520px){
  .site-chat-closed{align-items:stretch;flex-direction:column}.site-chat-closed button{width:100%}
  .site-chat-name-prompt{padding:12px}.site-chat-name-prompt form{width:100%}
}

/* Patch 07: hidden must win over the flex declaration below. */
.site-chat-typing[hidden]{display:none!important}


/* Patch 08: client emoji picker and refreshed composer. */
.site-chat-composer{position:relative;grid-template-columns:38px minmax(0,1fr) 40px;padding:9px 10px 10px;background:#fff}
.site-chat-composer textarea{grid-column:2;min-height:40px;padding:10px 5px}
.site-chat-composer [data-chat-send]{grid-column:3;width:40px;height:40px;background:#e8edf4;box-shadow:none}
.site-chat-composer:focus-within [data-chat-send],.site-chat-composer [data-chat-send].ready{background:#126bea;box-shadow:0 7px 18px rgba(18,107,234,.22)}
.site-chat-emoji-trigger{
  grid-column:1;width:38px!important;height:40px!important;border:1px solid #e1e6ed!important;border-radius:12px!important;
  background:#f6f8fb!important;color:#6f7b89!important;font-size:22px!important;box-shadow:none!important;
}
.site-chat-emoji-trigger:hover,.site-chat-emoji-trigger.active{background:#eaf3ff!important;color:#126bea!important;border-color:#9fc1f3!important}
.site-chat-emoji-picker{
  position:absolute;left:9px;bottom:58px;z-index:15;width:276px;max-width:calc(100% - 18px);padding:9px;
  display:grid;grid-template-columns:repeat(6,1fr);gap:3px;border:1px solid #dce5ef;border-radius:15px;background:#fff;
  box-shadow:0 18px 48px rgba(23,45,76,.22);
}
.site-chat-emoji-picker[hidden]{display:none!important}
.site-chat-emoji-picker button{
  width:39px!important;height:37px!important;padding:0!important;border:0!important;border-radius:9px!important;
  background:transparent!important;color:inherit!important;font-size:21px!important;box-shadow:none!important;
}
.site-chat-emoji-picker button:hover{background:#edf4ff!important;transform:scale(1.1)}
@media(max-width:420px){.site-chat-emoji-picker{width:270px;grid-template-columns:repeat(6,1fr)}}

/* Patch 20: keep the automatically opened chat fully inside the viewport. */
.site-chat{max-height:calc(100dvh - 86px)}
@media(max-width:700px){
  .site-chat{bottom:max(10px,env(safe-area-inset-bottom))!important;max-height:calc(100dvh - max(20px,env(safe-area-inset-bottom)))}
  .chat-launcher{bottom:env(safe-area-inset-bottom)}
}
@media(max-width:420px){
  .site-chat{bottom:env(safe-area-inset-bottom)!important;height:min(82dvh,660px)}
}
.site-chat-profile-error{margin:-4px 0 0;color:#c93434;font:600 12px/1.35 "Roboto Condensed",Arial,sans-serif}
