/* base.css */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
ul[role='list'],
ol[role='list'] {
  list-style: none;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
  line-height: 1.15;
}
p,
li,
figcaption {
  text-wrap: pretty;
  max-width: 72ch;
}

::selection {
  background: oklch(from var(--color-primary) l c h / 0.25);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

button {
  cursor: pointer;
  background: none;
  border: none;
}
table {
  border-collapse: collapse;
  width: 100%;
}

/* Interactive elements: animate hover/focus transitions.
   Only clickable elements get hover states — see `shared/03-motion.md`.
   Never add :hover styles to non-interactive elements. */
a,
button,
[role='button'],
[role='link'],
input,
textarea,
select {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.02rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem; --space-5: 1.25rem;
  --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem; --space-16: 4rem;

  --color-bg: #f5f4ef;
  --color-surface: #fbfaf7;
  --color-surface-2: #ffffff;
  --color-surface-offset: #ebe9e2;
  --color-divider: #e3e1d9;
  --color-border: #d2cfc5;
  --color-text: #1b1f25;
  --color-text-muted: #575c65;
  --color-text-faint: #868a92;
  --color-text-inverse: #ffffff;

  --color-primary: #1d4f91;
  --color-primary-hover: #163f75;
  --color-primary-soft: #e6edf7;
  --color-primary-ink: #173e72;
  --color-zone: rgba(29, 79, 145, 0.16);

  --color-amber: #9a5b00;
  --color-amber-soft: #fbefd8;
  --color-amber-border: #e6c286;

  --color-success: #246b43;
  --color-success-soft: #e2f1e7;
  --color-error: #a5281f;
  --color-error-soft: #f8e4e1;
  --color-steel: #2c3138;

  --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-full: 9999px;
  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(27, 31, 37, 0.06);
  --shadow-md: 0 4px 14px rgba(27, 31, 37, 0.08);
  --shadow-lg: 0 14px 40px rgba(27, 31, 37, 0.16);

  --font-body: 'Golos Text', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Golos Text', 'Segoe UI', Arial, sans-serif;
  --font-math: 'Source Serif 4', 'Times New Roman', Georgia, serif;

  --top-h: 56px;
  color-scheme: light;
}

html { scroll-padding-top: calc(var(--top-h) + var(--space-6)); }
.nw { white-space: nowrap; }
body { font-feature-settings: 'tnum' 0; }
a { color: var(--color-primary); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--color-primary-hover); }
sub, sup { line-height: 0; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--color-surface-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }

/* edition visibility */
body[data-edition='base'] [data-ed='cur'],
body[data-edition='cur'] [data-ed='base'] { display: none !important; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 40; background: rgba(245, 244, 239, 0.97); backdrop-filter: saturate(1.2) blur(8px); -webkit-backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--color-divider); }
.top-in { max-width: 1440px; margin: 0 auto; height: var(--top-h); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-6); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text); text-decoration: none; font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; margin-right: auto; }
.brand:hover { color: var(--color-text); }
.brand-mark { width: 28px; height: 28px; color: var(--color-primary); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-md); color: var(--color-text); }
.icon-btn:hover { background: var(--color-surface-offset); }
.toc-btn { display: none; }

/* segmented control */
.seg { display: inline-flex; background: var(--color-surface-offset); border-radius: var(--radius-md); padding: 3px; gap: 2px; flex-wrap: nowrap; }
.seg button { min-height: 36px; padding: 0 var(--space-3); border-radius: calc(var(--radius-md) - 2px); font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted); white-space: nowrap; }
.seg button:hover { color: var(--color-text); }
.seg button[aria-checked='true'] { background: var(--color-surface-2); color: var(--color-primary-ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg-sm button { min-height: 32px; padding: 0 var(--space-2); font-size: var(--text-xs); }
.seg-col { display: grid; grid-template-columns: 1fr 1fr; }
.ed-switch .sm { display: none; }

/* ---------- layout ---------- */
.layout { max-width: 1440px; margin: 0 auto; padding: 0 var(--space-6); display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px; gap: var(--space-10); align-items: start; }
main { min-width: 0; padding-bottom: var(--space-16); max-width: 820px; }

.toc { position: sticky; top: calc(var(--top-h) + var(--space-6)); max-height: calc(100dvh - var(--top-h) - var(--space-10)); overflow: auto; padding: var(--space-2) 0 var(--space-8); font-size: var(--text-sm); scrollbar-width: thin; }
.toc-head { display: none; }
.toc-list, .toc-list ol { list-style: none; }
.toc-list > li { margin-bottom: var(--space-4); }
.toc-list > li > a { font-weight: 600; color: var(--color-text); }
.toc-list a { display: block; padding: 5px var(--space-2); margin-left: calc(-1 * var(--space-2)); border-radius: var(--radius-sm); color: var(--color-text-muted); text-decoration: none; line-height: 1.35; }
.toc-list a:hover { background: var(--color-surface-offset); color: var(--color-text); }
.toc-list a.on { color: var(--color-primary-ink); background: var(--color-primary-soft); }
.toc-list ol { margin-top: 2px; }
.toc-scrim { position: fixed; inset: 0; background: rgba(20, 24, 30, 0.35); z-index: 44; }

/* ---------- state panel ---------- */
.state { position: sticky; top: calc(var(--top-h) + var(--space-6)); max-height: calc(100dvh - var(--top-h) - var(--space-10)); overflow: auto; padding-top: var(--space-2); scrollbar-width: thin; }
.state-bar { display: none; }
.state-body { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-3); box-shadow: var(--shadow-sm); }
.state-body { grid-template-columns: minmax(0, 1fr); }
.state-body .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.state-body .seg-col { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
.state-body .seg button { white-space: normal; line-height: 1.2; padding: 4px 6px; }
.state-h { font-size: var(--text-sm); text-transform: none; font-weight: 700; letter-spacing: 0; }
.state-note { font-size: var(--text-xs); color: var(--color-amber); }
.state-note:empty { display: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-divider); font-size: var(--text-sm); }
.kv dt { font-family: var(--font-math); font-style: italic; }
.kv dt sub { font-style: normal; }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv dd small { font-weight: 400; color: var(--color-text-muted); }

/* form fields */
.f { display: grid; gap: 4px; font-size: var(--text-sm); }
.fields > .f { grid-template-rows: 1fr auto; align-items: end; }
.f > span { color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 500; }
.f > span small { color: var(--color-text-faint); font-weight: 400; }
.f input, .f select, .bar-in select { width: 100%; min-height: 40px; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); font-variant-numeric: tabular-nums; font-size: var(--text-base); }
.f select, .bar-in select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23575c65' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.f input::placeholder { color: var(--color-text-faint); }
.f input:focus, .f select:focus, .bar-in select:focus { outline: 2px solid var(--color-primary); outline-offset: 0; border-color: var(--color-primary); }
.f input[aria-invalid='true'] { border-color: var(--color-error); background: var(--color-error-soft); }
.chk { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--text-sm); line-height: 1.35; cursor: pointer; min-height: 32px; }
.chk input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--color-primary); flex: none; }
.hint { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.4; }

/* switch */
.sw { position: relative; display: inline-block; width: 46px; height: 28px; cursor: pointer; }
.sw input { position: absolute; opacity: 0; inset: -8px -4px; width: calc(100% + 8px); height: calc(100% + 16px); margin: 0; cursor: pointer; z-index: 1; }
.sw-ui { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--color-border); transition: background var(--transition-interactive); }
.sw-ui::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--transition-interactive); }
.sw input:checked + .sw-ui { background: var(--color-primary); }
.sw input:checked + .sw-ui::after { transform: translateX(18px); }
.sw input:focus-visible + .sw-ui { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------- content ---------- */
.intro { padding: var(--space-10) 0 var(--space-6); }
.kicker { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-primary); margin-bottom: var(--space-3); }
h1 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; max-width: 22ch; }
.lead { margin-top: var(--space-4); font-size: var(--text-base); color: var(--color-text-muted); max-width: 62ch; }
.facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin-top: var(--space-5); font-size: var(--text-sm); }
.facts li { display: grid; gap: 2px; }
.facts-k { font-size: var(--text-xs); color: var(--color-text-faint); }
.facts-v { font-weight: 500; }
.disclaimer { margin-top: var(--space-5); font-size: var(--text-xs); color: var(--color-text-muted); padding: var(--space-3) var(--space-4); background: var(--color-surface-offset); border-radius: var(--radius-md); max-width: 72ch; }

