/* ==========================================================================
   Чат с ассистентом
   ========================================================================== */

/* Оболочка прибита к окну: на iOS страница иначе уезжает вместе с шапкой,
   когда появляется клавиатура или прячется адресная строка.
   Высоту берём из --app-h - её выставляет скрипт по видимой области. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

.chat-body {
    position: fixed;
    top: var(--app-top, 0px);
    left: 0;
    right: 0;
    height: var(--app-h, 100%);
    min-height: 0;                   /* общий стиль ставит 100vh и мешает сжаться под клавиатуру */
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Свободный режим: система сама прокручивает страницу к полю ввода - оболочка
   перестаёт быть прибитой, а лента растёт вместе с документом. */
html.loose, html.loose body { height: auto; overflow: visible; }

.chat-body.loose {
    position: static;
    height: auto;
    min-height: var(--app-h, 100%);
}

.chat-body.loose .chat { overflow: visible; flex: 1 0 auto; }

/* ── Шапка ───────────────────────────────────────────────────────────── */
.chat-top {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
}

.chat-top__ava {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--c-tint);
    overflow: hidden;
    flex: 0 0 auto;
}

.chat-top__ava img { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; }
.chat-top__name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.chat-top__name b { font-size: 16px; font-weight: 600; }
.chat-top__name i { font-size: 13px; font-style: normal; color: var(--c-muted); }

