/* SwiftGate — окно поддержки (ИИ). Своя область имён .sgs-, от стилей страницы не зависит. */
.sgs-root {
  --sgs-bg: #0a0e22; --sgs-bg2: #11163a; --sgs-line: rgba(255,255,255,.1); --sgs-line2: rgba(255,255,255,.18);
  --sgs-ink: #eef1ff; --sgs-muted: #a3abcf; --sgs-blue: #4f7cff; --sgs-blue2: #8fb3ff; --sgs-green: #34d399;
  --sgs-red: #ff5d7a; --sgs-radius: 22px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sgs-ink); -webkit-font-smoothing: antialiased;
}
.sgs-root *, .sgs-root *::before, .sgs-root *::after { box-sizing: border-box; }
.sgs-hidden { display: none !important; }

/* ---------- кнопка вызова ---------- */
.sgs-fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #4f7cff, #6d5cff); color: #fff;
  font: 600 15px/1 Inter, system-ui, sans-serif;
  box-shadow: 0 18px 50px -12px rgba(79,124,255,.85), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.sgs-fab:hover { transform: translateY(-2px); box-shadow: 0 22px 60px -12px rgba(79,124,255,1), inset 0 1px 0 rgba(255,255,255,.25); }
.sgs-fab:focus-visible { outline: 3px solid var(--sgs-blue2); outline-offset: 3px; }
.sgs-fab svg { width: 24px; height: 24px; flex: none; }
.sgs-fab-dot { position: absolute; top: 10px; left: 34px; width: 9px; height: 9px; border-radius: 50%; background: var(--sgs-green); box-shadow: 0 0 0 2px #4f7cff; }
.sgs-open .sgs-fab { transform: scale(.9); opacity: 0; pointer-events: none; }

/* ---------- панель ---------- */
.sgs-panel {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 91;
  display: flex; flex-direction: column; width: 400px; height: min(640px, calc(100vh - 36px));
  border: 1px solid var(--sgs-line2); border-radius: var(--sgs-radius); overflow: hidden;
  background: linear-gradient(180deg, var(--sgs-bg2), var(--sgs-bg));
  box-shadow: 0 30px 90px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(79,124,255,.12);
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; visibility: hidden;
  transition: opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s;
}
.sgs-open .sgs-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }

.sgs-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--sgs-line); }
.sgs-avatar { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: linear-gradient(135deg, #4f7cff, #6d5cff); }
.sgs-avatar svg { width: 22px; height: 22px; color: #fff; }
.sgs-avatar::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--sgs-green); border: 2px solid var(--sgs-bg2); }
.sgs-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sgs-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--sgs-muted); }
.sgs-close { margin-left: auto; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--sgs-muted); cursor: pointer; }
.sgs-close:hover { background: rgba(255,255,255,.1); color: var(--sgs-ink); }
.sgs-close:focus-visible { outline: 2px solid var(--sgs-blue2); }
.sgs-close svg { width: 18px; height: 18px; }