.sec { padding-top: var(--space-10); }
.sec > h2 { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; padding-bottom: var(--space-3); border-bottom: 2px solid var(--color-text); display: flex; gap: var(--space-3); align-items: baseline; }
.sec-no { color: var(--color-primary); font-variant-numeric: tabular-nums; }
.sec-lead { margin-top: var(--space-4); color: var(--color-text-muted); }

.cl { padding: var(--space-6) 0; border-bottom: 1px solid var(--color-divider); }
.cl-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); margin-bottom: var(--space-3); }
.cl-no { font-size: var(--text-sm); font-weight: 600; color: var(--color-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cl-h h3 { font-size: var(--text-base); font-weight: 650; flex: 1 1 auto; min-width: 12ch; }
.pdf { font-size: var(--text-xs); color: var(--color-text-muted); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-divider); }
.pdf::before { content: ''; width: 10px; height: 12px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M1 0h5l4 4v8H0V0h1zm0 1v10h8V5H5V1H1z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M1 0h5l4 4v8H0V0h1zm0 1v10h8V5H5V1H1z'/%3E%3C/svg%3E") center/contain no-repeat; }
.pdf:hover { color: var(--color-primary); border-color: var(--color-primary); }
.pdf-inline { font-size: var(--text-sm); }
.cl-body > * + *, .cl-body [data-ed] > * + * { margin-top: var(--space-3); }
.cl-body p, .cl-body li { line-height: 1.6; }
.dense { padding-left: 1.25em; display: grid; gap: 4px; }
.dense li::marker { color: var(--color-text-faint); }
.note { font-size: var(--text-sm); color: var(--color-text-muted); }
.cap, .cap-top { font-size: var(--text-xs); color: var(--color-text-muted); }
.live { padding: var(--space-2) var(--space-3); background: var(--color-primary-soft); border-radius: var(--radius-md); color: var(--color-primary-ink); font-variant-numeric: tabular-nums; width: fit-content; max-width: 100%; }
blockquote { font-family: var(--font-math); font-size: 1.04em; padding: var(--space-2) var(--space-4); color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); }
.live-flag:empty { display: none; }
.live-flag { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); }
.live-flag.bad { background: var(--color-error-soft); color: var(--color-error); }
.live-flag.good { background: var(--color-success-soft); color: var(--color-success); }

/* amendments */
.chg { display: inline-flex; align-items: center; font-family: var(--font-body); font-style: normal; font-size: 0.72rem; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: var(--radius-full); color: var(--color-amber); background: var(--color-amber-soft); border: 1px solid var(--color-amber-border); vertical-align: 0.12em; white-space: nowrap; }
body[data-edition='base'] .chg:not(.chg-static) { background: transparent; border-style: dashed; }
body[data-edition='base'] .chg:not(.chg-static)::before { content: 'изм. в '; font-weight: 500; }
.ins { background: linear-gradient(transparent 58%, var(--color-amber-soft) 58%); font-style: normal; }

/* formulas */
.eq { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--color-surface-2); border: 1px solid var(--color-divider); border-radius: var(--radius-md); font-family: var(--font-math); font-size: 1.125rem; line-height: 1.5; overflow-x: auto; scrollbar-width: thin; }
.eq-m { white-space: nowrap; }
.eq-n { font-family: var(--font-body); font-size: var(--text-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex: none; }
.eq:has(+ .eq-sub:not(:empty)) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.eq + .eq-sub { margin-top: 0 !important; border-top-left-radius: 0; border-top-right-radius: 0; }
.eq-sub { font-size: var(--text-sm); font-variant-numeric: tabular-nums; padding: var(--space-2) var(--space-4); background: var(--color-primary-soft); color: var(--color-primary-ink); border-radius: var(--radius-md); line-height: 1.55; overflow-x: auto; }
.eq-sub:empty { display: none; }
.m { font-family: var(--font-math); font-style: italic; }
.m sub, .m sup { font-style: normal; }
.eq-sub b { font-weight: 650; }
.eq-sub-strong { background: var(--color-surface-2); border: 1px solid var(--color-primary-soft); color: var(--color-text); }
.eq-sub .tag { font-family: var(--font-body); font-size: var(--text-xs); color: var(--color-text-muted); }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 0.12em; line-height: 1.25; }
.fr > span { padding: 0 0.2em; }
.fr > span:first-child { border-bottom: 1px solid currentColor; }
.fr .fr { font-size: 0.92em; }
.br { font-size: 1.45em; vertical-align: -0.08em; font-style: normal; }

.v { font-family: var(--font-math); font-style: italic; font-size: 1em; line-height: 1.2; color: inherit; padding: 0 1px; border-radius: 3px; border-bottom: 1px dotted rgba(29, 79, 145, 0.55); cursor: pointer; display: inline; vertical-align: baseline; }
.v sub, .v sup { font-style: normal; font-size: 0.68em; }
.v:hover, .v[aria-expanded='true'] { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.eq .v { border-bottom-color: rgba(29, 79, 145, 0.4); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; min-width: 52px; padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-full); font-size: var(--text-sm); font-variant-numeric: tabular-nums; background: var(--color-surface-2); }
.chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.chip[aria-checked='true'] { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 600; }
.chip.low { color: var(--color-text-faint); }
.chip.low[aria-checked='true'] { color: #fff; }

/* γbi */
.gb-list { display: grid; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface-2); }
.gb-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); font-size: var(--text-sm); }
.gb-row:last-child { border-bottom: 0; }
.gb-sym { font-size: 1.05rem; }
.gb-row-muted { color: var(--color-text-muted); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface-2); scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tbl { font-size: var(--text-sm); }
.calc-mini { display: none; }
.tbl-hint { margin-top: 6px !important; font-size: var(--text-xs); color: var(--color-text-faint); }
.tbl th, .tbl td { padding: 7px var(--space-3); text-align: left; border-bottom: 1px solid var(--color-divider); white-space: nowrap; }
.tbl thead th { position: sticky; top: 0; background: var(--color-surface); font-weight: 600; font-size: var(--text-xs); color: var(--color-text-muted); vertical-align: bottom; line-height: 1.3; }
.tbl thead th .src { display: block; font-weight: 400; color: var(--color-text-faint); }
.tbl thead th .vs { font-family: var(--font-math); font-style: italic; font-size: 0.9rem; color: var(--color-text); }
.tbl thead th .vs sub { font-style: normal; }
.tbl tbody tr:last-child td, .tbl tbody tr:last-child th { border-bottom: 0; }
.tbl-num td { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th[scope='row'] { position: sticky; left: 0; background: var(--color-surface-2); font-weight: 600; z-index: 1; }
.tbl thead th:first-child { left: 0; z-index: 2; }
.tbl-pick tbody tr { cursor: pointer; }
.tbl-pick tbody tr:hover td, .tbl-pick tbody tr:hover th { background: var(--color-surface); }
.tbl tr.sel td, .tbl tr.sel th { background: var(--color-primary-soft) !important; color: var(--color-primary-ink); font-weight: 650; }
.tbl tr.hl td, .tbl tr.hl th { background: var(--color-primary-soft); color: var(--color-primary-ink); font-weight: 600; }
.tbl td.na { color: var(--color-text-faint); }
.tbl td.cg { position: relative; }
.tbl td.cg::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-amber); margin-right: 6px; vertical-align: 0.15em; }
.tbl .old { color: var(--color-text-faint); text-decoration: line-through; margin-right: 6px; font-weight: 400; }
.tbl tr.gone th, .tbl tr.gone td { color: var(--color-text-faint); }
.tbl .tag-new { font-size: 0.68rem; font-weight: 600; color: var(--color-amber); background: var(--color-amber-soft); padding: 1px 5px; border-radius: var(--radius-full); margin-left: 6px; }

details.more { border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface); }
details.more > summary { cursor: pointer; padding: var(--space-3) var(--space-4); font-size: var(--text-sm); font-weight: 600; list-style: none; display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--transition-interactive); flex: none; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > :not(summary) { margin: 0 var(--space-4) var(--space-4); }

