/* Картинки в поддержке (SU.8b): окно клиента (поверх support-chat.css) и «Переписка» (поверх admin-support.css), разметка —
   assets/js/support-pics.js. Вид — макет demo/assets/css/support-att.css, принятый владельцем. Новых цветов нет: роли тем
   и цвета брендбука (--pulse-void, --pulse-paper) — для просмотра крупно, он тёмный в обеих темах: на тёмном снимок экрана
   читается лучше. Приметная деталь — та же линия пульса: её рисует перо, пока над окном держат картинку. */

/* ---- поле ввода клиента: скрепка слева, миниатюры над полем ---------------------------------------- */
.sa-field { padding-left: 4px; }
.sa-field:has(.sa-clip[hidden]) { padding-left: 14px; }
.sa-clip { all: unset; box-sizing: border-box; flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; cursor: pointer;
  color: var(--text-3); transition: color .16s var(--ease-ui), background-color .16s var(--ease-ui); }
.sa-clip[hidden] { display: none; }
.sa-clip:hover { color: var(--text); background: var(--ghost-bg); }
.sa-clip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sa-clip .ic { width: 21px; height: 21px; }
.sa-file { display: none; }

.sa-tray { display: flex; gap: 10px; margin: 0 0 10px; padding: 6px 6px 2px 2px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.sa-tray[hidden] { display: none; }
.sa-ti { position: relative; flex: none; width: 68px; height: 68px; }
.sa-tv { all: unset; box-sizing: border-box; position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 14px; overflow: hidden; cursor: zoom-in;
  background: var(--input-bg); }
.sa-tv img { width: 100%; height: 100%; object-fit: cover; }
.sa-tv::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line-strong); pointer-events: none; }
.sa-tv:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sa-ti.is-loading .sa-tv { cursor: progress; background: linear-gradient(100deg, var(--input-bg) 30%, var(--ghost-bg) 50%, var(--input-bg) 70%) 0 0 / 200% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .sa-ti.is-loading .sa-tv { animation: sa-shim 1s linear infinite; }
  .sa-ti { animation: sa-in .24s var(--ease-out) both; }
}
@keyframes sa-shim { to { background-position: -200% 0; } }
@keyframes sa-in { from { opacity: 0; transform: scale(.88); } }
/* Вес — на снимке: тёмная подложка в обеих темах, иначе на светлом снимке цифры теряются. */
.sa-ts { position: absolute; left: 4px; bottom: 4px; padding: 2px 5px; border-radius: 6px; pointer-events: none;
  font: 500 10px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--pulse-paper); background: color-mix(in srgb, var(--pulse-void) 66%, transparent); }
.sa-tx { all: unset; box-sizing: border-box; position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  color: var(--text-2); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), 0 2px 8px -2px rgba(5, 6, 13, .35); }
.sa-tx::before { content: ""; position: absolute; inset: -10px; }   /* попасть пальцем: 44 px */
.sa-tx .ic { width: 12px; height: 12px; }
.sa-tx:hover { color: var(--down); }
.sa-tx:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- картинки в ленте ------------------------------------------------------------------------------ */
.sa-pics { display: grid; gap: 3px; width: min(264px, 100%); border-radius: 16px; overflow: hidden; }
.sa-pics + .sc-b, .sc-b + .sa-pics, .sa-pics + .sa-pics { margin-top: 3px; }
.sa-pics.is-n1 { width: auto; max-width: 100%; }
.sa-pics.is-n2, .sa-pics.is-n3, .sa-pics.is-n4 { grid-template-columns: 1fr 1fr; }
.sa-pics.is-n3 .sa-pic:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.sa-pic { all: unset; box-sizing: border-box; position: relative; display: block; min-width: 0; overflow: hidden; cursor: zoom-in; aspect-ratio: 1; background: var(--input-bg); }
.sa-pics.is-n1 .sa-pic { aspect-ratio: auto; border-radius: 16px; }
/* Рамка — поверх картинки: светлый снимок на светлой теме не сливается с пузырём и фоном. */
.sa-pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.sa-pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease-out), opacity .2s var(--ease-ui); }
.sa-pics.is-n1 .sa-pic img { width: auto; max-width: 100%; height: auto; max-height: 280px; object-fit: contain; }
.sa-pic:hover img { transform: scale(1.025); }
.sa-pic:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.sa-more { position: absolute; inset: 0; display: grid; place-items: center; font: 600 20px/1 var(--font-text); color: var(--pulse-paper);
  background: color-mix(in srgb, var(--pulse-void) 55%, transparent); }
.sa-pics.is-sending .sa-pic img { opacity: .55; }
.sa-pics.is-fail { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--down) 55%, transparent); }
.sa-pics.is-fail .sa-pic img { opacity: .5; filter: grayscale(.6); }
.sa-prog { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--pulse-void) 55%, transparent); }
.sa-prog > i { display: block; height: 100%; border-radius: inherit; background: var(--pulse-paper); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; transition: transform .12s linear; }

