/* ============================================================
   ИАС «Матрёшка» — Демонстрационная админ-панель
   Дизайн-система: тёмный «кибер/разведка» стиль
   Бренд: чёрный фон + неоново-зелёный акцент
   ============================================================ */

:root {
  /* Палитра */
  --bg-0: #05070a;          /* самый тёмный фон */
  --bg-1: #0a0e13;          /* фон приложения */
  --bg-2: #0f151c;          /* карточки */
  --bg-3: #141c25;          /* поднятые панели */
  --bg-4: #1b2530;          /* hover */
  --line: #1e2a36;          /* границы */
  --line-soft: #172029;

  --green: #7ffa5a;         /* основной неоновый акцент */
  --green-2: #5fe23c;
  --green-dim: #3d7f2e;
  --green-glow: rgba(127, 250, 90, 0.35);

  --cyan: #38e1ff;
  --amber: #ffb14e;
  --red: #ff5c6c;
  --violet: #9d7bff;
  --blue: #4e9bff;

  --txt-0: #eaf3ec;         /* основной текст */
  --txt-1: #9db0a6;         /* вторичный */
  --txt-2: #5f7267;         /* приглушённый */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  --sidebar-w: 262px;
  --topbar-h: 62px;
  --mono: "JetBrains Mono", "SF Mono", "Consolas", monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg-1);
  color: var(--txt-0);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Фоновая сетка/градиент */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(127, 250, 90, 0.07), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(56, 225, 255, 0.05), transparent 55%),
    linear-gradient(transparent 96%, rgba(127, 250, 90, 0.03) 100%),
    linear-gradient(90deg, transparent 96%, rgba(127, 250, 90, 0.03) 100%);
  background-size: 100% 100%, 100% 100%, 34px 34px, 34px 34px;
  pointer-events: none;
  z-index: 0;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1d2732; border-radius: 10px; border: 2px solid var(--bg-1); }
::-webkit-scrollbar-thumb:hover { background: #2a3846; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, #0b1016, #070a0e);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand img { height: 30px; width: auto; filter: drop-shadow(0 0 8px var(--green-glow)); }
.brand .bt { display: flex; flex-direction: column; line-height: 1.05; }
.brand .bt b { font-size: 16px; letter-spacing: 0.5px; color: var(--txt-0); }
.brand .bt span { font-size: 9.5px; color: var(--green); letter-spacing: 2.5px; text-transform: uppercase; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 24px;
}
.nav-group { margin-top: 16px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group h6 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--txt-2);
  padding: 6px 12px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--txt-1);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: all 0.15s;
  user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--bg-3); color: var(--txt-0); }
.nav-item.active { background: linear-gradient(90deg, rgba(127,250,90,0.14), rgba(127,250,90,0.02)); color: var(--green); }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--green); border-radius: 0 3px 3px 0; box-shadow: 0 0 10px var(--green);
}
.nav-item .badge {
  margin-left: auto; font-size: 10px; font-family: var(--mono);
  background: var(--bg-4); color: var(--txt-1); padding: 1px 7px; border-radius: 20px;
}
.nav-item .badge.alert { background: rgba(255,92,108,0.15); color: var(--red); }
.nav-item .badge.ok { background: rgba(127,250,90,0.13); color: var(--green); }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  flex-shrink: 0;
}
.env-pill {
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--txt-1);
  font-family: var(--mono);
}
.env-pill b { color: var(--green); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: rgba(10, 14, 19, 0.75);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.crumb { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt-1); }
.crumb .pg { color: var(--txt-0); font-weight: 600; font-size: 15px; }
.crumb svg { width: 15px; height: 15px; color: var(--txt-2); }

