/* ============================================
   LEDСоюз — дизайн-система
   Матовое стекло, тёплый белый день и графитовая ночь.
   Акценты приглушённые: мята — прошло рубеж, пудра — не прошло.
   ============================================ */

:root {
    --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: var(--font);
    --font-body: var(--font);

    --radius-lg: 28px;
    --radius: 20px;
    --radius-sm: 14px;

    --gutter: clamp(16px, 4.5vw, 44px);
    --wrap: 1360px;
    --header-h: 68px;
    --ease: cubic-bezier(.4, 0, .2, 1);

    --stage-1: #8fa8d8;
    --stage-2: #86c9d3;
    --stage-3: #e7bf86;
    --stage-4: #93cfb1;
}

/* ── День ── */
:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f2ee;
    --fog-1: rgba(160, 214, 202, .55);
    --fog-2: rgba(240, 194, 199, .42);
    --fog-3: rgba(200, 216, 236, .5);

    --surface: rgba(255, 255, 255, .56);
    --surface-strong: rgba(255, 255, 255, .86);
    --surface-soft: rgba(255, 255, 255, .34);
    --edge: rgba(255, 255, 255, .95);
    --edge-soft: rgba(255, 255, 255, .62);
    --line: rgba(30, 42, 50, .08);
    --shadow: 0 1px 2px rgba(30, 42, 50, .04), 0 18px 40px -18px rgba(30, 42, 50, .18);
    --shadow-sm: 0 1px 2px rgba(30, 42, 50, .05), 0 6px 16px -8px rgba(30, 42, 50, .16);
    --inner: inset 0 1px 0 rgba(255, 255, 255, .95);

    --ink: #1e2a32;
    --ink-soft: #55636e;
    --ink-faint: #8b97a1;
    --track: rgba(30, 42, 50, .08);

    --accent: #5d9c92;
    --ok: #7fcbb4;
    --ok-soft: rgba(127, 203, 180, .26);
    --fail: #e7a3a9;
    --fail-soft: rgba(231, 163, 169, .26);
    --budget: #b58657;

    --btn-bg: #1e2a32;
    --btn-ink: #ffffff;
}

/* ── Ночь ── */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0c0d;
    --fog-1: rgba(58, 118, 124, .34);
    --fog-2: rgba(196, 112, 44, .2);
    --fog-3: rgba(64, 84, 148, .24);

    --surface: rgba(255, 255, 255, .045);
    --surface-strong: rgba(255, 255, 255, .085);
    --surface-soft: rgba(255, 255, 255, .025);
    --edge: rgba(255, 255, 255, .13);
    --edge-soft: rgba(255, 255, 255, .07);
    --line: rgba(255, 255, 255, .08);
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, .75);
    --shadow-sm: 0 8px 22px -12px rgba(0, 0, 0, .7);
    --inner: inset 0 1px 0 rgba(255, 255, 255, .07);

    --ink: #eef1f0;
    --ink-soft: #a7b1b4;
    --ink-faint: #6f7a7e;
    --track: rgba(255, 255, 255, .09);

    --accent: #8fd0c4;
    --ok: #6dbfa5;
    --ok-soft: rgba(109, 191, 165, .2);
    --fail: #d98b91;
    --fail-soft: rgba(217, 139, 145, .18);
    --budget: #c4925d;

    --btn-bg: #eef1f0;
    --btn-ink: #0a0c0d;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0a0c0d;
        --fog-1: rgba(58, 118, 124, .34);
        --fog-2: rgba(196, 112, 44, .2);
        --fog-3: rgba(64, 84, 148, .24);

        --surface: rgba(255, 255, 255, .045);
        --surface-strong: rgba(255, 255, 255, .085);
        --surface-soft: rgba(255, 255, 255, .025);
        --edge: rgba(255, 255, 255, .13);
        --edge-soft: rgba(255, 255, 255, .07);
        --line: rgba(255, 255, 255, .08);
        --shadow: 0 24px 60px -24px rgba(0, 0, 0, .75);
        --shadow-sm: 0 8px 22px -12px rgba(0, 0, 0, .7);
        --inner: inset 0 1px 0 rgba(255, 255, 255, .07);

        --ink: #eef1f0;
        --ink-soft: #a7b1b4;
        --ink-faint: #6f7a7e;
        --track: rgba(255, 255, 255, .09);

        --accent: #8fd0c4;
        --ok: #6dbfa5;
        --ok-soft: rgba(109, 191, 165, .2);
        --fail: #d98b91;
        --fail-soft: rgba(217, 139, 145, .18);
        --budget: #c4925d;

        --btn-bg: #eef1f0;
        --btn-ink: #0a0c0d;
    }
}

/* ── База ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15.5px;
    line-height: 1.6;
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

[hidden] {
    display: none !important;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-underline-offset: 3px;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font);
    font-weight: 600;
    letter-spacing: -.02em;
    margin: 0;
    text-wrap: balance;
}

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

.wrap {
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.wrap--narrow {
    max-width: 860px;
}

.eyebrow {
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
    margin: 0 0 12px;
}

/* Мягкий свет за стеклом */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.aurora i {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(110px);
    animation: drift 40s ease-in-out infinite;
}

.aurora i:nth-child(1) {
    width: 52vw;
    height: 52vw;
    background: var(--fog-1);
    top: -18vh;
    left: -14vw;
}

.aurora i:nth-child(2) {
    width: 44vw;
    height: 44vw;
    background: var(--fog-2);
    top: 38vh;
    right: -12vw;
    animation-delay: -14s;
}

.aurora i:nth-child(3) {
    width: 40vw;
    height: 40vw;
    background: var(--fog-3);
    bottom: -20vh;
    left: 26vw;
    animation-delay: -26s;
}

@keyframes drift {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(2vw, 3vh, 0) scale(1.06);
    }
}

/* ── Стекло ── */
.glass {
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow), var(--inner);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
}