.sgs-log { flex: 1; overflow-y: auto; padding: 16px 16px 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.sgs-log::-webkit-scrollbar { width: 6px; }
.sgs-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.sgs-msg { display: flex; margin: 0 0 10px; }
.sgs-msg.me { justify-content: flex-end; }
.sgs-bubble { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sgs-msg.ai .sgs-bubble { background: rgba(255,255,255,.06); border: 1px solid var(--sgs-line); border-top-left-radius: 6px; }
.sgs-msg.me .sgs-bubble { background: linear-gradient(135deg, #4f7cff, #5b6cff); color: #fff; border-top-right-radius: 6px; }
.sgs-bubble img { display: block; max-width: 100%; max-height: 220px; margin: 0 0 8px; border-radius: 12px; }
.sgs-bubble img:last-child { margin-bottom: 0; }

.sgs-note { margin: 2px 0 12px; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.4; color: var(--sgs-muted); background: rgba(79,124,255,.08); border: 1px solid rgba(79,124,255,.2); }
.sgs-note a { color: var(--sgs-blue2); }

/* карточка ссылки подписки */
.sgs-card { margin: 0 0 10px; padding: 14px; border-radius: 18px; border: 1px solid rgba(79,124,255,.35); background: rgba(79,124,255,.08); }
.sgs-card-title { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.sgs-code {
  display: block; width: 100%; padding: 11px 12px; border: 1px dashed rgba(143,179,255,.45); border-radius: 12px;
  background: rgba(0,0,0,.25); color: var(--sgs-blue2); cursor: pointer; text-align: left;
  font: 500 13px/1.4 JB, ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all;
}
.sgs-code:hover { border-style: solid; }
.sgs-code:focus-visible { outline: 2px solid var(--sgs-blue2); }
.sgs-card-hint { margin: 9px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--sgs-muted); }
.sgs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; margin-top: 10px; padding: 0 16px;
  border: 0; border-radius: 12px; cursor: pointer; text-decoration: none;
  background: var(--sgs-blue); color: #fff; font: 600 14px/1 Inter, system-ui, sans-serif;
}
.sgs-btn:hover { filter: brightness(1.1); }
.sgs-btn:focus-visible { outline: 2px solid var(--sgs-blue2); outline-offset: 2px; }
.sgs-btn.ok { background: var(--sgs-green); color: #04120c; }
.sgs-card.human { border-color: rgba(255,93,122,.35); background: rgba(255,93,122,.07); }

.sgs-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.sgs-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sgs-muted); animation: sgs-blink 1.2s infinite both; }
.sgs-typing i:nth-child(2) { animation-delay: .15s; }
.sgs-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sgs-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.sgs-typing-text { margin: -4px 0 10px 4px; font-size: 12px; color: var(--sgs-muted); }

.sgs-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.sgs-chip { padding: 9px 13px; border: 1px solid var(--sgs-line2); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--sgs-ink); cursor: pointer; font: 500 13.5px/1 Inter, system-ui, sans-serif; }
.sgs-chip:hover { border-color: var(--sgs-blue); background: rgba(79,124,255,.12); }
.sgs-chip:focus-visible { outline: 2px solid var(--sgs-blue2); }

/* ---------- поле ввода ---------- */
.sgs-form { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--sgs-line); background: rgba(0,0,0,.18); }
.sgs-preview { display: flex; gap: 8px; margin: 0 0 8px; }
.sgs-thumb { position: relative; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 1px solid var(--sgs-line2); }
.sgs-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sgs-thumb button { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.sgs-row { display: flex; align-items: flex-end; gap: 8px; }
.sgs-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--sgs-line2); border-radius: 14px;
  background: rgba(255,255,255,.05); color: var(--sgs-muted); cursor: pointer;
}
.sgs-icon:hover { color: var(--sgs-ink); border-color: var(--sgs-blue); }
.sgs-icon:focus-visible { outline: 2px solid var(--sgs-blue2); }
.sgs-icon svg { width: 20px; height: 20px; }
.sgs-input {
  flex: 1; min-height: 44px; max-height: 140px; padding: 11px 14px; border: 1px solid var(--sgs-line2); border-radius: 14px;
  background: rgba(255,255,255,.05); color: var(--sgs-ink); resize: none; outline: none;
  font: 400 15px/1.4 Inter, system-ui, sans-serif;
}
.sgs-input::placeholder { color: #7c84ad; }
.sgs-input:focus { border-color: var(--sgs-blue); box-shadow: 0 0 0 3px rgba(79,124,255,.18); }
.sgs-send { background: var(--sgs-blue); border-color: var(--sgs-blue); color: #fff; }
.sgs-send:hover { color: #fff; filter: brightness(1.1); }
.sgs-send:disabled { opacity: .45; cursor: default; filter: none; }
.sgs-foot { margin: 8px 2px 0; font-size: 11.5px; color: #7c84ad; text-align: center; }
.sgs-drop .sgs-panel { box-shadow: 0 0 0 2px var(--sgs-blue), 0 30px 90px -20px rgba(0,0,0,.85); }

/* ---------- телефоны: панель на весь экран, кнопка над нижней плашкой лендинга ---------- */
@media (max-width: 560px) {
  .sgs-fab { right: 14px; height: 52px; padding: 0 16px 0 14px; }
  .sgs-fab-label { display: none; }
  .sgs-fab { width: 52px; padding: 0; justify-content: center; }
  .sgs-fab-dot { left: 30px; top: 9px; }
  body:has(.sticky-cta.show) .sgs-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sgs-panel { inset: 0; width: auto; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .sgs-input { font-size: 16px; } /* iOS не зумит поле от 16px */
}
@media (prefers-reduced-motion: reduce) {
  .sgs-fab, .sgs-panel, .sgs-log { transition: none; scroll-behavior: auto; }
  .sgs-typing i { animation: none; opacity: .6; }
}