/* diagrams */
.dg { border: 1px solid var(--color-divider); border-radius: var(--radius-lg); background: var(--color-surface-2); padding: var(--space-4); display: grid; gap: var(--space-3); }
.dg-ctrl { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dg-svg { width: 100%; height: auto; font-family: var(--font-body); }
.dg-svg .ax { stroke: var(--color-text-muted); stroke-width: 1; }
.dg-svg .grid { stroke: var(--color-divider); stroke-width: 1; }
.dg-svg .ln { fill: none; stroke: var(--color-primary); stroke-width: 2.5; stroke-linejoin: round; }
.dg-svg .ln2 { fill: none; stroke: var(--color-text-faint); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dg-svg .guide { stroke: var(--color-text-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.dg-svg text { font-size: 13px; fill: var(--color-text-muted); }
.dg-svg .lbl { font-family: var(--font-math); font-style: italic; font-size: 14px; fill: var(--color-text); }
.dg-svg .val { font-size: 12px; fill: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.dg-svg .pt { fill: var(--color-primary); stroke: #fff; stroke-width: 2; }
.dg-svg .pt-l { stroke: var(--color-primary); stroke-width: 1; stroke-dasharray: 2 3; }
.dg-svg .area { fill: var(--color-zone); }
.slider { display: grid; gap: 4px; font-size: var(--text-sm); }
.slider > span { font-variant-numeric: tabular-nums; }
.slider input { width: 100%; height: 32px; accent-color: var(--color-primary); }
.formulas { display: grid; gap: var(--space-2); }
.formulas[hidden] { display: none; }
.formulas > p { font-size: var(--text-sm); }

/* ---------- calculator ---------- */
.calc-wrap { margin-top: var(--space-8); background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-6); box-shadow: var(--shadow-md); }
.calc-head h3 { font-size: var(--text-lg); font-weight: 700; }
.calc-head p { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }
.calc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-6); margin-top: var(--space-5); align-items: start; }
.calc-in { display: grid; gap: var(--space-4); }
.row2 { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fs { border: 0; display: grid; gap: var(--space-2); min-width: 0; }
.fs legend { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: var(--space-2); padding: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.fields .span2 { grid-column: 1 / -1; }
.fields.bars { grid-template-columns: 1fr; }
.bar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); gap: var(--space-2); align-items: center; }
.bar-in > span { color: var(--color-text-muted); }
.calc-wrap[data-shape='rect'] .tee-only { display: none; }
.calc-wrap[data-mode='design'] .check-only { display: none; }
.calc-wrap[data-mat='sp'] .mat-manual { display: none; }
.calc-wrap[data-mat='manual'] .mat-sp { display: none; }
.calc-wrap[data-fl='cant'] .slab-only { display: none; }
.mat-line { font-size: var(--text-sm); font-variant-numeric: tabular-nums; padding: var(--space-2) var(--space-3); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); }
.mat-sp, .mat-manual { margin-top: var(--space-2); }
.mat-sp { display: grid; gap: var(--space-2); }
.calc-src { font-size: var(--text-xs); color: var(--color-amber); }
.calc-src:empty { display: none; }

.calc-out { display: grid; gap: var(--space-4); position: sticky; top: calc(var(--top-h) + var(--space-4)); }
.res { border-radius: var(--radius-lg); padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-divider); display: grid; gap: var(--space-2); }
.res-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.res-k { font-size: var(--text-xs); color: var(--color-text-muted); }
.res-v { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.res-v small { font-size: 0.9rem; font-weight: 500; color: var(--color-text-muted); }
.res-sub { font-size: var(--text-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; padding: 4px 10px; border-radius: var(--radius-full); white-space: nowrap; }
.pill.ok { background: var(--color-success-soft); color: var(--color-success); }
.pill.bad { background: var(--color-error-soft); color: var(--color-error); }
.pill.warn { background: var(--color-amber-soft); color: var(--color-amber); }
.pill.info { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.res-bar { height: 8px; border-radius: var(--radius-full); background: var(--color-surface-offset); overflow: hidden; }
.res-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--color-success); }
.res-bar.bad > i { background: var(--color-error); }
.res-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; background: var(--color-primary); color: #fff; text-decoration: none; }
.btn:hover { background: var(--color-primary-hover); color: #fff; }
.btn-ghost { background: var(--color-surface-2); color: var(--color-primary-ink); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.warns { display: grid; gap: 6px; font-size: var(--text-sm); }
.warns p { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-amber-soft); color: #6d4100; }

.gauge { display: grid; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.gauge-track { position: relative; height: 28px; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--color-success-soft) 0 var(--r), var(--color-error-soft) var(--r) 100%); border: 1px solid var(--color-divider); }
.gauge-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--color-text); }
.gauge-r { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--color-error); }
.gauge-lbls { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.gauge-lbls b { color: var(--color-text); }

.sec-svg { border: 1px solid var(--color-divider); border-radius: var(--radius-lg); background: var(--color-surface); padding: var(--space-2); }
.calc-svg { width: 100%; height: auto; font-family: var(--font-body); }
.calc-svg text { font-size: 12px; fill: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.calc-svg .sym { font-family: var(--font-math); font-style: italic; font-size: 13px; fill: var(--color-text); }
.calc-svg .conc { fill: #e9e6dc; stroke: var(--color-steel); stroke-width: 1.4; }
.calc-svg .zone { fill: url(#hatch); }
.calc-svg .na { stroke: var(--color-primary); stroke-width: 1.4; stroke-dasharray: 6 4; }
.calc-svg .bar { fill: var(--color-steel); }
.calc-svg .bar2 { fill: #fff; stroke: var(--color-steel); stroke-width: 1.6; }
.calc-svg .dim { stroke: var(--color-text-muted); stroke-width: 1; }
.calc-svg .stress { fill: var(--color-zone); stroke: var(--color-primary); stroke-width: 1.2; }
.calc-svg .force { stroke: var(--color-primary-ink); stroke-width: 2; marker-end: url(#arr); }
.calc-svg .force-t { stroke: var(--color-steel); stroke-width: 2; marker-end: url(#arr2); }

.steps-wrap { margin-top: var(--space-6); border-top: 1px solid var(--color-divider); padding-top: var(--space-5); }
.steps-wrap h4 { font-size: var(--text-base); font-weight: 700; margin-bottom: var(--space-3); }
.steps { list-style: none; counter-reset: st; display: grid; gap: var(--space-3); }
.steps > li { counter-increment: st; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); }
.steps > li::before { content: counter(st); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: var(--text-xs); font-weight: 700; background: var(--color-surface-offset); color: var(--color-text-muted); }
.steps > li.st-bad::before { background: var(--color-error-soft); color: var(--color-error); }
.steps > li.st-ok::before { background: var(--color-success-soft); color: var(--color-success); }
.st-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-2); font-size: var(--text-sm); font-weight: 600; padding-top: 4px; }
.st-ref { font-weight: 500; font-size: var(--text-xs); color: var(--color-primary); text-decoration: none; padding: 1px 6px; border: 1px solid var(--color-primary-soft); border-radius: var(--radius-full); }
.st-b { margin-top: 6px; font-family: var(--font-math); font-size: 1.02rem; line-height: 1.7; background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); overflow-x: auto; scrollbar-width: thin; }
.st-b .ln-s { display: block; white-space: nowrap; }
.st-b .num { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 0.94em; }
.st-b .res-n { font-family: var(--font-body); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.94em; }
.st-t { margin-top: 4px; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---------- examples ---------- */
.ex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.ex { border: 1px solid var(--color-divider); border-radius: var(--radius-lg); background: var(--color-surface-2); padding: var(--space-4); display: grid; gap: var(--space-3); align-content: start; }
.ex-h { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.ex-no { font-size: var(--text-xs); font-weight: 700; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.05em; }
.ex h3 { font-size: var(--text-sm); font-weight: 650; line-height: 1.35; }
.ex-in { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.ex-tbl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--space-3); font-size: var(--text-sm); font-variant-numeric: tabular-nums; padding: var(--space-3) 0; border-block: 1px solid var(--color-divider); }
.ex-tbl dt { color: var(--color-text-muted); }
.ex-tbl dd { text-align: right; font-weight: 600; }
.ex-tbl dd.d { font-weight: 500; }
.ex-note { font-size: var(--text-xs); color: #6d4100; background: var(--color-amber-soft); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); line-height: 1.5; }
.ex .btn { justify-self: start; }

/* changes */
.chg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--space-4); margin-top: var(--space-5); }
.chg-card { border: 1px solid var(--color-divider); border-radius: var(--radius-lg); background: var(--color-surface-2); padding: var(--space-4); display: grid; gap: var(--space-3); align-content: start; }
.chg-card h3 { font-size: var(--text-sm); font-weight: 650; display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.chg-card .dense { font-size: var(--text-sm); }
.chg-links { font-size: var(--text-xs); }
#s-chg > .note { margin-top: var(--space-4); }

.foot { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--color-divider); font-size: var(--text-xs); color: var(--color-text-muted); display: grid; gap: var(--space-2); }
.foot-brand { font-weight: 600; }

/* popover */
.pop { position: absolute; z-index: 60; width: min(340px, calc(100vw - 24px)); background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-4); padding-right: var(--space-10); font-size: var(--text-sm); }
.pop[hidden] { display: none; }
.pop-x { position: absolute; top: 6px; right: 6px; }
.pop-sym { font-family: var(--font-math); font-style: italic; font-size: 1.35rem; line-height: 1.1; }
.pop-sym sub { font-style: normal; }
.pop-name { font-weight: 600; margin-top: 4px; line-height: 1.35; }
.pop-val { margin-top: var(--space-3); font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pop-val small { font-weight: 500; color: var(--color-text-muted); font-size: var(--text-sm); }
.pop-src { margin-top: var(--space-2); color: var(--color-text-muted); line-height: 1.45; }
.pop-src a { font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr) 260px; gap: var(--space-6); }
}
@media (max-width: 1080px) {
  html { scroll-padding-top: calc(var(--top-h) + 44px + var(--space-4)); }
  a.pdf { min-height: 36px; display: inline-flex; align-items: center; }
  .toc-btn { display: inline-grid; margin-left: calc(-1 * var(--space-2)); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  main { max-width: none; grid-row: 2; }
  .toc { position: fixed; z-index: 45; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); max-height: none; background: var(--color-surface-2); padding: 0 var(--space-5) var(--space-8); transform: translateX(-105%); transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1); box-shadow: var(--shadow-lg); visibility: hidden; }
  .toc[data-open] { transform: none; visibility: visible; }
  .toc-head { display: flex; align-items: center; justify-content: space-between; height: var(--top-h); font-weight: 700; position: sticky; top: 0; background: var(--color-surface-2); margin-bottom: var(--space-2); }
  .toc-list a { padding: 9px var(--space-2); }
  .state { grid-row: 1; position: sticky; top: var(--top-h); z-index: 30; max-height: none; overflow: visible; padding: 0; margin: 0 calc(-1 * var(--space-6)); background: var(--color-bg); border-bottom: 1px solid var(--color-divider); }
  .state-bar { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-6); font-size: var(--text-sm); text-align: left; }
  .state-sum { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .state-sum .s-dim { font-weight: 400; color: var(--color-text-muted); }
  .state-edit { color: var(--color-primary); font-weight: 600; flex: none; display: inline-flex; align-items: center; gap: 6px; }
  .state-edit::after { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--transition-interactive); }
  .state[data-open] .state-edit::after { transform: rotate(-135deg) translateY(-2px); }
  .state-body { display: none; position: absolute; left: var(--space-3); right: var(--space-3); top: calc(100% + 6px); max-height: calc(100dvh - var(--top-h) - 70px); overflow: auto; box-shadow: var(--shadow-lg); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .state-body .seg-col { grid-auto-flow: column; grid-template-columns: none; }
  .state[data-open] .state-body { display: grid; }
  .state-h { display: none; }
  .state-body .kv, .state-body .chk, .state-body .state-note, .state-body .f-wide { grid-column: 1 / -1; }
  .kv { grid-template-columns: auto 1fr auto 1fr; }
}
@media (max-width: 760px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-mini { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 5; margin-top: var(--space-4); padding: 10px var(--space-4); min-height: 44px; background: var(--color-primary-ink); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); text-decoration: none; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
  .calc-mini b { font-weight: 700; }
  .calc-mini .ok { color: #bfe8c9; font-weight: 600; }
  .calc-mini .bad { color: #ffc9c2; font-weight: 600; }
  .calc-mini .go { margin-left: auto; opacity: 0.8; font-size: var(--text-xs); }
  .calc-out { position: static; }
}
@media (max-width: 640px) {
  :root { --top-h: 52px; }
  .top-in { padding: 0 var(--space-4); gap: var(--space-2); }
  .layout { padding: 0 var(--space-4); }
  .state { margin: 0 calc(-1 * var(--space-4)); }
  .state-bar { padding: 0 var(--space-4); }
  .ed-switch .lg { display: none; }
  .ed-switch .sm { display: inline; }
  .seg button { min-height: 40px; }
  .seg-sm button { min-height: 36px; }
  .intro { padding-top: var(--space-6); }
  .cl { padding: var(--space-5) 0; }
  .eq { font-size: 1.02rem; padding: var(--space-3); }
  .eq-sub { padding: var(--space-2) var(--space-3); }
  .gb-row { grid-template-columns: 52px minmax(0, 1fr) auto; padding: var(--space-3); }
  .calc-wrap { padding: var(--space-4); margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); border-radius: var(--radius-lg); }
  .f input, .f select, .bar-in select { min-height: 44px; font-size: 16px; }
  .chip { min-height: 40px; }
  .dg { padding: var(--space-3); }
  .pop { position: fixed; left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 60dvh; overflow: auto; }
  .state-body { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: auto 1fr auto 1fr; font-size: var(--text-xs); }
  .row2 .seg { flex: 1 1 100%; }
  .row2 .seg button { flex: 1; }
  .steps > li { grid-template-columns: 24px minmax(0, 1fr); gap: var(--space-2); }
  .st-b .ln-s { white-space: normal; }
  .eq { flex-direction: column; align-items: stretch; gap: 2px; font-size: 1.05rem; padding: var(--space-2) var(--space-3) var(--space-3); }
  .eq-n { order: -1; align-self: flex-end; font-size: var(--text-xs); }
  .eq-m { white-space: normal; }
  .steps > li::before { width: 24px; height: 24px; }
  .st-b { font-size: 0.95rem; }
}
@media (pointer: coarse) {
  .v { padding: 2px 2px; }
}
@media print {
  .top, .toc, .state, .pop { display: none !important; }
  .layout { display: block; }
}

/* ===== Живой СП 63: документ ===== */
@font-face { font-family: 'Golos Text'; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url('fonts/golos-text-cyrillic-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url('fonts/golos-text-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url('fonts/source-serif-4-cyrillic-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url('fonts/source-serif-4-latin-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900;
  src: url('fonts/source-serif-4-cyrillic-opsz-italic.woff2') format('woff2-variations');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-display: swap; font-weight: 200 900;
  src: url('fonts/source-serif-4-latin-opsz-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* шапка */
.brand { margin-right: 0; }
.brand-hd { margin-right: auto; font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); text-decoration: none; padding: 4px 8px; border: 1px solid var(--color-divider); border-radius: var(--radius-full); }
.brand-hd:hover { color: var(--color-primary); border-color: var(--color-primary); }
.search-btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-sm); min-width: 200px; }
.search-btn:hover { border-color: var(--color-primary); color: var(--color-text); }
.search-btn .lb { margin-right: auto; }
.search-btn kbd { font-family: inherit; font-size: 0.72rem; border: 1px solid var(--color-border); border-radius: 4px; padding: 0 5px; color: var(--color-text-faint); }
.search-btn .ic { display: inline-grid; }

/* раскладка: без правой панели на обложке */
.layout { grid-template-columns: 240px minmax(0, 1fr) 270px; }
body[data-kind='cover'] .layout { grid-template-columns: 240px minmax(0, 1fr) 270px; }
main.doc { max-width: 780px; padding-top: var(--space-6); }
.toc-home { display: block; font-weight: 600; color: var(--color-text); text-decoration: none; padding: 5px var(--space-2); margin: 0 0 var(--space-3) calc(-1 * var(--space-2)); border-radius: var(--radius-sm); }
.toc-home:hover { background: var(--color-surface-offset); }
.toc-g { display: block; font-size: var(--text-xs); font-weight: 700; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0 2px; }
.toc-list > li { margin-bottom: var(--space-4); }
.toc-list > li > ol > li > a { color: var(--color-text); }
.toc-sub { margin: 2px 0 6px var(--space-3) !important; border-left: 1px solid var(--color-divider); padding-left: var(--space-2); }
.toc-sub a { font-size: var(--text-xs); padding: 4px var(--space-2) !important; }
.toc-sub a.h3 { font-weight: 600; color: var(--color-text); }
.toc-sub a.cur { color: var(--color-primary-ink); background: var(--color-primary-soft); }

.crumbs { display: flex; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: var(--space-4); }
.crumbs a { color: var(--color-text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--color-primary); }

/* текст норм */
.unit { font-size: var(--text-base); line-height: 1.62; }
.unit > * + * { margin-top: var(--space-3); }
.unit h2 { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; margin-top: var(--space-10); padding-bottom: var(--space-3); border-bottom: 2px solid var(--color-text); }
.unit > h2:first-child { margin-top: 0; }
.unit h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.35; margin-top: var(--space-8); }
.unit h2 + h3 { margin-top: var(--space-5); }
.unit h4 { font-size: var(--text-base); font-weight: 700; line-height: 1.4; margin-top: var(--space-8); color: var(--color-text); }
.unit h5 { font-size: var(--text-base); font-weight: 500; font-style: italic; margin-top: var(--space-6); color: var(--color-text-muted); }
.unit .hn { color: var(--color-primary); font-variant-numeric: tabular-nums; margin-right: 0.35em; }
.unit p { text-wrap: pretty; }
.unit p.cl { margin-top: var(--space-5); position: relative; }
.unit .cn { font-weight: 700; color: var(--color-primary); font-variant-numeric: tabular-nums; margin-right: 0.15em; text-decoration: none; }
a.cn:hover { text-decoration: underline; }
.unit p.li { padding-left: 1.4em; position: relative; margin-top: var(--space-2); }
.unit p.li::before { content: '–'; position: absolute; left: 0.35em; color: var(--color-text-muted); }
.unit p.li-a { padding-left: 1.4em; text-indent: -1.4em; margin-top: var(--space-2); }
.unit p.def { padding-left: 2.2em; text-indent: -2.2em; margin-top: var(--space-1); }
.unit p.def + p.def { margin-top: 2px; }
.unit .small, .unit p.note { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.unit .small + .small { margin-top: var(--space-1); }
.unit .ld { display: inline-block; min-width: 2em; flex: 1; border-bottom: 1.5px dotted var(--color-text-faint); margin: 0 0.4em; vertical-align: 0.28em; width: 3em; }
.unit sub, .unit sup { font-size: 0.72em; }

/* формулы */
.unit .eq { margin-top: var(--space-3); font-family: inherit; font-size: inherit; }
.unit .eq + .eq { margin-top: var(--space-2); }
.unit .eq-m { white-space: normal; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; flex: 1 1 auto; }
.unit .eq .katex-display { margin: 0; text-align: left; }
.unit .eq .katex-display > .katex { text-align: left; }
.unit .eq .katex { font-size: 1.12em; }
.unit .mi .katex { font-size: 1.06em; }
.unit .eq-n { cursor: pointer; }
.katex .enclosing, .katex [data-v] { cursor: pointer; }
.katex [data-v] { border-radius: 3px; transition: background var(--transition-interactive); }
.katex [data-v]:hover, .katex [data-v].hv { background: var(--color-primary-soft); color: var(--color-primary-ink); box-shadow: 0 0 0 2px var(--color-primary-soft); }
.tex-err { font-family: monospace; font-size: 0.85em; color: var(--color-error); background: var(--color-error-soft); padding: 0 4px; border-radius: 3px; }

/* ссылки между пунктами */
a.xr { text-decoration: underline dotted 1px; text-underline-offset: 0.2em; color: var(--color-primary-ink); }
a.xr:hover { text-decoration-style: solid; }

/* рисунки */
.unit figure.fig { margin-top: var(--space-5); background: var(--color-surface-2); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-3); }
.fig-img { display: grid; justify-items: center; gap: var(--space-2); }
.fig-img img { max-width: 100%; height: auto; mix-blend-mode: multiply; }
.fig-legend { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.fig-legend p + p { margin-top: 2px; }
.unit figure figcaption { font-size: var(--text-sm); font-weight: 600; line-height: 1.4; text-align: center; text-wrap: balance; }
.lbl { color: var(--color-primary-ink); font-weight: 700; margin-right: 0.3em; }
.fig-zoom { justify-self: end; font-size: var(--text-xs); }

/* поясняющие схемы (новые) */
.ex-fig { margin-top: var(--space-5); background: var(--color-primary-soft); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-3); }
.ex-fig .ex-k { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-primary); }
.ex-fig svg { width: 100%; height: auto; background: var(--color-surface-2); border-radius: var(--radius-md); }
.ex-fig figcaption, .ex-fig p { font-size: var(--text-sm); color: var(--color-primary-ink); line-height: 1.5; text-align: left !important; font-weight: 400 !important; }

/* таблицы */
.unit figure.tab { margin-top: var(--space-5); display: grid; gap: var(--space-2); }
.unit figure.tab figcaption { text-align: right; font-weight: 400; }
.tab-wrap { overflow-x: auto; border-radius: var(--radius-md); background: var(--color-surface-2); scrollbar-width: thin; -webkit-overflow-scrolling: touch; border: 1px solid var(--color-border); }
.unit table.tbl { border-collapse: collapse; width: 100%; font-size: var(--text-sm); line-height: 1.4; }
.unit table.tbl td, .unit table.tbl th { border: 1px solid var(--color-divider); padding: 6px 9px; vertical-align: top; white-space: normal; text-align: left; min-width: 3.5em; }
.unit table.tbl tr:first-child td, .unit table.tbl thead th { background: var(--color-surface); font-weight: 600; font-size: var(--text-xs); color: var(--color-text-muted); vertical-align: middle; text-align: center; }
.unit table.tbl.plain tr:first-child td { background: none; font-weight: 400; font-size: inherit; color: inherit; text-align: left; vertical-align: top; }
.unit table.tbl td.c { text-align: center; }
.unit table.tbl td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit table.tbl tr > :first-child { border-left: 0; }
.unit table.tbl tr > :last-child { border-right: 0; }
.unit table.tbl tr:first-child > * { border-top: 0; }
.unit table.tbl tr:last-child > * { border-bottom: 0; }
.unit table.tbl tr.hl td { background: var(--color-primary-soft); color: var(--color-primary-ink); font-weight: 600; }
.unit table.tbl td.hl { background: var(--color-primary-soft); color: var(--color-primary-ink); font-weight: 700; box-shadow: inset 0 0 0 2px var(--color-primary); }
.tab-note { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }

/* изменения */
.chg { cursor: help; }
ins.ed, .ed-ins { text-decoration: none; background: linear-gradient(transparent 60%, var(--color-amber-soft) 60%); }
.ed-block { border-radius: var(--radius-md); background: linear-gradient(90deg, var(--color-amber-soft), transparent 70%); padding: var(--space-2) var(--space-3); margin-left: calc(-1 * var(--space-3)); margin-right: calc(-1 * var(--space-3)); }
.ed-block > * + * { margin-top: var(--space-3); }

/* навигация вперёд/назад */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-12); }
.pn a { display: grid; gap: 2px; padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-2); text-decoration: none; color: var(--color-text); font-weight: 600; font-size: var(--text-sm); line-height: 1.35; }
.pn a span { font-size: var(--text-xs); font-weight: 500; color: var(--color-text-faint); }
.pn a:hover { border-color: var(--color-primary); color: var(--color-primary-ink); }
.pn-next { text-align: right; }
.doc-foot { margin-top: var(--space-10); padding-top: var(--space-5); border-top: 1px solid var(--color-divider); font-size: var(--text-xs); color: var(--color-text-muted); display: grid; gap: var(--space-2); }