/* ── Кнопки ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: 600 14.5px var(--font);
    text-decoration: none;
    cursor: pointer;
    color: var(--ink);
    transition: background .2s var(--ease), opacity .2s var(--ease), transform .12s var(--ease);
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--btn-bg);
    color: var(--btn-ink);
}

.btn--primary:hover {
    opacity: .88;
}

.btn--sm {
    padding: 9px 18px;
    font-size: 14px;
}

.btn--block {
    width: 100%;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.reveal-btn {
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 7px 14px;
    font: 500 13px var(--font);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.reveal-btn:hover {
    color: var(--ink);
}

/* ── Шапка ── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    height: var(--header-h);
    display: flex;
    align-items: center;
}

.header__inner {
    max-width: var(--wrap);
    width: 100%;
    margin-inline: auto;
    padding: 0 var(--gutter);
}

.header__bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: 999px;
    box-shadow: var(--shadow-sm), var(--inner);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
}

.nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav a {
    padding: 8px 16px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-soft);
    transition: background .2s var(--ease), color .2s var(--ease);
}

.nav a:hover {
    color: var(--ink);
}

.nav a.is-active {
    background: var(--surface-strong);
    color: var(--ink);
    box-shadow: var(--shadow-sm), var(--inner);
}

.theme-toggle {
    flex: none;
    margin-left: auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
}

.theme-toggle svg {
    width: 17px;
    height: 17px;
}

.theme-toggle .i-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .i-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .i-moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .i-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-toggle .i-moon {
        display: block;
    }
}

.burger {
    display: none;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    cursor: pointer;
    padding: 0;
    place-items: center;
}

.burger span {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--ink);
    margin: 3px auto;
    transition: transform .2s ease, opacity .2s ease;
}

.is-open .burger span:nth-child(1) {
    transform: translateY(4.5px) rotate(45deg);
}

.is-open .burger span:nth-child(2) {
    opacity: 0;
}

.is-open .burger span:nth-child(3) {
    transform: translateY(-4.5px) rotate(-45deg);
}

@media (max-width: 880px) {
    .burger {
        display: grid;
    }

    .nav {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
        background: var(--surface-strong);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        backdrop-filter: blur(26px);
        -webkit-backdrop-filter: blur(26px);
        display: none;
    }

    .is-open .nav {
        display: flex;
    }

    .nav a {
        padding: 12px 14px;
        font-size: 15.5px;
    }
}

/* ── Появление ── */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}

.reveal.is-in {
    opacity: 1;
    transform: none;
}

/* ── Страницы ── */
main {
    min-height: 70vh;
}

.section--flow {
    padding-top: calc(var(--header-h) + 20px);
    padding-bottom: 40px;
}

.page-wrap,
.kb-layout {
    padding-top: calc(var(--header-h) + 34px);
    padding-bottom: clamp(56px, 8vw, 100px);
}

.page-wrap h1,
.kb-main h1,
.legal h1 {
    font-size: clamp(30px, 4.4vw, 52px);
    font-weight: 500;
    letter-spacing: -.035em;
    line-height: 1.06;
    margin: 8px 0 18px;
}

.page-wrap h2,
.kb-main h2 {
    font-size: clamp(21px, 2.4vw, 28px);
    font-weight: 500;
    letter-spacing: -.025em;
    margin: 44px 0 14px;
}

.kb-main h3 {
    font-size: 17px;
}

.kb-main h4 {
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 18px 0 6px;
}

.bluf.lead {
    font-size: clamp(16px, 1.8vw, 19px);
    line-height: 1.55;
    color: var(--ink-soft);
    max-width: 68ch;
}

.crumbs {
    font-size: 13px;
    color: var(--ink-faint);
}

.crumbs a {
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--ink);
}

.crumbs span {
    margin: 0 4px;
}

/* ── Диаграмма ── */
.flow {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: min(95vh, 1080px);
    min-height: 660px;
    padding: clamp(14px, 2vw, 22px);
    border-radius: var(--radius-lg);
}

.flow__top,
.flow__bottom,
.flow__stage-nav,
.flow__pager,
.flow__kb,
.flow__std {
    flex: none;
}

.flow__setup {
    display: none;
}

.flow__top {
    display: grid;
    gap: 8px 18px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--surface-soft);
    border: 1px solid var(--edge-soft);
}

@media (min-width: 900px) {
    .flow__top {
        grid-template-columns: minmax(190px, 1fr) 4fr;
    }

    .flow__top > .ctrl__grid:not(.ctrl__grid--stages) {
        grid-column: 1 / -1;
    }
}

.ctrl__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px 18px;
}

.ctrl__grid--stages {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.ctrl__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-soft);
    margin-bottom: 4px;
}

.ctrl__label b {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.ctrl--stage .ctrl__label {
    position: relative;
    padding-left: 13px;
}

.ctrl--stage .ctrl__label::before {
    content: "";
    position: absolute;
    left: 0;
    top: .45em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--dot);
}

.ctrl--s1 { --dot: var(--stage-1); }
.ctrl--s2 { --dot: var(--stage-2); }
.ctrl--s3 { --dot: var(--stage-3); }
.ctrl--s4 { --dot: var(--stage-4); }

.ctrl.is-off .ctrl__label {
    color: var(--ink-faint);
}

.ctrl.is-off .ctrl__label b {
    color: var(--fail);
}

.ctrl.is-off .ctrl__range {
    opacity: .5;
}

.budget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 13.5px;
}

.budget-num {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.budget-num input {
    width: 8.6em;
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink);
    font: 600 16px var(--font);
    text-align: right;
    box-shadow: var(--inner);
}

.budget-num input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.budget-num i {
    font-style: normal;
    font-weight: 600;
}

.ctrl__range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
    margin: 0;
}

.ctrl__range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: var(--track);
}

.ctrl__range::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: var(--track);
}

.ctrl__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(30, 42, 50, .12);
    box-shadow: 0 2px 6px rgba(30, 42, 50, .2), inset 0 -1px 2px rgba(30, 42, 50, .08);
}

