/* Шрифты локально: CSP запрещает внешние источники. Inter и JetBrains Mono — SIL OFL 1.1 (fonts/OFL-*.txt). */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter-latin-400-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter-cyrillic-400-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter-latin-500-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter-cyrillic-500-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter-latin-600-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter-cyrillic-600-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter-latin-700-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter-cyrillic-700-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/jetbrains-mono-cyrillic-400-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/jetbrains-mono-latin-600-normal.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/jetbrains-mono-cyrillic-600-normal.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
:root {
  --ink: #14161a;
  --ink2: #454b55;
  --mute: #6b727d;
  --line: #e3e6eb;
  --panel: #f4f5f8;
  --bg: #fafbfc;
  --red: #e0262d;
  --red2: #fce9ea;
  --amber: #e8930c;
  --amber2: #fdf2df;
  --green: #1e9e63;
  --green2: #e3f4ec;
  --gray: #9aa0a9;
  --gray2: #eef0f3;
  --blue: #2f6fed;
  --blue2: #e7eefd;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pw: 348px;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family:
    Inter,
    -apple-system,
    'Helvetica Neue',
    Arial,
    sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mono {
  font-family: 'JetBrains Mono', Menlo, monospace;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}
svg.i {
  width: 16px;
  height: 16px;
  flex: none;
}
/* спрайт иконок в index.html; не style-атрибутом: CSP без 'unsafe-inline' */
.sprite {
  position: absolute;
}
/* top */
.top {
  flex: none;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.logo {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.logo b {
  color: var(--red);
}
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink2);
  font-size: 13px;
  white-space: nowrap;
}
.crumb svg {
  color: var(--mute);
}
.crumb .sl {
  color: #c3c7ce;
  margin: 0 2px;
}
.crumb {
  min-width: 0;
}
/* длинное имя пода сжимается первым, а не выталкивает кнопку агента за край */
.crumb b {
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.syn {
  font-size: 12px;
  color: var(--mute);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}
.sp {
  flex: 1;
}
.legend {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink2);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.legend svg {
  width: 12px;
  height: 12px;
}
/* stage */
.stage {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.stage.panning #cv {
  cursor: grabbing;
}
.band {
  fill: #f2f3f6;
}
.blabel {
  font-size: 12px;
  font-weight: 600;
  fill: #8a909a;
  letter-spacing: 0.02em;
}
/* nodes */
.node {
  cursor: pointer;
  transition:
    opacity 0.18s var(--ease),
    transform 0.22s var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}
.node .card {
  fill: #fff;
  stroke: var(--line);
  stroke-width: 1;
  transition:
    stroke 0.15s,
    filter 0.15s;
}
.node .card.dash {
  stroke: var(--amber);
  stroke-dasharray: 5 4;
  stroke-width: 1.5;
  fill: #fffbf3;
}
.node .stk {
  fill: #fff;
  stroke: #d6dae0;
}
.node .tile {
  transition: transform 0.18s var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}
.node[data-s='bad'] .tile rect {
  fill: var(--red2);
}
.node[data-s='bad'] .tile use {
  color: var(--red);
}
.node[data-s='new'] .tile rect {
  fill: var(--amber2);
}
.node[data-s='new'] .tile use {
  color: #b86d05;
}
.node[data-s='ok'] .tile rect {
  fill: var(--green2);
}
.node[data-s='ok'] .tile use {
  color: var(--green);
}
.node[data-s='bg'] .tile rect {
  fill: var(--gray2);
}
.node[data-s='bg'] .tile use {
  color: #7c838e;
}
.node .t {
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}
.node .s {
  font-size: 12px;
  fill: var(--mute);
  font-family: 'JetBrains Mono', Menlo, monospace;
}
.node .cnt rect {
  fill: var(--ink);
}
.node[data-s='bg'] .cnt rect,
.node[data-s='ok'] .cnt rect {
  fill: #7c838e;
}
.node .cnt text {
  fill: #fff;
  font-size: 12px;
  font-weight: 700;
}
.node:hover .card,
.node.hov .card {
  stroke: #a9afb8;
  filter: drop-shadow(0 4px 10px rgba(20, 22, 26, 0.12));
}
.node.hov .tile {
  transform: scale(1.08);
}
.node.sel .card {
  stroke: var(--blue);
}
.node.gone {
  opacity: 0 !important;
  pointer-events: none;
}
.node.in {
  animation: appear 0.24s var(--ease) both;
  animation-delay: calc(var(--lv) * 35ms);
}
@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* collapse toggle */
.tog {
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.tog circle {
  fill: #fff;
  stroke: #c3c7ce;
}
.tog use {
  color: var(--ink2);
}
.tog .pill {
  display: none;
}
.node:hover .tog,
.node.hov .tog,
.node.sel .tog {
  opacity: 1;
}
.tog:hover circle {
  stroke: var(--blue);
}
.tog:hover use {
  color: var(--blue);
}
.node.coll .tog {
  opacity: 1;
}
.node.coll .tog .dot {
  display: none;
}
.node.coll .tog .pill {
  display: inline;
}
.tog .pill rect {
  fill: var(--ink);
}
.tog .pill.hasbad rect {
  fill: var(--red);
}
.tog .pill text {
  fill: #fff;
  font-size: 12px;
  font-weight: 700;
}
.tog .pill use {
  color: #fff;
}
/* edges */
.edge {
  transition: opacity 0.18s var(--ease);
}
.edge .ln {
  fill: none;
  stroke: #c9ced6;
  stroke-width: 1.5;
  transition:
    stroke 0.18s,
    stroke-width 0.18s;
}
.edge.e-new .ln {
  stroke: #edb25a;
  stroke-width: 1.8;
}
.edge.e-bad .ln {
  stroke: #e86a6f;
  stroke-width: 2;
}
.edge.dsh .ln {
  stroke-dasharray: 4 4;
}
.edge .fl {
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1 17;
  opacity: 0.9;
  animation: flow 1.8s linear infinite;
}
.edge.e-bad .fl {
  stroke: #fff;
}
@keyframes flow {
  to {
    stroke-dashoffset: -18;
  }
}
.edge.gone {
  opacity: 0 !important;
}
.edge.rel .ln {
  stroke-width: 2.6;
}
.edge.rel.e-ok .ln,
.edge.rel.e-bg .ln {
  stroke: #7c838e;
}
.edge.rel.e-bad .ln {
  stroke: var(--red);
}
.edge.rel.e-new .ln {
  stroke: var(--amber);
}
.edge.chain .ln {
  stroke: var(--blue) !important;
  stroke-width: 3;
}
.edge.rel .fl {
  animation-duration: 1s;
}
#world.dim .node:not(.rel) {
  opacity: 0.42;
}
#world.dim .edge:not(.rel):not(.chain) {
  opacity: 0.3;
}
#world.dimS .node:not(.rel) {
  opacity: 0.16;
}
#world.dimS .edge:not(.rel) {
  opacity: 0.08;
}
/* selection ring */
#ringg {
  transition: transform 0.22s var(--ease);
  pointer-events: none;
}
#ring {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  transform-box: fill-box;
  transform-origin: center;
}
#halo {
  fill: none;
  stroke: var(--blue);
  stroke-opacity: 0.16;
  stroke-width: 8;
}
#ringg.off {
  opacity: 0;
}
#ring.pop {
  animation: pop 0.22s var(--ease);
}
@keyframes pop {
  from {
    transform: scale(1.07);
    stroke-opacity: 0;
  }
  to {
    transform: none;
    stroke-opacity: 1;
  }
}
#ring.bump {
  animation: bump 0.2s var(--ease);
}
@keyframes bump {
  50% {
    stroke-opacity: 0.25;
  }
}
/* overlays in stage */
.ctrls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 22, 26, 0.06);
  transition: right 0.2s var(--ease);
  z-index: 4;
}
.ctrls button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink2);
  border-radius: 9px;
}
.ctrls button:hover {
  background: var(--panel);
  color: var(--ink);
}
.ctrls .zl {
  width: auto;
  padding: 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  min-width: 52px;
  font-variant-numeric: tabular-nums;
}
.ctrls .div {
  width: 1px;
  height: 20px;
  background: var(--line);
}
.mini {
  position: absolute;
  right: 16px;
  bottom: 62px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 22, 26, 0.06);
  padding: 6px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease),
    right 0.2s var(--ease);
  z-index: 4;
}
.mini.on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.stage.askMode .mini {
  opacity: 0;
  pointer-events: none;
}
.mini svg {
  display: block;
  cursor: pointer;
}
.mini .mn {
  fill: #fff;
  stroke: #c3c7ce;
  stroke-width: 1.2;
}
.mini .mn[data-s='bad'] {
  fill: var(--red2);
  stroke: var(--red);
}
.mini .mn[data-s='new'] {
  fill: var(--amber2);
  stroke: var(--amber);
}
.mini .mn.sel {
  fill: var(--blue);
  stroke: var(--blue);
}
.mini .mn.gone {
  opacity: 0;
}
.mini #mvp {
  fill: rgba(47, 111, 237, 0.08);
  stroke: var(--blue);
  stroke-width: 1.5;
}
.stage.pOpen .ctrls,
.stage.pOpen .mini {
  right: calc(var(--pw) + 28px);
}
/* при открытой панели масштаб сдвигается влево и закрывал бы подсказки */
.stage.pOpen .hints {
  display: none;
}
.hints {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
  background: rgba(250, 251, 252, 0.9);
  padding: 6px 10px;
  border-radius: 8px;
  z-index: 3;
}
kbd {
  font-family: Inter, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink2);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  line-height: 18px;
  min-width: 20px;
  text-align: center;
  display: inline-block;
}
.hints i {
  font-style: normal;
  margin: 0 6px 0 2px;
}
/* panel */
.panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: var(--pw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(20, 22, 26, 0.1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
  transition:
    opacity 0.2s var(--ease),
    transform 0.2s var(--ease);
  z-index: 5;
}
.stage.pOpen .panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.ph {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px;
}
.ptile {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ptile svg {
  width: 22px;
  height: 22px;
}
.ph .tt {
  flex: 1;
  min-width: 0;
}
.ph .tt b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill-s {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}
.pill-s svg {
  width: 10px;
  height: 10px;
}
.s-bad {
  background: var(--red2);
  color: #b4161c;
}
.s-new {
  background: var(--amber2);
  color: #975a05;
}
.s-ok {
  background: var(--green2);
  color: #14724a;
}
.s-bg {
  background: var(--gray2);
  color: var(--ink2);
}
.t-bad {
  background: var(--red2);
  color: var(--red);
}
.t-new {
  background: var(--amber2);
  color: #b86d05;
}
.t-ok {
  background: var(--green2);
  color: var(--green);
}
.t-bg {
  background: var(--gray2);
  color: #7c838e;
}
.xbtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
}
.xbtn:hover {
  background: var(--panel);
  color: var(--ink);
}
.pb {
  flex: 1;
  overflow: auto;
  padding: 0 16px 16px;
}
.cmd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--panel);
  border-radius: 8px;
  padding: 9px 10px;
  line-height: 1.5;
  word-break: break-all;
  color: var(--ink);
}
.rows {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink2);
}
.rows div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rows svg {
  color: var(--mute);
}
.det {
  margin-top: 12px;
  background: var(--red2);
  color: #8e1a1f;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  display: flex;
  gap: 8px;
}
.det svg {
  color: var(--red);
  margin-top: 1px;
}
.h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  margin: 16px 0 6px;
}
.lnk {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 5px 6px;
  border-radius: 7px;
  font-size: 12.5px;
  transition: background 0.12s;
}
.lnk:hover,
.lnk.hot {
  background: var(--blue2);
}
.lnk .mt {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.lnk .mt svg {
  width: 13px;
  height: 13px;
}
.lnk span.x {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lnk .tm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--mute);
}
.path .lnk {
  padding-left: calc(6px + var(--d) * 10px);
}
.lnk.cur {
  background: var(--panel);
  font-weight: 600;
}
/* tooltip */
.tip {
  position: fixed;
  left: 0;
  top: 0;
  max-width: 330px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(20, 22, 26, 0.14);
  padding: 11px 12px;
  font-size: 12.5px;
  color: var(--ink2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.14s var(--ease),
    transform 0.14s var(--ease);
  z-index: 20;
}
.tip.on {
  opacity: 1;
  transform: none;
}
.tip .th {
  display: flex;
  align-items: center;
  gap: 9px;
}
.tip .th .ptile {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.tip .th .ptile svg {
  width: 17px;
  height: 17px;
}
.tip .th b {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
}
.tip .cmd {
  margin-top: 8px;
  font-size: 12px;
  padding: 7px 8px;
}
.tip .rows {
  margin-top: 8px;
  gap: 4px;
}
.tip .det {
  margin-top: 8px;
  padding: 7px 8px;
}
.tip .ft {
  margin-top: 8px;
  font-size: 12px;
  color: var(--mute);
}
/* timeline */
.tlw {
  flex: none;
  height: 184px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.tlh {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 0;
  font-size: 12.5px;
  color: var(--ink2);
}
.tlh b {
  font-weight: 600;
  color: var(--ink);
}
.tlh .more {
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 6px;
}
#tl {
  flex: 1;
  width: 100%;
  display: block;
}
.lane-l {
  font-size: 12px;
  fill: var(--ink2);
}
.lane-i {
  color: #8a909a;
}
.tick {
  font-size: 12px;
  fill: #8a909a;
}
.mk {
  cursor: pointer;
  transition: opacity 0.18s var(--ease);
}
.mk .v {
  transition: transform 0.15s var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}
.mk.hot .v {
  transform: scale(1.5);
}
.mk .hit {
  fill: transparent;
}
#tl.dim .mk:not(.on) {
  opacity: 0.3;
}
#tl.dimS .mk:not(.on) {
  opacity: 0.12;
}
#tl .mk.on.selm .v {
  stroke: var(--blue);
  stroke-width: 1.5;
}
#tlband {
  transition: opacity 0.18s;
}
/* ===== Чат-агент и режимы ответа ===== */
:root {
  --cw: 380px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (max-width: 1320px) {
  :root {
    --cw: 372px;
  }
  .top {
    gap: 10px;
  }
  .legend {
    gap: 10px;
  }
}
.app {
  flex: 1;
  display: flex;
  min-height: 0;
}
.mainc {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat {
  flex: none;
  width: var(--cw);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-left: 1px solid var(--line);
}
.app.cOff .chat {
  display: none;
}
.cbtn {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink2);
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s var(--ease-out);
}
.cbtn:hover {
  background: var(--panel);
}
.cbtn:active {
  transform: scale(0.97);
}
.cbtn[aria-pressed='true'] {
  background: var(--blue2);
  border-color: #bcd0fa;
  color: var(--blue);
}
.chd {
  flex: none;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.chd b {
  font-weight: 600;
}
.chd .m {
  color: var(--mute);
}
.chd .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}
.cbody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  /* длинные пути из данных переносятся, а не вылезают за пузырь */
  overflow-wrap: break-word;
  position: relative;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  animation: msgin 0.2s var(--ease-out) both;
}
@keyframes msgin {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
.mu {
  align-self: flex-end;
  max-width: 88%;
  background: var(--panel);
  border-radius: 12px 12px 4px 12px;
  padding: 8px 12px;
  line-height: 1.45;
}
.ma {
  line-height: 1.55;
}
.ma .ml {
  font-size: 12px;
  color: var(--mute);
  margin-top: 4px;
}
.think {
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 4px;
}
.think i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1s ease-in-out infinite;
}
.think i:nth-child(2) {
  animation-delay: 0.15s;
}
.think i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
.empty {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty .eh {
  font-size: 14px;
  font-weight: 600;
}
.empty .es {
  color: var(--mute);
  line-height: 1.45;
  margin-bottom: 6px;
}
.qchip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  background: #fff;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s var(--ease-out);
}
.qchip:hover {
  background: var(--panel);
  border-color: #d3d7de;
}
.qchip:active {
  transform: scale(0.98);
}
.qchip svg {
  color: var(--mute);
}
.qchip span {
  flex: 1;
}
.qchip em {
  font-style: normal;
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
}
.nchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.nchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  max-width: 100%;
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s var(--ease-out);
}
.nchip:hover {
  background: var(--panel);
}
.nchip:active {
  transform: scale(0.97);
}
.nchip.on {
  border-color: var(--blue);
  background: var(--blue2);
}
.nchip .mt {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.nchip .mt svg {
  width: 14px;
  height: 14px;
}
.nchip .x {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cin {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.cin input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
.cin input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue2);
}
.cin button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.1s var(--ease-out),
    opacity 0.12s;
}
.cin button:active {
  transform: scale(0.95);
}
.cin button:disabled {
  opacity: 0.35;
  cursor: default;
}
/* блок расследования */
.invb {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 10px 10px;
}
.invb .ih {
  display: flex;
  font-size: 12px;
  color: var(--mute);
  padding: 0 4px;
  white-space: pre;
}
.invb .ih span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.invb .ih .il {
  flex: none;
}
.invb .iv1 {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  text-wrap: balance;
  margin-top: 3px;
  padding: 0 4px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.steps {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 2px;
  width: 100%;
  text-align: left;
  padding: 7px 6px;
  border-radius: 9px;
  transition: background 0.12s;
}
.st:hover {
  background: var(--panel);
}
.st .n {
  grid-row: span 2;
  align-self: start;
  margin-top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #c3c7ce;
  color: var(--ink2);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.st.done .n {
  background: #7c838e;
  border-color: #7c838e;
  color: #fff;
}
.st.cur {
  background: var(--blue2);
}
.st.cur .n {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.st .l1 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.st .tm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--mute);
}
.st .vb {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.st .pill-s {
  margin: 0 0 0 auto;
  flex: none;
}
.st .ob {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st .nt {
  grid-column: 2;
  /* путь без пробелов не растягивает колонку шага */
  overflow-wrap: anywhere;
  font-size: 12.5px;
  color: var(--ink2);
  line-height: 1.45;
  margin-top: 3px;
  display: none;
}
.st.cur .nt {
  display: block;
}
.ictl {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 0 2px;
  /* длинное расследование (9 шагов на 1280×800) не уносит «Назад/Далее» под край чата */
  position: sticky;
  bottom: -16px;
  background: #fff;
  padding-block: 6px 10px;
  margin-bottom: -10px;
  z-index: 1;
}
.ictl .sp {
  flex: 1;
}
.btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink2);
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.1s var(--ease-out);
}
.btn:hover:not(:disabled) {
  background: var(--panel);
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn.pri {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn.pri:hover:not(:disabled) {
  background: #2a2e35;
}
.btn:disabled {
  opacity: 0.38;
  cursor: default;
}
.btn[aria-pressed='true'] {
  background: var(--blue2);
  border-color: #bcd0fa;
  color: var(--blue);
}
/* граф в режиме ответа: всё серое, проявлено только нужное */
#world.mode .node {
  opacity: 0.3;
  filter: grayscale(1);
  transition:
    opacity 0.2s var(--ease-out),
    filter 0.2s var(--ease-out),
    transform 0.22s var(--ease);
}
#world.mode .edge {
  opacity: 0.14;
  filter: grayscale(1);
  transition:
    opacity 0.2s var(--ease-out),
    filter 0.2s var(--ease-out);
}
#world.mode .node.iv,
#world.mode .edge.iv {
  opacity: 1;
  filter: none;
}
#world.mode .node.ic .card {
  stroke: var(--blue);
  stroke-width: 2;
}
#world.mode .edge.ec .ln {
  stroke: var(--blue);
  stroke-width: 3;
}
.nb {
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}
.nb circle {
  fill: #7c838e;
  stroke: #fff;
  stroke-width: 2;
}
.nb text {
  fill: #fff;
  font-size: 12px;
  font-weight: 700;
}
.nb.cur circle {
  fill: var(--blue);
}
.nb.pop {
  animation: nbin 0.2s var(--ease-out) both;
}
@keyframes nbin {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}
/* шкала: шаги расследования */
#tlcur {
  transition:
    transform 0.22s var(--ease-out),
    opacity 0.15s;
}
#tlcur.off {
  opacity: 0;
}
.tsb {
  cursor: pointer;
}
.tsb circle.v {
  fill: #fff;
  stroke: #c3c7ce;
  stroke-width: 1.5;
  transition:
    fill 0.15s,
    stroke 0.15s;
}
.tsb text {
  font-size: 11px;
  font-weight: 700;
  fill: var(--mute);
}
.tsb.done circle.v {
  fill: #7c838e;
  stroke: #7c838e;
}
.tsb.done text {
  fill: #fff;
}
.tsb.cur circle.v {
  fill: var(--blue);
  stroke: var(--blue);
}
.tsb.cur text {
  fill: #fff;
}
.tsb:hover circle.v {
  stroke: var(--blue);
}
/* ===== Разделы: Карта / Таймлайн / Сеть / Список ===== */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--panel);
  border-radius: 10px;
  margin-left: 4px;
}
.tabs button {
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink2);
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s,
    box-shadow 0.12s;
}
.tabs button:hover {
  color: var(--ink);
}
.tabs button[aria-selected='true'] {
  background: #fff;
  color: var(--ink);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 3px rgba(20, 22, 26, 0.06);
}
body:not([data-tab='map']) #cv,
body:not([data-tab='map']) .hints,
body:not([data-tab='map']) .mini,
body:not([data-tab='map']) .ctrls {
  display: none;
}
.vw {
  position: absolute;
  inset: 0;
  display: none;
  background: var(--bg);
  padding: 14px 18px;
}
body[data-tab='timeline'] #v-timeline,
body[data-tab='net'] #v-net {
  display: block;
}
body[data-tab='list'] #v-list {
  display: flex;
  flex-direction: column;
}
.nonet {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 420px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink2);
  line-height: 1.45;
  text-align: center;
}
.nonet[hidden] {
  display: none;
}
.vs {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}
.it {
  transition:
    opacity 0.18s var(--ease-out),
    filter 0.18s var(--ease-out);
}
.vw.dim .it:not(.on) {
  opacity: 0.3;
  filter: grayscale(1);
}
.vw.dimS .it:not(.on) {
  opacity: 0.12;
}
/* таймлайн: стек слоёв */
.fcol {
  fill: #fffbf3;
  stroke: var(--amber);
  stroke-dasharray: 5 4;
  stroke-width: 1.2;
}
.vtk {
  font-size: 12px;
  fill: #8a909a;
}
.fch {
  font-size: 12px;
  font-weight: 600;
  fill: #975a05;
}
.lnm {
  font-size: 13px;
  font-weight: 600;
  fill: var(--ink);
}
.lst {
  font-size: 12px;
  font-weight: 600;
}
.lsd {
  font-size: 12px;
  fill: var(--mute);
}
.lst[data-s='bad'] {
  fill: #b4161c;
}
.lst[data-s='new'] {
  fill: #975a05;
}
.lst[data-s='ok'] {
  fill: #14724a;
}
.lst[data-s='off'] {
  fill: var(--mute);
}
.ltile[data-s='off'] rect {
  fill: var(--panel);
}
.ltile[data-s='off'] use {
  color: var(--mute);
}
.ltile[data-s='bad'] rect {
  fill: var(--red2);
}
.ltile[data-s='bad'] use {
  color: var(--red);
}
.ltile[data-s='new'] rect {
  fill: var(--amber2);
}
.ltile[data-s='new'] use {
  color: #b86d05;
}
.ltile[data-s='ok'] rect {
  fill: var(--green2);
}
.ltile[data-s='ok'] use {
  color: var(--green);
}
.tm2 {
  cursor: pointer;
}
.tm2 .hit {
  fill: transparent;
}
.tm2 .lb {
  font-size: 12px;
  fill: var(--ink2);
  paint-order: stroke;
  stroke: #f2f3f6;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.tm2:hover .lb {
  fill: var(--ink);
}
.tm2 .rg {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  opacity: 0;
}
.tm2.sel .rg,
.tm2.cur .rg {
  opacity: 1;
}
.tm2.cur .lb,
.tm2.sel .lb {
  fill: var(--ink);
  font-weight: 600;
}
.lk {
  fill: none;
  stroke: #e86a6f;
  stroke-width: 1.5;
  stroke-opacity: 0.55;
}
.lk.cur {
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-opacity: 1;
}
.bcn {
  fill: none;
  stroke: #e86a6f;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.fc {
  cursor: pointer;
}
.fc .hit {
  fill: transparent;
}
/* широкая невидимая полоса под линией соединения — по ней легко попасть мышью */
.edge .hit {
  fill: none;
  stroke: transparent;
  stroke-width: 28px;
  cursor: pointer;
}
.fc circle {
  fill: #fff;
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-dasharray: 2.5 2;
}
.fc .ft1 {
  font-size: 12.5px;
  font-weight: 600;
  fill: var(--ink);
}
.fc .ft2 {
  font-size: 12px;
  fill: #975a05;
}
.fc:hover .ft1 {
  text-decoration: underline;
}
/* сеть */
.ncap {
  font-size: 12px;
  font-weight: 600;
  fill: #8a909a;
  letter-spacing: 0.02em;
}
.nlb {
  font-size: 12px;
  fill: var(--ink2);
  paint-order: stroke;
  stroke: #f2f3f6;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.vnb {
  display: none;
}
.vnb.show {
  display: inline;
}
/* список */
.lbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 10px;
  color: var(--ink2);
  font-size: 12.5px;
}
.lbar b {
  color: var(--ink);
  font-weight: 600;
}
.ltab {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.lgrid {
  display: grid;
  grid-template-columns: 32px 84px 124px minmax(0, 1fr) minmax(0, 1.5fr) 190px;
  align-items: center;
  column-gap: 12px;
  padding: 0 14px;
}
.lhd {
  flex: none;
  height: 36px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mute);
  border-bottom: 1px solid var(--line);
}
.lbody {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.lr {
  width: 100%;
  height: 36px;
  text-align: left;
  border-bottom: 1px solid #f0f1f4;
  transition:
    opacity 0.18s var(--ease-out),
    filter 0.18s var(--ease-out),
    background 0.12s;
}
.lr:hover {
  background: var(--panel);
}
.lr.sel,
.lr.cur {
  background: var(--blue2);
}
.lr .sn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #c3c7ce;
  color: var(--ink2);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lr.done .sn {
  background: #7c838e;
  border-color: #7c838e;
  color: #fff;
}
.lr.cur .sn {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.lr .tmc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink2);
}
.lr .ty {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.lr .ty .mt {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.lr .ty .mt svg {
  width: 13px;
  height: 13px;
}
.lr .pr {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 600;
}
.lr .pr .x,
.lr .tg {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.lr .rep {
  flex: none;
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 7px;
}
.lr .tg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink2);
}
.lr .mkc {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.lr .mkc .pill-s {
  margin: 0;
  flex: none;
}
.lr .mkc .m {
  font-size: 12px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* восстановление состояния по ссылке — без переходов */
.instant *,
.instant *::before {
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    animation: none !important;
  }
  .edge .fl {
    display: none;
  }
}
/* ошибка загрузки данных */
.boot-err {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 22, 26, 0.1);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.45;
  z-index: 30;
}
.boot-err b {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}
/* переключатель пода в шапке: выглядит как имя пода, клик по всей ширине */
#crSel {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  max-width: 260px;
  height: 32px;
  padding: 0 26px 0 8px;
  margin-left: -8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b727d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}
#crSel:hover {
  background-color: var(--panel);
}
#crSel:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
