/* suite.css — общий для всех утилит файл (одинаковый в каждом репозитории): вся система интерфейса —
   шрифты, шапка, колонка этапов, лист со штампом, поля, кнопки, расчётные карточки, шаги файлов, сохранения,
   окна и подсказки, меню «Утилиты» и раскладка шапки на телефоне.
   Цвета берутся из переменных app.css конкретной утилиты, поэтому файл не зависит от палитры.
   Порядок подключения: suite.css, затем app.css (палитра и блоки, которые есть только у этой утилиты).
   Правило: всё, что встречается больше чем в одной утилите, живёт здесь, а не в app.css. */

:root {
  --f-disp: "Jura", "Bahnschrift", "DIN Alternate", "Arial Narrow", sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --r: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
sub, sup { line-height: 0; }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--sheet) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1320px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.brand svg { flex: none; }
.brand b { font: 700 18px/1.1 var(--f-disp); letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.var-ctl { display: flex; align-items: center; gap: 6px; }
.var-ctl label { font: 600 11px/1 var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.var-box { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--sheet); }
.var-box button { border: 0; background: transparent; width: 34px; cursor: pointer; font-size: 16px; color: var(--muted); }
.var-box button:hover { background: var(--sheet-2); color: var(--fg); }
.var-box select { border: 0; border-inline: 1px solid var(--line); background: var(--sheet); padding: 6px 8px; font: 600 16px/1 var(--f-body); font-variant-numeric: tabular-nums; min-width: 74px; text-align: center; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--sheet); border-radius: var(--r); padding: 7px 12px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .55; cursor: progress; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--sheet); cursor: pointer; }