.ctrl__range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(30, 42, 50, .12);
    box-shadow: 0 2px 6px rgba(30, 42, 50, .2);
}

.ctrl__range:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 999px;
}

/* Вкладки этапов — сегментированный переключатель */
.flow__stage-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--edge-soft);
}

.stage-tab {
    text-align: left;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-faint);
    font-family: var(--font);
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}

.stage-tab b {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
}

.stage-tab span {
    display: block;
    font-size: 11.5px;
}

.stage-tab:hover {
    color: var(--ink-soft);
}

.stage-tab.is-active {
    background: var(--surface-strong);
    border-color: var(--edge);
    color: var(--ink);
    box-shadow: var(--shadow-sm), var(--inner);
}

.stage-tab[data-off] span::after {
    content: " · стандартные значения";
}

.flow__canvas {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius);
}

.flow__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.flow__svg .node-label {
    font-family: var(--font);
    font-size: calc(12px * var(--fxl, var(--fx-scale, 1)));
    font-weight: 600;
    fill: var(--ink);
}

.flow__svg .node-sub {
    font-family: var(--font);
    font-size: calc(10.5px * var(--fxl, var(--fx-scale, 1)));
    font-weight: 500;
    fill: var(--ink-soft);
}

.flow__svg .stage-layer text {
    transition: opacity .35s ease;
}

.flow__svg .stage-layer:not(.is-active-stage) text {
    opacity: 0;
}

.flow-backdrops {
    pointer-events: none;
}

.flow__pager {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flow__arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--ink-faint);
    background: transparent;
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0 0 2px;
    transition: background .2s var(--ease), opacity .2s var(--ease);
}

.flow__arrow:hover:not(:disabled) {
    background: var(--surface-strong);
}

.flow__arrow:disabled {
    opacity: .25;
    cursor: default;
}

.flow__page {
    min-width: 46px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
}

.flow__kb {
    margin: 0;
    text-align: center;
    font-size: 13.5px;
}

.flow__kb a {
    color: var(--ink-soft);
    font-weight: 500;
    text-decoration: none;
}

.flow__kb a:hover {
    color: var(--ink);
    text-decoration: underline;
}

.flow__std {
    margin: 0;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--ink-soft);
    background: var(--surface-soft);
    border: 1px dashed var(--edge);
}

.flow__bottom {
    display: grid;
    gap: 12px;
}

.flow__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.flow__legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: -1px;
}

.flow__result {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.result-card {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 4px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface-strong);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow-sm), var(--inner);
}

.result-card b {
    font-size: clamp(19px, 2vw, 26px);
    font-weight: 500;
    letter-spacing: -.02em;
    line-height: 1.1;
    white-space: nowrap;
}

.result-card span {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
}

/* ── База знаний ── */
.kb-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
}

.kb-side {
    position: sticky;
    top: calc(var(--header-h) + 22px);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow: auto;
}

.kb-side__mobile > summary {
    display: none;
}

.kb-tree {
    display: grid;
    gap: 2px;
    font-size: 14px;
}

.kb-tree a {
    display: block;
    padding: 6px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink-soft);
}

.kb-tree a:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.kb-tree a.is-current {
    background: var(--surface-strong);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-sm), var(--inner);
}

.kb-tree__group summary {
    cursor: pointer;
    padding: 7px 12px;
    border-radius: 10px;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
}

.kb-tree__group summary::-webkit-details-marker {
    display: none;
}

.kb-tree__group ul,
.kb-tree__flat {
    list-style: none;
    margin: 2px 0 6px 16px;
    padding: 0 0 0 8px;
    border-left: 1px solid var(--line);
}

.kb-tree__label {
    margin: 18px 12px 4px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
    flex: none;
}

.kb-tree .dot {
    margin-right: 0;
}

.kb-search {
    position: relative;
    margin: 20px 0 26px;
}

.input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink);
    font: 500 15px var(--font);
    box-shadow: var(--inner);
}

.input::placeholder {
    color: var(--ink-faint);
}

.input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.input.is-error {
    border-color: var(--fail);
}

textarea.input {
    min-height: 96px;
    resize: vertical;
}

.kb-results {
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
    border-radius: 14px;
    background: var(--surface-strong);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow);
    display: grid;
    gap: 2px;
}

.kb-results li {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-radius: 10px;
}

.kb-results li:hover {
    background: var(--surface-soft);
}

.kb-results a {
    text-decoration: none;
    font-weight: 600;
}

.kb-results small {
    color: var(--ink-faint);
}

.kb-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.kb-card {
    position: relative;
    padding: 24px 24px 22px;
    overflow: hidden;
}

.kb-card__bar {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 26px;
    height: 4px;
    border-radius: 999px;
}

.kb-card h3 {
    margin-top: 16px;
    font-size: 20px;
    font-weight: 600;
}

.kb-card h3 a {
    text-decoration: none;
}

.kb-card__role {
    margin: 2px 0 10px;
    color: var(--ink-faint);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
}

.kb-card p {
    font-size: 14.5px;
    color: var(--ink-soft);
}

.chips {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chips li,
.chips-inline a {
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    background: var(--surface-strong);
    border: 1px solid var(--edge);
    color: var(--ink-soft);
    text-decoration: none;
}

.chips a {
    color: inherit;
    text-decoration: none;
}

.chips-inline {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-left: 4px;
    vertical-align: middle;
}

.kb-links {
    padding-left: 18px;
    line-height: 1.9;
}

.trace {
    list-style: none;
    margin: 14px 0 20px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    counter-reset: trace;
}

.trace li {
    position: relative;
    padding: 14px 16px 14px 46px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow-sm), var(--inner);
    font-weight: 600;
    font-size: 14px;
    counter-increment: trace;
}

.trace li::before {
    content: counter(trace);
    position: absolute;
    left: 14px;
    top: 14px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11.5px;
    color: var(--ink-soft);
    border: 1px solid var(--ink-faint);
}

.trace small {
    display: block;
    margin-top: 2px;
    font-weight: 400;
    font-size: 12.5px;
    color: var(--ink-faint);
}