/* предпросмотр ссылки / переменной */
.pop { width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow: auto; }
.pop-h { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); }
.pop-b { font-size: var(--text-sm); line-height: 1.55; }
.pop-b > * + * { margin-top: var(--space-2); }
.pop-b .katex-display { margin: var(--space-2) 0; overflow-x: auto; overflow-y: hidden; }
.pop-go { display: inline-flex; margin-top: var(--space-3); font-weight: 600; font-size: var(--text-sm); }
.pop-sym .katex { font-size: 1.3em; }
.pop-uses { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); }

/* поиск */
.sd { position: fixed; inset: 0; z-index: 80; display: grid; align-items: start; justify-items: center; padding: 10vh var(--space-4) var(--space-4); background: rgba(20, 24, 30, 0.38); }
.sd[hidden] { display: none; }
.sd-box { width: min(720px, 100%); max-height: 78vh; display: grid; grid-template-rows: auto 1fr; background: var(--color-surface-2); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.sd-in { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-divider); }
.sd-in input { flex: 1; min-height: 48px; border: 0; background: none; font-size: 1.0625rem; padding: 0 var(--space-2); }
.sd-in input:focus { outline: none; }
.sd-res { overflow: auto; padding: var(--space-2); }
.sd-res a { display: grid; gap: 2px; padding: var(--space-3); border-radius: var(--radius-md); text-decoration: none; color: var(--color-text); }
.sd-res a:hover, .sd-res a.on { background: var(--color-primary-soft); }
.sd-res .sd-u { font-size: var(--text-xs); color: var(--color-text-faint); }
.sd-res .sd-t { font-size: var(--text-sm); line-height: 1.45; }
.sd-res mark { background: var(--color-amber-soft); color: inherit; border-radius: 2px; }
.sd-empty { padding: var(--space-6); text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); }
.sd-tips { padding: var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted); display: grid; gap: var(--space-2); }
.sd-tips button { color: var(--color-primary); text-decoration: underline; text-underline-offset: 0.18em; }