/* ---------- каркас ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; padding-block: 18px 60px; display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 22px; align-items: start; }
nav.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 74px); display: flex; flex-direction: column; gap: 4px; }
.rail a { display: grid; grid-template-columns: 42px 1fr; gap: 2px 10px; align-items: center; padding: 9px 10px; border-radius: var(--r); text-decoration: none; color: var(--fg); border: 1px solid transparent; }
.rail a .no { grid-row: span 2; font: 700 20px/1 var(--f-disp); color: var(--muted); text-align: center; border-right: 1px solid var(--line); padding-right: 8px; }
.rail a .t { font-weight: 600; font-size: 14px; line-height: 1.25; }
.rail a .s { font-size: 12px; color: var(--muted); line-height: 1.25; }
.rail a:hover { background: var(--sheet); }
.rail a[aria-current="page"] { background: var(--sheet); border-color: var(--line); box-shadow: var(--shadow); }
.rail a[aria-current="page"] .no { color: var(--accent); }
.rail .rail-foot { margin-top: 14px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--r); font-size: 12.5px; color: var(--muted); }
.rail .rail-foot b { color: var(--fg); }

/* ---------- лист ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 0; }
.sheet-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.sheet-head .eyebrow { font: 600 11.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.sheet-head h1 { font: 700 clamp(22px, 3.2vw, 31px)/1.12 var(--f-disp); margin: 8px 0 6px; text-wrap: balance; letter-spacing: .01em; }
.sheet-head p.lead { margin: 0; color: var(--muted); max-width: 66ch; }
.stamp { border: 1.5px solid var(--fg); font: 12px/1.2 var(--f-body); font-variant-numeric: tabular-nums; align-self: start; min-width: 250px; border-collapse: collapse; }
.stamp td { border: 1px solid var(--fg); padding: 4px 8px; white-space: nowrap; }
.stamp td.k { color: var(--muted); font-family: var(--f-body); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.stamp td.v { font-weight: 500; }
.sheet-body { padding: 8px 26px 26px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r); margin: 18px 0 6px; overflow: hidden; }
.kpi { padding: 10px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font: 600 18px/1.3 var(--f-body); font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 12px; color: var(--muted); font-family: var(--f-body); }

/* ---------- элементы отчёта ---------- */
.rep h2 { font: 700 19px/1.25 var(--f-disp); margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); text-wrap: balance; letter-spacing: .01em; }
.rep p { margin: 8px 0; max-width: 92ch; }
.eq { margin: 6px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }
.eq .katex-display { margin: 0; text-align: left; }
.eq .katex-display > .katex { text-align: left; padding-left: 4px; }
.tex { margin: 10px 0; overflow-x: auto; overflow-y: hidden; padding: 6px 0; }
.tex .katex-display { margin: 0; text-align: left; }
.tex .katex-display > .katex { text-align: left; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: var(--r); margin: 8px 0; background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.check.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.check .mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--sheet); background: var(--ok); font-size: 13px; margin-top: 2px; }
.check.bad .mark { background: var(--bad); }
.check .body { min-width: 0; overflow-x: auto; }
.check .body .ct { font-size: 13.5px; color: var(--fg); }
.note { margin: 10px 0; padding: 9px 12px 9px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r) var(--r) 0; font-size: 14px; }
.note.warn { border-color: var(--warn); background: var(--warn-soft); }
.note.bad { border-color: var(--bad); background: var(--bad-soft); }
.tbl { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: var(--r); }
.tbl table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl caption { caption-side: top; text-align: left; padding: 8px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--sheet-2); }
.tbl th, .tbl td { padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-weight: 600; font-size: 12.5px; background: var(--sheet-2); color: var(--muted); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--f-mono); }
figure.fig { margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--sheet); }
figure.fig .plot { width: 100%; min-height: 300px; }
figure.fig figcaption { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); background: var(--sheet-2); }
figure.fig figcaption b { color: var(--fg); font-weight: 600; }
.plot-wait { display: grid; place-items: center; height: 300px; color: var(--muted); font-size: 13px; }
.spinner { will-change: transform; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.diagram { overflow-x: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); margin: 14px 0; background: var(--plot-bg); }
.diagram .dcap { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
svg.ssdm { display: block; max-width: none; }
svg.ssdm .wire { fill: none; stroke: var(--fg); stroke-width: 1.2; }
svg.ssdm .arrowhead { fill: var(--fg); }
svg.ssdm .blk { fill: var(--sheet); stroke: var(--fg); stroke-width: 1.2; }
svg.ssdm .blk.acc { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
svg.ssdm .blk.dsh { stroke-dasharray: 5 3; fill: var(--sheet-2); }
svg.ssdm .bt { font: 12px var(--f-mono); fill: var(--fg); }
svg.ssdm .frac { stroke: var(--fg); stroke-width: 1; }
svg.ssdm .cap { font: 10.5px var(--f-body); fill: var(--muted); }
svg.ssdm .sum { fill: var(--sheet); stroke: var(--fg); stroke-width: 1.2; }
svg.ssdm .sumx { stroke: var(--fg); stroke-width: 0.8; }
svg.ssdm .sg { font: 600 12px var(--f-mono); fill: var(--fg); }
svg.ssdm .lbl { font: italic 12.5px var(--f-body); fill: var(--fg); }
svg.ssdm .lbl.sig { fill: var(--accent-2); font-style: italic; }
svg.ssdm .dot { fill: var(--fg); }
svg.ssdm .bar { fill: var(--fg); }

/* код */
.code { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; background: var(--sheet-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.code-head .fn { font: 500 13px var(--f-mono); }
.code-head .acts { display: flex; gap: 6px; }
pre.src { margin: 0; padding: 12px 14px; background: var(--code-bg); overflow: auto; max-height: 460px; font: 12.5px/1.5 var(--f-mono); tab-size: 4; }
pre.src .c { color: var(--code-com); }
pre.src .s { color: var(--code-str); }
pre.src .k { color: var(--code-kw); }

/* файлы */
.files { margin-top: 30px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.files-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--sheet-2); border-bottom: 1px solid var(--line); }
.files-head h3 { margin: 0; font: 700 17px/1.2 var(--f-disp); }
.files-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row .fn { font: 500 14px var(--f-mono); word-break: break-all; }
.file-row .fd { font-size: 13px; color: var(--muted); }
.file-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.file-row .step-no { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 600 11px var(--f-body); margin-right: 6px; vertical-align: 1px; }
.file-view { grid-column: 1 / -1; min-width: 0; }
.fmark { margin-left: 8px; padding: 1px 6px; border-radius: 3px; font: 600 11px var(--f-body); vertical-align: 1px; }
.fmark.new, .fchip.new em { background: var(--ok-soft); color: var(--ok); }
.fmark.chg, .fchip.chg em { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 80%, var(--fg)); }

/* шаги этапа: вертикальная линия-маршрут, номер шага на ней */
ol.steps { list-style: none; margin: 0; padding: 4px 0 0; }
.step, .step-fin { position: relative; padding: 12px 14px 12px 50px; }
.step::before { content: ""; position: absolute; left: 25px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.step:first-child::before { top: 22px; }
.steps:not(:has(+ .step-fin)) .step:last-child::before { bottom: auto; height: 22px; }
.step-fin { border-top: 1px dashed var(--line-strong); background: var(--sheet-2); }
.step-fin > .fd { margin: 6px 0 8px; font-size: 13px; color: var(--muted); }
.step-top { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.step-top .step-no { position: absolute; left: 14px; top: 12px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12.5px var(--f-body); box-shadow: 0 0 0 4px var(--sheet); }
.step-fin .step-top .step-no { box-shadow: 0 0 0 4px var(--sheet-2); }
.step-no.all { background: var(--ok); color: var(--sheet); }
.step-t { flex: 1 1 240px; min-width: 0; }
.step-t h4 { margin: 0; font: 600 15.5px/1.3 var(--f-body); }
.step-t h4.mono { font: 600 14.5px/1.3 var(--f-mono); word-break: break-all; }
.step-sec { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.step-kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px 12px; margin: 10px 0 4px; font-size: 13.5px; }
.step-kv dt { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.step-kv dd { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.step-kv dd:not(:has(.run)) { display: block; }
code.run { font: 500 13px var(--f-mono); background: var(--code-bg); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; word-break: break-all; }
.step-kv .calc-btn { width: 26px; height: 26px; }
.fig-link { border: 0; background: var(--accent-soft); color: var(--accent); font: 600 12.5px var(--f-body); padding: 1px 7px; border-radius: 4px; cursor: pointer; }
.fig-link:hover { text-decoration: underline; }
.fchips { display: flex; flex-wrap: wrap; gap: 5px; }
.fchip { display: inline-flex; align-items: center; gap: 5px; font: 500 12.5px var(--f-mono); padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--sheet); color: var(--muted); }
.fchip.new, .fchip.chg { color: var(--fg); border-color: var(--line-strong); }
.fchip em { font: 600 10.5px var(--f-body); font-style: normal; padding: 0 4px; border-radius: 3px; }
.step-files { margin-top: 8px; }
.step-files > summary { cursor: pointer; font-size: 13px; color: var(--accent); width: max-content; }
.step-files[open] > summary { margin-bottom: 6px; }
.step-files .file-row { padding: 8px 0; }
.step-files .file-row:last-child { border-bottom: 0; }
figure.fig.flash { animation: figflash 1.4s ease-out; }
@keyframes figflash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 640px) {
  .step, .step-fin { padding-left: 44px; padding-right: 12px; }
  .step::before { left: 21px; }
  .step-top .step-no { left: 10px; }
  .step-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .step-kv dd { margin-bottom: 6px; }
}

/* исходные данные */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 14px 0; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld label { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.fld label .sym { font-family: var(--f-mono); color: var(--fg); }
.fld input, .fld select { width: 100%; border: 1px solid var(--line-strong); background: var(--sheet); border-radius: var(--r); padding: 7px 9px; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.fld select { font-family: var(--f-body); }
.fld input:focus, .fld select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.fld.changed input { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 7%, var(--sheet)); }
.fld .hint { font-size: 11.5px; color: var(--muted); }
details.adv { margin: 16px 0; border: 1px solid var(--line); border-radius: var(--r); }
details.adv > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: "+"; font: 600 18px/1 var(--f-mono); color: var(--muted); }
details.adv[open] > summary::after { content: "−"; }
details.adv > .in { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 10px 0; }
.chk input { margin-top: 4px; }
.var-table { max-height: 420px; overflow: auto; }
.var-table tr { cursor: pointer; }
.var-table tr:hover td { background: var(--sheet-2); }
.var-table tr.on td { background: var(--accent-soft); font-weight: 600; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.pill.a { color: var(--accent); }
.pill.b { color: var(--accent-2); }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }
.approx { margin: -6px 0 18px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--sheet-2); }
.approx h4 { margin: 0 0 4px; font-size: 14px; }
.approx p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.approx .form-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin: 8px 0; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--sheet); padding: 9px 16px; border-radius: var(--r); font-size: 14px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.progress { font-size: 13px; color: var(--muted); }
.foot { max-width: 1320px; margin: 0 auto; padding: 0 16px 30px; font-size: 12.5px; color: var(--muted); }

/* ---------- адаптив ---------- */
@media (max-width: 960px) {
  .wrap { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 10px 50px; }
  nav.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--top-h, 58px)); z-index: 10; flex-direction: row; overflow-x: auto; gap: 6px; padding: 6px 0 8px; background: var(--bg); scrollbar-width: none; }
  nav.rail::-webkit-scrollbar { display: none; }
  .rail a { flex: none; grid-template-columns: auto; padding: 6px 12px; border: 1px solid var(--line); background: var(--sheet); }
  .rail a .no { grid-row: auto; border: 0; padding: 0; font-size: 15px; }
  .rail a .t, .rail a .s { display: none; }
  .rail a .no::after { content: attr(data-short); font: 500 12.5px var(--f-body); margin-left: 6px; color: var(--muted); }
  .rail a[aria-current="page"] { background: var(--accent); border-color: var(--accent); }
  .rail a[aria-current="page"] .no, .rail a[aria-current="page"] .no::after { color: var(--accent-ink); }
  .rail .rail-foot { display: none; }
  .sheet-head { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 14px; }
  .stamp { min-width: 0; width: 100%; }
  .sheet-body { padding: 4px 16px 20px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .top-in { gap: 8px 10px; padding: 8px 12px; }
  .brand small { display: none; }
  .brand b { font-size: 16px; }
  .top .btn .lbl-long { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr); }
  .file-row .acts { justify-content: flex-start; }
  .rep h2 { font-size: 17px; }
}