.search {
  margin-left: 10px;
  flex: 1;
  min-width: 0;
  max-width: 340px;
  display: flex; align-items: center; gap: 9px;

  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 13px;
  color: var(--txt-2);
}
.search svg { width: 16px; height: 16px; flex-shrink: 0; }
.search input {
  background: none; border: none; outline: none; color: var(--txt-0);
  flex: 1; font-size: 13px; font-family: var(--sans); min-width: 0;
}
.search kbd {
  font-family: var(--mono); font-size: 10px; color: var(--txt-2);
  background: var(--bg-4); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--txt-1); display: grid; place-items: center;
  cursor: pointer; position: relative; transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-4); color: var(--green); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 6px;
  border: 1px solid var(--line); border-radius: 30px; background: var(--bg-2); cursor: pointer;
}
.user-chip:hover { background: var(--bg-4); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #04120a; font-weight: 700; display: grid; place-items: center; font-size: 12px;
}
.user-chip .un { font-size: 12.5px; font-weight: 600; line-height: 1.15; }
.user-chip .ur { font-size: 10.5px; color: var(--green); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 26px 60px;
}
.page { animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.page-head h1 svg { width: 24px; height: 24px; vertical-align: -4px; color: var(--green); }
.page-head p { color: var(--txt-1); font-size: 13px; margin-top: 3px; max-width: 640px; }
.head-actions { display: flex; gap: 9px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--txt-0);
  cursor: pointer; transition: all 0.15s; font-family: var(--sans); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--bg-4); border-color: #2b3a48; }
.btn.primary { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #041207; border-color: transparent; box-shadow: 0 6px 18px rgba(127,250,90,0.22); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
@media (max-width: 1300px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2,1fr);} }

.card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.card-head h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 11.5px; color: var(--txt-2); font-weight: 400; }
.card-head svg { width: 16px; height: 16px; color: var(--txt-2); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.kpi .ico svg { width: 20px; height: 20px; }
.kpi .val { font-size: 27px; font-weight: 700; letter-spacing: -0.5px; font-family: var(--mono); }
.kpi .lbl { font-size: 12.5px; color: var(--txt-1); }
.kpi .trend { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.trend.flat { color: var(--txt-2); }
.tint-green { background: rgba(127,250,90,0.12); color: var(--green); }
.tint-cyan  { background: rgba(56,225,255,0.12); color: var(--cyan); }
.tint-amber { background: rgba(255,177,78,0.12); color: var(--amber); }
.tint-violet{ background: rgba(157,123,255,0.12); color: var(--violet); }
.tint-red   { background: rgba(255,92,108,0.12); color: var(--red); }
.tint-blue  { background: rgba(78,155,255,0.12); color: var(--blue); }

/* Badges / status */
.tag {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono);
  border: 1px solid transparent; white-space: nowrap;
}
.tag .d { width: 6px; height: 6px; border-radius: 50%; }
.tag.green { background: rgba(127,250,90,0.12); color: var(--green); } .tag.green .d { background: var(--green); box-shadow: 0 0 6px var(--green); }
.tag.amber { background: rgba(255,177,78,0.12); color: var(--amber); } .tag.amber .d { background: var(--amber); }
.tag.red   { background: rgba(255,92,108,0.13); color: var(--red); } .tag.red .d { background: var(--red); box-shadow: 0 0 6px var(--red); }
.tag.cyan  { background: rgba(56,225,255,0.12); color: var(--cyan); } .tag.cyan .d { background: var(--cyan); }
.tag.gray  { background: var(--bg-4); color: var(--txt-1); } .tag.gray .d { background: var(--txt-2); }
.tag.violet{ background: rgba(157,123,255,0.13); color: var(--violet);} .tag.violet .d{ background: var(--violet);}

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--txt-2); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg-2); z-index: 2;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); color: var(--txt-0); vertical-align: middle; }
table.tbl tbody tr { transition: background 0.12s; }
table.tbl tbody tr:hover { background: var(--bg-3); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.t-main { font-weight: 600; }
.t-sub { font-size: 11.5px; color: var(--txt-2); }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.center { text-align: center; }

/* progress */
.bar { height: 6px; border-radius: 6px; background: var(--bg-4); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--green-dim), var(--green)); }
.bar.cyan > i { background: linear-gradient(90deg, #1b6b7d, var(--cyan)); }
.bar.amber > i { background: linear-gradient(90deg, #7d5a1b, var(--amber)); }
.bar.red > i { background: linear-gradient(90deg, #7d1b28, var(--red)); }
.bar.violet > i { background: linear-gradient(90deg, #4b3a85, var(--violet)); }

/* mini spark */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--green), var(--green-dim)); border-radius: 2px 2px 0 0; opacity: 0.85; min-height: 3px; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.lrow:last-child { border-bottom: none; }
.lrow .li-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.lrow .li-ico svg { width: 18px; height: 18px; }
.lrow .grow { flex: 1; min-width: 0; }
.lrow .t1 { font-size: 13px; font-weight: 600; }
.lrow .t2 { font-size: 11.5px; color: var(--txt-2); }

.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 14px; display: flex; align-items: center; gap: 9px; }
.section-title svg { width: 18px; height: 18px; color: var(--green); }

/* chips filter */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--txt-1); cursor: pointer; transition: all 0.13s; font-weight: 500;
}
.chip:hover { background: var(--bg-4); }
.chip.on { background: rgba(127,250,90,0.14); color: var(--green); border-color: var(--green-dim); }

/* timeline */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--green); }
.tl-item.amber::before { border-color: var(--amber); }
.tl-item.red::before { border-color: var(--red); }
.tl-item.cyan::before { border-color: var(--cyan); }
.tl-item .tt { font-size: 12.5px; font-weight: 600; }
.tl-item .td { font-size: 11.5px; color: var(--txt-1); margin-top: 2px; }
.tl-item .tm { font-size: 10.5px; color: var(--txt-2); font-family: var(--mono); margin-top: 3px; }

/* canvas holders */
.canvas-wrap { position: relative; width: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--txt-1); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .k { width: 10px; height: 10px; border-radius: 3px; }

/* entity card */
.ent-head { display: flex; gap: 16px; align-items: center; }
.ent-ava { width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; font-weight: 700; flex-shrink: 0; }
.attr { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.attr:last-child { border-bottom: none; }
.attr .k { color: var(--txt-2); } .attr .v { font-weight: 600; }

/* risk meter */
.risk-ring { --p: 0; width: 92px; height: 92px; border-radius: 50%;
  background: conic-gradient(var(--rc, var(--green)) calc(var(--p)*1%), var(--bg-4) 0);
  display: grid; place-items: center; position: relative; }
.risk-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--bg-2); }
.risk-ring b { position: relative; font-size: 22px; font-family: var(--mono); }