.outcomes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.out {
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: 1px solid var(--edge);
}

.out--ok {
    background: var(--ok-soft);
}

.out--fail {
    background: var(--fail-soft);
}

.kb-main table,
.page-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.45;
    margin: 4px 0 10px;
}

.kb-main th,
.page-wrap th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
    padding: 8px 14px 8px 0;
    border-bottom: 1px solid var(--line);
}

.kb-main td,
.page-wrap td,
.page-wrap th[scope="row"] {
    padding: 10px 14px 10px 0;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
}

.kb-main td:first-child {
    color: var(--ink);
    font-weight: 500;
}

.table-wrap {
    overflow-x: auto;
}

.kb-channels-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kb-channel,
.faq,
.guide {
    border-radius: var(--radius-sm);
    border: 1px solid var(--edge);
    background: var(--surface);
    box-shadow: var(--shadow-sm), var(--inner);
    margin-bottom: 10px;
}

.kb-channel > summary,
.faq > summary,
.guide > summary {
    cursor: pointer;
    padding: 15px 20px;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-weight: 600;
}

.kb-channel > summary::-webkit-details-marker,
.faq > summary::-webkit-details-marker,
.guide > summary::-webkit-details-marker {
    display: none;
}

.kb-channel > summary::after,
.faq > summary::after,
.guide > summary::after {
    content: "+";
    margin-left: auto;
    font-size: 20px;
    font-weight: 400;
    color: var(--ink-faint);
    transition: transform .3s var(--ease);
}

.kb-channel[open] > summary::after,
.faq[open] > summary::after,
.guide[open] > summary::after {
    transform: rotate(45deg);
}

.kb-channel summary h3 {
    margin: 0;
    flex: 1;
}

.badge {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}

.badge small {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.kb-channel__body,
.faq > p,
.guide > ol,
.guide > .table-wrap {
    padding: 0 20px 18px;
}

.guide > ol {
    margin: 0;
    padding-left: 40px;
    line-height: 1.75;
}

.kb-cap,
.kb-tools {
    color: var(--ink-faint);
    font-size: 13.5px;
}

.kb-pn {
    display: flex;
    justify-content: space-between;
    margin: 30px 0 8px;
    font-weight: 600;
}

.kb-pn a {
    text-decoration: none;
}

.kb-note {
    font-size: 13px;
    color: var(--ink-faint);
    max-width: 90ch;
}

.kb-sources {
    margin-top: 40px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.kb-sources h2 {
    font-size: 17px;
}

.kb-sources ul {
    padding-left: 18px;
    font-size: 14px;
    color: var(--ink-soft);
}

.gloss {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0 30px;
}

.gloss > div {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.gloss dt {
    font-weight: 600;
}

.gloss dd {
    margin: 2px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
}

/* ── Технологии ── */
.stage-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 18px 0 10px;
}

.stage-jump a {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.tech-stage {
    margin-top: 48px;
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.tech-stage h2 {
    display: flex;
    align-items: center;
}

.tech-stage h3 {
    font-size: 16px;
    margin: 24px 0 8px;
}

.scheme {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px;
    margin: 18px 0 6px;
    padding: 20px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow-sm), var(--inner);
}

.layer {
    position: relative;
}

.layer:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -18px;
    top: 0;
    color: var(--ink-faint);
}

.layer h4 {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 8px;
}

.layer ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.layer li {
    padding: 8px 11px;
    border-radius: 10px;
    background: var(--surface-strong);
    border: 1px solid var(--edge);
    font-size: 13.5px;
    font-weight: 500;
}

.layer li a,
.partner-link {
    text-decoration: underline;
    text-decoration-color: var(--ink-faint);
}

.levels th small {
    display: block;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: var(--ink-faint);
}

.levels th[scope="row"] {
    color: var(--ink);
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.kb-link {
    font-weight: 600;
    margin: 16px 0 0;
}

.kb-link a {
    text-decoration: none;
}

/* ── Решения ── */
.sol-grid {
    display: grid;
    gap: 20px;
    margin-top: 24px;
}

.sol {
    padding: clamp(20px, 3vw, 34px);
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.sol h2 {
    margin-top: 0;
}

.sol h3 {
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 22px 0 8px;
}

.sol__who {
    color: var(--ink-faint);
    font-size: 14px;
    margin-top: -4px;
}

.sol ul.trends,
.sol ul.appr {
    padding-left: 18px;
    line-height: 1.7;
    color: var(--ink-soft);
}

.cite {
    font-size: 12px;
    color: var(--ink-faint);
    margin-left: 4px;
    white-space: nowrap;
}

.split {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    gap: 2px;
}

.split span {
    display: block;
    height: 100%;
}

.split__legend {
    font-size: 13px;
    color: var(--ink-faint);
    margin: 8px 0 16px;
}

/* ── Подвал ── */
.footer {
    margin-top: 20px;
    padding: 44px 0 26px;
    border-top: 1px solid var(--line);
}

.footer__grid {
    display: grid;
    grid-template-columns: 1.4fr .8fr;
    gap: 34px;
}

.footer__title {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
    margin: 0 0 12px;
}

.contact-text {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 14.5px;
}

.contact-text span {
    color: var(--ink-faint);
}

.contact-text b {
    font-weight: 500;
}

.reveal-link {
    color: var(--ink);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--ink-faint);
    text-underline-offset: 3px;
}

.reveal-link:hover {
    text-decoration-color: var(--ink);
}

.footer__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
    font-size: 14.5px;
}

.footer__links a {
    text-decoration: none;
    color: var(--ink-soft);
}

.footer__links a:hover {
    color: var(--ink);
}

.footer__bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.footer__bottom a {
    color: var(--ink-faint);
}

/* ── Окно заявки и форма ── */
.lead-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    max-height: calc(100vh - 32px);
    overflow: auto;
    width: min(460px, calc(100vw - 32px));
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--edge);
    background: var(--bg);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.lead-dialog::backdrop {
    background: rgba(10, 12, 13, .45);
    backdrop-filter: blur(8px);
}

.lead-dialog h2 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 6px;
}