/* расчётные карточки */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; margin: 10px 0; padding: 8px 8px 8px 14px; background: var(--calc-bg); border: 1.5px dashed var(--line-strong); border-radius: var(--r); }
.calc-math { min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.calc-math .katex-display { margin: 0; text-align: left; }
.calc-math .katex-display > .katex { text-align: left; }
.calc-tools { display: flex; gap: 4px; align-self: start; }
.calc-btn { width: 32px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--sheet); color: var(--muted); cursor: pointer; }
.calc-btn:hover { color: var(--accent); border-color: var(--accent); }
.calc-btn.tx { font: 600 10.5px var(--f-mono); }
.calc-desc { grid-column: 1 / -1; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; margin-right: 6px; }
.calc-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.calc-hint svg { flex: none; margin-top: 2px; }
@media (max-width: 640px) {
  .calc { grid-template-columns: minmax(0, 1fr); padding: 8px 10px; }
  .calc-tools { flex-direction: row; justify-content: flex-end; }
  .calc-desc { margin-right: 0; }
}

/* ---------- вкладка «Исходные данные»: единая структура ---------- */
.data-page .dsec { padding-bottom: 6px; }
.data-page .dsec + .dsec { margin-top: 8px; }
.data-page h2 { display: flex; align-items: center; gap: 10px; }
.data-page .dno { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 14px/1 var(--f-mono); flex: none; }
.data-page h3 { font: 600 13px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.data-page .dlead { margin: 0 0 4px; color: var(--muted); font-size: 14px; max-width: 78ch; }
.data-page .dhint { margin: 6px 0 10px; color: var(--muted); font-size: 12.5px; }
.data-page .dact { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.form-grid.fg4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid.fg3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.data-page .fld { justify-content: flex-end; }
.data-page .fld label { align-items: baseline; }
.data-page .fld label > span:first-child { min-width: 0; }
.data-page .fld label .sym { white-space: nowrap; color: var(--muted); font-size: 12px; }
.fld .inp { position: relative; display: flex; }
.fld .inp input { padding-right: 9px; }
.fld .inp .unit { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 12px/1 var(--f-mono); color: var(--muted); pointer-events: none; background: inherit; }
.fld .inp.has-u input { padding-right: 70px; }
.fld input.txt { font-family: var(--f-body); }
.fld textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 8px 9px; background: var(--sheet); font: 13.5px/1.45 var(--f-body); color: var(--fg); resize: vertical; }
.fld textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.opts { border: 1px solid var(--line); border-radius: var(--r); margin: 12px 0; background: var(--sheet); }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 12px 14px 14px; }
.opt + .opt { border-top: 1px solid var(--line); }
.opt-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-t b { font-weight: 600; font-size: 14.5px; }
.opt-t span { font-size: 12.5px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--sheet-2); }
.seg button { border: 0; background: transparent; padding: 6px 12px; font: 500 13px/1.2 var(--f-body); color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { color: var(--fg); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.sw { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw .track { width: 40px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; transition: background .15s; }
.sw .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + .track { background: var(--accent); }
.sw input:checked + .track::after { transform: translateX(18px); }
.sw input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dl-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 8px 0 4px; }
.dl-grid .btn { justify-content: center; }
.dl-grid .dl-all { grid-column: 1 / -1; padding: 10px 12px; font-size: 15px; }
@media (max-width: 720px) {
  .opt.has-seg { grid-template-columns: 1fr; gap: 8px; }
  .opt-c { justify-self: start; }
  .dl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg button { padding: 6px 10px; }
}

/* «что меняется» под каждой настройкой */
.opt-ex { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* неактивный вариант — пунктирная рамка и серый заголовок; текст остаётся контрастным (без прозрачности) */
.ex { border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--calc-bg); transition: border-color .15s; min-width: 0; }
.ex.on { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ex-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 6px 10px; font: 600 12px/1.2 var(--f-body); color: var(--muted); border-bottom: 1px dashed var(--line); }
.ex.on .ex-h { color: var(--accent); }
/* подпись варианта — цельный текст (индексы <sub> не становятся отдельными flex-элементами) */
.ex-l { min-width: 0; padding-top: 2px; }
.ex-now { flex: none; font: 600 10.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: var(--accent-ink); padding: 3px 6px; border-radius: 10px; }
.ex-b { padding: 8px 10px; }
.ex-f { font: 13.5px/1.55 var(--f-body); font-variant-numeric: tabular-nums; color: var(--fg); overflow-wrap: break-word; }
.ex-f + .ex-f { margin-top: 2px; }
/* превью листа растягивается на всю высоту карточки — пары карточек одной высоты без пустого «хвоста» */
.ex { display: flex; flex-direction: column; }
.ex-b { flex: 1; }
.ex-b:has(> .ex-paper:only-child) { display: flex; flex-direction: column; }
.ex-b > .ex-paper:only-child { flex: 1; }
.ex-p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.ex-paper { position: relative; background: #fff; color: #1b232c; border: 1px solid #d5dbe2; border-radius: 3px; padding: 10px 14px; font: 13px/1.45 "Times New Roman", Times, serif; }
.ex-paper p { margin: 0 0 4px; text-indent: 1.25em; text-align: justify; hyphens: auto; }
.ex-paper p.h { font-weight: 700; text-indent: 0; }
.ex-paper p.cap { text-indent: 0; text-align: left; }
.ex-paper p.gap { text-indent: 0; text-align: center; color: #5f6b78; font: italic 12px/1 var(--f-body); padding: 12px 0; border: 1px dashed #d5dbe2; border-radius: 3px; }
.ex-paper .ex-math { text-align: center; font-style: italic; margin: 2px 0 6px; }
.ex-paper pre { margin: 2px 0 4px; white-space: pre-wrap; font: 12px/1.35 "Courier New", Courier, monospace; }
.ex-paper pre.serif { font-family: "Times New Roman", Times, serif; font-size: 13px; }
.ex-paper.title { text-align: center; }
.ex-paper.title p { text-indent: 0; text-align: center; font-size: 12px; }
.ex-logo { display: inline-grid; place-items: center; width: 44px; height: 40px; margin-bottom: 4px; border-radius: 4px; background: var(--brand); color: #fff; font: 700 9px/1 var(--f-body); }
.ex-paper.fig { padding: 8px 10px; }
.ex-paper.fig svg { display: block; width: 100%; height: 96px; }
.ex-paper.fig p.cap { text-align: center; margin-top: 4px; }
.ex-wm { position: absolute; left: 12%; right: 12%; top: 18px; background: #fff; border: 1px solid #c9d1da; border-left: 3px solid var(--brand); border-radius: 5px; box-shadow: 0 3px 10px rgba(0,0,0,.15); padding: 6px 9px; display: flex; flex-direction: column; gap: 1px; font-family: var(--f-body); }
.ex-wm b { font-size: 12px; color: var(--brand); }
.ex-wm span { font-size: 11px; color: #5a6776; }
.ex-brk { margin: 6px -14px; border-top: 2px dashed #9aa5b1; position: relative; height: 0; }
.ex-brk span { position: absolute; right: 10px; top: -9px; background: #fff; padding: 0 5px; font: 10.5px/1.6 var(--f-body); color: #5f6b78; }
@media (max-width: 720px) {
  .opt-ex { grid-template-columns: 1fr; }
  .opt.has-seg { grid-template-columns: 1fr; }
  .opt.has-seg .opt-c { justify-self: start; }
}

.opt-ex:has(.ex-multi) { grid-template-columns: 1fr; }
.ex-multi { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; }
.ex-multi .ex-f { font-size: 12.5px; }
@media (max-width: 720px) { .ex-multi { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .ex-multi { grid-template-columns: 1fr; } }

.opt-ex:has(.ex-wide) { grid-template-columns: 1fr; }
.ex-tbl { width: 100%; border-collapse: collapse; font: 13px/1.35 var(--f-body); font-variant-numeric: tabular-nums; }
.ex-tbl th { text-align: right; font: 600 12px/1.2 var(--f-body); color: var(--muted); padding: 4px 8px; border-bottom: 1px solid var(--line); }
.ex-tbl th:first-child, .ex-tbl td:first-child { text-align: left; font-family: var(--f-body); }
.ex-tbl td { text-align: right; padding: 4px 8px; color: var(--muted); border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.ex-tbl tr:last-child td { border-bottom: 0; }
.ex-tbl tr.on td { color: var(--fg); font-weight: 600; background: var(--accent-soft); }
.ex-tbl td span, .ex-tbl th span { font: 600 10px/1 var(--f-body); white-space: nowrap; display: inline-block; text-transform: uppercase; letter-spacing: .05em; background: var(--accent); color: var(--accent-ink); padding: 2px 5px; border-radius: 8px; margin-left: 4px; }
.ex-wide .ex-b { overflow-x: auto; }

.ex-f mark, .ex-p mark { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.ex-note { grid-column: 1 / -1; margin: 0; max-width: none; padding: 7px 10px; font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--accent-2); background: var(--sheet-2); border-radius: 0 var(--r) var(--r) 0; }

/* слоты сохранений */
.slot .opt-t b { display: flex; align-items: center; gap: 8px; }
.slot-no { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font: 600 12px/1 var(--f-mono); color: var(--muted); flex: none; }
.slot:not(.empty) .slot-no { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slot.empty .opt-t b { color: var(--muted); font-weight: 500; }
.slot .opt-t > span { padding-left: 30px; }
.slot-act { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.icon-x { padding: 7px 10px; }
label.btn { cursor: pointer; }
@media (max-width: 720px) { .slot { grid-template-columns: 1fr; } .slot .opt-c { justify-self: start; } }

.slot.auto { background: var(--sheet-2); }
.slot.auto .slot-no { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* окно «продолжить?» */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(10, 18, 28, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); background: var(--sheet); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.25); padding: 20px 22px 18px; }
.modal h2 { margin: 0 0 10px; font: 700 19px/1.25 var(--f-disp); }
.modal p { margin: 0 0 8px; }
.modal-card { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--calc-bg); margin: 4px 0 10px; }
.modal-card span { font-size: 13px; color: var(--muted); }
.modal-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* навигация по разделам */
nav.rail { max-height: calc(100vh - 90px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
nav.rail::-webkit-scrollbar { width: 6px; }
nav.rail::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.rail-toc { display: flex; flex-direction: column; margin: 2px 0 8px 22px; padding-left: 10px; border-left: 2px solid var(--line); }
.rail-toc a { display: grid; grid-template-columns: 30px 1fr; gap: 4px; padding: 4px 8px; border: 0; border-radius: 4px; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.rail-toc a .tn { font: 500 11.5px/1.35 var(--f-mono); color: var(--muted); }
.rail-toc a:hover { color: var(--fg); background: var(--sheet); }
.rail-toc a.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rail-toc a.on .tn { color: var(--accent); }
.toc-fab, .toc-pop { display: none; }
@media (max-width: 960px) {
  nav.rail { max-height: none; overflow-y: visible; }
  .rail-toc { display: none; }
  .toc-fab { display: inline-flex; align-items: center; gap: 7px; position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 40; padding: 10px 14px; border: 0; border-radius: 22px; background: var(--accent); color: var(--accent-ink); font: 600 14px/1 var(--f-body); box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
  .toc-pop:not([hidden]) { display: flex; flex-direction: column; position: fixed; right: 14px; left: 14px; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 41; max-height: 60vh; overflow-y: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.25); padding: 6px; }
  .toc-pop-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px; font: 700 15px/1 var(--f-disp); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  .toc-top { border: 1px solid var(--line-strong); background: var(--sheet); border-radius: 5px; padding: 4px 8px; font: 500 12.5px var(--f-body); color: var(--fg); cursor: pointer; }
  .toc-pop a { display: grid; grid-template-columns: 34px 1fr; gap: 4px; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--fg); font-size: 14px; }
  .toc-pop a .tn { font: 500 12.5px/1.4 var(--f-mono); color: var(--muted); }
  .toc-pop a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
}

/* блоки модели Simulink */
details.sh > summary { font-family: var(--f-mono); font-weight: 500; font-size: 14px; }
.sh-tbl td { vertical-align: middle; }
.sh-tbl td:first-child { white-space: nowrap; }
.sh-tbl td:first-child span { display: block; font-size: 12px; color: var(--muted); }
.sh-tbl .sv { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sh-tbl .sv code { font: 13px/1.4 var(--f-mono); overflow-wrap: anywhere; }
.sh-tbl .sv .calc-btn { flex: none; width: 28px; height: 26px; }

/* сверка с ручным расчётом */
.chk-bar { margin: 12px 0 4px; }
.chk-bar .c-ok { color: var(--ok, #1f7a3a); } .chk-bar .c-warn { color: var(--warn, #9a6400); } .chk-bar .c-bad { color: var(--bad); }
.chk-row { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; border-top: 1px dashed var(--line); padding-top: 8px; margin-right: 6px; }
.chk-row label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.chk-row input { width: 130px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 5px 8px; background: var(--sheet); font: 13px var(--f-mono); color: var(--fg); }
.chk-row input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.chk-row em { font: normal 12px var(--f-mono); color: var(--muted); }
.chk-v { font-size: 13px; color: var(--muted); }
.chk-v .katex { font-size: 1em; }
.chk-row.ok .chk-v { color: var(--ok, #1f7a3a); }
.chk-row.warn .chk-v { color: var(--warn, #9a6400); }
.chk-row.bad .chk-v { color: var(--bad); }
.chk-row.ok input { border-color: var(--ok, #1f7a3a); }
.chk-row.warn input { border-color: var(--warn, #9a6400); }
.chk-row.bad input { border-color: var(--bad); }
@media (max-width: 640px) { .chk-row { grid-template-columns: 1fr; } }

/* подсказка над блоками схемы */
svg.ssdm .hv { cursor: help; outline: none; }
svg.ssdm .hv:hover .blk, svg.ssdm .hv:focus .blk, svg.ssdm .hv:hover .sum, svg.ssdm .hv:focus .sum { stroke: var(--accent); stroke-width: 2; }
.tipbox { position: fixed; z-index: 90; display: none; max-width: 320px; pointer-events: none; background: var(--sheet); color: var(--fg); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); border-radius: var(--r); box-shadow: 0 8px 22px rgba(0,0,0,.18); padding: 7px 10px; font-size: 12.5px; line-height: 1.35; }
.tipbox small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tipbox b { display: block; font: 600 13.5px/1.3 var(--f-mono); margin: 1px 0 2px; }
.tipbox span { display: block; color: var(--muted); }
.diagram .dcap { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dhint-r { font-size: 12px; color: var(--muted); font-weight: 400; }
@media (max-width: 640px) {
  .form-grid.fg4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .data-page .fld label { flex-direction: column; gap: 0; }
  .data-page .fld label .sym { align-self: flex-start; }
}

/* матрицы в формулах и контрольные вопросы */
.calc-math .katex .arraycolsep { width: 0.4em !important; }
.qa h2 { counter-increment: none; }
.qa p { max-width: 80ch; }
.tbl td .pill { margin-left: 6px; }
.fell { color: var(--bad); font-weight: 600; }

/* числовые показатели с оценкой и простые выпадающие списки */
.kpi.bad .v { color: var(--bad); }
.kpi.ok .v { color: var(--ok); }
select.txt { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--sheet); font: inherit; }

/* кнопки шапки: одинаковое поведение во всех утилитах */
.icon-btn { color: var(--fg); }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* меню «Утилиты» */
.suite-pop {
  position: fixed; z-index: 40; width: min(340px, calc(100vw - 16px));
  background: var(--sheet); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(10, 18, 28, .18), 0 2px 6px rgba(10, 18, 28, .08); padding: 6px;
}
.suite-pop[hidden] { display: none; }
.suite-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.suite-h span { font: 600 11px/1 var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.suite-h a { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent); border-radius: 4px; }
.suite-h a:hover { text-decoration: underline; }
.suite-it { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r); color: var(--fg); text-decoration: none; }
a.suite-it:hover, a.suite-it:focus-visible { background: var(--sheet-2); outline: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
.suite-it.cur { background: var(--accent-soft); }
.suite-t { display: flex; flex-direction: column; min-width: 0; }
.suite-t b { font-size: 14px; font-weight: 600; line-height: 1.25; }
.suite-t small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.suite-it em { font: 600 10.5px/1 var(--f-body); font-style: normal; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.suite-ic { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--c); color: #fff; }

/* меню «Стиль оформления»: пункты-кнопки и образцы стилей */
button.suite-it { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
button.suite-it:hover, button.suite-it:focus-visible { background: var(--sheet-2); outline: none; box-shadow: inset 0 0 0 1px var(--line-strong); }
button.suite-it.cur { background: var(--accent-soft); }
.suite-sw { flex: none; width: 34px; height: 34px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.suite-it em.dim { color: var(--muted); }
.suite-h .suite-note { font-size: 11.5px; color: var(--muted); }

/* шапка на телефоне: одинаковая раскладка во всех утилитах —
   1-я строка — название и три кнопки, 2-я — выбор варианта во всю ширину */
@media (max-width: 640px) {
  .top .brand { flex: 1 1 0; min-width: 0; margin-right: 0; }
  .top .brand b { display: block; font-size: 15px; line-height: 1.15; }
  .top .brand svg { width: 30px; height: 30px; }
  .top .icon-btn { flex: none; }
  .var-ctl { order: 5; flex: 1 0 100%; min-width: 0; }
  .var-ctl label { display: none; }
  .var-box { flex: 1 1 auto; min-width: 0; }
  .var-box button { width: 44px; }
  .var-box select { flex: 1 1 auto; min-width: 0; max-width: none; font-size: 15px; }
}

/* ---------- единые размеры элементов управления ----------
   Обычный размер (кнопки, поля, списки, кнопки-иконки, выбор варианта) — 36 px, малый (кнопки .sm, кнопки
   у формул, сегменты) — 30 px, главная кнопка «скачать всё» — 44 px. Высоту задаёт min-height, отступы — только по бокам,
   поэтому кнопки и поля в одной строке всегда стоят ровно в любом стиле оформления. */
:root { --ctl-h: 36px; --ctl-h-sm: 30px; --ctl-h-lg: 44px; }
.btn { min-height: var(--ctl-h); padding-block: 4px; line-height: 1.2; justify-content: center; }
.btn.sm { min-height: var(--ctl-h-sm); }
.btn.icon-x { padding-block: 4px; }
.dl-grid .dl-all { min-height: var(--ctl-h-lg); }
.icon-btn { width: var(--ctl-h); height: var(--ctl-h); }
.fld input, .fld select, select.txt, .chk-row input { height: var(--ctl-h); padding-block: 0; line-height: 1.2; }
.chk-row input { height: var(--ctl-h-sm); }
.var-box { height: var(--ctl-h); }
.var-box select { height: auto; padding-block: 0; }
.calc-btn, .step-kv .calc-btn, .sh-tbl .sv .calc-btn { width: var(--ctl-h-sm); height: var(--ctl-h-sm); }
.seg button { min-height: calc(var(--ctl-h-sm) - 2px); }
.toc-top { min-height: 28px; }
.toc-fab { min-height: 40px; }

/* ---------- плавность ----------
   Короткие переходы цвета и рамок у всего, на что можно нажать; лёгкое «нажатие»; меню, окна и сообщения
   появляются и исчезают мягко; смена вкладки, темы и переход между утилитами — плавные.
   При prefers-reduced-motion всё мгновенно (кроме индикатора загрузки — он просто вращается медленнее). */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --ease-out: cubic-bezier(.16, 1, .3, 1); --t-fast: .14s; --t: .2s; }
html { -webkit-tap-highlight-color: transparent; }
.btn, .icon-btn, .calc-btn, .seg button, .var-box button, .toc-top, .toc-fab, .fig-link, .rail a, .rail-toc a, .suite-it, .suite-h a,
.fld input, .fld select, .fld textarea, select.txt, .chk-row input, .var-box select, .var-table tr td, details.adv > summary, .step-files > summary, .ex, .slot {
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              box-shadow var(--t) var(--ease), filter var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.btn:active:not([disabled]), .icon-btn:active, .calc-btn:active, .toc-fab:active, .fig-link:active { transform: translateY(1px) scale(.98); transition-duration: .06s; }
.var-box button:active, .seg button:active { transform: scale(.96); transition-duration: .06s; }
.rail a:active, .suite-it:active { transform: scale(.99); }
details.adv > summary::after { transition: transform var(--t) var(--ease); }
details.adv[open] > summary::after { transform: rotate(180deg); }

/* раскрывающиеся блоки: плавное раскрытие там, где браузер умеет анимировать высоту до auto */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details.adv::details-content, details.step-files::details-content, details.sh::details-content {
    block-size: 0; overflow: clip;
    transition: block-size .26s var(--ease), content-visibility .26s allow-discrete;
  }
  details.adv[open]::details-content, details.step-files[open]::details-content, details.sh[open]::details-content { block-size: auto; }
}

/* меню «Утилиты», «Стиль», «Разделы» и сообщения: появляются и исчезают (display переключается в конце перехода) */
.suite-pop, .toc-pop {
  transform-origin: top right;
  transition: opacity .16s var(--ease), transform .2s var(--ease-out), display .2s allow-discrete, overlay .2s allow-discrete;
}
.toc-pop { transform-origin: bottom right; }
.suite-pop[hidden], .toc-pop[hidden] { opacity: 0; transform: translateY(-4px) scale(.98); }
.toc-pop[hidden] { transform: translateY(6px) scale(.98); }
@starting-style {
  .suite-pop:not([hidden]) { opacity: 0; transform: translateY(-4px) scale(.98); }
  .toc-pop:not([hidden]) { opacity: 0; transform: translateY(6px) scale(.98); }
}
.toast { transition: opacity .2s var(--ease), transform .24s var(--ease-out), display .24s allow-discrete; }
.toast[hidden] { display: none; opacity: 0; transform: translate(-50%, 10px); }
@starting-style { .toast:not([hidden]) { opacity: 0; transform: translate(-50%, 10px); } }

/* окна: фон затемняется, карточка чуть подъезжает */
.modal-back { animation: suite-fade .2s var(--ease) backwards; }
.modal { animation: suite-rise .26s var(--ease-out) backwards; }
@keyframes suite-fade { from { opacity: 0; } }
@keyframes suite-rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* новая вкладка: лист мягко проявляется (класс ставит suite.js только при смене этапа) */
.sheet.sheet-in { animation: suite-sheet .3s var(--ease-out) backwards; }
@keyframes suite-sheet { from { opacity: 0; transform: translateY(6px); } }
figure.fig .plot > * { animation: suite-fade .3s var(--ease) backwards; }

/* переходы между утилитами и хабом, смена темы и стиля — короткое перекрёстное затухание */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .24s; animation-timing-function: var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *:not(.spinner), *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* телефон: строка вкладок — во всю ширину экрана, прокручивается до края */
@media (max-width: 960px) {
  nav.rail { margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
}

/* шапка на средних экранах: всё в одну строку, длинный подзаголовок обрезается многоточием */
@media (min-width: 641px) {
  .top-in { flex-wrap: nowrap; }
  .brand > div { min-width: 0; }
  .brand b, .brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .var-ctl, .top .icon-btn, .top .btn { flex: none; }
  .var-ctl label { white-space: nowrap; }
}
@media (min-width: 641px) and (max-width: 1023px) { .var-ctl label { display: none; } }

/* ---------- настройки — заметные панели ----------
   Разделы «Методика расчёта», «Отчёт и файлы» и «Сохранения» на вкладке «Исходные данные» (section.dsec.set,
   data-set — подпись справа вверху), переключатель сверки на этапах (.chk-bar) и вкладка «Исходные данные»
   в колонке этапов (значок шестерёнки) выделены одинаково: акцентная кромка слева, лёгкая подложка цвета акцента. */
:root {
  --ico-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  --ico-sliders: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E");
  --ico-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/%3E%3C/svg%3E");
  --ico-save: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpath d='M17 21v-8H7v8M7 3v5h8'/%3E%3C/svg%3E");
  --set-edge: color-mix(in srgb, var(--accent) 32%, var(--line));
  --set-bg: color-mix(in srgb, var(--accent) 6%, var(--sheet));
}
.data-page .dsec.set { margin-top: 20px; padding: 4px 18px 14px; border: 1px solid var(--set-edge); border-left: 4px solid var(--accent); border-radius: calc(var(--r) + 2px); background: var(--set-bg); }
.data-page .dsec.set + .dsec.set { margin-top: 14px; }
.data-page .dsec.set > h2 { flex-wrap: wrap; row-gap: 6px; }
.data-page .dsec.set > h2::before { content: ""; flex: none; width: 20px; height: 20px; background: var(--accent); -webkit-mask: var(--ico-gear) center / contain no-repeat; mask: var(--ico-gear) center / contain no-repeat; }
.data-page .dsec.set-calc > h2::before { -webkit-mask-image: var(--ico-sliders); mask-image: var(--ico-sliders); }
.data-page .dsec.set-rep > h2::before { -webkit-mask-image: var(--ico-doc); mask-image: var(--ico-doc); }
.data-page .dsec.set-saves > h2::before { -webkit-mask-image: var(--ico-save); mask-image: var(--ico-save); }
.data-page .dsec.set { position: relative; }
.data-page .dsec.set[data-set] > h2 { padding-right: 180px; }
.data-page .dsec.set[data-set]::before { content: attr(data-set); position: absolute; z-index: 1; top: 20px; right: 18px; padding: 5px 9px; border: 1px solid var(--set-edge); border-radius: 999px; background: var(--sheet); color: var(--accent); font: 600 10.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .08em; pointer-events: none; }
.data-page .dsec.set .opts, .data-page .dsec.set details.adv { background: var(--sheet); }
.data-page .dsec.set .fld input, .data-page .dsec.set .fld textarea { background: var(--sheet); }
.chk-bar { border-color: var(--set-edge); border-left: 4px solid var(--accent); background: var(--set-bg); }
.chk-bar .opt-t b { display: flex; align-items: center; gap: 8px; }
.chk-bar .opt-t b::before { content: ""; flex: none; width: 16px; height: 16px; background: var(--accent); -webkit-mask: var(--ico-gear) center / contain no-repeat; mask: var(--ico-gear) center / contain no-repeat; }
/* колонка этапов: «Исходные данные» — со значком шестерёнки вместо кружка, разделы-настройки в оглавлении — с ним же */
.rail a[data-tab="data"] .no { font-size: 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rail a[data-tab="data"] .no::before { content: ""; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--ico-gear) center / contain no-repeat; mask: var(--ico-gear) center / contain no-repeat; }
.rail a[data-tab="data"] .t::after { content: "настройки"; display: inline-block; margin-left: 7px; padding: 3px 6px; border: 1px solid var(--set-edge); border-radius: 999px; color: var(--accent); font: 600 9.5px/1 var(--f-body); text-transform: uppercase; letter-spacing: .07em; vertical-align: 2px; }
.rail-toc a.set .tn, .toc-pop a.set .tn { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); }
.rail-toc a.set .tn::after, .toc-pop a.set .tn::after { content: ""; width: 10px; height: 10px; background: currentColor; -webkit-mask: var(--ico-gear) center / contain no-repeat; mask: var(--ico-gear) center / contain no-repeat; }
@media (max-width: 960px) {
  .rail a[data-tab="data"] .no::before { width: 15px; height: 15px; }
}
@media (max-width: 640px) {
  .data-page .dsec.set { padding: 2px 12px 12px; border-left-width: 3px; }
  .data-page .dsec.set[data-set] > h2 { padding-right: 0; }
  .data-page .dsec.set[data-set]::before { position: static; display: inline-block; margin: 12px 0 -4px; }
}

/* превью настроек отчёта: номер формулы, интервал, рамка с основной надписью, шапка таблицы, сверка */
.ex-paper .ex-math .ex-no { float: right; font-style: normal; }
.ex-paper.lh15 p { line-height: 1.85; }
.ex-paper.lh10 p { line-height: 1.2; }
.ex-paper.fs12 { font-size: 11.5px; }
.ex-paper p.where { text-indent: 0; text-align: left; }
.ex-paper p.toc { text-indent: 0; text-align: left; margin: 0; }
.ex-paper p.toc.off { color: #9aa5b1; text-decoration: line-through; }
.ex-paper p.foot { text-indent: 0; text-align: center; font-size: 11px; margin: 8px 0 0; }
.ex-paper.framed { border: 1.5px solid #1b232c; border-radius: 0; margin-left: 12px; padding-bottom: 0; }
.ex-stamp { display: grid; grid-template-columns: 1fr 1fr 3fr 1fr; margin: 8px -14px 0 auto; width: 78%; border-top: 1.5px solid #1b232c; border-left: 1.5px solid #1b232c; font: 10px/1.4 var(--f-body); color: #1b232c; }
.ex-stamp span { padding: 2px 4px; border-right: 1px solid #1b232c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-stamp span:last-child { border-right: 0; }
.ex-paper table.ex-tt { width: 100%; border-collapse: collapse; font-size: 12px; margin: 2px 0 4px; }
.ex-paper table.ex-tt th, .ex-paper table.ex-tt td { border: 1px solid #1b232c; padding: 2px 5px; text-align: center; font-weight: 400; }
.ex-paper table.ex-tt.double thead th { border-bottom: 3px double #1b232c; }
.ex-paper table.ex-tt.thick thead th { border-bottom: 2.5px solid #1b232c; }
.ex-chk { display: flex; align-items: center; gap: 8px; margin-top: 6px; font: 12px/1.3 var(--f-body); color: var(--muted); }
.ex-chk i { font-style: normal; display: inline-block; min-width: 64px; padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--sheet); font-family: var(--f-mono); color: var(--fg); }
.ex-chk b { color: var(--ok, #1f7a3a); font-weight: 600; }