/* обложка */
.cover { display: grid; gap: var(--space-4); }
.cover > h2 { margin-top: var(--space-8); }
.cover-k { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-primary); }
.cover h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); line-height: 1.05; max-width: 16ch; margin: 0; }
.cover .lead { font-size: var(--text-lg); line-height: 1.5; max-width: 60ch; color: var(--color-text); margin: 0; }
.cover-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.cover-cta .btn { min-height: 48px; padding: 0 var(--space-5); font-size: var(--text-base); }
.cover-demo { margin: var(--space-4) 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); }
.cd-eq { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--color-surface-2, #fff); border: 1px solid var(--color-divider); border-radius: var(--radius-md); font-size: 1.05rem; overflow-x: auto; }
.cd-eq .katex-display { margin: 0; }
.cd-no { font-family: var(--font-math); color: var(--color-text-muted); white-space: nowrap; }
.cd-n { display: none; }
.cd-pop { position: relative; max-width: 400px; margin-left: clamp(0px, 6%, 60px); background: var(--color-surface-2, #fff); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md, 0 6px 20px rgba(20, 30, 50, .08)); padding: var(--space-4); font-size: var(--text-sm); display: grid; gap: var(--space-2); }
.cd-pop::before { content: ''; position: absolute; left: 40px; top: -7px; width: 12px; height: 12px; background: inherit; border-left: 1px solid var(--color-border); border-top: 1px solid var(--color-border); transform: rotate(45deg); }
.cd-pop p { margin: 0; }
.cd-s { font-weight: 600; }
.cd-v { font-family: var(--font-math); font-size: 1.15rem; color: var(--color-primary-ink); font-weight: 600; }
.cd-src { color: var(--color-text-muted); font-size: var(--text-xs); }
.cover-demo figcaption { grid-column: 1 / -1; font-size: var(--text-sm); color: var(--color-text-muted); }
.cover-feat { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.cover-feat li { padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); display: grid; gap: 4px; align-content: start; }
.cover-feat b { font-size: var(--text-base); }
.cover-feat span { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.cover-calcs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.cover-calcs a { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: 2px; padding: var(--space-3) var(--space-4); min-height: 44px; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); text-decoration: none; transition: border-color .15s, background .15s; }
.cover-calcs a:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.cc-n { grid-row: span 2; align-self: start; font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); background: var(--color-primary-soft); border-radius: var(--radius-full); padding: 3px 8px; white-space: nowrap; margin-top: 2px; }
.cc-t { font-weight: 600; }
.cc-d { font-size: var(--text-xs); color: var(--color-text-muted); }
.cover-how { margin: 0; padding-left: 1.4em; display: grid; gap: var(--space-2); max-width: 66ch; }
.cover-about { display: grid; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); max-width: 72ch; }
.cover-about p { margin: 0; }
.cover-list { list-style: none; padding: 0; columns: 2 280px; column-gap: var(--space-6); margin: 0; }
.cover-list li { break-inside: avoid; padding: 0; }
.cover-list a { display: block; padding: 8px 0; min-height: 44px; box-sizing: border-box; text-decoration: none; color: var(--color-text); border-bottom: 1px solid var(--color-divider); }
.cover-list a:hover { color: var(--color-primary); }
@media (max-width: 720px) {
  .cover-demo { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); }
  .cd-w { display: none; } .cd-n { display: block; }
  .cd-eq { font-size: 0.98rem; padding: var(--space-3); align-items: flex-start; }
  .cover-feat, .cover-calcs { grid-template-columns: minmax(0, 1fr); }
  .cover-cta .btn { flex: 1 1 100%; }
}