.lead-dialog__lede {
    margin: 0 0 18px;
    color: var(--ink-soft);
    font-size: 14.5px;
}

.lead-dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink);
    font-size: 20px;
    cursor: pointer;
}

.field {
    margin-bottom: 14px;
}

.field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--ink-soft);
    margin: 4px 0 16px;
}

.consent input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.error {
    display: none;
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--fail);
}

.error.is-visible {
    display: block;
}

.hp {
    position: absolute;
    left: -9999px;
}

.form__done h3 {
    font-size: 20px;
    margin-bottom: 6px;
}

.form__done p {
    color: var(--ink-soft);
}

/* ── Политика ── */
.legal h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 30px 0 10px;
}

.legal p,
.legal li {
    color: var(--ink-soft);
}

.section__lede {
    color: var(--ink-soft);
}

/* ── Планшет ── */
@media (max-width: 900px) {
    .footer__grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .kb-layout {
        grid-template-columns: 1fr;
    }

    .kb-side {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .kb-side__mobile {
        border-radius: var(--radius-sm);
        border: 1px solid var(--edge);
        background: var(--surface);
        padding: 4px 8px;
    }

    .kb-side__mobile > summary {
        display: block;
        cursor: pointer;
        padding: 10px;
        font-weight: 600;
    }

    .kb-cards,
    .outcomes {
        grid-template-columns: 1fr;
    }

    .trace {
        grid-template-columns: 1fr 1fr;
    }

    .scheme {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .layer:not(:last-child)::after {
        content: "↓";
        right: auto;
        left: 6px;
        top: auto;
        bottom: -23px;
    }

    .flow__result {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ── Телефон ── */
@media (max-width: 760px) {
    .flow {
        height: auto;
        min-height: 0;
        gap: 10px;
        padding: 12px;
    }

    .flow__setup {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--edge);
        background: var(--surface-strong);
        box-shadow: var(--shadow-sm), var(--inner);
        color: var(--ink);
        font: 600 14px var(--font);
        cursor: pointer;
    }

    .flow__setup span {
        margin-right: auto;
    }

    .flow__setup i {
        font-style: normal;
        transition: transform .3s var(--ease);
    }

    .flow.is-setup-open .flow__setup i {
        transform: rotate(180deg);
    }

    .flow__top {
        display: none;
    }

    .flow.is-setup-open .flow__top {
        display: grid;
    }

    .stage-tab {
        padding: 8px 4px;
        text-align: center;
    }

    .stage-tab b {
        font-size: 11px;
        line-height: 1.25;
    }

    .stage-tab span {
        display: none;
    }

    .flow__canvas {
        flex: none;
        height: min(62vh, 440px);
        min-height: 320px;
    }

    .flow__svg .node-label {
        font-size: calc(10.5px * var(--fxl, var(--fx-scale, 1)));
    }

    .flow__svg .node-sub {
        font-size: calc(9.5px * var(--fxl, var(--fx-scale, 1)));
    }

    .flow__result {
        grid-template-columns: 1fr 1fr;
    }

    .trace {
        grid-template-columns: 1fr;
    }
}

.kb-layout > * {
    min-width: 0;
}

/* Шапка плотнее остального стекла: под ней прокручивается контент */
.header__bar {
    background: rgba(255, 255, 255, .72);
}

:root[data-theme="dark"] .header__bar {
    background: rgba(18, 21, 22, .72);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .header__bar {
        background: rgba(18, 21, 22, .72);
    }
}

/* Метка этапа — тонкая капсула вместо кружка */
.kb-tree .dot,
.tech-stage h2 .dot {
    width: 4px;
    height: 16px;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 2px 6px -1px rgba(30, 42, 50, .18);
}

.tech-stage h2 .dot {
    height: 24px;
    margin-right: 14px;
}

.kb-tree__group summary {
    gap: 11px;
}

/* Контактное лицо в подвале */
.person {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.person__photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--edge);
    box-shadow: var(--shadow-sm);
}

.person__name {
    margin: 0 0 8px;
    font-weight: 600;
    font-size: 15px;
}

.socials {
    display: flex;
    gap: 8px;
}

.socials a {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .2s var(--ease), opacity .2s var(--ease);
}

.socials a:hover {
    transform: translateY(-2px);
}

.socials a[title="Telegram"] {
    border-radius: 50%;
}

.socials img {
    width: 100%;
    height: 100%;
    display: block;
}

.contact-note {
    display: block;
    font-size: 12.5px;
    color: var(--ink-faint);
}

/* ── Решения: услуги ── */
.svc-grid {
    display: grid;
    gap: 20px;
    margin-top: 26px;
}

.svc {
    padding: clamp(22px, 3.2vw, 38px);
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.svc__head {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.svc__num {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-faint);
    letter-spacing: .08em;
}

.page-wrap .svc h2 {
    margin: 0 0 12px;
}

.svc .bluf.lead {
    margin-top: 0;
}

.svc__who {
    color: var(--ink-soft);
    font-size: 15px;
}

.svc__cols {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    margin-top: 18px;
}

.svc h3 {
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin: 0 0 10px;
}

.svc__steps {
    margin: 0;
    padding-left: 20px;
    line-height: 1.7;
    color: var(--ink-soft);
}

.svc__result {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.svc__result li {
    position: relative;
    padding: 10px 14px 10px 36px;
    border-radius: 12px;
    background: var(--ok-soft);
    font-size: 14.5px;
}

.svc__result li::before {
    content: "✓";
    position: absolute;
    left: 14px;
    top: 10px;
    color: var(--accent);
    font-weight: 700;
}

.svc__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.svc__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 40px;
    margin: 0;
}

.svc__facts dt {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    font-weight: 600;
}

.svc__facts dd {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 600;
}

.why__list {
    list-style: none;
    margin: 16px 0 10px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.why__list li {
    padding: 18px 20px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow-sm), var(--inner);
    display: grid;
    gap: 6px;
}

.why__list b {
    font-size: 34px;
    font-weight: 500;
    letter-spacing: -.03em;
    line-height: 1;
}

.why__list span {
    color: var(--ink-soft);
    font-size: 14.5px;
}

.why__list small {
    color: var(--ink-faint);
    font-size: 12px;
}

@media (max-width: 900px) {
    .svc__cols,
    .why__list {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Вертикальная воронка: экран диаграммы
   ============================================ */
.flow {
    height: calc(100vh - var(--header-h) - 36px);
    height: calc(100svh - var(--header-h) - 36px);
    min-height: 540px;
    gap: 10px;
}

.flow__bar {
    flex: none;
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.flow__bar .flow__stage-nav {
    flex: 1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-width: 0;
}

.flow__setup,
.flow.is-setup-open .flow__setup {
    display: inline-flex;
    flex: none;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    width: auto;
    padding: 6px 18px;
    border-radius: 16px;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    box-shadow: var(--shadow-sm), var(--inner);
    color: var(--ink);
    font: 600 13.5px var(--font);
    cursor: pointer;
}

.flow__setup b {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-faint);
}

.flow__stage {
    position: relative;
    flex: 1;
    min-height: 0;
}

.flow__stage .flow__canvas {
    height: 100%;
    min-height: 0;
}

.flow__top,
.flow.is-setup-open .flow__top {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: min(560px, calc(100% - 20px));
    max-height: calc(100% - 20px);
    overflow: auto;
    display: none;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--edge);
    box-shadow: var(--shadow);
}

.flow.is-setup-open .flow__top {
    display: grid;
}

.flow__top > .ctrl__grid:not(.ctrl__grid--stages) {
    grid-column: auto;
}

.flow__top .ctrl__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.flow__top-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flow__top-head h2 {
    font-size: 17px;
    font-weight: 600;
}

.flow__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--edge);
    background: var(--surface-strong);
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
}

.flow__top-sub {
    margin: 6px 0 0;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ink-faint);
}

.flow__stage .flow__canvas {
    touch-action: pan-y;
}

.flow__foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 22px;
}

