/* КП по ссылке — просмотрщик. Мобильный в первую очередь (ссылку откроют в Telegram на телефоне). Цвета ERP. */
:root { --bg:#f7f6f3; --surface:#fff; --border:#e2e0da; --text:#1a1917; --text2:#6b6862; --text3:#9e9b96; --accent:#1d5c3a; --accent-bg:#edf5f0; }
* { box-sizing:border-box; }
html,body { margin:0; background:var(--bg); color:var(--text); font-family:'Golos Text',system-ui,-apple-system,sans-serif; -webkit-text-size-adjust:100%; }

/* Полоска прогресса (max_page / pages) поверх всего */
.kp-progress { position:fixed; top:0; left:0; right:0; height:3px; z-index:20; }
.kp-progress-bar { height:100%; width:0; background:var(--accent); transition:width .3s; }

/* Шапка: логотип, название, счётчик страниц */
/* viewport-fit=cover: по бокам учитываем «чёлку» в альбомной ориентации iPhone */
.kp-top { position:sticky; top:0; display:flex; align-items:center; gap:12px; padding:10px 16px; padding:10px calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); background:rgba(247,246,243,.92); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); border-bottom:1px solid var(--border); z-index:10; }
.kp-logo { height:26px; display:block; }
.kp-title { flex:1; font-size:13px; color:var(--text2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kp-counter { font-size:13px; color:var(--text2); font-variant-numeric:tabular-nums; }
.kp-staff { background:#fff7e6; color:#8a5a00; font-size:12px; text-align:center; padding:6px 12px; border-bottom:1px solid #f0dcb0; }

/* Страницы: одна под другой на всю ширину; на десктопе по центру до 1100px */
.kp-pages { max-width:1100px; margin:0 auto; padding:12px 0 96px; }
.kp-page { position:relative; margin:0 auto 12px; width:100%; background:var(--surface); box-shadow:0 1px 3px rgba(0,0,0,.08); min-height:120px; }
.kp-page img { display:block; width:100%; height:auto; user-select:none; -webkit-user-select:none; -webkit-user-drag:none; -webkit-touch-callout:none; opacity:0; transition:opacity .2s; }
.kp-page.loaded img { opacity:1; }
/* Ошибка картинки: тап по странице запрашивает её заново (viewer.js) — в webview Telegram «обновить» неочевидно */
.kp-page.error { cursor:pointer; }
.kp-page.error::after { content:'Страница не загрузилась. Нажмите, чтобы попробовать снова.'; position:absolute; top:50%; left:0; right:0; transform:translateY(-50%); text-align:center; color:var(--text2); font-size:13px; padding:0 16px; }
/* Прозрачный слой поверх картинки — прикрывает «Сохранить как» и перетаскивание; щипок-зум не блокирует */
.kp-shield { position:absolute; top:0; left:0; right:0; bottom:0; }

/* Нижняя панель: «Обсудить в Telegram» и (если разрешено) «Скачать PDF» — две пилюли рядом по центру.
   Сам бар клики не ловит (pointer-events:none), чтобы не перекрывать страницу между кнопками. Высота CTA ≥ 44 px. */
.kp-bar { position:fixed; left:16px; right:16px; bottom:16px; left:calc(16px + env(safe-area-inset-left)); right:calc(16px + env(safe-area-inset-right)); bottom:calc(16px + env(safe-area-inset-bottom)); display:flex; justify-content:center; align-items:center; gap:10px; z-index:15; pointer-events:none; }
.kp-bar > * { pointer-events:auto; }
.kp-cta { background:var(--accent); color:#fff; text-decoration:none; font-weight:500; font-size:15px; padding:13px 22px; border-radius:999px; box-shadow:0 6px 20px rgba(29,92,58,.35); white-space:nowrap; }
.kp-download { font-size:13px; font-weight:500; color:var(--accent); text-decoration:none; background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:12px 14px; white-space:nowrap; }

/* Печать: прячем всё, показываем только предупреждение */
.kp-print-only { display:none; }
@media (min-width:900px) { .kp-pages { padding:24px 16px 96px; } }
@media print { body > * { display:none !important; } .kp-print-only { display:block !important; padding:40px; font-size:18px; } }

/* Страницы «Представьтесь» и заглушки (истекла / нет ссылки / готовится) */
.kp-plain { display:flex; min-height:100vh; align-items:center; justify-content:center; padding:24px 16px; }
.kp-card { width:100%; max-width:420px; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:28px 24px; text-align:center; }
.kp-card .kp-logo { margin:0 auto; }
.kp-card h1 { font-size:20px; margin:16px 0 6px; }
.kp-muted { color:var(--text2); font-size:13px; margin:0 0 18px; }
.kp-form { display:flex; flex-direction:column; gap:12px; text-align:left; }
.kp-form label { font-size:12px; color:var(--text2); display:flex; flex-direction:column; gap:4px; }
/* 16 px в поле — иначе iOS Safari зумит страницу при фокусе и не возвращает масштаб; высота ≈ 44 px */
.kp-form input { font:inherit; font-size:16px; padding:11px 12px; border:1px solid var(--border); border-radius:8px; }
.kp-btn { display:inline-block; background:var(--accent); color:#fff; border:0; border-radius:8px; padding:12px 18px; font:inherit; font-weight:500; text-decoration:none; cursor:pointer; margin-top:8px; }
.kp-error { color:#b42318; font-size:13px; margin:0; }