/* адаптив */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr) 250px; gap: var(--space-6); }
  .search-btn { min-width: 0; }
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  body[data-kind='cover'] .layout { grid-template-columns: minmax(0, 1fr); }
  main.doc { max-width: none; padding-top: var(--space-4); }
  .brand-hd { display: none; }
  .brand { margin-right: auto; }
}
@media (max-width: 640px) {
  .search-btn { min-width: 0; padding: 0; width: 40px; justify-content: center; border: 0; background: none; }
  .search-btn .lb, .search-btn kbd { display: none; }
  .unit { font-size: 1rem; line-height: 1.6; }
  .unit h2 { font-size: 1.125rem; margin-top: var(--space-8); }
  .unit h3 { font-size: 1.0625rem; }
  .unit p.def { padding-left: 1.2em; text-indent: -1.2em; }
  .unit figure.fig { padding: var(--space-3); margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
  .unit .eq { margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
  .unit .eq .katex { font-size: 1.02em; }
  .tab-wrap { margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
  .pn { grid-template-columns: 1fr; }
  .pn-next { text-align: left; }
  .sd { padding: 0; align-items: stretch; }
  .sd-box { max-height: none; height: 100dvh; border-radius: 0; width: 100%; }
}
.unit p.cl { padding: 0; border-bottom: 0; }

/* ===== Живой СП 63: интерактивные элементы ===== */

/* редакции */
.ins-p, .ins-block { background: linear-gradient(90deg, var(--color-amber-soft), transparent 80%); border-radius: var(--radius-sm); padding: 2px var(--space-2); margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
.ins-block > * + * { margin-top: var(--space-3); }
.ins-block .ins-p, .ins-block .ins { background: none; padding: 0; margin: 0; }
.ins-block > p.cl { margin-top: var(--space-3); }
.ins-block > p.cl:first-child { margin-top: 0; }
body[data-edition='base'] .ins-p, body[data-edition='base'] .ins-block, body[data-edition='base'] .ins { background: none; }
body[data-edition='base'] .chg:not(.chg-static)::before { content: 'изменено в '; }
.chg { cursor: pointer; margin-left: 0.35em; }
.chg + .chg { margin-left: 0.25em; }
.chg:hover { border-color: var(--color-amber); }
.unit p.ed-note { font-size: var(--text-xs); color: var(--color-amber); line-height: 1.45; }
body[data-edition='base'] .unit p.ed-note { display: none; }
.unit p.li2 { padding-left: 2.6em; text-indent: -1.2em; margin-top: var(--space-1); }
.unit p.li.lt { padding-left: 1.4em; text-indent: -1.4em; }
.unit p.li.lt::before { content: none; }

/* таблицы */
.unit p.tnote, .unit .tab-notes p { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; margin-top: var(--space-1); }
.tab-wrap { position: relative; }
.tab-wrap.scrollable { background: linear-gradient(to right, var(--color-surface-2) 30%, rgba(255, 255, 255, 0)), linear-gradient(to left, var(--color-surface-2) 30%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), transparent), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), transparent) 100% 0; background-repeat: no-repeat; background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; background-color: var(--color-surface-2); }
.unit table.tbl td.hl, .unit table.tbl tr.hl td { transition: background 200ms ease; }

/* подсветка места перехода */
@keyframes sp-flash { 0% { background-color: var(--color-amber-soft); } 100% { background-color: transparent; } }
.unit .flash { animation: sp-flash 2.2s ease-out; border-radius: var(--radius-sm); }
.state.flash .state-body { box-shadow: 0 0 0 3px var(--color-primary-soft), var(--shadow-sm); }
.unit .cn { cursor: pointer; }
.unit .cn:hover { text-decoration: underline; }

/* карточка-подсказка */
.pop { width: min(400px, calc(100vw - 24px)); max-height: min(72vh, 560px); overflow: auto; overscroll-behavior: contain; line-height: 1.5; }
.pop.wide { width: min(620px, calc(100vw - 24px)); }
.pop-h { padding-right: var(--space-4); }
.pop-sym { margin: 2px 0 var(--space-2); font-style: normal; }
.pop-sym .katex { font-size: 1.45em; }
.pop-b p { margin: 0; }
.pop-b p + p { margin-top: var(--space-2); }
.pop-b .pop-ctx { color: var(--color-text-muted); font-size: var(--text-xs); }
.pop-eq { margin-top: var(--space-3); padding: var(--space-3); background: var(--color-surface); border-radius: var(--radius-md); display: grid; gap: var(--space-1); overflow-x: auto; }
.pop-eq .katex-display { margin: 0; text-align: left; }
.pop-eq .katex-display > .katex { text-align: left; }
.pop-eqn { font-size: var(--text-xs); color: var(--color-text-faint); justify-self: end; }
.pop-val { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-primary-soft); color: var(--color-primary-ink); display: grid; gap: 2px; font-size: var(--text-sm); font-weight: 400; }
.pv-k { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.8; }
.pv-v { font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pv-v .katex { font-size: 1em; }
.pv-d { font-size: var(--text-xs); }
.pv-edit { justify-self: start; margin-top: var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); text-decoration: underline; text-underline-offset: 0.18em; min-height: 32px; }
.pop .pv-edit { display: inline-flex; align-items: center; }
.pop-note { font-size: var(--text-xs); color: var(--color-text-muted); }
.pop-prev { font-size: var(--text-sm); line-height: 1.55; }
.pop-prev > * + * { margin-top: var(--space-2); }
.pop-prev p.cl { margin-top: 0; }
.pop-prev .eq { margin: var(--space-2) 0 0; }
.pop-prev .eq .katex { font-size: 1em; }
.pop-prev figure.fig, .pop-prev figure.tab { margin-top: var(--space-2); padding: var(--space-2); }
.pop-prev .fig-img img { max-height: 320px; width: auto; }
.pop-prev .chg { pointer-events: none; }
.pop-cmp { margin-top: var(--space-3); border-top: 1px solid var(--color-divider); padding-top: var(--space-2); }
.pop-cmp summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--color-primary); min-height: 36px; display: flex; align-items: center; }
.pop-cmp .pop-prev { margin-top: var(--space-2); padding: var(--space-3); background: var(--color-surface); border-radius: var(--radius-md); }
.pop-cmp .pop-prev [data-ed] { display: revert !important; }
.pop-cmp .pop-prev .ins-p, .pop-cmp .pop-prev .ins-block { background: none; margin: 0; padding: 0; }
.pop-go { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; }
.pop-go:hover { text-decoration: underline; }

