.ssm-root,
.ssm-root * { box-sizing: border-box; }

.ssm-root {
  --ssm-primary: #5b4bff;
  --ssm-text: #172033;
  --ssm-muted: #748099;
  --ssm-bg: #fff;
  --ssm-border: rgba(23, 32, 51, .09);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  direction: rtl;
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.55;
}

.ssm-root.ssm-position-left { right: auto; left: 24px; }
.ssm-root.ssm-inline { position: relative; right: auto; left: auto; bottom: auto; width: 100%; min-height: 640px; }
.ssm-root.ssm-inline .ssm-launcher { display: none; }
.ssm-root.ssm-inline .ssm-panel { position: relative; right: auto; left: auto; bottom: auto; width: min(420px, 100%); height: 620px; margin: 0 auto; opacity: 1; visibility: visible; transform: none; }

.ssm-launcher {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--ssm-primary), white 12%), var(--ssm-primary));
  box-shadow: 0 18px 45px color-mix(in srgb, var(--ssm-primary), transparent 62%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: transform .2s ease, border-radius .2s ease;
}

.ssm-launcher:hover { transform: translateY(-3px); border-radius: 50%; }
.ssm-launcher svg { width: 29px; height: 29px; fill: currentColor; position: relative; z-index: 2; }
.ssm-launcher-pulse { position: absolute; inset: -5px; border: 2px solid color-mix(in srgb, var(--ssm-primary), transparent 45%); border-radius: 26px; animation: ssmPulse 2.2s infinite; }

.ssm-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 125px));
  min-height: 480px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 90px rgba(23, 32, 51, .22), 0 3px 14px rgba(23, 32, 51, .08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(.96);
  transform-origin: bottom right;
  transition: opacity .22s ease, visibility .22s ease, transform .22s ease;
}

.ssm-position-left .ssm-panel { right: auto; left: 0; transform-origin: bottom left; }
.ssm-open .ssm-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.ssm-header {
  min-height: 88px;
  padding: 18px 18px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,.26), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--ssm-primary), black 12%), var(--ssm-primary));
}