/* toggles */
.switch { width: 40px; height: 22px; border-radius: 20px; background: var(--bg-4); position: relative; cursor: pointer; transition: 0.2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--txt-1); transition: 0.2s; }
.switch.on { background: var(--green-dim); }
.switch.on::after { left: 21px; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* log console */
.console { font-family: var(--mono); font-size: 12px; background: #04070a; border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 340px; overflow-y: auto; }
.console .ln { display: flex; gap: 10px; padding: 2px 0; white-space: nowrap; }
.console .tm { color: var(--txt-2); }
.console .lv { font-weight: 700; }
.lv.INFO { color: var(--cyan); } .lv.WARN { color: var(--amber); } .lv.ERROR { color: var(--red); } .lv.OK { color: var(--green); } .lv.DEBUG{color:var(--txt-2);}
.console .msg { color: var(--txt-1); white-space: pre-wrap; }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-3); border: 1px solid var(--green-dim); border-left: 3px solid var(--green); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; min-width: 260px; animation: slidein 0.3s; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(3,5,8,0.7); backdrop-filter: blur(3px); z-index: 500; display: grid; place-items: center; animation: fade 0.2s; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); width: min(560px, 92vw); box-shadow: var(--shadow); overflow: hidden; }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .mh h3 { font-size: 15px; }
.modal .mb { padding: 20px; max-height: 60vh; overflow-y: auto; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--txt-1); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; color: var(--txt-0); font-size: 13px; font-family: var(--sans); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-dim); }

.hl { color: var(--green); }
.dim { color: var(--txt-2); }
.nowrap { white-space: nowrap; }
.flexrow { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-s { gap: 6px; } .gap-m { gap: 12px; }
.mt-s { margin-top: 8px; } .mt-m { margin-top: 16px; } .mt-l { margin-top: 26px; }
.wrap { flex-wrap: wrap; }

/* source/adapter cards */
.adp { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: all .15s; }
.adp:hover { border-color: var(--green-dim); transform: translateY(-2px); }
.adp .ah { display: flex; align-items: center; gap: 12px; }
.adp .aico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.adp .aico svg { width: 22px; height: 22px; }
.adp .stat { display: flex; justify-content: space-between; font-size: 12px; }
.adp .stat .k { color: var(--txt-2); }

.mini-metric { display: flex; flex-direction: column; gap: 3px; }
.mini-metric .mv { font-size: 18px; font-weight: 700; font-family: var(--mono); }
.mini-metric .mk { font-size: 11px; color: var(--txt-2); }

.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 1200px){ .two-col { grid-template-columns: 1fr; } }

