/* ============ Geosha — поддержка (страница пользователя) ============ */

.sp-body { overflow: hidden; }
.sp {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 12px;
  width: min(780px, 100%); height: 100vh; height: 100dvh; margin: 0 auto; padding: 14px 16px 16px;
}

/* шапка */
.sp-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 22px; flex: none; }
.sp-back:hover { background: var(--hover); }
.sp-ava { position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--inset-fill); border: 1px solid var(--glass-edge); }
.sp-ava .logo-orb { width: 28px; height: 28px; }
.sp-dot { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22C58B; box-shadow: 0 0 0 2.5px var(--base); }
.sp-who { flex: 1; min-width: 0; }
.sp-who h1 { margin: 0; font: 700 16px/1.25 var(--font-display); letter-spacing: -.01em; }
.sp-who p { margin: 2px 0 0; font-size: 13px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-who p.online { color: #12A877; font-weight: 600; }
.sp-docs { font-size: 13.5px; font-weight: 500; color: var(--ink-soft); text-decoration: none; padding: 8px 10px; border-radius: 11px; }
.sp-docs:hover { background: var(--hover); color: var(--ink); }

/* переписка */
.sp-card { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: var(--r-panel); overflow: hidden; }
.sp-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 6px; }
.sp-loading { margin: auto; color: var(--ink-faint); font-size: 14px; }

/* закреплённое приветствие и кнопки в стиле Telegram */
.sp-pin {
  flex: none; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; text-align: left;
  border-bottom: 1px solid var(--glass-edge); background: var(--inset-fill);
}
.sp-pin[hidden] { display: none; }
.sp-pin:hover { background: var(--hover); }
.sp-pin-bar { flex: none; width: 3px; align-self: stretch; border-radius: 3px; background: var(--brand); }
.sp-pin-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-pin-body b { font-size: 13px; font-weight: 700; color: var(--violet); }
.sp-pin-body span { font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-pin > svg { width: 18px; height: 18px; color: var(--ink-faint); }
:root[data-theme="dark"] .sp-pin-body b, :root[data-theme="custom"] .sp-pin-body b { color: #C99BFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sp-pin-body b { color: #C99BFF; } }

.sp-welcome {
  align-self: flex-start; display: flex; flex-direction: column; gap: 4px;
  width: min(78%, 480px); margin-bottom: 8px; scroll-margin-top: 12px; border-radius: 20px;
}
.sp-welcome .sp-bubble {
  max-width: none; padding-bottom: 10px;
  background: var(--glass-fill); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shine);
  border-bottom-left-radius: 7px;
}
.sp-welcome.flash .sp-bubble { animation: sp-flash 1.4s ease; }
@keyframes sp-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--focus-ring), var(--glass-shine); background: var(--tint); } }
.sp-pinned { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 3px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--violet); }
.sp-pinned svg { width: 13px; height: 13px; }
.sp-keys { display: flex; flex-direction: column; gap: 4px; }
.sp-keys button {
  width: 100%; min-height: 42px; padding: 9px 14px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; text-align: center; line-height: 1.3;
  color: var(--ink); background: var(--inset-fill); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: background .15s, transform .1s;
}
.sp-keys button:last-child { border-bottom-left-radius: 18px; border-bottom-right-radius: 18px; }
.sp-keys button:hover { background: var(--hover); }
.sp-keys button:active { transform: scale(.985); background: var(--active); }
.sp-keys button:disabled { opacity: .55; }

.sp-day { align-self: center; margin: 12px 0 6px; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--inset-fill); border: 1px solid var(--glass-edge); }