/* уведомление */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--color-text); color: var(--color-bg); padding: 10px 16px; border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-lg); transition: opacity 180ms ease, transform 180ms ease; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* поиск */
.sd-res .sd-direct .sd-t b { color: var(--color-primary-ink); }
.sd-res .sd-t { overflow-wrap: anywhere; }
body.sd-open { overflow: hidden; }

/* кнопка исходных данных (планшет и телефон) */
.state-open-btn { display: none; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); border: 1px solid var(--color-border); font-size: var(--text-sm); font-weight: 600; color: var(--color-primary-ink); white-space: nowrap; }
.state-open-btn:hover { border-color: var(--color-primary); }
.state-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.state-x { display: none; }
.state-body .hint { margin-top: -6px; }

/* увеличение рисунков */
.unit figure.fig .fig-img img { cursor: zoom-in; }
.zm { position: fixed; inset: 0; z-index: 95; background: #f5f4ef; display: grid; grid-template-rows: auto 1fr; }
.zm-top { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-divider); font-size: var(--text-sm); font-weight: 600; }
.zm-top span { flex: 1; min-width: 0; }
.zm-body { overflow: auto; display: grid; place-items: center; padding: var(--space-4); -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.zm-svg { place-items: start; }
.zm-svg .xsvg { width: min(100%, 1100px); min-width: 640px; margin: auto; cursor: default; }
@media (hover: none) { .xfig-k::after { content: ' · нажмите на схему, чтобы увеличить'; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--color-text-muted); } }
.xfig .xsvg { cursor: zoom-in; }
.zm-body img { max-width: none; width: auto; min-width: min(100%, 900px); height: auto; mix-blend-mode: multiply; }
body.zm-open { overflow: hidden; }

/* калькуляторы на страницах */
.calc-mount { margin-top: var(--space-6); }
.calc-mount:empty { display: none; }
.calc-mount .calc-wrap { margin-top: 0; }
.calc-k { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-primary); }
.calc-wrap .calc-head h3 { margin-top: var(--space-1); }
.calc-note { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; margin-top: var(--space-3); }
.calc-fail { padding: var(--space-4); border: 1px dashed var(--color-border); border-radius: var(--radius-md); }
.calc-wrap .calc-mat { font-size: var(--text-xs); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: 4px var(--space-2); align-items: center; }
.calc-wrap .calc-mat b { color: var(--color-text); font-weight: 600; }
.calc-wrap .calc-mat button { color: var(--color-primary); font-weight: 600; text-decoration: underline; text-underline-offset: 0.18em; min-height: 32px; }
.calc-wrap .unit-l { color: var(--color-text-faint); }

/* поясняющие схемы */
.ex-fig { border: 1px solid var(--color-divider); background: var(--color-surface-2); }
.ex-fig .ex-k { display: flex; align-items: center; gap: var(--space-2); }
.ex-fig svg { background: var(--color-surface); display: block; }
.ex-fig svg text { font-family: var(--font-body); }
.ex-fig figcaption { color: var(--color-text-muted); }
.ex-fig figcaption b { color: var(--color-text); }
.ex-fig .ex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--space-3); }

@media (max-width: 1080px) {
  .state-open-btn { display: inline-flex; }
  body:not(.has-state) .state { display: none; }
  .state { position: fixed; z-index: 70; left: 0; right: 0; bottom: 0; top: auto; margin: 0; padding: 0; max-height: 82dvh; overflow: auto; background: none; border: 0; transform: translateY(105%); visibility: hidden; transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 220ms; grid-row: auto; }
  body.state-open .state { transform: none; visibility: visible; transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1); }
  .state-body { display: grid; position: static; max-height: none; border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: 0 -10px 30px rgba(20, 24, 30, 0.18); padding: var(--space-4) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(720px, 100%); margin: 0 auto; }
  .state-h { display: block; }
  .state-x { display: inline-grid; }
  .state-top, .state-body .hint { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .brand-t { white-space: nowrap; font-size: 0.95rem; }
  .brand .brand-mark { width: 24px; height: 24px; }
  .top-in { gap: 6px; }
  .state-open-btn { padding: 0 8px; min-height: 40px; }
  .state-open-btn .sb-t { display: none; }
  .state-body { grid-template-columns: minmax(0, 1fr); padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); }
  .pop { max-height: 62dvh; padding: var(--space-4); padding-right: var(--space-10); border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg); box-shadow: 0 -8px 30px rgba(20, 24, 30, 0.22); }
  .pop.wide { width: auto; }
  .ins-p, .ins-block { margin-left: calc(-1 * var(--space-1)); margin-right: calc(-1 * var(--space-1)); padding: 2px var(--space-1); }
  .unit p.li2 { padding-left: 2em; }
}
@media (max-width: 380px) {
  .brand-t { font-size: 0.9rem; }
  .ed-switch button { padding: 0 8px; }
}
@media print {
  .state-open-btn, .toast, .calc-mount, .zm { display: none !important; }
}
/* в дробях KaTeX верхние слои перекрывают знаменатель — пропускаем нажатия к обозначениям */
.unit .katex .vlist-t, .unit .katex .vlist-r, .unit .katex .vlist, .pop .katex .vlist-t, .pop .katex .vlist-r, .pop .katex .vlist { pointer-events: none; }
.unit .katex [data-v], .unit .katex [data-v] * { pointer-events: auto; }