.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green-glow); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 var(--green-glow);} 70%{box-shadow:0 0 0 8px transparent;} 100%{box-shadow:0 0 0 0 transparent;} }

.pill-nav { display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.pill-nav button { border: none; background: none; color: var(--txt-1); padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 12.5px; font-weight: 600; font-family: var(--sans); }
.pill-nav button.on { background: var(--bg-4); color: var(--green); }

.node-tip { position: absolute; pointer-events: none; background: var(--bg-3); border: 1px solid var(--green-dim); border-radius: 8px; padding: 8px 11px; font-size: 12px; box-shadow: var(--shadow); z-index: 20; display: none; max-width: 240px; }
.node-tip b { color: var(--green); }

.overflow-x { overflow-x: auto; }
.h-scroll { max-height: 420px; overflow-y: auto; }

.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline .si b { font-size: 19px; font-family: var(--mono); display: block; }
.stat-inline .si span { font-size: 11px; color: var(--txt-2); }

/* ---------- Архитектура (послойная схема) ---------- */
.arch { display: flex; flex-direction: column; }
.arch-layer { display: flex; align-items: center; gap: 18px; padding: 6px 0; }
.arch-side { display: flex; align-items: center; gap: 12px; min-width: 260px; border-left: 3px solid var(--green-dim); padding: 10px 14px; background: var(--bg-1); border-radius: 0 10px 10px 0; }
.arch-num { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.arch-flow { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.arch-chip { font-size: 12px; font-family: var(--mono); padding: 6px 11px; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--line); color: var(--txt-0); }
.arch-arrow { color: var(--green); font-weight: 700; opacity: 0.6; }
.arch-connector { height: 14px; width: 2px; background: linear-gradient(var(--green-dim), transparent); margin-left: 130px; }
@media (max-width: 1100px) { .arch-layer { flex-direction: column; align-items: stretch; } .arch-connector { display: none; } }

/* ============================================================
   3D ГРАФ СВЯЗЕЙ — killer-вкладка
   ============================================================ */
.g3d-layout {
  display: grid;
  grid-template-columns: 250px 1fr 320px;
  gap: 14px;
  align-items: start;
}
@media (max-width: 1500px) { .g3d-layout { grid-template-columns: 230px 1fr; } .g3d-layout > #g3d-panel { grid-column: 1 / -1; } }
@media (max-width: 1100px) { .g3d-layout { grid-template-columns: 1fr; } }

.g3d-side { display: flex; flex-direction: column; }

.g3d-stage {
  height: calc(100vh - 210px);
  min-height: 620px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(800px 600px at 50% 45%, rgba(127,250,90,0.07), transparent 70%),
    #04070a;
  border-color: var(--green-dim);
}
.g3d-stage.full {
  position: fixed; inset: 0; z-index: 400; height: 100vh; min-height: 0; border-radius: 0;
}
.g3d-stage canvas { position: relative; z-index: 1; }


.g3d-legend {
  position: absolute; top: 12px; left: 14px; z-index: 5;
  background: rgba(6,10,14,0.6); padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.g3d-stat {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  padding: 7px 12px; background: rgba(6,10,14,0.6); backdrop-filter: blur(6px);
}
.g3d-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 5;
  font-size: 11.5px; color: var(--txt-1); background: rgba(6,10,14,0.72);
  padding: 8px 15px; border-radius: 20px; border: 1px solid var(--line);
  display: inline-flex; align-items: center; gap: 8px; backdrop-filter: blur(6px); white-space: nowrap;
}
.g3d-hint svg { width: 15px; height: 15px; color: var(--green); }

.g3d-search {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
  width: min(360px, 60%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(6,10,14,0.82); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; backdrop-filter: blur(8px);
}
.g3d-search svg { width: 16px; height: 16px; color: var(--txt-2); }
.g3d-search input { flex: 1; background: none; border: none; outline: none; color: var(--txt-0); font-size: 13px; font-family: var(--sans); }
.g3d-suggest {
  display: none; position: absolute; top: 46px; left: 0; right: 0;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.g3d-sg-item { display: flex; align-items: center; gap: 9px; padding: 9px 13px; font-size: 12.5px; cursor: pointer; }
.g3d-sg-item:hover { background: var(--bg-4); color: var(--green); }
.g3d-sg-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.g3d-range {
  width: 100%; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px;
  background: var(--bg-4); outline: none; margin: 8px 0 4px;
}
.g3d-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--green); cursor: pointer; box-shadow: 0 0 8px var(--green-glow); border: 2px solid #04120a;
}
.g3d-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--green); cursor: pointer; border: 2px solid #04120a; }

/* онбординг-подсказка */
.hint-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  background: linear-gradient(90deg, rgba(127,250,90,0.1), rgba(127,250,90,0.02));
  border: 1px solid var(--green-dim); border-radius: var(--radius); font-size: 13px; color: var(--txt-0);
}
.hint-banner svg { width: 20px; height: 20px; color: var(--green); flex-shrink: 0; }
.hint-banner .x { margin-left: auto; cursor: pointer; color: var(--txt-2); }
.hint-banner .x:hover { color: var(--txt-0); }

/* ============================================================
   ИИ-ЧАТ-КОНСУЛЬТАНТ («Матрёшка·Ассистент») — плавающее окно
   ============================================================ */
.chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 800;
  width: 58px; height: 58px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  display: grid; place-items: center; color: #041207;
  box-shadow: 0 8px 26px rgba(127,250,90,0.4); border: none;
  transition: transform 0.2s;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab .fab-dot {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--bg-1); font-family: var(--mono);
}
.chat-fab .ring { position: absolute; inset: 0; border-radius: 50%; animation: pulse 2.4s infinite; box-shadow: 0 0 0 0 var(--green-glow); }

