:root {
  --bg: #f4f3ee;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e4e2da;
  --brand: #2b3a67;
  --brand-2: #3d4f8a;
  --gold: #c9a227;
  --gold-soft: #f6efd6;
  --danger: #b4423a;
  --ok: #2b7a4b;
  --r: 14px;
  --shadow: 0 2px 10px rgba(30, 40, 70, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }
img, iframe { max-width: 100%; }
h1 { font-size: 26px; line-height: 1.25; margin: 6px 0 12px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
h3 { font-size: 17px; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
code { background: #eef0f5; padding: 1px 5px; border-radius: 5px; font-size: .92em; }
blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 10px 10px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
mark { background: #fff1a8; padding: 0 2px; border-radius: 3px; }

/* ── шапка ── */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.top .in {
  max-width: 1080px; margin: 0 auto; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: var(--gold); color: var(--brand); display: grid; place-items: center; font-size: 15px; font-weight: 800; }
.brand .txt { display: none; }
.top form { flex: 1; display: flex; }
.top input[type=search] {
  flex: 1; min-width: 0; border: 0; border-radius: 10px; padding: 8px 12px;
  background: rgba(255, 255, 255, .14); color: #fff; outline: none;
}
.top input[type=search]::placeholder { color: rgba(255, 255, 255, .7); }
.top input[type=search]:focus { background: #fff; color: var(--ink); }
.menu { position: relative; }
.menu > button { border: 0; background: rgba(255, 255, 255, .14); color: #fff; border-radius: 10px; padding: 7px 10px; cursor: pointer; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .dd {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); min-width: 200px; padding: 6px; display: none;
}
.menu.open .dd { display: block; }
.menu .dd a, .menu .dd button {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px;
  border-radius: 8px; text-decoration: none; color: var(--ink); cursor: pointer;
}
.menu .dd a:hover, .menu .dd button:hover { background: #f1f2f6; }
.menu .dd .who { padding: 8px 12px 4px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ── контент ── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px 14px 60px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs span.sep { opacity: .55; }
.head { display: flex; gap: 12px; align-items: flex-start; }
.head .ico { font-size: 34px; line-height: 1; margin-top: 4px; }
.intro { background: var(--card); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.intro > :last-child { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 22px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; background: var(--card); border-radius: var(--r);
  padding: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  border: 1px solid transparent; transition: transform .12s, border-color .12s, box-shadow .12s; min-height: 108px;
}
.tile:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 8px 22px rgba(30, 40, 70, .1); }
.tile .ico { font-size: 28px; line-height: 1; }
.tile .t { font-weight: 600; line-height: 1.3; }
.tile .s { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tile .meta { margin-top: auto; font-size: 12px; color: var(--muted); }
.tile.draft { opacity: .6; border-style: dashed; border-color: var(--muted); }
.tile.ext .t::after { content: " ↗"; color: var(--muted); font-weight: 400; }

.embed { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.embed .bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); gap: 8px; }
.embed iframe { display: block; width: 100%; height: 70vh; border: 0; background: #fff; }

.mats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.mat { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 14px; }
.mat .row { display: flex; gap: 10px; align-items: flex-start; }
.mat .ico { font-size: 22px; line-height: 1.2; width: 28px; text-align: center; flex: none; }
.mat .body { flex: 1; min-width: 0; }
.mat .t { font-weight: 600; }
.mat .n { font-size: 14px; color: var(--muted); margin-top: 2px; }
.mat .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.mat.draft { opacity: .65; border: 1px dashed var(--muted); }
.mat .inner { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.mat .inner iframe { width: 100%; height: 65vh; border: 0; border-radius: 8px; background: #fff; }
.mat .inner iframe.video { aspect-ratio: 16 / 9; height: auto; }
.mat .txt > :last-child { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: 7px 12px; border-radius: 10px; text-decoration: none; cursor: pointer; font-size: 14px;
  line-height: 1.2;
}
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--danger); border-color: #e7c9c6; }
.btn.danger:hover { background: #fbeeed; }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }

.navpn { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0 20px; }
.navpn a { flex: 1; background: var(--card); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); font-size: 14px; }
.navpn a small { display: block; color: var(--muted); font-size: 12px; }
.navpn a.next { text-align: right; }

/* ── формы ── */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.auth { max-width: 420px; margin: 24px auto; }
/* страницы входа — туманные горы на фоне */
body.auth-bg { background: #e9dcc6 url(/login-bg.jpg) center / cover no-repeat fixed; }
body.auth-bg .wrap { min-height: calc(100vh - 52px); display: flex; align-items: center; justify-content: center; }
body.auth-bg .auth { margin: 0; width: 100%; background: rgba(255, 253, 248, .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 12px 40px rgba(70, 50, 20, .18); }
@supports not (backdrop-filter: blur(6px)) { body.auth-bg .auth { background: rgba(255, 253, 248, .95); } }
.auth h1 { font-size: 22px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(43, 58, 103, .12); }
.field textarea { min-height: 120px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.check input { width: 18px; height: 18px; }
.err { color: var(--danger); font-size: 14px; margin: 8px 0; min-height: 1em; }
.ok { color: var(--ok); font-size: 14px; margin: 8px 0; }
.links { font-size: 14px; color: var(--muted); margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.notice { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 12px 14px; border-radius: 0 12px 12px 0; margin: 12px 0; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.results { display: flex; flex-direction: column; gap: 8px; }
.res { background: var(--card); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; }
.res .p { font-size: 12px; color: var(--muted); }
.res .t { font-weight: 600; }
.res .s { font-size: 14px; color: #444; margin-top: 3px; }
.res:hover { outline: 1px solid var(--gold); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }
.spinner { text-align: center; color: var(--muted); padding: 40px 0; }

@media (min-width: 640px) {
  .brand .txt { display: inline; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
  .tile { padding: 18px; min-height: 128px; }
  .wrap { padding: 22px 20px 80px; }
  h1 { font-size: 30px; }
}
