#schat-root{position:fixed;bottom:20px;right:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;line-height:1.4}
#schat-root *,#schat-root *:before,#schat-root *:after{box-sizing:border-box}
#schat-root[data-schat-position="bl"]{right:auto;left:20px}
#schat-root[data-schat-position="rt"]{bottom:auto;top:20px}
#schat-root[data-schat-position="lt"]{bottom:auto;top:20px;right:auto;left:20px}
#schat-root[data-schat-hidden-launcher="1"] .schat-launcher{display:none}

/* --- launcher --- */
.schat-launcher{position:relative;width:56px;height:56px;border-radius:50%;border:0;cursor:pointer;background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff);box-shadow:0 4px 16px rgba(0,0,0,.22);display:flex;align-items:center;justify-content:center;padding:0;transition:transform .15s ease}
.schat-launcher:hover{transform:scale(1.05)}
.schat-launcher:focus-visible{outline:3px solid var(--schat-bg,#0d8bcd);outline-offset:3px}
.schat-launcher svg{position:absolute;transition:opacity .15s ease,transform .15s ease}
.schat-icon-x{opacity:0;transform:rotate(-90deg)}
#schat-root.schat-open .schat-icon-chat{opacity:0;transform:rotate(90deg)}
#schat-root.schat-open .schat-icon-x{opacity:1;transform:rotate(0)}

/* --- teaser --- */
.schat-teaser{display:none;position:absolute;bottom:70px;right:0;width:250px;background:#fff;border-radius:14px;box-shadow:0 6px 24px rgba(0,0,0,.16);padding:11px 12px;align-items:flex-start;gap:9px}
#schat-root.schat-teaser-visible .schat-teaser{display:flex;animation:schat-in .2s ease}
#schat-root.schat-open .schat-teaser{display:none}
#schat-root[data-schat-position="bl"] .schat-teaser,#schat-root[data-schat-position="lt"] .schat-teaser{right:auto;left:0}
#schat-root[data-schat-position="rt"] .schat-teaser,#schat-root[data-schat-position="lt"] .schat-teaser{bottom:auto;top:70px}
.schat-teaser-avatar{width:30px;height:30px;border-radius:50%;object-fit:cover;flex:0 0 30px}
.schat-teaser-text{flex:1;background:none;border:0;padding:0;text-align:left;font:inherit;font-size:13px;color:#1a1a1a;cursor:pointer}
.schat-teaser-close{background:none;border:0;font-size:17px;line-height:1;color:#8a8f94;cursor:pointer;padding:0 2px}
.schat-teaser-close:hover{color:#1a1a1a}

/* --- panel --- */
/* Class-driven visibility. Do NOT swap this for the [hidden] attribute:
   this display rule would override it and the panel would never close. */
.schat-panel{display:none;position:absolute;bottom:74px;right:0;width:var(--schat-w,360px);height:var(--schat-h,520px);max-width:calc(100vw - 32px);max-height:calc(100vh - 130px);background:#fff;border-radius:16px;box-shadow:0 12px 44px rgba(0,0,0,.18);flex-direction:column;overflow:hidden}
#schat-root.schat-open .schat-panel{display:flex;animation:schat-in .18s ease}
@keyframes schat-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
#schat-root[data-schat-position="bl"] .schat-panel,#schat-root[data-schat-position="lt"] .schat-panel{right:auto;left:0}
#schat-root[data-schat-position="rt"] .schat-panel,#schat-root[data-schat-position="lt"] .schat-panel{bottom:auto;top:74px}
/* With no launcher there is nothing to clear, so close the gap. */
#schat-root[data-schat-hidden-launcher="1"] .schat-panel{bottom:0}
#schat-root[data-schat-hidden-launcher="1"][data-schat-position="rt"] .schat-panel,#schat-root[data-schat-hidden-launcher="1"][data-schat-position="lt"] .schat-panel{top:0}

#schat-root.schat-expanded .schat-panel{width:min(560px,calc(100vw - 32px));height:min(760px,calc(100vh - 130px))}

/* --- header --- */
.schat-header{background:var(--schat-header-bg,#fff);color:var(--schat-header-fg,#1a1a1a);padding:12px 14px;display:flex;align-items:center;gap:10px;flex:0 0 auto;border-bottom:1px solid rgba(0,0,0,.08)}
.schat-heading{display:flex;align-items:center;gap:9px;min-width:0;flex:1}
.schat-heading-text{display:flex;flex-direction:column;min-width:0}
.schat-header-avatar{width:32px;height:32px;border-radius:50%;object-fit:cover;flex:0 0 32px}
.schat-title{font-weight:600;font-size:15px;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.schat-subtitle{font-size:12px;opacity:.72;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.schat-header-actions{display:flex;align-items:center;gap:2px;flex:0 0 auto}
.schat-header-btn{background:none;border:0;color:inherit;cursor:pointer;padding:6px;display:flex;border-radius:7px;opacity:.72}
.schat-header-btn:hover{opacity:1;background:rgba(127,127,127,.14)}
.schat-header-btn:focus-visible{outline:2px solid currentColor;outline-offset:1px;opacity:1}
.schat-back{display:none}
#schat-root.schat-view-history .schat-back{display:flex}
#schat-root.schat-view-history .schat-history-btn{display:none}

/* --- views --- */
.schat-log{flex:1 1 auto;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:11px;background:#f7f8fa}
.schat-history{display:none;flex:1 1 auto;overflow-y:auto;padding:14px;background:#f7f8fa;flex-direction:column;gap:8px}
#schat-root.schat-view-history .schat-log,#schat-root.schat-view-history .schat-form{display:none}
#schat-root.schat-view-history .schat-history{display:flex}

.schat-history-item{background:#fff;border:1px solid #e6e8eb;border-radius:11px;padding:11px 13px;text-align:left;cursor:pointer;display:flex;flex-direction:column;gap:3px;font:inherit}
.schat-history-item:hover{border-color:var(--schat-bg,#0d8bcd)}
.schat-history-preview{font-size:13px;color:#1a1a1a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.schat-history-time{font-size:11px;color:#787c82}
.schat-history-empty{font-size:13px;color:#787c82;text-align:center;margin:14px 0}
.schat-new-chat{background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff);border:0;border-radius:10px;padding:10px;font-size:14px;font-weight:500;cursor:pointer;font-family:inherit}

/* --- messages --- */
.schat-msg{max-width:84%;display:flex;gap:7px;align-items:flex-end}
.schat-msg-avatar{width:26px;height:26px;border-radius:50%;object-fit:cover;flex:0 0 26px;margin-bottom:2px}
.schat-msg-stack{display:flex;flex-direction:column;gap:2px;min-width:0}
.schat-msg-name{font-size:11px;color:#666}
.schat-msg-body{padding:9px 13px;border-radius:14px;font-size:14px;line-height:1.45;word-wrap:break-word;overflow-wrap:anywhere;white-space:pre-wrap;background:#fff;color:#1a1a1a;box-shadow:0 1px 2px rgba(0,0,0,.06)}
.schat-msg-time{font-size:10.5px;color:#9aa0a6;padding:0 4px}
.schat-msg--visitor{align-self:flex-end;flex-direction:row-reverse}
.schat-msg--visitor .schat-msg-stack{align-items:flex-end}
.schat-msg--visitor .schat-msg-body{background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff)}
.schat-msg--optimistic{opacity:.55}
.schat-msg--system{align-self:center;max-width:94%}
.schat-msg--system .schat-msg-stack{align-items:center}
.schat-msg--system .schat-msg-body{background:transparent;box-shadow:none;color:#666;font-size:13px;text-align:center;padding:2px 0}

.schat-attachment{display:inline-block;max-width:100%;text-decoration:none}
.schat-attachment-image{max-width:100%;max-height:190px;border-radius:11px;display:block}
.schat-attachment-file{background:#fff;border:1px solid #e6e8eb;border-radius:11px;padding:8px 12px;font-size:13px;color:var(--schat-bg,#0d8bcd);overflow-wrap:anywhere}

/* --- composer --- */
.schat-form{border-top:1px solid #e6e8eb;flex:0 0 auto;background:#fff;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
.schat-chips{display:flex;flex-wrap:wrap;gap:6px}
#schat-root:not(.schat-has-chips) .schat-chips{display:none}
.schat-chips-intro{width:100%;font-size:12px;color:#787c82}
.schat-chip{background:#fff;border:1px solid var(--schat-bg,#0d8bcd);color:var(--schat-bg,#0d8bcd);border-radius:16px;padding:6px 12px;font-size:13px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;font-family:inherit}
.schat-chip:hover{background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff)}
.schat-chip-emoji{font-size:14px}

.schat-files{display:flex;flex-wrap:wrap;gap:6px}
.schat-files:empty{display:none}
.schat-file{background:#f0f1f3;border-radius:14px;padding:4px 8px 4px 11px;font-size:12px;display:inline-flex;align-items:center;gap:6px;max-width:100%}
.schat-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px}
.schat-file-pending{opacity:.55}
.schat-file-remove{background:none;border:0;font-size:15px;line-height:1;cursor:pointer;color:#646970;padding:0 2px}

.schat-input-row{display:flex;gap:7px;align-items:center}
.schat-file-input{display:none}
.schat-attach{background:none;border:0;cursor:pointer;color:#646970;padding:6px;display:flex;border-radius:7px;flex:0 0 auto}
.schat-attach:hover{background:#f0f1f3;color:#1a1a1a}
.schat-input{flex:1;border:1px solid #d6d9dd;border-radius:22px;padding:10px 14px;font-size:14px;outline:0;background:#fff;color:#1a1a1a;min-width:0;font-family:inherit}
.schat-input:focus{border-color:var(--schat-bg,#0d8bcd)}
.schat-send{border:0;border-radius:50%;width:38px;height:38px;flex:0 0 38px;cursor:pointer;background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff);display:flex;align-items:center;justify-content:center}
.schat-send:disabled{opacity:.5;cursor:default}
.schat-disclaimer{margin:0;font-size:11px;color:#9aa0a6;text-align:center}

/* --- pre-chat form --- */
.schat-prechat{background:#fff;border-radius:13px;padding:14px;box-shadow:0 1px 2px rgba(0,0,0,.06);display:flex;flex-direction:column;gap:9px}
.schat-prechat-intro{margin:0;font-size:13px;color:#50575e;line-height:1.45}
.schat-prechat-row{display:flex;flex-direction:column;gap:3px;font-size:12px;color:#50575e}
.schat-prechat-row input{border:1px solid #d6d9dd;border-radius:8px;padding:8px 10px;font-size:14px;outline:0;color:#1a1a1a;background:#fff;font-family:inherit}
.schat-prechat-row input:focus{border-color:var(--schat-bg,#0d8bcd)}
.schat-prechat-consent{display:flex;align-items:flex-start;gap:7px;font-size:12px;color:#50575e;line-height:1.4}
.schat-prechat-consent input{margin-top:2px;flex:0 0 auto}
.schat-prechat-error{margin:0;font-size:12px;color:#b32d2e}
.schat-prechat-submit{border:0;border-radius:9px;padding:10px 14px;font-size:14px;font-weight:500;cursor:pointer;background:var(--schat-bg,#0d8bcd);color:var(--schat-fg,#fff);font-family:inherit}
.schat-prechat-submit:disabled{opacity:.6;cursor:default}

@media (max-width:480px){
	#schat-root{bottom:16px;right:16px}
	#schat-root[data-schat-position="bl"],#schat-root[data-schat-position="lt"]{left:16px;right:auto}
	.schat-panel,#schat-root.schat-expanded .schat-panel{width:calc(100vw - 32px);height:min(74vh,580px)}
	.schat-teaser{width:calc(100vw - 90px)}
}

@media (prefers-reduced-motion:reduce){
	#schat-root *{animation:none!important;transition:none!important}
}

.schat-msg-clamped{max-height:7.5em;overflow:hidden;position:relative}
.schat-msg-clamped:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2em;background:linear-gradient(rgba(255,255,255,0),#fff)}
.schat-msg--visitor .schat-msg-clamped:after{background:linear-gradient(transparent,var(--schat-bg,#0d8bcd))}
.schat-msg-more{background:none;border:0;padding:2px 4px 0;font-size:11.5px;color:var(--schat-bg,#0d8bcd);cursor:pointer;text-decoration:underline;font-family:inherit;align-self:flex-start}
.schat-msg--visitor .schat-msg-more{align-self:flex-end;color:#646970}

.schat-chip-menu{border-style:dashed;opacity:.85}
.schat-dots{display:flex;align-items:center;gap:4px;padding:12px 14px}
.schat-dots span{width:6px;height:6px;border-radius:50%;background:#9aa0a6;animation:schat-bounce 1.2s infinite}
.schat-dots span:nth-child(2){animation-delay:.15s}
.schat-dots span:nth-child(3){animation-delay:.3s}
@keyframes schat-bounce{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
