/* Аналитический сайт: дерево драйверов, OST, карта процессов, покрытие.
   Токены и шрифты — из дизайн-системы researches/design (палитра «Атласа целей»). */

:root {
  --bg: #F5F6F3; --surface: #FBFBF9; --surface-2: #F0F2ED; --surface-3: #E7EAE3;
  --ink: #242C2E; --ink-soft: #535F5E; --ink-faint: #79847F; --line: #DCE0D8; --line-strong: #C5CBC1;
  --accent: #0E6A6E; --accent-soft: #E2EDEB;
  --good: #1F6B46; --good-bg: #E0EEE4; --warn: #8F650E; --warn-bg: #F2EBD6; --bad: #964E46; --bad-bg: #F2E2DF;
  --c-outcome: #0E6A6E; --c-driver: #4A549E; --c-metric: #535F5E; --c-guard: #964E46; --c-count: #79847F;
  --c-moment: #8A4E74; --c-opp: #96660F; --c-sol: #43744A; --c-alt: #79847F; --c-hyp: #8A4E74; --c-test: #0E6A6E;
  --c-astra: #4A549E; --c-opus: #0E6A6E; --c-coord: #8A4E74;
  --shadow: 0 1px 2px rgba(36,44,46,.06), 0 4px 16px rgba(36,44,46,.06);
  --shadow-lg: 0 12px 48px rgba(20,25,27,.22);
  --radius: 10px; --radius-sm: 6px;
  --font-display: "Piazzolla", Georgia, serif;
  --font-text: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --topbar-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14191B; --surface: #1A2123; --surface-2: #1F282A; --surface-3: #263032;
    --ink: #DBE2DF; --ink-soft: #A0ABA7; --ink-faint: #75807D; --line: #2C3537; --line-strong: #3A4547;
    --accent: #5FB8B6; --accent-soft: #1D3335;
    --good: #74C79A; --good-bg: #1C3126; --warn: #D3AC59; --warn-bg: #322B17; --bad: #D68F87; --bad-bg: #34211F;
    --c-outcome: #5FB8B6; --c-driver: #9BA6E8; --c-metric: #A0ABA7; --c-guard: #D68F87; --c-count: #75807D;
    --c-moment: #CE96BB; --c-opp: #D6A854; --c-sol: #8FC08E; --c-alt: #75807D; --c-hyp: #CE96BB; --c-test: #5FB8B6;
    --c-astra: #9BA6E8; --c-opus: #5FB8B6; --c-coord: #CE96BB;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14191B; --surface: #1A2123; --surface-2: #1F282A; --surface-3: #263032;
  --ink: #DBE2DF; --ink-soft: #A0ABA7; --ink-faint: #75807D; --line: #2C3537; --line-strong: #3A4547;
  --accent: #5FB8B6; --accent-soft: #1D3335;
  --good: #74C79A; --good-bg: #1C3126; --warn: #D3AC59; --warn-bg: #322B17; --bad: #D68F87; --bad-bg: #34211F;
  --c-outcome: #5FB8B6; --c-driver: #9BA6E8; --c-metric: #A0ABA7; --c-guard: #D68F87; --c-count: #75807D;
  --c-moment: #CE96BB; --c-opp: #D6A854; --c-sol: #8FC08E; --c-alt: #75807D; --c-hyp: #CE96BB; --c-test: #5FB8B6;
  --c-astra: #9BA6E8; --c-opus: #5FB8B6; --c-coord: #CE96BB;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font-text); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
code, .mono { font-family: var(--font-mono); font-size: .86em; }
button { font: inherit; color: inherit; }
kbd { font: 500 11px/1 var(--font-mono); padding: 3px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- верхняя панель ---------- */
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 18px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--surface); display: grid; place-items: center; font: 700 13px/1 var(--font-mono); }
.brand-title { font: 600 15px/1.1 var(--font-display); }
.brand-sub { display: block; font: 400 11px/1.2 var(--font-text); color: var(--ink-faint); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-soft); font-weight: 500; white-space: nowrap; font-size: 14px; }
.tabs a:hover { background: var(--surface-2); color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.tabs a[aria-current="page"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -9px; height: 2px; background: var(--accent); border-radius: 2px; }
.tools { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font-size: 13.5px; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
@media (max-width: 760px) { .brand-text { display: none; } .search-btn .label, .search-btn kbd { display: none; } .topbar { gap: 10px; padding: 0 12px; } }

/* ---------- каркас страниц ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }
.wrap.wide { max-width: none; }
.page-head { margin: 4px 0 20px; }
.kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; font: 500 12px/1.3 var(--font-mono); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 36px); margin: 0 0 10px; }
.essence { font-size: 16.5px; color: var(--ink-soft); max-width: 900px; margin: 0; }
.section { margin: 36px 0 0; }
.section > h2 { font-size: 22px; margin: 0 0 6px; }
.section > .lead { color: var(--ink-soft); margin: 0 0 16px; max-width: 900px; }
@media (max-width: 700px) { .wrap { padding: 20px 16px 48px; } }

/* ---------- чипы, теги, бейджи ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font: 500 11.5px/1.5 var(--font-text); background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.chip.mono { font-family: var(--font-mono); font-size: 11px; }
.chip.t-astra { color: var(--c-astra); border-color: color-mix(in srgb, var(--c-astra) 35%, transparent); }
.chip.t-opus { color: var(--c-opus); border-color: color-mix(in srgb, var(--c-opus) 35%, transparent); }
.chip.t-coord { color: var(--c-coord); border-color: color-mix(in srgb, var(--c-coord) 35%, transparent); }
.chip.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.solid { background: var(--ink); color: var(--surface); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }
.idtag { font: 600 11px/1 var(--font-mono); color: var(--ink-faint); letter-spacing: .02em; }
a.ref { font: 500 12px/1.4 var(--font-mono); text-decoration: none; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
a.ref:hover { border-color: var(--accent); color: var(--accent); }
a.node-link { display: inline-flex; gap: 6px; align-items: baseline; text-decoration: none; color: var(--ink); padding: 2px 0; }
a.node-link .idtag { color: var(--accent); }
a.node-link:hover .nl-label { text-decoration: underline; }

/* ---------- карточки и сетки ---------- */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0 0 8px; }
.card .muted, .muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
a.card { display: block; text-decoration: none; color: var(--ink); transition: transform .15s, border-color .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.compact { padding: 12px 14px; font-size: 13.5px; }
.card .big { font: 600 30px/1 var(--font-display); color: var(--ink); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 12.5px; color: var(--ink-soft); }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-bg); }
.callout.bad { border-color: var(--bad); background: var(--bad-bg); }
.callout.good { border-color: var(--good); background: var(--good-bg); }
.callout .co-title { font-weight: 600; margin: 0 0 4px; }
.callout p { margin: 0; }

