/* SDKV VPN — виджет чата поддержки (подключается из site-footer.php). */
.sp-root{
  --sp-bg:#111112; --sp-bg2:#0b0b0c; --sp-line:rgba(255,255,255,.1);
  --sp-o1:#ff8a1e; --sp-o2:#ff5c33; --sp-grad:linear-gradient(135deg,#ff8a1e,#ff5c33);
  --sp-hi:#f5f5f7; --sp-mid:#a1a1a6; --sp-lo:#6e6e73;
  position:fixed; right:max(16px,env(safe-area-inset-right)); bottom:max(16px,env(safe-area-inset-bottom));
  z-index:90; font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; font-size:14px; line-height:1.45;
  color:var(--sp-hi);
}
.sp-root *{ box-sizing:border-box; }
.sp-root [hidden]{ display:none !important; }

/* ---- кнопка ---- */
.sp-fab{
  position:relative; display:flex; align-items:center; gap:10px; height:52px; padding:0 20px 0 16px;
  border:0; border-radius:100px; cursor:pointer; color:#fff; font:inherit; font-weight:700; font-size:14.5px;
  background:var(--sp-grad); box-shadow:0 16px 36px -12px rgba(255,110,40,.7),0 0 0 1px rgba(255,255,255,.12) inset;
  transition:transform .18s ease, box-shadow .18s ease;
}
.sp-fab:hover{ transform:translateY(-2px); box-shadow:0 20px 40px -12px rgba(255,110,40,.8),0 0 0 1px rgba(255,255,255,.16) inset; }
.sp-fab:focus-visible{ outline:2px solid #fff; outline-offset:3px; }
.sp-fab-ico{ display:grid; place-items:center; width:24px; height:24px; }
.sp-fab-ico svg{ width:24px; height:24px; }
.sp-badge{
  position:absolute; top:-5px; right:-3px; min-width:21px; height:21px; padding:0 6px; border-radius:11px;
  background:#fff; color:#d83a10; font-size:12px; font-weight:800; display:grid; place-items:center;
  box-shadow:0 2px 8px rgba(0,0,0,.45);
}
.sp-fab.has-unread{ animation:sp-pulse 2.2s ease-in-out infinite; }
@keyframes sp-pulse{ 0%,100%{ box-shadow:0 16px 36px -12px rgba(255,110,40,.7),0 0 0 0 rgba(255,138,30,.55); } 50%{ box-shadow:0 16px 36px -12px rgba(255,110,40,.7),0 0 0 10px rgba(255,138,30,0); } }
.sp-root.is-open .sp-fab{ display:none; }

/* ---- панель ---- */
.sp-panel{
  display:flex; flex-direction:column; width:380px; height:min(600px,calc(100dvh - 32px));
  background:var(--sp-bg); border:1px solid var(--sp-line); border-radius:22px; overflow:hidden;
  box-shadow:0 30px 80px -20px rgba(0,0,0,.85),0 0 0 1px rgba(255,255,255,.03);
  animation:sp-in .22s cubic-bezier(.2,.8,.2,1) both; transform-origin:bottom right;
}
@keyframes sp-in{ from{ opacity:0; transform:translateY(12px) scale(.97); } to{ opacity:1; transform:none; } }
.sp-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 16px 14px 18px;
  background:linear-gradient(180deg,rgba(255,138,30,.14),rgba(255,138,30,0)); border-bottom:1px solid var(--sp-line);
}
.sp-head-t b{ display:block; font-size:15.5px; font-weight:700; }
.sp-head-t span{ display:block; margin-top:2px; font-size:12.5px; color:var(--sp-mid); }
.sp-close{
  flex:none; width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:50%;
  background:rgba(255,255,255,.06); color:var(--sp-mid); cursor:pointer; transition:background .15s,color .15s;
}
.sp-close:hover{ background:rgba(255,255,255,.12); color:var(--sp-hi); }
.sp-close svg{ width:16px; height:16px; }