/* ── Лента сообщений ─────────────────────────────────────────────────── */
.chat {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.msg { display: flex; }
.msg--bot { justify-content: flex-start; }
.msg--me { justify-content: flex-end; }

.bubble {
    max-width: 84%;
    padding: 12px 14px;
    border-radius: 16px 16px 16px 4px;
    background: var(--c-surface);
    font-size: 16px;
    line-height: 1.45;
}

/* Ответ приходит с переносами строк - этаж, адрес и описание должны стоять абзацами */
.bubble p { margin: 0 0 6px; white-space: pre-line; }
.bubble__lead { font-weight: 600; }
/* Пункт переносится на две-три строки, поэтому продолжение уходит под текст,
   а не под точку - иначе границы между пунктами не видно */
.bubble__list { margin: 0 0 6px; padding-left: 18px; }
.bubble__list li { margin: 2px 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble a { text-decoration: underline; }
.bubble a.btn { text-decoration: none; }

.msg--me .bubble {
    border-radius: 16px 16px 4px 16px;
    background: var(--c-primary);
    color: #fff;
    white-space: pre-line;
}

.msg--sticker { justify-content: flex-start; }
.sticker { width: 200px; height: 200px; object-fit: contain; }

/* ── Появление сообщений ─────────────────────────────────────────────
   Лента открывается пустой: сначала выскакивает стикер, следом - приветствие. */
@keyframes pop-in {
    0%   { opacity: 0; transform: scale(.3) rotate(-10deg); }
    55%  { opacity: 1; transform: scale(1.08) rotate(3deg); }
    75%  { transform: scale(.97) rotate(-1deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes rise {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

@keyframes rise-me {
    from { opacity: 0; transform: translateY(10px) translateX(8px); }
    to   { opacity: 1; transform: none; }
}

@keyframes fade-out {
    to { opacity: 0; transform: translateY(-4px) scale(.96); }
}

.msg--sticker .sticker { transform-origin: 60% 80%; }
.msg--sticker.show .sticker { animation: pop-in .55s cubic-bezier(.22, .9, .3, 1.2) both; }

/* Каждое сообщение всплывает при появлении: ответы бота - снизу, свои - из-под поля ввода */
.msg--bot > .bubble, .msg--bot > .place-card { animation: rise .34s cubic-bezier(.2, .8, .3, 1) both; }
.msg--me > .bubble { animation: rise-me .28s ease-out both; }
.msg.gone > .bubble { animation: fade-out .17s ease-in forwards; }

/* Содержимое ответа подтягивается следом, а не вываливается разом */
.msg .hint, .msg .option { animation: rise .3s ease-out both; }
.msg .hint:nth-child(1), .msg .option:nth-child(1) { animation-delay: .1s; }
.msg .hint:nth-child(2), .msg .option:nth-child(2) { animation-delay: .18s; }
.msg .hint:nth-child(3), .msg .option:nth-child(3) { animation-delay: .26s; }
.msg .hint:nth-child(n+4), .msg .option:nth-child(n+4) { animation-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
    .msg--sticker.show .sticker, .msg > .bubble, .msg .hint, .msg .option { animation: none; }
}

/* ── Где искали ──────────────────────────────────────────────────────
   Подпись к выдаче: объект поиска и способ выйти за его пределы. */
.scope {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--c-line);
}

.scope__label { font-size: 12px; color: var(--c-muted); }
.scope__label b { display: block; color: var(--c-text); font-size: 13px; }

.scope__btn {
    margin-left: auto;
    padding: 7px 12px;
    border: 1px solid var(--c-line);
    border-radius: 10px;
    background: var(--c-bg);
    color: var(--c-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.scope__btn:active { border-color: var(--c-muted); color: var(--c-text); }

/* ── Схемы маршрута ──────────────────────────────────────────────────
   Картинка участка пути и под ней то же самое словами. */
.shots { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.shot {
    margin: 0;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-bg);
    overflow: hidden;
    position: relative;
}

.shot__img {
    display: block;
    width: 100%;
    height: auto;
    background: linear-gradient(90deg, #FFFFFF 25%, var(--c-tint) 37%, #FFFFFF 63%);
    background-size: 300% 100%;
    animation: shot-wait 1.4s ease-in-out infinite;
    opacity: .35;
    transition: opacity .25s ease;
}

.shot__img.is-ready { background: #fff; animation: none; opacity: 1; }

@keyframes shot-wait { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.shot__cap { padding: 9px 12px 11px; font-size: 14px; line-height: 1.4; }
.shot__cap b { display: block; margin-bottom: 2px; color: var(--c-primary); font-size: 13px; }

/* ── Подсказки-примеры ───────────────────────────────────────────────── */
.hints { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.hint {
    padding: 9px 12px;
    border: 1px solid var(--c-primary-soft);
    border-radius: 12px;
    background: var(--c-bg);
    color: var(--c-primary);
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.hint:active { background: var(--c-tint); }

/* ── Карточка найденного объекта ─────────────────────────────────────── */
.place-card {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--c-bg);
}

.place-card__title { font-weight: 600; margin-bottom: 6px; }

.place-card__addr {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--c-muted);
    font-size: 15px;
}

.place-card__addr svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.place-card__acts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
}

.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--c-primary); color: #fff; }
.btn--soft { background: var(--c-primary-soft); color: var(--c-primary); }

/* ── Кнопки уточнения ────────────────────────────────────────────────── */
.options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.option {
    padding: 10px 12px;
    border: 1px solid var(--c-line);
    border-radius: 12px;
    background: var(--c-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.option:active { border-color: var(--c-primary); background: var(--c-bg); }
.option b { display: block; font-size: 15px; font-weight: 600; }
.option i { display: block; font-style: normal; font-size: 13px; color: var(--c-muted); margin-top: 2px; }

/* ── Индикатор набора ────────────────────────────────────────────────── */
.typing { display: flex; align-items: center; gap: 5px; padding: 11px 14px; }
.typing i { font-style: normal; font-size: 13px; color: var(--c-muted); margin-right: 2px; }

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-primary-soft);
    animation: typing 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

@keyframes typing { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ── Поле ввода ──────────────────────────────────────────────────────── */
.composer {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: var(--c-surface);
    border-top: 1px solid var(--c-line);
}

/* Без разделов под ним поле ввода само отступает от системной полосы -
   но не под клавиатурой: там она эту полосу и закрывает */
.chat-body.kb .composer { padding-bottom: 10px; }
.chat-body:not(.kb) .composer:last-child { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

.composer__field {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 136px;        /* ровно пять строк: 5 x 22 + отступы и рамка, иначе верхняя режется пополам */
    padding: 12px 14px;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: inherit;
    font-size: 16px;
    line-height: 22px;
    resize: none;
    overflow-y: auto;
    outline: none;
}

.composer__field:focus { border-color: var(--c-primary); background: var(--c-surface); }
.composer__field::placeholder { color: var(--c-muted); }

.composer__send {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    cursor: pointer;
}

.composer__send svg { width: 22px; height: 22px; }
.composer__send:disabled { background: var(--c-primary-soft); cursor: default; }

/* ── Нижние разделы ──────────────────────────────────────────────────── */
.tabs {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--c-surface);
    border-top: 1px solid var(--c-line);
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: var(--c-muted);
    font-family: inherit;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
}

.tab svg { width: 24px; height: 24px; }
.tab:disabled { opacity: .45; cursor: default; }
.tab:focus { outline: none; }

/* Нажатие показываем сжатием иконки, а не рамкой */
.tab:active:not(:disabled) svg { transform: scale(.92); }
.tab svg { transition: transform .12s ease; }

/* Центральная - текущий чат: только круг, по центру высоты соседних кнопок */
.tab--chat {
    align-self: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    color: var(--c-primary);
}

.tab--chat span {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(27, 90, 184, .35);
}

.tab--chat span svg { width: 24px; height: 24px; }

/* Открытая вкладка подсвечена; круглая кнопка чата гаснет, когда открыт раздел */
.tab.is-active { color: var(--c-primary); }
.chat-body.screen-open .tab--chat span { background: var(--c-primary-soft); color: var(--c-primary); box-shadow: none; }

/* С открытой клавиатурой места мало - разделы уступают его полю ввода */
.chat-body.kb .tabs { display: none; }

@media (min-width: 640px) {
    .chat, .chat-top, .composer, .tabs, .screen { width: 100%; max-width: 620px; margin-inline: auto; }
    .chat-body { background: var(--c-bg); }
}

/* ── Вне мессенджера ──────────────────────────────────────────────────
   До ответа Bridge прячем и чат, и заглушку - иначе в MAX на мгновение
   мелькает «я живу в мессенджере» */
.chat-body.is-checking .chat-top,
.chat-body.is-checking .chat,
.chat-body.is-checking .composer,
.chat-body.is-checking .tabs { visibility: hidden; }

.chat-body.only-web .chat-top,
.chat-body.only-web .chat,
.chat-body.only-web .composer,
.chat-body.only-web .tabs { display: none; }

.only-max {
    min-height: 100%;
    padding: 32px 24px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
}

.only-max__ava { width: 150px; height: 150px; }
.only-max__title { font-size: 22px; font-weight: 600; color: var(--c-primary); }
.only-max__text { max-width: 320px; color: var(--c-muted); font-size: 15px; line-height: 1.45; }

.only-max__btn {
    margin-top: 6px;
    padding: 14px 28px;
    border-radius: 14px;
    background: var(--c-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

/* ── Разделы приложения ───────────────────────────────────────────────
   Открытый раздел закрывает чат и поле ввода, но не выгружает их */
.chat-body.screen-open .chat-top,
.chat-body.screen-open .chat,
.chat-body.screen-open .composer { display: none; }

.screen {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen__title { font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--c-primary); }
.screen__lead { margin-top: 8px; color: var(--c-muted); font-size: 15px; line-height: 1.45; }

.screen__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-muted);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.screen__back svg { width: 18px; height: 18px; }

/* ── Плашки разделов ──────────────────────────────────────────────── */
.cards { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.pcard {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px;
    border: 0;
    border-radius: 18px;
    background: var(--c-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease;
}

.pcard:active { transform: scale(.985); }
a.pcard { text-decoration: none; color: inherit; }

.pcard__ico {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--c-tint);
    color: var(--c-primary);
}

.pcard__ico svg { width: 24px; height: 24px; }

/* У ботов вместо значка своя аватарка - она заполняет плитку целиком */
.pcard__ico--photo { background: none; overflow: hidden; }
.pcard__ico--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pcard__text b { font-size: 16px; font-weight: 600; }
.pcard__text i { font-style: normal; font-size: 13px; line-height: 1.35; color: var(--c-muted); }
.pcard__go { color: var(--c-primary-soft); }
.pcard__go svg { width: 18px; height: 18px; display: block; }

/* ── Частые вопросы ──────────────────────────────────────────────── */
.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.faq__item {
    border-radius: 16px;
    background: var(--c-surface);
    overflow: hidden;
    transition: box-shadow .2s ease;
}

.faq__item.is-open { box-shadow: 0 6px 18px rgba(27, 90, 184, .08); }

.faq__q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 15px 16px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    color: var(--c-text);
    cursor: pointer;
}

.faq__q svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--c-muted); transition: transform .2s ease; }
.faq__item.is-open .faq__q svg { transform: rotate(180deg); }

.faq__a {
    padding: 0 16px 16px;
    color: var(--c-muted);
    font-size: 14px;
    line-height: 1.5;
    animation: faq-open .22s ease both;
}

.faq__a a { color: var(--c-primary); text-decoration: none; word-break: break-word; }

@keyframes faq-open {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* ── Плашка без значка: список корпусов ───────────────────────────── */
.pcard--plain { grid-template-columns: minmax(0, 1fr) 18px; }

/* ── Форма заявки ─────────────────────────────────────────────────── */
.tform { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.tfield { display: block; }
.tfield__label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--c-muted); }
.tfield__label i { font-style: normal; color: var(--c-danger); }

.tfield__input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    background: var(--c-surface);
    font: inherit;
    font-size: 15px;
    color: var(--c-text);
}

.tfield__input:focus { outline: none; border-color: var(--c-primary); }
.tfield__area { resize: vertical; min-height: 96px; line-height: 1.45; }

/* Дату подачи не выбирают - её ставит система в момент отправки */
.tfield__input--locked { background: var(--c-bg); color: var(--c-muted); }

.tphoto {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px dashed var(--c-primary-soft);
    border-radius: 14px;
    background: var(--c-surface);
    color: var(--c-primary);
    font-size: 14px;
    cursor: pointer;
}

.tphoto svg { width: 22px; height: 22px; flex: 0 0 auto; }

.tform__error {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--c-danger-bg);
    color: var(--c-danger);
    font-size: 14px;
}

.tform__send {
    margin-top: 4px;
    padding: 15px;
    border: 0;
    border-radius: 16px;
    background: var(--c-primary);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.tform__send:disabled { opacity: .6; }

/* ── Мои заявки ───────────────────────────────────────────────────── */
.tickets { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.tickets__wait { padding: 28px 0; text-align: center; color: var(--c-muted); font-size: 14px; }

/* Экран растягивается на всю высоту, чтобы пустое состояние стояло по центру */
#screen-tickets { display: flex; flex-direction: column; }
#tickets-list { flex: 1 1 auto; min-height: 0; }
#tickets-list.is-empty { display: flex; align-items: center; justify-content: center; }

.tickets__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-bottom: 40px;
    text-align: center;
    color: var(--c-muted);
}

.tickets__empty svg { width: 56px; height: 56px; color: var(--c-primary-soft); }
.tickets__empty p { font-size: 17px; font-weight: 600; color: var(--c-text); }
.tickets__empty span { font-size: 14px; max-width: 260px; }

.ticket { padding: 14px 16px; border-radius: 16px; background: var(--c-surface); }
.ticket__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ticket__top b { font-size: 15px; font-weight: 600; }

.ticket__state {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.ticket__state.is-new { background: var(--c-tint); color: var(--c-primary); }
.ticket__state.is-work { background: var(--c-warn-bg); color: var(--c-warn); }
.ticket__state.is-done { background: var(--c-ok-bg); color: var(--c-ok); }
.ticket__state.is-rejected { background: var(--c-danger-bg); color: var(--c-danger); }

.ticket__where { font-size: 13px; color: var(--c-muted); }
.ticket__text { margin-top: 8px; font-size: 14px; line-height: 1.45; }
.ticket__date { margin-top: 8px; font-size: 12px; color: var(--c-muted); }

/* ── Скелетон списка заявок ───────────────────────────────────────── */
.ticket--sk { pointer-events: none; }

.ticket--sk .ticket__top { align-items: center; }
.ticket--sk .ticket__text { display: flex; flex-direction: column; gap: 7px; }

.sk {
    display: block;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--c-bg) 25%, #EAF1FC 37%, var(--c-bg) 63%);
    background-size: 400% 100%;
    animation: sk-shine 1.4s ease infinite;
}

.sk--title { width: 46%; height: 15px; }
.sk--pill { width: 66px; height: 22px; border-radius: 8px; }
.sk--where { width: 62%; height: 12px; margin-top: 2px; }
.sk--line { width: 100%; height: 13px; }
.sk--short { width: 72%; }
.sk--date { width: 34%; height: 11px; margin-top: 8px; }

@keyframes sk-shine {
    from { background-position: 100% 50%; }
    to   { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .sk { animation: none; }
}

/* ── Сообщение «раздел готовится» ─────────────────────────────────── */
.screen-toast {
    position: fixed;
    left: 50%;
    /* Над полем ввода, а не поверх него: при одной строке ввода и включённых
       разделах сообщение наезжало на поле, и человек читал его сквозь кнопку.
       136px = поле ввода (примерно 62) + полоса разделов (примерно 58) + зазор. */
    bottom: calc(136px + env(safe-area-inset-bottom));
    z-index: 20;
    max-width: 82%;
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(35, 35, 35, .9);
    color: #fff;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.screen-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ── Схема во весь экран ──────────────────────────────────────────────
   Открывается нажатием на схему в чате: щипок - масштаб, свайп вниз - закрыть.
   Высоту берём от inset, а не от vh: в WebView vh врёт. */
.viewer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: #0E1622;
    transition: opacity .2s ease;
}

body.is-viewing { overflow: hidden; }

.viewer__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
    color: #FFFFFF;
}

.viewer__ttl {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer__btn {
    flex: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #FFFFFF;
    cursor: pointer;
}

.viewer__btn svg { width: 22px; height: 22px; }
.viewer__btn:active { background: rgba(255, 255, 255, .28); }

.viewer__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.viewer__img {
    max-width: none;
    transform-origin: center center;
    opacity: 0;
    background: #FFFFFF;
    border-radius: 4px;
}

.viewer__img.is-ready { opacity: 1; }

.viewer__hint {
    padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
    text-align: center;
    transition: opacity .4s ease;
}

.viewer__hint.is-gone { opacity: 0; }

.shot__img { cursor: zoom-in; }

/* Подсказка, что схему можно раскрыть */
.shot__zoom {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 4px rgba(14, 22, 34, .18);
    color: var(--c-primary);
    pointer-events: none;
}

.shot__zoom svg { width: 16px; height: 16px; }

/* Предпросмотр в админке: полоса прокрутки съедала бы ширину, а меню
   разделов там ни к чему - проверяют поиск и маршруты. */
body[data-preview] { scrollbar-width: none; }
body[data-preview] ::-webkit-scrollbar { width: 0; height: 0; }
body[data-preview] .tabs { display: none; }