.flow__foot .flow__pager {
    align-self: auto;
}

.flow__foot .flow__result {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
    grid-template-columns: none;
}

.flow__result dt {
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--ink-faint);
}

.flow__result dd {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
    white-space: nowrap;
}

a.flow__kb {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
}

a.flow__kb:hover {
    color: var(--ink);
    text-decoration: underline;
}

@media (max-width: 900px) {
    .flow__bar {
        flex-direction: column;
    }

    .flow__bar .flow__stage-nav {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .flow__bar .stage-tab {
        flex: none;
        padding: 8px 12px;
    }

    .flow__bar .stage-tab span {
        display: none;
    }

    .flow__setup,
    .flow.is-setup-open .flow__setup {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 16px;
    }

    .flow__top .ctrl__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .flow {
        height: calc(100svh - var(--header-h) - 24px);
        min-height: 520px;
    }

    .flow__canvas {
        flex: 1;
        height: auto;
        min-height: 0;
    }

    .flow__foot .flow__result {
        gap: 4px 14px;
    }

    .flow__result dd {
        font-size: 15px;
    }
}

/* ============================================
   Редакционный стиль (из «Стратегии полной воронки»):
   чистый фон, тонкие линии, жирный Manrope,
   синий — конверсия, оранжевый — потери.
   ============================================ */
:root,
:root[data-theme="light"] {
    --bg: #ffffff;
    --fg: #1e2a32;
    --text: #3c4a54;
    --panel: #f3f2ee;
    --node: #3c4a68;
    --conv: #2f6fdf;
    --conv-ink: #1f4fa6;
    --loss: #e8853d;
    --loss-ink: #a6531a;
    --flow: #8e9bb5;
    --chip-dash: #8b97a1;

    --ink: #1e2a32;
    --ink-soft: #55636e;
    --ink-faint: #8b97a1;
    --line: #e6e4de;
    --track: #e6e4de;

    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-soft: #f3f2ee;
    --edge: #e6e4de;
    --edge-soft: #e6e4de;
    --shadow: none;
    --shadow-sm: none;
    --inner: none;

    --accent: #2f6fdf;
    --ok: #2f6fdf;
    --ok-soft: rgba(47, 111, 223, .08);
    --fail: #e8853d;
    --fail-soft: rgba(232, 133, 61, .1);
    --budget: #3c4a68;
    --btn-bg: #1e2a32;
    --btn-ink: #ffffff;

    --stage-1: #3c4a68;
    --stage-2: #3c4a68;
    --stage-3: #3c4a68;
    --stage-4: #3c4a68;
}

:root[data-theme="dark"] {
    --bg: #12161c;
    --fg: #eef1f4;
    --text: #c5cdd4;
    --panel: #1b2129;
    --node: #9fb0d0;
    --conv: #6c9ef2;
    --conv-ink: #8fb5f6;
    --loss: #f09a55;
    --loss-ink: #f3ad74;
    --flow: #6d7a94;
    --chip-dash: #6f7a84;

    --ink: #eef1f4;
    --ink-soft: #98a4ae;
    --ink-faint: #6f7a84;
    --line: #2a313a;
    --track: #2a313a;

    --surface: #12161c;
    --surface-strong: #1b2129;
    --surface-soft: #1b2129;
    --edge: #2a313a;
    --edge-soft: #2a313a;

    --accent: #6c9ef2;
    --ok: #6c9ef2;
    --ok-soft: rgba(108, 158, 242, .1);
    --fail: #f09a55;
    --fail-soft: rgba(240, 154, 85, .1);
    --budget: #9fb0d0;
    --btn-bg: #eef1f4;
    --btn-ink: #12161c;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #12161c;
        --fg: #eef1f4;
        --text: #c5cdd4;
        --panel: #1b2129;
        --node: #9fb0d0;
        --conv: #6c9ef2;
        --conv-ink: #8fb5f6;
        --loss: #f09a55;
        --loss-ink: #f3ad74;
        --flow: #6d7a94;
        --chip-dash: #6f7a84;

        --ink: #eef1f4;
        --ink-soft: #98a4ae;
        --ink-faint: #6f7a84;
        --line: #2a313a;
        --track: #2a313a;

        --surface: #12161c;
        --surface-strong: #1b2129;
        --surface-soft: #1b2129;
        --edge: #2a313a;
        --edge-soft: #2a313a;

        --accent: #6c9ef2;
        --ok: #6c9ef2;
        --ok-soft: rgba(108, 158, 242, .1);
        --fail: #f09a55;
        --fail-soft: rgba(240, 154, 85, .1);
        --budget: #9fb0d0;
        --btn-bg: #eef1f4;
        --btn-ink: #12161c;
    }
}