.chat-win {
  position: fixed; bottom: 24px; right: 24px; z-index: 801;
  width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 48px);
  background: var(--bg-2); border: 1px solid var(--green-dim); border-radius: 16px;
  box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden;
  animation: chatIn 0.28s cubic-bezier(.2,.8,.3,1);
}
.chat-win.open { display: flex; }
@keyframes chatIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }

.chat-head {
  display: flex; align-items: center; gap: 11px; padding: 13px 15px;
  background: linear-gradient(135deg, rgba(127,250,90,0.14), rgba(127,250,90,0.03));
  border-bottom: 1px solid var(--line);
}
.chat-head .cava {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green), var(--cyan)); color: #041207;
  display: grid; place-items: center;
}
.chat-head .cava svg { width: 22px; height: 22px; }
.chat-head .ci b { font-size: 14px; display: block; }
.chat-head .ci span { font-size: 11px; color: var(--green); display: inline-flex; align-items: center; gap: 5px; }
.chat-head .cx { margin-left: auto; cursor: pointer; color: var(--txt-1); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.chat-head .cx:hover { background: var(--bg-4); color: var(--txt-0); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg-row { display: flex; gap: 9px; max-width: 90%; }
.msg-row.bot { align-self: flex-start; }
.msg-row.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-ava { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; }
.msg-ava svg { width: 16px; height: 16px; }
.msg-ava.bot { background: rgba(127,250,90,0.14); color: var(--green); }
.msg-ava.me { background: linear-gradient(135deg, var(--green), var(--cyan)); color: #041207; font-size: 11px; font-weight: 700; }
.bubble { padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.55; }
.msg-row.bot .bubble { background: var(--bg-3); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg-row.me .bubble { background: linear-gradient(135deg, var(--green-dim), #2e6122); color: #eafff0; border-top-right-radius: 4px; }
.bubble .cite { color: var(--green); font-family: var(--mono); font-size: 11px; }
.bubble b { color: var(--green); }

.chat-typing { display: inline-flex; gap: 4px; align-items: center; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: typing 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: 0.2s; }
.chat-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-sugg { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px 10px; }
.chat-sugg .s {
  font-size: 11.5px; padding: 6px 11px; border-radius: 16px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--txt-1); transition: all 0.13s;
}
.chat-sugg .s:hover { border-color: var(--green-dim); color: var(--green); }

.chat-input {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line);
  background: var(--bg-1);
}
.chat-input input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 22px;
  padding: 10px 15px; color: var(--txt-0); font-size: 13px; outline: none; font-family: var(--sans);
}
.chat-input input:focus { border-color: var(--green-dim); }
.chat-send {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; cursor: pointer; border: none;
  background: linear-gradient(135deg, var(--green), var(--green-2)); color: #041207;
  display: grid; place-items: center;
}
.chat-send svg { width: 18px; height: 18px; }

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ДЕМО / РЕАЛЬНЫЕ ДАННЫЕ (в топбаре)
   ============================================================ */
.mode-switch {
  position: relative; display: inline-flex; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 3px; cursor: pointer; user-select: none; height: 32px; flex-shrink: 0;
}
.mode-switch .ms-opt {
  position: relative; z-index: 2; font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px;
  padding: 0 12px; height: 26px; display: grid; place-items: center; color: var(--txt-2);
  transition: color 0.2s; font-family: var(--mono);
}
.mode-switch .ms-opt.on { color: #041207; }
.mode-switch .ms-thumb {
  position: absolute; top: 3px; left: 3px; height: 26px; width: calc(50% - 3px);
  border-radius: 20px; background: linear-gradient(135deg, var(--green), var(--green-2));
  transition: transform 0.25s cubic-bezier(.3,.8,.3,1); z-index: 1;
  box-shadow: 0 2px 8px var(--green-glow);
}
.mode-switch.real .ms-thumb { transform: translateX(100%); background: linear-gradient(135deg, var(--cyan), var(--blue)); }

/* ============================================================
   ИИ НОВОСТИ
   ============================================================ */
.news-item { transition: border-color 0.15s, transform 0.15s; }
.news-item:hover { border-color: var(--green-dim); transform: translateY(-2px); }
.news-title { font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -0.2px; }






/* ============================================================
     ()
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg-0);
  transition: opacity .25s ease;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 20% 10%, rgba(127,250,90,.10), transparent 60%),
    radial-gradient(700px 500px at 85% 90%, rgba(56,225,255,.08), transparent 60%),
    linear-gradient(180deg, #05070a, #0a0e13);
}
.login-bg::after {
  content: " \; position: absolute; inset: 0;
 background-image:
 linear-gradient(rgba(30,42,54,.35) 1px, transparent 1px),
 linear-gradient(90deg, rgba(30,42,54,.35) 1px, transparent 1px);
 background-size: 46px 46px;
 mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 75%);
}
.login-card {
 position: relative; z-index: 2;
 width: 380px; max-width: calc(100vw - 40px);
 background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
 border: 1px solid var(--line);
 border-radius: 18px;
 padding: 30px 30px 24px;
 box-shadow: var(--shadow), 0 0 0 1px rgba(127,250,90,.05);
}
.login-card.shake { animation: loginShake .4s; }
@keyframes loginShake {
 0%,100% { transform: translateX(0); }
 20%,60% { transform: translateX(-7px); }
 40%,80% { transform: translateX(7px); }
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand img { width: 40px; height: 40px; border-radius: 10px; }
.login-brand b { display: block; font-size: 16px; letter-spacing: 2px; color: var(--txt-0); }
.login-brand span { font-size: 11px; color: var(--txt-2); letter-spacing: .5px; }
.login-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 12.5px; color: var(--txt-1); margin-bottom: 22px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; color: var(--txt-1); margin-bottom: 6px; }
.login-field input {
 width: 100%; padding: 11px 13px;
 background: var(--bg-1); border: 1px solid var(--line);
 border-radius: 10px; color: var(--txt-0); font-family: var(--sans); font-size: 14px;
 transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
 outline: none; border-color: var(--green-dim);
 box-shadow: 0 0 0 3px rgba(127,250,90,.12);
}
.login-remember {
 display: flex; align-items: center; gap: 8px;
 font-size: 12.5px; color: var(--txt-1); margin: 4px 0 16px; cursor: pointer;
}
.login-remember input { accent-color: var(--green); width: 15px; height: 15px; }
.login-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.login-foot {
 margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft);
 font-size: 11.5px; color: var(--txt-2); display: flex; align-items: center; gap: 8px;
}
.user-chip .logout-btn { opacity: .6; }
.user-chip .logout-btn:hover { opacity: 1; color: var(--red); }