/* ---------- таблицы ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--ink-soft); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable::after { content: ' ↕'; color: var(--ink-faint); font-size: 11px; }
table.data th[aria-sort="ascending"]::after { content: ' ↑'; color: var(--accent); }
table.data th[aria-sort="descending"]::after { content: ' ↓'; color: var(--accent); }

/* ---------- панель инструментов холста ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
.toolbar .group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar .group-label { font: 500 11.5px/1 var(--font-text); color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 12.5px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.input { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; min-width: 0; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

/* ---------- холст с панорамой и масштабом ---------- */
.canvas { position: relative; height: min(76vh, 900px); min-height: 460px; overflow: hidden; background:
  radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px, var(--bg);
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); cursor: grab; touch-action: none; }
.canvas.panning { cursor: grabbing; }
.canvas.panning * { user-select: none; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; padding: 40px; }
.zoom-ctl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.zoom-ctl button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 16px; box-shadow: var(--shadow); }
.zoom-ctl button:hover { border-color: var(--accent); }
.zoom-level { position: absolute; left: 12px; bottom: 12px; font: 500 11px/1 var(--font-mono); color: var(--ink-faint); background: var(--surface); padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line); z-index: 5; }
.canvas-hint { position: absolute; left: 12px; top: 12px; z-index: 5; font-size: 12px; color: var(--ink-faint); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 4px 8px; border-radius: 6px; pointer-events: none; }

