:root {
  --bg: #f4f6fb; --card: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1d4ed8; --accent-soft: #e0e7ff; --ok: #059669; --warn: #d97706; --bad: #dc2626;
  --radius: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg-light) { --bg: #0f1115; --card: #1a1d24; --text: #f3f4f6; --muted: #9ca3af; --line: #2a2f3a;
    --accent: #60a5fa; --accent-soft: #1e293b; color-scheme: dark; }
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(64px + var(--safe-b)); }
body.tg #top { display: none; }               /* в Telegram заголовок и «Назад» — у самого Telegram */
#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; height: 52px;
  padding: 0 8px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
#title { flex: 1; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 40px; height: 40px; border: 0; background: none; color: var(--accent); font-size: 26px; cursor: pointer; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 0; }

#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
#tabs a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); text-decoration: none; }
#tabs a span { font-size: 21px; filter: grayscale(1); opacity: .7; }
#tabs a.on { color: var(--accent); font-weight: 600; }
#tabs a.on span { filter: none; opacity: 1; }
.dot { position: absolute; top: 0; left: 55%; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

.hello { margin: 4px 0 14px; } .hello h1 { margin: 0; font-size: 22px; } .hello p { margin: 2px 0 0; color: var(--muted); }
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input { flex: 1; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); font-size: 16px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; min-height: 92px; padding: 14px;
  border-radius: var(--radius); background: var(--card); color: var(--text); text-decoration: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / .06); border: 1px solid var(--line); }
.tile.wide { grid-column: 1 / -1; min-height: 64px; flex-direction: row; align-items: center; }
.tile .e { font-size: 24px; } .tile b { font-size: 15px; font-weight: 600; } .tile small { color: var(--muted); }
.tile:active, .row:active { transform: scale(.985); }

h2.sec { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.list { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .k { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); font-size: 19px; }
.row .t { flex: 1; min-width: 0; } .row .t b { display: block; font-weight: 500; }
.row .t small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--muted); }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: #d1fae5; color: var(--ok); }

.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 8px; } .crumbs a { color: var(--muted); }
.doc-h { margin: 0 0 10px; font-size: 20px; }

/* просмотр PDF: листы подряд, счётчик и полоса прогресса */
.pages { display: flex; flex-direction: column; gap: 10px; margin: 0 -16px; }
.pages .pg { position: relative; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.pages img { display: block; width: 100%; height: auto; }
.pages .n { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #6b7280; background: #fffc;
  padding: 1px 6px; border-radius: 6px; }
.pbar { position: sticky; top: 52px; z-index: 4; display: flex; align-items: center; gap: 10px; margin: 0 -16px 10px;
  padding: 8px 16px; background: var(--bg); font-size: 13px; color: var(--muted); }
body.tg .pbar { top: 0; }
.pbar .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

video { width: 100%; border-radius: var(--radius); background: #000; }
.media-img { width: 100%; border-radius: var(--radius); }

.ack { margin: 18px 0 8px; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  text-align: center; }
.ack p { margin: 0 0 10px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 46px; padding: 0 20px;
  border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; }
.done { color: var(--ok); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.card h3 { margin: 0 0 4px; font-size: 16px; } .card p { margin: 4px 0; } .muted { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
.hit { font-size: 13px; color: var(--muted); } .hit mark { background: #fde68a; color: inherit; }

.login { max-width: 380px; margin: 40px auto; text-align: center; }
.login h1 { font-size: 24px; margin: 8px 0; } .login .logo { font-size: 56px; }
.login .people { text-align: left; margin-top: 20px; }
.stub { border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; color: var(--muted); font-size: 14px; }