/* Сверка с примерами: длинные подписи — строкой над значением */
.ex-tbl.stack { grid-template-columns: 1fr; gap: 2px; }
.ex-tbl.stack dt { font-size: var(--text-xs); }
.ex-tbl.stack dd { text-align: left; margin-bottom: var(--space-2); }
.ex-tbl.stack dd:last-child { margin-bottom: 0; }
.calc-wrap[data-mode='check'] .design-only { display: none; }
/* поля в сетке: подписи, поля и подсказки выровнены по строкам */
@supports (grid-template-rows: subgrid) {
  .calc-wrap .fields > .f { grid-row: span 3; grid-template-rows: subgrid; row-gap: 4px; align-items: start; }
  .calc-wrap .fields > .f > span:first-child { align-self: end; }
}
/* заголовки внутри калькулятора не наследуют отступы текста свода */
.unit .calc-wrap h3, .unit .calc-wrap h4 { margin-top: 0; }
.unit .calc-wrap .calc-head h3 { margin-top: var(--space-1); font-size: var(--text-lg); }
.unit .calc-wrap .ex h3 { font-size: var(--text-sm); }
.calc-wrap .tag { font-family: var(--font-body); font-size: var(--text-xs); color: var(--color-text-muted); margin-left: var(--space-2); }
/* переключаемые поля калькуляторов */
.calc-wrap[data-shape='rect'] .circ-only, .calc-wrap[data-shape='circle'] .rect-only { display: none; }
.calc-wrap[data-kind='in'] .edge-only, .calc-wrap[data-kind='in'] .open-only, .calc-wrap[data-kind='in'] .corner-only, .calc-wrap[data-kind='edge'] .corner-only { display: none; }
.calc-wrap:not([data-kind='in']) .shape-sel { display: none; }
.calc-wrap[data-sw='no'] .sw-only { display: none; }
.calc-wrap .seg + .fields, .calc-wrap .seg + .seg, .calc-wrap .fields + .seg, .calc-wrap .hint + .seg, .calc-wrap .hint + div > .seg { margin-top: var(--space-3); }
.calc-cap { font-size: var(--text-xs); color: var(--color-text-muted); display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin-top: var(--space-2); }
.calc-cap:empty { display: none; }
.lg { display: inline-block; width: 18px; height: 0; border-top: 2px dashed currentColor; vertical-align: middle; margin-right: 6px; }
.ed-switch .lg { width: auto; height: auto; border: 0; margin: 0; vertical-align: baseline; }
.lg-p { color: var(--color-primary); } .lg-a { color: var(--color-amber); } .lg-g { color: var(--color-text-muted); border-top-style: dotted; }
.calc-wrap[data-net='no'] .net-only { display: none; }
.lg-x { height: 10px; width: 14px; border: 1.5px solid var(--color-text); background: repeating-linear-gradient(45deg, transparent 0 3px, var(--color-text) 3px 4px); opacity: .7; }
.lg-h { height: 10px; width: 14px; border: 1.5px solid var(--color-primary); background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(29,79,145,.45) 3px 4px); }
.lg-k { border-top: 2px solid var(--color-text); }
.calc-wrap:not([data-own='true']) .own-only { display: none; }
.lg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--color-amber); vertical-align: middle; margin-right: 6px; }
.lg-s { border-top: 2.5px solid var(--color-primary); }
.calc-wrap[data-comp='no'] .comp-only { display: none; }
.lg-t { height: 10px; width: 14px; border: 1.5px solid var(--color-amber); background: repeating-linear-gradient(-45deg, transparent 0 3px, rgba(154,91,0,.55) 3px 4px); }
.st-sub { font-family: var(--font-body); font-size: var(--text-xs); color: var(--color-text-muted); margin: var(--space-2) 0 2px; }
.st-sub:first-child { margin-top: 0; }
/* поясняющие схемы */
.xfig { margin: var(--space-5) 0; padding: var(--space-4) var(--space-5) var(--space-5); background: var(--color-surface-2); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); }
.xfig-head { margin-bottom: var(--space-3); }
.xfig-k { display: block; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-primary); }
.xfig-t { font-weight: 650; font-size: var(--text-base); line-height: 1.35; margin-top: 2px; text-wrap: balance; }
.xfig-body { display: grid; gap: var(--space-4); }
.xfig-body > .xsvg { max-width: 580px; justify-self: center; }
.xsvg { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.xsvg text { font-size: 11.5px; fill: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.xsvg .s { font-family: var(--font-math); font-style: italic; font-size: 13px; fill: var(--color-text); }
.xsvg .sub { font-size: 9px; }
.xsvg .ttl { font-size: 11px; font-weight: 600; fill: var(--color-text); letter-spacing: .02em; }
.xsvg .c { fill: #e9e6dc; stroke: var(--color-steel); stroke-width: 1.4; }
.xsvg .ln { fill: none; stroke: var(--color-steel); stroke-width: 1.4; }
.xsvg .p { fill: none; stroke: var(--color-primary); stroke-width: 1.6; }
.xsvg .pa { fill: none; stroke: var(--color-primary-ink); stroke-width: 1.8; }
.xsvg .z { fill: rgba(29, 79, 145, .16); stroke: var(--color-primary); stroke-width: 1.3; }
.xsvg .am { fill: none; stroke: var(--color-amber); stroke-width: 1.6; }
.xsvg .amz { fill: rgba(154, 91, 0, .14); stroke: var(--color-amber); stroke-width: 1.3; }
.xsvg .dm { fill: none; stroke: var(--color-text-muted); stroke-width: .9; }
.xsvg .na { stroke: var(--color-primary); stroke-width: 1.3; stroke-dasharray: 6 4; fill: none; }
.xsvg .ax { stroke: var(--color-text-muted); stroke-width: .8; stroke-dasharray: 8 3 2 3; fill: none; }
.xsvg .bar { fill: var(--color-steel); }
.xsvg .cl circle { fill: var(--color-primary); }
.xsvg .cl text { fill: #fff; font-size: 10.5px; font-weight: 700; text-anchor: middle; }
.xfig-pts { list-style: none; counter-reset: xp; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-5); margin: 0; padding: 0; font-size: var(--text-sm); line-height: 1.5; }
.xfig-pts li { counter-increment: xp; position: relative; padding-left: 30px; }
.xfig-pts li::before { content: counter(xp); position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-primary); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.xfig-pts b { font-weight: 650; }
.xfig-foot { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-muted); }
@media (max-width: 760px) {
  .xfig-pts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .xfig { padding: var(--space-3); margin-left: calc(-1 * var(--space-2)); margin-right: calc(-1 * var(--space-2)); }
}
/* калькуляторы в одну колонку (диаграммы) */
.calc.calc-1 { grid-template-columns: minmax(0, 1fr); }
.calc.calc-1 .calc-out { position: static; }
.calc.calc-1 .calc-in { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: start; }
.calc.calc-1 .calc-in > .calc-mat:empty { display: none; }
.calc-wrap[data-load='short'] .long-only { display: none; }
.calc-wrap .slider { margin-bottom: var(--space-2); }
.calc-wrap .slider input[type='range'] { min-height: 44px; }
.calc-wrap[data-sign='t'] .sign-c { display: none; }
/* минимальное армирование */
.calc-wrap:not([data-t='comp']) .mr-comp { display: none; }
.calc-wrap[data-t='tenc'] .not-tenc { display: none; }
.calc-wrap[data-arr='contour'] .edge-only, .calc-wrap[data-arr='contour'] .edge-a { display: none; }
.calc-wrap:not([data-im='own']) .own-i { display: none; }
.calc-wrap[data-c2='false'] .c2-only { display: none; }
.calc-wrap .chk + .fields { margin-top: var(--space-2); }

.calc-wrap[data-kind='bend'] .pn-n { display: none; }