.sp-msg { display: flex; }
.sp-msg.mine { justify-content: flex-end; }
.sp-bubble {
  position: relative; max-width: min(78%, 560px); padding: 10px 14px 7px; border-radius: 20px;
  font-size: 15px; line-height: 1.5; overflow-wrap: anywhere;
}
.sp-msg.theirs .sp-bubble { background: var(--glass-fill); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shine); border-bottom-left-radius: 7px; }
.sp-msg.mine .sp-bubble { color: #fff; background: var(--user-bubble); border-bottom-right-radius: 7px; box-shadow: 0 8px 22px -14px var(--glow); }
:root[data-theme="custom"] .sp-msg.mine .sp-bubble { color: var(--on-brand); }
.sp-msg.auto .sp-bubble { border-style: dashed; }
.sp-msg.mine.auto .sp-bubble { border: 0; }
.sp-label { display: block; margin-bottom: 2px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--violet); }
.sp-text { margin: 0; white-space: pre-wrap; }
.sp-text.muted { color: var(--ink-faint); font-style: italic; }
.sp-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sp-time { display: block; margin-top: 2px; text-align: right; font-size: 11.5px; opacity: .62; font-variant-numeric: tabular-nums; }
.sp-img { display: block; width: 300px; max-width: 100%; margin: 2px -6px 6px; border-radius: 14px; overflow: hidden; cursor: zoom-in; }
.sp-img img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; }
.sp-btn {
  display: inline-flex; margin: 8px 0 2px; padding: 7px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  text-decoration: none; color: var(--on-brand); background: var(--brand);
}

/* гость */
.sp-guest {
  display: flex; align-items: center; gap: 10px; margin: 0 14px 8px; padding: 10px 12px; border-radius: 16px;
  font-size: 13.5px; color: var(--ink-soft); background: var(--tint); border: 1px solid var(--glass-edge);
}
.sp-guest[hidden] { display: none; }
.sp-guest svg { width: 18px; height: 18px; color: var(--violet); }
.sp-guest p { margin: 0; flex: 1; }
.sp-guest button { padding: 6px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--on-brand); background: var(--brand); }

/* поле ввода */
.sp-composer { padding: 0 14px 12px; flex: none; }
.sp-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 20px; }
.sp-row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--focus-ring); }
.sp-attach, .sp-send { flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; }
.sp-attach { color: var(--ink-soft); }
.sp-attach:hover { background: var(--hover); color: var(--ink); }
.sp-send { color: var(--on-brand); background: var(--brand); box-shadow: 0 6px 16px -8px var(--glow); }
.sp-send:disabled { opacity: .4; cursor: default; box-shadow: none; }
.sp-row textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: none; padding: 9px 4px;
  font-size: 15.5px; line-height: 1.45; max-height: 160px;
}
.sp-row textarea::placeholder { color: var(--ink-faint); }
.sp-hint { margin: 6px 4px 0; font-size: 12.5px; color: var(--ink-faint); min-height: 0; }
.sp-hint:empty { display: none; }
.sp-preview { position: relative; display: inline-block; margin: 0 0 8px 4px; }
.sp-preview[hidden] { display: none; }
.sp-preview img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 14px; border: 1px solid var(--glass-edge); }
.sp-preview-x { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(23,20,61,.8); }
.sp-preview-x svg { width: 14px; height: 14px; }

.sp-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(8,8,20,.82); cursor: zoom-out; }
.sp-lightbox[hidden] { display: none; }
.sp-lightbox img { max-width: 100%; max-height: 100%; border-radius: 14px; }

.sp-body .toast { bottom: 120px; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sp-who p.online { color: #4BE3B8; } }
:root[data-theme="dark"] .sp-who p.online, :root[data-theme="custom"] .sp-who p.online { color: #4BE3B8; }

@media (max-width: 600px) {
  .sp-welcome { width: 88%; }
  .sp-pin { padding: 8px 12px; }
  .sp { padding: 8px 8px 8px; gap: 8px; }
  .sp-head { border-radius: 18px; padding: 6px 10px 6px 4px; gap: 8px; }
  .sp-docs { display: none; }
  .sp-card { border-radius: 22px; }
  .sp-feed { padding: 14px 10px 8px; }
  .sp-bubble { max-width: 86%; }
  .sp-composer { padding: 0 8px 8px; }
  .sp-guest { margin: 0 8px 8px; }
  .sp-row textarea { font-size: 16px; }   /* iOS не увеличивает страницу при фокусе */
}