/* ---------- дерево (горизонтальное, CSS) ---------- */
/* узлы выровнены по верху; все связи крепятся на высоте --at от верха карточки */
.forest { display: flex; align-items: flex-start; gap: 72px; }
.forest-col { display: flex; flex-direction: column; gap: 10px; }
.forest-col > .forest-title { font: 600 11.5px/1.2 var(--font-text); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 0 0 6px 2px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; --at: 22px; }
.tree { display: flex; flex-direction: column; gap: 22px; }
.tree li { display: flex; align-items: flex-start; position: relative; }
.t-row { display: flex; align-items: flex-start; }
.t-kids { display: flex; flex-direction: column; position: relative; padding-left: 40px; }
.t-kids > li { position: relative; padding-left: 26px; }
.t-kids > li:not(:last-child) { padding-bottom: 12px; }
.t-kids.gap-lg > li:not(:last-child) { padding-bottom: 16px; }
.t-kids > li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--line-strong); }
.t-kids > li:last-child::before { bottom: auto; height: var(--at); }
.t-kids > li:only-child::before { display: none; }
.t-kids > li::after { content: ''; position: absolute; left: 0; top: var(--at); width: 26px; border-top: 2px solid var(--edge, var(--line-strong)); }
.t-kids::before { content: ''; position: absolute; left: 0; top: var(--at); width: 40px; border-top: 2px solid var(--line-strong); }
.t-kids > li.e-influence::after { border-top-style: dashed; border-top-color: var(--c-driver); }
.t-kids > li.e-constraint::after { border-top-style: dotted; border-top-color: var(--c-guard); }
.t-kids > li.e-identity::after { border-top-color: var(--ink-soft); }
.t-kids > li.e-addresses::after { border-top-color: var(--c-sol); }
.t-kids.gap-lg { gap: 18px; }
.t-kids.hidden { display: none; }
.edge-badge { position: absolute; left: 4px; top: var(--at); transform: translateY(calc(-100% - 2px)); font: 700 10.5px/1 var(--font-mono); color: var(--ink-soft); background: var(--bg); padding: 1px 3px; border-radius: 4px; z-index: 1; white-space: nowrap; }
.edge-badge.neg { color: var(--bad); }
.edge-badge.pos { color: var(--good); }
.tree li.dim > .t-row > .node { opacity: .28; }
.tree li.path > .t-row > .node { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

/* узел дерева */
.node { position: relative; width: var(--w, 240px); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--tone, var(--line-strong)); border-radius: 9px; padding: 9px 11px 9px 11px; box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .15s, transform .15s, opacity .2s; text-align: left; font: inherit; color: inherit; display: block; }
.node:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--tone, var(--accent)) 55%, transparent), var(--shadow); }
.node.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow); } 20%, 60% { box-shadow: 0 0 0 4px var(--accent), var(--shadow); } }
.node .n-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.node .n-type { font: 600 10px/1.2 var(--font-text); text-transform: uppercase; letter-spacing: .05em; color: var(--tone, var(--ink-faint)); }
.node .n-id { font: 600 10.5px/1 var(--font-mono); color: var(--ink-faint); margin-left: auto; }
.node .n-label { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.node .n-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.node .n-formula { margin-top: 4px; font: 11px/1.35 var(--font-mono); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .n-target { margin-top: 4px; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .mini { font: 500 10.5px/1.5 var(--font-text); padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.node .mini.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.node .mini.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.node .mini.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.node .mini.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.node.k-outcome { --tone: var(--c-outcome); background: color-mix(in srgb, var(--c-outcome) 9%, var(--surface)); }
.node.k-outcome .n-label { font: 600 15px/1.3 var(--font-display); }
.node.k-driver { --tone: var(--c-driver); }
.node.k-metric { --tone: var(--c-metric); }
.node.k-count { --tone: var(--c-count); border-style: dashed; border-left-style: solid; }
.node.k-guardrail { --tone: var(--c-guard); background: color-mix(in srgb, var(--c-guard) 6%, var(--surface)); }
.node.k-moment { --tone: var(--c-moment); background: color-mix(in srgb, var(--c-moment) 8%, var(--surface)); }
.node.k-moment .n-label { font: 600 14.5px/1.3 var(--font-display); }
.node.k-group, .node.k-opportunity { --tone: var(--c-opp); }
.node.k-solution { --tone: var(--c-sol); }
.node.k-alt { --tone: var(--c-alt); border-style: dashed; border-left-style: solid; background: var(--surface-2); }
.node.k-dnode { --tone: var(--accent); }
.node.target-opp { box-shadow: 0 0 0 2px var(--c-opp), var(--shadow); }
.node .toggle { position: absolute; right: -13px; top: calc(var(--at, 22px) - 12px); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); font: 600 10.5px/1 var(--font-mono); color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; z-index: 2; padding: 0; }
.node .toggle:hover { border-color: var(--accent); color: var(--accent); }
.status-core { --st: var(--good); }
.links-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.links-svg path { fill: none; stroke-width: 2; }
.links-svg .conflict { stroke: var(--bad); stroke-dasharray: 7 5; }
.links-svg .influence { stroke: var(--c-driver); stroke-dasharray: 4 4; }
.links-svg text { font: 600 11px var(--font-mono); fill: var(--bad); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.links-svg text.infl { fill: var(--c-driver); }

/* ---------- легенда ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--ink-soft); padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-top: 0; }
.legend .li { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); border-left: 4px solid var(--tone); background: var(--surface); }
.legend .ln { width: 26px; height: 0; border-top: 2px solid var(--ink-soft); }
.legend .ln.dash { border-top-style: dashed; border-top-color: var(--c-driver); }
.legend .ln.dot { border-top-style: dotted; border-top-color: var(--c-guard); }
.legend .ln.red { border-top-style: dashed; border-top-color: var(--bad); }

/* ---------- вкладки внутри страницы ---------- */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.subtabs button { border: 0; background: transparent; padding: 9px 14px; cursor: pointer; font-weight: 500; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.subtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.subtabs button .cnt { font: 500 11px/1 var(--font-mono); color: var(--ink-faint); margin-left: 4px; }
.tabpanel[hidden] { display: none; }

/* ---------- выдвижная панель ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20,25,27,.32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform .24s cubic-bezier(.2,.8,.2,1); z-index: 70; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.drawer-head .crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; flex: 1; }
.drawer-head .nav-btns { display: flex; gap: 4px; }
.drawer-body { overflow-y: auto; padding: 18px 22px 40px; flex: 1; overscroll-behavior: contain; }
.drawer h2 { font-size: 22px; margin: 4px 0 12px; }
.drawer .d-sec { margin: 18px 0 0; }
.drawer .d-sec > h3 { font: 600 12px/1.3 var(--font-text); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 0 0 8px; }
.drawer p { margin: 0 0 8px; }
.drawer ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.drawer ul.dots { margin: 0; padding-left: 18px; }
.drawer ul.dots li { margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 12px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; }
.formula { font: 12.5px/1.5 var(--font-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.pair .who { font: 600 11px/1 var(--font-mono); margin-bottom: 6px; display: block; }
.pair .who.a { color: var(--c-astra); }
.pair .who.o { color: var(--c-opus); }
@media (max-width: 560px) { .pair { grid-template-columns: 1fr; } .drawer-body { padding: 16px 16px 40px; } }
.claim-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.claim-list li { border-left: 3px solid var(--c-hyp); background: var(--surface-2); padding: 7px 10px; border-radius: 0 6px 6px 0; font-size: 13px; }
.claim-list li .idtag { display: block; margin-bottom: 3px; }
.rel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rel-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.rel-list li:last-child { border-bottom: 0; }
.rel-list .chips { margin-left: auto; flex: none; }
.effect { display: inline-flex; gap: 4px; align-items: center; }
.effect .arr { font-weight: 700; }
.effect .arr.up { color: var(--good); }
.effect .arr.down { color: var(--accent); }

/* ---------- палитра поиска ---------- */
.palette { position: fixed; inset: 0; z-index: 90; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(20,25,27,.35); }
.palette.open { display: flex; }
.palette-box { width: min(680px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; font-size: 16px; background: var(--surface); color: var(--ink); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.palette li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.palette li[aria-selected="true"], .palette li:hover { background: var(--accent-soft); }
.palette li .pt { font: 600 10.5px/1 var(--font-text); text-transform: uppercase; color: var(--ink-faint); width: 96px; flex: none; }
.palette li .pl { flex: 1; min-width: 0; }
.palette .pempty { padding: 16px; color: var(--ink-faint); }

/* ---------- процессы ---------- */
.proc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .proc-layout { grid-template-columns: minmax(0, 1fr); } }
.proc-nav { position: sticky; top: calc(var(--topbar-h) + 16px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; }
.proc-nav h4 { font: 600 11px/1.2 var(--font-text); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 12px 8px 6px; }
.proc-nav h4:first-child { margin-top: 4px; }
.proc-nav button { display: flex; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; line-height: 1.3; color: var(--ink-soft); }
.proc-nav button:hover { background: var(--surface-2); color: var(--ink); }
.proc-nav button[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.proc-nav .pid { font: 600 11px/1.3 var(--font-mono); color: var(--ink-faint); flex: none; width: 28px; padding-top: 1px; }
@media (max-width: 980px) { .proc-nav { position: static; max-height: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px; } .proc-nav h4 { display: none; } .proc-nav button { flex: none; width: auto; white-space: nowrap; } }
.value-chain { display: flex; gap: 0; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.vc { flex: 1 0 auto; min-width: 120px; position: relative; padding: 12px 22px 12px 26px; background: var(--surface); border: 1px solid var(--line); margin-right: -1px; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.vc:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); padding-left: 16px; }
.vc:hover, .vc[aria-pressed="true"] { background: var(--accent-soft); }
.vc .vn { font: 600 10.5px/1 var(--font-mono); color: var(--ink-faint); }
.vc .vl { font-weight: 600; font-size: 13.5px; display: block; margin-top: 3px; }
.vc .vs { font-size: 11.5px; color: var(--ink-faint); display: block; margin-top: 2px; }
.flow-wrap { position: relative; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.flow { position: relative; display: grid; gap: 22px 26px; padding: 0 22px 26px; min-width: min-content; }
.lane-head { position: sticky; top: 0; z-index: 3; font: 600 11.5px/1.2 var(--font-text); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: center; margin: 0 -13px; }
.lane-bg { border-left: 1px dashed var(--line); border-right: 1px dashed var(--line); margin: 0 -13px; pointer-events: none; }
.step { position: relative; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; box-shadow: var(--shadow); cursor: pointer; font: inherit; color: inherit; text-align: left; min-width: 0; align-self: center; transition: box-shadow .15s; }
.step:hover { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.step .s-id { font: 600 10px/1 var(--font-mono); color: var(--ink-faint); display: block; margin-bottom: 4px; }
.step .s-label { font-size: 13px; font-weight: 500; line-height: 1.35; }
.step .s-marks { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.step.k-start, .step.k-end { border-radius: 22px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.step.k-decision { border: 1.5px solid var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.step.k-decision .s-label::before { content: '◇ '; color: var(--warn); }
.step.has-link::after { content: '↗'; position: absolute; right: 8px; top: 6px; font-size: 12px; color: var(--accent); }
.flow-svg { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; overflow: visible; }
.flow-svg path { fill: none; stroke: var(--line-strong); stroke-width: 1.8; }
.flow-svg path.back { stroke-dasharray: 5 4; }
.flow-svg text { font: 500 11px var(--font-text); fill: var(--ink-soft); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
.flow-svg marker path { fill: var(--line-strong); stroke: none; }
.matrix th.col { color: var(--surface); }
.matrix td { font-size: 13px; }
.mx-P0 { background: var(--bad); } .mx-P1 { background: var(--warn); } .mx-P2 { background: var(--accent); } .mx-P3 { background: var(--ink-faint); }
.proc-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; justify-content: space-between; margin: 0 0 12px; }
.proc-head h2 { margin: 0 0 6px; font-size: 24px; }
.proc-head p { margin: 0; color: var(--ink-soft); max-width: 860px; }

/* ---------- обзор ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; align-items: start; }
@media (max-width: 900px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.flowline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; position: relative; }
@media (max-width: 800px) { .flowline { grid-template-columns: minmax(0, 1fr); } }
.flowline .card { position: relative; }
.flowline .num { font: 600 12px/1 var(--font-mono); color: var(--accent); }
.bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.bar.partial > span { background: var(--warn); }
.cov-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.cov-row:last-child { border-bottom: 0; }
.cov-row .n { font: 600 12.5px/1 var(--font-mono); text-align: right; }
@media (max-width: 560px) { .cov-row { grid-template-columns: minmax(0, 1fr) 70px; } .cov-row .bar { grid-column: 1 / -1; } }
.lint-row { display: grid; grid-template-columns: 24px 64px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.lint-row:last-child { border-bottom: 0; }
.lint-row .res { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--font-text); }
.res.pass { background: var(--good-bg); color: var(--good); }
.res.fail { background: var(--bad-bg); color: var(--bad); }
.res.warn { background: var(--warn-bg); color: var(--warn); }
.res.unknown { background: var(--surface-3); color: var(--ink-soft); }
.lint-row .rt { font-weight: 500; }
.lint-row .rd { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.funnel { display: flex; flex-direction: column; gap: 4px; }
.fn-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 13px; }
.fn-bar { height: 22px; border-radius: 5px; background: color-mix(in srgb, var(--c-driver) 22%, var(--surface)); position: relative; }
.fn-bar > span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 12px; color: var(--ink); }
.fn-bar.neg { background: color-mix(in srgb, var(--bad) 18%, var(--surface)); }
.fn-bar.push { background: color-mix(in srgb, var(--c-sol) 30%, var(--surface)); }
.fn-row .v { font: 600 12.5px/1 var(--font-mono); text-align: right; }
.loop { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.loop .st { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; }
.loop .ar { color: var(--ink-faint); }
.matrix-2x2 { position: relative; aspect-ratio: 1.5 / 1; min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.matrix-2x2 .q { position: absolute; width: 50%; height: 50%; padding: 10px 12px; font: 600 11px/1.3 var(--font-text); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.matrix-2x2 .q.hot { background: color-mix(in srgb, var(--bad) 7%, transparent); color: var(--bad); }
.matrix-2x2 .dotn { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--c-hyp); background: var(--surface); font: 600 9.5px/1 var(--font-mono); display: grid; place-items: center; cursor: pointer; color: var(--ink); z-index: 2; transition: transform .12s; }
.matrix-2x2 .dotn:hover { transform: translate(-50%, -50%) scale(1.18); z-index: 3; }
.matrix-2x2 .dotn.dis { border-style: dashed; }
.axis-x, .axis-y { position: absolute; font: 500 11.5px/1.2 var(--font-text); color: var(--ink-soft); }
.axis-x { bottom: 6px; left: 50%; transform: translateX(-50%); }
.axis-y { left: 6px; top: 50%; transform: rotate(-90deg) translateX(-50%); transform-origin: left top; }
.outline { list-style: none; padding-left: 0; margin: 0; }
.outline ul { list-style: none; padding-left: 20px; margin: 4px 0 4px 8px; border-left: 1px dashed var(--line-strong); }
.outline li { margin: 3px 0; }
.outline button.o-item { display: flex; gap: 8px; align-items: baseline; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 4px 6px; border-radius: 6px; width: 100%; font: inherit; color: inherit; }
.outline button.o-item:hover { background: var(--surface-2); }
.foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.empty-note { padding: 20px; text-align: center; color: var(--ink-faint); }
@media print { .topbar, .toolbar, .zoom-ctl, .drawer, .scrim { display: none !important; } }

/* ---------- доска OST: результат сверху, моменты в ряд, вложенные деревья ---------- */
.ost-scroll { overflow-x: auto; padding: 4px 2px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background:
  radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px, var(--bg); }
.ost-board { min-width: 1500px; padding: 20px 18px 8px; }
.ost-root-wrap { display: flex; justify-content: center; }
.ost-root { max-width: 760px; width: 100%; }
.ost-cols { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-top: 30px; padding-top: 22px; }
.ost-cols::before { content: ''; position: absolute; top: 0; left: var(--bus-l, 8%); right: var(--bus-r, 8%); border-top: 2px solid var(--line-strong); }
.vt-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ost-cols::after { content: ''; position: absolute; top: -30px; left: 50%; height: 30px; border-left: 2px solid var(--line-strong); }
.ost-col { position: relative; min-width: 0; }
.ost-col::before { content: ''; position: absolute; top: -22px; left: 50%; height: 22px; border-left: 2px solid var(--line-strong); }
.ost-col > .node { width: 100%; }
.vt, .vt ul { list-style: none; margin: 0; padding: 0; }
.vt ul, .ost-col > .vt { margin-left: 12px; padding-left: 14px; border-left: 2px solid var(--line-strong); }
.vt li { position: relative; margin: 10px 0 0; }
.vt li::before { content: ''; position: absolute; left: -14px; top: 20px; width: 12px; border-top: 2px solid var(--line-strong); }
.vt li:last-child::after { content: ''; position: absolute; left: -17px; top: 21px; bottom: -2px; width: 5px; background: var(--bg); }
.vt li.sol-li::before { border-top-color: color-mix(in srgb, var(--c-sol) 55%, var(--line-strong)); }
.vt .node { width: 100%; padding: 8px 10px; }
.vt .node .n-label { font-size: 13px; }
.vt .sols.hidden { display: none; }
.node.k-solution { padding: 7px 9px; }
.node.k-solution .n-label { font-size: 12.5px; font-weight: 500; }
.node .stripe { position: absolute; left: -4px; top: -1px; bottom: -1px; width: 4px; border-radius: 9px 0 0 9px; }
.node .sol-toggle { margin-top: 7px; display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1 var(--font-text); color: var(--c-sol); background: color-mix(in srgb, var(--c-sol) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c-sol) 30%, transparent); padding: 4px 8px; border-radius: 999px; cursor: pointer; }
.node .sol-toggle:hover { border-color: var(--c-sol); }
.node.dimmed { opacity: .3; }
.node.k-opportunity.target-opp::after { content: 'целевая'; position: absolute; right: 8px; bottom: 8px; font: 600 10px/1 var(--font-text); color: var(--c-opp); text-transform: uppercase; letter-spacing: .05em; }
.node .warn-mark { color: var(--warn); font-weight: 700; }
.out-card { border-left: 5px solid var(--c-outcome); background: color-mix(in srgb, var(--c-outcome) 7%, var(--surface)); cursor: pointer; }
.out-card h2 { font-size: 21px; margin: 4px 0 8px; }
.out-card .kv { font-size: 13px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
select.input { padding-right: 26px; }
.outline button.o-item { flex-wrap: wrap; }
.outline button.o-item > span:nth-child(2) { flex: 1 1 180px; min-width: 0; }
@media (max-width: 640px) { .outline ul { padding-left: 10px; margin-left: 4px; } }
