/* IF&PA — стиль сайта. Цвета — токены; тёмная тема ниже. */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #141a26;
  --muted: #5b6477;
  --faint: #8a93a6;
  --line: #e2e6ee;
  --line-strong: #cfd5e1;
  --accent: #1f5fa8;
  --accent-strong: #174a86;
  --accent-soft: #e7eff9;
  --pm: #b45f06;
  --pm-bright: #f0a53c;
  --pm-soft: #fcefdc;
  --ok: #217a4a;
  --ok-soft: #e3f3ea;
  --warn: #a4501b;
  --warn-soft: #fbece0;
  --code-bg: #f4f6fa;
  --head-bg: linear-gradient(135deg, #0f2f57 0%, #1f5fa8 60%, #2c7bc0 100%);
  --head-text: #ffffff;
  --head-muted: #c9dcf2;
  --footer-bg: #0e1b2e;
  --footer-text: #c3cddd;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", ui-monospace, Consolas, "SF Mono", Menlo, monospace;
  --header-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #151b24; --surface-2: #1c2330; --text: #e6eaf1; --muted: #9ba5b7; --faint: #6f7a8e;
    --line: #262f3d; --line-strong: #344052; --accent: #6fb0ec; --accent-strong: #93c4f2; --accent-soft: #16273b;
    --pm: #f0a53c; --pm-bright: #f5b75c; --pm-soft: #33261a; --ok: #6ccb94; --ok-soft: #15291e; --warn: #eea06a; --warn-soft: #33221a;
    --code-bg: #111720; --head-bg: linear-gradient(135deg, #0a1a2e 0%, #123a66 60%, #17508a 100%);
    --head-text: #f2f6fb; --head-muted: #a9c3e0; --footer-bg: #080c12; --footer-text: #9aa7ba;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151b24; --surface-2: #1c2330; --text: #e6eaf1; --muted: #9ba5b7; --faint: #6f7a8e;
  --line: #262f3d; --line-strong: #344052; --accent: #6fb0ec; --accent-strong: #93c4f2; --accent-soft: #16273b;
  --pm: #f0a53c; --pm-bright: #f5b75c; --pm-soft: #33261a; --ok: #6ccb94; --ok-soft: #15291e; --warn: #eea06a; --warn-soft: #33221a;
  --code-bg: #111720; --head-bg: linear-gradient(135deg, #0a1a2e 0%, #123a66 60%, #17508a 100%);
  --head-text: #f2f6fb; --head-muted: #a9c3e0; --footer-bg: #080c12; --footer-text: #9aa7ba;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); margin: .2em 0 .35em; letter-spacing: -.025em; }
h2 { font-size: 1.6rem; margin: 2.4em 0 .7em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .45em; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .8em; }
.content > :first-child, .content > .narrow > :first-child { margin-top: 0; }
p, ul, ol { margin: 0 0 1em; }
li { margin: .3em 0; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); padding: .05em .4em; border-radius: 5px; }
var { font-family: var(--serif); font-style: italic; font-size: 1.05em; }
/* греческие буквы — прямым начертанием, как принято в статьях; латинские переменные — курсивом */
var.gr, .float-tip .gr { font-style: normal; }
var.gr sub, var.gr sup, .float-tip .var-tip-sym sub, .float-tip .var-tip-sym sup, .float-tip .var-tip-sym i { font-style: italic; }   /* индексы — переменные */
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 800px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.hidden { display: none !important; }
.error { color: var(--warn); font-weight: 600; }

