/* ============================================================
   ABV · AnatBaseVariability — оформление V8
   Одна гарнитура (Commissioner, вариативная), тёмная «плёночная» палитра,
   шкала распространённости: редкий → умеренный → частый.
============================================================ */
@font-face {
  font-family: "Commissioner"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/commissioner-cyrillic-full-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Commissioner"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/commissioner-latin-full-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+2248, U+FEFF, U+FFFD;
}

:root {
  --bg: #0b1016;
  --surface: #121922;
  --raised: #19222d;
  --line: #243040;
  --line-soft: #1b2531;
  --text: #e9eef4;
  --dim: #9aa8b9;
  --faint: #66758a;
  --bone: #efe7d3;
  --link: #8ab6ff;
  --rare: #8a7cf5;
  --mid: #2fb6c0;
  --common: #e8a13a;
  --danger: #ff7a70;
  --ok: #5ccb8f;
  --top-h: 56px;
  --r: 6px;
  --font: "Commissioner", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5; font-weight: 400;
  font-variation-settings: "FLAR" 0, "VOLM" 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }
::selection { background: #2b4a7a; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--raised); color: var(--text); font-weight: 520; font-size: 0.94rem; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #202b38; border-color: #33435a; text-decoration: none; }
.btn-primary { background: var(--bone); border-color: var(--bone); color: #11161d; font-weight: 620; }
.btn-primary:hover { background: #fff8e6; border-color: #fff8e6; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--dim); padding: 0 10px; }
.btn-quiet:hover { background: var(--raised); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: #7a3b38; background: #2a1a1b; }
.btn-ok { background: #173326; border-color: #24553c; color: #9fe6c0; }
.btn-ok:hover { background: #1c3f2f; border-color: #2d6a4b; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 0.86rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: rgba(11, 16, 22, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 800; font-size: 1.32rem; letter-spacing: -0.02em; font-variation-settings: "FLAR" 100, "VOLM" 100; }
.brand-name { color: var(--dim); font-size: 0.9rem; }
.tag-open {
  font-size: 0.74rem; line-height: 1; color: var(--mid); border: 1px solid #1d5e66; border-radius: 99px;
  padding: 4px 9px 5px; align-self: center;
}
.top-nav { margin-left: auto; display: flex; gap: 4px; }
.top-nav a { color: var(--dim); padding: 8px 12px; border-radius: var(--r); font-size: 0.94rem; }
.top-nav a:hover, .top-nav a[aria-current="page"] { color: var(--text); background: var(--raised); text-decoration: none; }

/* ============================================================
   Главная: «рабочая станция» — слева атлас, справа каталог
============================================================ */
.station { display: grid; grid-template-columns: minmax(380px, 45%) minmax(0, 1fr); align-items: start; }
.viewport {
  position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h));
  min-height: 420px; overflow: hidden; border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, #17212e 0%, rgba(18, 25, 34, 0) 70%),
    #090d12;
  user-select: none; -webkit-user-select: none;
}
.viewport-poster, .viewport-stage { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewport-poster { object-fit: contain; padding: 8px 0; opacity: .9; transition: opacity .5s; pointer-events: none; }
.viewport.is-live .viewport-poster { opacity: 0; }
.viewport-stage { opacity: 0; transition: opacity .6s; }
.viewport.is-live .viewport-stage { opacity: 1; }
.atlas-canvas { position: absolute; inset: 0; touch-action: none; outline: none; }
.atlas-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.atlas-leaders { position: absolute; inset: 0; width: 100%; height: 100%; }
.atlas-leaders polyline { fill: none; stroke: rgba(233, 238, 244, .34); stroke-width: 1; }
.atlas-leaders circle { fill: #0b1016; stroke: rgba(233, 238, 244, .7); stroke-width: 1.2; }
.atlas-leaders .is-hot { stroke: #fff; }
.atlas-leaders polyline.is-hot { stroke-width: 1.4; }
.atlas-label {
  position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 7px;
  max-width: 46%; padding: 3px 4px 3px 9px; border-radius: 4px; border: 1px solid transparent;
  background: rgba(13, 19, 27, .82); color: var(--text); font-size: 0.8rem; line-height: 1.25; text-align: left;
  will-change: transform;
}
.atlas-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atlas-label b {
  font-weight: 600; font-variant-numeric: tabular-nums; min-width: 20px; text-align: center; padding: 0 5px;
  border-radius: 3px; background: var(--bone); color: #11161d; font-size: 0.74rem; line-height: 1.5;
}
.atlas-label.is-empty { color: var(--dim); }
.atlas-label.is-empty b { background: #232e3c; color: var(--faint); }
.atlas-label:hover, .atlas-label:focus-visible { border-color: #4a5d78; background: #17212d; color: #fff; }
.atlas-label.is-selected { border-color: var(--bone); background: #1c2632; color: #fff; }
.atlas-tip {
  position: absolute; left: 0; top: 0; padding: 4px 9px; border-radius: 4px; background: #05080c; border: 1px solid var(--line);
  font-size: 0.82rem; white-space: nowrap; z-index: 3;
}
.atlas-tip b { margin-left: 8px; font-weight: 600; color: var(--bone); font-variant-numeric: tabular-nums; }
.atlas-side { position: absolute; left: 0; top: 0; font-size: 0.78rem; font-weight: 600; color: var(--faint); }

/* элементы управления поверх атласа */
.vp-layers { position: absolute; left: 14px; top: 14px; z-index: 4; display: flex; flex-direction: column; gap: 2px; }
.vp-layer {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border-radius: 4px; font-size: 0.84rem; color: var(--dim);
  cursor: pointer; background: rgba(9, 13, 18, .55);
}
.vp-layer:hover { color: var(--text); background: rgba(25, 34, 45, .9); }
.vp-layer input { position: absolute; opacity: 0; pointer-events: none; }
.vp-layer i {
  width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid #4a5a70; flex: none; position: relative;
  transition: background .15s, border-color .15s;
}
.vp-layer input:checked + i { background: var(--c, var(--bone)); border-color: var(--c, var(--bone)); }
.vp-layer input:checked ~ span { color: var(--text); }
.vp-layer input:focus-visible + i { outline: 2px solid var(--link); outline-offset: 2px; }
.vp-layer.is-loading i { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.vp-tools { position: absolute; right: 12px; top: 12px; z-index: 4; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.vp-tool {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 4px;
  background: rgba(9, 13, 18, .6); border: 1px solid var(--line); color: var(--dim); font-size: 0.84rem;
}
.vp-tool:hover { color: var(--text); border-color: #3b4c63; background: #141c26; }
.vp-tool[aria-pressed="true"] { color: #11161d; background: var(--bone); border-color: var(--bone); }
.vp-tool svg { width: 15px; height: 15px; }
.vp-tool-row { display: flex; gap: 6px; }
.vp-tool-icon { width: 32px; padding: 0; justify-content: center; }

.vp-panel {
  position: absolute; right: 12px; top: 126px; z-index: 5; width: 292px; padding: 12px; border-radius: var(--r);
  background: rgba(12, 17, 24, .96); border: 1px solid var(--line); font-size: 0.84rem;
}
.vp-panel h3 { font-size: 0.84rem; font-weight: 600; margin-bottom: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { padding: 6px 2px; font-size: 0.78rem; color: var(--dim); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--bone); color: #11161d; font-weight: 600; }
.vp-panel input[type="range"] { width: 100%; margin: 12px 0 2px; accent-color: var(--bone); }
.vp-panel p { color: var(--faint); font-size: 0.78rem; line-height: 1.35; margin-top: 6px; }
.heat-legend { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 0.78rem; }
.heat-legend i { flex: 1; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #33405a, #78263a 35%, #db542e 68%, #ffd680); }

.vp-crumbs {
  position: absolute; left: 14px; bottom: 14px; right: 150px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  font-size: 0.86rem;
}
.vp-crumbs button { padding: 4px 8px; border-radius: 4px; color: var(--dim); background: rgba(9, 13, 18, .6); }
.vp-crumbs button:hover { color: var(--text); background: #17212d; }
.vp-crumbs .is-current { color: #fff; font-weight: 600; background: #1c2632; cursor: default; }
.vp-crumbs .vp-close { width: 28px; height: 28px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); margin-left: 4px; color: var(--text); }
.vp-crumbs .vp-close:hover { border-color: var(--bone); }
.vp-crumbs svg { width: 12px; height: 12px; }
.vp-crumbs .sep { color: var(--faint); }
.vp-note { position: absolute; right: 14px; bottom: 16px; z-index: 3; text-align: right; font-size: 0.74rem; color: var(--faint); line-height: 1.35; max-width: 140px; }
.vp-hint {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 4; padding: 6px 12px; border-radius: 99px;
  background: rgba(5, 8, 12, .86); border: 1px solid var(--line); color: var(--dim); font-size: 0.82rem; text-align: center;
  width: max-content; max-width: calc(100% - 28px);
  transition: opacity .4s; pointer-events: none;
}
.vp-hint.is-gone { opacity: 0; }

/* указатель структур (и запасной вариант без WebGL) */
.vp-index {
  position: absolute; inset: 0; z-index: 6; overflow: auto; padding: 58px 22px 24px; background: rgba(9, 13, 18, .97);
}
.vp-index-close { position: absolute; right: 12px; top: 12px; }
.vp-index h2 { font-size: 1.05rem; font-weight: 620; margin-bottom: 4px; }
.vp-index > p { color: var(--dim); font-size: 0.86rem; margin-bottom: 14px; max-width: 46ch; }
.index-grid { columns: 2 200px; column-gap: 28px; }
.index-group { break-inside: avoid; margin-bottom: 16px; }
.index-group > button { font-weight: 620; font-size: 0.94rem; padding: 3px 0; color: var(--text); display: flex; gap: 8px; align-items: baseline; }
.index-group li button { display: flex; width: 100%; gap: 8px; align-items: baseline; padding: 2px 0; color: var(--dim); font-size: 0.88rem; text-align: left; }
.index-group button:hover { color: #fff; }
.index-group b { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--faint); }
.index-group button.has b { color: var(--bone); }
.index-group i { width: 8px; height: 8px; border-radius: 2px; flex: none; align-self: center; }

/* ---------- правая колонка ---------- */
.column { min-width: 0; }
.view { padding: 44px clamp(20px, 4.2vw, 64px) 72px; max-width: 880px; }
.hero h1 {
  font-size: clamp(2.5rem, 4.6vw, 4.3rem); line-height: 0.98; letter-spacing: -0.035em; font-weight: 500;
  max-width: 11ch; text-wrap: balance;
}
.hero h1 span { font-weight: var(--w, 500); font-variation-settings: "FLAR" var(--f, 0), "VOLM" var(--f, 0); }
.hero p { margin-top: 20px; max-width: 54ch; color: var(--dim); font-size: 1.06rem; line-height: 1.5; }

.finder { margin-top: 34px; }
.search { position: relative; display: block; }
.search input {
  width: 100%; height: 48px; padding: 0 44px 0 44px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); font-size: 1rem;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: #4f6a92; background: #141c26; }
.search svg { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search kbd {
  position: absolute; right: 12px; top: 12px; min-width: 24px; height: 24px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 4px; color: var(--faint); font: inherit; font-size: 0.8rem;
}

/* шкала распространённости: распределение каталога и фильтр */
.scale { margin-top: 26px; }
.scale-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.scale-head h2 { font-size: 0.94rem; font-weight: 600; }
.scale-head a { font-size: 0.84rem; color: var(--dim); }
.scale-bar { display: flex; gap: 3px; }
.scale-seg {
  flex: var(--n, 1) 1 0; min-width: 96px; text-align: left; padding: 0; border-radius: 4px; color: var(--dim);
  transition: opacity .15s;
}
.scale-seg i { display: block; height: 10px; border-radius: 3px; background: var(--c); opacity: .9; }
.scale-seg b { display: block; margin-top: 7px; font-weight: 600; color: var(--text); font-size: 0.94rem; }
.scale-seg b em { font-style: normal; font-weight: 400; color: var(--dim); margin-left: 6px; font-variant-numeric: tabular-nums; }
.scale-seg small { display: block; font-size: 0.8rem; color: var(--faint); }
.scale-seg:hover i { opacity: 1; box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }
.scale.has-active .scale-seg:not([aria-pressed="true"]) { opacity: .38; }
.scale-seg[aria-pressed="true"] b { color: var(--c); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.chip {
  height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); color: var(--dim); font-size: 0.86rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); border-color: #3b4c63; }
.chip[aria-pressed="true"] { background: var(--bone); border-color: var(--bone); color: #11161d; font-weight: 600; }
.chip em { font-style: normal; font-variant-numeric: tabular-nums; opacity: .7; }
.chip.is-zero:not([aria-pressed="true"]) { opacity: .45; }

.list-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 34px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.list-head h2 { font-size: 1.02rem; font-weight: 620; }
.list-head h2 em { font-style: normal; color: var(--dim); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.place-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 4px; background: #1c2632;
  font-size: 0.86rem; color: #fff;
}
.place-chip button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 3px; color: var(--dim); }
.place-chip button:hover { background: #2a3747; color: #fff; }
.place-chip svg { width: 10px; height: 10px; }
.sort { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 0.86rem; }
.sort select, .field select {
  appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%239aa8b9' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 10px;
  border: 1px solid var(--line); border-radius: var(--r); padding: 0 30px 0 10px;
}
.sort select { height: 30px; font-size: 0.86rem; color: var(--text); }

/* строки каталога */
.rows { margin: 0; }
.row {
  display: grid; grid-template-columns: 68px minmax(0, 1fr) 132px; gap: 16px; align-items: center;
  padding: 12px 10px; margin: 0 -10px; border-bottom: 1px solid var(--line-soft); color: var(--text); border-radius: 4px;
}
.row:hover, .row.is-hot { background: var(--surface); text-decoration: none; }
.row-thumb { width: 68px; height: 68px; border-radius: 4px; background: #070a0e center / cover no-repeat; border: 1px solid var(--line-soft); overflow: hidden; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-title { font-weight: 560; font-size: 1.02rem; line-height: 1.28; text-wrap: pretty; }
.row-meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--dim); font-size: 0.86rem; }
.row-meta .where { color: var(--text); }
.row-meta .kind { color: var(--dim); }
.row-meta .who { color: var(--faint); }
.prev { display: grid; gap: 5px; justify-items: start; min-width: 0; }
.prev-line { position: relative; width: 100%; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #3a3470, #1c5a61 50%, #6b4c1e); }
.prev-line i { position: absolute; top: 50%; left: var(--p); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--bg); }
.row:hover .prev-line i, .row.is-hot .prev-line i { box-shadow: 0 0 0 3px var(--surface); }
.prev-text { font-size: 0.86rem; color: var(--c); font-weight: 560; }
.prev-text { display: flex; flex-wrap: wrap; gap: 0 6px; max-width: 100%; }
.prev-text em { font-style: normal; color: var(--dim); font-weight: 400; font-variant-numeric: tabular-nums; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 44px 0 20px; color: var(--dim); max-width: 46ch; }
.empty h3 { color: var(--text); font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }
.skeleton .row-title, .skeleton .row-meta, .skeleton .row-thumb { background: var(--surface); color: transparent; border-radius: 4px; }
.skeleton .row-title { width: 70%; height: 20px; } .skeleton .row-meta { width: 44%; height: 14px; }

/* ---------- материал ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 0.92rem; margin: -8px 0 22px -8px; padding: 6px 10px 6px 6px; border-radius: 4px; }
.back:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.back svg { width: 16px; height: 16px; }
.mat h1 { font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em; font-weight: 640; font-variation-settings: "FLAR" 60, "VOLM" 40; text-wrap: balance; max-width: 24ch; }
.mat-latin { margin-top: 8px; color: var(--dim); font-variation-settings: "slnt" -12; font-size: 1.04rem; }
.facts { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.facts > div { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.facts dt { color: var(--faint); font-size: 0.82rem; }
.facts dd { margin-top: 2px; font-size: 0.98rem; overflow-wrap: anywhere; }
.facts dd button { color: var(--link); text-align: left; }
.facts dd button:hover { text-decoration: underline; text-underline-offset: 3px; }
.facts .prev { max-width: 150px; margin-top: 6px; }
.facts .prev-line i { box-shadow: 0 0 0 3px var(--bg); }

.media { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #05070a; }
.media-stage { position: relative; height: min(62vh, 520px); overflow: hidden; cursor: grab; touch-action: none; }
.media-stage:active { cursor: grabbing; }
.media-stage img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: 0 0; will-change: transform, filter; -webkit-user-drag: none; user-select: none; }
.media-stage canvas { width: 100%; height: 100%; }
.media-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface); font-size: 0.84rem; color: var(--dim); }
.media-bar label { display: flex; align-items: center; gap: 8px; }
.media-bar input[type="range"] { width: 96px; accent-color: var(--bone); }
.media-bar .spacer { flex: 1; }
.media-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 0.92rem; text-align: center; padding: 20px; }
.filebox { margin-top: 26px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.filebox b { font-weight: 600; } .filebox span { color: var(--dim); font-size: 0.88rem; display: block; }
.filebox .btn { margin-left: auto; }
.ext { min-width: 46px; height: 46px; padding: 0 6px; border-radius: 4px; display: grid; place-items: center; background: #1c2632; font-weight: 700; font-size: 0.8rem; color: var(--bone); }

.prose { margin-top: 30px; max-width: 66ch; }
.prose h2 { font-size: 1.02rem; font-weight: 640; margin-bottom: 6px; }
.prose p { color: #cfd8e3; white-space: pre-line; overflow-wrap: anywhere; }
.prose + .prose { margin-top: 22px; }
.signif { border-left: 3px solid var(--c, var(--mid)); padding-left: 16px; }

.cite { margin-top: 34px; border-top: 1px solid var(--line); padding-top: 20px; }
.cite h2 { font-size: 1.02rem; font-weight: 640; margin-bottom: 10px; }
.cite-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.cite-box p, .cite-box pre { margin: 0; color: #cfd8e3; font-size: 0.92rem; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.cite-box small { display: block; color: var(--faint); font-size: 0.8rem; margin-bottom: 2px; }
.mat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.related { margin-top: 38px; }
.related h2 { font-size: 1.02rem; font-weight: 640; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

/* ---------- формы ---------- */
.form h1 { font-size: clamp(1.7rem, 2.6vw, 2.3rem); line-height: 1.1; letter-spacing: -0.02em; font-weight: 640; font-variation-settings: "FLAR" 60, "VOLM" 40; }
.form > p { margin-top: 10px; color: var(--dim); max-width: 58ch; }
.fieldset { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.fieldset > h2 { grid-column: 1 / -1; font-size: 1.02rem; font-weight: 640; }
.fieldset > h2 small { display: block; font-weight: 400; color: var(--dim); font-size: 0.88rem; margin-top: 2px; }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field .label { font-size: 0.88rem; color: var(--dim); }
.field label em { font-style: normal; color: var(--faint); }
.field input[type="text"], .field input[type="email"], .field input[type="number"], .field input[type="password"], .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: var(--r); border: 1px solid var(--line); background-color: var(--surface);
}
.field select { padding-right: 30px; }
.field textarea { min-height: 108px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #4f6a92; background-color: #141c26; }
.field small { color: var(--faint); font-size: 0.8rem; line-height: 1.35; }
.field.is-bad input, .field.is-bad select, .field.is-bad textarea { border-color: #8a4441; }
.level { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.level label { cursor: pointer; }
.level input { position: absolute; opacity: 0; }
.level span { display: block; padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 0.92rem; line-height: 1.25; border-top: 3px solid var(--c); }
.level span small { display: block; color: var(--faint); font-size: 0.78rem; }
.level input:checked + span { border-color: var(--c); background: #17202b; }
.level input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 2px; }
.drop {
  grid-column: 1 / -1; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 26px 16px; border: 1.5px dashed #34445a; border-radius: var(--r);
  color: var(--dim); cursor: pointer; background: var(--surface);
}
.drop:hover, .drop.is-over { border-color: var(--bone); color: var(--text); }
.drop b { color: var(--text); font-weight: 600; }
.drop small { color: var(--faint); font-size: 0.82rem; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-file { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.drop-file img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.check { grid-column: 1 / -1; display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 0.92rem; color: #cfd8e3; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--bone); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.form-foot { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.form-msg { font-size: 0.92rem; color: var(--danger); }
.done { padding: 40px 0; max-width: 50ch; }
.done h1 { font-size: 2rem; font-weight: 640; letter-spacing: -0.02em; font-variation-settings: "FLAR" 60, "VOLM" 40; }
.done p { margin-top: 10px; color: var(--dim); }
.done .mat-actions { margin-top: 22px; }

/* ---------- подвал ---------- */
.foot { border-top: 1px solid var(--line-soft); background: #080c11; position: relative; z-index: 2; overflow: hidden; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 32px; padding: 44px clamp(20px, 4vw, 56px) 8px; max-width: 1280px; }
.foot h2 { font-size: 0.94rem; font-weight: 640; margin-bottom: 10px; }
.foot p, .foot li { color: var(--dim); font-size: 0.92rem; }
.foot li + li { margin-top: 6px; }
.foot a { color: var(--dim); } .foot a:hover { color: var(--text); }
.foot-base { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 22px clamp(20px, 4vw, 56px) 0; color: var(--faint); font-size: 0.84rem; }
.foot-word {
  font-weight: 880; font-size: clamp(7rem, 27vw, 25rem); line-height: 0.74; letter-spacing: -0.055em; padding: 0.11em 0 0 clamp(8px, 2.4vw, 40px);
  margin-bottom: -0.085em; font-variation-settings: "FLAR" 100, "VOLM" 100; color: #121a24; user-select: none; white-space: nowrap;
}
.foot-word span:nth-child(1) { color: #1a1a36; } .foot-word span:nth-child(2) { color: #0f2a30; } .foot-word span:nth-child(3) { color: #2b2110; }

/* ---------- всплывающее сообщение ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 100; padding: 10px 16px; border-radius: var(--r);
  background: var(--bone); color: #11161d; font-weight: 560; font-size: 0.94rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-bad { background: #ffd9d5; }

/* ============================================================
   Простые страницы: вопросы и ответы, 404
============================================================ */
.page { max-width: 1120px; margin: 0 auto; padding: 56px clamp(20px, 4vw, 56px) 96px; }
.page-head h1 { font-size: clamp(2.3rem, 4.4vw, 3.8rem); line-height: 1; letter-spacing: -0.03em; font-weight: 700; font-variation-settings: "FLAR" 80, "VOLM" 60; max-width: 16ch; text-wrap: balance; }
.page-head p { margin-top: 16px; color: var(--dim); font-size: 1.06rem; max-width: 56ch; }
.faq-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; margin-top: 52px; align-items: start; }
.faq-toc { position: sticky; top: calc(var(--top-h) + 24px); display: grid; gap: 2px; }
.faq-toc a { color: var(--dim); padding: 6px 10px; border-radius: 4px; font-size: 0.94rem; border-left: 2px solid var(--line); border-radius: 0 4px 4px 0; }
.faq-toc a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.faq-group + .faq-group { margin-top: 48px; }
.faq-group > h2 { font-size: 1.4rem; font-weight: 660; letter-spacing: -0.01em; font-variation-settings: "FLAR" 60, "VOLM" 40; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.faq-group details { border-bottom: 1px solid var(--line-soft); }
.faq-group summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 1fr 20px; gap: 16px; align-items: center; padding: 16px 0; font-weight: 560; font-size: 1.04rem; }
.faq-group summary::-webkit-details-marker { display: none; }
.faq-group summary::after { content: ""; width: 10px; height: 10px; border-right: 1.6px solid var(--dim); border-bottom: 1.6px solid var(--dim); transform: rotate(45deg); justify-self: center; margin-top: -4px; transition: transform .2s; }
.faq-group details[open] summary::after { transform: rotate(225deg); margin-top: 4px; }
.faq-group summary:hover { color: #fff; }
.faq-body { padding: 0 36px 20px 0; color: #cfd8e3; max-width: 68ch; }
.faq-body p + p, .faq-body p + ul, .faq-body ul + p { margin-top: 10px; }
.faq-body ul { list-style: disc; padding-left: 20px; } .faq-body li + li { margin-top: 4px; }
.faq-body code { font-family: inherit; background: var(--raised); padding: 1px 6px; border-radius: 3px; font-size: 0.92em; }
.faq-scale { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 14px 0 4px; max-width: 520px; }
.faq-scale div { border-top: 10px solid var(--c); border-radius: 3px; padding-top: 8px; }
.faq-scale b { display: block; color: var(--text); font-weight: 600; } .faq-scale small { color: var(--dim); }
.callout { margin-top: 56px; padding: 26px 28px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.callout h2 { font-size: 1.2rem; font-weight: 640; } .callout p { color: var(--dim); margin-top: 2px; }
.callout .btn { margin-left: auto; }

.page-plain { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.notfound { max-width: 440px; }
.notfound-code { font-size: 7rem; line-height: 0.9; font-weight: 880; letter-spacing: -0.05em; font-variation-settings: "FLAR" 100, "VOLM" 100; color: var(--rare); }
.notfound h1 { font-size: 1.6rem; font-weight: 640; margin-top: 14px; }
.notfound p { color: var(--dim); margin: 8px 0 22px; }

/* ============================================================
   Панель модерации
============================================================ */
.login { max-width: 380px; margin: 9vh auto 0; padding: 0 20px 80px; }
.login h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; font-variation-settings: "FLAR" 80, "VOLM" 60; }
.login p { color: var(--dim); margin-top: 8px; }
.login form { margin-top: 26px; display: grid; gap: 14px; }
.login .btn { min-height: 42px; }
.desk { max-width: 1360px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 40px) 80px; }
.desk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.desk-head h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variation-settings: "FLAR" 80, "VOLM" 60; }
.desk-head .who { color: var(--dim); font-size: 0.92rem; margin-left: auto; }
.warn { margin-top: 16px; padding: 12px 14px; border: 1px solid #6b4c1e; background: #1f1a10; border-radius: var(--r); color: #f1cf8f; font-size: 0.94rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.warn .btn { margin-left: auto; }
.tabs { display: flex; gap: 2px; margin-top: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 10px 14px; color: var(--dim); font-size: 0.96rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--bone); font-weight: 600; }
.tabs em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--faint); margin-left: 6px; }
.tabs .has-pending em { background: var(--common); color: #11161d; border-radius: 99px; padding: 0 7px; font-weight: 600; }
.desk-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; align-items: center; }
.desk-tools .search { flex: 1 1 260px; max-width: 420px; }
.desk-tools .search input { height: 38px; font-size: 0.94rem; }
.desk-tools .search svg { top: 10px; }
.q { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 10px; margin: 0 -10px; border-bottom: 1px solid var(--line-soft); border-radius: 4px; }
.q:hover { background: var(--surface); }
.q .row-thumb { width: 56px; height: 56px; }
.q-title { font-weight: 560; line-height: 1.3; } .q-title button { text-align: left; } .q-title button:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--dim); font-size: 0.86rem; margin-top: 3px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--s); }
.status-pending { --s: var(--common); color: #f1cf8f; } .status-approved { --s: var(--ok); color: #9fe6c0; } .status-rejected { --s: var(--danger); color: #ffb3ad; }

.sheet { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: 1fr min(760px, 100%); }
.sheet-veil { background: rgba(4, 6, 9, .7); }
.sheet-body { background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; padding: 22px clamp(16px, 3vw, 32px) 40px; }
.sheet-head { display: flex; align-items: center; gap: 12px; position: sticky; top: -22px; background: var(--bg); padding: 14px 0; margin: -22px 0 0; z-index: 2; border-bottom: 1px solid var(--line-soft); }
.sheet-head h2 { font-size: 1.2rem; font-weight: 660; margin-right: auto; }
.sheet .fieldset { margin-top: 18px; }
.sheet-foot { position: sticky; bottom: -40px; background: var(--bg); padding: 14px 0 20px; margin: 22px 0 -40px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sheet-foot .spacer { flex: 1; }
.file-now { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.file-now img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.file-now .grow { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; } .file-now small { color: var(--dim); display: block; }
.team { margin-top: 8px; }
.team-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.team-row b { font-weight: 600; } .team-row small { color: var(--dim); display: block; }
.role { font-size: 0.84rem; color: var(--dim); } .role-owner { color: var(--bone); }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; margin-top: 10px; }
.panel-grid h2 { font-size: 1.1rem; font-weight: 640; margin: 22px 0 4px; }
.panel-grid p { color: var(--dim); font-size: 0.94rem; max-width: 52ch; }
.panel-grid form { display: grid; gap: 12px; margin-top: 14px; max-width: 380px; }
.stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ============================================================
   Узкие экраны
============================================================ */
@media (max-width: 1100px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) 108px; gap: 12px; }
  .row-thumb { width: 56px; height: 56px; }
}
@media (max-width: 900px) {
  .station { grid-template-columns: 1fr; }
  .viewport { position: relative; top: 0; height: 64vh; height: 64svh; min-height: 400px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .view { padding: 32px 18px 56px; }
  .faq-layout { grid-template-columns: 1fr; gap: 28px; }
  .faq-toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .faq-toc a { border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .panel-grid { grid-template-columns: 1fr; gap: 8px; }
  .vp-note { display: none; }
  .vp-crumbs { right: 14px; }
}
@media (max-width: 640px) {
  .top { padding: 0 12px; gap: 8px; }
  .brand-name, .tag-open { display: none; }
  .top-nav a { padding: 8px 8px; }
  .top .btn { padding: 0 12px; }
  .top .btn .long { display: none; }
  .row { grid-template-columns: 52px minmax(0, 1fr); }
  .row-thumb { width: 52px; height: 52px; }
  .row .prev { grid-column: 2; grid-template-columns: 84px auto; align-items: center; gap: 12px; }
  .fieldset { grid-template-columns: 1fr; }
  .level { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; }
  .atlas-label { font-size: 0.74rem; max-width: 44%; padding-left: 7px; }
  .vp-layer span { font-size: 0.8rem; }
  .vp-tool span { display: none; }
  .vp-tool { width: 32px; padding: 0; justify-content: center; }
  .vp-panel { top: 12px; right: 52px; width: min(232px, calc(100% - 190px)); }
  .vp-panel .seg { grid-auto-flow: row; }
  .vp-panel .seg button + button { border-left: 0; border-top: 1px solid var(--line); }
  .vp-panel p { display: none; }
  .q { grid-template-columns: 44px minmax(0, 1fr); } .q .row-thumb { width: 44px; height: 44px; }
  .q-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cite-box { grid-template-columns: 1fr; }
  .callout .btn { margin-left: 0; }
  .sheet { grid-template-columns: 0 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top, .viewport, .foot, .back, .mat-actions, .media-bar, .related, .toast, .btn { display: none !important; }
  .station { display: block; }
  body { background: #fff; color: #000; }
  .view { padding: 0; max-width: none; }
  .mat h1, .prose h2, .cite h2, .facts dd { color: #000; }
  .prose p, .cite-box p, .cite-box pre, .mat-latin, .facts dt { color: #222; }
  .media { border: 0; background: none; } .media-stage { height: auto; } .media-stage img { position: static; transform: none !important; filter: none !important; max-width: 100%; }
  .facts, .cite, .facts div, .cite-box { border-color: #bbb; }
}