body {
    font-size: 16px;
    color: var(--fg);
}

.aurora {
    display: none;
}

.glass,
.header__bar {
    background: var(--bg);
    border: 1px solid var(--line);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

:root[data-theme="dark"] .header__bar {
    background: var(--bg);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .header__bar {
        background: var(--bg);
    }
}

.header__bar {
    border-radius: 16px;
}

.glass {
    border-radius: 16px;
}

h1,
h2,
h3 {
    font-weight: 800;
    letter-spacing: -.01em;
}

.page-wrap h1,
.kb-main h1,
.legal h1 {
    font-weight: 800;
    letter-spacing: -.015em;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.12;
}

.page-wrap h2,
.kb-main h2 {
    font-weight: 800;
    letter-spacing: -.01em;
}

p,
.bluf.lead {
    color: var(--text);
}

.nav a.is-active,
.stage-tab.is-active,
.kb-tree a.is-current {
    background: var(--panel);
    box-shadow: none;
    border-color: transparent;
}

.flow__stage-nav,
.flow__top-sub + .ctrl__grid {
    background: transparent;
    border-color: var(--line);
}

/* Карточки и плашки — плоские панели */
.kb-card,
.svc,
.sol,
.trace li,
.kb-channel,
.faq,
.guide,
.scheme,
.why__list li,
.layer li,
.result-card,
.kb-results,
.stage-jump a,
.reveal-btn,
.theme-toggle,
.burger,
.flow__setup,
.flow__close,
.lead-dialog__close {
    box-shadow: none;
}

.trace li,
.kb-channel,
.faq,
.guide,
.why__list li,
.scheme {
    background: var(--bg);
    border: 1px solid var(--line);
}

.layer li {
    background: var(--panel);
    border-color: transparent;
}

/* Чипсы — контурные капсулы */
.chips li,
.chips-inline a,
.stage-jump a {
    background: transparent;
    border: 1.5px solid var(--fg);
    color: var(--fg);
    font-weight: 700;
}

.chips li.more {
    border-style: dashed;
    border-color: var(--chip-dash);
    color: var(--ink-faint);
    font-weight: 600;
}

.svc__result li {
    background: var(--panel);
}

.svc__result li::before {
    color: var(--conv);
}

.out--ok {
    background: var(--ok-soft);
    border-color: transparent;
}

.out--fail {
    background: var(--fail-soft);
    border-color: transparent;
}

.ctrl__range::-webkit-slider-thumb {
    background: var(--bg);
    border: 2px solid var(--fg);
    box-shadow: none;
}

.ctrl__range::-moz-range-thumb {
    background: var(--bg);
    border: 2px solid var(--fg);
    box-shadow: none;
}

.ctrl--stage .ctrl__label::before {
    background: var(--node);
}

.flow__top,
.flow.is-setup-open .flow__top {
    background: var(--bg);
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px -20px rgba(18, 22, 28, .3);
}

.flow__std {
    background: var(--panel);
    border: none;
}

.footer {
    background: transparent;
}

.person__photo {
    box-shadow: none;
    border-color: var(--line);
}

.socials a {
    box-shadow: none;
}

/* ── Диаграмма: тонкие узлы, подписи с ореолом фона ── */
.flow__svg text {
    font-family: var(--font);
    paint-order: stroke;
    stroke: var(--bg);
    stroke-width: calc(4px * var(--fxl, 1));
    stroke-linejoin: round;
}

.flow__svg .ln {
    font-size: calc(12.5px * var(--fxl, 1));
    font-weight: 600;
    fill: var(--fg);
}

.flow__svg .lc {
    font-size: calc(12.5px * var(--fxl, 1));
    font-weight: 700;
    fill: var(--conv-ink);
}

.flow__svg .ll {
    font-size: calc(12.5px * var(--fxl, 1));
    font-weight: 700;
    fill: var(--loss-ink);
}

.flow__svg .lv {
    font-size: calc(12px * var(--fxl, 1));
    font-weight: 500;
    fill: var(--ink-soft);
}

.flow__svg .lin {
    font-size: calc(12.5px * var(--fxl, 1));
    font-weight: 700;
    fill: var(--conv-ink);
}

.flow__svg .n { fill: var(--node); }
.flow__svg .c { fill: var(--conv); }
.flow__svg .l { fill: var(--loss); }
.flow__svg .flow { fill: var(--flow); }
.flow__svg .pt { fill: var(--conv); }
.flow__svg .st-flow { stop-color: var(--flow); }
.flow__svg .st-conv { stop-color: var(--conv); }
.flow__svg .st-loss { stop-color: var(--loss); }

.flow__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.flow__legend i {
    display: inline-block;
    width: 18px;
    height: 7px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: 1px;
}

.kb-tree .dot,
.tech-stage h2 .dot,
.kb-card__bar {
    background: var(--node) !important;
    box-shadow: none;
}

/* Пример расчёта и источники под диаграммой */
.flow__links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 22px;
    position: relative;
}

.flow__src summary {
    cursor: pointer;
    list-style: none;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

.flow__src summary::-webkit-details-marker {
    display: none;
}

.flow__src summary:hover {
    color: var(--ink);
}

.flow__src-body {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 5;
    width: min(560px, calc(100vw - 32px));
    padding: 16px 18px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-soft);
}