/* ---------- шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 24px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand .logo { width: 34px; height: 34px; flex: none; }
.brand-text { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; line-height: 1.05; }
.brand-text small { display: block; font-family: var(--sans); font-weight: 500; font-size: .74rem; color: var(--muted); letter-spacing: 0; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: .95rem; font-weight: 500;
  color: var(--text); text-decoration: none; background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"], .dd.active > .nav-link { color: var(--accent); background: var(--accent-soft); }
.dd { position: relative; }
.dd-btn svg { transition: transform .2s; opacity: .7; }
.dd.open .dd-btn svg { transform: rotate(180deg); }
.dd-menu {
  position: absolute; top: calc(100% + 8px); left: -8px; min-width: 330px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .16s, transform .16s, visibility .16s;
}
.dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.dd-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dd-item[aria-current="page"] { background: var(--accent-soft); }
.dd-item b { display: block; font-weight: 600; font-size: .95rem; }
.dd-item small { display: block; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.dd-ico { flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.lang-switch a, .lang-switch span { font-size: .78rem; font-weight: 700; letter-spacing: .04em; padding: 4px 8px; border-radius: 6px; text-decoration: none; color: var(--muted); line-height: 1.2; }
.lang-switch a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.lang-switch .on { background: var(--accent); color: #fff; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.menu-btn { display: none; }
.btn-cta { padding: 8px 16px; }

@media (max-width: 1060px) {
  .nav, .tools .btn-cta { display: none; }
  .drawer-foot .lang-switch { display: none; }
  .menu-btn { display: inline-grid; }
}

/* ---------- мобильное меню ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(8, 14, 24, .5); animation: fade .2s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .22s ease-out; overflow-y: auto;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-nav { padding: 8px 10px; flex: 1; }
.drawer-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; margin: 16px 10px 6px; }
.drawer-link { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.drawer-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.drawer-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.drawer-link .ico { color: var(--accent); flex: none; }
.drawer-link small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); }
@keyframes slide { from { transform: translateX(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- шапка страницы ---------- */
.page-head { background: var(--head-bg); color: var(--head-text); position: relative; overflow: hidden; }
.page-head::before {
  content: ""; position: absolute; inset: 0; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(90deg, transparent, #000 60%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.page-head .wrap { position: relative; padding-top: 40px; padding-bottom: 44px; }
.page-head h1 { color: var(--head-text); margin: .15em 0 .3em; max-width: 900px; }
.page-head .lead { color: var(--head-muted); margin: 0; max-width: 780px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .85rem; color: var(--head-muted); }
.crumbs a { color: var(--head-muted); text-decoration: none; }
.crumbs a:hover { color: #fff; text-decoration: underline; }

/* ---------- раскладка с оглавлением ---------- */
main { padding: 44px 0 80px; }
.with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 56px; }
.toc { position: relative; }
.toc-inner { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; }
.toc-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--faint); margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .88rem; line-height: 1.35; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 1060px) { .with-toc { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

/* ---------- блоки ---------- */
.lead { font-size: 1.15rem; color: var(--muted); max-width: 760px; line-height: 1.6; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--accent); font-weight: 700; margin-bottom: .3em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.three { grid-template-columns: minmax(0, 1fr); } }
a.card { color: inherit; text-decoration: none; transition: border-color .18s, transform .18s, box-shadow .18s; display: flex; flex-direction: column; }
a.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-3px); box-shadow: var(--shadow); }
a.card p { color: var(--muted); flex: 1; }
a.card .more { color: var(--accent); font-weight: 600; font-size: .92rem; }
.card-ico { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.note { border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); background: var(--accent-soft); padding: 14px 18px; border-radius: var(--radius-sm); margin: 1.3em 0; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--warn-soft); }
.note > :last-child { margin-bottom: 0; }
.formula {
  font-family: var(--serif); font-size: 1.15rem; text-align: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 18px; margin: 1.1em 0; overflow-x: auto;
}
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding-left: 50px; margin: 0 0 1.3em; }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: .95rem;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 1em; }
.table-wrap table { margin: 0; }
.table-wrap tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: .95rem; font-weight: 600;
  padding: 10px 18px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; cursor: pointer; text-decoration: none; line-height: 1.3; transition: background .15s, box-shadow .15s, transform .1s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1);
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
:root[data-theme="dark"] .btn:not(.ghost), :root[data-theme="dark"] .btn:not(.ghost):hover { color: #0d1117; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.ghost), :root:not([data-theme="light"]) .btn:not(.ghost):hover { color: #0d1117; } }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn.small { padding: 6px 12px; font-size: .85rem; font-weight: 600; }
.btn.lg { padding: 13px 22px; font-size: 1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
label { font-weight: 600; font-size: .9rem; }
textarea, input, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { font-family: var(--mono); font-size: .9rem; min-height: 230px; resize: vertical; line-height: 1.55; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; }
.field .hint { font-size: .84rem; color: var(--muted); margin-top: 6px; }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-fields > .field { flex: 1 1 150px; }

/* ---------- главная ---------- */
.home-hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background:
  radial-gradient(900px 420px at 85% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
  radial-gradient(700px 380px at -10% 110%, color-mix(in srgb, var(--pm-bright) 16%, transparent), transparent 70%), var(--bg); }
.home-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 70%);
}
.page-index main { padding-top: 0; }
.hero { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 64px; }
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--pm)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px 5px 6px; box-shadow: var(--shadow-sm); }
.badge b { background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: .74rem; }
.hero-art { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-lg); }
.hero-art figcaption { margin-top: 8px; }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 44px; padding-bottom: 40px; } }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 32px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.stat-row > div { font-size: .85rem; color: var(--muted); line-height: 1.4; }
.stat-row b { display: block; font-family: var(--display); font-size: 1.9rem; color: var(--accent); letter-spacing: -.02em; line-height: 1.1; margin-bottom: 4px; }
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; counter-reset: h; }
.how > div { position: relative; padding: 22px 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how > div::before { counter-increment: h; content: "0" counter(h); font-family: var(--display); font-weight: 800; font-size: 2rem; color: color-mix(in srgb, var(--accent) 35%, transparent); display: block; line-height: 1; margin-bottom: 10px; }
.how h3 { margin: 0 0 6px; }
.how p { color: var(--muted); margin: 0; font-size: .95rem; }
@media (max-width: 800px) { .how { grid-template-columns: minmax(0, 1fr); } }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 64px 0 20px; }
.section-title h2 { margin: 0; }
.section-title p { margin: 0; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .split { grid-template-columns: minmax(0, 1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-weight: 500; font-size: .93rem; transition: border-color .15s, color .15s, background .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.trust { margin-top: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 20px; align-items: center;
  padding: 22px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.trust > div { font-size: .85rem; color: var(--muted); line-height: 1.35; }
.trust b { display: block; font-family: var(--display); font-size: 1.5rem; color: var(--text); letter-spacing: -.02em; }
@media (max-width: 800px) { .trust { grid-template-columns: 1fr 1fr; } }
.card.good { border-top: 3px solid var(--ok); }
.card.limit { border-top: 3px solid var(--warn); }
.cite-band { margin-top: 56px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 26px 30px; border-radius: var(--radius); background: var(--head-bg); color: var(--head-text); }
.cite-band p { margin: 0; color: var(--head-muted); max-width: 760px; }
.cite-band b { color: var(--head-text); }
.cite-band .btn, .cite-band .btn:hover { background: #fff; color: #10233d; border-color: #fff; }

/* анимация иллюстрации на главной */
.hero-art .iv, .hero-art .ctr { animation: rise .6s both; }
.hero-art .ivs > :nth-child(3), .hero-art .ivs > :nth-child(4) { animation-delay: .1s; }
.hero-art .ivs > :nth-child(5), .hero-art .ivs > :nth-child(6) { animation-delay: .2s; }
.hero-art .ivs > :nth-child(7), .hero-art .ivs > :nth-child(8) { animation-delay: .3s; }
.hero-art .ivs > :nth-child(9), .hero-art .ivs > :nth-child(10) { animation-delay: .4s; }
.hero-art .ivs > :nth-child(11), .hero-art .ivs > :nth-child(12) { animation-delay: .5s; }
.hero-art .bar { animation: grow .7s .5s both; transform-origin: bottom; transform-box: fill-box; }
.hero-art .pm-line, .hero-art .pm-band { animation: fadein .6s 1.1s both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes fadein { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- код ---------- */
pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px;
  overflow-x: auto; line-height: 1.55; margin: 0 0 1em; tab-size: 4; font-size: .85rem;
}
.code-block { position: relative; }
.code-block .copy { position: absolute; top: 8px; right: 8px; opacity: .85; }
.code-block:hover .copy { opacity: 1; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  font: inherit; font-size: .95rem; font-weight: 500; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; cursor: pointer; color: var(--muted); margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel[hidden] { display: none; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 12px; }

/* ---------- калькулятор ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 28px; align-items: start; }
.calc > .card:first-child { position: sticky; top: calc(var(--header-h) + 20px); }
@media (max-width: 960px) { .calc { grid-template-columns: minmax(0, 1fr); } .calc > .card:first-child { position: static; } }
.result-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.result-main .value { font-family: var(--display); font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--pm); font-variant-numeric: tabular-nums; }
.result-main .unc { font-size: 1.25rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--sans); fill: var(--muted); font-size: 12px; }
.chart .axis { stroke: var(--line-strong); }
.chart .iv { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.chart .iv.out { stroke: var(--faint); opacity: .6; }
.chart .ctr { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .ctr.out { stroke: var(--faint); }
.chart .pm-band { fill: var(--pm-soft); }
.chart .pm-line { stroke: var(--pm); stroke-width: 2.2; }
.chart .ref-line { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.chart .ref-line.w { stroke-dasharray: 1.5 3.5; stroke-width: 1.8; }
.chart .bar { fill: var(--accent); opacity: .3; }
.chart .bar.win { fill: var(--pm); opacity: 1; }
.chart .lbl { fill: var(--text); }
.chart .pm-text { fill: var(--pm); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.legend span::before { content: ""; display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--pm); vertical-align: middle; margin-right: 6px; }
.legend .l-mean::before { border-top: 1.5px dashed var(--muted); }
.legend .l-wmean::before { border-top: 2px dotted var(--muted); }
.legend .l-iv::before { border-top: 3px solid var(--accent); }
.explain { padding-left: 1.2em; }
.explain li { margin-bottom: .55em; }
.explain li::marker { color: var(--accent); }

/* ---------- конфигуратор ---------- */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 12px 0 22px; }
.presets button {
  font: inherit; font-size: .92rem; font-weight: 600; text-align: left; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.presets button:hover { border-color: var(--accent); }
.presets button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.presets button small { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; margin-top: 2px; }
input[type="range"] { padding: 0; accent-color: var(--accent); border: 0; box-shadow: none; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0 8px 0 0; accent-color: var(--accent); flex: none; }
.field output { float: right; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
label.check { font-weight: 500; display: flex; align-items: center; }
.cfg { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 960px) { .cfg { grid-template-columns: minmax(0, 1fr); } }
button:disabled { opacity: .6; cursor: wait; }

/* ---------- публикации ---------- */
.pub { padding: 16px 0; border-bottom: 1px solid var(--line); }
.pub:last-of-type { border-bottom: 0; }
.pub .title { font-weight: 650; font-size: 1.02rem; }
.pub .meta { color: var(--muted); font-size: .92rem; }
.pub .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: .9rem; }

/* ---------- подвал ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: 56px 0 0; font-size: .92rem; }
.site-footer .brand, .site-footer .brand:hover { color: #fff; }
.site-footer .brand-text small { color: var(--footer-text); }
.site-footer h4 { color: #fff; }
.site-footer a { color: var(--footer-text); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0 0 8px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-about p { margin: 14px 0 0; max-width: 380px; }
.footer-note { font-size: .84rem; opacity: .8; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 40px; padding-top: 18px; padding-bottom: 22px; font-size: .82rem; opacity: .75; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }

.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }

@media print {
  .site-header, .site-footer, .btn-row, .tools, .toc, .to-top, .drawer { display: none !important; }
  .page-head { background: none; color: #000; }
  .page-head h1, .page-head .lead, .crumbs { color: #000; }
  body { background: #fff; color: #000; }
}

#vote-matrix th { text-transform: none; letter-spacing: 0; font-size: .9rem; }

/* ---------- интервальная лаборатория ---------- */
.lab { margin: 12px 0 18px; }
.lab-svg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); touch-action: none; user-select: none; }
.lab-caption { font-weight: 600; background: var(--accent-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 10px; min-height: 2.9em; }
.lab-rav { fill: var(--accent-soft); opacity: .55; }
.lab-dot { fill: var(--faint); }
.lab-dot.win { fill: var(--pm); }
.lab-iv { cursor: grab; outline: none; }
.lab-iv:active { cursor: grabbing; }
.lab-hit { fill: transparent; }
.lab-iv:hover .lab-hit, .lab-iv:focus .lab-hit, .lab-iv.sel .lab-hit { fill: var(--accent-soft); opacity: .6; }
.lab-iv:focus-visible .lab-hit { stroke: var(--accent); stroke-width: 1.5; }
.lab-end { stroke: var(--accent); stroke-width: 2; }
.lab-iv.out .iv, .lab-iv.out .lab-end { stroke: var(--faint); }
.lab-iv.out .ctr { stroke: var(--faint); }
.chart .lab-small, .lab-small { font-size: 11px; fill: var(--muted); }
.cell-in { fill: var(--accent); opacity: .85; }
.cell-out { fill: var(--surface-2); stroke: var(--line); stroke-width: .6; }
.lab-readout { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.lab-pill { font-size: .88rem; font-weight: 600; padding: 3px 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lab-pill.pm { background: var(--pm-soft); color: var(--pm); border-color: transparent; }
.lab-pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 500; }
.lab-n { max-width: 420px; margin-top: 12px; }
.lab-controls { margin-top: 10px; }

/* ---------- голосование: граф и гистограмма ---------- */
.vote-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 14px 0; }
.vote-figs figure { margin: 0; }
.vote-figs .hidden { display: none; }
.g-edge { stroke: var(--muted); stroke-width: 1.8; }
.g-edge.tie { stroke-dasharray: 4 4; opacity: .6; }
.g-edge.bad { stroke: var(--warn); stroke-width: 2.4; }
.g-arrow { fill: var(--muted); }
.g-arrow.bad { fill: var(--warn); }
.g-node { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.g-node.win { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 2.5; }
.chart .g-label { fill: var(--text); font-weight: 700; font-size: 12px; }
.vote-matrix th { text-transform: none; letter-spacing: 0; font-size: .9rem; }

/* ---------- лекция ---------- */
.deck { position: relative; }
.deck-bar { position: sticky; top: calc(var(--header-h) + 8px); z-index: 20; display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.deck-progress { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.deck-progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--pm)); border-radius: 99px; transition: width .3s; }
.deck-count { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }
.slide { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 34px 26px; box-shadow: var(--shadow); min-height: 520px; animation: slidein .28s ease-out; }
.slide[hidden] { display: none; }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } }
.slide h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .2em 0 .5em; }
.slide-no { text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0; }
.slide-lead { font-size: 1.08rem; color: var(--text); max-width: 900px; }
.slide-note { color: var(--muted); border-left: 3px solid var(--pm); padding-left: 12px; margin-top: 14px; }
/* оглавление лекции: главы и названия слайдов */
.deck-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.deck-toc { position: sticky; top: calc(var(--header-h) + 70px); max-height: calc(100vh - var(--header-h) - 90px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; font-size: .9rem; }
.deck-toc summary { display: none; }
.deck-toc ol { list-style: none; margin: 0; padding: 0; }
.deck-chapter { margin-bottom: 2px; }
.deck-toc .deck-chapter-head { justify-content: space-between; text-transform: uppercase; letter-spacing: .08em; font-size: .74rem;
  font-weight: 700; color: var(--muted); padding: 8px; }
.deck-toc .deck-chapter-head::after { content: "▸"; transition: transform .15s; }
.deck-chapter.open > .deck-chapter-head { color: var(--text); }
.deck-chapter.open > .deck-chapter-head::after { transform: rotate(90deg); }
.deck-chapter > ol { display: none; padding-bottom: 6px; }
.deck-chapter.open > ol { display: block; }
.deck-toc button { display: flex; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 5px 8px;
  color: var(--text); font: inherit; cursor: pointer; line-height: 1.3; }
.deck-toc button:hover { background: var(--surface-2); }
.deck-toc button[aria-current="step"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.deck-n { min-width: 1.4em; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-toc button[aria-current="step"] .deck-n { color: var(--accent); }
.deck-next { white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 999px) {
  .deck-layout { grid-template-columns: minmax(0, 1fr); }
  .deck-toc { position: static; max-height: none; padding: 0; }
  .deck-toc summary { display: block; cursor: pointer; padding: 10px 14px; }
  .deck-toc[open] ol { padding: 0 6px 10px; }
}
@media (max-width: 600px) { .deck-next-t { display: none; } }

/* от норм к расписанию: рюкзак и расписание (assets/knapsack.js) */
.kn-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.kn-item { text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px;
  cursor: pointer; font: inherit; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.kn-item small { color: var(--muted); }
.kn-item[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.kn-item.kn-mark { outline: 2px dashed var(--pm); outline-offset: 2px; }
.kn-bars { display: grid; gap: 8px; margin-bottom: 8px; }
.kn-bar { display: grid; gap: 4px; }
.kn-bar-label { font-size: .88rem; }
.kn-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: block; }
.kn-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .2s; }
.kn-over .kn-fill { background: var(--danger, #c0392b); }
.kn-msg { min-height: 1.6em; font-weight: 600; }
.kn-slider { display: grid; gap: 4px; max-width: 520px; margin-bottom: 10px; }
.kn-slider input { width: 100%; }
.kn-gantt td.kn-cell { font-weight: 700; }
.kn-w0 { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.kn-w1 { background: color-mix(in srgb, var(--pm) 22%, transparent); }
.kn-w2 { background: color-mix(in srgb, var(--accent) 34%, transparent); }
.kn-dim { color: var(--muted); }
.kn-load { display: flex; gap: 10px; align-items: flex-end; height: 140px; margin: 8px 0; }
.kn-month { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; max-width: 70px; height: 100%; }
.kn-col { position: relative; flex: 1; width: 100%; border-bottom: 1px solid var(--line-strong); }
.kn-col-a, .kn-col-p { position: absolute; bottom: 0; width: 42%; border-radius: 4px 4px 0 0; }
.kn-col-p { left: 6%; background: var(--line-strong); }
.kn-col-a { right: 6%; background: var(--accent); }
.kn-over .kn-col-a { background: var(--danger, #c0392b); }
.kn-cap { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--text); }
.kn-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.kn-key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: 8px; }
.kn-key-p { background: var(--line-strong); }
.kn-key-a { background: var(--accent); }
.kn-key-c { border-top: 2px dashed var(--text); height: 0; }
.deck.is-full { background: var(--bg); padding: 16px 24px; overflow-y: auto; }
.deck.is-full .deck-bar { top: 0; }
@media (max-width: 700px) { .slide { padding: 20px 16px; } }

/* ---------- тест ---------- */
.quiz .q { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.quiz .q > p:first-child { margin-bottom: 8px; }
.quiz button { display: block; width: 100%; text-align: left; font: inherit; margin: 6px 0; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.quiz button:hover:not(:disabled) { border-color: var(--accent); }
.quiz button:disabled { cursor: default; opacity: 1; }
.quiz button.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.quiz button.wrong { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.quiz .why { display: none; color: var(--muted); font-size: .92rem; margin: 8px 0 0; }
.quiz .q.done .why { display: block; }
.quiz-score { font-weight: 700; font-size: 1.1rem; color: var(--accent); }

.student-band { display: flex; align-items: center; gap: 18px; margin-top: 44px; padding: 20px 24px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), var(--pm-soft)); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.student-band:hover { text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.student-band .card-ico { margin: 0; flex: none; background: var(--surface); }
.student-band > span:nth-child(2) { flex: 1; }
.student-band b { display: block; font-size: 1.15rem; }
.student-band small { color: var(--muted); font-size: .92rem; }
@media (max-width: 700px) { .student-band { flex-wrap: wrap; } }

/* пример набора в конфигураторе */
.chart .iv.out-bad { stroke: var(--warn); }
.chart .ctr.out-bad { stroke: var(--warn); }
.chart .smp-truth { stroke: var(--ok); stroke-width: 2.5; }
.chart .smp-pm { stroke: var(--pm); stroke-width: 2.2; }
.chart .smp-w { stroke: var(--muted); stroke-width: 1.8; stroke-dasharray: 1.5 3.5; }
.chart .smp-mean { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.smp-legend .l-bad::before { border-top: 3px solid var(--warn); }
.smp-legend .l-truth::before { border-top: 2.5px solid var(--ok); }
.smp-legend .l-pm::before { border-top: 2px solid var(--pm); }
.smp-legend .l-w::before { border-top: 2px dotted var(--muted); }
.smp-legend .l-mean::before { border-top: 1.5px dashed var(--muted); }

.vote-graph { max-width: 340px; display: block; margin: 0 auto; }
figure.card { margin: 0; }
[data-bench] .chart text { font-size: 11px; }

/* лаборатория: ручки, панель выбранного интервала, «лестница» ширины */
.lab-hit { cursor: grab; }
.lab-iv:active .lab-hit { cursor: grabbing; }
.lab-handle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.2; pointer-events: none; transition: r .12s; }
.lab-hand-hit { fill: transparent; cursor: ew-resize; }
.lab-iv:hover .lab-handle, .lab-iv.sel .lab-handle { fill: var(--accent); }
.lab-iv.sel .iv { stroke-width: 4.5; }
.lab-iv.sel .lbl { font-weight: 700; fill: var(--accent); }
.lab-iv.out .lab-handle { stroke: var(--faint); }
.lab-panel { margin-top: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.lab-panel .muted { margin: 0; }
.lab-panel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.lab-field { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .9rem; color: var(--muted); }
.lab-field input { width: 120px; padding: 5px 8px; font-variant-numeric: tabular-nums; }
.lab-ladder { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.lab-ladder button { font: inherit; font-size: .78rem; font-weight: 600; padding: 5px 7px; border: 0; border-right: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.lab-ladder button:last-child { border-right: 0; }
.lab-ladder button:hover { background: var(--surface-2); color: var(--text); }
.lab-ladder button.on { background: var(--accent); color: #fff; }
@media (max-width: 700px) { .lab-ladder button { padding: 5px 4px; font-size: .72rem; } }

/* голосование: визуальный редактор профиля */
.v-editor { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 6px; }
.v-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.v-label { width: 150px; flex: none; padding: 5px 8px; font-size: .85rem; }
.v-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; min-height: 34px; }
.v-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--accent);
  color: var(--accent); font-weight: 700; cursor: grab; user-select: none; touch-action: none; transition: box-shadow .12s, transform .05s; }
.v-chip:hover { box-shadow: var(--shadow); }
.v-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.v-chip.drag { cursor: grabbing; z-index: 5; position: relative; box-shadow: var(--shadow-lg); background: var(--accent); color: #fff; }
.v-chip.drop { box-shadow: -4px 0 0 0 var(--pm); }
.v-sep { font: inherit; font-size: 1rem; font-weight: 700; min-width: 28px; padding: 2px 6px; border-radius: 6px; border: 1px dashed transparent;
  background: none; color: var(--muted); cursor: pointer; }
.v-sep:hover { border-color: var(--line-strong); color: var(--text); }
.v-sep.tie { color: var(--pm); }
.v-del { font: inherit; font-size: 1.1rem; line-height: 1; width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; flex: none; }
.v-del:hover { color: var(--warn); border-color: var(--warn); }
@media (max-width: 640px) { .v-row { flex-wrap: wrap; } .v-label { width: 100%; } }

/* калькулятор: галерея примеров и разбор */
.ex-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 28px; }
.ex-card { position: relative; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.ex-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.ex-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.ex-card b { font-size: 1rem; line-height: 1.3; }
.ex-card small { color: var(--muted); font-size: .85rem; line-height: 1.35; }
.ex-num { position: absolute; top: 12px; right: 14px; font-family: var(--display); font-weight: 800; font-size: 1.1rem; color: color-mix(in srgb, var(--accent) 35%, transparent); }
.ex-kind { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.ex-card[data-kind="real"] .ex-kind { color: var(--ok); }
.ex-card[data-kind="paper"] .ex-kind { color: var(--pm); }
.ex-note { margin-bottom: 18px; border-left: 4px solid var(--accent); }
.ex-note[data-kind="real"] { border-left-color: var(--ok); }
.ex-note[data-kind="paper"] { border-left-color: var(--pm); }
.ex-note h3 { margin: 2px 0 8px; }
.ex-note-h { font-weight: 700; margin: 10px 0 4px; }
.ex-try { background: var(--pm-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0 0; }
.ex-try::before { content: "▶ "; color: var(--pm); font-weight: 700; }
.field-help { margin: 4px 0 14px; padding: 8px 14px; }
.field-help summary { font-size: .92rem; }
.field-help p { font-size: .9rem; }
#format-hint { background: var(--surface-2); border-radius: 6px; padding: 7px 10px; }

/* конфигуратор: палитра серий (эталонная, проверена валидатором в обеих темах) и расходящаяся шкала карты */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --d-b3: #2a78d6; --d-b2: #6da7ec; --d-b1: #b7d3f6; --d-n: #f0efec; --d-r1: #f6c7c6; --d-r2: #ee8f8e; --d-r3: #e34948;
  --grid: #e1e0d9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --d-b3: #3987e5; --d-b2: #2a5f9e; --d-b1: #25405f; --d-n: #383835; --d-r1: #5e3232; --d-r2: #9c4544; --d-r3: #e66767;
    --grid: #2c2c2a;
  }
}
:root[data-theme="dark"] {
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --d-b3: #3987e5; --d-b2: #2a5f9e; --d-b1: #25405f; --d-n: #383835; --d-r1: #5e3232; --d-r2: #9c4544; --d-r3: #e66767;
  --grid: #2c2c2a;
}
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }

/* распределение ошибки */
.dist-hit { fill: transparent; }
.dist-row:hover .dist-hit { fill: var(--surface-2); }
.dist-whisker { stroke: var(--faint); stroke-width: 1.5; }
.dist-box { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
.dist-med { stroke: var(--accent); stroke-width: 2.5; }
.dist-rmse { fill: var(--text); }
.dist-row.pm .dist-box { fill: var(--pm-soft); stroke: var(--pm); }
.dist-row.pm .dist-med { stroke: var(--pm); }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .84rem; color: var(--muted); margin: 6px 0 14px; }
.dist-legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.dist-legend .k-box { width: 18px; height: 10px; border: 1.2px solid var(--accent); background: var(--accent-soft); border-radius: 3px; }
.dist-legend .k-med { width: 3px; height: 12px; background: var(--accent); }
.dist-legend .k-wh { width: 18px; height: 0; border-top: 1.5px solid var(--faint); }
.dist-legend .k-rm { width: 9px; height: 9px; background: var(--text); transform: rotate(45deg); }

/* один параметр */
.chart-host { position: relative; }
.sweep-line { fill: none; stroke-width: 2; }
.sweep-line.pm { stroke-width: 3; }
.sweep-dot { stroke: var(--surface); stroke-width: 1.5; }
.sweep-best { fill: var(--pm-soft); opacity: .55; }
.hover-col { fill: transparent; }
.hover-col.hover-on { fill: var(--surface-2); opacity: .6; }
.chart .sweep-label { font-size: 12px; font-weight: 600; fill: var(--text); stroke: none; }
.chart .sweep-label.pm { font-weight: 800; }
.s1 { stroke: var(--s1); } .s2 { stroke: var(--s2); } .s3 { stroke: var(--s3); } .s4 { stroke: var(--s4); } .s5 { stroke: var(--s5); }
.sweep-dot.s1 { fill: var(--s1); } .sweep-dot.s2 { fill: var(--s2); } .sweep-dot.s3 { fill: var(--s3); } .sweep-dot.s4 { fill: var(--s4); } .sweep-dot.s5 { fill: var(--s5); }
.legend2 { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; color: var(--text); margin: 8px 0; }
.legend2 .lg::before { content: ""; display: inline-block; width: 20px; height: 0; border-top: 3px solid currentColor; vertical-align: middle; margin-right: 6px; }
.legend2 .lg.s1::before { border-color: var(--s1); } .legend2 .lg.s2::before { border-color: var(--s2); border-top-width: 4px; }
.legend2 .lg.s3::before { border-color: var(--s3); border-top-style: dashed; } .legend2 .lg.s4::before { border-color: var(--s4); border-top-style: dotted; }
.legend2 .lg.s5::before { border-color: var(--s5); border-top-style: dashed; }
.legend2 .lg.pm { font-weight: 700; }
.legend2 .lg.best::before { width: 14px; height: 12px; border: 0; background: var(--pm-soft); }
.chart-tip { position: absolute; z-index: 5; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: .84rem; pointer-events: none; }
.chart-tip .tip-h { font-weight: 700; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tip-row b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-tip .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.chart-tip .sw.s1 { background: var(--s1); } .chart-tip .sw.s2 { background: var(--s2); } .chart-tip .sw.s3 { background: var(--s3); }
.chart-tip .sw.s4 { background: var(--s4); } .chart-tip .sw.s5 { background: var(--s5); }
.chart-tip .tip-note { margin-top: 4px; color: var(--pm); font-weight: 600; }

/* карта применимости */
.map-host { overflow-x: auto; }
.map-chart { min-width: 600px; }
.cell-b3 { fill: var(--d-b3); } .cell-b2 { fill: var(--d-b2); } .cell-b1 { fill: var(--d-b1); } .cell-n { fill: var(--d-n); }
.cell-r1 { fill: var(--d-r1); } .cell-r2 { fill: var(--d-r2); } .cell-r3 { fill: var(--d-r3); }
.map-cell:hover rect { stroke: var(--text); stroke-width: 1.5; }
.chart .map-t1 { font-size: 13px; font-weight: 700; fill: var(--text); }
.chart .map-t2 { font-size: 12px; fill: var(--text); font-variant-numeric: tabular-nums; }
.chart .map-t1.inv, .chart .map-t2.inv { fill: #fff; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .84rem; color: var(--muted); margin: 8px 0; }
.map-sw { display: inline-block; width: 30px; height: 14px; border-radius: 3px; }
.map-sw.cell-b3 { background: var(--d-b3); } .map-sw.cell-b2 { background: var(--d-b2); } .map-sw.cell-b1 { background: var(--d-b1); } .map-sw.cell-n { background: var(--d-n); }
.map-sw.cell-r1 { background: var(--d-r1); } .map-sw.cell-r2 { background: var(--d-r2); } .map-sw.cell-r3 { background: var(--d-r3); }
.map-lg-title { font-weight: 600; color: var(--text); }
.map-lg-ends { display: flex; gap: 16px; margin-left: 8px; }

/* Компактные таблицы результатов: пояснения — во всплывающей подсказке */
table.compact td, table.compact th { padding: 5px 10px; vertical-align: middle; }
table.compact tr.row-pm td { background: var(--pm-soft); }
.tip { cursor: help; border-bottom: 1px dotted var(--muted); }
.tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.float-tip { position: fixed; z-index: 50; max-width: 320px; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 7px 10px; font-size: .84rem; line-height: 1.4; pointer-events: none; }
.float-tip[hidden] { display: none; }
.cfg-sub { margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 700; font-size: .85rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; }
table.compact .tip { white-space: nowrap; }
table.compact th { white-space: normal; line-height: 1.25; }
table.compact tr.row-sub td { background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600; padding-top: 8px; }
table.compact tr.row-var td { color: var(--muted); }
.presets-h { margin: 14px 0 0; font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.presets-h + .presets { margin-top: 8px; }
.presets-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.presets-h .dot-pm { background: var(--pm); }
table.summary tr.row-sub td { display: table-cell; }
table.summary .row-sub .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-right: 8px; vertical-align: 0; }
table.summary .row-sub .dot-pm { background: var(--pm); }
table.summary td:nth-child(2) { color: var(--muted); font-size: .88rem; }
table.summary td.num { white-space: nowrap; }
table.summary .tip { white-space: normal; }
table.summary td:nth-child(1) { width: 34%; }
table.summary td:nth-child(2) { width: 30%; }
tr.row-pm td { background: var(--pm-soft); }
/* расшифровка обозначений при наведении (vars.js): подсветка появляется только под курсором */
var.var-tip-on { cursor: help; background: var(--accent-soft); border-radius: 3px; box-shadow: 0 0 0 2px var(--accent-soft); }
.float-tip .var-tip-sym { font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-style: normal; font-weight: 700; color: var(--accent); }

/* ===== Страница «Применения»: переключатель и демонстрации (apps.js) ===== */
.app-switch { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 26px; }
.app-switch button { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-switch button:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.app-switch button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.app-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-switch .app-ico { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); color: var(--accent); }
.app-switch button[aria-selected="true"] .app-ico { background: var(--accent); color: #fff; }
.app-switch b { font-size: .92rem; line-height: 1.25; }
.app-switch small { color: var(--muted); font-size: .78rem; }
html:not(.apps-js) .app-switch { display: none; }
.app-panel { animation: app-in .25s ease; }
@keyframes app-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .app-panel { animation: none; } .app-switch button:hover { transform: none; } }
.app-panel > h2:first-child { margin-top: 0; }
.app-flow { display: grid; grid-template-columns: repeat(3, 1fr); margin: 4px 0 20px; }
.app-flow > div { position: relative; padding: 12px 16px 12px 22px; background: var(--surface); border: 1px solid var(--line); }
.app-flow > div:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding-left: 16px; }
.app-flow > div:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.app-flow > div + div { border-left: 0; }
.app-flow > div:not(:last-child)::after { content: ""; position: absolute; right: -9px; top: 50%; width: 16px; height: 16px; z-index: 1;
  background: inherit; border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.app-flow b { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.app-flow span { font-size: .9rem; line-height: 1.35; display: block; }
.app-flow .pm { background: var(--pm-soft); }
.app-flow .pm b { color: var(--pm); }
@media (max-width: 640px) {
  .app-flow { grid-template-columns: minmax(0, 1fr); }
  .app-flow > div, .app-flow > div:first-child, .app-flow > div:last-child { border-radius: 0; border-left: 1px solid var(--line); padding: 12px 16px 14px; }
  .app-flow > div + div { border-top: 0; padding-top: 16px; }
  .app-flow > div:not(:last-child)::after { right: auto; left: 50%; top: auto; bottom: -9px; transform: translateX(-50%) rotate(135deg); }
}
.app-demo { margin: 18px 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.app-note { margin: 10px 0; }
.app-note.muted { color: var(--muted); font-size: .82rem; margin-top: 0; }
.app-note.warn { color: var(--text); background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 4px; }
.app-hint { font-size: .9rem; margin: 0 0 8px; }
.app-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.app-src { font-size: .8rem; color: var(--muted); }
.app-chart-box { min-width: 0; }
.app-two { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
.app-two.wide-left { grid-template-columns: 1.7fr 1fr; }
@media (max-width: 760px) { .app-two, .app-two.wide-left { grid-template-columns: minmax(0, 1fr); } }
.app-controls { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: flex-end; margin-bottom: 10px; }
.app-controls .field { margin: 0; min-width: 200px; }
.app-chart .app-grid { stroke: var(--grid); }
.app-chart .app-zero { stroke: var(--line-strong); }
.app-chart .app-axis-label { font-size: 11px; }
.app-chart .app-row-label { fill: var(--text); font-size: 12px; }
.app-chart .app-iv { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.app-chart .app-ctr { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.app-chart .app-row.off .app-iv, .app-chart .app-row.off .app-ctr { stroke: var(--faint); opacity: .55; }
.app-chart .app-row.off .app-row-label { fill: var(--faint); text-decoration: line-through; }
.app-chart .app-row.bad .app-iv, .app-chart .app-row.new .app-iv { stroke: var(--d-r3); }
.app-chart .app-row.bad .app-ctr, .app-chart .app-row.new .app-ctr { stroke: var(--d-r3); }
.app-chart .app-hit { fill: transparent; }
.app-chart .clickable { cursor: pointer; }
.app-chart .app-row.clickable:hover .app-hit, .app-chart .app-row.clickable:focus-visible .app-hit { fill: var(--accent-soft); }
.app-chart .app-row:focus { outline: none; }
.app-chart .app-mark { stroke-width: 2; }
.app-chart .app-mark-label { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.app-chart .m-pm { stroke: var(--pm); }
.app-chart text.m-pm { fill: var(--pm); stroke: none; }
.app-chart .m-s1 { stroke: var(--s1); }
.app-chart .m-s3 { stroke: var(--s3); }
.app-chart .m-s4 { stroke: var(--s4); }
.app-chart .m-truth { stroke: var(--text); stroke-width: 1.4; }
.app-chart text.app-mark-label { stroke: none; }
.app-chart .app-fit { stroke-width: 2.4; }
.app-chart .app-fit.m-truth { stroke: var(--muted); stroke-width: 1.4; }
.app-chart .app-ok-band { fill: var(--ok-soft); }
.app-chart .app-bar.ok { fill: var(--ok); }
.app-chart .app-bar.bad { fill: var(--d-r3); }
.app-chart .app-en { font-size: 12px; font-weight: 600; }
.app-chart .app-en.ok { fill: var(--ok); }
.app-chart .app-en.bad { fill: var(--d-r3); }
.app-chart .app-pt { fill: var(--accent); stroke: var(--surface); stroke-width: 2; cursor: grab; touch-action: none; }
.app-chart .app-pt.out { fill: var(--d-r3); }
.app-chart .app-pt:hover, .app-chart .app-pt:focus-visible { stroke: var(--text); outline: none; }
.app-chart .app-fbar.m-s1 { fill: var(--s1); }
.app-chart .app-fbar.m-s3 { fill: var(--s3); }
.app-chart .app-fbar.m-s4 { fill: var(--s4); }
.app-chart .app-fbar.m-pm { fill: var(--pm); }
.app-chart .app-fbar { stroke: none; }
.app-chart .app-fbar:focus-visible { outline: none; stroke: var(--text); stroke-width: 2; }
.app-map .app-map-bg { fill: var(--surface-2); stroke: var(--line); }
.app-map .app-link { stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 3 4; opacity: .6; }
.app-map .app-base { fill: var(--text); }
.app-map .app-node circle { fill: var(--surface); stroke: var(--faint); stroke-width: 2; }
.app-map .app-node.on circle { fill: var(--accent-soft); stroke: var(--accent); }
.app-map .app-node.bad circle { stroke: var(--d-r3); stroke-width: 3; }
.app-map .app-node:hover circle, .app-map .app-node:focus-visible circle { stroke-width: 3; }
.app-map .app-node:focus { outline: none; }
.app-map .app-node-id { font-size: 11px; font-weight: 700; fill: var(--text); }
.app-map .app-node-val { font-size: 10.5px; fill: var(--muted); }
.app-map .app-node.bad .app-node-val { fill: var(--d-r3); font-weight: 600; }
.app-sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 7px; vertical-align: middle; background: var(--faint); }
.app-sw.m-pm { background: var(--pm); }
.app-sw.m-s1 { background: var(--s1); }
.app-sw.m-s3 { background: var(--s3); }
.app-sw.m-s4 { background: var(--s4); }
.app-badge { font-size: .72rem; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 1px 7px; border-radius: 99px; margin-left: 6px; }
.app-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; background: var(--surface-2); }
.app-seg button { border: 0; background: none; font: inherit; font-size: .86rem; padding: 5px 14px; border-radius: 99px; color: var(--muted); cursor: pointer; }
.app-seg button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.app-readout { display: grid; gap: 10px; align-content: start; }
.app-energy { display: grid; gap: 4px; font-size: .86rem; }
.app-energy-bar { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.app-energy-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .2s; }
.app-stat { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.app-stat b { font-variant-numeric: tabular-nums; }
.app-stat small { grid-column: 1 / 3; color: var(--muted); }
.app-stat.bad { border-color: var(--d-r3); }
.app-stat.bad small { color: var(--d-r3); font-weight: 600; }
.app-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.app-steps button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: .86rem; padding: 6px 12px 6px 6px; border-radius: 99px; cursor: pointer; }
.app-steps button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.app-step-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: .78rem; font-weight: 700; }
.app-steps button[aria-selected="true"] .app-step-n { background: var(--accent); color: #fff; }
.app-step-desc { min-height: 3em; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius-sm); margin: 0 0 16px; }

/* правки: вертикальные плитки, доп. цвета, легенда регрессии */
.app-switch { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (min-width: 1100px) { .app-switch { grid-template-columns: repeat(7, 1fr); } }
.app-switch button { grid-template-columns: 1fr; grid-template-rows: auto; row-gap: 4px; align-content: start; padding: 12px; hyphens: auto; }
.app-switch .app-ico { grid-row: auto; width: 36px; height: 36px; margin-bottom: 4px; }
.app-switch b { font-size: .86rem; overflow-wrap: anywhere; }
.app-chart .m-s5 { stroke: var(--s5); }
.app-chart .app-fbar.m-s5 { fill: var(--s5); }
.app-sw.m-s5 { background: var(--s5); }
.app-sw.m-truth { background: var(--muted); }
.app-sw.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.app-reg-legend { margin: 8px 0; }
.app-reg-legend .pm { font-weight: 600; }

/* ===== Планировщик (assets/planner/ui.js) ===== */
.cfg.planner { margin-top: 18px; }
.pl-heat text, .pl-gantt text, .pl-load text { font-size: 11px; }
.chart .pl-row { fill: var(--text); font-size: 11.5px; }
.pl-cellbox { cursor: pointer; }
.pl-cellbox:focus { outline: none; }
.pl-cellbox:hover rect, .pl-cellbox:focus-visible rect { stroke: var(--text); stroke-width: 1.5; }
.pl-cellbox.sel rect { stroke: var(--text); stroke-width: 2.5; }
.chart .pl-celltext { font-size: 10px; fill: var(--text); pointer-events: none; }
.chart .pl-celltext.inv { fill: #fff; }
.chart .pl-bar { fill: var(--accent); }
.chart .pl-year { font-size: 10.5px; fill: var(--muted); font-weight: 600; }
.chart .pl-mon { font-size: 9px; fill: var(--faint); }
.chart .pl-load-bar { fill: var(--accent); }
.chart .pl-load-bar.over { fill: var(--d-r3); }
.chart .pl-limit { stroke: var(--text); stroke-dasharray: 4 3; stroke-width: 1.2; }
.pl-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--accent); }
.pl-dot.out { background: var(--d-r3); }
.pl-upload { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; margin: 10px 0; }
.pl-upload .inline-fields { grid-column: 1 / -1; }
.pl-file-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 4px; }
.pl-file-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pl-file-row label { cursor: pointer; margin: 0; flex: none; }
.pl-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.pl-file-input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-file-name { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#pl-norms .app-seg, #pl-plan .app-seg { margin: 4px 0 10px; flex-wrap: wrap; }
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.cfg.planner h2.h3 { margin-top: 0; }
#pl-cell svg { max-width: 640px; }
.pl-card { margin: 14px 0; }
.pl-card.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pl-card h4 { margin: 0 0 6px; font-size: 1.02rem; }
.pl-card details { margin: 8px 0; }
.pl-card summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.pl-steps { margin: 6px 0 12px; padding-left: 1.3em; }
.pl-steps li { margin: 2px 0; }
.pl-params { max-width: 460px; }

/* сводка «какой метод предпочтительнее» */
table.pl-map td { vertical-align: top; font-size: .88rem; }
table.pl-map td:first-child { min-width: 170px; }
table.pl-map td.good { background: color-mix(in srgb, var(--ok) 10%, transparent); }
table.pl-map td.bad { background: color-mix(in srgb, var(--d-r3) 10%, transparent); }
.pl-map .chip { display: inline-block; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin: 0 4px 3px 0; font-size: .82rem; }
.pl-map .chip.pm { background: var(--pm-soft); color: var(--pm); }
.pl-map .chip.mm { background: color-mix(in srgb, var(--s1) 15%, transparent); color: var(--s1); }
.pl-map .verdict { display: inline-block; font-weight: 600; padding: 3px 9px; border-radius: 6px; line-height: 1.35; }
.pl-map .verdict.pm { background: var(--pm-soft); color: var(--text); border-left: 3px solid var(--pm); }
.pl-map .verdict.tie { background: var(--surface-2); color: var(--text); border-left: 3px solid var(--faint); }
.pl-seed-hint { margin-top: -6px; margin-bottom: 12px; }
.pl-seed-row { display: flex; gap: 8px; align-items: center; }
.pl-seed-row input { flex: 1 1 auto; min-width: 0; }
.pl-seed-row .btn { flex: 0 0 auto; }
/* код и ссылки во вводном абзаце на синей шапке */
.page-head .lead code { background: rgba(255, 255, 255, .16); color: var(--head-text); border: 1px solid rgba(255, 255, 255, .28); }
.page-head .lead a { color: var(--head-text); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .55); text-underline-offset: 3px; }
.page-head .lead a:hover { text-decoration-color: currentColor; }

/* перевод названия метода под бейджем (русская версия) */
.badge-sub { display: block; margin: 8px 0 0 2px; font-size: .86rem; color: var(--muted); }
@media (max-width: 420px) { .tools > .lang-switch a, .tools > .lang-switch span { padding: 4px 6px; } }
.tools-sub { margin: 14px 0 0; color: var(--muted); font-size: .92rem; }
@media (max-width: 480px) {
  .site-header .brand-text small, header .brand-text small { display: none; }
  .tools { gap: 6px; }
}

/* бейдж с двумя названиями метода (русская версия) */
.badge.badge-2 { border-radius: 14px; padding: 7px 14px 7px 7px; gap: 10px; align-items: center; }
.badge.badge-2 b { align-self: stretch; display: grid; place-items: center; border-radius: 9px; padding: 0 10px; font-size: .8rem; }
.badge-names { display: grid; gap: 1px; line-height: 1.25; }
.badge-names > span:first-child { color: var(--text); font-weight: 700; font-size: .9rem; }
.badge-names > span:last-child { color: var(--muted); font-weight: 500; font-size: .76rem; letter-spacing: .01em; }

/* главная: русский заголовок — в две строки; факты вместо чисел; живой «Как это работает»; три колонки применимости */
html[lang="ru"] .hero h1 { font-size: clamp(1.9rem, 3.3vw, 2.55rem); }
.facts { list-style: none; padding: 22px 0 0; margin: 30px 0 0; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.facts li { display: flex; gap: 12px; align-items: center; font-size: .92rem; color: var(--muted); line-height: 1.4; }
.facts b { color: var(--text); font-weight: 600; }
.fact-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.how-live { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .how-live { grid-template-columns: minmax(0, 1fr); } }
.how-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: hs; }
.how-steps li { position: relative; padding: 16px 18px 14px 58px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.how-steps li::before { counter-increment: hs; content: counter(hs); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: .9rem; }
.how-steps h3 { margin: 0 0 4px; font-size: 1rem; }
.how-steps p { margin: 0; font-size: .92rem; color: var(--muted); }
.how-lab { min-width: 0; }
.when3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .when3 { grid-template-columns: minmax(0, 1fr); } }
.when3 ul { margin: 0; padding-left: 1.1em; display: grid; gap: 9px; font-size: .93rem; }
.when3 li a { white-space: nowrap; font-weight: 600; }
.when3 .card.tie { border-top: 3px solid var(--faint); }