/* ---- сообщения ---- */
.sp-body{ flex:1; overflow-y:auto; padding:16px 16px 8px; display:flex; flex-direction:column; gap:10px; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#333 transparent; }
.sp-hello{ margin:auto 0; text-align:center; padding:8px 4px; }
.sp-hello b{ display:block; font-size:17px; font-weight:700; }
.sp-hello p{ margin:6px 0 16px; color:var(--sp-mid); font-size:13.5px; }
.sp-chips{ display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.sp-chip{
  border:1px solid var(--sp-line); background:var(--sp-bg2); color:var(--sp-hi); font:inherit; font-size:13px; font-weight:600;
  padding:8px 13px; border-radius:100px; cursor:pointer; transition:border-color .15s,background .15s;
}
.sp-chip:hover{ border-color:rgba(255,138,30,.5); background:rgba(255,138,30,.08); }
.sp-msg{ display:flex; flex-direction:column; max-width:86%; }
.sp-msg.is-user{ align-self:flex-end; align-items:flex-end; }
.sp-msg.is-admin{ align-self:flex-start; align-items:flex-start; }
.sp-who{ font-size:11.5px; font-weight:700; color:var(--sp-o1); margin:0 4px 3px; }
.sp-bub{ padding:10px 14px; border-radius:18px; white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; }
.sp-msg.is-user .sp-bub{ background:var(--sp-grad); color:#fff; border-bottom-right-radius:6px; }
.sp-msg.is-admin .sp-bub{ background:#1c1c1e; color:var(--sp-hi); border-bottom-left-radius:6px; border:1px solid var(--sp-line); }
.sp-bub a{ color:inherit; text-decoration:underline; text-underline-offset:2px; }
.sp-msg.is-admin .sp-bub a{ color:#ffb36b; }
.sp-msg.is-pending .sp-bub{ opacity:.65; }
.sp-msg.is-failed .sp-bub{ background:#3a1a1a; border:1px solid rgba(255,107,107,.5); }
.sp-meta{ font-size:11px; color:var(--sp-lo); margin:3px 6px 0; }
.sp-retry{ border:0; background:none; color:#ff8a8a; font:inherit; font-size:12px; font-weight:600; text-decoration:underline; cursor:pointer; padding:0; }
.sp-note,.sp-flash{ align-self:center; text-align:center; font-size:12.5px; color:var(--sp-mid); background:rgba(255,255,255,.05); padding:7px 12px; border-radius:12px; }
.sp-flash{ color:#ffd9b0; background:rgba(255,138,30,.12); }

/* ---- вход и ввод ---- */
.sp-login{ padding:14px 18px 20px; border-top:1px solid var(--sp-line); text-align:center; }
.sp-login p{ color:var(--sp-mid); font-size:13.5px; margin-bottom:12px; }
.sp-login-btn{ display:inline-block; padding:12px 22px; border-radius:100px; background:var(--sp-grad); color:#fff; font-weight:700; font-size:14.5px; text-decoration:none; box-shadow:0 12px 28px -12px rgba(255,110,40,.7); }
.sp-login-btn:hover{ filter:brightness(1.06); }
.sp-form{ position:relative; display:flex; align-items:flex-end; gap:8px; padding:12px 16px 14px; }
.sp-hp{ position:absolute; left:-9999px; width:1px; height:1px; opacity:0; }
.sp-input{
  flex:1; min-width:0; resize:none; max-height:120px; padding:11px 14px; border-radius:16px; border:1px solid var(--sp-line);
  background:var(--sp-bg2); color:var(--sp-hi); font:inherit; font-size:14.5px; line-height:1.4; transition:border-color .15s;
}
.sp-input::placeholder{ color:var(--sp-lo); }
.sp-input:focus{ outline:0; border-color:rgba(255,138,30,.6); }
.sp-send{
  flex:none; width:44px; height:44px; display:grid; place-items:center; border:0; border-radius:50%; cursor:pointer; color:#fff;
  background:var(--sp-grad); transition:transform .15s, opacity .15s;
}
.sp-send:hover:not(:disabled){ transform:scale(1.06); }
.sp-send:disabled{ opacity:.5; cursor:default; }
.sp-send svg{ width:20px; height:20px; }

/* ---- телефон: панель на весь экран ---- */
@media (max-width:560px){
  .sp-fab-txt{ display:none; }
  .sp-fab{ width:56px; height:56px; padding:0; justify-content:center; }
  .sp-root.is-open{ inset:0; right:0; bottom:0; }
  .sp-panel{ width:100%; height:100dvh; border-radius:0; border:0; animation:sp-up .25s cubic-bezier(.2,.8,.2,1) both; }
  .sp-form{ padding-bottom:max(14px,env(safe-area-inset-bottom)); }
  .sp-input{ font-size:16px; }   /* iOS не приближает страницу при фокусе */
}
@keyframes sp-up{ from{ transform:translateY(24px); opacity:0; } to{ transform:none; opacity:1; } }
html.sp-lock,html.sp-lock body{ overflow:hidden; }
@media (prefers-reduced-motion:reduce){ .sp-panel,.sp-fab.has-unread{ animation:none; } .sp-fab,.sp-send{ transition:none; } }