/* Подсказка в приветствии: клавиши — как в строке под полем. */
.sc-b kbd { display: inline-block; padding: 0 5px; border-radius: 5px; font: 500 12px/1.45 var(--font-mono); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---- перетаскивание: рамка над окном, линию пульса рисует перо ----------------------------------- */
.sa-drop { position: absolute; inset: 0; z-index: 6; display: grid; padding: 10px; border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sa-drop[hidden] { display: none; }
.sa-drop-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; border-radius: 22px; text-align: center; pointer-events: none;
  border: 1.5px dashed color-mix(in srgb, var(--accent-text) 70%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.sa-drop-in > .ic { width: 34px; height: 34px; color: var(--accent-text); }
.sa-drop-in b { max-width: 26ch; font: 600 16px/1.35 var(--font-text); color: var(--text); text-wrap: balance; }
.sa-drop-in span { max-width: 32ch; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.sa-drop-line { width: 160px; height: 18px; margin-top: 6px; overflow: visible; }
.sa-drop-line path { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sa-drop-line path { animation: sa-pen 1.6s var(--ease-out) infinite; }
}
@keyframes sa-pen { 0% { stroke-dashoffset: 100; } 60%, 100% { stroke-dashoffset: 0; } }

/* ---- просмотр крупно ------------------------------------------------------------------------------ */
.sa-view { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); color: var(--pulse-paper); background: color-mix(in srgb, var(--pulse-void) 96%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s var(--ease-ui), overlay .2s allow-discrete, display .2s allow-discrete; }
.sa-view:not([open]) { display: none; }
.sa-view[open] { opacity: 1; }
@starting-style { .sa-view[open] { opacity: 0; } }
.sa-view::backdrop { background: transparent; }
.sa-vbar { display: flex; align-items: center; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px 20px; }
.sa-vcap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; margin: 0; }
.sa-vcap b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 15px/1.3 var(--font-text); }
.sa-vcap span { font: 500 11.5px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--pulse-mist); }
.sa-vb { all: unset; box-sizing: border-box; flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  color: var(--pulse-paper); background: color-mix(in srgb, var(--pulse-paper) 9%, transparent); transition: background-color .16s var(--ease-ui); }
.sa-vb[hidden] { display: none; }
.sa-vb:hover { background: color-mix(in srgb, var(--pulse-paper) 18%, transparent); }
.sa-vb:focus-visible, .sa-vnav:focus-visible { outline: 2px solid var(--pulse-ion); outline-offset: 2px; }
.sa-vb .ic { width: 20px; height: 20px; }
.sa-vstage { min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; place-items: safe center; padding: 8px 76px 28px; }
.sa-vstage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; cursor: zoom-in;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); }
.sa-view.is-fits .sa-vstage img { cursor: default; }
.sa-view.is-zoom .sa-vstage { padding: 8px; cursor: default; }
.sa-view.is-zoom .sa-vstage img { max-width: none; max-height: none; cursor: zoom-out; border-radius: 0; }
.sa-vnav { all: unset; box-sizing: border-box; position: fixed; top: 50%; display: none; place-items: center; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; cursor: pointer;
  color: var(--pulse-paper); background: color-mix(in srgb, var(--pulse-paper) 9%, transparent); }
.sa-vnav:hover { background: color-mix(in srgb, var(--pulse-paper) 18%, transparent); }
.sa-vnav .ic { width: 22px; height: 22px; }
.sa-vnav.is-prev { left: 16px; }
.sa-vnav.is-next { right: 16px; }
.sa-view.is-many .sa-vnav { display: grid; }
.sa-view.is-zoom .sa-vnav { display: none; }

/* ---- «Переписка»: картинки в пузыре, имя и вес под ними, миниатюры над полем, рамка над лентой ---------- */
.su-b .sa-pics { width: min(360px, 100%); margin-top: 8px; border-radius: 12px; }
.su-b .sa-pics.is-n1 { width: auto; }
.su-b .sa-pics.is-n1 .sa-pic { border-radius: 12px; }
.su-b .sa-pics.is-n1 .sa-pic img { max-height: 300px; }
.su-b .sa-pics:first-child { margin-top: 0; }
.sa-cap { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.su-prev .sa-pv-ic .ic { display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; color: var(--text-3); }
.su-comp .sa-tray { margin: 2px 0 8px; }
/* Окно клиента — 392 px: пять миниатюр 64 px с зазором 8 px входят целиком, с «Убрать» у пятой (68 + 10 — на 22 px шире). */
.sc-comp .sa-tray { gap: 8px; }
.sc-comp .sa-ti { width: 64px; height: 64px; }
.su-feed > .sa-drop { border-radius: 0; }
.su-attach[hidden] { display: none; }

@media (max-width: 760px) {
  .sa-vbar { padding-left: 16px; padding-right: 8px; gap: 4px; }
  .sa-vstage { padding: 4px 4px 76px; }
  .sa-view.is-zoom .sa-vstage { padding: 0; }
  .sa-vnav { top: auto; bottom: calc(14px + env(safe-area-inset-bottom)); margin-top: 0; }
  .sa-vnav.is-prev { left: calc(50% - 60px); }
  .sa-vnav.is-next { right: calc(50% - 60px); }
  .sa-pics { width: min(240px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  .sa-view, .sa-pic img, .sa-prog > i { transition: none !important; }
}