.ssm-header::after { content: ''; position: absolute; width: 130px; height: 130px; border: 24px solid rgba(255,255,255,.06); border-radius: 50%; left: -42px; top: -62px; }
.ssm-avatar { width: 48px; height: 48px; border-radius: 17px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); display: grid; place-items: center; font-size: 22px; font-weight: 800; position: relative; flex: 0 0 auto; }
.ssm-avatar i { position: absolute; width: 12px; height: 12px; border: 2px solid var(--ssm-primary); background: #37d889; border-radius: 50%; bottom: -2px; left: -2px; }
.ssm-header-copy { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.ssm-header-copy strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssm-header-copy small { display: flex; align-items: center; gap: 6px; opacity: .88; font-size: 11px; }
.ssm-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #5df2aa; box-shadow: 0 0 0 4px rgba(93,242,170,.16); }
.ssm-close { margin-right: auto; position: relative; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 12px; color: #fff; background: rgba(255,255,255,.12); font-size: 27px; line-height: 1; cursor: pointer; }
.ssm-close:hover { background: rgba(255,255,255,.22); }

.ssm-body { flex: 1; min-height: 0; background: linear-gradient(180deg, #f8f9ff 0, #fff 42%); }
.ssm-prechat { height: 100%; padding: 30px 26px; display: flex; flex-direction: column; justify-content: center; }
.ssm-welcome-icon { width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--ssm-primary), white 89%); margin-bottom: 17px; }
.ssm-prechat h3 { color: var(--ssm-text); font-size: 19px; line-height: 1.7; margin: 0 0 5px; }
.ssm-prechat > p { color: var(--ssm-muted); font-size: 12px; margin: 0 0 22px; }
.ssm-prechat label { display: flex; flex-direction: column; gap: 6px; color: var(--ssm-text); font-size: 12px; margin-bottom: 12px; }
.ssm-prechat label span { color: var(--ssm-muted); font-size: 10px; }
.ssm-prechat input { width: 100%; height: 46px; border-radius: 14px; border: 1px solid var(--ssm-border); background: #fff; padding: 0 14px; outline: none; color: var(--ssm-text); font: inherit; box-shadow: 0 5px 15px rgba(23,32,51,.03); }
.ssm-prechat input:focus { border-color: color-mix(in srgb, var(--ssm-primary), white 25%); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ssm-primary), transparent 90%); }
.ssm-start { height: 48px; border: 0; border-radius: 15px; margin-top: 5px; color: #fff; font: 700 13px Tahoma, Arial, sans-serif; background: linear-gradient(135deg, color-mix(in srgb, var(--ssm-primary), black 8%), var(--ssm-primary)); box-shadow: 0 12px 24px color-mix(in srgb, var(--ssm-primary), transparent 72%); cursor: pointer; }
.ssm-start:disabled { opacity: .65; cursor: wait; }
.ssm-privacy { margin-top: 13px; color: var(--ssm-muted); font-size: 9px; text-align: center; }

.ssm-chat { height: 100%; }
.ssm-messages { height: 100%; padding: 20px 16px 26px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ssm-message-row { display: flex; margin-bottom: 11px; }
.ssm-message-row.ssm-outgoing { justify-content: flex-start; }
.ssm-message-row.ssm-incoming { justify-content: flex-end; }
.ssm-message-bubble { max-width: 84%; padding: 10px 13px 7px; border-radius: 17px; box-shadow: 0 5px 16px rgba(23,32,51,.06); font-size: 12px; color: var(--ssm-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.ssm-outgoing .ssm-message-bubble { color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--ssm-primary), black 8%), var(--ssm-primary)); border-bottom-right-radius: 5px; }
.ssm-incoming .ssm-message-bubble { background: #fff; border: 1px solid var(--ssm-border); border-bottom-left-radius: 5px; }
.ssm-message-sender { display: block; color: var(--ssm-primary); font-size: 9px; font-weight: 700; margin-bottom: 3px; }
.ssm-message-bubble time { display: block; margin-top: 4px; font-size: 8px; opacity: .62; text-align: left; direction: ltr; }
.ssm-message-text { line-height: 1.75; }

.ssm-composer { min-height: 68px; padding: 10px 12px; display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid var(--ssm-border); background: #fff; }
.ssm-input { flex: 1; height: 44px; min-height: 44px; max-height: 110px; resize: none; border: 1px solid transparent; outline: 0; border-radius: 15px; padding: 11px 13px; background: #f3f5fa; color: var(--ssm-text); font: 12px/1.8 Tahoma, Arial, sans-serif; overflow-y: auto; }
.ssm-input:focus { background: #fff; border-color: color-mix(in srgb, var(--ssm-primary), transparent 58%); }
.ssm-send { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--ssm-primary); cursor: pointer; box-shadow: 0 8px 18px color-mix(in srgb, var(--ssm-primary), transparent 72%); }
.ssm-send svg { width: 21px; height: 21px; fill: currentColor; transform: rotate(180deg); }
.ssm-powered { height: 22px; display: grid; place-items: center; background: #fff; color: #a0a8b8; font-size: 8px; letter-spacing: .2px; }
.ssm-inline-error { margin: 10px auto; max-width: 90%; padding: 9px 11px; border-radius: 12px; color: #b42318; background: #fff0ef; border: 1px solid #ffd1cd; font-size: 10px; text-align: center; }

.ssm-typing { padding: 0 18px 8px; color: var(--ssm-muted); font-size: 9px; }
.ssm-typing span { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--ssm-primary); animation: ssmTyping 1s infinite alternate; }
.ssm-typing span:nth-child(2) { animation-delay: .2s; }
.ssm-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes ssmPulse { 0% { opacity: .8; transform: scale(.9); } 70%, 100% { opacity: 0; transform: scale(1.2); } }
@keyframes ssmTyping { to { transform: translateY(-3px); opacity: .4; } }

@media (max-width: 520px) {
  .ssm-root:not(.ssm-inline) { right: 14px; bottom: 14px; }
  .ssm-root.ssm-position-left:not(.ssm-inline) { right: auto; left: 14px; }
  .ssm-root:not(.ssm-inline) .ssm-panel { position: fixed; inset: 10px 10px 88px; width: auto; height: auto; min-height: 0; border-radius: 24px; }
  .ssm-launcher { width: 58px; height: 58px; border-radius: 20px; }
}

@supports not (color: color-mix(in srgb, red, blue)) {
  .ssm-launcher, .ssm-start, .ssm-outgoing .ssm-message-bubble { background: var(--ssm-primary); }
  .ssm-launcher { box-shadow: 0 18px 45px rgba(91,75,255,.35); }
}