.flow__src-body p {
    margin: 0 0 8px;
}

.flow__src-body b {
    color: var(--ink);
}

.flow__src-body ul {
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 640px) {
    .flow__src-body {
        position: static;
        width: auto;
        margin-top: 8px;
        box-shadow: none;
    }
}

/* Мобильная главная: диаграмма занимает весь экран, низ компактный */
@media (max-width: 760px) {
    .section--flow {
        padding-top: calc(var(--header-h) + 8px);
        padding-bottom: 8px;
    }

    .flow {
        height: calc(100svh - var(--header-h) - 16px);
        min-height: 560px;
        gap: 8px;
        padding: 10px;
    }

    .flow__bar {
        gap: 6px;
    }

    .flow__bar .stage-tab {
        padding: 6px 10px;
    }

    .flow__setup,
    .flow.is-setup-open .flow__setup {
        padding: 8px 14px;
    }

    .flow__foot {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 6px 12px;
    }

    .flow__foot .flow__legend {
        display: none;
    }

    .flow__foot .flow__pager {
        grid-row: 2;
        grid-column: 1;
        gap: 6px;
    }

    .flow__foot .flow__arrow {
        width: 34px;
        height: 34px;
    }

    .flow__foot .flow__result {
        grid-row: 1;
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px 10px;
    }

    .flow__result dt {
        font-size: 8.5px;
        letter-spacing: .01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .flow__result dd {
        font-size: 13px;
    }

    .flow__foot .flow__links {
        grid-row: 2;
        grid-column: 2;
        justify-content: flex-end;
        position: static;
        gap: 2px 14px;
    }

    .flow__foot {
        position: relative;
    }

    .flow__src summary,
    a.flow__kb {
        font-size: 12.5px;
    }

    .flow__src-body {
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 8px);
        width: auto;
        max-height: 60svh;
        overflow: auto;
        margin: 0;
        box-shadow: var(--shadow);
    }
}

/* ============================================
   График: поток вещества. Чёрная сцена, всё белое —
   потоки собраны из частиц одинаковой плотности,
   узлы — матрицы точек, подписи — мелкий моноширинный
   капс, как в технических чертежах. Сцена тёмная
   в обеих темах сайта.
   ============================================ */
.flow__canvas {
    /* сцена в цветах сайта: фон и «чернила» те же, что у страницы,
       в светлой и тёмной теме они меняются вместе с сайтом */
    --scene: var(--bg);
    background: var(--scene);
    border: 1px solid var(--line);
    border-radius: 2px;
    isolation: isolate;
}

/* едва заметное плёночное зерно поверх сцены */
.flow__canvas::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
    mix-blend-mode: soft-light;
}

.flow__dust {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.flow__canvas .flow__svg {
    position: relative;
    z-index: 1;
}

.flow__canvas .flow__svg text {
    stroke: var(--scene);
    stroke-width: calc(5px * var(--fxl, 1));
}

/* подписи: мелкий моноширинный капс; числа — тем же шрифтом, крупнее */
.flow__canvas .flow__svg .ln,
.flow__canvas .flow__svg .lc,
.flow__canvas .flow__svg .ll,
.flow__canvas .flow__svg .lin {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: calc(10.5px * var(--fxl, 1));
    font-weight: 400;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.flow__canvas .flow__svg .ln { fill: var(--ink); }
.flow__canvas .flow__svg .lc { fill: var(--ink); font-weight: 500; }
.flow__canvas .flow__svg .lin { fill: var(--ink-soft); }
.flow__canvas .flow__svg .ll { fill: var(--ink-soft); }

.flow__canvas .flow__svg .lv {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: calc(14px * var(--fxl, 1));
    font-weight: 300;
    letter-spacing: .02em;
    fill: var(--ink);
}

/* узлы: каналы и потери закрашены узором точек из JS; конверсия — сплошная */
.flow__canvas .flow__svg .c { fill: var(--ink); }
.flow__canvas .flow__svg .pd { fill: var(--ink); }
.flow__canvas .flow__svg .l-edge {
    stroke: var(--ink);
    stroke-opacity: .45;
    stroke-width: 1px;
    stroke-dasharray: 2 4;
    vector-effect: non-scaling-stroke;
}

/* кромки лент — тонкие линии, как каркас на чертеже */
.flow__canvas .flow__svg .edge {
    fill: none;
    stroke: #fff;
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    stroke-opacity: .16;
}

.flow__canvas .flow__svg .edge--in { stroke-opacity: .09; }
.flow__canvas .flow__svg .edge--loss { stroke-opacity: .06; }

/* соседние этапы приглушены */
.flow__canvas .stage-layer:not(.is-active-stage) .c:not(.c-in) {
    opacity: 0;
}

.flow__canvas .stage-layer:not(.is-active-stage) .c-in {
    opacity: .3;
}

/* легенда под графиком — тем же языком: матрица, сплошная, пыль */
.flow__legend i {
    box-shadow: none;
    background-color: transparent !important;
}

.flow__legend span:nth-child(1) i { background: radial-gradient(circle, currentColor 45%, transparent 50%) 0 0 / 3px 3px !important; }
.flow__legend span:nth-child(2) i { background: currentColor !important; }
.flow__legend span:nth-child(3) i { background: radial-gradient(circle, currentColor 35%, transparent 40%) 0 0 / 6px 5px !important; opacity: .7; }

/* на телефоне моноширинные подписи мельче, чтобы соседние не сходились */
@media (max-width: 640px) {
    .flow__canvas .flow__svg .ln,
    .flow__canvas .flow__svg .lc,
    .flow__canvas .flow__svg .ll,
    .flow__canvas .flow__svg .lin {
        font-size: calc(9px * var(--fxl, 1));
        letter-spacing: .06em;
    }
    .flow__canvas .flow__svg .lv {
        font-size: calc(12px * var(--fxl, 1));
    }
}
